[Libreoffice-commits] core.git: Branch 'private/kohei/calc-group-interpreter-3-backport' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Fri Oct 11 19:41:13 PDT 2013
sc/inc/address.hxx | 22 +-
sc/inc/compiler.hxx | 54 ++---
sc/inc/rangeutl.hxx | 23 +-
sc/source/core/data/column3.cxx | 2
sc/source/core/data/dpcache.cxx | 14 -
sc/source/core/data/table3.cxx | 24 +-
sc/source/core/inc/interpre.hxx | 26 +-
sc/source/core/tool/address.cxx | 217 ++++++++++-----------
sc/source/core/tool/compiler.cxx | 371 ++++++++++++++++++-------------------
sc/source/core/tool/interpr1.cxx | 172 ++++++++---------
sc/source/core/tool/interpr2.cxx | 70 +++---
sc/source/core/tool/interpr4.cxx | 54 ++---
sc/source/core/tool/interpr5.cxx | 21 --
sc/source/core/tool/queryparam.cxx | 14 -
sc/source/core/tool/rangeseq.cxx | 2
sc/source/core/tool/rangeutl.cxx | 101 ++++------
sc/source/core/tool/scmatrix.cxx | 2
sc/source/filter/excel/excimp8.cxx | 13 -
sc/source/filter/excel/xilink.cxx | 2
sc/source/ui/dbgui/consdlg.cxx | 12 -
sc/source/ui/dbgui/foptmgr.cxx | 2
sc/source/ui/inc/tpusrlst.hxx | 16 -
sc/source/ui/optdlg/tpusrlst.cxx | 72 +++----
sc/source/ui/view/gridwin.cxx | 4
sc/source/ui/view/gridwin5.cxx | 2
25 files changed, 645 insertions(+), 667 deletions(-)
New commits:
commit 9c3271e7410c1ffd3e89e3391579633b67b3c4ac
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Oct 11 22:42:19 2013 -0400
Fix all sorts of build breakages after the backport.
Change-Id: I352fbfd7bbedc1009125987a80e852cff0fe30fd
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index cc756d6..7fcd1f0 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<
@@ -304,7 +304,7 @@ public:
inline size_t hash() const;
/// "A1" or "$A$1" or R1C1 or R[1]C[1]
- String GetColRowString( bool bAbsolute = false,
+ OUString GetColRowString( bool bAbsolute = false,
const Details& rDetails = detailsOOOa1) const;
};
@@ -447,17 +447,17 @@ 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<
const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks = NULL );
- SC_DLLPUBLIC sal_uInt16 ParseAny( const String&, ScDocument* = NULL,
+ SC_DLLPUBLIC sal_uInt16 ParseAny( const OUString&, 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
@@ -481,7 +481,7 @@ public:
bOnlyAcceptSingle==true was given.
*/
const sal_Unicode* Parse_XL_Header( const sal_Unicode* pString, const ScDocument* pDoc,
- String& rExternDocName, String& rStartTabName, String& rEndTabName, sal_uInt16& nFlags,
+ OUString& rExternDocName, OUString& rStartTabName, OUString& rEndTabName, sal_uInt16& nFlags,
bool bOnlyAcceptSingle,
const ::com::sun::star::uno::Sequence<
const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks = NULL );
@@ -698,7 +698,7 @@ public:
inline int operator != ( const ScRefAddress& r ) const
{ return !(operator==(r)); }
- String GetRefString( ScDocument* pDoc, SCTAB nActTab,
+ OUString GetRefString( ScDocument* pDoc, SCTAB nActTab,
const ScAddress::Details& rDetails = ScAddress::detailsOOOa1) const;
};
@@ -753,12 +753,12 @@ template< typename T > void PutInOrder( T& nStart, T& nEnd )
}
}
-bool ConvertSingleRef( ScDocument* pDoc, const String& rRefString,
+bool ConvertSingleRef( ScDocument* pDoc, const OUString& rRefString,
SCTAB nDefTab, ScRefAddress& rRefAddress,
const ScAddress::Details& rDetails = ScAddress::detailsOOOa1,
ScAddress::ExternalInfo* pExtInfo = NULL );
-bool ConvertDoubleRef(ScDocument* pDoc, const String& rRefString,
+bool ConvertDoubleRef(ScDocument* pDoc, const OUString& rRefString,
SCTAB nDefTab, ScRefAddress& rStartRefAddress,
ScRefAddress& rEndRefAddress,
const ScAddress::Details& rDetails = ScAddress::detailsOOOa1,
@@ -782,7 +782,7 @@ inline OUString ScColToAlpha( SCCOL nCol )
}
/// get column number of A..IV... string
-bool AlphaToCol( SCCOL& rCol, const String& rStr);
+bool AlphaToCol( SCCOL& rCol, const OUString& rStr);
#endif // SC_ADDRESS_HXX
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 8d98a85..eb6eccf 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -239,8 +239,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;
/**
@@ -249,19 +249,19 @@ 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, OUString& rFile, OUString& rName,
const ScDocument* pDoc,
const ::com::sun::star::uno::Sequence<
const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks ) const = 0;
- virtual String makeExternalNameStr( const String& rFile, const String& rName ) const = 0;
+ virtual OUString makeExternalNameStr( const OUString& rFile, const OUString& rName ) const = 0;
virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
- sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef,
+ sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef,
ScExternalRefManager* pRefMgr ) const = 0;
virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
- sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef,
+ sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef,
ScExternalRefManager* pRefMgr ) const = 0;
enum SpecialSymbolType
@@ -316,8 +316,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,20 +335,20 @@ private:
virtual void SetError(sal_uInt16 nError);
xub_StrLen NextSymbol(bool bInArray);
- bool IsValue( const String& );
- bool IsOpCode( const String&, bool bInArray );
- bool IsOpCode2( const String& );
+ bool IsValue( const OUString& );
+ bool IsOpCode( const OUString&, bool bInArray );
+ bool IsOpCode2( const OUString& );
bool IsString();
- bool IsReference( const String& );
- bool IsSingleReference( const String& );
- bool IsPredetectedReference( const String& );
- bool IsDoubleReference( const String& );
- bool IsMacro( const String& );
- bool IsNamedRange( const String& );
- bool IsExternalNamedRange( const String& rSymbol );
- bool IsDBRange( const String& );
- bool IsColRowName( const String& );
- bool IsBoolean( const String& );
+ bool IsReference( const OUString& );
+ bool IsSingleReference( const OUString& );
+ bool IsPredetectedReference( const OUString& );
+ bool IsDoubleReference( const OUString& );
+ bool IsMacro( const OUString& );
+ bool IsNamedRange( const OUString& );
+ bool IsExternalNamedRange( const OUString& rSymbol );
+ bool IsDBRange( const OUString& );
+ bool IsColRowName( const OUString& );
+ bool IsBoolean( const OUString& );
void AutoCorrectParsedSymbol();
void SetRelNameReference();
@@ -371,21 +371,21 @@ public:
static void DeInit(); /// all
// for ScAddress::Format()
- static void CheckTabQuotes( String& aTabName,
+ static void CheckTabQuotes( OUString& aTabName,
const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO );
/** Analyzes a string for a 'Doc'#Tab construct, or 'Do''c'#Tab etc..
@returns the position of the unquoted # hash mark in 'Doc'#Tab, or
STRING_NOTFOUND if none. */
- static xub_StrLen GetDocTabPos( const String& rString );
+ static xub_StrLen GetDocTabPos( const OUString& rString );
- static bool EnQuote( String& rStr );
+ static bool EnQuote( OUString& rStr );
sal_Unicode GetNativeAddressSymbol( Convention::SpecialSymbolType eType ) const;
// Check if it is a valid english function name
- bool IsEnglishSymbol( const String& rName );
- bool IsErrorConstant( const String& ) const;
+ bool IsEnglishSymbol( const OUString& rName );
+ bool IsErrorConstant( const OUString& ) const;
//! _either_ CompileForFAP _or_ AutoCorrection, _not_ both
// #i101512# SetCompileForFAP is in formula::FormulaCompiler
@@ -446,7 +446,7 @@ public:
in nFlags, all bits must match. If bTestLetterNumeric is false and
char>=128, no LetterNumeric test is done and false is returned. */
static bool IsCharFlagAllConventions(
- String const & rStr, xub_StrLen nPos, sal_uLong nFlags, bool bTestLetterNumeric = true );
+ OUString const & rStr, xub_StrLen nPos, sal_uLong nFlags, bool bTestLetterNumeric = true );
private:
// FormulaCompiler
diff --git a/sc/inc/rangeutl.hxx b/sc/inc/rangeutl.hxx
index 486dab2..14a95f0 100644
--- a/sc/inc/rangeutl.hxx
+++ b/sc/inc/rangeutl.hxx
@@ -46,45 +46,45 @@ public:
ScRangeUtil() {}
~ScRangeUtil() {}
- sal_Bool MakeArea ( const String& rAreaStr,
+ sal_Bool MakeArea ( const OUString& rAreaStr,
ScArea& rArea,
ScDocument* pDoc,
SCTAB nTab,
ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 ) const;
- void CutPosString ( const String& theAreaStr,
- String& thePosStr ) const;
+ void CutPosString ( const OUString& theAreaStr,
+ OUString& thePosStr ) const;
- sal_Bool IsAbsTabArea ( const String& rAreaStr,
+ sal_Bool IsAbsTabArea ( const OUString& rAreaStr,
ScDocument* pDoc,
ScArea*** pppAreas = 0,
sal_uInt16* pAreaCount = 0,
sal_Bool bAcceptCellRef = false,
ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 ) const;
- sal_Bool IsAbsArea ( const String& rAreaStr,
+ sal_Bool IsAbsArea ( const OUString& rAreaStr,
ScDocument* pDoc,
SCTAB nTab,
- String* pCompleteStr = 0,
+ OUString* pCompleteStr = 0,
ScRefAddress* pStartPos = 0,
ScRefAddress* pEndPos = 0,
ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 ) const;
- sal_Bool IsRefArea ( const String&,
+ sal_Bool IsRefArea ( const OUString&,
ScDocument*,
SCTAB,
- String* = 0,
+ OUString* = 0,
ScRefAddress* = 0 ) const
{ return false; }
- sal_Bool IsAbsPos ( const String& rPosStr,
+ sal_Bool IsAbsPos ( const OUString& rPosStr,
ScDocument* pDoc,
SCTAB nTab,
- String* pCompleteStr = 0,
+ OUString* pCompleteStr = 0,
ScRefAddress* pPosTripel = 0,
ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 ) const;
- sal_Bool MakeRangeFromName ( const String& rName,
+ sal_Bool MakeRangeFromName ( const OUString& rName,
ScDocument* pDoc,
SCTAB nCurTab,
ScRange& rRange,
@@ -302,7 +302,6 @@ public:
~ScAreaNameIterator() {}
bool Next( OUString& rName, ScRange& rRange );
- bool Next( String& rName, ScRange& rRange );
bool WasDBName() const { return !bFirstPass; }
};
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index cad088a..220cb09 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1448,7 +1448,7 @@ bool ScColumn::ParseString(
if ( cFirstChar == '=' )
{
- if ( rString.getLength() == 1 ) // = Text
+ if ( rString.Len() == 1 ) // = Text
{
rCell.set(rPool.intern(rString));
}
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index f5cb40e..5ef3ada 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -525,7 +525,7 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam) const
&& pCellData->HasStringData() )
)
{ // by String
- String aCellStr = pCellData->GetString();
+ OUString aCellStr = pCellData->GetString();
bool bRealRegExp = (rParam.bRegExp && ((rEntry.eOp == SC_EQUAL)
|| (rEntry.eOp == SC_NOT_EQUAL)));
@@ -533,13 +533,13 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam) const
if (bRealRegExp || bTestRegExp)
{
sal_Int32 nStart = 0;
- sal_Int32 nEnd = aCellStr.Len();
+ sal_Int32 nEnd = aCellStr.getLength();
bool bMatch = (bool) rEntry.GetSearchTextPtr( rParam.bCaseSens )
->SearchForward( aCellStr, &nStart, &nEnd );
// from 614 on, nEnd is behind the found text
if (bMatch && bMatchWholeCell
- && (nStart != 0 || nEnd != aCellStr.Len()))
+ && (nStart != 0 || nEnd != aCellStr.getLength()))
bMatch = false; // RegExp must match entire cell string
if (bRealRegExp)
bOk = ((rEntry.eOp == SC_NOT_EQUAL) ? !bMatch : bMatch);
@@ -554,14 +554,14 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam) const
OUString aStr = rEntry.GetQueryItem().maString.getString();
bOk = pTransliteration->isEqual(aCellStr, aStr);
bool bHasStar = false;
- xub_StrLen nIndex;
- if (( nIndex = aStr.Search('*') ) != STRING_NOTFOUND)
+ sal_Int32 nIndex;
+ if (( nIndex = aStr.indexOf('*') ) != -1)
bHasStar = sal_True;
if (bHasStar && (nIndex>0))
{
- for (i=0;(i<nIndex) && (i< aCellStr.Len()) ; i++)
+ for (sal_Int32 j=0;(j<nIndex) && (j< aCellStr.getLength()) ; j++)
{
- if (aCellStr.GetChar( (sal_uInt16)i ) == aStr.GetChar((sal_uInt16) i ))
+ if (aCellStr[j] == aStr[j])
{
bOk=1;
}
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 7148d16..f6fc8f9 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -140,7 +140,7 @@ bool SplitString( const OUString &sWhole,
@return Returnes 1 if sInput1 is greater, 0 if sInput1 == sInput2, and -1 if
sInput2 is greater.
*/
-short Compare( const String &sInput1, const String &sInput2,
+short Compare( const OUString &sInput1, const OUString &sInput2,
const bool bCaseSens, const ScUserListData* pData, const CollatorWrapper *pCW )
{
OUString sStr1( sInput1 ), sStr2( sInput2 ), sPre1, sSuf1, sPre2, sSuf2;
@@ -942,13 +942,13 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam )
bool bTestPrevSub = ( nLevelCount > 1 );
OUString aSubString;
- String aOutString;
+ OUString aOutString;
bool bIgnoreCase = !rParam.bCaseSens;
- String *pCompString[MAXSUBTOTAL]; // Pointer wegen Compiler-Problemen
+ OUString *pCompString[MAXSUBTOTAL]; // Pointer wegen Compiler-Problemen
for (i=0; i<MAXSUBTOTAL; i++)
- pCompString[i] = new String;
+ pCompString[i] = new OUString;
//! sortieren?
@@ -1060,9 +1060,9 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam )
else
{ // " Ergebnis"
aOutString = aSubString;
- if (!aOutString.Len())
+ if (aOutString.isEmpty())
aOutString = ScGlobal::GetRscString( STR_EMPTYDATA );
- aOutString += ' ';
+ aOutString += " ";
sal_uInt16 nStrId = STR_TABLE_ERGEBNIS;
if ( nResCount == 1 )
switch ( eResFunc[0] )
@@ -1527,17 +1527,17 @@ public:
aQueryStr, ScGlobal::eLnge, 0, aQueryStr.getLength(),
NULL ) );
xub_StrLen nIndex = (rEntry.eOp == SC_ENDS_WITH
- || rEntry.eOp == SC_DOES_NOT_END_WITH)? (aCell.Len()-aQuer.Len()):0;
- xub_StrLen nStrPos = aCell.Search( aQuer, nIndex );
+ || rEntry.eOp == SC_DOES_NOT_END_WITH)? (aCell.getLength()-aQuer.getLength()):0;
+ sal_Int32 nStrPos = aCell.indexOf( aQuer, nIndex );
switch (rEntry.eOp)
{
case SC_EQUAL:
case SC_CONTAINS:
- bOk = ( nStrPos != STRING_NOTFOUND );
+ bOk = ( nStrPos != -1 );
break;
case SC_NOT_EQUAL:
case SC_DOES_NOT_CONTAIN:
- bOk = ( nStrPos == STRING_NOTFOUND );
+ bOk = ( nStrPos == -1 );
break;
case SC_BEGINS_WITH:
bOk = ( nStrPos == 0 );
@@ -1546,10 +1546,10 @@ public:
bOk = ( nStrPos != 0 );
break;
case SC_ENDS_WITH:
- bOk = ( nStrPos + aQuer.Len() == aCell.Len() );
+ bOk = ( nStrPos + aQuer.getLength() == aCell.getLength() );
break;
case SC_DOES_NOT_END_WITH:
- bOk = ( nStrPos + aQuer.Len() != aCell.Len() );
+ bOk = ( nStrPos + aQuer.getLength() != aCell.getLength() );
break;
default:
{
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 942b4a1..29c722b 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -195,7 +195,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 );
@@ -292,14 +292,14 @@ ScDBRangeBase* PopDBDoubleRef();
void PopDoubleRef(SCCOL& rCol1, SCROW &rRow1, SCTAB& rTab1,
SCCOL& rCol2, SCROW &rRow2, SCTAB& rTab2,
bool bDontCheckForTableOp = false );
-void PopExternalSingleRef(sal_uInt16& rFileId, String& rTabName, ScSingleRefData& rRef);
+void PopExternalSingleRef(sal_uInt16& rFileId, OUString& rTabName, ScSingleRefData& rRef);
void PopExternalSingleRef(ScExternalRefCache::TokenRef& rToken, ScExternalRefCache::CellFormat* pFmt = NULL);
-void PopExternalSingleRef(sal_uInt16& rFileId, String& rTabName, ScSingleRefData& rRef,
+void PopExternalSingleRef(sal_uInt16& rFileId, OUString& rTabName, ScSingleRefData& rRef,
ScExternalRefCache::TokenRef& rToken, ScExternalRefCache::CellFormat* pFmt = NULL);
-void PopExternalDoubleRef(sal_uInt16& rFileId, String& rTabName, ScComplexRefData& rRef);
+void PopExternalDoubleRef(sal_uInt16& rFileId, OUString& rTabName, ScComplexRefData& rRef);
void PopExternalDoubleRef(ScExternalRefCache::TokenArrayRef& rArray);
void PopExternalDoubleRef(ScMatrixRef& rMat);
-void GetExternalDoubleRef(sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& aData, ScExternalRefCache::TokenArrayRef& rArray);
+void GetExternalDoubleRef(sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& aData, ScExternalRefCache::TokenArrayRef& rArray);
bool PopDoubleRefOrSingleRef( ScAddress& rAdr );
void PopDoubleRefPushMatrix();
// If MatrixFormula: convert formula::svDoubleRef to svMatrix, create JumpMatrix.
@@ -321,9 +321,9 @@ void PushString( const svl::SharedString& rString );
void PushSingleRef(SCCOL nCol, SCROW nRow, SCTAB nTab);
void PushDoubleRef(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2);
-void PushExternalSingleRef(sal_uInt16 nFileId, const String& rTabName,
+void PushExternalSingleRef(sal_uInt16 nFileId, const OUString& rTabName,
SCCOL nCol, SCROW nRow, SCTAB nTab);
-void PushExternalDoubleRef(sal_uInt16 nFileId, const String& rTabName,
+void PushExternalDoubleRef(sal_uInt16 nFileId, const OUString& rTabName,
SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2);
void PushMatrix( const sc::RangeMatrix& rMat );
@@ -366,7 +366,7 @@ inline void CurFmtToFuncFmt()
{ nFuncFmtType = nCurFmtType; nFuncFmtIndex = nCurFmtIndex; }
// Check for String overflow of rResult+rAdd and set error and erase rResult
// if so. Return true if ok, false if overflow
-inline bool CheckStringResultLen( String& rResult, const String& rAdd );
+inline bool CheckStringResultLen( OUString& rResult, const OUString& rAdd );
// Set error according to rVal, and set rVal to 0.0 if there was an error.
inline void TreatDoubleError( double& rVal );
// Lookup using ScLookupCache, @returns true if found and result address
@@ -638,11 +638,11 @@ double ScGetBw(double fZins, double fZzr, double fRmz,
void ScBW();
void ScDIA();
double ScGetGDA(double fWert, double fRest, double fDauer,
- double fPeriode, double fFaktor);
+ double fPeriode, double fFactor);
void ScGDA();
void ScGDA2();
double ScInterVDB(double fWert,double fRest,double fDauer,double fDauer1,
- double fPeriode,double fFaktor);
+ double fPeriode,double fFactor);
void ScVDB();
void ScLaufz();
void ScLIA();
@@ -893,12 +893,12 @@ inline bool ScInterpreter::MustHaveParamCountMin( short nAct, short nMin )
return false;
}
-inline bool ScInterpreter::CheckStringResultLen( String& rResult, const String& rAdd )
+inline bool ScInterpreter::CheckStringResultLen( OUString& rResult, const OUString& rAdd )
{
- if ( (sal_uLong) rResult.Len() + rAdd.Len() > STRING_MAXLEN )
+ if ( (sal_uLong) rResult.getLength() + rAdd.getLength() > STRING_MAXLEN )
{
SetError( errStringOverflow );
- rResult.Erase();
+ rResult = "";
return false;
}
return true;
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 3a8aed3..f1fabf6 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -58,9 +58,9 @@ ScAddress::Details::Details ( const ScDocument* pDoc,
* @return pointer to the character immediately after the closing single
* quote.
*/
-static const sal_Unicode* lcl_ParseQuotedName( const sal_Unicode* p, String& rName )
+static const sal_Unicode* lcl_ParseQuotedName( const sal_Unicode* p, OUString& rName )
{
- rName.Erase();
+ rName = "";
if (*p != '\'')
return p;
@@ -73,7 +73,7 @@ static const sal_Unicode* lcl_ParseQuotedName( const sal_Unicode* p, String& rNa
if (cPrev == '\'')
{
// double single-quote equals one single quote.
- rName += *p;
+ rName += OUString(*p);
cPrev = 0;
continue;
}
@@ -82,10 +82,10 @@ static const sal_Unicode* lcl_ParseQuotedName( const sal_Unicode* p, String& rNa
// We are past the closing quote. We're done!
return p;
else
- rName += *p;
+ rName += OUString(*p);
cPrev = *p;
}
- rName.Erase();
+ rName = "";
return pStart;
}
@@ -142,12 +142,12 @@ static bool lcl_ScRange_External_TabSpan(
ScRange & rRange,
sal_uInt16 & rFlags,
ScAddress::ExternalInfo* pExtInfo,
- const String & rExternDocName,
- const String & rStartTabName,
- const String & rEndTabName,
+ const OUString & rExternDocName,
+ const OUString & rStartTabName,
+ const OUString & rEndTabName,
ScDocument* pDoc )
{
- if (!rExternDocName.Len())
+ if (rExternDocName.isEmpty())
return !pExtInfo || !pExtInfo->mbExternal;
ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
@@ -155,14 +155,14 @@ static bool lcl_ScRange_External_TabSpan(
{
// This is an internal document. Get the sheet positions from the
// ScDocument instance.
- if (rStartTabName.Len())
+ if (!rStartTabName.isEmpty())
{
SCTAB nTab;
if (pDoc->GetTable(rStartTabName, nTab))
rRange.aStart.SetTab(nTab);
}
- if (rEndTabName.Len())
+ if (!rEndTabName.isEmpty())
{
SCTAB nTab;
if (pDoc->GetTable(rEndTabName, nTab))
@@ -188,7 +188,7 @@ static bool lcl_ScRange_External_TabSpan(
}
}
- if (!rEndTabName.Len() || rStartTabName == rEndTabName)
+ if (rEndTabName.isEmpty() || rStartTabName == rEndTabName)
{
rRange.aEnd.SetTab( rRange.aStart.Tab());
return true;
@@ -219,11 +219,11 @@ static bool lcl_ScRange_External_TabSpan(
*/
static const sal_Unicode *
lcl_XL_ParseSheetRef( const sal_Unicode* start,
- String& rExternTabName,
+ OUString& rExternTabName,
bool allow_3d,
const sal_Unicode* pMsoxlQuoteStop )
{
- String aTabName;
+ OUString aTabName;
const sal_Unicode *p = start;
// XL only seems to use single quotes for sheet names.
@@ -237,7 +237,7 @@ lcl_XL_ParseSheetRef( const sal_Unicode* start,
// We pre-analyzed the quoting, no checks needed here.
if (*++p == '\'')
{
- aTabName.Append( pCurrentStart,
+ aTabName += OUString( pCurrentStart,
sal::static_int_cast<xub_StrLen>( p - pCurrentStart));
pCurrentStart = ++p;
}
@@ -250,8 +250,8 @@ lcl_XL_ParseSheetRef( const sal_Unicode* start,
++p;
}
if (pCurrentStart < p)
- aTabName.Append( pCurrentStart, sal::static_int_cast<xub_StrLen>( p - pCurrentStart));
- if (!aTabName.Len())
+ aTabName += OUString( pCurrentStart, sal::static_int_cast<xub_StrLen>( p - pCurrentStart));
+ if (aTabName.isEmpty())
return NULL;
if (p == pMsoxlQuoteStop)
++p; // position on ! of ...'!...
@@ -261,7 +261,7 @@ lcl_XL_ParseSheetRef( const sal_Unicode* start,
else if( *p == '\'')
{
p = lcl_ParseQuotedName(p, aTabName);
- if (!aTabName.Len())
+ if (aTabName.isEmpty())
return NULL;
}
else
@@ -322,7 +322,7 @@ lcl_XL_ParseSheetRef( const sal_Unicode* start,
if( *p != '!' && ( !allow_3d || *p != ':' ) )
return (!allow_3d && *p == ':') ? p : start;
- aTabName.Append( start, sal::static_int_cast<xub_StrLen>( p - start ) );
+ aTabName += OUString( start, sal::static_int_cast<xub_StrLen>( p - start ) );
}
rExternTabName = aTabName;
@@ -341,7 +341,7 @@ lcl_XL_ParseSheetRef( const sal_Unicode* start,
TRUE in all other cases, also when there is no index sequence or the input
name is not numeric.
*/
-static bool lcl_XL_getExternalDoc( const sal_Unicode** ppErrRet, String& rExternDocName,
+static bool lcl_XL_getExternalDoc( const sal_Unicode** ppErrRet, OUString& rExternDocName,
const uno::Sequence< const sheet::ExternalLinkInfo > * pExternalLinks)
{
// 1-based, sequence starts with an empty element.
@@ -350,7 +350,7 @@ static bool lcl_XL_getExternalDoc( const sal_Unicode** ppErrRet, String& rExtern
// A numeric "document name" is an index into the sequence.
if (CharClass::isAsciiNumeric( rExternDocName))
{
- sal_Int32 i = rExternDocName.ToInt32();
+ sal_Int32 i = rExternDocName.toInt32();
if (i < 0 || i >= pExternalLinks->getLength())
return false; // with default *ppErrRet
const sheet::ExternalLinkInfo & rInfo = (*pExternalLinks)[i];
@@ -388,9 +388,9 @@ static bool lcl_XL_getExternalDoc( const sal_Unicode** ppErrRet, String& rExtern
const sal_Unicode* ScRange::Parse_XL_Header(
const sal_Unicode* p,
const ScDocument* pDoc,
- String& rExternDocName,
- String& rStartTabName,
- String& rEndTabName,
+ OUString& rExternDocName,
+ OUString& rStartTabName,
+ OUString& rEndTabName,
sal_uInt16& nFlags,
bool bOnlyAcceptSingle,
const uno::Sequence< const sheet::ExternalLinkInfo > * pExternalLinks )
@@ -399,9 +399,9 @@ const sal_Unicode* ScRange::Parse_XL_Header(
sal_uInt16 nSaveFlags = nFlags;
// Is this an external reference ?
- rStartTabName.Erase();
- rEndTabName.Erase();
- rExternDocName.Erase();
+ rStartTabName = "";
+ rEndTabName = "";
+ rExternDocName = "";
const sal_Unicode* pMsoxlQuoteStop = NULL;
if (*p == '[')
{
@@ -411,9 +411,9 @@ const sal_Unicode* ScRange::Parse_XL_Header(
if (*p == '\'')
{
p = lcl_ParseQuotedName(p, rExternDocName);
- if (!*p || *p != ']' || !rExternDocName.Len())
+ if (!*p || *p != ']' || rExternDocName.isEmpty())
{
- rExternDocName.Erase();
+ rExternDocName = "";
return start;
}
}
@@ -423,7 +423,7 @@ const sal_Unicode* ScRange::Parse_XL_Header(
p = ScGlobal::UnicodeStrChr( start+1, ']' );
if( p == NULL )
return start;
- rExternDocName.Append( start+1, sal::static_int_cast<xub_StrLen>( p-(start+1) ) );
+ rExternDocName += OUString( start+1, sal::static_int_cast<xub_StrLen>( p-(start+1) ) );
}
++p;
@@ -445,23 +445,23 @@ const sal_Unicode* ScRange::Parse_XL_Header(
p = lcl_ParseQuotedName(p, rExternDocName);
if (!*p || *p != '!')
{
- rExternDocName.Erase();
+ rExternDocName = "";
return start;
}
- if (rExternDocName.Len())
+ if (!rExternDocName.isEmpty())
{
- xub_StrLen nOpen = rExternDocName.Search( '[');
- if (nOpen == STRING_NOTFOUND)
- rExternDocName.Erase();
+ sal_Int32 nOpen = rExternDocName.indexOf( '[');
+ if (nOpen == -1)
+ rExternDocName = "";
else
{
- xub_StrLen nClose = rExternDocName.Search( ']', nOpen+1);
- if (nClose == STRING_NOTFOUND)
- rExternDocName.Erase();
+ sal_Int32 nClose = rExternDocName.indexOf( ']', nOpen+1);
+ if (nClose == -1)
+ rExternDocName = "";
else
{
- rExternDocName.Erase( nClose);
- rExternDocName.Erase( nOpen, 1);
+ rExternDocName = rExternDocName.copy(0, nClose);
+ rExternDocName = rExternDocName.replaceAt( nOpen, 1, "");
pMsoxlQuoteStop = p - 1; // the ' quote char
// There may be embedded escaped quotes, just matching the
// doc name's length may not work.
@@ -481,7 +481,7 @@ const sal_Unicode* ScRange::Parse_XL_Header(
}
}
}
- if (!rExternDocName.Len())
+ if (rExternDocName.isEmpty())
p = start;
}
@@ -526,17 +526,15 @@ const sal_Unicode* ScRange::Parse_XL_Header(
// Use the current tab, it needs to be passed in. : aEnd.SetTab( .. );
}
- if (rExternDocName.Len())
+ if (!rExternDocName.isEmpty())
{
ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
- OUString aTmp = rExternDocName;
- pRefMgr->convertToAbsName(aTmp);
- rExternDocName = aTmp;
+ pRefMgr->convertToAbsName(rExternDocName);
}
else
{
// Internal reference.
- if (!rStartTabName.Len())
+ if (rStartTabName.isEmpty())
{
nFlags = nSaveFlags;
return start;
@@ -553,7 +551,7 @@ const sal_Unicode* ScRange::Parse_XL_Header(
aStart.SetTab(nTab);
aEnd.SetTab(nTab);
- if (rEndTabName.Len())
+ if (!rEndTabName.isEmpty())
{
if (!pDoc->GetTable(rEndTabName, nTab))
{
@@ -668,7 +666,7 @@ lcl_ScRange_Parse_XL_R1C1( ScRange& r,
ScAddress::ExternalInfo* pExtInfo )
{
const sal_Unicode* pTmp = NULL;
- String aExternDocName, aStartTabName, aEndTabName;
+ OUString aExternDocName, aStartTabName, aEndTabName;
sal_uInt16 nFlags = SCA_VALID | SCA_VALID_TAB;
// Keep in mind that nFlags2 gets left-shifted by 4 bits before being merged.
sal_uInt16 nFlags2 = SCA_VALID_TAB;
@@ -676,7 +674,7 @@ lcl_ScRange_Parse_XL_R1C1( ScRange& r,
p = r.Parse_XL_Header( p, pDoc, aExternDocName, aStartTabName,
aEndTabName, nFlags, bOnlyAcceptSingle, NULL );
- if (aExternDocName.Len() > 0)
+ if (!aExternDocName.isEmpty())
lcl_ScRange_External_TabSpan( r, nFlags, pExtInfo, aExternDocName,
aStartTabName, aEndTabName, pDoc);
@@ -845,13 +843,13 @@ lcl_ScRange_Parse_XL_A1( ScRange& r,
const uno::Sequence< const sheet::ExternalLinkInfo > * pExternalLinks )
{
const sal_Unicode* tmp1, *tmp2;
- String aExternDocName, aStartTabName, aEndTabName; // for external link table
+ OUString aExternDocName, aStartTabName, aEndTabName; // for external link table
sal_uInt16 nFlags = SCA_VALID | SCA_VALID_TAB, nFlags2 = SCA_VALID_TAB;
p = r.Parse_XL_Header( p, pDoc, aExternDocName, aStartTabName,
aEndTabName, nFlags, bOnlyAcceptSingle, pExternalLinks );
- if (aExternDocName.Len() > 0)
+ if (!aExternDocName.isEmpty())
lcl_ScRange_External_TabSpan( r, nFlags, pExtInfo, aExternDocName,
aStartTabName, aEndTabName, pDoc);
@@ -944,13 +942,13 @@ lcl_ScRange_Parse_XL_A1( ScRange& r,
p = tmp2;
p = lcl_eatWhiteSpace( p+1 );
tmp1 = lcl_a1_get_col( p, &r.aEnd, &nFlags2 );
- if( !tmp1 && !aEndTabName.Len() ) // Probably the aEndTabName was specified after the first range
+ if( !tmp1 && aEndTabName.isEmpty() ) // Probably the aEndTabName was specified after the first range
{
p = lcl_XL_ParseSheetRef( p, aEndTabName, false, NULL );
if( p )
{
SCTAB nTab = 0;
- if( aEndTabName.Len() && pDoc->GetTable( aEndTabName, nTab ) )
+ if( !aEndTabName.isEmpty() && pDoc->GetTable( aEndTabName, nTab ) )
{
r.aEnd.SetTab( nTab );
nFlags |= SCA_VALID_TAB2 | SCA_TAB2_3D | SCA_TAB2_ABSOLUTE;
@@ -989,7 +987,7 @@ lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDoc, ScAddress& rAdd
{
sal_uInt16 nRes = 0;
OUString aDocName; // der pure Dokumentenname
- String aTab;
+ OUString aTab;
bool bExtDoc = false;
bool bExtDocInherited = false;
const ScAddress aCurPos(rAddr);
@@ -999,7 +997,7 @@ lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDoc, ScAddress& rAdd
if (*p == '\'')
{
const sal_Unicode* pStart = p;
- String aTmp;
+ OUString aTmp;
p = lcl_ParseQuotedName(p, aTmp);
aDocName = aTmp;
if (*p++ == SC_COMPILER_FILE_TAB_SEP)
@@ -1046,7 +1044,8 @@ lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDoc, ScAddress& rAdd
{
p++; break;
}
- aTab += *p++;
+ aTab += OUString(*p);
+ p++;
}
}
if( *p++ != '.' )
@@ -1056,11 +1055,11 @@ lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDoc, ScAddress& rAdd
{
// Specified table name is not found in this document. Assume this is an external document.
aDocName = aTab;
- xub_StrLen n = aTab.SearchBackward('.');
- if (n != STRING_NOTFOUND && n > 0)
+ sal_Int32 n = aDocName.lastIndexOf('.');
+ if (n != -1 && n > 0)
{
// Extension found. Strip it.
- aTab.Erase(n);
+ aTab = aTab.replaceAt(n, 1, "");
bExtDoc = true;
}
else
@@ -1262,7 +1261,7 @@ lcl_ScAddress_Parse ( const sal_Unicode* p, ScDocument* pDoc, ScAddress& rAddr,
}
}
-bool ConvertSingleRef( ScDocument* pDoc, const String& rRefString,
+bool ConvertSingleRef( ScDocument* pDoc, const OUString& rRefString,
SCTAB nDefTab, ScRefAddress& rRefAddress,
const ScAddress::Details& rDetails,
ScAddress::ExternalInfo* pExtInfo /* = NULL */ )
@@ -1284,7 +1283,7 @@ bool ConvertSingleRef( ScDocument* pDoc, const String& rRefString,
return bRet;
}
-bool ConvertDoubleRef( ScDocument* pDoc, const String& rRefString, SCTAB nDefTab,
+bool ConvertDoubleRef( ScDocument* pDoc, const OUString& rRefString, SCTAB nDefTab,
ScRefAddress& rStartRefAddress, ScRefAddress& rEndRefAddress,
const ScAddress::Details& rDetails,
ScAddress::ExternalInfo* pExtInfo /* = NULL */ )
@@ -1310,12 +1309,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
@@ -1382,7 +1381,7 @@ void ScRange::ExtendTo( const ScRange& rRange )
}
static sal_uInt16
-lcl_ScRange_Parse_OOo( ScRange &aRange, const String& r, ScDocument* pDoc, ScAddress::ExternalInfo* pExtInfo = NULL )
+lcl_ScRange_Parse_OOo( ScRange &aRange, const OUString& r, ScDocument* pDoc, ScAddress::ExternalInfo* pExtInfo = NULL )
{
sal_uInt16 nRes1 = 0, nRes2 = 0;
xub_StrLen nPos = ScGlobal::FindUnquoted( r, ':');
@@ -1443,12 +1442,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,16 +1458,16 @@ 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 );
}
}
// Accept a full range, or an address
-sal_uInt16 ScRange::ParseAny( const String& r, ScDocument* pDoc,
+sal_uInt16 ScRange::ParseAny( const OUString& r, ScDocument* pDoc,
const ScAddress::Details& rDetails )
{
sal_uInt16 nRet = Parse( r, pDoc, rDetails );
@@ -1486,15 +1485,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 +1544,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)
@@ -1654,12 +1653,12 @@ lcl_r1c1_append_r ( OUString &r, int nRow, bool bIsAbs,
}
}
-static String
+static OUString
getFileNameFromDoc( const ScDocument* pDoc )
{
// TODO : er points at ScGlobal::GetAbsDocName()
// as a better template. Look into it
- String sFileName;
+ OUString sFileName;
SfxObjectShell* pShell;
if( NULL != pDoc &&
@@ -1694,18 +1693,18 @@ OUString ScAddress::Format(sal_uInt16 nFlags, const ScDocument* pDoc,
}
if( nFlags & SCA_TAB_3D )
{
- String aTabName, aDocName;
+ OUString aTabName, aDocName;
OUString aTmp;
pDoc->GetName(nTab, aTmp);
aTabName = aTmp; // TODO: remove use of String here.
// External Reference, same as in ScCompiler::MakeTabStr()
- if( aTabName.GetChar(0) == '\'' )
+ if( aTabName[0] == '\'' )
{ // "'Doc'#Tab"
xub_StrLen nPos = ScCompiler::GetDocTabPos( aTabName);
if (nPos != STRING_NOTFOUND)
{
- aDocName = aTabName.Copy( 0, nPos + 1 );
- aTabName.Erase( 0, nPos + 1 );
+ aDocName = aTabName.copy( 0, nPos + 1 );
+ aTabName = aTabName.copy( nPos + 1 );
}
}
else if( nFlags & SCA_FORCE_DOC )
@@ -1733,11 +1732,9 @@ OUString ScAddress::Format(sal_uInt16 nFlags, const ScDocument* pDoc,
case formula::FormulaGrammar::CONV_XL_A1:
case formula::FormulaGrammar::CONV_XL_R1C1:
case formula::FormulaGrammar::CONV_XL_OOX:
- if (aDocName.Len() > 0)
+ if (!aDocName.isEmpty())
{
- r += "[";
- r += aDocName;
- r += "]";
+ r += "[" + aDocName + "]";
}
r += aTabName;
r += "!";
@@ -1771,20 +1768,18 @@ static void
lcl_Split_DocTab( const ScDocument* pDoc, SCTAB nTab,
const ScAddress::Details& rDetails,
sal_uInt16 nFlags,
- String& rTabName, String& rDocName )
+ OUString& rTabName, OUString& rDocName )
{
- OUString aTmp;
- pDoc->GetName(nTab, aTmp);
- rTabName = aTmp;
- rDocName.Erase();
+ pDoc->GetName(nTab, rTabName);
+ rDocName = "";
// External reference, same as in ScCompiler::MakeTabStr()
- if ( rTabName.GetChar(0) == '\'' )
+ if ( rTabName[0] == '\'' )
{ // "'Doc'#Tab"
xub_StrLen nPos = ScCompiler::GetDocTabPos( rTabName);
if (nPos != STRING_NOTFOUND)
{
- rDocName = rTabName.Copy( 0, nPos + 1 );
- rTabName.Erase( 0, nPos + 1 );
+ rDocName = rTabName.copy( 0, nPos + 1 );
+ rTabName = rTabName.copy( nPos + 1 );
}
}
else if( nFlags & SCA_FORCE_DOC )
@@ -1806,14 +1801,12 @@ lcl_ScRange_Format_XL_Header( OUString& r, const ScRange& rRange,
{
if( nFlags & SCA_TAB_3D )
{
- String aTabName, aDocName;
+ OUString aTabName, aDocName;
lcl_Split_DocTab( pDoc, rRange.aStart.Tab(), rDetails, nFlags,
aTabName, aDocName );
- if( aDocName.Len() > 0 )
+ if( !aDocName.isEmpty() )
{
- r += "[";
- r += aDocName;
- r += "]";
+ r += "[" + aDocName + "]";
}
r += aTabName;
@@ -1960,7 +1953,7 @@ bool ScRange::Move( SCsCOL dx, SCsROW dy, SCsTAB dz, ScDocument* pDoc )
return aStart.Move( dx, dy, dz, pDoc ) & aEnd.Move( dx, dy, dz, pDoc );
}
-String ScAddress::GetColRowString( bool bAbsolute,
+OUString ScAddress::GetColRowString( bool bAbsolute,
const Details& rDetails ) const
{
OUString aString;
@@ -1991,7 +1984,7 @@ String ScAddress::GetColRowString( bool bAbsolute,
return aString;
}
-String ScRefAddress::GetRefString( ScDocument* pDoc, SCTAB nActTab,
+OUString ScRefAddress::GetRefString( ScDocument* pDoc, SCTAB nActTab,
const ScAddress::Details& rDetails ) const
{
if ( !pDoc )
@@ -2031,28 +2024,28 @@ void ScColToAlpha( OUStringBuffer& rBuf, SCCOL nCol )
}
else
{
- String aStr;
+ OUString aStr;
while (nCol >= 26)
{
SCCOL nC = nCol % 26;
- aStr += static_cast<sal_Unicode>( 'A' +
- static_cast<sal_uInt16>(nC));
+ aStr += OUString( static_cast<sal_Unicode>( 'A' +
+ static_cast<sal_uInt16>(nC)));
nCol = sal::static_int_cast<SCCOL>( nCol - nC );
nCol = nCol / 26 - 1;
}
- aStr += static_cast<sal_Unicode>( 'A' +
- static_cast<sal_uInt16>(nCol));
+ aStr += OUString(static_cast<sal_Unicode>( 'A' +
+ static_cast<sal_uInt16>(nCol)));
rBuf.append(comphelper::string::reverseString(aStr));
}
}
-bool AlphaToCol( SCCOL& rCol, const String& rStr)
+bool AlphaToCol( SCCOL& rCol, const OUString& rStr)
{
SCCOL nResult = 0;
- xub_StrLen nStop = rStr.Len();
+ xub_StrLen nStop = rStr.getLength();
xub_StrLen nPos = 0;
sal_Unicode c;
- while (nResult <= MAXCOL && nPos < nStop && (c = rStr.GetChar( nPos)) != 0 &&
+ while (nResult <= MAXCOL && nPos < nStop && (c = rStr[nPos]) != 0 &&
rtl::isAsciiAlpha(c))
{
if (nPos > 0)
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index fa281f5..7c25157 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -171,7 +171,7 @@ void ScCompiler::DeInit()
}
}
-bool ScCompiler::IsEnglishSymbol( const String& rName )
+bool ScCompiler::IsEnglishSymbol( const OUString& rName )
{
// function names are always case-insensitive
OUString aUpper = ScGlobal::pCharClass->uppercase(rName);
@@ -410,20 +410,20 @@ ScCompiler::Convention::Convention( FormulaGrammar::AddressConvention eConv )
}
}
-static bool lcl_isValidQuotedText( const String& rFormula, xub_StrLen nSrcPos, ParseResult& rRes )
+static bool lcl_isValidQuotedText( const OUString& rFormula, xub_StrLen nSrcPos, ParseResult& rRes )
{
// Tokens that start at ' can have anything in them until a final '
// but '' marks an escaped '
// We've earlier guaranteed that a string containing '' will be
// surrounded by '
- if (rFormula.GetChar(nSrcPos) == '\'')
+ if (rFormula[nSrcPos] == '\'')
{
xub_StrLen nPos = nSrcPos+1;
- while (nPos < rFormula.Len())
+ while (nPos < rFormula.getLength())
{
- if (rFormula.GetChar(nPos) == '\'')
+ if (rFormula[nPos] == '\'')
{
- if ( (nPos+1 == rFormula.Len()) || (rFormula.GetChar(nPos+1) != '\'') )
+ if ( (nPos+1 == rFormula.getLength()) || (rFormula[nPos+1] != '\'') )
{
rRes.TokenType = KParseType::SINGLE_QUOTE_NAME;
rRes.EndPos = nPos+1;
@@ -439,28 +439,28 @@ static bool lcl_isValidQuotedText( const String& rFormula, xub_StrLen nSrcPos, P
}
static bool lcl_parseExternalName(
- const String& rSymbol,
- String& rFile,
- String& rName,
+ const OUString& rSymbol,
+ OUString& rFile,
+ OUString& rName,
const sal_Unicode cSep,
const ScDocument* pDoc = NULL,
const uno::Sequence< const sheet::ExternalLinkInfo > * pExternalLinks = NULL )
{
/* 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;
+ OUString aTmpFile, aTmpName;
+ sal_Int32 i = 0;
bool bInName = false;
if (cSep == '!')
{
// For XL use existing parser that resolves bracketed and quoted and
// indexed external document names.
ScRange aRange;
- String aStartTabName, aEndTabName;
+ OUString aStartTabName, aEndTabName;
sal_uInt16 nFlags = 0;
p = aRange.Parse_XL_Header( p, pDoc, aTmpFile, aStartTabName,
aEndTabName, nFlags, true, pExternalLinks );
@@ -483,7 +483,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 == '\'')
@@ -498,7 +498,7 @@ static bool lcl_parseExternalName(
{
// two consecutive quotes equal a single quote in
// the file name.
- aTmpFile.Append(c);
+ aTmpFile += OUString(c);
cPrev = 'a';
}
else
@@ -516,10 +516,10 @@ static bool lcl_parseExternalName(
i = j;
bInName = true;
- aTmpName.Append(c); // Keep the separator as part of the name.
+ aTmpName += OUString(c); // Keep the separator as part of the name.
break;
}
- aTmpFile.Append(c);
+ aTmpFile += OUString(c);
cPrev = c;
}
@@ -547,14 +547,14 @@ static bool lcl_parseExternalName(
// A second separator ? Not a valid external name.
return false;
}
- aTmpName.Append(c);
+ aTmpName += OUString(c);
}
else
{
if (c == cSep)
{
bInName = true;
- aTmpName.Append(c); // Keep the separator as part of the name.
+ aTmpName += OUString(c); // Keep the separator as part of the name.
}
else
{
@@ -584,7 +584,7 @@ static bool lcl_parseExternalName(
return false;
}
while (false);
- aTmpFile.Append(c);
+ aTmpFile += OUString(c);
}
}
cPrev = c;
@@ -596,29 +596,28 @@ static bool lcl_parseExternalName(
return false;
}
- xub_StrLen nNameLen = aTmpName.Len();
+ xub_StrLen nNameLen = aTmpName.getLength();
if (nNameLen < 2)
{
// Name must be at least 2-char long (separator plus name).
return false;
}
- if (aTmpName.GetChar(0) != cSep)
+ if (aTmpName[0] != cSep)
{
// 1st char of the name must equal the separator.
return false;
}
- sal_Unicode cLast = aTmpName.GetChar(nNameLen-1);
- if (cLast == sal_Unicode('!'))
+ if (aTmpName[nNameLen-1] == '!')
{
// Check against #REF!.
- if (aTmpName.EqualsAscii("#REF!"))
+ if (aTmpName.equalsAscii("#REF!"))
return false;
}
rFile = aTmpFile;
- rName = aTmpName.Copy(1); // Skip the first char as it is always the separator.
+ rName = aTmpName.copy(1); // Skip the first char as it is always the separator.
return true;
}
@@ -678,8 +677,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;
@@ -690,7 +689,7 @@ struct Convention_A1 : public ScCompiler::Convention
KParseTokens::ASC_UNDERSCORE | KParseTokens::ASC_DOLLAR;
static const sal_Int32 nContFlags = nStartFlags | KParseTokens::ASC_DOT;
// '?' allowed in range names because of Xcl :-/
- static const String aAddAllowed(OUString("?#"));
+ static const OUString aAddAllowed("?#");
return pCharClass->parseAnyToken( rFormula,
nSrcPos, nStartFlags, aAddAllowed, nContFlags, aAddAllowed );
}
@@ -721,9 +720,9 @@ struct ConventionOOO_A1 : public Convention_A1
{
ConventionOOO_A1() : Convention_A1 (FormulaGrammar::CONV_OOO) { }
ConventionOOO_A1( FormulaGrammar::AddressConvention eConv ) : Convention_A1 (eConv) { }
- static String MakeTabStr( const ScCompiler& rComp, SCTAB nTab, String& aDoc )
+ static OUString MakeTabStr( const ScCompiler& rComp, SCTAB nTab, OUString& aDoc )
{
- String aString;
+ OUString aString;
OUString aTmp;
if (!rComp.GetDoc()->GetName( nTab, aTmp ))
aString = ScGlobal::GetRscString(STR_NO_REF_TABLE);
@@ -734,16 +733,16 @@ struct ConventionOOO_A1 : public Convention_A1
xub_StrLen nPos = ScCompiler::GetDocTabPos( aString );
if ( nPos != STRING_NOTFOUND )
{
- aDoc = aString.Copy( 0, nPos + 1 );
- aString.Erase( 0, nPos + 1 );
+ aDoc = aString.copy( 0, nPos + 1 );
+ aString = aString.copy( nPos + 1 );
aDoc = INetURLObject::decode( aDoc, INET_HEX_ESCAPE,
INetURLObject::DECODE_UNAMBIGUOUS );
}
else
- aDoc.Erase();
+ aDoc = "";
ScCompiler::CheckTabQuotes( aString, FormulaGrammar::CONV_OOO );
}
- aString += '.';
+ aString += ".";
return aString;
}
@@ -763,8 +762,8 @@ struct ConventionOOO_A1 : public Convention_A1
}
else
{
- String aDoc;
- String aRefStr(MakeTabStr(rComp, rAbsRef.Tab(), aDoc));
+ OUString aDoc;
+ OUString aRefStr(MakeTabStr(rComp, rAbsRef.Tab(), aDoc));
rBuffer.append(aDoc);
if (!rRef.IsTabRel())
rBuffer.append(sal_Unicode('$'));
@@ -843,7 +842,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, OUString& rFile, OUString& rName,
const ScDocument* pDoc,
const ::com::sun::star::uno::Sequence<
const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks ) const
@@ -851,14 +850,14 @@ struct ConventionOOO_A1 : public Convention_A1
return lcl_parseExternalName(rSymbol, rFile, rName, sal_Unicode('#'), pDoc, pExternalLinks);
}
- virtual String makeExternalNameStr( const String& rFile, const String& rName ) const
+ virtual OUString makeExternalNameStr( const OUString& rFile, const OUString& rName ) const
{
return lcl_makeExternalNameStr( rFile, rName, sal_Unicode('#'), false);
}
bool makeExternalSingleRefStr(
OUStringBuffer& rBuffer, sal_uInt16 nFileId,
- const String& rTabName, const ScSingleRefData& rRef, const ScAddress& rPos,
+ const OUString& rTabName, const ScSingleRefData& rRef, const ScAddress& rPos,
ScExternalRefManager* pRefMgr, bool bDisplayTabName, bool bEncodeUrl ) const
{
ScAddress aAbsRef = rRef.toAbs(rPos);
@@ -894,7 +893,7 @@ struct ConventionOOO_A1 : public Convention_A1
}
void makeExternalRefStrImpl( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
- sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef,
+ sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef,
ScExternalRefManager* pRefMgr, bool bODF ) const
{
if (bODF)
@@ -921,14 +920,14 @@ struct ConventionOOO_A1 : public Convention_A1
}
virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
- sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef,
+ sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef,
ScExternalRefManager* pRefMgr ) const
{
makeExternalRefStrImpl( rBuffer, rCompiler, nFileId, rTabName, rRef, pRefMgr, false);
}
void makeExternalRefStrImpl( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
- sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef,
+ sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef,
ScExternalRefManager* pRefMgr, bool bODF ) const
{
ScRange aAbsRange = rRef.toAbs(rCompiler.GetPos());
@@ -987,7 +986,7 @@ struct ConventionOOO_A1 : public Convention_A1
}
virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
- sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef,
+ sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef,
ScExternalRefManager* pRefMgr ) const
{
makeExternalRefStrImpl( rBuffer, rCompiler, nFileId, rTabName, rRef, pRefMgr, false);
@@ -1008,20 +1007,20 @@ struct ConventionOOO_A1_ODF : public ConventionOOO_A1
MakeRefStrImpl( rBuffer, rComp, rRef, bSingleRef, true);
}
- virtual String makeExternalNameStr( const String& rFile, const String& rName ) const
+ virtual OUString makeExternalNameStr( const OUString& rFile, const OUString& rName ) const
{
return lcl_makeExternalNameStr( rFile, rName, sal_Unicode('#'), true);
}
virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
- sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef,
+ sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef,
ScExternalRefManager* pRefMgr ) const
{
makeExternalRefStrImpl( rBuffer, rCompiler, nFileId, rTabName, rRef, pRefMgr, true);
}
virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
- sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef,
+ sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef,
ScExternalRefManager* pRefMgr ) const
{
makeExternalRefStrImpl( rBuffer, rCompiler, nFileId, rTabName, rRef, pRefMgr, true);
@@ -1035,12 +1034,12 @@ struct ConventionXL
{
static bool GetDocAndTab( const ScCompiler& rComp,
const ScSingleRefData& rRef,
- String& rDocName,
- String& rTabName )
+ OUString& rDocName,
+ OUString& rTabName )
{
bool bHasDoc = false;
- rDocName.Erase();
+ rDocName = "";
OUString aTmp;
ScAddress aAbs = rRef.toAbs(rComp.GetPos());
if (rRef.IsTabDeleted() || !rComp.GetDoc()->GetName(aAbs.Tab(), aTmp))
@@ -1054,11 +1053,11 @@ struct ConventionXL
xub_StrLen nPos = ScCompiler::GetDocTabPos( rTabName);
if (nPos != STRING_NOTFOUND)
{
- rDocName = rTabName.Copy( 0, nPos );
+ rDocName = rTabName.copy( 0, nPos );
// TODO : More research into how XL escapes the doc path
rDocName = INetURLObject::decode( rDocName, INET_HEX_ESCAPE,
INetURLObject::DECODE_UNAMBIGUOUS );
- rTabName.Erase( 0, nPos + 1 );
+ rTabName = rTabName.copy( nPos + 1 );
bHasDoc = true;
}
@@ -1075,7 +1074,7 @@ struct ConventionXL
{
if( rRef.Ref1.IsFlag3D() )
{
- String aStartTabName, aStartDocName, aEndTabName, aEndDocName;
+ OUString aStartTabName, aStartDocName, aEndTabName, aEndDocName;
bool bStartHasDoc = false, bEndHasDoc = false;
bStartHasDoc = GetDocAndTab( rComp, rRef.Ref1,
@@ -1123,7 +1122,7 @@ struct ConventionXL
return sal_Unicode(0);
}
- static bool parseExternalName( const String& rSymbol, String& rFile, String& rName,
+ static bool parseExternalName( const OUString& rSymbol, OUString& rFile, OUString& rName,
const ScDocument* pDoc,
const ::com::sun::star::uno::Sequence<
const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks )
@@ -1131,12 +1130,12 @@ struct ConventionXL
return lcl_parseExternalName( rSymbol, rFile, rName, sal_Unicode('!'), pDoc, pExternalLinks);
}
- static String makeExternalNameStr( const String& rFile, const String& rName )
+ static OUString makeExternalNameStr( const OUString& rFile, const OUString& rName )
{
return lcl_makeExternalNameStr( rFile, rName, sal_Unicode('!'), false);
}
- static void makeExternalDocStr( OUStringBuffer& rBuffer, const String& rFullName, bool bEncodeUrl )
+ static void makeExternalDocStr( OUStringBuffer& rBuffer, const OUString& rFullName, bool bEncodeUrl )
{
// Format that is easier to deal with inside OOo, because we use file
// URL, and all characetrs are allowed. Check if it makes sense to do
@@ -1147,15 +1146,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('\''))
@@ -1185,12 +1184,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)
@@ -1315,8 +1314,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;
@@ -1337,7 +1336,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, OUString& rFile, OUString& rName,
const ScDocument* pDoc,
const ::com::sun::star::uno::Sequence<
const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks ) const
@@ -1345,13 +1344,13 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
return ConventionXL::parseExternalName( rSymbol, rFile, rName, pDoc, pExternalLinks);
}
- virtual String makeExternalNameStr( const String& rFile, const String& rName ) const
+ virtual OUString makeExternalNameStr( const OUString& rFile, const OUString& rName ) const
{
return ConventionXL::makeExternalNameStr(rFile, rName);
}
virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
- sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef,
+ sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef,
ScExternalRefManager* pRefMgr ) const
{
// ['file:///path/to/file/filename.xls']'Sheet Name'!$A$1
@@ -1373,7 +1372,7 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
}
virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
- sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef,
+ sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef,
ScExternalRefManager* pRefMgr ) const
{
const OUString* pFullName = pRefMgr->getExternalFileName(nFileId);
@@ -1505,8 +1504,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);
@@ -1530,7 +1529,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, OUString& rFile, OUString& rName,
const ScDocument* pDoc,
const ::com::sun::star::uno::Sequence<
const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks ) const
@@ -1538,13 +1537,13 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
return ConventionXL::parseExternalName( rSymbol, rFile, rName, pDoc, pExternalLinks);
}
- virtual String makeExternalNameStr( const String& rFile, const String& rName ) const
+ virtual OUString makeExternalNameStr( const OUString& rFile, const OUString& rName ) const
{
return ConventionXL::makeExternalNameStr(rFile, rName);
}
virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
- sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef,
+ sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef,
ScExternalRefManager* pRefMgr ) const
{
// ['file:///path/to/file/filename.xls']'Sheet Name'!$A$1
@@ -1569,7 +1568,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
}
virtual void makeExternalRefStr( OUStringBuffer& rBuffer, const ScCompiler& rCompiler,
- sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef,
+ sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef,
ScExternalRefManager* pRefMgr ) const
{
const OUString* pFullName = pRefMgr->getExternalFileName(nFileId);
@@ -1668,7 +1667,7 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos)
nMaxTab = pDoc ? pDoc->GetTableCount() - 1 : 0;
}
-void ScCompiler::CheckTabQuotes( String& rString,
+void ScCompiler::CheckTabQuotes( OUString& rString,
const FormulaGrammar::AddressConvention eConv )
{
using namespace ::com::sun::star::i18n;
@@ -1676,7 +1675,7 @@ void ScCompiler::CheckTabQuotes( String& rString,
sal_Int32 nContFlags = nStartFlags;
ParseResult aRes = ScGlobal::pCharClass->parsePredefinedToken(
KParseType::IDENTNAME, rString, 0, nStartFlags, EMPTY_STRING, nContFlags, EMPTY_STRING);
- bool bNeedsQuote = !((aRes.TokenType & KParseType::IDENTNAME) && aRes.EndPos == rString.Len());
+ bool bNeedsQuote = !((aRes.TokenType & KParseType::IDENTNAME) && aRes.EndPos == rString.getLength());
switch ( eConv )
{
@@ -1692,7 +1691,7 @@ void ScCompiler::CheckTabQuotes( String& rString,
const OUString one_quote(static_cast<sal_Unicode>('\''));
const OUString two_quote("''");
// escape embedded quotes
- rString.SearchAndReplaceAll( one_quote, two_quote );
+ rString = rString.replaceAll( one_quote, two_quote );
}
break;
}
@@ -1705,18 +1704,17 @@ void ScCompiler::CheckTabQuotes( String& rString,
if( bNeedsQuote )
{
- rString.Insert( '\'', 0 );
- rString += '\'';
+ rString = "'" + rString + "'";
}
}
-xub_StrLen ScCompiler::GetDocTabPos( const String& rString )
+xub_StrLen ScCompiler::GetDocTabPos( const OUString& rString )
{
- if (rString.GetChar(0) != '\'')
+ if (rString[0] != '\'')
return STRING_NOTFOUND;
xub_StrLen nPos = ScGlobal::FindUnquoted( rString, SC_COMPILER_FILE_TAB_SEP);
// it must be 'Doc'#
- if (nPos != STRING_NOTFOUND && rString.GetChar(nPos-1) != '\'')
+ if (nPos != STRING_NOTFOUND && rString[nPos-1] != '\'')
nPos = STRING_NOTFOUND;
return nPos;
}
@@ -1799,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;
@@ -2313,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
@@ -2322,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 );
@@ -2331,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)
@@ -2346,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])
@@ -2384,7 +2382,7 @@ Label_MaskStateMachine:
// Convert symbol to token
-bool ScCompiler::IsOpCode( const String& rName, bool bInArray )
+bool ScCompiler::IsOpCode( const OUString& rName, bool bInArray )
{
OpCodeHashMap::const_iterator iLook( mxSymbols->getHashMap()->find( rName));
bool bFound = (iLook != mxSymbols->getHashMap()->end());
@@ -2394,9 +2392,9 @@ bool ScCompiler::IsOpCode( const String& rName, bool bInArray )
OpCode eOp = iLook->second;
if (bInArray)
{
- if (rName.Equals(mxSymbols->getSymbol(ocArrayColSep)))
+ if (rName.equals(mxSymbols->getSymbol(ocArrayColSep)))
eOp = ocArrayColSep;
- else if (rName.Equals(mxSymbols->getSymbol(ocArrayRowSep)))
+ else if (rName.equals(mxSymbols->getSymbol(ocArrayRowSep)))
eOp = ocArrayRowSep;
}
aToken.SetOpCode(eOp);
@@ -2426,7 +2424,7 @@ bool ScCompiler::IsOpCode( const String& rName, bool bInArray )
static const size_t nOdffAliases = sizeof(aOdffAliases) / sizeof(aOdffAliases[0]);
for (size_t i=0; i<nOdffAliases; ++i)
{
- if (rName.EqualsIgnoreCaseAscii( aOdffAliases[i].pName))
+ if (rName.equalsIgnoreAsciiCaseAscii( aOdffAliases[i].pName))
{
ScRawToken aToken;
aToken.SetOpCode( aOdffAliases[i].eOp);
@@ -2438,7 +2436,7 @@ bool ScCompiler::IsOpCode( const String& rName, bool bInArray )
}
if (!bFound)
{
- String aIntName;
+ OUString aIntName;
if (mxSymbols->hasExternals())
{
// If symbols are set by filters get mapping to exact name.
@@ -2449,7 +2447,7 @@ bool ScCompiler::IsOpCode( const String& 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
@@ -2458,7 +2456,7 @@ bool ScCompiler::IsOpCode( const String& rName, bool bInArray )
return false;
}
}
- if (!aIntName.Len())
+ if (aIntName.isEmpty())
{
// Old (deprecated) addins first for legacy.
if (ScGlobal::GetFuncCollection()->findByName(cSymbol))
@@ -2473,10 +2471,10 @@ bool ScCompiler::IsOpCode( const String& 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;
}
@@ -2498,13 +2496,13 @@ bool ScCompiler::IsOpCode( const String& rName, bool bInArray )
return bFound;
}
-bool ScCompiler::IsOpCode2( const String& rName )
+bool ScCompiler::IsOpCode2( const OUString& rName )
{
bool bFound = false;
sal_uInt16 i;
for( i = ocInternalBegin; i <= ocInternalEnd && !bFound; i++ )
- bFound = rName.EqualsAscii( pInternal[ i-ocInternalBegin ] );
+ bFound = rName.equalsAscii( pInternal[ i-ocInternalBegin ] );
if (bFound)
{
@@ -2515,7 +2513,7 @@ bool ScCompiler::IsOpCode2( const String& rName )
return bFound;
}
-bool ScCompiler::IsValue( const String& rSym )
+bool ScCompiler::IsValue( const OUString& rSym )
{
double fVal;
sal_uInt32 nIndex = ( mxSymbols->isEnglish() ?
@@ -2535,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 == '(')
@@ -2579,11 +2577,11 @@ bool ScCompiler::IsString()
return false;
}
-bool ScCompiler::IsPredetectedReference( const String& rName )
+bool ScCompiler::IsPredetectedReference( const OUString& rName )
{
// Speedup documents with lots of broken references, e.g. sheet deleted.
- xub_StrLen nPos = rName.SearchAscii( "#REF!");
- if (nPos != STRING_NOTFOUND)
+ sal_Int32 nPos = rName.indexOf( "#REF!");
+ if (nPos != -1)
{
/* TODO: this may be enhanced by reusing scan information from
* NextSymbol(), the positions of quotes and special characters found
@@ -2596,18 +2594,18 @@ bool ScCompiler::IsPredetectedReference( const String& rName )
{
// Per ODFF the correct string for a reference error is just #REF!,
// so pass it on.
- if (rName.Len() == 5)
+ if (rName.getLength() == 5)
return IsErrorConstant( rName);
return false; // #REF!.AB42 or #REF!42 or #REF!#REF!
}
- sal_Unicode c = rName.GetChar(nPos-1); // before #REF!
+ sal_Unicode c = rName[nPos-1]; // before #REF!
if ('$' == c)
{
if (nPos == 1)
return false; // $#REF!.AB42 or $#REF!42 or $#REF!#REF!
- c = rName.GetChar(nPos-2); // before $#REF!
+ c = rName[nPos-2]; // before $#REF!
}
- sal_Unicode c2 = rName.GetChar(nPos+5); // after #REF!
+ sal_Unicode c2 = rName[nPos+5]; // after #REF!
switch (c)
{
case '.':
@@ -2636,7 +2634,7 @@ bool ScCompiler::IsPredetectedReference( const String& rName )
return false;
}
-bool ScCompiler::IsDoubleReference( const String& rName )
+bool ScCompiler::IsDoubleReference( const OUString& rName )
{
ScRange aRange( aPos, aPos );
const ScAddress::Details aDetails( pConv->meConv, aPos );
@@ -2678,7 +2676,7 @@ bool ScCompiler::IsDoubleReference( const String& rName )
return ( nFlags & SCA_VALID ) != 0;
}
-bool ScCompiler::IsSingleReference( const String& rName )
+bool ScCompiler::IsSingleReference( const OUString& rName )
{
ScAddress aAddr( aPos );
const ScAddress::Details aDetails( pConv->meConv, aPos );
@@ -2724,10 +2722,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 )
@@ -2748,7 +2746,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;
@@ -2765,7 +2763,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 ) );
+ OUString aTabName( rName.copy( 0, nPos ) );
SCTAB nTab;
if ( !pDoc->GetTable( aTabName, nTab ) )
return false;
@@ -2791,7 +2789,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
@@ -2806,7 +2804,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:
@@ -2816,14 +2814,14 @@ bool ScCompiler::IsReference( const String& rName )
return false;
}
-bool ScCompiler::IsMacro( const String& rName )
+bool ScCompiler::IsMacro( const OUString& rName )
{
#ifdef DISABLE_SCRIPTING
(void) rName;
return false;
#else
- String aName( rName);
+ OUString aName( rName);
StarBASIC* pObj = 0;
SfxObjectShell* pDocSh = pDoc->GetDocumentShell();
@@ -2838,8 +2836,8 @@ bool ScCompiler::IsMacro( const String& rName )
// use only unprefixed name if encountered. BASIC doesn't allow '.' in a
// function name so a function "USER.FOO" could not exist, and macro check
// is assigned the lowest priority in function name check.
- if (FormulaGrammar::isODFF( GetGrammar()) && aName.EqualsIgnoreCaseAscii( "USER.", 0, 5))
- aName.Erase( 0, 5);
+ if (FormulaGrammar::isODFF( GetGrammar()) && aName.startsWithIgnoreAsciiCase( "USER."))
+ aName = aName.copy(5);
SbxMethod* pMeth = (SbxMethod*) pObj->Find( aName, SbxCLASS_METHOD );
if( !pMeth )
@@ -2854,14 +2852,14 @@ bool ScCompiler::IsMacro( const String& rName )
return false;
}
ScRawToken aToken;
- aToken.SetExternal( aName.GetBuffer() );
+ aToken.SetExternal( aName.getStr() );
aToken.eOp = ocMacro;
pRawToken = aToken.Clone();
return true;
#endif
}
-bool ScCompiler::IsNamedRange( const String& rUpperName )
+bool ScCompiler::IsNamedRange( const OUString& rUpperName )
{
// IsNamedRange is called only from NextNewToken, with an upper-case string
@@ -2891,7 +2889,7 @@ bool ScCompiler::IsNamedRange( const String& rUpperName )
return false;
}
-bool ScCompiler::IsExternalNamedRange( const String& rSymbol )
+bool ScCompiler::IsExternalNamedRange( const OUString& rSymbol )
{
/* FIXME: This code currently (2008-12-02T15:41+0100 in CWS mooxlsc)
* correctly parses external named references in OOo, as required per RFE
@@ -2902,12 +2900,12 @@ bool ScCompiler::IsExternalNamedRange( const String& rSymbol )
if (!pConv)
return false;
- String aFile, aName;
+ OUString aFile, aName;
if (!pConv->parseExternalName( rSymbol, aFile, aName, pDoc, &maExternalLinks))
return false;
ScRawToken aToken;
- if (aFile.Len() > MAXSTRLEN || aName.Len() > MAXSTRLEN)
+ if (aFile.getLength() > MAXSTRLEN || aName.getLength() > MAXSTRLEN)
return false;
ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
@@ -2926,9 +2924,9 @@ bool ScCompiler::IsExternalNamedRange( const String& rSymbol )
return true;
}
-bool ScCompiler::IsDBRange( const String& rName )
+bool ScCompiler::IsDBRange( const OUString& rName )
{
- if (rName.EqualsAscii("[]"))
+ if (rName.equalsAscii("[]"))
{
if (pRawToken && pRawToken->GetOpCode() == ocDBArea)
{
@@ -2952,7 +2950,7 @@ bool ScCompiler::IsDBRange( const String& rName )
return true;
}
-bool ScCompiler::IsColRowName( const String& rName )
+bool ScCompiler::IsColRowName( const OUString& rName )
{
bool bInList = false;
bool bFound = false;
@@ -3204,7 +3202,7 @@ bool ScCompiler::IsColRowName( const String& rName )
return false;
}
-bool ScCompiler::IsBoolean( const String& rName )
+bool ScCompiler::IsBoolean( const OUString& rName )
{
OpCodeHashMap::const_iterator iLook( mxSymbols->getHashMap()->find( rName ) );
if( iLook != mxSymbols->getHashMap()->end() &&
@@ -3220,7 +3218,7 @@ bool ScCompiler::IsBoolean( const String& rName )
return false;
}
-bool ScCompiler::IsErrorConstant( const String& rName ) const
+bool ScCompiler::IsErrorConstant( const OUString& rName ) const
{
sal_uInt16 nError = GetErrorConstant( rName);
if (nError)
@@ -3289,14 +3287,14 @@ void ScCompiler::AutoCorrectParsedSymbol()
}
else
{
- String aSymbol( aCorrectedSymbol );
- String aDoc;
- xub_StrLen nPosition;
- if ( aSymbol.GetChar(0) == '\''
- && ((nPosition = aSymbol.SearchAscii( "'#" )) != STRING_NOTFOUND) )
+ OUString aSymbol( aCorrectedSymbol );
+ OUString aDoc;
+ sal_Int32 nPosition;
+ if ( aSymbol[0] == '\''
+ && ((nPosition = aSymbol.indexOf( "'#" )) != -1) )
{ // Split off 'Doc'#, may be d:\... or whatever
- aDoc = aSymbol.Copy( 0, nPosition + 2 );
- aSymbol.Erase( 0, nPosition + 2 );
+ aDoc = aSymbol.copy( 0, nPosition + 2 );
+ aSymbol = aSymbol.copy(nPosition + 2 );
}
xub_StrLen nRefs = comphelper::string::getTokenCount(aSymbol, ':');
bool bColons;
@@ -3304,17 +3302,17 @@ void ScCompiler::AutoCorrectParsedSymbol()
{ // duplicated or too many ':'? B:2::C10 => B2:C10
bColons = true;
sal_Int32 nIndex = 0;
- String aTmp1( aSymbol.GetToken( 0, ':', nIndex ) );
- xub_StrLen nLen1 = aTmp1.Len();
- String aSym, aTmp2;
+ OUString aTmp1( aSymbol.getToken( 0, ':', nIndex ) );
+ xub_StrLen nLen1 = aTmp1.getLength();
+ OUString aSym, aTmp2;
bool bLastAlp, bNextNum;
bLastAlp = bNextNum = true;
xub_StrLen nStrip = 0;
xub_StrLen nCount = nRefs;
for ( xub_StrLen j=1; j<nCount; j++ )
{
- aTmp2 = aSymbol.GetToken( 0, ':', nIndex );
- xub_StrLen nLen2 = aTmp2.Len();
+ aTmp2 = aSymbol.getToken( 0, ':', nIndex );
+ xub_StrLen nLen2 = aTmp2.getLength();
if ( nLen1 || nLen2 )
{
if ( nLen1 )
@@ -3334,10 +3332,10 @@ void ScCompiler::AutoCorrectParsedSymbol()
}
else
{
- xub_StrLen nSymLen = aSym.Len();
+ xub_StrLen nSymLen = aSym.getLength();
if ( nSymLen
- && (aSym.GetChar( nSymLen - 1 ) != ':') )
- aSym += ':';
+ && (aSym[ nSymLen - 1 ] != ':') )
+ aSym += ":";
nStrip = 0;
}
bLastAlp = !bNextNum;
@@ -3365,12 +3363,12 @@ 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 )
{
- aRef[0] = aSymbol.GetToken( 0, ':' );
- aRef[1] = aSymbol.GetToken( 1, ':' );
+ aRef[0] = aSymbol.getToken( 0, ':' );
+ aRef[1] = aSymbol.getToken( 1, ':' );
}
else
aRef[0] = aSymbol;
@@ -3380,20 +3378,20 @@ 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();
+ OUString aOld( aRef[j] );
+ OUString aStr2;
+ const sal_Unicode* p = aRef[j].getStr();
while ( *p && CharClass::isAsciiNumeric( OUString(*p) ) )
- aStr2 += *p++;
+ aStr2 += OUString(*p++);
aRef[j] = OUString( p );
aRef[j] += aStr2;
if ( bColons || aRef[j] != aOld )
@@ -3421,7 +3419,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 ))
{
@@ -3487,7 +3485,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;
}
@@ -3511,7 +3509,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 == '(' );
@@ -3520,7 +3518,7 @@ bool ScCompiler::NextNewToken( bool bInArray )
// Italian ARCTAN.2 resulted in #REF! => IsOpcode() before
// IsReference().
- String aUpper;
+ OUString aUpper;
do
{
@@ -3541,7 +3539,7 @@ bool ScCompiler::NextNewToken( bool bInArray )
return true;
}
- aUpper.Erase();
+ aUpper = "";
bool bAsciiUpper = false;
if (bMayBeFuncName)
{
@@ -3568,7 +3566,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
@@ -3674,14 +3672,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++;
@@ -4087,10 +4085,10 @@ void ScCompiler::MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc, const ScAddr
}
bool ScCompiler::IsCharFlagAllConventions(
- String const & rStr, xub_StrLen nPos, sal_uLong nFlags, bool bTestLetterNumeric )
+ OUString const & rStr, xub_StrLen nPos, sal_uLong nFlags, bool bTestLetterNumeric )
{
- sal_Unicode c = rStr.GetChar( nPos );
- sal_Unicode cLast = nPos > 0 ? rStr.GetChar( nPos-1 ) : 0;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list