[Libreoffice-commits] core.git: 3 commits - editeng/source include/editeng starmath/inc starmath/source

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Wed May 15 17:40:33 UTC 2019


 editeng/source/editeng/editeng.cxx        |   10 ----
 editeng/source/editeng/impedit.hxx        |    4 -
 editeng/source/editeng/impedit2.cxx       |    1 
 editeng/source/editeng/impedit3.cxx       |    4 -
 include/editeng/editeng.hxx               |    2 
 starmath/inc/ElementsDockingWindow.hxx    |    3 +
 starmath/inc/document.hxx                 |    2 
 starmath/inc/edit.hxx                     |    1 
 starmath/inc/smmod.hxx                    |    2 
 starmath/inc/view.hxx                     |    3 -
 starmath/source/ElementsDockingWindow.cxx |   68 +++++++++++++++++++-----------
 starmath/source/document.cxx              |    8 +--
 starmath/source/edit.cxx                  |   12 +++--
 starmath/source/smmod.cxx                 |   29 ++++--------
 starmath/source/view.cxx                  |   16 ++-----
 15 files changed, 79 insertions(+), 86 deletions(-)

New commits:
commit 87b8c32f2f72fc9373abe1fc53a2d47183c5f5d3
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue May 14 03:11:17 2019 +0000
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Wed May 15 19:38:29 2019 +0200

    SM fix element control scrollbar
    
    The element layouting must always be done without a scrollbar, so
    it can be decided, if a scrollbar is needed. If it's needed the
    first paint will update the scrollbar accordingly.
    
    This also sets the scrollbar's page size to the control height,
    so clicking in an empty area will correctly scroll the widget not
    just a single pixel.
    
    Change-Id: Ib9a0eb1952bc0355f683cd8d116c61f9c9d462c4
    Reviewed-on: https://gerrit.libreoffice.org/72315
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx
index fe712401f773..c98072143bdc 100644
--- a/starmath/inc/ElementsDockingWindow.hxx
+++ b/starmath/inc/ElementsDockingWindow.hxx
@@ -77,6 +77,7 @@ class SmElementsControl : public Control
     virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
     virtual void MouseMove(const MouseEvent& rMEvt) override;
     virtual void RequestHelp(const HelpEvent& rHEvt) override;
+    virtual void Resize() override;
 
     SmDocShell*   mpDocShell;
     SmFormat      maFormat;
@@ -88,6 +89,7 @@ class SmElementsControl : public Control
     Size          maMaxElementDimensions;
     bool          mbVerticalMode;
     VclPtr< ScrollBar > mxScroll;
+    bool mbFirstPaintAfterLayout;
 
     void addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText);
 
diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx
index ab0ad7dd689e..36af328f1ced 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -238,6 +238,7 @@ SmElementsControl::SmElementsControl(vcl::Window *pParent)
     , mpCurrentElement(nullptr)
     , mbVerticalMode(true)
     , mxScroll(VclPtr<ScrollBar>::Create(this, WB_VERT))
+    , mbFirstPaintAfterLayout(false)
 {
     set_id("element_selector");
     SetMapMode( MapMode(MapUnit::Map100thMM) );
@@ -248,7 +249,6 @@ SmElementsControl::SmElementsControl(vcl::Window *pParent)
     maFormat.SetBaseSize(PixelToLogic(Size(0, SmPtsTo100th_mm(12))));
 
     mxScroll->SetScrollHdl( LINK(this, SmElementsControl, ScrollHdl) );
-    mxScroll->Show();
 }
 
 SmElementsControl::~SmElementsControl()
@@ -268,14 +268,19 @@ void SmElementsControl::setVerticalMode(bool bVerticalMode)
     mbVerticalMode = bVerticalMode;
 }
 
