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

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