Blob Blame History Raw
From 10e3ea1d50a225b92a56c83ccf881807fbc7b0eb Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Fri, 20 Nov 2015 10:24:29 +0100
Subject: [PATCH 351/398] sw lok comments: implement painting of the vertical
 scrollbar

This one is special, as normally its map mode is in pixels, but we need
all sub-widgets to work in twips when tiled rendering.

With this, the scrollbar widget (both the buttons and the
button/background area of the scrollbar itself) is painted at the
correct location when Writer comments have enough content so the
scrollbar is visible.

Change-Id: I4ee9ef8618974b965339078d2262364ec19732ef
(cherry picked from commit f411ef1b8065d3ae03d1a820812e64b250de0932)
---
 sw/source/uibase/docvw/SidebarWin.cxx | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index 5f6cfa7c4ae0..6acbc1da7077 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -290,8 +290,22 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle
         aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset);
         rRenderContext.SetMapMode(aMapMode);
 
+        bool bPopChild = false;
+        if (pChild->GetMapMode().GetMapUnit() != rRenderContext.GetMapMode().GetMapUnit())
+        {
+            // This is needed for the scrollbar that has its map unit in pixels.
+            pChild->Push(PushFlags::MAPMODE);
+            bPopChild = true;
+            pChild->EnableMapMode();
+            aMapMode = pChild->GetMapMode();
+            aMapMode.SetMapUnit(rRenderContext.GetMapMode().GetMapUnit());
+            pChild->SetMapMode(aMapMode);
+        }
+
         pChild->Paint(rRenderContext, rRect);
 
+        if (bPopChild)
+            pChild->Pop();
         rRenderContext.Pop();
     }
 
-- 
2.12.0