summaryrefslogtreecommitdiff
path: root/svx/source/svdraw/svdundo.cxx
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2017-04-24 10:52:54 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2017-04-24 13:57:12 +0200
commita1f9de6bbd957e0e119b99a4fe7cfab54677be30 (patch)
treef9ca324c2020e3f3b9f875403ae2794f9f523c0f /svx/source/svdraw/svdundo.cxx
parent90f492d46014068c64767100dc870bafc04d2ac7 (diff)
OUStrings: constify and avoid temporaries
Change-Id: I9d75924b414f21dacad2d72908c1e4e3af291672
Diffstat (limited to 'svx/source/svdraw/svdundo.cxx')
-rw-r--r--svx/source/svdraw/svdundo.cxx22
1 files changed, 7 insertions, 15 deletions
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index b411e935c88e..8380f0cf8e40 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -216,24 +216,16 @@ SdrUndoObj::SdrUndoObj(SdrObject& rNewObj)
OUString SdrUndoObj::GetDescriptionStringForObject( const SdrObject& _rForObject, sal_uInt16 nStrCacheID, bool bRepeat )
{
- OUString rStr = ImpGetResStr(nStrCacheID);
+ const OUString rStr {ImpGetResStr(nStrCacheID)};
- sal_Int32 nPos = rStr.indexOf("%1");
+ const sal_Int32 nPos = rStr.indexOf("%1");
+ if (nPos < 0)
+ return rStr;
- if(nPos != -1)
- {
- if(bRepeat)
- {
- rStr = rStr.replaceAt(nPos, 2, ImpGetResStr(STR_ObjNameSingulPlural));
- }
- else
- {
- OUString aStr(_rForObject.TakeObjNameSingul());
- rStr = rStr.replaceAt(nPos, 2, aStr);
- }
- }
+ if (bRepeat)
+ return rStr.replaceAt(nPos, 2, ImpGetResStr(STR_ObjNameSingulPlural));
- return rStr;
+ return rStr.replaceAt(nPos, 2, _rForObject.TakeObjNameSingul());
}
void SdrUndoObj::ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, OUString& rStr, bool bRepeat) const