diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-10-03 11:49:09 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-10-03 13:09:22 +0100 |
commit | dbec763c672ae5a08b6fb6763e87e41a5ec14ca9 (patch) | |
tree | 99f577a430eccf301c23fd1b1394efb55d8b54cc | |
parent | 5f4d8386a889b329eb19248dc0ee62198c3bf8ca (diff) |
de-GetBuffer calc
Change-Id: I6bb013cc32d5b363dd08738543b1fb834d39f516
33 files changed, 193 insertions, 246 deletions
diff --git a/sc/inc/addincol.hxx b/sc/inc/addincol.hxx index 0a689bb3041d..8c08672f0748 100644 --- a/sc/inc/addincol.hxx +++ b/sc/inc/addincol.hxx @@ -40,7 +40,7 @@ class SfxObjectShell; class ScUnoAddInFuncData; class ScFuncDesc; -typedef ::boost::unordered_map< OUString, const ScUnoAddInFuncData*, ScStringHashCode, ::std::equal_to< OUString > > ScAddInHashMap; +typedef ::boost::unordered_map< OUString, const ScUnoAddInFuncData*, OUStringHash > ScAddInHashMap; enum ScAddInArgumentType { diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index cc756d66af8d..e3617463a06a 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -283,7 +283,7 @@ public: inline void GetVars( SCCOL& nColP, SCROW& nRowP, SCTAB& nTabP ) const { nColP = nCol; nRowP = nRow; nTabP = nTab; } - SC_DLLPUBLIC sal_uInt16 Parse( const String&, ScDocument* = NULL, + SC_DLLPUBLIC sal_uInt16 Parse( const OUString&, ScDocument* = NULL, const Details& rDetails = detailsOOOa1, ExternalInfo* pExtInfo = NULL, const ::com::sun::star::uno::Sequence< @@ -447,7 +447,7 @@ public: inline bool In( const ScAddress& ) const; ///< is Address& in Range? inline bool In( const ScRange& ) const; ///< is Range& in Range? - SC_DLLPUBLIC sal_uInt16 Parse( const String&, ScDocument* = NULL, + SC_DLLPUBLIC sal_uInt16 Parse( const OUString&, ScDocument* = NULL, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1, ScAddress::ExternalInfo* pExtInfo = NULL, const ::com::sun::star::uno::Sequence< @@ -455,9 +455,9 @@ public: SC_DLLPUBLIC sal_uInt16 ParseAny( const String&, ScDocument* = NULL, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ); - SC_DLLPUBLIC sal_uInt16 ParseCols( const String&, ScDocument* = NULL, + SC_DLLPUBLIC sal_uInt16 ParseCols( const OUString&, ScDocument* = NULL, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ); - SC_DLLPUBLIC sal_uInt16 ParseRows( const String&, ScDocument* = NULL, + SC_DLLPUBLIC sal_uInt16 ParseRows( const OUString&, ScDocument* = NULL, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ); /** Parse an Excel style reference up to and including the sheet name diff --git a/sc/inc/autonamecache.hxx b/sc/inc/autonamecache.hxx index 981631d96d3e..8a53702eefa4 100644 --- a/sc/inc/autonamecache.hxx +++ b/sc/inc/autonamecache.hxx @@ -26,7 +26,7 @@ #include "global.hxx" typedef ::std::vector< ScAddress > ScAutoNameAddresses; -typedef ::boost::unordered_map< String, ScAutoNameAddresses, ScStringHashCode, ::std::equal_to< String > > ScAutoNameHashMap; +typedef ::boost::unordered_map< OUString, ScAutoNameAddresses, OUStringHash > ScAutoNameHashMap; /** Cache for faster lookup of automatic names during CompileXML (during CompileXML, no document content is changed). */ diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 4943bd702cc1..fe75cafb71e9 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -235,8 +235,8 @@ public: const ScComplexRefData& rRef, bool bSingleRef ) const = 0; virtual ::com::sun::star::i18n::ParseResult - parseAnyToken( const String& rFormula, - xub_StrLen nSrcPos, + parseAnyToken( const OUString& rFormula, + sal_Int32 nSrcPos, const CharClass* pCharClass) const = 0; /** @@ -245,7 +245,7 @@ public: * * @return true on successful parse, or false otherwise. */ - virtual bool parseExternalName( const String& rSymbol, String& rFile, String& rName, + virtual bool parseExternalName( const OUString& rSymbol, String& rFile, String& rName, const ScDocument* pDoc, const ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks ) const = 0; @@ -312,8 +312,8 @@ private: ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::ExternalLinkInfo > maExternalLinks; sal_Unicode cSymbol[MAXSTRLEN]; // current Symbol - String aFormula; // formula source code - xub_StrLen nSrcPos; // tokenizer position (source code) + OUString aFormula; // formula source code + sal_Int32 nSrcPos; // tokenizer position (source code) mutable ScRawTokenRef pRawToken; const CharClass* pCharClass; // which character classification is used for parseAnyToken @@ -335,7 +335,7 @@ private: bool IsOpCode( const OUString&, bool bInArray ); bool IsOpCode2( const String& ); bool IsString(); - bool IsReference( const String& ); + bool IsReference( const OUString& ); bool IsSingleReference( const String& ); bool IsPredetectedReference(const OUString&); bool IsDoubleReference( const String& ); diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx index cffd0c8d68cc..4017fe119332 100644 --- a/sc/inc/dptabres.hxx +++ b/sc/inc/dptabres.hxx @@ -681,7 +681,7 @@ private: size_t operator()(const ScDPItemData& r) const; }; typedef ::boost::unordered_set<ScDPItemData, MemberHash> VisibleMemberType; - typedef ::boost::unordered_map<OUString, VisibleMemberType, ScStringHashCode> DimMemberType; + typedef ::boost::unordered_map<OUString, VisibleMemberType, OUStringHash> DimMemberType; DimMemberType maDimensions; ScDPSource* mpSource; diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index ee9317a61d31..3fec756af114 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -448,14 +448,6 @@ struct ScImportParam bool operator== ( const ScImportParam& r ) const; }; -struct ScStringHashCode -{ - size_t operator()( const String& rStr ) const - { - return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() ); - } -}; - class ScDocument; class ScDocShell; class ScDocShellRef; @@ -663,7 +655,7 @@ SC_DLLPUBLIC static void EraseQuotes( OUString& rString, sal_Unic if cChar==cQuote the first cQuote character from nStart on is found. @returns offset if found, else STRING_NOTFOUND */ -SC_DLLPUBLIC static xub_StrLen FindUnquoted( const String& rString, sal_Unicode cChar, xub_StrLen nStart = 0, sal_Unicode cQuote = '\'' ); +SC_DLLPUBLIC static xub_StrLen FindUnquoted( const OUString& rString, sal_Unicode cChar, xub_StrLen nStart = 0, sal_Unicode cQuote = '\'' ); /** Finds an unquoted instance of cChar in null-terminated pString. Same semantics as FindUnquoted( const String&, ...) diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index 3a2ea7c945cb..81f1bf6601cb 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -3949,7 +3949,7 @@ void ScDPResultVisibilityData::addVisibleMember(const OUString& rDimName, const void ScDPResultVisibilityData::fillFieldFilters(vector<ScDPFilteredCache::Criterion>& rFilters) const { - typedef boost::unordered_map<String, long, ScStringHashCode> FieldNameMapType; + typedef boost::unordered_map<OUString, long, OUStringHash> FieldNameMapType; FieldNameMapType aFieldNames; ScDPTableData* pData = mpSource->GetData(); long nColumnCount = pData->GetColumnCount(); diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 04e02de4ae54..6ccd42dc3142 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -850,10 +850,10 @@ void ScGlobal::EraseQuotes( OUString& rString, sal_Unicode cQuote, bool bUnescap } } -xub_StrLen ScGlobal::FindUnquoted( const String& rString, sal_Unicode cChar, xub_StrLen nStart, sal_Unicode cQuote ) +xub_StrLen ScGlobal::FindUnquoted( const OUString& rString, sal_Unicode cChar, xub_StrLen nStart, sal_Unicode cQuote ) { - const sal_Unicode* const pStart = rString.GetBuffer(); - const sal_Unicode* const pStop = pStart + rString.Len(); + const sal_Unicode* const pStart = rString.getStr(); + const sal_Unicode* const pStop = pStart + rString.getLength(); const sal_Unicode* p = pStart + nStart; bool bQuoted = false; while (p < pStop) diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 339ae4a1e848..3a84fcb5d1c3 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -72,40 +72,40 @@ extern sal_uInt16 nScFillModeMouseModifier; // global.cxx namespace { -short lcl_DecompValueString( String& aValue, sal_Int32& nVal, sal_uInt16* pMinDigits = NULL ) +short lcl_DecompValueString( OUString& rValue, sal_Int32& nVal, sal_uInt16* pMinDigits = NULL ) { - if ( !aValue.Len() ) + if ( rValue.isEmpty() ) { nVal = 0; return 0; } - const sal_Unicode* p = aValue.GetBuffer(); - xub_StrLen nNeg = 0; - xub_StrLen nNum = 0; + const sal_Unicode* p = rValue.getStr(); + sal_Int32 nNeg = 0; + sal_Int32 nNum = 0; if ( p[nNum] == '-' ) nNum = nNeg = 1; while ( p[nNum] && CharClass::isAsciiNumeric( OUString(p[nNum]) ) ) nNum++; sal_Unicode cNext = p[nNum]; // 0 if at the end - sal_Unicode cLast = p[aValue.Len()-1]; + sal_Unicode cLast = p[rValue.getLength()-1]; // #i5550# If there are numbers at the beginning and the end, // prefer the one at the beginning only if it's followed by a space. // Otherwise, use the number at the end, to enable things like IP addresses. if ( nNum > nNeg && ( cNext == 0 || cNext == ' ' || !CharClass::isAsciiNumeric(OUString(cLast)) ) ) { // number at the beginning - nVal = aValue.Copy( 0, nNum ).ToInt32(); + nVal = rValue.copy( 0, nNum ).toInt32(); // any number with a leading zero sets the minimum number of digits if ( p[nNeg] == '0' && pMinDigits && ( nNum - nNeg > *pMinDigits ) ) *pMinDigits = nNum - nNeg; - aValue.Erase( 0, nNum ); + rValue = rValue.copy(nNum); return -1; } else { nNeg = 0; - xub_StrLen nEnd = nNum = aValue.Len() - 1; + sal_Int32 nEnd = nNum = rValue.getLength() - 1; while ( nNum && CharClass::isAsciiNumeric( OUString(p[nNum]) ) ) nNum--; if ( p[nNum] == '-' ) @@ -115,11 +115,11 @@ short lcl_DecompValueString( String& aValue, sal_Int32& nVal, sal_uInt16* pMinDi } if ( nNum < nEnd - nNeg ) { // number at the end - nVal = aValue.Copy( nNum + 1 ).ToInt32(); + nVal = rValue.copy( nNum + 1 ).toInt32(); // any number with a leading zero sets the minimum number of digits if ( p[nNum+1+nNeg] == '0' && pMinDigits && ( nEnd - nNum - nNeg > *pMinDigits ) ) *pMinDigits = nEnd - nNum - nNeg; - aValue.Erase( nNum + 1 ); + rValue = rValue.copy(0, nNum + 1); return 1; } } @@ -378,16 +378,12 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, // -> longest number defines rMinDigits sal_Int32 nVal1; - String aString = aStr; - short nFlag1 = lcl_DecompValueString( aString, nVal1, &rMinDigits ); - aStr = aString; + short nFlag1 = lcl_DecompValueString( aStr, nVal1, &rMinDigits ); if ( nFlag1 ) { sal_Int32 nVal2; GetString( nCol+nAddX, nRow+nAddY, aStr ); - aString = aStr; - short nFlag2 = lcl_DecompValueString( aString, nVal2, &rMinDigits ); - aStr = aString; + short nFlag2 = lcl_DecompValueString( aStr, nVal2, &rMinDigits ); if ( nFlag1 == nFlag2 ) { rInc = (double)nVal2 - (double)nVal1; @@ -401,9 +397,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if ( eType == CELLTYPE_STRING || eType == CELLTYPE_EDIT ) { aStr = aCell.getString(pDocument); - aString = aStr; - nFlag2 = lcl_DecompValueString( aString, nVal2, &rMinDigits ); - aStr = aString; + nFlag2 = lcl_DecompValueString( aStr, nVal2, &rMinDigits ); if ( nFlag1 == nFlag2 ) { double nDiff = (double)nVal2 - (double)nVal1; @@ -428,8 +422,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, { // call DecompValueString to set rMinDigits sal_Int32 nDummy; - String aString = aStr; - lcl_DecompValueString( aString, nDummy, &rMinDigits ); + lcl_DecompValueString( aStr, nDummy, &rMinDigits ); } } } @@ -765,7 +758,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nCellDigits = 0; short nHeadNoneTail = 0; sal_Int32 nStringValue = 0; - String aValue; + OUString aValue; ScCellValue aSrcCell; CellType eCellType = CELLTYPE_NONE; bool bIsOrdinalSuffix = false; @@ -803,7 +796,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, nHeadNoneTail = lcl_DecompValueString( aValue, nStringValue, &nCellDigits ); - bIsOrdinalSuffix = aValue.Equals( + bIsOrdinalSuffix = aValue.equals( ScGlobal::GetOrdinalSuffix( nStringValue)); } break; @@ -930,7 +923,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, String ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY ) { - String aValue; + OUString aValue; SCCOL nCol1 = rSource.aStart.Col(); SCROW nRow1 = rSource.aStart.Row(); @@ -1049,10 +1042,10 @@ String ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW n short nFlag = lcl_DecompValueString( aValue, nVal, &nCellDigits ); if ( nFlag < 0 ) { - if (aValue.Equals( ScGlobal::GetOrdinalSuffix( nVal))) + if (aValue.equals( ScGlobal::GetOrdinalSuffix( nVal))) aValue = ScGlobal::GetOrdinalSuffix( nVal + nDelta); - aValue.Insert( lcl_ValueString( nVal + nDelta, nCellDigits ), 0 ); + aValue = lcl_ValueString( nVal + nDelta, nCellDigits ) + aValue; } else if ( nFlag > 0 ) aValue += lcl_ValueString( nVal + nDelta, nCellDigits ); @@ -1141,10 +1134,10 @@ String ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW n { if ( nHeadNoneTail < 0 ) { - if (aValue.Equals( ScGlobal::GetOrdinalSuffix( nVal))) + if (aValue.equals( ScGlobal::GetOrdinalSuffix( nVal))) aValue = ScGlobal::GetOrdinalSuffix( (sal_Int32)nStart ); - aValue.Insert( lcl_ValueString( (sal_Int32)nStart, nMinDigits ), 0 ); + aValue = lcl_ValueString( (sal_Int32)nStart, nMinDigits ) + aValue; } else aValue += lcl_ValueString( (sal_Int32)nStart, nMinDigits ); @@ -1583,7 +1576,7 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if ( nMaxValue <= (double)LONG_MIN ) nMaxValue = (double)LONG_MIN + 1; } - String aValue; + OUString aValue; if (eCellType == CELLTYPE_STRING) aValue = *aSrcCell.mpString; else @@ -1599,7 +1592,7 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bError = false; bool bOverflow = false; - bool bIsOrdinalSuffix = aValue.Equals( ScGlobal::GetOrdinalSuffix( + bool bIsOrdinalSuffix = aValue.equals( ScGlobal::GetOrdinalSuffix( (sal_Int32)nStartVal)); rInner = nIStart; diff --git a/sc/source/core/inc/cellkeytranslator.hxx b/sc/source/core/inc/cellkeytranslator.hxx index 9802196ef5d3..d1ac3305d304 100644 --- a/sc/source/core/inc/cellkeytranslator.hxx +++ b/sc/source/core/inc/cellkeytranslator.hxx @@ -40,7 +40,7 @@ struct ScCellKeyword ScCellKeyword(const sal_Char* pName, OpCode eOpCode, const ::com::sun::star::lang::Locale& rLocale); }; -typedef ::boost::unordered_map< String, ::std::list<ScCellKeyword>, ScStringHashCode, ::std::equal_to<String> > ScCellKeywordHashMap; +typedef ::boost::unordered_map< OUString, ::std::list<ScCellKeyword>, OUStringHash > ScCellKeywordHashMap; /** Translate cell function keywords. diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index dfa5532394b9..1ab318629e4b 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -189,7 +189,7 @@ void ReplaceCell( ScAddress& ); // for TableOp void ReplaceCell( SCCOL& rCol, SCROW& rRow, SCTAB& rTab ); // for TableOp bool IsTableOpInRange( const ScRange& ); sal_uLong GetCellNumberFormat( const ScAddress& rPos, ScRefCellValue& rCell ); -double ConvertStringToValue( const String& ); +double ConvertStringToValue( const OUString& ); double GetCellValue( const ScAddress&, ScRefCellValue& rCell ); double GetCellValueOrZero( const ScAddress&, ScRefCellValue& rCell ); double GetValueCellValue( const ScAddress&, double fOrig ); diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index bf6beb374c12..5d080ba72dfb 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -1310,12 +1310,12 @@ bool ConvertDoubleRef( ScDocument* pDoc, const String& rRefString, SCTAB nDefTab return bRet; } -sal_uInt16 ScAddress::Parse( const String& r, ScDocument* pDoc, +sal_uInt16 ScAddress::Parse( const OUString& r, ScDocument* pDoc, const Details& rDetails, ExternalInfo* pExtInfo, const uno::Sequence< const sheet::ExternalLinkInfo > * pExternalLinks ) { - return lcl_ScAddress_Parse( r.GetBuffer(), pDoc, *this, rDetails, pExtInfo, pExternalLinks ); + return lcl_ScAddress_Parse( r.getStr(), pDoc, *this, rDetails, pExtInfo, pExternalLinks ); } bool ScRange::Intersects( const ScRange& r ) const @@ -1443,12 +1443,12 @@ lcl_ScRange_Parse_OOo( ScRange &aRange, const String& r, ScDocument* pDoc, ScAdd return nRes1; } -sal_uInt16 ScRange::Parse( const String& r, ScDocument* pDoc, +sal_uInt16 ScRange::Parse( const OUString& r, ScDocument* pDoc, const ScAddress::Details& rDetails, ScAddress::ExternalInfo* pExtInfo, const uno::Sequence< const sheet::ExternalLinkInfo > * pExternalLinks ) { - if ( r.Len() <= 0 ) + if (r.isEmpty()) return 0; switch (rDetails.eConv) @@ -1459,11 +1459,11 @@ sal_uInt16 ScRange::Parse( const String& r, ScDocument* pDoc, case formula::FormulaGrammar::CONV_XL_A1: case formula::FormulaGrammar::CONV_XL_OOX: - return lcl_ScRange_Parse_XL_A1( *this, r.GetBuffer(), pDoc, false, pExtInfo, + return lcl_ScRange_Parse_XL_A1( *this, r.getStr(), pDoc, false, pExtInfo, (rDetails.eConv == formula::FormulaGrammar::CONV_XL_OOX ? pExternalLinks : NULL) ); case formula::FormulaGrammar::CONV_XL_R1C1: - return lcl_ScRange_Parse_XL_R1C1( *this, r.GetBuffer(), pDoc, rDetails, false, pExtInfo ); + return lcl_ScRange_Parse_XL_R1C1( *this, r.getStr(), pDoc, rDetails, false, pExtInfo ); } } @@ -1486,15 +1486,15 @@ sal_uInt16 ScRange::ParseAny( const String& r, ScDocument* pDoc, } // Parse only full row references -sal_uInt16 ScRange::ParseCols( const String& rStr, ScDocument* pDoc, +sal_uInt16 ScRange::ParseCols( const OUString& rStr, ScDocument* pDoc, const ScAddress::Details& rDetails ) { - const sal_Unicode* p = rStr.GetBuffer(); - sal_uInt16 nRes = 0, ignored = 0; - - if( NULL == p ) + if (rStr.isEmpty()) return 0; + const sal_Unicode* p = rStr.getStr(); + sal_uInt16 nRes = 0, ignored = 0; + (void)pDoc; // make compiler shutup we may need this later switch (rDetails.eConv) @@ -1545,15 +1545,15 @@ sal_uInt16 ScRange::ParseCols( const String& rStr, ScDocument* pDoc, } // Parse only full row references -sal_uInt16 ScRange::ParseRows( const String& rStr, ScDocument* pDoc, +sal_uInt16 ScRange::ParseRows( const OUString& rStr, ScDocument* pDoc, const ScAddress::Details& rDetails ) { - const sal_Unicode* p = rStr.GetBuffer(); - sal_uInt16 nRes = 0, ignored = 0; - - if( NULL == p ) + if (rStr.isEmpty()) return 0; + const sal_Unicode* p = rStr.getStr(); + sal_uInt16 nRes = 0, ignored = 0; + (void)pDoc; // make compiler shutup we may need this later switch (rDetails.eConv) diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index bf04a4a3c6a6..e278d6c56cec 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -437,7 +437,7 @@ static bool lcl_isValidQuotedText( const String& rFormula, xub_StrLen nSrcPos, P } static bool lcl_parseExternalName( - const String& rSymbol, + const OUString& rSymbol, String& rFile, String& rName, const sal_Unicode cSep, @@ -446,12 +446,12 @@ static bool lcl_parseExternalName( { /* TODO: future versions will have to support sheet-local names too, thus * return a possible sheet name as well. */ - const sal_Unicode* const pStart = rSymbol.GetBuffer(); + const sal_Unicode* const pStart = rSymbol.getStr(); const sal_Unicode* p = pStart; - xub_StrLen nLen = rSymbol.Len(); + sal_Int32 nLen = rSymbol.getLength(); sal_Unicode cPrev = 0; String aTmpFile, aTmpName; - xub_StrLen i = 0; + sal_Int32 i = 0; bool bInName = false; if (cSep == '!') { @@ -481,7 +481,7 @@ static bool lcl_parseExternalName( // quote. cPrev = c; ++i; ++p; - for (xub_StrLen j = i; j < nLen; ++j, ++p) + for (sal_Int32 j = i; j < nLen; ++j, ++p) { c = *p; if (c == '\'') @@ -676,8 +676,8 @@ struct Convention_A1 : public ScCompiler::Convention static void MakeColStr( OUStringBuffer& rBuffer, SCCOL nCol ); static void MakeRowStr( OUStringBuffer& rBuffer, SCROW nRow ); - ParseResult parseAnyToken( const String& rFormula, - xub_StrLen nSrcPos, + ParseResult parseAnyToken( const OUString& rFormula, + sal_Int32 nSrcPos, const CharClass* pCharClass) const { ParseResult aRet; @@ -841,7 +841,7 @@ struct ConventionOOO_A1 : public Convention_A1 return sal_Unicode(0); } - virtual bool parseExternalName( const String& rSymbol, String& rFile, String& rName, + virtual bool parseExternalName( const OUString& rSymbol, String& rFile, String& rName, const ScDocument* pDoc, const ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks ) const @@ -1121,7 +1121,7 @@ struct ConventionXL return sal_Unicode(0); } - static bool parseExternalName( const String& rSymbol, String& rFile, String& rName, + static bool parseExternalName( const OUString& rSymbol, String& rFile, String& rName, const ScDocument* pDoc, const ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks ) @@ -1145,15 +1145,15 @@ struct ConventionXL rBuffer.append(sal_Unicode('[')); rBuffer.append(sal_Unicode('\'')); - String aFullName; + OUString aFullName; if (bEncodeUrl) aFullName = rFullName; else aFullName = INetURLObject::decode(rFullName, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS); - const sal_Unicode* pBuf = aFullName.GetBuffer(); - xub_StrLen nLen = aFullName.Len(); - for (xub_StrLen i = 0; i < nLen; ++i) + const sal_Unicode* pBuf = aFullName.getStr(); + sal_Int32 nLen = aFullName.getLength(); + for (sal_Int32 i = 0; i < nLen; ++i) { const sal_Unicode c = pBuf[i]; if (c == sal_Unicode('\'')) @@ -1183,12 +1183,12 @@ struct ConventionXL } } - static void parseExternalDocName( const String& rFormula, xub_StrLen& rSrcPos ) + static void parseExternalDocName( const OUString& rFormula, sal_Int32& rSrcPos ) { - xub_StrLen nLen = rFormula.Len(); - const sal_Unicode* p = rFormula.GetBuffer(); + sal_Int32 nLen = rFormula.getLength(); + const sal_Unicode* p = rFormula.getStr(); sal_Unicode cPrev = 0; - for (xub_StrLen i = rSrcPos; i < nLen; ++i) + for (sal_Int32 i = rSrcPos; i < nLen; ++i) { sal_Unicode c = p[i]; if (i == rSrcPos) @@ -1313,8 +1313,8 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL } } - virtual ParseResult parseAnyToken( const String& rFormula, - xub_StrLen nSrcPos, + virtual ParseResult parseAnyToken( const OUString& rFormula, + sal_Int32 nSrcPos, const CharClass* pCharClass) const { ParseResult aRet; @@ -1335,7 +1335,7 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL return ConventionXL::getSpecialSymbol(eSymType); } - virtual bool parseExternalName( const String& rSymbol, String& rFile, String& rName, + virtual bool parseExternalName( const OUString& rSymbol, String& rFile, String& rName, const ScDocument* pDoc, const ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks ) const @@ -1503,8 +1503,8 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL } } - ParseResult parseAnyToken( const String& rFormula, - xub_StrLen nSrcPos, + ParseResult parseAnyToken( const OUString& rFormula, + sal_Int32 nSrcPos, const CharClass* pCharClass) const { ConventionXL::parseExternalDocName(rFormula, nSrcPos); @@ -1528,7 +1528,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL return ConventionXL::getSpecialSymbol(eSymType); } - virtual bool parseExternalName( const String& rSymbol, String& rFile, String& rName, + virtual bool parseExternalName( const OUString& rSymbol, String& rFile, String& rName, const ScDocument* pDoc, const ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks ) const @@ -1797,7 +1797,7 @@ xub_StrLen ScCompiler::NextSymbol(bool bInArray) { cSymbol[MAXSTRLEN-1] = 0; // Stopper sal_Unicode* pSym = cSymbol; - const sal_Unicode* const pStart = aFormula.GetBuffer(); + const sal_Unicode* const pStart = aFormula.getStr(); const sal_Unicode* pSrc = pStart + nSrcPos; bool bi18n = false; sal_Unicode c = *pSrc; @@ -2311,8 +2311,8 @@ Label_MaskStateMachine: } if ( bi18n ) { - nSrcPos = sal::static_int_cast<xub_StrLen>( nSrcPos + nSpaces ); - String aSymbol; + nSrcPos = nSrcPos + nSpaces; + OUStringBuffer aSymbol; mnRangeOpPosInSymbol = -1; sal_uInt16 nErr = 0; do @@ -2320,7 +2320,7 @@ Label_MaskStateMachine: bi18n = false; // special case (e.g. $'sheetname' in OOO A1) if ( pStart[nSrcPos] == cSheetPrefix && pStart[nSrcPos+1] == '\'' ) - aSymbol += pStart[nSrcPos++]; + aSymbol.append(pStart[nSrcPos++]); ParseResult aRes = pConv->parseAnyToken( aFormula, nSrcPos, pCharClass ); @@ -2329,13 +2329,13 @@ Label_MaskStateMachine: if ( aRes.EndPos <= nSrcPos ) { // ?!? SetError( nErr = errIllegalChar ); - nSrcPos = aFormula.Len(); - aSymbol.Erase(); + nSrcPos = aFormula.getLength(); + aSymbol.truncate(0); } else { - aSymbol.Append( pStart + nSrcPos, (xub_StrLen)aRes.EndPos - nSrcPos ); - nSrcPos = (xub_StrLen) aRes.EndPos; + aSymbol.append( pStart + nSrcPos, aRes.EndPos - nSrcPos); + nSrcPos = aRes.EndPos; c = pStart[nSrcPos]; if ( aRes.TokenType & KParseType::SINGLE_QUOTE_NAME ) { // special cases (e.g. 'sheetname'. or 'filename'# in OOO A1) @@ -2344,25 +2344,25 @@ Label_MaskStateMachine: // One range operator restarts parsing for second reference. if (c == ':' && mnRangeOpPosInSymbol < 0) { - mnRangeOpPosInSymbol = aSymbol.Len(); + mnRangeOpPosInSymbol = aSymbol.getLength(); bi18n = true; } if ( bi18n ) - aSymbol += pStart[nSrcPos++]; + aSymbol.append(pStart[nSrcPos++]); } } while ( bi18n && !nErr ); - xub_StrLen nLen = aSymbol.Len(); + sal_Int32 nLen = aSymbol.getLength(); if ( nLen >= MAXSTRLEN ) { SetError( errStringOverflow ); nLen = MAXSTRLEN-1; } - lcl_UnicodeStrNCpy( cSymbol, aSymbol.GetBuffer(), nLen ); + lcl_UnicodeStrNCpy( cSymbol, aSymbol.getStr(), nLen ); pSym = &cSymbol[nLen]; } else { - nSrcPos = sal::static_int_cast<xub_StrLen>( pSrc - pStart ); + nSrcPos = pSrc - pStart; *pSym = 0; } if (mnRangeOpPosInSymbol >= 0 && mnRangeOpPosInSymbol == (pSym-1) - &cSymbol[0]) @@ -2436,7 +2436,7 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool bInArray ) } if (!bFound) { - String aIntName; + OUString aIntName; if (mxSymbols->hasExternals()) { // If symbols are set by filters get mapping to exact name. @@ -2447,7 +2447,7 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool bInArray ) if (ScGlobal::GetAddInCollection()->GetFuncData( (*iExt).second)) aIntName = (*iExt).second; } - if (!aIntName.Len()) + if (aIntName.isEmpty()) { // If that isn't found we might continue with rName lookup as a // last resort by just falling through to FindFunction(), but @@ -2456,7 +2456,7 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool bInArray ) return false; } } - if (!aIntName.Len()) + if (aIntName.isEmpty()) { // Old (deprecated) addins first for legacy. if (ScGlobal::GetFuncCollection()->findByName(cSymbol)) @@ -2471,10 +2471,10 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool bInArray ) aIntName = ScGlobal::GetAddInCollection()->FindFunction( rName, !mxSymbols->isEnglish()); } - if (aIntName.Len()) + if (!aIntName.isEmpty()) { ScRawToken aToken; - aToken.SetExternal( aIntName.GetBuffer() ); // international name + aToken.SetExternal( aIntName.getStr() ); // international name pRawToken = aToken.Clone(); bFound = true; } @@ -2533,7 +2533,7 @@ bool ScCompiler::IsValue( const String& rSym ) if (nType == NUMBERFORMAT_LOGICAL) { - const sal_Unicode* p = aFormula.GetBuffer() + nSrcPos; + const sal_Unicode* p = aFormula.getStr() + nSrcPos; while( *p == ' ' ) p++; if (*p == '(') @@ -2720,10 +2720,10 @@ bool ScCompiler::IsSingleReference( const String& rName ) return ( nFlags & SCA_VALID ) != 0; } -bool ScCompiler::IsReference( const String& rName ) +bool ScCompiler::IsReference( const OUString& rName ) { // Has to be called before IsValue - sal_Unicode ch1 = rName.GetChar(0); + sal_Unicode ch1 = rName[0]; sal_Unicode cDecSep = ( mxSymbols->isEnglish() ? '.' : ScGlobal::pLocaleData->getNumDecimalSep()[0] ); if ( ch1 == cDecSep ) @@ -2744,7 +2744,7 @@ bool ScCompiler::IsReference( const String& rName ) break; // may be 3:3, continue as usual return false; } - sal_Unicode const * const pTabSep = rName.GetBuffer() + nPos; + sal_Unicode const * const pTabSep = rName.getStr() + nPos; sal_Unicode ch2 = pTabSep[1]; // maybe a column identifier if ( !(ch2 == '$' || rtl::isAsciiAlpha( ch2 )) ) return false; @@ -2761,7 +2761,7 @@ bool ScCompiler::IsReference( const String& rName ) // and would produce wrong formulas if the conditions here are met. // If you can live with these restrictions you may remove the // check and return an unconditional FALSE. - String aTabName( rName.Copy( 0, nPos ) ); + String aTabName( rName.copy( 0, nPos ) ); SCTAB nTab; if ( !pDoc->GetTable( aTabName, nTab ) ) return false; @@ -2787,7 +2787,7 @@ bool ScCompiler::IsReference( const String& rName ) while (cSymbol[++nLen]) ; cSymbol[mnRangeOpPosInSymbol] = 0; - nSrcPos -= static_cast<xub_StrLen>(nLen - mnRangeOpPosInSymbol); + nSrcPos -= (nLen - mnRangeOpPosInSymbol); mnRangeOpPosInSymbol = -1; mbRewind = true; return true; // end all checks @@ -2802,7 +2802,7 @@ bool ScCompiler::IsReference( const String& rName ) case FormulaGrammar::CONV_XL_A1: case FormulaGrammar::CONV_XL_R1C1: case FormulaGrammar::CONV_XL_OOX: - if (rName.GetChar(0) == '\'' && IsDoubleReference( rName)) + if (rName[0] == '\'' && IsDoubleReference( rName)) return true; break; default: @@ -3361,7 +3361,7 @@ void ScCompiler::AutoCorrectParsedSymbol() bColons = false; if ( nRefs && nRefs <= 2 ) { // reference twisted? 4A => A4 etc. - String aTab[2], aRef[2]; + OUString aTab[2], aRef[2]; const ScAddress::Details aDetails( pConv->meConv, aPos ); if ( nRefs == 2 ) { @@ -3376,18 +3376,18 @@ void ScCompiler::AutoCorrectParsedSymbol() sal_uInt16 nMask = SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW; for ( int j=0; j<nRefs; j++ ) { - xub_StrLen nTmp = 0; - xub_StrLen nDotPos = STRING_NOTFOUND; - while ( (nTmp = aRef[j].Search( '.', nTmp )) != STRING_NOTFOUND ) + sal_Int32 nTmp = 0; + sal_Int32 nDotPos = -1; + while ( (nTmp = aRef[j].indexOf( '.', nTmp )) != -1 ) nDotPos = nTmp++; // the last one counts - if ( nDotPos != STRING_NOTFOUND ) + if ( nDotPos != -1 ) { - aTab[j] = aRef[j].Copy( 0, nDotPos + 1 ); // with '.' - aRef[j].Erase( 0, nDotPos + 1 ); + aTab[j] = aRef[j].copy( 0, nDotPos + 1 ); // with '.' + aRef[j] = aRef[j].copy( nDotPos + 1 ); } String aOld( aRef[j] ); String aStr2; - const sal_Unicode* p = aRef[j].GetBuffer(); + const sal_Unicode* p = aRef[j].getStr(); while ( *p && CharClass::isAsciiNumeric( OUString(*p) ) ) aStr2 += *p++; aRef[j] = OUString( p ); @@ -3417,7 +3417,7 @@ void ScCompiler::AutoCorrectParsedSymbol() } } -static inline bool lcl_UpperAsciiOrI18n( String& rUpper, const OUString& rOrg, FormulaGrammar::Grammar eGrammar ) +static inline bool lcl_UpperAsciiOrI18n( OUString& rUpper, const OUString& rOrg, FormulaGrammar::Grammar eGrammar ) { if (FormulaGrammar::isODFF( eGrammar )) { @@ -3482,7 +3482,7 @@ bool ScCompiler::NextNewToken( bool bInArray ) * #REF!.#REF!#REF! parts. In case of reading ODF that is all * handled by IsPredetectedReference(), this case here remains for * manual/API input. */ - String aBad( aFormula.Copy( nSrcPos-1 ) ); + OUString aBad( aFormula.copy( nSrcPos-1 ) ); eLastOp = pArr->AddBad( aBad )->GetOpCode(); return false; } @@ -3506,7 +3506,7 @@ bool ScCompiler::NextNewToken( bool bInArray ) if ( bMayBeFuncName ) { // a function name must be followed by a parenthesis - const sal_Unicode* p = aFormula.GetBuffer() + nSrcPos; + const sal_Unicode* p = aFormula.getStr() + nSrcPos; while( *p == ' ' ) p++; bMayBeFuncName = ( *p == '(' ); @@ -3515,7 +3515,7 @@ bool ScCompiler::NextNewToken( bool bInArray ) // Italian ARCTAN.2 resulted in #REF! => IsOpcode() before // IsReference(). - String aUpper; + OUString aUpper; do { @@ -3536,7 +3536,7 @@ bool ScCompiler::NextNewToken( bool bInArray ) return true; } - aUpper.Erase(); + aUpper = ""; bool bAsciiUpper = false; if (bMayBeFuncName) { @@ -3563,7 +3563,7 @@ bool ScCompiler::NextNewToken( bool bInArray ) return true; } - if (!aUpper.Len()) + if (aUpper.isEmpty()) bAsciiUpper = lcl_UpperAsciiOrI18n( aUpper, aOrg, meGrammar); // IsBoolean() before IsValue() to catch inline bools without the kludge @@ -3609,7 +3609,7 @@ bool ScCompiler::NextNewToken( bool bInArray ) // the interpreter. aUpper = ScGlobal::pCharClass->lowercase( aUpper ); ScRawToken aToken; - aToken.SetString( aUpper.GetBuffer() ); + aToken.SetString( aUpper.getStr() ); aToken.NewOpCode( ocBad ); pRawToken = aToken.Clone(); if ( bAutoCorrect ) @@ -3668,14 +3668,14 @@ ScTokenArray* ScCompiler::CompileString( const OUString& rFormula ) aCorrectedSymbol = ""; } sal_uInt8 nForced = 0; // ==formula forces recalc even if cell is not visible - if( aFormula.GetChar(nSrcPos) == '=' ) + if( aFormula[nSrcPos] == '=' ) { nSrcPos++; nForced++; if ( bAutoCorrect ) aCorrectedFormula += "="; } - if( aFormula.GetChar(nSrcPos) == '=' ) + if( aFormula[nSrcPos] == '=' ) { nSrcPos++; nForced++; diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index c914396a90ea..bec70aa69fb5 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -2225,12 +2225,12 @@ void ScInterpreter::ScDecimal() if ( MustHaveParamCount( GetByte(), 2 ) ) { double fBase = ::rtl::math::approxFloor( GetDouble() ); - String aStr( GetString() ); + OUString aStr( GetString() ); if ( !nGlobalError && 2 <= fBase && fBase <= 36 ) { double fVal = 0.0; int nBase = (int) fBase; - const sal_Unicode* p = aStr.GetBuffer(); + const sal_Unicode* p = aStr.getStr(); while ( *p == ' ' || *p == '\t' ) p++; // strip leading white space if ( nBase == 16 ) diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 7288613fc160..a49e650c8e5f 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -218,7 +218,7 @@ sal_uInt16 ScInterpreter::GetCellErrCode( const ScRefCellValue& rCell ) into account; minutes and seconds are limited to the value 59 as well. */ -double ScInterpreter::ConvertStringToValue( const String& rStr ) +double ScInterpreter::ConvertStringToValue( const OUString& rStr ) { #if 1 // We keep this code until we provide a friendly way to convert string @@ -237,12 +237,12 @@ double ScInterpreter::ConvertStringToValue( const String& rStr ) // containing only spaces, be on par in these cases with what was // accepted in OOo and is in AOO (see also the else branch below) and // convert to 0 to prevent interoperability nightmares. - if (!rStr.Len()) + if (rStr.isEmpty()) return fValue; - else if (rStr.GetChar(0) == ' ') + else if (rStr[0] == ' ') { - const sal_Unicode* p = rStr.GetBuffer() + 1; - const sal_Unicode* const pStop = p - 1 + rStr.Len(); + const sal_Unicode* p = rStr.getStr() + 1; + const sal_Unicode* const pStop = p - 1 + rStr.getLength(); while (p < pStop && *p == ' ') ++p; if (p == pStop) diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index d738c0185736..46ccfd0a03a7 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -358,14 +358,14 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU { sal_uInt16 nLevel; bool bRel; - String aFileName( BuildFileName( nLevel, bRel, rUrl, rRoot ) ); + OUString aFileName( BuildFileName( nLevel, bRel, rUrl, rRoot ) ); if( eProtocol == INET_PROT_SMB ) { // #n382718# (and #n261623#) Convert smb notation to '\\' aFileName = aUrlObj.GetMainURL( INetURLObject::NO_DECODE ); - aFileName = OUString( aFileName.GetBuffer() + 4 ); // skip the 'smb:' part - aFileName.SearchAndReplaceAll( '/', '\\' ); + aFileName = aFileName.copy(4); // skip the 'smb:' part + aFileName = aFileName.replace('/', '\\'); } if( !bRel ) @@ -1576,7 +1576,7 @@ XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) : sFormulaBuf.append( (sal_Unicode) ',' ); } mxString1->Append( aToken ); - sFormulaBuf.append( XclXmlUtils::ToOUString( aToken ) ); + sFormulaBuf.append( aToken ); } ::set_flag( mnFlags, EXC_DV_STRINGLIST ); diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index 14611613b1a8..b18542cb6695 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -328,7 +328,7 @@ void XclExpName::SaveXml( XclExpXmlStream& rStrm ) // OOXTODO: XML_workbookParameter, "", // OOXTODO: XML_xlm, "", FSEND ); - rWorkbook->writeEscaped( XclXmlUtils::ToOUString( msSymbol ) ); + rWorkbook->writeEscaped( msSymbol ); rWorkbook->endElement( XML_definedName ); } diff --git a/sc/source/filter/excel/xepage.cxx b/sc/source/filter/excel/xepage.cxx index 4092eb89d375..06649eb5a392 100644 --- a/sc/source/filter/excel/xepage.cxx +++ b/sc/source/filter/excel/xepage.cxx @@ -58,7 +58,7 @@ void XclExpHeaderFooter::SaveXml( XclExpXmlStream& rStrm ) sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); sal_Int32 nElement = GetRecId() == EXC_ID_HEADER ? XML_oddHeader : XML_oddFooter; rWorksheet->startElement( nElement, FSEND ); - rWorksheet->writeEscaped( XclXmlUtils::ToOUString( maHdrString ) ); + rWorksheet->writeEscaped( maHdrString ); rWorksheet->endElement( nElement ); } diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 06b58ab5a171..7c67f7729171 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -744,11 +744,6 @@ OString XclXmlUtils::ToOString( const OUString& s ) return OUStringToOString( s, RTL_TEXTENCODING_UTF8 ); } -OString XclXmlUtils::ToOString( const String& s ) -{ - return OString( s.GetBuffer(), s.Len(), RTL_TEXTENCODING_UTF8 ); -} - OString XclXmlUtils::ToOString( const ScAddress& rAddress ) { OUString sAddress(rAddress.Format(SCA_VALID, NULL, ScAddress::Details( FormulaGrammar::CONV_XL_A1))); @@ -838,11 +833,6 @@ OUString XclXmlUtils::ToOUString( const ScfUInt16Vec& rBuf, sal_Int32 nStart, sa return (nLength > 0) ? OUString( &rBuf[nStart], nLength ) : OUString(); } -OUString XclXmlUtils::ToOUString( const String& s ) -{ - return OUString( s.GetBuffer(), s.Len() ); -} - OUString XclXmlUtils::ToOUString( ScDocument& rDocument, const ScAddress& rAddress, const ScTokenArray* pTokenArray, const FormulaCompiler::OpCodeMapPtr & xOpCodeMap ) diff --git a/sc/source/filter/excel/xestring.cxx b/sc/source/filter/excel/xestring.cxx index b1cc1af1e157..edd5208918bf 100644 --- a/sc/source/filter/excel/xestring.cxx +++ b/sc/source/filter/excel/xestring.cxx @@ -103,11 +103,6 @@ XclExpString::XclExpString( XclStrFlags nFlags, sal_uInt16 nMaxLen ) Init( 0, nFlags, nMaxLen, true ); } -XclExpString::XclExpString( const String& rString, XclStrFlags nFlags, sal_uInt16 nMaxLen ) -{ - Assign( rString, nFlags, nMaxLen ); -} - XclExpString::XclExpString( const OUString& rString, XclStrFlags nFlags, sal_uInt16 nMaxLen ) { Assign( rString, nFlags, nMaxLen ); @@ -115,11 +110,6 @@ XclExpString::XclExpString( const OUString& rString, XclStrFlags nFlags, sal_uIn // assign --------------------------------------------------------------------- -void XclExpString::Assign( const String& rString, XclStrFlags nFlags, sal_uInt16 nMaxLen ) -{ - Build( rString.GetBuffer(), rString.Len(), nFlags, nMaxLen ); -} - void XclExpString::Assign( const OUString& rString, XclStrFlags nFlags, sal_uInt16 nMaxLen ) { Build( rString.getStr(), rString.getLength(), nFlags, nMaxLen ); @@ -131,7 +121,7 @@ void XclExpString::Assign( sal_Unicode cChar, XclStrFlags nFlags, sal_uInt16 nMa } void XclExpString::AssignByte( - const String& rString, rtl_TextEncoding eTextEnc, XclStrFlags nFlags, sal_uInt16 nMaxLen ) + const OUString& rString, rtl_TextEncoding eTextEnc, XclStrFlags nFlags, sal_uInt16 nMaxLen ) { // length may differ from length of rString OString aByteStr(OUStringToOString(rString, eTextEnc)); @@ -140,14 +130,14 @@ void XclExpString::AssignByte( // append --------------------------------------------------------------------- -void XclExpString::Append( const String& rString ) +void XclExpString::Append( const OUString& rString ) { - BuildAppend( rString.GetBuffer(), rString.Len() ); + BuildAppend( rString.getStr(), rString.getLength() ); } -void XclExpString::AppendByte( const String& rString, rtl_TextEncoding eTextEnc ) +void XclExpString::AppendByte( const OUString& rString, rtl_TextEncoding eTextEnc ) { - if( rString.Len() > 0 ) + if (!rString.isEmpty()) { // length may differ from length of rString OString aByteStr(OUStringToOString(rString, eTextEnc)); diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx index db721e2ef6f1..ea41c8c91760 100644 --- a/sc/source/filter/excel/xihelper.cxx +++ b/sc/source/filter/excel/xihelper.cxx @@ -276,7 +276,7 @@ XclImpHFConverter::~XclImpHFConverter() { } -void XclImpHFConverter::ParseString( const String& rHFString ) +void XclImpHFConverter::ParseString( const OUString& rHFString ) { // edit engine objects mrEE.SetText( EMPTY_STRING ); @@ -301,8 +301,8 @@ void XclImpHFConverter::ParseString( const String& rHFString ) xlPSHeight /// Read font height ('&' is followed by num. digits, reads until non-digit). } eState = xlPSText; - const sal_Unicode* pChar = rHFString.GetBuffer(); - const sal_Unicode* pNull = pChar + rHFString.Len(); // pointer to teminating null char + const sal_Unicode* pChar = rHFString.getStr(); + const sal_Unicode* pNull = pChar + rHFString.getLength(); // pointer to teminating null char while( *pChar ) { switch( eState ) diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx index ba759ae35ef1..a6c371eb55ff 100644 --- a/sc/source/filter/inc/xestream.hxx +++ b/sc/source/filter/inc/xestream.hxx @@ -275,7 +275,6 @@ public: static OString ToOString( const Color& rColor ); static OString ToOString( const OUString& s ); static OString ToOString( const ScfUInt16Vec& rBuffer ); - static OString ToOString( const String& s ); static OString ToOString( const ScAddress& rRange ); static OString ToOString( const ScRange& rRange ); static OString ToOString( const ScRangeList& rRangeList ); @@ -286,7 +285,6 @@ public: static OUString ToOUString( const char* s ); static OUString ToOUString( const ScfUInt16Vec& rBuffer, sal_Int32 nStart = 0, sal_Int32 nLength = -1 ); - static OUString ToOUString( const String& s ); static OUString ToOUString( ScDocument& rDocument, const ScAddress& rAddress, const ScTokenArray* pTokenArray, const ScCompiler::OpCodeMapPtr & xOpCodeMap ); static OUString ToOUString( const XclExpString& s ); diff --git a/sc/source/filter/inc/xestring.hxx b/sc/source/filter/inc/xestring.hxx index de23884c7c85..f4a7e2428105 100644 --- a/sc/source/filter/inc/xestring.hxx +++ b/sc/source/filter/inc/xestring.hxx @@ -58,13 +58,6 @@ public: @param nFlags Modifiers for string export. @param nMaxLen The maximum number of characters to store in this string. */ explicit XclExpString( - const String& rString, - XclStrFlags nFlags = EXC_STR_DEFAULT, - sal_uInt16 nMaxLen = EXC_STR_MAXLEN ); - /** Constructs an unformatted BIFF8 Unicode string. - @param nFlags Modifiers for string export. - @param nMaxLen The maximum number of characters to store in this string. */ - explicit XclExpString( const OUString& rString, XclStrFlags nFlags = EXC_STR_DEFAULT, sal_uInt16 nMaxLen = EXC_STR_MAXLEN ); @@ -75,14 +68,6 @@ public: @param nFlags Modifiers for string export. @param nMaxLen The maximum number of characters to store in this string. */ void Assign( - const String& rString, - XclStrFlags nFlags = EXC_STR_DEFAULT, - sal_uInt16 nMaxLen = EXC_STR_MAXLEN ); - - /** Assigns an unformatted string, converts this object to a BIFF8 Unicode string. - @param nFlags Modifiers for string export. - @param nMaxLen The maximum number of characters to store in this string. */ - void Assign( const OUString& rString, XclStrFlags nFlags = EXC_STR_DEFAULT, sal_uInt16 nMaxLen = EXC_STR_MAXLEN ); @@ -99,7 +84,7 @@ public: @param nFlags Modifiers for string export. @param nMaxLen The maximum number of characters to store in this string. */ void AssignByte( - const String& rString, + const OUString& rString, rtl_TextEncoding eTextEnc, XclStrFlags nFlags = EXC_STR_DEFAULT, sal_uInt16 nMaxLen = EXC_STR_MAXLEN ); @@ -108,11 +93,11 @@ public: /** Appends a string. Uses the string flags used in constructor or last Assign(). @descr This object must be a BIFF8 Unicode string. */ - void Append( const String& rString ); + void Append( const OUString& rString ); /** Appends a string. Uses the string flags used in constructor or last Assign(). @descr This object must be a BIFF2-BIFF7 byte string. */ - void AppendByte( const String& rString, rtl_TextEncoding eTextEnc ); + void AppendByte( const OUString& rString, rtl_TextEncoding eTextEnc ); /** Appends a character. Uses the string flags used in constructor or last Assign(). @descr This object must be a BIFF2-BIFF7 byte string. */ void AppendByte( sal_Unicode cChar, rtl_TextEncoding eTextEnc ); diff --git a/sc/source/filter/inc/xihelper.hxx b/sc/source/filter/inc/xihelper.hxx index 5884aae31769..0727f2664045 100644 --- a/sc/source/filter/inc/xihelper.hxx +++ b/sc/source/filter/inc/xihelper.hxx @@ -163,7 +163,7 @@ public: ~XclImpHFConverter(); /** Parses the passed string and creates three new edit engine text objects. */ - void ParseString( const String& rHFString ); + void ParseString( const OUString& rHFString ); /** Creates a ScPageHFItem and inserts it into the passed item set. */ void FillToItemSet( SfxItemSet& rItemSet, sal_uInt16 nWhichId ) const; diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 3ce1a6ce9a10..365c6a067066 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -192,7 +192,7 @@ void removeChars(OUString& rStr, sal_Unicode c) } -void ScInputHandler::InitRangeFinder( const String& rFormula ) +void ScInputHandler::InitRangeFinder( const OUString& rFormula ) { DeleteRangeFinder(); ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell(); @@ -212,10 +212,10 @@ void ScInputHandler::InitRangeFinder( const String& rFormula ) if ( nDot != STRING_NOTFOUND ) aDelimiters = aDelimiters.replaceAt( nDot, 1 , ""); // Delimiter ohne Punkt - const sal_Unicode* pChar = rFormula.GetBuffer(); - xub_StrLen nLen = rFormula.Len(); - xub_StrLen nPos = 0; - xub_StrLen nStart = 0; + const sal_Unicode* pChar = rFormula.getStr(); + sal_Int32 nLen = rFormula.getLength(); + sal_Int32 nPos = 0; + sal_Int32 nStart = 0; sal_uInt16 nCount = 0; ScRange aRange; while ( nPos < nLen && nCount < RANGEFIND_MAX ) @@ -252,7 +252,7 @@ handle_r1c1: if ( nPos > nStart ) { - String aTest = rFormula.Copy( nStart, nPos-nStart ); + String aTest = rFormula.copy( nStart, nPos-nStart ); const ScAddress::Details aAddrDetails( pDoc, aCursorPos ); sal_uInt16 nFlags = aRange.ParseAny( aTest, pDoc, aAddrDetails ); if ( nFlags & SCA_VALID ) @@ -395,11 +395,11 @@ static void lcl_RemoveLineEnd(OUString& rStr) removeChars(rStr, sal_Unicode('\n')); } -xub_StrLen lcl_MatchParenthesis( const String& rStr, xub_StrLen nPos ) +xub_StrLen lcl_MatchParenthesis( const OUString& rStr, xub_StrLen nPos ) { int nDir; sal_Unicode c1, c2 = 0; - c1 = rStr.GetChar( nPos ); + c1 = rStr[nPos]; switch ( c1 ) { case '(' : @@ -439,8 +439,8 @@ xub_StrLen lcl_MatchParenthesis( const String& rStr, xub_StrLen nPos ) } if ( !nDir ) return STRING_NOTFOUND; - xub_StrLen nLen = rStr.Len(); - const sal_Unicode* p0 = rStr.GetBuffer(); + xub_StrLen nLen = rStr.getLength(); + const sal_Unicode* p0 = rStr.getStr(); const sal_Unicode* p; const sal_Unicode* p1; sal_uInt16 nQuotes = 0; diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx index 3418d53f9a70..f4b9674b43f3 100644 --- a/sc/source/ui/dbgui/csvgrid.cxx +++ b/sc/source/ui/dbgui/csvgrid.cxx @@ -718,7 +718,7 @@ void ScCsvGrid::DoSelectAction( sal_uInt32 nColIndex, sal_uInt16 nModifier ) void ScCsvGrid::ImplSetTextLineSep( sal_Int32 nLine, const OUString& rTextLine, - const String& rSepChars, sal_Unicode cTextSep, bool bMergeSep ) + const OUString& rSepChars, sal_Unicode cTextSep, bool bMergeSep ) { if( nLine < GetFirstVisLine() ) return; @@ -730,7 +730,7 @@ void ScCsvGrid::ImplSetTextLineSep( // scan for separators String aCellText; - const sal_Unicode* pSepChars = rSepChars.GetBuffer(); + const sal_Unicode* pSepChars = rSepChars.getStr(); const sal_Unicode* pChar = rTextLine.getStr(); sal_uInt32 nColIx = 0; diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index da29f00d8440..d9a13e63fa07 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -514,7 +514,7 @@ void lcl_GetColumnTypes( sal_Int32 nFieldLen = 0; sal_Int32 nPrecision = 0; sal_Int32 nDbType = sdbc::DataType::SQLNULL; - String aFieldName; + OUString aFieldName; OUString aString; // Feldname[,Type[,Width[,Prec]]] @@ -580,11 +580,11 @@ void lcl_GetColumnTypes( // weitere nur alphanumerisch und Unterstrich erlaubt, // "_DBASELOCK" ist reserviert (obsolet weil erstes Zeichen kein Buchstabe), // keine doppelten Namen. - if ( !IsAsciiAlpha( aFieldName.GetChar(0) ) ) - aFieldName.Insert( 'N', 0 ); + if ( !IsAsciiAlpha( aFieldName[0] ) ) + aFieldName = "N" + aFieldName; String aTmpStr; sal_Unicode c; - for ( const sal_Unicode* p = aFieldName.GetBuffer(); ( c = *p ) != 0; p++ ) + for ( const sal_Unicode* p = aFieldName.getStr(); ( c = *p ) != 0; p++ ) { if ( IsAsciiAlpha( c ) || IsAsciiDigit( c ) || c == '_' ) aTmpStr += c; @@ -592,8 +592,8 @@ void lcl_GetColumnTypes( aTmpStr += '_'; } aFieldName = aTmpStr; - if ( aFieldName.Len() > 10 ) - aFieldName.Erase( 10 ); + if ( aFieldName.getLength() > 10 ) + aFieldName = aFieldName.copy(0, 10); if (!aFieldNames.insert(aFieldName).second) { // doppelter Feldname, numerisch erweitern @@ -612,8 +612,7 @@ void lcl_GetColumnTypes( } else { - aFieldName = 'N'; - aFieldName += OUString::number(nCol+1); + aFieldName = "N" + OUString::number(nCol+1); } if ( !bTypeDefined ) diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 5557f9b576c6..a41d3c4289f0 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -490,17 +490,17 @@ bool ScImportExport::ExportStream( SvStream& rStrm, const String& rBaseURL, sal_ } -void ScImportExport::WriteUnicodeOrByteString( SvStream& rStrm, const String& rString, bool bZero ) +void ScImportExport::WriteUnicodeOrByteString( SvStream& rStrm, const OUString& rString, bool bZero ) { rtl_TextEncoding eEnc = rStrm.GetStreamCharSet(); if ( eEnc == RTL_TEXTENCODING_UNICODE ) { if ( !IsEndianSwap( rStrm ) ) - rStrm.Write( rString.GetBuffer(), rString.Len() * sizeof(sal_Unicode) ); + rStrm.Write( rString.getStr(), rString.getLength() * sizeof(sal_Unicode) ); else { - const sal_Unicode* p = rString.GetBuffer(); - const sal_Unicode* const pStop = p + rString.Len(); + const sal_Unicode* p = rString.getStr(); + const sal_Unicode* const pStop = p + rString.getLength(); while ( p < pStop ) { rStrm << *p; @@ -859,7 +859,7 @@ static void lcl_WriteString( SvStream& rStrm, String& rString, sal_Unicode cQuot ScImportExport::WriteUnicodeOrByteString( rStrm, rString ); } -static inline void lcl_WriteSimpleString( SvStream& rStrm, const String& rString ) +static inline void lcl_WriteSimpleString( SvStream& rStrm, const OUString& rString ) { ScImportExport::WriteUnicodeOrByteString( rStrm, rString ); } @@ -1275,8 +1275,8 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) SCTAB nTab = aRange.aStart.Tab(); bool bFixed = pExtOptions->IsFixedLen(); - const String& rSeps = pExtOptions->GetFieldSeps(); - const sal_Unicode* pSeps = rSeps.GetBuffer(); + const OUString& rSeps = pExtOptions->GetFieldSeps(); + const sal_Unicode* pSeps = rSeps.getStr(); bool bMerge = pExtOptions->IsMergeSeps(); sal_uInt16 nInfoCount = pExtOptions->GetInfoCount(); const sal_Int32* pColStart = pExtOptions->GetColStart(); @@ -1556,10 +1556,10 @@ namespace { * @param rStr string to inspect. * @param cSep separator character. */ -bool hasLineBreaksOrSeps( const String& rStr, sal_Unicode cSep ) +bool hasLineBreaksOrSeps( const OUString& rStr, sal_Unicode cSep ) { - const sal_Unicode* p = rStr.GetBuffer(); - for (xub_StrLen i = 0, n = rStr.Len(); i < n; ++i, ++p) + const sal_Unicode* p = rStr.getStr(); + for (sal_Int32 i = 0, n = rStr.getLength(); i < n; ++i, ++p) { sal_Unicode c = *p; if (c == cSep) @@ -1710,7 +1710,7 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) while( bOk ) { - String aLine; + OUString aLine; String aText; OString aByteLine; SCCOL nCol = nStartCol; @@ -1725,7 +1725,7 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) aLine = OStringToOUString(aByteLine, rStrm.GetStreamCharSet()); if( rStrm.IsEof() ) break; - const sal_Unicode* p = aLine.GetBuffer(); + const sal_Unicode* p = aLine.getStr(); sal_Unicode cTag = *p++; if( cTag == 'C' ) // Content { @@ -1787,7 +1787,7 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) else { double fVal = rtl_math_uStringToDouble( p, - aLine.GetBuffer() + aLine.Len(), + aLine.getStr() + aLine.getLength(), cDecSep, cGrpSep, NULL, NULL ); pDoc->SetValue( nCol, nRow, aRange.aStart.Tab(), fVal ); } @@ -1917,10 +1917,10 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) } else if( cTag == 'I' && *p == 'D' ) { - aLine.Erase( 0, 4 ); - if (aLine.EqualsAscii( "CALCOOO32" )) + aLine = aLine.copy(4); + if (aLine == "CALCOOO32") eVersion = SYLK_OOO32; - else if (aLine.EqualsAscii( "SCALC3" )) + else if (aLine == "SCALC3") eVersion = SYLK_SCALC3; bMyDoc = (eVersion <= SYLK_OWN); } @@ -2291,14 +2291,14 @@ static inline const sal_Unicode* lcl_UnicodeStrChr( const sal_Unicode* pStr, } OUString ReadCsvLine( SvStream &rStream, bool bEmbeddedLineBreak, - const String& rFieldSeparators, sal_Unicode cFieldQuote ) + const OUString& rFieldSeparators, sal_Unicode cFieldQuote ) { OUString aStr; rStream.ReadUniOrByteStringLine(aStr, rStream.GetStreamCharSet(), nArbitraryLineLengthLimit); if (bEmbeddedLineBreak) { - const sal_Unicode* pSeps = rFieldSeparators.GetBuffer(); + const sal_Unicode* pSeps = rFieldSeparators.getStr(); QuoteType eQuoteState = FIELDEND_QUOTE; bool bFieldStart = true; diff --git a/sc/source/ui/inc/crnrdlg.hxx b/sc/source/ui/inc/crnrdlg.hxx index b7f522cc43a9..dd1077ba45e2 100644 --- a/sc/source/ui/inc/crnrdlg.hxx +++ b/sc/source/ui/inc/crnrdlg.hxx @@ -67,7 +67,7 @@ private: ScRangePairListRef xColNameRanges; ScRangePairListRef xRowNameRanges; - typedef ::boost::unordered_map< String, ScRange, ScStringHashCode, ::std::equal_to<String> > NameRangeMap; + typedef ::boost::unordered_map< OUString, ScRange, OUStringHash > NameRangeMap; NameRangeMap aRangeMap; ScViewData* pViewData; ScDocument* pDoc; diff --git a/sc/source/ui/inc/csvgrid.hxx b/sc/source/ui/inc/csvgrid.hxx index 717fd429bb48..2486ba347f6d 100644 --- a/sc/source/ui/inc/csvgrid.hxx +++ b/sc/source/ui/inc/csvgrid.hxx @@ -269,7 +269,7 @@ public: /** Fills all cells of a line with the passed text (separators mode). */ void ImplSetTextLineSep( sal_Int32 nLine, const OUString& rTextLine, - const String& rSepChars, sal_Unicode cTextSep, bool bMergeSep ); + const OUString& rSepChars, sal_Unicode cTextSep, bool bMergeSep ); /** Fills all cells of a line with the passed text (fixed width mode). */ void ImplSetTextLineFix( sal_Int32 nLine, const OUString& rTextLine ); diff --git a/sc/source/ui/inc/impex.hxx b/sc/source/ui/inc/impex.hxx index fef8300c3bda..8ef517b61308 100644 --- a/sc/source/ui/inc/impex.hxx +++ b/sc/source/ui/inc/impex.hxx @@ -108,7 +108,7 @@ public: static const sal_Unicode* ScanNextFieldFromString( const sal_Unicode* p, String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, bool bMergeSeps, bool& rbIsQuoted, bool& rbOverflowCell ); - static void WriteUnicodeOrByteString( SvStream& rStrm, const String& rString, bool bZero = false ); + static void WriteUnicodeOrByteString( SvStream& rStrm, const OUString& rString, bool bZero = false ); static void WriteUnicodeOrByteEndl( SvStream& rStrm ); static inline bool IsEndianSwap( const SvStream& rStrm ); @@ -234,7 +234,7 @@ public: */ SC_DLLPUBLIC OUString ReadCsvLine( SvStream &rStream, bool bEmbeddedLineBreak, - const String& rFieldSeparators, sal_Unicode cFieldQuote ); + const OUString& rFieldSeparators, sal_Unicode cFieldQuote ); #endif diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx index 0f0ac6e101da..ec80c85381e3 100644 --- a/sc/source/ui/inc/inputhdl.hxx +++ b/sc/source/ui/inc/inputhdl.hxx @@ -253,7 +253,7 @@ public: Size GetTextSize(); // in 1/100mm // actually private, public for SID_INPUT_SUM - void InitRangeFinder( const String& rFormula ); + void InitRangeFinder(const OUString& rFormula); static void SetAutoComplete(bool bSet) { bAutoComplete = bSet; } }; diff --git a/sc/source/ui/inc/pvfundlg.hxx b/sc/source/ui/inc/pvfundlg.hxx index c02cb5c6a142..6efd087daadb 100644 --- a/sc/source/ui/inc/pvfundlg.hxx +++ b/sc/source/ui/inc/pvfundlg.hxx @@ -233,7 +233,7 @@ private: CancelButton maBtnCancel; HelpButton maBtnHelp; - typedef ::boost::unordered_map<String, long, ScStringHashCode> DimNameIndexMap; + typedef ::boost::unordered_map<OUString, long, OUStringHash> DimNameIndexMap; DimNameIndexMap maNameIndexMap; ScDPObject& mrDPObj; }; |