From af71531ea292c62f785f8300205eddea8c2d33d2 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 21 Jan 2020 13:22:50 +0000 Subject: Resolves: tdf#130035 reuse toolbar for arrow styles in sidebar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8fdbf97a2e3f535767f0163a87c99ead8a3198cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87139 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- svx/source/sidebar/line/LinePropertyPanel.cxx | 23 --- svx/source/sidebar/line/LinePropertyPanel.hxx | 3 - svx/source/sidebar/line/LinePropertyPanelBase.cxx | 188 +--------------------- svx/uiconfig/ui/sidebarline.ui | 106 +++--------- 4 files changed, 28 insertions(+), 292 deletions(-) (limited to 'svx') diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx index 2667ffe749a7..cf6dc5505f72 100644 --- a/svx/source/sidebar/line/LinePropertyPanel.cxx +++ b/svx/source/sidebar/line/LinePropertyPanel.cxx @@ -54,9 +54,6 @@ LinePropertyPanel::LinePropertyPanel( maStyleControl(SID_ATTR_LINE_STYLE, *pBindings, *this), maDashControl (SID_ATTR_LINE_DASH, *pBindings, *this), maWidthControl(SID_ATTR_LINE_WIDTH, *pBindings, *this), - maStartControl(SID_ATTR_LINE_START, *pBindings, *this), - maEndControl(SID_ATTR_LINE_END, *pBindings, *this), - maLineEndListControl(SID_LINEEND_LIST, *pBindings, *this), maLineStyleListControl(SID_DASH_LIST, *pBindings, *this), maTransControl(SID_ATTR_LINE_TRANSPARENCE, *pBindings, *this), maEdgeStyle(SID_ATTR_LINE_JOINT, *pBindings, *this), @@ -77,9 +74,6 @@ void LinePropertyPanel::dispose() maStyleControl.dispose(); maDashControl.dispose(); maWidthControl.dispose(); - maStartControl.dispose(); - maEndControl.dispose(); - maLineEndListControl.dispose(); maLineStyleListControl.dispose(); maTransControl.dispose(); maEdgeStyle.dispose(); @@ -133,23 +127,6 @@ void LinePropertyPanel::NotifyItemUpdate( updateLineWidth(bDisabled, bSetOrDefault, pState); break; } - case SID_ATTR_LINE_START: - { - updateLineStart(bDisabled, bSetOrDefault, pState); - break; - } - case SID_ATTR_LINE_END: - { - updateLineEnd(bDisabled, bSetOrDefault, pState); - break; - } - case SID_LINEEND_LIST: - { - FillLineEndList(); - SelectEndStyle(true); - SelectEndStyle(false); - break; - } case SID_DASH_LIST: { FillLineStyleList(); diff --git a/svx/source/sidebar/line/LinePropertyPanel.hxx b/svx/source/sidebar/line/LinePropertyPanel.hxx index 99c1aee74a26..00585290f579 100644 --- a/svx/source/sidebar/line/LinePropertyPanel.hxx +++ b/svx/source/sidebar/line/LinePropertyPanel.hxx @@ -85,9 +85,6 @@ private: sfx2::sidebar::ControllerItem maStyleControl; sfx2::sidebar::ControllerItem maDashControl; sfx2::sidebar::ControllerItem maWidthControl; - sfx2::sidebar::ControllerItem maStartControl; - sfx2::sidebar::ControllerItem maEndControl; - sfx2::sidebar::ControllerItem maLineEndListControl; sfx2::sidebar::ControllerItem maLineStyleListControl; sfx2::sidebar::ControllerItem maTransControl; sfx2::sidebar::ControllerItem maEdgeStyle; diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx index 91b6b6931c51..cee744ebd3b1 100644 --- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx +++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx @@ -66,8 +66,8 @@ LinePropertyPanelBase::LinePropertyPanelBase( mxLBStyle(new SvxLineLB(m_xBuilder->weld_combo_box("linestyle"))), mxFTTransparency(m_xBuilder->weld_label("translabel")), mxMFTransparent(m_xBuilder->weld_metric_spin_button("linetransparency", FieldUnit::PERCENT)), - mxLBStart(new SvxLineEndLB(m_xBuilder->weld_combo_box("beginarrowstyle"))), - mxLBEnd(new SvxLineEndLB(m_xBuilder->weld_combo_box("endarrowstyle"))), + mxArrowsTB(m_xBuilder->weld_toolbar("arrowheads")), + mxArrowsDispatch(new ToolbarUnoDispatcher(*mxArrowsTB, rxFrame)), mxFTEdgeStyle(m_xBuilder->weld_label("cornerlabel")), mxLBEdgeStyle(m_xBuilder->weld_combo_box("edgestyle")), mxFTCapStyle(m_xBuilder->weld_label("caplabel")), @@ -80,8 +80,6 @@ LinePropertyPanelBase::LinePropertyPanelBase( mnTrans(0), meMapUnit(MapUnit::MapMM), mnWidthCoreValue(0), - mpStartItem(), - mpEndItem(), maIMGNone(BMP_NONE_ICON), mbWidthValuable(true), mbArrowSupported(true) @@ -104,8 +102,8 @@ void LinePropertyPanelBase::dispose() mxLBStyle.reset(); mxFTTransparency.reset(); mxMFTransparent.reset(); - mxLBStart.reset(); - mxLBEnd.reset(); + mxArrowsDispatch.reset(); + mxArrowsTB.reset(); mxFTEdgeStyle.reset(); mxLBEdgeStyle.reset(); mxFTCapStyle.reset(); @@ -136,12 +134,6 @@ void LinePropertyPanelBase::Initialize() mxTBWidth->set_item_icon_name(SELECTWIDTH, maIMGWidthIcon[0]); mxTBWidth->connect_clicked(LINK(this, LinePropertyPanelBase, ToolboxWidthSelectHdl)); - FillLineEndList(); - SelectEndStyle(true); - SelectEndStyle(false); - mxLBStart->connect_changed( LINK( this, LinePropertyPanelBase, ChangeStartHdl ) ); - mxLBEnd->connect_changed( LINK( this, LinePropertyPanelBase, ChangeEndHdl ) ); - mxMFTransparent->connect_value_changed(LINK(this, LinePropertyPanelBase, ChangeTransparentHdl)); mxLBEdgeStyle->connect_changed( LINK( this, LinePropertyPanelBase, ChangeEdgeStyleHdl ) ); @@ -262,54 +254,6 @@ void LinePropertyPanelBase::updateLineWidth(bool bDisabled, bool bSetOrDefault, SetWidthIcon(); } -void LinePropertyPanelBase::updateLineStart(bool bDisabled, bool bSetOrDefault, - const SfxPoolItem* pItem) -{ - if(bDisabled) - { - mxLBStart->set_sensitive(false); - } - else - { - if (mbArrowSupported) - mxLBStart->set_sensitive(true); - } - - if(bSetOrDefault && pItem) - { - mpStartItem.reset(static_cast(pItem->Clone())); - SelectEndStyle(true); - return; - } - - mpStartItem.reset(); - SelectEndStyle(true); -} - -void LinePropertyPanelBase::updateLineEnd(bool bDisabled, bool bSetOrDefault, - const SfxPoolItem* pItem) -{ - if(bDisabled) - { - mxLBEnd->set_sensitive(false); - } - else - { - if (mbArrowSupported) - mxLBEnd->set_sensitive(true); - } - - if(bSetOrDefault && pItem) - { - mpEndItem.reset(static_cast(pItem->Clone())); - SelectEndStyle(false); - return; - } - - mpEndItem.reset(); - SelectEndStyle(false); -} - void LinePropertyPanelBase::updateLineJoint(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pState) { @@ -460,34 +404,6 @@ IMPL_LINK_NOARG(LinePropertyPanelBase, ChangeLineStyleHdl, weld::ComboBox&, void ActivateControls(); } -IMPL_LINK_NOARG(LinePropertyPanelBase, ChangeStartHdl, weld::ComboBox&, void) -{ - sal_Int32 nPos = mxLBStart->get_active(); - if (nPos != -1 && mxLBStart->get_value_changed_from_saved()) - { - std::unique_ptr pItem; - if( nPos == 0 ) - pItem.reset(new XLineStartItem()); - else if( mxLineEndList.is() && mxLineEndList->Count() > static_cast( nPos - 1 ) ) - pItem.reset(new XLineStartItem( mxLBStart->get_active_text(),mxLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() )); - setLineStartStyle(pItem.get()); - } -} - -IMPL_LINK_NOARG(LinePropertyPanelBase, ChangeEndHdl, weld::ComboBox&, void) -{ - sal_Int32 nPos = mxLBEnd->get_active(); - if (nPos != -1 && mxLBEnd->get_value_changed_from_saved()) - { - std::unique_ptr pItem; - if( nPos == 0 ) - pItem.reset(new XLineEndItem()); - else if( mxLineEndList.is() && mxLineEndList->Count() > static_cast( nPos - 1 ) ) - pItem.reset(new XLineEndItem( mxLBEnd->get_active_text(), mxLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() )); - setLineEndStyle(pItem.get()); - } -} - IMPL_LINK_NOARG(LinePropertyPanelBase, ChangeEdgeStyleHdl, weld::ComboBox&, void) { const sal_Int32 nPos(mxLBEdgeStyle->get_active()); @@ -617,35 +533,6 @@ void LinePropertyPanelBase::SetWidth(long nWidth) mxLineWidthPopup->SetWidthSelect(mnWidthCoreValue, mbWidthValuable, meMapUnit); } -void LinePropertyPanelBase::FillLineEndList() -{ - SfxObjectShell* pSh = SfxObjectShell::Current(); - if ( pSh && pSh->GetItem( SID_LINEEND_LIST ) ) - { - mxLBStart->set_sensitive(true); - mxLBStart->clear(); - mxLBEnd->clear(); - mxLineEndList = pSh->GetItem( SID_LINEEND_LIST )->GetLineEndList(); - - if (mxLineEndList.is()) - { - OUString sNone(SvxResId(RID_SVXSTR_NONE)); - mxLBStart->append_text(sNone); - mxLBStart->Fill(mxLineEndList, true); - mxLBEnd->append_text(sNone); - mxLBEnd->Fill(mxLineEndList, false); - } - - mxLBStart->set_active(0); - mxLBEnd->set_active(0); - } - else - { - mxLBStart->set_sensitive(false); - mxLBEnd->set_sensitive(false); - } -} - void LinePropertyPanelBase::FillLineStyleList() { SfxObjectShell* pSh = SfxObjectShell::Current(); @@ -711,70 +598,6 @@ void LinePropertyPanelBase::SelectLineStyle() ActivateControls(); } -void LinePropertyPanelBase::SelectEndStyle(bool bStart) -{ - bool bSelected(false); - - if(bStart) - { - if (!mpStartItem) - { - mxLBStart->set_active(-1); - mxLBStart->set_sensitive(false); - return; - } - - if (mxLineEndList.is()) - { - const basegfx::B2DPolyPolygon& rItemPolygon = mpStartItem->GetLineStartValue(); - for(long a(0);!bSelected && a < mxLineEndList->Count(); a++) - { - const XLineEndEntry* pEntry = mxLineEndList->GetLineEnd(a); - const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd(); - if(rItemPolygon == rEntryPolygon) - { - mxLBStart->set_active(a + 1); - bSelected = true; - } - } - } - - if(!bSelected) - { - mxLBStart->set_active( 0 ); - } - } - else - { - if (!mpEndItem) - { - mxLBEnd->set_active(-1); - mxLBEnd->set_sensitive(false); - return; - } - - if (mxLineEndList.is()) - { - const basegfx::B2DPolyPolygon& rItemPolygon = mpEndItem->GetLineEndValue(); - for(long a(0);!bSelected && a < mxLineEndList->Count(); a++) - { - const XLineEndEntry* pEntry = mxLineEndList->GetLineEnd(a); - const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd(); - if(rItemPolygon == rEntryPolygon) - { - mxLBEnd->set_active(a + 1); - bSelected = true; - } - } - } - - if(!bSelected) - { - mxLBEnd->set_active( 0 ); - } - } -} - void LinePropertyPanelBase::ActivateControls() { const sal_Int32 nPos(mxLBStyle->get_active()); @@ -782,8 +605,7 @@ void LinePropertyPanelBase::ActivateControls() mxGridLineProps->set_sensitive( bLineStyle ); mxBoxArrowProps->set_sensitive( bLineStyle ); - mxLBStart->set_sensitive( bLineStyle && mbArrowSupported ); - mxLBEnd->set_sensitive( bLineStyle && mbArrowSupported ); + mxArrowsTB->set_sensitive( bLineStyle && mbArrowSupported ); } void LinePropertyPanelBase::setMapUnit(MapUnit eMapUnit) diff --git a/svx/uiconfig/ui/sidebarline.ui b/svx/uiconfig/ui/sidebarline.ui index d18b522417f7..997255fc5e80 100644 --- a/svx/uiconfig/ui/sidebarline.ui +++ b/svx/uiconfig/ui/sidebarline.ui @@ -7,18 +7,6 @@ 10 20 - - - - - - - - - - - - @@ -31,18 +19,6 @@ - - - - - - - - - - - - True False @@ -64,48 +40,14 @@ True False - vertical 3 - - - 65 - True - False - Select the style of the beginning arrowhead. - True - liststore4 - 0 - 1 - - - - 0 - - - - - - 3 - - - - - Beginning Style - - - - - False - True - 1 - - 105 True False Select the style of the line. + center True liststore5 0 @@ -131,41 +73,39 @@ False True - 2 + 0 - - 65 + True - False - liststore6 - Select the style of the ending arrowhead. - 0 - True - 1 - - - - 0 - - + True + Select the style of the arrowheads. + icons + False + 2 - - - 3 - + + True + False + Select the style of the arrowheads. + True + + + False + False + - - Ending Style + + Arrow Styles False True - 3 + 1 @@ -306,13 +246,13 @@ + True False vertical - True - False True + False 6 6 True -- cgit