Blob Blame History Raw
From a1641176c666645a2c61b3b9ebcba05f01350c12 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Mon, 16 Nov 2015 16:30:21 +0100
Subject: [PATCH 337/398] sw lok comments: fix sidebar width with custom zoom

Change-Id: I6772cce10d157421d983d6b93efb52bf8b95f5b8
(cherry picked from commit dc65f048fd1b08d17e71e4d3a3a3c114aae871e6)
---
 sw/source/uibase/docvw/PostItMgr.cxx | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 871a642d24da..fa82556554d1 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -1865,19 +1865,19 @@ bool SwPostItMgr::HasNotes() const
 
 unsigned long SwPostItMgr::GetSidebarWidth(bool bPx) const
 {
-    unsigned long aWidth = (unsigned long)(mpWrtShell->GetViewOptions()->GetZoom() * 1.8);
+    sal_uInt16 nZoom = mpWrtShell->GetViewOptions()->GetZoom();
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        // The output device contains the real wanted scale factor.
+        double fScaleX = mpWrtShell->GetOut()->GetMapMode().GetScaleX();
+        nZoom = fScaleX * 100;
+    }
+    unsigned long aWidth = (unsigned long)(nZoom * 1.8);
+
     if (bPx)
         return aWidth;
     else
-    {
-        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;
-    }
+        return mpWrtShell->GetOut()->PixelToLogic(Size(aWidth, 0)).Width();
 }
 
 unsigned long SwPostItMgr::GetSidebarBorderWidth(bool bPx) const
@@ -1885,7 +1885,7 @@ unsigned long SwPostItMgr::GetSidebarBorderWidth(bool bPx) const
     if (bPx)
         return 2;
     else
-        return mpEditWin->PixelToLogic(Size(2,0)).Width();
+        return mpWrtShell->GetOut()->PixelToLogic(Size(2,0)).Width();
 }
 
 unsigned long SwPostItMgr::GetNoteWidth()
-- 
2.12.0