[Libreoffice-commits] core.git: sw/source
Matteo Casalin
matteo.casalin at yahoo.com
Wed Aug 21 10:27:38 PDT 2013
sw/source/core/undo/SwRewriter.cxx | 34 ++++++----------------------------
1 file changed, 6 insertions(+), 28 deletions(-)
New commits:
commit fdbb60d2604471fc3aaf7ce4cefbb355952bac0f
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Wed Aug 21 14:40:34 2013 +0200
SwRewriter: use GetPlaceHolder in Apply
Change-Id: I7b7372e781b445eb2bb7f07d7ccf44ede963ae99
diff --git a/sw/source/core/undo/SwRewriter.cxx b/sw/source/core/undo/SwRewriter.cxx
index 3d1b584..33a05d9 100644
--- a/sw/source/core/undo/SwRewriter.cxx
+++ b/sw/source/core/undo/SwRewriter.cxx
@@ -55,35 +55,13 @@ void SwRewriter::AddRule(SwUndoArg eWhat, const OUString & rWith)
mRules.push_back(aRule);
}
-namespace
-{
-
-const char UNDO_ARG1[] = "$1";
-const char UNDO_ARG2[] = "$2";
-const char UNDO_ARG3[] = "$3";
-
-}
-
OUString SwRewriter::Apply(const OUString & rStr) const
{
OUString aResult = rStr;
- std::vector<SwRewriteRule>::const_iterator aIt;
- for (aIt = mRules.begin(); aIt != mRules.end(); ++aIt)
+ for (std::vector<SwRewriteRule>::const_iterator aIt = mRules.begin(); aIt != mRules.end(); ++aIt)
{
- switch (aIt->first)
- {
- case UndoArg1:
- default:
- aResult = aResult.replaceAll(UNDO_ARG1, aIt->second);
- break;
- case UndoArg2:
- aResult = aResult.replaceAll(UNDO_ARG2, aIt->second);
- break;
- case UndoArg3:
- aResult = aResult.replaceAll(UNDO_ARG3, aIt->second);
- break;
- }
+ aResult = aResult.replaceAll(GetPlaceHolder(aIt->first), aIt->second);
}
return aResult;
@@ -94,15 +72,15 @@ OUString SwRewriter::GetPlaceHolder(SwUndoArg eId)
switch (eId)
{
case UndoArg1:
- return OUString(UNDO_ARG1);
+ return OUString("$1");
case UndoArg2:
- return OUString(UNDO_ARG2);
+ return OUString("$2");
case UndoArg3:
- return OUString(UNDO_ARG3);
+ return OUString("$3");
default:
break;
}
- return OUString(UNDO_ARG1);
+ return OUString("$1");
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list