[Libreoffice-commits] .: Branch 'libreoffice-3-6' - sc/inc sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Nov 13 01:04:24 PST 2012
sc/inc/conditio.hxx | 6 ++++++
sc/source/core/data/conditio.cxx | 20 ++++++++++++++++----
sc/source/filter/xml/xmlcondformat.cxx | 7 +++++++
3 files changed, 29 insertions(+), 4 deletions(-)
New commits:
commit d5581278e8e2c68cfcef8d0e610efdbb1f793b34
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Nov 12 07:16:05 2012 +0100
remove conditional formats withiout range after import, related fdo#56983
(cherry picked from commit eb240530443b964ea45bf80a5e3711e11a3f09c5)
Change-Id: I9a8c02369c3e5a12310a46229bdc1671f75593ad
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 80a8e62..c94f145 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -336,6 +336,12 @@ public:
void InsertNew( ScConditionalFormat* pNew )
{ maConditionalFormats.insert(pNew); }
+ /**
+ * Checks that all cond formats have a non empty range.
+ * Deletes empty cond formats.
+ * @return true if all cond formats were valid
+ */
+ bool CheckAllEntries();
ScConditionalFormat* GetFormat( sal_uInt32 nKey );
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 994a199..d0c40e9 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1713,20 +1713,32 @@ void ScConditionalFormatList::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos )
itr->UpdateMoveTab( nOldPos, nNewPos );
}
-void ScConditionalFormatList::DeleteArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
+bool ScConditionalFormatList::CheckAllEntries()
{
- for( iterator itr = begin(); itr != end(); ++itr)
- itr->DeleteArea( nCol1, nRow1, nCol2, nRow2 );
-
+ bool bValid = true;
+ //
// need to check which must be deleted
iterator itr = begin();
while(itr != end())
{
if(itr->GetRange().empty())
+ {
+ bValid = false;
maConditionalFormats.erase(itr++);
+ }
else
++itr;
}
+
+ return bValid;
+}
+
+void ScConditionalFormatList::DeleteArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
+{
+ for( iterator itr = begin(); itr != end(); ++itr)
+ itr->DeleteArea( nCol1, nRow1, nCol2, nRow2 );
+
+ CheckAllEntries();
}
void ScConditionalFormatList::SourceChanged( const ScAddress& rAddr )
diff --git a/sc/source/filter/xml/xmlcondformat.cxx b/sc/source/filter/xml/xmlcondformat.cxx
index a8a47f1..dbb5028 100644
--- a/sc/source/filter/xml/xmlcondformat.cxx
+++ b/sc/source/filter/xml/xmlcondformat.cxx
@@ -72,6 +72,13 @@ SvXMLImportContext* ScXMLConditionalFormatsContext::CreateChildContext( sal_uInt
void ScXMLConditionalFormatsContext::EndElement()
{
+ ScDocument* pDoc = GetScImport().GetDocument();
+
+ SCTAB nTab = GetScImport().GetTables().GetCurrentSheet();
+ ScConditionalFormatList* pCondFormatList = pDoc->GetCondFormList(nTab);
+ bool bDeleted = !pCondFormatList->CheckAllEntries();
+
+ SAL_WARN_IF(bDeleted, "sc", "conditional formats have been deleted because they contained empty range info");
}
ScXMLConditionalFormatContext::ScXMLConditionalFormatContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
More information about the Libreoffice-commits
mailing list