[Libreoffice-commits] core.git: editeng/source include/tools sc/source sw/source tools/source

Thomas Arnhold thomas at arnhold.org
Wed Sep 11 04:31:27 PDT 2013


 editeng/source/misc/svxacorr.cxx        |   36 ++++---
 include/tools/string.hxx                |    1 
 sc/source/ui/view/output2.cxx           |   61 +++++++-----
 sw/source/filter/inc/msfilter.hxx       |   12 +-
 sw/source/filter/ww8/writerwordglue.cxx |  157 +++++++++++++++-----------------
 sw/source/filter/ww8/ww8par.hxx         |    2 
 sw/source/filter/ww8/ww8par2.cxx        |    4 
 sw/source/filter/ww8/ww8par5.cxx        |   12 +-
 tools/source/string/tustring.cxx        |   24 ----
 9 files changed, 149 insertions(+), 160 deletions(-)

New commits:
commit 4f702470a2c5f5521209203f0d20f768ef274d67
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Mon Sep 9 18:50:22 2013 +0200

    Related: fdo#38838 Remove String::SearchChar()
    
    Change-Id: Ide40e0ef91aec04c2ae274aaf2a957dd5064854c
    Reviewed-on: https://gerrit.libreoffice.org/5894
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 014eefc..71f70f4 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1639,18 +1639,28 @@ OUString EncryptBlockName_Imp(const OUString& rName)
 }
 
 /* This code is copied from SwXMLTextBlocks::GeneratePackageName */
