[Libreoffice-commits] core.git: sw/inc sw/source
Matteo Casalin
matteo.casalin at yahoo.com
Wed Aug 14 14:30:45 PDT 2013
sw/inc/modcfg.hxx | 31 ++++++++----------
sw/inc/swmodule.hxx | 2 -
sw/source/ui/app/swmodul1.cxx | 2 -
sw/source/ui/config/modcfg.cxx | 69 +++++++++++++++++++----------------------
sw/source/ui/uno/unotxdoc.cxx | 2 -
5 files changed, 51 insertions(+), 55 deletions(-)
New commits:
commit f9e8f092f770b00ca2327153da6ce9d88af4c6d5
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Wed Aug 14 11:54:25 2013 +0200
String to OUString
Change-Id: I6ccde9448acf8564fe270f119ffdfa8b1bab8afe
Reviewed-on: https://gerrit.libreoffice.org/5409
Reviewed-by: Michael Stahl <mstahl at redhat.com>
Tested-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx
index 374d519..75d8a2a 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 dde838e..f9f043e 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 f22fcd7..cad791d 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 115caa0..211b34a 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 ae06e575..ee9e006 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:
More information about the Libreoffice-commits
mailing list