diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-11-28 00:18:59 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-11-29 10:36:44 +0100 |
commit | 7eb8df24ab4fc682cc03f951c813bb2bd8378f46 (patch) | |
tree | a54e92a8ef942c994df317c31ccb631a07984596 | |
parent | 071148bed482a964ddd7ff99fdf18c13c2e8cec5 (diff) |
clean up and reduce indent levels
Change-Id: I35b66d310d411683c70687b762eadfeecb016275
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 696807bb77e7..aeb8910464e0 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -352,35 +352,31 @@ sal_Int32 lcl_GetCountOrName2<SFX_STYLE_FAMILY_CHAR>(const SwDoc &rDoc, OUString } template<> -sal_Int32 lcl_GetCountOrName2<SFX_STYLE_FAMILY_PARA>(const SwDoc &rDoc, OUString *pString, sal_Int32 nIndex) +sal_Int32 lcl_GetCountOrName2<SFX_STYLE_FAMILY_PARA>(const SwDoc &rDoc, OUString* pString, sal_Int32 nIndex) { + constexpr sal_Int32 nBaseCount = + RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN + + RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN + + RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN + + RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN + + RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN + + RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN; + nIndex -= nBaseCount; sal_Int32 nCount = 0; - const sal_Int32 nBaseCount = - RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN + - RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN + - RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN + - RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN + - RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN + - RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN; - nIndex = nIndex - nBaseCount; - const size_t nArrLen = rDoc.GetTextFormatColls()->size(); - for ( size_t i = 0; i < nArrLen; ++i ) + for(auto pColl : *rDoc.GetTextFormatColls()) { - SwTextFormatColl * pColl = (*rDoc.GetTextFormatColls())[i]; - if ( pColl->IsDefault() ) + if(pColl->IsDefault()) + continue; + if(!IsPoolUserFormat(pColl->GetPoolFormatId())) continue; - if ( IsPoolUserFormat ( pColl->GetPoolFormatId() ) ) + if(nIndex == nCount) { - if ( nIndex == nCount ) - { - *pString = pColl->GetName(); - break; - } - nCount++; + *pString = pColl->GetName(); + break; } + ++nCount; } - nCount += nBaseCount; - return nCount; + return nCount + nBaseCount; } template<> |