summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2016-05-27 22:36:43 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2016-06-01 06:06:55 +0000
commitbf3f3a6bfb08c2d1a2c95f1c1cf62117e0002235 (patch)
tree43927ef5c4048e9c39abf81722fab2ec9ccc47c8 /sc
parentcbf36dd473fdc9e8d8b78c9e9317836a7cbbc6c7 (diff)
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>
Diffstat (limited to 'sc')
-rw-r--r--sc/Library_sc.mk2
-rw-r--r--sc/inc/NumberFormatControl.hxx46
-rw-r--r--sc/inc/globstr.hrc13
-rw-r--r--sc/sdi/scalc.sdi2
-rw-r--r--sc/source/ui/app/scdll.cxx2
-rw-r--r--sc/source/ui/cctrl/cbnumberformat.cxx60
-rw-r--r--sc/source/ui/inc/cbnumberformat.hxx36
-rw-r--r--sc/source/ui/sidebar/NumberFormatControl.cxx77
-rw-r--r--sc/source/ui/src/globstr.src40
-rw-r--r--sc/uiconfig/scalc/ui/notebookbar.ui124
10 files changed, 337 insertions, 65 deletions
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index bd767cb31c30..892995fa0a80 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -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 \
diff --git a/sc/inc/NumberFormatControl.hxx b/sc/inc/NumberFormatControl.hxx
new file mode 100644
index 000000000000..b7ecb4606399
--- /dev/null
+++ b/sc/inc/NumberFormatControl.hxx
@@ -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: */
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 81e44932d49b..df4369f21838 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -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
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 14169f0757a5..028e703cb054 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -6600,6 +6600,6 @@ SfxUInt16Item NumberFormatType SID_NUMBER_TYPE_FORMAT
AccelConfig = FALSE,
MenuConfig = FALSE,
- ToolBoxConfig = FALSE,
+ ToolBoxConfig = TRUE,
GroupId = GID_FORMAT;
]
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 087477f69c6f..9a14c78ee23f 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -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);
diff --git a/sc/source/ui/cctrl/cbnumberformat.cxx b/sc/source/ui/cctrl/cbnumberformat.cxx
new file mode 100644
index 000000000000..8e4e7c91b674
--- /dev/null
+++ b/sc/source/ui/cctrl/cbnumberformat.cxx
@@ -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: */
diff --git a/sc/source/ui/inc/cbnumberformat.hxx b/sc/source/ui/inc/cbnumberformat.hxx
new file mode 100644
index 000000000000..b52cc94a9d47
--- /dev/null
+++ b/sc/source/ui/inc/cbnumberformat.hxx
@@ -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: */
diff --git a/sc/source/ui/sidebar/NumberFormatControl.cxx b/sc/source/ui/sidebar/NumberFormatControl.cxx
new file mode 100644
index 000000000000..d5cec76da326
--- /dev/null
+++ b/sc/source/ui/sidebar/NumberFormatControl.cxx
@@ -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: */
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index c74373f662b3..08e84c99f2e6 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -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: */
diff --git a/sc/uiconfig/scalc/ui/notebookbar.ui b/sc/uiconfig/scalc/ui/notebookbar.ui
index fb2dbae1eb1e..7c6d70d6f14d 100644
--- a/sc/uiconfig/scalc/ui/notebookbar.ui
+++ b/sc/uiconfig/scalc/ui/notebookbar.ui
@@ -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>