diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-01-07 14:08:57 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-01-09 13:24:12 +0100 |
commit | 006f4caf543d6d6ce5f069b2af8c2ba982dcfb62 (patch) | |
tree | 922eca559917947778a8488d66e0f92cca182306 | |
parent | 1f1de88b3acb388082f689229d487956bd5050b0 (diff) |
weld ParaPropertyPanel
Change-Id: Id486c73559e698979e223c7f1ca8a16caba3bbfd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86357
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/svx/relfld.hxx | 3 | ||||
-rw-r--r-- | svx/source/sidebar/paragraph/ParaPropertyPanel.cxx | 254 | ||||
-rw-r--r-- | svx/source/sidebar/paragraph/ParaPropertyPanel.hxx | 38 | ||||
-rw-r--r-- | svx/uiconfig/ui/sidebarparagraph.ui | 173 |
4 files changed, 285 insertions, 183 deletions
diff --git a/include/svx/relfld.hxx b/include/svx/relfld.hxx index c7370f3159f7..8f8c84dc38f3 100644 --- a/include/svx/relfld.hxx +++ b/include/svx/relfld.hxx @@ -65,6 +65,9 @@ public: void set_text(const OUString& rText) { m_xSpinButton->set_text(rText); } void save_value() { m_xSpinButton->save_value(); } bool get_value_changed_from_saved() const { return m_xSpinButton->get_value_changed_from_saved(); } + void set_size_request(int nWidth, int nHeight) { m_xSpinButton->set_size_request(nWidth, nHeight); } + Size get_preferred_size() const { return m_xSpinButton->get_preferred_size(); } + weld::SpinButton& get_widget() { return m_xSpinButton->get_widget(); } int GetCoreValue(MapUnit eUnit) const { return ::GetCoreValue(*m_xSpinButton, eUnit); } void SetFieldUnit(FieldUnit eUnit, bool bAll = false) { ::SetFieldUnit(*m_xSpinButton, eUnit, bAll); } diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx index aa520d799ba6..ebc6f2d9ce87 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -21,6 +21,7 @@ #include <sfx2/dispatch.hxx> #include <sfx2/module.hxx> #include <sfx2/viewfrm.hxx> +#include <sfx2/weldutils.hxx> #include <editeng/lrspitem.hxx> #include <editeng/ulspitem.hxx> #include <vcl/toolbox.hxx> @@ -81,9 +82,9 @@ void ParaPropertyPanel::HandleContextChange ( { case CombinedEnumContext(Application::Calc, Context::DrawText): case CombinedEnumContext(Application::WriterVariants, Context::DrawText): - mpTBxVertAlign->Show(); - mpTBxBackColor->Hide(); - mpTBxNumBullet->Hide(); + mxTBxVertAlign->show(); + mxTBxBackColor->hide(); + mxTBxNumBullet->hide(); ReSize(); break; @@ -92,31 +93,31 @@ void ParaPropertyPanel::HandleContextChange ( case CombinedEnumContext(Application::DrawImpress, Context::Graphic): case CombinedEnumContext(Application::DrawImpress, Context::DrawText): case CombinedEnumContext(Application::DrawImpress, Context::Table): - mpTBxVertAlign->Show(); - mpTBxBackColor->Hide(); - mpTBxNumBullet->Hide(); + mxTBxVertAlign->show(); + mxTBxBackColor->hide(); + mxTBxNumBullet->hide(); ReSize(); break; case CombinedEnumContext(Application::WriterVariants, Context::Default): case CombinedEnumContext(Application::WriterVariants, Context::Text): - mpTBxVertAlign->Hide(); - mpTBxBackColor->Show(); - mpTBxNumBullet->Show(); + mxTBxVertAlign->hide(); + mxTBxBackColor->show(); + mxTBxNumBullet->show(); ReSize(); break; case CombinedEnumContext(Application::WriterVariants, Context::Table): - mpTBxVertAlign->Show(); - mpTBxBackColor->Show(); - mpTBxNumBullet->Show(); + mxTBxVertAlign->show(); + mxTBxBackColor->show(); + mxTBxNumBullet->show(); ReSize(); break; case CombinedEnumContext(Application::WriterVariants, Context::Annotation): - mpTBxVertAlign->Hide(); - mpTBxBackColor->Hide(); - mpTBxNumBullet->Hide(); + mxTBxVertAlign->hide(); + mxTBxBackColor->hide(); + mxTBxNumBullet->hide(); ReSize(); break; @@ -142,37 +143,39 @@ void ParaPropertyPanel::ReSize() void ParaPropertyPanel::InitToolBoxIndent() { - Link<Edit&,void> aLink = LINK( this, ParaPropertyPanel, ModifyIndentHdl_Impl ); - mpLeftIndent->SetModifyHdl( aLink ); - mpRightIndent->SetModifyHdl( aLink ); - mpFLineIndent->SetModifyHdl( aLink ); + Link<weld::MetricSpinButton&,void> aLink = LINK( this, ParaPropertyPanel, ModifyIndentHdl_Impl ); + mxLeftIndent->connect_value_changed( aLink ); + mxRightIndent->connect_value_changed( aLink ); + mxFLineIndent->connect_value_changed( aLink ); m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric(); } void ParaPropertyPanel::InitToolBoxSpacing() { - Link<Edit&,void> aLink = LINK( this, ParaPropertyPanel, ULSpaceHdl_Impl ); - mpTopDist->SetModifyHdl(aLink); - mpBottomDist->SetModifyHdl( aLink ); + Link<weld::MetricSpinButton&,void> aLink = LINK( this, ParaPropertyPanel, ULSpaceHdl_Impl ); + mxTopDist->connect_value_changed(aLink); + mxBottomDist->connect_value_changed( aLink ); m_eULSpaceUnit = maULSpaceControl.GetCoreMetric(); } void ParaPropertyPanel::initial() { + limitMetricWidths(); + //toolbox InitToolBoxIndent(); InitToolBoxSpacing(); } // for Paragraph Indent -IMPL_LINK_NOARG( ParaPropertyPanel, ModifyIndentHdl_Impl, Edit&, void) +IMPL_LINK_NOARG( ParaPropertyPanel, ModifyIndentHdl_Impl, weld::MetricSpinButton&, void) { SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE ); - aMargin.SetTextLeft( GetCoreValue( *mpLeftIndent, m_eLRSpaceUnit ) ); - aMargin.SetRight( GetCoreValue( *mpRightIndent, m_eLRSpaceUnit ) ); - aMargin.SetTextFirstLineOfst( static_cast<short>(GetCoreValue( *mpFLineIndent, m_eLRSpaceUnit )) ); + aMargin.SetTextLeft(mxLeftIndent->GetCoreValue(m_eLRSpaceUnit)); + aMargin.SetRight(mxRightIndent->GetCoreValue(m_eLRSpaceUnit)); + aMargin.SetTextFirstLineOfst(static_cast<short>(mxFLineIndent->GetCoreValue(m_eLRSpaceUnit))); GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_PARA_LRSPACE, SfxCallMode::RECORD, { &aMargin }); @@ -180,11 +183,11 @@ IMPL_LINK_NOARG( ParaPropertyPanel, ModifyIndentHdl_Impl, Edit&, void) // for Paragraph Spacing -IMPL_LINK_NOARG( ParaPropertyPanel, ULSpaceHdl_Impl, Edit&, void) +IMPL_LINK_NOARG( ParaPropertyPanel, ULSpaceHdl_Impl, weld::MetricSpinButton&, void) { SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE ); - aMargin.SetUpper( static_cast<sal_uInt16>(GetCoreValue( *mpTopDist, m_eULSpaceUnit )) ); - aMargin.SetLower( static_cast<sal_uInt16>(GetCoreValue( *mpBottomDist, m_eULSpaceUnit )) ); + aMargin.SetUpper( static_cast<sal_uInt16>(mxTopDist->GetCoreValue(m_eULSpaceUnit))); + aMargin.SetLower( static_cast<sal_uInt16>(mxBottomDist->GetCoreValue(m_eULSpaceUnit))); GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_PARA_ULSPACE, SfxCallMode::RECORD, { &aMargin }); @@ -203,11 +206,13 @@ void ParaPropertyPanel::NotifyItemUpdate( m_eMetricUnit = GetCurrentUnit(eState,pState); if( m_eMetricUnit!=m_last_eMetricUnit ) { - SetFieldUnit( *mpLeftIndent, m_eMetricUnit ); - SetFieldUnit( *mpRightIndent, m_eMetricUnit ); - SetFieldUnit( *mpFLineIndent, m_eMetricUnit ); - SetFieldUnit( *mpTopDist, m_eMetricUnit ); - SetFieldUnit( *mpBottomDist, m_eMetricUnit ); + mxLeftIndent->SetFieldUnit(m_eMetricUnit); + mxRightIndent->SetFieldUnit(m_eMetricUnit); + mxFLineIndent->SetFieldUnit(m_eMetricUnit); + mxTopDist->SetFieldUnit(m_eMetricUnit); + mxBottomDist->SetFieldUnit(m_eMetricUnit); + + limitMetricWidths(); } m_last_eMetricUnit = m_eMetricUnit; } @@ -237,18 +242,18 @@ void ParaPropertyPanel::StateChangedIndentImpl( SfxItemState eState, const SfxPo case CombinedEnumContext(Application::DrawImpress, Context::Graphic): case CombinedEnumContext(Application::DrawImpress, Context::Table): { - mpLeftIndent->SetMin( DEFAULT_VALUE ); - mpRightIndent->SetMin( DEFAULT_VALUE ); - mpFLineIndent->SetMin( DEFAULT_VALUE ); + mxLeftIndent->set_min( DEFAULT_VALUE, FieldUnit::NONE ); + mxRightIndent->set_min( DEFAULT_VALUE, FieldUnit::NONE ); + mxFLineIndent->set_min( DEFAULT_VALUE, FieldUnit::NONE ); } break; case CombinedEnumContext(Application::WriterVariants, Context::Default): case CombinedEnumContext(Application::WriterVariants, Context::Text): case CombinedEnumContext(Application::WriterVariants, Context::Table): { - mpLeftIndent->SetMin( NEGA_MAXVALUE, FieldUnit::MM_100TH ); - mpRightIndent->SetMin( NEGA_MAXVALUE, FieldUnit::MM_100TH ); - mpFLineIndent->SetMin( NEGA_MAXVALUE, FieldUnit::MM_100TH ); + mxLeftIndent->set_min( NEGA_MAXVALUE, FieldUnit::MM_100TH ); + mxRightIndent->set_min( NEGA_MAXVALUE, FieldUnit::MM_100TH ); + mxFLineIndent->set_min( NEGA_MAXVALUE, FieldUnit::MM_100TH ); } break; } @@ -269,17 +274,17 @@ void ParaPropertyPanel::StateChangedIndentImpl( SfxItemState eState, const SfxPo aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MapUnit::Map100thMM, MapUnit::MapTwip ); long nVal = OutputDevice::LogicToLogic( maTxtLeft, MapUnit::MapTwip, MapUnit::Map100thMM ); - nVal = static_cast<long>(mpLeftIndent->Normalize( nVal )); + nVal = static_cast<long>(mxLeftIndent->normalize( nVal )); if ( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application::WriterVariants, Context::Text) && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application::WriterVariants, Context::Default) && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application::WriterVariants, Context::Table)) { - mpFLineIndent->SetMin( nVal*-1, FieldUnit::MM_100TH ); + mxFLineIndent->set_min( nVal*-1, FieldUnit::MM_100TH ); } long nrVal = OutputDevice::LogicToLogic( aTxtRight, MapUnit::MapTwip, MapUnit::Map100thMM ); - nrVal = static_cast<long>(mpRightIndent->Normalize( nrVal )); + nrVal = static_cast<long>(mxRightIndent->normalize( nrVal )); switch (maContext.GetCombinedContext_DI()) { @@ -289,9 +294,9 @@ void ParaPropertyPanel::StateChangedIndentImpl( SfxItemState eState, const SfxPo case CombinedEnumContext(Application::WriterVariants, Context::Table): case CombinedEnumContext(Application::WriterVariants, Context::Annotation): { - mpLeftIndent->SetMax( MAX_SW - nrVal, FieldUnit::MM_100TH ); - mpRightIndent->SetMax( MAX_SW - nVal, FieldUnit::MM_100TH ); - mpFLineIndent->SetMax( MAX_SW - nVal - nrVal, FieldUnit::MM_100TH ); + mxLeftIndent->set_max( MAX_SW - nrVal, FieldUnit::MM_100TH ); + mxRightIndent->set_max( MAX_SW - nVal, FieldUnit::MM_100TH ); + mxFLineIndent->set_max( MAX_SW - nVal - nrVal, FieldUnit::MM_100TH ); } break; case CombinedEnumContext(Application::DrawImpress, Context::DrawText): @@ -300,37 +305,39 @@ void ParaPropertyPanel::StateChangedIndentImpl( SfxItemState eState, const SfxPo case CombinedEnumContext(Application::DrawImpress, Context::TextObject): case CombinedEnumContext(Application::DrawImpress, Context::Graphic): { - mpLeftIndent->SetMax( MAX_SC_SD - nrVal, FieldUnit::MM_100TH ); - mpRightIndent->SetMax( MAX_SC_SD - nVal, FieldUnit::MM_100TH ); - mpFLineIndent->SetMax( MAX_SC_SD - nVal - nrVal, FieldUnit::MM_100TH ); + mxLeftIndent->set_max( MAX_SC_SD - nrVal, FieldUnit::MM_100TH ); + mxRightIndent->set_max( MAX_SC_SD - nVal, FieldUnit::MM_100TH ); + mxFLineIndent->set_max( MAX_SC_SD - nVal - nrVal, FieldUnit::MM_100TH ); } } - mpLeftIndent->SetValue( nVal, FieldUnit::MM_100TH ); - mpRightIndent->SetValue( nrVal, FieldUnit::MM_100TH ); + mxLeftIndent->set_value( nVal, FieldUnit::MM_100TH ); + mxRightIndent->set_value( nrVal, FieldUnit::MM_100TH ); long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MapUnit::MapTwip, MapUnit::Map100thMM ); - nfVal = static_cast<long>(mpFLineIndent->Normalize( nfVal )); - mpFLineIndent->SetValue( nfVal, FieldUnit::MM_100TH ); + nfVal = static_cast<long>(mxFLineIndent->normalize( nfVal )); + mxFLineIndent->set_value( nfVal, FieldUnit::MM_100TH ); } else if( eState == SfxItemState::DISABLED ) { - mpLeftIndent-> Disable(); - mpRightIndent->Disable(); - mpFLineIndent->Disable(); + mxLeftIndent->set_sensitive(false); + mxRightIndent->set_sensitive(false); + mxFLineIndent->set_sensitive(false); } else { - mpLeftIndent->SetEmptyFieldValue(); - mpRightIndent->SetEmptyFieldValue(); - mpFLineIndent->SetEmptyFieldValue(); + mxLeftIndent->set_text(""); + mxRightIndent->set_text(""); + mxFLineIndent->set_text(""); } + + limitMetricWidths(); } void ParaPropertyPanel::StateChangedULImpl( SfxItemState eState, const SfxPoolItem* pState ) { - mpTopDist->SetMax( mpTopDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) ); - mpBottomDist->SetMax( mpBottomDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) ); + mxTopDist->set_max( mxTopDist->normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) ); + mxBottomDist->set_max( mxBottomDist->normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) ); if( pState && eState >= SfxItemState::DEFAULT ) { @@ -345,23 +352,24 @@ void ParaPropertyPanel::StateChangedULImpl( SfxItemState eState, const SfxPoolIt maLower = OutputDevice::LogicToLogic( maLower, MapUnit::Map100thMM, MapUnit::MapTwip ); sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, MapUnit::MapTwip, MapUnit::Map100thMM ); - nVal = mpTopDist->Normalize( nVal ); - mpTopDist->SetValue( nVal, FieldUnit::MM_100TH ); + nVal = mxTopDist->normalize( nVal ); + mxTopDist->set_value( nVal, FieldUnit::MM_100TH ); nVal = OutputDevice::LogicToLogic( maLower, MapUnit::MapTwip, MapUnit::Map100thMM ); - nVal = mpBottomDist->Normalize( nVal ); - mpBottomDist->SetValue( nVal, FieldUnit::MM_100TH ); + nVal = mxBottomDist->normalize( nVal ); + mxBottomDist->set_value( nVal, FieldUnit::MM_100TH ); } else if(eState == SfxItemState::DISABLED ) { - mpTopDist->Disable(); - mpBottomDist->Disable(); + mxTopDist->set_sensitive(false); + mxBottomDist->set_sensitive(false); } else { - mpTopDist->SetEmptyFieldValue(); - mpBottomDist->SetEmptyFieldValue(); + mxTopDist->set_text(""); + mxBottomDist->set_text(""); } + limitMetricWidths(); } FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ) @@ -395,12 +403,47 @@ FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolI return eUnit; } +namespace +{ + void limitWidth(RelativeField& rMetricSpinButton) + { + // space is limited in the sidebar, so limit MetricSpinButtons to a width of 4 digits + const int nMaxDigits = 4; + + weld::SpinButton& rSpinButton = rMetricSpinButton.get_widget(); + rSpinButton.set_width_chars(std::min(rSpinButton.get_width_chars(), nMaxDigits)); + } +} + ParaPropertyPanel::ParaPropertyPanel(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings, const css::uno::Reference<css::ui::XSidebar>& rxSidebar) - : PanelLayout(pParent, "ParaPropertyPanel", "svx/ui/sidebarparagraph.ui", rxFrame), - + : PanelLayout(pParent, "ParaPropertyPanel", "svx/ui/sidebarparagraph.ui", rxFrame, true), + //Alignment + mxTBxHorzAlign(m_xBuilder->weld_toolbar("horizontalalignment")), + mxHorzAlignDispatch(new ToolbarUnoDispatcher(*mxTBxHorzAlign, rxFrame)), + mxTBxVertAlign(m_xBuilder->weld_toolbar("verticalalignment")), + mxVertAlignDispatch(new ToolbarUnoDispatcher(*mxTBxVertAlign, rxFrame)), + //NumBullet&Backcolor + mxTBxNumBullet(m_xBuilder->weld_toolbar("numberbullet")), + mxNumBulletDispatch(new ToolbarUnoDispatcher(*mxTBxNumBullet, rxFrame)), + mxTBxBackColor(m_xBuilder->weld_toolbar("backgroundcolor")), + mxBackColorDispatch(new ToolbarUnoDispatcher(*mxTBxBackColor, rxFrame)), + mxTBxWriteDirection(m_xBuilder->weld_toolbar("writedirection")), + mxWriteDirectionDispatch(new ToolbarUnoDispatcher(*mxTBxWriteDirection, rxFrame)), + mxTBxParaSpacing(m_xBuilder->weld_toolbar("paraspacing")), + mxParaSpacingDispatch(new ToolbarUnoDispatcher(*mxTBxParaSpacing, rxFrame)), + mxTBxLineSpacing(m_xBuilder->weld_toolbar("linespacing")), + mxLineSpacingDispatch(new ToolbarUnoDispatcher(*mxTBxLineSpacing, rxFrame)), + mxTBxIndent(m_xBuilder->weld_toolbar("indent")), + mxIndentDispatch(new ToolbarUnoDispatcher(*mxTBxIndent, rxFrame)), + //Paragraph spacing + mxTopDist(new RelativeField(m_xBuilder->weld_metric_spin_button("aboveparaspacing", FieldUnit::CM))), + mxBottomDist(new RelativeField(m_xBuilder->weld_metric_spin_button("belowparaspacing", FieldUnit::CM))), + mxLeftIndent(new RelativeField(m_xBuilder->weld_metric_spin_button("beforetextindent", FieldUnit::CM))), + mxRightIndent(new RelativeField(m_xBuilder->weld_metric_spin_button("aftertextindent", FieldUnit::CM))), + mxFLineIndent(new RelativeField(m_xBuilder->weld_metric_spin_button("firstlineindent", FieldUnit::CM))), maTxtLeft (0), maUpper (0), maLower (0), @@ -415,27 +458,27 @@ ParaPropertyPanel::ParaPropertyPanel(vcl::Window* pParent, mpBindings(pBindings), mxSidebar(rxSidebar) { - //Alignment - get(mpTBxVertAlign, "verticalalignment"); - //NumBullet&Backcolor - get(mpTBxNumBullet, "numberbullet"); - get(mpTBxBackColor, "backgroundcolor"); - //Paragraph spacing - get(mpTopDist, "aboveparaspacing"); - mpTopDist->set_width_request(mpTopDist->get_preferred_size().Width()); - get(mpBottomDist, "belowparaspacing"); - mpBottomDist->set_width_request(mpBottomDist->get_preferred_size().Width()); - get(mpLeftIndent, "beforetextindent"); - mpLeftIndent->set_width_request(mpLeftIndent->get_preferred_size().Width()); - get(mpRightIndent, "aftertextindent"); - mpRightIndent->set_width_request(mpRightIndent->get_preferred_size().Width()); - get(mpFLineIndent, "firstlineindent"); - mpFLineIndent->set_width_request(mpFLineIndent->get_preferred_size().Width()); +#if 0 + mxTopDist->set_size_request(mxTopDist->get_preferred_size().Width(), -1); + mxBottomDist->set_size_request(mxBottomDist->get_preferred_size().Width(), -1); + mxLeftIndent->set_size_request(mxLeftIndent->get_preferred_size().Width(), -1); + mxRightIndent->set_size_request(mxRightIndent->get_preferred_size().Width(), -1); + mxFLineIndent->set_size_request(mxFLineIndent->get_preferred_size().Width(), -1); +#endif initial(); m_aMetricCtl.RequestUpdate(); } +void ParaPropertyPanel::limitMetricWidths() +{ + limitWidth(*mxTopDist); + limitWidth(*mxBottomDist); + limitWidth(*mxLeftIndent); + limitWidth(*mxRightIndent); + limitWidth(*mxFLineIndent); +} + ParaPropertyPanel::~ParaPropertyPanel() { disposeOnce(); @@ -443,14 +486,35 @@ ParaPropertyPanel::~ParaPropertyPanel() void ParaPropertyPanel::dispose() { - mpTBxVertAlign.clear(); - mpTBxNumBullet.clear(); - mpTBxBackColor.clear(); - mpTopDist.clear(); - mpBottomDist.clear(); - mpLeftIndent.clear(); - mpRightIndent.clear(); - mpFLineIndent.clear(); + mxHorzAlignDispatch.reset(); + mxTBxHorzAlign.reset(); + + mxVertAlignDispatch.reset(); + mxTBxVertAlign.reset(); + + mxNumBulletDispatch.reset(); + mxTBxNumBullet.reset(); + + mxBackColorDispatch.reset(); + mxTBxBackColor.reset(); + + mxWriteDirectionDispatch.reset(); + mxTBxWriteDirection.reset(); + + mxParaSpacingDispatch.reset(); + mxTBxParaSpacing.reset(); + + mxLineSpacingDispatch.reset(); + mxTBxLineSpacing.reset(); + + mxIndentDispatch.reset(); + mxTBxIndent.reset(); + + mxTopDist.reset(); + mxBottomDist.reset(); + mxLeftIndent.reset(); + mxRightIndent.reset(); + mxFLineIndent.reset(); maLRSpaceControl.dispose(); maULSpaceControl.dispose(); diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx index 0c1c5bcc6099..6a6aacd5f8ff 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx @@ -33,7 +33,7 @@ #include <svl/poolitem.hxx> #include <tools/fldunit.hxx> -class ToolBox; +class ToolbarUnoDispatcher; namespace svx { namespace sidebar { @@ -74,16 +74,31 @@ public: private: // UI controls //Alignment - VclPtr<ToolBox> mpTBxVertAlign; + std::unique_ptr<weld::Toolbar> mxTBxHorzAlign; + std::unique_ptr<ToolbarUnoDispatcher> mxHorzAlignDispatch; + std::unique_ptr<weld::Toolbar> mxTBxVertAlign; + std::unique_ptr<ToolbarUnoDispatcher> mxVertAlignDispatch; //NumBullet&Backcolor - VclPtr<ToolBox> mpTBxNumBullet; - VclPtr<ToolBox> mpTBxBackColor; + std::unique_ptr<weld::Toolbar> mxTBxNumBullet; + std::unique_ptr<ToolbarUnoDispatcher> mxNumBulletDispatch; + std::unique_ptr<weld::Toolbar> mxTBxBackColor; + std::unique_ptr<ToolbarUnoDispatcher> mxBackColorDispatch; + + std::unique_ptr<weld::Toolbar> mxTBxWriteDirection; + std::unique_ptr<ToolbarUnoDispatcher> mxWriteDirectionDispatch; + std::unique_ptr<weld::Toolbar> mxTBxParaSpacing; + std::unique_ptr<ToolbarUnoDispatcher> mxParaSpacingDispatch; + std::unique_ptr<weld::Toolbar> mxTBxLineSpacing; + std::unique_ptr<ToolbarUnoDispatcher> mxLineSpacingDispatch; + std::unique_ptr<weld::Toolbar> mxTBxIndent; + std::unique_ptr<ToolbarUnoDispatcher> mxIndentDispatch; + //Paragraph spacing - VclPtr<SvxRelativeField> mpTopDist; - VclPtr<SvxRelativeField> mpBottomDist; - VclPtr<SvxRelativeField> mpLeftIndent; - VclPtr<SvxRelativeField> mpRightIndent; - VclPtr<SvxRelativeField> mpFLineIndent; + std::unique_ptr<RelativeField> mxTopDist; + std::unique_ptr<RelativeField> mxBottomDist; + std::unique_ptr<RelativeField> mxLeftIndent; + std::unique_ptr<RelativeField> mxRightIndent; + std::unique_ptr<RelativeField> mxFLineIndent; // Data Member long maTxtLeft; @@ -103,8 +118,8 @@ private: SfxBindings* const mpBindings; css::uno::Reference<css::ui::XSidebar> mxSidebar; - DECL_LINK(ModifyIndentHdl_Impl, Edit&, void); - DECL_LINK(ULSpaceHdl_Impl, Edit&, void); + DECL_LINK(ModifyIndentHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(ULSpaceHdl_Impl, weld::MetricSpinButton&, void); void StateChangedIndentImpl( SfxItemState eState, const SfxPoolItem* pState ); void StateChangedULImpl( SfxItemState eState, const SfxPoolItem* pState ); @@ -113,6 +128,7 @@ private: void ReSize(); void InitToolBoxIndent(); void InitToolBoxSpacing(); + void limitMetricWidths(); }; } } // end of namespace svx::sidebar diff --git a/svx/uiconfig/ui/sidebarparagraph.ui b/svx/uiconfig/ui/sidebarparagraph.ui index 435ddf2e199b..3b89f623a52e 100644 --- a/svx/uiconfig/ui/sidebarparagraph.ui +++ b/svx/uiconfig/ui/sidebarparagraph.ui @@ -2,12 +2,31 @@ <!-- Generated with glade 3.22.1 --> <interface domain="svx"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> <object class="GtkAdjustment" id="adjustment1"> <property name="upper">100</property> <property name="step_increment">1</property> <property name="page_increment">10</property> </object> + <object class="GtkAdjustment" id="adjustment2"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment3"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment4"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment5"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> <object class="GtkGrid" id="ParaPropertyPanel"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -19,35 +38,35 @@ <property name="column_spacing">6</property> <property name="column_homogeneous">True</property> <child> - <object class="sfxlo-SidebarToolBox" id="numberbullet"> + <object class="GtkToolbar" id="numberbullet"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="tooltip_text" translatable="yes" context="sidebarparagraph|numberbullet|tooltip_text">Bullets and Numbering</property> + <property name="toolbar_style">icons</property> <property name="show_arrow">False</property> + <property name="icon_size">2</property> <child> - <object class="GtkMenuToolButton" id="bullet"> + <object class="GtkMenuToolButton" id=".uno:DefaultBullet"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="is_important">True</property> - <property name="action_name">.uno:DefaultBullet</property> <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="homogeneous">False</property> </packing> </child> <child> - <object class="GtkMenuToolButton" id="number"> + <object class="GtkMenuToolButton" id=".uno:DefaultNumbering"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="is_important">True</property> - <property name="action_name">.uno:DefaultNumbering</property> <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="homogeneous">False</property> </packing> </child> </object> @@ -63,58 +82,56 @@ <property name="margin_bottom">6</property> <property name="spacing">6</property> <child> - <object class="sfxlo-SidebarToolBox" id="horizontalalignment"> + <object class="GtkToolbar" id="horizontalalignment"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="tooltip_text" translatable="yes" context="sidebarparagraph|horizontalalignment|tooltip_text">Horizontal Alignment</property> <property name="halign">start</property> + <property name="toolbar_style">icons</property> <property name="show_arrow">False</property> + <property name="icon_size">2</property> <child> - <object class="GtkToolButton" id="leftpara"> + <object class="GtkToggleToolButton" id=".uno:LeftPara"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="action_name">.uno:LeftPara</property> <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="homogeneous">False</property> </packing> </child> <child> - <object class="GtkToolButton" id="centerpara"> + <object class="GtkToggleToolButton" id=".uno:CenterPara"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="action_name">.uno:CenterPara</property> <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="homogeneous">False</property> </packing> </child> <child> - <object class="GtkToolButton" id="rightpara"> + <object class="GtkToggleToolButton" id=".uno:RightPara"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="action_name">.uno:RightPara</property> <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="homogeneous">False</property> </packing> </child> <child> - <object class="GtkToolButton" id="substjustify"> + <object class="GtkToggleToolButton" id=".uno:JustifyPara"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="action_name">.uno:JustifyPara</property> <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="homogeneous">False</property> </packing> </child> </object> @@ -125,34 +142,34 @@ </packing> </child> <child> - <object class="sfxlo-SidebarToolBox" id="writedirection"> + <object class="GtkToolbar" id="writedirection"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="toolbar_style">icons</property> <property name="show_arrow">False</property> + <property name="icon_size">2</property> <child> - <object class="GtkToolButton" id="lefttoright"> + <object class="GtkToggleToolButton" id=".uno:ParaLeftToRight"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="is_important">True</property> - <property name="action_name">.uno:ParaLeftToRight</property> <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="homogeneous">False</property> </packing> </child> <child> - <object class="GtkToolButton" id="righttoleft"> + <object class="GtkToggleToolButton" id=".uno:ParaRightToLeft"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="is_important">True</property> - <property name="action_name">.uno:ParaRightToLeft</property> <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="homogeneous">False</property> </packing> </child> </object> @@ -163,47 +180,46 @@ </packing> </child> <child> - <object class="sfxlo-SidebarToolBox" id="verticalalignment"> + <object class="GtkToolbar" id="verticalalignment"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="tooltip_text" translatable="yes" context="sidebarparagraph|verticalalignment|tooltip_text">Vertical Alignment</property> <property name="halign">end</property> <property name="hexpand">True</property> + <property name="toolbar_style">icons</property> <property name="show_arrow">False</property> + <property name="icon_size">2</property> <child> - <object class="GtkToolButton" id="cellverttop"> + <object class="GtkToggleToolButton" id=".uno:CellVertTop"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="action_name">.uno:CellVertTop</property> <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="homogeneous">False</property> </packing> </child> <child> - <object class="GtkToolButton" id="cellvertcenter"> + <object class="GtkToggleToolButton" id=".uno:CellVertCenter"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="action_name">.uno:CellVertCenter</property> <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="homogeneous">False</property> </packing> </child> <child> - <object class="GtkToolButton" id="cellvertbottom"> + <object class="GtkToggleToolButton" id=".uno:CellVertBottom"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="action_name">.uno:CellVertBottom</property> <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="homogeneous">False</property> </packing> </child> </object> @@ -244,33 +260,33 @@ </packing> </child> <child> - <object class="sfxlo-SidebarToolBox" id="paraspacing"> + <object class="GtkToolbar" id="paraspacing"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="tooltip_text" translatable="yes" context="sidebarparagraph|paraspacing|tooltip_text">Spacing</property> + <property name="toolbar_style">icons</property> <property name="show_arrow">False</property> + <property name="icon_size">2</property> <child> - <object class="GtkToolButton" id="paraspaceinc"> + <object class="GtkToolButton" id=".uno:ParaspaceIncrease"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="action_name">.uno:ParaspaceIncrease</property> <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="homogeneous">False</property> </packing> </child> <child> - <object class="GtkToolButton" id="paraspacedec"> + <object class="GtkToolButton" id=".uno:ParaspaceDecrease"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="action_name">.uno:ParaspaceDecrease</property> <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="homogeneous">False</property> </packing> </child> </object> @@ -293,7 +309,7 @@ <property name="can_focus">False</property> <property name="halign">center</property> <property name="valign">center</property> - <property name="pixbuf">svx/res/symphony/spacing1.png</property> + <property name="icon_name">svx/res/symphony/spacing1.png</property> </object> <packing> <property name="expand">False</property> @@ -302,7 +318,7 @@ </packing> </child> <child> - <object class="svxlo-SvxRelativeField" id="aboveparaspacing"> + <object class="GtkSpinButton" id="aboveparaspacing"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="tooltip_text" translatable="yes" context="sidebarparagraph|aboveparaspacing|tooltip_text">Above Paragraph Spacing</property> @@ -341,7 +357,7 @@ <property name="can_focus">False</property> <property name="halign">center</property> <property name="valign">center</property> - <property name="pixbuf">svx/res/symphony/spacing2.png</property> + <property name="icon_name">svx/res/symphony/spacing2.png</property> </object> <packing> <property name="expand">False</property> @@ -350,13 +366,13 @@ </packing> </child> <child> - <object class="svxlo-SvxRelativeField" id="belowparaspacing"> + <object class="GtkSpinButton" id="belowparaspacing"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="tooltip_text" translatable="yes" context="sidebarparagraph|belowparaspacing|tooltip_text">Below Paragraph Spacing</property> <property name="hexpand">True</property> <property name="text">0</property> - <property name="adjustment">adjustment1</property> + <property name="adjustment">adjustment2</property> <child internal-child="accessible"> <object class="AtkObject" id="belowparaspacing-atkobject"> <property name="AtkObject::accessible-name" translatable="yes" context="sidebarparagraph|belowparaspacing-atkobject">Below Paragraph Spacing</property> @@ -377,22 +393,24 @@ </packing> </child> <child> - <object class="sfxlo-SidebarToolBox" id="linespacing"> + <object class="GtkToolbar" id="linespacing"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="margin_left">1</property> <property name="hexpand">True</property> + <property name="toolbar_style">icons</property> + <property name="show_arrow">False</property> + <property name="icon_size">2</property> <child> - <object class="GtkMenuToolButton" id="setlinespacing"> + <object class="GtkMenuToolButton" id=".uno:LineSpacing"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes" context="sidebarparagraph|setlinespacing|tooltip_text">Line Spacing</property> - <property name="action_name">.uno:LineSpacing</property> <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="homogeneous">False</property> </packing> </child> </object> @@ -431,48 +449,47 @@ </packing> </child> <child> - <object class="sfxlo-SidebarToolBox" id="indent"> + <object class="GtkToolbar" id="indent"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="tooltip_text" translatable="yes" context="sidebarparagraph|indent|tooltip_text">Indent</property> + <property name="toolbar_style">icons</property> <property name="show_arrow">False</property> + <property name="icon_size">2</property> <child> - <object class="GtkToolButton" id="increaseindent"> + <object class="GtkToolButton" id=".uno:IncrementIndent"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes" context="sidebarparagraph|increaseindent|tooltip_text">Increase Indent</property> - <property name="action_name">.uno:IncrementIndent</property> <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="homogeneous">False</property> </packing> </child> <child> - <object class="GtkToolButton" id="decreaseindent"> + <object class="GtkToolButton" id=".uno:DecrementIndent"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes" context="sidebarparagraph|decreaseindent|tooltip_text">Decrease Indent</property> - <property name="action_name">.uno:DecrementIndent</property> <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="homogeneous">False</property> </packing> </child> <child> - <object class="GtkToolButton" id="hangingindent"> + <object class="GtkToolButton" id=".uno:HangingIndent"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes" context="sidebarparagraph|hangingindent|tooltip_text">Switch to Hanging Indent</property> - <property name="action_name">.uno:HangingIndent</property> <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="homogeneous">False</property> </packing> </child> </object> @@ -495,7 +512,7 @@ <property name="can_focus">False</property> <property name="halign">center</property> <property name="valign">center</property> - <property name="pixbuf">svx/res/symphony/Indent4.png</property> + <property name="icon_name">svx/res/symphony/Indent4.png</property> </object> <packing> <property name="expand">False</property> @@ -504,13 +521,13 @@ </packing> </child> <child> - <object class="svxlo-SvxRelativeField" id="beforetextindent"> + <object class="GtkSpinButton" id="beforetextindent"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="tooltip_text" translatable="yes" context="sidebarparagraph|beforetextindent|tooltip_text">Before Text Indent</property> <property name="hexpand">True</property> <property name="text">0</property> - <property name="adjustment">adjustment1</property> + <property name="adjustment">adjustment3</property> <child internal-child="accessible"> <object class="AtkObject" id="beforetextindent-atkobject"> <property name="AtkObject::accessible-name" translatable="yes" context="sidebarparagraph|beforetextindent-atkobject">Before Text Indent</property> @@ -543,7 +560,7 @@ <property name="can_focus">False</property> <property name="halign">center</property> <property name="valign">center</property> - <property name="pixbuf">svx/res/symphony/Indent3.png</property> + <property name="icon_name">svx/res/symphony/Indent3.png</property> </object> <packing> <property name="expand">False</property> @@ -552,13 +569,13 @@ </packing> </child> <child> - <object class="svxlo-SvxRelativeField" id="aftertextindent"> + <object class="GtkSpinButton" id="aftertextindent"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="tooltip_text" translatable="yes" context="sidebarparagraph|aftertextindent|tooltip_text">After Text Indent</property> <property name="hexpand">True</property> <property name="text">0</property> - <property name="adjustment">adjustment1</property> + <property name="adjustment">adjustment4</property> <child internal-child="accessible"> <object class="AtkObject" id="aftertextindent-atkobject"> <property name="AtkObject::accessible-name" translatable="yes" context="sidebarparagraph|aftertextindent-atkobject">After Text Indent</property> @@ -591,7 +608,7 @@ <property name="can_focus">False</property> <property name="halign">center</property> <property name="valign">center</property> - <property name="pixbuf">svx/res/symphony/Indent2.png</property> + <property name="icon_name">svx/res/symphony/Indent2.png</property> </object> <packing> <property name="expand">False</property> @@ -600,13 +617,13 @@ </packing> </child> <child> - <object class="svxlo-SvxRelativeField" id="firstlineindent"> + <object class="GtkSpinButton" id="firstlineindent"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="tooltip_text" translatable="yes" context="sidebarparagraph|firstlineindent|tooltip_text">First Line Indent</property> <property name="hexpand">True</property> <property name="text">0</property> - <property name="adjustment">adjustment1</property> + <property name="adjustment">adjustment5</property> <child internal-child="accessible"> <object class="AtkObject" id="firstlineindent-atkobject"> <property name="AtkObject::accessible-name" translatable="yes" context="sidebarparagraph|firstlineindent-atkobject">First Line Indent</property> @@ -637,22 +654,24 @@ <property name="visible">True</property> <property name="can_focus">False</property> <child> - <object class="sfxlo-SidebarToolBox" id="backgroundcolor"> + <object class="GtkToolbar" id="backgroundcolor"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="tooltip_text" translatable="yes" context="sidebarparagraph|backgroundcolor|tooltip_text">Paragraph Background Color</property> <property name="halign">end</property> + <property name="toolbar_style">icons</property> + <property name="show_arrow">False</property> + <property name="icon_size">2</property> <child> - <object class="GtkMenuToolButton" id="parabkcolor"> + <object class="GtkMenuToolButton" id=".uno:BackgroundColor"> <property name="width_request">105</property> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="action_name">.uno:BackgroundColor</property> <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="homogeneous">False</property> </packing> </child> </object> |