sc/source/ui/view/output2.cxx |   28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

New commits:
commit d7e9a1a5f7062749633418ed4971cecbbd5c409e
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Mar 26 10:02:39 2020 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Mar 26 13:25:54 2020 +0100

    tdf#131593 ScOutputData::GetMergeOrigin: Handle cells outside own area
    
    Rendering the bugdoc had regressed at commit
    9113f17e65b1dafbc178fd269e2967c1e2632f0e
    ("LOK: fast tile rendering (text only)", 2016-06-04),
    which had changed the area covered by the ScTableInfo
    in use from the document's whole rendering area to that
    covered by the bounding rows and columns for the tile
    being rendered.
    
    For the bug doc, it was e.g. no longer detected that cell
    A10 (nX=0, nY=9) is merged to A1 when processing the
    "second tile in the second row of tiles" in
    ScOutputData::DrawEdit.
    
    Change-Id: I60c3ad43ad816d2186547486116f63e27ed3a166
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91094
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 141062fd19ca..aae2bc186617 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -917,19 +917,33 @@ bool ScOutputData::GetMergeOrigin( SCCOL nX, SCROW nY, 
SCSIZE nArrY,
     bool bIsLeft = ( nX == nVisX1 );
     bool bIsTop  = ( nY == nVisY1 ) || bVisRowChanged;
 
-    CellInfo* pInfo = &pRowInfo[nArrY].pCellInfo[nX+1];
-    if ( pInfo->bHOverlapped && pInfo->bVOverlapped )
+    bool bHOver;
+    bool bVOver;
+    bool bHidden;
+
+    if (!mpDoc->ColHidden(nX, nTab) && nX >= nX1 && nX <= nX2
+            && !mpDoc->RowHidden(nY, nTab) && nY >= nY1 && nY <= nY2)
+    {
+        CellInfo* pInfo = &pRowInfo[nArrY].pCellInfo[nX+1];
+        bHOver = pInfo->bHOverlapped;
+        bVOver = pInfo->bVOverlapped;
+    }
+    else
+    {
+        ScMF nOverlap2 = mpDoc->GetAttr(nX, nY, nTab, 
ATTR_MERGE_FLAG)->GetValue();
+        bHOver = bool(nOverlap2 & ScMF::Hor);
+        bVOver = bool(nOverlap2 & ScMF::Ver);
+    }
+
+    if ( bHOver && bVOver )
         bDoMerge = bIsLeft && bIsTop;
-    else if ( pInfo->bHOverlapped )
+    else if ( bHOver )
         bDoMerge = bIsLeft;
-    else if ( pInfo->bVOverlapped )
+    else if ( bVOver )
         bDoMerge = bIsTop;
 
     rOverX = nX;
     rOverY = nY;
-    bool bHOver = pInfo->bHOverlapped;
-    bool bVOver = pInfo->bVOverlapped;
-    bool bHidden;
 
     while (bHOver)              // nY constant
     {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to