diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-11-14 09:48:36 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-11-14 09:49:27 +0000 |
commit | 40f8c14be28aeb78fe758264b43a255d2bfd4938 (patch) | |
tree | cbc164a6fdc2e38b9a2910a889f327b2609fd018 /sfx2 | |
parent | fdf56e4b50b396884f67b841b82bca2ae8def848 (diff) |
minor opt tweaks
Change-Id: I418d0e04f8d4373c0d9f1f106ac0cc7779029802
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/templdlg.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 3bd42b263066..bb25c2b602dd 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -543,17 +543,20 @@ StyleTreeArr_Impl& MakeTree_Impl(StyleTreeArr_Impl& rArr) std::unordered_map<OUString, StyleTree_Impl*, OUStringHash> styleFinder; styleFinder.reserve(rArr.size()); - for(auto pEntry : rArr) + for (const auto& pEntry : rArr) { styleFinder.emplace(pEntry->getName(), pEntry); } // Arrange all under their Parents - for(auto pEntry : rArr) + for (const auto& pEntry : rArr) { - if(pEntry->HasParent() && styleFinder.find(pEntry->getParent()) != styleFinder.end()) + if (!pEntry->HasParent()) + continue; + auto it = styleFinder.find(pEntry->getParent()); + if (it != styleFinder.end()) { - StyleTree_Impl* pCmp = styleFinder[pEntry->getParent()]; + StyleTree_Impl* pCmp = it->second; // Insert child entries sorted auto iPos = std::lower_bound(pCmp->getChildren().begin(), pCmp->getChildren().end(), pEntry, [&aSorter](StyleTree_Impl* pEntry1, StyleTree_Impl* pEntry2) { return aSorter.compare(pEntry1->getName(), pEntry2->getName()) < 0; }); |