Blob Blame History Raw
From 141f83a0f86de000c2ad25b207fdd6b0684a1c70 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Fri, 6 Nov 2015 10:29:38 +0100
Subject: [PATCH 282/398] sw lok annotations: paint all child window

And use map modes to get the painting to the correct position instead of
manually adjusting each and every Paint() method.

(cherry picked from commit 177e375d2e63f1c3db9f5ab41e4281af740625fb)

Change-Id: I66798321b8bbf2c7968d6ac1edebb1f8df60bce8
---
 sw/source/uibase/docvw/PostItMgr.cxx         | 11 +++++++++--
 sw/source/uibase/docvw/SidebarTxtControl.cxx | 19 +++----------------
 sw/source/uibase/docvw/SidebarTxtControl.hxx |  1 -
 sw/source/uibase/docvw/SidebarWin.cxx        | 13 +++++++++----
 4 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index b6bc52c253d0..35152d05d242 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -855,10 +855,17 @@ void SwPostItMgr::PaintTile(OutputDevice& rRenderContext, const Rectangle& /*rRe
         if (!pPostIt)
             continue;
 
-        Point aPoint(mpEditWin->PixelToLogic(pPostIt->GetPosPixel()));
+        rRenderContext.Push(PushFlags::MAPMODE);
+        Point aOffset(mpEditWin->PixelToLogic(pPostIt->GetPosPixel()));
+        MapMode aMapMode(rRenderContext.GetMapMode());
+        aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset);
+        rRenderContext.SetMapMode(aMapMode);
         Size aSize(pPostIt->PixelToLogic(pPostIt->GetSizePixel()));
-        Rectangle aRectangle(aPoint, aSize);
+        Rectangle aRectangle(Point(0, 0), aSize);
+
         pPostIt->PaintTile(rRenderContext, aRectangle);
+
+        rRenderContext.Pop();
     }
 }
 
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 06dcfea58ff6..afda8b1952ad 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -54,7 +54,6 @@
 #include <SwRewriter.hxx>
 #include <boost/scoped_ptr.hpp>
 #include <memory>
-#include <comphelper/lok.hxx>
 
 namespace sw { namespace sidebarwindows {
 
@@ -153,37 +152,25 @@ void SidebarTextControl::Draw(OutputDevice* pDev, const Point& rPt, const Size&
     }
 }
 
-void SidebarTextControl::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
-{
-    Paint(rRenderContext, rRect);
-}
-
 void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
 {
-    Point aPoint(0, 0);
-    if (comphelper::LibreOfficeKit::isActive())
-        aPoint = rRect.TopLeft();
-
     if (!rRenderContext.GetSettings().GetStyleSettings().GetHighContrastMode())
     {
         if (mrSidebarWin.IsMouseOverSidebarWin() || HasFocus())
         {
-            rRenderContext.DrawGradient(Rectangle(aPoint, rRenderContext.PixelToLogic(GetSizePixel())),
+            rRenderContext.DrawGradient(Rectangle(Point(0,0), rRenderContext.PixelToLogic(GetSizePixel())),
                                         Gradient(GradientStyle_LINEAR, mrSidebarWin.ColorDark(), mrSidebarWin.ColorDark()));
         }
         else
         {
-            rRenderContext.DrawGradient(Rectangle(aPoint, rRenderContext.PixelToLogic(GetSizePixel())),
+            rRenderContext.DrawGradient(Rectangle(Point(0,0), rRenderContext.PixelToLogic(GetSizePixel())),
                            Gradient(GradientStyle_LINEAR, mrSidebarWin.ColorLight(), mrSidebarWin.ColorDark()));
         }
     }
 
     if (GetTextView())
     {
-        if (comphelper::LibreOfficeKit::isActive())
-            GetTextView()->GetOutliner()->Draw(&rRenderContext, rRect);
-        else
-            GetTextView()->Paint(rRect, &rRenderContext);
+        GetTextView()->Paint(rRect, &rRenderContext);
     }
 
     if (mrSidebarWin.GetLayoutStatus() == SwPostItHelper::DELETED)
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx
index df732434ecf5..1be8ab3b8b4a 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.hxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx
@@ -69,7 +69,6 @@ class SidebarTextControl : public Control
         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
 
         virtual void Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) override;
-        void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect);
 };
 
 } } // end of namespace sw::sidebarwindows
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index 45916b03f797..1d0374b7f92d 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -247,10 +247,15 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle
     for (sal_uInt16 i = 0; i < GetChildCount(); ++i)
     {
         vcl::Window* pChild = GetChild(i);
-        if (pChild == mpSidebarTextControl.get())
-            mpSidebarTextControl->PaintTile(rRenderContext, rRect);
-        else
-            SAL_WARN("sw.uibase", "SwSidebarWin::PaintTile: unhandled child " << pChild);
+        rRenderContext.Push(PushFlags::MAPMODE);
+        Point aOffset(PixelToLogic(pChild->GetPosPixel()));
+        MapMode aMapMode(rRenderContext.GetMapMode());
+        aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset);
+        rRenderContext.SetMapMode(aMapMode);
+
+        pChild->Paint(rRenderContext, rRect);
+
+        rRenderContext.Pop();
     }
 }
 
-- 
2.12.0