Kaydet (Commit) fbea89b6 authored tarafından Caolán McNamara's avatar Caolán McNamara

refactor these two bizarro positioning things into reusable chunks

Change-Id: I3f89aca650d31658ce17b3b1496a7babba23bdc6
üst 509bc5e5
......@@ -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; }
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment