summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2018-03-27 11:26:43 +0200
committerMarco Cecchetti <mrcekets@gmail.com>2018-05-21 15:07:45 +0200
commitc04ee32ea43c6ac2c2fa0375405431b7730d78c5 (patch)
treed8920896bf45570630d76b230c8437f3daee653a /vcl
parent13d5f89ac667efd7c843d26e4325c8d31c9413d4 (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/54630 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.cxx20
1 files changed, 15 insertions, 5 deletions
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