diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-11-28 00:20:26 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-11-29 10:36:45 +0100 |
commit | c022f8f2cbe95a7fc5f8ea0b3e0dce42e87db947 (patch) | |
tree | 28ae0bc8206d8419d2659026f0cc09c2792a2b97 | |
parent | 7eb8df24ab4fc682cc03f951c813bb2bd8378f46 (diff) |
clean up and reduce indent levels
Change-Id: Ib1e2a6295c7cbf64156906c424249bcde0009bed
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index aeb8910464e0..81697c27b66a 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -380,29 +380,25 @@ sal_Int32 lcl_GetCountOrName2<SFX_STYLE_FAMILY_PARA>(const SwDoc &rDoc, OUString } template<> -sal_Int32 lcl_GetCountOrName2<SFX_STYLE_FAMILY_FRAME>(const SwDoc &rDoc, OUString *pString, sal_Int32 nIndex) +sal_Int32 lcl_GetCountOrName2<SFX_STYLE_FAMILY_FRAME>(const SwDoc &rDoc, OUString* pString, sal_Int32 nIndex) { + constexpr sal_Int32 nBaseCount = RES_POOLFRM_END - RES_POOLFRM_BEGIN; + nIndex -= nBaseCount; sal_Int32 nCount = 0; - const sal_Int32 nBaseCount = RES_POOLFRM_END - RES_POOLFRM_BEGIN; - nIndex = nIndex - nBaseCount; - const size_t nArrLen = rDoc.GetFrameFormats()->size(); - for( size_t i = 0; i < nArrLen; ++i ) + for(const auto pFormat : *rDoc.GetFrameFormats()) { - const SwFrameFormat* pFormat = (*rDoc.GetFrameFormats())[ i ]; if(pFormat->IsDefault() || pFormat->IsAuto()) continue; - if ( IsPoolUserFormat ( pFormat->GetPoolFormatId() ) ) + if(!IsPoolUserFormat(pFormat->GetPoolFormatId())) + continue; + if(nIndex == nCount) { - if ( nIndex == nCount ) - { - *pString = pFormat->GetName(); - break; - } - nCount++; + *pString = pFormat->GetName(); + break; } + nCount++; } - nCount += nBaseCount; - return nCount; + return nCount + nBaseCount; } template<> @@ -423,7 +419,7 @@ sal_Int32 lcl_GetCountOrName2<SFX_STYLE_FAMILY_PAGE>(const SwDoc &rDoc, OUString *pString = rDesc.GetName(); break; } - nCount++; + ++nCount; } } nCount += nBaseCount; |