editeng/source/editeng/impedit4.cxx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
New commits: commit 18a9092d7b9a9f4e7ee9203770423e50fa01d626 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Tue Nov 5 14:52:27 2024 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Nov 6 15:49:32 2024 +0100 Simplify a bit Change-Id: I62299212957f491ff0ead9e64816d70cb7f19e08 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176061 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 55737feded2b..03295ce18d93 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -327,21 +327,15 @@ ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel, bool bCl aFontTable.emplace_back( new SvxFontItem( maEditDoc.GetItemPool().GetUserOrPoolDefaultItem( EE_CHAR_FONTINFO ) ) ); aFontTable.emplace_back( new SvxFontItem( maEditDoc.GetItemPool().GetUserOrPoolDefaultItem( EE_CHAR_FONTINFO_CJK ) ) ); aFontTable.emplace_back( new SvxFontItem( maEditDoc.GetItemPool().GetUserOrPoolDefaultItem( EE_CHAR_FONTINFO_CTL ) ) ); - for ( sal_uInt16 nScriptType = 0; nScriptType < 3; nScriptType++ ) + for (auto nWhich : { EE_CHAR_FONTINFO, EE_CHAR_FONTINFO_CJK, EE_CHAR_FONTINFO_CTL }) { - sal_uInt16 nWhich = EE_CHAR_FONTINFO; - if ( nScriptType == 1 ) - nWhich = EE_CHAR_FONTINFO_CJK; - else if ( nScriptType == 2 ) - nWhich = EE_CHAR_FONTINFO_CTL; - ItemSurrogates aSurrogates; maEditDoc.GetItemPool().GetItemSurrogates(aSurrogates, nWhich); for (const SfxPoolItem* pItem : aSurrogates) { SvxFontItem const*const pFontItem = static_cast<const SvxFontItem*>(pItem); bool bAlreadyExist = false; - size_t nTestMax = nScriptType ? aFontTable.size() : 1; + const size_t nTestMax = nWhich == EE_CHAR_FONTINFO ? 1 : aFontTable.size(); for ( size_t nTest = 0; !bAlreadyExist && ( nTest < nTestMax ); nTest++ ) { bAlreadyExist = *aFontTable[ nTest ] == *pFontItem;