-static void GeneratePackageName ( const String& rShort, String& rPackageName )
+static void GeneratePackageName ( const OUString& rShort, OUString& rPackageName )
 {
-    rPackageName = rShort;
-    xub_StrLen nPos = 0;
-    sal_Unicode pDelims[] = { '!', '/', ':', '.', '\\', 0 };
-    OString sByte(OUStringToOString(rPackageName, RTL_TEXTENCODING_UTF7));
-    rPackageName = OStringToOUString(sByte, RTL_TEXTENCODING_ASCII_US);
-    while( STRING_NOTFOUND != ( nPos = rPackageName.SearchChar( pDelims, nPos )))
+    OString sByte(OUStringToOString(rShort, RTL_TEXTENCODING_UTF7));
+    OUStringBuffer aBuf(OStringToOUString(sByte, RTL_TEXTENCODING_ASCII_US));
+
+    for (sal_Int32 nPos = 0; nPos < aBuf.getLength(); ++nPos)
     {
-        rPackageName.SetChar( nPos, '_' );
-        ++nPos;
+        switch (aBuf[nPos])
+        {
+            case '!':
+            case '/':
+            case ':':
+            case '.':
+            case '\\':
+                aBuf[nPos] = '_';
+                break;
+            default:
+                break;
+        }
     }
+
+    rPackageName = aBuf.makeStringAndClear();
 }
 
 static const SvxAutocorrWord* lcl_SearchWordsInList(
@@ -2436,7 +2446,7 @@ sal_Bool SvxAutoCorrectLanguageLists::MakeCombinedChanges( std::vector<SvxAutoco
             {
                 if( !pFoundEntry->IsTextOnly() )
                 {
-                    String aName( aWordToDelete.GetShort() );
+                    OUString aName( aWordToDelete.GetShort() );
                     if (xStorage->IsOLEStorage())
                         aName = EncryptBlockName_Imp(aName);
                     else
@@ -2461,7 +2471,7 @@ sal_Bool SvxAutoCorrectLanguageLists::MakeCombinedChanges( std::vector<SvxAutoco
                 if( !pRemoved->IsTextOnly() )
                 {
                     // Still have to remove the Storage
-                    String sStorageName( pWordToAdd->GetShort() );
+                    OUString sStorageName( pWordToAdd->GetShort() );
                     if (xStorage->IsOLEStorage())
                         sStorageName = EncryptBlockName_Imp(sStorageName);
                     else
@@ -2509,7 +2519,7 @@ sal_Bool SvxAutoCorrectLanguageLists::PutText( const OUString& rShort, const OUS
             if( !pRemove->IsTextOnly() )
             {
                 // Still have to remove the Storage
-                String sStgNm( rShort );
+                OUString sStgNm( rShort );
                 if (xStg->IsOLEStorage())
                     sStgNm = EncryptBlockName_Imp(sStgNm);
                 else
@@ -2589,7 +2599,7 @@ sal_Bool SvxAutoCorrectLanguageLists::DeleteText( const OUString& rShort )
         {
             if( !pFnd->IsTextOnly() )
             {
-                String aName( rShort );
+                OUString aName( rShort );
                 if (xStg->IsOLEStorage())
                     aName = EncryptBlockName_Imp(aName);
                 else
diff --git a/include/tools/string.hxx b/include/tools/string.hxx
index 56b6e9c..768192f 100644
--- a/include/tools/string.hxx
+++ b/include/tools/string.hxx
@@ -255,7 +255,6 @@ public:
     xub_StrLen          Search( const sal_Unicode* pCharStr, xub_StrLen nIndex = 0 ) const;
     xub_StrLen          SearchAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex = 0 ) const;
     xub_StrLen          SearchBackward( sal_Unicode c, xub_StrLen nIndex = STRING_LEN ) const;
-    xub_StrLen          SearchChar( const sal_Unicode* pChars, xub_StrLen nIndex = 0 ) const;
 
     xub_StrLen          SearchAndReplace( sal_Unicode c, sal_Unicode cRep,
                                           xub_StrLen nIndex = 0 );
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 5e361c3..4dd83a3 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -101,7 +101,7 @@ class ScDrawStringsVars
     sal_uInt16              nIndent;
     sal_Bool                bRotated;
 
-    String              aString;                // Inhalte
+    OUString            aString;                // contents
     Size                aTextSize;
     long                nOriginalWidth;
     long                nMaxDigitWidth;
@@ -139,7 +139,7 @@ public:
     bool SetText( ScRefCellValue& rCell );   // TRUE -> pOldPattern vergessen
     void        SetHashText();
     void SetTextToWidthOrHash( ScRefCellValue& rCell, long nWidth );
-    void        SetAutoText( const String& rAutoText );
+    void        SetAutoText( const OUString& rAutoText );
 
     const ScPatternAttr*    GetPattern() const       { return pPattern; }
     SvxCellOrientation      GetOrient() const        { return eAttrOrient; }
@@ -152,7 +152,7 @@ public:
     sal_uInt16              GetLeftTotal() const     { return pMargin->GetLeftMargin() + nIndent; }
     sal_uInt16              GetRightTotal() const    { return pMargin->GetRightMargin() + nIndent; }
 
-    const String&           GetString() const        { return aString; }
+    const OUString&         GetString() const        { return aString; }
     const Size&             GetTextSize() const      { return aTextSize; }
     long                    GetOriginalWidth() const { return nOriginalWidth; }
 
@@ -207,7 +207,7 @@ ScDrawStringsVars::ScDrawStringsVars(ScOutputData* pData, sal_Bool bPTL) :
     bRepeat     ( false ),
     bShrink     ( false ),
     bPixelToLogic( bPTL ),
-    nPos( STRING_NOTFOUND ),
+    nPos( -1 ),
     nChar( 0x0 )
 {
     ScModule* pScMod = SC_MOD();
@@ -498,32 +498,30 @@ bool ScDrawStringsVars::SetText( ScRefCellValue& rCell )
 
             Color* pColor;
             sal_uLong nFormat = GetValueFormat();
-            OUString aOUString = aString;
             ScCellFormat::GetString( rCell,
-                                     nFormat, aOUString, &pColor,
+                                     nFormat, aString, &pColor,
                                      *pOutput->mpDoc->GetFormatTable(),
                                      pOutput->mpDoc,
                                      pOutput->mbShowNullValues,
                                      pOutput->mbShowFormulas,
                                      ftCheck, true );
-            aString = aOUString;
             if ( nFormat )
             {
-                nPos = aString.Search( 0x1B );
-                if ( nPos != STRING_NOTFOUND )
+                nPos = aString.indexOf( 0x1B );
+                if ( nPos != -1 )
                 {
-                    nChar = aString.GetChar( nPos + 1 );
+                    nChar = aString[ nPos + 1 ];
                     // delete placeholder and char to repeat
-                    aString.Erase( nPos, 2 );
+                    aString = aString.replaceAt( nPos, 2, "" );
                 }
             }
             else
             {
-                nPos = STRING_NOTFOUND;
+                nPos = -1;
                 nChar = 0x0;
             }
-            if (aString.Len() > DRAWTEXT_MAX)
-                aString.Erase(DRAWTEXT_MAX);
+            if (aString.getLength() > DRAWTEXT_MAX)
+                aString = aString.copy(0, DRAWTEXT_MAX);
 
             if ( pColor && !pOutput->mbSyntaxMode && !( pOutput->mbUseStyleColor && pOutput->mbForceAutoColor ) )
             {
@@ -540,7 +538,7 @@ bool ScDrawStringsVars::SetText( ScRefCellValue& rCell )
     }
     else
     {
-        aString.Erase();
+        aString = OUString();
         maLastCell.clear();
         aTextSize = Size(0,0);
         nOriginalWidth = 0;
@@ -556,7 +554,7 @@ void ScDrawStringsVars::SetHashText()
 
 void ScDrawStringsVars::RepeatToFill( long colWidth )
 {
-    if ( nPos ==  STRING_NOTFOUND || nPos > aString.Len() )
+    if ( nPos == -1 || nPos > aString.getLength() )
         return;
 
     long charWidth = pOutput->pFmtDevice->GetTextWidth(OUString(nChar));
@@ -572,7 +570,7 @@ void ScDrawStringsVars::RepeatToFill( long colWidth )
     long nCharsToInsert = aSpaceToFill / charWidth;
     OUStringBuffer aFill;
     comphelper::string::padToLength(aFill, nCharsToInsert, nChar);
-    aString.Insert( aFill.makeStringAndClear(), nPos);
+    aString = aString.replaceAt( nPos, 0, aFill.makeStringAndClear() );
     TextChanged();
 }
 
@@ -627,11 +625,11 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScRefCellValue& rCell, long nWidth
         aString = sTempOut;
     }
     sal_uInt8 nSignCount = 0, nDecimalCount = 0, nExpCount = 0;
-    xub_StrLen nLen = aString.Len();
+    sal_Int32 nLen = aString.getLength();
     sal_Unicode cDecSep = ScGlobal::GetpLocaleData()->getLocaleItem().decimalSeparator.getStr()[0];
     for (xub_StrLen i = 0; i < nLen; ++i)
     {
-        sal_Unicode c = aString.GetChar(i);
+        sal_Unicode c = aString[i];
         if (c == sal_Unicode('-'))
             ++nSignCount;
         else if (c == cDecSep)
@@ -642,7 +640,7 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScRefCellValue& rCell, long nWidth
 
     // #i112250# A small value might be formatted as "0" when only counting the digits,
     // but fit into the column when considering the smaller width of the decimal separator.
-    if (aString.EqualsAscii("0") && fVal != 0.0)
+    if (aString == "0" && fVal != 0.0)
         nDecimalCount = 1;
 
     if (nDecimalCount)
@@ -678,7 +676,7 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScRefCellValue& rCell, long nWidth
     maLastCell.clear();   // #i113022# equal cell and format in another column may give different string
 }
 
-void ScDrawStringsVars::SetAutoText( const String& rAutoText )
+void ScDrawStringsVars::SetAutoText( const OUString& rAutoText )
 {
     aString = rAutoText;
 
@@ -779,11 +777,24 @@ void ScDrawStringsVars::TextChanged()
 
 sal_Bool ScDrawStringsVars::HasEditCharacters() const
 {
-    static const sal_Unicode pChars[] =
+    for (sal_Int32 nIdx = 0; nIdx < aString.getLength(); ++nIdx)
     {
-        CHAR_NBSP, CHAR_SHY, CHAR_ZWSP, CHAR_LRM, CHAR_RLM, CHAR_NBHY, CHAR_ZWNBSP, 0
-    };
-    return aString.SearchChar( pChars ) != STRING_NOTFOUND;
+        switch(aString[nIdx])
+        {
+            case CHAR_NBSP:
+            case CHAR_SHY:
+            case CHAR_ZWSP:
+            case CHAR_LRM:
+            case CHAR_RLM:
+            case CHAR_NBHY:
+            case CHAR_ZWNBSP:
+                return sal_True;
+            default:
+                break;
+        }
+    }
+
+    return sal_False;
 }
 
 sal_uLong ScDrawStringsVars::GetResultValueFormat() const
diff --git a/sw/source/filter/inc/msfilter.hxx b/sw/source/filter/inc/msfilter.hxx
index 37691ca..24818ef 100644
--- a/sw/source/filter/inc/msfilter.hxx
+++ b/sw/source/filter/inc/msfilter.hxx
@@ -103,20 +103,20 @@ namespace sw
             @author
                 <a href="mailto:mmaher at openoffice.org">Martin Maher</a
         */
-        sal_uLong MSDateTimeFormatToSwFormat(String& rParams, SvNumberFormatter *pFormatter, sal_uInt16 &rLang, bool bHijri, sal_uInt16 nDocLang);
+        sal_uLong MSDateTimeFormatToSwFormat(OUString& rParams, SvNumberFormatter *pFormatter, sal_uInt16 &rLang, bool bHijri, sal_uInt16 nDocLang);
 
         /*Used to identify if the previous token is AM time field*/
-        sal_Bool IsPreviousAM(String& rParams, xub_StrLen nPos);
+        sal_Bool IsPreviousAM(OUString& rParams, sal_Int32 nPos);
 
         /*Used to identify if the next token is PM time field*/
-        sal_Bool IsNextPM(String& rParams, xub_StrLen nPos);
+        sal_Bool IsNextPM(OUString& rParams, sal_Int32 nPos);
 
         /** Used by MSDateTimeFormatToSwFormat to identify AM time fields
 
             @author
                 <a href="mailto:mmaher at openoffice.org">Martin Maher</a
         */
-        bool IsNotAM(String& rParams, xub_StrLen nPos);
+        bool IsNotAM(OUString& rParams, sal_Int32 nPos);
 
         /** Another function used by MSDateTimeFormatToSwFormat
 
@@ -206,7 +206,7 @@ namespace sw
                 rName and WW-rName[0..SAL_MAX_INT32], which is both unlikely
                 and impossible.
             */
-            StyleResult GetStyle(const String& rName, ww::sti eSti);
+            StyleResult GetStyle(const OUString& rName, ww::sti eSti);
         };
 
         /** Knows which writer style a given word style should be imported as
@@ -266,7 +266,7 @@ namespace sw
                 rName and WW-rName[0..SAL_MAX_INT32], which is both unlikely
                 and impossible.
             */
-            StyleResult GetStyle(const String& rName, ww::sti eSti);
+            StyleResult GetStyle(const OUString& rName, ww::sti eSti);
         };
 
         /** Find suitable names for exporting this font
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index d30e519..323ac36 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -121,8 +121,8 @@ namespace myImplHelpers
     public:
         MapperImpl(SwDoc &rDoc) : mrDoc(rDoc) {}
         SwTxtFmtColl* GetBuiltInStyle(ww::sti eSti);
-        SwTxtFmtColl* GetStyle(const String &rName);
-        SwTxtFmtColl* MakeStyle(const String &rName);
+        SwTxtFmtColl* GetStyle(const OUString &rName);
+        SwTxtFmtColl* MakeStyle(const OUString &rName);
     };
 
     SwTxtFmtColl* MapperImpl<SwTxtFmtColl>::GetBuiltInStyle(ww::sti eSti)
@@ -166,12 +166,12 @@ namespace myImplHelpers
         return pRet;
     }
 
-    SwTxtFmtColl* MapperImpl<SwTxtFmtColl>::GetStyle(const String &rName)
+    SwTxtFmtColl* MapperImpl<SwTxtFmtColl>::GetStyle(const OUString &rName)
     {
         return sw::util::GetParaStyle(mrDoc, rName);
     }
 
-    SwTxtFmtColl* MapperImpl<SwTxtFmtColl>::MakeStyle(const String &rName)
+    SwTxtFmtColl* MapperImpl<SwTxtFmtColl>::MakeStyle(const OUString &rName)
     {
         return mrDoc.MakeTxtFmtColl(rName,
             const_cast<SwTxtFmtColl *>(mrDoc.GetDfltTxtFmtColl()));
@@ -184,8 +184,8 @@ namespace myImplHelpers
     public:
         MapperImpl(SwDoc &rDoc) : mrDoc(rDoc) {}
         SwCharFmt* GetBuiltInStyle(ww::sti eSti);
-        SwCharFmt* GetStyle(const String &rName);
-        SwCharFmt* MakeStyle(const String &rName);
+        SwCharFmt* GetStyle(const OUString &rName);
+        SwCharFmt* MakeStyle(const OUString &rName);
     };
 
     SwCharFmt* MapperImpl<SwCharFmt>::GetBuiltInStyle(ww::sti eSti)
@@ -227,12 +227,12 @@ namespace myImplHelpers
         return pRet;
     }
 
-    SwCharFmt* MapperImpl<SwCharFmt>::GetStyle(const String &rName)
+    SwCharFmt* MapperImpl<SwCharFmt>::GetStyle(const OUString &rName)
     {
         return sw::util::GetCharStyle(mrDoc, rName);
     }
 
-    SwCharFmt* MapperImpl<SwCharFmt>::MakeStyle(const String &rName)
+    SwCharFmt* MapperImpl<SwCharFmt>::MakeStyle(const OUString &rName)
     {
         return mrDoc.MakeCharFmt(rName, mrDoc.GetDfltCharFmt());
     }
@@ -246,12 +246,12 @@ namespace myImplHelpers
     public:
         typedef std::pair<C*, bool> StyleResult;
         StyleMapperImpl(SwDoc &rDoc) : maHelper(rDoc) {}
-        StyleResult GetStyle(const String& rName, ww::sti eSti);
+        StyleResult GetStyle(const OUString& rName, ww::sti eSti);
     };
 
     template<class C>
     typename StyleMapperImpl<C>::StyleResult
-    StyleMapperImpl<C>::GetStyle(const String& rName, ww::sti eSti)
+    StyleMapperImpl<C>::GetStyle(const OUString& rName, ww::sti eSti)
     {
         C *pRet = maHelper.GetBuiltInStyle(eSti);
 
@@ -271,12 +271,12 @@ namespace myImplHelpers
 
         if (!pRet)
         {
-            String aName(rName);
-            xub_StrLen nPos = aName.Search(',');
+            OUString aName(rName);
+            sal_Int32 nIdx = rName.indexOf(',');
             // No commas allow in SW style names
-            if (STRING_NOTFOUND != nPos)
-                aName.Erase(nPos);
-            pRet = MakeNonCollidingStyle(aName);
+            if (-1 != nIdx)
+                aName = rName.copy( 0, nIdx );
+            pRet = MakeNonCollidingStyle( aName );
         }
 
         if (pRet)
@@ -453,7 +453,7 @@ namespace sw
         }
 
         ParaStyleMapper::StyleResult ParaStyleMapper::GetStyle(
-            const String& rName, ww::sti eSti)
+            const OUString& rName, ww::sti eSti)
         {
             return mpImpl->GetStyle(rName, eSti);
         }
@@ -469,7 +469,7 @@ namespace sw
         }
 
         CharStyleMapper::StyleResult CharStyleMapper::GetStyle(
-            const String& rName, ww::sti eSti)
+            const OUString& rName, ww::sti eSti)
         {
             return mpImpl->GetStyle(rName, eSti);
         }
@@ -746,7 +746,7 @@ namespace sw
             return nDT;
         }
 
-        sal_uLong MSDateTimeFormatToSwFormat(String& rParams,
+        sal_uLong MSDateTimeFormatToSwFormat(OUString& rParams,
             SvNumberFormatter *pFormatter, sal_uInt16 &rLang, bool bHijri,
             sal_uInt16 nDocLang)
         {
@@ -760,72 +760,66 @@ namespace sw
             rParams = sParams;
 
             // Force to Japanese when finding one of 'geaE'
-            OUString sJChars( "geE" );
-            bool bForceJapanese = ( STRING_NOTFOUND != rParams.SearchChar( sJChars.getStr() ) );
+            bool bForceJapanese = (-1 != rParams.indexOf('g')
+                || -1 != rParams.indexOf('e') || -1 != rParams.indexOf('E') );
             if ( bForceJapanese )
             {
-                rParams.SearchAndReplaceAll( OUString( "ee" ),
-                                             OUString( "yyyy" ) );
-                rParams.SearchAndReplaceAll( OUString( "EE" ),
-                                             OUString( "YYYY" ) );
+                rParams = rParams.replaceAll( "ee", "yyyy" ).replaceAll( "EE", "YYYY" );
             }
             if (LANGUAGE_FRENCH != nDocLang)
             {
                 // Handle the 'a' case here
-                xub_StrLen nLastPos = 0;
+                sal_Int32 nLastPos = 0;
                 do
                 {
-                    xub_StrLen nPos = rParams.Search( 'a', nLastPos + 1 );
-                    bForceJapanese |= ( nPos != STRING_NOTFOUND && IsNotAM( rParams, nPos ) );
+                    sal_Int32 nPos = rParams.indexOf( 'a', nLastPos + 1 );
+                    bForceJapanese |= ( nPos != -1 && IsNotAM( rParams, nPos ) );
                     nLastPos = nPos;
-                } while ( STRING_NOTFOUND != nLastPos );
+                } while ( -1 != nLastPos );
             }
 
             // Force to NatNum when finding one of 'oOA'
-            String sOldParams( rParams );
-            rParams.SearchAndReplaceAll( OUString( "o" ),
-                                         OUString( "m" ) );
-            rParams.SearchAndReplaceAll( OUString( "O" ),
-                                         OUString( "M" ) );
-            bool bForceNatNum = !sOldParams.Equals( rParams );
+            OUString sOldParams( rParams );
+            rParams = rParams.replaceAll( "o", "m" ).replaceAll( "O", "M" );
+            bool bForceNatNum = !sOldParams.equals( rParams );
             if (LANGUAGE_FRENCH != nDocLang)
             {
                 // Handle the 'A' case here
-                xub_StrLen nLastPos = 0;
+                sal_Int32 nLastPos = 0;
                 do
                 {
-                    xub_StrLen nPos = rParams.Search( 'A', nLastPos + 1 );
-                    bool bIsCharA = ( nPos != STRING_NOTFOUND && IsNotAM( rParams, nPos ) );
+                    sal_Int32 nPos = rParams.indexOf( 'A', nLastPos + 1 );
+                    bool bIsCharA = ( nPos != -1 && IsNotAM( rParams, nPos ) );
                     bForceNatNum |= bIsCharA;
                     if ( bIsCharA )
-                        rParams.SetChar( nPos, 'D' );
+                        rParams = rParams.replaceAt( nPos, 1, "D" );
                     nLastPos = nPos;
-                } while ( STRING_NOTFOUND != nLastPos );
+                } while ( -1 != nLastPos );
             }
 
-            xub_StrLen nLen = rParams.Len();
-            xub_StrLen nI = 0;
+            sal_Int32 nLen = rParams.getLength();
+            sal_Int32 nI = 0;
             while (nI < nLen)
             {
-                if (rParams.GetChar(nI) == '\\')
+                if (rParams[nI] == '\\')
                     nI++;
-                else if (rParams.GetChar(nI) == '\"')
+                else if (rParams[nI] == '\"')
                 {
                     ++nI;
                     //While not at the end and not at an unescaped end quote
-                    while ((nI < nLen) && (!(rParams.GetChar(nI) == '\"') && (rParams.GetChar(nI-1) != '\\')))
+                    while ((nI < nLen) && (!(rParams[nI] == '\"') && (rParams[nI-1] != '\\')))
                         ++nI;
                 }
                 else //normal unquoted section
                 {
-                    sal_Unicode nChar = rParams.GetChar(nI);
+                    sal_Unicode nChar = rParams[nI];
 
                     // Change the localized word string to english
                     switch ( nDocLang )
                     {
                         case LANGUAGE_FRENCH:
                             if ( ( nChar == 'a' || nChar == 'A' ) && IsNotAM(rParams, nI) )
-                                rParams.SetChar(nI, 'Y');
+                                rParams = rParams.replaceAt(nI, 1, "Y");
                             break;
                         default:
                             ;
@@ -836,7 +830,7 @@ namespace sw
                         // But not if it's a '/' inside AM/PM
                         if (!(IsPreviousAM(rParams, nI) && IsNextPM(rParams, nI)))
                         {
-                            rParams.Replace(nI, 1, OUString("\\/"));
+                            rParams = rParams.replaceAt(nI, 1, "\\/");
                         }
                         nI++;
                         nLen++;
@@ -854,13 +848,13 @@ namespace sw
                         case LANGUAGE_FINNISH:
                             {
                                 if (nChar == 'y' || nChar == 'Y')
-                                    rParams.SetChar (nI, 'V');
+                                    rParams = rParams.replaceAt(nI, 1, "V");
                                 else if (nChar == 'm' || nChar == 'M')
-                                    rParams.SetChar (nI, 'K');
+                                    rParams = rParams.replaceAt(nI, 1, "K");
                                 else if (nChar == 'd' || nChar == 'D')
-                                    rParams.SetChar (nI, 'P');
+                                    rParams = rParams.replaceAt(nI, 1, "P");
                                 else if (nChar == 'h' || nChar == 'H')
-                                    rParams.SetChar (nI, 'T');
+                                    rParams = rParams.replaceAt(nI, 1, "T");
                             }
                             break;
                         case LANGUAGE_DANISH:
@@ -871,7 +865,7 @@ namespace sw
                         case LANGUAGE_SWEDISH_FINLAND:
                             {
                                 if (nChar == 'h' || nChar == 'H')
-                                    rParams.SetChar (nI, 'T');
+                                    rParams = rParams.replaceAt(nI, 1, "T");
                             }
                             break;
                         case LANGUAGE_PORTUGUESE:
@@ -898,31 +892,31 @@ namespace sw
                         case LANGUAGE_SPANISH_PUERTO_RICO:
                             {
                                 if (nChar == 'a' || nChar == 'A')
-                                    rParams.SetChar (nI, 'O');
+                                    rParams = rParams.replaceAt(nI, 1, "O");
                                 else if (nChar == 'y' || nChar == 'Y')
-                                    rParams.SetChar (nI, 'A');
+                                    rParams = rParams.replaceAt(nI, 1, "A");
                             }
                             break;
                         case LANGUAGE_DUTCH:
                         case LANGUAGE_DUTCH_BELGIAN:
                             {
                                 if (nChar == 'y' || nChar == 'Y')
-                                    rParams.SetChar (nI, 'J');
+                                    rParams = rParams.replaceAt(nI, 1, "J");
                                 else if (nChar == 'u' || nChar == 'U')
-                                    rParams.SetChar (nI, 'H');
+                                    rParams = rParams.replaceAt(nI, 1, "H");
                             }
                             break;
                         case LANGUAGE_ITALIAN:
                         case LANGUAGE_ITALIAN_SWISS:
                             {
                                 if (nChar == 'a' || nChar == 'A')
-                                    rParams.SetChar (nI, 'O');
+                                    rParams = rParams.replaceAt(nI, 1, "O");
                                 else if (nChar == 'g' || nChar == 'G')
-                                    rParams.SetChar (nI, 'X');
+                                    rParams = rParams.replaceAt(nI, 1, "X");
                                 else if (nChar == 'y' || nChar == 'Y')
-                                    rParams.SetChar(nI, 'A');
+                                    rParams = rParams.replaceAt(nI, 1, "A");
                                 else if (nChar == 'd' || nChar == 'D')
-                                    rParams.SetChar (nI, 'G');
+                                    rParams = rParams.replaceAt(nI, 1, "G");
                             }
                             break;
                         case LANGUAGE_GERMAN:
@@ -932,9 +926,9 @@ namespace sw
                         case LANGUAGE_GERMAN_LIECHTENSTEIN:
                             {
                                 if (nChar == 'y' || nChar == 'Y')
-                                    rParams.SetChar (nI, 'J');
+                                    rParams = rParams.replaceAt(nI, 1, "J");
                                 else if (nChar == 'd' || nChar == 'D')
-                                    rParams.SetChar (nI, 'T');
+                                    rParams = rParams.replaceAt(nI, 1, "T");
                             }
                             break;
                         case LANGUAGE_FRENCH:
@@ -945,9 +939,9 @@ namespace sw
                         case LANGUAGE_FRENCH_MONACO:
                             {
                                 if (nChar == 'y' || nChar == 'Y' || nChar == 'a')
-                                    rParams.SetChar (nI, 'A');
+                                    rParams = rParams.replaceAt(nI, 1, "A");
                                 else if (nChar == 'd' || nChar == 'D' || nChar == 'j')
-                                    rParams.SetChar (nI, 'J');
+                                    rParams = rParams.replaceAt(nI, 1, "J");
                             }
                             break;
                         default:
@@ -967,10 +961,10 @@ namespace sw
                 rLang = LANGUAGE_JAPANESE;
 
             if (bForceNatNum)
-                rParams.Insert(OUString("[NatNum1][$-411]"),0);
+                rParams = "[NatNum1][$-411]" + rParams;
 
             if (bHijri)
-                rParams.Insert(OUString("[~hijri]"), 0);
+                rParams = "[~hijri]" + rParams;
 
             OUString sTemp(rParams);
             pFormatter->PutEntry(sTemp, nCheckPos, nType, nKey, rLang);
@@ -979,41 +973,40 @@ namespace sw
             return nKey;
         }
 
-        sal_Bool IsPreviousAM(String& rParams, xub_StrLen nPos){
-            xub_StrLen nPos1 = nPos - 1;
-            xub_StrLen nPos2 = nPos - 2;
+        sal_Bool IsPreviousAM(OUString& rParams, sal_Int32 nPos){
+            sal_uInt16 nPos1 = nPos - 1;
+            sal_uInt16 nPos2 = nPos - 2;
 
             if(nPos1 > nPos || nPos2 > nPos){
                 return sal_False;
             }else{
                 return (
-                    (rParams.GetChar(nPos1) == 'M'||rParams.GetChar(nPos1) == 'm')&&
-                    (rParams.GetChar(nPos2) == 'A'||rParams.GetChar(nPos2) == 'a')
+                    ( rParams[nPos1] == 'M' || rParams[nPos1] == 'm' ) &&
+                    ( rParams[nPos2] == 'A' || rParams[nPos2] == 'a' )
                     );
             }
         }
-        sal_Bool IsNextPM(String& rParams, xub_StrLen nPos){
-            xub_StrLen nPos1 = nPos + 1;
-            xub_StrLen nPos2 = nPos + 2;
+        sal_Bool IsNextPM(OUString& rParams, sal_Int32 nPos){
+            sal_Int32 nPos1 = nPos + 1;
+            sal_Int32 nPos2 = nPos + 2;
 
-
-            if(nPos1 >= rParams.Len() - 1 || nPos2 > rParams.Len() - 1){
+            if(nPos1 >= rParams.getLength() - 1 || nPos2 > rParams.getLength() - 1){
                 return sal_False;
             }else{
                 return (
-                    (rParams.GetChar(nPos1) == 'P'||rParams.GetChar(nPos1) == 'p')&&
-                    (rParams.GetChar(nPos2) == 'M'||rParams.GetChar(nPos2) == 'm')
+                    ( rParams[nPos1] == 'P' || rParams[nPos1] == 'p' ) &&
+                    ( rParams[nPos2] == 'M' || rParams[nPos2] == 'm' )
                     );
             }
 
         }
-        bool IsNotAM(String& rParams, xub_StrLen nPos)
+        bool IsNotAM(OUString& rParams, sal_Int32 nPos)
         {
             return (
-                    (nPos == rParams.Len() - 1) ||
+                    (nPos == rParams.getLength() - 1) ||
                     (
-                    (rParams.GetChar(nPos+1) != 'M') &&
-                    (rParams.GetChar(nPos+1) != 'm')
+                    (rParams[nPos+1] != 'M') &&
+                    (rParams[nPos+1] != 'm')
                     )
                 );
         }
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 56bfa43..53f754e 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1794,7 +1794,7 @@ public:     // eigentlich private, geht aber leider nur public
     void SetNAktColl( sal_uInt16 nColl ) { nAktColl = nColl;    }
     void SetAktItemSet( SfxItemSet* pItemSet ) { pAktItemSet = pItemSet; }
     sal_uInt16 StyleUsingLFO( sal_uInt16 nLFOIndex ) const ;
-    const SwFmt* GetStyleWithOrgWWName( String& rName ) const ;
+    const SwFmt* GetStyleWithOrgWWName( OUString& rName ) const ;
 
     static bool GetPictGrafFromStream(Graphic& rGraphic, SvStream& rSrc);
     static void PicRead( SvStream *pDataStream, WW8_PIC *pPic, bool bVer67);
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 955266e..79c0ab2 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -3542,14 +3542,14 @@ sal_uInt16 SwWW8ImplReader::StyleUsingLFO( sal_uInt16 nLFOIndex ) const
     return nRes;
 }
 
-const SwFmt* SwWW8ImplReader::GetStyleWithOrgWWName( String& rName ) const
+const SwFmt* SwWW8ImplReader::GetStyleWithOrgWWName( OUString& rName ) const
 {
     SwFmt* pRet = 0;
     if( !vColl.empty() )
     {
         for(sal_uInt16 nI = 0; nI < pStyles->GetCount(); nI++ )
             if(    vColl[ nI ].bValid
-                && (rName.Equals( vColl[ nI ].GetOrgWWName())) )
+                && (rName.equals( vColl[ nI ].GetOrgWWName())) )
             {
                 pRet = vColl[ nI ].pFmt;
                 break;
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index ff9bf59..556b5d7 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -593,8 +593,8 @@ short SwWW8ImplReader::GetTimeDatePara(OUString& rStr, sal_uInt32& rFormat,
     rLang = pLang ? pLang->GetValue() : LANGUAGE_ENGLISH_US;
 
     SvNumberFormatter* pFormatter = rDoc.GetNumberFormatter();
-    String sParams( FindPara( rStr, '@', '@' ) );// Date/Time
-    if (!sParams.Len())
+    OUString sParams( FindPara( rStr, '@', '@' ) );// Date/Time
+    if (sParams.isEmpty())
     {
         bool bHasTime = false;
         switch (nWhichDefault)
@@ -602,11 +602,11 @@ short SwWW8ImplReader::GetTimeDatePara(OUString& rStr, sal_uInt32& rFormat,
             case ww::ePRINTDATE:
             case ww::eSAVEDATE:
                 sParams = GetWordDefaultDateStringAsUS(pFormatter, rLang);
-                sParams.AppendAscii(" HH:MM:SS AM/PM");
+                sParams += " HH:MM:SS AM/PM";
                 bHasTime = true;
                 break;
             case ww::eCREATEDATE:
-                sParams.AssignAscii("DD/MM/YYYY HH:MM:SS");
+                sParams += "DD/MM/YYYY HH:MM:SS";
                 bHasTime = true;
                 break;
             default:
@@ -616,7 +616,7 @@ short SwWW8ImplReader::GetTimeDatePara(OUString& rStr, sal_uInt32& rFormat,
         }
 
         if (bHijri)
-            sParams.Insert(OUString("[~hijri]"), 0);
+            sParams = "[~hijri]" + sParams;
 
         sal_Int32 nCheckPos = 0;
         short nType = NUMBERFORMAT_DEFINED;
@@ -2964,7 +2964,7 @@ static void lcl_toxMatchTSwitch(SwWW8ImplReader& rReader, SwTOXBase& rBase,
 
             // Delimiters between styles and style levels appears to allow both ; and ,
 
-            String sTemplate( sParams.GetToken(0, ';', nIndex) );
+            OUString sTemplate( sParams.GetToken(0, ';', nIndex) );
             if( -1 == nIndex )
             {
                 nIndex=0;
diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx
index 97f5e95..2bc8280 100644
--- a/tools/source/string/tustring.cxx
+++ b/tools/source/string/tustring.cxx
@@ -59,30 +59,6 @@ sal_Int32 UniString::ToInt32() const
     return rtl_ustr_toInt32( mpData->maStr, 10 );
 }
 
-xub_StrLen STRING::SearchChar( const STRCODE* pChars, xub_StrLen nIndex ) const
-{
-    DBG_CHKTHIS( STRING, DBGCHECKSTRING );
-
-    sal_Int32       nLen = mpData->mnLen;
-    const STRCODE*  pStr = mpData->maStr;
-    pStr += nIndex;
-    while ( nIndex < nLen )
-    {
-        STRCODE         c = *pStr;
-        const STRCODE*  pCompStr = pChars;
-        while ( *pCompStr )
-        {
-            if ( *pCompStr == c )
-                return nIndex;
-            ++pCompStr;
-        }
-        ++pStr,
-        ++nIndex;
-    }
-
-    return STRING_NOTFOUND;
-}
-
 xub_StrLen STRING::SearchAndReplace( STRCODE c, STRCODE cRep, xub_StrLen nIndex )
 {
     DBG_CHKTHIS( STRING, DBGCHECKSTRING );


More information about the Libreoffice-commits mailing list