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

Matteo Casalin matteo.casalin at yahoo.com
Tue Jul 30 06:35:50 PDT 2013


 editeng/source/misc/SvXMLAutoCorrectImport.cxx |    9 +++++----
 editeng/source/misc/svxacorr.cxx               |    9 +++++----
 include/editeng/svxacorr.hxx                   |    7 ++++---
 sw/inc/swacorr.hxx                             |    7 ++++---
 sw/source/core/inc/SwXMLBlockImport.hxx        |    5 ++---
 sw/source/core/inc/SwXMLTextBlocks.hxx         |    8 ++++----
 sw/source/core/inc/swblocks.hxx                |    6 +++---
 sw/source/core/sw3io/swacorr.cxx               |   10 ++++++----
 sw/source/core/swg/SwXMLBlockImport.cxx        |    2 +-
 sw/source/core/swg/SwXMLBlockListContext.cxx   |    8 ++++----
 sw/source/core/swg/SwXMLTextBlocks.cxx         |    6 +++---
 sw/source/core/swg/SwXMLTextBlocks1.cxx        |    4 ++--
 12 files changed, 43 insertions(+), 38 deletions(-)

New commits:
commit 73a136945d50a207c9e1c552d02c90d5c862c470
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Jul 26 15:37:08 2013 +0200

    String to OUString
    
    Change-Id: Ia9bebaf92bf570c10d01a9ed3db437f70098a07d
    Reviewed-on: https://gerrit.libreoffice.org/5185
    Reviewed-by: Luboš Luňák <l.lunak at suse.cz>
    Tested-by: Luboš Luňák <l.lunak at suse.cz>

diff --git a/editeng/source/misc/SvXMLAutoCorrectImport.cxx b/editeng/source/misc/SvXMLAutoCorrectImport.cxx
index 9b4de02..b338b95 100644
--- a/editeng/source/misc/SvXMLAutoCorrectImport.cxx
+++ b/editeng/source/misc/SvXMLAutoCorrectImport.cxx
@@ -100,7 +100,8 @@ SvXMLWordContext::SvXMLWordContext(
    SvXMLImportContext ( rImport, nPrefix, rLocalName ),
    rLocalRef(rImport)
 {
-    String sRight, sWrong;
+    OUString sRight;
+    OUString sWrong;
     sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
 
     for (sal_Int16 i=0; i < nAttrCount; i++)
@@ -121,15 +122,15 @@ SvXMLWordContext::SvXMLWordContext(
             }
         }
     }
-    if (!sWrong.Len() || !sRight.Len() )
+    if (sWrong.isEmpty() || sRight.isEmpty())
         return;
 
     sal_Bool bOnlyTxt = sRight != sWrong;
     if( !bOnlyTxt )
     {
-        String sLongSave( sRight );
+        const OUString sLongSave( sRight );
         if( !rLocalRef.rAutoCorrect.GetLongText( rLocalRef.xStorage, String(), sWrong, sRight ) &&
-            sLongSave.Len() )
+            !sLongSave.isEmpty() )
         {
             sRight = sLongSave;
             bOnlyTxt = sal_True;
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index d40f481..8b651a6 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1609,14 +1609,15 @@ sal_Bool SvxAutoCorrect::MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNew
 
     //  - return the replacement text (only for SWG-Format, all other
     //      can be taken from the word list!)
-sal_Bool SvxAutoCorrect::GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String&, const String& , String& )
+sal_Bool SvxAutoCorrect::GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&,
+                                      const String&, const String&, OUString& )
 {
     return sal_False;
 }
 
     // Text with attribution (only the SWG - SWG format!)
-sal_Bool SvxAutoCorrect::PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String&, const String&, SfxObjectShell&,
-                                String& )
+sal_Bool SvxAutoCorrect::PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&,
+                                  const String&, const String&, SfxObjectShell&, OUString& )
 {
     return sal_False;
 }
