svx/source/sidebar/line/LinePropertyPanel.cxx | 27 +++++++++++++++++++++++++- svx/source/sidebar/line/LinePropertyPanel.hxx | 6 +++++ 2 files changed, 32 insertions(+), 1 deletion(-)
New commits: commit eede66cd922b0f867b7521a9d96e2c6f42a973dc Author: Rishabh <kris.kr...@yahoo.in> Date: Sun Jan 24 07:07:07 2016 +0530 tdf#84381: Disable the line arrowheads when non-line object is selected When a non-line object is selected, the arrow subsection of line tab is hidden Change-Id: Id23245aadeaef5327449679a20a6243da4ad2b3a Reviewed-on: https://gerrit.libreoffice.org/21740 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: jan iversen <j...@documentfoundation.org> diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx index ebf7bf4..4b1ca42 100644 --- a/svx/source/sidebar/line/LinePropertyPanel.cxx +++ b/svx/source/sidebar/line/LinePropertyPanel.cxx @@ -72,7 +72,8 @@ LinePropertyPanel::LinePropertyPanel( maTransControl(SID_ATTR_LINE_TRANSPARENCE, *pBindings, *this), maEdgeStyle(SID_ATTR_LINE_JOINT, *pBindings, *this), maCapStyle(SID_ATTR_LINE_CAP, *pBindings, *this), - mpBindings(pBindings) + mpBindings(pBindings), + maContext() { Initialize(); } @@ -186,6 +187,30 @@ void LinePropertyPanel::NotifyItemUpdate( ActivateControls(); } +void LinePropertyPanel::HandleContextChange( + const sfx2::sidebar::EnumContext& rContext) +{ + if(maContext == rContext) + { + // Nothing to do + return; + } + + maContext = rContext; + bool bShowArrows = false; + + switch(maContext.GetCombinedContext_DI()) + { + case CombinedEnumContext(Application_Calc, Context_DrawLine): + case CombinedEnumContext(Application_DrawImpress, Context_DrawLine): + bShowArrows = true; + break; + } + + if(!bShowArrows) + disableArrowHead(); +} + void LinePropertyPanel::setLineStyle(const XLineStyleItem& rItem) { GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SfxCallMode::RECORD, &rItem, 0L); diff --git a/svx/source/sidebar/line/LinePropertyPanel.hxx b/svx/source/sidebar/line/LinePropertyPanel.hxx index 7c0c3a1..594109b 100644 --- a/svx/source/sidebar/line/LinePropertyPanel.hxx +++ b/svx/source/sidebar/line/LinePropertyPanel.hxx @@ -23,6 +23,7 @@ #include <vcl/ctrl.hxx> #include <sfx2/sidebar/SidebarPanelBase.hxx> #include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> #include <vcl/fixed.hxx> #include <vcl/field.hxx> #include <vcl/layout.hxx> @@ -58,6 +59,7 @@ class PopupContainer; class LineWidthControl; class LinePropertyPanel : public LinePropertyPanelBase, + public sfx2::sidebar::IContextChangeReceiver, public sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface { public: @@ -69,6 +71,9 @@ public: const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings); + virtual void HandleContextChange( + const ::sfx2::sidebar::EnumContext& rContext) override; + virtual void NotifyItemUpdate( const sal_uInt16 nSId, const SfxItemState eState, @@ -109,6 +114,7 @@ private: sfx2::sidebar::ControllerItem maCapStyle; SfxBindings* mpBindings; + sfx2::sidebar::EnumContext maContext; void Initialize(); }; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits