Blame SOURCES/0282-sw-lok-annotations-paint-all-child-window.patch

135360
From 141f83a0f86de000c2ad25b207fdd6b0684a1c70 Mon Sep 17 00:00:00 2001
135360
From: Miklos Vajna <vmiklos@collabora.co.uk>
135360
Date: Fri, 6 Nov 2015 10:29:38 +0100
135360
Subject: [PATCH 282/398] sw lok annotations: paint all child window
135360
135360
And use map modes to get the painting to the correct position instead of
135360
manually adjusting each and every Paint() method.
135360
135360
(cherry picked from commit 177e375d2e63f1c3db9f5ab41e4281af740625fb)
135360
135360
Change-Id: I66798321b8bbf2c7968d6ac1edebb1f8df60bce8
135360
---
135360
 sw/source/uibase/docvw/PostItMgr.cxx         | 11 +++++++++--
135360
 sw/source/uibase/docvw/SidebarTxtControl.cxx | 19 +++----------------
135360
 sw/source/uibase/docvw/SidebarTxtControl.hxx |  1 -
135360
 sw/source/uibase/docvw/SidebarWin.cxx        | 13 +++++++++----
135360
 4 files changed, 21 insertions(+), 23 deletions(-)
135360
135360
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
135360
index b6bc52c253d0..35152d05d242 100644
135360
--- a/sw/source/uibase/docvw/PostItMgr.cxx
135360
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
135360
@@ -855,10 +855,17 @@ void SwPostItMgr::PaintTile(OutputDevice& rRenderContext, const Rectangle& /*rRe
135360
         if (!pPostIt)
135360
             continue;
135360
 
135360
-        Point aPoint(mpEditWin->PixelToLogic(pPostIt->GetPosPixel()));
135360
+        rRenderContext.Push(PushFlags::MAPMODE);
135360
+        Point aOffset(mpEditWin->PixelToLogic(pPostIt->GetPosPixel()));
135360
+        MapMode aMapMode(rRenderContext.GetMapMode());
135360
+        aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset);
135360
+        rRenderContext.SetMapMode(aMapMode);
135360
         Size aSize(pPostIt->PixelToLogic(pPostIt->GetSizePixel()));
135360
-        Rectangle aRectangle(aPoint, aSize);
135360
+        Rectangle aRectangle(Point(0, 0), aSize);
135360
+
135360
         pPostIt->PaintTile(rRenderContext, aRectangle);
135360
+
135360
+        rRenderContext.Pop();
135360
     }
135360
 }
135360
 
135360
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
135360
index 06dcfea58ff6..afda8b1952ad 100644
135360
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
135360
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
135360
@@ -54,7 +54,6 @@
135360
 #include <SwRewriter.hxx>
135360
 #include <boost/scoped_ptr.hpp>
135360
 #include <memory>
135360
-#include <comphelper/lok.hxx>
135360
 
135360
 namespace sw { namespace sidebarwindows {
135360
 
135360
@@ -153,37 +152,25 @@ void SidebarTextControl::Draw(OutputDevice* pDev, const Point& rPt, const Size&
135360
     }
135360
 }
135360
 
135360
-void SidebarTextControl::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
135360
-{
135360
-    Paint(rRenderContext, rRect);
135360
-}
135360
-
135360
 void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
135360
 {
135360
-    Point aPoint(0, 0);
135360
-    if (comphelper::LibreOfficeKit::isActive())
135360
-        aPoint = rRect.TopLeft();
135360
-
135360
     if (!rRenderContext.GetSettings().GetStyleSettings().GetHighContrastMode())
135360
     {
135360
         if (mrSidebarWin.IsMouseOverSidebarWin() || HasFocus())
135360
         {
135360
-            rRenderContext.DrawGradient(Rectangle(aPoint, rRenderContext.PixelToLogic(GetSizePixel())),
135360
+            rRenderContext.DrawGradient(Rectangle(Point(0,0), rRenderContext.PixelToLogic(GetSizePixel())),
135360
                                         Gradient(GradientStyle_LINEAR, mrSidebarWin.ColorDark(), mrSidebarWin.ColorDark()));
135360
         }
135360
         else
135360
         {
135360
-            rRenderContext.DrawGradient(Rectangle(aPoint, rRenderContext.PixelToLogic(GetSizePixel())),
135360
+            rRenderContext.DrawGradient(Rectangle(Point(0,0), rRenderContext.PixelToLogic(GetSizePixel())),
135360
                            Gradient(GradientStyle_LINEAR, mrSidebarWin.ColorLight(), mrSidebarWin.ColorDark()));
135360
         }
135360
     }
135360
 
135360
     if (GetTextView())
135360
     {
135360
-        if (comphelper::LibreOfficeKit::isActive())
135360
-            GetTextView()->GetOutliner()->Draw(&rRenderContext, rRect);
135360
-        else
135360
-            GetTextView()->Paint(rRect, &rRenderContext);
135360
+        GetTextView()->Paint(rRect, &rRenderContext);
135360
     }
135360
 
135360
     if (mrSidebarWin.GetLayoutStatus() == SwPostItHelper::DELETED)
135360
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx
135360
index df732434ecf5..1be8ab3b8b4a 100644
135360
--- a/sw/source/uibase/docvw/SidebarTxtControl.hxx
135360
+++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx
135360
@@ -69,7 +69,6 @@ class SidebarTextControl : public Control
135360
         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
135360
 
135360
         virtual void Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) override;
135360
-        void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect);
135360
 };
135360
 
135360
 } } // end of namespace sw::sidebarwindows
135360
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
135360
index 45916b03f797..1d0374b7f92d 100644
135360
--- a/sw/source/uibase/docvw/SidebarWin.cxx
135360
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
135360
@@ -247,10 +247,15 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle
135360
     for (sal_uInt16 i = 0; i < GetChildCount(); ++i)
135360
     {
135360
         vcl::Window* pChild = GetChild(i);
135360
-        if (pChild == mpSidebarTextControl.get())
135360
-            mpSidebarTextControl->PaintTile(rRenderContext, rRect);
135360
-        else
135360
-            SAL_WARN("sw.uibase", "SwSidebarWin::PaintTile: unhandled child " << pChild);
135360
+        rRenderContext.Push(PushFlags::MAPMODE);
135360
+        Point aOffset(PixelToLogic(pChild->GetPosPixel()));
135360
+        MapMode aMapMode(rRenderContext.GetMapMode());
135360
+        aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset);
135360
+        rRenderContext.SetMapMode(aMapMode);
135360
+
135360
+        pChild->Paint(rRenderContext, rRect);
135360
+
135360
+        rRenderContext.Pop();
135360
     }
135360
 }
135360
 
135360
-- 
135360
2.12.0
135360