diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-03-03 09:56:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-03-03 19:19:39 +0100 |
commit | 0a1031a9ecd1502b1841bde26dde7ad51358c638 (patch) | |
tree | 564e854741e6307d5be08afcad395bca5ce30c16 /sw/source/uibase/utlui/numfmtlb.cxx | |
parent | c1ac79906bde5c902be5cb0ae6b530da96e52169 (diff) |
use SfxItemSet::GetItemIfSet in sw/source/uibase
Change-Id: Ic82df8d321ba2eb94957236264c71c5eb9a940a7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130905
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase/utlui/numfmtlb.cxx')
-rw-r--r-- | sw/source/uibase/utlui/numfmtlb.cxx | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/sw/source/uibase/utlui/numfmtlb.cxx b/sw/source/uibase/utlui/numfmtlb.cxx index ee668f4d11a9..0aab232852f0 100644 --- a/sw/source/uibase/utlui/numfmtlb.cxx +++ b/sw/source/uibase/utlui/numfmtlb.cxx @@ -410,20 +410,20 @@ void SwNumFormatBase::CallSelectHdl() if (RET_OK == pDlg->Execute()) { - const SfxPoolItem* pItem = pView->GetDocShell()-> + const SvxNumberInfoItem* pFormatInfoItem = pView->GetDocShell()-> GetItem( SID_ATTR_NUMBERFORMAT_INFO ); - if( pItem ) + if( pFormatInfoItem ) { - for ( sal_uInt32 key : static_cast<const SvxNumberInfoItem*>(pItem)->GetDelFormats() ) + for ( sal_uInt32 key : pFormatInfoItem->GetDelFormats() ) pFormatter->DeleteEntry( key ); } const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); - if( SfxItemState::SET == pOutSet->GetItemState( - SID_ATTR_NUMBERFORMAT_VALUE, false, &pItem )) + if( const SfxUInt32Item* pFormatValueItem = pOutSet->GetItemIfSet( + SID_ATTR_NUMBERFORMAT_VALUE, false )) { - sal_uInt32 nNumberFormat = static_cast<const SfxUInt32Item*>(pItem)->GetValue(); + sal_uInt32 nNumberFormat = pFormatValueItem->GetValue(); // oj #105473# change order of calls const SvNumberformat* pFormat = pFormatter->GetEntry(nNumberFormat); if( pFormat ) @@ -431,10 +431,11 @@ void SwNumFormatBase::CallSelectHdl() // SetDefFormat uses eCurLanguage to look for if this format already in the list SetDefFormat(nNumberFormat); } - if( m_bShowLanguageControl && SfxItemState::SET == pOutSet->GetItemState( - SID_ATTR_NUMBERFORMAT_ADD_AUTO, false, &pItem )) + const SfxBoolItem* pAddAutoItem; + if( m_bShowLanguageControl && (pAddAutoItem = pOutSet->GetItemIfSet( + SID_ATTR_NUMBERFORMAT_ADD_AUTO, false))) { - m_bUseAutomaticLanguage = static_cast<const SfxBoolItem*>(pItem)->GetValue(); + m_bUseAutomaticLanguage = pAddAutoItem->GetValue(); } } else |