diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-06-12 13:40:45 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-06-13 11:20:23 +0100 |
commit | 6191fa0847ac5b27083efe1a8c6cd84d080a638c (patch) | |
tree | b107ce00125d0d204e5c32f6c472e70c73182bb2 /sc | |
parent | 2e16eaf31c7a4849110020aebd5fbc97a1ab3e99 (diff) |
reduce use of UniString ctor from null-terminated unicodearray
Change-Id: I98361309ada084d8f78517ce88f210d785f59cc0
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/global.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/address.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/cellkeytranslator.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/tool/interpr4.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/token.cxx | 12 | ||||
-rw-r--r-- | sc/source/filter/dif/difimp.cxx | 22 | ||||
-rw-r--r-- | sc/source/filter/excel/xecontent.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 23 |
9 files changed, 37 insertions, 42 deletions
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 1ea9f8a0387c..635281cfa9ef 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -813,7 +813,7 @@ void ScGlobal::AddQuotes( String& rString, sal_Unicode cQuote, bool bEscapeEmbed sal_Unicode pQ[3]; pQ[0] = pQ[1] = cQuote; pQ[2] = 0; - String aQuotes( pQ ); + rtl::OUString aQuotes( pQ ); rString.SearchAndReplaceAll( cQuote, aQuotes); } rString.Insert( cQuote, 0 ).Append( cQuote ); @@ -829,7 +829,7 @@ void ScGlobal::EraseQuotes( String& rString, sal_Unicode cQuote, bool bUnescapeE sal_Unicode pQ[3]; pQ[0] = pQ[1] = cQuote; pQ[2] = 0; - String aQuotes( pQ ); + rtl::OUString aQuotes( pQ ); rString.SearchAndReplaceAll( aQuotes, cQuote); } } diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index aeab79e00111..72a30e92cfe8 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -1071,8 +1071,8 @@ lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDoc, ScAddress& rAdd } else { - String aTmp( p ); - long n = aTmp.ToInt32() - 1; + rtl::OUString aTmp( p ); + long n = aTmp.toInt32() - 1; while (CharClass::isAsciiDigit( *p )) p++; if( n < 0 || n > MAXROW ) diff --git a/sc/source/core/tool/cellkeytranslator.cxx b/sc/source/core/tool/cellkeytranslator.cxx index 41fbe7782185..f32234c6fba8 100644 --- a/sc/source/core/tool/cellkeytranslator.cxx +++ b/sc/source/core/tool/cellkeytranslator.cxx @@ -234,7 +234,7 @@ void ScCellKeywordTranslator::addToMap(const String& rKey, const sal_Char* pName void ScCellKeywordTranslator::addToMap(const TransItem* pItems, const Locale& rLocale) { for (sal_uInt16 i = 0; pItems[i].from != NULL; ++i) - addToMap(String(pItems[i].from), pItems[i].to, rLocale, pItems[i].func); + addToMap(rtl::OUString(pItems[i].from), pItems[i].to, rLocale, pItems[i].func); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index a1bc598cda48..7833786b6c17 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -3494,7 +3494,7 @@ void ScCompiler::AutoCorrectParsedSymbol() const sal_Unicode* p = aRef[j].GetBuffer(); while ( *p && CharClass::isAsciiNumeric( *p ) ) aStr2 += *p++; - aRef[j] = String( p ); + aRef[j] = rtl::OUString( p ); aRef[j] += aStr2; if ( bColons || aRef[j] != aOld ) { @@ -3561,7 +3561,7 @@ bool ScCompiler::NextNewToken( bool bInArray ) // Short cut for references when reading ODF to speedup things. if (mnPredetectedReference) { - String aStr( cSymbol); + rtl::OUString aStr( cSymbol); if (!IsPredetectedReference( aStr) && !IsExternalNamedRange( aStr)) { /* TODO: it would be nice to generate a #REF! error here, which @@ -3571,7 +3571,7 @@ bool ScCompiler::NextNewToken( bool bInArray ) * information if not ODFF (in that case it was already handled). * */ ScRawToken aToken; - aToken.SetString( aStr.GetBuffer() ); + aToken.SetString( aStr.getStr() ); aToken.NewOpCode( ocBad ); pRawToken = aToken.Clone(); } @@ -3625,7 +3625,7 @@ bool ScCompiler::NextNewToken( bool bInArray ) do { mbRewind = false; - const String aOrg( cSymbol ); + const rtl::OUString aOrg( cSymbol ); if (bAsciiNonAlnum) { diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index a6d169315926..c914daf788d2 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -1898,7 +1898,7 @@ void ScInterpreter::PushStringBuffer( const sal_Unicode* pString ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushStringBuffer" ); if ( pString ) - PushString( String( pString ) ); + PushString( rtl::OUString(pString) ); else PushString( EMPTY_STRING ); } diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index b29e48d95acb..800d952de96d 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -364,9 +364,9 @@ FormulaToken* ScRawToken::CreateToken() const return new FormulaDoubleToken( nValue ); case svString : if (eOp == ocPush) - return new FormulaStringToken( String( cStr ) ); + return new FormulaStringToken( rtl::OUString( cStr ) ); else - return new FormulaStringOpToken( eOp, String( cStr ) ); + return new FormulaStringOpToken( eOp, rtl::OUString( cStr ) ); case svSingleRef : if (eOp == ocPush) return new ScSingleRefToken( aRef.Ref1 ); @@ -384,23 +384,23 @@ FormulaToken* ScRawToken::CreateToken() const return new FormulaIndexToken( eOp, name.nIndex, name.bGlobal); case svExternalSingleRef: { - String aTabName(extref.cTabName); + rtl::OUString aTabName(extref.cTabName); return new ScExternalSingleRefToken(extref.nFileId, aTabName, extref.aRef.Ref1); } case svExternalDoubleRef: { - String aTabName(extref.cTabName); + rtl::OUString aTabName(extref.cTabName); return new ScExternalDoubleRefToken(extref.nFileId, aTabName, extref.aRef); } case svExternalName: { - String aName(extname.cName); + rtl::OUString aName(extname.cName); return new ScExternalNameToken( extname.nFileId, aName ); } case svJump : return new FormulaJumpToken( eOp, (short*) nJump ); case svExternal : - return new FormulaExternalToken( eOp, sbyte.cByte, String( cStr+1 ) ); + return new FormulaExternalToken( eOp, sbyte.cByte, rtl::OUString( cStr+1 ) ); case svFAP : return new FormulaFAPToken( eOp, sbyte.cByte, NULL ); case svMissing : diff --git a/sc/source/filter/dif/difimp.cxx b/sc/source/filter/dif/difimp.cxx index 1ffae6a1cb40..7496db78ab8d 100644 --- a/sc/source/filter/dif/difimp.cxx +++ b/sc/source/filter/dif/difimp.cxx @@ -70,7 +70,7 @@ FltError ScFormatFilterPluginImpl::ScImportDif( SvStream& rIn, ScDocument* pDoc, sal_Bool bSyntErrWarn = false; sal_Bool bOverflowWarn = false; - String& rData = aDifParser.aData; + rtl::OUString aData = aDifParser.aData; sal_Bool bData = false; rIn.Seek( 0 ); @@ -83,7 +83,7 @@ FltError ScFormatFilterPluginImpl::ScImportDif( SvStream& rIn, ScDocument* pDoc, aPrgrsBar.Progress(); - bData = rData.Len() > 0; + bData = !aData.isEmpty(); switch( eTopic ) { @@ -92,7 +92,7 @@ FltError ScFormatFilterPluginImpl::ScImportDif( SvStream& rIn, ScDocument* pDoc, if( aDifParser.nVector != 0 || aDifParser.nVal != 1 ) bSyntErrWarn = sal_True; if( bData ) - pDoc->RenameTab( nBaseTab, rData ); + pDoc->RenameTab( nBaseTab, aData ); } break; case T_VECTORS: @@ -164,14 +164,14 @@ FltError ScFormatFilterPluginImpl::ScImportDif( SvStream& rIn, ScDocument* pDoc, if( ValidCol(nColCnt) && ValidRow(nRowCnt) ) { ScBaseCell* pCell; - if( DifParser::IsV( rData.GetBuffer() ) ) + if( DifParser::IsV( aData.getStr() ) ) { pCell = new ScValueCell( aDifParser.fVal ); if( !bPlain ) aAttrCache.SetNumFormat( nColCnt, nRowCnt, aDifParser.nNumFormat ); } - else if( rData == pKeyTRUE || rData == pKeyFALSE ) + else if( aData == pKeyTRUE || aData == pKeyFALSE ) { pCell = new ScValueCell( aDifParser.fVal ); if( bPlain ) @@ -180,12 +180,12 @@ FltError ScFormatFilterPluginImpl::ScImportDif( SvStream& rIn, ScDocument* pDoc, aAttrCache.SetNumFormat( nColCnt, nRowCnt, aDifParser.nNumFormat ); } - else if( rData == pKeyNA || rData == pKeyERROR ) - pCell = new ScStringCell( rData ); + else if( aData == pKeyNA || aData == pKeyERROR ) + pCell = new ScStringCell( aData ); else { String aTmp( RTL_CONSTASCII_USTRINGPARAM( "#IND: " )); - aTmp += rData; + aTmp += aData; aTmp += sal_Unicode('?'); pCell = new ScStringCell( aTmp ); } @@ -203,10 +203,10 @@ FltError ScFormatFilterPluginImpl::ScImportDif( SvStream& rIn, ScDocument* pDoc, if( ValidCol(nColCnt) && ValidRow(nRowCnt) ) { - if( rData.Len() > 0 ) + if (!aData.isEmpty()) { pDoc->PutCell( nColCnt, nRowCnt, nBaseTab, - ScBaseCell::CreateTextCell( rData, pDoc ), true ); + ScBaseCell::CreateTextCell( aData, pDoc ), true ); } } else @@ -434,7 +434,7 @@ DATASET DifParser::GetNumberDataset( const sal_Unicode* pPossibleNumericData ) else { // ...und zur Strafe mit'm Numberformatter... OSL_ENSURE( pNumFormatter, "-DifParser::GetNextDataset(): No Formatter, more fun!" ); - String aTestVal( pPossibleNumericData ); + rtl::OUString aTestVal( pPossibleNumericData ); sal_uInt32 nFormat = 0; double fTmpVal; if( pNumFormatter->IsNumberFormat( aTestVal, nFormat, fTmpVal ) ) diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 6021704c7012..101eb6a98504 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -375,7 +375,7 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU { // #n382718# (and #n261623#) Convert smb notation to '\\' aFileName = aUrlObj.GetMainURL( INetURLObject::NO_DECODE ); - aFileName = String( aFileName.GetBuffer() + 4 ); // skip the 'smb:' part + aFileName = rtl::OUString( aFileName.GetBuffer() + 4 ); // skip the 'smb:' part aFileName.SearchAndReplaceAll( '/', '\\' ); } diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index c7eaf379a1cc..73015c3ddab8 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -1751,16 +1751,16 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) switch( ch ) { case 'X': - nCol = static_cast<SCCOL>(String( p ).ToInt32()) + nStartCol - 1; + nCol = static_cast<SCCOL>(rtl::OUString(p).toInt32()) + nStartCol - 1; break; case 'Y': - nRow = String( p ).ToInt32() + nStartRow - 1; + nRow = rtl::OUString(p).toInt32() + nStartRow - 1; break; case 'C': - nRefCol = static_cast<SCCOL>(String( p ).ToInt32()) + nStartCol - 1; + nRefCol = static_cast<SCCOL>(rtl::OUString(p).toInt32()) + nStartCol - 1; break; case 'R': - nRefRow = String( p ).ToInt32() + nStartRow - 1; + nRefRow = rtl::OUString(p).toInt32() + nStartRow - 1; break; case 'K': { @@ -1871,10 +1871,10 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) switch( ch ) { case 'X': - nCol = static_cast<SCCOL>(String( p ).ToInt32()) + nStartCol - 1; + nCol = static_cast<SCCOL>(rtl::OUString(p).toInt32()) + nStartCol - 1; break; case 'Y': - nRow = String( p ).ToInt32() + nStartRow - 1; + nRow = rtl::OUString(p).toInt32() + nStartRow - 1; break; case 'P' : if ( bData ) @@ -1913,16 +1913,11 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) { if ( bData && *p == ';' && *(p+1) == 'P' ) { - String aCode( p+2 ); + rtl::OUString aCode( p+2 ); // unescape doubled semicolons - xub_StrLen nPos = 0; - String aSemicolon( RTL_CONSTASCII_USTRINGPARAM(";;")); - while ( (nPos = aCode.Search( aSemicolon, nPos )) != STRING_NOTFOUND ) - aCode.Erase( nPos++, 1 ); + aCode = aCode.replaceAll(";;", ";"); // get rid of Xcl escape characters - nPos = 0; - while ( (nPos = aCode.Search( sal_Unicode(0x1b), nPos )) != STRING_NOTFOUND ) - aCode.Erase( nPos, 1 ); + aCode = aCode.replaceAll(rtl::OUString(static_cast<sal_Unicode>(0x1b)), rtl::OUString()); xub_StrLen nCheckPos; short nType; sal_uInt32 nKey; |