diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-03-14 12:28:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-03-14 14:20:26 +0100 |
commit | 6ba9daac763baf37c833911be5e5fb97e068bea1 (patch) | |
tree | 12ba4c5402747074f5a4b69a10fc60ab1c3d6603 /cui | |
parent | a342ac91e21dd45640b7dea063bc04b80f0feb6e (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 'cui')
-rw-r--r-- | cui/source/options/treeopt.cxx | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index 8d274f83ce4c..ed43861d654b 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -1050,12 +1050,12 @@ std::optional<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId ) SfxViewFrame* pViewFrame = SfxViewFrame::Current(); if ( pViewFrame ) { - const SfxPoolItem* pItem = nullptr; + const SfxUInt16Item* pItem = nullptr; SfxDispatcher* pDispatch = pViewFrame->GetDispatcher(); // miscellaneous - Year2000 if( SfxItemState::DEFAULT <= pDispatch->QueryState( SID_ATTR_YEAR2000, pItem ) ) - pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, static_cast<const SfxUInt16Item*>(pItem)->GetValue() ) ); + pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, pItem->GetValue() ) ); else pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, officecfg::Office::Common::DateFormat::TwoDigitYear::get() ) ); } @@ -1100,28 +1100,17 @@ std::optional<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId ) SfxViewFrame* pViewFrame = SfxViewFrame::Current(); if ( pViewFrame ) { - const SfxPoolItem* pItem = nullptr; + const SvxLanguageItem* pLangItem = nullptr; SfxDispatcher* pDispatch = pViewFrame->GetDispatcher(); - if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_ATTR_LANGUAGE, pItem)) - pRet->Put( - SvxLanguageItem( - (static_cast<const SvxLanguageItem*>(pItem) - ->GetLanguage()), - SID_ATTR_LANGUAGE)); - if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_ATTR_CHAR_CJK_LANGUAGE, pItem)) - pRet->Put( - SvxLanguageItem( - (static_cast<const SvxLanguageItem*>(pItem) - ->GetLanguage()), - SID_ATTR_CHAR_CJK_LANGUAGE)); - if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_ATTR_CHAR_CTL_LANGUAGE, pItem)) - pRet->Put( - SvxLanguageItem( - (static_cast<const SvxLanguageItem*>(pItem) - ->GetLanguage()), - SID_ATTR_CHAR_CTL_LANGUAGE)); + if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_ATTR_LANGUAGE, pLangItem)) + pRet->Put(*pLangItem, SID_ATTR_LANGUAGE); + if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_ATTR_CHAR_CJK_LANGUAGE, pLangItem)) + pRet->Put(*pLangItem, SID_ATTR_CHAR_CJK_LANGUAGE); + if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_ATTR_CHAR_CTL_LANGUAGE, pLangItem)) + pRet->Put(*pLangItem, SID_ATTR_CHAR_CTL_LANGUAGE); pRet->Put(aHyphen); + const SfxPoolItem* pItem = nullptr; if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_AUTOSPELL_CHECK, pItem)) { pRet->Put(std::unique_ptr<SfxPoolItem>(pItem->Clone())); |