diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2013-09-08 17:44:41 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-09-09 08:56:25 +0000 |
commit | ff4f2a414a4dcf8267a44f5463d07e4f0bbe0858 (patch) | |
tree | eebb3d4d94737514bf3b084b0ac8ce55c6a6f504 | |
parent | 5dbf5f0af5e5d035eb34af1901af0256cd115f07 (diff) |
String to OUstring
Change-Id: I98f2e16f1e679cb2c01984ed34dc4efb254c918d
Reviewed-on: https://gerrit.libreoffice.org/5876
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/source/filter/inc/msfilter.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/writerwordglue.cxx | 21 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 24 |
4 files changed, 24 insertions, 25 deletions
diff --git a/sw/source/filter/inc/msfilter.hxx b/sw/source/filter/inc/msfilter.hxx index 5fbc9547ff12..37691ca4efb9 100644 --- a/sw/source/filter/inc/msfilter.hxx +++ b/sw/source/filter/inc/msfilter.hxx @@ -123,7 +123,7 @@ namespace sw @author <a href="mailto:mmaher@openoffice.org">Martin Maher</a */ - void SwapQuotesInField(String &rFmt); + void SwapQuotesInField(OUString &rFmt); } diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index 226b20ce926e..d30e519e7a58 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -755,7 +755,9 @@ namespace sw short nType = NUMBERFORMAT_DEFINED; sal_uInt32 nKey = 0; - SwapQuotesInField(rParams); + OUString sParams(rParams); + SwapQuotesInField(sParams); + rParams = sParams; // Force to Japanese when finding one of 'geaE' OUString sJChars( "geE" ); @@ -1016,16 +1018,19 @@ namespace sw ); } - void SwapQuotesInField(String &rFmt) + void SwapQuotesInField(OUString &rFmt) { //Swap unescaped " and ' with ' and " - xub_StrLen nLen = rFmt.Len(); - for (xub_StrLen nI = 0; nI < nLen; ++nI) + const sal_Int32 nLen = rFmt.getLength(); + for (sal_Int32 nI = 0; nI < nLen; ++nI) { - if ((rFmt.GetChar(nI) == '\"') && (!nI || rFmt.GetChar(nI-1) != '\\')) - rFmt.SetChar(nI, '\''); - else if ((rFmt.GetChar(nI) == '\'') && (!nI || rFmt.GetChar(nI-1) != '\\')) - rFmt.SetChar(nI, '\"'); + if (!nI || rFmt[nI-1]!='\\') + { + if (rFmt[nI]=='\"') + rFmt = rFmt.replaceAt(nI, 1, "\'"); + else if (rFmt[nI]=='\'') + rFmt = rFmt.replaceAt(nI, 1, "\""); + } } } diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 7bef91db78fd..5ae203f618dd 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -741,7 +741,7 @@ public: static bool NoPageBreakSection( const SfxItemSet *pSet ); // Compute the number format for WW dates - bool GetNumberFmt(const SwField& rFld, String& rStr); + bool GetNumberFmt(const SwField& rFld, OUString& rStr); virtual sal_uLong ReplaceCr( sal_uInt8 nChar ) = 0; diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 7b25c6045b69..c0a34c80e679 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -2325,7 +2325,7 @@ void AttributeOutputBase::EndTOX( const SwSection& rSect ) GetExport( ).bInWriteTOX = false; } -bool MSWordExportBase::GetNumberFmt(const SwField& rFld, String& rStr) +bool MSWordExportBase::GetNumberFmt(const SwField& rFld, OUString& rStr) { // Returns a date or time format string by using the US NfKeywordTable bool bHasFmt = false; @@ -2338,16 +2338,14 @@ bool MSWordExportBase::GetNumberFmt(const SwField& rFld, String& rStr) LocaleDataWrapper aLocDat(pNFmtr->GetComponentContext(), LanguageTag(nLng)); - String sFmt(pNumFmt->GetMappedFormatstring(GetNfKeywordTable(), + OUString sFmt(pNumFmt->GetMappedFormatstring(GetNfKeywordTable(), aLocDat)); - if (sFmt.Len()) + if (!sFmt.isEmpty()) { sw::ms::SwapQuotesInField(sFmt); - rStr.AppendAscii( "\\@\"" ); - rStr += sFmt; - rStr.AppendAscii( "\" " ); + rStr = "\\@\"" + sFmt + "\" " ; bHasFmt = true; } } @@ -2632,7 +2630,7 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField ) bWriteExpand = true; else { - String sStr; + OUString sStr; ww::eField eFld(ww::eNONE); switch (0xff & nSubType) { @@ -2690,9 +2688,7 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField ) if (nIndex != sFieldname.Len()) sFieldname = sFieldname.Copy(nIndex + 1); - sStr.Insert(sQuotes); - sStr.Insert(sFieldname); - sStr.Insert(sQuotes); + sStr = sQuotes + sFieldname + sQuotes; } } break; @@ -2702,8 +2698,7 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField ) if (eFld != ww::eNONE) { - sStr.Insert(FieldString(eFld), 0); - GetExport().OutputField(pFld, eFld, sStr); + GetExport().OutputField(pFld, eFld, FieldString(eFld) + sStr); } else bWriteExpand = true; @@ -2711,14 +2706,13 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField ) break; case RES_DATETIMEFLD: { - String sStr; + OUString sStr; if (FIXEDFLD & nSubType || !GetExport().GetNumberFmt(*pFld, sStr)) bWriteExpand = true; else { ww::eField eFld = (DATEFLD & nSubType) ? ww::eDATE : ww::eTIME; - sStr.Insert(FieldString(eFld), 0); - GetExport().OutputField(pFld, eFld, sStr); + GetExport().OutputField(pFld, eFld, FieldString(eFld) + sStr); } } break; |