[Libreoffice-commits] core.git: sd/inc sd/Library_sd.mk sd/source

Takeshi Abe tabe at fixedpoint.jp
Wed Oct 26 09:21:14 UTC 2016


 sd/Library_sd.mk                   |    1 +
 sd/inc/sdmod.hxx                   |    4 ++++
 sd/source/ui/app/sdmod.cxx         |    9 ++++++++-
 sd/source/ui/inc/DrawViewShell.hxx |   10 +++++++---
 sd/source/ui/view/drviews1.cxx     |   10 +---------
 sd/source/ui/view/drviews4.cxx     |   11 ++---------
 sd/source/ui/view/drviews5.cxx     |    2 +-
 sd/source/ui/view/drviewsa.cxx     |   11 +++++------
 sd/source/ui/view/drviewsk.cxx     |   37 +++++++++++++++++++++++++++++++++++++
 9 files changed, 66 insertions(+), 29 deletions(-)

New commits:
commit 406798f8aae3c0e305d6994fc82561a5002af0aa
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Thu Oct 20 20:26:24 2016 +0900

    tdf#96948 Change color of the area behind Impress slide immediately
    
    after saving Options > Application colours > Application background.
    
    This fixes a regression from 1c481fe6522f4c7d883e77a4ac32f855b9bcb323.
    
    Change-Id: I8dc0caf9e351c0b1bf2a10e9097d8f3e895f1471
    Reviewed-on: https://gerrit.libreoffice.org/29957
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk
index 22c94b8..6a267d4 100644
--- a/sd/Library_sd.mk
+++ b/sd/Library_sd.mk
@@ -475,6 +475,7 @@ $(eval $(call gb_Library_add_exception_objects,sd,\
 	sd/source/ui/view/drviewsh \
 	sd/source/ui/view/drviewsi \
 	sd/source/ui/view/drviewsj \
+	sd/source/ui/view/drviewsk \
 	sd/source/ui/view/drvwshrg \
 	sd/source/ui/view/frmview \
 	sd/source/ui/view/grviewsh \
diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx
index ed4435d..9b04cf0 100644
--- a/sd/inc/sdmod.hxx
+++ b/sd/inc/sdmod.hxx
@@ -43,6 +43,7 @@ class SvNumberFormatter;
 class SfxErrorHandler;
 class SdDrawDocument;
 class SfxFrame;
+namespace svtools { class ColorConfig; }
 
 namespace sd {
 class DrawDocShell;
@@ -129,6 +130,8 @@ public:
     SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache;
     SdTypesCache gImplTypesCache;
 
+    svtools::ColorConfig& GetColorConfig();
+
 protected:
 
     SdOptions*              pImpressOptions;
@@ -176,6 +179,7 @@ private:
     */
     DECL_STATIC_LINK( SdModule, EventListenerHdl, VclSimpleEvent&, void );
 
+    std::unique_ptr<svtools::ColorConfig> mpColorConfig;
 };
 
 #define SD_MOD() ( static_cast<SdModule*>(SfxApplication::GetModule(SfxToolsModule::Draw)) )
diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx
index f38a67e..d5cfa2a 100644
--- a/sd/source/ui/app/sdmod.cxx
+++ b/sd/source/ui/app/sdmod.cxx
@@ -40,6 +40,7 @@
 #include <svx/svxerr.hxx>
 
 #include <svx/xmlsecctrl.hxx>
+#include <svtools/colorcfg.hxx>
 
 #include "sderror.hxx"
 #include "sdmod.hxx"
@@ -77,7 +78,8 @@ SdModule::SdModule(SfxObjectFactory* pFact1, SfxObjectFactory* pFact2 )
     pNumberFormatter( nullptr ),
     bWaterCan(false),
     mpResourceContainer(new ::sd::SdGlobalResourceContainer()),
-    mbEventListenerAdded(false)
+    mbEventListenerAdded(false),
+    mpColorConfig(new svtools::ColorConfig)
 {
     SetName( "StarDraw" );  // Do not translate!
     pSearchItem = new SvxSearchItem(SID_SEARCH_ITEM);
@@ -220,4 +222,9 @@ OutputDevice* SdModule::GetRefDevice (::sd::DrawDocShell& )
     return GetVirtualRefDevice();
 }
 
+svtools::ColorConfig& SdModule::GetColorConfig()
+{
+    return *mpColorConfig;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index 22b21d7..1068edb 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -30,6 +30,7 @@
 #include <com/sun/star/lang/XEventListener.hpp>
 #include <com/sun/star/scanner/XScannerManager2.hpp>
 #include <unotools/caserotate.hxx>
+#include <unotools/options.hxx>
 
 class Outliner;
 class SdPage;
@@ -65,7 +66,8 @@ class ViewOverlayManager;
 */
 class DrawViewShell
     : public ViewShell,
-      public SfxListener
+      public SfxListener,
+      public utl::ConfigurationListener
 {
 public:
     SFX_DECL_INTERFACE(SD_IF_SDDRAWVIEWSHELL)
@@ -361,8 +363,6 @@ public:
 
     OUString GetSidebarContextName() const;
 
-    const Color& GetAppBackgroundColor() const { return mnAppBackgroundColor; }
-    void SetAppBackgroundColor( Color nNewColor )  { mnAppBackgroundColor = nNewColor; }
     bool IsInSwitchPage() { return mbIsInSwitchPage; }
 
     //move this method to ViewShell.
@@ -489,6 +489,10 @@ private:
 
     std::vector<std::unique_ptr<SdrExternalToolEdit>> m_ExternalEdits;
 
+    virtual void ConfigurationChanged( utl::ConfigurationBroadcaster* pCb, sal_uInt32 ) override;
+
+    void ConfigureAppBackgroundColor( svtools::ColorConfig* pColorConfig = nullptr );
+
     // The colour of the area behind the slide (used to be called "Wiese")
     Color mnAppBackgroundColor;
 };
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 84696ce..a521675 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -380,10 +380,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
                 GetViewShellBase().GetToolBarManager()->ResetToolBars(ToolBarManager::TBG_COMMON_TASK);
         }
 
-        svtools::ColorConfig aColorConfig;
-        Color aFillColor( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor );
-        if (comphelper::LibreOfficeKit::isActive())
-            aFillColor = COL_TRANSPARENT;
+        ConfigureAppBackgroundColor();
 
         if (meEditMode == EditMode::Page)
         {
@@ -410,8 +407,6 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
 
             maTabControl->SetCurPageId(nActualPageNum + 1);
 
-            SetAppBackgroundColor( aFillColor );
-
             SwitchPage(nActualPageNum);
 
             //tdf#102343 re-enable common undo on switch back from master mode
@@ -451,9 +446,6 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
                 }
             }
 
-            aFillColor.DecreaseLuminance( 64 );
-            SetAppBackgroundColor( aFillColor );
-
             maTabControl->SetCurPageId(nActualMasterPageNum + 1);
             SwitchPage(nActualMasterPageNum);
 
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index c8d526f..5c95ce8 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -20,7 +20,6 @@
 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
 
 #include "DrawViewShell.hxx"
-#include <comphelper/lok.hxx>
 #include <vcl/msgbox.hxx>
 #include <svl/urlbmk.hxx>
 #include <svx/svdpagv.hxx>
@@ -342,14 +341,8 @@ void DrawViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)
         // is needed it is necessary to set it here.
         if (GetDoc())
         {
-            svtools::ColorConfig aColorConfig;
-            Color aFillColor;
-
-            aFillColor = Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor );
-            if (comphelper::LibreOfficeKit::isActive())
-                aFillColor = COL_TRANSPARENT;
-
-            mpDrawView->SetApplicationBackgroundColor(aFillColor);
+            ConfigureAppBackgroundColor();
+            mpDrawView->SetApplicationBackgroundColor( mnAppBackgroundColor );
         }
 
         ViewShell::MouseMove(rMEvt, pWin);
diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx
index b3ce977..7dca113 100644
--- a/sd/source/ui/view/drviews5.cxx
+++ b/sd/source/ui/view/drviews5.cxx
@@ -414,7 +414,7 @@ void DrawViewShell::Paint(const Rectangle& rRect, ::sd::Window* pWin)
     GetDoc()->GetDrawOutliner().SetDefaultLanguage( GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ) );
 
     // Set Application Background color for usage in SdrPaintView(s)
-    mpDrawView->SetApplicationBackgroundColor(GetAppBackgroundColor());
+    mpDrawView->SetApplicationBackgroundColor( mnAppBackgroundColor );
 
     /* This is done before each text edit, so why not do it before every paint.
                 The default language is only used if the outliner only contains one
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index ad3c9b1..84ed10d 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -20,7 +20,6 @@
 #include "DrawViewShell.hxx"
 #include <com/sun/star/scanner/ScannerManager.hpp>
 #include <cppuhelper/implbase.hxx>
-#include <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
 #include <editeng/sizeitem.hxx>
 #include <svx/svdlayer.hxx>
@@ -128,10 +127,15 @@ DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBas
     SetContextName(GetSidebarContextName());
 
     doShow();
+
+    ConfigureAppBackgroundColor();
+    SD_MOD()->GetColorConfig().AddListener(this);
 }
 
 DrawViewShell::~DrawViewShell()
 {
+    SD_MOD()->GetColorConfig().RemoveListener(this);
+
     mpSelectionChangeHandler->Disconnect();
 
     mpAnnotationManager.reset();
@@ -205,11 +209,6 @@ void DrawViewShell::Construct(DrawDocShell* pDocSh, PageKind eInitialPageKind)
     mbPastePossible = false;
     mbIsLayerModeActive = false;
 
-    svtools::ColorConfig aColorConfig;
-    mnAppBackgroundColor = Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor );
-    if (comphelper::LibreOfficeKit::isActive())
-        mnAppBackgroundColor = COL_TRANSPARENT;
-
     mpFrameView->Connect();
 
     OSL_ASSERT (GetViewShell()!=nullptr);
diff --git a/sd/source/ui/view/drviewsk.cxx b/sd/source/ui/view/drviewsk.cxx
new file mode 100644
index 0000000..aaf11ddf
--- /dev/null
+++ b/sd/source/ui/view/drviewsk.cxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "DrawViewShell.hxx"
+#include "sdmod.hxx"
+
+#include <comphelper/lok.hxx>
+
+namespace sd {
+
+void DrawViewShell::ConfigurationChanged( utl::ConfigurationBroadcaster* pCb, sal_uInt32 )
+{
+    ConfigureAppBackgroundColor( dynamic_cast<svtools::ColorConfig*>(pCb) );
+}
+
+void DrawViewShell::ConfigureAppBackgroundColor( svtools::ColorConfig *pColorConfig )
+{
+    if (!pColorConfig)
+        pColorConfig = &SD_MOD()->GetColorConfig();
+    Color aFillColor( pColorConfig->GetColorValue( svtools::APPBACKGROUND ).nColor );
+    if (comphelper::LibreOfficeKit::isActive())
+        aFillColor = COL_TRANSPARENT;
+    // tdf#87905 Use darker background color for master view
+    if (meEditMode == EditMode::MasterPage)
+        aFillColor.DecreaseLuminance( 64 );
+    mnAppBackgroundColor = aFillColor;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */


More information about the Libreoffice-commits mailing list