diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-04-03 20:57:49 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-04-07 09:18:19 +0200 |
commit | ac662ccdeed798d3632bf0c444231f4c9c94c2cd (patch) | |
tree | aac4592db42b8168b4bc76d640774dcd3ba67a10 /sc | |
parent | ee1e0919c29bca99405c9c3b1f250b69ec069fd0 (diff) |
sc tiled editing: Correct position of the selection in far positions.
Before this commit, the selections outside of the aScrSize rectangle did not
work - they always degraded to a single cell selection.
Change-Id: Ie51da710424bff3691302f5923b141a2f2bea676
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 32 | ||||
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 15 |
2 files changed, 33 insertions, 14 deletions
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 7202f3d19d50..a9c013555ec0 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1554,23 +1554,35 @@ void ScGridWindow::GetSelectionRects( ::std::vector< Rectangle >& rPixelRects ) SCCOL nPosX = pViewData->GetPosX( eHWhich ); SCROW nPosY = pViewData->GetPosY( eVWhich ); + // is the selection visible at all? if (nTestX2 < nPosX || nTestY2 < nPosY) - return; // unsichtbar + return; SCCOL nRealX1 = nX1; if (nX1 < nPosX) nX1 = nPosX; if (nY1 < nPosY) nY1 = nPosY; - SCCOL nXRight = nPosX + pViewData->VisibleCellsX(eHWhich); - if (nXRight > MAXCOL) nXRight = MAXCOL; - SCROW nYBottom = nPosY + pViewData->VisibleCellsY(eVWhich); - if (nYBottom > MAXROW) nYBottom = MAXROW; - - if (nX1 > nXRight || nY1 > nYBottom) - return; // unsichtbar - if (nX2 > nXRight) nX2 = nXRight; - if (nY2 > nYBottom) nY2 = nYBottom; + if (!pDoc->GetDrawLayer()->isTiledRendering()) + { + // limit the selection to only what is visible on the screen + SCCOL nXRight = nPosX + pViewData->VisibleCellsX(eHWhich); + if (nXRight > MAXCOL) + nXRight = MAXCOL; + + SCROW nYBottom = nPosY + pViewData->VisibleCellsY(eVWhich); + if (nYBottom > MAXROW) + nYBottom = MAXROW; + + // is the selection visible at all? + if (nX1 > nXRight || nY1 > nYBottom) + return; + + if (nX2 > nXRight) + nX2 = nXRight; + if (nY2 > nYBottom) + nY2 = nYBottom; + } double nPPTX = pViewData->GetPPTX(); double nPPTY = pViewData->GetPPTY(); diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 32ed6426c132..fb375a53c698 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1513,13 +1513,14 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich, } sal_uInt16 nTSize; + bool bIsTiledRendering = GetDocument()->GetDrawLayer()->isTiledRendering(); SCCOL nPosX = GetPosX(eWhichX); SCCOL nX; long nScrPosX=0; if (nWhereX >= nPosX) - for (nX=nPosX; nX<nWhereX && (bAllowNeg || nScrPosX<=aScrSize.Width()); nX++) + for (nX = nPosX; nX < nWhereX && (bAllowNeg || bIsTiledRendering || nScrPosX <= aScrSize.Width()); nX++) { if ( nX > MAXCOL ) nScrPosX = 65535; @@ -1550,7 +1551,7 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich, long nScrPosY=0; if (nWhereY >= nPosY) - for (nY=nPosY; nY<nWhereY && (bAllowNeg || nScrPosY<=aScrSize.Height()); nY++) + for (nY = nPosY; nY < nWhereY && (bAllowNeg || bIsTiledRendering || nScrPosY <= aScrSize.Height()); nY++) { if ( nY > MAXROW ) nScrPosY = 65535; @@ -1591,8 +1592,14 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich, nScrPosX = aScrSize.Width() - 1 - nScrPosX; } - if (nScrPosX > 32767) nScrPosX=32767; - if (nScrPosY > 32767) nScrPosY=32767; + if (!bIsTiledRendering) + { + if (nScrPosX > 32767) + nScrPosX = 32767; + if (nScrPosY > 32767) + nScrPosY = 32767; + } + return Point( nScrPosX, nScrPosY ); } |