summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2019-02-03 18:57:27 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2019-02-08 19:32:14 +0100
commit6e1bd43a4344f6c3dff9a6fc06fa9a6f1356e327 (patch)
tree2c0d0c0fee14bee8d2c902d67700e95054821e8e /sw
parent15b0bc23e87aa41dc40beeaaed7e87d727af00f2 (diff)
Use indexed getToken()
Change-Id: I1fa06283b3c1857c81ec320b98db857a42e91bca Reviewed-on: https://gerrit.libreoffice.org/67333 Tested-by: Jenkins Reviewed-by: Matteo Casalin <matteo.casalin@yahoo.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/edit/autofmt.cxx15
1 files changed, 8 insertions, 7 deletions
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index e10fbcd6f9bf..2827659def58 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -1619,12 +1619,13 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel )
{
SwCharFormat* pCFormat = m_pDoc->getIDocumentStylePoolAccess().GetCharFormatFromPool(
RES_POOLCHR_NUM_LEVEL );
+
+ sal_Int32 nPrefixIdx{ 0 };
if( !nDigitLevel )
{
SwNumFormat aFormat( aRule.Get( nLvl ) );
- aFormat.SetStart( static_cast<sal_uInt16>(aPrefix.getToken( 1,
- u'\x0001' ).toInt32()));
- aFormat.SetPrefix( aPrefix.getToken( 0, u'\x0001' ));
+ aFormat.SetPrefix( aPrefix.getToken( 0, u'\x0001', nPrefixIdx ));
+ aFormat.SetStart( static_cast<sal_uInt16>(aPrefix.getToken( 0, u'\x0001', nPrefixIdx ).toInt32()));
aFormat.SetSuffix( aPostfix.getToken( 0, u'\x0001' ));
aFormat.SetIncludeUpperLevels( 0 );
@@ -1642,15 +1643,15 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel )
{
auto const nSpaceSteps = nLvl ? nLeftTextPos / nLvl : 0;
sal_uInt16 n;
+ sal_Int32 nPostfixIdx{ 0 };
for( n = 0; n <= nLvl; ++n )
{
SwNumFormat aFormat( aRule.Get( n ) );
- aFormat.SetStart( static_cast<sal_uInt16>(aPrefix.getToken( n+1,
- u'\x0001' ).toInt32() ));
if( !n )
- aFormat.SetPrefix( aPrefix.getToken( n, u'\x0001' ));
- aFormat.SetSuffix( aPostfix.getToken( n, u'\x0001' ));
+ aFormat.SetPrefix( aPrefix.getToken( 0, u'\x0001', nPrefixIdx )); // token 0, read only on first loop
+ aFormat.SetStart( static_cast<sal_uInt16>(aPrefix.getToken( 0, u'\x0001', nPrefixIdx ).toInt32() ));
+ aFormat.SetSuffix( aPostfix.getToken( 0, u'\x0001', nPostfixIdx ));
aFormat.SetIncludeUpperLevels( MAXLEVEL );
if( n < aNumTypes.getLength() )
aFormat.SetNumberingType(static_cast<SvxNumType>(aNumTypes[ n ] - '0'));