[Libreoffice-commits] core.git: include/vcl vcl/source

Adrien Ollier (via logerrit) logerrit at kemper.freedesktop.org
Sun Jan 19 10:34:17 UTC 2020


 include/vcl/outdev.hxx        |    4 ++++
 include/vcl/window.hxx        |    1 +
 vcl/source/outdev/map.cxx     |   14 ++++----------
 vcl/source/window/window3.cxx |    9 ++++++++-
 4 files changed, 17 insertions(+), 11 deletions(-)

New commits:
commit fcc0fea62a6985699dfa88136f22cb19be6232bd
Author:     Adrien Ollier <adr.ollier at hotmail.fr>
AuthorDate: Sun Nov 24 11:08:15 2019 +0100
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sun Jan 19 11:33:40 2020 +0100

    tdf#74702: clean up of OutputDevice::SetMapMode
    
    All changes are formatted using clang-format utility.
    
    Change-Id: Icfa7ae22bc06e57c7f7cb512813966dcefd4fc40
    Signed-off-by: Adrien Ollier <adr.ollier at hotmail.fr>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/83601
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Tested-by: Jenkins

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index d0578b39095a..64ba3f135ad2 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1673,6 +1673,10 @@ public:
     void                        SetRelativeMapMode( const MapMode& rNewMapMode );
     const MapMode&              GetMapMode() const { return maMapMode; }
 
+protected:
+    virtual void ImplInitMapModeObjects();
+
+public:
      // #i75163#
     basegfx::B2DHomMatrix       GetViewTransformation() const;
     basegfx::B2DHomMatrix       GetInverseViewTransformation() const;
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 8ea622a8898e..a78259c5f222 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -746,6 +746,7 @@ protected:
 
     void ImplClearFontData(bool bNewFontLists) override;
     void ImplRefreshFontData(bool bNewFontLists) override;
+    void ImplInitMapModeObjects() override;
 
     // FIXME: this is a hack to workaround missing layout functionality
     virtual void                        ImplAdjustNWFSizes();
diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index 7ac99f6b4a37..92d9e63224e7 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -666,11 +666,7 @@ void OutputDevice::SetMapMode()
         // create new objects (clip region are not re-scaled)
         mbNewFont   = true;
         mbInitFont  = true;
-        if ( GetOutDevType() == OUTDEV_WINDOW )
-        {
-            if ( static_cast<vcl::Window*>(this)->mpWindowImpl->mpCursor )
-                static_cast<vcl::Window*>(this)->mpWindowImpl->mpCursor->ImplNew();
-        }
+        ImplInitMapModeObjects();
 
         // #106426# Adapt logical offset when changing mapmode
         mnOutOffLogicX = mnOutOffOrigX; // no mapping -> equal offsets
@@ -760,11 +756,7 @@ void OutputDevice::SetMapMode( const MapMode& rNewMapMode )
     // create new objects (clip region are not re-scaled)
     mbNewFont   = true;
     mbInitFont  = true;
-    if ( GetOutDevType() == OUTDEV_WINDOW )
-    {
-        if ( static_cast<vcl::Window*>(this)->mpWindowImpl->mpCursor )
-            static_cast<vcl::Window*>(this)->mpWindowImpl->mpCursor->ImplNew();
-    }
+    ImplInitMapModeObjects();
 
     // #106426# Adapt logical offset when changing mapmode
     mnOutOffLogicX = ImplPixelToLogic( mnOutOffOrigX, mnDPIX,
@@ -778,6 +770,8 @@ void OutputDevice::SetMapMode( const MapMode& rNewMapMode )
     ImplInvalidateViewTransform();
 }
 
+void OutputDevice::ImplInitMapModeObjects() {}
+
 void OutputDevice::SetRelativeMapMode( const MapMode& rNewMapMode )
 {
     // do nothing if MapMode did not change
diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx
index 565a81eb292e..c99d085f41e5 100644
--- a/vcl/source/window/window3.cxx
+++ b/vcl/source/window/window3.cxx
@@ -20,6 +20,7 @@
 #include <vcl/window.hxx>
 #include <vcl/waitobj.hxx>
 #include <window.h>
+#include <vcl/cursor.hxx>
 
 WaitObject::~WaitObject()
 {
@@ -55,7 +56,13 @@ void Window::ImplRefreshFontData(bool bNewFontLists)
         pChild->ImplRefreshFontData(bNewFontLists);
 }
 
-} /* namespace vcl */
+void Window::ImplInitMapModeObjects()
+{
+    OutputDevice::ImplInitMapModeObjects();
+    if (mpWindowImpl->mpCursor)
+        mpWindowImpl->mpCursor->ImplNew();
+}
 
+} /* namespace vcl */
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list