[Libreoffice-commits] core.git: editeng/source

Caolán McNamara caolanm at redhat.com
Sun May 7 16:24:31 UTC 2017


 editeng/source/editeng/impedit.hxx  |    9 +++------
 editeng/source/editeng/impedit2.cxx |   10 ----------
 editeng/source/editeng/impedit3.cxx |    3 +--
 3 files changed, 4 insertions(+), 18 deletions(-)

New commits:
commit 525292acab017dcfd50ef0c0b6dc4a5229e32a4e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 7 15:28:22 2017 +0100

    create color config in ctor instead of on-demand
    
    Change-Id: Id45b6cba3665c11074dbdc52757d1b6f0084b020
    Reviewed-on: https://gerrit.libreoffice.org/37346
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 19333a665575..bb8f4e894a49 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -31,6 +31,7 @@
 #include <editeng/eedata.hxx>
 #include "editeng/editeng.hxx"
 #include <editeng/editview.hxx>
+#include <svtools/colorcfg.hxx>
 #include <vcl/virdev.hxx>
 #include <vcl/gdimtf.hxx>
 #include <vcl/cursor.hxx>
@@ -84,10 +85,6 @@ namespace clipboard {
     class XClipboard;
 }}}}}
 
-namespace svtools {
-    class ColorConfig;
-}
-
 namespace editeng {
     struct MisspellRanges;
 }
@@ -425,7 +422,7 @@ private:
     VclPtr< OutputDevice > pRefDev;
     VclPtr<VirtualDevice> mpOwnDev;
 
-    svtools::ColorConfig*   pColorConfig;
+    svtools::ColorConfig maColorConfig;
     mutable SvtCTLOptions*  pCTLOptions;
 
     SfxItemSet*         pEmptyItemSet;
@@ -866,7 +863,7 @@ public:
     void            FormatAndUpdate( EditView* pCurView = nullptr, bool bCalledFromUndo = false );
     inline void     IdleFormatAndUpdate( EditView* pCurView );
 
-    svtools::ColorConfig& GetColorConfig();
+    const svtools::ColorConfig& GetColorConfig() const { return maColorConfig; }
     bool            IsVisualCursorTravelingEnabled();
     bool            DoVisualCursorTraveling();
 
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index df975e1eb882..950a5bf79f1b 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -120,7 +120,6 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
     pUndoManager        = nullptr;
     pUndoMarkSelection  = nullptr;
     pTextRanger         = nullptr;
-    pColorConfig        = nullptr;
     pCTLOptions         = nullptr;
 
     nCurTextHeight      = 0;
@@ -200,7 +199,6 @@ ImpEditEngine::~ImpEditEngine()
     delete pUndoManager;
     delete pTextRanger;
     delete mpIMEInfos;
-    delete pColorConfig;
     delete pCTLOptions;
     delete pSpellInfo;
 }
@@ -4347,14 +4345,6 @@ void ImpEditEngine::SetForbiddenCharsTable( const rtl::Reference<SvxForbiddenCha
     EditDLL::Get().GetGlobalData()->SetForbiddenCharsTable( xForbiddenChars );
 }
 
-svtools::ColorConfig& ImpEditEngine::GetColorConfig()
-{
-    if ( !pColorConfig )
-        pColorConfig = new svtools::ColorConfig;
-
-    return *pColorConfig;
-}
-
 bool ImpEditEngine::IsVisualCursorTravelingEnabled()
 {
     bool bVisualCursorTravaling = false;
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 85360b100f1a..f002bb3c31c9 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -4393,7 +4393,7 @@ Reference < i18n::XExtendedInputSequenceChecker > const & ImpEditEngine::ImplGet
 
 Color ImpEditEngine::GetAutoColor() const
 {
-    Color aColor = const_cast<ImpEditEngine*>(this)->GetColorConfig().GetColorValue( svtools::FONTCOLOR ).nColor;
+    Color aColor = GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor;
 
     if ( GetBackgroundColor() != COL_AUTO )
     {
@@ -4406,7 +4406,6 @@ Color ImpEditEngine::GetAutoColor() const
     return aColor;
 }
 
-
 bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* pNode,
                                              TextPortion* pTextPortion, sal_Int32 nStartPos,
                                              long* pDXArray, sal_uInt16 n100thPercentFromMax,


More information about the Libreoffice-commits mailing list