From 1f2d389c3d3211e079806aba96b51a1348b47368 Mon Sep 17 00:00:00 2001 From: Marco Cecchetti Date: Wed, 18 Apr 2018 18:31:00 +0200 Subject: 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 Tested-by: Jan Holesovsky Reviewed-on: https://gerrit.libreoffice.org/54649 Reviewed-on: https://gerrit.libreoffice.org/54655 Tested-by: Jenkins Reviewed-by: Marco Cecchetti --- chart2/source/controller/main/ChartController_Window.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'chart2') diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index f3cd46bb5ee1..9c3993095e47 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -66,6 +66,7 @@ #include #include +#include #include #include #include @@ -1259,6 +1260,19 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) { PopupMenu* pPopupMenu = static_cast(VCLXMenu::GetImplementation(xPopupMenu)->GetMenu()); pPopupMenu->SetLOKNotifier(SfxViewShell::Current()); + + // the context menu expects a position related to the document window, + // not to the chart window + SfxInPlaceClient* pIPClient = SfxViewShell::Current()->GetIPClient(); + if (pIPClient) + { + vcl::Window* pRootWin = pIPClient->GetEditWin(); + if (pRootWin) + { + Point aOffset = pChartWindow->GetOffsetPixelFrom(*pRootWin); + aPos += aOffset; + } + } } xPopupController->setPopupMenu( xPopupMenu ); -- cgit