diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2018-04-18 18:31:00 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-04-20 18:55:50 +0200 |
commit | fc409bae21ff400736278294ab6a82a5f3cedfa7 (patch) | |
tree | 80b6c43d742cf1770ccde4e4d4819ad25ab0908a /chart2 | |
parent | e449872333d0c0664eeecb5bb15331d397c1f011 (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>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/controller/main/ChartController_Window.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 58f7206554ec..6bf0446cc24c 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -63,6 +63,7 @@ #include <toolkit/awt/vclxmenu.hxx> #include <sfx2/viewsh.hxx> +#include <sfx2/ipclient.hxx> #include <svx/svxids.hrc> #include <svx/ActionDescriptionProvider.hxx> #include <svx/obj3d.hxx> @@ -1238,6 +1239,19 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) { PopupMenu* pPopupMenu = static_cast<PopupMenu*>(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 = m_pChartWindow->GetOffsetPixelFrom(*pRootWin); + aPos += aOffset; + } + } } xPopupController->setPopupMenu( xPopupMenu ); |