diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-10-28 20:31:11 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-10-28 23:09:32 +0000 |
commit | 0dd085f8f327b08cf5d69c3e1b93ff82016995fb (patch) | |
tree | 0fec0966cd3a88b840621161de72ef5c462bb877 /sc | |
parent | 8865b7f013bcd9b4ce41dd98be28ba28aeb22e66 (diff) |
UniString->rtl::OUStringBuffer
Change-Id: I9938d7c4ab5594baeb10f405f0aa0964ef84d6c5
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/global.hxx | 6 | ||||
-rw-r--r-- | sc/source/core/data/global.cxx | 12 | ||||
-rw-r--r-- | sc/source/core/tool/interpr2.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/excel/xecontent.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xeescher.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xehelper.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/excel/xetable.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xicontent.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/html/htmlimp.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/html/htmlpars.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/dbgui/validate.cxx | 4 |
11 files changed, 32 insertions, 20 deletions
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 44d8810ddd2d..5dfe54763375 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -632,9 +632,9 @@ public: @param cSep The character to separate the tokens. @param nSepCount Specifies how often cSep is inserted between two tokens. @param bForceSep true = Always insert separator; false = Only, if not at begin or end. */ - SC_DLLPUBLIC static void AddToken( - String& rTokenList, const String& rToken, - sal_Unicode cSep, xub_StrLen nSepCount = 1, + SC_DLLPUBLIC static OUString addToken( + const OUString& rTokenList, const OUString& rToken, + sal_Unicode cSep, sal_Int32 nSepCount = 1, bool bForceSep = false ); /** Returns true, if the first and last character of the string is cQuote. */ diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 4d269a1465dd..2cefa9468cc5 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -56,6 +56,7 @@ #include <i18npool/mslangid.hxx> #include <com/sun/star/lang/Locale.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <unotools/calendarwrapper.hxx> #include <unotools/collatorwrapper.hxx> #include <com/sun/star/i18n/CollatorOptions.hpp> @@ -806,11 +807,14 @@ const sal_Unicode* ScGlobal::UnicodeStrChr( const sal_Unicode* pStr, // ---------------------------------------------------------------------------- -void ScGlobal::AddToken( String& rTokenList, const String& rToken, sal_Unicode cSep, xub_StrLen nSepCount, bool bForceSep ) +OUString ScGlobal::addToken(const OUString& rTokenList, const OUString& rToken, + sal_Unicode cSep, sal_Int32 nSepCount, bool bForceSep) { - if( bForceSep || (rToken.Len() && rTokenList.Len()) ) - rTokenList.Expand( rTokenList.Len() + nSepCount, cSep ); - rTokenList.Append( rToken ); + rtl::OUStringBuffer aBuf(rTokenList); + if( bForceSep || (!rToken.isEmpty() && !rTokenList.isEmpty()) ) + comphelper::string::padToLength(aBuf, aBuf.getLength() + nSepCount, cSep); + aBuf.append(rToken); + return aBuf.makeStringAndClear(); } bool ScGlobal::IsQuoted( const String& rString, sal_Unicode cQuote ) diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index fc899502d7d4..9e5056341ea1 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -26,6 +26,7 @@ * ************************************************************************/ +#include <comphelper/string.hxx> #include <sfx2/linkmgr.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/objsh.hxx> @@ -2602,7 +2603,14 @@ void ScInterpreter::ScRoman() { if( nDigit > 4 ) aRoman += pChars[ nIndex - 1 ]; - aRoman.Expand( aRoman.Len() + (nDigit % 5), pChars[ nIndex ] ); + sal_Int32 nPad = nDigit % 5; + if (nPad) + { + rtl::OUStringBuffer aBuf(aRoman); + comphelper::string::padToLength(aBuf, aBuf.getLength() + nPad, + pChars[nIndex]); + aRoman = aBuf.makeStringAndClear(); + } nVal %= pValues[ nIndex ]; } } diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index c73155be6518..219bbb84fcf5 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -1600,7 +1600,7 @@ XclExpWebQuery::XclExpWebQuery( mbEntireDoc = ScfTools::IsHTMLDocName( aToken ); bExitLoop = mbEntireDoc || ScfTools::IsHTMLTablesName( aToken ); if( !bExitLoop && ScfTools::GetHTMLNameFromName( aToken, aAppendTable ) ) - ScGlobal::AddToken( aNewTables, aAppendTable, ',' ); + aNewTables = ScGlobal::addToken( aNewTables, aAppendTable, ',' ); } if( !bExitLoop ) // neither HTML_all nor HTML_tables found diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 74bc82d532b9..b4e4aafe8c6c 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -1225,7 +1225,7 @@ XclExpNote::XclExpNote( const XclExpRoot& rRoot, const ScAddress& rScPos, mpNoteContents = XclExpStringHelper::CreateString( rRoot, *pEditObj ); } // append additional text - ScGlobal::AddToken( aNoteText, rAddText, '\n', 2 ); + aNoteText = ScGlobal::addToken( aNoteText, rAddText, '\n', 2 ); maOrigNoteText = aNoteText; // initialize record dependent on BIFF type diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index b2a68d467265..581c6142c9dd 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -320,7 +320,7 @@ rtl::OUString XclExpHyperlinkHelper::ProcessUrlField( const SvxURLField& rUrlFie aUrlRepr = *pRepr; // add URL to note text - ScGlobal::AddToken( maUrlList, rUrlField.GetURL(), '\n' ); + maUrlList = ScGlobal::addToken( maUrlList, rUrlField.GetURL(), '\n' ); } // no hyperlink representation from Excel HLINK record -> use it from text field @@ -879,7 +879,7 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico aSel.nStartPos = aSel.nEndPos; } - ScGlobal::AddToken( aText, aParaText, '\n' ); + aText = ScGlobal::addToken( aText, aParaText, '\n' ); if( nParaHeight == 0 ) nParaHeight = aFontData.mnHeight * 20; // points -> twips nHeight += nParaHeight; diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index bebb239e9289..04458d18e404 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2329,7 +2329,7 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : mxHyperlinkList->AppendRecord( aLinkHelper.GetLinkRecord() ); // add list of multiple URLs to the additional cell note text if( aLinkHelper.HasMultipleUrls() ) - ScGlobal::AddToken( aAddNoteText, aLinkHelper.GetUrlList(), '\n', 2 ); + aAddNoteText = ScGlobal::addToken( aAddNoteText, aLinkHelper.GetUrlList(), '\n', 2 ); } break; diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index c5f6dad50a6a..edd47173f524 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -947,12 +947,12 @@ void XclImpWebQuery::ReadWqtables( XclImpStream& rStrm ) String aToken( ScStringUtil::GetQuotedToken( aTables, 0, aQuotedPairs, ',', nStringIx ) ); sal_Int32 nTabNum = CharClass::isAsciiNumeric( aToken ) ? aToken.ToInt32() : 0; if( nTabNum > 0 ) - ScGlobal::AddToken( maTables, ScfTools::GetNameFromHTMLIndex( static_cast< sal_uInt32 >( nTabNum ) ), cSep ); + maTables = ScGlobal::addToken( maTables, ScfTools::GetNameFromHTMLIndex( static_cast< sal_uInt32 >( nTabNum ) ), cSep ); else { ScGlobal::EraseQuotes( aToken, '"', false ); if( aToken.Len() ) - ScGlobal::AddToken( maTables, ScfTools::GetNameFromHTMLName( aToken ), cSep ); + maTables = ScGlobal::addToken( maTables, ScfTools::GetNameFromHTMLName( aToken ), cSep ); } } } diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx index b75b1cc351b1..facda67aa573 100644 --- a/sc/source/filter/html/htmlimp.cxx +++ b/sc/source/filter/html/htmlimp.cxx @@ -238,7 +238,7 @@ String ScHTMLImport::GetHTMLRangeNameList( ScDocument* pDoc, const String& rOrig ScRange aRange; if( pRangeData->IsReference( aRange ) && !aRangeList.In( aRange ) ) { - ScGlobal::AddToken( aNewName, aToken, ';' ); + aNewName = ScGlobal::addToken(aNewName, aToken, ';'); aRangeList.Append( aRange ); } } @@ -247,7 +247,7 @@ String ScHTMLImport::GetHTMLRangeNameList( ScDocument* pDoc, const String& rOrig } } else - ScGlobal::AddToken( aNewName, aToken, ';' ); + aNewName = ScGlobal::addToken(aNewName, aToken, ';'); } return aNewName; } diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 7b412f3ddb21..d5ad5e7f3326 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -3082,7 +3082,7 @@ void ScHTMLQueryParser::FontOn( const ImportInfo& rInfo ) { // font list separator: VCL = ';' HTML = ',' String aFName = comphelper::string::strip(rFace.GetToken(0, ',', nPos), ' '); - ScGlobal::AddToken( aFontName, aFName, ';' ); + aFontName = ScGlobal::addToken(aFontName, aFName, ';'); } if ( aFontName.Len() ) mpCurrTable->PutItem( SvxFontItem( FAMILY_DONTKNOW, diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index 390ad1743e63..ea12ad189296 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -269,7 +269,7 @@ void lclGetFormulaFromStringList( String& rFmlaStr, const String& rStringList, s { String aToken( rStringList.GetToken( 0, '\n', nStringIx ) ); ScGlobal::AddQuotes( aToken, '"' ); - ScGlobal::AddToken( rFmlaStr, aToken, cFmlaSep ); + rFmlaStr = ScGlobal::addToken(rFmlaStr, aToken, cFmlaSep); } if( !rFmlaStr.Len() ) rFmlaStr.AssignAscii( "\"\"" ); @@ -300,7 +300,7 @@ bool lclGetStringListFromFormula( String& rStringList, const String& rFmlaStr, s if( bIsStringList ) { ScGlobal::EraseQuotes( aToken, '"' ); - ScGlobal::AddToken( rStringList, aToken, '\n', 1, bTokenAdded ); + rStringList = ScGlobal::addToken(rStringList, aToken, '\n', 1, bTokenAdded); bTokenAdded = true; } } |