[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - include/vcl vcl/source
Jan Holesovsky
kendy at collabora.com
Mon May 21 13:08:08 UTC 2018
include/vcl/floatwin.hxx | 6 +++---
vcl/source/window/floatwin.cxx | 20 +++++++++++++++-----
2 files changed, 18 insertions(+), 8 deletions(-)
New commits:
commit c04ee32ea43c6ac2c2fa0375405431b7730d78c5
Author: Jan Holesovsky <kendy at 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 <pranavk at collabora.co.uk>
Tested-by: pranavk <pranavk at collabora.co.uk>
Reviewed-on: https://gerrit.libreoffice.org/54630
Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
Tested-by: Marco Cecchetti <mrcekets at gmail.com>
diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx
index 6ebb5c84cf37..cba8d79c94cb 100644
--- a/include/vcl/floatwin.hxx
+++ b/include/vcl/floatwin.hxx
@@ -120,9 +120,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 a4482a29eb00..e39f1dc1f121 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()
@@ -230,9 +231,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;
@@ -439,6 +440,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 );
}
@@ -621,15 +630,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);
@@ -717,7 +727,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
More information about the Libreoffice-commits
mailing list