Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4247

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/47/4247/1

String->OUString few more from unotools

Change-Id: Iaac38fbf5158b2912aa1e6115c0fe693bdbebe48
---
M basic/source/runtime/runtime.cxx
M desktop/source/migration/migration.cxx
M desktop/source/migration/services/oo3extensionmigration.cxx
M forms/source/xforms/computedexpression.cxx
M include/unotools/fontcfg.hxx
M include/unotools/fontcvt.hxx
M include/unotools/fontdefs.hxx
M include/unotools/textsearch.hxx
M reportdesign/source/ui/inspection/GeometryHandler.cxx
M sc/source/core/data/dpcache.cxx
M svx/source/dialog/ctredlin.cxx
M sw/source/core/crsr/findtxt.cxx
M unotools/source/config/fontcfg.cxx
M unotools/source/config/securityoptions.cxx
M unotools/source/i18n/localedatawrapper.cxx
M unotools/source/misc/fontcvt.cxx
M unotools/source/misc/fontdefs.cxx
M vcl/inc/outdev.h
M vcl/source/gdi/font.cxx
M vcl/source/gdi/outdev3.cxx
20 files changed, 166 insertions(+), 171 deletions(-)



diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 4c2ffa9..ed731f1 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -1583,8 +1583,8 @@
     }
     SbxVariable* pRes = new SbxVariable;
     utl::TextSearch aSearch(aSearchOpt);
-    sal_uInt16 nStart=0, nEnd=value.getLength();
-    int bRes = aSearch.SearchFrwrd(value, &nStart, &nEnd);
+    sal_Int32 nStart=0, nEnd=value.getLength();
+    int bRes = aSearch.SearchForward(value, &nStart, &nEnd);
     pRes->PutBool( bRes != 0 );
 
     PushVar( pRes );
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx
index 2b36113..932c9fb 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -647,12 +647,12 @@
         SearchParam param(*i_pat, SearchParam::SRCH_REGEXP);
         TextSearch ts(param, LANGUAGE_DONTKNOW);
         i_set = vSet.begin();
-        xub_StrLen start = 0;
-        xub_StrLen end = 0;
+        sal_Int32 start = 0;
+        sal_Int32 end = 0;
         while (i_set != vSet.end())
         {
-            end = (xub_StrLen)(i_set->getLength());
-            if (ts.SearchFrwrd(*i_set, &start, &end))
+            end = i_set->getLength();
+            if (ts.SearchForward(*i_set, &start, &end))
                 vrResult->push_back(*i_set);
             ++i_set;
         }
diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx 
b/desktop/source/migration/services/oo3extensionmigration.cxx
index 75590a8..ff969be 100644
--- a/desktop/source/migration/services/oo3extensionmigration.cxx
+++ b/desktop/source/migration/services/oo3extensionmigration.cxx
@@ -287,9 +287,9 @@
             utl::SearchParam param(m_aBlackList[i], utl::SearchParam::SRCH_REGEXP);
             utl::TextSearch  ts(param, LANGUAGE_DONTKNOW);
 
-            xub_StrLen start = 0;
-            xub_StrLen end   = static_cast<sal_uInt16>(sDescriptionXmlURL.getLength());
-            if (ts.SearchFrwrd(sDescriptionXmlURL, &start, &end))
+            sal_Int32 start = 0;
+            sal_Int32 end   = static_cast<sal_uInt16>(sDescriptionXmlURL.getLength());
+            if (ts.SearchForward(sDescriptionXmlURL, &start, &end))
                 return false;
         }
     }
diff --git a/forms/source/xforms/computedexpression.cxx b/forms/source/xforms/computedexpression.cxx
index 184d91c..a2b7932 100644
--- a/forms/source/xforms/computedexpression.cxx
+++ b/forms/source/xforms/computedexpression.cxx
@@ -95,11 +95,10 @@
     aSearchOptions.searchString = String( pExpression, RTL_TEXTENCODING_ASCII_US );
     utl::TextSearch aTextSearch( aSearchOptions );
 
-    xub_StrLen nLength =
-        static_cast<xub_StrLen>( msExpression.getLength() );
-    xub_StrLen nStart = 0;
-    xub_StrLen nEnd = nLength;
-    int nSearch = aTextSearch.SearchFrwrd( msExpression, &nStart, &nEnd );
+    sal_Int32 nLength = msExpression.getLength();
+    sal_Int32 nStart = 0;
+    sal_Int32 nEnd = nLength;
+    int nSearch = aTextSearch.SearchForward( msExpression, &nStart, &nEnd );
 
     // our expression is static only if 1) we found our regexp, and 2)
     // the regexp goes from beginning to end.
