diff options
Diffstat (limited to 'sc/source')
78 files changed, 328 insertions, 455 deletions
diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx index 80bc01a66c97..ce572b930369 100644 --- a/sc/source/core/data/attrib.cxx +++ b/sc/source/core/data/attrib.cxx @@ -481,10 +481,8 @@ SfxItemPresentation ScRangeItem::GetPresentation case SFX_ITEM_PRESENTATION_NAMELESS: { - String aText; /* Always use OOo:A1 format */ - aRange.Format( aText ); - rText += aText; + rText += aRange.Format(); } break; diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx index abaf08882abf..5d2e50a881b9 100644 --- a/sc/source/core/data/dpcache.cxx +++ b/sc/source/core/data/dpcache.cxx @@ -114,9 +114,7 @@ OUString createLabelString(ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab) aBuf.append(sal_Unicode(' ')); ScAddress aColAddr(nCol, 0, 0); - OUString aColStr; - aColAddr.Format(aColStr, SCA_VALID_COL, NULL); - aBuf.append(aColStr); + aBuf.append(aColAddr.Format(SCA_VALID_COL, NULL)); aDocStr = aBuf.makeStringAndClear(); } return aDocStr; diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 32238cda798d..2ca77d10eb77 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2005,13 +2005,12 @@ sal_uInt16 ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos ) const else { #if OSL_DEBUG_LEVEL > 0 - OUString aTmp; OStringBuffer aMsg(RTL_CONSTASCII_STRINGPARAM( "broken Matrix, no MatFormula at origin, Pos: ")); - aPos.Format( aTmp, SCA_VALID_COL | SCA_VALID_ROW, pDocument ); + OUString aTmp(aPos.Format(SCA_VALID_COL | SCA_VALID_ROW, pDocument)); aMsg.append(OUStringToOString(aTmp, RTL_TEXTENCODING_ASCII_US)); aMsg.append(RTL_CONSTASCII_STRINGPARAM(", MatOrg: ")); - aOrg.Format( aTmp, SCA_VALID_COL | SCA_VALID_ROW, pDocument ); + aTmp = aOrg.Format(SCA_VALID_COL | SCA_VALID_ROW, pDocument); aMsg.append(OUStringToOString(aTmp, RTL_TEXTENCODING_ASCII_US)); OSL_FAIL(aMsg.getStr()); #endif @@ -2038,12 +2037,11 @@ sal_uInt16 ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos ) const #if OSL_DEBUG_LEVEL > 0 else { - OUString aTmp; OStringBuffer aMsg( "broken Matrix, Pos: " ); - aPos.Format( aTmp, SCA_VALID_COL | SCA_VALID_ROW, pDocument ); + OUString aTmp(aPos.Format(SCA_VALID_COL | SCA_VALID_ROW, pDocument)); aMsg.append(OUStringToOString(aTmp, RTL_TEXTENCODING_UTF8 )); aMsg.append(RTL_CONSTASCII_STRINGPARAM(", MatOrg: ")); - aOrg.Format( aTmp, SCA_VALID_COL | SCA_VALID_ROW, pDocument ); + aTmp = aOrg.Format(SCA_VALID_COL | SCA_VALID_ROW, pDocument); aMsg.append(OUStringToOString(aTmp, RTL_TEXTENCODING_UTF8 )); aMsg.append(RTL_CONSTASCII_STRINGPARAM(", MatCols: ")); aMsg.append(static_cast<sal_Int32>( nC )); diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index e471e85b067b..d6342e010a0f 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -206,9 +206,8 @@ sal_Bool ScValidationData::DoScript( const ScAddress& rPos, const String& rInput aParams[0] = ::com::sun::star::uno::makeAny( OUString( aValStr ) ); // 2) Position der Zelle - String aPosStr; - rPos.Format( aPosStr, SCA_VALID | SCA_TAB_3D, pDocument, pDocument->GetAddressConvention() ); - aParams[1] = ::com::sun::star::uno::makeAny( OUString( aPosStr ) ); + OUString aPosStr(rPos.Format(SCA_VALID | SCA_TAB_3D, pDocument, pDocument->GetAddressConvention())); + aParams[1] = ::com::sun::star::uno::makeAny(aPosStr); // use link-update flag to prevent closing the document // while the macro is running @@ -329,8 +328,7 @@ sal_Bool ScValidationData::DoMacro( const ScAddress& rPos, const String& rInput, refPar->Get(1)->PutString( aValStr ); // 2) Position der Zelle - String aPosStr; - rPos.Format( aPosStr, SCA_VALID | SCA_TAB_3D, pDocument, pDocument->GetAddressConvention() ); + OUString aPosStr(rPos.Format(SCA_VALID | SCA_TAB_3D, pDocument, pDocument->GetAddressConvention())); refPar->Get(2)->PutString( aPosStr ); // use link-update flag to prevent closing the document diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index 6906c876fc9b..0a3d919b98f1 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -1615,26 +1615,26 @@ sal_uInt16 ScRange::ParseRows( const String& rStr, ScDocument* pDoc, } static inline void -lcl_a1_append_c ( String &r, int nCol, bool bIsAbs ) +lcl_a1_append_c ( OUString &r, int nCol, bool bIsAbs ) { if( bIsAbs ) - r += '$'; + r += "$"; ScColToAlpha( r, sal::static_int_cast<SCCOL>(nCol) ); } static inline void -lcl_a1_append_r ( String &r, int nRow, bool bIsAbs ) +lcl_a1_append_r ( OUString &r, int nRow, bool bIsAbs ) { if ( bIsAbs ) - r += '$'; + r += "$"; r += OUString::number( nRow+1 ); } static inline void -lcl_r1c1_append_c ( String &r, int nCol, bool bIsAbs, +lcl_r1c1_append_c ( OUString &r, int nCol, bool bIsAbs, const ScAddress::Details& rDetails ) { - r += 'C'; + r += "C"; if (bIsAbs) { r += OUString::number( nCol + 1 ); @@ -1648,10 +1648,10 @@ lcl_r1c1_append_c ( String &r, int nCol, bool bIsAbs, } } static inline void -lcl_r1c1_append_r ( String &r, int nRow, bool bIsAbs, +lcl_r1c1_append_r ( OUString &r, int nRow, bool bIsAbs, const ScAddress::Details& rDetails ) { - r += 'R'; + r += "R"; if (bIsAbs) { r += OUString::number( nRow + 1 ); @@ -1691,26 +1691,17 @@ getFileNameFromDoc( const ScDocument* pDoc ) return sFileName; } -void ScAddress::Format( OUString& r, sal_uInt16 nFlags, const ScDocument* pDoc, +OUString ScAddress::Format(sal_uInt16 nFlags, const ScDocument* pDoc, const Details& rDetails) const { - String aStr; - Format(aStr, nFlags, pDoc, rDetails); - r = aStr; -} - -void ScAddress::Format( String& r, sal_uInt16 nFlags, const ScDocument* pDoc, - const Details& rDetails) const -{ - r.Erase(); + OUString r; if( nFlags & SCA_VALID ) nFlags |= ( SCA_VALID_ROW | SCA_VALID_COL | SCA_VALID_TAB ); if( pDoc && (nFlags & SCA_VALID_TAB ) ) { if ( nTab >= pDoc->GetTableCount() ) { - r = ScGlobal::GetRscString( STR_NOREF_STR ); - return; + return ScGlobal::GetRscString( STR_NOREF_STR ); } if( nFlags & SCA_TAB_3D ) { @@ -1745,9 +1736,9 @@ void ScAddress::Format( String& r, sal_uInt16 nFlags, const ScDocument* pDoc, case formula::FormulaGrammar::CONV_OOO: r += aDocName; if( nFlags & SCA_TAB_ABSOLUTE ) - r += '$'; + r += "$"; r += aTabName; - r += '.'; + r += "."; break; case formula::FormulaGrammar::CONV_XL_A1: @@ -1755,12 +1746,12 @@ void ScAddress::Format( String& r, sal_uInt16 nFlags, const ScDocument* pDoc, case formula::FormulaGrammar::CONV_XL_OOX: if (aDocName.Len() > 0) { - r += '['; + r += "["; r += aDocName; - r += ']'; + r += "]"; } r += aTabName; - r += '!'; + r += "!"; break; } } @@ -1784,6 +1775,7 @@ void ScAddress::Format( String& r, sal_uInt16 nFlags, const ScDocument* pDoc, lcl_r1c1_append_c ( r, nCol, nFlags & SCA_COL_ABSOLUTE, rDetails ); break; } + return r; } static void @@ -1819,7 +1811,7 @@ lcl_Split_DocTab( const ScDocument* pDoc, SCTAB nTab, } static void -lcl_ScRange_Format_XL_Header( String& r, const ScRange& rRange, +lcl_ScRange_Format_XL_Header( OUString& r, const ScRange& rRange, sal_uInt16 nFlags, const ScDocument* pDoc, const ScAddress::Details& rDetails ) { @@ -1830,9 +1822,9 @@ lcl_ScRange_Format_XL_Header( String& r, const ScRange& rRange, aTabName, aDocName ); if( aDocName.Len() > 0 ) { - r += '['; + r += "["; r += aDocName; - r += ']'; + r += "]"; } r += aTabName; @@ -1840,23 +1832,22 @@ lcl_ScRange_Format_XL_Header( String& r, const ScRange& rRange, { lcl_Split_DocTab( pDoc, rRange.aEnd.Tab(), rDetails, nFlags, aTabName, aDocName ); - r += ':'; + r += ":"; r += aTabName; } - r += '!'; + r += "!"; } } -void ScRange::Format( String& r, sal_uInt16 nFlags, const ScDocument* pDoc, +OUString ScRange::Format( sal_uInt16 nFlags, const ScDocument* pDoc, const ScAddress::Details& rDetails ) const { - r.Erase(); if( !( nFlags & SCA_VALID ) ) { - r = ScGlobal::GetRscString( STR_NOREF_STR ); - return; + return ScGlobal::GetRscString( STR_NOREF_STR ); } + OUString r; #define absrel_differ(nFlags, mask) (((nFlags) & (mask)) ^ (((nFlags) >> 4) & (mask))) switch( rDetails.eConv ) { default : @@ -1864,19 +1855,18 @@ void ScRange::Format( String& r, sal_uInt16 nFlags, const ScDocument* pDoc, bool bOneTab = (aStart.Tab() == aEnd.Tab()); if ( !bOneTab ) nFlags |= SCA_TAB_3D; - aStart.Format( r, nFlags, pDoc, rDetails ); + r = aStart.Format(nFlags, pDoc, rDetails); if( aStart != aEnd || absrel_differ( nFlags, SCA_COL_ABSOLUTE ) || absrel_differ( nFlags, SCA_ROW_ABSOLUTE )) { - String aName; nFlags = ( nFlags & SCA_VALID ) | ( ( nFlags >> 4 ) & 0x070F ); if ( bOneTab ) pDoc = NULL; else nFlags |= SCA_TAB_3D; - aEnd.Format( aName, nFlags, pDoc, rDetails ); - r += ':'; + OUString aName(aEnd.Format(nFlags, pDoc, rDetails)); + r += ":"; r += aName; } } @@ -1889,14 +1879,14 @@ void ScRange::Format( String& r, sal_uInt16 nFlags, const ScDocument* pDoc, { // Full col refs always require 2 rows (2:2) lcl_a1_append_r( r, aStart.Row(), nFlags & SCA_ROW_ABSOLUTE ); - r += ':'; + r += ":"; lcl_a1_append_r( r, aEnd.Row(), nFlags & SCA_ROW2_ABSOLUTE ); } else if( aStart.Row() == 0 && aEnd.Row() >= MAXROW ) { // Full row refs always require 2 cols (A:A) lcl_a1_append_c( r, aStart.Col(), nFlags & SCA_COL_ABSOLUTE ); - r += ':'; + r += ":"; lcl_a1_append_c( r, aEnd.Col(), nFlags & SCA_COL2_ABSOLUTE ); } else @@ -1907,7 +1897,7 @@ void ScRange::Format( String& r, sal_uInt16 nFlags, const ScDocument* pDoc, absrel_differ( nFlags, SCA_COL_ABSOLUTE ) || aStart.Row() != aEnd.Row() || absrel_differ( nFlags, SCA_ROW_ABSOLUTE )) { - r += ':'; + r += ":"; lcl_a1_append_c ( r, aEnd.Col(), nFlags & SCA_COL2_ABSOLUTE ); lcl_a1_append_r ( r, aEnd.Row(), nFlags & SCA_ROW2_ABSOLUTE ); } @@ -1921,7 +1911,7 @@ void ScRange::Format( String& r, sal_uInt16 nFlags, const ScDocument* pDoc, lcl_r1c1_append_r( r, aStart.Row(), nFlags & SCA_ROW_ABSOLUTE, rDetails ); if( aStart.Row() != aEnd.Row() || absrel_differ( nFlags, SCA_ROW_ABSOLUTE )) { - r += ':'; + r += ":"; lcl_r1c1_append_r( r, aEnd.Row(), nFlags & SCA_ROW2_ABSOLUTE, rDetails ); } } @@ -1930,7 +1920,7 @@ void ScRange::Format( String& r, sal_uInt16 nFlags, const ScDocument* pDoc, lcl_r1c1_append_c( r, aStart.Col(), nFlags & SCA_COL_ABSOLUTE, rDetails ); if( aStart.Col() != aEnd.Col() || absrel_differ( nFlags, SCA_COL_ABSOLUTE )) { - r += ':'; + r += ":"; lcl_r1c1_append_c( r, aEnd.Col(), nFlags & SCA_COL2_ABSOLUTE, rDetails ); } } @@ -1942,21 +1932,14 @@ void ScRange::Format( String& r, sal_uInt16 nFlags, const ScDocument* pDoc, absrel_differ( nFlags, SCA_COL_ABSOLUTE ) || aStart.Row() != aEnd.Row() || absrel_differ( nFlags, SCA_ROW_ABSOLUTE )) { - r += ':'; + r += ":"; lcl_r1c1_append_r( r, aEnd.Row(), nFlags & SCA_ROW2_ABSOLUTE, rDetails ); lcl_r1c1_append_c( r, aEnd.Col(), nFlags & SCA_COL2_ABSOLUTE, rDetails ); } } } #undef absrel_differ -} - -void ScRange::Format( OUString& r, sal_uInt16 nFlags, const ScDocument* pDoc, - const ScAddress::Details& rDetails ) const -{ - String aStr; - Format(aStr, nFlags, pDoc, rDetails); - r = aStr; + return r; } bool ScAddress::Move( SCsCOL dx, SCsROW dy, SCsTAB dz, ScDocument* pDoc ) @@ -1993,7 +1976,7 @@ bool ScRange::Move( SCsCOL dx, SCsROW dy, SCsTAB dz, ScDocument* pDoc ) String ScAddress::GetColRowString( bool bAbsolute, const Details& rDetails ) const { - String aString; + OUString aString; switch( rDetails.eConv ) { @@ -2002,12 +1985,12 @@ String ScAddress::GetColRowString( bool bAbsolute, case formula::FormulaGrammar::CONV_XL_A1: case formula::FormulaGrammar::CONV_XL_OOX: if (bAbsolute) - aString.Append( '$' ); + aString += "$"; ScColToAlpha( aString, nCol); if ( bAbsolute ) - aString.Append( '$' ); + aString += "$"; aString += OUString::number(nRow+1); break; @@ -2030,7 +2013,6 @@ String ScRefAddress::GetRefString( ScDocument* pDoc, SCTAB nActTab, if ( Tab()+1 > pDoc->GetTableCount() ) return ScGlobal::GetRscString( STR_NOREF_STR ); - String aString; sal_uInt16 nFlags = SCA_VALID; if ( nActTab != Tab() ) { @@ -2043,9 +2025,7 @@ String ScRefAddress::GetRefString( ScDocument* pDoc, SCTAB nActTab, if ( !bRelRow ) nFlags |= SCA_ROW_ABSOLUTE; - aAdr.Format( aString, nFlags, pDoc, rDetails ); - - return aString; + return aAdr.Format(nFlags, pDoc, rDetails); } //------------------------------------------------------------------------ diff --git a/sc/source/core/tool/chartarr.cxx b/sc/source/core/tool/chartarr.cxx index 7abb78751816..6929e42963c6 100644 --- a/sc/source/core/tool/chartarr.cxx +++ b/sc/source/core/tool/chartarr.cxx @@ -279,7 +279,7 @@ ScMemChart* ScChartArray::CreateMemChartSingle() for (nCol=0; nCol<nColCount; nCol++) { - OUString aString, aColStr; + OUString aString; if (HasColHeaders()) aString = pDocument->GetString(aCols[nCol], nStrRow, nTab1); if (aString.isEmpty()) @@ -289,8 +289,7 @@ ScMemChart* ScChartArray::CreateMemChartSingle() aBuf.append(sal_Unicode(' ')); ScAddress aPos( aCols[ nCol ], 0, 0 ); - aPos.Format( aColStr, SCA_VALID_COL, NULL ); - aBuf.append(aColStr); + aBuf.append(aPos.Format(SCA_VALID_COL, NULL)); aString = aBuf.makeStringAndClear(); } @@ -399,7 +398,7 @@ ScMemChart* ScChartArray::CreateMemChartMulti() SCCOL nPosCol = 0; for ( nCol = 0; nCol < nColCount; nCol++ ) { - OUString aString, aColStr; + OUString aString; const ScAddress* pPos = GetPositionMap()->GetColHeaderPosition( static_cast<SCCOL>(nCol) ); if ( HasColHeaders() && pPos ) aString = pDocument->GetString(pPos->Col(), pPos->Row(), pPos->Tab()); @@ -413,8 +412,7 @@ ScMemChart* ScChartArray::CreateMemChartMulti() else nPosCol++; ScAddress aPos( nPosCol - 1, 0, 0 ); - aPos.Format( aColStr, SCA_VALID_COL, NULL ); - aBuf.append(aColStr); + aBuf.append(aPos.Format(SCA_VALID_COL, NULL)); aString = aBuf.makeStringAndClear(); } pMemChart->SetColText( static_cast<short>(nCol), aString); diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index 75163bbfb80b..d5f1c6c92d18 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -559,9 +559,7 @@ OUString ScChangeAction::GetRefString( if ( bFlag3D || GetType() == SC_CAT_INSERT_TABS ) nFlags |= SCA_TAB_3D; - OUString aTmp; - aTmpRange.Format(aTmp, nFlags, pDoc, pDoc->GetAddressConvention()); - aBuf.append(aTmp); + aBuf.append(aTmpRange.Format(nFlags, pDoc, pDoc->GetAddressConvention())); } } if ( (bFlag3D && IsDeleteType()) || IsDeletedIn() ) @@ -1593,7 +1591,7 @@ void ScChangeActionContent::GetRefString( ScAddress aTmpAddress( GetBigRange().aStart.MakeAddress() ); if ( bFlag3D ) nFlags |= SCA_TAB_3D; - aTmpAddress.Format( rStr, nFlags, pDoc, pDoc->GetAddressConvention() ); + rStr = aTmpAddress.Format(nFlags, pDoc, pDoc->GetAddressConvention()); if ( IsDeletedIn() ) { // Insert the parentheses. diff --git a/sc/source/core/tool/ddelink.cxx b/sc/source/core/tool/ddelink.cxx index c6a55d85b841..4228d7ebcca1 100644 --- a/sc/source/core/tool/ddelink.cxx +++ b/sc/source/core/tool/ddelink.cxx @@ -129,23 +129,23 @@ sfx2::SvBaseLink::UpdateResult ScDdeLink::DataChanged( if ( FORMAT_STRING != SotExchange::GetFormatIdFromMimeType( rMimeType )) return SUCCESS; - String aLinkStr; + OUString aLinkStr; ScByteSequenceToString::GetString( aLinkStr, rValue, DDE_TXT_ENCODING ); aLinkStr = convertLineEnd(aLinkStr, LINEEND_LF); // wenn String mit Zeilenende aufhoert, streichen: - xub_StrLen nLen = aLinkStr.Len(); - if (nLen && aLinkStr.GetChar(nLen-1) == '\n') - aLinkStr.Erase(nLen-1); + sal_Int32 nLen = aLinkStr.getLength(); + if (nLen && aLinkStr[nLen-1] == '\n') + aLinkStr = aLinkStr.copy(0, nLen-1); String aLine; SCSIZE nCols = 1; // Leerstring -> eine leere Zelle SCSIZE nRows = 1; - if (aLinkStr.Len()) + if (!aLinkStr.isEmpty()) { nRows = static_cast<SCSIZE>(comphelper::string::getTokenCount(aLinkStr, '\n')); - aLine = aLinkStr.GetToken( 0, '\n' ); + aLine = aLinkStr.getToken( 0, '\n' ); if (aLine.Len()) nCols = static_cast<SCSIZE>(comphelper::string::getTokenCount(aLine, '\t')); } @@ -178,7 +178,7 @@ sfx2::SvBaseLink::UpdateResult ScDdeLink::DataChanged( String aEntry; for (SCSIZE nR=0; nR<nRows; nR++) { - aLine = aLinkStr.GetToken( (xub_StrLen) nR, '\n' ); + aLine = aLinkStr.getToken( (sal_Int32) nR, '\n' ); for (SCSIZE nC=0; nC<nCols; nC++) { aEntry = aLine.GetToken( (xub_StrLen) nC, '\t' ); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index ba265810ebcc..a4d0d55ad2cb 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -2413,8 +2413,7 @@ void ScInterpreter::ScCell() else if( aInfoType.EqualsAscii( "ADDRESS" ) ) { // address formatted as [['FILENAME'#]$TABLE.]$COL$ROW sal_uInt16 nFlags = (aCellPos.Tab() == aPos.Tab()) ? (SCA_ABS) : (SCA_ABS_3D); - OUString aStr; - aCellPos.Format( aStr, nFlags, pDok, pDok->GetAddressConvention() ); + OUString aStr(aCellPos.Format(nFlags, pDok, pDok->GetAddressConvention())); PushString(aStr); } else if( aInfoType.EqualsAscii( "FILENAME" ) ) @@ -2448,13 +2447,13 @@ void ScInterpreter::ScCell() { // address, lotus 1-2-3 formatted: $TABLE:$COL$ROW // Yes, passing tab as col is intentional! OUStringBuffer aFuncResult; - OUString aCellStr; + OUString aCellStr = ScAddress( static_cast<SCCOL>(aCellPos.Tab()), 0, 0 ).Format( - aCellStr, (SCA_COL_ABSOLUTE|SCA_VALID_COL), NULL, pDok->GetAddressConvention() ); + (SCA_COL_ABSOLUTE|SCA_VALID_COL), NULL, pDok->GetAddressConvention() ); aFuncResult.append(aCellStr); aFuncResult.append(sal_Unicode(':')); - aCellPos.Format( aCellStr, (SCA_COL_ABSOLUTE|SCA_VALID_COL|SCA_ROW_ABSOLUTE|SCA_VALID_ROW), - NULL, pDok->GetAddressConvention() ); + aCellStr = aCellPos.Format((SCA_COL_ABSOLUTE|SCA_VALID_COL|SCA_ROW_ABSOLUTE|SCA_VALID_ROW), + NULL, pDok->GetAddressConvention()); aFuncResult.append(aCellStr); PushString( aFuncResult.makeStringAndClear() ); } @@ -7352,10 +7351,9 @@ void ScInterpreter::ScAddressFunc() return; } - String aRefStr; const ScAddress::Details aDetails( eConv, aPos ); const ScAddress aAdr( nCol, nRow, 0); - aAdr.Format( aRefStr, nFlags, pDok, aDetails ); + OUString aRefStr(aAdr.Format(nFlags, pDok, aDetails)); if( nParamCount >= 5 && sTabStr.Len() ) { diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 85e9ed0a65e6..02564b7bcc6d 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -2407,17 +2407,17 @@ static bool lcl_GetArabicValue( sal_Unicode cChar, sal_uInt16& rnValue, bool& rb void ScInterpreter::ScArabic() { - String aRoman( GetString() ); + OUString aRoman( GetString() ); if( nGlobalError ) PushError( nGlobalError); else { - aRoman.ToUpperAscii(); + aRoman = aRoman.toAsciiUpperCase(); sal_uInt16 nValue = 0; sal_uInt16 nValidRest = 3999; - sal_uInt16 nCharIndex = 0; - sal_uInt16 nCharCount = aRoman.Len(); + sal_Int32 nCharIndex = 0; + sal_Int32 nCharCount = aRoman.getLength(); bool bValid = true; while( bValid && (nCharIndex < nCharCount) ) @@ -2425,11 +2425,11 @@ void ScInterpreter::ScArabic() sal_uInt16 nDigit1 = 0; sal_uInt16 nDigit2 = 0; bool bIsDec1 = false; - bValid = lcl_GetArabicValue( aRoman.GetChar( nCharIndex ), nDigit1, bIsDec1 ); + bValid = lcl_GetArabicValue( aRoman[nCharIndex], nDigit1, bIsDec1 ); if( bValid && (nCharIndex + 1 < nCharCount) ) { bool bIsDec2 = false; - bValid = lcl_GetArabicValue( aRoman.GetChar( nCharIndex + 1 ), nDigit2, bIsDec2 ); + bValid = lcl_GetArabicValue( aRoman[nCharIndex + 1], nDigit2, bIsDec2 ); } if( bValid ) { diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 4027d6febfe8..8abb3474eee2 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -132,8 +132,7 @@ public: void operator() (const ScRange* p) { - String aStr; - p->Format(aStr, mnFlags, mpDoc, meConv); + OUString aStr(p->Format(mnFlags, mpDoc, meConv)); if (mbFirst) mbFirst = false; else diff --git a/sc/source/core/tool/rangeseq.cxx b/sc/source/core/tool/rangeseq.cxx index db55a3fd1c13..9331a63fd34f 100644 --- a/sc/source/core/tool/rangeseq.cxx +++ b/sc/source/core/tool/rangeseq.cxx @@ -444,14 +444,14 @@ ScMatrixRef ScSequenceToMatrix::CreateMixedMatrix( const com::sun::star::uno::An //------------------------------------------------------------------------ -sal_Bool ScByteSequenceToString::GetString( String& rString, const uno::Any& rAny, +sal_Bool ScByteSequenceToString::GetString( OUString& rString, const uno::Any& rAny, sal_uInt16 nEncoding ) { uno::Sequence<sal_Int8> aSeq; if ( rAny >>= aSeq ) { - rString = String( (const sal_Char*)aSeq.getConstArray(), - (xub_StrLen)aSeq.getLength(), nEncoding ); + rString = OUString( (const sal_Char*)aSeq.getConstArray(), + aSeq.getLength(), nEncoding ); rString = comphelper::string::stripEnd(rString, 0); return sal_True; } diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx index 38305f698c71..93490af4e931 100644 --- a/sc/source/core/tool/rangeutl.cxx +++ b/sc/source/core/tool/rangeutl.cxx @@ -676,8 +676,7 @@ void ScRangeStringConverter::GetStringFromAddress( { if (pDocument && pDocument->HasTable(rAddress.Tab())) { - String sAddress; - rAddress.Format( sAddress, nFormatFlags, (ScDocument*) pDocument, eConv ); + OUString sAddress(rAddress.Format(nFormatFlags, (ScDocument*) pDocument, eConv)); AssignString( rString, sAddress, bAppendStr, cSeparator ); } } @@ -695,10 +694,8 @@ void ScRangeStringConverter::GetStringFromRange( { ScAddress aStartAddress( rRange.aStart ); ScAddress aEndAddress( rRange.aEnd ); - String sStartAddress; - String sEndAddress; - aStartAddress.Format( sStartAddress, nFormatFlags, (ScDocument*) pDocument, eConv ); - aEndAddress.Format( sEndAddress, nFormatFlags, (ScDocument*) pDocument, eConv ); + OUString sStartAddress(aStartAddress.Format(nFormatFlags, (ScDocument*) pDocument, eConv)); + OUString sEndAddress(aEndAddress.Format(nFormatFlags, (ScDocument*) pDocument, eConv)); OUString sOUStartAddress( sStartAddress ); sOUStartAddress += OUString(':'); sOUStartAddress += OUString( sEndAddress ); @@ -811,14 +808,12 @@ static void lcl_appendCellAddress( ScRangeStringConverter::AppendTableName(rBuf, rExtInfo.maTabName); rBuf.append(sal_Unicode('.')); - String aAddr; - rCell.Format(aAddr, SCA_ABS, NULL, pDoc->GetAddressConvention()); + OUString aAddr(rCell.Format(SCA_ABS, NULL, pDoc->GetAddressConvention())); rBuf.append(aAddr); } else { - String aAddr; - rCell.Format(aAddr, SCA_ABS_3D, pDoc, pDoc->GetAddressConvention()); + OUString aAddr(rCell.Format(SCA_ABS_3D, pDoc, pDoc->GetAddressConvention())); rBuf.append(aAddr); } } @@ -846,8 +841,7 @@ static void lcl_appendCellRangeAddress( ScRangeStringConverter::AppendTableName(rBuf, rExtInfo1.maTabName); rBuf.append(sal_Unicode('.')); - String aAddr; - rCell1.Format(aAddr, SCA_ABS, NULL, pDoc->GetAddressConvention()); + OUString aAddr(rCell1.Format(SCA_ABS, NULL, pDoc->GetAddressConvention())); rBuf.append(aAddr); rBuf.appendAscii(":"); @@ -859,7 +853,7 @@ static void lcl_appendCellRangeAddress( rBuf.append(sal_Unicode('.')); } - rCell2.Format(aAddr, SCA_ABS, NULL, pDoc->GetAddressConvention()); + aAddr = rCell2.Format(SCA_ABS, NULL, pDoc->GetAddressConvention()); rBuf.append(aAddr); } else @@ -867,8 +861,7 @@ static void lcl_appendCellRangeAddress( ScRange aRange; aRange.aStart = rCell1; aRange.aEnd = rCell2; - String aAddr; - aRange.Format(aAddr, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention()); + OUString aAddr(aRange.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention())); rBuf.append(aAddr); } } diff --git a/sc/source/core/tool/reffind.cxx b/sc/source/core/tool/reffind.cxx index 8b5b863b8e8f..8c0fe9224891 100644 --- a/sc/source/core/tool/reffind.cxx +++ b/sc/source/core/tool/reffind.cxx @@ -270,7 +270,7 @@ void ScRefFinder::ToggleRel( sal_Int32 nStartPos, sal_Int32 nEndPos ) if ( nResult & SCA_VALID ) { sal_uInt16 nFlags = lcl_NextFlags( nResult ); - aAddr.Format(aExpr, nFlags, mpDoc, aDetails); + aExpr = aAddr.Format(nFlags, mpDoc, aDetails); sal_Int32 nAbsStart = nStartPos+aResult.getLength()+aSep.getLength(); diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index ca472a6d665f..14611613b1a8 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -386,8 +386,7 @@ sal_uInt16 XclExpNameManagerImpl::InsertBuiltInName( sal_Unicode cBuiltIn, XclTo XclExpNameRef xName( new XclExpName( GetRoot(), cBuiltIn ) ); xName->SetTokenArray( xTokArr ); xName->SetLocalTab( aRange.aStart.Tab() ); - String sSymbol; - aRange.Format( sSymbol, SCR_ABS_3D, GetDocPtr(), ScAddress::Details( ::formula::FormulaGrammar::CONV_XL_A1 ) ); + OUString sSymbol(aRange.Format(SCR_ABS_3D, GetDocPtr(), ScAddress::Details( ::formula::FormulaGrammar::CONV_XL_A1))); xName->SetSymbol( sSymbol ); return Append( xName ); } diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 16576b6dfcf1..06b58ab5a171 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -751,8 +751,7 @@ OString XclXmlUtils::ToOString( const String& s ) OString XclXmlUtils::ToOString( const ScAddress& rAddress ) { - String sAddress; - rAddress.Format( sAddress, SCA_VALID, NULL, ScAddress::Details( FormulaGrammar::CONV_XL_A1 ) ); + OUString sAddress(rAddress.Format(SCA_VALID, NULL, ScAddress::Details( FormulaGrammar::CONV_XL_A1))); return ToOString( sAddress ); } @@ -764,15 +763,14 @@ OString XclXmlUtils::ToOString( const ScfUInt16Vec& rBuffer ) OString XclXmlUtils::ToOString( const ScRange& rRange ) { - String sRange; - rRange.Format( sRange, SCA_VALID, NULL, ScAddress::Details( FormulaGrammar::CONV_XL_A1 ) ); + OUString sRange(rRange.Format(SCA_VALID, NULL, ScAddress::Details( FormulaGrammar::CONV_XL_A1))); return ToOString( sRange ); } OString XclXmlUtils::ToOString( const ScRangeList& rRangeList ) { String s; - rRangeList.Format( s, SCA_VALID, NULL, FormulaGrammar::CONV_XL_A1, ' ' ); + rRangeList.Format(s, SCA_VALID, NULL, FormulaGrammar::CONV_XL_A1, ' '); return ToOString( s ); } diff --git a/sc/source/ui/Accessibility/AccessibleCellBase.cxx b/sc/source/ui/Accessibility/AccessibleCellBase.cxx index 39e70a03ffad..0d6f431c08b3 100644 --- a/sc/source/ui/Accessibility/AccessibleCellBase.cxx +++ b/sc/source/ui/Accessibility/AccessibleCellBase.cxx @@ -213,10 +213,9 @@ OUString SAL_CALL throw (uno::RuntimeException) { String sName( ScResId(STR_ACC_CELL_NAME) ); - String sAddress; // Document not needed, because only the cell address, but not the tablename is needed // always us OOO notation - maCellAddress.Format( sAddress, SCA_VALID, NULL ); + OUString sAddress(maCellAddress.Format(SCA_VALID, NULL)); sName.SearchAndReplaceAscii("%1", sAddress); /* #i65103# ZoomText merges cell address and contents, e.g. if value 2 is contained in cell A1, ZT reads "cell A twelve" instead of "cell A1 - 2". diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index b38c63964acd..3e858224e6a6 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -2087,9 +2087,8 @@ OUString ScAccessibleDocument::GetCurrentCellName() const String sName( ScResId(STR_ACC_CELL_NAME) ); if (mpViewShell) { - String sAddress; // Document not needed, because only the cell address, but not the tablename is needed - mpViewShell->GetViewData()->GetCurPos().Format( sAddress, SCA_VALID, NULL ); + OUString sAddress(mpViewShell->GetViewData()->GetCurPos().Format(SCA_VALID, NULL)); sName.SearchAndReplaceAscii("%1", sAddress); } return OUString(sName); diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx index 74fefb455a0c..a2fce10ae39a 100644 --- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx @@ -178,7 +178,7 @@ sal_Int32 ScNotesChildren::AddNotes(const ScPreviewLocationData& rData, const Re if (bMark) { // Document not needed, because only the cell address, but not the tablename is needed - aNote.maNoteCell.Format( aNote.maNoteText, SCA_VALID, NULL ); + aNote.maNoteText = aNote.maNoteCell.Format(SCA_VALID, NULL); } else { @@ -355,7 +355,7 @@ sal_Int32 ScNotesChildren::CheckChanges(const ScPreviewLocationData& rData, if (bMark) { // Document not needed, because only the cell address, but not the tablename is needed - aNote.maNoteCell.Format( aNote.maNoteText, SCA_VALID, NULL ); + aNote.maNoteText = aNote.maNoteCell.Format(SCA_VALID, NULL); } else { diff --git a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx index 20d2c8612114..d0c809d446ae 100644 --- a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx @@ -58,8 +58,7 @@ OUString lclCreateMultiParameterFormula( OUString aResult; for (size_t i = 0; i < aRangeList.size(); i++) { - OUString aRangeString; - aRangeList[i]->Format( aRangeString, SCR_ABS, pDocument, aAddressDetails ); + OUString aRangeString(aRangeList[i]->Format(SCR_ABS, pDocument, aAddressDetails)); OUString aFormulaString = aFormulaTemplate.replaceAll(aWildcard, aRangeString); aResult += aFormulaString; if(i != aRangeList.size() - 1) // Not Last @@ -138,7 +137,7 @@ void ScAnalysisOfVarianceDialog::CalculateInputAndWriteToOutput( ) ); aRangeList.Append(aColumnRange); - aColumnRange.Format( aReferenceString, SCR_ABS, mDocument, mAddressDetails ); + aReferenceString = aColumnRange.Format(SCR_ABS, mDocument, mAddressDetails); OUString aFormulaString; OUString aFormulaTemplate; @@ -176,12 +175,10 @@ void ScAnalysisOfVarianceDialog::CalculateInputAndWriteToOutput( ) // Sum of Squares aAddress = ScAddress(outCol, outRow, outTab); - OUString aReferenceTotal; - OUString aReferenceWithin; ScAddress aAddressTotal(outCol, outRow+2, outTab); - aAddressTotal.Format( aReferenceTotal, SCR_ABS, mDocument, mAddressDetails ); + OUString aReferenceTotal(aAddressTotal.Format(SCR_ABS, mDocument, mAddressDetails)); ScAddress aAddressWithin(outCol, outRow+1, outTab); - aAddressWithin.Format( aReferenceWithin, SCR_ABS, mDocument, mAddressDetails ); + OUString aReferenceWithin(aAddressWithin.Format(SCR_ABS, mDocument, mAddressDetails)); OUString aFormulaString = "=" + aReferenceTotal + "-" + aReferenceWithin; pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, aFormulaString), true); outCol++; @@ -189,18 +186,16 @@ void ScAnalysisOfVarianceDialog::CalculateInputAndWriteToOutput( ) // Degree of freedom aAddress = ScAddress(outCol, outRow, outTab); aAddressTotal = ScAddress(outCol, outRow+2, outTab); - aAddressTotal.Format( aReferenceTotal, SCR_ABS, mDocument, mAddressDetails ); + aReferenceTotal = aAddressTotal.Format(SCR_ABS, mDocument, mAddressDetails); aAddressWithin = ScAddress(outCol, outRow+1, outTab); - aAddressWithin.Format( aReferenceWithin, SCR_ABS, mDocument, mAddressDetails ); + aReferenceWithin = aAddressWithin.Format(SCR_ABS, mDocument, mAddressDetails); aFormulaString = "=" + aReferenceTotal + "-" + aReferenceWithin; pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, aFormulaString), true); outCol++; // MS - OUString aSSRef; - ScAddress(outCol-2, outRow, outTab).Format( aSSRef, SCR_ABS, mDocument, mAddressDetails ); - OUString aDFRef; - ScAddress(outCol-1, outRow, outTab).Format( aDFRef, SCR_ABS, mDocument, mAddressDetails ); + OUString aSSRef(ScAddress(outCol-2, outRow, outTab).Format(SCR_ABS, mDocument, mAddressDetails)); + OUString aDFRef(ScAddress(outCol-1, outRow, outTab).Format(SCR_ABS, mDocument, mAddressDetails)); aFormulaString = "=" + aSSRef + "/" + aDFRef; aAddress = ScAddress(outCol, outRow, outTab); pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, aFormulaString), true); @@ -208,22 +203,17 @@ void ScAnalysisOfVarianceDialog::CalculateInputAndWriteToOutput( ) // F aAddress = ScAddress(outCol, outRow, outTab); - OUString aMSBetween; - ScAddress(outCol-1, outRow, outTab).Format( aMSBetween, SCR_ABS, mDocument, mAddressDetails ); - OUString aMSWithin; - ScAddress(outCol-1, outRow+1, outTab).Format( aMSWithin, SCR_ABS, mDocument, mAddressDetails ); + OUString aMSBetween(ScAddress(outCol-1, outRow, outTab).Format(SCR_ABS, mDocument, mAddressDetails)); + OUString aMSWithin(ScAddress(outCol-1, outRow+1, outTab).Format(SCR_ABS, mDocument, mAddressDetails)); aFormulaString = "=" + aMSBetween + "/" + aMSWithin; pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, aFormulaString), true); outCol++; // P-value aAddress = ScAddress(outCol, outRow, outTab); - OUString aFValue; - ScAddress(outCol-1, outRow, outTab).Format( aFValue, SCR_ABS, mDocument, mAddressDetails ); - OUString aDFBetween; - ScAddress(outCol-3, outRow, outTab).Format( aDFBetween, SCR_ABS, mDocument, mAddressDetails ); - OUString aDFWithin; - ScAddress(outCol-3, outRow+1, outTab).Format( aDFWithin, SCR_ABS, mDocument, mAddressDetails ); + OUString aFValue(ScAddress(outCol-1, outRow, outTab).Format(SCR_ABS, mDocument, mAddressDetails)); + OUString aDFBetween(ScAddress(outCol-3, outRow, outTab).Format(SCR_ABS, mDocument, mAddressDetails)); + OUString aDFWithin(ScAddress(outCol-3, outRow+1, outTab).Format(SCR_ABS, mDocument, mAddressDetails)); aFormulaString = "=FDIST("+ aFValue + ";" + aDFBetween + ";" + aDFWithin + ")"; pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, aFormulaString), true); outCol++; @@ -265,12 +255,10 @@ void ScAnalysisOfVarianceDialog::CalculateInputAndWriteToOutput( ) outCol++; // MS - OUString aSSRef; - OUString aDFRef; ScAddress aAddressSS(outCol-2, outRow, outTab); - aAddressSS.Format( aSSRef, SCR_ABS, mDocument, mAddressDetails ); + OUString aSSRef(aAddressSS.Format(SCR_ABS, mDocument, mAddressDetails)); ScAddress aAddressDF(outCol-1, outRow, outTab); - aAddressDF.Format( aDFRef, SCR_ABS, mDocument, mAddressDetails ); + OUString aDFRef(aAddressDF.Format(SCR_ABS, mDocument, mAddressDetails)); OUString aFormulaString = "=" + aSSRef + "/" + aDFRef; aAddress = ScAddress(outCol, outRow, outTab); pDocShell->GetDocFunc().SetFormulaCell(aAddress, new ScFormulaCell(mDocument, aAddress, aFormulaString), true); diff --git a/sc/source/ui/StatisticsDialogs/CorrelationDialog.cxx b/sc/source/ui/StatisticsDialogs/CorrelationDialog.cxx index 9f26c8c8eec4..780804ddbcbe 100644 --- a/sc/source/ui/StatisticsDialogs/CorrelationDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/CorrelationDialog.cxx @@ -126,8 +126,6 @@ void ScCorrelationDialog::CalculateInputAndWriteToOutput( ) void ScCorrelationDialog::WriteCorrelationFormulas(ScAddress aOutputAddress, ScRangeList aRangeList) { ScDocShell* pDocShell = mViewData->GetDocShell(); - OUString aColumnString1; - OUString aColumnString2; ScAddress aAddress; SCTAB outTab = aOutputAddress.Tab(); @@ -142,8 +140,8 @@ void ScCorrelationDialog::WriteCorrelationFormulas(ScAddress aOutputAddress, ScR { if (j >= i) { - aRangeList[i]->Format( aColumnString1, SCR_ABS, mDocument, mAddressDetails ); - aRangeList[j]->Format( aColumnString2, SCR_ABS, mDocument, mAddressDetails ); + OUString aColumnString1(aRangeList[i]->Format(SCR_ABS, mDocument, mAddressDetails)); + OUString aColumnString2(aRangeList[j]->Format(SCR_ABS, mDocument, mAddressDetails)); aAddress = ScAddress(outCol, outRow, outTab); aFormulaString = lclCorrelTemplate.replaceAll(lclWildcardColumn1, aColumnString1); diff --git a/sc/source/ui/StatisticsDialogs/CovarianceDialog.cxx b/sc/source/ui/StatisticsDialogs/CovarianceDialog.cxx index 94a62da7f7e2..b72e569ded24 100644 --- a/sc/source/ui/StatisticsDialogs/CovarianceDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/CovarianceDialog.cxx @@ -126,8 +126,6 @@ void ScCovarianceDialog::CalculateInputAndWriteToOutput( ) void ScCovarianceDialog::WriteCovarianceFormulas(ScAddress aOutputAddress, ScRangeList aRangeList) { ScDocShell* pDocShell = mViewData->GetDocShell(); - OUString aRowString1; - OUString aRowString2; ScAddress aAddress; SCTAB outTab = aOutputAddress.Tab(); @@ -142,8 +140,8 @@ void ScCovarianceDialog::WriteCovarianceFormulas(ScAddress aOutputAddress, ScRan { if (j >= i) { - aRangeList[i]->Format( aRowString1, SCR_ABS, mDocument, mAddressDetails ); - aRangeList[j]->Format( aRowString2, SCR_ABS, mDocument, mAddressDetails ); + OUString aRowString1(aRangeList[i]->Format(SCR_ABS, mDocument, mAddressDetails)); + OUString aRowString2(aRangeList[j]->Format(SCR_ABS, mDocument, mAddressDetails)); aAddress = ScAddress(outCol, outRow, outTab); aFormulaString = lclCovarTemplate.replaceAll(lclWildcardRow1, aRowString1); diff --git a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx index b4d89157a00e..f6ae015af70f 100644 --- a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx @@ -113,7 +113,7 @@ void ScDescriptiveStatisticsDialog::CalculateInputAndWriteToOutput( ) ScAddress(inCol, mInputRange.aEnd.Row(), inTab) ); - aColumnRange.Format( aReferenceString, SCR_ABS, mDocument, mAddressDetails ); + aReferenceString = aColumnRange.Format(SCR_ABS, mDocument, mAddressDetails); OUString aFormulaString; OUString aFormulaTemplate; diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx index 779252e9bdfe..917b2965e698 100644 --- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx @@ -116,9 +116,8 @@ void ScRandomNumberGeneratorDialog::Init() void ScRandomNumberGeneratorDialog::GetRangeFromSelection() { - OUString aCurrentString; mViewData->GetSimpleArea(mInputRange); - mInputRange.Format( aCurrentString, SCR_ABS_3D, mDocument, mAddressDetails ); + OUString aCurrentString(mInputRange.Format(SCR_ABS_3D, mDocument, mAddressDetails)); mpInputRangeEdit->SetText( aCurrentString ); } @@ -154,8 +153,7 @@ void ScRandomNumberGeneratorDialog::SetReference( const ScRange& rReferenceRange mInputRange = rReferenceRange; - String aReferenceString; - mInputRange.Format( aReferenceString, SCR_ABS_3D, pDocument, mAddressDetails ); + OUString aReferenceString(mInputRange.Format(SCR_ABS_3D, pDocument, mAddressDetails)); mpInputRangeEdit->SetRefString( aReferenceString ); } } diff --git a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx index 841f3fc51663..20608bbb6e24 100644 --- a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx @@ -101,9 +101,8 @@ void ScSamplingDialog::Init() void ScSamplingDialog::GetRangeFromSelection() { - OUString aCurrentString; mViewData->GetSimpleArea(mInputRange); - mInputRange.Format(aCurrentString, SCR_ABS_3D, mDocument, mAddressDetails); + OUString aCurrentString(mInputRange.Format(SCR_ABS_3D, mDocument, mAddressDetails)); mpInputRangeEdit->SetText(aCurrentString); } @@ -142,7 +141,7 @@ void ScSamplingDialog::SetReference( const ScRange& rReferenceRange, ScDocument* if ( mpActiveEdit == mpInputRangeEdit ) { mInputRange = rReferenceRange; - mInputRange.Format( aReferenceString, SCR_ABS_3D, pDocument, mAddressDetails ); + aReferenceString = mInputRange.Format(SCR_ABS_3D, pDocument, mAddressDetails); mpInputRangeEdit->SetRefString( aReferenceString ); } else if ( mpActiveEdit == mpOutputRangeEdit ) @@ -150,7 +149,7 @@ void ScSamplingDialog::SetReference( const ScRange& rReferenceRange, ScDocument* mOutputAddress = rReferenceRange.aStart; sal_uInt16 nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ? SCA_ABS : SCA_ABS_3D; - mOutputAddress.Format( aReferenceString, nFormat, pDocument, pDocument->GetAddressConvention() ); + aReferenceString = mOutputAddress.Format(nFormat, pDocument, pDocument->GetAddressConvention()); mpOutputRangeEdit->SetRefString( aReferenceString ); // Change sampling size according to output range selection diff --git a/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx b/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx index 7d868705192f..ff431d7cf677 100644 --- a/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx @@ -111,9 +111,8 @@ void ScStatisticsInputOutputDialog::Init() void ScStatisticsInputOutputDialog::GetRangeFromSelection() { - OUString aCurrentString; mViewData->GetSimpleArea(mInputRange); - mInputRange.Format(aCurrentString, SCR_ABS_3D, mDocument, mAddressDetails); + OUString aCurrentString(mInputRange.Format(SCR_ABS_3D, mDocument, mAddressDetails)); mpInputRangeEdit->SetText(aCurrentString); } @@ -139,12 +138,12 @@ void ScStatisticsInputOutputDialog::SetReference( const ScRange& rReferenceRange if ( rReferenceRange.aStart != rReferenceRange.aEnd ) RefInputStart( mpActiveEdit ); - String aReferenceString; + OUString aReferenceString; if ( mpActiveEdit == mpInputRangeEdit ) { mInputRange = rReferenceRange; - mInputRange.Format( aReferenceString, SCR_ABS_3D, pDocument, mAddressDetails ); + aReferenceString = mInputRange.Format(SCR_ABS_3D, pDocument, mAddressDetails); mpInputRangeEdit->SetRefString( aReferenceString ); } else if ( mpActiveEdit == mpOutputRangeEdit ) @@ -152,7 +151,7 @@ void ScStatisticsInputOutputDialog::SetReference( const ScRange& rReferenceRange mOutputAddress = rReferenceRange.aStart; sal_uInt16 nFormat = ( mOutputAddress.Tab() == mCurrentAddress.Tab() ) ? SCA_ABS : SCA_ABS_3D; - mOutputAddress.Format( aReferenceString, nFormat, pDocument, pDocument->GetAddressConvention() ); + aReferenceString = mOutputAddress.Format(nFormat, pDocument, pDocument->GetAddressConvention()); mpOutputRangeEdit->SetRefString( aReferenceString ); // Enable OK, Cancel if output range is set diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 436991f49cc0..42cbbb19294d 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -331,10 +331,9 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew ) ScRange aJustified = rNew; aJustified.Justify(); // Ref in der Formel immer richtigherum anzeigen - String aNewStr; ScDocument* pDoc = pDocView->GetViewData()->GetDocument(); const ScAddress::Details aAddrDetails( pDoc, aCursorPos ); - aJustified.Format( aNewStr, pData->nFlags, pDoc, aAddrDetails ); + String aNewStr(aJustified.Format(pData->nFlags, pDoc, aAddrDetails)); ESelection aOldSel( 0, nOldStart, 0, nOldEnd ); DataChanging(); @@ -2967,8 +2966,7 @@ void ScInputHandler::SetReference( const ScRange& rRef, ScDocument* pDoc ) OSL_ENSURE(rRef.aStart.Tab()==rRef.aEnd.Tab(), "nStartTab!=nEndTab"); - String aTmp; - rRef.Format( aTmp, SCA_VALID|SCA_TAB_3D, pDoc, aAddrDetails ); // immer 3d + String aTmp(rRef.Format(SCA_VALID|SCA_TAB_3D, pDoc, aAddrDetails)); // immer 3d SfxObjectShell* pObjSh = pDoc->GetDocumentShell(); // #i75893# convert escaped URL of the document to something user friendly @@ -2983,9 +2981,9 @@ void ScInputHandler::SetReference( const ScRange& rRef, ScDocument* pDoc ) { if ( ( rRef.aStart.Tab() != aCursorPos.Tab() || rRef.aStart.Tab() != rRef.aEnd.Tab() ) && pDoc ) - rRef.Format( aRefStr, SCA_VALID|SCA_TAB_3D, pDoc, aAddrDetails ); + aRefStr = rRef.Format(SCA_VALID|SCA_TAB_3D, pDoc, aAddrDetails); else - rRef.Format( aRefStr, SCA_VALID, pDoc, aAddrDetails ); + aRefStr = rRef.Format(SCA_VALID, pDoc, aAddrDetails); } if (pTableView || pTopView) @@ -3573,10 +3571,10 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState, { ScRange r(rSPos, rEPos); nFlags |= (nFlags << 4); - r.Format( aPosStr, SCA_VALID | nFlags, pDoc, aAddrDetails ); + aPosStr = r.Format(SCA_VALID | nFlags, pDoc, aAddrDetails); } else - aCursorPos.Format( aPosStr, SCA_VALID | nFlags, pDoc, aAddrDetails ); + aPosStr = aCursorPos.Format(SCA_VALID | nFlags, pDoc, aAddrDetails); } // Disable the accessible VALUE_CHANGE event diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 4fb2ad7f01bc..8c1de6035cc7 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -2393,8 +2393,7 @@ void ScPosWnd::DoEnter() { ScRangeName aNewRanges( *pNames ); ScAddress aCursor( pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo() ); - String aContent; - aSelection.Format( aContent, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() ); + OUString aContent(aSelection.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention())); ScRangeData* pNew = new ScRangeData( pDoc, aText, aContent, aCursor ); if ( aNewRanges.insert(pNew) ) { @@ -2420,7 +2419,7 @@ void ScPosWnd::DoEnter() // be in Calc A1 format. Convert the text. ScRange aRange(0,0,pViewData->GetTabNo()); aRange.ParseAny(aText, pDoc, pDoc->GetAddressConvention()); - aRange.Format(aText, SCR_ABS_3D, pDoc, ::formula::FormulaGrammar::CONV_OOO); + aText = aRange.Format(SCR_ABS_3D, pDoc, ::formula::FormulaGrammar::CONV_OOO); } SfxStringItem aPosItem( SID_CURRENTCELL, aText ); diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index bfea6e0bcec6..907c1b629472 100644 --- a/sc/source/ui/condformat/condformatdlg.cxx +++ b/sc/source/ui/condformat/condformatdlg.cxx @@ -436,14 +436,13 @@ void ScCondFormatDlg::SetReference(const ScRange& rRef, ScDocument*) if(rRef.aStart != rRef.aEnd) RefInputStart(pEdit); - OUString aRefStr; sal_uInt16 n = 0; if(mpLastEdit && mpLastEdit != &maEdRange) n = ABS_DREF3D; else n = ABS_DREF; - rRef.Format( aRefStr, n, mpDoc, ScAddress::Details(mpDoc->GetAddressConvention(), 0, 0) ); + OUString aRefStr(rRef.Format(n, mpDoc, ScAddress::Details(mpDoc->GetAddressConvention(), 0, 0))); pEdit->SetRefString( aRefStr ); } } diff --git a/sc/source/ui/dbgui/consdlg.cxx b/sc/source/ui/dbgui/consdlg.cxx index 558d68ecfebd..d6c2985398a6 100644 --- a/sc/source/ui/dbgui/consdlg.cxx +++ b/sc/source/ui/dbgui/consdlg.cxx @@ -172,8 +172,8 @@ void ScConsolidateDlg::Init() const ScArea& rArea = *(theConsData.ppDataAreas[i] ); if ( rArea.nTab < pDoc->GetTableCount() ) { - ScRange( rArea.nColStart, rArea.nRowStart, rArea.nTab, - rArea.nColEnd, rArea.nRowEnd, rArea.nTab ).Format( aStr, + aStr = ScRange( rArea.nColStart, rArea.nRowStart, rArea.nTab, + rArea.nColEnd, rArea.nRowEnd, rArea.nTab ).Format( SCR_ABS_3D, pDoc, eConv ); pLbConsAreas->InsertEntry( aStr ); } @@ -181,12 +181,12 @@ void ScConsolidateDlg::Init() if ( theConsData.nTab < pDoc->GetTableCount() ) { - ScAddress( theConsData.nCol, theConsData.nRow, theConsData.nTab - ).Format( aStr, SCA_ABS_3D, pDoc, eConv ); + aStr = ScAddress( theConsData.nCol, theConsData.nRow, theConsData.nTab + ).Format( SCA_ABS_3D, pDoc, eConv ); pEdDestArea->SetText( aStr ); } else - pEdDestArea->SetText( EMPTY_STRING ); + pEdDestArea->SetText(OUString()); //---------------------------------------------------------- @@ -209,13 +209,12 @@ void ScConsolidateDlg::Init() pAreaData = new ScAreaData[nAreaDataCount]; String aStrName; - String aStrArea; sal_uInt16 nAt = 0; ScRange aRange; ScAreaNameIterator aIter( pDoc ); while ( aIter.Next( aStrName, aRange ) ) { - aRange.Format( aStrArea, SCA_ABS_3D, pDoc, eConv ); + String aStrArea(aRange.Format(SCA_ABS_3D, pDoc, eConv)); pAreaData[nAt++].Set( aStrName, aStrArea, aIter.WasDBName() ); } } @@ -223,7 +222,7 @@ void ScConsolidateDlg::Init() FillAreaLists(); ModifyHdl( pEdDestArea ); pLbDataArea->SelectEntryPos( 0 ); - pEdDataArea->SetText( EMPTY_STRING ); + pEdDataArea->SetText(OUString()); pEdDataArea->GrabFocus(); //aFlSep.SetStyle( aFlSep.GetStyle() | WB_VERT ); @@ -276,9 +275,9 @@ void ScConsolidateDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) nFmt |= SCA_TAB2_3D; if ( pRefInputEdit == pEdDataArea) - rRef.Format( aStr, nFmt, pDocP, eConv ); + aStr = rRef.Format(nFmt, pDocP, eConv); else if ( pRefInputEdit == pEdDestArea ) - rRef.aStart.Format( aStr, nFmt, pDocP, eConv ); + aStr = rRef.aStart.Format(nFmt, pDocP, eConv); pRefInputEdit->SetRefString( aStr ); } @@ -471,9 +470,9 @@ IMPL_LINK( ScConsolidateDlg, ClickHdl, PushButton*, pBtn ) if ( ppAreas[i] ) { const ScArea& rArea = *(ppAreas[i]); - ScRange( rArea.nColStart, rArea.nRowStart, rArea.nTab, + aNewArea = ScRange( rArea.nColStart, rArea.nRowStart, rArea.nTab, rArea.nColEnd, rArea.nRowEnd, rArea.nTab - ).Format( aNewArea, SCR_ABS_3D, pDoc, eConv ); + ).Format(SCR_ABS_3D, pDoc, eConv); if ( pLbConsAreas->GetEntryPos( aNewArea ) == LISTBOX_ENTRY_NOTFOUND ) diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx index e46ffc430dd2..1035ed033507 100644 --- a/sc/source/ui/dbgui/dbnamdlg.cxx +++ b/sc/source/ui/dbgui/dbnamdlg.cxx @@ -202,7 +202,7 @@ void ScDbNameDlg::Init() theCurArea = ScRange( ScAddress( nStartCol, nStartRow, nStartTab ), ScAddress( nEndCol, nEndRow, nEndTab ) ); - theCurArea.Format( theAreaStr, ABS_DREF3D, pDoc, aAddrDetails ); + theAreaStr = theCurArea.Format(ABS_DREF3D, pDoc, aAddrDetails); if ( pDBColl ) { @@ -279,8 +279,7 @@ void ScDbNameDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) theCurArea = rRef; - String aRefStr; - theCurArea.Format( aRefStr, ABS_DREF3D, pDocP, aAddrDetails ); + OUString aRefStr(theCurArea.Format(ABS_DREF3D, pDocP, aAddrDetails)); m_pEdAssign->SetRefString( aRefStr ); m_pOptions->Enable(); m_pBtnAdd->Enable(); @@ -358,8 +357,7 @@ void ScDbNameDlg::UpdateDBData( const String& rStrName ) pData->GetArea( nTab, nColStart, nRowStart, nColEnd, nRowEnd ); theCurArea = ScRange( ScAddress( nColStart, nRowStart, nTab ), ScAddress( nColEnd, nRowEnd, nTab ) ); - OUString theArea; - theCurArea.Format( theArea, ABS_DREF3D, pDoc, aAddrDetails ); + OUString theArea(theCurArea.Format(ABS_DREF3D, pDoc, aAddrDetails)); m_pEdAssign->SetText( theArea ); m_pBtnAdd->SetText( aStrModify ); m_pBtnHeader->Check( pData->HasHeader() ); diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 0b7b8f07b587..bc68214a63be 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -409,8 +409,7 @@ void ScFilterDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) { if ( rRef.aStart != rRef.aEnd ) RefInputStart( pEdCopyArea ); - OUString aRefStr; - rRef.aStart.Format( aRefStr, SCA_ABS_3D, pDocP, pDocP->GetAddressConvention() ); + OUString aRefStr(rRef.aStart.Format(SCA_ABS_3D, pDocP, pDocP->GetAddressConvention())); pEdCopyArea->SetRefString( aRefStr ); } } diff --git a/sc/source/ui/dbgui/foptmgr.cxx b/sc/source/ui/dbgui/foptmgr.cxx index abf1faacd4f2..362f818d9592 100644 --- a/sc/source/ui/dbgui/foptmgr.cxx +++ b/sc/source/ui/dbgui/foptmgr.cxx @@ -111,7 +111,7 @@ void ScFilterOptionsMgr::Init() OUString theDbName(STR_DB_LOCAL_NONAME); const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); - theCurArea.Format( theAreaStr, SCR_ABS_3D, pDoc, eConv ); + theAreaStr = theCurArea.Format(SCR_ABS_3D, pDoc, eConv); // Zielbereichsliste fuellen @@ -121,12 +121,11 @@ void ScFilterOptionsMgr::Init() ScAreaNameIterator aIter( pDoc ); String aName; ScRange aRange; - String aRefStr; while ( aIter.Next( aName, aRange ) ) { sal_uInt16 nInsert = pLbCopyArea->InsertEntry( aName ); - aRange.aStart.Format( aRefStr, SCA_ABS_3D, pDoc, eConv ); + OUString aRefStr(aRange.aStart.Format(SCA_ABS_3D, pDoc, eConv)); pLbCopyArea->SetEntryData( nInsert, new String( aRefStr ) ); } @@ -177,12 +176,11 @@ void ScFilterOptionsMgr::Init() if ( !rQueryData.bInplace ) { - String aString; - - ScAddress( rQueryData.nDestCol, - rQueryData.nDestRow, - rQueryData.nDestTab - ).Format( aString, SCA_ABS_3D, pDoc, eConv ); + OUString aString = + ScAddress( rQueryData.nDestCol, + rQueryData.nDestRow, + rQueryData.nDestTab + ).Format(SCA_ABS_3D, pDoc, eConv); pBtnCopyResult->Check( sal_True ); pEdCopyArea->SetText( aString ); diff --git a/sc/source/ui/dbgui/pfiltdlg.cxx b/sc/source/ui/dbgui/pfiltdlg.cxx index 3f5f63e899a1..3adaf16789e3 100644 --- a/sc/source/ui/dbgui/pfiltdlg.cxx +++ b/sc/source/ui/dbgui/pfiltdlg.cxx @@ -153,7 +153,6 @@ void ScPivotFilterDlg::Init( const SfxItemSet& rArgSet ) if ( pViewData && pDoc ) { - OUString theAreaStr; ScRange theCurArea ( ScAddress( theQueryData.nCol1, theQueryData.nRow1, nSrcTab ), @@ -168,7 +167,7 @@ void ScPivotFilterDlg::Init( const SfxItemSet& rArgSet ) * Bereich um einen Datenbankbereich handelt: */ - theCurArea.Format( theAreaStr, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() ); + OUString theAreaStr(theCurArea.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention())); if ( pDBColl ) { diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx index 79178c9f3e85..4c30cb1ca71a 100644 --- a/sc/source/ui/dbgui/pvlaydlg.cxx +++ b/sc/source/ui/dbgui/pvlaydlg.cxx @@ -179,9 +179,8 @@ ScPivotLayoutDlg::ScPivotLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window maEdInPos.SetText(aRangeName); else { - OUString aStr; maOldRange = p->GetSourceRange(); - maOldRange.Format(aStr, SCR_ABS_3D, mpDoc, mpDoc->GetAddressConvention()); + OUString aStr(maOldRange.Format(SCR_ABS_3D, mpDoc, mpDoc->GetAddressConvention())); maEdInPos.SetText(aStr); } } @@ -221,14 +220,13 @@ ScPivotLayoutDlg::ScPivotLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window ScAreaNameIterator aIter( mpDoc ); OUString aName; ScRange aRange; - OUString aRefStr; while ( aIter.Next( aName, aRange ) ) { if ( !aIter.WasDBName() ) // hier keine DB-Bereiche ! { sal_uInt16 nInsert = maLbOutPos.InsertEntry( aName ); - aRange.aStart.Format( aRefStr, SCA_ABS_3D, mpDoc, mpDoc->GetAddressConvention() ); + OUString aRefStr(aRange.aStart.Format(SCA_ABS_3D, mpDoc, mpDoc->GetAddressConvention())); maRefStrs.push_back(new OUString(aRefStr)); maLbOutPos.SetEntryData(nInsert, &maRefStrs.back()); } @@ -248,10 +246,10 @@ ScPivotLayoutDlg::ScPivotLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window if ( maPivotData.nTab != MAXTAB+1 ) { - OUString aStr; - ScAddress( maPivotData.nCol, - maPivotData.nRow, - maPivotData.nTab ).Format( aStr, STD_FORMAT, mpDoc, mpDoc->GetAddressConvention() ); + OUString aStr = + ScAddress( maPivotData.nCol, + maPivotData.nRow, + maPivotData.nTab ).Format(STD_FORMAT, mpDoc, mpDoc->GetAddressConvention()); maEdOutPos.SetText( aStr ); maOutputRefStr = aStr; EdOutModifyHdl(0); @@ -1470,14 +1468,12 @@ void ScPivotLayoutDlg::SetReference( const ScRange& rRef, ScDocument* pDoc ) if (mpRefInputEdit == &maEdInPos) { - OUString aRefStr; - rRef.Format( aRefStr, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() ); + OUString aRefStr(rRef.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention())); mpRefInputEdit->SetRefString(aRefStr); } else if (mpRefInputEdit == &maEdOutPos) { - OUString aRefStr; - rRef.aStart.Format( aRefStr, STD_FORMAT, pDoc, pDoc->GetAddressConvention() ); + OUString aRefStr(rRef.aStart.Format(STD_FORMAT, pDoc, pDoc->GetAddressConvention())); mpRefInputEdit->SetRefString(aRefStr); maOutputRefStr = aRefStr; OutputPosUpdated(); diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx index a8904cbe840e..793691e39fff 100644 --- a/sc/source/ui/dbgui/sfiltdlg.cxx +++ b/sc/source/ui/dbgui/sfiltdlg.cxx @@ -168,8 +168,7 @@ void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet ) ScRange aAdvSource; if (rQueryItem.GetAdvancedQuerySource(aAdvSource)) { - String aRefStr; - aAdvSource.Format( aRefStr, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() ); + OUString aRefStr(aAdvSource.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention())); pEdFilterArea->SetRefString( aRefStr ); } } @@ -227,13 +226,13 @@ void ScSpecialFilterDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) if ( rRef.aStart != rRef.aEnd ) RefInputStart( pRefInputEdit ); - String aRefStr; + OUString aRefStr; const formula::FormulaGrammar::AddressConvention eConv = pDocP->GetAddressConvention(); if ( pRefInputEdit == pEdCopyArea) - rRef.aStart.Format( aRefStr, SCA_ABS_3D, pDocP, eConv ); + aRefStr = rRef.aStart.Format(SCA_ABS_3D, pDocP, eConv); else if ( pRefInputEdit == pEdFilterArea) - rRef.Format( aRefStr, SCR_ABS_3D, pDocP, eConv ); + aRefStr = rRef.Format(SCR_ABS_3D, pDocP, eConv); pRefInputEdit->SetRefString( aRefStr ); } diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx index 8ab5a7429877..e541a1a7e908 100644 --- a/sc/source/ui/dbgui/tpsort.cxx +++ b/sc/source/ui/dbgui/tpsort.cxx @@ -593,7 +593,6 @@ void ScTabPageSortOptions::Init() if ( pViewData && pDoc ) { - String theArea; ScDBCollection* pDBColl = pDoc->GetDBCollection(); const SCTAB nCurTab = pViewData->GetTabNo(); OUString theDbName = OUString(STR_DB_LOCAL_NONAME); @@ -606,12 +605,11 @@ void ScTabPageSortOptions::Init() ScAreaNameIterator aIter( pDoc ); OUString aName; ScRange aRange; - OUString aRefStr; while ( aIter.Next( aName, aRange ) ) { sal_uInt16 nInsert = m_pLbOutPos->InsertEntry( aName ); - aRange.aStart.Format( aRefStr, SCA_ABS_3D, pDoc, eConv ); + OUString aRefStr(aRange.aStart.Format(SCA_ABS_3D, pDoc, eConv)); m_pLbOutPos->SetEntryData( nInsert, new OUString( aRefStr ) ); } @@ -621,9 +619,10 @@ void ScTabPageSortOptions::Init() // Check whether the field that is passed on is a database field: ScAddress aScAddress( aSortData.nCol1, aSortData.nRow1, nCurTab ); - ScRange( aScAddress, + String theArea = + ScRange( aScAddress, ScAddress( aSortData.nCol2, aSortData.nRow2, nCurTab ) - ).Format( theArea, SCR_ABS, pDoc, eConv ); + ).Format(SCR_ABS, pDoc, eConv); if ( pDBColl ) { @@ -705,7 +704,6 @@ void ScTabPageSortOptions::Reset( const SfxItemSet& /* rArgSet */ ) if ( pDoc && !aSortData.bInplace ) { - OUString aStr; sal_uInt16 nFormat = (aSortData.nDestTab != pViewData->GetTabNo()) ? SCR_ABS_3D : SCR_ABS; @@ -714,7 +712,7 @@ void ScTabPageSortOptions::Reset( const SfxItemSet& /* rArgSet */ ) aSortData.nDestRow, aSortData.nDestTab ); - theOutPos.Format( aStr, nFormat, pDoc, pDoc->GetAddressConvention() ); + OUString aStr(theOutPos.Format(nFormat, pDoc, pDoc->GetAddressConvention())); m_pBtnCopyResult->Check(); m_pLbOutPos->Enable(); m_pEdOutPos->Enable(); diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index 45e3694c36f5..0085edcb1bf2 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -88,8 +88,7 @@ void ScTPValidationValue::SetReferenceHdl( const ScRange&rRange , ScDocument* pD if ( m_pRefEdit ) { - OUString aStr; - rRange.Format( aStr, SCR_ABS_3D, pDoc ); + OUString aStr(rRange.Format(SCR_ABS_3D, pDoc)); m_pRefEdit->SetRefString( aStr ); } } diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 81b315f22452..a150f62f50c8 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -4914,8 +4914,7 @@ void ScDocFunc::CreateOneName( ScRangeName& rList, ScRangeData::MakeValidName(aName); if (aName.Len()) { - String aContent; - ScRange( nX1, nY1, nTab, nX2, nY2, nTab ).Format( aContent, SCR_ABS_3D, pDoc ); + String aContent(ScRange( nX1, nY1, nTab, nX2, nY2, nTab ).Format(SCR_ABS_3D, pDoc)); bool bInsert = false; ScRangeData* pOld = rList.findByUpperName(ScGlobal::pCharClass->uppercase(aName)); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 8d9e1814f7ff..65ef96bb6707 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -2083,10 +2083,10 @@ long ScDocShell::DdeGetData( const OUString& rItem, if ( !aObj.IsRef() ) return 0; // ungueltiger Bereich - if( aDdeTextFmt.GetChar(0) == 'F' ) + if( aDdeTextFmt[0] == 'F' ) aObj.SetFormulas( sal_True ); - if( aDdeTextFmt.EqualsAscii( "SYLK" ) || - aDdeTextFmt.EqualsAscii( "FSYLK" ) ) + if( aDdeTextFmt == "SYLK" || + aDdeTextFmt == "FSYLK" ) { OString aData; if( aObj.ExportByteString( aData, osl_getThreadTextEncoding(), @@ -2100,8 +2100,8 @@ long ScDocShell::DdeGetData( const OUString& rItem, else return 0; } - if( aDdeTextFmt.EqualsAscii( "CSV" ) || - aDdeTextFmt.EqualsAscii( "FCSV" ) ) + if( aDdeTextFmt == "CSV" || + aDdeTextFmt == "FCSV" ) aObj.SetSeparator( ',' ); aObj.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::ToSpace, 0, false ) ); return aObj.ExportData( rMimeType, rValue ) ? 1 : 0; @@ -2124,26 +2124,26 @@ long ScDocShell::DdeSetData( const OUString& rItem, { if ( ScByteSequenceToString::GetString( aDdeTextFmt, rValue, osl_getThreadTextEncoding() ) ) { - aDdeTextFmt.ToUpperAscii(); + aDdeTextFmt = aDdeTextFmt.toAsciiUpperCase(); return 1; } return 0; } ScImportExport aObj( &aDocument, rItem ); - if( aDdeTextFmt.GetChar(0) == 'F' ) + if( aDdeTextFmt[0] == 'F' ) aObj.SetFormulas( sal_True ); - if( aDdeTextFmt.EqualsAscii( "SYLK" ) || - aDdeTextFmt.EqualsAscii( "FSYLK" ) ) + if( aDdeTextFmt == "SYLK" || + aDdeTextFmt == "FSYLK" ) { - String aData; + OUString aData; if ( ScByteSequenceToString::GetString( aData, rValue, osl_getThreadTextEncoding() ) ) { return aObj.ImportString( aData, SOT_FORMATSTR_ID_SYLK ) ? 1 : 0; } return 0; } - if( aDdeTextFmt.EqualsAscii( "CSV" ) || - aDdeTextFmt.EqualsAscii( "FCSV" ) ) + if( aDdeTextFmt == "CSV" || + aDdeTextFmt == "FCSV" ) aObj.SetSeparator( ',' ); return aObj.ImportData( rMimeType, rValue ) ? 1 : 0; } diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index ae259c21608a..da29f00d8440 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -514,20 +514,21 @@ void lcl_GetColumnTypes( sal_Int32 nFieldLen = 0; sal_Int32 nPrecision = 0; sal_Int32 nDbType = sdbc::DataType::SQLNULL; - String aFieldName, aString; + String aFieldName; + OUString aString; // Feldname[,Type[,Width[,Prec]]] // Typ etc.: L; D; C[,W]; N[,W[,P]] if ( bHasFieldNames ) { aString = pDoc->GetString(nCol, nFirstRow, nTab); - aString.ToUpperAscii(); + aString = aString.toAsciiUpperCase(); xub_StrLen nToken = comphelper::string::getTokenCount(aString, ','); if ( nToken > 1 ) { - aFieldName = aString.GetToken( 0, ',' ); + aFieldName = aString.getToken( 0, ',' ); aString = comphelper::string::remove(aString, ' '); - switch ( aString.GetToken( 1, ',' ).GetChar(0) ) + switch ( aString.getToken( 1, ',' )[0] ) { case 'L' : nDbType = sdbc::DataType::BIT; @@ -559,10 +560,10 @@ void lcl_GetColumnTypes( } if ( bTypeDefined && !nFieldLen && nToken > 2 ) { - nFieldLen = aString.GetToken( 2, ',' ).ToInt32(); + nFieldLen = aString.getToken( 2, ',' ).toInt32(); if ( !bPrecDefined && nToken > 3 ) { - String aTmp( aString.GetToken( 3, ',' ) ); + String aTmp( aString.getToken( 3, ',' ) ); if ( CharClass::isAsciiNumeric(aTmp) ) { nPrecision = aTmp.ToInt32(); diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index aae1b47719a0..d46a1dfbf16d 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -448,17 +448,17 @@ bool ScImportExport::ExportStream( SvStream& rStrm, const String& rBaseURL, sal_ if( aDocName.Len() ) { // Always use Calc A1 syntax for paste link. - String aRefName; + OUString aRefName; sal_uInt16 nFlags = SCA_VALID | SCA_TAB_3D; if( bSingle ) - aRange.aStart.Format( aRefName, nFlags, pDoc, formula::FormulaGrammar::CONV_OOO ); + aRefName = aRange.aStart.Format(nFlags, pDoc, formula::FormulaGrammar::CONV_OOO); else { if( aRange.aStart.Tab() != aRange.aEnd.Tab() ) nFlags |= SCA_TAB2_3D; - aRange.Format( aRefName, nFlags, pDoc, formula::FormulaGrammar::CONV_OOO ); + aRefName = aRange.Format(nFlags, pDoc, formula::FormulaGrammar::CONV_OOO); } - String aAppName = Application::GetAppName(); + OUString aAppName = Application::GetAppName(); // extra bits are used to tell the client to prefer external // reference link. diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index 695cbda432cc..7c5b8434383a 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -114,7 +114,7 @@ void lcl_ChartInit( const uno::Reference < embed::XEmbeddedObject >& xObj, ScVie pDoc->LimitChartArea( nTab1, nCol1,nRow1, nCol2,nRow2 ); ScRange aRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 ); - aRange.Format( aRangeString, SCR_ABS_3D, pScDoc ); + aRangeString = aRange.Format(SCR_ABS_3D, pScDoc); } } } diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx index 25ae7d03e6a1..a907e0cf232b 100644 --- a/sc/source/ui/formdlg/formula.cxx +++ b/sc/source/ui/formdlg/formula.cxx @@ -408,8 +408,7 @@ void ScFormulaDlg::SetReference( const ScRange& rRef, ScDocument* pRefDoc ) OSL_ENSURE(rRef.aStart.Tab()==rRef.aEnd.Tab(), "nStartTab!=nEndTab"); - String aTmp; - rRef.Format( aTmp, SCA_VALID|SCA_TAB_3D, pRefDoc ); // immer 3d + OUString aTmp(rRef.Format(SCA_VALID|SCA_TAB_3D, pRefDoc)); // immer 3d SfxObjectShell* pObjSh = pRefDoc->GetDocumentShell(); diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 8e459aba6b43..eeda0364dc84 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -85,7 +85,7 @@ class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener { ScDocument aDocument; - String aDdeTextFmt; + OUString aDdeTextFmt; double nPrtToScreenFactor; DocShell_Impl* pImpl; @@ -376,7 +376,7 @@ public: const ::com::sun::star::uno::Any & rValue ); virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const OUString& rItem ); - const String& GetDdeTextFmt() const { return aDdeTextFmt; } + const OUString& GetDdeTextFmt() const { return aDdeTextFmt; } SfxBindings* GetViewBindings(); diff --git a/sc/source/ui/inc/navipi.hxx b/sc/source/ui/inc/navipi.hxx index 8e8f8ac5912c..ed355c98707f 100644 --- a/sc/source/ui/inc/navipi.hxx +++ b/sc/source/ui/inc/navipi.hxx @@ -145,9 +145,9 @@ private: void EvalText (); void ExecuteCol (); - SCCOL AlphaToNum ( String& rStr ); - SCCOL NumStrToAlpha ( String& rStr ); - SCCOL NumToAlpha ( SCCOL nColNo, String& rStr ); + SCCOL AlphaToNum ( OUString& rStr ); + SCCOL NumStrToAlpha ( OUString& rStr ); + SCCOL NumToAlpha ( SCCOL nColNo, OUString& rStr ); }; diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx index 3c6364cbf235..93e04e7f1e13 100644 --- a/sc/source/ui/inc/viewfunc.hxx +++ b/sc/source/ui/inc/viewfunc.hxx @@ -158,7 +158,7 @@ public: sal_uInt16 GetCreateNameFlags(); void InsertNameList(); sal_Bool InsertName( const String& rName, const String& rSymbol, - const String& rType ); + const OUString& rType ); void ApplyAttributes( const SfxItemSet* pDialogSet, const SfxItemSet* pOldSet, sal_Bool bRecord = sal_True ); diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index d3b1069763a7..1eb077a7a0ae 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -253,8 +253,7 @@ void ScAcceptChgDlg::Init() if( !aChangeViewSet.GetTheRangeList().empty() ) { const ScRange* pRangeEntry = aChangeViewSet.GetTheRangeList().front(); - String aRefStr; - pRangeEntry->Format( aRefStr, ABS_DREF3D, pDoc ); + OUString aRefStr(pRangeEntry->Format(ABS_DREF3D, pDoc)); pTPFilter->SetRange(aRefStr); } diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx index 3cf2f12d47a3..e0173851e0f2 100644 --- a/sc/source/ui/miscdlgs/crnrdlg.cxx +++ b/sc/source/ui/miscdlgs/crnrdlg.cxx @@ -258,8 +258,7 @@ void ScColRowNameRangesDlg::SetColRowData( const ScRange& rLabelRange,sal_Bool b if ( bValid ) { const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); - String aStr; - theCurArea.Format( aStr, SCR_ABS_3D, pDoc, eConv ); + OUString aStr(theCurArea.Format(SCR_ABS_3D, pDoc, eConv)); if(bRef) pEdAssign->SetRefString( aStr ); @@ -267,7 +266,7 @@ void ScColRowNameRangesDlg::SetColRowData( const ScRange& rLabelRange,sal_Bool b pEdAssign->SetText( aStr ); pEdAssign->SetSelection( Selection( SELECTION_MAX, SELECTION_MAX ) ); - theCurData.Format( aStr, SCR_ABS_3D, pDoc, eConv ); + aStr = theCurData.Format(SCR_ABS_3D, pDoc, eConv); if(bRef) pEdAssign2->SetRefString( aStr ); @@ -361,8 +360,7 @@ void ScColRowNameRangesDlg::AdjustColRowData( const ScRange& rDataRange,sal_Bool } } } - String aStr; - theCurData.Format( aStr, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() ); + OUString aStr(theCurData.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention())); if(bRef) pEdAssign2->SetRefString( aStr ); @@ -512,7 +510,7 @@ void ScColRowNameRangesDlg::UpdateNames() for ( j=0; j < nCount; j++ ) { const ScRange aRange(ppSortArray[j]->GetRange(0)); - aRange.Format( aString, SCR_ABS_3D, pDoc, aDetails ); + aString = aRange.Format(SCR_ABS_3D, pDoc, aDetails); //@008 Hole Bereichsparameter aus Dok ppSortArray[j]->GetRange(0).GetVars( nCol1, nRow1, nTab1, @@ -559,7 +557,7 @@ void ScColRowNameRangesDlg::UpdateNames() for ( j=0; j < nCount; j++ ) { const ScRange aRange(ppSortArray[j]->GetRange(0)); - aRange.Format( aString, SCR_ABS_3D, pDoc, aDetails ); + aString = aRange.Format(SCR_ABS_3D, pDoc, aDetails); //@008 Ab hier baue String fuer Zeilen ppSortArray[j]->GetRange(0).GetVars( nCol1, nRow1, nTab1, @@ -625,16 +623,15 @@ void ScColRowNameRangesDlg::UpdateRangeData( const ScRange& rRange, sal_Bool bCo if ( bFound ) { const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); - String aStr; theCurArea = rRange; - theCurArea.Format( aStr, SCR_ABS_3D, pDoc, eConv ); + OUString aStr(theCurArea.Format(SCR_ABS_3D, pDoc, eConv)); pEdAssign->SetText( aStr ); pBtnAdd->Disable(); pBtnRemove->Enable(); pBtnColHead->Check( bColName ); pBtnRowHead->Check( !bColName ); theCurData = pPair->GetRange(1); - theCurData.Format( aStr, SCR_ABS_3D, pDoc, eConv ); + aStr = theCurData.Format(SCR_ABS_3D, pDoc, eConv); pEdAssign2->SetText( aStr ); } else @@ -1076,8 +1073,7 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, ColClickHdl) if ( theCurArea.aStart.Row() == 0 && theCurArea.aEnd.Row() == MAXROW ) { theCurArea.aEnd.SetRow( MAXROW - 1 ); - String aStr; - theCurArea.Format( aStr, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() ); + OUString aStr(theCurArea.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention())); pEdAssign->SetText( aStr ); } ScRange aRange( theCurData ); @@ -1114,8 +1110,7 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, RowClickHdl) if ( theCurArea.aStart.Col() == 0 && theCurArea.aEnd.Col() == MAXCOL ) { theCurArea.aEnd.SetCol( MAXCOL - 1 ); - String aStr; - theCurArea.Format( aStr, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() ); + OUString aStr(theCurArea.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention())); pEdAssign->SetText( aStr ); } ScRange aRange( theCurData ); diff --git a/sc/source/ui/miscdlgs/highred.cxx b/sc/source/ui/miscdlgs/highred.cxx index d863bddd6f43..b86780f5c5b1 100644 --- a/sc/source/ui/miscdlgs/highred.cxx +++ b/sc/source/ui/miscdlgs/highred.cxx @@ -135,9 +135,8 @@ void ScHighlightChgDlg::Init() if ( !aChangeViewSet.GetTheRangeList().empty() ) { - String aRefStr; const ScRange* pRangeEntry = aChangeViewSet.GetTheRangeList().front(); - pRangeEntry->Format( aRefStr, ABS_DREF3D, pDoc ); + OUString aRefStr(pRangeEntry->Format(ABS_DREF3D, pDoc)); aFilterCtr.SetRange(aRefStr); } aFilterCtr.Enable(sal_True,sal_True); @@ -154,8 +153,7 @@ void ScHighlightChgDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) { if ( rRef.aStart != rRef.aEnd ) RefInputStart(&aEdAssign); - String aRefStr; - rRef.Format( aRefStr, ABS_DREF3D, pDocP, pDocP->GetAddressConvention() ); + OUString aRefStr(rRef.Format(ABS_DREF3D, pDocP, pDocP->GetAddressConvention())); aEdAssign.SetRefString( aRefStr ); aFilterCtr.SetRange(aRefStr); } diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx index 12edd679a729..ecd4cd22161b 100644 --- a/sc/source/ui/miscdlgs/optsolver.cxx +++ b/sc/source/ui/miscdlgs/optsolver.cxx @@ -397,7 +397,7 @@ void ScOptSolverDlg::Init(const ScAddress& rCursorPos) m_pRbMax->Check(); OUString aCursorStr; if ( !mpDoc->GetRangeAtBlock( ScRange(rCursorPos), &aCursorStr ) ) - rCursorPos.Format( aCursorStr, SCA_ABS, NULL, mpDoc->GetAddressConvention() ); + aCursorStr = rCursorPos.Format(SCA_ABS, NULL, mpDoc->GetAddressConvention()); m_pEdObjectiveCell->SetRefString( aCursorStr ); if ( nImplCount > 0 ) maEngine = maImplNames[0]; // use first implementation @@ -516,9 +516,9 @@ void ScOptSolverDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) { sal_uInt16 nFmt = ( aAdr.Tab() == mnCurTab ) ? SCA_ABS : SCA_ABS_3D; if ( bSingle ) - aAdr.Format( aStr, nFmt, pDocP, pDocP->GetAddressConvention() ); + aStr = aAdr.Format(nFmt, pDocP, pDocP->GetAddressConvention()); else - rRef.Format( aStr, nFmt | SCR_ABS, pDocP, pDocP->GetAddressConvention() ); + aStr = rRef.Format(nFmt | SCR_ABS, pDocP, pDocP->GetAddressConvention()); } // variable cells can be several ranges, so only the selection is replaced diff --git a/sc/source/ui/miscdlgs/simpref.cxx b/sc/source/ui/miscdlgs/simpref.cxx index 7afa37cd1b45..93460a59060c 100644 --- a/sc/source/ui/miscdlgs/simpref.cxx +++ b/sc/source/ui/miscdlgs/simpref.cxx @@ -109,10 +109,10 @@ void ScSimpleRefDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) if ( bSingleCell ) { ScAddress aAdr = rRef.aStart; - aAdr.Format( aRefStr, SCA_ABS_3D, pDocP, pDocP->GetAddressConvention() ); + aRefStr = aAdr.Format(SCA_ABS_3D, pDocP, pDocP->GetAddressConvention()); } else - theCurArea.Format( aRefStr, ABS_DREF3D, pDocP, pDocP->GetAddressConvention() ); + aRefStr = theCurArea.Format(ABS_DREF3D, pDocP, pDocP->GetAddressConvention()); if ( bMultiSelection ) { diff --git a/sc/source/ui/miscdlgs/solvrdlg.cxx b/sc/source/ui/miscdlgs/solvrdlg.cxx index b7eae4771bff..0a4d6554fbd7 100644 --- a/sc/source/ui/miscdlgs/solvrdlg.cxx +++ b/sc/source/ui/miscdlgs/solvrdlg.cxx @@ -84,8 +84,6 @@ ScSolverDlg::~ScSolverDlg() void ScSolverDlg::Init() { - String aStr; - m_pBtnOk->SetClickHdl( LINK( this, ScSolverDlg, BtnHdl ) ); m_pBtnCancel->SetClickHdl( LINK( this, ScSolverDlg, BtnHdl ) ); @@ -102,7 +100,7 @@ void ScSolverDlg::Init() m_pEdVariableCell->SetLoseFocusHdl ( aLink ); m_pRBVariableCell->SetLoseFocusHdl ( aLink ); - theFormulaCell.Format( aStr, SCA_ABS, NULL, pDoc->GetAddressConvention() ); + OUString aStr(theFormulaCell.Format(SCA_ABS, NULL, pDoc->GetAddressConvention())); m_pEdFormulaCell->SetText( aStr ); m_pEdFormulaCell->GrabFocus(); @@ -142,13 +140,12 @@ void ScSolverDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) if ( rRef.aStart != rRef.aEnd ) RefInputStart(pEdActive); - String aStr; ScAddress aAdr = rRef.aStart; sal_uInt16 nFmt = ( aAdr.Tab() == nCurTab ) ? SCA_ABS : SCA_ABS_3D; - aAdr.Format( aStr, nFmt, pDocP, pDocP->GetAddressConvention() ); + OUString aStr(aAdr.Format(nFmt, pDocP, pDocP->GetAddressConvention())); pEdActive->SetRefString( aStr ); if ( pEdActive == m_pEdFormulaCell ) diff --git a/sc/source/ui/miscdlgs/tabopdlg.cxx b/sc/source/ui/miscdlgs/tabopdlg.cxx index 443b87e4bcf5..12a344f10325 100644 --- a/sc/source/ui/miscdlgs/tabopdlg.cxx +++ b/sc/source/ui/miscdlgs/tabopdlg.cxx @@ -144,7 +144,7 @@ void ScTabOpDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) if ( rRef.aStart != rRef.aEnd ) RefInputStart(pEdActive); - String aStr; + OUString aStr; sal_uInt16 nFmt = ( rRef.aStart.Tab() == nCurTab ) ? SCR_ABS : SCR_ABS_3D; @@ -153,17 +153,17 @@ void ScTabOpDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) { theFormulaCell.Set( rRef.aStart, false, false, false); theFormulaEnd.Set( rRef.aEnd, false, false, false); - rRef.Format( aStr, nFmt, pDocP, aDetails ); + aStr = rRef.Format(nFmt, pDocP, aDetails); } else if ( pEdActive == &aEdRowCell ) { theRowCell.Set( rRef.aStart, false, false, false); - rRef.aStart.Format( aStr, nFmt, pDocP, aDetails ); + aStr = rRef.aStart.Format(nFmt, pDocP, aDetails); } else if ( pEdActive == &aEdColCell ) { theColCell.Set( rRef.aStart, false, false, false); - rRef.aStart.Format( aStr, nFmt, pDocP, aDetails ); + aStr = rRef.aStart.Format(nFmt, pDocP, aDetails); } pEdActive->SetRefString( aStr ); diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx index 3804fcac27f4..62e13fd1855a 100644 --- a/sc/source/ui/namedlg/namedefdlg.cxx +++ b/sc/source/ui/namedlg/namedefdlg.cxx @@ -78,12 +78,11 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParen m_pBtnAdd->Disable(); // empty name is invalid - String aAreaStr; ScRange aRange; pViewData->GetSimpleArea( aRange ); - aRange.Format( aAreaStr, ABS_DREF3D, mpDoc, - ScAddress::Details(mpDoc->GetAddressConvention(), 0, 0) ); + OUString aAreaStr(aRange.Format(ABS_DREF3D, mpDoc, + ScAddress::Details(mpDoc->GetAddressConvention(), 0, 0))); m_pEdRange->SetText( aAreaStr ); @@ -288,9 +287,8 @@ void ScNameDefDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) { if ( rRef.aStart != rRef.aEnd ) RefInputStart(m_pEdRange); - String aRefStr; - rRef.Format( aRefStr, ABS_DREF3D, pDocP, - ScAddress::Details(pDocP->GetAddressConvention(), 0, 0) ); + OUString aRefStr(rRef.Format(ABS_DREF3D, pDocP, + ScAddress::Details(pDocP->GetAddressConvention(), 0, 0))); m_pEdRange->SetRefString( aRefStr ); } } diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index 10080fbd6294..b013ba54c3c2 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -173,9 +173,8 @@ void ScNameDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) { if ( rRef.aStart != rRef.aEnd ) RefInputStart(m_pEdAssign); - String aRefStr; - rRef.Format( aRefStr, ABS_DREF3D, pDocP, - ScAddress::Details(pDocP->GetAddressConvention(), 0, 0) ); + OUString aRefStr(rRef.Format(ABS_DREF3D, pDocP, + ScAddress::Details(pDocP->GetAddressConvention(), 0, 0))); m_pEdAssign->SetRefString( aRefStr ); } } diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index bf275d12d9f2..c4dce57245c4 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -249,9 +249,9 @@ sal_uLong ScContentTree::GetChildIndex( SvTreeListEntry* pEntry ) const return nChild; } -static String lcl_GetDBAreaRange( ScDocument* pDoc, const String& rDBName ) +static OUString lcl_GetDBAreaRange( ScDocument* pDoc, const OUString& rDBName ) { - String aRet; + OUString aRet; if (pDoc) { ScDBCollection* pDbNames = pDoc->GetDBCollection(); @@ -260,7 +260,7 @@ static String lcl_GetDBAreaRange( ScDocument* pDoc, const String& rDBName ) { ScRange aRange; pData->GetArea(aRange); - aRange.Format(aRet, SCR_ABS_3D, pDoc); + aRet = aRange.Format(SCR_ABS_3D, pDoc); } } return aRet; @@ -325,9 +325,8 @@ IMPL_LINK_NOARG(ScContentTree, ContentDoubleClickHdl) if( pLink ) { ScRange aRange = pLink->GetDestArea(); - String aRangeStr; ScDocument* pSrcDoc = GetSourceDocument(); - aRange.Format( aRangeStr, SCR_ABS_3D, pSrcDoc, pSrcDoc->GetAddressConvention() ); + OUString aRangeStr(aRange.Format(SCR_ABS_3D, pSrcDoc, pSrcDoc->GetAddressConvention())); pParentWindow->SetCurrentCellStr( aRangeStr ); } } diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 21f2178310d8..19620999b4c9 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -59,7 +59,7 @@ // macro is sufficient since only used in ctor #define SCNAV_COLDIGITS (static_cast<xub_StrLen>( floor( log10( static_cast<double>(SCNAV_MAXCOL)))) + 1) // 1...256...18278 // precomputed constant because it is used in every change of spin button field -static const xub_StrLen SCNAV_COLLETTERS = ::ScColToAlpha(SCNAV_MAXCOL).Len(); // A...IV...ZZZ +static const xub_StrLen SCNAV_COLLETTERS = ::ScColToAlpha(SCNAV_MAXCOL).getLength(); // A...IV...ZZZ #define SCNAV_MAXROW (MAXROWCOUNT) @@ -168,7 +168,7 @@ void ColumnEdit::First() void ColumnEdit::Last() { - String aStr; + OUString aStr; nCol = NumToAlpha( SCNAV_MAXCOL, aStr ); SetText( aStr ); } @@ -178,9 +178,9 @@ void ColumnEdit::Last() void ColumnEdit::EvalText() { - String aStrCol = GetText(); + OUString aStrCol = GetText(); - if ( aStrCol.Len() > 0 ) + if (!aStrCol.isEmpty()) { // nKeyGroup wird bei VCL mangels KeyInput nicht mehr gesetzt @@ -212,7 +212,7 @@ void ColumnEdit::ExecuteCol() void ColumnEdit::SetCol( SCCOL nColNo ) { - String aStr; + OUString aStr; if ( nColNo == 0 ) { @@ -229,46 +229,46 @@ void ColumnEdit::SetCol( SCCOL nColNo ) //------------------------------------------------------------------------ -SCCOL ColumnEdit::AlphaToNum( String& rStr ) +SCCOL ColumnEdit::AlphaToNum( OUString& rStr ) { SCCOL nColumn = 0; if ( CharClass::isAsciiAlpha( rStr) ) { - rStr.ToUpperAscii(); + rStr = rStr.toAsciiUpperCase(); if (::AlphaToCol( nColumn, rStr)) ++nColumn; - if ( (rStr.Len() > SCNAV_COLLETTERS) || (nColumn > SCNAV_MAXCOL) ) + if ( (rStr.getLength() > SCNAV_COLLETTERS) || (nColumn > SCNAV_MAXCOL) ) { nColumn = SCNAV_MAXCOL; NumToAlpha( nColumn, rStr ); } } else - rStr.Erase(); + rStr = ""; return nColumn; } //------------------------------------------------------------------------ -SCCOL ColumnEdit::NumStrToAlpha( String& rStr ) +SCCOL ColumnEdit::NumStrToAlpha( OUString& rStr ) { SCCOL nColumn = 0; if ( CharClass::isAsciiNumeric(rStr) ) - nColumn = NumToAlpha( (SCCOL)rStr.ToInt32(), rStr ); + nColumn = NumToAlpha( (SCCOL)rStr.toInt32(), rStr ); else - rStr.Erase(); + rStr = ""; return nColumn; } //------------------------------------------------------------------------ -SCCOL ColumnEdit::NumToAlpha( SCCOL nColNo, String& rStr ) +SCCOL ColumnEdit::NumToAlpha( SCCOL nColNo, OUString& rStr ) { if ( nColNo > SCNAV_MAXCOL ) nColNo = SCNAV_MAXCOL; @@ -994,8 +994,7 @@ void ScNavigatorDlg::SetCurrentCell( SCCOL nColNo, SCROW nRowNo ) ppBoundItems[0]->ClearCache(); ScAddress aScAddress( nColNo, nRowNo, 0 ); - String aAddr; - aScAddress.Format( aAddr, SCA_ABS ); + OUString aAddr(aScAddress.Format(SCA_ABS)); sal_Bool bUnmark = false; if ( GetViewData() ) diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx index ad86994ab441..c1176a4fa641 100644 --- a/sc/source/ui/optdlg/tpusrlst.cxx +++ b/sc/source/ui/optdlg/tpusrlst.cxx @@ -131,8 +131,8 @@ void ScTpUserLists::Init() PutInOrder( nStartRow, nEndRow ); PutInOrder( nStartTab, nEndTab ); - ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab - ).Format( aStrSelectedArea, SCR_ABS_3D, pDoc ); + aStrSelectedArea = ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab + ).Format(SCR_ABS_3D, pDoc); mpBtnCopy->SetClickHdl ( LINK( this, ScTpUserLists, BtnClickHdl ) ); mpBtnCopy->Enable(); diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx index e421b0b2a9ff..dd83ee1de23c 100644 --- a/sc/source/ui/pagedlg/areasdlg.cxx +++ b/sc/source/ui/pagedlg/areasdlg.cxx @@ -202,7 +202,7 @@ void ScPrintAreasDlg::SetReference( const ScRange& rRef, ScDocument* /* pDoc */ if ( pEdPrintArea == pRefInputEdit ) { - rRef.Format( aStr, SCR_ABS, pDoc, eConv ); + aStr = rRef.Format(SCR_ABS, pDoc, eConv); String aVal = pEdPrintArea->GetText(); Selection aSel = pEdPrintArea->GetSelection(); aSel.Justify(); @@ -312,7 +312,7 @@ void ScPrintAreasDlg::Impl_Reset() { if ( aStrRange.Len() ) aStrRange += sep; - pPrintRange->Format( aOne, SCR_ABS, pDoc, eConv ); + aOne = pPrintRange->Format(SCR_ABS, pDoc, eConv); aStrRange += aOne; } } @@ -354,7 +354,7 @@ bool ScPrintAreasDlg::Impl_GetItem( Edit* pEd, SfxStringItem& rItem ) ScRange aRange; const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); lcl_CheckRepeatString(aRangeStr, pDoc, pEdRepeatRow == pEd, &aRange); - aRange.Format(aRangeStr, SCR_ABS, pDoc, eConv); + aRangeStr = aRange.Format(SCR_ABS, pDoc, eConv); } rItem.SetValue( aRangeStr ); @@ -445,12 +445,12 @@ void ScPrintAreasDlg::Impl_FillLists() formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); if ( bSimple ) - aRange.Format( aStrRange, SCR_ABS, pDoc, eConv ); + aStrRange = aRange.Format(SCR_ABS, pDoc, eConv); else { ScRangeListRef aList( new ScRangeList ); pViewData->GetMarkData().FillRangeListWithMarks( aList, false ); - aList->Format( aStrRange, SCR_ABS, pDoc, eConv ); + aList->Format(aStrRange, SCR_ABS, pDoc, eConv); } pLbPrintArea->SetEntryData( SC_AREASDLG_PR_SELECT, new String( aStrRange ) ); @@ -477,7 +477,7 @@ void ScPrintAreasDlg::Impl_FillLists() { if (itr->second->HasType(RT_PRINTAREA)) { - aRange.Format(aSymbol, SCR_ABS, pDoc, eConv); + aSymbol = aRange.Format(SCR_ABS, pDoc, eConv); pLbPrintArea->SetEntryData( pLbPrintArea->InsertEntry(aName), new String(aSymbol) ); @@ -654,11 +654,10 @@ IMPL_LINK( ScPrintAreasDlg, Impl_ModifyHdl, formula::RefEdit*, pEd ) // set list box selection according to edit field sal_uInt16 nEntryCount = pLb->GetEntryCount(); - String aStrEd( pEd->GetText() ); - String aEdUpper = aStrEd; - aEdUpper.ToUpperAscii(); + OUString aStrEd( pEd->GetText() ); + OUString aEdUpper = aStrEd.toAsciiUpperCase(); - if ( (nEntryCount > nFirstCustomPos) && aStrEd.Len() > 0 ) + if ( (nEntryCount > nFirstCustomPos) && !aStrEd.isEmpty() ) { sal_Bool bFound = false; String* pSymbol = NULL; @@ -667,13 +666,13 @@ IMPL_LINK( ScPrintAreasDlg, Impl_ModifyHdl, formula::RefEdit*, pEd ) for ( i=nFirstCustomPos; i<nEntryCount && !bFound; i++ ) { pSymbol = (String*)pLb->GetEntryData( i ); - bFound = ( (*pSymbol == aStrEd) || (*pSymbol == aEdUpper) ); + bFound = ( pSymbol->Equals(aStrEd) || pSymbol->Equals(aEdUpper) ); } pLb->SelectEntryPos( bFound ? i-1 : nUserDefPos ); } else - pLb->SelectEntryPos( aStrEd.Len() ? nUserDefPos : 0 ); + pLb->SelectEntryPos( !aStrEd.isEmpty() ? nUserDefPos : 0 ); return 0; } @@ -878,14 +877,11 @@ static void lcl_GetRepeatRangeString( const ScRange* pRange, ScDocument* pDoc, b const ScAddress& rEnd = pRange->aEnd; const sal_uInt16 nFmt = bIsRow ? (SCA_VALID_ROW | SCA_ROW_ABSOLUTE) : (SCA_VALID_COL | SCA_COL_ABSOLUTE); - String aTmpStr; - rStart.Format(aTmpStr, nFmt, pDoc, eConv); - rStr += aTmpStr; + rStr += rStart.Format(nFmt, pDoc, eConv); if ((bIsRow && rStart.Row() != rEnd.Row()) || (!bIsRow && rStart.Col() != rEnd.Col())) { rStr += ScCompiler::GetNativeSymbol(ocRange); - rEnd.Format(aTmpStr, nFmt, pDoc, eConv); - rStr += aTmpStr; + rStr += rEnd.Format(nFmt, pDoc, eConv); } } diff --git a/sc/source/ui/unoobj/addruno.cxx b/sc/source/ui/unoobj/addruno.cxx index 0fe5201985dc..09d50e9444bb 100644 --- a/sc/source/ui/unoobj/addruno.cxx +++ b/sc/source/ui/unoobj/addruno.cxx @@ -249,15 +249,15 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const OUString& aPro else if ( aNameStr.EqualsAscii( SC_UNONAME_UIREPR ) ) { // generate UI representation string - include sheet only if different from ref sheet - String aFormatStr; + OUString aFormatStr; sal_uInt16 nFlags = SCA_VALID; if ( aRange.aStart.Tab() != nRefSheet ) nFlags |= SCA_TAB_3D; if ( bIsRange ) - aRange.Format( aFormatStr, nFlags, pDoc ); + aFormatStr = aRange.Format(nFlags, pDoc); else - aRange.aStart.Format( aFormatStr, nFlags, pDoc ); - aRet <<= OUString( aFormatStr ); + aFormatStr = aRange.aStart.Format(nFlags, pDoc); + aRet <<= aFormatStr; } else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XLA1REPR ) ) { @@ -265,17 +265,15 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const OUString& aPro ::formula::FormulaGrammar::CONV_XL_A1 : ::formula::FormulaGrammar::CONV_OOO; // generate file format string - always include sheet - String aFormatStr; - aRange.aStart.Format( aFormatStr, SCA_VALID | SCA_TAB_3D, pDoc, eConv ); + String aFormatStr(aRange.aStart.Format(SCA_VALID | SCA_TAB_3D, pDoc, eConv)); if ( bIsRange ) { // manually concatenate range so both parts always have the sheet name aFormatStr.Append( (sal_Unicode) ':' ); - String aSecond; sal_uInt16 nFlags = SCA_VALID; if( eConv != ::formula::FormulaGrammar::CONV_XL_A1 ) nFlags |= SCA_TAB_3D; - aRange.aEnd.Format( aSecond, nFlags, pDoc, eConv ); + OUString aSecond(aRange.aEnd.Format(nFlags, pDoc, eConv)); aFormatStr.Append( aSecond ); } aRet <<= OUString( aFormatStr ); diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 528cc9e3103b..927a81169e15 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -4481,7 +4481,7 @@ static sal_Bool lcl_FindRangeByName( const ScRangeList& rRanges, ScDocShell* pDo ScDocument* pDoc = pDocSh->GetDocument(); for ( size_t i = 0, nCount = rRanges.size(); i < nCount; i++ ) { - rRanges[ i ]->Format( aRangeStr, SCA_VALID | SCA_TAB_3D, pDoc ); + aRangeStr = rRanges[ i ]->Format(SCA_VALID | SCA_TAB_3D, pDoc); if ( aRangeStr == rName ) { rIndex = i; @@ -4683,7 +4683,7 @@ uno::Sequence<OUString> SAL_CALL ScCellRangesObj::getElementNames() if (m_pImpl->m_aNamedEntries.empty() || !lcl_FindEntryName(m_pImpl->m_aNamedEntries, aRange, aRangeStr)) { - aRange.Format( aRangeStr, SCA_VALID | SCA_TAB_3D, pDoc ); + aRangeStr = aRange.Format(SCA_VALID | SCA_TAB_3D, pDoc); } pAry[i] = aRangeStr; } diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 14ea95cecd61..afd174325031 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -3159,8 +3159,7 @@ public: String aString = ScGlobal::GetRscString(STR_COLUMN); aString += ' '; ScAddress aPos( nCol, 0, 0 ); - String aColStr; - aPos.Format( aColStr, SCA_VALID_COL, NULL ); + OUString aColStr(aPos.Format(SCA_VALID_COL, NULL)); aString += aColStr; pArr[mnCount] = aString; } diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index af8bf07e12cb..bb4a7a8f04bc 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -2097,7 +2097,6 @@ ScVbaRange::Address( const uno::Any& RowAbsolute, const uno::Any& ColumnAbsolut RangeHelper thisRange( mxRange ); table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress(); ScRange aRange( static_cast< SCCOL >( thisAddress.StartColumn ), static_cast< SCROW >( thisAddress.StartRow ), static_cast< SCTAB >( thisAddress.Sheet ), static_cast< SCCOL >( thisAddress.EndColumn ), static_cast< SCROW >( thisAddress.EndRow ), static_cast< SCTAB >( thisAddress.Sheet ) ); - String sRange; sal_uInt16 ROW_ABSOLUTE = ( SCA_ROW_ABSOLUTE | SCA_ROW2_ABSOLUTE ); sal_uInt16 COL_ABSOLUTE = ( SCA_COL_ABSOLUTE | SCA_COL2_ABSOLUTE ); // default @@ -2130,8 +2129,7 @@ ScVbaRange::Address( const uno::Any& RowAbsolute, const uno::Any& ColumnAbsolut table::CellRangeAddress refAddress = getCellRangeAddressForVBARange( RelativeTo, pDocShell ); dDetails = ScAddress::Details( formula::FormulaGrammar::CONV_XL_R1C1, static_cast< SCROW >( refAddress.StartRow ), static_cast< SCCOL >( refAddress.StartColumn ) ); } - aRange.Format( sRange, nFlags, pDoc, dDetails ); - return sRange; + return aRange.Format(nFlags, pDoc, dDetails); } uno::Reference < excel::XFont > diff --git a/sc/source/ui/vba/vbawsfunction.cxx b/sc/source/ui/vba/vbawsfunction.cxx index ae5a1f4285cc..ec5117323298 100644 --- a/sc/source/ui/vba/vbawsfunction.cxx +++ b/sc/source/ui/vba/vbawsfunction.cxx @@ -225,9 +225,9 @@ ScVbaWSFunction::invoke(const OUString& FunctionName, const uno::Sequence< uno:: #if 0 // MATCH function should alwayse return a double value, but currently if the first argument is XCellRange, MATCH function returns an array instead of a double value. Don't know why? // To fix this issue in safe, current solution is to convert this array to a double value just for MATCH function. - String aUpper( FunctionName ); + OUString aUpper( FunctionName.toAsciiUpperCase() ); ScCompiler aCompiler( NULL, ScAddress() ); - OpCode eOp = aCompiler.GetEnglishOpCode( aUpper.ToUpperAscii() ); + OpCode eOp = aCompiler.GetEnglishOpCode( aUpper ); if( eOp == ocMatch ) { double fVal = 0.0; diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index 8484ed2ad44d..f3be1cb9527b 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -591,9 +591,8 @@ void ScCellShell::GetState(SfxItemSet &rSet) ScRange aRange; if ( pData->GetSimpleArea( aRange ) == SC_MARK_SIMPLE ) { - String aStr; sal_uInt16 nFlags = SCA_VALID | SCA_TAB_3D; - aRange.Format(aStr,nFlags,pDoc); + OUString aStr(aRange.Format(nFlags,pDoc)); rSet.Put( SfxStringItem( nWhich, aStr ) ); } } diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index dc6cfa57f838..b7d6d307acab 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -325,17 +325,17 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if ( pReqArgs!=NULL && pTabViewShell->SelectionEditable() ) { const SfxPoolItem* pItem; - String aFlags = OUString('A'); + OUString aFlags('A'); if( pReqArgs->HasItem( SID_DELETE, &pItem ) ) aFlags = ((const SfxStringItem*)pItem)->GetValue(); - aFlags.ToUpperAscii(); + aFlags = aFlags.toAsciiUpperCase(); sal_Bool bCont = sal_True; - for( xub_StrLen i=0 ; bCont && i<aFlags.Len() ; i++ ) + for (sal_Int32 i=0 ; bCont && i<aFlags.getLength(); ++i) { - switch( aFlags.GetChar(i) ) + switch (aFlags[i]) { case 'A': // all nFlags |= IDF_ALL; @@ -439,17 +439,17 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if ( pReqArgs!=NULL && pTabViewShell->SelectionEditable() ) { const SfxPoolItem* pItem; - String aFlags = OUString('A'); + OUString aFlags('A'); if( pReqArgs->HasItem( FID_FILL_TAB, &pItem ) ) aFlags = ((const SfxStringItem*)pItem)->GetValue(); - aFlags.ToUpperAscii(); + aFlags = aFlags.toAsciiUpperCase(); sal_Bool bCont = sal_True; - for( xub_StrLen i=0 ; bCont && i<aFlags.Len() ; i++ ) + for (sal_Int32 i=0; bCont && i < aFlags.getLength(); ++i) { - switch( aFlags.GetChar(i) ) + switch (aFlags[i]) { case 'A': // all nFlags |= IDF_ALL; @@ -885,9 +885,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if( ! rReq.IsAPI() ) { - String aAdrStr; ScAddress aAdr( nFillCol, nFillRow, 0 ); - aAdr.Format( aAdrStr, SCR_ABS, pDoc, pDoc->GetAddressConvention() ); + OUString aAdrStr(aAdr.Format(SCR_ABS, pDoc, pDoc->GetAddressConvention())); rReq.AppendItem( SfxStringItem( FID_FILL_AUTO, aAdrStr ) ); rReq.Done(); @@ -1057,13 +1056,13 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if( pReqArgs->HasItem( SID_OUTLINE_MAKE, &pItem ) ) { - String aCol = ((const SfxStringItem*)pItem)->GetValue(); - aCol.ToUpperAscii(); + OUString aCol = ((const SfxStringItem*)pItem)->GetValue(); + aCol = aCol.toAsciiUpperCase(); - switch( aCol.GetChar(0) ) + switch( aCol[0] ) { - case 'R': bColumns=false; bOk = sal_True;break; - case 'C': bColumns=sal_True; bOk = sal_True;break; + case 'R': bColumns=false; bOk = true;break; + case 'C': bColumns=true; bOk = true;break; } } } @@ -1119,13 +1118,13 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if( pReqArgs->HasItem( SID_OUTLINE_REMOVE, &pItem ) ) { - String aCol = ((const SfxStringItem*)pItem)->GetValue(); - aCol.ToUpperAscii(); + OUString aCol = ((const SfxStringItem*)pItem)->GetValue(); + aCol = aCol.toAsciiUpperCase(); - switch( aCol.GetChar(0) ) + switch (aCol[0]) { - case 'R': bColumns=false; bOk = sal_True;break; - case 'C': bColumns=sal_True; bOk = sal_True;break; + case 'R': bColumns=false; bOk = true;break; + case 'C': bColumns=true; bOk = true;break; } } } @@ -1256,17 +1255,17 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if ( pReqArgs!=NULL && pTabViewShell->SelectionEditable() ) { const SfxPoolItem* pItem; - String aFlags = OUString('A'); + OUString aFlags('A'); if( pReqArgs->HasItem( FID_INS_CELL_CONTENTS, &pItem ) ) aFlags = ((const SfxStringItem*)pItem)->GetValue(); - aFlags.ToUpperAscii(); + aFlags = aFlags.toAsciiUpperCase(); sal_Bool bCont = sal_True; - for( xub_StrLen i=0 ; bCont && i<aFlags.Len() ; i++ ) + for (sal_Int32 i=0 ; bCont && i<aFlags.getLength(); ++i) { - switch( aFlags.GetChar(i) ) + switch (aFlags[i]) { case 'A': // all nFlags |= IDF_ALL; diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index fd953a70d78e..3246cf050df0 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -137,14 +137,13 @@ static sal_Bool lcl_GetSortParam( const ScViewData* pData, ScSortParam& rSortPar ( rSortParam.nRow1 == rSortParam.nRow2 && aExternalRange.aStart.Row() != aExternalRange.aEnd.Row() ) ) { sal_uInt16 nFmt = SCA_VALID; - String aExtendStr,aCurrentStr; pTabViewShell->AddHighlightRange( aExternalRange,Color( COL_LIGHTBLUE ) ); ScRange rExtendRange( aExternalRange.aStart.Col(), aExternalRange.aStart.Row(), nTab, aExternalRange.aEnd.Col(), aExternalRange.aEnd.Row(), nTab ); - rExtendRange.Format( aExtendStr, nFmt, pDoc ); + OUString aExtendStr(rExtendRange.Format(nFmt, pDoc)); ScRange rCurrentRange( rSortParam.nCol1, rSortParam.nRow1, nTab, rSortParam.nCol2, rSortParam.nRow2, nTab ); - rCurrentRange.Format( aCurrentStr, nFmt, pDoc ); + OUString aCurrentStr(rCurrentRange.Format(nFmt, pDoc)); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); diff --git a/sc/source/ui/view/colrowba.cxx b/sc/source/ui/view/colrowba.cxx index fda9c55c43d3..76029c0347cb 100644 --- a/sc/source/ui/view/colrowba.cxx +++ b/sc/source/ui/view/colrowba.cxx @@ -92,7 +92,7 @@ sal_uInt16 ScColBar::GetEntrySize( SCCOLROW nEntryNo ) String ScColBar::GetEntryText( SCCOLROW nEntryNo ) { return UseNumericHeader() - ? String(OUString::number(nEntryNo + 1)) //FIXME remove String again + ? OUString::number(nEntryNo + 1) //FIXME remove String again : ScColToAlpha( static_cast<SCCOL>(nEntryNo) ); } diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 208318b01c3a..d2fb9ac75614 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -2329,8 +2329,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) aBuf.append('#'); aBuf.append(aExtInfo.maTabName); aBuf.append('.'); - OUString aRefCalcA1; - aTempAddr.Format(aRefCalcA1, SCA_ABS, NULL, formula::FormulaGrammar::CONV_OOO); + OUString aRefCalcA1(aTempAddr.Format(SCA_ABS, NULL, formula::FormulaGrammar::CONV_OOO)); aBuf.append(aRefCalcA1); ScGlobal::OpenURL(aBuf.makeStringAndClear(), aTarget); } @@ -2338,8 +2337,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) { // Internal reference. aBuf.append('#'); - OUString aUrlCalcA1; - aTempAddr.Format(aUrlCalcA1, SCA_ABS_3D, pDoc, formula::FormulaGrammar::CONV_OOO); + OUString aUrlCalcA1(aTempAddr.Format(SCA_ABS_3D, pDoc, formula::FormulaGrammar::CONV_OOO)); aBuf.append(aUrlCalcA1); ScGlobal::OpenURL(aBuf.makeStringAndClear(), aTarget); } @@ -2400,7 +2398,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) { ScRange aScRange; rMark.GetMarkArea( aScRange ); - aScRange.Format( aAddr, SCR_ABS ); + aAddr = aScRange.Format(SCR_ABS); if ( aScRange.aStart == aScRange.aEnd ) { // make sure there is a range selection string even for a single cell @@ -2415,7 +2413,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) else // nur Cursor bewegen { ScAddress aScAddress( pViewData->GetCurX(), pViewData->GetCurY(), 0 ); - aScAddress.Format( aAddr, SCA_ABS ); + aAddr = aScAddress.Format(SCA_ABS); } SfxStringItem aPosItem( SID_CURRENTCELL, aAddr ); @@ -4045,8 +4043,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos OUString aChartName; if (pThisDoc->HasChartAtPoint( nThisTab, rLogicPos, aChartName )) { - String aRangeName; - aSource.Format( aRangeName, SCR_ABS_3D, pThisDoc ); + OUString aRangeName(aSource.Format(SCR_ABS_3D, pThisDoc)); SfxStringItem aNameItem( SID_CHART_NAME, aChartName ); SfxStringItem aRangeItem( SID_CHART_SOURCE, aRangeName ); sal_uInt16 nId = bIsMove ? SID_CHART_SOURCE : SID_CHART_ADDSOURCE; @@ -4228,8 +4225,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos { String aApp = Application::GetAppName(); String aTopic = pSourceSh->GetTitle( SFX_TITLE_FULLNAME ); - String aItem; - aSource.Format( aItem, SCA_VALID | SCA_TAB_3D, pSourceDoc ); + OUString aItem(aSource.Format(SCA_VALID | SCA_TAB_3D, pSourceDoc)); // TODO: we could define ocQuote for " const OUString aQuote('"'); diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx index 71914dad5bc4..c104b463561b 100644 --- a/sc/source/ui/view/gridwin2.cxx +++ b/sc/source/ui/view/gridwin2.cxx @@ -1028,12 +1028,12 @@ void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, sal_Bool bUp ) const ScRange* pOld = pDoc->GetPrintRange( nTab, nPos ); if ( pOld ) { - String aTemp; + OUString aTemp; if ( *pOld != aPagebreakSource ) - pOld->Format( aTemp, SCA_VALID ); + aTemp = pOld->Format(SCA_VALID); else if ( !bHide ) - aPagebreakDrag.Format( aTemp, SCA_VALID ); - if (aTemp.Len()) + aTemp = aPagebreakDrag.Format(SCA_VALID); + if (!aTemp.isEmpty()) { if ( aNewRanges.Len() ) aNewRanges += ';'; @@ -1043,7 +1043,7 @@ void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, sal_Bool bUp ) } } else if (!bHide) - aPagebreakDrag.Format( aNewRanges, SCA_VALID ); + aNewRanges = aPagebreakDrag.Format(SCA_VALID); pViewFunc->SetPrintRanges( pDoc->IsPrintEntireSheet( nTab ), &aNewRanges, NULL, NULL, false ); } diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index a8acd70ca3d2..8f13897016bb 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -2449,9 +2449,8 @@ void ScOutputData::AddPDFNotes() const ScPostIt* pNote = mpDoc->GetNotes(nTab)->findByAddress(nMergeX, nMergeY); // Note title is the cell address (as on printed note pages) - String aTitle; ScAddress aAddress( nMergeX, nMergeY, nTab ); - aAddress.Format( aTitle, SCA_VALID, mpDoc, mpDoc->GetAddressConvention() ); + OUString aTitle(aAddress.Format(SCA_VALID, mpDoc, mpDoc->GetAddressConvention())); // Content has to be a simple string without line breaks String aContent = pNote->GetText(); diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index e7fa2bb3b623..0a7cb3289b73 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -1874,8 +1874,7 @@ long ScPrintFunc::DoNotes( long nNoteStart, sal_Bool bDoPrint, ScPreviewLocation { pEditEngine->Draw( pDev, Point( nPosX, nPosY ), 0 ); - String aMarkStr; - rPos.Format( aMarkStr, SCA_VALID, pDoc, pDoc->GetAddressConvention() ); + String aMarkStr(rPos.Format(SCA_VALID, pDoc, pDoc->GetAddressConvention())); aMarkStr += ':'; // cell position also via EditEngine, for correct positioning diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 022f9ddc6469..b4ca5021b61a 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -229,8 +229,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) case SID_CURRENTCELL: { ScAddress aScAddress( GetViewData()->GetCurX(), GetViewData()->GetCurY(), 0 ); - String aAddr; - aScAddress.Format( aAddr, SCA_ABS, NULL, pDoc->GetAddressConvention() ); + OUString aAddr(aScAddress.Format(SCA_ABS, NULL, pDoc->GetAddressConvention())); SfxStringItem aPosItem( SID_CURRENTCELL, aAddr ); rSet.Put( aPosItem ); diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index c6b810bd8499..b8c1d0172f75 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -392,7 +392,7 @@ sal_Bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, else { ScAddress aCellPos( nPosX,nPosY,nTab ); - aCellPos.Format( sTarget, SCA_ABS_3D, pDoc, pDoc->GetAddressConvention() ); + sTarget = aCellPos.Format(SCA_ABS_3D, pDoc, pDoc->GetAddressConvention()); } SfxStringItem aTarget(FN_PARAM_1, sTarget); diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx index be2178b7820e..e324d4aae08f 100644 --- a/sc/source/ui/view/viewfun6.cxx +++ b/sc/source/ui/view/viewfun6.cxx @@ -107,8 +107,7 @@ void ScViewFunc::DetectiveRefresh() static void lcl_jumpToRange(const ScRange& rRange, ScViewData* pView, ScDocument* pDoc) { - String aAddrText; - rRange.Format(aAddrText, SCR_ABS_3D, pDoc); + OUString aAddrText(rRange.Format(SCR_ABS_3D, pDoc)); SfxStringItem aPosItem(SID_CURRENTCELL, aAddrText); SfxBoolItem aUnmarkItem(FN_PARAM_1, true); // remove existing selection pView->GetDispatcher().Execute( @@ -189,11 +188,10 @@ void ScViewFunc::DetectiveMarkPred() aBuf.append(rTabName); aBuf.append(sal_Unicode('.')); - String aRangeStr; - aRange.Format(aRangeStr, SCA_VALID); + OUString aRangeStr(aRange.Format(SCA_VALID)); aBuf.append(aRangeStr); - ScGlobal::OpenURL(aBuf.makeStringAndClear(), String()); + ScGlobal::OpenURL(aBuf.makeStringAndClear(), OUString()); } return; } diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 631e09936394..2096db70e562 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -2757,7 +2757,7 @@ void ScViewFunc::ChangeIndent( sal_Bool bIncrement ) } sal_Bool ScViewFunc::InsertName( const String& rName, const String& rSymbol, - const String& rType ) + const OUString& rType ) { // Type = P,R,C,F (and combinations) //! undo... @@ -2772,8 +2772,7 @@ sal_Bool ScViewFunc::InsertName( const String& rName, const String& rSymbol, ScRangeData* pNewEntry = new ScRangeData( pDoc, rName, rSymbol, ScAddress( GetViewData()->GetCurX(), GetViewData()->GetCurY(), nTab), nType ); - String aUpType = rType; - aUpType.ToUpperAscii(); + String aUpType = rType.toAsciiUpperCase(); if ( aUpType.Search( 'P' ) != STRING_NOTFOUND ) nType |= RT_PRINTAREA; if ( aUpType.Search( 'R' ) != STRING_NOTFOUND ) diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx index 6699530f104d..5ae5c861da2c 100644 --- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx +++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx @@ -137,8 +137,7 @@ void ScXMLSourceDlg::SetReference(const ScRange& rRange, ScDocument* pDoc) if (rRange.aStart != rRange.aEnd) RefInputStart(mpActiveEdit); - OUString aStr; - rRange.aStart.Format(aStr, SCA_ABS_3D, pDoc, pDoc->GetAddressConvention()); + OUString aStr(rRange.aStart.Format(SCA_ABS_3D, pDoc, pDoc->GetAddressConvention())); mpActiveEdit->SetRefString(aStr); RefEditModified(); @@ -304,8 +303,7 @@ void ScXMLSourceDlg::TreeItemSelected() const ScAddress& rPos = pUserData->maLinkedPos; if (rPos.IsValid()) { - OUString aStr; - rPos.Format(aStr, SCA_ABS_3D, mpDoc, mpDoc->GetAddressConvention()); + OUString aStr(rPos.Format(SCA_ABS_3D, mpDoc, mpDoc->GetAddressConvention())); maRefEdit.SetRefString(aStr); } else |