@@ -2541,7 +2542,7 @@ sal_Bool SvxAutoCorrectLanguageLists::PutText( const String& rShort,
     MakeUserStorage_Impl();
 
     sal_Bool bRet = sal_False;
-    String sLong;
+    OUString sLong;
     try
     {
         uno::Reference < embed::XStorage > xStg = comphelper::OStorageHelper::GetStorageFromURL( sUserAutoCorrFile, embed::ElementModes::READWRITE );
diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx
index 85bf3e9..0a493d7 100644
--- a/include/editeng/svxacorr.hxx
+++ b/include/editeng/svxacorr.hxx
@@ -267,8 +267,8 @@ class EDITENG_DLLPUBLIC SvxAutoCorrect
 protected:
     //  - Text with attribution (only the SWG - SWG format!)
     //      rShort is the stream name - encrypted!
-    virtual sal_Bool PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const String& rFileName, const String& rShort, SfxObjectShell& ,
-                            String& );
+    virtual sal_Bool PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg,
+                              const String& rFileName, const String& rShort, SfxObjectShell&, OUString& );
 
     // required language in the table add if possible only when the file exists
     sal_Bool    CreateLanguageFile(LanguageType eLang, sal_Bool bNewFile = sal_True);
@@ -279,7 +279,8 @@ public:
 
     sal_Unicode GetQuote( sal_Unicode cInsChar, sal_Bool bSttQuote,
                             LanguageType eLang ) const;
-    virtual sal_Bool GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const String& rFileName, const String& rShort, String& rLong );
+    virtual sal_Bool GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg,
+                                  const String& rFileName, const String& rShort, OUString& rLong );
 
     TYPEINFO();
 
diff --git a/sw/inc/swacorr.hxx b/sw/inc/swacorr.hxx
index 685d7aa..9879946 100644
--- a/sw/inc/swacorr.hxx
+++ b/sw/inc/swacorr.hxx
@@ -31,12 +31,13 @@ class SwAutoCorrect : public SvxAutoCorrect
 protected:
     // Return replacement text (only for SWG-format, all others can be obtained from wordlist!).
     // rShort is stream-name - encrypted!
-    virtual sal_Bool GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& , const String& rFileName, const String& rShort, String& rLong );
+    virtual sal_Bool GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&,
+                                  const String& rFileName, const String& rShort, OUString& rLong );
 
     // Text with attributes (only SWG-format!).
     // rShort is stream-name - encrypted!
-    virtual sal_Bool PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String& rFileName, const String& rShort, SfxObjectShell& ,
-                            String& );
+    virtual sal_Bool PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&,
+                              const String& rFileName, const String& rShort, SfxObjectShell&, OUString& );
 
 public:
     TYPEINFO();
diff --git a/sw/source/core/inc/SwXMLBlockImport.hxx b/sw/source/core/inc/SwXMLBlockImport.hxx
index bbe47d5..9b66504 100644
--- a/sw/source/core/inc/SwXMLBlockImport.hxx
+++ b/sw/source/core/inc/SwXMLBlockImport.hxx
@@ -21,7 +21,6 @@
 #define _SW_XMLBLOCKIMPORT_HXX
 
 #include <xmloff/xmlimp.hxx>
-#include <tools/string.hxx>
 
 class SwXMLTextBlocks;
 class SwXMLBlockListImport : public SvXMLImport
@@ -65,10 +64,10 @@ protected:
 
 public:
     sal_Bool bTextOnly;
