[Libreoffice-commits] core.git: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Feb 17 15:48:32 UTC 2019


 sc/source/ui/dbgui/imoptdlg.cxx |   19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

New commits:
commit 371c744799a3a5791e3a7d643aa8e84dff27527f
Author:     Matteo Casalin <matteo.casalin at yahoo.com>
AuthorDate: Sun Feb 10 18:16:25 2019 +0100
Commit:     Matteo Casalin <matteo.casalin at yahoo.com>
CommitDate: Sun Feb 17 16:48:10 2019 +0100

    Use indexed getToken()
    
    Change-Id: I12f621a433d2f044fed11f7fac854c68efff9b5e
    Reviewed-on: https://gerrit.libreoffice.org/67658
    Tested-by: Jenkins
    Reviewed-by: Matteo Casalin <matteo.casalin at yahoo.com>

diff --git a/sc/source/ui/dbgui/imoptdlg.cxx b/sc/source/ui/dbgui/imoptdlg.cxx
index efaf07d8585a..a60541a85107 100644
--- a/sc/source/ui/dbgui/imoptdlg.cxx
+++ b/sc/source/ui/dbgui/imoptdlg.cxx
@@ -47,35 +47,36 @@ ScImportOptions::ScImportOptions( const OUString& rStr )
     sal_Int32 nTokenCount = comphelper::string::getTokenCount(rStr, ',');
     if ( nTokenCount >= 3 )
     {
+        sal_Int32 nIdx{ 0 };
         // first 3 tokens: common
-        OUString aToken( rStr.getToken( 0, ',' ) );
+        OUString aToken( rStr.getToken( 0, ',', nIdx ) );
         if( aToken.equalsIgnoreAsciiCase( pStrFix ) )
             bFixedWidth = true;
         else
             nFieldSepCode = ScAsciiOptions::GetWeightedFieldSep( aToken, true);
-        nTextSepCode  = static_cast<sal_Unicode>(rStr.getToken(1,',').toInt32());
-        aStrFont      = rStr.getToken(2,',');
+        nTextSepCode  = static_cast<sal_Unicode>(rStr.getToken(0, ',', nIdx).toInt32());
+        aStrFont      = rStr.getToken(0, ',', nIdx);
         eCharSet      = ScGlobal::GetCharsetValue(aStrFont);
 
         if ( nTokenCount == 4 )
         {
             // compatibility with old options string: "Save as shown" as 4th token, numeric
-            bSaveAsShown = rStr.getToken( 3, ',' ).toInt32() != 0;
+            bSaveAsShown = rStr.getToken(0, ',', nIdx).toInt32() != 0;
             bQuoteAllText = true;   // use old default then
         }
         else
         {
             // look at the same positions as in ScAsciiOptions
             if ( nTokenCount >= 7 )
-                bQuoteAllText = rStr.getToken(6, ',') == "true";
+                bQuoteAllText = rStr.getToken(3, ',', nIdx) == "true";  // 7th token
             if ( nTokenCount >= 8 )
-                bSaveNumberAsSuch = rStr.getToken(7, ',') == "true";
+                bSaveNumberAsSuch = rStr.getToken(0, ',', nIdx) == "true";
             if ( nTokenCount >= 9 )
-                bSaveAsShown = rStr.getToken(8, ',') == "true";
+                bSaveAsShown = rStr.getToken(0, ',', nIdx) == "true";
             if ( nTokenCount >= 10 )
-                bSaveFormulas = rStr.getToken(9, ',') == "true";
+                bSaveFormulas = rStr.getToken(0, ',', nIdx) == "true";
             if ( nTokenCount >= 11 )
-                bRemoveSpace = rStr.getToken(10, ',') == "true";
+                bRemoveSpace = rStr.getToken(0, ',', nIdx) == "true";
         }
     }
 }


More information about the Libreoffice-commits mailing list