Blame 0001-tdf-128399-sw-btlr-fix-clicking-to-lower-rotated-cel.patch

0d9c470
From fe7deff845c39a351a92b8e01168a527fc237a9b Mon Sep 17 00:00:00 2001
0d9c470
From: Miklos Vajna <vmiklos@collabora.com>
0d9c470
Date: Tue, 29 Oct 2019 15:29:59 +0100
0d9c470
Subject: [PATCH] tdf#128399 sw btlr: fix clicking to lower rotated cell
0d9c470
MIME-Version: 1.0
0d9c470
Content-Type: text/plain; charset=UTF-8
0d9c470
Content-Transfer-Encoding: 8bit
0d9c470
0d9c470
In case a table has more than 1 btlr cells in multiple rows, the first
0d9c470
captured the mouse.
0d9c470
0d9c470
This was because SwFrame::GetPaintArea() assumed that left and right
0d9c470
edges can be compared directly, without going via the SwRectFnSet
0d9c470
abstraction. This works for hozizontal and plain vertical directions,
0d9c470
but not for btlr.
0d9c470
0d9c470
(cherry picked from commit 435ab51ec8920033b7865f27f4afee8a852a0b31)
0d9c470
0d9c470
Conflicts:
0d9c470
	sw/qa/extras/layout/layout.cxx
0d9c470
0d9c470
Change-Id: Ia3bd7623a5d8d9ad3bdfabceb10adc0dbf105059
0d9c470
Reviewed-on: https://gerrit.libreoffice.org/81733
0d9c470
Tested-by: Jenkins
0d9c470
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
0d9c470
Tested-by: Caolán McNamara <caolanm@redhat.com>
0d9c470
---
0d9c470
 sw/qa/extras/layout/data/tdf128399.docx | Bin 0 -> 13132 bytes
0d9c470
 sw/qa/extras/layout/layout.cxx          |  27 ++++++++++++++++++++++++
0d9c470
 sw/source/core/layout/ssfrm.cxx         |  13 ++++++------
0d9c470
 3 files changed, 34 insertions(+), 6 deletions(-)
0d9c470
 create mode 100644 sw/qa/extras/layout/data/tdf128399.docx
0d9c470
0d9c470
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
0d9c470
index 8ff47322e0c0..90b5e2958af2 100644
0d9c470
--- a/sw/source/core/layout/ssfrm.cxx
0d9c470
+++ b/sw/source/core/layout/ssfrm.cxx
0d9c470
@@ -623,6 +623,7 @@ const SwRect SwFrame::GetPaintArea() const
0d9c470
     SwRect aRect = IsRowFrame() ? GetUpper()->getFrameArea() : getFrameArea();
0d9c470
     const bool bVert = IsVertical();
0d9c470
     SwRectFn fnRect = bVert ? ( IsVertLR() ? (IsVertLRBT() ? fnRectVertL2RB2T : fnRectVertL2R) : fnRectVert ) : fnRectHori;
0d9c470
+    SwRectFnSet aRectFnSet(this);
0d9c470
     long nRight = (aRect.*fnRect->fnGetRight)();
0d9c470
     long nLeft  = (aRect.*fnRect->fnGetLeft)();
0d9c470
     const SwFrame* pTmp = this;
0d9c470
@@ -651,9 +652,9 @@ const SwRect SwFrame::GetPaintArea() const
0d9c470
             pTmp->IsCellFrame() || pTmp->IsRowFrame() || //nobody leaves a table!
0d9c470
             pTmp->IsRootFrame() )
0d9c470
         {
0d9c470
-            if( bLeft || nLeft < nTmpLeft )
0d9c470
+            if( bLeft || aRectFnSet.XDiff(nTmpLeft, nLeft) > 0 )
0d9c470
                 nLeft = nTmpLeft;
0d9c470
-            if( bRight || nTmpRight < nRight )
0d9c470
+            if( bRight || aRectFnSet.XDiff(nRight, nTmpRight) > 0 )
0d9c470
                 nRight = nTmpRight;
0d9c470
             if( pTmp->IsPageFrame() || pTmp->IsFlyFrame() || pTmp->IsRootFrame() )
0d9c470
                 break;
0d9c470
@@ -666,14 +667,14 @@ const SwRect SwFrame::GetPaintArea() const
0d9c470
             // the first column has _no_ influence to the left range
0d9c470
             if( bR2L ? pTmp->GetNext() : pTmp->GetPrev() )
0d9c470
             {
0d9c470
-                if( bLeft || nLeft < nTmpLeft )
0d9c470
+                if( bLeft || aRectFnSet.XDiff(nTmpLeft, nLeft) > 0 )
0d9c470
                     nLeft = nTmpLeft;
0d9c470
                 bLeft = false;
0d9c470
             }
0d9c470
              // the last column has _no_ influence to the right range
0d9c470
             if( bR2L ? pTmp->GetPrev() : pTmp->GetNext() )
0d9c470
             {
0d9c470
-                if( bRight || nTmpRight < nRight )
0d9c470
+                if( bRight || aRectFnSet.XDiff(nRight, nTmpRight) > 0 )
0d9c470
                     nRight = nTmpRight;
0d9c470
                 bRight = false;
0d9c470
             }
0d9c470
@@ -686,14 +687,14 @@ const SwRect SwFrame::GetPaintArea() const
0d9c470
             // the next frame of a body frame may be a footnotecontainer or
0d9c470
             // a footer. The footnotecontainer has the same direction like
0d9c470
             // the body frame.
0d9c470
-            if( pTmp->GetPrev() && ( bLeft || nLeft < nTmpLeft ) )
0d9c470
+            if( pTmp->GetPrev() && ( bLeft || aRectFnSet.XDiff(nTmpLeft, nLeft) > 0 ) )
0d9c470
             {
0d9c470
                 nLeft = nTmpLeft;
0d9c470
                 bLeft = false;
0d9c470
             }
0d9c470
             if( pTmp->GetNext() &&
0d9c470
                 ( pTmp->GetNext()->IsFooterFrame() || pTmp->GetNext()->GetNext() )
0d9c470
-                && ( bRight || nTmpRight < nRight ) )
0d9c470
+                && ( bRight || aRectFnSet.XDiff(nRight, nTmpRight) > 0 ) )
0d9c470
             {
0d9c470
                 nRight = nTmpRight;
0d9c470
                 bRight = false;
0d9c470
-- 
0d9c470
2.23.0
0d9c470