summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand (Allotropia) <armin.le.grand@me.com>2021-06-10 21:03:01 +0200
committerArmin Le Grand <Armin.Le.Grand@me.com>2021-06-11 09:41:03 +0200
commit2baf6f654244a67715e4b3d86c49144ce6b5dd13 (patch)
tree0e694211355dd8a504159718244bf8aec88f0410
parent552ceeb5c6ccf2573adfd092cc4b2ce214a9c2df (diff)
tdf#130428 remove unnecessary usage of SfxItemState::UNKNOWN
ParaLineSpacingControl::Initialize() is another place where SfxItemState::UNKNOWN was just used as a placeholder for a non-set SfxItemState (aka could not be queried) Change-Id: I95ad01579e5aa4c86ace619e2201481742297c2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117016 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
-rw-r--r--svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
index bbd0b74de631..9a7b69b1a51d 100644
--- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
+++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
@@ -124,14 +124,16 @@ void ParaLineSpacingControl::Initialize()
{
const SfxPoolItem* pItem(nullptr);
SfxViewFrame* pCurrent = SfxViewFrame::Current();
- SfxItemState eState = pCurrent ? pCurrent->GetBindings().GetDispatcher()->QueryState(SID_ATTR_PARA_LINESPACE, pItem) : SfxItemState::UNKNOWN;
-
- const SvxLineSpacingItem* currSPItem = static_cast<const SvxLineSpacingItem*>(pItem);
+ const bool bItemStateSet(nullptr != pCurrent);
+ const SfxItemState eState(bItemStateSet
+ ? pCurrent->GetBindings().GetDispatcher()->QueryState(SID_ATTR_PARA_LINESPACE, pItem)
+ : SfxItemState::DEFAULT);
mxLineDist->set_sensitive(true);
- if( eState >= SfxItemState::DEFAULT )
+ if( bItemStateSet && (eState == SfxItemState::DEFAULT || eState == SfxItemState::SET) )
{
+ const SvxLineSpacingItem* currSPItem = static_cast<const SvxLineSpacingItem*>(pItem);
MapUnit eUnit = pCurrent->GetPool().GetMetric(currSPItem->Which());
meLNSpaceUnit = eUnit;
@@ -201,7 +203,7 @@ void ParaLineSpacingControl::Initialize()
break;
}
}
- else if( eState == SfxItemState::DISABLED )
+ else if( bItemStateSet && eState == SfxItemState::DISABLED )
{
mxLineDist->set_sensitive(false);
mxLineDistLabel->set_sensitive(false);
@@ -209,7 +211,7 @@ void ParaLineSpacingControl::Initialize()
mpActLineDistFld->set_text("");
}
- else
+ else // !bItemStateSet || eState == SfxItemState::DONTCARE || eState == SfxItemState::UNKNOWN
{
mxLineDistLabel->set_sensitive(false);
mpActLineDistFld->set_sensitive(false);