diff options
author | Jan Holesovsky <kendy@collabora.com> | 2018-03-27 11:26:43 +0200 |
---|---|---|
committer | Marco Cecchetti <mrcekets@gmail.com> | 2018-05-21 15:08:12 +0200 |
commit | 6ede92ec3998c2d3122b32546137d1790fee70ad (patch) | |
tree | 2b3df6990706f70ab5e3e85d0b9338c660b88ca4 /vcl | |
parent | 423f4ac936e8a3991e9e3f16c6f3f7c3c5d44e71 (diff) |
lokdialog: For the tunneled top-level popups, provide the position in twips.
Change-Id: I7b1ca50b06c3bdf0958bb88946873c6ddf717b0e
Reviewed-on: https://gerrit.libreoffice.org/51952
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
Reviewed-on: https://gerrit.libreoffice.org/54628
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/floatwin.cxx | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 1a6166dd5b92..4bffbb52b8cf 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -40,6 +40,7 @@ public: VclPtr<ToolBox> mpBox; tools::Rectangle maItemEdgeClipRect; // used to clip the common edge between a toolbar item and the border of this window Point maPos; // position of the floating window wrt. parent + Point maLOKTwipsPos; ///< absolute position of the floating window in the document - in twips (for toplevel floating windows). }; FloatingWindow::ImplData::ImplData() @@ -229,9 +230,9 @@ Point FloatingWindow::CalcFloatingPosition( vcl::Window* pWindow, const tools::R return ImplCalcPos( pWindow, rRect, nFlags, rArrangeIndex ); } -Point FloatingWindow::ImplCalcPos( vcl::Window* pWindow, - const tools::Rectangle& rRect, FloatWinPopupFlags nFlags, - sal_uInt16& rArrangeIndex ) +Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow, + const tools::Rectangle& rRect, FloatWinPopupFlags nFlags, + sal_uInt16& rArrangeIndex, Point* pLOKTwipsPos) { // get window position Point aPos; @@ -438,6 +439,14 @@ Point FloatingWindow::ImplCalcPos( vcl::Window* pWindow, tools::Rectangle( e1, e2 ); } + if (bLOKActive && pLOKTwipsPos) + { + if (pW->IsMapModeEnabled()) + *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 return pW->OutputToScreenPixel( aPos ); } @@ -623,15 +632,16 @@ void FloatingWindow::StateChanged( StateChangedType nType ) // dialog - but maybe we'll need a separate type for this // later aItems.emplace_back("type", "dialog"); + aItems.emplace_back("position", mpImplData->maLOKTwipsPos.toString()); // twips } else { SetLOKNotifier(pParent->GetLOKNotifier()); aItems.emplace_back("type", "child"); aItems.emplace_back("parentId", OString::number(pParent->GetLOKWindowId())); + aItems.emplace_back("position", mpImplData->maPos.toString()); // pixels } aItems.emplace_back("size", GetSizePixel().toString()); - aItems.emplace_back("position", mpImplData->maPos.toString()); if (!GetText().isEmpty()) aItems.emplace_back("title", GetText().toUtf8()); GetLOKNotifier()->notifyWindow(GetLOKWindowId(), "created", aItems); @@ -719,7 +729,7 @@ void FloatingWindow::StartPopupMode( const tools::Rectangle& rRect, FloatWinPopu // compute window position according to flags and arrangement sal_uInt16 nArrangeIndex; DoInitialLayout(); - mpImplData->maPos = ImplCalcPos( this, rRect, nFlags, nArrangeIndex ); + mpImplData->maPos = ImplCalcPos(this, rRect, nFlags, nArrangeIndex, &mpImplData->maLOKTwipsPos); SetPosPixel( mpImplData->maPos ); // set data and display window |