diff --git a/include/unotools/fontcfg.hxx b/include/unotools/fontcfg.hxx
index 23ea551..ef9f6a7 100644
--- a/include/unotools/fontcfg.hxx
+++ b/include/unotools/fontcfg.hxx
@@ -154,11 +154,11 @@
 
 struct UNOTOOLS_DLLPUBLIC FontNameAttr
 {
-    String                              Name;
-    ::std::vector< String >             Substitutions;
-    ::std::vector< String >             MSSubstitutions;
-    ::std::vector< String >             PSSubstitutions;
-    ::std::vector< String >             HTMLSubstitutions;
+    OUString                            Name;
+    ::std::vector< OUString >           Substitutions;
+    ::std::vector< OUString >           MSSubstitutions;
+    ::std::vector< OUString >           PSSubstitutions;
+    ::std::vector< OUString >           HTMLSubstitutions;
     FontWeight                          Weight;
     FontWidth                           Width;
     unsigned long                       Type; // bitfield of IMPL_FONT_ATTR_*
@@ -190,7 +190,7 @@
 
     void fillSubstVector( const com::sun::star::uno::Reference< 
com::sun::star::container::XNameAccess > xFont,
                           const OUString& rType,
-                          std::vector< String >& rSubstVector ) const;
+                          std::vector< OUString >& rSubstVector ) const;
     FontWeight getSubstWeight( const com::sun::star::uno::Reference< 
com::sun::star::container::XNameAccess > xFont,
                           const OUString& rType ) const;
     FontWidth getSubstWidth( const com::sun::star::uno::Reference< 
com::sun::star::container::XNameAccess > xFont,
@@ -205,13 +205,13 @@
     static FontSubstConfiguration& get();
 
     const FontNameAttr* getSubstInfo(
-                                     const String& rFontName,
+                                     const OUString& rFontName,
                                      const com::sun::star::lang::Locale& rLocale =
                                      com::sun::star::lang::Locale( OUString( "en" ),
                                                                    OUString(),
                                                                    OUString() )
                                      ) const;
-    static void getMapName( const String& rOrgName, String& rShortName, String& rFamilyName, 
FontWeight& rWeight, FontWidth& rWidth, sal_uLong& rType );
+    static void getMapName( const OUString& rOrgName, OUString& rShortName, OUString& rFamilyName, 
FontWeight& rWeight, FontWidth& rWidth, sal_uLong& rType );
 };
 
 } // namespace utl
diff --git a/include/unotools/fontcvt.hxx b/include/unotools/fontcvt.hxx
index 6386e61..004215c 100644
--- a/include/unotools/fontcvt.hxx
+++ b/include/unotools/fontcvt.hxx
@@ -32,10 +32,10 @@
 #define FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS     ((sal_uLong)0x00000004)
 
 typedef void* FontToSubsFontConverter;
-UNOTOOLS_DLLPUBLIC FontToSubsFontConverter     CreateFontToSubsFontConverter( const String& 
rFontName, sal_uLong nFlags );
+UNOTOOLS_DLLPUBLIC FontToSubsFontConverter     CreateFontToSubsFontConverter( const OUString& 
rFontName, sal_uLong nFlags );
 UNOTOOLS_DLLPUBLIC void                        DestroyFontToSubsFontConverter( 
FontToSubsFontConverter hConverter );
 UNOTOOLS_DLLPUBLIC sal_Unicode                 ConvertFontToSubsFontChar( FontToSubsFontConverter 
hConverter, sal_Unicode c );
-UNOTOOLS_DLLPUBLIC String                      GetFontToSubsFontName( FontToSubsFontConverter 
hConverter );
+UNOTOOLS_DLLPUBLIC OUString                    GetFontToSubsFontName( FontToSubsFontConverter 
hConverter );
 
 // ---------------------------
 // - StarSymbolToMSMultiFont -
@@ -48,7 +48,7 @@
     //mapped to. Sets rChar to the correct position for that font. If no
     //match found, then no name is returned, and rChar is unchanged. If you
     //want to convert a string, you don't want to use this.
-    virtual String ConvertChar(sal_Unicode &rChar) = 0;
+    virtual OUString ConvertChar(sal_Unicode &rChar) = 0;
 
     //Starts converting the string at position rIndex. It converts as much of
     //the string that can be converted to the same symbol font and returns the
@@ -57,7 +57,7 @@
     //rString.Len() and handle each section as separate 8bit strings using
     //separate fonts. Will return an empty string for a continous section
     //that has no possible mapping.
-    virtual String ConvertString(String &rString, xub_StrLen &rIndex) = 0;
+    virtual OUString ConvertString(OUString& rString, sal_Int32& rIndex) = 0;
     virtual ~StarSymbolToMSMultiFont() {}
 };
 
@@ -67,7 +67,7 @@
 //recognizably similar. Even in this mode there will be characters that fail.
 //The users of this might want to make a distinction between failed characters
 //which were inside and those outside the unicode private area.
-UNOTOOLS_DLLPUBLIC StarSymbolToMSMultiFont *CreateStarSymbolToMSMultiFont(bool bPerfectOnly=false);
+UNOTOOLS_DLLPUBLIC StarSymbolToMSMultiFont* CreateStarSymbolToMSMultiFont(bool bPerfectOnly=false);
 #endif // _UNOTOOLS_FONTCVT_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/fontdefs.hxx b/include/unotools/fontdefs.hxx
index e57abd4..d46c8e2 100644
--- a/include/unotools/fontdefs.hxx
+++ b/include/unotools/fontdefs.hxx
@@ -43,7 +43,7 @@
 
 UNOTOOLS_DLLPUBLIC void AddTokenFontName( OUString& rName, const OUString& rNewToken );
 
-struct UNOTOOLS_DLLPUBLIC FontNameHash { int operator()(const String&) const; };
+struct UNOTOOLS_DLLPUBLIC FontNameHash { int operator()(const OUString&) const; };
 
 // ---------------
 // - ConvertChar -
@@ -57,7 +57,7 @@
     sal_Unicode         (*mpCvtFunc)( sal_Unicode );
     sal_Unicode         RecodeChar( sal_Unicode c ) const;
     void                RecodeString( OUString& rStra, sal_Int32 nIndex, sal_Int32 nLen ) const;
-    static const ConvertChar* GetRecodeData( const String& rOrgFontName, const String& 
rMapFontName );
+    static const ConvertChar* GetRecodeData( const OUString& rOrgFontName, const OUString& 
rMapFontName );
 };
 
 
