diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-01-02 10:55:27 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-01-05 09:18:19 +0000 |
commit | bacfd2dc4cea1a5d87658ed8592116acd931e000 (patch) | |
tree | d22172a33fdd13a440b6882a28c23ea2d639bbad /svx/source/gallery2 | |
parent | 6281eb0e0792da0194c07da18296e94dd944b8e5 (diff) |
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 'svx/source/gallery2')
-rw-r--r-- | svx/source/gallery2/galbrws2.cxx | 4 | ||||
-rw-r--r-- | svx/source/gallery2/gallery1.cxx | 13 | ||||
-rw-r--r-- | svx/source/gallery2/galmisc.cxx | 5 | ||||
-rw-r--r-- | svx/source/gallery2/galobj.cxx | 3 |
4 files changed, 14 insertions, 11 deletions
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index d1a554ba9e72..46311b3ea560 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -27,7 +27,7 @@ ************************************************************************/ - +#include <comphelper/string.hxx> #include <sot/formats.hxx> #include <vcl/msgbox.hxx> #include <svtools/valueset.hxx> @@ -1123,7 +1123,7 @@ String GalleryBrowser2::GetItemText( const GalleryTheme& rTheme, const SgaObject if( !aTitle.Len() ) { aTitle = aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ); - aTitle = aTitle.GetToken( aTitle.GetTokenCount( '/' ) - 1, '/' ); + aTitle = aTitle.GetToken( comphelper::string::getTokenCount(aTitle, '/') - 1, '/' ); } aRet += aTitle; diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index 2170c1f218f1..7a26e0dee8c5 100644 --- a/svx/source/gallery2/gallery1.cxx +++ b/svx/source/gallery2/gallery1.cxx @@ -27,6 +27,7 @@ ************************************************************************/ +#include <comphelper/string.hxx> #include <tools/vcompat.hxx> #include <ucbhelper/content.hxx> #include <unotools/ucbstreamhelper.hxx> @@ -178,7 +179,7 @@ public: // - Gallery - // ----------- -Gallery::Gallery( const String& rMultiPath ) +Gallery::Gallery( const rtl::OUString& rMultiPath ) : nReadTextEncoding ( osl_getThreadTextEncoding() ) , nLastFileNumber ( 0 ) , bMultiPath ( sal_False ) @@ -221,9 +222,9 @@ Gallery* Gallery::GetGalleryInstance() // ------------------------------------------------------------------------ -void Gallery::ImplLoad( const String& rMultiPath ) +void Gallery::ImplLoad( const rtl::OUString& rMultiPath ) { - const sal_uInt16 nTokenCount = rMultiPath.GetTokenCount( ';' ); + const sal_Int32 nTokenCount = comphelper::string::getTokenCount(rMultiPath, ';'); sal_Bool bIsReadOnlyDir; bMultiPath = ( nTokenCount > 0 ); @@ -236,11 +237,11 @@ void Gallery::ImplLoad( const String& rMultiPath ) if( bMultiPath ) { - aRelURL = INetURLObject( rMultiPath.GetToken( 0, ';' ) ); + aRelURL = INetURLObject( comphelper::string::getToken(rMultiPath, 0, ';') ); - for( sal_uInt16 i = 0UL; i < nTokenCount; i++ ) + for( sal_Int32 i = 0; i < nTokenCount; ++i ) { - aCurURL = INetURLObject(rMultiPath.GetToken( i, ';' )); + aCurURL = INetURLObject(comphelper::string::getToken(rMultiPath, i, ';')); ImplLoadSubDirs( aCurURL, bIsReadOnlyDir ); diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx index 79602e003265..aa4c1ee74629 100644 --- a/svx/source/gallery2/galmisc.cxx +++ b/svx/source/gallery2/galmisc.cxx @@ -30,6 +30,7 @@ #include <unotools/streamwrap.hxx> #include <unotools/ucbstreamhelper.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <ucbhelper/content.hxx> #include <tools/resmgr.hxx> #include <tools/urlobj.hxx> @@ -232,7 +233,7 @@ String GetReducedString( const INetURLObject& rURL, sal_uIntPtr nMaxLen ) { String aReduced( rURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ); - aReduced = aReduced.GetToken( aReduced.GetTokenCount( '/' ) - 1, '/' ); + aReduced = aReduced.GetToken( comphelper::string::getTokenCount(aReduced, '/') - 1, '/' ); if( INET_PROT_PRIV_SOFFICE != rURL.GetProtocol() ) { @@ -261,7 +262,7 @@ String GetSvDrawStreamNameFromURL( const INetURLObject& rSvDrawObjURL ) String aRet; if( rSvDrawObjURL.GetProtocol() == INET_PROT_PRIV_SOFFICE && - String(rSvDrawObjURL.GetMainURL( INetURLObject::NO_DECODE )).GetTokenCount( '/' ) == 3 ) + comphelper::string::getTokenCount(rSvDrawObjURL.GetMainURL( INetURLObject::NO_DECODE ), '/') == 3 ) { aRet = String(rSvDrawObjURL.GetMainURL( INetURLObject::NO_DECODE )).GetToken( 2, '/' ); } diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx index 9bfa16ba489a..f0db928d3824 100644 --- a/svx/source/gallery2/galobj.cxx +++ b/svx/source/gallery2/galobj.cxx @@ -32,6 +32,7 @@ #include <sfx2/docfac.hxx> #include <comphelper/classids.hxx> +#include <comphelper/string.hxx> #include <unotools/pathoptions.hxx> #include <tools/rcid.h> @@ -196,7 +197,7 @@ const String SgaObject::GetTitle() const String aReturnValue( aTitle ); if ( !getenv( "GALLERY_SHOW_PRIVATE_TITLE" ) ) { - if ( aReturnValue.GetTokenCount( ':' ) == 3 ) + if ( comphelper::string::getTokenCount(aReturnValue, ':') == 3 ) { String aPrivateInd ( aReturnValue.GetToken( 0, ':' ) ); String aResourceName( aReturnValue.GetToken( 1, ':' ) ); |