sw/inc/txatritr.hxx | 7 +++---- sw/source/core/txtnode/thints.cxx | 8 ++++---- sw/source/core/txtnode/txatritr.cxx | 6 +++--- sw/source/filter/ww8/wrtw8nds.cxx | 4 ++-- sw/source/ui/dbui/mmresultdialogs.cxx | 6 +++--- sw/source/ui/dialog/ascfldlg.cxx | 6 +++--- 6 files changed, 18 insertions(+), 19 deletions(-)
New commits: commit 53b289eabb3d265b47bc7fb6cc430291c97f0c0b Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Nov 7 10:24:48 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Nov 7 11:28:55 2023 +0100 use more TypedWhichId Change-Id: If76b02a20b01624c2cc0aa5e3c310aa1dd930c01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159058 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 2c0a1250f0b7..71c1ed75d059 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -3492,7 +3492,7 @@ LanguageType SwTextNode::GetLang( const sal_Int32 nBegin, const sal_Int32 nLen, } // #i91465# Consider nScript if pSwpHints == 0 - const sal_uInt16 nWhichId = GetWhichOfScript( RES_CHRATR_LANGUAGE, nScript ); + const TypedWhichId<SvxLanguageItem> nWhichId = GetWhichOfScript( RES_CHRATR_LANGUAGE, nScript ); if ( HasHints() ) { @@ -3526,8 +3526,8 @@ LanguageType SwTextNode::GetLang( const sal_Int32 nBegin, const sal_Int32 nLen, if( pHt->DontExpand() ? nBegin >= *pEndIdx : nBegin > *pEndIdx) continue; } - const SfxPoolItem* pItem = CharFormat::GetItem( *pHt, nWhichId ); - const LanguageType nLng = static_cast<const SvxLanguageItem*>(pItem)->GetLanguage(); + const SvxLanguageItem* pItem = CharFormat::GetItem( *pHt, nWhichId ); + const LanguageType nLng = pItem->GetLanguage(); // does the attribute completely cover the range? if( nAttrStart <= nBegin && nEnd <= *pEndIdx ) @@ -3539,7 +3539,7 @@ LanguageType SwTextNode::GetLang( const sal_Int32 nBegin, const sal_Int32 nLen, } if( LANGUAGE_DONTKNOW == nRet ) { - nRet = static_cast<const SvxLanguageItem&>(GetSwAttrSet().Get( nWhichId )).GetLanguage(); + nRet = GetSwAttrSet().Get( nWhichId ).GetLanguage(); if( LANGUAGE_DONTKNOW == nRet ) nRet = GetAppLanguage(); } diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index d2e57406f8b3..5b1d62b4b12b 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -3688,8 +3688,8 @@ WW8Ruby::WW8Ruby(const SwTextNode& rNode, const SwFormatRuby& rRuby, const MSWor if (!rText.isEmpty()) nScript = g_pBreakIt->GetBreakIter()->getScriptType(rText, 0); - sal_uInt16 nWhich = GetWhichOfScript(RES_CHRATR_FONTSIZE, nScript); - auto& rHeightItem = static_cast<const SvxFontHeightItem&>(rExport.GetItem(nWhich)); + TypedWhichId<SvxFontHeightItem> nWhich = GetWhichOfScript(RES_CHRATR_FONTSIZE, nScript); + const SvxFontHeightItem& rHeightItem = rExport.GetItem(nWhich); m_nBaseHeight = rHeightItem.GetHeight(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx index 55e6d3ed899c..d53085c91276 100644 --- a/sw/source/ui/dbui/mmresultdialogs.cxx +++ b/sw/source/ui/dbui/mmresultdialogs.cxx @@ -1087,9 +1087,9 @@ IMPL_LINK_NOARG(SwMMResultEmailDialog, SendDocumentsHdl_Impl, weld::Button&, voi { SwAsciiOptions aOpt; sal_uInt16 nAppScriptType = SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ); - sal_uInt16 nWhich = GetWhichOfScript( RES_CHRATR_LANGUAGE, nAppScriptType); - aOpt.SetLanguage( static_cast<const SvxLanguageItem&>(pTargetView->GetWrtShell(). - GetDefault( nWhich )).GetLanguage()); + TypedWhichId<SvxLanguageItem> nWhich = GetWhichOfScript( RES_CHRATR_LANGUAGE, nAppScriptType); + const SvxLanguageItem& rDefLangItem = pTargetView->GetWrtShell().GetDefault( nWhich ); + aOpt.SetLanguage( rDefLangItem.GetLanguage() ); aOpt.SetParaFlags( LINEEND_CR ); aOpt.WriteUserData( sFilterOptions ); } diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx index d800233e2856..43a3249823ae 100644 --- a/sw/source/ui/dialog/ascfldlg.cxx +++ b/sw/source/ui/dialog/ascfldlg.cxx @@ -162,9 +162,9 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( weld::Window* pParent, SwDocShell& rDocSh, { if(pDoc) { - const sal_uInt16 nWhich = GetWhichOfScript( RES_CHRATR_LANGUAGE, nAppScriptType); - aOpt.SetLanguage( static_cast<const SvxLanguageItem&>(pDoc-> - GetDefault( nWhich )).GetLanguage()); + const TypedWhichId<SvxLanguageItem> nWhich = GetWhichOfScript( RES_CHRATR_LANGUAGE, nAppScriptType); + const SvxLanguageItem& rLangItem = pDoc->GetDefault( nWhich ); + aOpt.SetLanguage( rLangItem.GetLanguage() ); } else { commit 1a9a99a8eee7be3d98ca705425a6778ee8efbfc8 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Nov 7 10:04:58 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Nov 7 11:28:47 2023 +0100 use more concrete *PoolItem types in SwLanguageIterator rather than casting Change-Id: Ic134c30490fea7ae42bbf3194532ae0aad4c61c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159057 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/inc/txatritr.hxx b/sw/inc/txatritr.hxx index 76a865cab9ff..66ef09b470de 100644 --- a/sw/inc/txatritr.hxx +++ b/sw/inc/txatritr.hxx @@ -52,8 +52,8 @@ class SwLanguageIterator std::deque<const SwTextAttr*> m_aStack; const SwTextNode& m_rTextNode; - const SfxPoolItem* m_pParaItem; - const SfxPoolItem* m_pCurrentItem; + const SvxLanguageItem* m_pParaItem; + const SvxLanguageItem* m_pCurrentItem; size_t m_nAttrPos; sal_Int32 m_nChgPos; @@ -65,8 +65,7 @@ public: bool Next(); sal_Int32 GetChgPos() const { return m_nChgPos; } - LanguageType GetLanguage() const - { return static_cast<const SvxLanguageItem&>(*m_pCurrentItem).GetValue(); } + LanguageType GetLanguage() const { return m_pCurrentItem->GetValue(); } }; #endif diff --git a/sw/source/core/txtnode/txatritr.cxx b/sw/source/core/txtnode/txatritr.cxx index 91aed778c157..1bc97b62b2e5 100644 --- a/sw/source/core/txtnode/txatritr.cxx +++ b/sw/source/core/txtnode/txatritr.cxx @@ -126,7 +126,7 @@ bool SwLanguageIterator::Next() m_nChgPos = nEndPos; m_nAttrPos = nSavePos; - const sal_uInt16 nWId = GetWhichOfScript( RES_CHRATR_LANGUAGE, m_aScriptIter.GetCurrScript() ); + const TypedWhichId<SvxLanguageItem> nWId = GetWhichOfScript( RES_CHRATR_LANGUAGE, m_aScriptIter.GetCurrScript() ); m_pCurrentItem = CharFormat::GetItem(*pHt, nWId); m_aStack.pop_front(); @@ -152,7 +152,7 @@ void SwLanguageIterator::AddToStack( const SwTextAttr& rAttr ) void SwLanguageIterator::SearchNextChg() { - sal_uInt16 nWh = 0; + TypedWhichId<SvxLanguageItem> nWh(0); if( m_nChgPos == m_aScriptIter.GetScriptChgPos() ) { m_aScriptIter.Next(); @@ -181,7 +181,7 @@ void SwLanguageIterator::SearchNextChg() nWh = GetWhichOfScript( RES_CHRATR_LANGUAGE, m_aScriptIter.GetCurrScript() ); } - const SfxPoolItem* pItem = nullptr; + const SvxLanguageItem* pItem = nullptr; for( ; m_nAttrPos < pHts->Count(); ++m_nAttrPos ) { const SwTextAttr* pHt = pHts->Get( m_nAttrPos );