[Libreoffice-commits] core.git: cui/source fpicker/source framework/source linguistic/source sfx2/source toolkit/source vcl/win

Thomas Arnhold thomas at arnhold.org
Fri Sep 13 04:31:14 PDT 2013


 cui/source/dialogs/hlinettp.cxx                       |    2 -
 cui/source/dialogs/hlmailtp.cxx                       |   27 ++++++++----------
 fpicker/source/office/iodlg.cxx                       |   16 +++++-----
 fpicker/source/office/iodlgimp.cxx                    |    2 -
 fpicker/source/office/iodlgimp.hxx                    |    8 ++---
 framework/source/uiconfiguration/imagemanagerimpl.cxx |    7 ++--
 linguistic/source/convdic.cxx                         |    3 --
 linguistic/source/convdiclist.cxx                     |   10 ++----
 linguistic/source/dlistimp.cxx                        |    8 ++---
 sfx2/source/appl/newhelp.cxx                          |    4 --
 toolkit/source/awt/vclxtoolkit.cxx                    |   10 +++---
 vcl/win/source/gdi/salgdi3.cxx                        |   21 ++++++--------
 vcl/win/source/window/salframe.cxx                    |   12 +++-----
 13 files changed, 59 insertions(+), 71 deletions(-)

New commits:
commit 3e55e00662b50b02c289ca4a1d94d4306bd8c86b
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Mon Sep 9 23:35:25 2013 +0200

    String to OUString
    
    This removes nearly all ToLowerAscii() calls.
    
    Conflicts:
    	linguistic/source/convdic.cxx
    	linguistic/source/convdiclist.cxx
    	linguistic/source/dlistimp.cxx
    	sc/source/filter/html/htmlexp.cxx
    
    Change-Id: Iddcaacfb7383e1df3d2f13751a3c788eba953fdd
    Reviewed-on: https://gerrit.libreoffice.org/5895
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx
index 9e7392e..ab3786a 100644
--- a/cui/source/dialogs/hlinettp.cxx
+++ b/cui/source/dialogs/hlinettp.cxx
@@ -120,7 +120,7 @@ void SvxHyperlinkInternetTp::FillDlgFields ( String& aStrURL )
     // set additional controls for FTP: Username / Password
     if ( aStrScheme.SearchAscii( sFTPScheme ) == 0 )
     {
-        if ( String(aURL.GetUser()).ToLowerAscii().SearchAscii ( sAnonymous ) == 0 )
+        if ( aURL.GetUser().toAsciiLowerCase().startsWith( sAnonymous ) )
             setAnonymousFTPUser();
         else
             setFTPUser(aURL.GetUser(), aURL.GetPass());
diff --git a/cui/source/dialogs/hlmailtp.cxx b/cui/source/dialogs/hlmailtp.cxx
index 1a5090c..d799c6c 100644
--- a/cui/source/dialogs/hlmailtp.cxx
+++ b/cui/source/dialogs/hlmailtp.cxx
@@ -94,30 +94,29 @@ SvxHyperlinkMailTp::~SvxHyperlinkMailTp ()
 
 void SvxHyperlinkMailTp::FillDlgFields ( String& aStrURL )
 {
-    const sal_Char sMailtoScheme[] = INET_MAILTO_SCHEME;
-
     INetURLObject aURL( aStrURL );
-    String aStrScheme = GetSchemeFromURL( aStrURL );
+    OUString aStrScheme = GetSchemeFromURL( aStrURL );
 
     // set URL-field and additional controls
-    String aStrURLc ( aStrURL );
+    OUString aStrURLc ( aStrURL );
     // set additional controls for EMail:
-    if ( aStrScheme.SearchAscii( sMailtoScheme ) == 0 )
+    if ( aStrScheme.startsWith( INET_MAILTO_SCHEME ) )
     {
         // Find mail-subject
-        String aStrSubject, aStrTmp ( aStrURLc );
+        OUString aStrSubject, aStrTmp( aStrURLc );
+
+        sal_Int32 nPos = aStrTmp.toAsciiLowerCase().indexOf( "subject" );
 
-        const sal_Char sSubject[] = "subject";
-        xub_StrLen nPos = aStrTmp.ToLowerAscii().SearchAscii( sSubject, 0 );
-        nPos = aStrTmp.Search( sal_Unicode( '=' ), nPos );
+        if ( nPos != -1 )
+            nPos = aStrTmp.indexOf( '=', nPos );
 
-        if ( nPos != STRING_NOTFOUND )
-            aStrSubject = aStrURLc.Copy( nPos+1, aStrURLc.Len() );
+        if ( nPos != -1 )
+            aStrSubject = aStrURLc.copy( nPos+1 );
 
-        nPos = aStrURLc.Search ( sal_Unicode( '?' ), 0);
+        nPos = aStrURLc.indexOf( '?' );
 
-        aStrURLc = aStrURLc.Copy( 0, ( nPos == STRING_NOTFOUND ?
-                                           aStrURLc.Len() : nPos ) );
+        if ( nPos != -1 )
+            aStrURLc = aStrURLc.copy( 0, nPos );
 
         maEdSubject.SetText ( aStrSubject );
     }
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index d2f1837..51ce476 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -3275,12 +3275,12 @@ void SvtFileDialog::appendDefaultExtension(String& _rFileName,
                                            const String& _rFilterDefaultExtension,
                                            const String& _rFilterExtensions)
 {
-    String aTemp(_rFileName);
-    aTemp.ToLowerAscii();
-    String aType(_rFilterExtensions);
-    aType.ToLowerAscii();
+    OUString aTemp(_rFileName);
+    aTemp = aTemp.toAsciiLowerCase();
+    OUString aType(_rFilterExtensions);
+    aType = aType.toAsciiLowerCase();
 
-    if ( ! aType.EqualsAscii(FILEDIALOG_FILTER_ALL) )
+    if ( ! aType.equals(FILEDIALOG_FILTER_ALL) )
     {
         sal_uInt16 nWildCard = comphelper::string::getTokenCount(aType, FILEDIALOG_DEF_EXTSEP);
         sal_uInt16 nIndex;
@@ -3288,14 +3288,14 @@ void SvtFileDialog::appendDefaultExtension(String& _rFileName,
 
         for ( nIndex = 0; nIndex < nWildCard; nIndex++ )
         {
-            OUString aExt(aType.GetToken( 0, FILEDIALOG_DEF_EXTSEP, nPos ));
+            OUString aExt(aType.getToken( 0, FILEDIALOG_DEF_EXTSEP, nPos ));
             // take care of a leading *
             sal_Int32 nExtOffset = (aExt[0] == '*' ? 1 : 0);
             const sal_Unicode* pExt = aExt.getStr() + nExtOffset;
             sal_Int32 nExtLen = aExt.getLength() - nExtOffset;
-            sal_Int32 nOffset = aTemp.Len() - nExtLen;
+            sal_Int32 nOffset = aTemp.getLength() - nExtLen;
             // minimize search by starting at last possible index
-            if ( aTemp.Search(pExt, nOffset) == nOffset )
+            if ( aTemp.indexOf(pExt, nOffset) == nOffset )
                 break;
         }
 
diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx
index 2d8a195..5456fce 100644
--- a/fpicker/source/office/iodlgimp.cxx
+++ b/fpicker/source/office/iodlgimp.cxx
@@ -98,7 +98,7 @@ SvtFileDialogFilter_Impl::SvtFileDialogFilter_Impl( const String& rName, const S
 {
     DBG_CTOR( SvtFileDialogFilter_Impl, NULL );
 
-    m_aType.ToLowerAscii();
+    m_aType = m_aType.toAsciiLowerCase();
 }
 
 //*****************************************************************************
diff --git a/fpicker/source/office/iodlgimp.hxx b/fpicker/source/office/iodlgimp.hxx
index 862160c..7726248 100644
--- a/fpicker/source/office/iodlgimp.hxx
+++ b/fpicker/source/office/iodlgimp.hxx
@@ -50,17 +50,17 @@ class SvtFileDialogFilter_Impl
 {
 private:
     String  m_aName;    // name of the entry
-    String  m_aType;    // filter wildcard - if empty, the entry marks a group
+    OUString m_aType;    // filter wildcard - if empty, the entry marks a group
 
 public:
     SvtFileDialogFilter_Impl( const String& rName, const String& rType );
     ~SvtFileDialogFilter_Impl();
 
     const String&       GetName() const     { return m_aName; }
-    const String&       GetType() const     { return m_aType; }
-    const String        GetExtension() const    { return m_aType.Copy( 2 ); }
+    const OUString&     GetType() const     { return m_aType; }
+    const String        GetExtension() const    { return m_aType.copy( 2 ); }
 
-    sal_Bool            isGroupSeparator() const    { return 0 == m_aType.Len(); }
+    sal_Bool            isGroupSeparator() const    { return m_aType.isEmpty(); }
 };
 
 typedef boost::ptr_deque<SvtFileDialogFilter_Impl> SvtFileDialogFilterList_Impl;
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index fa3bf1a..ffb9737 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -223,7 +223,7 @@ void CmdImageList::impl_fillCommandToImageNameMap()
         for ( sal_uInt32 i = 0; i < nCount; i++ )
         {
             OUString aCommandName( m_aImageCommandNameVector[i] );
-            String   aImageName;
+            OUString aImageName;
 
             if ( aCommandName.indexOf( aUNOString ) != 0 )
             {
@@ -240,14 +240,13 @@ void CmdImageList::impl_fillCommandToImageNameMap()
                     aImageName = aEmptyString;
 
                 // Search for query part.
-                sal_Int32 nIndex = aImageName.Search( '?' );
-                if ( nIndex != STRING_NOTFOUND )
+                if ( aImageName.indexOf('?') != -1 )
                     aImageName = getCanonicalName( aImageName ); // convert to valid filename
             }
             // Image names are not case-dependent. Always use lower case characters to
             // reflect this.
             aImageName += aExt;
-            aImageName.ToLowerAscii();
+            aImageName = aImageName.toAsciiLowerCase();
 
             m_aImageNameVector[i] = aImageName;
             m_aCommandToImageNameMap.insert( CommandToImageNameMap::value_type( aCommandName, aImageName ));
diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx
index 28f49e5..539f884 100644
--- a/linguistic/source/convdic.cxx
+++ b/linguistic/source/convdic.cxx
@@ -134,8 +134,7 @@ sal_Bool IsConvDic( const OUString &rFileURL, sal_Int16 &nLang, sal_Int16 &nConv
     OUString aExt;
     sal_Int32 nPos = rFileURL.lastIndexOf( '.' );
     if (-1 != nPos)
-        aExt = rFileURL.copy( nPos + 1 );
-    aExt = aExt.toAsciiLowerCase();
+        aExt = rFileURL.copy( nPos + 1 ).toAsciiLowerCase();
     if (aExt != CONV_DIC_EXT)
         return bRes;
 
diff --git a/linguistic/source/convdiclist.cxx b/linguistic/source/convdiclist.cxx
index dcd2bbb..69e48ad 100644
--- a/linguistic/source/convdiclist.cxx
+++ b/linguistic/source/convdiclist.cxx
@@ -335,13 +335,11 @@ void ConvDicNameContainer::AddConvDics(
 
     for (sal_Int32 i = 0;  i < nEntries;  ++i)
     {
-        OUString  aURL( pDirCnt[i] );
+        OUString aURL( pDirCnt[i] );
 
-        sal_Int32 nPos  = aURL.lastIndexOf('.');
-        OUString  aExt(aURL.copy(nPos + 1));
-        aExt = aExt.toAsciiLowerCase();
-        OUString  aSearchExt( rExtension );
-        aSearchExt = aSearchExt.toAsciiLowerCase();
+        sal_Int32 nPos = aURL.lastIndexOf('.');
+        OUString aExt( aURL.copy(nPos + 1).toAsciiLowerCase() );
+        OUString aSearchExt( rExtension.toAsciiLowerCase() );
         if(aExt != aSearchExt)
             continue;          // skip other files
 
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index ec7853b..45db201 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -324,8 +324,7 @@ void DicList::SearchForDictionaries(
         {
             // When not
             sal_Int32 nPos  = aURL.indexOf('.');
-            OUString aExt(aURL.copy(nPos + 1));
-            aExt = aExt.toAsciiLowerCase();
+            OUString aExt( aURL.copy(nPos + 1).toAsciiLowerCase() );
 
             if (aDCN.equals(aExt))       // negativ
                 bNeg = sal_True;
@@ -870,10 +869,9 @@ static sal_Bool IsVers2OrNewer( const OUString& rFileURL, sal_uInt16& nLng, sal_
     OUString aExt;
     sal_Int32 nPos = rFileURL.lastIndexOf( '.' );
     if (-1 != nPos)
-        aExt = rFileURL.copy( nPos + 1 );
-    aExt = aExt.toAsciiLowerCase();
+        aExt = rFileURL.copy( nPos + 1 ).toAsciiLowerCase();
 
-    if (!aDIC.equals(aExt))
+    if (aDIC != aExt)
         return sal_False;
 
     // get stream to be used
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 1b231fc..9fcf956 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -1706,9 +1706,7 @@ IMPL_LINK_NOARG(SfxHelpIndexWindow_Impl, SelectFactoryHdl)
     OUString* pFactory = (OUString*)(sal_uIntPtr)aActiveLB.GetEntryData( aActiveLB.GetSelectEntryPos() );
     if ( pFactory )
     {
-        String aFactory( *pFactory );
-        aFactory.ToLowerAscii();
-        SetFactory( aFactory, sal_False );
+        SetFactory( OUString( *pFactory ).toAsciiLowerCase(), sal_False );
         aSelectFactoryLink.Call( this );
     }
 
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 09502c1..ef105df 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -617,15 +617,15 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
     const ::com::sun::star::awt::WindowDescriptor& rDescriptor,
     Window* pParent, WinBits nWinBits )
 {
-    String aServiceName( rDescriptor.WindowServiceName );
-    aServiceName.ToLowerAscii();
+    OUString aServiceName( rDescriptor.WindowServiceName );
+    aServiceName = aServiceName.toAsciiLowerCase();
 
     Window* pNewWindow = NULL;
     sal_uInt16 nType = ImplGetComponentType( aServiceName );
     bool bFrameControl = false;
-    if ( aServiceName == String( "frame" ) )
+    if ( aServiceName == "frame" )
         bFrameControl = true;
-    if ( aServiceName == String( "tabcontrolnotabs" ) )
+    if ( aServiceName == "tabcontrolnotabs" )
     {
         nWinBits |= WB_NOBORDER;
         nType = ImplGetComponentType( String( "tabcontrol" ) );
@@ -1018,7 +1018,7 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
                     pNewWindow = new TabControl( pParent, nWinBits );
                     *ppNewComp = new VCLXTabPageContainer;
                 }
-                else if ( aServiceName.EqualsAscii( "animatedimages" ) )
+                else if ( aServiceName == "animatedimages" )
                 {
                     pNewWindow = new Throbber( pParent, nWinBits );
                     *ppNewComp = new ::toolkit::AnimatedImagesPeer;
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index 09a907a..5c01947 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -94,12 +94,12 @@ class ImplFontAttrCache
 {
 private:
     FontAttrMap     aFontAttributes;
-    OUString   aCacheFileName;
-    String          aBaseURL;
-    sal_Bool            bModified;
+    OUString        aCacheFileName;
+    OUString        aBaseURL;
+    sal_Bool        bModified;
 
 protected:
-    String  OptimizeURL( const String& rURL ) const;
+    OUString OptimizeURL( const OUString& rURL ) const;
 
     enum{ MAGIC = 0x12349876 }; // change if fontattrcache format changes
 
@@ -111,10 +111,10 @@ public:
     void                   AddFontAttr( const String& rFontFileName, const ImplDevFontAttributes& );
 };
 
-ImplFontAttrCache::ImplFontAttrCache( const String& rFileNameURL, const String& rBaseURL ) : aBaseURL( rBaseURL )
+ImplFontAttrCache::ImplFontAttrCache( const OUString& rFileNameURL, const OUString& rBaseURL ) : aBaseURL( rBaseURL )
 {
     bModified = FALSE;
-    aBaseURL.ToLowerAscii();    // Windows only, no problem...
+    aBaseURL = aBaseURL.toAsciiLowerCase();    // Windows only, no problem...
 
     // open the cache file
     osl::FileBase::getSystemPathFromFileURL( rFileNameURL, aCacheFileName );
@@ -190,12 +190,11 @@ ImplFontAttrCache::~ImplFontAttrCache()
     }
 }
 
-String ImplFontAttrCache::OptimizeURL( const String& rURL ) const
+OUString ImplFontAttrCache::OptimizeURL( const OUString& rURL ) const
 {
-    String aOptimizedFontFileURL( rURL );
-    aOptimizedFontFileURL.ToLowerAscii();   // Windows only, no problem...
-    if ( aOptimizedFontFileURL.CompareTo( aBaseURL, aBaseURL.Len() ) == COMPARE_EQUAL )
-        aOptimizedFontFileURL = aOptimizedFontFileURL.Copy( aBaseURL.Len() );
+    OUString aOptimizedFontFileURL( rURL.toAsciiLowerCase() );
+    if ( aOptimizedFontFileURL.startsWith( aBaseURL ) )
+        aOptimizedFontFileURL = aOptimizedFontFileURL.copy( aBaseURL.getLength() );
     return aOptimizedFontFileURL;
 }
 
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 9b4e12c..95f88aa 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -4613,10 +4613,8 @@ static int ImplMenuChar( HWND, WPARAM wParam, LPARAM lParam )
 {
     int nRet = MNC_IGNORE;
     HMENU hMenu = (HMENU) lParam;
-    String aMnemonic;
-    aMnemonic.AssignAscii("&");
-    aMnemonic.Append( (sal_Unicode) LOWORD(wParam) );
-    aMnemonic.ToLowerAscii();   // we only have ascii mnemonics
+    OUString aMnemonic( "&" + (sal_Unicode) LOWORD(wParam) );
+    aMnemonic = aMnemonic.toAsciiLowerCase();   // we only have ascii mnemonics
 
     // search the mnemonic in the current menu
     int nItemCount = GetMenuItemCount( hMenu );
@@ -4629,9 +4627,9 @@ static int ImplMenuChar( HWND, WPARAM wParam, LPARAM lParam )
         WinSalMenuItem* pSalMenuItem = ImplGetSalMenuItem( hMenu, idx % nItemCount );
         if( !pSalMenuItem )
             continue;
-        String aStr = pSalMenuItem->mText;
-        aStr.ToLowerAscii();
-        if( aStr.Search( aMnemonic ) != STRING_NOTFOUND)
+        OUString aStr = pSalMenuItem->mText;
+        aStr = aStr.toAsciiLowerCase();
+        if( aStr.indexOf( aMnemonic ) != -1 )
         {
             if( idxFound == -1 )
                 idxFound = idx % nItemCount;


More information about the Libreoffice-commits mailing list