summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-12-10 18:43:32 +0100
committerBjörn Michaelsen <bjoern.michaelsen@canonical.com>2015-12-11 17:00:31 +0000
commitce3d3f5543e3e132a3473af27aa2c827336add0f (patch)
tree6b26617f0f14fdf684d09f0d9471ec8007b0d3bc /sw/source/core/unocore
parent14bb81ef5666a9e775208ffae947bb8ba76bc8cb (diff)
add test for UNO writer style families ...
... and fix the breakages it finds. Change-Id: Ibc7289cc0cd7fb5648d686bd55afff9016f58b3b Reviewed-on: https://gerrit.libreoffice.org/20638 Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw/source/core/unocore')
-rw-r--r--sw/source/core/unocore/unostyle.cxx15
1 files changed, 7 insertions, 8 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index d789611f3c21..f8fe8d1905be 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -398,7 +398,7 @@ static sal_Int32 lcl_GetCountOrName(const SwDoc&, OUString*, sal_Int32);
template<>
sal_Int32 lcl_GetCountOrName<SFX_STYLE_FAMILY_CHAR>(const SwDoc& rDoc, OUString* pString, sal_Int32 nIndex)
{
- const sal_uInt16 nBaseCount = nPoolChrHtmlRange + nPoolCollTextRange;
+ const sal_uInt16 nBaseCount = nPoolChrHtmlRange + nPoolChrNormalRange;
nIndex -= nBaseCount;
sal_Int32 nCount = 0;
for(auto pFormat : *rDoc.GetCharFormats())
@@ -529,7 +529,7 @@ sal_uInt16 lcl_TranslateIndex<SFX_STYLE_FAMILY_CHAR>(const sal_uInt16 nIndex)
if(nIndex < nPoolChrNormalRange)
return nIndex + RES_POOLCHR_NORMAL_BEGIN;
else if(nIndex < (nPoolChrHtmlRange+nPoolChrNormalRange))
- return nIndex + RES_POOLCHR_HTML_BEGIN + nPoolChrNormalRange;
+ return nIndex + RES_POOLCHR_HTML_BEGIN - nPoolChrNormalRange;
throw lang::IndexOutOfBoundsException();
}
@@ -540,15 +540,15 @@ sal_uInt16 lcl_TranslateIndex<SFX_STYLE_FAMILY_PARA>(const sal_uInt16 nIndex)
if(nIndex < nPoolCollListsStackedStart)
return nIndex + RES_POOLCOLL_TEXT_BEGIN;
else if(nIndex < nPoolCollExtraStackedStart)
- return nIndex + RES_POOLCOLL_LISTS_BEGIN + nPoolCollListsStackedStart;
+ return nIndex + RES_POOLCOLL_LISTS_BEGIN - nPoolCollListsStackedStart;
else if(nIndex < nPoolCollRegisterStackedStart)
- return nIndex + RES_POOLCOLL_EXTRA_BEGIN + nPoolCollExtraStackedStart;
+ return nIndex + RES_POOLCOLL_EXTRA_BEGIN - nPoolCollExtraStackedStart;
else if(nIndex < nPoolCollDocStackedStart)
- return nIndex + RES_POOLCOLL_REGISTER_BEGIN + nPoolCollRegisterStackedStart;
+ return nIndex + RES_POOLCOLL_REGISTER_BEGIN - nPoolCollRegisterStackedStart;
else if(nIndex < nPoolCollHtmlStackedStart)
- return nIndex + RES_POOLCOLL_DOC_BEGIN + nPoolCollDocStackedStart;
+ return nIndex + RES_POOLCOLL_DOC_BEGIN - nPoolCollDocStackedStart;
else if(nIndex < nPoolCollHtmlStackedStart + nPoolCollTextRange)
- return nIndex + RES_POOLCOLL_HTML_BEGIN + nPoolCollHtmlStackedStart;
+ return nIndex + RES_POOLCOLL_HTML_BEGIN - nPoolCollHtmlStackedStart;
throw lang::IndexOutOfBoundsException();
}
@@ -575,7 +575,6 @@ uno::Any XStyleFamily::getByIndex(sal_Int32 nIndex)
} catch(...) {}
if (sStyleName.isEmpty())
GetCountOrName(&sStyleName, nIndex);
-
if(sStyleName.isEmpty())
throw lang::IndexOutOfBoundsException();
return getByName(sStyleName);