summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2015-09-13 11:04:21 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2015-09-13 11:05:28 +0200
commit22547d056c5fc36aff666b68b03a2d9471022ac2 (patch)
tree16ed5e38b281aaba7cace9e8eb7c39344905c9ed
parent77ca5fec1ff78508f892afe25953f8c31da202df (diff)
Avoid getTokenCount in CustomAnimationPreset::getProperties/hasProperty
Change-Id: Ic5b9c152ef2faf8333ad797232e26b817668e965
-rw-r--r--sd/source/core/CustomAnimationPreset.cxx30
1 files changed, 16 insertions, 14 deletions
diff --git a/sd/source/core/CustomAnimationPreset.cxx b/sd/source/core/CustomAnimationPreset.cxx
index e014280b7c71..f1a8005b68e6 100644
--- a/sd/source/core/CustomAnimationPreset.cxx
+++ b/sd/source/core/CustomAnimationPreset.cxx
@@ -32,7 +32,6 @@
#include <comphelper/getexpandeduri.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/random.hxx>
-#include <comphelper/string.hxx>
#include <unotools/pathoptions.hxx>
#include <tools/stream.hxx>
@@ -199,28 +198,31 @@ Reference< XAnimationNode > CustomAnimationPreset::create( const OUString& rstrS
UStringList CustomAnimationPreset::getProperties() const
{
- OUString aProperties( maProperty );
- sal_uInt16 nTokens = comphelper::string::getTokenCount(aProperties, ';');
- sal_uInt16 nToken;
UStringList aPropertyList;
- for( nToken = 0; nToken < nTokens; nToken++ )
- aPropertyList.push_back( aProperties.getToken( nToken, ';' ) );
-
+ if (!maProperty.isEmpty())
+ {
+ sal_Int32 nPos = 0;
+ do
+ {
+ aPropertyList.push_back(maProperty.getToken(0, ';', nPos));
+ }
+ while (nPos >= 0);
+ }
return aPropertyList;
-
}
bool CustomAnimationPreset::hasProperty( const OUString& rProperty )const
{
- OUString aProperties( maProperty );
- OUString aProperty( rProperty );
- sal_uInt16 nTokens = comphelper::string::getTokenCount(aProperties, ';');
- sal_uInt16 nToken;
- for( nToken = 0; nToken < nTokens; nToken++ )
+ if (maProperty.isEmpty())
+ return false;
+
+ sal_Int32 nPos = 0;
+ do
{
- if( aProperties.getToken( nToken, ';' ) == aProperty )
+ if (maProperty.getToken(0, ';', nPos) == rProperty)
return true;
}
+ while (nPos >= 0);
return false;
}