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

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