diff --git a/include/unotools/textsearch.hxx b/include/unotools/textsearch.hxx
index 0b82610..f26d150 100644
--- a/include/unotools/textsearch.hxx
+++ b/include/unotools/textsearch.hxx
@@ -52,8 +52,8 @@
     enum SearchType{ SRCH_NORMAL, SRCH_REGEXP, SRCH_LEVDIST };
 
 private:
-    String sSrchStr;            // the search string
-    String sReplaceStr;         // the replace string
+    OUString sSrchStr;            // the search string
+    OUString sReplaceStr;         // the replace string
 
     SearchType m_eSrchType;       // search normal/regular/LevDist
 
@@ -81,8 +81,8 @@
 
     ~SearchParam();
 
-    const String&   GetSrchStr() const          { return sSrchStr; }
-    const String&   GetReplaceStr() const       { return sReplaceStr; }
+    const OUString&   GetSrchStr() const          { return sSrchStr; }
+    const OUString&   GetReplaceStr() const       { return sReplaceStr; }
     SearchType      GetSrchType() const         { return m_eSrchType; }
 
     int             IsCaseSensitive() const     { return m_bCaseSense; }
@@ -90,8 +90,8 @@
     int             IsSrchWordOnly() const      { return m_bWordOnly; }
 
 
-    void SetSrchStr( const String& rStr )       { sSrchStr = rStr; }
-    void SetReplaceStr( const String& rStr )    { sReplaceStr = rStr; }
+    void SetSrchStr( const OUString& rStr )       { sSrchStr = rStr; }
+    void SetReplaceStr( const OUString& rStr )    { sReplaceStr = rStr; }
     void SetSrchType( SearchType eType )        { m_eSrchType = eType; }
 
     void SetCaseSensitive( int bFlag )          { m_bCaseSense = bFlag; }
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx 
b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index 3c9339b..5831490 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -1871,15 +1871,15 @@
         {
             aSearchOptions.searchString = aIter->m_sSearchString;
             utl::TextSearch aTextSearch(aSearchOptions);
-            xub_StrLen start = 0;
-            xub_StrLen end = sFormula.Len();
-            if ( aTextSearch.SearchFrwrd(sFormula,&start,&end) && start == 0 && end == 
sFormula.Len()) // default function found
+            sal_Int32 start = 0;
+            sal_Int32 end = (sal_Int32)sFormula.Len();
+            if ( aTextSearch.SearchForward(sFormula, &start, &end) && start == 0 && end == 
(sal_Int32)sFormula.Len()) // default function found
             {
                 aSearchOptions.searchString = OUString("\\[[:alpha:]+([:space:]*[:alnum:]*)*\\]");
                 utl::TextSearch aDataSearch(aSearchOptions);
-                aDataSearch.SearchFrwrd(sFormula,&start,&end );
+                aDataSearch.SearchForward(sFormula, &start, &end );
                 ++start;
-                _rDataField = sFormula.Copy(start,end-start-1);
+                _rDataField = sFormula.Copy(start, end-start-1);
                 _rsDefaultFunctionName = aIter->m_sName;
                 break;
             }
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 17ab695..6f112d6 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -534,13 +534,13 @@
             bool bTestRegExp = false;
             if (bRealRegExp || bTestRegExp)
             {
-                xub_StrLen nStart = 0;
-                xub_StrLen nEnd   = aCellStr.Len();
+                sal_Int32 nStart = 0;
+                sal_Int32 nEnd   = (sal_Int32)aCellStr.Len();
                 bool bMatch = (bool) rEntry.GetSearchTextPtr( rParam.bCaseSens )
-                              ->SearchFrwrd( aCellStr, &nStart, &nEnd );
+                              ->SearchForward( aCellStr, &nStart, &nEnd );
                 // from 614 on, nEnd is behind the found text
                 if (bMatch && bMatchWholeCell
-                    && (nStart != 0 || nEnd != aCellStr.Len()))
+                    && (nStart != 0 || nEnd != (sal_Int32)aCellStr.Len()))
                     bMatch = false;    // RegExp must match entire cell string
                 if (bRealRegExp)
                     bOk = ((rEntry.eOp == SC_NOT_EQUAL) ? !bMatch : bMatch);
diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx
index b201d8d..09a56de 100644
--- a/svx/source/dialog/ctredlin.cxx
+++ b/svx/source/dialog/ctredlin.cxx
@@ -324,10 +324,10 @@
     }
     if(bComment && nTheFlag)
     {
-        xub_StrLen nStartPos = 0;
-        xub_StrLen nEndPos = pCommentStr->Len();
+        sal_Int32 nStartPos = 0;
+        sal_Int32 nEndPos = (sal_Int32)pCommentStr->Len();
 
-        nTheFlag=pCommentSearcher->SearchFrwrd( *pCommentStr, &nStartPos, &nEndPos);
+        nTheFlag=pCommentSearcher->SearchForward( *pCommentStr, &nStartPos, &nEndPos);
     }
     return nTheFlag;
 }
