include/vcl/floatwin.hxx | 6 +++--- vcl/source/window/floatwin.cxx | 20 +++++++++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-)
New commits: commit 6ede92ec3998c2d3122b32546137d1790fee70ad Author: Jan Holesovsky <ke...@collabora.com> Date: Tue Mar 27 11:26:43 2018 +0200 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 <pran...@collabora.co.uk> Tested-by: pranavk <pran...@collabora.co.uk> Reviewed-on: https://gerrit.libreoffice.org/54628 Reviewed-by: Marco Cecchetti <mrcek...@gmail.com> Tested-by: Marco Cecchetti <mrcek...@gmail.com> diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx index 62739f95cb8d..7cb1e38b9914 100644 --- a/include/vcl/floatwin.hxx +++ b/include/vcl/floatwin.hxx @@ -121,9 +121,9 @@ public: SAL_DLLPRIVATE bool ImplIsFloatPopupModeWindow( const vcl::Window* pWindow ); SAL_DLLPRIVATE void ImplSetMouseDown() { mbMouseDown = true; } SAL_DLLPRIVATE bool ImplIsMouseDown() const { return mbMouseDown; } - static Point ImplCalcPos( vcl::Window* pWindow, - const tools::Rectangle& rRect, FloatWinPopupFlags nFlags, - sal_uInt16& rArrangeIndex ); + static Point ImplCalcPos(vcl::Window* pWindow, + const tools::Rectangle& rRect, FloatWinPopupFlags nFlags, + sal_uInt16& rArrangeIndex, Point* pLOKTwipsPos = nullptr); static Point ImplConvertToAbsPos(vcl::Window* pReference, const Point& rPos); static tools::Rectangle ImplConvertToAbsPos(vcl::Window* pReference, const tools::Rectangle& rRect); SAL_DLLPRIVATE void ImplEndPopupMode( FloatWinPopupEndFlags nFlags, const VclPtr<vcl::Window>& xFocusId ); 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 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits