From 6d7f4b4cb906a7abaed5b857e50302a3f2040593 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Sat, 28 Nov 2015 00:39:06 +0100 Subject: clean up and reduce indent levels Change-Id: I85fe89e9ef9a6afe79e7e31a3d3d9be85936394d --- sw/source/core/unocore/unostyle.cxx | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 81697c27b66a..f92e9c00e22b 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -427,29 +427,25 @@ sal_Int32 lcl_GetCountOrName2(const SwDoc &rDoc, OUString } template<> -sal_Int32 lcl_GetCountOrName2(const SwDoc &rDoc, OUString *pString, sal_Int32 nIndex) +sal_Int32 lcl_GetCountOrName2(const SwDoc &rDoc, OUString* pString, sal_Int32 nIndex) { + constexpr sal_Int32 nBaseCount = RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN; + nIndex -= nBaseCount; sal_Int32 nCount = 0; - const sal_Int32 nBaseCount = RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN; - nIndex = nIndex - nBaseCount; - const SwNumRuleTable& rNumTable = rDoc.GetNumRuleTable(); - for(size_t i = 0; i < rNumTable.size(); ++i) + for(const auto pRule : rDoc.GetNumRuleTable()) { - const SwNumRule& rRule = *rNumTable[ i ]; - if( rRule.IsAutoRule() ) + if(pRule->IsAutoRule()) continue; - if ( IsPoolUserFormat ( rRule.GetPoolFormatId() ) ) + if(!IsPoolUserFormat(pRule->GetPoolFormatId())) + continue; + if(nIndex == nCount) { - if ( nIndex == nCount ) - { - *pString = rRule.GetName(); - break; - } - nCount++; + *pString = pRule->GetName(); + break; } + ++nCount; } - nCount += nBaseCount; - return nCount; + return nCount + nBaseCount; } static sal_Int32 lcl_GetCountOrName(const SwDoc &rDoc, -- cgit v1.2.3