diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2013-08-14 23:17:08 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-08-15 16:38:26 +0200 |
commit | 6e0d836ff120ba292ba52f3623a3dd9be04aefc2 (patch) | |
tree | a8deb1dd85481c0d09d5cdc29d5440722548889b /sw | |
parent | 6b9d91c924a5b2f41c4cab5f1e86291b5997a681 (diff) |
String to OUString, some formatting
Conflicts:
sw/source/filter/basflt/fltini.cxx
sw/source/ui/dialog/ascfldlg.cxx
Change-Id: Ifa12105aa6f747e2797891b6c71128bd96f78bf3
Diffstat (limited to 'sw')
25 files changed, 219 insertions, 251 deletions
diff --git a/sw/inc/SwXMLSectionList.hxx b/sw/inc/SwXMLSectionList.hxx index 8c6abc060881..68eb8fd8f0bd 100644 --- a/sw/inc/SwXMLSectionList.hxx +++ b/sw/inc/SwXMLSectionList.hxx @@ -32,11 +32,11 @@ protected: const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); public: - std::vector<String*> &rSectionList; + std::vector<OUString*> &rSectionList; SwXMLSectionList( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, - std::vector<String*> &rNewSectionList ); + std::vector<OUString*> &rNewSectionList ); virtual ~SwXMLSectionList ( ) throw(); diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx index b58dceff1993..328593f19ae4 100644 --- a/sw/inc/shellio.hxx +++ b/sw/inc/shellio.hxx @@ -29,7 +29,6 @@ #include <sot/formats.hxx> #include <sot/storage.hxx> #include <svtools/parhtml.hxx> -#include <tools/string.hxx> #include <tools/date.hxx> #include <tools/time.hxx> #include <tools/datetime.hxx> @@ -63,15 +62,15 @@ struct Writer_Impl; class SW_DLLPUBLIC SwAsciiOptions { - String sFont; + OUString sFont; rtl_TextEncoding eCharSet; sal_uInt16 nLanguage; LineEnd eCRLF_Flag; public: - const String& GetFontName() const { return sFont; } - void SetFontName( const String& rFont ) { sFont = rFont; } + OUString GetFontName() const { return sFont; } + void SetFontName( const OUString& rFont ) { sFont = rFont; } rtl_TextEncoding GetCharSet() const { return eCharSet; } void SetCharSet( rtl_TextEncoding nVal ) { eCharSet = nVal; } @@ -84,7 +83,7 @@ public: void Reset() { - sFont.Erase(); + sFont = OUString(); eCRLF_Flag = GetSystemLineEnd(); eCharSet = ::osl_getThreadTextEncoding(); nLanguage = 0; @@ -155,35 +154,35 @@ class SwReader: public SwDocFac SfxMedium* pMedium; // Who wants to obtain a Medium (W4W). SwPaM* pCrsr; - String aFileName; - String sBaseURL; + OUString aFileName; + OUString sBaseURL; public: // Initial reading. Document is created only at Read(...) // or in case it is given, into that. // Special case for Load with Sw3Reader. - SwReader( SfxMedium&, const String& rFilename, SwDoc *pDoc = 0 ); + SwReader( SfxMedium&, const OUString& rFilename, SwDoc *pDoc = 0 ); // Read into existing document. // Document and position in document are taken from SwPaM. - SwReader( SvStream&, const String& rFilename, const String& rBaseURL, SwPaM& ); - SwReader( SfxMedium&, const String& rFilename, SwPaM& ); - SwReader( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String& rFilename, SwPaM& ); + SwReader( SvStream&, const OUString& rFilename, const OUString& rBaseURL, SwPaM& ); + SwReader( SfxMedium&, const OUString& rFilename, SwPaM& ); + SwReader( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const OUString& rFilename, SwPaM& ); // The only export interface is SwReader::Read(...)!!! sal_Bool NeedsPasswd( const Reader& ); - sal_Bool CheckPasswd( const String&, const Reader& ); + sal_Bool CheckPasswd( const OUString&, const Reader& ); sal_uLong Read( const Reader& ); // Ask for glossaries. sal_Bool HasGlossaries( const Reader& ); sal_Bool ReadGlossaries( const Reader&, SwTextBlocks&, sal_Bool bSaveRelFiles ); - const String& GetBaseURL() const { return sBaseURL;} + OUString GetBaseURL() const { return sBaseURL;} protected: - void SetBaseURL( const String& rURL ) { sBaseURL = rURL; } + void SetBaseURL( const OUString& rURL ) { sBaseURL = rURL; } }; @@ -198,7 +197,7 @@ class SW_DLLPUBLIC Reader { friend class SwReader; SwDoc* pTemplate; - String aTemplateNm; + OUString aTemplateNm; Date aDStamp; Time aTStamp; @@ -219,7 +218,7 @@ protected: sal_Bool bHasAskTemplateName : 1; sal_Bool bIgnoreHTMLComments : 1; - virtual String GetTemplateName() const; + virtual OUString GetTemplateName() const; public: Reader(); @@ -228,7 +227,7 @@ public: virtual int GetReaderType(); SwgReaderOption& GetReaderOpt() { return aOpt; } - virtual void SetFltName( const String& rFltNm ); + virtual void SetFltName( const OUString& rFltNm ); // Adapt item-set of a Frm-Format to the old format. static void ResetFrmFmtAttrs( SfxItemSet &rFrmSet ); @@ -241,7 +240,7 @@ public: SwDoc* GetTemplateDoc(); sal_Bool SetTemplate( SwDoc& rDoc ); void ClearTemplate(); - void SetTemplateName( const String& rDir ); + void SetTemplateName( const OUString& rDir ); void MakeHTMLDummyTemplateDoc(); sal_Bool IsReadUTF8() const { return bReadUTF8; } @@ -261,13 +260,13 @@ public: // Read the sections of the document, which is equal to the medium. // Returns the count of it virtual size_t GetSectionList( SfxMedium& rMedium, - std::vector<String*>& rStrings ) const; + std::vector<OUString*>& rStrings ) const; SotStorageRef getSotStorageRef() { return pStg; }; void setSotStorageRef(SotStorageRef pStgRef) { pStg = pStgRef; }; private: - virtual sal_uLong Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &)=0; + virtual sal_uLong Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &)=0; // Everyone who does not need the streams / storages open // has to overload the method (W4W!!). @@ -277,21 +276,21 @@ private: class AsciiReader: public Reader { friend class SwReader; - virtual sal_uLong Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &); + virtual sal_uLong Read( SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &); public: AsciiReader(): Reader() {} }; class SW_DLLPUBLIC StgReader : public Reader { - String aFltName; + OUString aFltName; protected: sal_uLong OpenMainStream( SotStorageStreamRef& rRef, sal_uInt16& rBuffSize ); public: virtual int GetReaderType(); - const String& GetFltName() { return aFltName; } - virtual void SetFltName( const String& r ); + OUString GetFltName() { return aFltName; } + virtual void SetFltName( const OUString& r ); }; @@ -380,7 +379,7 @@ class SW_DLLPUBLIC Writer , private ::boost::noncopyable { SwAsciiOptions aAscOpts; - String sBaseURL; + OUString sBaseURL; void _AddFontItem( SfxItemPool& rPool, const SvxFontItem& rFont ); void _AddFontItems( SfxItemPool& rPool, sal_uInt16 nWhichId ); @@ -390,7 +389,7 @@ class SW_DLLPUBLIC Writer protected: SwPaM* pOrigPam; // Last Pam that has to be processed. - const String* pOrigFileName; + const OUString* pOrigFileName; void ResetWriter(); sal_Bool CopyNextPam( SwPaM ** ); @@ -399,7 +398,7 @@ protected: void PutEditEngFontsInAttrPool( bool bIncl_CJK_CTL = true ); virtual sal_uLong WriteStream() = 0; - void SetBaseURL( const String& rURL ) { sBaseURL = rURL; } + void SetBaseURL( const OUString& rURL ) { sBaseURL = rURL; } IDocumentSettingAccess* getIDocumentSettingAccess(); const IDocumentSettingAccess* getIDocumentSettingAccess() const; @@ -426,22 +425,22 @@ public: Writer(); virtual ~Writer(); - virtual sal_uLong Write( SwPaM&, SfxMedium&, const String* = 0 ); - sal_uLong Write( SwPaM&, SvStream&, const String* = 0 ); - virtual sal_uLong Write( SwPaM&, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String* = 0, SfxMedium* = 0 ); - virtual sal_uLong Write( SwPaM&, SotStorage&, const String* = 0 ); + virtual sal_uLong Write( SwPaM&, SfxMedium&, const OUString* = 0 ); + sal_uLong Write( SwPaM&, SvStream&, const OUString* = 0 ); + virtual sal_uLong Write( SwPaM&, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const OUString* = 0, SfxMedium* = 0 ); + virtual sal_uLong Write( SwPaM&, SotStorage&, const OUString* = 0 ); - virtual void SetVersion( const String&, long ); + virtual void SetVersion( const OUString&, long ); virtual sal_Bool IsStgWriter() const; void SetShowProgress( sal_Bool bFlag = sal_False ) { bShowProgress = bFlag; } - const String* GetOrigFileName() const { return pOrigFileName; } + const OUString* GetOrigFileName() const { return pOrigFileName; } const SwAsciiOptions& GetAsciiOptions() const { return aAscOpts; } void SetAsciiOptions( const SwAsciiOptions& rOpt ) { aAscOpts = rOpt; } - const String& GetBaseURL() const { return sBaseURL;} + OUString GetBaseURL() const { return sBaseURL;} // Look up next bookmark position from bookmark-table. sal_Int32 FindPos_Bkmk( const SwPosition& rPos ) const; @@ -482,7 +481,7 @@ SV_IMPL_REF(Writer) class SW_DLLPUBLIC StgWriter : public Writer { protected: - String aFltName; + OUString aFltName; SotStorageRef pStg; com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStg; @@ -498,8 +497,8 @@ public: virtual sal_Bool IsStgWriter() const; - virtual sal_uLong Write( SwPaM&, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String* = 0, SfxMedium* = 0 ); - virtual sal_uLong Write( SwPaM&, SotStorage&, const String* = 0 ); + virtual sal_uLong Write( SwPaM&, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const OUString* = 0, SfxMedium* = 0 ); + virtual sal_uLong Write( SwPaM&, SotStorage&, const OUString* = 0 ); SotStorage& GetStorage() const { return *pStg; } }; @@ -521,7 +520,7 @@ class SwWriter sal_Bool bWriteAll; public: - sal_uLong Write( WriterRef& rxWriter, const String* = 0); + sal_uLong Write( WriterRef& rxWriter, const OUString* = 0); SwWriter( SvStream&, SwCrsrShell &,sal_Bool bWriteAll = sal_False ); SwWriter( SvStream&, SwDoc & ); @@ -536,8 +535,8 @@ public: typedef Reader* (*FnGetReader)(); -typedef void (*FnGetWriter)(const String&, const String& rBaseURL, WriterRef&); -sal_uLong SaveOrDelMSVBAStorage( SfxObjectShell&, SotStorage&, sal_Bool, const String& ); +typedef void (*FnGetWriter)(const OUString&, const OUString& rBaseURL, WriterRef&); +sal_uLong SaveOrDelMSVBAStorage( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& ); sal_uLong GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS ); struct SwReaderWriterEntry @@ -555,7 +554,7 @@ struct SwReaderWriterEntry Reader* GetReader(); /// Get access to the writer. - void GetWriter( const String& rNm, const String& rBaseURL, WriterRef& xWrt ) const; + void GetWriter( const OUString& rNm, const OUString& rBaseURL, WriterRef& xWrt ) const; }; namespace SwReaderWriter @@ -564,17 +563,17 @@ namespace SwReaderWriter Reader* GetReader( ReaderWriterEnum eReader ); /// Return reader based on the name. - Reader* GetReader( const String& rFltName ); + Reader* GetReader( const OUString& rFltName ); /// Return writer based on the name. - void GetWriter( const String& rFltName, const String& rBaseURL, WriterRef& xWrt ); + void GetWriter( const OUString& rFltName, const OUString& rBaseURL, WriterRef& xWrt ); } -void GetRTFWriter( const String&, const String&, WriterRef& ); -void GetASCWriter( const String&, const String&, WriterRef& ); -void GetHTMLWriter( const String&, const String&, WriterRef& ); -void GetXMLWriter( const String&, const String&, WriterRef& ); -void GetWW8Writer( const String&, const String&, WriterRef& ); +void GetRTFWriter( const OUString&, const OUString&, WriterRef& ); +void GetASCWriter( const OUString&, const OUString&, WriterRef& ); +void GetHTMLWriter( const OUString&, const OUString&, WriterRef& ); +void GetXMLWriter( const OUString&, const OUString&, WriterRef& ); +void GetWW8Writer( const OUString&, const OUString&, WriterRef& ); #endif diff --git a/sw/source/core/swg/SwXMLSectionList.cxx b/sw/source/core/swg/SwXMLSectionList.cxx index d1e1028d65d9..bd76ad7edd6d 100644 --- a/sw/source/core/swg/SwXMLSectionList.cxx +++ b/sw/source/core/swg/SwXMLSectionList.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <tools/string.hxx> #include <SwXMLSectionList.hxx> #include <xmloff/nmspmap.hxx> #include <xmloff/xmlnmspe.hxx> @@ -26,13 +25,15 @@ using namespace ::com::sun::star; using namespace ::xmloff::token; +// TODO: verify if these should match the same-name constants +// in xmloff/source/core/xmlimp.cxx ("_office" and "_office") sal_Char const sXML_np__office[] = "_ooffice"; sal_Char const sXML_np__text[] = "_otext"; // #110680# SwXMLSectionList::SwXMLSectionList( const uno::Reference< uno::XComponentContext > xContext, - std::vector<String*> &rNewSectionList) + std::vector<OUString*> &rNewSectionList) : SvXMLImport( xContext ), rSectionList ( rNewSectionList ) { @@ -93,11 +94,11 @@ SvXMLImportContext *SvXMLSectionListContext::CreateChildContext( const uno::Reference< xml::sax::XAttributeList > & xAttrList ) { SvXMLImportContext *pContext = 0; - String sName; if (nPrefix == XML_NAMESPACE_TEXT && ( IsXMLToken ( rLocalName, XML_SECTION ) || IsXMLToken ( rLocalName, XML_BOOKMARK) ) ) { + OUString sName; sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; for (sal_Int16 i=0; i < nAttrCount; i++) @@ -105,12 +106,11 @@ SvXMLImportContext *SvXMLSectionListContext::CreateChildContext( const OUString& rAttrName = xAttrList->getNameByIndex( i ); OUString aLocalName; sal_uInt16 nPrefx = rLocalRef.GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName); - const OUString& rAttrValue = xAttrList->getValueByIndex( i ); if (XML_NAMESPACE_TEXT == nPrefx && IsXMLToken ( aLocalName, XML_NAME ) ) - sName = rAttrValue; + sName = xAttrList->getValueByIndex( i ); } - if ( sName.Len() ) - rLocalRef.rSectionList.push_back( new String(sName) ); + if ( !sName.isEmpty() ) + rLocalRef.rSectionList.push_back( new OUString(sName) ); } pContext = new SvXMLSectionListContext (rLocalRef, nPrefix, rLocalName, xAttrList); diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index a6800fdc8e36..c5e8387a26fa 100644 --- a/sw/source/filter/ascii/parasc.cxx +++ b/sw/source/filter/ascii/parasc.cxx @@ -69,7 +69,7 @@ public: // Call for the general reader interface -sal_uLong AsciiReader::Read( SwDoc &rDoc, const String&, SwPaM &rPam, const String & ) +sal_uLong AsciiReader::Read( SwDoc &rDoc, const OUString&, SwPaM &rPam, const OUString & ) { if( !pStrm ) { @@ -110,7 +110,7 @@ SwASCIIParser::SwASCIIParser(SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn, pItemSet->Put( aLang, RES_CHRATR_CJK_LANGUAGE ); pItemSet->Put( aLang, RES_CHRATR_CTL_LANGUAGE ); } - if( rOpt.GetFontName().Len() ) + if( !rOpt.GetFontName().isEmpty() ) { Font aTextFont( rOpt.GetFontName(), Size( 0, 10 ) ); if( pDoc->getPrinter( false ) ) diff --git a/sw/source/filter/ascii/wrtasc.cxx b/sw/source/filter/ascii/wrtasc.cxx index 42a0b21f8620..87d1002d7586 100644 --- a/sw/source/filter/ascii/wrtasc.cxx +++ b/sw/source/filter/ascii/wrtasc.cxx @@ -33,17 +33,17 @@ //----------------------------------------------------------------- -SwASCWriter::SwASCWriter( const String& rFltNm ) +SwASCWriter::SwASCWriter( const OUString& rFltNm ) { SwAsciiOptions aNewOpts; - switch( 5 <= rFltNm.Len() ? rFltNm.GetChar( 4 ) : 0 ) + switch( 5 <= rFltNm.getLength() ? rFltNm[4] : 0 ) { case 'D': aNewOpts.SetCharSet( RTL_TEXTENCODING_IBM_850 ); aNewOpts.SetParaFlags( LINEEND_CRLF ); - if( 5 < rFltNm.Len() ) - switch( rFltNm.Copy( 5 ).ToInt32() ) + if( 5 < rFltNm.getLength() ) + switch( rFltNm.copy( 5 ).toInt32() ) { case 437: aNewOpts.SetCharSet( RTL_TEXTENCODING_IBM_437 ); break; case 850: aNewOpts.SetCharSet( RTL_TEXTENCODING_IBM_850 ); break; @@ -74,7 +74,7 @@ SwASCWriter::SwASCWriter( const String& rFltNm ) break; default: - if( rFltNm.Copy( 4 ).EqualsAscii( "_DLG" )) + if( rFltNm.copy( 4 )=="_DLG" ) { // use the options aNewOpts = GetAsciiOptions(); @@ -87,22 +87,17 @@ SwASCWriter::~SwASCWriter() {} sal_uLong SwASCWriter::WriteStream() { - sal_Char cLineEnd[ 3 ]; - sal_Char* pCEnd = cLineEnd; if( bASCII_ParaAsCR ) // If predefined - *pCEnd++ = '\015'; + m_sLineEnd = "\015"; else if( bASCII_ParaAsBlanc ) - *pCEnd++ = ' '; + m_sLineEnd = " "; else switch( GetAsciiOptions().GetParaFlags() ) { - case LINEEND_CR: *pCEnd++ = '\015'; break; - case LINEEND_LF: *pCEnd++ = '\012'; break; - case LINEEND_CRLF: *pCEnd++ = '\015', *pCEnd++ = '\012'; break; + case LINEEND_CR: m_sLineEnd = "\015"; break; + case LINEEND_LF: m_sLineEnd = "\012"; break; + case LINEEND_CRLF: m_sLineEnd = "\015\012"; break; } - *pCEnd = 0; - - sLineEnd.AssignAscii( cLineEnd ); long nMaxNode = pDoc->GetNodes().Count(); @@ -200,7 +195,7 @@ sal_uLong SwASCWriter::WriteStream() } -void GetASCWriter( const String& rFltNm, const String& /*rBaseURL*/, WriterRef& xRet ) +void GetASCWriter( const OUString& rFltNm, const OUString& /*rBaseURL*/, WriterRef& xRet ) { xRet = new SwASCWriter( rFltNm ); } diff --git a/sw/source/filter/ascii/wrtasc.hxx b/sw/source/filter/ascii/wrtasc.hxx index 99b97fca5e91..cd8af84dd38b 100644 --- a/sw/source/filter/ascii/wrtasc.hxx +++ b/sw/source/filter/ascii/wrtasc.hxx @@ -16,8 +16,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _WRTASC_HXX -#define _WRTASC_HXX +#ifndef WRTASC_HXX +#define WRTASC_HXX #include <shellio.hxx> #include <wrt_fn.hxx> @@ -29,15 +29,15 @@ extern SwNodeFnTab aASCNodeFnTab; class SwASCWriter : public Writer { - String sLineEnd; + OUString m_sLineEnd; virtual sal_uLong WriteStream(); public: - SwASCWriter( const String& rFilterName ); + SwASCWriter( const OUString& rFilterName ); virtual ~SwASCWriter(); - const String& GetLineEnd() const { return sLineEnd; } + OUString GetLineEnd() const { return m_sLineEnd; } }; diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index f90d0e3750cb..b882d6441291 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -95,7 +95,7 @@ Reader* SwReaderWriterEntry::GetReader() return NULL; } -void SwReaderWriterEntry::GetWriter( const String& rNm, const String& rBaseURL, WriterRef& xWrt ) const +void SwReaderWriterEntry::GetWriter( const OUString& rNm, const OUString& rBaseURL, WriterRef& xWrt ) const { if ( fnGetWriter ) (*fnGetWriter)( rNm, rBaseURL, xWrt ); @@ -171,34 +171,34 @@ Reader* GetReader( ReaderWriterEnum eReader ) return aReaderWriter[eReader].GetReader(); } -void GetWriter( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) +void GetWriter( const OUString& rFltName, const OUString& rBaseURL, WriterRef& xRet ) { - for( sal_uInt16 n = 0; n < MAXFILTER; ++n ) - if( aFilterDetect[n].IsFilter( rFltName ) ) - { + for( sal_uInt16 n = 0; n < MAXFILTER; ++n ) + if ( aFilterDetect[n].IsFilter( rFltName ) ) + { aReaderWriter[n].GetWriter( rFltName, rBaseURL, xRet ); - break; - } + break; + } } -SwRead GetReader( const String& rFltName ) +SwRead GetReader( const OUString& rFltName ) { - SwRead pRead = 0; - for( sal_uInt16 n = 0; n < MAXFILTER; ++n ) - if( aFilterDetect[n].IsFilter( rFltName ) ) - { - pRead = aReaderWriter[n].GetReader(); - // fuer einige Reader noch eine Sonderbehandlung: - if ( pRead ) - pRead->SetFltName( rFltName ); - break; - } - return pRead; + SwRead pRead = 0; + for( sal_uInt16 n = 0; n < MAXFILTER; ++n ) + if ( aFilterDetect[n].IsFilter( rFltName ) ) + { + pRead = aReaderWriter[n].GetReader(); + // fuer einige Reader noch eine Sonderbehandlung: + if ( pRead ) + pRead->SetFltName( rFltName ); + break; + } + return pRead; } } // namespace SwReaderWriter -void Writer::SetVersion( const String&, long ) {} +void Writer::SetVersion( const OUString&, long ) {} sal_Bool Writer::IsStgWriter() const { return sal_False; } @@ -214,7 +214,7 @@ sal_Bool SwReader::NeedsPasswd( const Reader& /*rOptions*/ ) } -sal_Bool SwReader::CheckPasswd( const String& /*rPasswd*/, const Reader& /*rOptions*/ ) +sal_Bool SwReader::CheckPasswd( const OUString& /*rPasswd*/, const Reader& /*rOptions*/ ) { return sal_True; } @@ -298,7 +298,7 @@ void SwFilterOptions::Notify( const ::com::sun::star::uno::Sequence< OUString >& -void StgReader::SetFltName( const String& rFltNm ) +void StgReader::SetFltName( const OUString& rFltNm ) { if( SW_STORAGE_READER & GetReaderType() ) aFltName = rFltNm; @@ -436,6 +436,9 @@ void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor, } } +namespace +{ + struct CharSetNameMap { rtl_TextEncoding eCode; @@ -543,17 +546,18 @@ const CharSetNameMap *GetCharSetNameMap() }; return &aMapArr[0]; } + /* Get a rtl_TextEncoding from its name */ -rtl_TextEncoding CharSetFromName(const String& rChrSetStr) +rtl_TextEncoding CharSetFromName(const OUString& rChrSetStr) { const CharSetNameMap *pStart = GetCharSetNameMap(); rtl_TextEncoding nRet = pStart->eCode; for(const CharSetNameMap *pMap = pStart; pMap->pName; ++pMap) { - if(rChrSetStr.EqualsIgnoreCaseAscii(pMap->pName)) + if(rChrSetStr.equalsIgnoreAsciiCaseAscii(pMap->pName)) { nRet = pMap->eCode; break; @@ -565,11 +569,10 @@ rtl_TextEncoding CharSetFromName(const String& rChrSetStr) return nRet; } - /* Get the String name of an rtl_TextEncoding */ -String NameFromCharSet(rtl_TextEncoding nChrSet) +OUString NameFromCharSet(rtl_TextEncoding nChrSet) { const CharSetNameMap *pStart = GetCharSetNameMap(); const char *pRet = pStart->pName; @@ -588,6 +591,8 @@ String NameFromCharSet(rtl_TextEncoding nChrSet) return OUString::createFromAscii(pRet); } +} + // for the automatic conversion (mail/news/...) // The user data contains the options for the ascii import/export filter. // The format is: @@ -602,9 +607,9 @@ void SwAsciiOptions::ReadUserData( const OUString& rStr ) { sal_Int32 nToken = 0; sal_uInt16 nCnt = 0; - OUString sToken; do { - if( !(sToken = rStr.getToken( 0, ',', nToken )).isEmpty() ) + const OUString sToken = rStr.getToken( 0, ',', nToken ); + if (!sToken.isEmpty()) { switch( nCnt ) { @@ -612,9 +617,9 @@ void SwAsciiOptions::ReadUserData( const OUString& rStr ) eCharSet = CharSetFromName(sToken); break; case 1: // LineEnd - if( sToken.equalsIgnoreAsciiCase( "CRLF" )) + if (sToken.equalsIgnoreAsciiCase("CRLF")) eCRLF_Flag = LINEEND_CRLF; - else if( sToken.equalsIgnoreAsciiCase( "LF" )) + else if (sToken.equalsIgnoreAsciiCase("LF")) eCRLF_Flag = LINEEND_LF; else eCRLF_Flag = LINEEND_CR; @@ -634,8 +639,7 @@ void SwAsciiOptions::ReadUserData( const OUString& rStr ) void SwAsciiOptions::WriteUserData(OUString& rStr) { // 1. charset - rStr = NameFromCharSet(eCharSet); - rStr += ","; + rStr = NameFromCharSet(eCharSet) + ","; // 2. LineEnd switch(eCRLF_Flag) @@ -653,8 +657,7 @@ void SwAsciiOptions::WriteUserData(OUString& rStr) rStr += ","; // 3. Fontname - rStr += sFont; - rStr += ","; + rStr += sFont + ","; // 4. Language if (nLanguage) @@ -693,7 +696,7 @@ Reader* GetRTFReader() } -void GetRTFWriter( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) +void GetRTFWriter( const OUString& rFltName, const OUString& rBaseURL, WriterRef& xRet ) { #ifndef DISABLE_DYNLOADING FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( SwGlobals::getFilters().GetMswordLibSymbol( "ExportRTF" ) ); @@ -721,7 +724,7 @@ Reader* GetWW8Reader() #endif } -void GetWW8Writer( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) +void GetWW8Writer( const OUString& rFltName, const OUString& rBaseURL, WriterRef& xRet ) { #ifndef DISABLE_DYNLOADING FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( SwGlobals::getFilters().GetMswordLibSymbol( "ExportDOC" ) ); @@ -738,7 +741,7 @@ void GetWW8Writer( const String& rFltName, const String& rBaseURL, WriterRef& xR typedef sal_uLong ( SAL_CALL *SaveOrDel )( SfxObjectShell&, SotStorage&, sal_Bool, const String& ); typedef sal_uLong ( SAL_CALL *GetSaveWarning )( SfxObjectShell& ); -sal_uLong SaveOrDelMSVBAStorage( SfxObjectShell& rDoc, SotStorage& rStor, sal_Bool bSaveInto, const String& rStorageName ) +sal_uLong SaveOrDelMSVBAStorage( SfxObjectShell& rDoc, SotStorage& rStor, sal_Bool bSaveInto, const OUString& rStorageName ) { #ifndef DISABLE_DYNLOADING SaveOrDel pFunction = reinterpret_cast<SaveOrDel>( SwGlobals::getFilters().GetMswordLibSymbol( "SaveOrDelMSVBAStorage_ww8" ) ); diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index a17f91d54094..ea629791d979 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -404,7 +404,7 @@ sal_uLong SwReader::Read( const Reader& rOptions ) * Konstruktoren, Destruktor */ -SwReader::SwReader(SfxMedium& rMedium, const String& rFileName, SwDoc *pDocument) +SwReader::SwReader(SfxMedium& rMedium, const OUString& rFileName, SwDoc *pDocument) : SwDocFac(pDocument), pStrm(0), pMedium(&rMedium), pCrsr(0), aFileName(rFileName) { @@ -413,21 +413,21 @@ SwReader::SwReader(SfxMedium& rMedium, const String& rFileName, SwDoc *pDocument // In ein existierendes Dokument einlesen -SwReader::SwReader(SvStream& rStrm, const String& rFileName, const String& rBaseURL, SwPaM& rPam) +SwReader::SwReader(SvStream& rStrm, const OUString& rFileName, const OUString& rBaseURL, SwPaM& rPam) : SwDocFac(rPam.GetDoc()), pStrm(&rStrm), pMedium(0), pCrsr(&rPam), aFileName(rFileName) { SetBaseURL( rBaseURL ); } -SwReader::SwReader(SfxMedium& rMedium, const String& rFileName, SwPaM& rPam) +SwReader::SwReader(SfxMedium& rMedium, const OUString& rFileName, SwPaM& rPam) : SwDocFac(rPam.GetDoc()), pStrm(0), pMedium(&rMedium), pCrsr(&rPam), aFileName(rFileName) { SetBaseURL( rMedium.GetBaseURL() ); } -SwReader::SwReader( const uno::Reference < embed::XStorage > &rStg, const String& rFilename, SwPaM &rPam ) +SwReader::SwReader( const uno::Reference < embed::XStorage > &rStg, const OUString& rFilename, SwPaM &rPam ) : SwDocFac(rPam.GetDoc()), pStrm(0), xStg( rStg ), pMedium(0), pCrsr(&rPam), aFileName(rFilename) { } @@ -448,9 +448,9 @@ Reader::~Reader() delete pTemplate; } -String Reader::GetTemplateName() const +OUString Reader::GetTemplateName() const { - return aEmptyStr; + return OUString(); } // Die Filter-Vorlage laden, setzen und wieder freigeben @@ -462,12 +462,12 @@ SwDoc* Reader::GetTemplateDoc() bHasAskTemplateName = sal_True; } - if( !aTemplateNm.Len() ) + if( aTemplateNm.isEmpty() ) ClearTemplate(); else { INetURLObject aTDir( aTemplateNm ); - String aFileName = aTDir.GetMainURL( INetURLObject::NO_DECODE ); + const OUString aFileName = aTDir.GetMainURL( INetURLObject::NO_DECODE ); OSL_ENSURE( !aTDir.HasError(), "No absolute path for template name!" ); DateTime aCurrDateTime( DateTime::SYSTEM ); bool bLoad = false; @@ -529,8 +529,7 @@ SwDoc* Reader::GetTemplateDoc() } } - OSL_ENSURE( !pTemplate || FStatHelper::IsDocument( aFileName ) || - aTemplateNm.EqualsAscii( "$$Dummy$$" ), + OSL_ENSURE( !pTemplate || FStatHelper::IsDocument( aFileName ) || aTemplateNm=="$$Dummy$$", "TemplatePtr but no template exist!" ); } @@ -563,9 +562,9 @@ void Reader::ClearTemplate() } } -void Reader::SetTemplateName( const String& rDir ) +void Reader::SetTemplateName( const OUString& rDir ) { - if( rDir.Len() && aTemplateNm != rDir ) + if( !rDir.isEmpty() && aTemplateNm != rDir ) { ClearTemplate(); aTemplateNm = rDir; @@ -581,7 +580,7 @@ void Reader::MakeHTMLDummyTemplateDoc() pTemplate->getPrinter( true ); pTemplate->RemoveAllFmtLanguageDependencies(); aChkDateTime = Date( 1, 1, 2300 ); // 2300. Jahrtausend sollte reichen - aTemplateNm.AssignAscii( "$$Dummy$$" ); + aTemplateNm = "$$Dummy$$"; } // alle die die Streams / Storages nicht geoeffnet brauchen, @@ -624,7 +623,7 @@ int Reader::GetReaderType() } -void Reader::SetFltName( const String& ) +void Reader::SetFltName( const OUString& ) { } @@ -668,7 +667,7 @@ void Reader::ResetFrmFmts( SwDoc& rDoc ) // read the sections of the document, which is equal to the medium. // returns the count of it -size_t Reader::GetSectionList( SfxMedium&, std::vector<String*>& ) const +size_t Reader::GetSectionList( SfxMedium&, std::vector<OUString*>& ) const { return 0; } @@ -768,7 +767,7 @@ SwWriter::SwWriter(SfxMedium& rMedium, SwDoc &rDocument) { } -sal_uLong SwWriter::Write( WriterRef& rxWriter, const String* pRealFileName ) +sal_uLong SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName ) { // #i73788# SwPauseThreadStarting aPauseThreadStarting; diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 22f2318d167d..87fc2c2a86fd 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -142,35 +142,26 @@ HTMLReader::HTMLReader() bTmplBrowseMode = sal_True; } -String HTMLReader::GetTemplateName() const +OUString HTMLReader::GetTemplateName() const { - OUString sTemplate("internal/html"); + const OUString sTemplateWithoutExt("internal/html"); + SvtPathOptions aPathOpt; - OUString sTemplateWithoutExt( sTemplate ); // first search for OpenDocument Writer/Web template - sTemplate += ".oth"; - - SvtPathOptions aPathOpt; // OpenDocument Writer/Web template (extension .oth) - bool bSet = aPathOpt.SearchFile( sTemplate, SvtPathOptions::PATH_TEMPLATE ); + OUString sTemplate( sTemplateWithoutExt + ".oth" ); + if (aPathOpt.SearchFile( sTemplate, SvtPathOptions::PATH_TEMPLATE )) + return sTemplate; - if( !bSet ) - { // no OpenDocument Writer/Web template found. // search for OpenOffice.org Writer/Web template - sTemplate = sTemplateWithoutExt; - sTemplate += ".stw"; - bSet = aPathOpt.SearchFile( sTemplate, SvtPathOptions::PATH_TEMPLATE ); - } + sTemplate = sTemplateWithoutExt + ".stw"; + if (aPathOpt.SearchFile( sTemplate, SvtPathOptions::PATH_TEMPLATE )) + return sTemplate; - if( !bSet ) - { - sTemplate = ""; - OSL_ENSURE( !this, - "The default HTML template cannot be found in the defined template directories!"); - } + OSL_ENSURE( !this, "The default HTML template cannot be found in the defined template directories!"); - return sTemplate; + return OUString(); } int HTMLReader::SetStrmStgPtr() @@ -187,7 +178,7 @@ int HTMLReader::SetStrmStgPtr() } // Aufruf fuer die allg. Reader-Schnittstelle -sal_uLong HTMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPam, const String & rName ) +sal_uLong HTMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPam, const OUString & rName ) { if( !pStrm ) { @@ -222,9 +213,8 @@ sal_uLong HTMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPam, co pStrm->ResetError(); else if( SVPAR_ACCEPTED != eState ) { - String sErr( OUString::number((sal_Int32)xParser->GetLineNr())); - sErr += ','; - sErr += OUString::number((sal_Int32)xParser->GetLinePos()); + const OUString sErr(OUString::number((sal_Int32)xParser->GetLineNr()) + + "," + OUString::number((sal_Int32)xParser->GetLinePos())); // den Stream als Fehlernummer Transporter benutzen nRet = *new StringErrorInfo( ERR_FORMAT_ROWCOL, sErr, diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 5df779fb17fe..97367e4cfbf1 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -1367,7 +1367,7 @@ HTMLSaveData::~HTMLSaveData() } -void GetHTMLWriter( const String&, const String& rBaseURL, WriterRef& xRet ) +void GetHTMLWriter( const OUString&, const OUString& rBaseURL, WriterRef& xRet ) { xRet = new SwHTMLWriter( rBaseURL ); } diff --git a/sw/source/filter/inc/fltini.hxx b/sw/source/filter/inc/fltini.hxx index 115ed3632b4f..d57227912f3e 100644 --- a/sw/source/filter/inc/fltini.hxx +++ b/sw/source/filter/inc/fltini.hxx @@ -33,20 +33,20 @@ class HTMLReader: public Reader { // wir wollen die Streams / Storages nicht geoeffnet haben virtual int SetStrmStgPtr(); - virtual sal_uLong Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &); - virtual String GetTemplateName() const; + virtual sal_uLong Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &); + virtual OUString GetTemplateName() const; public: HTMLReader(); }; class WW1Reader : public Reader { - virtual sal_uLong Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &); + virtual sal_uLong Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &); }; class XMLReader : public Reader { - virtual sal_uLong Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &); + virtual sal_uLong Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &); public: virtual int GetReaderType(); @@ -55,12 +55,12 @@ public: // read the sections of the document, which is equal to the medium. // returns the count of it virtual size_t GetSectionList( SfxMedium& rMedium, - std::vector<String*>& rStrings ) const; + std::vector<OUString*>& rStrings ) const; }; // die speziellen Writer -void GetWW8Writer( const String&, const String&, WriterRef& ); +void GetWW8Writer( const OUString&, const OUString&, WriterRef& ); // Umsetzen der LRSpaces im aktuell importierten Doc. Die Fremd-Filter diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index ad43cc9879fb..cfbc9154e716 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -42,10 +42,10 @@ using namespace ::com::sun::star; /// Glue class to call RtfImport as an internal filter, needed by copy&paste support. class SwRTFReader : public Reader { - virtual sal_uLong Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &); + virtual sal_uLong Read( SwDoc &, const OUString& rBaseURL, SwPaM &,const OUString &); }; -sal_uLong SwRTFReader::Read( SwDoc &rDoc, const String& /*rBaseURL*/, SwPaM& rPam, const String &) +sal_uLong SwRTFReader::Read( SwDoc &rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam, const OUString &) { if (!pStrm) return ERR_SWG_READ_ERROR; diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index 07fa02be2eb9..45da4f52e863 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -250,7 +250,7 @@ SvStream& Writer::OutULong( SvStream& rStrm, sal_uLong nVal ) } -sal_uLong Writer::Write( SwPaM& rPaM, SvStream& rStrm, const String* pFName ) +sal_uLong Writer::Write( SwPaM& rPaM, SvStream& rStrm, const OUString* pFName ) { if ( IsStgWriter() ) { @@ -277,20 +277,20 @@ sal_uLong Writer::Write( SwPaM& rPaM, SvStream& rStrm, const String* pFName ) return nRet; } -sal_uLong Writer::Write( SwPaM& rPam, SfxMedium& rMed, const String* pFileName ) +sal_uLong Writer::Write( SwPaM& rPam, SfxMedium& rMed, const OUString* pFileName ) { // This method must be overloaded in SwXMLWriter a storage from medium will be used there. // The microsoft format can write to storage but the storage will be based on the stream. return Write( rPam, *rMed.GetOutStream(), pFileName ); } -sal_uLong Writer::Write( SwPaM& /*rPam*/, SvStorage&, const String* ) +sal_uLong Writer::Write( SwPaM& /*rPam*/, SvStorage&, const OUString* ) { OSL_ENSURE( !this, "Write in Storages on a stream?" ); return ERR_SWG_WRITE_ERROR; } -sal_uLong Writer::Write( SwPaM&, const uno::Reference < embed::XStorage >&, const String*, SfxMedium* ) +sal_uLong Writer::Write( SwPaM&, const uno::Reference < embed::XStorage >&, const OUString*, SfxMedium* ) { OSL_ENSURE( !this, "Write in Storages on a stream?" ); return ERR_SWG_WRITE_ERROR; @@ -445,7 +445,7 @@ sal_uLong StgWriter::WriteStream() return ERR_SWG_WRITE_ERROR; } -sal_uLong StgWriter::Write( SwPaM& rPaM, SvStorage& rStg, const String* pFName ) +sal_uLong StgWriter::Write( SwPaM& rPaM, SvStorage& rStg, const OUString* pFName ) { SetStream(0); pStg = &rStg; @@ -465,7 +465,7 @@ sal_uLong StgWriter::Write( SwPaM& rPaM, SvStorage& rStg, const String* pFName ) return nRet; } -sal_uLong StgWriter::Write( SwPaM& rPaM, const uno::Reference < embed::XStorage >& rStg, const String* pFName, SfxMedium* pMedium ) +sal_uLong StgWriter::Write( SwPaM& rPaM, const uno::Reference < embed::XStorage >& rStg, const OUString* pFName, SfxMedium* pMedium ) { SetStream(0); pStg = 0; diff --git a/sw/source/filter/ww1/w1par.cxx b/sw/source/filter/ww1/w1par.cxx index dab32cff1291..561c28484d19 100644 --- a/sw/source/filter/ww1/w1par.cxx +++ b/sw/source/filter/ww1/w1par.cxx @@ -57,7 +57,7 @@ static sal_uLong WW1_Read_FieldIniFlags() // Diese werden dann einfach per Pipe 'uebertragen'. // -sal_uLong WW1Reader::Read(SwDoc& rDoc, const String& rBaseURL, SwPaM& rPam, const String& /*cName*/) +sal_uLong WW1Reader::Read(SwDoc& rDoc, const OUString& rBaseURL, SwPaM& rPam, const OUString& /*cName*/) { sal_uLong nRet = ERR_SWG_READ_ERROR; OSL_ENSURE(pStrm!=NULL, "W1-Read ohne Stream"); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 67dbaab06dda..f5c07e826fc9 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3395,7 +3395,7 @@ sal_uLong SwWW8Writer::WriteMedium( SfxMedium& ) } sal_uLong SwWW8Writer::Write( SwPaM& rPaM, SfxMedium& rMed, - const String* pFileName ) + const OUString* pFileName ) { mpMedium = &rMed; sal_uLong nRet = StgWriter::Write( rPaM, rMed, pFileName ); diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index e9ae483f5a20..01d32c28e219 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -894,7 +894,7 @@ public: bool InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec ); using StgWriter::Write; - virtual sal_uLong Write( SwPaM&, SfxMedium&, const String* = 0 ); + virtual sal_uLong Write( SwPaM&, SfxMedium&, const OUString* = 0 ); private: /// No copying. diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index c9ad2eb41227..fda24ba92c20 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -5685,7 +5685,7 @@ sal_uLong WW8Reader::OpenMainStream( SvStorageStreamRef& rRef, sal_uInt16& rBuff return nRet; } -sal_uLong WW8Reader::Read(SwDoc &rDoc, const String& rBaseURL, SwPaM &rPam, const String & /* FileName */) +sal_uLong WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPam, const OUString & /* FileName */) { sal_uInt16 nOldBuffSize = 32768; bool bNew = !bInsertMode; // New Doc (no inserting) @@ -5697,8 +5697,8 @@ sal_uLong WW8Reader::Read(SwDoc &rDoc, const String& rBaseURL, SwPaM &rPam, cons sal_uLong nRet = 0; sal_uInt8 nVersion = 8; - String sFltName = GetFltName(); - if( sFltName.EqualsAscii( "WW6" ) ) + const OUString sFltName = GetFltName(); + if ( sFltName=="WW6" ) { if (pStrm) nVersion = 6; @@ -5710,9 +5710,9 @@ sal_uLong WW8Reader::Read(SwDoc &rDoc, const String& rBaseURL, SwPaM &rPam, cons } else { - if( sFltName.EqualsAscii( "CWW6" ) ) + if ( sFltName=="CWW6" ) nVersion = 6; - else if( sFltName.EqualsAscii( "CWW7" ) ) + else if ( sFltName=="CWW7" ) nVersion = 7; if( pStg ) diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index ee4627acdd16..ee770c035a50 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -136,7 +136,7 @@ struct WW8LFOInfo; class WW8Reader : public StgReader { - virtual sal_uLong Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &); + virtual sal_uLong Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &); sal_uLong OpenMainStream( SvStorageStreamRef& rRef, sal_uInt16& rBuffSize ); public: virtual int GetReaderType(); diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index d3ba12a61ae8..0633f188f9f7 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -341,8 +341,7 @@ sal_Int32 ReadThroughComponent( OSL_ENSURE( xInfoSet.is(), "missing property set" ); if( xInfoSet.is() ) { - OUString sPropName("StreamName"); - xInfoSet->setPropertyValue( sPropName, makeAny( sStreamName ) ); + xInfoSet->setPropertyValue( "StreamName", makeAny( sStreamName ) ); } try @@ -351,8 +350,7 @@ sal_Int32 ReadThroughComponent( uno::Reference <io::XStream> xStream = xStorage->openStreamElement( sStreamName, embed::ElementModes::READ ); uno::Reference <beans::XPropertySet > xProps( xStream, uno::UNO_QUERY ); - Any aAny = xProps->getPropertyValue( - OUString("Encrypted") ); + Any aAny = xProps->getPropertyValue("Encrypted"); bool bEncrypted = aAny.getValueType() == ::getBooleanCppuType() && *(sal_Bool *)aAny.getValue(); @@ -501,7 +499,7 @@ static void lcl_ConvertSdrOle2ObjsToSdrGrafObjs( SwDoc& _rDoc ) } -sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, const String & rName ) +sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, const OUString & rName ) { // Get service factory uno::Reference< uno::XComponentContext > xContext = @@ -649,7 +647,7 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con if( xParentSet.is() ) { uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xParentSet->getPropertySetInfo() ); - OUString sPropName("BuildId" ); + const OUString sPropName("BuildId" ); if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(sPropName) ) { xInfoSet->setPropertyValue( sPropName, xParentSet->getPropertyValue(sPropName) ); @@ -683,8 +681,7 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con } uno::Any aProgRange; aProgRange <<= nProgressRange; - OUString sProgressRange("ProgressRange"); - xInfoSet->setPropertyValue(sProgressRange, aProgRange); + xInfoSet->setPropertyValue("ProgressRange", aProgRange); Reference< container::XNameAccess > xLateInitSettings( document::NamedPropertyValues::create(xContext), UNO_QUERY_THROW ); beans::NamedValue aLateInitSettings( @@ -721,36 +718,33 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con OUString *pSeq = aFamiliesSeq.getArray(); if( aOpt.IsFrmFmts() ) // SFX_STYLE_FAMILY_FRAME; - *pSeq++ = OUString("FrameStyles"); + *pSeq++ = "FrameStyles"; if( aOpt.IsPageDescs() ) // SFX_STYLE_FAMILY_PAGE; - *pSeq++ = OUString("PageStyles"); + *pSeq++ = "PageStyles"; if( aOpt.IsTxtFmts() ) { // (SFX_STYLE_FAMILY_CHAR|SFX_STYLE_FAMILY_PARA); - *pSeq++ = OUString("CharacterStyles"); - *pSeq++ = OUString("ParagraphStyles"); + *pSeq++ = "CharacterStyles"; + *pSeq++ = "ParagraphStyles"; } if( aOpt.IsNumRules() ) // SFX_STYLE_FAMILY_PSEUDO; - *pSeq++ = OUString("NumberingStyles"); + *pSeq++ = "NumberingStyles"; - OUString sStyleInsertModeFamilies("StyleInsertModeFamilies"); - xInfoSet->setPropertyValue( sStyleInsertModeFamilies, + xInfoSet->setPropertyValue( "StyleInsertModeFamilies", makeAny(aFamiliesSeq) ); - OUString sStyleInsertModeOverwrite("StyleInsertModeOverwrite"); sal_Bool bTmp = !aOpt.IsMerge(); Any aAny; aAny.setValue( &bTmp, ::getBooleanCppuType() ); - xInfoSet->setPropertyValue( sStyleInsertModeOverwrite, aAny ); + xInfoSet->setPropertyValue( "StyleInsertModeOverwrite", aAny ); } else if( bInsertMode ) { const uno::Reference<text::XTextRange> xInsertTextRange = SwXTextRange::CreateXTextRange(rDoc, *rPaM.GetPoint(), 0); - OUString sTextInsertModeRange("TextInsertModeRange"); - xInfoSet->setPropertyValue( sTextInsertModeRange, + xInfoSet->setPropertyValue( "TextInsertModeRange", makeAny(xInsertTextRange) ); } else @@ -761,19 +755,17 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con if( IsBlockMode() ) { - OUString sAutoTextMode("AutoTextMode"); sal_Bool bTmp = sal_True; Any aAny; aAny.setValue( &bTmp, ::getBooleanCppuType() ); - xInfoSet->setPropertyValue( sAutoTextMode, aAny ); + xInfoSet->setPropertyValue( "AutoTextMode", aAny ); } if( IsOrganizerMode() ) { - OUString sOrganizerMode("OrganizerMode"); sal_Bool bTmp = sal_True; Any aAny; aAny.setValue( &bTmp, ::getBooleanCppuType() ); - xInfoSet->setPropertyValue( sOrganizerMode, aAny ); + xInfoSet->setPropertyValue( "OrganizerMode", aAny ); } // Set base URI @@ -782,9 +774,7 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con SfxMedium* pMedDescrMedium = pMedium ? pMedium : pDocSh->GetMedium(); OSL_ENSURE( pMedDescrMedium, "There is no medium to get MediaDescriptor from!\n" ); - OUString aBaseURL( rBaseURL ); - OUString sPropName("BaseURI"); - xInfoSet->setPropertyValue( sPropName, makeAny( aBaseURL ) ); + xInfoSet->setPropertyValue( "BaseURI", makeAny( rBaseURL ) ); // TODO/LATER: separate links from usual embedded objects OUString StreamPath; @@ -799,13 +789,12 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con } else { - StreamPath = OUString("dummyObjectName"); + StreamPath = "dummyObjectName"; } if( !StreamPath.isEmpty() ) { - sPropName = OUString("StreamRelPath"); - xInfoSet->setPropertyValue( sPropName, makeAny( StreamPath ) ); + xInfoSet->setPropertyValue( "StreamRelPath", makeAny( StreamPath ) ); } } @@ -815,15 +804,15 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con // save redline mode into import info property set Any aAny; sal_Bool bTmp; - OUString sShowChanges("ShowChanges"); + const OUString sShowChanges("ShowChanges"); + const OUString sRecordChanges("RecordChanges"); + const OUString sRedlineProtectionKey("RedlineProtectionKey"); bTmp = IDocumentRedlineAccess::IsShowChanges( rDoc.GetRedlineMode() ); aAny.setValue( &bTmp, ::getBooleanCppuType() ); xInfoSet->setPropertyValue( sShowChanges, aAny ); - OUString sRecordChanges("RecordChanges"); bTmp = IDocumentRedlineAccess::IsRedlineOn(rDoc.GetRedlineMode()); aAny.setValue( &bTmp, ::getBooleanCppuType() ); xInfoSet->setPropertyValue( sRecordChanges, aAny ); - OUString sRedlineProtectionKey("RedlineProtectionKey"); aAny <<= rDoc.GetRedlinePassword(); xInfoSet->setPropertyValue( sRedlineProtectionKey, aAny ); @@ -836,13 +825,13 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con { const sal_Bool bShapePositionInHoriL2R = !bOASIS; xInfoSet->setPropertyValue( - OUString("ShapePositionInHoriL2R"), + "ShapePositionInHoriL2R", makeAny( bShapePositionInHoriL2R ) ); } { const sal_Bool bTextDocInOOoFileFormat = !bOASIS; xInfoSet->setPropertyValue( - OUString("TextDocInOOoFileFormat"), + "TextDocInOOoFileFormat", makeAny( bTextDocInOOoFileFormat ) ); } @@ -857,7 +846,7 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(xModelComp, uno::UNO_QUERY_THROW); const uno::Reference<rdf::XURI> xBaseURI( ::sfx2::createBaseURI( - xContext, xStorage, aBaseURL, StreamPath) ); + xContext, xStorage, rBaseURL, StreamPath) ); const uno::Reference<task::XInteractionHandler> xHandler( pDocSh->GetMedium()->GetInteractionHandler() ); xDMA->loadMetadataFromStorage(xStorage, xBaseURI, xHandler); @@ -1013,7 +1002,7 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con if( xModelSet.is() ) { uno::Reference< beans::XPropertySetInfo > xModelSetInfo( xModelSet->getPropertySetInfo() ); - OUString sName("BuildId" ); + const OUString sName("BuildId" ); if( xModelSetInfo.is() && xModelSetInfo->hasPropertyByName(sName) ) { xModelSet->setPropertyValue( sName, xInfoSet->getPropertyValue(sName) ); @@ -1033,7 +1022,7 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con // read the sections of the document, which is equal to the medium. // returns the count of it size_t XMLReader::GetSectionList( SfxMedium& rMedium, - std::vector<String*>& rStrings ) const + std::vector<OUString*>& rStrings ) const { uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx index 6c1e193e57b1..6542fbe2e391 100644 --- a/sw/source/filter/xml/wrtxml.cxx +++ b/sw/source/filter/xml/wrtxml.cxx @@ -58,7 +58,7 @@ using namespace ::com::sun::star::document; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; -SwXMLWriter::SwXMLWriter( const String& rBaseURL ) +SwXMLWriter::SwXMLWriter( const OUString& rBaseURL ) { SetBaseURL( rBaseURL ); } @@ -212,9 +212,9 @@ pGraphicHelper = SvXMLGraphicHelper::Create( xStg, if ( !aDocHierarchicalName.isEmpty() ) aName = aDocHierarchicalName; else - aName = OUString( "dummyObjectName" ); + aName = "dummyObjectName"; - sPropName = OUString("StreamRelPath"); + sPropName = "StreamRelPath"; xInfoSet->setPropertyValue( sPropName, makeAny( aName ) ); } @@ -287,7 +287,6 @@ pGraphicHelper = SvXMLGraphicHelper::Create( xStg, // export sub streams for package, else full stream into a file bool bWarn = false, bErr = false; - String sWarnFile, sErrFile; // RDF metadata: export if ODF >= 1.2 // N.B.: embedded documents have their own manifest.rdf! @@ -333,6 +332,7 @@ pGraphicHelper = SvXMLGraphicHelper::Create( xStg, {} } + OUString sWarnFile; if( !bOrganizerMode && !bBlock && bStoreMeta ) { if( !WriteThroughComponent( @@ -342,8 +342,7 @@ pGraphicHelper = SvXMLGraphicHelper::Create( xStg, aEmptyArgs, aProps ) ) { bWarn = true; - sWarnFile = String( RTL_CONSTASCII_STRINGPARAM("meta.xml"), - RTL_TEXTENCODING_ASCII_US ); + sWarnFile = "meta.xml"; } } @@ -360,13 +359,13 @@ pGraphicHelper = SvXMLGraphicHelper::Create( xStg, if( !bWarn ) { bWarn = true; - sWarnFile = String( RTL_CONSTASCII_STRINGPARAM("settings.xml"), - RTL_TEXTENCODING_ASCII_US ); + sWarnFile = "settings.xml"; } } } } + OUString sErrFile; if( !WriteThroughComponent( xModelComp, "styles.xml", xContext, (bOASIS ? "com.sun.star.comp.Writer.XMLOasisStylesExporter" @@ -374,8 +373,7 @@ pGraphicHelper = SvXMLGraphicHelper::Create( xStg, aFilterArgs, aProps ) ) { bErr = true; - sErrFile = String( RTL_CONSTASCII_STRINGPARAM("styles.xml"), - RTL_TEXTENCODING_ASCII_US ); + sErrFile = "styles.xml"; } @@ -388,8 +386,7 @@ pGraphicHelper = SvXMLGraphicHelper::Create( xStg, aFilterArgs, aProps ) ) { bErr = true; - sErrFile = String( RTL_CONSTASCII_STRINGPARAM("content.xml"), - RTL_TEXTENCODING_ASCII_US ); + sErrFile = "content.xml"; } } @@ -442,19 +439,17 @@ pGraphicHelper = SvXMLGraphicHelper::Create( xStg, if( bErr ) { - if( sErrFile.Len() ) + if( !sErrFile.isEmpty() ) return *new StringErrorInfo( ERR_WRITE_ERROR_FILE, sErrFile, ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR ); - else - return ERR_SWG_WRITE_ERROR; + return ERR_SWG_WRITE_ERROR; } else if( bWarn ) { - if( sWarnFile.Len() ) + if( !sWarnFile.isEmpty() ) return *new StringErrorInfo( WARN_WRITE_ERROR_FILE, sWarnFile, ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR ); - else - return WARN_SWG_FEATURES_LOST; + return WARN_SWG_FEATURES_LOST; } return 0; @@ -482,7 +477,7 @@ sal_uLong SwXMLWriter::WriteMedium( SfxMedium& aTargetMedium ) } sal_uLong SwXMLWriter::Write( SwPaM& rPaM, SfxMedium& rMed, - const String* pFileName ) + const OUString* pFileName ) { return IsStgWriter() ? ((StgWriter *)this)->Write( rPaM, rMed.GetOutputStorage(), pFileName, &rMed ) @@ -600,7 +595,7 @@ bool SwXMLWriter::WriteThroughComponent( // ----------------------------------------------------------------------- -void GetXMLWriter( const String& /*rName*/, const String& rBaseURL, WriterRef& xRet ) +void GetXMLWriter( const OUString& /*rName*/, const OUString& rBaseURL, WriterRef& xRet ) { xRet = new SwXMLWriter( rBaseURL ); } diff --git a/sw/source/filter/xml/wrtxml.hxx b/sw/source/filter/xml/wrtxml.hxx index 8097510abf65..779b9aec5c0c 100644 --- a/sw/source/filter/xml/wrtxml.hxx +++ b/sw/source/filter/xml/wrtxml.hxx @@ -49,10 +49,10 @@ protected: public: - SwXMLWriter( const String& rBaseURL ); + SwXMLWriter( const OUString& rBaseURL ); virtual ~SwXMLWriter(); - virtual sal_uLong Write( SwPaM&, SfxMedium&, const String* = 0 ); + virtual sal_uLong Write( SwPaM&, SfxMedium&, const OUString* = 0 ); private: diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index cdc1d26c18d8..2a0c0af82921 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -676,7 +676,7 @@ sal_Bool SwDocShell::ConvertTo( SfxMedium& rMedium ) // Span Context in order to suppress the Selection's View sal_uLong nErrno; - String aFileName( rMedium.GetName() ); + const OUString aFileName( rMedium.GetName() ); // No View, so the whole Document! if ( pWrtShell ) diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx index bad86da75832..d6ca744acfe8 100644 --- a/sw/source/ui/dialog/ascfldlg.cxx +++ b/sw/source/ui/dialog/ascfldlg.cxx @@ -196,7 +196,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh, m_pFontLB->InsertEntry( *it ); } - if( !aOpt.GetFontName().Len() ) + if( aOpt.GetFontName().isEmpty() ) { LanguageType eLang = aOpt.GetLanguage(); Font aTmpFont(OutputDevice::GetDefaultFont(DEFAULTFONT_FIXED, eLang, DEFAULTFONT_FLAGS_ONLYONE, pPrt)); diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index 3f5e438696b9..6f90f318c5ad 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -1420,13 +1420,13 @@ static void lcl_ReadSections( SfxMedium& rMedium, ComboBox& rBox ) uno::Reference < embed::XStorage > xStg; if( rMedium.IsStorage() && (xStg = rMedium.GetStorage()).is() ) { - std::vector<String*> aArr; + std::vector<OUString*> aArr; sal_uInt32 nFormat = SotStorage::GetFormatID( xStg ); if ( nFormat == SOT_FORMATSTR_ID_STARWRITER_60 || nFormat == SOT_FORMATSTR_ID_STARWRITERGLOB_60 || nFormat == SOT_FORMATSTR_ID_STARWRITER_8 || nFormat == SOT_FORMATSTR_ID_STARWRITERGLOB_8) SwGetReaderXML()->GetSectionList( rMedium, aArr ); - for(std::vector<String*>::const_iterator it(aArr.begin()); it != aArr.end(); ++it) { + for(std::vector<OUString*>::const_iterator it(aArr.begin()); it != aArr.end(); ++it) { rBox.InsertEntry( **it ); delete *it; } diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index 805847fc822a..b30560245c91 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -816,19 +816,17 @@ void SwSrcView::Load(SwDocShell* pDocShell) { utl::TempFile aTempFile; aTempFile.EnableKillingFile(); - String sFileURL( aTempFile.GetURL() ); + const OUString sFileURL( aTempFile.GetURL() ); SvtSaveOptions aOpt; { SfxMedium aMedium( sFileURL,STREAM_READWRITE ); SwWriter aWriter( aMedium, *pDocShell->GetDoc() ); WriterRef xWriter; - ::GetHTMLWriter(aEmptyStr, aMedium.GetBaseURL( true ), xWriter); - String sWriteName; - if (pDocShell->HasName()) - sWriteName = pMedium->GetName(); - else - sWriteName = sFileURL; + ::GetHTMLWriter(OUString(), aMedium.GetBaseURL( true ), xWriter); + const OUString sWriteName = pDocShell->HasName() + ? pMedium->GetName() + : sFileURL; sal_uLong nRes = aWriter.Write(xWriter, &sWriteName); if(nRes) { |