diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-08 08:50:52 +0200 |
---|---|---|
committer | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2016-07-12 22:06:16 -0400 |
commit | 776b74a545216ac71e15c8d5299cb66398a6e7c2 (patch) | |
tree | 5f03db426632ed644168c28c6f8cb939a0b888ee /sw | |
parent | 896e5925c4f967bd48c7eca46d10698fc596a4a7 (diff) |
sfx2 classification: use auto where it improves code readability
std::map<OUString, basegfx::BColor>::iterator itColor = aColors.find(aLevel);
vs
auto itColor = aColors.find(aLevel);
and so on.
(And do the same at two other places as well.)
Reviewed-on: https://gerrit.libreoffice.org/26046
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
(cherry picked from commit 42dae96f97bfcc44d5e6ccf727e1cdb178123d56)
Change-Id: I538998c8b8afdf18a7eb139fa4d469205c561370
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/textboxhelper.cxx | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index 576bf98d3269..f1d23faa553d 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -119,10 +119,8 @@ std::set<const SwFrameFormat*> SwTextBoxHelper::findTextBoxes(const SwDoc* pDoc) std::map<SwNodeIndex, const SwFrameFormat*> aFlyFormats, aDrawFormats; const SwFrameFormats& rSpzFrameFormats = *pDoc->GetSpzFrameFormats(); - for (SwFrameFormats::const_iterator it = rSpzFrameFormats.begin(); it != rSpzFrameFormats.end(); ++it) + for (const SwFrameFormat* pFormat : rSpzFrameFormats) { - const SwFrameFormat* pFormat = *it; - // A TextBox in the context of this class is a fly frame that has a // matching (same RES_CNTNT) draw frame. if (!pFormat->GetAttrSet().HasItem(RES_CNTNT) || !pFormat->GetContent().GetContentIdx()) @@ -162,9 +160,8 @@ std::set<const SwFrameFormat*> SwTextBoxHelper::findTextBoxes(const SwNode& rNod const SwSortedObjs* pSortedObjs = pContentFrame->GetDrawObjs(); if (pSortedObjs) { - for (size_t i = 0; i < pSortedObjs->size(); ++i) + for (SwAnchoredObject* pAnchoredObject : *pSortedObjs) { - SwAnchoredObject* pAnchoredObject = (*pSortedObjs)[i]; SwFrameFormat* pTextBox = findTextBox(&pAnchoredObject->GetFrameFormat()); if (pTextBox) aRet.insert(pTextBox); @@ -183,11 +180,11 @@ std::map<SwFrameFormat*, SwFrameFormat*> SwTextBoxHelper::findShapes(const SwDoc std::map<SwFrameFormat*, SwFrameFormat*> aRet; const SwFrameFormats& rSpzFrameFormats = *pDoc->GetSpzFrameFormats(); - for (SwFrameFormats::const_iterator it = rSpzFrameFormats.begin(); it != rSpzFrameFormats.end(); ++it) + for (SwFrameFormat* pFormat : rSpzFrameFormats) { - SwFrameFormat* pTextBox = findTextBox(*it); + SwFrameFormat* pTextBox = findTextBox(pFormat); if (pTextBox) - aRet[pTextBox] = *it; + aRet[pTextBox] = pFormat; } return aRet; @@ -212,7 +209,7 @@ bool SwTextBoxHelper::isTextBox(const SdrObject* pObject) sal_Int32 SwTextBoxHelper::getCount(SdrPage* pPage, std::set<const SwFrameFormat*>& rTextBoxes) { sal_Int32 nRet = 0; - for (size_t i = 0; i < pPage->GetObjCount(); ++i) + for (std::size_t i = 0; i < pPage->GetObjCount(); ++i) { if (lcl_isTextBox(pPage->GetObj(i), rTextBoxes)) continue; @@ -228,7 +225,7 @@ uno::Any SwTextBoxHelper::getByIndex(SdrPage* pPage, sal_Int32 nIndex, std::set< SdrObject* pRet = nullptr; sal_Int32 nCount = 0; // Current logical index. - for (size_t i = 0; i < pPage->GetObjCount(); ++i) + for (std::size_t i = 0; i < pPage->GetObjCount(); ++i) { if (lcl_isTextBox(pPage->GetObj(i), rTextBoxes)) continue; @@ -251,7 +248,7 @@ sal_Int32 SwTextBoxHelper::getOrdNum(const SdrObject* pObject, std::set<const Sw if (const SdrPage* pPage = pObject->GetPage()) { sal_Int32 nOrder = 0; // Current logical order. - for (size_t i = 0; i < pPage->GetObjCount(); ++i) + for (std::size_t i = 0; i < pPage->GetObjCount(); ++i) { if (lcl_isTextBox(pPage->GetObj(i), rTextBoxes)) continue; @@ -268,7 +265,7 @@ sal_Int32 SwTextBoxHelper::getOrdNum(const SdrObject* pObject, std::set<const Sw void SwTextBoxHelper::getShapeWrapThrough(const SwFrameFormat* pTextBox, bool& rWrapThrough) { std::map<SwFrameFormat*, SwFrameFormat*> aMap = findShapes(pTextBox->GetDoc()); - std::map<SwFrameFormat*, SwFrameFormat*>::iterator it = aMap.find(const_cast<SwFrameFormat*>(pTextBox)); + auto it = aMap.find(const_cast<SwFrameFormat*>(pTextBox)); if (it != aMap.end()) // pTextBox is indeed a TextBox, it->second is its shape. rWrapThrough = it->second->GetSurround().GetSurround() == SURROUND_THROUGHT; @@ -292,9 +289,8 @@ SwFrameFormat* SwTextBoxHelper::findTextBox(const SwFrameFormat* pShape) { const SwFormatContent& rContent = pShape->GetContent(); const SwFrameFormats& rSpzFrameFormats = *pShape->GetDoc()->GetSpzFrameFormats(); - for (SwFrameFormats::const_iterator it = rSpzFrameFormats.begin(); it != rSpzFrameFormats.end(); ++it) + for (SwFrameFormat* pFormat : rSpzFrameFormats) { - SwFrameFormat* pFormat = *it; // Only a fly frame can be a TextBox. if (pFormat->Which() == RES_FLYFRMFMT && pFormat->GetAttrSet().HasItem(RES_CNTNT) && pFormat->GetContent() == rContent) { @@ -590,7 +586,7 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u void SwTextBoxHelper::saveLinks(const SwFrameFormats& rFormats, std::map<const SwFrameFormat*, const SwFrameFormat*>& rLinks) { - for (size_t i = 0; i < rFormats.size(); ++i) + for (std::size_t i = 0; i < rFormats.size(); ++i) { const SwFrameFormat* pFormat = rFormats[i]; if (pFormat->Which() != RES_DRAWFRMFMT) @@ -612,14 +608,14 @@ void SwTextBoxHelper::resetLink(SwFrameFormat* pShape, std::map<const SwFrameFor void SwTextBoxHelper::restoreLinks(std::set<_ZSortFly>& rOld, std::vector<SwFrameFormat*>& rNew, SavedLink& rSavedLinks, SavedContent& rOldContent) { - size_t i = 0; - for (std::set<_ZSortFly>::iterator aSetIt = rOld.begin(); aSetIt != rOld.end(); ++aSetIt, ++i) + std::size_t i = 0; + for (auto aSetIt = rOld.begin(); aSetIt != rOld.end(); ++aSetIt, ++i) { - SavedLink::iterator aTextBoxIt = rSavedLinks.find(aSetIt->GetFormat()); + auto aTextBoxIt = rSavedLinks.find(aSetIt->GetFormat()); if (aTextBoxIt != rSavedLinks.end()) { - size_t j = 0; - for (std::set<_ZSortFly>::iterator aSetJt = rOld.begin(); aSetJt != rOld.end(); ++aSetJt, ++j) + std::size_t j = 0; + for (auto aSetJt = rOld.begin(); aSetJt != rOld.end(); ++aSetJt, ++j) { if (aSetJt->GetFormat() == aTextBoxIt->second) rNew[i]->SetFormatAttr(rNew[j]->GetContent()); @@ -653,7 +649,7 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet& rSet) aTextBoxSet.Put(aOrient); - // restore height (shrinked for extending beyond the page bottom - tdf#91260) + // restore height (shrunk for extending beyond the page bottom - tdf#91260) SwFormatFrameSize aSize(pFormat->GetFrameSize()); if (!aRect.IsEmpty()) { |