[Libreoffice-commits] core.git: include/svx svx/AllLangResTarget_svx.mk svx/Library_svxcore.mk svx/source sw/source sw/uiconfig
Susobhan Ghosh
susobhang70 at gmail.com
Mon Aug 29 13:18:35 UTC 2016
include/svx/dialogs.hrc | 3 +
include/svx/samecontentlistbox.hxx | 35 +++++++++++++++++++
svx/AllLangResTarget_svx.mk | 1
svx/Library_svxcore.mk | 1
svx/source/dialog/samecontent.src | 12 ++++++
svx/source/dialog/samecontentlistbox.cxx | 48 +++++++++++++++++++++++++++
sw/source/uibase/sidebar/PageFooterPanel.hxx | 3 +
sw/source/uibase/sidebar/PageHeaderPanel.hxx | 3 +
sw/uiconfig/swriter/ui/pagefooterpanel.ui | 11 ------
sw/uiconfig/swriter/ui/pageheaderpanel.ui | 11 ------
10 files changed, 105 insertions(+), 23 deletions(-)
New commits:
commit 8393d4642273bfb3eb0cd0b68157e2b8674b70df
Author: Susobhan Ghosh <susobhang70 at gmail.com>
Date: Thu Aug 18 18:51:58 2016 +0530
tdf#83830: Use samecontentlistbox in Header/Footer Panel
Change-Id: Ib24f6e6ac91859467f105c4db9b094454443ff9d
Reviewed-on: https://gerrit.libreoffice.org/28218
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc
index c7eb352..68d27d3 100644
--- a/include/svx/dialogs.hrc
+++ b/include/svx/dialogs.hrc
@@ -1085,9 +1085,10 @@
#define RID_SVXSTRARY_PAPERSIZE_DRAW (RID_SVX_START + 1396)
#define RID_SVXSTRARY_PAGE_NUMBERING (RID_SVX_START + 1397)
#define RID_SVXSTRARY_SPACING (RID_SVX_START + 1398)
+#define RID_SVXSTRARY_SAMECONTENT (RID_SVX_START + 1399)
// !!! IMPORTANT: consider and update RID_SVXSTR_NEXTFREE when introducing new RIDs for Strings !!!
-#define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1399)
+#define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1400)
// if we have _a_lot_ time, we should group the resource ids by type, instead
// of grouping them by semantics. The reason is that resource ids have to be
diff --git a/include/svx/samecontentlistbox.hxx b/include/svx/samecontentlistbox.hxx
new file mode 100644
index 0000000..576ebdf
--- /dev/null
+++ b/include/svx/samecontentlistbox.hxx
@@ -0,0 +1,35 @@
+/* -*- 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_SVX_SAMECONTENTLISTBOXHELPER_HXX
+#define INCLUDED_SVX_SAMECONTENTLISTBOXHELPER_HXX
+
+#include <svx/svxdllapi.h>
+#include <vcl/lstbox.hxx>
+
+/// Custom Widget ListBox to hold entries for SameContent setting of Header/Footer
+class SVX_DLLPUBLIC SameContentListBox : public ListBox
+{
+public:
+ SameContentListBox( vcl::Window* pParent, WinBits nBits = WB_BORDER | WB_DROPDOWN );
+ Size GetOptimalSize() const override;
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/svx/AllLangResTarget_svx.mk b/svx/AllLangResTarget_svx.mk
index c7ee81f..c56a5ce 100644
--- a/svx/AllLangResTarget_svx.mk
+++ b/svx/AllLangResTarget_svx.mk
@@ -50,6 +50,7 @@ $(eval $(call gb_SrsTarget_add_files,svx/res,\
svx/source/dialog/prtqry.src \
svx/source/dialog/ruler.src \
svx/source/dialog/spacing.src \
+ svx/source/dialog/samecontent.src \
svx/source/dialog/sdstring.src \
svx/source/dialog/srchdlg.src \
svx/source/dialog/svxbmpnumvalueset.src \
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 228c8f3..a3fdf02 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -120,6 +120,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
svx/source/dialog/langbox \
svx/source/dialog/pagenumberlistbox \
svx/source/dialog/papersizelistbox \
+ svx/source/dialog/samecontentlistbox \
svx/source/dialog/spacinglistbox \
svx/source/dialog/stddlg \
svx/source/dialog/svxdlg \
diff --git a/svx/source/dialog/samecontent.src b/svx/source/dialog/samecontent.src
new file mode 100644
index 0000000..38666d4
--- /dev/null
+++ b/svx/source/dialog/samecontent.src
@@ -0,0 +1,12 @@
+#include <svx/dialogs.hrc>
+
+StringArray RID_SVXSTRARY_SAMECONTENT
+{
+ ItemList [ en-US ] =
+ {
+ < "All Pages" ; 0; > ;
+ < "First Page" ; 1; > ;
+ < "Left and Right Pages" ; 2; > ;
+ < "First, Left and Right Pages" ; 3; > ;
+ };
+};
\ No newline at end of file
diff --git a/svx/source/dialog/samecontentlistbox.cxx b/svx/source/dialog/samecontentlistbox.cxx
new file mode 100644
index 0000000..83f42b2
--- /dev/null
+++ b/svx/source/dialog/samecontentlistbox.cxx
@@ -0,0 +1,48 @@
+/* -*- 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 <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <svx/samecontentlistbox.hxx>
+#include <tools/resary.hxx>
+#include <vcl/builderfactory.hxx>
+
+SameContentListBox::SameContentListBox(vcl::Window* pParent, WinBits nStyle)
+ : ListBox( pParent, nStyle)
+{
+ ResStringArray aSameContentAry( SVX_RES( RID_SVXSTRARY_SAMECONTENT ) );
+ sal_uInt32 nCnt = aSameContentAry.Count();
+
+ for ( sal_uInt32 i = 0; i < nCnt; ++i )
+ {
+ OUString aStr = aSameContentAry.GetString(i);
+ sal_uInt16 nData = aSameContentAry.GetValue(i);
+ sal_Int32 nPos = InsertEntry( aStr );
+ SetEntryData( nPos, reinterpret_cast<void*>((sal_uLong)nData) );
+ }
+ SetDropDownLineCount(8);
+ SelectEntryPos(0);
+}
+
+VCL_BUILDER_FACTORY(SameContentListBox);
+
+Size SameContentListBox::GetOptimalSize() const
+{
+ return Size(150, ListBox::GetOptimalSize().Height());
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/sidebar/PageFooterPanel.hxx b/sw/source/uibase/sidebar/PageFooterPanel.hxx
index 10d6459..adc6479 100644
--- a/sw/source/uibase/sidebar/PageFooterPanel.hxx
+++ b/sw/source/uibase/sidebar/PageFooterPanel.hxx
@@ -44,6 +44,7 @@
#include <svl/poolitem.hxx>
#include <svl/eitem.hxx>
#include <svx/spacinglistbox.hxx>
+#include <svx/samecontentlistbox.hxx>
namespace sw { namespace sidebar {
@@ -83,7 +84,7 @@ private:
VclPtr<CheckBox> mpFooterToggle;
VclPtr<SpacingListBox> mpFooterSpacingLB;
VclPtr<SpacingListBox> mpFooterMarginPresetLB;
- VclPtr<ListBox> mpFooterLayoutLB;
+ VclPtr<SameContentListBox> mpFooterLayoutLB;
VclPtr<FixedText> mpCustomEntry;
OUString aCustomEntry;
diff --git a/sw/source/uibase/sidebar/PageHeaderPanel.hxx b/sw/source/uibase/sidebar/PageHeaderPanel.hxx
index 2cfde07..754fbc4 100644
--- a/sw/source/uibase/sidebar/PageHeaderPanel.hxx
+++ b/sw/source/uibase/sidebar/PageHeaderPanel.hxx
@@ -44,6 +44,7 @@
#include <svl/poolitem.hxx>
#include <svl/eitem.hxx>
#include <svx/spacinglistbox.hxx>
+#include <svx/samecontentlistbox.hxx>
namespace sw { namespace sidebar {
@@ -83,7 +84,7 @@ private:
VclPtr<CheckBox> mpHeaderToggle;
VclPtr<SpacingListBox> mpHeaderSpacingLB;
VclPtr<SpacingListBox> mpHeaderMarginPresetLB;
- VclPtr<ListBox> mpHeaderLayoutLB;
+ VclPtr<SameContentListBox> mpHeaderLayoutLB;
VclPtr<FixedText> mpCustomEntry;
OUString aCustomEntry;
diff --git a/sw/uiconfig/swriter/ui/pagefooterpanel.ui b/sw/uiconfig/swriter/ui/pagefooterpanel.ui
index 0297daf..dc0d3e7 100644
--- a/sw/uiconfig/swriter/ui/pagefooterpanel.ui
+++ b/sw/uiconfig/swriter/ui/pagefooterpanel.ui
@@ -93,7 +93,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
- <property name="model">spacinglist</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -105,7 +104,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
- <property name="model">spacinglist</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -113,17 +111,10 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="samecontentLB">
- <property name="width_request">150</property>
+ <object class="svxcorelo-SameContentListBox" id="samecontentLB">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
- <items>
- <item translatable="yes">All Pages</item>
- <item translatable="yes">First Page</item>
- <item translatable="yes">Left and Right Pages</item>
- <item translatable="yes">First, Left and Right Pages</item>
- </items>
</object>
<packing>
<property name="left_attach">1</property>
diff --git a/sw/uiconfig/swriter/ui/pageheaderpanel.ui b/sw/uiconfig/swriter/ui/pageheaderpanel.ui
index ae0de28..d3a63d0 100644
--- a/sw/uiconfig/swriter/ui/pageheaderpanel.ui
+++ b/sw/uiconfig/swriter/ui/pageheaderpanel.ui
@@ -93,7 +93,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
- <property name="model">spacinglist</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -105,7 +104,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
- <property name="model">spacinglist</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -113,17 +111,10 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="samecontentLB">
- <property name="width_request">150</property>
+ <object class="svxcorelo-SameContentListBox" id="samecontentLB">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
- <items>
- <item translatable="yes">All Pages</item>
- <item translatable="yes">First Page</item>
- <item translatable="yes">Left and Right Pages</item>
- <item translatable="yes">First, Left and Right Pages</item>
- </items>
</object>
<packing>
<property name="left_attach">1</property>
More information about the Libreoffice-commits
mailing list