From ce3d3f5543e3e132a3473af27aa2c827336add0f Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Thu, 10 Dec 2015 18:43:32 +0100 Subject: add test for UNO writer style families ... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... and fix the breakages it finds. Change-Id: Ibc7289cc0cd7fb5648d686bd55afff9016f58b3b Reviewed-on: https://gerrit.libreoffice.org/20638 Reviewed-by: Björn Michaelsen Tested-by: Jenkins --- sw/source/core/unocore/unostyle.cxx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'sw/source/core/unocore/unostyle.cxx') 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(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(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(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); -- cgit v1.2.3