diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-03-08 14:02:19 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-03-08 14:02:35 +0000 |
commit | 1fad074f43e3301420900918881ad1a8b0bc8687 (patch) | |
tree | 54928f10dad54ce558a72b0c0052d9f6a5053993 | |
parent | 706cac767c90281b74fbc27a134b022d27e2ce21 (diff) |
convert to OUString to I can use SAL_WARN
-rw-r--r-- | sw/source/core/inc/SwXMLTextBlocks.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/inc/swblocks.hxx | 6 | ||||
-rw-r--r-- | sw/source/core/swg/SwXMLTextBlocks.cxx | 34 | ||||
-rw-r--r-- | sw/source/core/swg/SwXMLTextBlocks1.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/swg/swblocks.cxx | 4 |
5 files changed, 27 insertions, 24 deletions
diff --git a/sw/source/core/inc/SwXMLTextBlocks.hxx b/sw/source/core/inc/SwXMLTextBlocks.hxx index c87b08d77360..c7cf91e52dd7 100644 --- a/sw/source/core/inc/SwXMLTextBlocks.hxx +++ b/sw/source/core/inc/SwXMLTextBlocks.hxx @@ -47,7 +47,7 @@ protected: sal_Bool bBlock; SfxObjectShellRef xDocShellRef; sal_uInt16 nFlags; - String aPackageName; + rtl::OUString aPackageName; SfxMediumRef xMedium; void ReadInfo(); @@ -63,7 +63,7 @@ public: 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 ); - void GeneratePackageName ( const String& rShort, String& rPackageName ); + rtl::OUString GeneratePackageName ( const String& rShort ); virtual ~SwXMLTextBlocks(); //virtual sal_Bool IsOld() const; virtual sal_uLong Delete( sal_uInt16 ); diff --git a/sw/source/core/inc/swblocks.hxx b/sw/source/core/inc/swblocks.hxx index 9a4d2f31612e..88d72abde663 100644 --- a/sw/source/core/inc/swblocks.hxx +++ b/sw/source/core/inc/swblocks.hxx @@ -45,12 +45,12 @@ class SwBlockName { friend class SwImpBlocks; friend class Sw2TextBlocks; - sal_uInt16 nHashS, nHashL; // Hash-Codes zum Checken + sal_uInt16 nHashS, nHashL; // Hash-Codes zum Checken long nPos; // Dateiposition (SW2-Format) public: String aShort; // Short name String aLong; // Long name - String aPackageName; // Package name + rtl::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 @@ -108,7 +108,7 @@ public: 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 - const String& GetPackageName( sal_uInt16 ) const; // Langname fuer Index zurueck + rtl::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 diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx index ba3b00a08486..6f786b0fe296 100644 --- a/sw/source/core/swg/SwXMLTextBlocks.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks.cxx @@ -29,9 +29,10 @@ #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> -#include <tools/urlobj.hxx> +#include <rtl/oustringostreaminserter.hxx> #include <sot/stg.hxx> #include <sfx2/docfile.hxx> +#include <tools/urlobj.hxx> #include <unotools/localfilehelper.hxx> #include <unotools/ucbstreamhelper.hxx> @@ -156,7 +157,7 @@ void SwXMLTextBlocks::AddName( const String& rShort, const String& rLong, sal_Bo if( nIdx != (sal_uInt16) -1 ) aNames.DeleteAndDestroy( nIdx ); - GeneratePackageName( rShort, aPackageName ); + aPackageName = GeneratePackageName( rShort ); pNew = new SwBlockName( rShort, rLong, aPackageName ); pNew->bIsOnlyTxtFlagInit = sal_True; @@ -205,17 +206,17 @@ sal_uLong SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const String& rNewShort, con OSL_ENSURE( xBlkRoot.is(), "No storage set" ); if(!xBlkRoot.is()) return 0; - String aOldName (aNames[ nIdx ]->aPackageName); + rtl::OUString aOldName (aNames[ nIdx ]->aPackageName); aShort = rNewShort; - GeneratePackageName( aShort, aPackageName ); + aPackageName = GeneratePackageName( aShort ); if(aOldName != aPackageName) { if (IsOnlyTextBlock ( nIdx ) ) { - String sExt( String::CreateFromAscii( ".xml" )); - String aOldStreamName( aOldName ); aOldStreamName += sExt; - String aNewStreamName( aPackageName ); aNewStreamName += sExt; + rtl::OUString sExt(".xml"); + rtl::OUString aOldStreamName( aOldName ); aOldStreamName += sExt; + rtl::OUString aNewStreamName( aPackageName ); aNewStreamName += sExt; xRoot = xBlkRoot->openStorageElement( aOldName, embed::ElementModes::READWRITE ); try @@ -224,6 +225,7 @@ sal_uLong SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const String& rNewShort, con } catch(const container::ElementExistException&) { + SAL_WARN("sw", "Couldn't rename " << aOldStreamName << " to " << aNewStreamName); } uno::Reference < embed::XTransactedObject > xTrans( xRoot, uno::UNO_QUERY ); if ( xTrans.is() ) @@ -237,6 +239,7 @@ sal_uLong SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const String& rNewShort, con } catch(const container::ElementExistException&) { + SAL_WARN("sw", "Couldn't rename " << aOldName << " to " << aPackageName); } } uno::Reference < embed::XTransactedObject > xTrans( xBlkRoot, uno::UNO_QUERY ); @@ -325,7 +328,7 @@ sal_uLong SwXMLTextBlocks::BeginPutDoc( const String& rShort, const String& rLon // In der Basisklasse ablegen! aShort = rShort; aLong = rLong; - GeneratePackageName( rShort, aPackageName ); + aPackageName = GeneratePackageName( rShort ); SetIsTextOnly( rShort, sal_False); return StartPutBlock (rShort, aPackageName); } @@ -559,18 +562,19 @@ short SwXMLTextBlocks::GetFileType ( void ) const return SWBLK_XML; } -void SwXMLTextBlocks::GeneratePackageName ( const String& rShort, String& rPackageName ) +rtl::OUString SwXMLTextBlocks::GeneratePackageName ( const String& rShort ) { - rPackageName = rShort; + String aRet = rShort; xub_StrLen nPos = 0; sal_Unicode pDelims[] = { '!', '/', ':', '.', '\\', 0 }; - rtl::OString sByte(rtl::OUStringToOString(rPackageName, RTL_TEXTENCODING_UTF7)); - rPackageName = String (sByte, RTL_TEXTENCODING_ASCII_US); - while( STRING_NOTFOUND != ( nPos = rPackageName.SearchChar( pDelims, nPos ))) + rtl::OString sByte(rtl::OUStringToOString(aRet, RTL_TEXTENCODING_UTF7)); + aRet = String (sByte, RTL_TEXTENCODING_ASCII_US); + while( STRING_NOTFOUND != ( nPos = aRet.SearchChar( pDelims, nPos ))) { - rPackageName.SetChar( nPos, '_' ); + aRet.SetChar( nPos, '_' ); ++nPos; } + return aRet; } sal_uLong SwXMLTextBlocks::PutText( const String& rShort, const String& rName, @@ -581,7 +585,7 @@ sal_uLong SwXMLTextBlocks::PutText( const String& rShort, const String& rName, aLong = rName; aCur = rText; SetIsTextOnly( aShort, sal_True ); - GeneratePackageName( rShort, aPackageName ); + aPackageName = GeneratePackageName( rShort ); ClearDoc(); nRes = PutBlockText( rShort, rName, rText, aPackageName ); return nRes; diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index 32faa356d46e..62a2494f1ad8 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -314,8 +314,7 @@ sal_uLong SwXMLTextBlocks::GetBlockText( const String& rShort, String& rText ) { sal_uLong n = 0; sal_Bool bTextOnly = sal_True; - String aFolderName; - GeneratePackageName ( rShort, aFolderName ); + String aFolderName = GeneratePackageName ( rShort ); String aStreamName = aFolderName + (OUString) String::CreateFromAscii(".xml"); rText.Erase(); diff --git a/sw/source/core/swg/swblocks.cxx b/sw/source/core/swg/swblocks.cxx index efed9cc8a2c1..45abd6baca5d 100644 --- a/sw/source/core/swg/swblocks.cxx +++ b/sw/source/core/swg/swblocks.cxx @@ -193,11 +193,11 @@ const String& SwImpBlocks::GetLongName( sal_uInt16 n ) const return aEmptyStr; } -const String& SwImpBlocks::GetPackageName( sal_uInt16 n ) const +rtl::OUString SwImpBlocks::GetPackageName( sal_uInt16 n ) const { if( n < aNames.Count() ) return aNames[ n ]->aPackageName; - return aEmptyStr; + return rtl::OUString(); } void SwImpBlocks::AddName( const String& rShort, const String& rLong, |