tdf#117706 Multi-select copying rows between sheets broken
regression from
commit 6529cd54c2
don't use heap for elements in ScRangeList
where I converted some loop variables from pointers to refs, forgetting
to assigning to a ref is quite different from assigning to a pointer
Change-Id: I4a365006317d16a24cbb1b43994906a0d4b4d424
Reviewed-on: https://gerrit.libreoffice.org/54756
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -3126,22 +3126,22 @@ void ScDocument::GetClipArea(SCCOL& nClipX, SCROW& nClipY, bool bIncludeFiltered
|
||||
// No clip range. Bail out.
|
||||
return;
|
||||
|
||||
ScRange & rRange = rClipRanges.front();
|
||||
ScRange const & rRange = rClipRanges.front();
|
||||
SCCOL nStartCol = rRange.aStart.Col();
|
||||
SCCOL nEndCol = rRange.aEnd.Col();
|
||||
SCROW nStartRow = rRange.aStart.Row();
|
||||
SCROW nEndRow = rRange.aEnd.Row();
|
||||
for ( size_t i = 1, n = rClipRanges.size(); i < n; ++i )
|
||||
{
|
||||
rRange = rClipRanges[ i ];
|
||||
if (rRange.aStart.Col() < nStartCol)
|
||||
nStartCol = rRange.aStart.Col();
|
||||
if (rRange.aStart.Row() < nStartRow)
|
||||
nStartRow = rRange.aStart.Row();
|
||||
if (rRange.aEnd.Col() > nEndCol)
|
||||
nEndCol = rRange.aEnd.Col();
|
||||
if (rRange.aEnd.Row() < nEndRow)
|
||||
nEndRow = rRange.aEnd.Row();
|
||||
ScRange const rRange2 = rClipRanges[ i ];
|
||||
if (rRange2.aStart.Col() < nStartCol)
|
||||
nStartCol = rRange2.aStart.Col();
|
||||
if (rRange2.aStart.Row() < nStartRow)
|
||||
nStartRow = rRange2.aStart.Row();
|
||||
if (rRange2.aEnd.Col() > nEndCol)
|
||||
nEndCol = rRange2.aEnd.Col();
|
||||
if (rRange2.aEnd.Row() < nEndRow)
|
||||
nEndRow = rRange2.aEnd.Row();
|
||||
}
|
||||
|
||||
nClipX = nEndCol - nStartCol;
|
||||
|
@@ -306,26 +306,26 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b
|
||||
|
||||
// Check for geometrical feasibility of the ranges.
|
||||
bool bValidRanges = true;
|
||||
ScRange & r = aClipParam.maRanges.front();
|
||||
ScRange const * p = &aClipParam.maRanges.front();
|
||||
SCCOL nPrevColDelta = 0;
|
||||
SCROW nPrevRowDelta = 0;
|
||||
SCCOL nPrevCol = r.aStart.Col();
|
||||
SCROW nPrevRow = r.aStart.Row();
|
||||
SCCOL nPrevColSize = r.aEnd.Col() - r.aStart.Col() + 1;
|
||||
SCROW nPrevRowSize = r.aEnd.Row() - r.aStart.Row() + 1;
|
||||
SCCOL nPrevCol = p->aStart.Col();
|
||||
SCROW nPrevRow = p->aStart.Row();
|
||||
SCCOL nPrevColSize = p->aEnd.Col() - p->aStart.Col() + 1;
|
||||
SCROW nPrevRowSize = p->aEnd.Row() - p->aStart.Row() + 1;
|
||||
for ( size_t i = 1; i < aClipParam.maRanges.size(); ++i )
|
||||
{
|
||||
r = aClipParam.maRanges[i];
|
||||
p = &aClipParam.maRanges[i];
|
||||
if ( pDoc->HasSelectedBlockMatrixFragment(
|
||||
r.aStart.Col(), r.aStart.Row(), r.aEnd.Col(), r.aEnd.Row(), rMark) )
|
||||
p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(), rMark) )
|
||||
{
|
||||
if (!bApi)
|
||||
ErrorMessage(STR_MATRIXFRAGMENTERR);
|
||||
return false;
|
||||
}
|
||||
|
||||
SCCOL nColDelta = r.aStart.Col() - nPrevCol;
|
||||
SCROW nRowDelta = r.aStart.Row() - nPrevRow;
|
||||
SCCOL nColDelta = p->aStart.Col() - nPrevCol;
|
||||
SCROW nRowDelta = p->aStart.Row() - nPrevRow;
|
||||
|
||||
if ((nColDelta && nRowDelta) || (nPrevColDelta && nRowDelta) || (nPrevRowDelta && nColDelta))
|
||||
{
|
||||
@@ -341,8 +341,8 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b
|
||||
aClipParam.meDirection = ScClipParam::Row;
|
||||
}
|
||||
|
||||
SCCOL nColSize = r.aEnd.Col() - r.aStart.Col() + 1;
|
||||
SCROW nRowSize = r.aEnd.Row() - r.aStart.Row() + 1;
|
||||
SCCOL nColSize = p->aEnd.Col() - p->aStart.Col() + 1;
|
||||
SCROW nRowSize = p->aEnd.Row() - p->aStart.Row() + 1;
|
||||
|
||||
if (aClipParam.meDirection == ScClipParam::Column && nRowSize != nPrevRowSize)
|
||||
{
|
||||
@@ -358,8 +358,8 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b
|
||||
break;
|
||||
}
|
||||
|
||||
nPrevCol = r.aStart.Col();
|
||||
nPrevRow = r.aStart.Row();
|
||||
nPrevCol = p->aStart.Col();
|
||||
nPrevRow = p->aStart.Row();
|
||||
nPrevColDelta = nColDelta;
|
||||
nPrevRowDelta = nRowDelta;
|
||||
nPrevColSize = nColSize;
|
||||
|
Reference in New Issue
Block a user