Blob Blame History Raw
From b2abef914624cfb7d0fd5f75d098fe37cabaf3d6 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Tue, 10 Nov 2015 14:08:26 +0100
Subject: [PATCH 297/398] sw lok: fix width of the notes sidebar

The map mode is in general disabled during tiled rendering, so mouse
positions can be sent in using twips, but here we have to temporarily
enable it, otherwise the width will be returned always in pixels.

With this, the gray background of the sidebar has the proper width, not
e.g. fifteenth of the expected value (using default zoom).

Change-Id: I4380ee0ba6bcda97cf71735161dbdc826e7a2532
(cherry picked from commit 6c3dbdbccbcccf914360dac1167599c5b89446a8)
---
 sw/source/uibase/docvw/PostItMgr.cxx | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 35152d05d242..2310dd64f4de 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -74,6 +74,7 @@
 
 #include <i18nlangtag/mslangid.hxx>
 #include <i18nlangtag/lang.h>
+#include <comphelper/lok.hxx>
 
 #include "annotsh.hxx"
 #include "swabstdlg.hxx"
@@ -1813,7 +1814,15 @@ unsigned long SwPostItMgr::GetSidebarWidth(bool bPx) const
     if (bPx)
         return aWidth;
     else
-        return mpEditWin->PixelToLogic(Size( aWidth ,0)).Width();
+    {
+        bool bEnableMapMode = comphelper::LibreOfficeKit::isActive() && !mpEditWin->IsMapModeEnabled();
+        if (bEnableMapMode)
+            mpEditWin->EnableMapMode();
+        long nRet = mpEditWin->PixelToLogic(Size(aWidth, 0)).Width();
+        if (bEnableMapMode)
+            mpEditWin->EnableMapMode(false);
+        return nRet;
+    }
 }
 
 unsigned long SwPostItMgr::GetSidebarBorderWidth(bool bPx) const
-- 
2.12.0