From 0fb40ac6ec515ccc3b1db575232aa4e01c46e815 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Mon, 23 Nov 2015 13:46:59 +0100
Subject: [PATCH 353/398] sw lok comments: fix vertical scrollbar with custom
zoom
With this, if a comment has enough content that it gets a vertical
scrollbar, then tiled rendering output looks OK, even with non-100%
zoom.
Change-Id: I699aadc11b6c34fb0791e70705719fd61169d972
(cherry picked from commit 30b511ae38e2870174db91d12f65a9c3320fc172)
---
sw/source/core/view/viewsh.cxx | 9 +++++++++
sw/source/uibase/docvw/SidebarWin.cxx | 5 +++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 963577fb1bd8..093d5208fdda 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1879,6 +1879,15 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex
aMapMode.SetScaleY(scaleY);
rDevice.SetMapMode(aMapMode);
+ // Update scaling of SwEditWin and its sub-widgets, needed for comments.
+ if (GetWin() && GetWin()->GetMapMode().GetScaleX() != scaleX)
+ {
+ double fScale = scaleX;
+ SwViewOption aOption(*GetViewOptions());
+ aOption.SetZoom(fScale * 100);
+ ApplyViewOptions(aOption);
+ }
+
Rectangle aOutRect = Rectangle(Point(tilePosX, tilePosY),
rDevice.PixelToLogic(Size(contextWidth, contextHeight)));
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index 6acbc1da7077..47c65c86b06b 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -284,8 +284,7 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle
continue;
rRenderContext.Push(PushFlags::MAPMODE);
- const Fraction& rFraction(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
- Point aOffset(PixelToLogic(pChild->GetPosPixel() * rFraction.GetDenominator() / rFraction.GetNumerator()));
+ Point aOffset(PixelToLogic(pChild->GetPosPixel()));
MapMode aMapMode(rRenderContext.GetMapMode());
aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset);
rRenderContext.SetMapMode(aMapMode);
@@ -299,6 +298,8 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle
pChild->EnableMapMode();
aMapMode = pChild->GetMapMode();
aMapMode.SetMapUnit(rRenderContext.GetMapMode().GetMapUnit());
+ aMapMode.SetScaleX(rRenderContext.GetMapMode().GetScaleX());
+ aMapMode.SetScaleY(rRenderContext.GetMapMode().GetScaleY());
pChild->SetMapMode(aMapMode);
}
--
2.12.0