diff options
Diffstat (limited to 'sc')
28 files changed, 194 insertions, 206 deletions
diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx index 4b12fb9e1442..f117d783c35a 100644 --- a/sc/source/core/data/docpool.cxx +++ b/sc/source/core/data/docpool.cxx @@ -408,13 +408,12 @@ static bool lcl_HFPresentation SfxItemIter aIter( rSet ); pItem = aIter.FirstItem(); - OUString aText; while( pItem ) { sal_uInt16 nWhich = pItem->Which(); - aText.clear(); + OUString aText; switch( nWhich ) { diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index a9cbb8ddcbaf..007a3a72f4fd 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -1882,8 +1882,7 @@ OUString ScDrawLayer::GetNewGraphicName( long* pnCounter ) const while (bThere) { ++nId; - aGraphicName = aBase; - aGraphicName += OUString::number( nId ); + aGraphicName = aBase + OUString::number( nId ); bThere = ( GetNamedObject( aGraphicName, 0, nDummy ) != nullptr ); } diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index edbd2de757fa..816851e8c9a0 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -2005,7 +2005,6 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam ) bool bTestPrevSub = ( nLevelCount > 1 ); OUString aSubString; - OUString aOutString; bool bIgnoreCase = !rParam.bCaseSens; @@ -2111,7 +2110,7 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam ) // collect formula positions aRowVector.push_back( aRowEntry ); - aOutString = aSubString; + OUString aOutString = aSubString; if (aOutString.isEmpty()) aOutString = ScResId( STR_EMPTYDATA ); aOutString += " "; diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 1cd0cd515f9e..534c66491426 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -480,7 +480,8 @@ static bool lcl_parseExternalName( const sal_Unicode* const pStart = rSymbol.getStr(); const sal_Unicode* p = pStart; sal_Int32 nLen = rSymbol.getLength(); - OUString aTmpFile, aTmpName; + OUString aTmpFile; + OUStringBuffer aTmpName; sal_Int32 i = 0; bool bInName = false; if (cSep == '!') @@ -543,7 +544,7 @@ static bool lcl_parseExternalName( i = j; bInName = true; - aTmpName += OUStringLiteral1(c); // Keep the separator as part of the name. + aTmpName.append(c); // Keep the separator as part of the name. break; } aTmpFile += OUStringLiteral1(c); @@ -573,14 +574,14 @@ static bool lcl_parseExternalName( // A second separator ? Not a valid external name. return false; } - aTmpName += OUStringLiteral1(c); + aTmpName.append(c); } else { if (c == cSep) { bInName = true; - aTmpName += OUStringLiteral1(c); // Keep the separator as part of the name. + aTmpName.append(c); // Keep the separator as part of the name. } else { @@ -637,12 +638,12 @@ static bool lcl_parseExternalName( if (aTmpName[nNameLen-1] == '!') { // Check against #REF!. - if (aTmpName.equalsIgnoreAsciiCase("#REF!")) + if (aTmpName.toString().equalsIgnoreAsciiCase("#REF!")) return false; } rFile = aTmpFile; - rName = aTmpName.copy(1); // Skip the first char as it is always the separator. + rName = aTmpName.makeStringAndClear().copy(1); // Skip the first char as it is always the separator. return true; } @@ -3981,7 +3982,8 @@ void ScCompiler::AutoCorrectParsedSymbol() sal_Int32 nIndex = 0; OUString aTmp1( aSymbol.getToken( 0, ':', nIndex ) ); sal_Int32 nLen1 = aTmp1.getLength(); - OUString aSym, aTmp2; + OUStringBuffer aSym; + OUString aTmp2; bool bLastAlp, bNextNum; bLastAlp = bNextNum = true; sal_Int32 nStrip = 0; @@ -3994,7 +3996,7 @@ void ScCompiler::AutoCorrectParsedSymbol() { if ( nLen1 ) { - aSym += aTmp1; + aSym.append(aTmp1); bLastAlp = CharClass::isAsciiAlpha( aTmp1 ); } if ( nLen2 ) @@ -4009,8 +4011,8 @@ void ScCompiler::AutoCorrectParsedSymbol() } else { - if ( !aSym.isEmpty() && !aSym.endsWith(":")) - aSym += ":"; + if ( !aSym.isEmpty() && aSym[aSym.getLength()-1] != ':') + aSym.append(":"); nStrip = 0; } bLastAlp = !bNextNum; @@ -4030,7 +4032,7 @@ void ScCompiler::AutoCorrectParsedSymbol() else nRefs--; } - aSymbol = aSym; + aSymbol = aSym.makeStringAndClear(); aSymbol += aTmp1; } else @@ -4062,12 +4064,12 @@ void ScCompiler::AutoCorrectParsedSymbol() aRef[j] = aRef[j].copy( nDotPos + 1 ); } OUString aOld( aRef[j] ); - OUString aStr2; + OUStringBuffer aStr2; const sal_Unicode* p = aRef[j].getStr(); while ( *p && rtl::isAsciiDigit( *p ) ) - aStr2 += OUStringLiteral1(*p++); + aStr2.append(*p++); aRef[j] = OUString( p ); - aRef[j] += aStr2; + aRef[j] += aStr2.makeStringAndClear(); if ( bColons || aRef[j] != aOld ) { bChanged = true; diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index e055324fa679..f6560dcb95ab 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -3042,7 +3042,7 @@ void ScInterpreter::ScRoman() static const sal_uInt16 pValues[] = { 1000, 500, 100, 50, 10, 5, 1 }; static const sal_uInt16 nMaxIndex = sal_uInt16(SAL_N_ELEMENTS(pValues) - 1); - OUString aRoman; + OUStringBuffer aRoman; sal_uInt16 nVal = static_cast<sal_uInt16>(fVal); sal_uInt16 nMode = static_cast<sal_uInt16>(fMode); @@ -3066,8 +3066,7 @@ void ScInterpreter::ScRoman() else nSteps = nMode; } - aRoman += OUStringLiteral1( pChars[ nIndex ] ) - + OUStringLiteral1( pChars[ nIndex2 ] ); + aRoman.append( pChars[ nIndex ] ).append( pChars[ nIndex2 ] ); nVal = sal::static_int_cast<sal_uInt16>( nVal + pValues[ nIndex ] ); nVal = sal::static_int_cast<sal_uInt16>( nVal - pValues[ nIndex2 ] ); } @@ -3077,7 +3076,7 @@ void ScInterpreter::ScRoman() { // assert can't happen with nVal<4000 precondition assert( nIndex >= 1 ); - aRoman += OUStringLiteral1( pChars[ nIndex - 1 ] ); + aRoman.append( pChars[ nIndex - 1 ] ); } sal_Int32 nPad = nDigit % 5; if (nPad) @@ -3091,7 +3090,7 @@ void ScInterpreter::ScRoman() } } - PushString( aRoman ); + PushString( aRoman.makeStringAndClear() ); } else PushIllegalArgument(); diff --git a/sc/source/core/tool/reffind.cxx b/sc/source/core/tool/reffind.cxx index 31e6fd8977a7..18a85f295bfd 100644 --- a/sc/source/core/tool/reffind.cxx +++ b/sc/source/core/tool/reffind.cxx @@ -241,7 +241,7 @@ void ScRefFinder::ToggleRel( sal_Int32 nStartPos, sal_Int32 nEndPos ) ExpandToText(pSource, nLen, nStartPos, nEndPos, meConv); - OUString aResult; + OUStringBuffer aResult; OUString aExpr; OUString aSep; ScAddress aAddr; @@ -314,14 +314,14 @@ void ScRefFinder::ToggleRel( sal_Int32 nStartPos, sal_Int32 nEndPos ) // assemble - aResult += aSep; - aResult += aExpr; + aResult.append(aSep); + aResult.append(aExpr); nLoopStart = nEEnd; } OUString aTotal = maFormula.copy(0, nStartPos); - aTotal += aResult; + aTotal += aResult.makeStringAndClear(); if (nEndPos < maFormula.getLength()-1) aTotal += maFormula.copy(nEndPos+1); diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index a541d9f21b82..ecc10f076f6a 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -707,7 +707,7 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico for( sal_Int32 nPara = 0; nPara < nParaCount; ++nPara ) { ESelection aSel( nPara, 0 ); - OUString aParaText; + OUStringBuffer aParaText; sal_Int32 nParaHeight = 0; std::vector<sal_Int32> aPosList; mrEE.GetPortions( nPara, aPosList ); @@ -744,9 +744,9 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico aNewData.mbItalic ? ITALIC_NORMAL : ITALIC_NONE ) ); aNewData.maStyle = pFontList->GetStyleName( aFontMetric ); if( !aNewData.maStyle.isEmpty() ) - aParaText += "," + aNewData.maStyle; + aParaText.append(",").append(aNewData.maStyle); } - aParaText += "\""; + aParaText.append("\""); } // height @@ -756,7 +756,7 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico (aNewData.mnHeight += 10) /= 20; bool bFontHtChanged = (aFontData.mnHeight != aNewData.mnHeight); if( bFontHtChanged ) - aParaText += "&" + OUString::number( aNewData.mnHeight ); + aParaText.append("&").append(OUString::number( aNewData.mnHeight )); // update maximum paragraph height, convert to twips nParaHeight = ::std::max< sal_Int32 >( nParaHeight, aNewData.mnHeight * 20 ); @@ -773,13 +773,13 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico { sal_uInt8 nTmpUnderl = (aNewData.mnUnderline == EXC_FONTUNDERL_NONE) ? aFontData.mnUnderline : aNewData.mnUnderline; - (nTmpUnderl == EXC_FONTUNDERL_SINGLE)? aParaText += "&U" : aParaText += "&E"; + (nTmpUnderl == EXC_FONTUNDERL_SINGLE)? aParaText.append("&U") : aParaText.append("&E"); } // strikeout aNewData.mbStrikeout = (aFont.GetStrikeout() != STRIKEOUT_NONE); if( aFontData.mbStrikeout != aNewData.mbStrikeout ) - aParaText += "&S"; + aParaText.append("&S"); // super/sub script const SvxEscapementItem& rEscapeItem = aEditSet.Get( EE_CHAR_ESCAPEMENT ); @@ -789,9 +789,9 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico switch(aNewData.mnEscapem) { // close the previous super/sub script. - case EXC_FONTESC_NONE: (aFontData.mnEscapem == EXC_FONTESC_SUPER) ? aParaText += "&X" : aParaText += "&Y"; break; - case EXC_FONTESC_SUPER: aParaText += "&X"; break; - case EXC_FONTESC_SUB: aParaText += "&Y"; break; + case EXC_FONTESC_NONE: (aFontData.mnEscapem == EXC_FONTESC_SUPER) ? aParaText.append("&X") : aParaText.append("&Y"); break; + case EXC_FONTESC_SUPER: aParaText.append("&X"); break; + case EXC_FONTESC_SUB: aParaText.append("&Y"); break; default: break; } } @@ -807,30 +807,30 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico if( const SvxFieldData* pFieldData = static_cast< const SvxFieldItem* >( pItem )->GetField() ) { if( dynamic_cast<const SvxPageField*>( pFieldData) != nullptr ) - aParaText += "&P"; + aParaText.append("&P"); else if( dynamic_cast<const SvxPagesField*>( pFieldData) != nullptr ) - aParaText += "&N"; + aParaText.append("&N"); else if( dynamic_cast<const SvxDateField*>( pFieldData) != nullptr ) - aParaText += "&D"; + aParaText.append("&D"); else if( dynamic_cast<const SvxTimeField*>( pFieldData) != nullptr || dynamic_cast<const SvxExtTimeField*>( pFieldData) != nullptr ) - aParaText += "&T"; + aParaText.append("&T"); else if( dynamic_cast<const SvxTableField*>( pFieldData) != nullptr ) - aParaText += "&A"; + aParaText.append("&A"); else if( dynamic_cast<const SvxFileField*>( pFieldData) != nullptr ) // title -> file name - aParaText += "&F"; + aParaText.append("&F"); else if( const SvxExtFileField* pFileField = dynamic_cast<const SvxExtFileField*>( pFieldData ) ) { switch( pFileField->GetFormat() ) { case SvxFileFormat::NameAndExt: case SvxFileFormat::NameOnly: - aParaText += "&F"; + aParaText.append("&F"); break; case SvxFileFormat::PathOnly: - aParaText += "&Z"; + aParaText.append("&Z"); break; case SvxFileFormat::PathFull: - aParaText += "&Z&F"; + aParaText.append("&Z&F"); break; default: OSL_FAIL( "XclExpHFConverter::AppendPortion - unknown file field" ); @@ -848,16 +848,16 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico sal_Unicode cLast = aParaText[ aParaText.getLength() - 1 ]; sal_Unicode cFirst = aPortionText[0]; if( ('0' <= cLast) && (cLast <= '9') && ('0' <= cFirst) && (cFirst <= '9') ) - aParaText += " "; + aParaText.append(" "); } - aParaText += aPortionText; + aParaText.append(aPortionText); } } aSel.nStartPos = aSel.nEndPos; } - aText = ScGlobal::addToken( aText, aParaText, '\n' ); + aText = ScGlobal::addToken( aText, aParaText.makeStringAndClear(), '\n' ); if( nParaHeight == 0 ) nParaHeight = aFontData.mnHeight * 20; // points -> twips nHeight += nParaHeight; diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 3a00b8c4ef47..ab31d5d4307d 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -377,7 +377,8 @@ void XclImpHyperlink::ConvertToValidTabName(OUString& rUrl) // the 1st character must be '#'. return; - OUString aNewUrl('#'), aTabName; + OUStringBuffer aNewUrl("#"); + OUStringBuffer aTabName; bool bInQuote = false; bool bQuoteTabName = false; @@ -392,7 +393,7 @@ void XclImpHyperlink::ConvertToValidTabName(OUString& rUrl) // quite. When this occurs, the whole table name needs to be // quoted. bQuoteTabName = true; - aTabName += OUStringLiteral1(c) + OUStringLiteral1(c); + aTabName.append(c).append(c); ++i; continue; } @@ -401,16 +402,16 @@ void XclImpHyperlink::ConvertToValidTabName(OUString& rUrl) if (!bInQuote && !aTabName.isEmpty()) { if (bQuoteTabName) - aNewUrl += "'"; - aNewUrl += aTabName; + aNewUrl.append("'"); + aNewUrl.append(aTabName); if (bQuoteTabName) - aNewUrl += "'"; + aNewUrl.append("'"); } } else if (bInQuote) - aTabName += OUStringLiteral1(c); + aTabName.append(c); else - aNewUrl += OUStringLiteral1(c); + aNewUrl.append(c); } if (bInQuote) @@ -418,7 +419,7 @@ void XclImpHyperlink::ConvertToValidTabName(OUString& rUrl) return; // All is good. Pass the new URL. - rUrl = aNewUrl; + rUrl = aNewUrl.makeStringAndClear(); } void XclImpHyperlink::InsertUrl( XclImpRoot& rRoot, const XclRange& rXclRange, const OUString& rUrl ) diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index a3e7e8166d62..911f4197b780 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -2881,15 +2881,15 @@ XclImpPictureObj::XclImpPictureObj( const XclImpRoot& rRoot ) : OUString XclImpPictureObj::GetOleStorageName() const { - OUString aStrgName; + OUStringBuffer aStrgName; if( (mbEmbedded || mbLinked) && !mbControl && (mnStorageId > 0) ) { aStrgName = mbEmbedded ? OUString(EXC_STORAGE_OLE_EMBEDDED) : OUString(EXC_STORAGE_OLE_LINKED); static const sal_Char spcHexChars[] = "0123456789ABCDEF"; for( sal_uInt8 nIndex = 32; nIndex > 0; nIndex -= 4 ) - aStrgName += OUStringLiteral1( spcHexChars[ ::extract_value< sal_uInt8 >( mnStorageId, nIndex - 4, 4 ) ] ); + aStrgName.append(OUStringLiteral1( spcHexChars[ ::extract_value< sal_uInt8 >( mnStorageId, nIndex - 4, 4 ) ] )); } - return aStrgName; + return aStrgName.makeStringAndClear(); } void XclImpPictureObj::DoReadObj3( XclImpStream& rStrm, sal_uInt16 nMacroSize ) @@ -4189,7 +4189,7 @@ void XclImpSheetDrawing::ReadNote3( XclImpStream& rStrm ) if( GetAddressConverter().ConvertAddress( aScNotePos, aXclPos, maScUsedArea.aStart.Tab(), true ) ) { sal_uInt16 nPartLen = ::std::min( nTotalLen, static_cast< sal_uInt16 >( rStrm.GetRecLeft() ) ); - OUString aNoteText = rStrm.ReadRawByteString( nPartLen ); + OUStringBuffer aNoteText = rStrm.ReadRawByteString( nPartLen ); nTotalLen = nTotalLen - nPartLen; while( (nTotalLen > 0) && (rStrm.GetNextRecId() == EXC_ID_NOTE) && rStrm.StartNextRecord() ) { @@ -4199,7 +4199,7 @@ void XclImpSheetDrawing::ReadNote3( XclImpStream& rStrm ) if( aXclPos.mnRow == 0xFFFF ) { OSL_ENSURE( nPartLen <= nTotalLen, "XclImpObjectManager::ReadNote3 - string too long" ); - aNoteText += rStrm.ReadRawByteString( nPartLen ); + aNoteText.append(rStrm.ReadRawByteString( nPartLen )); nTotalLen = nTotalLen - ::std::min( nTotalLen, nPartLen ); } else @@ -4210,7 +4210,7 @@ void XclImpSheetDrawing::ReadNote3( XclImpStream& rStrm ) nTotalLen = 0; } } - ScNoteUtil::CreateNoteFromString( GetDoc(), aScNotePos, aNoteText, false, false ); + ScNoteUtil::CreateNoteFromString( GetDoc(), aScNotePos, aNoteText.makeStringAndClear(), false, false ); } } diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx index 6d36c73c9c99..f31cbc29cae8 100644 --- a/sc/source/filter/excel/xihelper.cxx +++ b/sc/source/filter/excel/xihelper.cxx @@ -285,8 +285,8 @@ void XclImpHFConverter::ParseString( const OUString& rHFString ) // parser temporaries maCurrText.truncate(); - OUString aReadFont; // current font name - OUString aReadStyle; // current font style + OUStringBuffer aReadFont; // current font name + OUStringBuffer aReadStyle; // current font style sal_uInt16 nReadHeight = 0; // current font height ResetFontData(); @@ -384,8 +384,8 @@ void XclImpHFConverter::ParseString( const OUString& rHFString ) break; case '\"': // font name - aReadFont.clear(); - aReadStyle.clear(); + aReadFont.setLength(0); + aReadStyle.setLength(0); eState = xlPSFont; break; default: @@ -411,7 +411,7 @@ void XclImpHFConverter::ParseString( const OUString& rHFString ) eState = xlPSFontStyle; break; default: - aReadFont += OUStringLiteral1(*pChar); + aReadFont.append(*pChar); } } break; @@ -425,12 +425,12 @@ void XclImpHFConverter::ParseString( const OUString& rHFString ) case '\"': SetAttribs(); if( !aReadFont.isEmpty() ) - mxFontData->maName = aReadFont; - mxFontData->maStyle = aReadStyle; + mxFontData->maName = aReadFont.toString(); + mxFontData->maStyle = aReadStyle.toString(); eState = xlPSText; break; default: - aReadStyle += OUStringLiteral1(*pChar); + aReadStyle.append(*pChar); } } break; diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx index 5f6e84a0a310..9c2aa9e75f83 100644 --- a/sc/source/filter/excel/xistream.cxx +++ b/sc/source/filter/excel/xistream.cxx @@ -826,7 +826,7 @@ std::size_t XclImpStream::ReadUniStringExtHeader( bool& rb16Bit, sal_uInt8 nFlag OUString XclImpStream::ReadRawUniString( sal_uInt16 nChars, bool b16Bit ) { - OUString aRet; + OUStringBuffer aRet; sal_uInt16 nCharsLeft = nChars; sal_uInt16 nReadSize; @@ -866,14 +866,14 @@ OUString XclImpStream::ReadRawUniString( sal_uInt16 nChars, bool b16Bit ) } *pcEndChar = '\0'; - aRet += OUString( pcBuffer.get() ); + aRet.append( pcBuffer.get(), pcUniChar - pcBuffer.get() ); nCharsLeft = nCharsLeft - nReadSize; if( nCharsLeft > 0 ) JumpToNextStringContinue( b16Bit ); } - return aRet; + return aRet.makeStringAndClear(); } OUString XclImpStream::ReadUniString( sal_uInt16 nChars, sal_uInt8 nFlags ) diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 04ba99cdaef0..788c851a5732 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -1436,7 +1436,7 @@ void ScHTMLLayoutParser::FontOn( HtmlImportInfo* pInfo ) case HtmlOptionId::FACE : { const OUString& rFace = rOption.GetString(); - OUString aFontName; + OUStringBuffer aFontName; sal_Int32 nPos = 0; while( nPos != -1 ) { @@ -1445,12 +1445,12 @@ void ScHTMLLayoutParser::FontOn( HtmlImportInfo* pInfo ) OUString aFName = rFace.getToken( 0, ',', nPos ); aFName = comphelper::string::strip(aFName, ' '); if( !aFontName.isEmpty() ) - aFontName += ";"; - aFontName += aFName; + aFontName.append(";"); + aFontName.append(aFName); } if ( !aFontName.isEmpty() ) mxActEntry->aItemSet.Put( SvxFontItem( FAMILY_DONTKNOW, - aFontName, EMPTY_OUSTRING, PITCH_DONTKNOW, + aFontName.makeStringAndClear(), EMPTY_OUSTRING, PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, ATTR_FONT ) ); } break; diff --git a/sc/source/filter/oox/richstring.cxx b/sc/source/filter/oox/richstring.cxx index 19b2c5531012..6d55e71da8c6 100644 --- a/sc/source/filter/oox/richstring.cxx +++ b/sc/source/filter/oox/richstring.cxx @@ -395,14 +395,14 @@ std::unique_ptr<EditTextObject> RichString::convert( ScEditEngineDefaulter& rEE, { ESelection aSelection; - OUString sString; + OUStringBuffer sString; for( PortionVector::const_iterator aIt = maTextPortions.begin(), aEnd = maTextPortions.end(); aIt != aEnd; ++aIt ) - sString += (*aIt)->getText(); + sString.append((*aIt)->getText()); // fdo#84370 - diving into editeng is not thread safe. SolarMutexGuard aGuard; - rEE.SetText( sString ); + rEE.SetText( sString.makeStringAndClear() ); for( PortionVector::const_iterator aIt = maTextPortions.begin(), aEnd = maTextPortions.end(); aIt != aEnd; ++aIt ) { diff --git a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx index 66672b095831..cbed718e5f98 100644 --- a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx @@ -64,16 +64,16 @@ OUString lclCreateMultiParameterFormula( const OUString& aWildcard, const ScDocument* pDocument, const ScAddress::Details& aAddressDetails) { - OUString aResult; + OUStringBuffer aResult; for (size_t i = 0; i < aRangeList.size(); i++) { OUString aRangeString(aRangeList[i].Format(ScRefFlags::RANGE_ABS, pDocument, aAddressDetails)); OUString aFormulaString = aFormulaTemplate.replaceAll(aWildcard, aRangeString); - aResult += aFormulaString; + aResult.append(aFormulaString); if(i != aRangeList.size() - 1) // Not Last - aResult+= ";"; + aResult.append(";"); } - return aResult; + return aResult.makeStringAndClear(); } void lclMakeSubRangesList(ScRangeList& rRangeList, const ScRange& rInputRange, ScStatisticsInputOutputDialog::GroupedBy aGroupedBy) diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 742eadf257a6..8b1e5b9fd413 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1133,7 +1133,7 @@ bool ScInputHandler::GetFuncName( OUString& aStart, OUString& aResult ) void ScInputHandler::ShowFuncList( const ::std::vector< OUString > & rFuncStrVec ) { - OUString aTipStr; + OUStringBuffer aTipStr; OUString aFuncNameStr; OUString aDescFuncNameStr; ::std::vector<OUString>::const_iterator itStr = rFuncStrVec.begin(); @@ -1157,21 +1157,20 @@ void ScInputHandler::ShowFuncList( const ::std::vector< OUString > & rFuncStrVec } else { - aTipStr = aTipStr + ", "; + aTipStr.append(", "); } - aTipStr = aTipStr + aFuncNameStr; + aTipStr.append(aFuncNameStr); if ( itStr == rFuncStrVec.begin() ) - aTipStr += "]"; + aTipStr.append("]"); if ( --nRemainFindNumber <= 0 ) break; } sal_Int32 nRemainNumber = rFuncStrVec.size() - nMaxFindNumber; if ( nRemainFindNumber == 0 && nRemainNumber > 0 ) { - OUString aBufStr( aTipStr ); OUString aMessage( ScResId( STR_FUNCTIONS_FOUND ) ); aMessage = aMessage.replaceFirst("%2", OUString::number(nRemainNumber)); - aMessage = aMessage.replaceFirst("%1", aBufStr); + aMessage = aMessage.replaceFirst("%1", aTipStr.makeStringAndClear()); aTipStr = aMessage; } FormulaHelper aHelper(ScGlobal::GetStarCalcFunctionMgr()); @@ -1183,10 +1182,10 @@ void ScInputHandler::ShowFuncList( const ::std::vector< OUString > & rFuncStrVec { if ( !ppFDesc->getFunctionName().isEmpty() ) { - aTipStr += " : " + ppFDesc->getDescription(); + aTipStr.append(" : ").append(ppFDesc->getDescription()); } } - ShowTip( aTipStr ); + ShowTip( aTipStr.makeStringAndClear() ); } void ScInputHandler::UseFormulaData() diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 9f0cacfc0176..aafbef46a7a1 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -1948,7 +1948,7 @@ void ScCheckListMenuWindow::getResult(ResultType& rResult) { if ( maMembers[i].mbLeaf ) { - OUString aLabel = maMembers[i].maName; + OUStringBuffer aLabel = maMembers[i].maName; if (aLabel.isEmpty()) aLabel = ScResId(STR_EMPTYDATA); @@ -1959,9 +1959,9 @@ void ScCheckListMenuWindow::getResult(ResultType& rResult) pParent && pParent->GetFirstItem( SvLBoxItemType::String); pParent = pParent->GetParent()) { - aLabel += ";" + maChecks->GetEntryText( pParent); + aLabel.append(";").append(maChecks->GetEntryText( pParent)); } - bool bState = vCheckeds.find(aLabel) != vCheckeds.end(); + bool bState = vCheckeds.find(aLabel.makeStringAndClear()) != vCheckeds.end(); ResultEntry aResultEntry; aResultEntry.bValid = bState; diff --git a/sc/source/ui/dbgui/asciiopt.cxx b/sc/source/ui/dbgui/asciiopt.cxx index f510577c2712..e580334f27c6 100644 --- a/sc/source/ui/dbgui/asciiopt.cxx +++ b/sc/source/ui/dbgui/asciiopt.cxx @@ -57,10 +57,10 @@ void ScAsciiOptions::SetColumnInfo( const ScCsvExpDataVec& rDataVec ) static OUString lcl_decodeSepString( const OUString & rSepNums, bool & o_bMergeFieldSeps ) { - OUString aFieldSeps; if ( rSepNums.isEmpty() ) - return aFieldSeps; + return OUString(); + OUStringBuffer aFieldSeps; sal_Int32 nPos = 0; do { @@ -71,12 +71,12 @@ static OUString lcl_decodeSepString( const OUString & rSepNums, bool & o_bMergeF { sal_Int32 nVal = aCode.toInt32(); if ( nVal ) - aFieldSeps += OUStringLiteral1(nVal); + aFieldSeps.append(OUStringLiteral1(nVal)); } } while ( nPos >= 0 ); - return aFieldSeps; + return aFieldSeps.makeStringAndClear(); } // The options string must not contain semicolons (because of the pick list), @@ -179,68 +179,68 @@ void ScAsciiOptions::ReadFromString( const OUString& rString ) OUString ScAsciiOptions::WriteToString() const { - OUString aOutStr; + OUStringBuffer aOutStr; // Token 0: Field separator. if ( bFixedLen ) - aOutStr += pStrFix; + aOutStr.append(pStrFix); else if ( aFieldSeps.isEmpty() ) - aOutStr += "0"; + aOutStr.append("0"); else { sal_Int32 nLen = aFieldSeps.getLength(); for (sal_Int32 i=0; i<nLen; i++) { if (i) - aOutStr += "/"; - aOutStr += OUString::number(aFieldSeps[i]); + aOutStr.append("/"); + aOutStr.append(OUString::number(aFieldSeps[i])); } if ( bMergeFieldSeps ) { - aOutStr += "/"; - aOutStr += pStrMrg; + aOutStr.append("/"); + aOutStr.append(pStrMrg); } } // Token 1: Text Quote character. - aOutStr += "," + OUString::number(cTextSep) + ","; + aOutStr.append(",").append(OUString::number(cTextSep)).append(","); //Token 2: Text encoding. if ( bCharSetSystem ) // force "SYSTEM" - aOutStr += ScGlobal::GetCharsetString( RTL_TEXTENCODING_DONTKNOW ); + aOutStr.append(ScGlobal::GetCharsetString( RTL_TEXTENCODING_DONTKNOW )); else - aOutStr += ScGlobal::GetCharsetString( eCharSet ); + aOutStr.append(ScGlobal::GetCharsetString( eCharSet )); //Token 3: Number of start row. - aOutStr += "," + OUString::number(nStartRow) + ","; + aOutStr.append(",").append(OUString::number(nStartRow)).append(","); //Token 4: Column info. for (size_t nInfo=0; nInfo<mvColStart.size(); nInfo++) { if (nInfo) - aOutStr += "/"; - aOutStr += OUString::number(mvColStart[nInfo]) + - "/" + - OUString::number(mvColFormat[nInfo]); + aOutStr.append("/"); + aOutStr.append(OUString::number(mvColStart[nInfo])) + .append("/") + .append(OUString::number(mvColFormat[nInfo])); } // #i112025# the options string is used in macros and linked sheets, // so new options must be added at the end, to remain compatible - aOutStr += "," + + aOutStr.append(",") //Token 5: Language - OUString::number(static_cast<sal_uInt16>(eLang)) + "," + + .append(OUString::number(static_cast<sal_uInt16>(eLang))).append(",") //Token 6: Import quoted field as text. - OUString::boolean( bQuotedFieldAsText ) + "," + + .append(OUString::boolean( bQuotedFieldAsText )).append(",") //Token 7: Detect special numbers. - OUString::boolean( bDetectSpecialNumber ) + "," + + .append(OUString::boolean( bDetectSpecialNumber )).append(",") // Token 8: used for "Save as shown" in export options - OUString::boolean( bSaveAsShown ) + "," + + .append(OUString::boolean( bSaveAsShown )).append(",") // Token 9: used for "Save cell formulas" in export options - OUString::boolean( bSaveFormulas ) + "," + + .append(OUString::boolean( bSaveFormulas )).append(",") //Token 10: Trim Space - OUString::boolean( bRemoveSpace ); - return aOutStr; + .append(OUString::boolean( bRemoveSpace )); + return aOutStr.makeStringAndClear(); } // static diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index faa202a0cf62..062c327ab9ee 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -541,16 +541,16 @@ void lcl_GetColumnTypes( // No duplicated names. if ( !rtl::isAsciiAlpha(aFieldName[0]) ) aFieldName = "N" + aFieldName; - OUString aTmpStr; + OUStringBuffer aTmpStr; sal_Unicode c; for ( const sal_Unicode* p = aFieldName.getStr(); ( c = *p ) != 0; p++ ) { if ( rtl::isAsciiAlpha(c) || rtl::isAsciiDigit(c) || c == '_' ) - aTmpStr += OUStringLiteral1(c); + aTmpStr.append(c); else - aTmpStr += "_"; + aTmpStr.append("_"); } - aFieldName = aTmpStr; + aFieldName = aTmpStr.makeStringAndClear(); if ( aFieldName.getLength() > 10 ) aFieldName = aFieldName.copy(0, 10); @@ -564,8 +564,7 @@ void lcl_GetColumnTypes( OUString aVarPart = OUString::number( nSub ); if ( aFixPart.getLength() + aVarPart.getLength() > 10 ) aFixPart = aFixPart.copy( 0, 10 - aVarPart.getLength() ); - aFieldName = aFixPart; - aFieldName += aVarPart; + aFieldName = aFixPart + aVarPart; } while (!aFieldNames.insert(aFieldName).second); } } diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx index 7abb24ee10f3..527c3a5de512 100644 --- a/sc/source/ui/formdlg/dwfunctr.cxx +++ b/sc/source/ui/formdlg/dwfunctr.cxx @@ -277,7 +277,7 @@ void ScFunctionWin::UpdateFunctionList() void ScFunctionWin::DoEnter() { OUString aFirstArgStr; - OUString aArgStr; + OUStringBuffer aArgStr; OUString aString=aFuncList->GetSelectedEntry(); SfxViewShell* pCurSh = SfxViewShell::Current(); nArgs=0; @@ -327,11 +327,11 @@ void ScFunctionWin::DoEnter() for ( sal_uInt16 nArg = 1; nArg < nFix && !pDesc->pDefArgFlags[nArg].bOptional; nArg++ ) { - aArgStr += "; "; + aArgStr.append("; "); OUString sTmp = pDesc->maDefArgNames[nArg]; sTmp = comphelper::string::strip(sTmp, ' '); sTmp = sTmp.replaceAll(" ", "_"); - aArgStr += sTmp; + aArgStr.append(sTmp); } } } @@ -349,7 +349,7 @@ void ScFunctionWin::DoEnter() if(nArgs>0) { pHdl->InsertFunction(aString); - pEdView->InsertText(aArgStr,true); + pEdView->InsertText(aArgStr.makeStringAndClear(),true); ESelection aESel=pEdView->GetSelection(); aESel.nEndPos = aESel.nStartPos + aFirstArgStr.getLength(); pEdView->SetSelection(aESel); diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx index 1596b4a8574b..9c79f6860207 100644 --- a/sc/source/ui/miscdlgs/crnrdlg.cxx +++ b/sc/source/ui/miscdlgs/crnrdlg.cxx @@ -379,7 +379,6 @@ void ScColRowNameRangesDlg::UpdateNames() SCROW nRow2; SCTAB nTab2; OUString rString; - OUString strShow; const ScAddress::Details aDetails(pDoc->GetAddressConvention()); OUString aString; @@ -405,24 +404,23 @@ void ScColRowNameRangesDlg::UpdateNames() SCCOL q=nCol1+3; if(q>nCol2) q=nCol2; //@008 construct string - strShow = " ["; + OUStringBuffer strShow = " ["; rString = pDoc->GetString(nCol1, nRow1, nTab1); - strShow += rString; + strShow.append(rString); for(SCCOL i=nCol1+1;i<=q;i++) { - strShow += ", "; + strShow.append(", "); rString = pDoc->GetString(i, nRow1, nTab1); - strShow += rString; + strShow.append(rString); } if(q<nCol2) // Too long? Add ",..." { - strShow += ", ..."; + strShow.append(", ..."); } - strShow += "]"; + strShow.append("]"); //@008 Add string to listbox - OUString aInsStr = aString; - aInsStr += strShow; + OUString aInsStr = aString + strShow.makeStringAndClear(); nPos = pLbRange->InsertEntry( aInsStr ); aRangeMap.emplace( aInsStr, aRange ); pLbRange->SetEntryData( nPos, reinterpret_cast<void*>(nEntryDataCol) ); @@ -448,23 +446,22 @@ void ScColRowNameRangesDlg::UpdateNames() nCol2, nRow2, nTab2 ); SCROW q=nRow1+3; if(q>nRow2) q=nRow2; - strShow = " ["; + OUStringBuffer strShow = " ["; rString = pDoc->GetString(nCol1, nRow1, nTab1); - strShow += rString; + strShow.append(rString); for(SCROW i=nRow1+1;i<=q;i++) { - strShow += ", "; + strShow.append(", "); rString = pDoc->GetString(nCol1, i, nTab1); - strShow += rString; + strShow.append(rString); } if(q<nRow2) { - strShow += ", ..."; + strShow.append(", ..."); } - strShow += "]"; + strShow.append("]"); - OUString aInsStr = aString; - aInsStr += strShow; + OUString aInsStr = aString + strShow.makeStringAndClear(); nPos = pLbRange->InsertEntry( aInsStr ); aRangeMap.emplace( aInsStr, aRange ); pLbRange->SetEntryData( nPos, reinterpret_cast<void*>(nEntryDataRow) ); diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx index 9c38f0284bf6..3c7b46ead276 100644 --- a/sc/source/ui/miscdlgs/mvtabdlg.cxx +++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx @@ -201,7 +201,6 @@ void ScMoveTableDlg::InitDocListBox() ScDocShell* pScSh = nullptr; sal_uInt16 nSelPos = 0; sal_uInt16 i = 0; - OUString aEntryName; m_xLbDoc->clear(); m_xLbDoc->freeze(); @@ -212,7 +211,7 @@ void ScMoveTableDlg::InitDocListBox() if ( pScSh ) { - aEntryName = pScSh->GetTitle(); + OUString aEntryName = pScSh->GetTitle(); if ( pScSh == SfxObjectShell::Current() ) { diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx index 6b13e971cc1b..bc5b96ef428f 100644 --- a/sc/source/ui/optdlg/tpusrlst.cxx +++ b/sc/source/ui/optdlg/tpusrlst.cxx @@ -277,16 +277,16 @@ void ScTpUserLists::UpdateEntries( size_t nList ) { const ScUserListData& rList = (*pUserLists)[nList]; std::size_t nSubCount = rList.GetSubCount(); - OUString aEntryListStr; + OUStringBuffer aEntryListStr; for ( size_t i=0; i<nSubCount; i++ ) { if ( i!=0 ) - aEntryListStr += OUStringLiteral1(CR); - aEntryListStr += rList.GetSubStr(i); + aEntryListStr.append(CR); + aEntryListStr.append(rList.GetSubStr(i)); } - mpEdEntries->SetText(convertLineEnd(aEntryListStr, GetSystemLineEnd())); + mpEdEntries->SetText(convertLineEnd(aEntryListStr.makeStringAndClear(), GetSystemLineEnd())); } else { @@ -296,18 +296,18 @@ void ScTpUserLists::UpdateEntries( size_t nList ) void ScTpUserLists::MakeListStr( OUString& rListStr ) { - OUString aStr; + OUStringBuffer aStr; sal_Int32 nToken = comphelper::string::getTokenCount(rListStr, LF); for(sal_Int32 i=0; i<nToken; i++) { OUString aString = comphelper::string::strip(rListStr.getToken(i, LF), ' '); - aStr += aString; - aStr += OUStringLiteral1(cDelimiter); + aStr.append(aString); + aStr.append(cDelimiter); } - aStr = comphelper::string::strip(aStr, cDelimiter); + aStr.strip(cDelimiter); sal_Int32 nLen = aStr.getLength(); rListStr.clear(); @@ -367,53 +367,51 @@ void ScTpUserLists::CopyListFromArea( const ScRefAddress& rStartPos, if ( nCellDir != RET_CANCEL ) { bool bValueIgnored = false; - OUString aStrList; - OUString aStrField; if ( nCellDir == SCRET_COLS ) { for ( SCCOL col=nStartCol; col<=nEndCol; col++ ) { + OUStringBuffer aStrList; for ( SCROW row=nStartRow; row<=nEndRow; row++ ) { if ( pDoc->HasStringData( col, row, nTab ) ) { - aStrField = pDoc->GetString(col, row, nTab); + OUString aStrField = pDoc->GetString(col, row, nTab); if ( !aStrField.isEmpty() ) { - aStrList += aStrField + "\n"; + aStrList.append(aStrField).append("\n"); } } else bValueIgnored = true; } if ( !aStrList.isEmpty() ) - AddNewList( aStrList ); - aStrList.clear(); + AddNewList( aStrList.makeStringAndClear() ); } } else { for ( SCROW row=nStartRow; row<=nEndRow; row++ ) { + OUStringBuffer aStrList; for ( SCCOL col=nStartCol; col<=nEndCol; col++ ) { if ( pDoc->HasStringData( col, row, nTab ) ) { - aStrField = pDoc->GetString(col, row, nTab); + OUString aStrField = pDoc->GetString(col, row, nTab); if ( !aStrField.isEmpty() ) { - aStrList += aStrField + "\n"; + aStrList.append(aStrField).append("\n"); } } else bValueIgnored = true; } if ( !aStrList.isEmpty() ) - AddNewList( aStrList ); - aStrList.clear(); + AddNewList( aStrList.makeStringAndClear() ); } } diff --git a/sc/source/ui/unoobj/PivotTableDataProvider.cxx b/sc/source/ui/unoobj/PivotTableDataProvider.cxx index 9177254d5979..abbe7e2265fd 100644 --- a/sc/source/ui/unoobj/PivotTableDataProvider.cxx +++ b/sc/source/ui/unoobj/PivotTableDataProvider.cxx @@ -611,7 +611,7 @@ PivotTableDataProvider::assignLabelsToDataSequence(size_t nIndex) OUString sLabelID = lcl_identifierForLabel(nIndex); - OUString aLabel; + OUStringBuffer aLabel; bool bFirst = true; if (m_aLabels.empty()) @@ -624,17 +624,17 @@ PivotTableDataProvider::assignLabelsToDataSequence(size_t nIndex) { if (bFirst) { - aLabel += rItem.m_aString; + aLabel.append(rItem.m_aString); bFirst = false; } else { - aLabel += " - " + rItem.m_aString; + aLabel.append(" - ").append(rItem.m_aString); } } } - std::vector<ValueAndFormat> aLabelVector { ValueAndFormat(aLabel) }; + std::vector<ValueAndFormat> aLabelVector { ValueAndFormat(aLabel.makeStringAndClear()) }; std::unique_ptr<PivotTableDataSequence> pSequence; pSequence.reset(new PivotTableDataSequence(m_pDocument, m_sPivotTableName, diff --git a/sc/source/ui/vba/vbanames.cxx b/sc/source/ui/vba/vbanames.cxx index 3dea193fe844..cd986a8e2a2a 100644 --- a/sc/source/ui/vba/vbanames.cxx +++ b/sc/source/ui/vba/vbanames.cxx @@ -200,7 +200,7 @@ ScVbaNames::Add( const css::uno::Any& Name , table::CellAddress aCellAddr( aAddr.Sheet , aAddr.StartColumn , aAddr.StartRow ); if ( mxNames->hasByName( sName ) ) mxNames->removeByName(sName); - OUString sTmp = "$"; + OUStringBuffer sTmp = "$"; uno::Reference< ov::XCollection > xCol( xRange->Areas( uno::Any() ), uno::UNO_QUERY ); for ( sal_Int32 nArea = 1; nArea <= xCol->getCount(); ++nArea ) { @@ -208,10 +208,10 @@ ScVbaNames::Add( const css::uno::Any& Name , OUString sRangeAdd = xArea->Address( aAny2, aAny2 , aAny2 , aAny2, aAny2 ); if ( nArea > 1 ) - sTmp += ","; - sTmp = sTmp + "'" + xRange->getWorksheet()->getName() + "'." + sRangeAdd; + sTmp.append(","); + sTmp.append("'").append(xRange->getWorksheet()->getName()).append("'.").append(sRangeAdd); } - mxNames->addNewByName( sName, sTmp, aCellAddr, 0/*nUnoType*/); + mxNames->addNewByName( sName, sTmp.makeStringAndClear(), aCellAddr, 0/*nUnoType*/); return Item( uno::makeAny( sName ), uno::Any() ); } } diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 04e92c3c314a..e5ee4af10a19 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -2042,7 +2042,7 @@ ScVbaRange::Address( const uno::Any& RowAbsolute, const uno::Any& ColumnAbsolut if ( m_Areas->getCount() > 1 ) { // Multi-Area Range - OUString sAddress; + OUStringBuffer sAddress; uno::Reference< XCollection > xCollection( m_Areas, uno::UNO_QUERY_THROW ); uno::Any aExternalCopy = External; for ( sal_Int32 index = 1; index <= xCollection->getCount(); ++index ) @@ -2050,15 +2050,15 @@ ScVbaRange::Address( const uno::Any& RowAbsolute, const uno::Any& ColumnAbsolut uno::Reference< excel::XRange > xRange( xCollection->Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); if ( index > 1 ) { - sAddress += ","; - // force external to be false - // only first address should have the - // document and sheet specifications - aExternalCopy <<= false; + sAddress.append(","); + // force external to be false + // only first address should have the + // document and sheet specifications + aExternalCopy <<= false; } - sAddress += xRange->Address( RowAbsolute, ColumnAbsolute, ReferenceStyle, aExternalCopy, RelativeTo ); + sAddress.append(xRange->Address( RowAbsolute, ColumnAbsolute, ReferenceStyle, aExternalCopy, RelativeTo )); } - return sAddress; + return sAddress.makeStringAndClear(); } ScAddress::Details dDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 ); diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 555fdb4a1b0b..5b11b8b046de 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -1199,7 +1199,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) OUString aCode = static_cast<const SfxStringItem*>(pItem)->GetValue(); sal_uInt16 aLen = aCode.getLength(); std::unique_ptr<OUString[]> sFormat( new OUString[4] ); - OUString sTmpStr = ""; + OUStringBuffer sTmpStr; sal_uInt16 nCount(0); sal_uInt16 nStrCount(0); @@ -1209,13 +1209,12 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) if(cChar == ',') { - sFormat[nStrCount] = sTmpStr; - sTmpStr.clear(); + sFormat[nStrCount] = sTmpStr.makeStringAndClear(); nStrCount++; } else { - sTmpStr += OUStringLiteral1(cChar); + sTmpStr.append(cChar); } nCount++; diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 812975966ab2..8b77601bcdf3 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -1796,10 +1796,10 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co if ( nRepeatCount > 1 ) { OUString aCellStr = aVars.GetString(); - OUString aRepeated = aCellStr; + OUStringBuffer aRepeated = aCellStr; for ( long nRepeat = 1; nRepeat < nRepeatCount; nRepeat++ ) - aRepeated += aCellStr; - aVars.SetAutoText( aRepeated ); + aRepeated.append(aCellStr); + aVars.SetAutoText( aRepeated.makeStringAndClear() ); } } } @@ -2966,11 +2966,11 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam) long nRepeatCount = nAvailable / nRepeatSize; if ( nRepeatCount > 1 ) { - OUString aRepeated = aCellStr; + OUStringBuffer aRepeated = aCellStr; for ( long nRepeat = 1; nRepeat < nRepeatCount; nRepeat++ ) - aRepeated += aCellStr; + aRepeated.append(aCellStr); - nEngineWidth = SetEngineTextAndGetWidth( rParam, aRepeated, + nEngineWidth = SetEngineTextAndGetWidth( rParam, aRepeated.makeStringAndClear(), nNeededPixel, (nLeftM + nRightM ) ); nEngineHeight = rParam.mpEngine->GetTextHeight(); @@ -3336,11 +3336,11 @@ void ScOutputData::DrawEditBottomTop(DrawEditParam& rParam) const long nRepeatCount = nAvailable / nRepeatSize; if ( nRepeatCount > 1 ) { - OUString aRepeated = aCellStr; + OUStringBuffer aRepeated = aCellStr; for ( long nRepeat = 1; nRepeat < nRepeatCount; nRepeat++ ) - aRepeated += aCellStr; + aRepeated.append(aCellStr); - nEngineWidth = SetEngineTextAndGetWidth( rParam, aRepeated, + nEngineWidth = SetEngineTextAndGetWidth( rParam, aRepeated.makeStringAndClear(), nNeededPixel, (nLeftM + nRightM ) ); nEngineHeight = rParam.mpEngine->GetTextHeight(); @@ -3580,11 +3580,11 @@ void ScOutputData::DrawEditTopBottom(DrawEditParam& rParam) const long nRepeatCount = nAvailable / nRepeatSize; if ( nRepeatCount > 1 ) { - OUString aRepeated = aCellStr; + OUStringBuffer aRepeated = aCellStr; for ( long nRepeat = 1; nRepeat < nRepeatCount; nRepeat++ ) - aRepeated += aCellStr; + aRepeated.append(aCellStr); - nEngineWidth = SetEngineTextAndGetWidth( rParam, aRepeated, + nEngineWidth = SetEngineTextAndGetWidth( rParam, aRepeated.makeStringAndClear(), nNeededPixel, (nLeftM + nRightM ) ); nEngineHeight = rParam.mpEngine->GetTextHeight(); diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 0acd574a396a..a5c51b7fc5f5 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -70,8 +70,6 @@ using namespace com::sun::star; bool ScTabViewShell::GetFunction( OUString& rFuncStr, FormulaError nErrCode ) { - OUString aStr; - sal_uInt32 nFuncs = SC_MOD()->GetAppOptions().GetStatusFunc(); ScViewData& rViewData = GetViewData(); ScMarkData& rMark = rViewData.GetMarkData(); @@ -115,7 +113,7 @@ bool ScTabViewShell::GetFunction( OUString& rFuncStr, FormulaError nErrCode ) SCROW nPosY = rViewData.GetCurY(); SCTAB nTab = rViewData.GetTabNo(); - aStr = ScResId(pGlobStrId); + OUString aStr = ScResId(pGlobStrId); aStr += ": "; ScAddress aCursor( nPosX, nPosY, nTab ); |