summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-12-14 11:27:57 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-12-14 16:22:45 +0100
commite9e9d7d1f8f16c4e97b387bf7c2edd42d8219159 (patch)
tree92020bdf8cc5eb0db42d83a6c2b0116692526b70
parentc1625e807ff7d94d0598b2aa86735fb94b829288 (diff)
add a way to undo ImplConvertToAbsPos
Change-Id: Ia739c93c91f512c570d38a385d36bcce76e6fdcd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107684 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/vcl/floatwin.hxx1
-rw-r--r--include/vcl/window.hxx1
-rw-r--r--vcl/source/window/floatwin.cxx23
-rw-r--r--vcl/source/window/window.cxx25
4 files changed, 48 insertions, 2 deletions
diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx
index 91a6ae3c8c0e..ef3c38c6bd72 100644
--- a/include/vcl/floatwin.hxx
+++ b/include/vcl/floatwin.hxx
@@ -117,6 +117,7 @@ public:
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);
+ static tools::Rectangle ImplConvertToRelPos(vcl::Window* pReference, const tools::Rectangle& rRect);
SAL_DLLPRIVATE void ImplEndPopupMode( FloatWinPopupEndFlags nFlags, const VclPtr<vcl::Window>& xFocusId );
SAL_DLLPRIVATE tools::Rectangle& ImplGetItemEdgeClipRect();
SAL_DLLPRIVATE bool ImplIsInPrivatePopupMode() const { return mbInPopupMode; }
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index b88f565fcc88..43db85d77e5f 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -718,6 +718,7 @@ private:
SAL_DLLPRIVATE static void ImplHandleScroll(ScrollBar* pHScrl, double nX, ScrollBar* pVScrl, double nY);
SAL_DLLPRIVATE tools::Rectangle ImplOutputToUnmirroredAbsoluteScreenPixel( const tools::Rectangle& rRect ) const;
+ SAL_DLLPRIVATE tools::Rectangle ImplUnmirroredAbsoluteScreenToOutputPixel( const tools::Rectangle& rRect ) const;
SAL_DLLPRIVATE tools::Long ImplGetUnmirroredOutOffX();
// retrieves the list of owner draw decorated windows for this window hierarchy
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 53f9349e565f..1d9bac8c427c 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -524,6 +524,29 @@ tools::Rectangle FloatingWindow::ImplConvertToAbsPos(vcl::Window* pReference, co
}
else
aFloatRect.SetPos(pReference->OutputToAbsoluteScreenPixel(pReference->ScreenToOutputPixel(rRect.TopLeft())));
+
+ return aFloatRect;
+}
+
+tools::Rectangle FloatingWindow::ImplConvertToRelPos(vcl::Window* pReference, const tools::Rectangle& rRect)
+{
+ tools::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() )
+ {
+ aFloatRect = pReference->ImplUnmirroredAbsoluteScreenToOutputPixel(aFloatRect);
+ aFloatRect.SetPos(pReference->OutputToScreenPixel(aFloatRect.TopLeft()));
+
+ if(!pReference->IsRTLEnabled() )
+ pParentWinOutDev->ReMirror(aFloatRect);
+ }
+ else
+ aFloatRect.SetPos(pReference->OutputToScreenPixel(pReference->AbsoluteScreenToOutputPixel(rRect.TopLeft())));
+
return aFloatRect;
}
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 3ab8fad61652..7bbc9924709d 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2873,17 +2873,38 @@ tools::Rectangle Window::ImplOutputToUnmirroredAbsoluteScreenPixel( const tools:
// and is used for positioning of RTL popup windows correctly on the screen
SalFrameGeometry g = mpWindowImpl->mpFrame->GetUnmirroredGeometry();
- Point p1 = OutputToScreenPixel( rRect.TopRight() );
+ Point p1 = rRect.TopRight();
+ p1 = OutputToScreenPixel(p1);
p1.setX( g.nX+g.nWidth-p1.X() );
p1.AdjustY(g.nY );
- Point p2 = OutputToScreenPixel( rRect.BottomLeft() );
+ Point p2 = rRect.BottomLeft();
+ p2 = OutputToScreenPixel(p2);
p2.setX( g.nX+g.nWidth-p2.X() );
p2.AdjustY(g.nY );
return tools::Rectangle( p1, p2 );
}
+tools::Rectangle Window::ImplUnmirroredAbsoluteScreenToOutputPixel( const tools::Rectangle &rRect ) const
+{
+ // undo ImplOutputToUnmirroredAbsoluteScreenPixel
+ SalFrameGeometry g = mpWindowImpl->mpFrame->GetUnmirroredGeometry();
+
+ Point p1 = rRect.TopRight();
+ p1.AdjustY(-g.nY );
+ p1.setX( g.nX+g.nWidth-p1.X() );
+ p1 = ScreenToOutputPixel(p1);
+
+ Point p2 = rRect.BottomLeft();
+ p2.AdjustY(-g.nY);
+ p2.setX( g.nX+g.nWidth-p2.X() );
+ p2 = ScreenToOutputPixel(p2);
+
+ return tools::Rectangle( p1, p2 );
+}
+
+
tools::Rectangle Window::GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const
{
// with decoration