@@ -362,10 +362,10 @@
 
     if(bComment)
     {
-        xub_StrLen nStartPos = 0;
-        xub_StrLen nEndPos = pCommentStr->Len();
+        sal_Int32 nStartPos = 0;
+        sal_Int32 nEndPos = (sal_Int32)pCommentStr->Len();
 
-        nTheFlag=pCommentSearcher->SearchFrwrd( *pCommentStr, &nStartPos, &nEndPos);
+        nTheFlag=pCommentSearcher->SearchForward( *pCommentStr, &nStartPos, &nEndPos);
     }
     return nTheFlag;
 }
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 92f1249..6c2359f 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -664,10 +664,10 @@
         {
             utl::TextSearch aSTxt( rSearchOpt );
             const String& rStr = static_cast<const SwTxtNode*>(pTxtNode)->GetTxt();
-            xub_StrLen nStart = pPam->Start()->nContent.GetIndex();
-            xub_StrLen nEnd = pPam->End()->nContent.GetIndex();
+            sal_Int32 nStart = (sal_Int32)pPam->Start()->nContent.GetIndex();
+            sal_Int32 nEnd = (sal_Int32)pPam->End()->nContent.GetIndex();
             SearchResult aResult;
-            if( aSTxt.SearchFrwrd( rStr, &nStart, &nEnd, &aResult ) )
+            if( aSTxt.SearchForward( rStr, &nStart, &nEnd, &aResult ) )
             {
                 String aReplaceStr( rSearchOpt.replaceString );
                 aSTxt.ReplaceBackReferences( aReplaceStr, rStr, aResult );
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx
index 9da6e05..3d08aac 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -649,12 +649,12 @@
 
 // -----------------------------------------------------------------------
 
-static bool ImplKillLeading( String& rName, const char* const* ppStr )
+static bool ImplKillLeading( OUString& rName, const char* const* ppStr )
 {
     for(; *ppStr; ++ppStr )
     {
         const char*         pStr = *ppStr;
-        const sal_Unicode*  pNameStr = rName.GetBuffer();
+        const sal_Unicode*  pNameStr = rName.getStr();
         while ( (*pNameStr == (sal_Unicode)(unsigned char)*pStr) && *pStr )
         {
             pNameStr++;
@@ -662,19 +662,19 @@
         }
         if ( !*pStr )
         {
-            xub_StrLen nLen = sal::static_int_cast<xub_StrLen>(pNameStr - rName.GetBuffer());
-            rName.Erase( 0, nLen );
+            sal_Int32 nLen = sal_Int32(pNameStr - rName.getStr());
+            rName = rName.copy( nLen );
             return true;
         }
     }
 
     // special case for Baekmuk
     // TODO: allow non-ASCII KillLeading list
-    const sal_Unicode* pNameStr = rName.GetBuffer();
+    const sal_Unicode* pNameStr = rName.getStr();
     if( (pNameStr[0]==0xBC31) && (pNameStr[1]==0xBC35) )
     {
-        xub_StrLen nLen = (pNameStr[2]==0x0020) ? 3 : 2;
-        rName.Erase( 0, nLen );
+        sal_Int32 nLen = (pNameStr[2]==0x0020) ? 3 : 2;
+        rName = rName.copy( nLen );
         return true;
     }
 
@@ -683,13 +683,13 @@
 
 // -----------------------------------------------------------------------
 
-static xub_StrLen ImplIsTrailing( const String& rName, const char* pStr )
+static sal_Int32 ImplIsTrailing( const OUString& rName, const char* pStr )
 {
-    xub_StrLen nStrLen = static_cast<xub_StrLen>( strlen( pStr ) );
-    if( nStrLen >= rName.Len() )
+    sal_Int32 nStrLen = strlen( pStr );
+    if( nStrLen >= rName.getLength() )
         return 0;
 
-    const sal_Unicode* pEndName = rName.GetBuffer() + rName.Len();
+    const sal_Unicode* pEndName = rName.getStr() + rName.getLength();
     const sal_Unicode* pNameStr = pEndName - nStrLen;
     do if( *(pNameStr++) != *(pStr++) )
         return 0;
@@ -700,14 +700,14 @@
 
 // -----------------------------------------------------------------------
 
-static bool ImplKillTrailing( String& rName, const char* const* ppStr )
+static bool ImplKillTrailing( OUString& rName, const char* const* ppStr )
 {
     for(; *ppStr; ++ppStr )
     {
-        xub_StrLen nTrailLen = ImplIsTrailing( rName, *ppStr );
+        sal_Int32 nTrailLen = ImplIsTrailing( rName, *ppStr );
         if( nTrailLen )
         {
-            rName.Erase( rName.Len()-nTrailLen );
+            rName = rName.copy(0,  rName.getLength()-nTrailLen );
             return true;
         }
     }
@@ -717,11 +717,11 @@
 
 // -----------------------------------------------------------------------
 
-static bool ImplKillTrailingWithExceptions( String& rName, const char* const* ppStr )
+static bool ImplKillTrailingWithExceptions( OUString& rName, const char* const* ppStr )
 {
     for(; *ppStr; ++ppStr )
     {
-        xub_StrLen nTrailLen = ImplIsTrailing( rName, *ppStr );
+        sal_Int32 nTrailLen = ImplIsTrailing( rName, *ppStr );
         if( nTrailLen )
         {
             // check string match against string exceptions
@@ -729,7 +729,7 @@
                 if( ImplIsTrailing( rName, *ppStr ) )
                     return false;
 
-            rName.Erase( rName.Len()-nTrailLen );
+            rName = rName.copy(0, rName.getLength()-nTrailLen );
             return true;
         }
         else
@@ -744,23 +744,25 @@
 
 // -----------------------------------------------------------------------
 
-static sal_Bool ImplFindAndErase( String& rName, const char* pStr )
+static bool ImplFindAndErase( OUString& rName, const char* pStr )
 {
-    xub_StrLen nPos = rName.SearchAscii( pStr );
-    if ( nPos == STRING_NOTFOUND )
+    sal_Int32 nPos = rName.indexOfAsciiL( pStr, strlen(pStr) );
+    if ( nPos < 0)
         return sal_False;
 
     const char* pTempStr = pStr;
     while ( *pTempStr )
         pTempStr++;
-    rName.Erase( nPos, (xub_StrLen)(pTempStr-pStr) );
+    OUStringBuffer sBuff(rName);
+    sBuff.remove(nPos, (sal_Int32)(pTempStr - pStr));
+    rName = sBuff.makeStringAndClear();
     return sal_True;
 }
 
 // =======================================================================
 
-void FontSubstConfiguration::getMapName( const String& rOrgName, String& rShortName,
-    String& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, sal_uLong& rType )
+void FontSubstConfiguration::getMapName( const OUString& rOrgName, OUString& rShortName,
+    OUString& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, sal_uLong& rType )
 {
     rShortName = rOrgName;
 
@@ -815,14 +817,16 @@
 
     // Remove numbers
     // TODO: also remove localized and fullwidth digits
-    xub_StrLen i = 0;
-    while ( i < rFamilyName.Len() )
+    sal_Int32 i = 0;
+    OUStringBuffer sBuff(rFamilyName.getLength());
+    while ( i < rFamilyName.getLength() )
     {
-        sal_Unicode c = rFamilyName.GetChar( i );
-        if ( (c >= 0x0030) && (c <= 0x0039) )
-            rFamilyName.Erase( i, 1 );
-        else
-            i++;
+        sal_Unicode c = rFamilyName[i];
+        if (!( (c >= 0x0030) && (c <= 0x0039)) )
+        {
+            sBuff.append(c);
+        }
+        i++;
     }
 }
 
@@ -830,7 +834,7 @@
 struct StrictStringSort : public ::std::binary_function< const FontNameAttr&, const FontNameAttr&, 
bool >
 {
     bool operator()( const FontNameAttr& rLeft, const FontNameAttr& rRight )
-    { return rLeft.Name.CompareTo( rRight.Name ) == COMPARE_LESS ; }
+    { return rLeft.Name.compareTo( rRight.Name ) < 0 ; }
 };
 
 static const char* const pAttribNames[] =
@@ -910,7 +914,7 @@
 
 void FontSubstConfiguration::fillSubstVector( const com::sun::star::uno::Reference< XNameAccess > 
xFont,
                                               const OUString& rType,
-                                              std::vector< String >& rSubstVector ) const
+                                              std::vector< OUString >& rSubstVector ) const
 {
     try
     {
@@ -1137,15 +1141,14 @@
     }
 }
 
-const FontNameAttr* FontSubstConfiguration::getSubstInfo( const String& rFontName, const Locale& 
rLocale ) const
+const FontNameAttr* FontSubstConfiguration::getSubstInfo( const OUString& rFontName, const Locale& 
rLocale ) const
 {
-    if( !rFontName.Len() )
+    if( rFontName.isEmpty() )
         return NULL;
 
     // search if a  (language dep.) replacement table for the given font exists
     // fallback is english
-    String aSearchFont( rFontName );
-    aSearchFont.ToLowerAscii();
+    OUString aSearchFont( rFontName.toAsciiLowerCase() );
     FontNameAttr aSearchAttr;
     aSearchAttr.Name = aSearchFont;
 
@@ -1172,8 +1175,8 @@
                 const FontNameAttr& rFoundAttr = *it;
                 // a search for "abcblack" may match with an entry for "abc"
                 // the reverse is not a good idea (e.g. #i112731# alba->albani)
-                if( rFoundAttr.Name.Len() <= aSearchFont.Len() )
-                    if( aSearchFont.CompareTo( rFoundAttr.Name, rFoundAttr.Name.Len() ) == 
COMPARE_EQUAL )
+                if( rFoundAttr.Name.getLength() <= aSearchFont.getLength() )
+                    if( aSearchFont.indexOf( rFoundAttr.Name ) >= 0 )
                         return &rFoundAttr;
             }
         }
diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx
index cd0e6c7..00ff19c 100644
--- a/unotools/source/config/securityoptions.cxx
+++ b/unotools/source/config/securityoptions.cxx
@@ -704,9 +704,8 @@
                     sal_Int32   nCnt = m_seqTrustedAuthors.getLength();
                     if( nCnt )
                     {
-                        String  s;
-                        s.AppendAscii( CSTR_MACRO_TRUSTEDAUTHORS );
-                        s.AppendAscii( "/a" );
+                        OUString  s(CSTR_MACRO_TRUSTEDAUTHORS );
+                        s += "/a" ;
 
                         Sequence< Sequence< com::sun::star::beans::PropertyValue > > 
lPropertyValuesSeq( nCnt );
                         for( sal_Int32 i = 0 ; i < nCnt ; ++i )
@@ -908,7 +907,7 @@
             }
 
             if ( !bState )
-                bState = sRef.compareToAscii("private:user") == COMPARE_EQUAL;
+                bState = sRef.compareToAscii("private:user") == 0;
         }
     }
 
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 82b55c1..e05e78a 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -672,7 +672,7 @@
                         p = pStop;
                 break;
                 default:
-                    if (!nInSection && nSym == -1 && String(rCode).Equals( aCurrSymbol, 
(xub_StrLen)(p-pStr), aCurrSymbol.getLength()))
+                    if (!nInSection && nSym == -1 && rCode.compareTo( aCurrSymbol, 
(sal_Int32)(p-pStr)) == 0)
                     {   // currency symbol not surrounded by [$...]
                         nSym = p - pStr;
                         if (nBlank == -1 && pStr < p && *(p-1) == ' ')
@@ -1423,14 +1423,15 @@
 
 
 OUString LocaleDataWrapper::getLongDate( const Date& rDate, CalendarWrapper& rCal,
-        sal_Int16 nDisplayDayOfWeek, sal_Bool bDayOfMonthWithLeadingZero,
-        sal_Int16 nDisplayMonth, sal_Bool bTwoDigitYear ) const
+                                         sal_Int16 nDisplayDayOfWeek,
+                                         sal_Bool bDayOfMonthWithLeadingZero,
+                                         sal_Int16 nDisplayMonth, sal_Bool bTwoDigitYear ) const
 {
     ::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical );
     using namespace ::com::sun::star::i18n;
     sal_Unicode     aBuf[20];
     sal_Unicode*    pBuf;
-    String aStr;
+    OUString aStr;
     sal_Int16 nVal;
     rCal.setGregorianDateTime( rDate );
     // day of week
@@ -1454,26 +1455,14 @@
     // concatenate
     switch ( getLongDateFormat() )
     {
-        case DMY :
-            aStr += aDay;
-            aStr += getLongDateDaySep();
-            aStr += aMonth;
-            aStr += getLongDateMonthSep();
-            aStr += aYear;
+    case DMY :
+        aStr += aDay + getLongDateDaySep() + aMonth + getLongDateMonthSep() + aYear;
         break;
-        case MDY :
-            aStr += aMonth;
-            aStr += getLongDateMonthSep();
-            aStr += aDay;
-            aStr += getLongDateDaySep();
-            aStr += aYear;
+    case MDY :
+        aStr += aMonth + getLongDateMonthSep() + aDay + getLongDateDaySep() + aYear;
         break;
-        default:    // YMD
-            aStr += aYear;
-            aStr += getLongDateYearSep();
-            aStr += aMonth;
-            aStr += getLongDateMonthSep();
-            aStr += aDay;
+    default:    // YMD
+        aStr += aYear + getLongDateYearSep() + aMonth + getLongDateMonthSep() + aDay;
     }
     return aStr;
 }
diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx
index 2b44624..0192067 100644
--- a/unotools/source/misc/fontcvt.cxx
+++ b/unotools/source/misc/fontcvt.cxx
@@ -1049,8 +1049,8 @@
     ::std::multimap<sal_Unicode, SymbolEntry> maMagicMap;
 public:
     StarSymbolToMSMultiFontImpl(bool bPerfectOnly);
-    String ConvertChar(sal_Unicode &rChar);
-    String ConvertString(String &rString, xub_StrLen& rIndex);
+    OUString ConvertChar(sal_Unicode &rChar);
+    OUString ConvertString(OUString &rString, sal_Int32& rIndex);
 };
 
 struct ExtraTable { sal_Unicode cStar; sal_uInt8 cMS;};
@@ -1237,9 +1237,9 @@
     return *ppName;
 }
 
-String StarSymbolToMSMultiFontImpl::ConvertChar(sal_Unicode &rChar)
+OUString StarSymbolToMSMultiFontImpl::ConvertChar(sal_Unicode &rChar)
 {
-    String sRet;
+    OUString sRet;
 
     ::std::multimap<sal_Unicode, SymbolEntry>::const_iterator aResult =
         maMagicMap.find(rChar);
@@ -1247,32 +1247,33 @@
     if (aResult != maMagicMap.end())
     {
         const SymbolEntry &rEntry = (*aResult).second;
-        sRet.AssignAscii(SymbolFontToString(rEntry.eFont));
+        const char* pc = SymbolFontToString(rEntry.eFont);
+        sRet = OUString(pc, strlen(pc),  RTL_TEXTENCODING_ASCII_US );
         rChar = rEntry.cIndex;
     }
 
     return sRet;
 }
 
-String StarSymbolToMSMultiFontImpl::ConvertString(String &rString,
-    xub_StrLen& rIndex)
+OUString StarSymbolToMSMultiFontImpl::ConvertString(OUString &rString,
+                                                  sal_Int32& rIndex)
 {
     typedef ::std::multimap<sal_Unicode, SymbolEntry>::iterator MI;
     typedef ::std::pair<MI, MI> Result;
 
-    String sRet;
+    OUString sRet;
 
-    xub_StrLen nLen = rString.Len();
+    sal_Int32 nLen = rString.getLength();
     if (rIndex >= nLen)
         return sRet;
 
     int nTotal = 0, nResult = 0;
     ::std::vector<Result> aPossibilities;
     aPossibilities.reserve(nLen - rIndex);
-    xub_StrLen nStart = rIndex;
+    sal_Int32 nStart = rIndex;
     do
     {
-        Result aResult = maMagicMap.equal_range(rString.GetChar(rIndex));
+        Result aResult = maMagicMap.equal_range(rString[rIndex]);
         int nBitfield = 0;
         for (MI aIndex = aResult.first; aIndex != aResult.second; ++aIndex)
             nBitfield |= aIndex->second.eFont;
@@ -1304,10 +1305,12 @@
             else
                 break;
         }
-        sRet.AssignAscii(SymbolFontToString(nI));
+        const char* pc = SymbolFontToString(nI);
+        sRet = OUString(pc, strlen(pc),  RTL_TEXTENCODING_ASCII_US );
 
-        xub_StrLen nSize = sal::static_int_cast<xub_StrLen>(aPossibilities.size());
-        for(xub_StrLen nPos = 0; nPos < nSize; ++nPos)
+        sal_Int32 nSize = aPossibilities.size();
+        OUStringBuffer sBuff(rString);
+        for(sal_Int32 nPos = 0; nPos < nSize; ++nPos)
         {
             const Result &rResult = aPossibilities[nPos];
 
@@ -1315,11 +1318,12 @@
             {
                 if (aIndex->second.eFont == nI)
                 {
-                    rString.SetChar(nPos+nStart, aIndex->second.cIndex);
+                    sBuff[nPos+nStart] = aIndex->second.cIndex;
                     break;
                 }
             }
         }
+        rString = sBuff.makeStringAndClear();
     }
 
     return sRet;
