[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sc/source

Eike Rathke erack at redhat.com
Fri Jan 23 12:28:22 PST 2015


 sc/source/ui/view/gridwin.cxx |   25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

New commits:
commit a93e7bcfa6498dc8aa6c2cc69148664cd210554a
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Jan 12 14:52:47 2015 +0100

    make this work also for an overlapping merge range, fdo#87382 follow-up
    
    ... if the merged range ends behind the visble range.
    
    (cherry picked from commit e4fea6e67a05256c3ce6336bf054004015936310)
    
    get rid of C-style cast, fdo#87382 follow-up
    
    (cherry picked from commit 5865ab6bd27425912e2752020a966e2aac3279e5)
    
    86dd6a96f69d9bedeabeebc04f953b9f22476543
    
    Change-Id: Ib5e9ae57299614f42c9200da5641922dfd90ab60
    Reviewed-on: https://gerrit.libreoffice.org/13877
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 9ea1d21..031cd0e 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5741,17 +5741,28 @@ void ScGridWindow::UpdateCursorOverlay()
     SCROW nY = pViewData->GetCurY();
 
     ScDocument* pDoc = pViewData->GetDocument();
-    const ScMergeAttr* pMerge = (const ScMergeAttr*) pDoc->GetAttr(nX, nY, nTab, ATTR_MERGE);
+    const ScPatternAttr* pPattern = pDoc->GetPattern(nX,nY,nTab);
 
-    // fdo#87382 Also display the cell cursor for the visible part of merged
-    // cells if the cell position is part of merged cells.
-    if (!(maVisibleRange.isInside(nX, nY) ||
-                maVisibleRange.isInside(nX + pMerge->GetColMerge(), nY + pMerge->GetRowMerge())))
-        return;
+    if (!maVisibleRange.isInside(nX, nY))
+    {
+        if (maVisibleRange.mnCol2 < nX || maVisibleRange.mnRow2 < nY)
+            return;     // no further check needed, nothing visible
+
+        // fdo#87382 Also display the cell cursor for the visible part of
+        // merged cells if the view position is part of merged cells.
+        const ScMergeAttr& rMerge = static_cast<const ScMergeAttr&>(pPattern->GetItem(ATTR_MERGE));
+        if (rMerge.GetColMerge() <= 1 && rMerge.GetRowMerge() <= 1)
+            return;     // not merged and invisible
+
+        SCCOL nX2 = nX + rMerge.GetColMerge() - 1;
+        SCROW nY2 = nY + rMerge.GetRowMerge() - 1;
+        // Check if the middle or tail of the merged range is visible.
+        if (!(maVisibleRange.mnCol1 <= nX2 && maVisibleRange.mnRow1 <= nY2))
+            return;     // no visible part
+    }
 
     //  don't show the cursor in overlapped cells
 
-    const ScPatternAttr* pPattern = pDoc->GetPattern(nX,nY,nTab);
     const ScMergeFlagAttr& rMergeFlag = static_cast<const ScMergeFlagAttr&>( pPattern->GetItem(ATTR_MERGE_FLAG) );
     bool bOverlapped = rMergeFlag.IsOverlapped();
 


More information about the Libreoffice-commits mailing list