summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-07-09 21:05:20 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-07-09 20:16:38 +0000
commit25bc5473e15c85fefb22f52a878b0e04ca352af7 (patch)
tree02594539f390c97afdb46e9e0842a97cb5e2fc4e /sc
parent40775ba02d714f5abb0e8486d49c225b3199a222 (diff)
execute the terrible bottle neck loop only if there are conditional formats
(cherry picked from commit 2aefb89b299e7ebdca5bb35aa4e9059e59805715) Conflicts: sc/source/core/data/documen7.cxx Change-Id: Ic8bd65a728289c9fa1a0721b0ecbd9b4a48672ca Reviewed-on: https://gerrit.libreoffice.org/16903 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/conditio.hxx1
-rw-r--r--sc/source/core/data/conditio.cxx5
-rw-r--r--sc/source/core/data/documen7.cxx12
3 files changed, 16 insertions, 2 deletions
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 743c950070a6..48e50f2fd5b0 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -496,6 +496,7 @@ public:
const_iterator end() const;
size_t size() const;
+ bool empty() const;
void erase(sal_uLong nIndex);
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 35a827fb5134..cbc7fd87c477 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -2314,6 +2314,11 @@ size_t ScConditionalFormatList::size() const
return maConditionalFormats.size();
}
+bool ScConditionalFormatList::empty() const
+{
+ return maConditionalFormats.empty();
+}
+
void ScConditionalFormatList::erase( sal_uLong nIndex )
{
for( iterator itr = begin(); itr != end(); ++itr )
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index ea06c2a0faae..6d024b813bbc 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -149,12 +149,20 @@ void ScDocument::BroadcastCells( const ScRange& rRange, sal_uLong nHint )
continue;
ScConditionalFormatList* pCondFormList = GetCondFormList(nTab);
- if (pCondFormList)
+ if (pCondFormList && !pCondFormList->empty())
{
+ /* TODO: looping over all possible cells is a terrible bottle neck,
+ * for each cell looping over all conditional formats even worse,
+ * this certainly needs a better method. */
+ ScAddress aAddress( 0, 0, nTab);
for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
{
+ aAddress.SetRow(nRow);
for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
- pCondFormList->SourceChanged(ScAddress(nCol,nRow,nTab));
+ {
+ aAddress.SetCol(nCol);
+ pCondFormList->SourceChanged(aAddress);
+ }
}
}
}