Kaydet (Commit) 73a13694 authored tarafından Matteo Casalin's avatar Matteo Casalin Kaydeden (comit) Luboš Luňák

String to OUString

Change-Id: Ia9bebaf92bf570c10d01a9ed3db437f70098a07d
Reviewed-on: https://gerrit.libreoffice.org/5185Reviewed-by: 's avatarLuboš Luňák <l.lunak@suse.cz>
Tested-by: 's avatarLuboš Luňák <l.lunak@suse.cz>
üst 9accbeda
...@@ -100,7 +100,8 @@ SvXMLWordContext::SvXMLWordContext( ...@@ -100,7 +100,8 @@ SvXMLWordContext::SvXMLWordContext(
SvXMLImportContext ( rImport, nPrefix, rLocalName ), SvXMLImportContext ( rImport, nPrefix, rLocalName ),
rLocalRef(rImport) rLocalRef(rImport)
{ {
String sRight, sWrong; OUString sRight;
OUString sWrong;
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
for (sal_Int16 i=0; i < nAttrCount; i++) for (sal_Int16 i=0; i < nAttrCount; i++)
...@@ -121,15 +122,15 @@ SvXMLWordContext::SvXMLWordContext( ...@@ -121,15 +122,15 @@ SvXMLWordContext::SvXMLWordContext(
} }
} }
} }
if (!sWrong.Len() || !sRight.Len() ) if (sWrong.isEmpty() || sRight.isEmpty())
return; return;
sal_Bool bOnlyTxt = sRight != sWrong; sal_Bool bOnlyTxt = sRight != sWrong;
if( !bOnlyTxt ) if( !bOnlyTxt )
{ {
String sLongSave( sRight ); const OUString sLongSave( sRight );
if( !rLocalRef.rAutoCorrect.GetLongText( rLocalRef.xStorage, String(), sWrong, sRight ) && if( !rLocalRef.rAutoCorrect.GetLongText( rLocalRef.xStorage, String(), sWrong, sRight ) &&
sLongSave.Len() ) !sLongSave.isEmpty() )
{ {
sRight = sLongSave; sRight = sLongSave;
bOnlyTxt = sal_True; bOnlyTxt = sal_True;
......
...@@ -1609,14 +1609,15 @@ sal_Bool SvxAutoCorrect::MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNew ...@@ -1609,14 +1609,15 @@ sal_Bool SvxAutoCorrect::MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNew
// - return the replacement text (only for SWG-Format, all other // - return the replacement text (only for SWG-Format, all other
// can be taken from the word list!) // can be taken from the word list!)
sal_Bool SvxAutoCorrect::GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String&, const String& , String& ) sal_Bool SvxAutoCorrect::GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&,
const String&, const String&, OUString& )
{ {
return sal_False; return sal_False;
} }
// Text with attribution (only the SWG - SWG format!) // Text with attribution (only the SWG - SWG format!)
sal_Bool SvxAutoCorrect::PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String&, const String&, SfxObjectShell&, sal_Bool SvxAutoCorrect::PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&,
String& ) const String&, const String&, SfxObjectShell&, OUString& )
{ {
return sal_False; return sal_False;
} }
...@@ -2541,7 +2542,7 @@ sal_Bool SvxAutoCorrectLanguageLists::PutText( const String& rShort, ...@@ -2541,7 +2542,7 @@ sal_Bool SvxAutoCorrectLanguageLists::PutText( const String& rShort,
MakeUserStorage_Impl(); MakeUserStorage_Impl();
sal_Bool bRet = sal_False; sal_Bool bRet = sal_False;
String sLong; OUString sLong;
try try
{ {
uno::Reference < embed::XStorage > xStg = comphelper::OStorageHelper::GetStorageFromURL( sUserAutoCorrFile, embed::ElementModes::READWRITE ); uno::Reference < embed::XStorage > xStg = comphelper::OStorageHelper::GetStorageFromURL( sUserAutoCorrFile, embed::ElementModes::READWRITE );
......
...@@ -267,8 +267,8 @@ class EDITENG_DLLPUBLIC SvxAutoCorrect ...@@ -267,8 +267,8 @@ class EDITENG_DLLPUBLIC SvxAutoCorrect
protected: protected:
// - Text with attribution (only the SWG - SWG format!) // - Text with attribution (only the SWG - SWG format!)
// rShort is the stream name - encrypted! // rShort is the stream name - encrypted!
virtual sal_Bool PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const String& rFileName, const String& rShort, SfxObjectShell& , virtual sal_Bool PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg,
String& ); const String& rFileName, const String& rShort, SfxObjectShell&, OUString& );
// required language in the table add if possible only when the file exists // required language in the table add if possible only when the file exists
sal_Bool CreateLanguageFile(LanguageType eLang, sal_Bool bNewFile = sal_True); sal_Bool CreateLanguageFile(LanguageType eLang, sal_Bool bNewFile = sal_True);
...@@ -279,7 +279,8 @@ public: ...@@ -279,7 +279,8 @@ public:
sal_Unicode GetQuote( sal_Unicode cInsChar, sal_Bool bSttQuote, sal_Unicode GetQuote( sal_Unicode cInsChar, sal_Bool bSttQuote,
LanguageType eLang ) const; LanguageType eLang ) const;
virtual sal_Bool GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const String& rFileName, const String& rShort, String& rLong ); virtual sal_Bool GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg,
const String& rFileName, const String& rShort, OUString& rLong );
TYPEINFO(); TYPEINFO();
......
...@@ -31,12 +31,13 @@ class SwAutoCorrect : public SvxAutoCorrect ...@@ -31,12 +31,13 @@ class SwAutoCorrect : public SvxAutoCorrect
protected: protected:
// Return replacement text (only for SWG-format, all others can be obtained from wordlist!). // Return replacement text (only for SWG-format, all others can be obtained from wordlist!).
// rShort is stream-name - encrypted! // rShort is stream-name - encrypted!
virtual sal_Bool GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& , const String& rFileName, const String& rShort, String& rLong ); virtual sal_Bool GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&,
const String& rFileName, const String& rShort, OUString& rLong );
// Text with attributes (only SWG-format!). // Text with attributes (only SWG-format!).
// rShort is stream-name - encrypted! // rShort is stream-name - encrypted!
virtual sal_Bool PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String& rFileName, const String& rShort, SfxObjectShell& , virtual sal_Bool PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&,
String& ); const String& rFileName, const String& rShort, SfxObjectShell&, OUString& );
public: public:
TYPEINFO(); TYPEINFO();
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define _SW_XMLBLOCKIMPORT_HXX #define _SW_XMLBLOCKIMPORT_HXX
#include <xmloff/xmlimp.hxx> #include <xmloff/xmlimp.hxx>
#include <tools/string.hxx>
class SwXMLTextBlocks; class SwXMLTextBlocks;
class SwXMLBlockListImport : public SvXMLImport class SwXMLBlockListImport : public SvXMLImport
...@@ -65,10 +64,10 @@ protected: ...@@ -65,10 +64,10 @@ protected:
public: public:
sal_Bool bTextOnly; sal_Bool bTextOnly;
String &m_rText; OUString &m_rText;
SwXMLTextBlockImport( SwXMLTextBlockImport(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
SwXMLTextBlocks &rBlocks, String &rNewText, sal_Bool bNewTextOnly ); SwXMLTextBlocks &rBlocks, OUString &rNewText, sal_Bool bNewTextOnly );
SwXMLTextBlocks& getBlockList ( void ) SwXMLTextBlocks& getBlockList ( void )
{ {
......
...@@ -65,8 +65,8 @@ public: ...@@ -65,8 +65,8 @@ public:
virtual sal_uLong GetDoc( sal_uInt16 ); virtual sal_uLong GetDoc( sal_uInt16 );
virtual sal_uLong BeginPutDoc( const String&, const String& ); virtual sal_uLong BeginPutDoc( const String&, const String& );
virtual sal_uLong PutDoc(); virtual sal_uLong PutDoc();
virtual sal_uLong GetText( sal_uInt16, String& ); virtual sal_uLong GetText( sal_uInt16, OUString& );
virtual sal_uLong PutText( const String&, const String&, const String& ); virtual sal_uLong PutText( const String&, const String&, const OUString& );
virtual sal_uLong MakeBlockList(); virtual sal_uLong MakeBlockList();
virtual short GetFileType ( void ) const; virtual short GetFileType ( void ) const;
...@@ -76,7 +76,7 @@ public: ...@@ -76,7 +76,7 @@ public:
static sal_Bool IsFileUCBStorage( const String & rFileName); static sal_Bool IsFileUCBStorage( const String & rFileName);
// Methods for the new Autocorrecter // Methods for the new Autocorrecter
sal_uLong GetText( const String& rShort, String& ); sal_uLong GetText( const String& rShort, OUString& );
virtual sal_Bool IsOnlyTextBlock( const String& rShort ) const; virtual sal_Bool IsOnlyTextBlock( const String& rShort ) const;
virtual sal_Bool IsOnlyTextBlock( sal_uInt16 nIdx ) const; virtual sal_Bool IsOnlyTextBlock( sal_uInt16 nIdx ) const;
...@@ -95,7 +95,7 @@ public: ...@@ -95,7 +95,7 @@ public:
//void SetDoc( SwDoc * pNewDoc); //void SetDoc( SwDoc * pNewDoc);
sal_uLong StartPutBlock( const String& rShort, const String& rPackageName ); sal_uLong StartPutBlock( const String& rShort, const String& rPackageName );
sal_uLong PutBlock( SwPaM& rPaM, const String& rLong ); sal_uLong PutBlock( SwPaM& rPaM, const String& rLong );
sal_uLong GetBlockText( const String& rShort, String& rText ); sal_uLong GetBlockText( const String& rShort, OUString& rText );
sal_uLong PutBlockText( const String& rShort, const String& rName, const String& rText, const String& rPackageName ); sal_uLong PutBlockText( const String& rShort, const String& rName, const String& rText, const String& rPackageName );
void MakeBlockText( const String& rText ); void MakeBlockText( const String& rText );
......
...@@ -60,7 +60,7 @@ class SwImpBlocks ...@@ -60,7 +60,7 @@ class SwImpBlocks
protected: protected:
String aFile; // physikalischer Dateiname String aFile; // physikalischer Dateiname
String aName; // logischer Name der Datei String aName; // logischer Name der Datei
String aCur; // aktueller Text OUString aCur; // aktueller Text
String aShort, aLong; // Kurz- und Langname (PutDoc) String aShort, aLong; // Kurz- und Langname (PutDoc)
String sBaseURL; // base URL - has to be set at the Readers and Writers String sBaseURL; // base URL - has to be set at the Readers and Writers
SwBlockNames aNames; // Liste aller Bausteine SwBlockNames aNames; // Liste aller Bausteine
...@@ -113,8 +113,8 @@ public: ...@@ -113,8 +113,8 @@ public:
virtual sal_uLong GetDoc( sal_uInt16 ) = 0; virtual sal_uLong GetDoc( sal_uInt16 ) = 0;
virtual sal_uLong BeginPutDoc( const String&, const String& ) = 0; virtual sal_uLong BeginPutDoc( const String&, const String& ) = 0;
virtual sal_uLong PutDoc() = 0; virtual sal_uLong PutDoc() = 0;
virtual sal_uLong GetText( sal_uInt16, String& ) = 0; virtual sal_uLong GetText( sal_uInt16, OUString& ) = 0;
virtual sal_uLong PutText( const String&, const String&, const String& ) = 0; virtual sal_uLong PutText( const String&, const String&, const OUString& ) = 0;
virtual sal_uLong MakeBlockList() = 0; virtual sal_uLong MakeBlockList() = 0;
virtual sal_uLong OpenFile( sal_Bool bReadOnly = sal_True ) = 0; virtual sal_uLong OpenFile( sal_Bool bReadOnly = sal_True ) = 0;
......
...@@ -35,7 +35,8 @@ TYPEINIT1( SwAutoCorrect, SvxAutoCorrect ); ...@@ -35,7 +35,8 @@ TYPEINIT1( SwAutoCorrect, SvxAutoCorrect );
// koennen aus der Wortliste herausgeholt werden!) // koennen aus der Wortliste herausgeholt werden!)
// rShort ist der Stream-Name - gecryptet! // rShort ist der Stream-Name - gecryptet!
sal_Bool SwAutoCorrect::GetLongText( const uno::Reference < embed::XStorage >& rStg, const String& rFileName, const String& rShort, String& rLong ) sal_Bool SwAutoCorrect::GetLongText( const uno::Reference < embed::XStorage >& rStg,
const String& rFileName, const String& rShort, OUString& rLong )
{ {
sal_uLong nRet = 0; sal_uLong nRet = 0;
if (rStg.is()) if (rStg.is())
...@@ -47,13 +48,14 @@ sal_Bool SwAutoCorrect::GetLongText( const uno::Reference < embed::XStorage >& r ...@@ -47,13 +48,14 @@ sal_Bool SwAutoCorrect::GetLongText( const uno::Reference < embed::XStorage >& r
else { else {
OSL_ENSURE( rStg.is(), "Someone passed SwAutoCorrect::GetLongText a dud storage!"); OSL_ENSURE( rStg.is(), "Someone passed SwAutoCorrect::GetLongText a dud storage!");
} }
return !IsError( nRet ) && rLong.Len(); return !IsError( nRet ) && !rLong.isEmpty();
} }
// - Text mit Attributierung (kann nur der SWG - SWG-Format!) // - Text mit Attributierung (kann nur der SWG - SWG-Format!)
// rShort ist der Stream-Name - gecryptet! // rShort ist der Stream-Name - gecryptet!
sal_Bool SwAutoCorrect::PutText( const uno::Reference < embed::XStorage >& rStg, const String& rFileName, const String& rShort, sal_Bool SwAutoCorrect::PutText( const uno::Reference < embed::XStorage >& rStg,
SfxObjectShell& rObjSh, String& rLong ) const String& rFileName, const String& rShort,
SfxObjectShell& rObjSh, OUString& rLong )
{ {
if( !rObjSh.IsA( TYPE(SwDocShell) ) ) if( !rObjSh.IsA( TYPE(SwDocShell) ) )
return sal_False; return sal_False;
......
...@@ -64,7 +64,7 @@ SvXMLImportContext *SwXMLBlockListImport::CreateContext( ...@@ -64,7 +64,7 @@ SvXMLImportContext *SwXMLBlockListImport::CreateContext(
SwXMLTextBlockImport::SwXMLTextBlockImport( SwXMLTextBlockImport::SwXMLTextBlockImport(
const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< uno::XComponentContext > xContext,
SwXMLTextBlocks &rBlocks, SwXMLTextBlocks &rBlocks,
String & rNewText, OUString & rNewText,
sal_Bool bNewTextOnly ) sal_Bool bNewTextOnly )
: SvXMLImport(xContext, IMPORT_ALL ), : SvXMLImport(xContext, IMPORT_ALL ),
rBlockList ( rBlocks ), rBlockList ( rBlocks ),
......
...@@ -224,16 +224,16 @@ SwXMLTextBlockParContext::SwXMLTextBlockParContext( ...@@ -224,16 +224,16 @@ SwXMLTextBlockParContext::SwXMLTextBlockParContext(
void SwXMLTextBlockParContext::Characters( const OUString& rChars ) void SwXMLTextBlockParContext::Characters( const OUString& rChars )
{ {
rLocalRef.m_rText.Append ( rChars.getStr()); rLocalRef.m_rText += rChars;
} }
SwXMLTextBlockParContext::~SwXMLTextBlockParContext ( void ) SwXMLTextBlockParContext::~SwXMLTextBlockParContext ( void )
{ {
if (rLocalRef.bTextOnly) if (rLocalRef.bTextOnly)
rLocalRef.m_rText.AppendAscii( "\015" ); rLocalRef.m_rText += "\015";
else else
{ {
if (rLocalRef.m_rText.GetChar ( rLocalRef.m_rText.Len()) != ' ' ) if (!rLocalRef.m_rText.endsWith( " " ))
rLocalRef.m_rText.AppendAscii( " " ); rLocalRef.m_rText += " ";
} }
} }
......
...@@ -414,12 +414,12 @@ sal_uLong SwXMLTextBlocks::PutDoc() ...@@ -414,12 +414,12 @@ sal_uLong SwXMLTextBlocks::PutDoc()
return nErr; return nErr;
} }
sal_uLong SwXMLTextBlocks::GetText( sal_uInt16 nIdx, String& rText ) sal_uLong SwXMLTextBlocks::GetText( sal_uInt16 nIdx, OUString& rText )
{ {
return GetBlockText( aNames[ nIdx ]->aShort, rText ); return GetBlockText( aNames[ nIdx ]->aShort, rText );
} }
sal_uLong SwXMLTextBlocks::GetText( const String& rShort, String& rText ) sal_uLong SwXMLTextBlocks::GetText( const String& rShort, OUString& rText )
{ {
return GetBlockText( rShort, rText ); return GetBlockText( rShort, rText );
} }
...@@ -572,7 +572,7 @@ OUString SwXMLTextBlocks::GeneratePackageName ( const String& rShort ) ...@@ -572,7 +572,7 @@ OUString SwXMLTextBlocks::GeneratePackageName ( const String& rShort )
} }
sal_uLong SwXMLTextBlocks::PutText( const String& rShort, const String& rName, sal_uLong SwXMLTextBlocks::PutText( const String& rShort, const String& rName,
const String& rText ) const OUString& rText )
{ {
sal_uLong nRes = 0; sal_uLong nRes = 0;
aShort = rShort; aShort = rShort;
......
...@@ -266,13 +266,13 @@ sal_uLong SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, ...@@ -266,13 +266,13 @@ sal_uLong SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
} }
sal_uLong SwXMLTextBlocks::GetBlockText( const String& rShort, String& rText ) sal_uLong SwXMLTextBlocks::GetBlockText( const String& rShort, OUString& rText )
{ {
sal_uLong n = 0; sal_uLong n = 0;
sal_Bool bTextOnly = sal_True; sal_Bool bTextOnly = sal_True;
String aFolderName = GeneratePackageName ( rShort ); String aFolderName = GeneratePackageName ( rShort );
String aStreamName = aFolderName + OUString(".xml"); String aStreamName = aFolderName + OUString(".xml");
rText.Erase(); rText = OUString();
try try
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment