summaryrefslogtreecommitdiff
path: root/vcl/source/window/floatwin.cxx
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2018-04-18 18:31:00 +0200
committerMarco Cecchetti <mrcekets@gmail.com>2018-05-22 12:49:19 +0200
commit1f2d389c3d3211e079806aba96b51a1348b47368 (patch)
tree85a77dec748423604cccd13dcb351488715f27ac /vcl/source/window/floatwin.cxx
parent494f1a98bf32bea014c277bd0bee81b9aab5c966 (diff)
lok: charts context menu was misplaced + wrong LogicToLogic conversion
Chart context menu was misplaced since the context menu expects a position related to the document window not to the chart window. Moreover map mode is not enabled for chart window, that leads to use the LogicToLogic routine which unfortunately provides a wrong pixel to twips conversion. In fact we gets a 20 twips per pixel conversion since LogicToLogic uses a fixed 72 dpi value, instead of a correctly computed output device real dpi or at least the most commonly used 96 dpi value. Change-Id: Idb4220d03fddd4b6d643c1c0fb52754bafed7e36 Reviewed-on: https://gerrit.libreoffice.org/53118 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/54649 Reviewed-on: https://gerrit.libreoffice.org/54655 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Diffstat (limited to 'vcl/source/window/floatwin.cxx')
-rw-r--r--vcl/source/window/floatwin.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 83966e42b0e5..0ba23a39d6d8 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -441,10 +441,22 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow,
if (bLOKActive && pLOKTwipsPos)
{
- if (pW->IsMapModeEnabled())
+ 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 = OutputDevice::LogicToLogic(aPos, pW->GetMapMode(), MapMode(MapUnit::MapTwip));
+ }
}
// caller expects coordinates relative to top-level win