@@ -1432,7 +1436,7 @@
 
 // -----------------------------------------------------------------------
 
-const ConvertChar* ConvertChar::GetRecodeData( const String& rOrgFontName, const String& 
rMapFontName )
+const ConvertChar* ConvertChar::GetRecodeData( const OUString& rOrgFontName, const OUString& 
rMapFontName )
 {
     const ConvertChar* pCvt = NULL;
     OUString aOrgName( rOrgFontName );
@@ -1479,7 +1483,7 @@
 //=======================================================================
 
 FontToSubsFontConverter CreateFontToSubsFontConverter(
-    const String& rOrgName, sal_uLong nFlags )
+        const OUString& rOrgName, sal_uLong nFlags )
 {
     const ConvertChar* pCvt = NULL;
 
@@ -1529,10 +1533,10 @@
 
 // -----------------------------------------------------------------------
 
-String GetFontToSubsFontName( FontToSubsFontConverter hConverter )
+OUString GetFontToSubsFontName( FontToSubsFontConverter hConverter )
 {
     if ( !hConverter )
-        return String();
+        return OUString();
 
     const char* pName = ((ConvertChar*)hConverter)->mpSubsFontName;
     return OUString::createFromAscii( pName );
diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx
index b81a5b3..9180e5b 100644
--- a/unotools/source/misc/fontdefs.cxx
+++ b/unotools/source/misc/fontdefs.cxx
@@ -485,7 +485,7 @@
 
 // =======================================================================
 
-static bool ImplIsFontToken( const OUString& rName, const String& rToken )
+static bool ImplIsFontToken( const OUString& rName, const OUString& rToken )
 {
     OUString      aTempName;
     sal_Int32  nIndex = 0;
@@ -502,7 +502,7 @@
 
 // -----------------------------------------------------------------------
 
-static void ImplAppendFontToken( OUString& rName, const String& rNewToken )
+static void ImplAppendFontToken( OUString& rName, const OUString& rNewToken )
 {
     if ( !rName.isEmpty() )
     {
@@ -539,7 +539,7 @@
     {
         for( int i = 0; i < 3; i++ )
         {
-            const ::std::vector< String >* pVector = NULL;
+            const ::std::vector< OUString >* pVector = NULL;
             switch( i )
             {
                 case 0:
@@ -557,7 +557,7 @@
             }
             if( ! pVector )
                 continue;
-            for( ::std::vector< String >::const_iterator it = pVector->begin(); it != 
pVector->end(); ++it )
+            for( ::std::vector< OUString >::const_iterator it = pVector->begin(); it != 
pVector->end(); ++it )
                 if( ! ImplIsFontToken( rName, *it ) )
                 {
                     ImplAppendFontToken( aName, *it );
@@ -576,22 +576,22 @@
 // -----------------------------------------------------------------------
 
 // TODO: use a more generic String hash
-int FontNameHash::operator()( const String& rStr ) const
+int FontNameHash::operator()( const OUString& rStr ) const
 {
     // this simple hash just has to be good enough for font names
     int nHash = 0;
-    const int nLen = rStr.Len();
-    const sal_Unicode* p = rStr.GetBuffer();
+    const int nLen = rStr.getLength();
+    const sal_Unicode* p = rStr.getStr();
     switch( nLen )
     {
-        default: nHash = (p[0]<<16) - (p[1]<<8) + p[2];
-                 nHash += nLen;
-                 p += nLen - 3;
-                 // fall through
-        case 3:  nHash += (p[2]<<16);   // fall through
-        case 2:  nHash += (p[1]<<8);    // fall through
-        case 1:  nHash += p[0];         // fall through
-        case 0:  break;
+    default: nHash = (p[0]<<16) - (p[1]<<8) + p[2];
+        nHash += nLen;
+        p += nLen - 3;
+        // fall through
+    case 3:  nHash += (p[2]<<16);   // fall through
+    case 2:  nHash += (p[1]<<8);    // fall through
+    case 1:  nHash += p[0];         // fall through
+    case 0:  break;
     };
 
     return nHash;
diff --git a/vcl/inc/outdev.h b/vcl/inc/outdev.h
index cf5feb0..76a671a 100644
--- a/vcl/inc/outdev.h
+++ b/vcl/inc/outdev.h
@@ -55,14 +55,14 @@
                         ~ImplDevFontListData();
 
     const OUString&     GetFamilyName() const    { return maName; }
-    const String&       GetSearchName() const    { return maSearchName; }
+    const OUString&     GetSearchName() const    { return maSearchName; }
     const OUString&     GetAliasNames() const    { return maMapNames; }
     bool                IsScalable() const       { return mpFirst->IsScalable(); }
     int                 GetMinQuality() const    { return mnMinQuality; }
 
     bool                AddFontFace( PhysicalFontFace* );
     void                InitMatchData( const utl::FontSubstConfiguration&,
-                            const String& rSearchName );
+                                       const String& rSearchName );
     PhysicalFontFace*   FindBestFontFace( const FontSelectPattern& rFSD ) const;
 
     void                GetFontHeights( std::set<int>& rHeights ) const;
@@ -74,11 +74,11 @@
 friend class ImplDevFontList; // TODO: remove soon
     PhysicalFontFace*   mpFirst;            // linked list of physical font faces
     OUString            maName;             // Fontname (original font family name)
-    String              maSearchName;       // normalized font family name
+    OUString            maSearchName;       // normalized font family name
     OUString            maMapNames;         // fontname aliases
     sal_uIntPtr         mnTypeFaces;        // Typeface Flags
     sal_uIntPtr         mnMatchType;        // MATCH - Type
-    String              maMatchFamilyName;  // MATCH - FamilyName
+    OUString            maMatchFamilyName;  // MATCH - FamilyName
     FontWeight          meMatchWeight;      // MATCH - Weight
     FontWidth           meMatchWidth;       // MATCH - Width
     FontFamily          meFamily;
diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx
index 94c64e1..eb678f6 100644
--- a/vcl/source/gdi/font.cxx
+++ b/vcl/source/gdi/font.cxx
@@ -153,8 +153,8 @@
     // prepare the FontSubst configuration lookup
     const utl::FontSubstConfiguration& rFontSubst = utl::FontSubstConfiguration::get();
 
-    String      aShortName;
-    String      aFamilyName;
+    OUString      aShortName;
+    OUString      aFamilyName;
     sal_uLong       nType = 0;
     FontWeight  eWeight = WEIGHT_DONTKNOW;
     FontWidth   eWidthType = WIDTH_DONTKNOW;
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index ec55ff1..ab72e18 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -1071,7 +1071,7 @@
 void ImplDevFontListData::InitMatchData( const utl::FontSubstConfiguration& rFontSubst,
     const String& rSearchName )
 {
-    String aShortName;
+    OUString aShortName;
     // get font attributes from the decorated font name
     rFontSubst.getMapName( rSearchName, aShortName, maMatchFamilyName,
                             meMatchWeight, meMatchWidth, mnMatchType );
@@ -1092,12 +1092,13 @@
         return mpFirst;
 
     // FontName+StyleName should map to FamilyName+StyleName
-    const String& rSearchName = rFSD.maTargetName;
+    const OUString& rSearchName = rFSD.maTargetName;
     const sal_Unicode* pTargetStyleName = NULL;
-    if( (rSearchName.Len() > maSearchName.Len())
-    &&   rSearchName.Equals( maSearchName, 0, maSearchName.Len() ) )
-        pTargetStyleName = rSearchName.GetBuffer() + maSearchName.Len() + 1;
-
+    if( (rSearchName.getLength() > maSearchName.getLength()) &&
+        rSearchName.compareTo( maSearchName, maSearchName.getLength() ) == 0 )
+    {
+        pTargetStyleName = rSearchName.getStr() + maSearchName.getLength() + 1;
+    }
     // TODO: linear search improve!
     PhysicalFontFace* pFontFace = mpFirst;
     PhysicalFontFace* pBestFontFace = pFontFace;
@@ -1483,7 +1484,7 @@
     ImplDevFontListData* pFoundData = NULL;
 
     // use the font substitutions suggested by the FontNameAttr to find the font
-    ::std::vector< String >::const_iterator it = rFontAttr.Substitutions.begin();
+    ::std::vector< OUString >::const_iterator it = rFontAttr.Substitutions.begin();
     for(; it != rFontAttr.Substitutions.end(); ++it )
     {
         OUString aSearchName( *it );
@@ -1734,9 +1735,9 @@
 
         // test font name substrings
         // TODO: calculate name matching score using e.g. Levenstein distance
-        if( (rSearchFamilyName.getLength() >= 4) && (pData->maMatchFamilyName.Len() >= 4)
-        &&    ((rSearchFamilyName.indexOf( pData->maMatchFamilyName ) != -1)
-            || (pData->maMatchFamilyName.Search( rSearchFamilyName ) != STRING_NOTFOUND)) )
+        if( (rSearchFamilyName.getLength() >= 4) && (pData->maMatchFamilyName.getLength() >= 4)
+        &&    ((rSearchFamilyName.indexOf( pData->maMatchFamilyName ) >= 0)
+            || (pData->maMatchFamilyName.indexOf( rSearchFamilyName ) >= 0)) )
                     nTestMatch += 5000;
 
         // test SERIF attribute
@@ -2501,8 +2502,8 @@
         GetEnglishSearchFontName( aSearchName );
     }
 
-    String      aSearchShortName;
-    String      aSearchFamilyName;
+    OUString      aSearchShortName;
+    OUString      aSearchFamilyName;
     FontWeight  eSearchWeight   = rFSD.GetWeight();
     FontWidth   eSearchWidth    = rFSD.GetWidthType();
     sal_uLong   nSearchType     = 0;
@@ -2574,8 +2575,8 @@
         aSearchName = rFSD.maTargetName;
         GetEnglishSearchFontName( aSearchName );
 
-        String      aTempShortName;
-        String      aTempFamilyName;
+        OUString      aTempShortName;
+        OUString      aTempFamilyName;
         sal_uLong   nTempType   = 0;
         FontWeight  eTempWeight = rFSD.GetWeight();
         FontWidth   eTempWidth  = WIDTH_DONTKNOW;

-- 
To view, visit https://gerrit.libreoffice.org/4247
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaac38fbf5158b2912aa1e6115c0fe693bdbebe48
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Norbert Thiebaud <nthiebaud@gmail.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.