summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-11-28 04:50:28 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-11-29 10:36:54 +0100
commit0d05bb47c40566cc183c4c13cc93ad87f167d8f3 (patch)
tree9adae5a86725d4c97de9864c1da53a025ee49bf4 /sw/source/core/unocore
parent9c852dd419bc3b30e1e4ed69be3ba8132b4f2e65 (diff)
add ranges for pages, frames, nums
Change-Id: Id3c0f39b076bd3908d3ac4154e72ee14ca3963ae
Diffstat (limited to 'sw/source/core/unocore')
-rw-r--r--sw/source/core/unocore/unostyle.cxx26
1 files changed, 13 insertions, 13 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 715921030c11..d3cda0971127 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -120,6 +120,9 @@ namespace
constexpr sal_uInt16 nPoolCollRegisterRange = RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN;
constexpr sal_uInt16 nPoolCollDocRange = RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN;
constexpr sal_uInt16 nPoolCollHtmlRange = RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN;
+ constexpr sal_uInt16 nPoolFrameRange = RES_POOLFRM_END - RES_POOLFRM_BEGIN;
+ constexpr sal_uInt16 nPoolPageRange = RES_POOLPAGE_END - RES_POOLPAGE_BEGIN;
+ constexpr sal_uInt16 nPoolNumRange = RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN;
constexpr sal_uInt16 nPoolCollListsStackedStart = nPoolCollTextRange;
constexpr sal_uInt16 nPoolCollExtraStackedStart = nPoolCollListsStackedStart + nPoolCollListsRange;
constexpr sal_uInt16 nPoolCollRegisterStackedStart = nPoolCollExtraStackedStart + nPoolCollExtraRange;
@@ -436,8 +439,7 @@ sal_Int32 lcl_GetCountOrNameImpl<SFX_STYLE_FAMILY_PARA>(const SwDoc& rDoc, OUStr
template<>
sal_Int32 lcl_GetCountOrNameImpl<SFX_STYLE_FAMILY_FRAME>(const SwDoc& rDoc, OUString* pString, sal_Int32 nIndex)
{
- constexpr sal_Int32 nBaseCount = RES_POOLFRM_END - RES_POOLFRM_BEGIN;
- nIndex -= nBaseCount;
+ nIndex -= nPoolFrameRange;
sal_Int32 nCount = 0;
for(const auto pFormat : *rDoc.GetFrameFormats())
{
@@ -452,15 +454,14 @@ sal_Int32 lcl_GetCountOrNameImpl<SFX_STYLE_FAMILY_FRAME>(const SwDoc& rDoc, OUSt
}
nCount++;
}
- return nCount + nBaseCount;
+ return nCount + nPoolFrameRange;
}
template<>
sal_Int32 lcl_GetCountOrNameImpl<SFX_STYLE_FAMILY_PAGE>(const SwDoc& rDoc, OUString* pString, sal_Int32 nIndex)
{
+ nIndex -= nPoolPageRange;
sal_Int32 nCount = 0;
- const sal_Int32 nBaseCount = RES_POOLPAGE_END - RES_POOLPAGE_BEGIN;
- nIndex = nIndex - nBaseCount;
const size_t nArrLen = rDoc.GetPageDescCnt();
for(size_t i = 0; i < nArrLen; ++i)
{
@@ -476,15 +477,14 @@ sal_Int32 lcl_GetCountOrNameImpl<SFX_STYLE_FAMILY_PAGE>(const SwDoc& rDoc, OUStr
++nCount;
}
}
- nCount += nBaseCount;
+ nCount += nPoolPageRange;
return nCount;
}
template<>
sal_Int32 lcl_GetCountOrNameImpl<SFX_STYLE_FAMILY_PSEUDO>(const SwDoc& rDoc, OUString* pString, sal_Int32 nIndex)
{
- constexpr sal_Int32 nBaseCount = RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN;
- nIndex -= nBaseCount;
+ nIndex -= nPoolNumRange;
sal_Int32 nCount = 0;
for(const auto pRule : rDoc.GetNumRuleTable())
{
@@ -499,7 +499,7 @@ sal_Int32 lcl_GetCountOrNameImpl<SFX_STYLE_FAMILY_PSEUDO>(const SwDoc& rDoc, OUS
}
++nCount;
}
- return nCount + nBaseCount;
+ return nCount + nPoolNumRange;
}
sal_Int32 XStyleFamily::GetCountOrName(OUString* pString, sal_Int32 nIndex)
@@ -563,20 +563,20 @@ uno::Any XStyleFamily::getByIndex(sal_Int32 nIndex)
break;
case SFX_STYLE_FAMILY_FRAME:
{
- if(nIndex < (RES_POOLFRM_END - RES_POOLFRM_BEGIN))
+ if(nIndex < nPoolFrameRange)
SwStyleNameMapper::FillUIName(static_cast<sal_uInt16>(RES_POOLFRM_BEGIN + nIndex), sStyleName);
}
break;
case SFX_STYLE_FAMILY_PAGE:
{
- if(nIndex < (RES_POOLPAGE_END - RES_POOLPAGE_BEGIN ))
+ if(nIndex < nPoolPageRange)
SwStyleNameMapper::FillUIName(static_cast<sal_uInt16>(RES_POOLPAGE_BEGIN + nIndex), sStyleName);
}
break;
case SFX_STYLE_FAMILY_PSEUDO:
{
- if(nIndex < (RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN))
- SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLNUMRULE_BEGIN + nIndex), sStyleName );
+ if(nIndex < nPoolNumRange)
+ SwStyleNameMapper::FillUIName(static_cast<sal_uInt16>(RES_POOLNUMRULE_BEGIN + nIndex), sStyleName);
}
break;