diff options
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 2 | ||||
-rw-r--r-- | include/editeng/svxacorr.hxx | 9 | ||||
-rw-r--r-- | linguistic/source/spelldsp.cxx | 18 | ||||
-rw-r--r-- | linguistic/source/spelldsp.hxx | 5 | ||||
-rw-r--r-- | sd/inc/drawdoc.hxx | 9 | ||||
-rw-r--r-- | sd/source/core/drawdoc.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/dlg/custsdlg.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/edit/autofmt.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/inc/txmsrt.hxx | 5 | ||||
-rw-r--r-- | sw/source/core/tox/txmsrt.cxx | 8 |
10 files changed, 37 insertions, 33 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 68743034e66b..6b759415b52b 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -359,7 +359,7 @@ SvxAutoCorrect::~SvxAutoCorrect() void SvxAutoCorrect::GetCharClass_( LanguageType eLang ) { - pCharClass.reset( new CharClass( LanguageTag( eLang)) ); + moCharClass.emplace( LanguageTag( eLang) ); eCharClassLang = eLang; } diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx index b2eaeff9f9e3..b7372a431865 100644 --- a/include/editeng/svxacorr.hxx +++ b/include/editeng/svxacorr.hxx @@ -28,14 +28,15 @@ #include <tools/date.hxx> #include <editeng/swafopt.hxx> #include <editeng/editengdllapi.h> +#include <unotools/charclass.hxx> #include <optional> #include <map> #include <memory> +#include <optional> #include <string_view> #include <utility> -class CharClass; class SfxPoolItem; class SotStorage; class SvxAutoCorrect; @@ -255,7 +256,7 @@ class EDITENG_DLLPUBLIC SvxAutoCorrect // all languages in a table std::map<LanguageTag, SvxAutoCorrectLanguageLists> m_aLangTable; std::map<LanguageTag, sal_Int64> aLastFileTable; - std::unique_ptr<CharClass> pCharClass; + std::optional<CharClass> moCharClass; LanguageType eCharClassLang; @@ -440,9 +441,9 @@ public: CharClass& GetCharClass( LanguageType eLang ) { - if( !pCharClass || eLang != eCharClassLang ) + if( !moCharClass || eLang != eCharClassLang ) GetCharClass_( eLang ); - return *pCharClass; + return *moCharClass; } }; diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx index c1b309b00adf..92b2d4c3efbd 100644 --- a/linguistic/source/spelldsp.cxx +++ b/linguistic/source/spelldsp.cxx @@ -394,9 +394,9 @@ bool SpellCheckerDispatcher::isValid_Impl( bRes = !xTmp->isNegative(); } else { setCharClass(LanguageTag(nLanguage)); - CapType ct = capitalType(aChkWord, m_pCharClass.get()); + CapType ct = capitalType(aChkWord, m_oCharClass ? &*m_oCharClass : nullptr); if (ct == CapType::INITCAP || ct == CapType::ALLCAP) { - Reference< XDictionaryEntry > xTmp2( lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, m_pCharClass.get()), nLanguage ) ); + Reference< XDictionaryEntry > xTmp2( lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, m_oCharClass), nLanguage ) ); if (xTmp2.is()) { bRes = !xTmp2->isNegative(); } @@ -635,10 +635,10 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( else { setCharClass(LanguageTag(nLanguage)); - CapType ct = capitalType(aChkWord, m_pCharClass.get()); + CapType ct = capitalType(aChkWord, m_oCharClass ? &*m_oCharClass : nullptr); if (ct == CapType::INITCAP || ct == CapType::ALLCAP) { - Reference< XDictionaryEntry > xTmp2( lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, m_pCharClass.get()), nLanguage ) ); + Reference< XDictionaryEntry > xTmp2( lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, m_oCharClass), nLanguage ) ); if (xTmp2.is()) { if (xTmp2->isNegative()) // negative entry found @@ -655,10 +655,10 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( switch ( ct ) { case CapType::INITCAP: - aProposalList.Prepend( m_pCharClass->titlecase(aAddRplcTxt) ); + aProposalList.Prepend( m_oCharClass->titlecase(aAddRplcTxt) ); break; case CapType::ALLCAP: - aProposalList.Prepend( m_pCharClass->uppercase(aAddRplcTxt) ); + aProposalList.Prepend( m_oCharClass->uppercase(aAddRplcTxt) ); break; default: /* can't happen because of if ct == above */ @@ -813,13 +813,13 @@ void SpellCheckerDispatcher::FlushSpellCache() void SpellCheckerDispatcher::setCharClass(const LanguageTag& rLanguageTag) { - if (m_pCharClass && m_pCharClass->getLanguageTag() == rLanguageTag) + if (m_oCharClass && m_oCharClass->getLanguageTag() == rLanguageTag) return; - m_pCharClass.reset( new CharClass(rLanguageTag) ); + m_oCharClass.emplace( rLanguageTag ); } -OUString SpellCheckerDispatcher::makeLowerCase(const OUString& aTerm, CharClass const * pCC) +OUString SpellCheckerDispatcher::makeLowerCase(const OUString& aTerm, const std::optional<CharClass> & pCC) { if (pCC) return pCC->lowercase(aTerm); diff --git a/linguistic/source/spelldsp.hxx b/linguistic/source/spelldsp.hxx index c93560441333..73fe59579ff3 100644 --- a/linguistic/source/spelldsp.hxx +++ b/linguistic/source/spelldsp.hxx @@ -31,6 +31,7 @@ #include <map> #include <memory> +#include <optional> #include <unotools/charclass.hxx> class LngSvcMgr; @@ -53,7 +54,7 @@ class SpellCheckerDispatcher : LngSvcMgr &m_rMgr; mutable std::unique_ptr<linguistic::SpellCache> m_pCache; // Spell Cache (holds known words) - std::unique_ptr<CharClass> m_pCharClass; + std::optional<CharClass> m_oCharClass; SpellCheckerDispatcher(const SpellCheckerDispatcher &) = delete; SpellCheckerDispatcher & operator = (const SpellCheckerDispatcher &) = delete; @@ -105,7 +106,7 @@ public: private: void setCharClass(const LanguageTag& rLanguageTag); - static OUString makeLowerCase(const OUString&, CharClass const *); + static OUString makeLowerCase(const OUString&, const std::optional<CharClass> &); }; diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx index c0a01c548be0..50a5e2f09ca3 100644 --- a/sd/inc/drawdoc.hxx +++ b/sd/inc/drawdoc.hxx @@ -22,11 +22,13 @@ #include <com/sun/star/text/WritingMode.hpp> #include <svl/style.hxx> #include <svx/fmmodel.hxx> +#include <unotools/charclass.hxx> #include <vcl/prntypes.hxx> #include <xmloff/autolayout.hxx> #include <vector> #include <memory> +#include <optional> #include <string_view> #include "sddllapi.h" @@ -51,7 +53,6 @@ struct SpellCallbackInfo; class SdCustomShowList; class SdUndoGroup; class SdrObject; -class CharClass; class Idle; class ImageMap; class Outliner; @@ -162,8 +163,8 @@ private: ::sd::DrawDocShellRef mxAllocedDocShRef; // => AllocModel() bool mbAllocDocSh; // => AllocModel() DocumentType meDocType; - std::unique_ptr<CharClass> - mpCharClass; + std::optional<CharClass> + moCharClass; ::std::unique_ptr<ImpDrawPageListWatcher> mpDrawPageListWatcher; ::std::unique_ptr<ImpMasterPageListWatcher> mpMasterPageListWatcher; @@ -464,7 +465,7 @@ public: static SdAnimationInfo* GetShapeUserData(SdrObject& rObject, bool bCreate = false ); - SAL_DLLPRIVATE CharClass* GetCharClass() const { return mpCharClass.get(); } + SAL_DLLPRIVATE const std::optional<CharClass>& GetCharClass() const { return moCharClass; } SAL_DLLPRIVATE void UpdateAllLinks(); diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 89d5bdefa714..3adb91275784 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -199,7 +199,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) } LanguageType eRealLanguage = MsLangId::getRealLanguage( meLanguage ); - mpCharClass.reset(new CharClass( LanguageTag( eRealLanguage) )); + moCharClass.emplace(LanguageTag( eRealLanguage)); // If the current application language is a language that uses right-to-left text... LanguageType eRealCTLLanguage = Application::GetSettings().GetLanguageTag().getLanguageType(); @@ -367,7 +367,7 @@ SdDrawDocument::~SdDrawDocument() mpCustomShowList.reset(); mpOutliner.reset(); mpInternalOutliner.reset(); - mpCharClass.reset(); + moCharClass.reset(); } void SdDrawDocument::adaptSizeAndBorderForAllPages( diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx index 1774b62d0211..6628a9ac9c8e 100644 --- a/sd/source/ui/dlg/custsdlg.cxx +++ b/sd/source/ui/dlg/custsdlg.cxx @@ -195,7 +195,7 @@ void SdCustomShowDlg::SelectHdl(void const *p) { // replace number by a number increased by 1 - const CharClass* pCharClass = rDoc.GetCharClass(); + const std::optional<CharClass>& pCharClass = rDoc.GetCharClass(); while( pCharClass->isDigit( aStr, nStrPos ) ) aStr = aStr.replaceAt( nStrPos, 1, u"" ); aStr = aStr.subView( 0, nStrPos) + OUString::number( ++nNum ) + aStr.subView( nStrPos); diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 74c3518a0a24..f8bcfebe9875 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -98,7 +98,7 @@ class SwAutoFormat SwTextFrame* m_pCurTextFrame; // frame of the current TextNode bool m_bIsRightToLeft; // text direction of the current frame SwNodeOffset m_nEndNdIdx; // for the percentage-display - mutable std::unique_ptr<CharClass> m_pCharClass; // Character classification + mutable std::optional<CharClass> m_oCharClass; // Character classification mutable LanguageType m_eCharClassLang; sal_uInt16 m_nRedlAutoFormatSeqId; @@ -121,12 +121,12 @@ class SwAutoFormat CharClass& GetCharClass( LanguageType eLang ) const { - if( !m_pCharClass || eLang != m_eCharClassLang ) + if( !m_oCharClass || eLang != m_eCharClassLang ) { - m_pCharClass.reset( new CharClass( LanguageTag( eLang ) ) ); + m_oCharClass.emplace( LanguageTag( eLang ) ); m_eCharClassLang = eLang; } - return *m_pCharClass; + return *m_oCharClass; } static bool IsSpace( const sal_Unicode c ) diff --git a/sw/source/core/inc/txmsrt.hxx b/sw/source/core/inc/txmsrt.hxx index 018457a06e94..324f88a90f23 100644 --- a/sw/source/core/inc/txmsrt.hxx +++ b/sw/source/core/inc/txmsrt.hxx @@ -20,13 +20,14 @@ #define INCLUDED_SW_SOURCE_CORE_INC_TXMSRT_HXX #include <i18nlangtag/lang.h> +#include <unotools/charclass.hxx> #include <nodeoffset.hxx> #include <tox.hxx> #include <com/sun/star/lang/Locale.hpp> +#include <optional> #include <utility> -class CharClass; class SwContentNode; class SwTextNode; class SwTextTOXMark; @@ -73,7 +74,7 @@ struct TextAndReading class SwTOXInternational { std::unique_ptr<IndexEntrySupplierWrapper> m_pIndexWrapper; - std::unique_ptr<CharClass> m_pCharClass; + std::optional<CharClass> m_oCharClass; LanguageType m_eLang; OUString m_sSortAlgorithm; SwTOIOptions m_nOptions; diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index de3ff3949912..4dcbd49fe70b 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -91,24 +91,24 @@ void SwTOXInternational::Init() else m_pIndexWrapper->LoadAlgorithm( aLcl, m_sSortAlgorithm, SW_COLLATOR_IGNORES ); - m_pCharClass.reset( new CharClass( LanguageTag( aLcl )) ); + m_oCharClass.emplace( LanguageTag( aLcl ) ); } SwTOXInternational::~SwTOXInternational() { - m_pCharClass.reset(); + m_oCharClass.reset(); m_pIndexWrapper.reset(); } OUString SwTOXInternational::ToUpper( const OUString& rStr, sal_Int32 nPos ) const { - return m_pCharClass->uppercase( rStr, nPos, 1 ); + return m_oCharClass->uppercase( rStr, nPos, 1 ); } bool SwTOXInternational::IsNumeric( const OUString& rStr ) const { - return m_pCharClass->isNumeric( rStr ); + return m_oCharClass->isNumeric( rStr ); } sal_Int32 SwTOXInternational::Compare( const TextAndReading& rTaR1, |