summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-11-07 10:04:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-11-07 11:28:47 +0100
commit1a9a99a8eee7be3d98ca705425a6778ee8efbfc8 (patch)
treea0ad7123ee9fccafdd248928719f1d980684e50e /sw
parent1305f70cff8a81a58a5a6d9c96c5bb032005389e (diff)
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.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/txatritr.hxx7
-rw-r--r--sw/source/core/txtnode/txatritr.cxx6
2 files changed, 6 insertions, 7 deletions
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 );