sc/source/ui/view/gridwin.cxx | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)
New commits: commit e4fea6e67a05256c3ce6336bf054004015936310 Author: Eike Rathke <er...@redhat.com> Date: Mon Jan 12 16:05:34 2015 +0100 make this work also for an overlapping merge range, fdo#87382 follow-up ... if the merged range ends behind the visble range. Change-Id: Ib5e9ae57299614f42c9200da5641922dfd90ab60 diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 785beee..436bc15 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 = static_cast<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(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits