[Libreoffice-commits] .: cui/source svl/inc svl/source sw/source

Takeshi Abe tabe at kemper.freedesktop.org
Thu Feb 2 09:47:02 PST 2012


 cui/source/dialogs/insdlg.cxx  |    4 +-
 svl/inc/svl/ownlist.hxx        |   17 +++++-----
 svl/source/misc/ownlist.cxx    |   64 +++++++++++++++++++++--------------------
 sw/source/ui/shells/textsh.cxx |    2 -
 4 files changed, 44 insertions(+), 43 deletions(-)

New commits:
commit f439dde9be6e269903dfd65fb63a786fcaba3971
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Fri Feb 3 02:34:17 2012 +0900

    Replaced String by rtl::OUString

diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx
index 5312e6f..2ff622b 100644
--- a/cui/source/dialogs/insdlg.cxx
+++ b/cui/source/dialogs/insdlg.cxx
@@ -468,7 +468,7 @@ SvInsertPlugInDialog::~SvInsertPlugInDialog()
 
 static void Plugin_ImplFillCommandSequence( const String& aCommands, uno::Sequence< beans::PropertyValue >& aCommandSequence )
 {
-    sal_uInt16 nEaten;
+    sal_Int32 nEaten;
     SvCommandList aLst;
     aLst.AppendCommands( aCommands, &nEaten );
 
@@ -478,7 +478,7 @@ static void Plugin_ImplFillCommandSequence( const String& aCommands, uno::Sequen
     {
         aCommandSequence[nIndex].Name = aLst[ nIndex ].GetCommand();
         aCommandSequence[nIndex].Handle = -1;
-        aCommandSequence[nIndex].Value = makeAny( OUString( aLst[ nIndex ].GetArgument() ) );
+        aCommandSequence[nIndex].Value = makeAny( aLst[ nIndex ].GetArgument() );
         aCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE;
     }
 }
diff --git a/svl/inc/svl/ownlist.hxx b/svl/inc/svl/ownlist.hxx
index f0fd246..fb14002 100644
--- a/svl/inc/svl/ownlist.hxx
+++ b/svl/inc/svl/ownlist.hxx
@@ -30,7 +30,6 @@
 #define _OWNLIST_HXX
 
 #include "svl/svldllapi.h"
-#include <tools/stream.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
 #include <vector>
 
@@ -50,17 +49,17 @@ class SvCommand
     aus: Kommando = Argument.
 */
 {
-    String  aCommand;
-    String  aArgument;
+    ::rtl::OUString aCommand;
+    ::rtl::OUString aArgument;
 public:
                     SvCommand() {}
-                    SvCommand( const String & rCommand, const String & rArg )
+    SvCommand( const ::rtl::OUString & rCommand, const ::rtl::OUString & rArg )
                     {
                         aCommand = rCommand;
                         aArgument = rArg;
                     }
-    const String & GetCommand() const { return aCommand; }
-    const String & GetArgument() const { return aArgument; }
+    const ::rtl::OUString & GetCommand() const { return aCommand; }
+    const ::rtl::OUString & GetArgument() const { return aArgument; }
 };
 
 typedef ::std::vector< SvCommand > SvCommandList_impl;
@@ -78,10 +77,10 @@ private:
     SvCommandList_impl  aCommandList;
 
 public:
-    SvCommand&      Append( const String & rCommand, const String & rArg );
-    sal_Bool        AppendCommands( const String & rCmd, sal_uInt16 * pEaten );
+    SvCommand&      Append( const ::rtl::OUString & rCommand, const ::rtl::OUString & rArg );
+    bool        AppendCommands( const ::rtl::OUString & rCmd, sal_Int32 * pEaten );
 
-    sal_Bool FillFromSequence( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& );
+    bool FillFromSequence( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& );
     void FillSequence( com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& );
 
     size_t          size() const { return aCommandList.size(); }
diff --git a/svl/source/misc/ownlist.cxx b/svl/source/misc/ownlist.cxx
index 51f0707..156fe5b 100644
--- a/svl/source/misc/ownlist.cxx
+++ b/svl/source/misc/ownlist.cxx
@@ -38,45 +38,47 @@ using namespace com::sun::star;
 //============== SvCommandList ============================================
 //=========================================================================
 
-static String parseString(const String & rCmd, sal_uInt16 * pIndex)
+static ::rtl::OUString parseString(const ::rtl::OUString & rCmd, sal_Int32 * pIndex)
 {
-    String result;
+    ::rtl::OUString result;
 
-    if(rCmd.GetChar( *pIndex ) == '\"') {
+    if(rCmd[*pIndex] == sal_Unicode('\"')) {
         (*pIndex) ++;
 
-        sal_uInt16 begin = *pIndex;
+        sal_Int32 begin = *pIndex;
 
-        while(*pIndex < rCmd.Len() && rCmd.GetChar((*pIndex) ++) != '\"') ;
+        while(*pIndex < rCmd.getLength() && rCmd[(*pIndex) ++] != sal_Unicode('\"')) ;
 
-        result = String(rCmd.Copy(begin, *pIndex - begin - 1));
+        result = rCmd.copy(begin, *pIndex - begin - 1);
     }
 
     return result;
 }
 
-static String parseWord(const String & rCmd, sal_uInt16 * pIndex)
+static ::rtl::OUString parseWord(const ::rtl::OUString & rCmd, sal_Int32 * pIndex)
 {
-    sal_uInt16 begin = *pIndex;
+    sal_Int32 begin = *pIndex;
 
-    while(*pIndex < rCmd.Len() && !isspace(rCmd.GetChar(*pIndex)) && rCmd.GetChar(*pIndex) != '=')
+    while(*pIndex < rCmd.getLength()
+          && !isspace(sal::static_int_cast<int>(rCmd[*pIndex]))
+          && rCmd[*pIndex] != sal_Unicode('='))
         (*pIndex) ++;
 
-    return String(rCmd.Copy(begin, *pIndex - begin));
+    return rCmd.copy(begin, *pIndex - begin);
 }
 
-static void eatSpace(const String & rCmd, sal_uInt16 * pIndex)
+static void eatSpace(const ::rtl::OUString & rCmd, sal_Int32 * pIndex)
 {
-    while(*pIndex < rCmd.Len() && isspace(rCmd.GetChar(*pIndex)))
+    while(*pIndex < rCmd.getLength() && isspace(sal::static_int_cast<int>(rCmd[*pIndex])))
         (*pIndex) ++;
 }
 
 
 //=========================================================================
-sal_Bool SvCommandList::AppendCommands
+bool SvCommandList::AppendCommands
 (
-    const String & rCmd,    /* Dieser Text wird in Kommandos umgesetzt */
-    sal_uInt16 * pEaten         /* Anzahl der Zeichen, die gelesen wurden */
+ const ::rtl::OUString & rCmd,    /* Dieser Text wird in Kommandos umgesetzt */
+ sal_Int32 * pEaten         /* Anzahl der Zeichen, die gelesen wurden */
 )
 /*  [Beschreibung]
 
@@ -85,25 +87,25 @@ sal_Bool SvCommandList::AppendCommands
 
     [R"uckgabewert]
 
-    sal_Bool        sal_True, der Text wurde korrekt geparsed.
-                sal_False, der Text wurde nicht korrekt geparsed.
+    bool        true, der Text wurde korrekt geparsed.
+                false, der Text wurde nicht korrekt geparsed.
 */
 {
-    sal_uInt16 index = 0;
-    while(index < rCmd.Len())
+    sal_Int32 index = 0;
+    while(index < rCmd.getLength())
     {
 
         eatSpace(rCmd, &index);
-        String name = (rCmd.GetChar(index) == '\"') ? parseString(rCmd, &index) : parseWord(rCmd, &index);
+        ::rtl::OUString name = (rCmd[index] == sal_Unicode('\"')) ? parseString(rCmd, &index) : parseWord(rCmd, &index);
 
         eatSpace(rCmd, &index);
-        String value;
-        if(index < rCmd.Len() && rCmd.GetChar(index) == '=')
+        ::rtl::OUString value;
+        if(index < rCmd.getLength() && rCmd[index] == sal_Unicode('='))
         {
             index ++;
 
             eatSpace(rCmd, &index);
-            value = (rCmd.GetChar(index) == '\"') ? parseString(rCmd, &index) : parseWord(rCmd, &index);
+            value = (rCmd[index] == sal_Unicode('\"')) ? parseString(rCmd, &index) : parseWord(rCmd, &index);
         }
 
         aCommandList.push_back( SvCommand(name, value));
@@ -111,14 +113,14 @@ sal_Bool SvCommandList::AppendCommands
 
     *pEaten = index;
 
-    return sal_True;
+    return true;
 }
 
 //=========================================================================
 SvCommand & SvCommandList::Append
 (
-    const String & rCommand,    /* das Kommando */
-    const String & rArg         /* dasArgument des Kommandos */
+ const ::rtl::OUString & rCommand,    /* das Kommando */
+ const ::rtl::OUString & rArg         /* dasArgument des Kommandos */
 )
 /*  [Beschreibung]
 
@@ -134,21 +136,21 @@ SvCommand & SvCommandList::Append
     return aCommandList.back();
 }
 
-sal_Bool SvCommandList::FillFromSequence( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& aCommandSequence )
+bool SvCommandList::FillFromSequence( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& aCommandSequence )
 {
     const sal_Int32 nCount = aCommandSequence.getLength();
-    String aCommand, aArg;
+    ::rtl::OUString aCommand, aArg;
     ::rtl::OUString aApiArg;
     for( sal_Int32 nIndex=0; nIndex<nCount; nIndex++ )
     {
         aCommand = aCommandSequence[nIndex].Name;
         if( !( aCommandSequence[nIndex].Value >>= aApiArg ) )
-            return sal_False;
+            return false;
         aArg = aApiArg;
         Append( aCommand, aArg );
     }
 
-    return sal_True;
+    return true;
 }
 
 void SvCommandList::FillSequence( com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& aCommandSequence )
@@ -159,7 +161,7 @@ void SvCommandList::FillSequence( com::sun::star::uno::Sequence < com::sun::star
     {
         aCommandSequence[nIndex].Name = aCommandList[ nIndex ].GetCommand();
         aCommandSequence[nIndex].Handle = -1;
-        aCommandSequence[nIndex].Value = uno::makeAny( ::rtl::OUString( aCommandList[ nIndex ].GetArgument() ) );
+        aCommandSequence[nIndex].Value = uno::makeAny( aCommandList[ nIndex ].GetArgument() );
         aCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE;
     }
 }
diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx
index ef2f4b9..6e36f23 100644
--- a/sw/source/ui/shells/textsh.cxx
+++ b/sw/source/ui/shells/textsh.cxx
@@ -287,7 +287,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
             SvCommandList aCommandList;
             if(pCommandsItem)
             {
-                sal_uInt16 nTemp;
+                sal_Int32 nTemp;
                 aCommandList.AppendCommands( pCommandsItem->GetValue(), &nTemp );
             }
 


More information about the Libreoffice-commits mailing list