+/**
+ * !pContext => layout only
+ *
+ * Layouting is always done without a scrollbar and will show or hide it.
+ * The first paint (mbFirstPaintAfterLayout) therefore needs to update a
+ * visible scrollbar, because the layouting was wrong.
+ **/
 void SmElementsControl::LayoutOrPaintContents(vcl::RenderContext *pContext)
 {
-    bool bOldVisibleState = mxScroll->IsVisible();
-
-    sal_Int32 nScrollbarWidth = bOldVisibleState ? GetSettings().GetStyleSettings().GetScrollBarSize() : 0;
-
-    sal_Int32 nControlWidth = GetOutputSizePixel().Width() - nScrollbarWidth;
-    sal_Int32 nControlHeight = GetOutputSizePixel().Height();
+    const sal_Int32 nScrollbarWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
+    const sal_Int32 nControlWidth = GetOutputSizePixel().Width()
+                                    - (pContext && mxScroll->IsVisible() ? nScrollbarWidth : 0);
+    const sal_Int32 nControlHeight = GetOutputSizePixel().Height();
 
     sal_Int32 boxX = maMaxElementDimensions.Width()  + 10;
     sal_Int32 boxY = maMaxElementDimensions.Height() + 10;
@@ -379,15 +384,21 @@ void SmElementsControl::LayoutOrPaintContents(vcl::RenderContext *pContext)
     }
 
     if (pContext)
-        return;
+    {
+        if (!mbFirstPaintAfterLayout || !mxScroll->IsVisible())
+            return;
+        mbFirstPaintAfterLayout = false;
+    }
+    else
+        mbFirstPaintAfterLayout = true;
 
     sal_Int32 nTotalControlHeight = y + boxY + mxScroll->GetThumbPos();
-
     if (nTotalControlHeight > GetOutputSizePixel().Height())
     {
         mxScroll->SetRangeMax(nTotalControlHeight);
         mxScroll->SetPosSizePixel(Point(nControlWidth, 0), Size(nScrollbarWidth, nControlHeight));
         mxScroll->SetVisibleSize(nControlHeight);
+        mxScroll->SetPageSize(nControlHeight);
         mxScroll->Show();
     }
     else
@@ -397,6 +408,12 @@ void SmElementsControl::LayoutOrPaintContents(vcl::RenderContext *pContext)
     }
 }
 
+void SmElementsControl::Resize()
+{
+     Window::Resize();
+     LayoutOrPaintContents(nullptr);
+}
+
 void SmElementsControl::ApplySettings(vcl::RenderContext& rRenderContext)
 {
     rRenderContext.SetBackground(COL_WHITE);
@@ -461,7 +478,6 @@ void SmElementsControl::MouseMove( const MouseEvent& rMouseEvent )
     mpCurrentElement = nullptr;
     if (rMouseEvent.IsLeaveWindow())
     {
-        LayoutOrPaintContents();
         Invalidate();
         return;
     }
@@ -476,7 +492,6 @@ void SmElementsControl::MouseMove( const MouseEvent& rMouseEvent )
                 if (pPrevElement != element)
                 {
                     mpCurrentElement = element;
-                    LayoutOrPaintContents();
                     Invalidate();
                     return;
                 }
@@ -541,7 +556,6 @@ void SmElementsControl::DoScroll(long nDelta)
     aRect.AdjustRight( -(mxScroll->GetSizePixel().Width()) );
     Scroll( 0, -nDelta, aRect );
     mxScroll->SetPosPixel(aNewPoint);
-    LayoutOrPaintContents();
     Invalidate();
 }
 
