[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - vcl/source

Marco Cecchetti marco.cecchetti at collabora.com
Wed May 23 14:26:19 UTC 2018


 vcl/source/window/floatwin.cxx |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

New commits:
commit 873f09df02a14c8e16ff13ce189c0af3317a754a
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Wed May 16 21:43:59 2018 +0200

    lok: sc: tunneled spell-check context menu appear in bottom right corner
    
    In the end it seems that in this context LogicToLogic is used for
    converting non-pixel units, too.
    
    Change-Id: I268e5522e929dd55af1284c38780064315d8cd41
    Reviewed-on: https://gerrit.libreoffice.org/54465
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 302703bf4e8a..8a5d5dcc62fd 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -445,13 +445,22 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow,
 
     if (bLOKActive && pLOKTwipsPos)
     {
-        // if we use pW->LogicToLogic(aPos, pW->GetMapMode(), MapMode(MapUnit::MapTwip)),
-        // when map mode is not enabled, we gets a 20 twips per pixel conversion
-        // since LogicToLogic uses a fixed 72 dpi value, instead of a correctly
-        // computed output device dpi or at least the most commonly used 96 dpi
-        // value; and anyway the following is what we already do in
-        // ScGridWindow::LogicInvalidate when map mode is not enabled.
-        *pLOKTwipsPos = pW->PixelToLogic(aPos, MapMode(MapUnit::MapTwip));
+        if (pW->IsMapModeEnabled() || pW->GetMapMode().GetMapUnit() == MapUnit::MapPixel)
+        {
+            // if we use pW->LogicToLogic(aPos, pW->GetMapMode(), MapMode(MapUnit::MapTwip)),
+            // for pixel conversions when map mode is not enabled, we gets
+            // a 20 twips per pixel conversion since LogicToLogic uses
+            // a fixed 72 dpi value, instead of a correctly computed output
+            // device dpi or at least the most commonly used 96 dpi value;
+            // and anyway the following is what we already do in
+            // ScGridWindow::LogicInvalidate when map mode is not enabled.
+
+            *pLOKTwipsPos = pW->PixelToLogic(aPos, MapMode(MapUnit::MapTwip));
+        }
+        else
+        {
+            *pLOKTwipsPos = pW->LogicToLogic(aPos, pW->GetMapMode(), MapMode(MapUnit::MapTwip));
+        }
     }
 
     // caller expects coordinates relative to top-level win


More information about the Libreoffice-commits mailing list