diff options
author | Tobias Lippert <drtl@fastmail.fm> | 2014-07-15 21:05:20 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-07-23 11:33:14 +0000 |
commit | 9782ba7f1b7f4d6cc11045b6c953deb6f17f321d (patch) | |
tree | 169715724ebc5153d00f65ca825b60ecfe214cf2 /svl/source | |
parent | 8c6e900e4724dc7c800047099139c080f5f5d564 (diff) |
fdo#76754 Add return first to IndexedStyleSheets to speed up ods writing
Change-Id: I6fc9fe8ce78ad9cc1a7c2fe3e13ed38ce468ce6c
Reviewed-on: https://gerrit.libreoffice.org/10347
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svl/source')
-rw-r--r-- | svl/source/items/IndexedStyleSheets.cxx | 5 | ||||
-rw-r--r-- | svl/source/items/style.cxx | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/svl/source/items/IndexedStyleSheets.cxx b/svl/source/items/IndexedStyleSheets.cxx index 7b9f7b632e75..bc5b1cd7a1b8 100644 --- a/svl/source/items/IndexedStyleSheets.cxx +++ b/svl/source/items/IndexedStyleSheets.cxx @@ -130,7 +130,7 @@ IndexedStyleSheets::FindPositionsByName(const rtl::OUString& name) const std::vector<unsigned> IndexedStyleSheets::FindPositionsByNameAndPredicate(const rtl::OUString& name, - StyleSheetPredicate& predicate) const + StyleSheetPredicate& predicate, SearchBehavior behavior) const { std::vector<unsigned> r; MapType::const_iterator it = mPositionsByName.find(name); @@ -139,6 +139,9 @@ IndexedStyleSheets::FindPositionsByNameAndPredicate(const rtl::OUString& name, SfxStyleSheetBase *ssheet = mStyleSheets.at(pos).get(); if (predicate.Check(*ssheet)) { r.push_back(pos); + if (behavior == RETURN_FIRST) { + break; + } } } return r; diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 9d212345711e..e61f3eb8b50b 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -530,7 +530,8 @@ SfxStyleSheetBase* SfxStyleSheetIterator::Find(const OUString& rStr) DoesStyleMatchStyleSheetPredicate predicate(this); std::vector<unsigned> positions = - pBasePool->mIndexedStyleSheets->FindPositionsByNameAndPredicate(rStr, predicate); + pBasePool->mIndexedStyleSheets->FindPositionsByNameAndPredicate(rStr, predicate, + svl::IndexedStyleSheets::RETURN_FIRST); if (positions.empty()) { return NULL; } |