notebookbar: working number format listbox

Change-Id: I1555934646148b9cd4164cbaaf09dcb9affe861e
Reviewed-on: https://gerrit.libreoffice.org/25579
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
Szymon Kłos
2016-06-01 06:06:55 +00:00
committed by Samuel Mehrbrodt
parent cbf36dd473
commit bf3f3a6bfb
10 changed files with 337 additions and 65 deletions
+2
View File
@@ -380,6 +380,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/app/typemap \
sc/source/ui/app/uiitems \
sc/source/ui/attrdlg/scabstdlg \
sc/source/ui/cctrl/cbnumberformat \
sc/source/ui/cctrl/cbuttonw \
sc/source/ui/cctrl/checklistmenu \
sc/source/ui/cctrl/dpcontrol \
@@ -500,6 +501,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/sidebar/CellAppearancePropertyPanel \
sc/source/ui/sidebar/CellBorderStyleControl \
sc/source/ui/sidebar/CellBorderStylePopup \
sc/source/ui/sidebar/NumberFormatControl \
sc/source/ui/sidebar/NumberFormatPropertyPanel \
sc/source/ui/sidebar/ScPanelFactory \
sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog \
+46
View File
@@ -0,0 +1,46 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_SC_NUMBERFORMATCONTROL_HXX
#define INCLUDED_SC_NUMBERFORMATCONTROL_HXX
#include <scdllapi.h>
#include <sfx2/tbxctrl.hxx>
#include <functional>
namespace sc {
class SC_DLLPUBLIC ScNumberFormatControl : public SfxToolBoxControl
{
public:
SFX_DECL_TOOLBOX_CONTROL();
ScNumberFormatControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
virtual ~ScNumberFormatControl();
virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState) override;
virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) override;
};
} // end of namespace sc
#endif // INCLUDED_SC_NUMBERFORMATCONTROL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+12 -1
View File
@@ -708,7 +708,18 @@
#define STR_FILTER_SELCOUNT 533
#define SC_GLOBSTR_STR_COUNT 534 /**< the count of permanently resident strings */
#define STR_GENERAL 534
#define STR_NUMBER 535
#define STR_PERCENT 536
#define STR_CURRENCY 537
#define STR_DATE 538
#define STR_TIME 539
#define STR_SCIENTIFIC 540
#define STR_FRACTION 541
#define STR_BOOLEAN_VALUE 542
#define STR_TEXT 543
#define SC_GLOBSTR_STR_COUNT 544 /**< the count of permanently resident strings */
#endif
+1 -1
View File
@@ -6600,6 +6600,6 @@ SfxUInt16Item NumberFormatType SID_NUMBER_TYPE_FORMAT
AccelConfig = FALSE,
MenuConfig = FALSE,
ToolBoxConfig = FALSE,
ToolBoxConfig = TRUE,
GroupId = GID_FORMAT;
]
+2
View File
@@ -35,6 +35,7 @@
#include <svx/ParaLineSpacingPopup.hxx>
#include <svx/TextCharacterSpacingPopup.hxx>
#include <svx/TextUnderlinePopup.hxx>
#include <NumberFormatControl.hxx>
#include <svtools/parhtml.hxx>
#include <sot/formats.hxx>
@@ -174,6 +175,7 @@ void ScDLL::Init()
svx::TextCharacterSpacingPopup ::RegisterControl(SID_ATTR_CHAR_KERNING, pMod );
svx::TextUnderlinePopup ::RegisterControl(SID_ATTR_CHAR_UNDERLINE, pMod );
svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH, pMod );
sc::ScNumberFormatControl ::RegisterControl(SID_NUMBER_TYPE_FORMAT, pMod );
SvxGrafModeToolBoxControl ::RegisterControl(SID_ATTR_GRAF_MODE, pMod);
SvxGrafRedToolBoxControl ::RegisterControl(SID_ATTR_GRAF_RED, pMod);
+60
View File
@@ -0,0 +1,60 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <cbnumberformat.hxx>
#include "global.hxx"
#include <globstr.hrc>
#include <sfx2/dispatch.hxx>
#include <svl/intitem.hxx>
#include "sc.hrc"
ScNumberFormat::ScNumberFormat(vcl::Window* pParent, WinBits nStyle) :
ListBox(pParent, nStyle | WB_DROPDOWN|WB_LEFT|WB_VCENTER|WB_BORDER|WB_3DLOOK)
{
SetSelectHdl(LINK(this, ScNumberFormat, NumFormatSelectHdl));
AdaptDropDownLineCountToMaximum();
InsertEntry(ScGlobal::GetRscString(STR_GENERAL));
InsertEntry(ScGlobal::GetRscString(STR_NUMBER));
InsertEntry(ScGlobal::GetRscString(STR_PERCENT));
InsertEntry(ScGlobal::GetRscString(STR_CURRENCY));
InsertEntry(ScGlobal::GetRscString(STR_DATE));
InsertEntry(ScGlobal::GetRscString(STR_TIME));
InsertEntry(ScGlobal::GetRscString(STR_SCIENTIFIC));
InsertEntry(ScGlobal::GetRscString(STR_FRACTION));
InsertEntry(ScGlobal::GetRscString(STR_BOOLEAN_VALUE));
InsertEntry(ScGlobal::GetRscString(STR_TEXT));
}
IMPL_LINK_TYPED(ScNumberFormat, NumFormatSelectHdl, ListBox&, rBox, void)
{
if(SfxViewFrame::Current())
{
SfxDispatcher* pDisp = SfxViewFrame::Current()->GetBindings().GetDispatcher();
if(pDisp)
{
const sal_Int32 nVal = rBox.GetSelectEntryPos();
SfxUInt16Item aItem(SID_NUMBER_TYPE_FORMAT, nVal);
pDisp->ExecuteList(SID_NUMBER_TYPE_FORMAT,
SfxCallMode::RECORD, {&aItem});
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+36
View File
@@ -0,0 +1,36 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_SC_SOURCE_UI_INC_CBNUMBERFORMAT_HXX
#define INCLUDED_SC_SOURCE_UI_INC_CBNUMBERFORMAT_HXX
#include <vcl/lstbox.hxx>
class ScNumberFormat : public ListBox
{
public:
explicit ScNumberFormat(vcl::Window* pParent, WinBits nStyle);
private:
DECL_LINK_TYPED(NumFormatSelectHdl, ListBox&, void);
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -0,0 +1,77 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <NumberFormatControl.hxx>
#include <cbnumberformat.hxx>
#include <svl/intitem.hxx>
#include <svl/stritem.hxx>
#include <vcl/toolbox.hxx>
using namespace sc;
SFX_IMPL_TOOLBOX_CONTROL(ScNumberFormatControl, SfxUInt16Item);
ScNumberFormatControl::ScNumberFormatControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx)
: SfxToolBoxControl(nSlotId, nId, rTbx)
{
}
ScNumberFormatControl::~ScNumberFormatControl()
{
}
void ScNumberFormatControl::StateChanged(sal_uInt16, SfxItemState eState,
const SfxPoolItem* pState)
{
sal_uInt16 nId = GetId();
ToolBox& rTbx = GetToolBox();
ScNumberFormat* pComboBox = static_cast<ScNumberFormat*>(rTbx.GetItemWindow(nId));
DBG_ASSERT( pComboBox, "Control not found!" );
if(SfxItemState::DISABLED == eState)
pComboBox->Disable();
else
pComboBox->Enable();
rTbx.EnableItem(nId, SfxItemState::DISABLED != eState);
switch(eState)
{
case SfxItemState::DEFAULT:
{
const SfxInt16Item* pItem = static_cast<const SfxInt16Item*>(pState);
sal_uInt16 nVal = pItem->GetValue();
pComboBox->SelectEntryPos(nVal);
break;
}
default:
break;
}
}
VclPtr<vcl::Window> ScNumberFormatControl::CreateItemWindow( vcl::Window *pParent )
{
VclPtr<ScNumberFormat> pControl = VclPtr<ScNumberFormat>::Create(pParent, WB_DROPDOWN);
pControl->SetSizePixel(pControl->GetOptimalSize());
return pControl;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+40
View File
@@ -2109,6 +2109,46 @@ Resource RID_GLOBSTR
{
Text [ en-US ] = "%1 and %2 more";
};
String STR_GENERAL
{
Text [ en-US ] = "General";
};
String STR_NUMBER
{
Text [ en-US ] = "Number";
};
String STR_PERCENT
{
Text [ en-US ] = "Percent";
};
String STR_CURRENCY
{
Text [ en-US ] = "Currency";
};
String STR_DATE
{
Text [ en-US ] = "Date";
};
String STR_TIME
{
Text [ en-US ] = "Time";
};
String STR_SCIENTIFIC
{
Text [ en-US ] = "Scientific";
};
String STR_FRACTION
{
Text [ en-US ] = "Fraction";
};
String STR_BOOLEAN_VALUE
{
Text [ en-US ] = "Boolean Value";
};
String STR_TEXT
{
Text [ en-US ] = "Text";
};
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+61 -63
View File
@@ -103,6 +103,51 @@
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_paste.png</property>
</object>
<object class="GtkImage" id="ProtectImg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_protect.png</property>
</object>
<object class="GtkImage" id="SendToBackImg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_sendtoback.png</property>
</object>
<object class="GtkImage" id="SpellDialogImg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_spelldialog.png</property>
</object>
<object class="GtkImage" id="SpellOnlineImg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_spellonline.png</property>
</object>
<object class="GtkImage" id="SplitWindowImg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_splitwindow.png</property>
</object>
<object class="GtkImage" id="ThesaurusDialogImg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_thesaurus.png</property>
</object>
<object class="GtkImage" id="ToggleSheetGridImg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_togglesheetgrid.png</property>
</object>
<object class="GtkImage" id="ToolProtectionDocumentImg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_protect.png</property>
</object>
<object class="GtkImage" id="ZoomImg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_zoom.png</property>
</object>
<object class="GtkGrid" id="NotebookBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -960,25 +1005,23 @@
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkComboBoxText" id="category">
<object class="sfxlo-SidebarToolBox" id="numberformat">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_markup" translatable="yes">Select a category of contents.</property>
<property name="tooltip_text" translatable="yes">Select a category of contents.</property>
<property name="hexpand">True</property>
<items>
<item translatable="yes">General</item>
<item translatable="yes">Number</item>
<item translatable="yes">Percent</item>
<item translatable="yes">Currency</item>
<item translatable="yes">Date </item>
<item translatable="yes">Time</item>
<item translatable="yes">Scientific</item>
<item translatable="yes">Fraction</item>
<item translatable="yes">Boolean Value</item>
<item translatable="yes">Text</item>
</items>
<property name="show_arrow">False</property>
<child>
<object class="GtkToolButton" id="NumberFormatType">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action_name">.uno:NumberFormatType</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
@@ -987,7 +1030,7 @@
</packing>
</child>
<child>
<object class="sfxlo-SidebarToolBox" id="numberformat">
<object class="sfxlo-SidebarToolBox" id="numberformat1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_arrow">False</property>
@@ -2775,49 +2818,4 @@
</packing>
</child>
</object>
<object class="GtkImage" id="ProtectImg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_protect.png</property>
</object>
<object class="GtkImage" id="SendToBackImg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_sendtoback.png</property>
</object>
<object class="GtkImage" id="SpellDialogImg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_spelldialog.png</property>
</object>
<object class="GtkImage" id="SpellOnlineImg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_spellonline.png</property>
</object>
<object class="GtkImage" id="SplitWindowImg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_splitwindow.png</property>
</object>
<object class="GtkImage" id="ThesaurusDialogImg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_thesaurus.png</property>
</object>
<object class="GtkImage" id="ToggleSheetGridImg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_togglesheetgrid.png</property>
</object>
<object class="GtkImage" id="ToolProtectionDocumentImg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_protect.png</property>
</object>
<object class="GtkImage" id="ZoomImg">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_zoom.png</property>
</object>
</interface>