Blame SOURCES/0338-sw-lok-comments-fix-text-selection-with-custom-zoom.patch

f325b2
From 3fb5c82343761f02a956653d7afcdb96d509daf5 Mon Sep 17 00:00:00 2001
f325b2
From: Miklos Vajna <vmiklos@collabora.co.uk>
f325b2
Date: Tue, 17 Nov 2015 12:21:42 +0100
f325b2
Subject: [PATCH 338/398] sw lok comments: fix text selection with custom zoom
f325b2
f325b2
SwPostItMgr::GetSidebarWidth() can be called in two scenarios:
f325b2
f325b2
- inside PaintTile() the output device contains the zoom level and has
f325b2
  the map mode enabled (and its scale factor is the zoom level)
f325b2
- outisde PaintTile() the output device is SwEditWin and has the map
f325b2
  mode disabled (and the zoom level is to be taken from the view
f325b2
  options)
f325b2
f325b2
Change-Id: I6cf19f3241a2e972ae711e0efa7b0205aae1a3f2
f325b2
(cherry picked from commit 0fd381b773cb7c15c4773affd4a3b298ad38fe92)
f325b2
---
f325b2
 sw/source/uibase/docvw/PostItMgr.cxx | 15 ++++++++++++---
f325b2
 1 file changed, 12 insertions(+), 3 deletions(-)
f325b2
f325b2
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
f325b2
index fa82556554d1..40e2bda8f6b7 100644
f325b2
--- a/sw/source/uibase/docvw/PostItMgr.cxx
f325b2
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
f325b2
@@ -1865,10 +1865,11 @@ bool SwPostItMgr::HasNotes() const
f325b2
 
f325b2
 unsigned long SwPostItMgr::GetSidebarWidth(bool bPx) const
f325b2
 {
f325b2
+    bool bEnableMapMode = !mpWrtShell->GetOut()->IsMapModeEnabled();
f325b2
     sal_uInt16 nZoom = mpWrtShell->GetViewOptions()->GetZoom();
f325b2
-    if (comphelper::LibreOfficeKit::isActive())
f325b2
+    if (comphelper::LibreOfficeKit::isActive() && !bEnableMapMode)
f325b2
     {
f325b2
-        // The output device contains the real wanted scale factor.
f325b2
+        // The output device is the tile and contains the real wanted scale factor.
f325b2
         double fScaleX = mpWrtShell->GetOut()->GetMapMode().GetScaleX();
f325b2
         nZoom = fScaleX * 100;
f325b2
     }
f325b2
@@ -1877,7 +1878,15 @@ unsigned long SwPostItMgr::GetSidebarWidth(bool bPx) const
f325b2
     if (bPx)
f325b2
         return aWidth;
f325b2
     else
f325b2
-        return mpWrtShell->GetOut()->PixelToLogic(Size(aWidth, 0)).Width();
f325b2
+    {
f325b2
+        if (bEnableMapMode)
f325b2
+            // The output device is the window.
f325b2
+            mpWrtShell->GetOut()->EnableMapMode();
f325b2
+        long nRet = mpWrtShell->GetOut()->PixelToLogic(Size(aWidth, 0)).Width();
f325b2
+        if (bEnableMapMode)
f325b2
+            mpWrtShell->GetOut()->EnableMapMode(false);
f325b2
+        return nRet;
f325b2
+    }
f325b2
 }
f325b2
 
f325b2
 unsigned long SwPostItMgr::GetSidebarBorderWidth(bool bPx) const
f325b2
-- 
f325b2
2.12.0
f325b2