sw/inc/swmodule.hxx | 5 +++++ sw/source/core/inc/txtfrm.hxx | 3 ++- sw/source/core/text/inftxt.cxx | 5 ++--- sw/source/core/text/txtfrm.cxx | 11 +++++------ sw/source/core/txtnode/swfont.cxx | 13 +++++++++---- sw/source/uibase/app/apphdl.cxx | 2 +- sw/source/uibase/app/swmodule.cxx | 1 + 7 files changed, 25 insertions(+), 15 deletions(-)
New commits: commit 9cf582bc9a875a90dd004ebc9aa6c3e351b18cd8 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Thu Oct 3 12:55:50 2024 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu Oct 10 07:18:12 2024 +0200 We don't need to constantly fetch SvtCTLOptions::GetCTLTextNumerals we are already listening to SvtCTLOptions and triggering SwViewShell::ChgNumberDigits if it changes, so can just keep the initial value and update it at that point. Change-Id: I669aeb755506b9d703a7c638a82c03935779ce8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174340 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx index 03140bf6220d..ace496237831 100644 --- a/sw/inc/swmodule.hxx +++ b/sw/inc/swmodule.hxx @@ -25,6 +25,7 @@ #include <o3tl/deleter.hxx> #include <tools/fldunit.hxx> +#include <svl/ctloptions.hxx> #include <svl/lstner.hxx> #include <unotools/options.hxx> #include <sfx2/module.hxx> @@ -109,6 +110,8 @@ class SW_DLLPUBLIC SwModule final : public SfxModule, public SfxListener, public css::uno::Reference< css::scanner::XScannerManager2 > m_xScannerManager; css::uno::Reference< css::linguistic2::XLanguageGuessing > m_xLanguageGuesser; + SvtCTLOptions::TextNumerals m_eCTLTextNumerals; + bool m_bAuthorInitialised : 1; bool m_bEmbeddedLoadSave : 1; @@ -184,6 +187,8 @@ public: bool IsEmbeddedLoadSave() const { return m_bEmbeddedLoadSave; } void SetEmbeddedLoadSave( bool bFlag ) { m_bEmbeddedLoadSave = bFlag; } + SvtCTLOptions::TextNumerals GetCTLTextNumerals() const { return m_eCTLTextNumerals; } + static void ShowDBObj( SwView const & rView, const SwDBData& rData); // Table modi. diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index a1b7d1942f68..6e1c75c6a168 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -20,6 +20,7 @@ #define INCLUDED_SW_SOURCE_CORE_INC_TXTFRM_HXX #include <com/sun/star/uno/Sequence.hxx> +#include <svl/ctloptions.hxx> #include "cntfrm.hxx" #include "TextFrameIndex.hxx" #include <nodeoffset.hxx> @@ -975,7 +976,7 @@ class SwDigitModeModifier const OutputDevice& rOut; LanguageType nOldLanguageType; public: - SwDigitModeModifier( const OutputDevice& rOutp, LanguageType eCurLang ); + SwDigitModeModifier( const OutputDevice& rOutp, LanguageType eCurLang, SvtCTLOptions::TextNumerals eCTlTextNumerals ); ~SwDigitModeModifier(); }; diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 3b1bbf087dac..fa06ee43c205 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -1567,14 +1567,13 @@ void SwTextFormatInfo::CtorInitTextFormatInfo( OutputDevice* pRenderContext, SwT m_nLineNetHeight = 0; SetLineStart(TextFrameIndex(0)); - SvtCTLOptions::TextNumerals const nTextNumerals( - SvtCTLOptions::GetCTLTextNumerals()); + SvtCTLOptions::TextNumerals const nTextNumerals(SW_MOD()->GetCTLTextNumerals()); // cannot cache for NUMERALS_CONTEXT because we need to know the string // for the whole paragraph now if (nTextNumerals != SvtCTLOptions::NUMERALS_CONTEXT) { // set digit mode to what will be used later to get same results - SwDigitModeModifier const m(*m_pRef, LANGUAGE_NONE /*dummy*/); + SwDigitModeModifier const m(*m_pRef, LANGUAGE_NONE /*dummy*/, nTextNumerals); assert(m_pRef->GetDigitLanguage() != LANGUAGE_NONE); SetCachedVclData(OutputDevice::CreateTextLayoutCache(*m_pText)); } diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index ac705517be4c..1fd67928b26e 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -721,7 +721,8 @@ void SwLayoutModeModifier::SetAuto() const_cast<OutputDevice&>(m_rOut).SetLayoutMode( nNewLayoutMode ); } -SwDigitModeModifier::SwDigitModeModifier( const OutputDevice& rOutp, LanguageType eCurLang ) : +SwDigitModeModifier::SwDigitModeModifier( const OutputDevice& rOutp, LanguageType eCurLang, + SvtCTLOptions::TextNumerals eCTLTextNumerals ) : rOut( rOutp ), nOldLanguageType( rOutp.GetDigitLanguage() ) { LanguageType eLang = eCurLang; @@ -729,13 +730,11 @@ SwDigitModeModifier::SwDigitModeModifier( const OutputDevice& rOutp, LanguageTyp eLang = LANGUAGE_ENGLISH_US; else { - const SvtCTLOptions::TextNumerals nTextNumerals = SvtCTLOptions::GetCTLTextNumerals(); - - if ( SvtCTLOptions::NUMERALS_HINDI == nTextNumerals ) + if ( SvtCTLOptions::NUMERALS_HINDI == eCTLTextNumerals ) eLang = LANGUAGE_ARABIC_SAUDI_ARABIA; - else if ( SvtCTLOptions::NUMERALS_ARABIC == nTextNumerals ) + else if ( SvtCTLOptions::NUMERALS_ARABIC == eCTLTextNumerals ) eLang = LANGUAGE_ENGLISH; - else if ( SvtCTLOptions::NUMERALS_SYSTEM == nTextNumerals ) + else if ( SvtCTLOptions::NUMERALS_SYSTEM == eCTLTextNumerals ) eLang = ::GetAppLanguage(); } diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx index 98fec0f153e2..9c6c419effe2 100644 --- a/sw/source/core/txtnode/swfont.cxx +++ b/sw/source/core/txtnode/swfont.cxx @@ -52,6 +52,7 @@ #include <fntcache.hxx> #include <txtfrm.hxx> #include <scriptinfo.hxx> +#include <swmodule.hxx> #ifdef DBG_UTIL // global Variable @@ -995,7 +996,8 @@ Size SwSubFont::GetTextSize_( SwDrawTextInfo& rInf ) !IsSameInstance( rInf.GetpOut()->GetFont() ) ) ChgFnt( rInf.GetShell(), rInf.GetOut() ); - SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() ); + SwDigitModeModifier aDigitModeModifier(rInf.GetOut(), rInf.GetFont()->GetLanguage(), + SW_MOD()->GetCTLTextNumerals()); Size aTextSize; TextFrameIndex const nLn = rInf.GetLen() == TextFrameIndex(COMPLETE_STRING) @@ -1124,7 +1126,8 @@ void SwSubFont::DrawText_( SwDrawTextInfo &rInf, const bool bGrey ) if( !pLastFont || pLastFont->GetOwner() != m_nFontCacheId ) ChgFnt( rInf.GetShell(), rInf.GetOut() ); - SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() ); + SwDigitModeModifier aDigitModeModifier(rInf.GetOut(), rInf.GetFont()->GetLanguage(), + SW_MOD()->GetCTLTextNumerals()); const Point aOldPos(rInf.GetPos()); Point aPos( rInf.GetPos() ); @@ -1249,7 +1252,8 @@ void SwSubFont::DrawStretchText_( SwDrawTextInfo &rInf ) if ( !pLastFont || pLastFont->GetOwner() != m_nFontCacheId ) ChgFnt( rInf.GetShell(), rInf.GetOut() ); - SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() ); + SwDigitModeModifier aDigitModeModifier(rInf.GetOut(), rInf.GetFont()->GetLanguage(), + SW_MOD()->GetCTLTextNumerals()); rInf.ApplyAutoColor(); @@ -1314,7 +1318,8 @@ TextFrameIndex SwSubFont::GetModelPositionForViewPoint_( SwDrawTextInfo& rInf ) if ( !pLastFont || pLastFont->GetOwner() != m_nFontCacheId ) ChgFnt( rInf.GetShell(), rInf.GetOut() ); - SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() ); + SwDigitModeModifier aDigitModeModifier(rInf.GetOut(), rInf.GetFont()->GetLanguage(), + SW_MOD()->GetCTLTextNumerals()); TextFrameIndex const nLn = rInf.GetLen() == TextFrameIndex(COMPLETE_STRING) ? TextFrameIndex(rInf.GetText().getLength()) diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index 253117c5bf9b..32e953a548c1 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -1047,6 +1047,7 @@ void SwModule::ConfigurationChanged(utl::ConfigurationBroadcaster* pBrdCst, Conf #endif else if( pBrdCst == m_pCTLOptions.get() ) { + m_eCTLTextNumerals = SvtCTLOptions::GetCTLTextNumerals(); const SfxObjectShell* pObjSh = SfxObjectShell::GetFirst(); while( pObjSh ) { @@ -1060,7 +1061,6 @@ void SwModule::ConfigurationChanged(utl::ConfigurationBroadcaster* pBrdCst, Conf pObjSh = SfxObjectShell::GetNext(*pObjSh); } } - } SwDBConfig* SwModule::GetDBConfig() diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index e7a97f4b8c25..c6b8459def7d 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -130,6 +130,7 @@ SwModule::SwModule( SfxObjectFactory* pWebFact, SfxObjectFactory* pGlobalFact ) : SfxModule("sw"_ostr, {pWebFact, pFact, pGlobalFact}), m_pView(nullptr), + m_eCTLTextNumerals(SvtCTLOptions::GetCTLTextNumerals()), m_bAuthorInitialised(false), m_bEmbeddedLoadSave( false ), m_pDragDrop( nullptr ),