[Libreoffice-commits] core.git: sc/source
Jelle van der Waa
jelle at vdwaa.nl
Sat Sep 7 19:53:49 PDT 2013
sc/source/core/tool/chgtrack.cxx | 16 +++++----------
sc/source/core/tool/compiler.cxx | 10 +--------
sc/source/filter/xml/xmlexprt.cxx | 8 -------
sc/source/ui/view/viewfun5.cxx | 39 ++++++++++++--------------------------
4 files changed, 22 insertions(+), 51 deletions(-)
New commits:
commit 5ba5c492e8e4d994e6c37893516059b6586a5b92
Author: Jelle van der Waa <jelle at vdwaa.nl>
Date: Sat Sep 7 20:39:59 2013 +0200
fdo#57950: Remove some chained appends in sc
Change-Id: I24d8e2e60d4c8b4e52c2514f0477299d8fc8c541
Reviewed-on: https://gerrit.libreoffice.org/5863
Reviewed-by: Thomas Arnhold <thomas at arnhold.org>
Tested-by: Thomas Arnhold <thomas at arnhold.org>
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index d5f1c6c..6495195 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -445,8 +445,7 @@ void ScChangeAction::GetDescription(
if (GetType() == SC_CAT_MOVE)
{
aBuf.append(
- ScGlobal::GetRscString(STR_CHANGED_MOVE_REJECTION_WARNING));
- aBuf.append(sal_Unicode(' '));
+ ScGlobal::GetRscString(STR_CHANGED_MOVE_REJECTION_WARNING) + " ");
rStr = aBuf.makeStringAndClear();
return;
}
@@ -454,8 +453,7 @@ void ScChangeAction::GetDescription(
if (IsInsertType())
{
aBuf.append(
- ScGlobal::GetRscString(STR_CHANGED_DELETE_REJECTION_WARNING));
- aBuf.append(sal_Unicode(' '));
+ ScGlobal::GetRscString(STR_CHANGED_DELETE_REJECTION_WARNING) + " ");
rStr = aBuf.makeStringAndClear();
return;
}
@@ -1269,12 +1267,10 @@ void ScChangeActionMove::GetRefString(
if ( !bFlag3D )
bFlag3D = ( GetFromRange().aStart.Tab() != GetBigRange().aStart.Tab() );
- OUStringBuffer aBuf;
- aBuf.append(ScChangeAction::GetRefString(GetFromRange(), pDoc, bFlag3D));
- aBuf.append(sal_Unicode(','));
- aBuf.append(sal_Unicode(' '));
- aBuf.append(ScChangeAction::GetRefString(GetBigRange(), pDoc, bFlag3D));
- rStr = aBuf.makeStringAndClear(); // overwrite existing string value.
+ // overwrite existing string value.
+ rStr = ScChangeAction::GetRefString(GetFromRange(), pDoc, bFlag3D)
+ + ", "
+ + ScChangeAction::GetRefString(GetBigRange(), pDoc, bFlag3D);
}
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 5e58cc6..a510f4b 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -644,10 +644,7 @@ static OUString lcl_makeExternalNameStr(const OUString& rFile, const OUString& r
OUStringBuffer aBuf(aFile.getLength() + aName.getLength() + 9);
if (bODF)
aBuf.append( sal_Unicode( '['));
- aBuf.append( sal_Unicode( '\''));
- aBuf.append( aFile);
- aBuf.append( sal_Unicode( '\''));
- aBuf.append( cSep);
+ aBuf.append( "'" + aFile + "'" + OUString(cSep));
if (bODF)
aBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "$$'"));
aBuf.append( aName);
@@ -892,10 +889,7 @@ struct ConventionOOO_A1 : public Convention_A1
aFile = INetURLObject::decode(*p, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS);
}
- rBuffer.append(sal_Unicode('\''));
- rBuffer.append(aFile.replaceAll("'", "''"));
- rBuffer.append(sal_Unicode('\''));
- rBuffer.append(sal_Unicode('#'));
+ rBuffer.append("'" + aFile.replaceAll("'", "''") + "'#");
if (!rRef.IsTabRel())
rBuffer.append(sal_Unicode('$'));
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 8873238..45e2677 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -4526,13 +4526,7 @@ void ScXMLExport::WriteExternalRefCaches()
if (!pTable.get() || !pTable->isReferenced())
continue;
- OUStringBuffer aBuf;
- aBuf.append(sal_Unicode('\''));
- aBuf.append(*pUrl);
- aBuf.append(sal_Unicode('\''));
- aBuf.append(sal_Unicode('#'));
- aBuf.append(*itr);
- AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, aBuf.makeStringAndClear());
+ AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, "'" + *pUrl + "'" + "#" + *itr);
AddAttribute(XML_NAMESPACE_TABLE, XML_PRINT, GetXMLToken(XML_FALSE));
AddAttribute(XML_NAMESPACE_TABLE, XML_STYLE_NAME, sExternalRefTabStyleName);
SvXMLElementExport aElemTable(*this, XML_NAMESPACE_TABLE, XML_TABLE, true, true);
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index b8c1d01..9d99869 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -696,14 +696,10 @@ bool ScViewFunc::PasteLink( const uno::Reference<datatransfer::XTransferable>& r
// Paste this as an external reference. Note that paste link always
// uses Calc A1 syntax even when another formula syntax is specified
// in the UI.
- OUStringBuffer aBuf;
- aBuf.appendAscii("='");
- OUString aPath = ScGlobal::GetAbsDocName(
- *pTopic, GetViewData()->GetDocument()->GetDocumentShell());
- aBuf.append(aPath);
- aBuf.appendAscii("'#");
- aBuf.append(*pItem);
- EnterMatrix(aBuf.makeStringAndClear(), ::formula::FormulaGrammar::GRAM_NATIVE);
+ EnterMatrix("='"
+ + OUString(ScGlobal::GetAbsDocName(*pTopic, GetViewData()->GetDocument()->GetDocumentShell()))
+ + "'#" + *pItem
+ , ::formula::FormulaGrammar::GRAM_NATIVE);
return true;
}
else
@@ -711,24 +707,15 @@ bool ScViewFunc::PasteLink( const uno::Reference<datatransfer::XTransferable>& r
// DDE in all other cases.
// TODO: we could define ocQuote for "
- OUStringBuffer aBuf;
- aBuf.append(sal_Unicode('='));
- aBuf.append(ScCompiler::GetNativeSymbol(ocDde));
- aBuf.append(ScCompiler::GetNativeSymbol(ocOpen));
- aBuf.append(sal_Unicode('"'));
- aBuf.append(*pApp);
- aBuf.append(sal_Unicode('"'));
- aBuf.append(ScCompiler::GetNativeSymbol(ocSep));
- aBuf.append(sal_Unicode('"'));
- aBuf.append(*pTopic);
- aBuf.append(sal_Unicode('"'));
- aBuf.append(ScCompiler::GetNativeSymbol(ocSep));
- aBuf.append(sal_Unicode('"'));
- aBuf.append(*pItem);
- aBuf.append(sal_Unicode('"'));
- aBuf.append(ScCompiler::GetNativeSymbol(ocClose));
-
- EnterMatrix(aBuf.makeStringAndClear(), ::formula::FormulaGrammar::GRAM_NATIVE);
+ EnterMatrix("=" + OUString(ScCompiler::GetNativeSymbol(ocDde))
+ + ScCompiler::GetNativeSymbol(ocOpen)
+ + "\"" + *pApp + "\""
+ + ScCompiler::GetNativeSymbol(ocSep)
+ + "\"" + *pTopic + "\""
+ + ScCompiler::GetNativeSymbol(ocSep)
+ + "\"" + *pItem + "\""
+ + ScCompiler::GetNativeSymbol(ocClose)
+ , ::formula::FormulaGrammar::GRAM_NATIVE);
}
// mark range
More information about the Libreoffice-commits
mailing list