diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2023-05-12 22:07:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-05-13 14:56:06 +0200 |
commit | 5dc82f62d54fbd6299b4a1dc677e714e92f2f88c (patch) | |
tree | dbba9287eff7abaa32e16d9f9af1252c06ae38ee /sd | |
parent | 3168d1ab07239789cd36a5960cef2d13ae29c9de (diff) |
use more optional for CharClass
Change-Id: I67984321b8f38928bfab9fb0b624620e7d286a11
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151722
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-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 |
3 files changed, 8 insertions, 7 deletions
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); |