sw/inc/shellio.hxx | 28 +++---- sw/source/core/inc/SwXMLTextBlocks.hxx | 34 ++++----- sw/source/core/inc/swblocks.hxx | 52 +++++++------- sw/source/core/swg/SwXMLBlockListContext.cxx | 6 + sw/source/core/swg/SwXMLTextBlocks.cxx | 68 ++++++++++--------- sw/source/core/swg/SwXMLTextBlocks1.cxx | 18 ++--- sw/source/core/swg/swblocks.cxx | 96 +++++++++++++-------------- sw/source/ui/dochdl/gloshdl.cxx | 71 +++++++++---------- sw/source/ui/inc/gloshdl.hxx | 40 +++++------ sw/source/ui/misc/glosdoc.cxx | 2 sw/source/ui/uno/unoatxt.cxx | 4 - 11 files changed, 213 insertions(+), 206 deletions(-)
New commits: commit 734295ee6081686b62a4521dacf4975240e1109e Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sat Jul 27 12:56:48 2013 +0200 String to OUString Change-Id: I412801fbc1a692c02badd15ce03d4d7ff82aab5e Reviewed-on: https://gerrit.libreoffice.org/5186 Reviewed-by: LuboÅ¡ LuÅák <l.lu...@suse.cz> Tested-by: LuboÅ¡ LuÅák <l.lu...@suse.cz> diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx index 7efeca0..fa3f34b 100644 --- a/sw/inc/shellio.hxx +++ b/sw/inc/shellio.hxx @@ -306,46 +306,46 @@ class SW_DLLPUBLIC SwTextBlocks sal_uLong nErr; public: - SwTextBlocks( const String& ); + SwTextBlocks( const OUString& ); ~SwTextBlocks(); void Flush(){} SwDoc* GetDoc(); void ClearDoc(); // Delete Doc-contents. - const String& GetName(); - void SetName( const String& ); + OUString GetName(); + void SetName( const OUString& ); sal_uLong GetError() const { return nErr; } - String GetBaseURL() const; - void SetBaseURL( const String& rURL ); + OUString GetBaseURL() const; + void SetBaseURL( const OUString& rURL ); sal_Bool IsOld() const; sal_uLong ConvertToNew(); // Convert text modules. sal_uInt16 GetCount() const; // Get count text modules. - sal_uInt16 GetIndex( const String& ) const; // Get index of short names. - sal_uInt16 GetLongIndex( const String& ) const; // Get index of long names. - const String& GetShortName( sal_uInt16 ) const; // Get short name for index. - const String& GetLongName( sal_uInt16 ) const; // Get long name for index. + sal_uInt16 GetIndex( const OUString& ) const; // Get index of short names. + sal_uInt16 GetLongIndex( const OUString& ) const; // Get index of long names. + OUString GetShortName( sal_uInt16 ) const; // Get short name for index. + OUString GetLongName( sal_uInt16 ) const; // Get long name for index. sal_Bool Delete( sal_uInt16 ); - sal_uInt16 Rename( sal_uInt16, const String*, const String* ); + sal_uInt16 Rename( sal_uInt16, const OUString*, const OUString* ); sal_uLong CopyBlock( SwTextBlocks& rSource, OUString& rSrcShort, const OUString& rLong ); sal_Bool BeginGetDoc( sal_uInt16 ); // Read text modules. void EndGetDoc(); // Release text modules. - sal_Bool BeginPutDoc( const String&, const String& ); // Begin save. + sal_Bool BeginPutDoc( const OUString&, const OUString& ); // Begin save. sal_uInt16 PutDoc(); // End save. - sal_uInt16 PutText( const String&, const String&, const String& ); // Save (short name, text). + sal_uInt16 PutText( const OUString&, const OUString&, const OUString& ); // Save (short name, text). sal_Bool IsOnlyTextBlock( sal_uInt16 ) const; - sal_Bool IsOnlyTextBlock( const String& rShort ) const; + sal_Bool IsOnlyTextBlock( const OUString& rShort ) const; - const String& GetFileName() const; // Filename of pImp. + OUString GetFileName() const; // Filename of pImp. sal_Bool IsReadOnly() const; // ReadOnly-flag of pImp. sal_Bool GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTbl ); diff --git a/sw/source/core/inc/SwXMLTextBlocks.hxx b/sw/source/core/inc/SwXMLTextBlocks.hxx index b3c1b3b..ec21818 100644 --- a/sw/source/core/inc/SwXMLTextBlocks.hxx +++ b/sw/source/core/inc/SwXMLTextBlocks.hxx @@ -51,36 +51,36 @@ public: com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xBlkRoot; com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xRoot; short nCurBlk; - SwXMLTextBlocks( const String& rFile ); - SwXMLTextBlocks( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String& rFile ); - void AddName( const String&, const String&, const String&, sal_Bool bOnlyTxt = sal_False ); - virtual void AddName( const String&, const String&, sal_Bool bOnlyTxt = sal_False ); - OUString GeneratePackageName ( const String& rShort ); + SwXMLTextBlocks( const OUString& rFile ); + SwXMLTextBlocks( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const OUString& rFile ); + void AddName( const OUString&, const OUString&, const OUString&, sal_Bool bOnlyTxt = sal_False ); + virtual void AddName( const OUString&, const OUString&, sal_Bool bOnlyTxt = sal_False ); + OUString GeneratePackageName ( const OUString& rShort ); virtual ~SwXMLTextBlocks(); //virtual sal_Bool IsOld() const; virtual sal_uLong Delete( sal_uInt16 ); - virtual sal_uLong Rename( sal_uInt16, const String&, const String& ); + virtual sal_uLong Rename( sal_uInt16, const OUString&, const OUString& ); virtual sal_uLong CopyBlock( SwImpBlocks& rImp, OUString& rShort, const OUString& rLong); virtual void ClearDoc(); virtual sal_uLong GetDoc( sal_uInt16 ); - virtual sal_uLong BeginPutDoc( const String&, const String& ); + virtual sal_uLong BeginPutDoc( const OUString&, const OUString& ); virtual sal_uLong PutDoc(); virtual sal_uLong GetText( sal_uInt16, OUString& ); - virtual sal_uLong PutText( const String&, const String&, const OUString& ); + virtual sal_uLong PutText( const OUString&, const OUString&, const OUString& ); virtual sal_uLong MakeBlockList(); virtual short GetFileType ( void ) const; virtual sal_uLong OpenFile( sal_Bool bReadOnly = sal_True ); virtual void CloseFile(); - static sal_Bool IsFileUCBStorage( const String & rFileName); + static sal_Bool IsFileUCBStorage( const OUString & rFileName); // Methods for the new Autocorrecter - sal_uLong GetText( const String& rShort, OUString& ); + sal_uLong GetText( const OUString& rShort, OUString& ); - virtual sal_Bool IsOnlyTextBlock( const String& rShort ) const; + virtual sal_Bool IsOnlyTextBlock( const OUString& rShort ) const; virtual sal_Bool IsOnlyTextBlock( sal_uInt16 nIdx ) const; - virtual void SetIsTextOnly( const String& rShort, sal_Bool bNewValue ); + virtual void SetIsTextOnly( const OUString& rShort, sal_Bool bNewValue ); virtual void SetIsTextOnly( sal_uInt16 nIdx, sal_Bool bNewValue ); virtual sal_uLong GetMacroTable( sal_uInt16, SvxMacroTableDtor& rMacroTbl, @@ -93,11 +93,11 @@ public: public: SwDoc* GetDoc() const { return pDoc; } //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, OUString& rText ); - sal_uLong PutBlockText( const String& rShort, const String& rName, const String& rText, const String& rPackageName ); - void MakeBlockText( const String& rText ); + sal_uLong StartPutBlock( const OUString& rShort, const OUString& rPackageName ); + sal_uLong PutBlock( SwPaM& rPaM, const OUString& rLong ); + sal_uLong GetBlockText( const OUString& rShort, OUString& rText ); + sal_uLong PutBlockText( const OUString& rShort, const OUString& rName, const OUString& rText, const OUString& rPackageName ); + void MakeBlockText( const OUString& rText ); }; diff --git a/sw/source/core/inc/swblocks.hxx b/sw/source/core/inc/swblocks.hxx index 9561e55..e5f0e20 100644 --- a/sw/source/core/inc/swblocks.hxx +++ b/sw/source/core/inc/swblocks.hxx @@ -19,8 +19,6 @@ #ifndef _SWBLOCKS_HXX #define _SWBLOCKS_HXX -#include <tools/string.hxx> - #include <tools/datetime.hxx> #include <o3tl/sorted_vector.hxx> @@ -36,15 +34,15 @@ class SwBlockName friend class SwImpBlocks; sal_uInt16 nHashS, nHashL; // Hash-Codes zum Checken public: - String aShort; // Short name - String aLong; // Long name + OUString aShort; // Short name + OUString aLong; // Long name OUString aPackageName; // Package name sal_Bool bIsOnlyTxtFlagInit : 1; // ist das Flag gueltig? sal_Bool bIsOnlyTxt : 1; // unformatted text sal_Bool bInPutMuchBlocks : 1; // put serveral block entries - SwBlockName( const String& rShort, const String& rLong ); - SwBlockName( const String& rShort, const String& rLong, const String& rPackageName ); + SwBlockName( const OUString& rShort, const OUString& rLong ); + SwBlockName( const OUString& rShort, const OUString& rLong, const OUString& rPackageName ); // fuer das Einsortieren in das Array bool operator==( const SwBlockName& r ) const { return aShort == r.aShort; } @@ -58,11 +56,11 @@ class SwImpBlocks { friend class SwTextBlocks; protected: - String aFile; // physikalischer Dateiname - String aName; // logischer Name der Datei + OUString aFile; // physikalischer Dateiname + OUString aName; // logischer Name der Datei OUString aCur; // aktueller Text - String aShort, aLong; // Kurz- und Langname (PutDoc) - String sBaseURL; // base URL - has to be set at the Readers and Writers + OUString aShort, aLong; // Kurz- und Langname (PutDoc) + OUString sBaseURL; // base URL - has to be set at the Readers and Writers SwBlockNames aNames; // Liste aller Bausteine Date aDateModified; // fuers abgleichen bei den Aktionen Time aTimeModified; @@ -72,10 +70,10 @@ protected: sal_Bool bInPutMuchBlocks : 1; // put serveral block entries sal_Bool bInfoChanged : 1; // any Info of TextBlock is changed - SwImpBlocks( const String&, sal_Bool = sal_False ); + SwImpBlocks( const OUString&, sal_Bool = sal_False ); virtual ~SwImpBlocks(); - static short GetFileType( const String& ); + static short GetFileType( const OUString& ); virtual short GetFileType() const = 0; #define SWBLK_NO_FILE 0 // nicht da #define SWBLK_NONE 1 // keine TB-Datei @@ -85,42 +83,42 @@ protected: virtual void ClearDoc(); // Doc-Inhalt loeschen SwPaM* MakePaM(); // PaM ueber Doc aufspannen - virtual void AddName( const String&, const String&, sal_Bool bOnlyTxt = sal_False ); + virtual void AddName( const OUString&, const OUString&, sal_Bool bOnlyTxt = sal_False ); sal_Bool IsFileChanged() const; void Touch(); public: - static sal_uInt16 Hash( const String& ); // Hashcode fuer Blocknamen + static sal_uInt16 Hash( const OUString& ); // Hashcode fuer Blocknamen sal_uInt16 GetCount() const; // Anzahl Textbausteine ermitteln - sal_uInt16 GetIndex( const String& ) const; // Index fuer Kurznamen ermitteln - sal_uInt16 GetLongIndex( const String& ) const; //Index fuer Langnamen ermitteln - const String& GetShortName( sal_uInt16 ) const; // Kurzname fuer Index zurueck - const String& GetLongName( sal_uInt16 ) const; // Langname fuer Index zurueck + sal_uInt16 GetIndex( const OUString& ) const; // Index fuer Kurznamen ermitteln + sal_uInt16 GetLongIndex( const OUString& ) const; //Index fuer Langnamen ermitteln + OUString GetShortName( sal_uInt16 ) const; // Kurzname fuer Index zurueck + OUString GetLongName( sal_uInt16 ) const; // Langname fuer Index zurueck OUString GetPackageName( sal_uInt16 ) const; // Langname fuer Index zurueck - const String& GetFileName() const {return aFile;} // phys. Dateinamen liefern - void SetName( const String& rName ) // logic name + OUString GetFileName() const {return aFile;} // phys. Dateinamen liefern + void SetName( const OUString& rName ) // logic name { aName = rName; bInfoChanged = sal_True; } - const String & GetName( void ) + OUString GetName( void ) { return aName; } - const String& GetBaseURL() const { return sBaseURL;} - void SetBaseURL( const String& rURL ) { sBaseURL = rURL; } + OUString GetBaseURL() const { return sBaseURL;} + void SetBaseURL( const OUString& rURL ) { sBaseURL = rURL; } virtual sal_uLong Delete( sal_uInt16 ) = 0; - virtual sal_uLong Rename( sal_uInt16, const String&, const String& ) = 0; + virtual sal_uLong Rename( sal_uInt16, const OUString&, const OUString& ) = 0; virtual sal_uLong CopyBlock( SwImpBlocks& rImp, OUString& rShort, const OUString& rLong) = 0; virtual sal_uLong GetDoc( sal_uInt16 ) = 0; - virtual sal_uLong BeginPutDoc( const String&, const String& ) = 0; + virtual sal_uLong BeginPutDoc( const OUString&, const OUString& ) = 0; virtual sal_uLong PutDoc() = 0; virtual sal_uLong GetText( sal_uInt16, OUString& ) = 0; - virtual sal_uLong PutText( const String&, const String&, const OUString& ) = 0; + virtual sal_uLong PutText( const OUString&, const OUString&, const OUString& ) = 0; virtual sal_uLong MakeBlockList() = 0; virtual sal_uLong OpenFile( sal_Bool bReadOnly = sal_True ) = 0; virtual void CloseFile() = 0; - virtual sal_Bool IsOnlyTextBlock( const String& rShort ) const; + virtual sal_Bool IsOnlyTextBlock( const OUString& rShort ) const; virtual sal_uLong GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTbl, sal_Bool bFileAlreadyOpen = sal_False ); diff --git a/sw/source/core/swg/SwXMLBlockListContext.cxx b/sw/source/core/swg/SwXMLBlockListContext.cxx index 442156e..ecbbcae 100644 --- a/sw/source/core/swg/SwXMLBlockListContext.cxx +++ b/sw/source/core/swg/SwXMLBlockListContext.cxx @@ -83,7 +83,9 @@ SwXMLBlockContext::SwXMLBlockContext( SvXMLImportContext ( rImport, nPrefix, rLocalName ) { static const CharClass & rCC = GetAppCharClass(); - String aShort, aLong, aPackageName; + OUString aShort; + OUString aLong; + OUString aPackageName; sal_Bool bTextOnly = sal_False; sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; @@ -114,7 +116,7 @@ SwXMLBlockContext::SwXMLBlockContext( } } } - if (!aShort.Len() || !aLong.Len() || !aPackageName.Len()) + if (aShort.isEmpty() || aLong.isEmpty() || aPackageName.isEmpty()) return; rImport.getBlockList().AddName( aShort, aLong, aPackageName, bTextOnly); } diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx index 1a35392..ad9645c 100644 --- a/sw/source/core/swg/SwXMLTextBlocks.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks.cxx @@ -56,7 +56,7 @@ void SwXMLTextBlocks::ResetBlockMode ( ) xRoot = 0; } -SwXMLTextBlocks::SwXMLTextBlocks( const String& rFile ) +SwXMLTextBlocks::SwXMLTextBlocks( const OUString& rFile ) : SwImpBlocks( rFile ), bAutocorrBlock( sal_False ), nFlags ( 0 ) { SwDocShell* pDocSh = new SwDocShell ( SFX_CREATE_MODE_INTERNAL ); @@ -97,7 +97,7 @@ SwXMLTextBlocks::SwXMLTextBlocks( const String& rFile ) bInfoChanged = sal_False; } -SwXMLTextBlocks::SwXMLTextBlocks( const uno::Reference < embed::XStorage >& rStg, const String& rName ) +SwXMLTextBlocks::SwXMLTextBlocks( const uno::Reference < embed::XStorage >& rStg, const OUString& rName ) : SwImpBlocks( rName ) , bAutocorrBlock( sal_True ) , nFlags ( 0 ) @@ -138,7 +138,7 @@ void SwXMLTextBlocks::ClearDoc() pDoc->ClearDoc(); pDocShell->ClearEmbeddedObjects(); } -void SwXMLTextBlocks::AddName( const String& rShort, const String& rLong, sal_Bool bOnlyTxt ) +void SwXMLTextBlocks::AddName( const OUString& rShort, const OUString& rLong, sal_Bool bOnlyTxt ) { sal_uInt16 nIdx = GetIndex( rShort ); SwBlockName* pNew = NULL; @@ -156,8 +156,8 @@ void SwXMLTextBlocks::AddName( const String& rShort, const String& rLong, sal_Bo aNames.insert( pNew ); bInfoChanged = sal_True; } -void SwXMLTextBlocks::AddName( const String& rShort, const String& rLong, - const String& rPackageName, sal_Bool bOnlyTxt ) +void SwXMLTextBlocks::AddName( const OUString& rShort, const OUString& rLong, + const OUString& rPackageName, sal_Bool bOnlyTxt ) { sal_uInt16 nIdx = GetIndex( rShort ); if( nIdx != (sal_uInt16) -1 ) @@ -174,7 +174,7 @@ void SwXMLTextBlocks::AddName( const String& rShort, const String& rLong, sal_uLong SwXMLTextBlocks::Delete( sal_uInt16 n ) { - String aPckName (aNames[n]->aPackageName); + const OUString aPckName (aNames[n]->aPackageName); uno::Reference < container::XNameAccess > xAccess( xBlkRoot, uno::UNO_QUERY ); if ( xAccess.is() && xAccess->hasByName( aPckName ) && xBlkRoot->isStreamElement( aPckName ) ) @@ -195,7 +195,7 @@ sal_uLong SwXMLTextBlocks::Delete( sal_uInt16 n ) return 0; } -sal_uLong SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const String& rNewShort, const String& ) +sal_uLong SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const OUString& rNewShort, const OUString& ) { OSL_ENSURE( xBlkRoot.is(), "No storage set" ); if(!xBlkRoot.is()) @@ -250,10 +250,10 @@ sal_uLong SwXMLTextBlocks::CopyBlock( SwImpBlocks& rDestImp, OUString& rShort, sal_uLong nError = 0; OpenFile(sal_True); rDestImp.OpenFile(sal_False); - String aGroup( rShort ); + const OUString aGroup( rShort ); sal_Bool bTextOnly = IsOnlyTextBlock ( rShort ) ;//pImp->pBlkRoot->IsStream( aGroup ); sal_uInt16 nIndex = GetIndex ( rShort ); - String sDestShortName( GetPackageName (nIndex) ); + OUString sDestShortName( GetPackageName (nIndex) ); sal_uInt16 nIdx = 0; OSL_ENSURE( xBlkRoot.is(), "No storage set" ); @@ -297,7 +297,7 @@ sal_uLong SwXMLTextBlocks::CopyBlock( SwImpBlocks& rDestImp, OUString& rShort, } -sal_uLong SwXMLTextBlocks::StartPutBlock( const String& rShort, const String& rPackageName ) +sal_uLong SwXMLTextBlocks::StartPutBlock( const OUString& rShort, const OUString& rPackageName ) { OSL_ENSURE( xBlkRoot.is(), "No storage set" ); if(!xBlkRoot.is()) @@ -317,7 +317,8 @@ sal_uLong SwXMLTextBlocks::StartPutBlock( const String& rShort, const String& rP } return 0; } -sal_uLong SwXMLTextBlocks::BeginPutDoc( const String& rShort, const String& rLong ) + +sal_uLong SwXMLTextBlocks::BeginPutDoc( const OUString& rShort, const OUString& rLong ) { // In der Basisklasse ablegen! aShort = rShort; @@ -327,7 +328,7 @@ sal_uLong SwXMLTextBlocks::BeginPutDoc( const String& rShort, const String& rLon return StartPutBlock (rShort, aPackageName); } -sal_uLong SwXMLTextBlocks::PutBlock( SwPaM& , const String& ) +sal_uLong SwXMLTextBlocks::PutBlock( SwPaM& , const OUString& ) { sal_uLong nRes = 0; sal_uInt16 nCommitFlags = nFlags & (SWXML_CONVBLOCK|SWXML_NOROOTCOMMIT); @@ -419,7 +420,7 @@ sal_uLong SwXMLTextBlocks::GetText( sal_uInt16 nIdx, OUString& rText ) return GetBlockText( aNames[ nIdx ]->aShort, rText ); } -sal_uLong SwXMLTextBlocks::GetText( const String& rShort, OUString& rText ) +sal_uLong SwXMLTextBlocks::GetText( const OUString& rShort, OUString& rText ) { return GetBlockText( rShort, rText ); } @@ -504,7 +505,7 @@ void SwXMLTextBlocks::CloseFile() } } -void SwXMLTextBlocks::SetIsTextOnly( const String& rShort, sal_Bool bNewValue ) +void SwXMLTextBlocks::SetIsTextOnly( const OUString& rShort, sal_Bool bNewValue ) { sal_uInt16 nIdx = GetIndex ( rShort ); if (nIdx != (sal_uInt16) -1 && nIdx != USHRT_MAX) @@ -516,7 +517,7 @@ void SwXMLTextBlocks::SetIsTextOnly( sal_uInt16 nIdx, sal_Bool bNewValue ) aNames[nIdx]->bIsOnlyTxt = bNewValue; } -sal_Bool SwXMLTextBlocks::IsOnlyTextBlock( const String& rShort ) const +sal_Bool SwXMLTextBlocks::IsOnlyTextBlock( const OUString& rShort ) const { sal_uInt16 nIdx = GetIndex ( rShort ); sal_Bool bRet = sal_False; @@ -531,7 +532,7 @@ sal_Bool SwXMLTextBlocks::IsOnlyTextBlock( sal_uInt16 nIdx ) const return aNames[nIdx]->bIsOnlyTxt; } -sal_Bool SwXMLTextBlocks::IsFileUCBStorage( const String & rFileName) +sal_Bool SwXMLTextBlocks::IsFileUCBStorage( const OUString & rFileName) { OUString aName( rFileName ); INetURLObject aObj( aName ); @@ -556,22 +557,30 @@ short SwXMLTextBlocks::GetFileType ( void ) const return SWBLK_XML; } -OUString SwXMLTextBlocks::GeneratePackageName ( const String& rShort ) +OUString SwXMLTextBlocks::GeneratePackageName ( const OUString& rShort ) { - String aRet = rShort; - xub_StrLen nPos = 0; - sal_Unicode pDelims[] = { '!', '/', ':', '.', '\\', 0 }; - OString sByte(OUStringToOString(aRet, RTL_TEXTENCODING_UTF7)); - aRet = OStringToOUString(sByte, RTL_TEXTENCODING_ASCII_US); - while( STRING_NOTFOUND != ( nPos = aRet.SearchChar( pDelims, nPos ))) + OString sByte(OUStringToOString(rShort, RTL_TEXTENCODING_UTF7)); + OUStringBuffer aBuf(OStringToOUString(sByte, RTL_TEXTENCODING_ASCII_US)); + const sal_Int32 nLen = aBuf.getLength(); + for (sal_Int32 nPos=0; nPos<nLen; ++nPos) { - aRet.SetChar( nPos, '_' ); - ++nPos; + switch (aBuf[nPos]) + { + case '!': + case '/': + case ':': + case '.': + case '\\': + aBuf[nPos] = '_'; + break; + default: + break; + } } - return aRet; + return aBuf.makeStringAndClear(); } -sal_uLong SwXMLTextBlocks::PutText( const String& rShort, const String& rName, +sal_uLong SwXMLTextBlocks::PutText( const OUString& rShort, const OUString& rName, const OUString& rText ) { sal_uLong nRes = 0; @@ -585,7 +594,7 @@ sal_uLong SwXMLTextBlocks::PutText( const String& rShort, const String& rName, return nRes; } -void SwXMLTextBlocks::MakeBlockText( const String& rText ) +void SwXMLTextBlocks::MakeBlockText( const OUString& rText ) { SwTxtNode* pTxtNode = pDoc->GetNodes()[ pDoc->GetNodes().GetEndOfContent(). GetIndex() - 1 ]->GetTxtNode(); @@ -600,8 +609,7 @@ void SwXMLTextBlocks::MakeBlockText( const String& rText ) pTxtNode = (SwTxtNode*)pTxtNode->AppendNode( SwPosition( *pTxtNode ) ); } SwIndex aIdx( pTxtNode ); - String sTemp(rText.GetToken( 0, '\015', nPos ) ); - pTxtNode->InsertText( sTemp, aIdx ); + pTxtNode->InsertText( rText.getToken( 0, '\015', nPos ), aIdx ); } while ( -1 != nPos ); } diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index eaa0ace..c0b05cb 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -50,7 +50,7 @@ using ::xmloff::token::GetXMLToken; sal_uLong SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx ) { - String aFolderName ( GetPackageName ( nIdx ) ); + OUString aFolderName ( GetPackageName ( nIdx ) ); if (!IsOnlyTextBlock ( nIdx ) ) { @@ -86,7 +86,7 @@ sal_uLong SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx ) } else { - String aStreamName = aFolderName + OUString(".xml"); + OUString aStreamName = aFolderName + ".xml"; try { xRoot = xBlkRoot->openStorageElement( aFolderName, embed::ElementModes::READ ); @@ -266,12 +266,12 @@ sal_uLong SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, } -sal_uLong SwXMLTextBlocks::GetBlockText( const String& rShort, OUString& rText ) +sal_uLong SwXMLTextBlocks::GetBlockText( const OUString& rShort, OUString& rText ) { sal_uLong n = 0; sal_Bool bTextOnly = sal_True; - String aFolderName = GeneratePackageName ( rShort ); - String aStreamName = aFolderName + OUString(".xml"); + OUString aFolderName = GeneratePackageName ( rShort ); + OUString aStreamName = aFolderName + ".xml"; rText = OUString(); try @@ -329,8 +329,8 @@ sal_uLong SwXMLTextBlocks::GetBlockText( const String& rShort, OUString& rText ) return n; } -sal_uLong SwXMLTextBlocks::PutBlockText( const String& rShort, const String& , - const String& rText, const String& rPackageName ) +sal_uLong SwXMLTextBlocks::PutBlockText( const OUString& rShort, const OUString& , + const OUString& rText, const OUString& rPackageName ) { GetIndex ( rShort ); /* @@ -340,8 +340,8 @@ sal_uLong SwXMLTextBlocks::PutBlockText( const String& rShort, const String& , xBlkRoot->Commit ( ); } */ - String aFolderName( rPackageName ); - String aStreamName = aFolderName + OUString(".xml"); + OUString aFolderName( rPackageName ); + OUString aStreamName = aFolderName + ".xml"; uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); diff --git a/sw/source/core/swg/swblocks.cxx b/sw/source/core/swg/swblocks.cxx index 3045aa5..2193ea0 100644 --- a/sw/source/core/swg/swblocks.cxx +++ b/sw/source/core/swg/swblocks.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <algorithm> + #include <sfx2/docfilt.hxx> #include <sot/storage.hxx> #include <tools/urlobj.hxx> @@ -43,27 +45,27 @@ // Hash-Code errechnen (muss nicht eindeutig sein) -sal_uInt16 SwImpBlocks::Hash( const String& r ) +sal_uInt16 SwImpBlocks::Hash( const OUString& r ) { sal_uInt16 n = 0; - xub_StrLen nLen = r.Len(); - if( nLen > 8 ) - nLen = 8; - const sal_Unicode* p = r.GetBuffer(); - while( nLen-- ) - n = ( n << 1 ) + *p++; + // std::min requires an explicit cast to sal_Int32 on 32bit platforms + const sal_Int32 nLen = std::min(r.getLength(), static_cast<sal_Int32>(8)); + for (sal_Int32 i=0; i<nLen; ++i) + { + n = ( n << 1 ) + r[i]; + } return n; } -SwBlockName::SwBlockName( const String& rShort, const String& rLong ) +SwBlockName::SwBlockName( const OUString& rShort, const OUString& rLong ) : aShort( rShort ), aLong( rLong ), aPackageName (rShort), bIsOnlyTxtFlagInit( sal_False ), bIsOnlyTxt( sal_False ) { nHashS = SwImpBlocks::Hash( rShort ); nHashL = SwImpBlocks::Hash( rLong ); } -SwBlockName::SwBlockName( const String& rShort, const String& rLong, const String& rPackageName) +SwBlockName::SwBlockName( const OUString& rShort, const OUString& rLong, const OUString& rPackageName) : aShort( rShort ), aLong( rLong ), aPackageName (rPackageName), bIsOnlyTxtFlagInit( sal_False ), bIsOnlyTxt( sal_False ) { @@ -74,7 +76,7 @@ SwBlockName::SwBlockName( const String& rShort, const String& rLong, const Strin // Ist die angegebene Datei ein Storage oder gibt es sie nicht? -short SwImpBlocks::GetFileType( const String& rFile ) +short SwImpBlocks::GetFileType( const OUString& rFile ) { if( !FStatHelper::IsDocument( rFile ) ) return SWBLK_NO_FILE; @@ -87,7 +89,7 @@ short SwImpBlocks::GetFileType( const String& rFile ) } -SwImpBlocks::SwImpBlocks( const String& rFile, sal_Bool ) +SwImpBlocks::SwImpBlocks( const OUString& rFile, sal_Bool ) : aFile( rFile ), aDateModified( Date::EMPTY ), aTimeModified( Time::EMPTY ), @@ -97,7 +99,7 @@ SwImpBlocks::SwImpBlocks( const String& rFile, sal_Bool ) FStatHelper::GetModifiedDateTimeOfFile( rFile, &aDateModified, &aTimeModified ); INetURLObject aObj(rFile); - aObj.setExtension( aEmptyStr ); + aObj.setExtension( OUString() ); aName = aObj.GetBase(); } @@ -131,10 +133,10 @@ sal_uInt16 SwImpBlocks::GetCount() const } // Case Insensitive -sal_uInt16 SwImpBlocks::GetIndex( const String& rShort ) const +sal_uInt16 SwImpBlocks::GetIndex( const OUString& rShort ) const { - String s( GetAppCharClass().uppercase( rShort ) ); - sal_uInt16 nHash = Hash( s ); + const OUString s( GetAppCharClass().uppercase( rShort ) ); + const sal_uInt16 nHash = Hash( s ); for( sal_uInt16 i = 0; i < aNames.size(); i++ ) { const SwBlockName* pName = aNames[ i ]; @@ -146,7 +148,7 @@ sal_uInt16 SwImpBlocks::GetIndex( const String& rShort ) const } -sal_uInt16 SwImpBlocks::GetLongIndex( const String& rLong ) const +sal_uInt16 SwImpBlocks::GetLongIndex( const OUString& rLong ) const { sal_uInt16 nHash = Hash( rLong ); for( sal_uInt16 i = 0; i < aNames.size(); i++ ) @@ -160,19 +162,19 @@ sal_uInt16 SwImpBlocks::GetLongIndex( const String& rLong ) const } -const String& SwImpBlocks::GetShortName( sal_uInt16 n ) const +OUString SwImpBlocks::GetShortName( sal_uInt16 n ) const { if( n < aNames.size() ) return aNames[n]->aShort; - return aEmptyStr; + return OUString(); } -const String& SwImpBlocks::GetLongName( sal_uInt16 n ) const +OUString SwImpBlocks::GetLongName( sal_uInt16 n ) const { if( n < aNames.size() ) return aNames[n]->aLong; - return aEmptyStr; + return OUString(); } OUString SwImpBlocks::GetPackageName( sal_uInt16 n ) const @@ -182,7 +184,7 @@ OUString SwImpBlocks::GetPackageName( sal_uInt16 n ) const return OUString(); } -void SwImpBlocks::AddName( const String& rShort, const String& rLong, +void SwImpBlocks::AddName( const OUString& rShort, const OUString& rLong, sal_Bool bOnlyTxt ) { sal_uInt16 nIdx = GetIndex( rShort ); @@ -216,7 +218,7 @@ void SwImpBlocks::Touch() &aDateModified, &aTimeModified ); } -sal_Bool SwImpBlocks::IsOnlyTextBlock( const String& ) const +sal_Bool SwImpBlocks::IsOnlyTextBlock( const OUString& ) const { return sal_False; } @@ -240,11 +242,11 @@ sal_Bool SwImpBlocks::PutMuchEntries( sal_Bool ) //////////////////////////////////////////////////////////////////////////// -SwTextBlocks::SwTextBlocks( const String& rFile ) +SwTextBlocks::SwTextBlocks( const OUString& rFile ) : pImp( 0 ), nErr( 0 ) { INetURLObject aObj(rFile); - String sFileName = aObj.GetMainURL( INetURLObject::NO_DECODE ); + const OUString sFileName = aObj.GetMainURL( INetURLObject::NO_DECODE ); switch( SwImpBlocks::GetFileType( rFile ) ) { case SWBLK_XML: pImp = new SwXMLTextBlocks( sFileName ); break; @@ -259,13 +261,13 @@ SwTextBlocks::~SwTextBlocks() delete pImp; } -const String& SwTextBlocks::GetName() +OUString SwTextBlocks::GetName() { - return pImp ? pImp->aName : aEmptyStr; + return pImp ? pImp->aName : OUString(); } -void SwTextBlocks::SetName( const String& r ) +void SwTextBlocks::SetName( const OUString& r ) { if( pImp ) pImp->SetName( r ); @@ -290,27 +292,27 @@ sal_uInt16 SwTextBlocks::GetCount() const } -sal_uInt16 SwTextBlocks::GetIndex( const String& r ) const +sal_uInt16 SwTextBlocks::GetIndex( const OUString& r ) const { return pImp ? pImp->GetIndex( r ) : (sal_uInt16) -1; } -sal_uInt16 SwTextBlocks::GetLongIndex( const String& r ) const +sal_uInt16 SwTextBlocks::GetLongIndex( const OUString& r ) const { return pImp ? (sal_uInt16)(pImp->GetLongIndex( r )) : (sal_uInt16) -1; } -const String& SwTextBlocks::GetShortName( sal_uInt16 n ) const +OUString SwTextBlocks::GetShortName( sal_uInt16 n ) const { if( pImp ) return pImp->GetShortName( n ); - return aEmptyStr; + return OUString(); } -const String& SwTextBlocks::GetLongName( sal_uInt16 n ) const +OUString SwTextBlocks::GetLongName( sal_uInt16 n ) const { if( pImp ) return pImp->GetLongName( n ); @@ -346,18 +348,19 @@ sal_Bool SwTextBlocks::Delete( sal_uInt16 n ) } -sal_uInt16 SwTextBlocks::Rename( sal_uInt16 n, const String* s, const String* l ) +sal_uInt16 SwTextBlocks::Rename( sal_uInt16 n, const OUString* s, const OUString* l ) { sal_uInt16 nIdx = (sal_uInt16)-1; if( pImp && !pImp->bInPutMuchBlocks ) { pImp->nCur = nIdx; - String aNew, aLong; + OUString aNew; + OUString aLong; if( s ) aNew = aLong = *s; if( l ) aLong = *l; - if( !aNew.Len() ) + if( aNew.isEmpty() ) { OSL_ENSURE( !this, "Kein Kurzname in Rename angegeben" ); nErr = ERR_SWG_INTERNAL_ERROR; return (sal_uInt16) -1; @@ -439,7 +442,7 @@ void SwTextBlocks::EndGetDoc() } -sal_Bool SwTextBlocks::BeginPutDoc( const String& s, const String& l ) +sal_Bool SwTextBlocks::BeginPutDoc( const OUString& s, const OUString& l ) { if( pImp ) { @@ -454,7 +457,7 @@ sal_Bool SwTextBlocks::BeginPutDoc( const String& s, const String& l ) } if( bOk ) { - String aNew = GetAppCharClass().uppercase(s); + const OUString aNew = GetAppCharClass().uppercase(s); nErr = pImp->BeginPutDoc( aNew, l ); } if( nErr ) @@ -493,8 +496,8 @@ sal_uInt16 SwTextBlocks::PutDoc() return nIdx; } -sal_uInt16 SwTextBlocks::PutText( const String& rShort, const String& rName, - const String& rTxt ) +sal_uInt16 SwTextBlocks::PutText( const OUString& rShort, const OUString& rName, + const OUString& rTxt ) { sal_uInt16 nIdx = (sal_uInt16) -1; if( pImp ) @@ -510,7 +513,7 @@ sal_uInt16 SwTextBlocks::PutText( const String& rShort, const String& rName, } if( bOk ) { - String aNew = GetAppCharClass().uppercase( rShort ); + OUString aNew = GetAppCharClass().uppercase( rShort ); nErr = pImp->PutText( aNew, rName, rTxt ); pImp->nCur = (sal_uInt16) -1; if( !nErr ) @@ -553,7 +556,7 @@ void SwTextBlocks::ClearDoc() } -const String& SwTextBlocks::GetFileName() const +OUString SwTextBlocks::GetFileName() const { return pImp->GetFileName(); } @@ -582,7 +585,7 @@ sal_Bool SwTextBlocks::IsOnlyTextBlock( sal_uInt16 nIdx ) const return bRet; } -sal_Bool SwTextBlocks::IsOnlyTextBlock( const String& rShort ) const +sal_Bool SwTextBlocks::IsOnlyTextBlock( const OUString& rShort ) const { sal_uInt16 nIdx = pImp->GetIndex( rShort ); if( USHRT_MAX != nIdx ) @@ -627,15 +630,14 @@ void SwTextBlocks::EndPutMuchBlockEntries() pImp->PutMuchEntries( sal_False ); } -String SwTextBlocks::GetBaseURL() const +OUString SwTextBlocks::GetBaseURL() const { - String sRet; if(pImp) - sRet = pImp->GetBaseURL(); - return sRet; + return pImp->GetBaseURL(); + return OUString(); } -void SwTextBlocks::SetBaseURL( const String& rURL ) +void SwTextBlocks::SetBaseURL( const OUString& rURL ) { if(pImp) pImp->SetBaseURL(rURL); diff --git a/sw/source/ui/dochdl/gloshdl.cxx b/sw/source/ui/dochdl/gloshdl.cxx index 95c8b45..0641bce 100644 --- a/sw/source/ui/dochdl/gloshdl.cxx +++ b/sw/source/ui/dochdl/gloshdl.cxx @@ -66,9 +66,9 @@ const short RET_EDIT = 100; // PUBLIC METHODS ------------------------------------------------------- struct TextBlockInfo_Impl { - String sTitle; - String sLongName; - String sGroupName; + OUString sTitle; + OUString sLongName; + OUString sGroupName; }; typedef boost::ptr_vector<TextBlockInfo_Impl> TextBlockInfoArr; SV_IMPL_REF( SwDocShell ) @@ -81,7 +81,8 @@ void SwGlossaryHdl::GlossaryDlg() OSL_ENSURE(pFact, "Dialogdiet fail!"); AbstractGlossaryDlg* pDlg = pFact->CreateGlossaryDlg(pViewFrame, this, pWrtShell); OSL_ENSURE(pDlg, "Dialogdiet fail!"); - String sName, sShortName; + OUString sName; + OUString sShortName; if( RET_EDIT == pDlg->Execute() ) { @@ -96,13 +97,13 @@ void SwGlossaryHdl::GlossaryDlg() GetGlossaryList()->ClearGroups(); } - if( sName.Len() || sShortName.Len() ) + if( !sName.isEmpty() || !sShortName.isEmpty() ) rStatGlossaries.EditGroupDoc( sName, sShortName ); } // set the default group; if called from the dialog // the group is created temporarily for faster access -void SwGlossaryHdl::SetCurGroup(const String &rGrp, sal_Bool bApi, sal_Bool bAlwaysCreateNew ) +void SwGlossaryHdl::SetCurGroup(const OUString &rGrp, sal_Bool bApi, sal_Bool bAlwaysCreateNew ) { OUString sGroup(rGrp); if (sGroup.indexOf(GLOS_DELIM)<0 && !FindGroupName(sGroup)) @@ -117,7 +118,7 @@ void SwGlossaryHdl::SetCurGroup(const String &rGrp, sal_Bool bApi, sal_Bool bAlw INetURLObject aTemp( pCurGrp->GetFileName() ); const OUString sCurBase = aTemp.getBase(); aTemp.removeSegment(); - const String sCurEntryPath = aTemp.GetMainURL(INetURLObject::NO_DECODE); + const OUString sCurEntryPath = aTemp.GetMainURL(INetURLObject::NO_DECODE); const std::vector<String> & rPathArr = rStatGlossaries.GetPathArray(); sal_uInt16 nCurrentPath = USHRT_MAX; @@ -239,7 +240,7 @@ sal_Bool SwGlossaryHdl::CopyOrMove( const OUString& rSourceGroupName, OUString& } // delete a autotext-file-group -sal_Bool SwGlossaryHdl::DelGroup(const String &rGrpName) +sal_Bool SwGlossaryHdl::DelGroup(const OUString &rGrpName) { OUString sGroup(rGrpName); if (sGroup.indexOf(GLOS_DELIM)<0) @@ -248,8 +249,7 @@ sal_Bool SwGlossaryHdl::DelGroup(const String &rGrpName) { if(pCurGrp) { - const OUString aMac_Tmp(pCurGrp->GetName()); - if(aMac_Tmp == sGroup) + if (pCurGrp->GetName() == sGroup) DELETEZ(pCurGrp); } return sal_True; @@ -264,22 +264,22 @@ sal_uInt16 SwGlossaryHdl::GetGlossaryCnt() return pCurGrp ? pCurGrp->GetCount() : 0; } -String SwGlossaryHdl::GetGlossaryName( sal_uInt16 nId ) +OUString SwGlossaryHdl::GetGlossaryName( sal_uInt16 nId ) { OSL_ENSURE(nId < GetGlossaryCnt(), "Textbausteinarray ueberindiziert."); return pCurGrp->GetLongName( nId ); } -String SwGlossaryHdl::GetGlossaryShortName(sal_uInt16 nId) +OUString SwGlossaryHdl::GetGlossaryShortName(sal_uInt16 nId) { OSL_ENSURE(nId < GetGlossaryCnt(), "Textbausteinarray ueberindiziert."); return pCurGrp->GetShortName( nId ); } // ask for short name -String SwGlossaryHdl::GetGlossaryShortName(const String &rName) +OUString SwGlossaryHdl::GetGlossaryShortName(const OUString &rName) { - String sReturn; + OUString sReturn; SwTextBlocks *pTmp = pCurGrp ? pCurGrp: rStatGlossaries.GetGroupDoc( aCurGrp, sal_False ); if(pTmp) @@ -294,7 +294,7 @@ String SwGlossaryHdl::GetGlossaryShortName(const String &rName) } // short name for autotext already used? -sal_Bool SwGlossaryHdl::HasShortName(const String& rShortName) const +sal_Bool SwGlossaryHdl::HasShortName(const OUString& rShortName) const { SwTextBlocks *pBlock = pCurGrp ? pCurGrp : rStatGlossaries.GetGroupDoc( aCurGrp ); @@ -310,7 +310,7 @@ sal_Bool SwGlossaryHdl::ConvertToNew(SwTextBlocks& /*rOld*/) } // Create autotext -sal_Bool SwGlossaryHdl::NewGlossary(const String& rName, const String& rShortName, +sal_Bool SwGlossaryHdl::NewGlossary(const OUString& rName, const OUString& rShortName, sal_Bool bCreateGroup, sal_Bool bNoAttr) { SwTextBlocks *pTmp = @@ -344,7 +344,7 @@ sal_Bool SwGlossaryHdl::NewGlossary(const String& rName, const String& rShortNam } // Delete a autotext -sal_Bool SwGlossaryHdl::DelGlossary(const String &rShortName) +sal_Bool SwGlossaryHdl::DelGlossary(const OUString &rShortName) { SwTextBlocks *pGlossary = pCurGrp ? pCurGrp : rStatGlossaries.GetGroupDoc(aCurGrp); @@ -374,7 +374,7 @@ sal_Bool SwGlossaryHdl::ExpandGlossary() FindGroupName(sGroupName); pGlossary = rStatGlossaries.GetGroupDoc(sGroupName); - String aShortName; + OUString aShortName; // use this at text selection if(pWrtShell->SwCrsrShell::HasSelection() && !pWrtShell->IsBlockMode()) @@ -398,12 +398,12 @@ sal_Bool SwGlossaryHdl::ExpandGlossary() return pGlossary ? Expand( aShortName, &rStatGlossaries, pGlossary ) : sal_False; } -sal_Bool SwGlossaryHdl::Expand( const String& rShortName, +sal_Bool SwGlossaryHdl::Expand( const OUString& rShortName, SwGlossaries *pGlossaries, SwTextBlocks *pGlossary ) { TextBlockInfoArr aFoundArr; - String aShortName( rShortName ); + OUString aShortName( rShortName ); sal_Bool bCancel = sal_False; // search for text block // - don't prefer current group depending on configuration setting @@ -488,14 +488,13 @@ sal_Bool SwGlossaryHdl::Expand( const String& rShortName, { pGlossaries->PutGroupDoc(pGlossary); - const sal_uInt16 nMaxLen = 50; - if(pWrtShell->IsSelection() && aShortName.Len() > nMaxLen) + const sal_Int32 nMaxLen = 50; + if(pWrtShell->IsSelection() && aShortName.getLength() > nMaxLen) { - aShortName.Erase(nMaxLen); - aShortName.AppendAscii(" ..."); + aShortName = aShortName.copy(0, nMaxLen) + " ..."; } - String aTmp( SW_RES(STR_NOGLOS)); - aTmp.SearchAndReplaceAscii("%1", aShortName); + OUString aTmp( SW_RES(STR_NOGLOS)); + aTmp = aTmp.replaceFirst("%1", aShortName); InfoBox( pWrtShell->GetView().GetWindow(), aTmp ).Execute(); } @@ -538,7 +537,7 @@ sal_Bool SwGlossaryHdl::Expand( const String& rShortName, } // add autotext -bool SwGlossaryHdl::InsertGlossary(const String &rName) +bool SwGlossaryHdl::InsertGlossary(const OUString &rName) { OSL_ENSURE(pWrtShell->CanInsert(), "illegal"); @@ -582,7 +581,7 @@ bool SwGlossaryHdl::InsertGlossary(const String &rName) } // set / ask for macro -void SwGlossaryHdl::SetMacros(const String& rShortName, +void SwGlossaryHdl::SetMacros(const OUString& rShortName, const SvxMacro* pStart, const SvxMacro* pEnd, SwTextBlocks *pGlossary ) @@ -603,7 +602,7 @@ void SwGlossaryHdl::SetMacros(const String& rShortName, rStatGlossaries.PutGroupDoc(pGlos); } -void SwGlossaryHdl::GetMacros( const String &rShortName, +void SwGlossaryHdl::GetMacros( const OUString &rShortName, SvxMacro& rStart, SvxMacro& rEnd, SwTextBlocks *pGlossary ) @@ -648,8 +647,8 @@ SwGlossaryHdl::~SwGlossaryHdl() } // rename an autotext -sal_Bool SwGlossaryHdl::Rename(const String& rOldShort, const String& rNewShortName, - const String& rNewName ) +sal_Bool SwGlossaryHdl::Rename(const OUString& rOldShort, const OUString& rNewShortName, + const OUString& rNewName ) { sal_Bool bRet = sal_False; SwTextBlocks *pGlossary = pCurGrp ? pCurGrp @@ -667,9 +666,7 @@ sal_Bool SwGlossaryHdl::Rename(const String& rOldShort, const String& rNewShortN (nOldLongIdx == USHRT_MAX || nOldLongIdx == nIdx )&& (nOldIdx == USHRT_MAX || nOldIdx == nIdx )) { - String aNewShort( rNewShortName ); - String aNewName( rNewName ); - pGlossary->Rename( nIdx, &aNewShort, &aNewName ); + pGlossary->Rename( nIdx, &rNewShortName, &rNewName ); bRet = pGlossary->GetError() == 0; } if( !pCurGrp ) @@ -713,7 +710,7 @@ sal_Bool SwGlossaryHdl::FindGroupName(OUString& rGroup) return rStatGlossaries.FindGroupName(rGroup); } -sal_Bool SwGlossaryHdl::CopyToClipboard(SwWrtShell& rSh, const String& rShortName) +sal_Bool SwGlossaryHdl::CopyToClipboard(SwWrtShell& rSh, const OUString& rShortName) { SwTextBlocks *pGlossary = pCurGrp ? pCurGrp : rStatGlossaries.GetGroupDoc(aCurGrp); @@ -728,10 +725,10 @@ sal_Bool SwGlossaryHdl::CopyToClipboard(SwWrtShell& rSh, const String& rShortNam return 0 != nRet; } -sal_Bool SwGlossaryHdl::ImportGlossaries( const String& rName ) +sal_Bool SwGlossaryHdl::ImportGlossaries( const OUString& rName ) { sal_Bool bRet = sal_False; - if( rName.Len() ) + if( !rName.isEmpty() ) { const SfxFilter* pFilter = 0; SfxMedium* pMed = new SfxMedium( rName, STREAM_READ, 0, 0 ); diff --git a/sw/source/ui/inc/gloshdl.hxx b/sw/source/ui/inc/gloshdl.hxx index b397ec1..e5f8790 100644 --- a/sw/source/ui/inc/gloshdl.hxx +++ b/sw/source/ui/inc/gloshdl.hxx @@ -19,7 +19,7 @@ #ifndef _GLOSHDL_HXX #define _GLOSHDL_HXX -#include <tools/string.hxx> +#include <rtl/ustring.hxx> #include "swdllapi.h" class SwWrtShell; @@ -33,16 +33,16 @@ class SW_DLLPUBLIC SwGlossaryHdl { SwGlossaries& rStatGlossaries; - String aCurGrp; + OUString aCurGrp; SfxViewFrame* pViewFrame; SwWrtShell* pWrtShell; SwTextBlocks* pCurGrp; - SW_DLLPRIVATE void _SetMacros(const String &rName, + SW_DLLPRIVATE void _SetMacros(const OUString &rName, const SvxMacro *pStart, const SvxMacro *pEnd); - SW_DLLPRIVATE sal_Bool Expand( const String& rShortName, + SW_DLLPRIVATE sal_Bool Expand( const OUString& rShortName, SwGlossaries* pGlossaries, SwTextBlocks *pGlossary ); @@ -53,37 +53,37 @@ public: sal_uInt16 GetGroupCnt() const; OUString GetGroupName( sal_uInt16, OUString* pTitle = 0 ); sal_Bool NewGroup(OUString & rGroupName, const OUString& rTitle); - sal_Bool DelGroup(const String &); + sal_Bool DelGroup(const OUString &); sal_Bool RenameGroup(const OUString& rOld, OUString& rNew, const OUString& rNewTitle); - void SetCurGroup(const String &aGrp, sal_Bool bApi = sal_False, sal_Bool bAlwaysCreateNew = sal_False); + void SetCurGroup(const OUString &aGrp, sal_Bool bApi = sal_False, sal_Bool bAlwaysCreateNew = sal_False); - const String &GetCurGroup() const { return aCurGrp; } + OUString GetCurGroup() const { return aCurGrp; } sal_uInt16 GetGlossaryCnt(); - String GetGlossaryName(sal_uInt16); - String GetGlossaryShortName(const String &rName); - String GetGlossaryShortName(sal_uInt16); + OUString GetGlossaryName(sal_uInt16); + OUString GetGlossaryShortName(const OUString &rName); + OUString GetGlossaryShortName(sal_uInt16); - sal_Bool Rename( const String& rOldShortName, const String& rNewShortName, - const String& rNewName); + sal_Bool Rename( const OUString& rOldShortName, const OUString& rNewShortName, + const OUString& rNewName); sal_Bool CopyOrMove( const OUString& rSourceGroupName, OUString& rSourceShortName, const OUString& rDestGroupName, const OUString& rLongName, sal_Bool bMove ); - sal_Bool HasShortName(const String &rShortName) const; + sal_Bool HasShortName(const OUString &rShortName) const; // when NewGlossary is called from Basic then the previously set group should // be newly created if applicable. - sal_Bool NewGlossary(const String &rName, const String &rShortName, + sal_Bool NewGlossary(const OUString &rName, const OUString &rShortName, sal_Bool bApiCall = sal_False, sal_Bool bNoAttr = sal_False ); - sal_Bool DelGlossary(const String&); - sal_Bool CopyToClipboard(SwWrtShell& rSh, const String& rShortName); + sal_Bool DelGlossary(const OUString&); + sal_Bool CopyToClipboard(SwWrtShell& rSh, const OUString& rShortName); sal_Bool ExpandGlossary(); - bool InsertGlossary(const String &rName); + bool InsertGlossary(const OUString &rName); - void SetMacros(const String& rName, + void SetMacros(const OUString& rName, const SvxMacro* pStart, const SvxMacro* pEnd, SwTextBlocks *pGlossary = 0 ); - void GetMacros(const String& rShortName, + void GetMacros(const OUString& rShortName, SvxMacro& rStart, SvxMacro& rEnd, SwTextBlocks* pGlossary = 0 ); @@ -93,7 +93,7 @@ public: sal_Bool FindGroupName(OUString& rGroup); // find group without path index - sal_Bool ImportGlossaries( const String& rName ); + sal_Bool ImportGlossaries( const OUString& rName ); SwGlossaryHdl(SfxViewFrame* pViewFrame, SwWrtShell *); ~SwGlossaryHdl(); diff --git a/sw/source/ui/misc/glosdoc.cxx b/sw/source/ui/misc/glosdoc.cxx index c5d2d2e..c343300 100644 --- a/sw/source/ui/misc/glosdoc.cxx +++ b/sw/source/ui/misc/glosdoc.cxx @@ -324,7 +324,7 @@ SwTextBlocks* SwGlossaries::GetGlosDoc( const String &rName, sal_Bool bCreate ) bOk = !IsError( pTmp->GetError() ); } - if( bOk && !pTmp->GetName().Len() ) + if( bOk && pTmp->GetName().isEmpty() ) pTmp->SetName( rName ); } } diff --git a/sw/source/ui/uno/unoatxt.cxx b/sw/source/ui/uno/unoatxt.cxx index f3f26a7..6ffb983 100644 --- a/sw/source/ui/uno/unoatxt.cxx +++ b/sw/source/ui/uno/unoatxt.cxx @@ -304,8 +304,8 @@ void SwXAutoTextGroup::renameByName(const OUString& aElementName, sal_uInt16 nIdx = pGlosGroup->GetIndex( aElementName); if(USHRT_MAX == nIdx) throw lang::IllegalArgumentException(); - String aNewShort( aNewElementName); - String aNewName( aNewElementTitle); + OUString aNewShort(aNewElementName); + OUString aNewName(aNewElementTitle); sal_uInt16 nOldLongIdx = pGlosGroup->GetLongIndex( aNewShort ); sal_uInt16 nOldIdx = pGlosGroup->GetIndex( aNewName );
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits