diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2013-08-14 11:54:25 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-08-14 21:30:24 +0000 |
commit | f9e8f092f770b00ca2327153da6ce9d88af4c6d5 (patch) | |
tree | d28fd75677af074ee284747a1d3f9aabbd1a44d0 /sw | |
parent | cafcf33915fe30af693a94f4224fedd5cb9f9a55 (diff) |
String to OUString
Change-Id: I6ccde9448acf8564fe270f119ffdfa8b1bab8afe
Reviewed-on: https://gerrit.libreoffice.org/5409
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/modcfg.hxx | 31 | ||||
-rw-r--r-- | sw/inc/swmodule.hxx | 2 | ||||
-rw-r--r-- | sw/source/ui/app/swmodul1.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/config/modcfg.cxx | 69 | ||||
-rw-r--r-- | sw/source/ui/uno/unotxdoc.cxx | 2 |
5 files changed, 51 insertions, 55 deletions
diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx index 374d519766b0..75d8a2aca69f 100644 --- a/sw/inc/modcfg.hxx +++ b/sw/inc/modcfg.hxx @@ -20,7 +20,6 @@ #define _MODOPT_HXX #include <boost/ptr_container/ptr_vector.hpp> -#include <tools/string.hxx> #include <tools/wintypes.hxx> #include <vcl/field.hxx> #include <unotools/configitem.hxx> @@ -144,18 +143,18 @@ class SwMiscConfig : public utl::ConfigItem { friend class SwModuleOptions; - String sWordDelimiter; // Statistics/WordNumber/Delimiter + OUString sWordDelimiter; // Statistics/WordNumber/Delimiter sal_Bool bDefaultFontsInCurrDocOnly; // DefaultFont/Document - sal_Bool bShowIndexPreview ; // Index/ShowPreview + sal_Bool bShowIndexPreview; // Index/ShowPreview sal_Bool bGrfToGalleryAsLnk; // Misc/GraphicToGalleryAsLink sal_Bool bNumAlignSize; // Numbering/Graphic/KeepRatio sal_Bool bSinglePrintJob; // FormLetter/PrintOutput/SinglePrintJobs sal_Bool bIsNameFromColumn; // FormLetter/FileOutput/FileName/Generation sal_Bool bAskForMailMergeInPrint; // Ask if documents containing fields should be 'mailmerged' sal_Int16 nMailingFormats; // FormLetter/MailingOutput/Formats - String sNameFromColumn; // FormLetter/FileOutput/FileName/FromDatabaseField (string!) - String sMailingPath; // FormLetter/FileOutput/Path - String sMailName; // FormLetter/FileOutput/FileName/FromManualSetting (string!) + OUString sNameFromColumn; // FormLetter/FileOutput/FileName/FromDatabaseField (string!) + OUString sMailingPath; // FormLetter/FileOutput/Path + OUString sMailName; // FormLetter/FileOutput/FileName/FromManualSetting (string!) const com::sun::star::uno::Sequence<OUString>& GetPropertyNames(); public: @@ -179,7 +178,7 @@ class SW_DLLPUBLIC SwModuleOptions SwMiscConfig aMiscConfig; - SwCompareConfig aCompareConfig; + SwCompareConfig aCompareConfig; //fiscus: don't show tips of text fields - it's not part of the configuration! sal_Bool bHideFieldTips : 1; @@ -304,24 +303,24 @@ public: } - const String& GetNameFromColumn() const { return aMiscConfig.sNameFromColumn; } - void SetNameFromColumn( const String& rSet ) { aMiscConfig.sNameFromColumn = rSet; + OUString GetNameFromColumn() const { return aMiscConfig.sNameFromColumn; } + void SetNameFromColumn( const OUString& rSet ) { aMiscConfig.sNameFromColumn = rSet; aMiscConfig.SetModified();} - String GetMailingPath() const { return aMiscConfig.sMailingPath; } - void SetMailingPath(const String& sPath) { aMiscConfig.sMailingPath = sPath; + OUString GetMailingPath() const { return aMiscConfig.sMailingPath; } + void SetMailingPath(const OUString& sPath) { aMiscConfig.sMailingPath = sPath; aMiscConfig.SetModified();} - String GetMailName() const { return aMiscConfig.sMailName; } - void SetMailName(const String& sName){ aMiscConfig.sMailName = sName; + OUString GetMailName() const { return aMiscConfig.sMailName; } + void SetMailName(const OUString& sName){ aMiscConfig.sMailName = sName; aMiscConfig.SetModified();} - const String &GetWordDelimiter() const { return aMiscConfig.sWordDelimiter; } - void SetWordDelimiter(const String& sDelim) { aMiscConfig.sWordDelimiter = sDelim; + OUString GetWordDelimiter() const { return aMiscConfig.sWordDelimiter; } + void SetWordDelimiter(const OUString& sDelim) { aMiscConfig.sWordDelimiter = sDelim; aMiscConfig.SetModified();} //convert word delimiter from or to user interface - static String ConvertWordDelimiter(const String& rDelim, sal_Bool bFromUI); + static OUString ConvertWordDelimiter(const OUString& rDelim, sal_Bool bFromUI); sal_Bool IsShowIndexPreview() const {return aMiscConfig.bShowIndexPreview;} void SetShowIndexPreview(sal_Bool bSet) diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx index dde838ea90c2..f9f043ebc70e 100644 --- a/sw/inc/swmodule.hxx +++ b/sw/inc/swmodule.hxx @@ -203,7 +203,7 @@ public: sal_uInt16 GetPieceLen() const; // Return defined DocStat - WordDelimiter. - const String& GetDocStatWordDelim() const; + OUString GetDocStatWordDelim() const; // Pass metric of ModuleConfig (for HTML-export). sal_uInt16 GetMetric( sal_Bool bWeb ) const; diff --git a/sw/source/ui/app/swmodul1.cxx b/sw/source/ui/app/swmodul1.cxx index f22fcd7a3cf1..cad791d70427 100644 --- a/sw/source/ui/app/swmodul1.cxx +++ b/sw/source/ui/app/swmodul1.cxx @@ -549,7 +549,7 @@ const SwViewOption* SwModule::GetViewOption(sal_Bool bWeb) return GetUsrPref( bWeb ); } -const String& SwModule::GetDocStatWordDelim() const +OUString SwModule::GetDocStatWordDelim() const { return pModuleConfig->GetWordDelimiter(); } diff --git a/sw/source/ui/config/modcfg.cxx b/sw/source/ui/config/modcfg.cxx index 115caa0bd6f2..211b34ad1080 100644 --- a/sw/source/ui/config/modcfg.cxx +++ b/sw/source/ui/config/modcfg.cxx @@ -135,36 +135,32 @@ SwModuleOptions::SwModuleOptions() : { } -String SwModuleOptions::ConvertWordDelimiter(const String& rDelim, sal_Bool bFromUI) +OUString SwModuleOptions::ConvertWordDelimiter(const OUString& rDelim, sal_Bool bFromUI) { - String sReturn; + OUString sReturn; + const sal_Int32 nDelimLen = rDelim.getLength(); if(bFromUI) { - xub_StrLen i = 0; - sal_Unicode c; - - while (i < rDelim.Len()) + for (sal_Int32 i = 0; i < nDelimLen; ) { - c = rDelim.GetChar(i++); + const sal_Unicode c = rDelim[i++]; - if (c == '\\') + if (c == '\\' && i < nDelimLen ) { - c = rDelim.GetChar(i++); - - switch (c) + switch (rDelim[i++]) { - case 'n': sReturn += '\n'; break; - case 't': sReturn += '\t'; break; - case '\\': sReturn += '\\'; break; + case 'n': sReturn += "\n"; break; + case 't': sReturn += "\t"; break; + case '\\': sReturn += "\\"; break; case 'x': { - sal_Unicode nVal, nChar; + sal_Unicode nChar = 0; bool bValidData = true; - xub_StrLen n; - for( n = 0, nChar = 0; n < 2 && i < rDelim.Len(); ++n, ++i ) + for( sal_Int32 n = 0; n < 2 && i < nDelimLen; ++n, ++i ) { - if( ((nVal = rDelim.GetChar( i )) >= '0') && ( nVal <= '9') ) + sal_Unicode nVal = rDelim[i]; + if( (nVal >= '0') && ( nVal <= '9') ) nVal -= '0'; else if( (nVal >= 'A') && (nVal <= 'F') ) nVal -= 'A' - 10; @@ -177,44 +173,45 @@ String SwModuleOptions::ConvertWordDelimiter(const String& rDelim, sal_Bool bFro break; } - (nChar <<= 4 ); - nChar = nChar + nVal; + nChar <<= 4; + nChar += nVal; } if( bValidData ) - sReturn += nChar; + sReturn += OUString(nChar); break; } default: // Unknown, so insert backslash - sReturn += '\\'; + sReturn += "\\"; i--; break; } } else - sReturn += c; + sReturn += OUString(c); } } else { - for (xub_StrLen i = 0; i < rDelim.Len(); i++) + for (sal_Int32 i = 0; i < nDelimLen; ++i) { - sal_Unicode c = rDelim.GetChar(i); + const sal_Unicode c = rDelim[i]; switch (c) { - case '\n': sReturn.AppendAscii(RTL_CONSTASCII_STRINGPARAM("\\n")); break; - case '\t': sReturn.AppendAscii(RTL_CONSTASCII_STRINGPARAM("\\t")); break; - case '\\': sReturn.AppendAscii(RTL_CONSTASCII_STRINGPARAM("\\\\")); break; + case '\n': sReturn += "\\n"; break; + case '\t': sReturn += "\\t"; break; + case '\\': sReturn += "\\\\"; break; default: if( c <= 0x1f || c >= 0x7f ) { - sReturn.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\\x" )) - += OUString::number( c, 16 ); + sReturn += "\\x" + OUString::number( c, 16 ); } else - sReturn += c; + { + sReturn += OUString(c); + } } } } @@ -1264,8 +1261,8 @@ void SwMiscConfig::Commit() switch(nProp) { case 0 : - pValues[nProp] <<= OUString( - SwModuleOptions::ConvertWordDelimiter(sWordDelimiter, sal_False)); + pValues[nProp] <<= + SwModuleOptions::ConvertWordDelimiter(sWordDelimiter, sal_False); break; case 1 : pValues[nProp].setValue(&bDefaultFontsInCurrDocOnly, rType); break; case 2 : pValues[nProp].setValue(&bShowIndexPreview, rType) ; break; @@ -1273,9 +1270,9 @@ void SwMiscConfig::Commit() case 4 : pValues[nProp].setValue(&bNumAlignSize, rType); break; case 5 : pValues[nProp].setValue(&bSinglePrintJob, rType); break; case 6 : pValues[nProp] <<= nMailingFormats; break; - case 7 : pValues[nProp] <<= OUString(sNameFromColumn); break; - case 8 : pValues[nProp] <<= OUString(sMailingPath); break; - case 9 : pValues[nProp] <<= OUString(sMailName); break; + case 7 : pValues[nProp] <<= sNameFromColumn; break; + case 8 : pValues[nProp] <<= sMailingPath; break; + case 9 : pValues[nProp] <<= sMailName; break; case 10: pValues[nProp].setValue(&bIsNameFromColumn, rType);break; case 11: pValues[nProp] <<= bAskForMailMergeInPrint; break; } diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index ae06e5756771..ee9e00602106 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2043,7 +2043,7 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName) break; case WID_DOC_WORD_SEPARATOR : { - aAny <<= OUString(SW_MOD()->GetDocStatWordDelim()); + aAny <<= SW_MOD()->GetDocStatWordDelim(); } break; case WID_DOC_CHANGES_RECORD: |