summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore
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 /sw/source/core/unocore
parent6281eb0e0792da0194c07da18296e94dd944b8e5 (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 'sw/source/core/unocore')
-rw-r--r--sw/source/core/unocore/unochart.cxx7
-rw-r--r--sw/source/core/unocore/unofield.cxx5
-rw-r--r--sw/source/core/unocore/unoidx.cxx3
-rw-r--r--sw/source/core/unocore/unosect.cxx3
4 files changed, 11 insertions, 7 deletions
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 6aa5247a8c29..0960456b2f7d 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -56,6 +56,7 @@
#include <unocore.hrc>
#include <docary.hxx>
#include <comphelper/servicehelper.hxx>
+#include <comphelper/string.hxx>
#define SN_DATA_PROVIDER "com.sun.star.chart2.data.DataProvider"
#define SN_DATA_SOURCE "com.sun.star.chart2.data.DataSource"
@@ -475,7 +476,7 @@ static sal_Bool GetSubranges( const OUString &rRangeRepresentation,
{
sal_Bool bRes = sal_True;
String aRangesStr( rRangeRepresentation );
- xub_StrLen nLen = aRangesStr.GetTokenCount( ';' );
+ xub_StrLen nLen = comphelper::string::getTokenCount(aRangesStr, ';');
uno::Sequence< OUString > aRanges( nLen );
sal_Int32 nCnt = 0;
@@ -1779,7 +1780,7 @@ rtl::OUString SAL_CALL SwChartDataProvider::convertRangeToXML( const rtl::OUStri
// multiple ranges are delimeted by a ';' like in
// "Table1.A1:A4;Table1.C2:C5" the same table must be used in all ranges!
- xub_StrLen nNumRanges = aRangeRepresentation.GetTokenCount( ';' );
+ xub_StrLen nNumRanges = comphelper::string::getTokenCount(aRangeRepresentation, ';');
SwTable* pFirstFoundTable = 0; // to check that only one table will be used
for (sal_uInt16 i = 0; i < nNumRanges; ++i)
{
@@ -1847,7 +1848,7 @@ rtl::OUString SAL_CALL SwChartDataProvider::convertRangeFromXML( const rtl::OUSt
// multiple ranges are delimeted by a ' ' like in
// "Table1.$A$1:.$A$4 Table1.$C$2:.$C$5" the same table must be used in all ranges!
- xub_StrLen nNumRanges = aXMLRange.GetTokenCount( ' ' );
+ xub_StrLen nNumRanges = comphelper::string::getTokenCount(aXMLRange, ' ');
rtl::OUString aFirstFoundTable; // to check that only one table will be used
for (sal_uInt16 i = 0; i < nNumRanges; ++i)
{
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 2e4785fbe7fc..113cbca373c7 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -44,9 +44,10 @@
#include <docstat.hxx>
#include <editsh.hxx>
#include <viewsh.hxx>
-#include <comphelper/types.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/servicehelper.hxx>
+#include <comphelper/string.hxx>
+#include <comphelper/types.hxx>
#include <com/sun/star/util/Time.hpp>
#include <com/sun/star/util/DateTimeRange.hpp>
#include <com/sun/star/util/DateTime.hpp>
@@ -2444,7 +2445,7 @@ sal_uInt16 lcl_GetIdByName( String& rName, String& rTypeName )
else if(rTypeName.EqualsAscii("DataBase"))
{
rName.Erase( 0, RTL_CONSTASCII_LENGTH( "DataBase." ));
- sal_uInt16 nDotCount = rName.GetTokenCount('.');
+ sal_uInt16 nDotCount = comphelper::string::getTokenCount(rName, '.');
if( 2 <= nDotCount )
{
// #i51815#
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 3ba05bd213a2..50e7f59e9cfb 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -64,6 +64,7 @@
#include <SwStyleNameMapper.hxx>
#include <unoevtlstnr.hxx>
#include <comphelper/servicehelper.hxx>
+#include <comphelper/string.hxx>
using namespace ::com::sun::star;
@@ -2663,7 +2664,7 @@ throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
const String& rStyles =
rTOXBase.GetStyleNames(static_cast<sal_uInt16>(nIndex));
- const sal_uInt16 nStyles = rStyles.GetTokenCount(TOX_STYLE_DELIMITER);
+ const sal_uInt16 nStyles = comphelper::string::getTokenCount(rStyles, TOX_STYLE_DELIMITER);
uno::Sequence<OUString> aStyles(nStyles);
OUString* pStyles = aStyles.getArray();
String aString;
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 1524d8240ad6..916607fc9505 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -64,6 +64,7 @@
#include <fmtcntnt.hxx>
#include <editeng/lrspitem.hxx>
#include <comphelper/servicehelper.hxx>
+#include <comphelper/string.hxx>
using namespace ::com::sun::star;
@@ -734,7 +735,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
pSectionData->SetType(FILE_LINK_SECTION);
}
String sSectLink(pSectionData->GetLinkFileName());
- while (3 < sSectLink.GetTokenCount(sfx2::cTokenSeperator))
+ while (3 < comphelper::string::getTokenCount(sSectLink, sfx2::cTokenSeperator))
{
sSectLink += sfx2::cTokenSeperator;
}