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>
This commit is contained in:
Rishabh
2016-01-24 07:07:07 +05:30
committed by jan iversen
parent 45e3e87ddc
commit eede66cd92
2 changed files with 32 additions and 1 deletions

View File

@@ -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);

View File

@@ -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();
};