commit f9c94cfdde6c0af621cf80467a9d83c789699093
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Sun May 12 13:19:56 2019 +0000
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Wed May 15 19:37:58 2019 +0200

    tdf#90297 set default SmEditWindow background
    
    This implements ApplySetting for the proper background of the
    undocked SfxDockingWindow.
    
    In addition, like all other code, this sets the text color via
    the EditEngine font objects and therefore reverts the uneeded
    EditEngine interface from the original commit ea191cf9807d
    ("tdf#90297 use field colors for math's edit engine").
    
    Change-Id: Ib7df4ce730da92a1e41f58b8348a5aec18208166
    Reviewed-on: https://gerrit.libreoffice.org/72312
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 5faf9eb9f3f3..458f71b34d3f 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -183,16 +183,6 @@ Color const & EditEngine::GetBackgroundColor() const
     return pImpEditEngine->GetBackgroundColor();
 }
 
-void EditEngine::SetTextColor( const Color& rColor )
-{
-    pImpEditEngine->SetTextColor( rColor );
-}
-
-Color const & EditEngine::GetTextColor() const
-{
-    return pImpEditEngine->GetTextColor();
-}
-
 Color EditEngine::GetAutoColor() const
 {
     return pImpEditEngine->GetAutoColor();
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 987281ef89e4..9f0e27909515 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -463,7 +463,6 @@ private:
     EditSelectionEngine aSelEngine;
 
     Color               maBackgroundColor;
-    Color               maTextColor;
 
     sal_uInt16          nStretchX;
     sal_uInt16          nStretchY;
@@ -679,9 +678,6 @@ private:
     void                SetBackgroundColor( const Color& rColor ) { maBackgroundColor = rColor; }
     const Color&        GetBackgroundColor() const { return maBackgroundColor; }
 
-    void                SetTextColor( const Color& rColor ) { maTextColor = rColor; }
-    const Color&        GetTextColor() const { return maTextColor; }
-
     long                CalcVertLineSpacing(Point& rStartPos) const;
 
     Color               GetAutoColor() const;
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 0d1d3b399f93..6b4b8da61b2e 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -124,7 +124,6 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
 
     eDefLanguage        = LANGUAGE_DONTKNOW;
     maBackgroundColor   = COL_AUTO;
-    maTextColor         = COL_AUTO;
 
     nAsianCompressionMode = CharCompressType::NONE;
 
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 0cdee12d70ae..ec3e10cf1290 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -4418,9 +4418,7 @@ Reference < i18n::XExtendedInputSequenceChecker > const & ImpEditEngine::ImplGet
 
 Color ImpEditEngine::GetAutoColor() const
 {
-    Color aColor = GetTextColor();
-    if ( aColor == COL_AUTO )
-        aColor = GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor;
+    Color aColor = GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor;
 
     if ( GetBackgroundColor() != COL_AUTO )
     {
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index dfb39a0b8e94..f585ce8b5796 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -216,8 +216,6 @@ public:
 
     void            SetBackgroundColor( const Color& rColor );
     Color const &   GetBackgroundColor() const;
-    void            SetTextColor( const Color& rColor );
-    Color const &   GetTextColor() const;
     Color           GetAutoColor() const;
     void            EnableAutoColor( bool b );
     void            ForceAutoColor( bool b );
diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx
index ec4b016f12b9..2e2c7fab4211 100644
--- a/starmath/inc/document.hxx
+++ b/starmath/inc/document.hxx
@@ -215,7 +215,7 @@ public:
     void writeFormulaRtf(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding);
     void readFormulaOoxml( oox::formulaimport::XmlStream& stream );
 
-    void UpdateEditEngineDefaultFonts();
+    void UpdateEditEngineDefaultFonts(const Color& aTextColor);
 };
 
 #endif
diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx
index 858360b32e87..45d130b0c658 100644
--- a/starmath/inc/edit.hxx
+++ b/starmath/inc/edit.hxx
@@ -61,6 +61,7 @@ class SmEditWindow : public vcl::Window, public DropTargetHelper
     DECL_LINK(ModifyTimerHdl, Timer *, void);
     DECL_LINK(CursorMoveTimerHdl, Timer *, void);
 
+    virtual void ApplySettings(vcl::RenderContext&) override;
     virtual void DataChanged( const DataChangedEvent& ) override;
     virtual void Resize() override;
     virtual void MouseMove(const MouseEvent &rEvt) override;
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index 965702e1d5a4..bec09afd3163 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -275,7 +275,7 @@ void SmDocShell::ArrangeFormula()
     maAccText.clear();
 }
 
-void SmDocShell::UpdateEditEngineDefaultFonts()
+void SmDocShell::UpdateEditEngineDefaultFonts(const Color& aTextColor)
 {
     assert(mpEditEngineItemPool);
     if (!mpEditEngineItemPool)
@@ -310,6 +310,7 @@ void SmDocShell::UpdateEditEngineDefaultFonts()
                 rFntDta.nFallbackLang : rFntDta.nLang;
         vcl::Font aFont = OutputDevice::GetDefaultFont(
                     rFntDta.nFontType, nLang, GetDefaultFontFlags::OnlyOne );
+        aFont.SetColor(aTextColor);
         mpEditEngineItemPool->SetPoolDefaultItem(
                 SvxFontItem( aFont.GetFamilyType(), aFont.GetFamilyName(),
                     aFont.GetStyleName(), aFont.GetPitch(), aFont.GetCharSet(),
@@ -338,7 +339,8 @@ EditEngine& SmDocShell::GetEditEngine()
 
         mpEditEngineItemPool = EditEngine::CreatePool();
 
-        UpdateEditEngineDefaultFonts();
+        const StyleSettings& rStyleSettings = Application::GetDefaultDevice()->GetSettings().GetStyleSettings();
+        UpdateEditEngineDefaultFonts(rStyleSettings.GetFieldTextColor());
 
         mpEditEngine.reset( new EditEngine( mpEditEngineItemPool ) );
 
@@ -348,8 +350,6 @@ EditEngine& SmDocShell::GetEditEngine()
         mpEditEngine->SetDefTab( sal_uInt16(
             Application::GetDefaultDevice()->GetTextWidth("XXXX")) );
 
-        const StyleSettings& rStyleSettings = Application::GetDefaultDevice()->GetSettings().GetStyleSettings();
-        mpEditEngine->SetTextColor(rStyleSettings.GetFieldTextColor());
         mpEditEngine->SetBackgroundColor(rStyleSettings.GetFieldColor());
 
         mpEditEngine->SetControlWord(
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 76c10fe6536d..643ef04a1960 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -188,6 +188,12 @@ EditEngine * SmEditWindow::GetEditEngine()
     return pEditEng;
 }
 
+void SmEditWindow::ApplySettings(vcl::RenderContext& rRenderContext)
+{
+    const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+    rRenderContext.SetBackground(rStyleSettings.GetWindowColor());
+}
+
 void SmEditWindow::DataChanged( const DataChangedEvent& rDCEvt )
 {
     Window::DataChanged( rDCEvt );
@@ -208,11 +214,9 @@ void SmEditWindow::DataChanged( const DataChangedEvent& rDCEvt )
         //!
         const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
 
-        pDoc->UpdateEditEngineDefaultFonts();
-
-        pEditEngine->SetDefTab(sal_uInt16(GetTextWidth("XXXX")));
-        pEditEngine->SetTextColor(rStyleSettings.GetFieldTextColor());
+        pDoc->UpdateEditEngineDefaultFonts(rStyleSettings.GetFieldTextColor());
         pEditEngine->SetBackgroundColor(rStyleSettings.GetFieldColor());
+        pEditEngine->SetDefTab(sal_uInt16(GetTextWidth("XXXX")));
 
         // forces new settings to be used
         // unfortunately this resets the whole edit engine
commit 78523a2d03c95843c417c869bc90e14cfd267bcb
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Mon May 13 21:57:15 2019 +0000
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Wed May 15 19:37:18 2019 +0200

    SM handle background theme changes
    
    Replaces ApplyColorConfigValues with standard ApplySettings.
    I also opted to use COL_WHITE for the elements list, as the
    highlight color is also hard-coded to some light gray.
    
    Change-Id: I8be9d5897bf1dda4078b91d4df34a3339ac6cf31
    Reviewed-on: https://gerrit.libreoffice.org/72314
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx
index 133c480d7100..fe712401f773 100644
--- a/starmath/inc/ElementsDockingWindow.hxx
+++ b/starmath/inc/ElementsDockingWindow.hxx
@@ -72,6 +72,7 @@ class SmElementsControl : public Control
     static const std::pair<const char*, const char*> aFormats[];
     static const std::pair<const char*, const char*> aOthers[];
 
+    virtual void ApplySettings(vcl::RenderContext&) override;
     virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
     virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
     virtual void MouseMove(const MouseEvent& rMEvt) override;
diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx
index fc97d5392912..297f8a972e50 100644
--- a/starmath/inc/smmod.hxx
+++ b/starmath/inc/smmod.hxx
@@ -70,8 +70,6 @@ class SmModule : public SfxModule, public utl::ConfigurationListener
     std::unique_ptr<SvtSysLocale> mpSysLocale;
     VclPtr<VirtualDevice>    mpVirtualDev;
 
-    static void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
-
 public:
     SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START + SfxInterfaceId(0))
 
diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index 2b1692e8d9df..fb27546c456f 100644
--- a/starmath/inc/view.hxx
+++ b/starmath/inc/view.hxx
@@ -61,6 +61,7 @@ public:
     virtual void dispose() override;
 
     // Window
+    virtual void ApplySettings(vcl::RenderContext&) override;
     virtual void MouseButtonDown(const MouseEvent &rMEvt) override;
     virtual void MouseMove(const MouseEvent &rMEvt) override;
     virtual void GetFocus() override;
@@ -88,8 +89,6 @@ public:
     using ScrollableWindow::SetTotalSize;
     void SetTotalSize();
 
-    void ApplyColorConfigValues(const svtools::ColorConfig &rColorCfg);
-
     // for Accessibility
     virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
 
diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx
index 95df76c4ec63..ab0ad7dd689e 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -30,14 +30,15 @@
 #include "uiobject.hxx"
 #include <strings.hxx>
 
-#include <svl/stritem.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/sfxmodelfactory.hxx>
+#include <svl/stritem.hxx>
+#include <svtools/colorcfg.hxx>
 #include <vcl/event.hxx>
 #include <vcl/help.hxx>
 #include <vcl/settings.hxx>
-#include <vcl/uitest/logger.hxx>
 #include <vcl/uitest/eventdescription.hxx>
+#include <vcl/uitest/logger.hxx>
 
 SmElement::SmElement(std::unique_ptr<SmNode>&& pNode, const OUString& aText, const OUString& aHelpText) :
     mpNode(std::move(pNode)),
@@ -348,21 +349,21 @@ void SmElementsControl::LayoutOrPaintContents(vcl::RenderContext *pContext)
                 }
             }
 
-            if (mpCurrentElement == element && pContext)
-            {
-                pContext->Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
-                pContext->SetFillColor(Color(230, 230, 230));
-                pContext->SetLineColor(Color(230, 230, 230));
-
-                pContext->DrawRect(PixelToLogic(tools::Rectangle(x + 2, y + 2, x + boxX - 2, y + boxY - 2)));
-                pContext->Pop();
-            }
-
             element->mBoxLocation = Point(x,y);
             element->mBoxSize = Size(boxX, boxY);
 
             if (pContext)
             {
+                if (mpCurrentElement == element)
+                {
+                    pContext->Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
+                    pContext->SetFillColor(Color(230, 230, 230));
+                    pContext->SetLineColor(Color(230, 230, 230));
+
+                    pContext->DrawRect(PixelToLogic(tools::Rectangle(x + 2, y + 2, x + boxX - 2, y + boxY - 2)));
+                    pContext->Pop();
+                }
+
                 Size aSizePixel = LogicToPixel(Size(element->getNode()->GetWidth(),
                                                     element->getNode()->GetHeight()));
                 Point location(x + ((boxX - aSizePixel.Width()) / 2),
@@ -396,6 +397,11 @@ void SmElementsControl::LayoutOrPaintContents(vcl::RenderContext *pContext)
     }
 }
 
+void SmElementsControl::ApplySettings(vcl::RenderContext& rRenderContext)
+{
+    rRenderContext.SetBackground(COL_WHITE);
+}
+
 void SmElementsControl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
 {
     rRenderContext.Push();
diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx
index 041190181abf..cfa7048d23a0 100644
--- a/starmath/source/smmod.cxx
+++ b/starmath/source/smmod.cxx
@@ -133,35 +133,28 @@ SmModule::~SmModule()
     mpVirtualDev.disposeAndClear();
 }
 
-void SmModule::ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg )
-{
-    //invalidate all graphic and edit windows
-    SfxViewShell* pViewShell = SfxViewShell::GetFirst();
-    while (pViewShell)
-    {
-        if (dynamic_cast<const SmViewShell *>(pViewShell) != nullptr)
-        {
-            SmViewShell *pSmView = static_cast<SmViewShell *>(pViewShell);
-            pSmView->GetGraphicWindow().ApplyColorConfigValues( rColorCfg );
-        }
-        pViewShell = SfxViewShell::GetNext( *pViewShell );
-    }
-}
-
 svtools::ColorConfig & SmModule::GetColorConfig()
 {
     if(!mpColorConfig)
     {
         mpColorConfig.reset(new svtools::ColorConfig);
-        ApplyColorConfigValues( *mpColorConfig );
         mpColorConfig->AddListener(this);
     }
     return *mpColorConfig;
 }
 
-void SmModule::ConfigurationChanged( utl::ConfigurationBroadcaster*, ConfigurationHints )
+void SmModule::ConfigurationChanged(utl::ConfigurationBroadcaster* pBrdCst, ConfigurationHints)
 {
-    ApplyColorConfigValues(*mpColorConfig);
+    if (pBrdCst == mpColorConfig.get())
+    {
+        SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+        while (pViewShell)
+        {
+            if (dynamic_cast<const SmViewShell *>(pViewShell) != nullptr)
+                pViewShell->GetWindow()->Invalidate();
+            pViewShell = SfxViewShell::GetNext(*pViewShell);
+        }
+    }
 }
 
 SmMathConfig * SmModule::GetConfig()
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index cdc8b0b78862..96874023c9dc 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -135,15 +135,6 @@ void SmGraphicWindow::StateChanged(StateChangedType eType)
     ScrollableWindow::StateChanged(eType);
 }
 
-
-void SmGraphicWindow::ApplyColorConfigValues(const svtools::ColorConfig &rColorCfg)
-{
-    // Note: SetTextColor not necessary since the nodes that
-    // get painted have the color information.
-    SetBackground(rColorCfg.GetColorValue(svtools::DOCCOLOR).nColor);
-}
-
-
 void SmGraphicWindow::MouseButtonDown(const MouseEvent& rMEvt)
 {
     ScrollableWindow::MouseButtonDown(rMEvt);
@@ -368,10 +359,13 @@ const SmNode * SmGraphicWindow::SetCursorPos(sal_uInt16 nRow, sal_uInt16 nCol)
     return pNode;
 }
 
-void SmGraphicWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
+void SmGraphicWindow::ApplySettings(vcl::RenderContext& rRenderContext)
 {
-    ApplyColorConfigValues(SM_MOD()->GetColorConfig());
+    rRenderContext.SetBackground(SM_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor);
+}
 
+void SmGraphicWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
+{
     SmDocShell& rDoc = *pViewShell->GetDoc();
     Point aPoint;
 


More information about the Libreoffice-commits mailing list