diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-08-31 04:02:10 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-08-31 15:50:14 +0200 |
commit | a3c4ee1653166ee2ac1f1b9d65ff1065b6288ebc (patch) | |
tree | 994b4237b292dd9dcf222012142332b8f01a56c4 /sc | |
parent | 7222a571d0d458810c1b23871f8b91491db4462d (diff) |
update cond formats for deleting, moving and cut&paste
Change-Id: I52987e957918853bcd1abd1460c6166b52454d62
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/conditio.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/conditio.cxx | 22 | ||||
-rw-r--r-- | sc/source/core/data/table2.cxx | 5 |
3 files changed, 29 insertions, 0 deletions
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index 4967e826242b..9890758871af 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -290,6 +290,7 @@ public: void CompileXML(); void UpdateReference( UpdateRefMode eUpdateRefMode, const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + void DeleteArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); void UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos ); void RenameCellStyle( const String& rOld, const String& rNew ); @@ -349,6 +350,7 @@ public: const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); void RenameCellStyle( const String& rOld, const String& rNew ); void UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos ); + void DeleteArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); void SourceChanged( const ScAddress& rAddr ); diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 4a842fb1ca2b..17483c3b44d8 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1471,6 +1471,12 @@ void ScConditionalFormat::UpdateReference( UpdateRefMode eUpdateRefMode, itr->UpdateReference(eUpdateRefMode, rRange, nDx, nDy, nDz); } +void ScConditionalFormat::DeleteArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) +{ + SCTAB nTab = maRanges[0]->aStart.Tab(); + maRanges.DeleteArea( nCol1, nRow1, nTab, nCol2, nRow2, nTab ); +} + void ScConditionalFormat::RenameCellStyle(const String& rOld, const String& rNew) { for(CondFormatContainer::iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr) @@ -1626,6 +1632,22 @@ void ScConditionalFormatList::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos ) itr->UpdateMoveTab( nOldPos, nNewPos ); } +void ScConditionalFormatList::DeleteArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) +{ + for( iterator itr = begin(); itr != end(); ++itr) + itr->DeleteArea( nCol1, nRow1, nCol2, nRow2 ); + + // need to check which must be deleted + iterator itr = begin(); + while(itr != end()) + { + if(itr->GetRange().empty()) + maConditionalFormats.erase(itr++); + else + ++itr; + } +} + void ScConditionalFormatList::SourceChanged( const ScAddress& rAddr ) { for( iterator itr = begin(); itr != end(); ++itr) diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index a2be5f538f58..12c9212bbb8e 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -533,6 +533,8 @@ void ScTable::DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal aPattern.GetItemSet().Put( ScProtectionAttr( false ) ); ApplyPatternArea( nCol1, nRow1, nCol2, nRow2, aPattern ); } + + mpCondFormatList->DeleteArea( nCol1, nRow1, nCol2, nRow2 ); } if (nDelFlag & IDF_NOTE) @@ -561,6 +563,9 @@ void ScTable::DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark ) ScRange* pRange = aRangeList[i]; if (nDelFlag & IDF_NOTE && pRange) maNotes.erase(pRange->aStart.Col(), pRange->aStart.Row(), pRange->aEnd.Col(), pRange->aEnd.Row(), true); + + if(pRange && pRange->aStart.Tab() == nTab) + mpCondFormatList->DeleteArea( pRange->aStart.Col(), pRange->aStart.Row(), pRange->aEnd.Col(), pRange->aEnd.Row() ); } // |