diff options
author | Eike Rathke <erack@redhat.com> | 2015-01-12 14:52:47 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-01-23 20:27:42 +0000 |
commit | a93e7bcfa6498dc8aa6c2cc69148664cd210554a (patch) | |
tree | 7a2bbafd69019bdf0e2414d6492e9e5366587acd | |
parent | af30252902520375255ed01ba9d8fae3706fd691 (diff) |
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@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 9ea1d21bdbf3..031cd0ef3020 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(); |