From 906e35f80a17d51c305e0db251e6224f5dd23d52 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 27 Feb 2012 09:45:35 +0000 Subject: merge GetString variants --- sc/inc/cell.hxx | 18 ++++------- sc/source/core/data/autonamecache.cxx | 6 ++-- sc/source/core/data/cell.cxx | 18 +++++------ sc/source/core/data/cell2.cxx | 37 +++++++--------------- sc/source/core/data/column.cxx | 3 +- sc/source/core/data/column3.cxx | 16 ++++------ sc/source/core/data/conditio.cxx | 10 +++--- sc/source/core/data/documen8.cxx | 6 ++-- sc/source/core/data/document.cxx | 6 ++-- sc/source/core/data/table3.cxx | 4 +-- sc/source/core/data/table4.cxx | 20 ++++++------ sc/source/core/data/validat.cxx | 13 ++++---- sc/source/core/tool/cellform.cxx | 15 ++++----- sc/source/core/tool/chgtrack.cxx | 8 ++--- sc/source/core/tool/compiler.cxx | 12 +++---- sc/source/core/tool/interpr4.cxx | 34 +++++++++----------- sc/source/core/tool/interpr5.cxx | 3 +- sc/source/filter/dif/difexp.cxx | 4 +-- sc/source/filter/excel/xehelper.cxx | 6 ++-- sc/source/filter/excel/xestream.cxx | 6 ++-- sc/source/filter/excel/xetable.cxx | 6 ++-- sc/source/filter/xcl97/XclExpChangeTrack.cxx | 4 +-- .../filter/xml/XMLChangeTrackingExportHelper.cxx | 10 ++---- sc/source/filter/xml/xmlexprt.cxx | 2 +- sc/source/ui/app/inputhdl.cxx | 4 +-- sc/source/ui/app/transobj.cxx | 3 +- sc/source/ui/docshell/docsh.cxx | 4 +-- sc/source/ui/docshell/externalrefmgr.cxx | 21 ++++-------- sc/source/ui/formdlg/formula.cxx | 4 +-- sc/source/ui/unoobj/funcuno.cxx | 5 ++- sc/source/ui/view/tabvwsh5.cxx | 2 +- tools/inc/tools/string.hxx | 2 -- tools/source/string/strucvt.cxx | 10 ------ 33 files changed, 128 insertions(+), 194 deletions(-) diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx index 387ff69202f9..93fc09f9391e 100644 --- a/sc/inc/cell.hxx +++ b/sc/inc/cell.hxx @@ -228,26 +228,24 @@ public: #endif ScStringCell(); - explicit ScStringCell( const String& rString ); + explicit ScStringCell(const rtl::OUString& rString); #if OSL_DEBUG_LEVEL > 0 ~ScStringCell(); #endif - inline void SetString( const String& rString ) { maString = rString; } - inline void GetString( String& rString ) const { rString = maString; } - inline void GetString( rtl::OUString& rString ) const { rString = maString; } - inline const String& GetString() const { return maString; } + inline void SetString( const rtl::OUString& rString ) { maString = rString; } + inline const rtl::OUString& GetString() const { return maString; } private: - String maString; + rtl::OUString maString; }; class SC_DLLPUBLIC ScEditCell : public ScBaseCell { private: EditTextObject* pData; - String* pString; // for faster access to formulas + mutable rtl::OUString* pString; // for faster access to formulas ScDocument* pDoc; // for EditEngine access with Pool void SetTextObject( const EditTextObject* pObject, @@ -273,8 +271,7 @@ public: void SetData( const EditTextObject* pObject, const SfxItemPool* pFromPool /* = NULL */ ); void GetData( const EditTextObject*& rpObject ) const; - void GetString( String& rString ) const; - void GetString( rtl::OUString& rString ) const; + rtl::OUString GetString() const; const EditTextObject* GetData() const { return pData; } @@ -464,8 +461,7 @@ public: bool IsValue(); // also true if formula::svEmptyCell double GetValue(); double GetValueAlways(); // ignore errors - void GetString( String& rString ); - void GetString( rtl::OUString& rString ); + rtl::OUString GetString(); const ScMatrix* GetMatrix(); bool GetMatrixOrigin( ScAddress& rPos ) const; void GetResultDimensions( SCSIZE& rCols, SCSIZE& rRows ); diff --git a/sc/source/core/data/autonamecache.cxx b/sc/source/core/data/autonamecache.cxx index 2c6caa00c69b..9dcccf29bf83 100644 --- a/sc/source/core/data/autonamecache.cxx +++ b/sc/source/core/data/autonamecache.cxx @@ -78,13 +78,13 @@ const ScAutoNameAddresses& ScAutoNameCache::GetNameOccurrences( const String& rN switch ( eType ) { case CELLTYPE_STRING: - ((ScStringCell*)pCell)->GetString( aStr ); + aStr = ((ScStringCell*)pCell)->GetString(); break; case CELLTYPE_FORMULA: - ((ScFormulaCell*)pCell)->GetString( aStr ); + aStr = ((ScFormulaCell*)pCell)->GetString(); break; case CELLTYPE_EDIT: - ((ScEditCell*)pCell)->GetString( aStr ); + aStr = ((ScEditCell*)pCell)->GetString(); break; case CELLTYPE_NONE: case CELLTYPE_VALUE: diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx index 48d6391f9382..c8ac64f3e5a3 100644 --- a/sc/source/core/data/cell.cxx +++ b/sc/source/core/data/cell.cxx @@ -564,13 +564,13 @@ String ScBaseCell::GetStringData() const switch ( eCellType ) { case CELLTYPE_STRING: - ((const ScStringCell*)this)->GetString( aStr ); + aStr = ((const ScStringCell*)this)->GetString(); break; case CELLTYPE_EDIT: - ((const ScEditCell*)this)->GetString( aStr ); + aStr = ((const ScEditCell*)this)->GetString(); break; case CELLTYPE_FORMULA: - ((ScFormulaCell*)this)->GetString( aStr ); // an der Formelzelle nicht-const + aStr = ((ScFormulaCell*)this)->GetString(); // an der Formelzelle nicht-const break; } return aStr; @@ -610,14 +610,14 @@ bool ScBaseCell::CellEqual( const ScBaseCell* pCell1, const ScBaseCell* pCell2 ) { String aText1; if ( pCell1->GetCellType() == CELLTYPE_STRING ) - ((const ScStringCell*)pCell1)->GetString(aText1); + aText1 = ((const ScStringCell*)pCell1)->GetString(); else - ((const ScEditCell*)pCell1)->GetString(aText1); + aText1 = ((const ScEditCell*)pCell1)->GetString(); String aText2; if ( pCell2->GetCellType() == CELLTYPE_STRING ) - ((const ScStringCell*)pCell2)->GetString(aText2); + aText2 = ((const ScStringCell*)pCell2)->GetString(); else - ((const ScEditCell*)pCell2)->GetString(aText2); + aText2 = ((const ScEditCell*)pCell2)->GetString(); return ( aText1 == aText2 ); } case CELLTYPE_FORMULA: @@ -704,7 +704,7 @@ ScStringCell::ScStringCell() : { } -ScStringCell::ScStringCell( const String& rString ) : +ScStringCell::ScStringCell( const rtl::OUString& rString ) : ScBaseCell( CELLTYPE_STRING ), maString( rString.intern() ) { @@ -1980,7 +1980,7 @@ void ScFormulaCell::GetURLResult( String& rURL, String& rCellText ) } else { - GetString( aCellString ); + aCellString = GetString(); pFormatter->GetOutputString( aCellString, nCellFormat, rCellText, &pColor ); } ScConstMatrixRef xMat( aResult.GetMatrix()); diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx index 117d31df7dc0..5938e157473c 100644 --- a/sc/source/core/data/cell2.cxx +++ b/sc/source/core/data/cell2.cxx @@ -122,29 +122,24 @@ void ScEditCell::GetData( const EditTextObject*& rpObject ) const rpObject = pData; } -void ScEditCell::GetString( String& rString ) const +rtl::OUString ScEditCell::GetString() const { if ( pString ) - rString = *pString; - else if ( pData ) + return *pString; + + if ( pData ) { // auch Text von URL-Feldern, Doc-Engine ist eine ScFieldEditEngine EditEngine& rEngine = pDoc->GetEditEngine(); rEngine.SetText( *pData ); - rString = ScEditUtil::GetMultilineString(rEngine); // string with line separators between paragraphs + rtl::OUString sRet = ScEditUtil::GetMultilineString(rEngine); // string with line separators between paragraphs // cache short strings for formulas - if ( rString.Len() < 256 ) - ((ScEditCell*)this)->pString = new String( rString ); //! non-const + if ( sRet.getLength() < 256 ) + pString = new rtl::OUString(sRet); //! non-const + return sRet; } - else - rString.Erase(); -} -void ScEditCell::GetString( rtl::OUString& rString ) const -{ - String aTmp; - GetString(aTmp); - rString = aTmp; + return rtl::OUString(); } void ScEditCell::RemoveCharAttribs( const ScPatternAttr& rAttr ) @@ -524,21 +519,13 @@ double ScFormulaCell::GetValueAlways() return aResult.GetDouble(); } -void ScFormulaCell::GetString( String& rString ) +rtl::OUString ScFormulaCell::GetString() { MaybeInterpret(); if ((!pCode->GetCodeError() || pCode->GetCodeError() == errDoubleRef) && !aResult.GetResultError()) - rString = aResult.GetString(); - else - rString.Erase(); -} - -void ScFormulaCell::GetString( rtl::OUString& rString ) -{ - String aTmp; - GetString(aTmp); - rString = aTmp; + return aResult.GetString(); + return rtl::OUString(); } const ScMatrix* ScFormulaCell::GetMatrix() diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 50f0e95b153d..444cc67df767 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1308,8 +1308,7 @@ void ScColumn::CopyToColumn(SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bM // empty cell. if (pNew->GetCellType() == CELLTYPE_STRING) { - String aStr; - static_cast(pNew)->GetString(aStr); + String aStr = static_cast(pNew)->GetString(); if (aStr.Len() == 0) // A string cell with empty string. Delete the cell itself. rColumn.Delete(maItems[i].nRow); diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index c6d16b5b8b05..ab9f666034e6 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -898,8 +898,7 @@ ScBaseCell* ScColumn::CloneCell(SCSIZE nIndex, sal_uInt16 nFlags, ScDocument& rD } else if (bCloneString) { - String aString; - rForm.GetString( aString ); + String aString = rForm.GetString(); // do not clone empty string if (aString.Len() > 0) { @@ -1342,7 +1341,7 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString, switch ( pCell->GetCellType() ) { case CELLTYPE_STRING : - ((ScStringCell*)pCell)->GetString( aStr ); + aStr = ((ScStringCell*)pCell)->GetString(); if ( rString == aStr ) bIsText = true; break; @@ -1628,9 +1627,9 @@ bool ScColumn::GetDataEntries(SCROW nStartRow, std::set& rString if (eType == CELLTYPE_STRING || eType == CELLTYPE_EDIT) // nur Strings interessieren { if (eType == CELLTYPE_STRING) - ((ScStringCell*)pCell)->GetString(aString); + aString = ((ScStringCell*)pCell)->GetString(); else - ((ScEditCell*)pCell)->GetString(aString); + aString = ((ScEditCell*)pCell)->GetString(); bool bInserted = rStrings.insert(ScTypedStrData(aString)).second; if (bInserted && bLimit && rStrings.size() >= DATENT_MAX) @@ -1651,9 +1650,9 @@ bool ScColumn::GetDataEntries(SCROW nStartRow, std::set& rString if (eType == CELLTYPE_STRING || eType == CELLTYPE_EDIT) // nur Strings interessieren { if (eType == CELLTYPE_STRING) - ((ScStringCell*)pCell)->GetString(aString); + aString = ((ScStringCell*)pCell)->GetString(); else - ((ScEditCell*)pCell)->GetString(aString); + aString = ((ScEditCell*)pCell)->GetString(); bool bInserted = rStrings.insert(ScTypedStrData(aString)).second; if (bInserted && bLimit && rStrings.size() >= DATENT_MAX) @@ -1702,8 +1701,7 @@ void ScColumn::RemoveProtected( SCROW nStartRow, SCROW nEndRow ) } else { - String aString; - pFormula->GetString(aString); + String aString = pFormula->GetString(); maItems[nIndex].pCell = new ScStringCell( aString ); } delete pFormula; diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 61d71db44f73..ac4fa9e61e98 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -649,7 +649,7 @@ void ScConditionEntry::Interpret( const ScAddress& rPos ) else { bIsStr1 = sal_True; - pEff1->GetString( aStrVal1 ); + aStrVal1 = pEff1->GetString(); nVal1 = 0.0; } } @@ -678,7 +678,7 @@ void ScConditionEntry::Interpret( const ScAddress& rPos ) else { bIsStr2 = sal_True; - pEff2->GetString( aStrVal2 ); + aStrVal2 = pEff2->GetString(); nVal2 = 0.0; } } @@ -716,16 +716,16 @@ static sal_Bool lcl_GetCellContent( ScBaseCell* pCell, sal_Bool bIsStr1, double& if (bVal) rArg = pFCell->GetValue(); else - pFCell->GetString(rArgStr); + rArgStr = pFCell->GetString(); } break; case CELLTYPE_STRING: case CELLTYPE_EDIT: bVal = false; if ( eType == CELLTYPE_STRING ) - ((ScStringCell*)pCell)->GetString(rArgStr); + rArgStr = ((ScStringCell*)pCell)->GetString(); else - ((ScEditCell*)pCell)->GetString(rArgStr); + rArgStr = ((ScEditCell*)pCell)->GetString(); break; default: diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 021274554ecc..9e207c7c93db 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -726,8 +726,7 @@ bool ScDocument::OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpe if ( eType == CELLTYPE_STRING ) { - rtl::OUString aText; - static_cast(pCell)->GetString(aText); + rtl::OUString aText = static_cast(pCell)->GetString(); pEngine->SetText( aText ); } else @@ -1595,8 +1594,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp else if ( eType == CELLTYPE_STRING ) { - rtl::OUString aOldStr; - ((const ScStringCell*)pCell)->GetString(aOldStr); + rtl::OUString aOldStr = ((const ScStringCell*)pCell)->GetString(); sal_Int32 nOldLen = aOldStr.getLength(); if ( bConsiderLanguage ) diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index a7e66cd504c6..22e7ac4a1850 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3023,10 +3023,10 @@ sal_uInt16 ScDocument::GetStringForFormula( const ScAddress& rPos, rtl::OUString switch (pCell->GetCellType()) { case CELLTYPE_STRING: - static_cast(pCell)->GetString(aStr); + aStr = static_cast(pCell)->GetString(); break; case CELLTYPE_EDIT: - static_cast(pCell)->GetString(aStr); + aStr = static_cast(pCell)->GetString(); break; case CELLTYPE_FORMULA: { @@ -3041,7 +3041,7 @@ sal_uInt16 ScDocument::GetStringForFormula( const ScAddress& rPos, rtl::OUString pFormatter->GetInputLineString(fVal, nIndex, aStr); } else - pFCell->GetString(aStr); + aStr = pFCell->GetString(); } break; case CELLTYPE_VALUE: diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 36078ad62e8a..b15703ef2bf9 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -411,11 +411,11 @@ short ScTable::CompareCell( sal_uInt16 nSort, rtl::OUString aStr1; rtl::OUString aStr2; if (eType1 == CELLTYPE_STRING) - ((ScStringCell*)pCell1)->GetString(aStr1); + aStr1 = ((ScStringCell*)pCell1)->GetString(); else GetString(nCell1Col, nCell1Row, aStr1); if (eType2 == CELLTYPE_STRING) - ((ScStringCell*)pCell2)->GetString(aStr2); + aStr2 = ((ScStringCell*)pCell2)->GetString(); else GetString(nCell2Col, nCell2Row, aStr2); diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 7990d28704c9..85f3169f1dbd 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -386,9 +386,9 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if ( eType == CELLTYPE_STRING || eType == CELLTYPE_EDIT ) { if ( eType == CELLTYPE_STRING ) - ((ScStringCell*)pCell)->GetString( aStr ); + aStr = ((ScStringCell*)pCell)->GetString(); else - ((ScEditCell*)pCell)->GetString( aStr ); + aStr = ((ScEditCell*)pCell)->GetString(); aString = aStr; nFlag2 = lcl_DecompValueString( aString, nVal2, &rMinDigits ); aStr = aString; @@ -748,9 +748,9 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, case CELLTYPE_STRING: case CELLTYPE_EDIT: if ( eCellType == CELLTYPE_STRING ) - ((ScStringCell*)pSrcCell)->GetString( aValue ); + aValue = ((ScStringCell*)pSrcCell)->GetString(); else - ((ScEditCell*)pSrcCell)->GetString( aValue ); + aValue = ((ScEditCell*)pSrcCell)->GetString(); if ( !(nScFillModeMouseModifier & KEY_MOD1) && !bHasFiltered ) { nCellDigits = 0; // look at each source cell individually @@ -1012,9 +1012,9 @@ String ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW n case CELLTYPE_EDIT: { if ( eType == CELLTYPE_STRING ) - ((ScStringCell*)pCell)->GetString( aValue ); + aValue = ((ScStringCell*)pCell)->GetString(); else - ((ScEditCell*)pCell)->GetString( aValue ); + aValue = ((ScEditCell*)pCell)->GetString(); if ( !(nScFillModeMouseModifier & KEY_MOD1) && !IsDataFiltered() ) { sal_Int32 nVal; @@ -1069,9 +1069,9 @@ String ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW n case CELLTYPE_EDIT: { if ( eType == CELLTYPE_STRING ) - ((ScStringCell*)pCell)->GetString( aValue ); + aValue = ((ScStringCell*)pCell)->GetString(); else - ((ScEditCell*)pCell)->GetString( aValue ); + aValue = ((ScEditCell*)pCell)->GetString(); nHeadNoneTail = lcl_DecompValueString( aValue, nVal ); if ( nHeadNoneTail ) nStart = (double)nVal; @@ -1465,9 +1465,9 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, } String aValue; if (eCellType == CELLTYPE_STRING) - ((ScStringCell*)pSrcCell)->GetString( aValue ); + aValue = ((ScStringCell*)pSrcCell)->GetString(); else - ((ScEditCell*)pSrcCell)->GetString( aValue ); + aValue = ((ScEditCell*)pSrcCell)->GetString(); sal_Int32 nStringValue; sal_uInt16 nMinDigits = nArgMinDigits; short nHeadNoneTail = lcl_DecompValueString( aValue, nStringValue, &nMinDigits ); diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index 277ab9835587..a759385c31ae 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -212,7 +212,7 @@ sal_Bool ScValidationData::DoScript( const ScAddress& rPos, const String& rInput if ( bIsValue ) nValue = pCell->GetValue(); else - pCell->GetString( aValStr ); + aValStr = pCell->GetString(); } if ( bIsValue ) aParams[0] = ::com::sun::star::uno::makeAny( nValue ); @@ -334,7 +334,7 @@ sal_Bool ScValidationData::DoMacro( const ScAddress& rPos, const String& rInput, if ( bIsValue ) nValue = pCell->GetValue(); else - pCell->GetString( aValStr ); + aValStr = pCell->GetString(); } if ( bIsValue ) refPar->Get(1)->PutDouble( nValue ); @@ -478,11 +478,11 @@ sal_Bool ScValidationData::IsDataValid( ScBaseCell* pCell, const ScAddress& rPos nVal = ((ScValueCell*)pCell)->GetValue(); break; case CELLTYPE_STRING: - ((ScStringCell*)pCell)->GetString( aString ); + aString = ((ScStringCell*)pCell)->GetString(); bIsVal = false; break; case CELLTYPE_EDIT: - ((ScEditCell*)pCell)->GetString( aString ); + aString = ((ScEditCell*)pCell)->GetString(); bIsVal = false; break; case CELLTYPE_FORMULA: @@ -492,7 +492,7 @@ sal_Bool ScValidationData::IsDataValid( ScBaseCell* pCell, const ScAddress& rPos if ( bIsVal ) nVal = pFCell->GetValue(); else - pFCell->GetString( aString ); + aString = pFCell->GetString(); } break; default: // Notizen, Broadcaster @@ -654,8 +654,7 @@ bool ScValidationData::GetSelectionFromFormula( xMatRef->PutDouble( aValidationSrc.GetValue(), 0); else { - String aStr; - aValidationSrc.GetString( aStr); + String aStr = aValidationSrc.GetString(); xMatRef->PutString( aStr, 0); } diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx index 72effcc74a4c..066b5c1d640b 100644 --- a/sc/source/core/tool/cellform.cxx +++ b/sc/source/core/tool/cellform.cxx @@ -64,15 +64,13 @@ void ScCellFormat::GetString( ScBaseCell* pCell, sal_uLong nFormat, rtl::OUStrin { case CELLTYPE_STRING: { - String aCellString; - ((ScStringCell*)pCell)->GetString( aCellString ); + String aCellString = ((ScStringCell*)pCell)->GetString(); rFormatter.GetOutputString( aCellString, nFormat, aString, ppColor ); } break; case CELLTYPE_EDIT: { - String aCellString; - ((ScEditCell*)pCell)->GetString( aCellString ); + String aCellString = ((ScEditCell*)pCell)->GetString(); rFormatter.GetOutputString( aCellString, nFormat, aString, ppColor ); } break; @@ -141,8 +139,7 @@ void ScCellFormat::GetString( ScBaseCell* pCell, sal_uLong nFormat, rtl::OUStrin } else { - String aCellString; - pFCell->GetString( aCellString ); + String aCellString = pFCell->GetString(); rFormatter.GetOutputString( aCellString, nFormat, aString, ppColor ); } } @@ -171,12 +168,12 @@ void ScCellFormat::GetInputString( ScBaseCell* pCell, sal_uLong nFormat, rtl::OU { case CELLTYPE_STRING: { - ((ScStringCell*)pCell)->GetString( aString ); + aString = ((ScStringCell*)pCell)->GetString(); } break; case CELLTYPE_EDIT: { - ((ScEditCell*)pCell)->GetString( aString ); + aString = ((ScEditCell*)pCell)->GetString(); } break; case CELLTYPE_VALUE: @@ -198,7 +195,7 @@ void ScCellFormat::GetInputString( ScBaseCell* pCell, sal_uLong nFormat, rtl::OU } else { - ((ScFormulaCell*)pCell)->GetString( aString ); + aString = ((ScFormulaCell*)pCell)->GetString(); } sal_uInt16 nErrCode = ((ScFormulaCell*)pCell)->GetErrCode(); diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index 65670be6a209..0a90a2232180 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -1727,10 +1727,10 @@ void ScChangeActionContent::GetStringOfCell( rtl::OUString& rStr, } break; case CELLTYPE_STRING : - ((ScStringCell*)pCell)->GetString( rStr ); + rStr = ((ScStringCell*)pCell)->GetString(); break; case CELLTYPE_EDIT : - ((ScEditCell*)pCell)->GetString( rStr ); + rStr = ((ScEditCell*)pCell)->GetString(); break; case CELLTYPE_FORMULA : ((ScFormulaCell*)pCell)->GetFormula( rStr ); @@ -1863,10 +1863,10 @@ void ScChangeActionContent::GetValueString( switch ( pCell->GetCellType() ) { case CELLTYPE_STRING : - ((ScStringCell*)pCell)->GetString( rStr ); + rStr = ((ScStringCell*)pCell)->GetString(); break; case CELLTYPE_EDIT : - ((ScEditCell*)pCell)->GetString( rStr ); + rStr = ((ScEditCell*)pCell)->GetString(); break; case CELLTYPE_VALUE : // ist immer in rValue rStr = rValue; diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 162eaf5549fd..a1c1ecfc4764 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -3049,13 +3049,13 @@ bool ScCompiler::IsColRowName( const String& rName ) switch ( eType ) { case CELLTYPE_STRING: - ((ScStringCell*)pCell)->GetString( aStr ); + aStr = ((ScStringCell*)pCell)->GetString(); break; case CELLTYPE_FORMULA: - ((ScFormulaCell*)pCell)->GetString( aStr ); + aStr = ((ScFormulaCell*)pCell)->GetString(); break; case CELLTYPE_EDIT: - ((ScEditCell*)pCell)->GetString( aStr ); + aStr = ((ScEditCell*)pCell)->GetString(); break; case CELLTYPE_NONE: case CELLTYPE_VALUE: @@ -3178,13 +3178,13 @@ bool ScCompiler::IsColRowName( const String& rName ) switch ( eType ) { case CELLTYPE_STRING: - ((ScStringCell*)pCell)->GetString( aStr ); + aStr = ((ScStringCell*)pCell)->GetString(); break; case CELLTYPE_FORMULA: - ((ScFormulaCell*)pCell)->GetString( aStr ); + aStr = ((ScFormulaCell*)pCell)->GetString(); break; case CELLTYPE_EDIT: - ((ScEditCell*)pCell)->GetString( aStr ); + aStr = ((ScEditCell*)pCell)->GetString(); break; case CELLTYPE_NONE: case CELLTYPE_VALUE: diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index fac1d34b9002..9e047ac0214e 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -456,8 +456,7 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, const ScBaseCel } else { - String aStr; - pFCell->GetString( aStr ); + String aStr = pFCell->GetString(); fValue = ConvertStringToValue( aStr ); } } @@ -484,9 +483,9 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, const ScBaseCel // it ... #i5658# String aStr; if ( eType == CELLTYPE_STRING ) - ((ScStringCell*)pCell)->GetString( aStr ); + aStr = ((ScStringCell*)pCell)->GetString(); else - ((ScEditCell*)pCell)->GetString( aStr ); + aStr = ((ScEditCell*)pCell)->GetString(); fValue = ConvertStringToValue( aStr ); } break; @@ -518,10 +517,10 @@ void ScInterpreter::GetCellString( String& rStr, const ScBaseCell* pCell ) switch (pCell->GetCellType()) { case CELLTYPE_STRING: - ((ScStringCell*) pCell)->GetString(rStr); + rStr = ((ScStringCell*) pCell)->GetString(); break; case CELLTYPE_EDIT: - ((ScEditCell*) pCell)->GetString(rStr); + rStr = ((ScEditCell*) pCell)->GetString(); break; case CELLTYPE_FORMULA: { @@ -536,7 +535,7 @@ void ScInterpreter::GetCellString( String& rStr, const ScBaseCell* pCell ) pFormatter->GetInputLineString(fVal, nIndex, rStr); } else - pFCell->GetString(rStr); + rStr = pFCell->GetString(); } break; case CELLTYPE_VALUE: @@ -687,16 +686,16 @@ bool ScInterpreter::CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, switch ( pCell->GetCellType() ) { case CELLTYPE_STRING : - ((ScStringCell*)pCell)->GetString(aStr); + aStr = ((ScStringCell*)pCell)->GetString(); break; case CELLTYPE_EDIT : - ((ScEditCell*)pCell)->GetString(aStr); + aStr = ((ScEditCell*)pCell)->GetString(); break; case CELLTYPE_FORMULA : if (!((ScFormulaCell*)pCell)->IsValue()) { nErr = ((ScFormulaCell*)pCell)->GetErrCode(); - ((ScFormulaCell*)pCell)->GetString(aStr); + aStr = ((ScFormulaCell*)pCell)->GetString(); } else bOk = false; @@ -793,11 +792,11 @@ bool ScInterpreter::CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, switch ( pCell->GetCellType() ) { case CELLTYPE_STRING : - ((ScStringCell*)pCell)->GetString(aStr); + aStr = ((ScStringCell*)pCell)->GetString(); nType = 1; break; case CELLTYPE_EDIT : - ((ScEditCell*)pCell)->GetString(aStr); + aStr = ((ScEditCell*)pCell)->GetString(); nType = 1; break; case CELLTYPE_VALUE : @@ -808,7 +807,7 @@ bool ScInterpreter::CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, if (((ScFormulaCell*)pCell)->IsValue()) nVal = ((ScFormulaCell*)pCell)->GetValue(); else - ((ScFormulaCell*)pCell)->GetString(aStr); + aStr = ((ScFormulaCell*)pCell)->GetString(); break; default : bOk = false; @@ -3369,15 +3368,13 @@ bool ScInterpreter::SetSbxVariable( SbxVariable* pVar, const ScAddress& rPos ) break; case CELLTYPE_STRING : { - String aVal; - ((ScStringCell*)pCell)->GetString( aVal ); + rtl::OUString aVal = ((ScStringCell*)pCell)->GetString(); pVar->PutString( aVal ); break; } case CELLTYPE_EDIT : { - String aVal; - ((ScEditCell*) pCell)->GetString( aVal ); + rtl::OUString aVal = ((ScEditCell*) pCell)->GetString(); pVar->PutString( aVal ); break; } @@ -3392,8 +3389,7 @@ bool ScInterpreter::SetSbxVariable( SbxVariable* pVar, const ScAddress& rPos ) } else { - String aVal; - ((ScFormulaCell*)pCell)->GetString( aVal ); + rtl::OUString aVal = ((ScFormulaCell*)pCell)->GetString(); pVar->PutString( aVal ); } } diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index 02d6db23db82..07dcaf574209 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -3273,8 +3273,7 @@ void ScInterpreter::ScMatRef() PushDouble( pCell->GetValue() ); else { - String aVal; - pCell->GetString( aVal ); + rtl::OUString aVal = pCell->GetString(); PushString( aVal ); } pDok->GetNumberFormatInfo( nCurFmtType, nCurFmtIndex, aAdr, pCell ); diff --git a/sc/source/filter/dif/difexp.cxx b/sc/source/filter/dif/difexp.cxx index c7b08b84b645..78d1dd18f7e0 100644 --- a/sc/source/filter/dif/difexp.cxx +++ b/sc/source/filter/dif/difexp.cxx @@ -196,7 +196,7 @@ FltError ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc aOS.appendAscii("\nV\n"); break; case CELLTYPE_EDIT: - static_cast(pAkt)->GetString(aString); + aString = static_cast(pAkt)->GetString(); bWriteStringData = true; break; case CELLTYPE_STRING: @@ -225,7 +225,7 @@ FltError ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc } else if( pAkt->HasStringData() ) { - static_cast(pAkt)->GetString(aString); + aString = static_cast(pAkt)->GetString(); bWriteStringData = true; } else diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index 3e805feb4919..9745cdae1724 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -573,8 +573,7 @@ XclExpStringRef XclExpStringHelper::CreateCellString( const XclExpRoot& rRoot, const ScStringCell& rStringCell, const ScPatternAttr* pCellAttr, XclStrFlags nFlags, sal_uInt16 nMaxLen ) { - String aCellText; - rStringCell.GetString( aCellText ); + rtl::OUString aCellText = rStringCell.GetString(); return lclCreateFormattedString( rRoot, aCellText, pCellAttr, nFlags, nMaxLen ); } @@ -602,8 +601,7 @@ XclExpStringRef XclExpStringHelper::CreateCellString( else { // unformatted cell - String aCellText; - rEditCell.GetString( aCellText ); + String aCellText = rEditCell.GetString(); xString = lclCreateFormattedString( rRoot, aCellText, pCellAttr, nFlags, nMaxLen ); } return xString; diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 1951656bcefd..5d064f3378b7 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -717,8 +717,7 @@ void XclXmlUtils::GetFormulaTypeAndValue( ScFormulaCell& rCell, const char*& rsT case NUMBERFORMAT_TEXT: { rsType = "str"; - String aResult; - rCell.GetString( aResult ); + String aResult = rCell.GetString(); rsValue = ToOUString( aResult ); } break; @@ -733,8 +732,7 @@ void XclXmlUtils::GetFormulaTypeAndValue( ScFormulaCell& rCell, const char*& rsT default: { rsType = "inlineStr"; - String aResult; - rCell.GetString( aResult ); + String aResult = rCell.GetString(); rsValue = ToOUString( aResult ); } break; diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index ac8c6caefa9a..88b3f83814bb 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -803,8 +803,7 @@ XclExpFormulaCell::XclExpFormulaCell( bool bForceLineBreak = false; if( nFormatType == NUMBERFORMAT_TEXT ) { - String aResult; - mrScFmlaCell.GetString( aResult ); + String aResult = mrScFmlaCell.GetString(); bForceLineBreak = mrScFmlaCell.IsMultilineResult(); nScript = XclExpStringHelper::GetLeadingScriptType( rRoot, aResult ); } @@ -949,8 +948,7 @@ void XclExpFormulaCell::WriteContents( XclExpStream& rStrm ) case NUMBERFORMAT_TEXT: { - String aResult; - mrScFmlaCell.GetString( aResult ); + String aResult = mrScFmlaCell.GetString(); if( aResult.Len() || (rStrm.GetRoot().GetBiff() <= EXC_BIFF5) ) { rStrm << EXC_FORMULA_RES_STRING; diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx index d009ef768d74..f18e824ea776 100644 --- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx @@ -859,14 +859,14 @@ void XclExpChTrCellContent::GetCellData( if( pScCell->GetCellType() == CELLTYPE_STRING ) { const ScStringCell* pStrCell = static_cast< const ScStringCell* >( pScCell ); - pStrCell->GetString( sCellStr ); + sCellStr = pStrCell->GetString(); rpData->mpFormattedString = XclExpStringHelper::CreateCellString( rRoot, *pStrCell, NULL ); } else { const ScEditCell* pEditCell = static_cast< const ScEditCell* >( pScCell ); - pEditCell->GetString( sCellStr ); + sCellStr = pEditCell->GetString(); XclExpHyperlinkHelper aLinkHelper( rRoot, aPosition ); rpData->mpFormattedString = XclExpStringHelper::CreateCellString( rRoot, *pEditCell, NULL, aLinkHelper ); diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx index 926a8c07ab94..45f7e913f3f3 100644 --- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx +++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx @@ -300,9 +300,7 @@ void ScChangeTrackingExportHelper::WriteStringCell(const ScBaseCell* pCell) const ScStringCell* pStringCell = static_cast(pCell); if (pStringCell) { - String sString; - pStringCell->GetString(sString); - rtl::OUString sOUString(sString); + rtl::OUString sOUString = pStringCell->GetString(); rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING); SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, XML_CHANGE_TRACK_TABLE_CELL, true, true); if (!sOUString.isEmpty()) @@ -319,8 +317,7 @@ void ScChangeTrackingExportHelper::WriteEditCell(const ScBaseCell* pCell) const ScEditCell* pEditCell = static_cast(pCell); if (pEditCell) { - String sString; - pEditCell->GetString(sString); + String sString = pEditCell->GetString(); rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING); SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, XML_CHANGE_TRACK_TABLE_CELL, true, true); if (sString.Len()) @@ -388,8 +385,7 @@ void ScChangeTrackingExportHelper::WriteFormulaCell(const ScBaseCell* pCell, con else { rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING); - String sCellValue; - pFormulaCell->GetString(sCellValue); + String sCellValue = pFormulaCell->GetString(); rtl::OUString sOUValue(sCellValue); SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, XML_CHANGE_TRACK_TABLE_CELL, true, true); if (!sOUValue.isEmpty()) diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 01689d251dc7..4770839d547f 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -205,7 +205,7 @@ OUString lcl_GetRawString( ScDocument* pDoc, const ScAddress& rPos ) { CellType eType = pCell->GetCellType(); if ( eType == CELLTYPE_STRING ) - static_cast(pCell)->GetString(aVal); // string cell: content + aVal = static_cast(pCell)->GetString(); // string cell: content else if ( eType == CELLTYPE_EDIT ) { // edit cell: text with line breaks diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 2fa6ae399b46..bc52b65bcd3c 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1350,9 +1350,7 @@ String lcl_Calculate( const String& rFormula, ScDocument* pDoc, const ScAddress } else { - String aStr; - - pCell->GetString( aStr ); + String aStr = pCell->GetString(); sal_uLong nFormat = aFormatter.GetStandardFormat( pCell->GetFormatType(), ScGlobal::eLnge); aFormatter.GetOutputString( aStr, nFormat, diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index a61e5d3d8d9e..38afe5250e06 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -825,8 +825,7 @@ void ScTransferObj::StripRefs( ScDocument* pDoc, } else { - String aStr; - pFCell->GetString(aStr); + String aStr = pFCell->GetString(); if ( pFCell->IsMultilineResult() ) pNew = new ScEditCell( aStr, pDestDoc ); else diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index d02d9d4bc1c7..7a8c06ce426c 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1883,7 +1883,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt ScCellFormat::GetString( pCell, nFormat, aString, &pDummy, rFormatter ); } else - ((ScFormulaCell*)pCell)->GetString( aString ); + aString = ((ScFormulaCell*)pCell)->GetString(); bString = true; } } @@ -1897,7 +1897,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt ScCellFormat::GetString( pCell, nFormat, aString, &pDummy, rFormatter ); } else - ((ScStringCell*)pCell)->GetString( aString ); + aString = ((ScStringCell*)pCell)->GetString(); bString = true; break; case CELLTYPE_EDIT : diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index eaf72bcfd488..3dbc96f5beb6 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -194,8 +194,7 @@ public: else { // string cell otherwise. - String aVal; - pCell->GetString(aVal); + rtl::OUString aVal = pCell->GetString(); mpDoc->PutCell(aPos, new ScStringCell(aVal)); } } @@ -1308,14 +1307,12 @@ static FormulaToken* lcl_convertToToken(ScBaseCell* pCell) { case CELLTYPE_EDIT: { - String aStr; - static_cast(pCell)->GetString(aStr); + rtl::OUString aStr = static_cast(pCell)->GetString(); return new formula::FormulaStringToken(aStr); } case CELLTYPE_STRING: { - String aStr; - static_cast(pCell)->GetString(aStr); + rtl::OUString aStr = static_cast(pCell)->GetString(); return new formula::FormulaStringToken(aStr); } case CELLTYPE_VALUE: @@ -1336,8 +1333,7 @@ static FormulaToken* lcl_convertToToken(ScBaseCell* pCell) } else { - String aStr; - pFCell->GetString(aStr); + rtl::OUString aStr = pFCell->GetString(); return new formula::FormulaStringToken(aStr); } } @@ -1410,15 +1406,13 @@ static ScTokenArray* lcl_convertToTokenArray(const ScDocument* pSrcDoc, ScRange& { case CELLTYPE_EDIT: { - String aStr; - static_cast(pCell)->GetString(aStr); + rtl::OUString aStr = static_cast(pCell)->GetString(); xMat->PutString(aStr, nC, nR); } break; case CELLTYPE_STRING: { - String aStr; - static_cast(pCell)->GetString(aStr); + rtl::OUString aStr = static_cast(pCell)->GetString(); xMat->PutString(aStr, nC, nR); } break; @@ -1441,8 +1435,7 @@ static ScTokenArray* lcl_convertToTokenArray(const ScDocument* pSrcDoc, ScRange& } else { - String aStr; - pFCell->GetString(aStr); + rtl::OUString aStr = pFCell->GetString(); xMat->PutString(aStr, nC, nR); } } diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx index cb9b6fd3df48..56925940441e 100644 --- a/sc/source/ui/formdlg/formula.cxx +++ b/sc/source/ui/formdlg/formula.cxx @@ -370,9 +370,7 @@ bool ScFormulaDlg::calculateValue( const String& rStrExp, String& rStrResult ) } else { - String aStr; - - pFCell->GetString( aStr ); + String aStr = pFCell->GetString(); sal_uLong nFormat = aFormatter.GetStandardFormat( pFCell->GetFormatType(), ScGlobal::eLnge); aFormatter.GetOutputString( aStr, nFormat, diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index 6eac293f084e..f162a756551c 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -708,9 +708,8 @@ uno::Any SAL_CALL ScFunctionAccess::callFunction( const rtl::OUString& aName, else { // string result - String aStrVal; - pFormula->GetString( aStrVal ); - aRet <<= rtl::OUString( aStrVal ); + rtl::OUString aStrVal = pFormula->GetString(); + aRet <<= aStrVal; } } else if ( nErrCode == NOTAVAILABLE ) diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx index 4961730d5630..87bc8c7a1c49 100644 --- a/sc/source/ui/view/tabvwsh5.cxx +++ b/sc/source/ui/view/tabvwsh5.cxx @@ -351,7 +351,7 @@ void ScTabViewShell::MakeNumberInfoItem( ScDocument* pDoc, case CELLTYPE_STRING: { - ((ScStringCell*)pCell)->GetString( aCellString ); + aCellString = ((ScStringCell*)pCell)->GetString(); eValType = SVX_VALUE_TYPE_STRING; } break; diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx index 1cd1c9a35583..107723554928 100644 --- a/tools/inc/tools/string.hxx +++ b/tools/inc/tools/string.hxx @@ -178,8 +178,6 @@ public: return rtl::OUString (reinterpret_cast(mpData)); } - UniString intern() const; - static UniString CreateFromAscii( const sal_Char* pAsciiStr ); static UniString CreateFromAscii( const sal_Char* pAsciiStr, xub_StrLen nLen ); diff --git a/tools/source/string/strucvt.cxx b/tools/source/string/strucvt.cxx index 6db930277ea8..144d9e41603a 100644 --- a/tools/source/string/strucvt.cxx +++ b/tools/source/string/strucvt.cxx @@ -132,16 +132,6 @@ UniString& UniString::Assign( const rtl::OUString& rStr ) return *this; } -UniString UniString::intern() const -{ - UniString aStr; - - rtl_uString_intern( reinterpret_cast(&aStr.mpData), - (rtl_uString *)(mpData) ); - - return aStr; -} - // ======================================================================= #include -- cgit