-    String &m_rText;
+    OUString &m_rText;
     SwXMLTextBlockImport(
         const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
-        SwXMLTextBlocks &rBlocks, String &rNewText, sal_Bool bNewTextOnly );
+        SwXMLTextBlocks &rBlocks, OUString &rNewText, sal_Bool bNewTextOnly );
 
     SwXMLTextBlocks& getBlockList ( void )
     {
diff --git a/sw/source/core/inc/SwXMLTextBlocks.hxx b/sw/source/core/inc/SwXMLTextBlocks.hxx
index 3648663..8aa3a94 100644
--- a/sw/source/core/inc/SwXMLTextBlocks.hxx
+++ b/sw/source/core/inc/SwXMLTextBlocks.hxx
@@ -65,8 +65,8 @@ public:
     virtual sal_uLong GetDoc( sal_uInt16 );
     virtual sal_uLong BeginPutDoc( const String&, const String& );
     virtual sal_uLong PutDoc();
-    virtual sal_uLong GetText( sal_uInt16, String& );
-    virtual sal_uLong PutText( const String&, const String&, const String& );
+    virtual sal_uLong GetText( sal_uInt16, OUString& );
+    virtual sal_uLong PutText( const String&, const String&, const OUString& );
     virtual sal_uLong MakeBlockList();
 
     virtual short GetFileType ( void ) const;
@@ -76,7 +76,7 @@ public:
     static sal_Bool IsFileUCBStorage( const String & rFileName);
 
     // Methods for the new Autocorrecter
-    sal_uLong GetText( const String& rShort, String& );
+    sal_uLong GetText( const String& rShort, OUString& );
 
     virtual sal_Bool IsOnlyTextBlock( const String& rShort ) const;
     virtual sal_Bool IsOnlyTextBlock( sal_uInt16 nIdx ) const;
@@ -95,7 +95,7 @@ public:
     //void  SetDoc( SwDoc * pNewDoc);
     sal_uLong StartPutBlock( const String& rShort, const String& rPackageName );
     sal_uLong PutBlock( SwPaM& rPaM, const String& rLong );
-    sal_uLong GetBlockText( const String& rShort, String& rText );
+    sal_uLong GetBlockText( const String& rShort, OUString& rText );
     sal_uLong PutBlockText( const String& rShort, const String& rName, const String& rText,  const String& rPackageName );
     void MakeBlockText( const String& rText );
 
diff --git a/sw/source/core/inc/swblocks.hxx b/sw/source/core/inc/swblocks.hxx
index e3a5865..d2f72bf 100644
--- a/sw/source/core/inc/swblocks.hxx
+++ b/sw/source/core/inc/swblocks.hxx
@@ -60,7 +60,7 @@ class SwImpBlocks
 protected:
     String aFile;                       // physikalischer Dateiname
     String aName;                       // logischer Name der Datei
-    String aCur;                        // aktueller Text
+    OUString aCur;                      // aktueller Text
     String aShort, aLong;               // Kurz- und Langname (PutDoc)
     String sBaseURL;                    // base URL - has to be set at the Readers and Writers
     SwBlockNames aNames;                // Liste aller Bausteine
@@ -113,8 +113,8 @@ public:
     virtual sal_uLong GetDoc( sal_uInt16 ) = 0;
     virtual sal_uLong BeginPutDoc( const String&, const String& ) = 0;
     virtual sal_uLong PutDoc() = 0;
-    virtual sal_uLong GetText( sal_uInt16, String& ) = 0;
-    virtual sal_uLong PutText( const String&, const String&, const String& ) = 0;
+    virtual sal_uLong GetText( sal_uInt16, OUString& ) = 0;
+    virtual sal_uLong PutText( const String&, const String&, const OUString& ) = 0;
     virtual sal_uLong MakeBlockList() = 0;
 
     virtual sal_uLong OpenFile( sal_Bool bReadOnly = sal_True ) = 0;
diff --git a/sw/source/core/sw3io/swacorr.cxx b/sw/source/core/sw3io/swacorr.cxx
index d7f5a52..92d3b4c 100644
--- a/sw/source/core/sw3io/swacorr.cxx
+++ b/sw/source/core/sw3io/swacorr.cxx
@@ -35,7 +35,8 @@ TYPEINIT1( SwAutoCorrect, SvxAutoCorrect );
     //      koennen aus der Wortliste herausgeholt werden!)
     //      rShort ist der Stream-Name - gecryptet!
 
-sal_Bool SwAutoCorrect::GetLongText( const uno::Reference < embed::XStorage >& rStg, const String& rFileName, const String& rShort, String& rLong )
+sal_Bool SwAutoCorrect::GetLongText( const uno::Reference < embed::XStorage >& rStg,
+                                     const String& rFileName, const String& rShort, OUString& rLong )
 {
     sal_uLong nRet = 0;
     if (rStg.is())
@@ -47,13 +48,14 @@ sal_Bool SwAutoCorrect::GetLongText( const uno::Reference < embed::XStorage >& r
     else {
        OSL_ENSURE( rStg.is(), "Someone passed SwAutoCorrect::GetLongText a dud storage!");
     }
-    return !IsError( nRet ) && rLong.Len();
+    return !IsError( nRet ) && !rLong.isEmpty();
 }
 
     //  - Text mit Attributierung (kann nur der SWG - SWG-Format!)
     //      rShort ist der Stream-Name - gecryptet!
-sal_Bool SwAutoCorrect::PutText( const uno::Reference < embed::XStorage >&  rStg, const String& rFileName, const String& rShort,
-                            SfxObjectShell& rObjSh, String& rLong )
+sal_Bool SwAutoCorrect::PutText( const uno::Reference < embed::XStorage >&  rStg,
+                                 const String& rFileName, const String& rShort,
+                                 SfxObjectShell& rObjSh, OUString& rLong )
 {
     if( !rObjSh.IsA( TYPE(SwDocShell) ) )
         return sal_False;
diff --git a/sw/source/core/swg/SwXMLBlockImport.cxx b/sw/source/core/swg/SwXMLBlockImport.cxx
index c007cd8..7535d33 100644
--- a/sw/source/core/swg/SwXMLBlockImport.cxx
+++ b/sw/source/core/swg/SwXMLBlockImport.cxx
@@ -64,7 +64,7 @@ SvXMLImportContext *SwXMLBlockListImport::CreateContext(
 SwXMLTextBlockImport::SwXMLTextBlockImport(
     const uno::Reference< uno::XComponentContext > xContext,
     SwXMLTextBlocks &rBlocks,
-    String & rNewText,
+    OUString & rNewText,
     sal_Bool bNewTextOnly )
 :   SvXMLImport(xContext, IMPORT_ALL ),
     rBlockList ( rBlocks ),
diff --git a/sw/source/core/swg/SwXMLBlockListContext.cxx b/sw/source/core/swg/SwXMLBlockListContext.cxx
index c1bf14e..442156e 100644
--- a/sw/source/core/swg/SwXMLBlockListContext.cxx
+++ b/sw/source/core/swg/SwXMLBlockListContext.cxx
@@ -224,16 +224,16 @@ SwXMLTextBlockParContext::SwXMLTextBlockParContext(
 
 void SwXMLTextBlockParContext::Characters( const OUString& rChars )
 {
-    rLocalRef.m_rText.Append ( rChars.getStr());
+    rLocalRef.m_rText += rChars;
 }
 SwXMLTextBlockParContext::~SwXMLTextBlockParContext ( void )
 {
     if (rLocalRef.bTextOnly)
-        rLocalRef.m_rText.AppendAscii( "\015" );
+        rLocalRef.m_rText += "\015";
     else
     {
-        if (rLocalRef.m_rText.GetChar ( rLocalRef.m_rText.Len()) != ' ' )
-            rLocalRef.m_rText.AppendAscii( " " );
+        if (!rLocalRef.m_rText.endsWith( " " ))
+            rLocalRef.m_rText += " ";
     }
 }
 
diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx
index 7012180..30b8500 100644
--- a/sw/source/core/swg/SwXMLTextBlocks.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks.cxx
@@ -414,12 +414,12 @@ sal_uLong SwXMLTextBlocks::PutDoc()
     return nErr;
 }
 
-sal_uLong SwXMLTextBlocks::GetText( sal_uInt16 nIdx, String& rText )
+sal_uLong SwXMLTextBlocks::GetText( sal_uInt16 nIdx, OUString& rText )
 {
     return GetBlockText( aNames[ nIdx ]->aShort, rText );
 }
 
-sal_uLong SwXMLTextBlocks::GetText( const String& rShort, String& rText )
+sal_uLong SwXMLTextBlocks::GetText( const String& rShort, OUString& rText )
 {
     return GetBlockText( rShort, rText );
 }
@@ -572,7 +572,7 @@ OUString SwXMLTextBlocks::GeneratePackageName ( const String& rShort )
 }
 
 sal_uLong SwXMLTextBlocks::PutText( const String& rShort, const String& rName,
-                                const String& rText )
+                                    const OUString& rText )
 {
     sal_uLong nRes = 0;
     aShort = rShort;
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index d204c4a..eaa0ace 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -266,13 +266,13 @@ sal_uLong SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
 }
 
 
-sal_uLong SwXMLTextBlocks::GetBlockText( const String& rShort, String& rText )
+sal_uLong SwXMLTextBlocks::GetBlockText( const String& rShort, OUString& rText )
 {
     sal_uLong n = 0;
     sal_Bool bTextOnly = sal_True;
     String aFolderName = GeneratePackageName ( rShort );
     String aStreamName = aFolderName + OUString(".xml");
-    rText.Erase();
+    rText = OUString();
 
     try
     {


More information about the Libreoffice-commits mailing list