[Libreoffice-commits] core.git: include/vcl vcl/source
Caolán McNamara
caolanm at redhat.com
Thu Mar 3 13:56:35 UTC 2016
include/vcl/floatwin.hxx | 2 +
vcl/source/window/floatwin.cxx | 54 +++++++++++++++++++++++++----------------
2 files changed, 35 insertions(+), 21 deletions(-)
New commits:
commit fbea89b6b2a4a91fecc4200d59bf03166c3f8908
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Mar 3 13:52:24 2016 +0000
refactor these two bizarro positioning things into reusable chunks
Change-Id: I3f89aca650d31658ce17b3b1496a7babba23bdc6
diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx
index 2e9aa42..e5bb9a5 100644
--- a/include/vcl/floatwin.hxx
+++ b/include/vcl/floatwin.hxx
@@ -129,6 +129,8 @@ public:
SAL_DLLPRIVATE static Point ImplCalcPos( vcl::Window* pWindow,
const Rectangle& rRect, FloatWinPopupFlags nFlags,
sal_uInt16& rArrangeIndex );
+ SAL_DLLPRIVATE static Point ImplConvertToAbsPos(vcl::Window* pReference, const Point& rPos);
+ SAL_DLLPRIVATE static Rectangle ImplConvertToAbsPos(vcl::Window* pReference, const Rectangle& rRect);
SAL_DLLPRIVATE void ImplEndPopupMode( FloatWinPopupEndFlags nFlags = FloatWinPopupEndFlags::NONE, VclPtr<vcl::Window> xFocusId = nullptr );
SAL_DLLPRIVATE Rectangle& ImplGetItemEdgeClipRect();
SAL_DLLPRIVATE bool ImplIsInPrivatePopupMode() const { return mbInPopupMode; }
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index ed997c8..00c3b34 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -449,10 +449,8 @@ Point FloatingWindow::ImplCalcPos( vcl::Window* pWindow,
return pW->OutputToScreenPixel( aPos );
}
-FloatingWindow* FloatingWindow::ImplFloatHitTest( vcl::Window* pReference, const Point& rPos, HitTest& rHitTest )
+Point FloatingWindow::ImplConvertToAbsPos(vcl::Window* pReference, const Point& rPos)
{
- FloatingWindow* pWin = this;
-
Point aAbsolute( rPos );
const OutputDevice *pWindowOutDev = pReference->GetOutDev();
@@ -472,6 +470,37 @@ FloatingWindow* FloatingWindow::ImplFloatHitTest( vcl::Window* pReference, const
aAbsolute = Point( pReference->OutputToAbsoluteScreenPixel(
pReference->ScreenToOutputPixel(rPos) ) );
+ return aAbsolute;
+}
+
+Rectangle FloatingWindow::ImplConvertToAbsPos(vcl::Window* pReference, const Rectangle& rRect)
+{
+ Rectangle aFloatRect = rRect;
+
+ const OutputDevice *pParentWinOutDev = pReference->GetOutDev();
+
+ // compare coordinates in absolute screen coordinates
+ // Keep in sync with FloatingWindow::ImplFloatHitTest, e.g. fdo#33509
+ if( pReference->HasMirroredGraphics() )
+ {
+ if(!pReference->IsRTLEnabled() )
+ // --- RTL --- re-mirror back to get device coordinates
+ pParentWinOutDev->ReMirror(aFloatRect);
+
+ aFloatRect.SetPos(pReference->ScreenToOutputPixel(aFloatRect.TopLeft()));
+ aFloatRect = pReference->ImplOutputToUnmirroredAbsoluteScreenPixel(aFloatRect);
+ }
+ else
+ aFloatRect.SetPos(pReference->OutputToAbsoluteScreenPixel(pReference->ScreenToOutputPixel(rRect.TopLeft())));
+ return aFloatRect;
+}
+
+FloatingWindow* FloatingWindow::ImplFloatHitTest( vcl::Window* pReference, const Point& rPos, HitTest& rHitTest )
+{
+ FloatingWindow* pWin = this;
+
+ Point aAbsolute(FloatingWindow::ImplConvertToAbsPos(pReference, rPos));
+
do
{
// compute the floating window's size in absolute screen coordinates
@@ -665,24 +694,7 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, FloatWinPopupFlags
// convert maFloatRect to absolute device coordinates
// so they can be compared across different frames
// !!! rRect is expected to be in screen coordinates of the parent frame window !!!
- maFloatRect = rRect;
-
- vcl::Window *pReference = GetParent();
- const OutputDevice *pParentWinOutDev = pReference->GetOutDev();
-
- // compare coordinates in absolute screen coordinates
- // Keep in sync with FloatingWindow::ImplFloatHitTest, e.g. fdo#33509
- if( pReference->HasMirroredGraphics() )
- {
- if(!pReference->IsRTLEnabled() )
- // --- RTL --- re-mirror back to get device coordinates
- pParentWinOutDev->ReMirror(maFloatRect);
-
- maFloatRect.SetPos(pReference->ScreenToOutputPixel(maFloatRect.TopLeft()));
- maFloatRect = pReference->ImplOutputToUnmirroredAbsoluteScreenPixel(maFloatRect);
- }
- else
- maFloatRect.SetPos(pReference->OutputToAbsoluteScreenPixel(pReference->ScreenToOutputPixel(rRect.TopLeft())));
+ maFloatRect = FloatingWindow::ImplConvertToAbsPos(GetParent(), rRect);
maFloatRect.Left() -= 2;
maFloatRect.Top() -= 2;
More information about the Libreoffice-commits
mailing list