summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-12-10 11:27:15 +0000
committerXisco Fauli <xiscofauli@libreoffice.org>2020-12-17 14:03:52 +0100
commit4b87577ea3f80e1e3df5ce1b492dea267577f072 (patch)
treec0aa78ef809453f532ebb4a55fd8c98a16ab1bdd
parenttdf#138661 don't emit value-changed when not changed by user (diff)
downloadcore-4b87577ea3f80e1e3df5ce1b492dea267577f072.tar.gz
core-4b87577ea3f80e1e3df5ce1b492dea267577f072.zip
Resolves: tdf#138789 disable widgets on 'none' when status changes
instead of when chage is dispatched, the chart case has its own dispatcher that disables the base class one. This fixes the reported problem, and the related problem of updating when moving focus from one line that has style 'none' to one that doesn't, and vice-versa, where no change is dispached on received on context change Change-Id: I6afb396e75ba93c13fcae71c52618cfce7f9cecb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107527 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--include/svx/linectrl.hxx5
-rw-r--r--include/svx/sidebar/LinePropertyPanelBase.hxx4
-rw-r--r--svx/source/sidebar/line/LinePropertyPanelBase.cxx18
-rw-r--r--svx/source/tbxctrls/linectrl.cxx10
4 files changed, 23 insertions, 14 deletions
diff --git a/include/svx/linectrl.hxx b/include/svx/linectrl.hxx
index 62f428aa5136..7ade8dc06643 100644
--- a/include/svx/linectrl.hxx
+++ b/include/svx/linectrl.hxx
@@ -32,6 +32,7 @@ class XLineStyleItem;
class XLineDashItem;
typedef std::function<bool(const OUString&, const css::uno::Any&)> LineStyleSelectFunction;
+typedef std::function<void(bool)> LineStyleIsNoneFunction;
// SvxLineStyleController:
class SVXCORE_DLLPUBLIC SvxLineStyleToolBoxControl final : public svt::PopupWindowController
@@ -40,6 +41,7 @@ private:
std::unique_ptr<svx::ToolboxButtonLineStyleUpdater> m_xBtnUpdater;
LineStyleSelectFunction m_aLineStyleSelectFunction;
+ LineStyleIsNoneFunction m_aLineStyleIsNoneFunction;
public:
SvxLineStyleToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext );
@@ -56,7 +58,10 @@ public:
virtual ~SvxLineStyleToolBoxControl() override;
+ // called when the user selects a line style
void setLineStyleSelectFunction(const LineStyleSelectFunction& aLineStyleSelectFunction);
+ // called when the line style changes, can be used to trigger disabling the arrows if the none line style is selected
+ void setLineStyleIsNoneFunction(const LineStyleIsNoneFunction& aLineStyleIsNoneFunction);
void dispatchLineStyleCommand(const OUString& rCommand, const css::uno::Sequence<css::beans::PropertyValue>& rArgs);
private:
diff --git a/include/svx/sidebar/LinePropertyPanelBase.hxx b/include/svx/sidebar/LinePropertyPanelBase.hxx
index 40b4cc6f4688..2da80e9a6b54 100644
--- a/include/svx/sidebar/LinePropertyPanelBase.hxx
+++ b/include/svx/sidebar/LinePropertyPanelBase.hxx
@@ -45,7 +45,7 @@ namespace svx
namespace sidebar
{
-class DisableArrowsWrapper;
+class LineStyleNoneChange;
class SVX_DLLPUBLIC LinePropertyPanelBase : public PanelLayout
{
@@ -116,7 +116,7 @@ private:
//popup windows
std::unique_ptr<LineWidthPopup> mxLineWidthPopup;
- std::unique_ptr<DisableArrowsWrapper> mxDisableArrowsWrapper;
+ std::unique_ptr<LineStyleNoneChange> mxLineStyleNoneChange;
sal_uInt16 mnTrans;
MapUnit meMapUnit;
diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
index f2c1b4553ea4..ef4778f4ad7c 100644
--- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
@@ -36,26 +36,20 @@ const char SELECTWIDTH[] = "SelectWidth";
namespace svx::sidebar {
// trigger disabling the arrows if the none line style is selected
-class DisableArrowsWrapper
+class LineStyleNoneChange
{
private:
LinePropertyPanelBase& m_rPanel;
public:
- DisableArrowsWrapper(LinePropertyPanelBase& rPanel)
+ LineStyleNoneChange(LinePropertyPanelBase& rPanel)
: m_rPanel(rPanel)
{
}
- bool operator()(const OUString& rCommand, const css::uno::Any& rValue)
+ void operator()(bool bLineStyleNone)
{
- if (rCommand == ".uno:XLineStyle")
- {
- css::drawing::LineStyle eLineStyle(css::drawing::LineStyle_NONE);
- rValue >>= eLineStyle;
- m_rPanel.SetNoneLineStyle(eLineStyle == css::drawing::LineStyle_NONE);
- }
- return false;
+ m_rPanel.SetNoneLineStyle(bLineStyleNone);
}
};
@@ -89,7 +83,7 @@ LinePropertyPanelBase::LinePropertyPanelBase(
mxGridLineProps(m_xBuilder->weld_widget("lineproperties")),
mxBoxArrowProps(m_xBuilder->weld_widget("arrowproperties")),
mxLineWidthPopup(new LineWidthPopup(mxTBWidth.get(), *this)),
- mxDisableArrowsWrapper(new DisableArrowsWrapper(*this)),
+ mxLineStyleNoneChange(new LineStyleNoneChange(*this)),
mnTrans(0),
meMapUnit(MapUnit::MapMM),
mnWidthCoreValue(0),
@@ -150,7 +144,7 @@ void LinePropertyPanelBase::Initialize()
mxLBCapStyle->connect_changed( LINK( this, LinePropertyPanelBase, ChangeCapStyleHdl ) );
SvxLineStyleToolBoxControl* pLineStyleControl = getLineStyleToolBoxControl(*mxLineStyleDispatch);
- pLineStyleControl->setLineStyleSelectFunction(*mxDisableArrowsWrapper);
+ pLineStyleControl->setLineStyleIsNoneFunction(*mxLineStyleNoneChange);
}
void LinePropertyPanelBase::updateLineTransparence(bool bDisabled, bool bSetOrDefault,
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index df0115f5b91b..cece7eea8085 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -91,6 +91,7 @@ void SAL_CALL SvxLineStyleToolBoxControl::statusChanged( const frame::FeatureSta
const SvxDashListItem* pItem = pSh->GetItem( SID_DASH_LIST );
if (pItem)
{
+ bool bNoneLineStyle = false;
XDashListRef xList = pItem->GetDashList();
int nIndex = m_xBtnUpdater->GetStyleIndex();
switch (nIndex)
@@ -107,6 +108,7 @@ void SAL_CALL SvxLineStyleToolBoxControl::statusChanged( const frame::FeatureSta
}
else
pToolBox->SetItemImage(nId, Image(aEmpty));
+ bNoneLineStyle = true;
break;
}
case 1:
@@ -128,6 +130,9 @@ void SAL_CALL SvxLineStyleToolBoxControl::statusChanged( const frame::FeatureSta
pToolBox->SetItemImage(nId, Image(xList->GetUiBitmap(nIndex - 2)));
break;
}
+
+ if (m_aLineStyleIsNoneFunction)
+ m_aLineStyleIsNoneFunction(bNoneLineStyle);
}
}
}
@@ -172,6 +177,11 @@ void SvxLineStyleToolBoxControl::setLineStyleSelectFunction(const LineStyleSelec
m_aLineStyleSelectFunction = rLineStyleSelectFunction;
}
+void SvxLineStyleToolBoxControl::setLineStyleIsNoneFunction(const LineStyleIsNoneFunction& rLineStyleIsNoneFunction)
+{
+ m_aLineStyleIsNoneFunction = rLineStyleIsNoneFunction;
+}
+
void SvxLineStyleToolBoxControl::dispatchLineStyleCommand(const OUString& rCommand, const Sequence<PropertyValue>& rArgs)
{
if (m_aLineStyleSelectFunction && m_aLineStyleSelectFunction(rCommand, rArgs[0].Value))