Kaydet (Commit) 6f437466 authored tarafından Susobhan Ghosh's avatar Susobhan Ghosh Kaydeden (comit) Katarina Behrens

tdf#83830: Use SpacingListBox in Header/Footer and Sidebar Wrap Panel

Change-Id: I80ea84b6eaabcf241b313d46695cffdd74174c08
Reviewed-on: https://gerrit.libreoffice.org/28104Reviewed-by: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
Tested-by: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
üst 79f1315a
......@@ -1084,9 +1084,10 @@
#define RID_SVXSTRARY_PAPERSIZE_STD (RID_SVX_START + 1395)
#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)
// !!! IMPORTANT: consider and update RID_SVXSTR_NEXTFREE when introducing new RIDs for Strings !!!
#define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1398)
#define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1399)
// 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
......
/* -*- 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_SPACINGLISTBOXHELPER_HXX
#define INCLUDED_SVX_SPACINGLISTBOXHELPER_HXX
#include <svx/svxdllapi.h>
#include <vcl/lstbox.hxx>
/// Custom Widget ListBox to hold entries for Spacing & Margin settings of Header/Footer
class SVX_DLLPUBLIC SpacingListBox : public ListBox
{
public:
SpacingListBox( vcl::Window* pParent, WinBits nBits = WB_BORDER | WB_DROPDOWN );
Size GetOptimalSize() const override;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -49,6 +49,7 @@ $(eval $(call gb_SrsTarget_add_files,svx/res,\
svx/source/dialog/passwd.src \
svx/source/dialog/prtqry.src \
svx/source/dialog/ruler.src \
svx/source/dialog/spacing.src \
svx/source/dialog/sdstring.src \
svx/source/dialog/srchdlg.src \
svx/source/dialog/svxbmpnumvalueset.src \
......
......@@ -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/spacinglistbox \
svx/source/dialog/stddlg \
svx/source/dialog/svxdlg \
svx/source/dialog/SvxNumOptionsTabPageHelper \
......
#include <svx/dialogs.hrc>
StringArray RID_SVXSTRARY_SPACING
{
ItemList [ en-US ] =
{
< "None" ; 0; > ;
< "Extra Small (1/16\")"; 91; > ;
< "Small (1/8\")"; 181; > ;
< "Small Medium (1/4\")"; 363; > ;
< "Medium (3/8\")"; 539; > ;
< "Medium Large (1/2\")"; 720; > ;
< "Large (3/4\")"; 1077; > ;
< "Extra Large (1\")"; 1440; > ;
};
};
\ No newline at end of file
/* -*- 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/spacinglistbox.hxx>
#include <tools/resary.hxx>
#include <vcl/builderfactory.hxx>
SpacingListBox::SpacingListBox(vcl::Window* pParent, WinBits nStyle)
: ListBox( pParent, nStyle)
{
ResStringArray aSpacingAry( SVX_RES( RID_SVXSTRARY_SPACING ) );
sal_uInt32 nCnt = aSpacingAry.Count();
for ( sal_uInt32 i = 0; i < nCnt; ++i )
{
OUString aStr = aSpacingAry.GetString(i);
sal_uInt16 nData = aSpacingAry.GetValue(i);
sal_Int32 nPos = InsertEntry( aStr );
SetEntryData( nPos, reinterpret_cast<void*>((sal_uLong)nData) );
}
SetDropDownLineCount(8);
SelectEntryPos(0);
}
VCL_BUILDER_FACTORY(SpacingListBox);
Size SpacingListBox::GetOptimalSize() const
{
return Size(150, ListBox::GetOptimalSize().Height());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -43,6 +43,7 @@
#include <tools/fldunit.hxx>
#include <svl/poolitem.hxx>
#include <svl/eitem.hxx>
#include <svx/spacinglistbox.hxx>
namespace sw { namespace sidebar {
......@@ -79,11 +80,11 @@ private:
::sfx2::sidebar::ControllerItem maFooterSpacingController;
::sfx2::sidebar::ControllerItem maFooterLayoutController;
VclPtr<CheckBox> mpFooterToggle;
VclPtr<ListBox> mpFooterSpacingLB;
VclPtr<ListBox> mpFooterLayoutLB;
VclPtr<ListBox> mpFooterMarginPresetLB;
VclPtr<FixedText> mpCustomEntry;
VclPtr<CheckBox> mpFooterToggle;
VclPtr<SpacingListBox> mpFooterSpacingLB;
VclPtr<SpacingListBox> mpFooterMarginPresetLB;
VclPtr<ListBox> mpFooterLayoutLB;
VclPtr<FixedText> mpCustomEntry;
OUString aCustomEntry;
void Initialize();
......
......@@ -251,7 +251,6 @@ IMPL_LINK_NOARG_TYPED( PageHeaderPanel, HeaderSpacingHdl, ListBox&, void )
mpHeaderSpacingItem->SetLower(nVal);
GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_PAGE_HEADER_SPACING,
SfxCallMode::RECORD, { mpHeaderSpacingItem.get() } );
}
IMPL_LINK_NOARG_TYPED( PageHeaderPanel, HeaderLayoutHdl, ListBox&, void )
{
......
......@@ -43,6 +43,7 @@
#include <tools/fldunit.hxx>
#include <svl/poolitem.hxx>
#include <svl/eitem.hxx>
#include <svx/spacinglistbox.hxx>
namespace sw { namespace sidebar {
......@@ -79,11 +80,11 @@ private:
::sfx2::sidebar::ControllerItem maHeaderSpacingController;
::sfx2::sidebar::ControllerItem maHeaderLayoutController;
VclPtr<CheckBox> mpHeaderToggle;
VclPtr<ListBox> mpHeaderSpacingLB;
VclPtr<ListBox> mpHeaderLayoutLB;
VclPtr<ListBox> mpHeaderMarginPresetLB;
VclPtr<FixedText> mpCustomEntry;
VclPtr<CheckBox> mpHeaderToggle;
VclPtr<SpacingListBox> mpHeaderSpacingLB;
VclPtr<SpacingListBox> mpHeaderMarginPresetLB;
VclPtr<ListBox> mpHeaderLayoutLB;
VclPtr<FixedText> mpCustomEntry;
OUString aCustomEntry;
void Initialize();
......
......@@ -26,6 +26,7 @@
#include <sfx2/sidebar/ControllerItem.hxx>
#include <com/sun/star/frame/XFrame.hpp>
#include <vcl/lstbox.hxx>
#include <svx/spacinglistbox.hxx>
namespace sw { namespace sidebar {
......@@ -65,7 +66,7 @@ namespace sw { namespace sidebar {
VclPtr<RadioButton> mpRBIdealWrap;
VclPtr<Button> mpEditContour;
VclPtr<CheckBox> mpEnableContour;
VclPtr<ListBox> mpSpacingLB;
VclPtr<SpacingListBox> mpSpacingLB;
VclPtr<FixedText> mpCustomEntry;
//Spacing
......
......@@ -2,48 +2,6 @@
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkListStore" id="spacinglist">
<columns>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
<!-- column-name gint1 -->
<column type="gint"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">None</col>
<col id="1">0</col>
</row>
<row>
<col id="0" translatable="yes">Extra Small (0.16cm)</col>
<col id="1">91</col>
</row>
<row>
<col id="0" translatable="yes">Small (0.32cm)</col>
<col id="1">181</col>
</row>
<row>
<col id="0" translatable="yes">Small Medium (0.64cm)</col>
<col id="1">363</col>
</row>
<row>
<col id="0" translatable="yes">Medium (0.95cm)</col>
<col id="1">539</col>
</row>
<row>
<col id="0" translatable="yes">Medium Large (1.27cm)</col>
<col id="1">720</col>
</row>
<row>
<col id="0" translatable="yes">Large (1.9cm)</col>
<col id="1">1077</col>
</row>
<row>
<col id="0" translatable="yes">Extra Large (2.54cm)</col>
<col id="1">1440</col>
</row>
</data>
</object>
<object class="GtkGrid" id="PageFooterPanel">
<property name="visible">True</property>
<property name="can_focus">False</property>
......@@ -131,8 +89,7 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="footermarginpreset">
<property name="width_request">150</property>
<object class="svxcorelo-SpacingListBox" id="footermarginpreset">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
......@@ -144,8 +101,7 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="spacingpreset">
<property name="width_request">150</property>
<object class="svxcorelo-SpacingListBox" id="spacingpreset">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
......
......@@ -2,48 +2,6 @@
<!-- Generated with glade 3.16.1 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkListStore" id="spacinglist">
<columns>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
<!-- column-name gint1 -->
<column type="gint"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">None</col>
<col id="1">0</col>
</row>
<row>
<col id="0" translatable="yes">Extra Small (0.16cm)</col>
<col id="1">91</col>
</row>
<row>
<col id="0" translatable="yes">Small (0.32cm)</col>
<col id="1">181</col>
</row>
<row>
<col id="0" translatable="yes">Small Medium (0.64cm)</col>
<col id="1">363</col>
</row>
<row>
<col id="0" translatable="yes">Medium (0.95cm)</col>
<col id="1">539</col>
</row>
<row>
<col id="0" translatable="yes">Medium Large (1.27cm)</col>
<col id="1">720</col>
</row>
<row>
<col id="0" translatable="yes">Large (1.9cm)</col>
<col id="1">1077</col>
</row>
<row>
<col id="0" translatable="yes">Extra Large (2.54cm)</col>
<col id="1">1440</col>
</row>
</data>
</object>
<object class="GtkGrid" id="PageHeaderPanel">
<property name="visible">True</property>
<property name="can_focus">False</property>
......@@ -131,8 +89,7 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="headermarginpreset">
<property name="width_request">150</property>
<object class="svxcorelo-SpacingListBox" id="headermarginpreset">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
......@@ -144,8 +101,7 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="spacingpreset">
<property name="width_request">150</property>
<object class="svxcorelo-SpacingListBox" id="spacingpreset">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
......
......@@ -2,48 +2,6 @@
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<object class="GtkListStore" id="spacinglist">
<columns>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
<!-- column-name gint1 -->
<column type="gint"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">None</col>
<col id="1">0</col>
</row>
<row>
<col id="0" translatable="yes">Extra Small (0.16cm)</col>
<col id="1">91</col>
</row>
<row>
<col id="0" translatable="yes">Small (0.32cm)</col>
<col id="1">181</col>
</row>
<row>
<col id="0" translatable="yes">Small Medium (0.64cm)</col>
<col id="1">363</col>
</row>
<row>
<col id="0" translatable="yes">Medium (0.95cm)</col>
<col id="1">539</col>
</row>
<row>
<col id="0" translatable="yes">Medium Large (1.27cm)</col>
<col id="1">720</col>
</row>
<row>
<col id="0" translatable="yes">Large (1.9cm)</col>
<col id="1">1077</col>
</row>
<row>
<col id="0" translatable="yes">Extra Large (2.54cm)</col>
<col id="1">1440</col>
</row>
</data>
</object>
<object class="GtkGrid" id="WrapPropertyPanel">
<property name="visible">True</property>
<property name="can_focus">False</property>
......@@ -68,7 +26,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_markup" translatable="yes">None</property>
<property name="tooltip_text" translatable="yes">None</property>
<property name="action_name">.uno:WrapOff</property>
<property name="xalign">0</property>
......@@ -92,7 +49,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_markup" translatable="yes">Parallel</property>
<property name="tooltip_text" translatable="yes">Parallel</property>
<property name="action_name">.uno:WrapOn</property>
<property name="xalign">0</property>
......@@ -116,7 +72,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_markup" translatable="yes">Optimal</property>
<property name="tooltip_text" translatable="yes">Optimal</property>
<property name="action_name">.uno:WrapIdeal</property>
<property name="xalign">0</property>
......@@ -140,7 +95,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_markup" translatable="yes">Before</property>
<property name="tooltip_text" translatable="yes">Before</property>
<property name="action_name">.uno:WrapLeft</property>
<property name="xalign">0</property>
......@@ -164,7 +118,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_markup" translatable="yes">After</property>
<property name="tooltip_text" translatable="yes">After</property>
<property name="action_name">.uno:WrapRight</property>
<property name="xalign">0</property>
......@@ -188,7 +141,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_markup" translatable="yes">Through</property>
<property name="tooltip_text" translatable="yes">Through</property>
<property name="action_name">.uno:WrapThrough</property>
<property name="xalign">0</property>
......@@ -224,7 +176,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_markup" translatable="yes">Click to automatically trim unnecessary parts of the image</property>
<property name="tooltip_text" translatable="yes">Click to automatically trim unnecessary parts of the image</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
......@@ -241,7 +192,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_markup" translatable="yes">Edit the trimmed area of the image</property>
<property name="tooltip_text" translatable="yes">Edit the trimmed area of the image</property>
</object>
<packing>
......@@ -275,12 +225,10 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="spacingLB">
<object class="svxcorelo-SpacingListBox" id="spacingLB">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_markup" translatable="yes">Set the amount of space between the image and surrounding text</property>
<property name="tooltip_text" translatable="yes">Set the amount of space between the image and surrounding text</property>
<property name="model">spacinglist</property>
</object>
<packing>
<property name="expand">False</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment