summaryrefslogtreecommitdiffstats
path: root/sd
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-01-02 10:55:27 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-01-05 09:18:19 +0000
commitbacfd2dc4cea1a5d87658ed8592116acd931e000 (patch)
treed22172a33fdd13a440b6882a28c23ea2d639bbad /sd
parentGetTokenCount on empty string is always 0 (diff)
downloadcore-bacfd2dc4cea1a5d87658ed8592116acd931e000.tar.gz
core-bacfd2dc4cea1a5d87658ed8592116acd931e000.zip
add a comphelper::string::getTokenCount
suitable for conversion from [Byte]String::GetTokenCount converted low-hanging variants to rtl::O[UString]::getToken loops added unit test
Diffstat (limited to 'sd')
-rw-r--r--sd/source/core/CustomAnimationPreset.cxx5
-rw-r--r--sd/source/filter/ppt/pptin.cxx4
-rw-r--r--sd/source/ui/annotations/annotationmanager.cxx3
-rw-r--r--sd/source/ui/dlg/copydlg.cxx3
-rw-r--r--sd/source/ui/dlg/tpaction.cxx5
-rw-r--r--sd/source/ui/dlg/tpoption.cxx2
6 files changed, 13 insertions, 9 deletions
diff --git a/sd/source/core/CustomAnimationPreset.cxx b/sd/source/core/CustomAnimationPreset.cxx
index feab1338853c..f26fa686964c 100644
--- a/sd/source/core/CustomAnimationPreset.cxx
+++ b/sd/source/core/CustomAnimationPreset.cxx
@@ -40,6 +40,7 @@
#include <tools/urlobj.hxx>
#include <unotools/streamwrap.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
#include <unotools/pathoptions.hxx>
#include <tools/stream.hxx>
@@ -214,7 +215,7 @@ Reference< XAnimationNode > CustomAnimationPreset::create( const rtl::OUString&
UStringList CustomAnimationPreset::getProperties() const
{
String aProperties( maProperty );
- sal_uInt16 nTokens = aProperties.GetTokenCount();
+ sal_uInt16 nTokens = comphelper::string::getTokenCount(aProperties, ';');
sal_uInt16 nToken;
UStringList aPropertyList;
for( nToken = 0; nToken < nTokens; nToken++ )
@@ -228,7 +229,7 @@ bool CustomAnimationPreset::hasProperty( const OUString& rProperty )const
{
String aProperties( maProperty );
String aProperty( rProperty );
- sal_uInt16 nTokens = aProperties.GetTokenCount();
+ sal_uInt16 nTokens = comphelper::string::getTokenCount(aProperties, ';');
sal_uInt16 nToken;
for( nToken = 0; nToken < nTokens; nToken++ )
{
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 3c7469aea7cb..2e8493dbd6e2 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -433,7 +433,7 @@ sal_Bool ImplSdPPTImport::Import()
sal_uInt32 nPageNumber = 0;
String aString( pHyperlink->aSubAdress );
rtl::OString aStringAry[ 3 ];
- sal_uInt16 nTokenCount = aString.GetTokenCount( ',' );
+ sal_uInt16 nTokenCount = comphelper::string::getTokenCount(aString, ',');
if ( nTokenCount > 3 )
nTokenCount = 3;
sal_uInt16 nToken;
@@ -1943,7 +1943,7 @@ String ImplSdPPTImport::ReadSound(sal_uInt32 nSoundRef) const
if ( SeekToRec( rStCtrl, PPT_PST_SoundData, nStrLen, &aSoundDataRecHd, 0 ) )
{
String aGalleryDir( SvtPathOptions().GetGalleryPath() );
- INetURLObject aGalleryUserSound( aGalleryDir.GetToken( aGalleryDir.GetTokenCount( ';' ) - 1 ) );
+ INetURLObject aGalleryUserSound( aGalleryDir.GetToken( comphelper::string::getTokenCount(aGalleryDir, ';') - 1 ) );
aGalleryUserSound.Append( aRetval );
sal_uInt32 nSoundDataLen = aSoundDataRecHd.nRecLen;
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index 87bac6d035b8..fac02eb1c0f3 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -36,6 +36,7 @@
#include <com/sun/star/geometry/RealPoint2D.hpp>
#include <com/sun/star/text/XText.hpp>
#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <comphelper/string.hxx>
#include <svx/svxids.hrc>
#include <vcl/menu.hxx>
#include <vcl/msgbox.hxx>
@@ -488,7 +489,7 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest& rReq )
aStr.Append( sQuote );
aStr.Append( String(RTL_CONSTASCII_USTRINGPARAM("\"\n") ) );
- sal_uInt16 nParaCount = aStr.GetTokenCount( '\n' );
+ sal_uInt16 nParaCount = comphelper::string::getTokenCount(aStr, '\n');
for( sal_uInt16 nPara = 0; nPara < nParaCount; nPara++ )
pOutliner->Insert( aStr.GetToken( nPara, '\n' ), LIST_APPEND, -1 );
diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx
index 1fed4c2fcd3f..0b20b058304d 100644
--- a/sd/source/ui/dlg/copydlg.cxx
+++ b/sd/source/ui/dlg/copydlg.cxx
@@ -32,6 +32,7 @@
#endif
#include "copydlg.hxx"
+#include <comphelper/string.hxx>
#include <svx/dlgutil.hxx>
#include <sfx2/module.hxx>
#include <svx/xcolit.hxx>
@@ -167,7 +168,7 @@ IMPL_LINK( CopyDlg, Reset, void*, EMPTYARG )
const SfxPoolItem* pPoolItem = NULL;
String aStr( GetExtraData() );
- if( aStr.GetTokenCount( TOKEN ) < 8 )
+ if (comphelper::string::getTokenCount(aStr, TOKEN) < 8)
{
if( SFX_ITEM_SET == mrOutAttrs.GetItemState( ATTR_COPY_NUMBER, sal_True, &pPoolItem ) )
maNumFldCopies.SetValue( ( ( const SfxUInt16Item* ) pPoolItem )->GetValue() );
diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx
index 4e6db4f6ae9f..4608f0d4e52e 100644
--- a/sd/source/ui/dlg/tpaction.cxx
+++ b/sd/source/ui/dlg/tpaction.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/uri/XUriReferenceFactory.hpp>
#include <com/sun/star/uri/XVndSunStarScriptUrl.hpp>
#include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
#include <com/sun/star/embed/VerbAttributes.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
@@ -368,7 +369,7 @@ void SdTPAction::Reset( const SfxItemSet& rAttrs )
case presentation::ClickAction_DOCUMENT:
{
- if( aFileName.GetTokenCount( DOCUMENT_TOKEN ) == 2 )
+ if( comphelper::string::getTokenCount(aFileName, DOCUMENT_TOKEN) == 2 )
aLbTreeDocument.SelectEntry( aFileName.GetToken( 1, DOCUMENT_TOKEN ) );
}
break;
@@ -778,7 +779,7 @@ void SdTPAction::SetEditText( String const & rStr )
switch( eCA )
{
case presentation::ClickAction_DOCUMENT:
- if( rStr.GetTokenCount( DOCUMENT_TOKEN ) == 2 )
+ if( comphelper::string::getTokenCount(rStr, DOCUMENT_TOKEN) == 2 )
aText = rStr.GetToken( 0, DOCUMENT_TOKEN );
// fallthrough inteded
diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx
index c006ee7ae8d3..970289fac1d3 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -690,7 +690,7 @@ String SdTpOptionsMisc::GetScale( sal_Int32 nX, sal_Int32 nY )
sal_Bool SdTpOptionsMisc::SetScale( const String& aScale, sal_Int32& rX, sal_Int32& rY )
{
- if( aScale.GetTokenCount( TOKEN ) != 2 )
+ if( comphelper::string::getTokenCount(aScale, TOKEN) != 2 )
return( sal_False );
rtl::OUString aTmp(aScale.GetToken( 0, TOKEN ));