sw/source/core/edit/autofmt.cxx |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 6e1bd43a4344f6c3dff9a6fc06fa9a6f1356e327
Author:     Matteo Casalin <matteo.casa...@yahoo.com>
AuthorDate: Sun Feb 3 18:57:27 2019 +0100
Commit:     Matteo Casalin <matteo.casa...@yahoo.com>
CommitDate: Fri Feb 8 19:32:14 2019 +0100

    Use indexed getToken()
    
    Change-Id: I1fa06283b3c1857c81ec320b98db857a42e91bca
    Reviewed-on: https://gerrit.libreoffice.org/67333
    Tested-by: Jenkins
    Reviewed-by: Matteo Casalin <matteo.casa...@yahoo.com>

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'));
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to