[Libreoffice-commits] core.git: sc/inc sc/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Sun Sep 18 16:51:20 UTC 2016
sc/inc/conditio.hxx | 2 ++
sc/source/core/data/conditio.cxx | 12 ++++++++++++
sc/source/core/data/table1.cxx | 9 +--------
3 files changed, 15 insertions(+), 8 deletions(-)
New commits:
commit 046f3aa2d9285da7661c4d9f59c0baf406227553
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sun Sep 18 16:07:22 2016 +0200
extract the code to get the max key id to own method
Change-Id: I56bd53e03a7ea97b15895528ec02a09a73d877b6
Reviewed-on: https://gerrit.libreoffice.org/28994
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index f569391..e3a19d0 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -523,6 +523,8 @@ public:
void startRendering();
void endRendering();
+
+ sal_uInt32 getMaxKey() const;
};
#endif
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index e9440a0..2a6b48a 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -2282,4 +2282,16 @@ void ScConditionalFormatList::clear()
m_ConditionalFormats.clear();
}
+sal_uInt32 ScConditionalFormatList::getMaxKey() const
+{
+ sal_uInt32 nMax = 0;
+ for (const auto& aEntry : m_ConditionalFormats)
+ {
+ if (aEntry->GetKey() > nMax)
+ nMax = aEntry->GetKey();
+ }
+
+ return nMax;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index f770c7e..2da7c76 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -2115,14 +2115,7 @@ sal_uLong ScTable::AddCondFormat( ScConditionalFormat* pNew )
if(!mpCondFormatList)
mpCondFormatList.reset(new ScConditionalFormatList());
- sal_uLong nMax = 0;
- for(ScConditionalFormatList::const_iterator itr = mpCondFormatList->begin();
- itr != mpCondFormatList->end(); ++itr)
- {
- sal_uLong nKey = (*itr)->GetKey();
- if(nKey > nMax)
- nMax = nKey;
- }
+ sal_uInt32 nMax = mpCondFormatList->getMaxKey();
pNew->SetKey(nMax+1);
mpCondFormatList->InsertNew(pNew);
More information about the Libreoffice-commits
mailing list