diff options
author | Rishabh <kris.kr296@yahoo.in> | 2016-01-24 07:07:07 +0530 |
---|---|---|
committer | jan iversen <jani@documentfoundation.org> | 2016-01-25 07:14:34 +0000 |
commit | eede66cd922b0f867b7521a9d96e2c6f42a973dc (patch) | |
tree | 5158307abe928b19ca3d77446ebbb1479b5542fc | |
parent | 45e3e87ddcdfb14186ce6a9d8748fa4b31393600 (diff) |
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 <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
-rw-r--r-- | svx/source/sidebar/line/LinePropertyPanel.cxx | 27 | ||||
-rw-r--r-- | svx/source/sidebar/line/LinePropertyPanel.hxx | 6 |
2 files changed, 32 insertions, 1 deletions
diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx index ebf7bf41fd1a..4b1ca42b19eb 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 7c0c3a1442b4..594109bdac00 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(); }; |