configmgr/qa/unit/data.xcd | 5 icon-themes/crystal/links.txt | 4 icon-themes/galaxy/links.txt | 3 icon-themes/hicontrast/links.txt | 3 icon-themes/human/links.txt | 4 icon-themes/industrial/links.txt | 3 icon-themes/oxygen/links.txt | 4 icon-themes/sifr/links.txt | 4 icon-themes/tango/links.txt | 4 icon-themes/tango_testing/links.txt | 4 include/svx/ParaLineSpacingPopup.hxx | 50 include/svx/dialogs.hrc | 17 include/svx/svxcommands.h | 1 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 12 svx/UIConfig_svx.mk | 1 svx/sdi/svx.sdi | 1 svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx | 707 ++-------- svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx | 88 - svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx | 41 svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx | 49 svx/source/sidebar/paragraph/ParaPropertyPanel.cxx | 38 svx/source/sidebar/paragraph/ParaPropertyPanel.hrc | 16 svx/source/sidebar/paragraph/ParaPropertyPanel.hxx | 6 svx/source/sidebar/paragraph/ParaPropertyPanel.src | 179 -- svx/uiconfig/ui/paralinespacingcontrol.ui | 284 ++++ svx/uiconfig/ui/sidebarparagraph.ui | 3 sw/source/uibase/app/swmodule.cxx | 4 sw/uiconfig/swriter/toolbar/textobjectbar.xml | 4 28 files changed, 625 insertions(+), 914 deletions(-)
New commits: commit 695d29e17feefb33ff54e7263ba2d322e665d176 Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Nov 4 20:23:52 2014 +0100 line spacing: Some consistency. Change-Id: I9c5e3d27c4c3333c6b76eac9acd116417db9a363 diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index 9cb163c..c8daeca 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -1608,7 +1608,7 @@ </node> <node oor:name=".uno:SpacePara15" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> - <value xml:lang="en-US">Line Spacing : 1.5</value> + <value xml:lang="en-US">Line Spacing: 1.5</value> </prop> <prop oor:name="Properties" oor:type="xs:int"> <value>15</value> @@ -1616,7 +1616,7 @@ </node> <node oor:name=".uno:SpacePara2" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> - <value xml:lang="en-US">Line Spacing : 2</value> + <value xml:lang="en-US">Line Spacing: 2</value> </prop> <prop oor:name="Properties" oor:type="xs:int"> <value>15</value> commit 6e4ee0c0f5b0e314ead2e87438e09eae513e5dc3 Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Nov 4 20:22:58 2014 +0100 line spacing: Magic 'Property' that is needed to actually show the icon. Change-Id: I65ac0dc09936ba20d42f1485d628289d1cfab819 diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index a15aa77..9cb163c 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -1594,6 +1594,9 @@ <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">Line Spacing</value> </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>15</value> + </prop> </node> <node oor:name=".uno:SpacePara1" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> commit d694697d9d7b46435227ed50edbac304dbb0137f Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Nov 4 18:07:03 2014 +0100 line spacing: Introduce an icon for that. Change-Id: I26922eb51120331c1f10b00e2bf59bdd7cd8d413 diff --git a/icon-themes/crystal/links.txt b/icon-themes/crystal/links.txt index 6b76367..7e5bb94f 100644 --- a/icon-themes/crystal/links.txt +++ b/icon-themes/crystal/links.txt @@ -1 +1,5 @@ cmd/sc_exporttopdf.png cmd/sc_exportdirecttopdf.png + +# paragraph line spacing +cmd/lc_linespacing.png cmd/lc_spacepara15.png +cmd/sc_linespacing.png cmd/sc_spacepara15.png diff --git a/icon-themes/galaxy/links.txt b/icon-themes/galaxy/links.txt index 95eb5e9..4de4f5b 100644 --- a/icon-themes/galaxy/links.txt +++ b/icon-themes/galaxy/links.txt @@ -13,3 +13,6 @@ cmd/lc_objectmirrorvertical.png cmd/sc_flipvertical.png cmd/lc_objectmirrorhorizontal.png cmd/sc_fliphorizontal.png cmd/sc_exporttopdf.png cmd/sc_exportdirecttopdf.png +# paragraph line spacing +cmd/lc_linespacing.png cmd/lc_spacepara15.png +cmd/sc_linespacing.png cmd/sc_spacepara15.png diff --git a/icon-themes/hicontrast/links.txt b/icon-themes/hicontrast/links.txt new file mode 100644 index 0000000..a9a7c82 --- /dev/null +++ b/icon-themes/hicontrast/links.txt @@ -0,0 +1,3 @@ +# paragraph line spacing +cmd/lc_linespacing.png cmd/lc_spacepara15.png +cmd/sc_linespacing.png cmd/sc_spacepara15.png diff --git a/icon-themes/human/links.txt b/icon-themes/human/links.txt index 6b76367..7e5bb94f 100644 --- a/icon-themes/human/links.txt +++ b/icon-themes/human/links.txt @@ -1 +1,5 @@ cmd/sc_exporttopdf.png cmd/sc_exportdirecttopdf.png + +# paragraph line spacing +cmd/lc_linespacing.png cmd/lc_spacepara15.png +cmd/sc_linespacing.png cmd/sc_spacepara15.png diff --git a/icon-themes/industrial/links.txt b/icon-themes/industrial/links.txt new file mode 100644 index 0000000..a9a7c82 --- /dev/null +++ b/icon-themes/industrial/links.txt @@ -0,0 +1,3 @@ +# paragraph line spacing +cmd/lc_linespacing.png cmd/lc_spacepara15.png +cmd/sc_linespacing.png cmd/sc_spacepara15.png diff --git a/icon-themes/oxygen/links.txt b/icon-themes/oxygen/links.txt index 6b76367..7e5bb94f 100644 --- a/icon-themes/oxygen/links.txt +++ b/icon-themes/oxygen/links.txt @@ -1 +1,5 @@ cmd/sc_exporttopdf.png cmd/sc_exportdirecttopdf.png + +# paragraph line spacing +cmd/lc_linespacing.png cmd/lc_spacepara15.png +cmd/sc_linespacing.png cmd/sc_spacepara15.png diff --git a/icon-themes/sifr/links.txt b/icon-themes/sifr/links.txt index 6b76367..7e5bb94f 100644 --- a/icon-themes/sifr/links.txt +++ b/icon-themes/sifr/links.txt @@ -1 +1,5 @@ cmd/sc_exporttopdf.png cmd/sc_exportdirecttopdf.png + +# paragraph line spacing +cmd/lc_linespacing.png cmd/lc_spacepara15.png +cmd/sc_linespacing.png cmd/sc_spacepara15.png diff --git a/icon-themes/tango/links.txt b/icon-themes/tango/links.txt index b5f8936..8abf06c 100644 --- a/icon-themes/tango/links.txt +++ b/icon-themes/tango/links.txt @@ -628,3 +628,7 @@ cmd/zh-TW/sc_bold.png cmd/sc_bold.png cmd/zh-TW/sc_italic.png cmd/sc_italic.png cmd/zh-TW/sc_underline.png cmd/sc_underline.png cmd/zh-TW/sc_underlinedouble.png cmd/sc_underlinedouble.png + +# paragraph line spacing +cmd/lc_linespacing.png cmd/lc_spacepara15.png +cmd/sc_linespacing.png cmd/sc_spacepara15.png diff --git a/icon-themes/tango_testing/links.txt b/icon-themes/tango_testing/links.txt index 8638065..eec2444 100644 --- a/icon-themes/tango_testing/links.txt +++ b/icon-themes/tango_testing/links.txt @@ -30,3 +30,7 @@ cmd/lc_rectangletoolbox.png cmd/lc_basicshapes.rectangle.png cmd/lc_texttoolbox.png cmd/lc_text.png cmd/lc_inserttoolbox.png cmd/lc_drawchart.png cmd/lc_spellingandgrammardialog.png cmd/lc_spelldialog.png + +# paragraph line spacing +cmd/lc_linespacing.png cmd/lc_spacepara15.png +cmd/sc_linespacing.png cmd/sc_spacepara15.png commit 05695230af685bd5db817e160828cdfe414a8b5a Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Nov 4 17:57:24 2014 +0100 line spacing: Correct way of detecting the currently used units. Change-Id: I208c54f948ecfc0a47d9b26c83acd0bbfdc2070f diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx index 516688a..d85e08b 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx @@ -84,7 +84,15 @@ ParaLineSpacingControl::ParaLineSpacingControl(sal_uInt16 nId) aLink = LINK( this, ParaLineSpacingControl, LineSPDistAtHdl_Impl ); mpLineDistAtPercentBox->SetModifyHdl( aLink ); mpLineDistAtMetricBox->SetModifyHdl( aLink ); - SetFieldUnit(*mpLineDistAtMetricBox, SfxModule::GetCurrentFieldUnit()); + + FieldUnit eUnit = FUNIT_INCH; + const SfxPoolItem* pItem = NULL; + if (SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState(SID_ATTR_METRIC, pItem) >= SfxItemState::DEFAULT) + eUnit = static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); + else + eUnit = SfxModule::GetCurrentFieldUnit(); + + SetFieldUnit(*mpLineDistAtMetricBox, eUnit); initialize(); } @@ -104,7 +112,6 @@ void ParaLineSpacingControl::initialize() if( eState >= SfxItemState::DEFAULT ) { - // SfxMapUnit eUnit = maLNSpaceControl.GetCoreMetric(); SfxMapUnit eUnit = SFX_MAPUNIT_100TH_MM; meLNSpaceUnit = eUnit; commit 3df910376d403f582702bcc44eb4379fdab3c965 Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Nov 4 17:47:01 2014 +0100 line spacing: Enable/disable also the value's label, looks more natural. Change-Id: Ifc0e26008b5b5a5bcc8343ee37b87cda3fdb6114 diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx index 4f92378..516688a 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx @@ -62,6 +62,8 @@ ParaLineSpacingControl::ParaLineSpacingControl(sal_uInt16 nId) mpSpacing2Button = get<PushButton>("spacing_2"); mpLineDist = get<ListBox>("line_dist"); + + mpLineDistLabel = get<FixedText>("value_label"); mpLineDistAtPercentBox = get<MetricField>("percent_box"); mpLineDistAtMetricBox = get<MetricField>("metric_box"); @@ -171,12 +173,14 @@ void ParaLineSpacingControl::initialize() else if( eState == SfxItemState::DISABLED ) { mpLineDist->Disable(); + mpLineDistLabel->Disable(); mpActLineDistFld->Disable(); mpActLineDistFld->SetText(""); } else { + mpLineDistLabel->Disable(); mpActLineDistFld->Disable(); mpActLineDistFld->SetText(""); mpLineDist->SetNoSelection(); @@ -230,6 +234,7 @@ void ParaLineSpacingControl::UpdateMetricFields() else mpLineDistAtPercentBox->Hide(); + mpLineDistLabel->Disable(); mpActLineDistFld->Show(); mpActLineDistFld->Disable(); mpActLineDistFld->SetText(""); @@ -244,6 +249,7 @@ void ParaLineSpacingControl::UpdateMetricFields() if (mpLineDistAtMetricBox->GetText().isEmpty()) mpLineDistAtMetricBox->SetValue(mpLineDistAtMetricBox->Normalize(0)); + mpLineDistLabel->Enable(); mpActLineDistFld->Show(); mpActLineDistFld->Enable(); break; @@ -257,6 +263,7 @@ void ParaLineSpacingControl::UpdateMetricFields() if (mpLineDistAtMetricBox->GetText().isEmpty()) mpLineDistAtMetricBox->SetValue(mpLineDistAtMetricBox->Normalize(0), FUNIT_TWIP); + mpLineDistLabel->Enable(); mpActLineDistFld->Show(); mpActLineDistFld->Enable(); break; @@ -269,6 +276,7 @@ void ParaLineSpacingControl::UpdateMetricFields() if (mpLineDistAtPercentBox->GetText().isEmpty()) mpLineDistAtPercentBox->SetValue(mpLineDistAtPercentBox->Normalize(100), FUNIT_TWIP); + mpLineDistLabel->Enable(); mpActLineDistFld->Show(); mpActLineDistFld->Enable(); break; @@ -283,6 +291,7 @@ void ParaLineSpacingControl::UpdateMetricFields() if (mpLineDistAtMetricBox->GetValue() != nTemp) SetMetricValue(*mpLineDistAtMetricBox, FIX_DIST_DEF, SFX_MAPUNIT_TWIP); + mpLineDistLabel->Enable(); mpActLineDistFld->Show(); mpActLineDistFld->Enable(); } diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx index 0995380..087e6a8 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx @@ -58,6 +58,7 @@ private: ListBox* mpLineDist; + FixedText* mpLineDistLabel; MetricField* mpLineDistAtPercentBox; MetricField* mpLineDistAtMetricBox; diff --git a/svx/uiconfig/ui/paralinespacingcontrol.ui b/svx/uiconfig/ui/paralinespacingcontrol.ui index 455a709..2fb95d7 100644 --- a/svx/uiconfig/ui/paralinespacingcontrol.ui +++ b/svx/uiconfig/ui/paralinespacingcontrol.ui @@ -195,7 +195,7 @@ </packing> </child> <child> - <object class="GtkLabel" id="label4"> + <object class="GtkLabel" id="value_label"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> commit e7e2a25bcaacf8dc02268dd436f761550d42b843 Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Nov 4 17:36:30 2014 +0100 line spacing: Unused. Change-Id: Icf93aff540da480c7e1a66abe8a639dc6cd0ead0 diff --git a/include/svx/ParaLineSpacingPopup.hxx b/include/svx/ParaLineSpacingPopup.hxx index f0d41bf..ba8cebc 100644 --- a/include/svx/ParaLineSpacingPopup.hxx +++ b/include/svx/ParaLineSpacingPopup.hxx @@ -40,7 +40,6 @@ public: virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; - virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) SAL_OVERRIDE; }; } // namespace svx diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx index 07683b3..345aed3 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx @@ -46,19 +46,11 @@ SfxPopupWindow* ParaLineSpacingPopup::CreatePopupWindow() { ParaLineSpacingControl* pControl = new ParaLineSpacingControl(GetSlotId()); - //pControl->StartPopupMode(&GetToolBox(), FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE); pControl->StartPopupMode(&GetToolBox(), FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE); - //pControl->StartSelection(); SetPopupWindow(pControl); - //pControl->SetSelectedHdl(LINK(this, ParaLineSpacingPopup, SelectedHdl)); return pControl; } -void ParaLineSpacingPopup::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) -{ - // FIXME - do we need to do anything here? -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit bbe1b16b2b2b977cef9b5c48924b0debc758eecc Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Nov 4 17:28:34 2014 +0100 line spacing: Kill RID_POPUPPANEL_PARAPAGE_LINESPACING. Change-Id: Ibc442d3c4fa05a47c2900d61623bd02a1b03e48f diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc index 142da59..0fe72fa 100644 --- a/include/svx/dialogs.hrc +++ b/include/svx/dialogs.hrc @@ -216,11 +216,10 @@ #define RID_SIDEBAR_EMPTY_PANEL (RID_SVX_START + 327) #define RID_SIDEBAR_PARA_PANEL (RID_SVX_START + 328) -#define RID_POPUPPANEL_PARAPAGE_LINESPACING (RID_SVX_START + 329) -#define RID_POPUPPANEL_PARAPAGE_BULLETS (RID_SVX_START + 330) -#define RID_POPUPPANEL_PARAPAGE_NUMBERING (RID_SVX_START + 331) +#define RID_POPUPPANEL_PARAPAGE_BULLETS (RID_SVX_START + 329) +#define RID_POPUPPANEL_PARAPAGE_NUMBERING (RID_SVX_START + 330) -#define RID_SIDEBAR_INSERT_PANEL (RID_SVX_START + 332) +#define RID_SIDEBAR_INSERT_PANEL (RID_SVX_START + 331) // !!! IMPORTANT: consider and update RID_SVX_FIRSTFREE when introducing new RIDs !!! (see above) commit e2c9ee8e1b404d07e40c35c6dd270ddaec98e43a Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Nov 4 17:11:27 2014 +0100 line spacing: Finally use the reworked line spacing popup in the sidebar too. Change-Id: I7f33a25903dec7e5aa0dc878ff5dea7f35935863 diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx index 45d7bd5..5e7604f 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -19,7 +19,6 @@ #include "ParaPropertyPanel.hxx" #include "ParaPropertyPanel.hrc" -#include "ParaLineSpacingControl.hxx" #include "ParaBulletsPopup.hxx" #include "ParaBulletsControl.hxx" #include "ParaNumberingPopup.hxx" @@ -313,24 +312,12 @@ void ParaPropertyPanel::InitToolBoxSpacing() m_eULSpaceUnit = maULSpaceControl.GetCoreMetric(); } -void ParaPropertyPanel::InitToolBoxLineSpacing() -{ - Link aLink = LINK( this, ParaPropertyPanel, ClickLineSPDropDownHdl_Impl ); - mpLineSPTbx->SetDropdownClickHdl( aLink ); - mpLineSPTbx->SetSelectHdl( aLink ); //support keyinput "ENTER" - - const sal_uInt16 nIdSpacing = mpLineSPTbx->GetItemId(UNO_LINESPACING); - mpLineSPTbx->SetItemBits( nIdSpacing, mpLineSPTbx->GetItemBits( nIdSpacing ) | ToolBoxItemBits::DROPDOWNONLY ); - mpLineSPTbx->SetItemImage(nIdSpacing, maSpace3); -} - void ParaPropertyPanel::initial() { //toolbox InitToolBoxIndent(); InitToolBoxBulletsNumbering(); InitToolBoxSpacing(); - InitToolBoxLineSpacing(); } // for Numbering & Bullet @@ -494,20 +481,6 @@ IMPL_LINK(ParaPropertyPanel, ClickProDemote_Hdl_Impl, ToolBox *, pControl) return( 0L ); } -// for Paragraph Line Spacing -IMPL_LINK( ParaPropertyPanel, ClickLineSPDropDownHdl_Impl, ToolBox*, pBox ) -{ - const sal_uInt16 nId = pBox->GetCurItemId(); - const OUString aCommand(pBox->GetItemCommand(nId)); - - if (aCommand == UNO_LINESPACING) - { - pBox->SetItemDown( nId, true ); - //maLineSpacePopup.Rearrange(meLnSpState,m_eMetricUnit,mpLnSPItem,maContext); - //maLineSpacePopup.Show(*pBox); - } - return (0L); -} // for Paragraph Spacing IMPL_LINK_NOARG( ParaPropertyPanel, ULSpaceHdl_Impl) @@ -968,12 +941,6 @@ FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolI return eUnit; } -/* -PopupControl* ParaPropertyPanel::CreateLineSpacingControl (PopupContainer* pParent) -{ - return new ParaLineSpacingControl(pParent, *this); -}*/ - PopupControl* ParaPropertyPanel::CreateBulletsPopupControl (PopupContainer* pParent) { return new ParaBulletsControl(pParent, *this); @@ -1022,7 +989,6 @@ ParaPropertyPanel::ParaPropertyPanel(vcl::Window* pParent, mxFrame(rxFrame), maContext(), mpBindings(pBindings), - //maLineSpacePopup(this, ::boost::bind(&ParaPropertyPanel::CreateLineSpacingControl, this, _1)), maBulletsPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBulletsPopupControl, this, _1)), maNumberingPopup(this, ::boost::bind(&ParaPropertyPanel::CreateNumberingPopupControl, this, _1)), mxSidebar(rxSidebar) @@ -1046,7 +1012,6 @@ ParaPropertyPanel::ParaPropertyPanel(vcl::Window* pParent, get(mpTbxIndent_IncDec, "indent"); get(mpTbxProDemote, "promotedemote"); - get(mpLineSPTbx, "linespacing"); get(mpTbxUL_IncDec, "paraspacing"); initial(); diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx index f387988..56179de 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx @@ -92,7 +92,6 @@ private: ToolBox* mpTbxUL_IncDec; SvxRelativeField* mpTopDist; SvxRelativeField* mpBottomDist; - ToolBox* mpLineSPTbx; ToolBox* mpTbxIndent_IncDec; ToolBox* mpTbxProDemote; SvxRelativeField* mpLeftIndent; @@ -172,8 +171,6 @@ private: void initial(); void ReSize(bool bSize); - - //PopupControl* CreateLineSpacingControl (PopupContainer* pParent); PopupControl* CreateBulletsPopupControl (PopupContainer* pParent); PopupControl* CreateNumberingPopupControl (PopupContainer* pParent); DECL_LINK(ClickLineSPDropDownHdl_Impl, ToolBox*); @@ -182,7 +179,6 @@ private: void InitToolBoxIndent(); void InitToolBoxBulletsNumbering(); void InitToolBoxSpacing(); - void InitToolBoxLineSpacing(); }; } } // end of namespace ::svx::sidebar diff --git a/svx/uiconfig/ui/sidebarparagraph.ui b/svx/uiconfig/ui/sidebarparagraph.ui index ed298f0..cb3dc4c 100644 --- a/svx/uiconfig/ui/sidebarparagraph.ui +++ b/svx/uiconfig/ui/sidebarparagraph.ui @@ -412,11 +412,10 @@ </packing> </child> <child> - <object class="GtkToolbar" id="linespacing"> + <object class="sfxlo-SidebarToolBox" id="linespacing"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="has_tooltip">True</property> - <property name="tooltip_text" translatable="yes">Line Spacing</property> <property name="hexpand">True</property> <child> <object class="GtkMenuToolButton" id="setlinespacing"> commit f3798fa1584dd63b8547eec00c92584d906f6979 Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Nov 4 17:02:15 2014 +0100 line spacing: Honor the current setting of units. Plus fixes of some warnings. Change-Id: I877e08e4b60c1b654e371c6786cc3ad33e79c583 diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx index 0328dce..4f92378 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx @@ -82,6 +82,7 @@ ParaLineSpacingControl::ParaLineSpacingControl(sal_uInt16 nId) aLink = LINK( this, ParaLineSpacingControl, LineSPDistAtHdl_Impl ); mpLineDistAtPercentBox->SetModifyHdl( aLink ); mpLineDistAtMetricBox->SetModifyHdl( aLink ); + SetFieldUnit(*mpLineDistAtMetricBox, SfxModule::GetCurrentFieldUnit()); initialize(); } @@ -97,11 +98,6 @@ void ParaLineSpacingControl::initialize() const SvxLineSpacingItem* currSPItem = static_cast<const SvxLineSpacingItem*>(pItem); - /* TODO - according to the current units setting - FieldUnit currMetricUnit = FUNIT_CM; - SetFieldUnit(*mpLineDistAtMetricBox, currMetricUnit); - */ - mpLineDist->Enable(); if( eState >= SfxItemState::DEFAULT ) @@ -300,7 +296,7 @@ void ParaLineSpacingControl::SelectEntryPos(sal_Int32 nPos) UpdateMetricFields(); } -IMPL_LINK( ParaLineSpacingControl, LineSPDistHdl_Impl, ListBox*, pBox ) +IMPL_LINK(ParaLineSpacingControl, LineSPDistHdl_Impl, ListBox*, /*pBox*/) { UpdateMetricFields(); ExecuteLineSpace(); @@ -417,7 +413,7 @@ void ParaLineSpacingControl::ExecuteLineSpacing(sal_uInt16 nEntry) // special-case the 1.15 line spacing if (nEntry == LLINESPACE_115) - SetLineSpace(aSpacing, LLINESPACE_PROP, mpLineDistAtPercentBox->Denormalize(115L)); + SetLineSpace(aSpacing, LLINESPACE_PROP, mpLineDistAtPercentBox->Denormalize(LINESPACE_115)); else SetLineSpace(aSpacing, nEntry); commit caa4c09ce4407dcbcbcf38117db63f68f022bc53 Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Nov 4 16:53:20 2014 +0100 line spacing: Setup the Custom value according to the current state. Change-Id: I16d34d501385c57ba32dece1eb8032ff38d5f4a6 diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx index fb2d5b5..0328dce 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx @@ -55,7 +55,6 @@ using namespace svx::sidebar; ParaLineSpacingControl::ParaLineSpacingControl(sal_uInt16 nId) : SfxPopupWindow(nId, "ParaLineSpacingControl", "svx/ui/paralinespacingcontrol.ui") -// , maLineSpacing(ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES( LINE_SPACING ) ) { mpSpacing1Button = get<PushButton>("spacing_1"); mpSpacing115Button = get<PushButton>("spacing_115"); @@ -68,16 +67,8 @@ ParaLineSpacingControl::ParaLineSpacingControl(sal_uInt16 nId) mpActLineDistFld = mpLineDistAtPercentBox; - initial(); meLNSpaceUnit = SFX_MAPUNIT_100TH_MM; -} - -ParaLineSpacingControl::~ParaLineSpacingControl() -{ -} -void ParaLineSpacingControl::initial() -{ Link aLink = LINK(this, ParaLineSpacingControl, PredefinedValuesHandler); mpSpacing1Button->SetClickHdl(aLink); mpSpacing115Button->SetClickHdl(aLink); @@ -86,23 +77,32 @@ void ParaLineSpacingControl::initial() aLink = LINK( this, ParaLineSpacingControl, LineSPDistHdl_Impl ); mpLineDist->SetSelectHdl(aLink); - mpLineDist->SelectEntryPos( LLINESPACE_1 ) ; + SelectEntryPos(LLINESPACE_1); aLink = LINK( this, ParaLineSpacingControl, LineSPDistAtHdl_Impl ); mpLineDistAtPercentBox->SetModifyHdl( aLink ); mpLineDistAtMetricBox->SetModifyHdl( aLink ); + + initialize(); } -void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext) +ParaLineSpacingControl::~ParaLineSpacingControl() { - SfxItemState eState = currSPState; +} +void ParaLineSpacingControl::initialize() +{ + const SfxPoolItem* pItem; + SfxItemState eState = SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState(SID_ATTR_PARA_LINESPACE, pItem); + + const SvxLineSpacingItem* currSPItem = static_cast<const SvxLineSpacingItem*>(pItem); + + /* TODO - according to the current units setting + FieldUnit currMetricUnit = FUNIT_CM; SetFieldUnit(*mpLineDistAtMetricBox, currMetricUnit); + */ mpLineDist->Enable(); - mpActLineDistFld->Enable(); - mpActLineDistFld->SetText( "" ); - //bool bValueSetFocus = sal_False; //wj if( eState >= SfxItemState::DEFAULT ) { @@ -119,106 +119,35 @@ void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMe switch( eInter ) { case SVX_INTER_LINE_SPACE_OFF: - { - mpLineDist->SelectEntryPos( LLINESPACE_1 ); - mpActLineDistFld->Disable(); - mpActLineDistFld->SetText( "" ); - if ( LINESPACE_1 == currSPItem->GetPropLineSpace() ) - { -// maLineSpacing.SelectItem(1); - //bValueSetFocus = sal_True; //wj - } - } + SelectEntryPos(LLINESPACE_1); break; case SVX_INTER_LINE_SPACE_PROP: { if ( LINESPACE_1 == currSPItem->GetPropLineSpace() ) { - mpLineDist->SelectEntryPos( LLINESPACE_1 ); - mpActLineDistFld->Disable(); - mpActLineDistFld->SetText( "" ); -// maLineSpacing.SelectItem(1); - //bValueSetFocus = sal_True; //wj - break; + SelectEntryPos(LLINESPACE_1); } - if ( LINESPACE_15 == currSPItem->GetPropLineSpace() ) + else if ( LINESPACE_15 == currSPItem->GetPropLineSpace() ) { - mpLineDist->SelectEntryPos( LLINESPACE_15 ); - mpActLineDistFld->Disable(); - mpActLineDistFld->SetText( "" ); - -// maLineSpacing.SelectItem(3); - //bValueSetFocus = sal_True; //wj - break; + SelectEntryPos(LLINESPACE_15); } - if ( LINESPACE_2 == currSPItem->GetPropLineSpace() ) - { - mpLineDist->SelectEntryPos( LLINESPACE_2 ); - mpActLineDistFld->Disable(); - mpActLineDistFld->SetText( "" ); - -// maLineSpacing.SelectItem(4); - //bValueSetFocus = sal_True; //wj - break; - } - - mpLineDist->SelectEntryPos( LLINESPACE_PROP ); - if(mpActLineDistFld != mpLineDistAtPercentBox) + else if ( LINESPACE_2 == currSPItem->GetPropLineSpace() ) { - mpActLineDistFld->Disable(); - mpActLineDistFld->Hide(); - mpActLineDistFld = mpLineDistAtPercentBox; + SelectEntryPos(LLINESPACE_2); } else { - mpActLineDistFld = mpLineDistAtMetricBox; - mpActLineDistFld->Disable(); - mpActLineDistFld->Hide(); - mpActLineDistFld = mpLineDistAtPercentBox; - } - mpActLineDistFld->Enable(); - mpActLineDistFld->Show(); - mpLineDistAtPercentBox-> - SetValue( mpLineDistAtPercentBox->Normalize( - currSPItem->GetPropLineSpace() ) ); - - if( currSPItem->GetPropLineSpace() == LINESPACE_115 ) - { -// maLineSpacing.SelectItem(2); - //bValueSetFocus = sal_True; //wj - } - else - { -// maLineSpacing.SetNoSelection(); -// maLineSpacing.SelectItem(0); + SelectEntryPos(LLINESPACE_PROP); + mpLineDistAtPercentBox->SetValue(mpLineDistAtPercentBox->Normalize(currSPItem->GetPropLineSpace())); } } break; case SVX_INTER_LINE_SPACE_FIX: { - if(mpActLineDistFld != mpLineDistAtMetricBox) - { - mpActLineDistFld->Disable(); - mpActLineDistFld->Hide(); - mpActLineDistFld = mpLineDistAtMetricBox; - } - else - { - mpActLineDistFld = mpLineDistAtPercentBox; - mpActLineDistFld->Disable(); - mpActLineDistFld->Hide(); - mpActLineDistFld = mpLineDistAtMetricBox; - } - mpActLineDistFld->Enable(); - mpActLineDistFld->Show(); -// maLineSpacing.SetNoSelection(); -// maLineSpacing.SelectItem(0); - + SelectEntryPos(LLINESPACE_DURCH); SetMetricValue(*mpLineDistAtMetricBox, currSPItem->GetInterLineSpace(), eUnit); - mpLineDist->SelectEntryPos( LLINESPACE_DURCH ); - } break; default: @@ -228,51 +157,15 @@ void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMe break; case SVX_LINE_SPACE_FIX: { - if(mpActLineDistFld != mpLineDistAtMetricBox) - { - mpActLineDistFld->Disable(); - mpActLineDistFld->Hide(); - mpActLineDistFld = mpLineDistAtMetricBox; - } - else - { - mpActLineDistFld = mpLineDistAtPercentBox; - mpActLineDistFld->Disable(); - mpActLineDistFld->Hide(); - mpActLineDistFld = mpLineDistAtMetricBox; - } - mpActLineDistFld->Enable(); - mpActLineDistFld->Show(); -// maLineSpacing.SetNoSelection(); -// maLineSpacing.SelectItem(0); - + SelectEntryPos(LLINESPACE_FIX); SetMetricValue(*mpLineDistAtMetricBox, currSPItem->GetLineHeight(), eUnit); - mpLineDist->SelectEntryPos( LLINESPACE_FIX ); } break; case SVX_LINE_SPACE_MIN: { - if(mpActLineDistFld != mpLineDistAtMetricBox) - { - mpActLineDistFld->Disable(); - mpActLineDistFld->Hide(); - mpActLineDistFld = mpLineDistAtMetricBox; - } - else - { - mpActLineDistFld = mpLineDistAtPercentBox; - mpActLineDistFld->Disable(); - mpActLineDistFld->Hide(); - mpActLineDistFld = mpLineDistAtMetricBox; - } - mpActLineDistFld->Enable(); - mpActLineDistFld->Show(); -// maLineSpacing.SetNoSelection(); -// maLineSpacing.SelectItem(0); - + SelectEntryPos(LLINESPACE_MIN); SetMetricValue(*mpLineDistAtMetricBox, currSPItem->GetLineHeight(), eUnit); - mpLineDist->SelectEntryPos( LLINESPACE_MIN ); } break; default: @@ -282,23 +175,20 @@ void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMe else if( eState == SfxItemState::DISABLED ) { mpLineDist->Disable(); - mpActLineDistFld->Enable(false); - mpActLineDistFld->SetText( "" ); -// maLineSpacing.SetNoSelection(); -// maLineSpacing.SelectItem(0); + mpActLineDistFld->Disable(); + mpActLineDistFld->SetText(""); } else { - mpActLineDistFld->Enable(false); - mpActLineDistFld->SetText( "" ); + mpActLineDistFld->Disable(); + mpActLineDistFld->SetText(""); mpLineDist->SetNoSelection(); -// maLineSpacing.SetNoSelection(); -// maLineSpacing.SelectItem(0); } mpLineDist->SaveValue(); + /* TODO const sal_uInt16 uCount = mpLineDist->GetEntryCount(); if( uCount == LLINESPACE_FIX + 1 ) { @@ -329,80 +219,90 @@ void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMe } } } -// maLineSpacing.Format(); -// maLineSpacing.StartSelection(); + */ } -IMPL_LINK( ParaLineSpacingControl, LineSPDistHdl_Impl, ListBox*, pBox ) +void ParaLineSpacingControl::UpdateMetricFields() { -// maLineSpacing.SetNoSelection(); -// maLineSpacing.SelectItem(0); -// maLineSpacing.Format(); -// maLineSpacing.StartSelection(); - - switch( pBox->GetSelectEntryPos() ) + switch (mpLineDist->GetSelectEntryPos()) { case LLINESPACE_1: case LLINESPACE_15: case LLINESPACE_2: - mpActLineDistFld->Enable(false); - mpActLineDistFld->SetText( "" ); + if (mpActLineDistFld == mpLineDistAtPercentBox) + mpLineDistAtMetricBox->Hide(); + else + mpLineDistAtPercentBox->Hide(); + + mpActLineDistFld->Show(); + mpActLineDistFld->Disable(); + mpActLineDistFld->SetText(""); break; case LLINESPACE_DURCH: mpLineDistAtPercentBox->Hide(); + mpActLineDistFld = mpLineDistAtMetricBox; mpLineDistAtMetricBox->SetMin(0); + if (mpLineDistAtMetricBox->GetText().isEmpty()) + mpLineDistAtMetricBox->SetValue(mpLineDistAtMetricBox->Normalize(0)); - if ( mpLineDistAtMetricBox->GetText().isEmpty() ) - mpLineDistAtMetricBox->SetValue( - mpLineDistAtMetricBox->Normalize( 0 ) ); - mpLineDistAtPercentBox->Hide(); mpActLineDistFld->Show(); mpActLineDistFld->Enable(); break; case LLINESPACE_MIN: mpLineDistAtPercentBox->Hide(); + mpActLineDistFld = mpLineDistAtMetricBox; mpLineDistAtMetricBox->SetMin(0); - if ( mpLineDistAtMetricBox->GetText().isEmpty() ) - mpLineDistAtMetricBox->SetValue( - mpLineDistAtMetricBox->Normalize( 0 ), FUNIT_TWIP ); - mpLineDistAtPercentBox->Hide(); + if (mpLineDistAtMetricBox->GetText().isEmpty()) + mpLineDistAtMetricBox->SetValue(mpLineDistAtMetricBox->Normalize(0), FUNIT_TWIP); + mpActLineDistFld->Show(); mpActLineDistFld->Enable(); break; case LLINESPACE_PROP: mpLineDistAtMetricBox->Hide(); + mpActLineDistFld = mpLineDistAtPercentBox; - if ( mpLineDistAtPercentBox->GetText().isEmpty() ) - mpLineDistAtPercentBox->SetValue( - mpLineDistAtPercentBox->Normalize( 100 ), FUNIT_TWIP ); - mpLineDistAtMetricBox->Hide(); + if (mpLineDistAtPercentBox->GetText().isEmpty()) + mpLineDistAtPercentBox->SetValue(mpLineDistAtPercentBox->Normalize(100), FUNIT_TWIP); + mpActLineDistFld->Show(); mpActLineDistFld->Enable(); break; case LLINESPACE_FIX: { mpLineDistAtPercentBox->Hide(); + mpActLineDistFld = mpLineDistAtMetricBox; sal_Int64 nTemp = mpLineDistAtMetricBox->GetValue(); mpLineDistAtMetricBox->SetMin(mpLineDistAtMetricBox->Normalize(MIN_FIXED_DISTANCE), FUNIT_TWIP); - if ( mpLineDistAtMetricBox->GetValue() != nTemp ) + if (mpLineDistAtMetricBox->GetValue() != nTemp) SetMetricValue(*mpLineDistAtMetricBox, FIX_DIST_DEF, SFX_MAPUNIT_TWIP); - mpLineDistAtPercentBox->Hide(); mpActLineDistFld->Show(); mpActLineDistFld->Enable(); } break; } +} + +void ParaLineSpacingControl::SelectEntryPos(sal_Int32 nPos) +{ + mpLineDist->SelectEntryPos(nPos); + UpdateMetricFields(); +} + +IMPL_LINK( ParaLineSpacingControl, LineSPDistHdl_Impl, ListBox*, pBox ) +{ + UpdateMetricFields(); ExecuteLineSpace(); return 0; } @@ -416,7 +316,6 @@ IMPL_LINK_NOARG( ParaLineSpacingControl, LineSPDistAtHdl_Impl ) void ParaLineSpacingControl::ExecuteLineSpace() { mpLineDist->SaveValue(); -// maLineSpacing.SetNoSelection(); SvxLineSpacingItem aSpacing(DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); sal_uInt16 nPos = mpLineDist->GetSelectEntryPos(); @@ -426,7 +325,7 @@ void ParaLineSpacingControl::ExecuteLineSpace() case LLINESPACE_1: case LLINESPACE_15: case LLINESPACE_2: - SetLineSpace( aSpacing, nPos ); + SetLineSpace(aSpacing, nPos); break; case LLINESPACE_PROP: @@ -448,8 +347,7 @@ void ParaLineSpacingControl::ExecuteLineSpace() SID_ATTR_PARA_LINESPACE, SfxCallMode::RECORD, &aSpacing, 0L); } -void ParaLineSpacingControl::SetLineSpace( SvxLineSpacingItem& rLineSpace, - int eSpace, long lValue ) +void ParaLineSpacingControl::SetLineSpace(SvxLineSpacingItem& rLineSpace, int eSpace, long lValue) { switch ( eSpace ) { @@ -515,8 +413,6 @@ IMPL_LINK(ParaLineSpacingControl, PredefinedValuesHandler, void *, pControl) void ParaLineSpacingControl::ExecuteLineSpacing(sal_uInt16 nEntry) { - mpLineDist->SelectEntryPos(nEntry) ; - mpLineDist->SaveValue(); SvxLineSpacingItem aSpacing(DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); // special-case the 1.15 line spacing diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx index 968b09c..0995380 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx @@ -37,8 +37,6 @@ public: ParaLineSpacingControl(sal_uInt16 nId); virtual ~ParaLineSpacingControl(); - void Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext); - short GetLastCustomState(); long GetLastCustomValue(); @@ -64,7 +62,14 @@ private: MetricField* mpLineDistAtMetricBox; private: - void initial(); + void initialize(); + + /// Set mpActlineDistFld and visibility of mpLineDist* fields according to what is just selected. + void UpdateMetricFields(); + + /// Set the entry and update the metric fields. + void SelectEntryPos(sal_Int32 nPos); + DECL_LINK(LineSPDistHdl_Impl, ListBox*); DECL_LINK(LineSPDistAtHdl_Impl, void*); DECL_LINK(PredefinedValuesHandler, void*); diff --git a/svx/uiconfig/ui/paralinespacingcontrol.ui b/svx/uiconfig/ui/paralinespacingcontrol.ui index 9f9e557..455a709 100644 --- a/svx/uiconfig/ui/paralinespacingcontrol.ui +++ b/svx/uiconfig/ui/paralinespacingcontrol.ui @@ -1,6 +1,41 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> <!-- interface-requires gtk+ 3.10 --> + <object class="GtkAdjustment" id="adjustment1"> + <property name="lower">50</property> + <property name="upper">200</property> + <property name="value">100</property> + <property name="step_increment">10</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment2"> + <property name="lower">0.01</property> + <property name="upper">9999</property> + <property name="value">0.5</property> + <property name="step_increment">0.10000000000000001</property> + <property name="page_increment">1</property> + </object> + <object class="GtkImage" id="image_spacing_1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">svx/res/symphony/lpspacing-1.png</property> + </object> + <object class="GtkImage" id="image_spacing_115"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_right">6</property> + <property name="xalign">0</property> + <property name="pixbuf">svx/res/symphony/lpspacing-1_15.png</property> + <property name="icon-size">1</property> + </object> + <object class="GtkImage" id="image_spacing_15"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_right">6</property> + <property name="xalign">0</property> + <property name="pixbuf">svx/res/symphony/lpspacing-1_5.png</property> + <property name="icon-size">1</property> + </object> <object class="GtkImage" id="image_spacing_2"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -125,6 +160,8 @@ <property name="can_focus">False</property> <property name="xalign">0</property> <property name="label" translatable="yes">Line Spacing:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">line_dist</property> </object> <packing> <property name="left_attach">0</property> @@ -163,6 +200,8 @@ <property name="can_focus">False</property> <property name="xalign">0</property> <property name="label" translatable="yes">Value:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">grid1</property> </object> <packing> <property name="left_attach">0</property> @@ -179,7 +218,6 @@ <property name="vexpand">True</property> <child> <object class="GtkSpinButton" id="percent_box:0%"> - <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="invisible_char">â</property> @@ -201,6 +239,7 @@ <property name="invisible_char">â</property> <property name="invisible_char_set">True</property> <property name="adjustment">adjustment2</property> + <property name="digits">2</property> </object> <packing> <property name="left_attach">0</property> @@ -242,37 +281,4 @@ </object> </child> </object> - <object class="GtkAdjustment" id="adjustment1"> - <property name="lower">50</property> - <property name="upper">200</property> - <property name="value">100</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> - </object> - <object class="GtkAdjustment" id="adjustment2"> - <property name="upper">9999</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> - </object> - <object class="GtkImage" id="image_spacing_1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="pixbuf">svx/res/symphony/lpspacing-1.png</property> - </object> - <object class="GtkImage" id="image_spacing_115"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_right">6</property> - <property name="xalign">0</property> - <property name="pixbuf">svx/res/symphony/lpspacing-1_15.png</property> - <property name="icon-size">1</property> - </object> - <object class="GtkImage" id="image_spacing_15"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_right">6</property> - <property name="xalign">0</property> - <property name="pixbuf">svx/res/symphony/lpspacing-1_5.png</property> - <property name="icon-size">1</property> - </object> </interface> commit bafd505409e163abcd2261e2cf26737e2202ba24 Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Nov 4 14:31:55 2014 +0100 line spacing: Kill lots of unused stuff. Rename some member variables. Change-Id: Ia424ea0b71e64bb1133d2a02becb79d6a5ace639 diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx index 8e3d924..fb2d5b5 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx @@ -29,12 +29,12 @@ #include <svtools/unitconv.hxx> #include <vcl/settings.hxx> -#define _DEFAULT_LINE_SPACING 200 -#define FIX_DIST_DEF 283 -#define LINESPACE_1 100 -#define LINESPACE_15 150 -#define LINESPACE_2 200 -#define LINESPACE_115 115 +#define DEFAULT_LINE_SPACING 200 +#define FIX_DIST_DEF 283 +#define LINESPACE_1 100 +#define LINESPACE_15 150 +#define LINESPACE_2 200 +#define LINESPACE_115 115 // values of the mpLineDist listbox #define LLINESPACE_1 0 @@ -48,24 +48,14 @@ // special case; should not conflict with the mpLinDist values #define LLINESPACE_115 7 -#define DO_NOT_CUSTOM false -#define USE_CUSTOM true - -#define LSP_POS_GLOBAL_VALUE "Line_Spacing_Pos" -#define LSP_LV_GLOBAL_VALUE "Line_Spacing_Lv" -#define BEGIN_VALUE 28 +#define MIN_FIXED_DISTANCE 28 using namespace svx; using namespace svx::sidebar; ParaLineSpacingControl::ParaLineSpacingControl(sal_uInt16 nId) : SfxPopupWindow(nId, "ParaLineSpacingControl", "svx/ui/paralinespacingcontrol.ui") - , mbUseLineSPCustom(false) - , mbLineSPDisable(false) - , nMinFixDist(BEGIN_VALUE) // , maLineSpacing(ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES( LINE_SPACING ) ) - , maValue( 0 ) - , maPos( 0 ) { mpSpacing1Button = get<PushButton>("spacing_1"); mpSpacing115Button = get<PushButton>("spacing_115"); @@ -76,10 +66,10 @@ ParaLineSpacingControl::ParaLineSpacingControl(sal_uInt16 nId) mpLineDistAtPercentBox = get<MetricField>("percent_box"); mpLineDistAtMetricBox = get<MetricField>("metric_box"); - pActLineDistFld = mpLineDistAtPercentBox; + mpActLineDistFld = mpLineDistAtPercentBox; initial(); - m_eLNSpaceUnit = SFX_MAPUNIT_100TH_MM; + meLNSpaceUnit = SFX_MAPUNIT_100TH_MM; } ParaLineSpacingControl::~ParaLineSpacingControl() @@ -103,115 +93,22 @@ void ParaLineSpacingControl::initial() mpLineDistAtMetricBox->SetModifyHdl( aLink ); } -void ParaLineSpacingControl::PopupModeEndCallback() -{ - if( mbUseLineSPCustom ) - { - //maLinePos = mpLineSPPage->maPos; - //maLineValue = mpLineSPPage->maValue; - - SvtViewOptions aWinOpt( E_WINDOW, LSP_POS_GLOBAL_VALUE ); - ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1); - aSeq[0].Name = "maLinePos"; - aSeq[0].Value <<= ::rtl::OUString::number(maPos); - aWinOpt.SetUserData( aSeq ); - - SvtViewOptions aWinOpt2( E_WINDOW, LSP_LV_GLOBAL_VALUE ); - aSeq[0].Name = "maLineValue"; - aSeq[0].Value <<= ::rtl::OUString::number(maValue); - aWinOpt2.SetUserData( aSeq ); - } -} - void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext) { - SvtViewOptions aWinOpt( E_WINDOW, LSP_POS_GLOBAL_VALUE ); - if ( aWinOpt.Exists() ) - { - ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData(); - ::rtl::OUString aTmp; - if ( aSeq.getLength()) - aSeq[0].Value >>= aTmp; - - OUString aWinData( aTmp ); - maPos = (sal_uInt16)aWinData.toInt32(); - } - - SvtViewOptions aWinOpt2( E_WINDOW, LSP_LV_GLOBAL_VALUE ); - if ( aWinOpt2.Exists() ) - { - ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt2.GetUserData(); - ::rtl::OUString aTmp; - if ( aSeq.getLength()) - aSeq[0].Value >>= aTmp; - - OUString aWinData( aTmp ); - maValue = (sal_uInt16)aWinData.toInt32(); - } -// OUString sHelpText; -// switch(maPos) -// { -// case LLINESPACE_1: -// sHelpText += mpStrTip[0]; -// break; -// case LLINESPACE_15: -// sHelpText += mpStrTip[2]; -// break; -// case LLINESPACE_2: -// sHelpText += mpStrTip[3]; -// break; -// case LLINESPACE_PROP: -// sHelpText +=maLine; -// sHelpText += "Proportion: "; -// sHelpText += maOf; -// sHelpText += OUString::number( maValue ); -// break; -// case LLINESPACE_MIN: -// sHelpText += maLine; -// sHelpText += "At Least: "; -// sHelpText += maOf; -// sHelpText += OUString::number( maValue ); -// break; -// case LLINESPACE_DURCH: -// sHelpText += maLine; -// sHelpText += "Leading: "; -// sHelpText += maOf; -// sHelpText += OUString::number( maValue ); -// break; -// case LLINESPACE_FIX: -// sHelpText += maLine; -// sHelpText += "Fixed: "; -// sHelpText += maOf; -// sHelpText += OUString::number( maValue ); -// break; -// } - if( !aWinOpt.Exists() && !aWinOpt2.Exists() ) - mbLineSPDisable = true; - else - mbLineSPDisable = false; - -// if( mbLineSPDisable ) -// maLineSpacing.ReplaceItemImages(5, maImgCusGrey,0); -// else -// { -// maLineSpacing.ReplaceItemImages(5, maImgCus,0); -// maLineSpacing.SetItemText(5,sHelpText); -// } - SfxItemState eState = currSPState; SetFieldUnit(*mpLineDistAtMetricBox, currMetricUnit); mpLineDist->Enable(); - pActLineDistFld->Enable(); - pActLineDistFld->SetText( "" ); + mpActLineDistFld->Enable(); + mpActLineDistFld->SetText( "" ); //bool bValueSetFocus = sal_False; //wj if( eState >= SfxItemState::DEFAULT ) { // SfxMapUnit eUnit = maLNSpaceControl.GetCoreMetric(); SfxMapUnit eUnit = SFX_MAPUNIT_100TH_MM; - m_eLNSpaceUnit = eUnit; + meLNSpaceUnit = eUnit; switch( currSPItem->GetLineSpaceRule() ) { @@ -224,9 +121,8 @@ void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMe case SVX_INTER_LINE_SPACE_OFF: { mpLineDist->SelectEntryPos( LLINESPACE_1 ); - pActLineDistFld->Disable(); - pActLineDistFld->SetText( "" ); - mbUseLineSPCustom = DO_NOT_CUSTOM; + mpActLineDistFld->Disable(); + mpActLineDistFld->SetText( "" ); if ( LINESPACE_1 == currSPItem->GetPropLineSpace() ) { // maLineSpacing.SelectItem(1); @@ -240,9 +136,8 @@ void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMe if ( LINESPACE_1 == currSPItem->GetPropLineSpace() ) { mpLineDist->SelectEntryPos( LLINESPACE_1 ); - pActLineDistFld->Disable(); - pActLineDistFld->SetText( "" ); - mbUseLineSPCustom = DO_NOT_CUSTOM; + mpActLineDistFld->Disable(); + mpActLineDistFld->SetText( "" ); // maLineSpacing.SelectItem(1); //bValueSetFocus = sal_True; //wj break; @@ -250,10 +145,9 @@ void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMe if ( LINESPACE_15 == currSPItem->GetPropLineSpace() ) { mpLineDist->SelectEntryPos( LLINESPACE_15 ); - pActLineDistFld->Disable(); - pActLineDistFld->SetText( "" ); + mpActLineDistFld->Disable(); + mpActLineDistFld->SetText( "" ); - mbUseLineSPCustom = DO_NOT_CUSTOM; // maLineSpacing.SelectItem(3); //bValueSetFocus = sal_True; //wj break; @@ -261,44 +155,41 @@ void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMe if ( LINESPACE_2 == currSPItem->GetPropLineSpace() ) { mpLineDist->SelectEntryPos( LLINESPACE_2 ); - pActLineDistFld->Disable(); - pActLineDistFld->SetText( "" ); + mpActLineDistFld->Disable(); + mpActLineDistFld->SetText( "" ); - mbUseLineSPCustom = DO_NOT_CUSTOM; // maLineSpacing.SelectItem(4); //bValueSetFocus = sal_True; //wj break; } mpLineDist->SelectEntryPos( LLINESPACE_PROP ); - if(pActLineDistFld != mpLineDistAtPercentBox) + if(mpActLineDistFld != mpLineDistAtPercentBox) { - pActLineDistFld->Disable(); - pActLineDistFld->Hide(); - pActLineDistFld = mpLineDistAtPercentBox; + mpActLineDistFld->Disable(); + mpActLineDistFld->Hide(); + mpActLineDistFld = mpLineDistAtPercentBox; } else { - pActLineDistFld = mpLineDistAtMetricBox; - pActLineDistFld->Disable(); - pActLineDistFld->Hide(); - pActLineDistFld = mpLineDistAtPercentBox; + mpActLineDistFld = mpLineDistAtMetricBox; + mpActLineDistFld->Disable(); + mpActLineDistFld->Hide(); + mpActLineDistFld = mpLineDistAtPercentBox; } - pActLineDistFld->Enable(); - pActLineDistFld->Show(); + mpActLineDistFld->Enable(); + mpActLineDistFld->Show(); mpLineDistAtPercentBox-> SetValue( mpLineDistAtPercentBox->Normalize( currSPItem->GetPropLineSpace() ) ); if( currSPItem->GetPropLineSpace() == LINESPACE_115 ) { - mbUseLineSPCustom = DO_NOT_CUSTOM; // maLineSpacing.SelectItem(2); //bValueSetFocus = sal_True; //wj } else { - mbUseLineSPCustom = USE_CUSTOM; // maLineSpacing.SetNoSelection(); // maLineSpacing.SelectItem(0); } @@ -307,28 +198,27 @@ void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMe case SVX_INTER_LINE_SPACE_FIX: { - if(pActLineDistFld != mpLineDistAtMetricBox) + if(mpActLineDistFld != mpLineDistAtMetricBox) { - pActLineDistFld->Disable(); - pActLineDistFld->Hide(); - pActLineDistFld = mpLineDistAtMetricBox; + mpActLineDistFld->Disable(); + mpActLineDistFld->Hide(); + mpActLineDistFld = mpLineDistAtMetricBox; } else { - pActLineDistFld = mpLineDistAtPercentBox; - pActLineDistFld->Disable(); - pActLineDistFld->Hide(); - pActLineDistFld = mpLineDistAtMetricBox; + mpActLineDistFld = mpLineDistAtPercentBox; + mpActLineDistFld->Disable(); + mpActLineDistFld->Hide(); + mpActLineDistFld = mpLineDistAtMetricBox; } - pActLineDistFld->Enable(); - pActLineDistFld->Show(); + mpActLineDistFld->Enable(); + mpActLineDistFld->Show(); // maLineSpacing.SetNoSelection(); // maLineSpacing.SelectItem(0); SetMetricValue(*mpLineDistAtMetricBox, currSPItem->GetInterLineSpace(), eUnit); mpLineDist->SelectEntryPos( LLINESPACE_DURCH ); - mbUseLineSPCustom = USE_CUSTOM; } break; default: @@ -338,53 +228,51 @@ void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMe break; case SVX_LINE_SPACE_FIX: { - if(pActLineDistFld != mpLineDistAtMetricBox) + if(mpActLineDistFld != mpLineDistAtMetricBox) { - pActLineDistFld->Disable(); - pActLineDistFld->Hide(); - pActLineDistFld = mpLineDistAtMetricBox; + mpActLineDistFld->Disable(); + mpActLineDistFld->Hide(); + mpActLineDistFld = mpLineDistAtMetricBox; } else { - pActLineDistFld = mpLineDistAtPercentBox; - pActLineDistFld->Disable(); - pActLineDistFld->Hide(); - pActLineDistFld = mpLineDistAtMetricBox; + mpActLineDistFld = mpLineDistAtPercentBox; + mpActLineDistFld->Disable(); + mpActLineDistFld->Hide(); + mpActLineDistFld = mpLineDistAtMetricBox; } - pActLineDistFld->Enable(); - pActLineDistFld->Show(); + mpActLineDistFld->Enable(); + mpActLineDistFld->Show(); // maLineSpacing.SetNoSelection(); // maLineSpacing.SelectItem(0); SetMetricValue(*mpLineDistAtMetricBox, currSPItem->GetLineHeight(), eUnit); mpLineDist->SelectEntryPos( LLINESPACE_FIX ); - mbUseLineSPCustom = USE_CUSTOM; } break; case SVX_LINE_SPACE_MIN: { - if(pActLineDistFld != mpLineDistAtMetricBox) + if(mpActLineDistFld != mpLineDistAtMetricBox) { - pActLineDistFld->Disable(); - pActLineDistFld->Hide(); - pActLineDistFld = mpLineDistAtMetricBox; + mpActLineDistFld->Disable(); + mpActLineDistFld->Hide(); + mpActLineDistFld = mpLineDistAtMetricBox; } else { - pActLineDistFld = mpLineDistAtPercentBox; - pActLineDistFld->Disable(); - pActLineDistFld->Hide(); - pActLineDistFld = mpLineDistAtMetricBox; + mpActLineDistFld = mpLineDistAtPercentBox; + mpActLineDistFld->Disable(); + mpActLineDistFld->Hide(); + mpActLineDistFld = mpLineDistAtMetricBox; } - pActLineDistFld->Enable(); - pActLineDistFld->Show(); + mpActLineDistFld->Enable(); + mpActLineDistFld->Show(); // maLineSpacing.SetNoSelection(); // maLineSpacing.SelectItem(0); SetMetricValue(*mpLineDistAtMetricBox, currSPItem->GetLineHeight(), eUnit); mpLineDist->SelectEntryPos( LLINESPACE_MIN ); - mbUseLineSPCustom = USE_CUSTOM; } break; default: @@ -394,21 +282,19 @@ void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMe else if( eState == SfxItemState::DISABLED ) { mpLineDist->Disable(); - pActLineDistFld->Enable(false); - pActLineDistFld->SetText( "" ); + mpActLineDistFld->Enable(false); + mpActLineDistFld->SetText( "" ); // maLineSpacing.SetNoSelection(); // maLineSpacing.SelectItem(0); - mbUseLineSPCustom = DO_NOT_CUSTOM; } else { - pActLineDistFld->Enable(false); - pActLineDistFld->SetText( "" ); + mpActLineDistFld->Enable(false); + mpActLineDistFld->SetText( "" ); mpLineDist->SetNoSelection(); // maLineSpacing.SetNoSelection(); // maLineSpacing.SelectItem(0); - mbUseLineSPCustom = DO_NOT_CUSTOM; } mpLineDist->SaveValue(); @@ -459,13 +345,13 @@ IMPL_LINK( ParaLineSpacingControl, LineSPDistHdl_Impl, ListBox*, pBox ) case LLINESPACE_1: case LLINESPACE_15: case LLINESPACE_2: - pActLineDistFld->Enable(false); - pActLineDistFld->SetText( "" ); + mpActLineDistFld->Enable(false); + mpActLineDistFld->SetText( "" ); break; case LLINESPACE_DURCH: mpLineDistAtPercentBox->Hide(); - pActLineDistFld = mpLineDistAtMetricBox; + mpActLineDistFld = mpLineDistAtMetricBox; mpLineDistAtMetricBox->SetMin(0); @@ -473,47 +359,47 @@ IMPL_LINK( ParaLineSpacingControl, LineSPDistHdl_Impl, ListBox*, pBox ) mpLineDistAtMetricBox->SetValue( mpLineDistAtMetricBox->Normalize( 0 ) ); mpLineDistAtPercentBox->Hide(); - pActLineDistFld->Show(); - pActLineDistFld->Enable(); + mpActLineDistFld->Show(); + mpActLineDistFld->Enable(); break; case LLINESPACE_MIN: mpLineDistAtPercentBox->Hide(); - pActLineDistFld = mpLineDistAtMetricBox; + mpActLineDistFld = mpLineDistAtMetricBox; mpLineDistAtMetricBox->SetMin(0); if ( mpLineDistAtMetricBox->GetText().isEmpty() ) mpLineDistAtMetricBox->SetValue( mpLineDistAtMetricBox->Normalize( 0 ), FUNIT_TWIP ); mpLineDistAtPercentBox->Hide(); - pActLineDistFld->Show(); - pActLineDistFld->Enable(); + mpActLineDistFld->Show(); + mpActLineDistFld->Enable(); break; case LLINESPACE_PROP: mpLineDistAtMetricBox->Hide(); - pActLineDistFld = mpLineDistAtPercentBox; + mpActLineDistFld = mpLineDistAtPercentBox; if ( mpLineDistAtPercentBox->GetText().isEmpty() ) mpLineDistAtPercentBox->SetValue( mpLineDistAtPercentBox->Normalize( 100 ), FUNIT_TWIP ); mpLineDistAtMetricBox->Hide(); - pActLineDistFld->Show(); - pActLineDistFld->Enable(); + mpActLineDistFld->Show(); + mpActLineDistFld->Enable(); break; case LLINESPACE_FIX: { mpLineDistAtPercentBox->Hide(); - pActLineDistFld = mpLineDistAtMetricBox; + mpActLineDistFld = mpLineDistAtMetricBox; sal_Int64 nTemp = mpLineDistAtMetricBox->GetValue(); - mpLineDistAtMetricBox->SetMin(mpLineDistAtMetricBox->Normalize(nMinFixDist), FUNIT_TWIP); + mpLineDistAtMetricBox->SetMin(mpLineDistAtMetricBox->Normalize(MIN_FIXED_DISTANCE), FUNIT_TWIP); if ( mpLineDistAtMetricBox->GetValue() != nTemp ) SetMetricValue(*mpLineDistAtMetricBox, FIX_DIST_DEF, SFX_MAPUNIT_TWIP); mpLineDistAtPercentBox->Hide(); - pActLineDistFld->Show(); - pActLineDistFld->Enable(); + mpActLineDistFld->Show(); + mpActLineDistFld->Enable(); } break; } @@ -532,7 +418,7 @@ void ParaLineSpacingControl::ExecuteLineSpace() mpLineDist->SaveValue(); // maLineSpacing.SetNoSelection(); - SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); + SvxLineSpacingItem aSpacing(DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); sal_uInt16 nPos = mpLineDist->GetSelectEntryPos(); switch ( nPos ) @@ -540,30 +426,17 @@ void ParaLineSpacingControl::ExecuteLineSpace() case LLINESPACE_1: case LLINESPACE_15: case LLINESPACE_2: - { - SetLineSpace( aSpacing, nPos ); - maPos = nPos; - } + SetLineSpace( aSpacing, nPos ); break; case LLINESPACE_PROP: - { - SetLineSpace( aSpacing, nPos, - mpLineDistAtPercentBox->Denormalize( - (long)mpLineDistAtPercentBox->GetValue() ) ); - maPos = nPos; - maValue =mpLineDistAtPercentBox->GetValue(); - } + SetLineSpace(aSpacing, nPos, mpLineDistAtPercentBox->Denormalize((long)mpLineDistAtPercentBox->GetValue())); break; case LLINESPACE_MIN: case LLINESPACE_DURCH: case LLINESPACE_FIX: - { - SetLineSpace(aSpacing, nPos, GetCoreValue(*mpLineDistAtMetricBox, m_eLNSpaceUnit)); - maPos = nPos; - maValue = GetCoreValue(*mpLineDistAtMetricBox, m_eLNSpaceUnit); - } + SetLineSpace(aSpacing, nPos, GetCoreValue(*mpLineDistAtMetricBox, meLNSpaceUnit)); break; default: @@ -573,8 +446,6 @@ void ParaLineSpacingControl::ExecuteLineSpace() SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute( SID_ATTR_PARA_LINESPACE, SfxCallMode::RECORD, &aSpacing, 0L); - - mbUseLineSPCustom = USE_CUSTOM; } void ParaLineSpacingControl::SetLineSpace( SvxLineSpacingItem& rLineSpace, @@ -646,7 +517,7 @@ void ParaLineSpacingControl::ExecuteLineSpacing(sal_uInt16 nEntry) { mpLineDist->SelectEntryPos(nEntry) ; mpLineDist->SaveValue(); - SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); + SvxLineSpacingItem aSpacing(DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); // special-case the 1.15 line spacing if (nEntry == LLINESPACE_115) @@ -657,8 +528,6 @@ void ParaLineSpacingControl::ExecuteLineSpacing(sal_uInt16 nEntry) SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute( SID_ATTR_PARA_LINESPACE, SfxCallMode::RECORD, &aSpacing, 0L); - mbUseLineSPCustom = DO_NOT_CUSTOM; - // close when the user used the buttons EndPopupMode(); } diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx index 0cea335..968b09c 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx @@ -47,15 +47,11 @@ public: int eSpace, long lValue = 0 ); void ExecuteLineSpacing(sal_uInt16 aEntry); - void PopupModeEndCallback(); private: - bool mbUseLineSPCustom; - bool mbLineSPDisable; - SfxMapUnit m_eLNSpaceUnit; + SfxMapUnit meLNSpaceUnit; - long nMinFixDist; - Edit* pActLineDistFld; + Edit* mpActLineDistFld; PushButton* mpSpacing1Button; PushButton* mpSpacing115Button; @@ -67,8 +63,6 @@ private: MetricField* mpLineDistAtPercentBox; MetricField* mpLineDistAtMetricBox; - sal_Int64 maValue; - sal_uInt16 maPos; private: void initial(); DECL_LINK(LineSPDistHdl_Impl, ListBox*); commit b654f0bc935bedad1d0aa3358c1ae9949b4db02d Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Nov 4 10:15:22 2014 +0100 line spacing: "Of:" -> "Value:" Change-Id: I7bf251d994a0f74788d4f498626db0e0663be6c8 diff --git a/svx/uiconfig/ui/paralinespacingcontrol.ui b/svx/uiconfig/ui/paralinespacingcontrol.ui index 1dfb0cb..9f9e557 100644 --- a/svx/uiconfig/ui/paralinespacingcontrol.ui +++ b/svx/uiconfig/ui/paralinespacingcontrol.ui @@ -1,6 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> <!-- interface-requires gtk+ 3.10 --> + <object class="GtkImage" id="image_spacing_2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_right">6</property> + <property name="xalign">0</property> + <property name="pixbuf">svx/res/symphony/lpspacing-2.png</property> + <property name="icon-size">1</property> + </object> <object class="GtkWindow" id="ParaLineSpacingControl"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -154,7 +162,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Of:</property> + <property name="label" translatable="yes">Value:</property> </object> <packing> <property name="left_attach">0</property> @@ -267,12 +275,4 @@ <property name="pixbuf">svx/res/symphony/lpspacing-1_5.png</property> <property name="icon-size">1</property> </object> - <object class="GtkImage" id="image_spacing_2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_right">6</property> - <property name="xalign">0</property> - <property name="pixbuf">svx/res/symphony/lpspacing-2.png</property> - <property name="icon-size">1</property> - </object> </interface> commit 4000f93c9464be91c6a19231c93f3ac52df873e9 Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Nov 4 10:04:46 2014 +0100 line spacing: Kill the "Last value" button. Close popup when used via buttons. Change-Id: I48eabbe5e1f41f5ed015d2fa95ade5376576cac9 diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx index 55fab66..8e3d924 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx @@ -36,6 +36,7 @@ #define LINESPACE_2 200 #define LINESPACE_115 115 +// values of the mpLineDist listbox #define LLINESPACE_1 0 #define LLINESPACE_15 1 #define LLINESPACE_2 2 @@ -44,6 +45,9 @@ #define LLINESPACE_DURCH 5 #define LLINESPACE_FIX 6 +// special case; should not conflict with the mpLinDist values +#define LLINESPACE_115 7 + #define DO_NOT_CUSTOM false #define USE_CUSTOM true @@ -67,7 +71,6 @@ ParaLineSpacingControl::ParaLineSpacingControl(sal_uInt16 nId) mpSpacing115Button = get<PushButton>("spacing_115"); mpSpacing15Button = get<PushButton>("spacing_15"); mpSpacing2Button = get<PushButton>("spacing_2"); - mpSpacingLastButton = get<PushButton>("spacing_last"); mpLineDist = get<ListBox>("line_dist"); mpLineDistAtPercentBox = get<MetricField>("percent_box"); @@ -90,7 +93,6 @@ void ParaLineSpacingControl::initial() mpSpacing115Button->SetClickHdl(aLink); mpSpacing15Button->SetClickHdl(aLink); mpSpacing2Button->SetClickHdl(aLink); - mpSpacingLastButton->SetClickHdl(aLink); aLink = LINK( this, ParaLineSpacingControl, LineSPDistHdl_Impl ); mpLineDist->SetSelectHdl(aLink); @@ -622,79 +624,43 @@ IMPL_LINK(ParaLineSpacingControl, PredefinedValuesHandler, void *, pControl) { if (pControl == mpSpacing1Button) { - ExecuteLineSpacing(false, LLINESPACE_1); + ExecuteLineSpacing(LLINESPACE_1); } else if (pControl == mpSpacing115Button) { - ExecuteLineSpacing(false, LLINESPACE_PROP); + ExecuteLineSpacing(LLINESPACE_115); } else if (pControl == mpSpacing15Button) { - ExecuteLineSpacing(false, LLINESPACE_15); + ExecuteLineSpacing(LLINESPACE_15); } else if (pControl == mpSpacing2Button) { - ExecuteLineSpacing( false, 2 ); - } - else - { - if(!(mbLineSPDisable)) - { - mpLineDist->SelectEntryPos( maPos ) ; - mpLineDist->SaveValue(); - - SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); - switch(maPos) - { - case LLINESPACE_1: - case LLINESPACE_15: - case LLINESPACE_2: - SetLineSpace(aSpacing, maPos); - break; - - case LLINESPACE_PROP: - SetLineSpace(aSpacing, maPos, mpLineDistAtPercentBox->Denormalize((long)maValue)); - break; - - case LLINESPACE_MIN: - case LLINESPACE_DURCH: - case LLINESPACE_FIX: - SetLineSpace(aSpacing, maPos, (long)maValue); - break; - } - - SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute( - SID_ATTR_PARA_LINESPACE, SfxCallMode::RECORD, &aSpacing, 0L); - - ExecuteLineSpacing(USE_CUSTOM, 0); - } + ExecuteLineSpacing(LLINESPACE_2); } return 0; } -void ParaLineSpacingControl::ExecuteLineSpacing( bool aIsCustom, sal_uInt16 aEntry ) +void ParaLineSpacingControl::ExecuteLineSpacing(sal_uInt16 nEntry) { - if( !aIsCustom ) - { - mpLineDist->SelectEntryPos( aEntry ) ; - mpLineDist->SaveValue(); - SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); - sal_uInt16 nPos = aEntry; - if( aEntry == LLINESPACE_PROP ) - SetLineSpace( aSpacing, nPos, mpLineDistAtPercentBox->Denormalize( (long)115 ) ); - else - SetLineSpace( aSpacing, nPos ); - - SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute( + mpLineDist->SelectEntryPos(nEntry) ; + mpLineDist->SaveValue(); + SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); + + // special-case the 1.15 line spacing + if (nEntry == LLINESPACE_115) + SetLineSpace(aSpacing, LLINESPACE_PROP, mpLineDistAtPercentBox->Denormalize(115L)); + else + SetLineSpace(aSpacing, nEntry); + + SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute( SID_ATTR_PARA_LINESPACE, SfxCallMode::RECORD, &aSpacing, 0L); - } - if( !aIsCustom ) - { - mbUseLineSPCustom = DO_NOT_CUSTOM; - } -// maLineSpacing.SetNoSelection(); + mbUseLineSPCustom = DO_NOT_CUSTOM; + + // close when the user used the buttons + EndPopupMode(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx index 492cfb8..0cea335 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx @@ -46,7 +46,7 @@ public: void SetLineSpace( SvxLineSpacingItem& rLineSpace, int eSpace, long lValue = 0 ); - void ExecuteLineSpacing( bool aIsCustom, sal_uInt16 aEntry ); + void ExecuteLineSpacing(sal_uInt16 aEntry); void PopupModeEndCallback(); private: @@ -61,7 +61,6 @@ private: PushButton* mpSpacing115Button; PushButton* mpSpacing15Button; PushButton* mpSpacing2Button; - PushButton* mpSpacingLastButton; ListBox* mpLineDist; diff --git a/svx/uiconfig/ui/paralinespacingcontrol.ui b/svx/uiconfig/ui/paralinespacingcontrol.ui index c7ad5b7..1dfb0cb 100644 --- a/svx/uiconfig/ui/paralinespacingcontrol.ui +++ b/svx/uiconfig/ui/paralinespacingcontrol.ui @@ -1,55 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> <!-- interface-requires gtk+ 3.10 --> - <object class="GtkAdjustment" id="adjustment1"> - <property name="lower">50</property> - <property name="upper">200</property> - <property name="value">100</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> - </object> - <object class="GtkAdjustment" id="adjustment2"> - <property name="upper">9999</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> - </object> - <object class="GtkImage" id="image_spacing_1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="pixbuf">svx/res/symphony/lpspacing-1.png</property> - </object> - <object class="GtkImage" id="image_spacing_115"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_right">6</property> - <property name="xalign">0</property> - <property name="pixbuf">svx/res/symphony/lpspacing-1_15.png</property> - <property name="icon-size">1</property> - </object> - <object class="GtkImage" id="image_spacing_15"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_right">6</property> - <property name="xalign">0</property> - <property name="pixbuf">svx/res/symphony/lpspacing-1_5.png</property> - <property name="icon-size">1</property> - </object> - <object class="GtkImage" id="image_spacing_2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_right">6</property> - <property name="xalign">0</property> - <property name="pixbuf">svx/res/symphony/lpspacing-2.png</property> - <property name="icon-size">1</property> - </object> - <object class="GtkImage" id="image_spacing_last"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_right">6</property> - <property name="xalign">0</property> - <property name="pixbuf">svx/res/symphony/last_custom_common.png</property> - <property name="icon-size">1</property> - </object> <object class="GtkWindow" id="ParaLineSpacingControl"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -66,9 +17,9 @@ <object class="GtkGrid" id="grid2"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="margin_right">6</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="row_spacing">6</property> <child> <object class="GtkButton" id="spacing_1"> <property name="label">Spacing: 1</property> @@ -142,24 +93,6 @@ </packing> </child> <child> - <object class="GtkButton" id="spacing_last"> - <property name="label">Last Custom Value</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="image">image_spacing_last</property> - <property name="relief">none</property> - <property name="xalign">0</property> - <property name="always_show_image">True</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> <object class="GtkFrame" id="frame1"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -242,6 +175,7 @@ <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="invisible_char">â</property> + <property name="invisible_char_set">True</property> <property name="adjustment">adjustment1</property> </object> <packing> @@ -257,6 +191,7 @@ <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="invisible_char">â</property> + <property name="invisible_char_set">True</property> <property name="adjustment">adjustment2</property> </object> <packing> @@ -291,7 +226,7 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">5</property> + <property name="top_attach">4</property> <property name="width">1</property> <property name="height">1</property> </packing> @@ -299,4 +234,45 @@ </object> </child> </object> + <object class="GtkAdjustment" id="adjustment1"> + <property name="lower">50</property> + <property name="upper">200</property> + <property name="value">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment2"> + <property name="upper">9999</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkImage" id="image_spacing_1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">svx/res/symphony/lpspacing-1.png</property> + </object> + <object class="GtkImage" id="image_spacing_115"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_right">6</property> + <property name="xalign">0</property> + <property name="pixbuf">svx/res/symphony/lpspacing-1_15.png</property> + <property name="icon-size">1</property> + </object> + <object class="GtkImage" id="image_spacing_15"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_right">6</property> + <property name="xalign">0</property> + <property name="pixbuf">svx/res/symphony/lpspacing-1_5.png</property> + <property name="icon-size">1</property> + </object> + <object class="GtkImage" id="image_spacing_2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_right">6</property> + <property name="xalign">0</property> + <property name="pixbuf">svx/res/symphony/lpspacing-2.png</property> + <property name="icon-size">1</property> + </object> </interface> commit 5bb43d06622a10c247ceeaeaceb236c5e3dcdcf0 Author: Jan Holesovsky <ke...@collabora.com> Date: Sun Nov 2 01:44:05 2014 +0100 line spacing: Make the buttons work - they set the line spacing now. Change-Id: Ib0a08ebedbab5bfe4db196a4d22d4a08fec15f60 diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx index a8c20f9..55fab66 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx @@ -23,9 +23,9 @@ #include <svx/dialmgr.hxx> #include <unotools/viewoptions.hxx> #include <editeng/kernitem.hxx> -#include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/sidebar/Theme.hxx> +#include <sfx2/viewfrm.hxx> #include <svtools/unitconv.hxx> #include <vcl/settings.hxx> @@ -54,16 +54,21 @@ using namespace svx; using namespace svx::sidebar; -ParaLineSpacingControl::ParaLineSpacingControl(sal_uInt16 nId, const css::uno::Reference<css::frame::XFrame>& rFrame, vcl::Window* pParentWindow, WinBits nBits) +ParaLineSpacingControl::ParaLineSpacingControl(sal_uInt16 nId) : SfxPopupWindow(nId, "ParaLineSpacingControl", "svx/ui/paralinespacingcontrol.ui") , mbUseLineSPCustom(false) , mbLineSPDisable(false) - , mpBindings(NULL) , nMinFixDist(BEGIN_VALUE) // , maLineSpacing(ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES( LINE_SPACING ) ) , maValue( 0 ) , maPos( 0 ) { + mpSpacing1Button = get<PushButton>("spacing_1"); + mpSpacing115Button = get<PushButton>("spacing_115"); + mpSpacing15Button = get<PushButton>("spacing_15"); + mpSpacing2Button = get<PushButton>("spacing_2"); + mpSpacingLastButton = get<PushButton>("spacing_last"); + mpLineDist = get<ListBox>("line_dist"); mpLineDistAtPercentBox = get<MetricField>("percent_box"); mpLineDistAtMetricBox = get<MetricField>("metric_box"); @@ -80,35 +85,17 @@ ParaLineSpacingControl::~ParaLineSpacingControl() void ParaLineSpacingControl::initial() { -// maLineSpacing.SetStyle( maLineSpacing.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT ); -// -// maLineSpacing.SetControlBackground( -// GetSettings().GetStyleSettings().GetHighContrastMode() -// ? GetSettings().GetStyleSettings().GetMenuColor() -// : sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); -// maLineSpacing.SetColor( -// GetSettings().GetStyleSettings().GetHighContrastMode() -// ? GetSettings().GetStyleSettings().GetMenuColor() -// : sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); -// maLineSpacing.SetBackground( -// GetSettings().GetStyleSettings().GetHighContrastMode() -// ? GetSettings().GetStyleSettings().GetMenuColor() -// : sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); - -// for (int i=0;i<4;i++) -// maLineSpacing.AddItem(mpImg[i], &mpImgSel[i],mpStr[i],&mpStrTip[i]); - -// maLineSpacing.AddItem( maImgCus, 0, maStrCus, 0 ); - - SetAllNoSel(); - Link aLink = LINK(this, ParaLineSpacingControl,VSSelHdl ); -// maLineSpacing.SetSelectHdl(aLink); -// maLineSpacing.StartSelection(); -// maLineSpacing.Show(); + Link aLink = LINK(this, ParaLineSpacingControl, PredefinedValuesHandler); + mpSpacing1Button->SetClickHdl(aLink); + mpSpacing115Button->SetClickHdl(aLink); + mpSpacing15Button->SetClickHdl(aLink); + mpSpacing2Button->SetClickHdl(aLink); + mpSpacingLastButton->SetClickHdl(aLink); aLink = LINK( this, ParaLineSpacingControl, LineSPDistHdl_Impl ); mpLineDist->SetSelectHdl(aLink); mpLineDist->SelectEntryPos( LLINESPACE_1 ) ; + aLink = LINK( this, ParaLineSpacingControl, LineSPDistAtHdl_Impl ); mpLineDistAtPercentBox->SetModifyHdl( aLink ); mpLineDistAtMetricBox->SetModifyHdl( aLink ); @@ -213,7 +200,6 @@ void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMe SetFieldUnit(*mpLineDistAtMetricBox, currMetricUnit); -// mpLineSPPage->SetAllNoSel(); mpLineDist->Enable(); pActLineDistFld->Enable(); pActLineDistFld->SetText( "" ); @@ -459,12 +445,6 @@ void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMe // maLineSpacing.StartSelection(); } -void ParaLineSpacingControl::SetAllNoSel() -{ -// maLineSpacing.SelectItem(1); -// maLineSpacing.SetNoSelection(); -} - IMPL_LINK( ParaLineSpacingControl, LineSPDistHdl_Impl, ListBox*, pBox ) { // maLineSpacing.SetNoSelection(); @@ -589,7 +569,7 @@ void ParaLineSpacingControl::ExecuteLineSpace() break; } - mpBindings->GetDispatcher()->Execute( + SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute( SID_ATTR_PARA_LINESPACE, SfxCallMode::RECORD, &aSpacing, 0L); mbUseLineSPCustom = USE_CUSTOM; @@ -638,66 +618,57 @@ void ParaLineSpacingControl::SetLineSpace( SvxLineSpacingItem& rLineSpace, } } -IMPL_LINK(ParaLineSpacingControl, VSSelHdl, void *, pControl) +IMPL_LINK(ParaLineSpacingControl, PredefinedValuesHandler, void *, pControl) { -// maLineSpacing.SetNoSelection(); -// bool bClosePop = true; -// if(pControl == &maLineSpacing) -// { -// sal_uInt16 iPos = maLineSpacing.GetSelectItemId(); -// switch ( iPos ) -// { -// case 1: -// ExecuteLineSpacing( false, 0 ); -// break; -// case 2: -// ExecuteLineSpacing( false, 3 ); -// break; -// case 3: -// ExecuteLineSpacing( false, 1 ); -// break; -// case 4: -// ExecuteLineSpacing( false, 2 ); -// break; -// case 5: -// { -// if(!(mbLineSPDisable)) -// { -// mpLineDist->SelectEntryPos( maPos ) ; -// mpLineDist->SaveValue(); -// -// SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); -// switch(maPos) -// { -// case LLINESPACE_1: -// case LLINESPACE_15: -// case LLINESPACE_2: -// SetLineSpace( aSpacing, maPos ); -// break; -// -// case LLINESPACE_PROP: -// SetLineSpace( aSpacing, maPos, -// mpLineDistAtPercentBox->Denormalize( (long)maValue ) ); -// break; -// -// case LLINESPACE_MIN: -// case LLINESPACE_DURCH: -// case LLINESPACE_FIX: -// SetLineSpace( aSpacing, maPos, (long)maValue ); -// break; -// } -// -// mpBindings->GetDispatcher()->Execute( -// SID_ATTR_PARA_LINESPACE, SfxCallMode::RECORD, &aSpacing, 0L); -// -// ExecuteLineSpacing( USE_CUSTOM, 0 ); -// } -// else -// bClosePop = false; -// } -// break; -// } -// } + if (pControl == mpSpacing1Button) + { + ExecuteLineSpacing(false, LLINESPACE_1); + } + else if (pControl == mpSpacing115Button) + { + ExecuteLineSpacing(false, LLINESPACE_PROP); + } + else if (pControl == mpSpacing15Button) + { + ExecuteLineSpacing(false, LLINESPACE_15); + } + else if (pControl == mpSpacing2Button) + { + ExecuteLineSpacing( false, 2 ); + } + else + { + if(!(mbLineSPDisable)) + { + mpLineDist->SelectEntryPos( maPos ) ; + mpLineDist->SaveValue(); + + SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE); + switch(maPos) + { + case LLINESPACE_1: + case LLINESPACE_15: + case LLINESPACE_2: + SetLineSpace(aSpacing, maPos); + break; + + case LLINESPACE_PROP: + SetLineSpace(aSpacing, maPos, mpLineDistAtPercentBox->Denormalize((long)maValue)); + break; + + case LLINESPACE_MIN: + case LLINESPACE_DURCH: + case LLINESPACE_FIX: + SetLineSpace(aSpacing, maPos, (long)maValue); + break; + } + + SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute( + SID_ATTR_PARA_LINESPACE, SfxCallMode::RECORD, &aSpacing, 0L); + + ExecuteLineSpacing(USE_CUSTOM, 0); + } + } return 0; } @@ -715,7 +686,7 @@ void ParaLineSpacingControl::ExecuteLineSpacing( bool aIsCustom, sal_uInt16 aEnt else SetLineSpace( aSpacing, nPos ); - mpBindings->GetDispatcher()->Execute( + SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute( SID_ATTR_PARA_LINESPACE, SfxCallMode::RECORD, &aSpacing, 0L); } diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx index a4f94b6..492cfb8 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx @@ -34,34 +34,35 @@ namespace svx { class ParaLineSpacingControl : public SfxPopupWindow { public: - ParaLineSpacingControl(sal_uInt16 nId, const css::uno::Reference<css::frame::XFrame>& rFrame, vcl::Window* pParentWindow, WinBits nBits); + ParaLineSpacingControl(sal_uInt16 nId); virtual ~ParaLineSpacingControl(); void Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext); - //virtual void Paint(const Rectangle& rect); - //add short GetLastCustomState(); long GetLastCustomValue(); - //add end void ExecuteLineSpace(); void SetLineSpace( SvxLineSpacingItem& rLineSpace, int eSpace, long lValue = 0 ); void ExecuteLineSpacing( bool aIsCustom, sal_uInt16 aEntry ); - void SetAllNoSel(); void PopupModeEndCallback(); private: bool mbUseLineSPCustom; bool mbLineSPDisable; SfxMapUnit m_eLNSpaceUnit; - SfxBindings* mpBindings; long nMinFixDist; Edit* pActLineDistFld; + PushButton* mpSpacing1Button; + PushButton* mpSpacing115Button; + PushButton* mpSpacing15Button; + PushButton* mpSpacing2Button; + PushButton* mpSpacingLastButton; + ListBox* mpLineDist; MetricField* mpLineDistAtPercentBox; @@ -73,7 +74,7 @@ private: void initial(); DECL_LINK(LineSPDistHdl_Impl, ListBox*); DECL_LINK(LineSPDistAtHdl_Impl, void*); - DECL_LINK(VSSelHdl, void*); + DECL_LINK(PredefinedValuesHandler, void*); }; } // namespace svx diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx index 4f97276..07683b3 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx @@ -44,7 +44,7 @@ SfxPopupWindowType ParaLineSpacingPopup::GetPopupWindowType() const SfxPopupWindow* ParaLineSpacingPopup::CreatePopupWindow() { - ParaLineSpacingControl* pControl = new ParaLineSpacingControl(GetSlotId(), m_xFrame, &GetToolBox(), /* WinBits - TODO? */(WinBits)0); + ParaLineSpacingControl* pControl = new ParaLineSpacingControl(GetSlotId()); //pControl->StartPopupMode(&GetToolBox(), FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE); pControl->StartPopupMode(&GetToolBox(), FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE); commit b59b183ce3b84bec6722110ee80d6158b6a60377 Author: Jan Holesovsky <ke...@collabora.com> Date: Sat Nov 1 02:04:54 2014 +0100 line spacing: Convert the ParaLineSpacingControl to .ui. Change-Id: I81dd0d541e7f7dd3e3fb881c2c318f9adc733fde diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc index d3a74f0..142da59 100644 --- a/include/svx/dialogs.hrc +++ b/include/svx/dialogs.hrc @@ -1015,16 +1015,6 @@ #define RID_SVX_SIDEBAR_BEGIN (RID_SVX_START + 1241) #define IMG_SPACE3 (RID_SVX_SIDEBAR_BEGIN + 0) #define IMG_INDENT_HANG (RID_SVX_SIDEBAR_BEGIN + 1) -#define IMG_SPACING1 (RID_SVX_SIDEBAR_BEGIN + 2) -#define IMG_SPACING115 (RID_SVX_SIDEBAR_BEGIN + 3) -#define IMG_SPACING15 (RID_SVX_SIDEBAR_BEGIN + 4) -#define IMG_SPACING2 (RID_SVX_SIDEBAR_BEGIN + 5) ... etc. - the rest is truncated
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits