summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-03-14 12:28:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-03-14 14:20:26 +0100
commit6ba9daac763baf37c833911be5e5fb97e068bea1 (patch)
tree12ba4c5402747074f5a4b69a10fc60ab1c3d6603 /svx
parenta342ac91e21dd45640b7dea063bc04b80f0feb6e (diff)
add TypedWhichId version of QueryState
Change-Id: I95b86fc081847da01e06f50a1b2c7e7f5456c638 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131529 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/rubydialog.cxx5
-rw-r--r--svx/source/fmcomp/fmgridcl.cxx4
-rw-r--r--svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx8
-rw-r--r--svx/source/sidebar/text/TextCharacterSpacingControl.cxx5
-rw-r--r--svx/source/sidebar/text/TextUnderlineControl.cxx6
5 files changed, 12 insertions, 16 deletions
diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx
index 006b07cc0918..9bc87b222fd4 100644
--- a/svx/source/dialog/rubydialog.cxx
+++ b/svx/source/dialog/rubydialog.cxx
@@ -533,10 +533,9 @@ IMPL_LINK_NOARG(SvxRubyDialog, CloseHdl_Impl, weld::Button&, void) { Close(); }
IMPL_LINK_NOARG(SvxRubyDialog, StylistHdl_Impl, weld::Button&, void)
{
- std::unique_ptr<SfxPoolItem> pState;
+ std::unique_ptr<SfxBoolItem> pState;
SfxItemState eState = pBindings->QueryState(SID_STYLE_DESIGNER, pState);
- if (eState <= SfxItemState::SET || !pState
- || !static_cast<SfxBoolItem*>(pState.get())->GetValue())
+ if (eState <= SfxItemState::SET || !pState || !pState->GetValue())
{
pBindings->GetDispatcher()->Execute(SID_STYLE_DESIGNER,
SfxCallMode::ASYNCHRON | SfxCallMode::RECORD);
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index 3906a6047258..762144002948 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -798,12 +798,12 @@ void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, weld::Menu& rM
// ask the bindings of the current view frame (which should be the one we're residing in) for the state
if (pCurrentFrame)
{
- std::unique_ptr<SfxPoolItem> pItem;
+ std::unique_ptr<SfxBoolItem> pItem;
SfxItemState eState = pCurrentFrame->GetBindings().QueryState(SID_FM_CTL_PROPERTIES, pItem);
if (eState >= SfxItemState::DEFAULT && pItem != nullptr)
{
- bool bChecked = dynamic_cast<const SfxBoolItem*>( pItem.get()) != nullptr && static_cast<SfxBoolItem*>(pItem.get())->GetValue();
+ bool bChecked = pItem && pItem->GetValue();
rMenu.set_active("column", bChecked);
}
}
diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
index 9a7b69b1a51d..9ff16f340b15 100644
--- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
+++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
@@ -82,10 +82,10 @@ ParaLineSpacingControl::ParaLineSpacingControl(SvxLineSpacingToolBoxControl* pCo
mxLineDistAtMetricBox->connect_value_changed( aLink2 );
FieldUnit eUnit = FieldUnit::INCH;
- const SfxPoolItem* pItem = nullptr;
+ const SfxUInt16Item* pItem = nullptr;
SfxViewFrame* pCurrent = SfxViewFrame::Current();
if (pCurrent && pCurrent->GetBindings().GetDispatcher()->QueryState(SID_ATTR_METRIC, pItem) >= SfxItemState::DEFAULT)
- eUnit = static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
+ eUnit = static_cast<FieldUnit>(pItem->GetValue());
else
eUnit = SfxModule::GetCurrentFieldUnit();
@@ -122,7 +122,7 @@ ParaLineSpacingControl::~ParaLineSpacingControl()
void ParaLineSpacingControl::Initialize()
{
- const SfxPoolItem* pItem(nullptr);
+ const SvxLineSpacingItem* pItem(nullptr);
SfxViewFrame* pCurrent = SfxViewFrame::Current();
const bool bItemStateSet(nullptr != pCurrent);
const SfxItemState eState(bItemStateSet
@@ -133,7 +133,7 @@ void ParaLineSpacingControl::Initialize()
if( bItemStateSet && (eState == SfxItemState::DEFAULT || eState == SfxItemState::SET) )
{
- const SvxLineSpacingItem* currSPItem = static_cast<const SvxLineSpacingItem*>(pItem);
+ const SvxLineSpacingItem* currSPItem = pItem;
MapUnit eUnit = pCurrent->GetPool().GetMetric(currSPItem->Which());
meLNSpaceUnit = eUnit;
diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
index ba528d702282..0826434b79fb 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
@@ -106,10 +106,9 @@ TextCharacterSpacingControl::~TextCharacterSpacingControl()
void TextCharacterSpacingControl::Initialize()
{
- const SfxPoolItem* pItem;
- SfxItemState eState = SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState(SID_ATTR_CHAR_KERNING, pItem);
+ const SvxKerningItem* pKerningItem;
+ SfxItemState eState = SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState(SID_ATTR_CHAR_KERNING, pKerningItem);
- const SvxKerningItem* pKerningItem = dynamic_cast<const SvxKerningItem*>(pItem);
tools::Long nKerning = 0;
if(pKerningItem)
diff --git a/svx/source/sidebar/text/TextUnderlineControl.cxx b/svx/source/sidebar/text/TextUnderlineControl.cxx
index 380389509865..9d79e924e877 100644
--- a/svx/source/sidebar/text/TextUnderlineControl.cxx
+++ b/svx/source/sidebar/text/TextUnderlineControl.cxx
@@ -99,10 +99,8 @@ namespace {
Color GetUnderlineColor()
{
- const SfxPoolItem* pItem;
- SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState(SID_ATTR_CHAR_UNDERLINE, pItem);
-
- const SvxUnderlineItem* pUnderlineItem = static_cast<const SvxUnderlineItem*>(pItem);
+ const SvxUnderlineItem* pUnderlineItem;
+ SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState(SID_ATTR_CHAR_UNDERLINE, pUnderlineItem);
if(pUnderlineItem)
return pUnderlineItem->GetColor();