[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/inc sc/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Tue Oct 4 15:26:28 UTC 2016
sc/inc/rangelst.hxx | 2 +-
sc/source/core/tool/rangelst.cxx | 22 +++++++++++++++++++---
2 files changed, 20 insertions(+), 4 deletions(-)
New commits:
commit 685071d10a4cbe556b0c83342b18aeb97dc878fd
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat Oct 1 01:31:09 2016 +0200
tdf#101910, mark ScRangeList updated when DeleteArea was used
Change-Id: I98390b28c5a1bbbd391ff054b2f574951c7c00c4
Reviewed-on: https://gerrit.libreoffice.org/29422
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Jenkins <ci at libreoffice.org>
(cherry picked from commit 5f658dc87794036182aa1f8586d82c5ee997cd8b)
Reviewed-on: https://gerrit.libreoffice.org/29424
Reviewed-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx
index 2641483..996124f 100644
--- a/sc/inc/rangelst.hxx
+++ b/sc/inc/rangelst.hxx
@@ -62,7 +62,7 @@ public:
/** For now this method assumes that nTab1 == nTab2
* The algorithm will be much more complicated if nTab1 != nTab2
*/
- void DeleteArea( SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2,
+ bool DeleteArea( SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2,
SCROW nRow2, SCTAB nTab2 );
const ScRange* Find( const ScAddress& ) const;
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index daa2ffe..a59c483 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -398,11 +398,11 @@ bool ScRangeList::UpdateReference(
{
if(nDx < 0)
{
- DeleteArea(nCol1+nDx, nRow1, nTab1, nCol1-1, nRow2, nTab2);
+ bChanged = DeleteArea(nCol1+nDx, nRow1, nTab1, nCol1-1, nRow2, nTab2);
}
if(nDy < 0)
{
- DeleteArea(nCol1, nRow1+nDy, nTab1, nCol2, nRow1-1, nTab2);
+ bChanged = DeleteArea(nCol1, nRow1+nDy, nTab1, nCol2, nRow1-1, nTab2);
}
SAL_WARN_IF(nDx < 0 && nDy < 0, "sc", "nDx and nDy are negative, check why");
}
@@ -940,9 +940,10 @@ bool handleFourRanges( const ScRange& rDelRange, ScRange* p, std::vector<ScRange
}
-void ScRangeList::DeleteArea( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
+bool ScRangeList::DeleteArea( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2 )
{
+ bool bChanged = false;
ScRange aRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
for(size_t i = 0; i < maRanges.size();)
{
@@ -950,6 +951,7 @@ void ScRangeList::DeleteArea( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
{
ScRange* pRange = Remove(i);
delete pRange;
+ bChanged = true;
}
else
++i;
@@ -975,12 +977,18 @@ void ScRangeList::DeleteArea( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
// r.aStart.X() <= p.aStart.X() && r.aEnd.X() >= p.aEnd.X()
// && ( r.aStart.Y() <= p.aStart.Y() || r.aEnd.Y() >= r.aEnd.Y() )
if(handleOneRange( aRange, *itr ))
+ {
+ bChanged = true;
continue;
+ }
// getting two ranges
// r.aStart.X()
else if(handleTwoRanges( aRange, *itr, aNewRanges ))
+ {
+ bChanged = true;
continue;
+ }
// getting 3 ranges
// r.aStart.X() > p.aStart.X() && r.aEnd.X() >= p.aEnd.X()
@@ -989,16 +997,24 @@ void ScRangeList::DeleteArea( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
// r.aStart.X() <= p.aStart.X() && r.aEnd.X() < p.aEnd.X()
// && r.aStart.Y() > p.aStart.Y() && r.aEnd.Y() < p.aEnd.Y()
else if(handleThreeRanges( aRange, *itr, aNewRanges ))
+ {
+ bChanged = true;
continue;
+ }
// getting 4 ranges
// r.aStart.X() > p.aStart.X() && r.aEnd().X() < p.aEnd.X()
// && r.aStart.Y() > p.aStart.Y() && r.aEnd().Y() < p.aEnd.Y()
else if(handleFourRanges( aRange, *itr, aNewRanges ))
+ {
+ bChanged = true;
continue;
+ }
}
for(vector<ScRange>::iterator itr = aNewRanges.begin(); itr != aNewRanges.end(); ++itr)
Join( *itr);
+
+ return bChanged;
}
const ScRange* ScRangeList::Find( const ScAddress& rAdr ) const
More information about the Libreoffice-commits
mailing list