[Libreoffice-commits] core.git: Branch 'private/kohei/calc-shared-string' - 2 commits - formula/source include/formula include/svl sc/inc sc/source svl/source
Kohei Yoshida
kohei.yoshida at collabora.com
Thu Oct 10 20:10:15 PDT 2013
formula/source/core/api/FormulaCompiler.cxx | 4
formula/source/core/api/token.cxx | 47 +++
include/formula/token.hxx | 35 +-
include/svl/sharedstring.hxx | 3
sc/inc/compiler.hxx | 6
sc/inc/formulacell.hxx | 6
sc/inc/formularesult.hxx | 4
sc/inc/simpleformulacalc.hxx | 2
sc/inc/token.hxx | 53 ++--
sc/source/core/data/autonamecache.cxx | 2
sc/source/core/data/cellvalue.cxx | 2
sc/source/core/data/column.cxx | 16 -
sc/source/core/data/column2.cxx | 8
sc/source/core/data/column3.cxx | 11
sc/source/core/data/conditio.cxx | 14 -
sc/source/core/data/dociter.cxx | 2
sc/source/core/data/documen4.cxx | 4
sc/source/core/data/document.cxx | 2
sc/source/core/data/formulacell.cxx | 11
sc/source/core/data/simpleformulacalc.cxx | 4
sc/source/core/data/validat.cxx | 41 +--
sc/source/core/inc/interpre.hxx | 16 -
sc/source/core/tool/cellform.cxx | 10
sc/source/core/tool/compiler.cxx | 28 +-
sc/source/core/tool/formularesult.cxx | 14 -
sc/source/core/tool/interpr1.cxx | 205 ++++++++---------
sc/source/core/tool/interpr2.cxx | 46 +--
sc/source/core/tool/interpr4.cxx | 133 ++++++-----
sc/source/core/tool/interpr5.cxx | 20 -
sc/source/core/tool/interpr6.cxx | 4
sc/source/core/tool/interpr7.cxx | 6
sc/source/core/tool/reftokenhelper.cxx | 4
sc/source/core/tool/token.cxx | 64 ++---
sc/source/filter/dif/difexp.cxx | 2
sc/source/filter/excel/xechart.cxx | 3
sc/source/filter/excel/xecontent.cxx | 2
sc/source/filter/excel/xeformula.cxx | 27 +-
sc/source/filter/excel/xelink.cxx | 10
sc/source/filter/excel/xestream.cxx | 4
sc/source/filter/excel/xetable.cxx | 4
sc/source/filter/excel/xlformula.cxx | 2
sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx | 2
sc/source/filter/xml/xmlexprt.cxx | 4
sc/source/ui/app/inputhdl.cxx | 2
sc/source/ui/app/transobj.cxx | 2
sc/source/ui/docshell/docsh.cxx | 2
sc/source/ui/docshell/externalrefmgr.cxx | 15 -
sc/source/ui/formdlg/formula.cxx | 2
sc/source/ui/unoobj/chart2uno.cxx | 18 -
sc/source/ui/unoobj/funcuno.cxx | 2
sc/source/ui/unoobj/linkuno.cxx | 2
sc/source/ui/unoobj/tokenuno.cxx | 10
sc/source/ui/view/viewfun6.cxx | 4
svl/source/misc/sharedstring.cxx | 9
54 files changed, 512 insertions(+), 443 deletions(-)
New commits:
commit 27fe192912d53ed3016a6a8610dbe92242cb4a5b
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Oct 10 23:08:08 2013 -0400
Fix VLOOKUP calculation when the matching value is literal string.
ScRawToken needed to store a shared string value rather than the normal
unicode string array. This fixes a previously failed unit test.
Change-Id: I87164c018ace0761c40d1493f44fe25909a4499c
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 0ecb2a5..28e4efe 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -138,6 +138,10 @@ public:
bool bGlobal;
sal_uInt16 nIndex;
} name;
+ struct {
+ rtl_uString* mpData;
+ rtl_uString* mpDataIgnoreCase;
+ } sharedstring;
ScMatrix* pMat;
sal_uInt16 nError;
sal_Unicode cStr[ MAXSTRLEN+1 ]; // string (up to 255 characters + 0)
@@ -161,7 +165,7 @@ public:
// Use these methods only on tokens that are not part of a token array,
// since the reference count is cleared!
void SetOpCode( OpCode eCode );
- void SetString( const sal_Unicode* pStr );
+ void SetString( rtl_uString* pData, rtl_uString* pDataIgoreCase );
void SetSingleReference( const ScSingleRefData& rRef );
void SetDoubleReference( const ScComplexRefData& rRef );
void SetDouble( double fVal );
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 128cf18..2ba6ffc 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -17,11 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "compiler.hxx"
+
#include <sfx2/app.hxx>
#include <sfx2/objsh.hxx>
#include <basic/sbmeth.hxx>
#include <basic/sbstar.hxx>
#include <svl/zforlist.hxx>
+#include "svl/sharedstringpool.hxx"
#include <sal/macros.h>
#include <tools/rcid.h>
#include <tools/solar.h>
@@ -41,7 +44,6 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
-#include "compiler.hxx"
#include "rangenam.hxx"
#include "dbdata.hxx"
#include "document.hxx"
@@ -2566,7 +2568,9 @@ bool ScCompiler::IsString()
{
cSymbol[nLen] = '\0';
ScRawToken aToken;
- aToken.SetString( cSymbol+1 );
+ const sal_Unicode* pStr = cSymbol+1;
+ svl::SharedString aSS = pDoc->GetSharedStringPool().intern(OUString(pStr));
+ aToken.SetString(aSS.getData(), aSS.getDataIgnoreCase());
pRawToken = aToken.Clone();
return true;
}
@@ -3464,7 +3468,8 @@ bool ScCompiler::NextNewToken( bool bInArray )
* information if not ODFF (in that case it was already handled).
* */
ScRawToken aToken;
- aToken.SetString( aStr.getStr() );
+ svl::SharedString aSS = pDoc->GetSharedStringPool().intern(aStr);
+ aToken.SetString(aSS.getData(), aSS.getDataIgnoreCase());
aToken.NewOpCode( ocBad );
pRawToken = aToken.Clone();
}
@@ -3607,7 +3612,8 @@ bool ScCompiler::NextNewToken( bool bInArray )
// the interpreter.
aUpper = ScGlobal::pCharClass->lowercase( aUpper );
ScRawToken aToken;
- aToken.SetString( aUpper.getStr() );
+ svl::SharedString aSS = pDoc->GetSharedStringPool().intern(aUpper);
+ aToken.SetString(aSS.getData(), aSS.getDataIgnoreCase());
aToken.NewOpCode( ocBad );
pRawToken = aToken.Clone();
if ( bAutoCorrect )
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index c5a7f8e..ab9e3a9 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -174,21 +174,14 @@ void ScRawToken::SetOpCode( OpCode e )
nRefCnt = 0;
}
-void ScRawToken::SetString( const sal_Unicode* pStr )
+void ScRawToken::SetString( rtl_uString* pData, rtl_uString* pDataIgoreCase )
{
eOp = ocPush;
eType = svString;
- if ( pStr )
- {
- xub_StrLen nLen = GetStrLen( pStr ) + 1;
- if( nLen > MAXSTRLEN )
- nLen = MAXSTRLEN;
- memcpy( cStr, pStr, GetStrLenBytes( nLen ) );
- cStr[ nLen-1 ] = 0;
- }
- else
- cStr[0] = 0;
nRefCnt = 0;
+
+ sharedstring.mpData = pData;
+ sharedstring.mpDataIgnoreCase = pDataIgoreCase;
}
void ScRawToken::SetSingleReference( const ScSingleRefData& rRef )
@@ -340,7 +333,7 @@ ScRawToken* ScRawToken::Clone() const
case svByte: n += sizeof(ScRawToken::sbyte); break;
case svDouble: n += sizeof(double); break;
case svError: n += sizeof(nError); break;
- case svString: n = sal::static_int_cast<sal_uInt16>( n + GetStrLenBytes( cStr ) + GetStrLenBytes( 1 ) ); break;
+ case svString: n += sizeof(sharedstring); break;
case svSingleRef:
case svDoubleRef: n += sizeof(aRef); break;
case svMatrix: n += sizeof(ScMatrix*); break;
@@ -381,10 +374,13 @@ FormulaToken* ScRawToken::CreateToken() const
IF_NOT_OPCODE_ERROR( ocPush, FormulaDoubleToken);
return new FormulaDoubleToken( nValue );
case svString :
+ {
+ svl::SharedString aSS(sharedstring.mpData, sharedstring.mpDataIgnoreCase);
if (eOp == ocPush)
- return new FormulaStringToken( OUString( cStr ) );
+ return new FormulaStringToken(aSS);
else
- return new FormulaStringOpToken( eOp, OUString( cStr ) );
+ return new FormulaStringOpToken(eOp, aSS);
+ }
case svSingleRef :
if (eOp == ocPush)
return new ScSingleRefToken( aRef.Ref1 );
commit 71c87093f60f58ed382a288788f012e5ef782a7d
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Oct 10 20:24:21 2013 -0400
Formula tokens, formula cells and formula interpreters to use shared strings.
Change-Id: I5da99869fc7f61ce698180fa5daa9be9db9ac132
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 5cd0b82..fda54bd 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1776,9 +1776,9 @@ FormulaToken* FormulaCompiler::CreateStringFromToken( OUStringBuffer& rBuffer, F
case svString:
if( eOp == ocBad || eOp == ocStringXML )
- rBuffer.append( t->GetString());
+ rBuffer.append( t->GetString().getString());
else
- AppendString( rBuffer, t->GetString() );
+ AppendString( rBuffer, t->GetString().getString() );
break;
case svSingleRef:
CreateStringFromSingleRef( rBuffer, t);
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index da9c6f8..8f0cfa8 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -174,11 +174,10 @@ double & FormulaToken::GetDoubleAsReference()
return fVal;
}
-const OUString& FormulaToken::GetString() const
+svl::SharedString FormulaToken::GetString() const
{
SAL_WARN( "formula.core", "FormulaToken::GetString: virtual dummy called" );
- static OUString aDummyString;
- return aDummyString;
+ return svl::SharedString(); // invalid string
}
sal_uInt16 FormulaToken::GetIndex() const
@@ -1323,18 +1322,45 @@ bool FormulaDoubleToken::operator==( const FormulaToken& r ) const
return FormulaToken::operator==( r ) && fDouble == r.GetDouble();
}
+FormulaStringToken::FormulaStringToken( const svl::SharedString& r ) :
+ FormulaToken( svString ), maString( r ) {}
+FormulaStringToken::FormulaStringToken( const FormulaStringToken& r ) :
+ FormulaToken( r ), maString( r.maString ) {}
+
+FormulaToken* FormulaStringToken::Clone() const
+{
+ return new FormulaStringToken(*this);
+}
+
+svl::SharedString FormulaStringToken::GetString() const
+{
+ return maString;
+}
-const OUString& FormulaStringToken::GetString() const { return aString; }
bool FormulaStringToken::operator==( const FormulaToken& r ) const
{
- return FormulaToken::operator==( r ) && aString == r.GetString();
+ return FormulaToken::operator==( r ) && maString == r.GetString();
}
+FormulaStringOpToken::FormulaStringOpToken( OpCode e, const svl::SharedString& r ) :
+ FormulaByteToken( e, 0, svString, false ), maString( r ) {}
+
+FormulaStringOpToken::FormulaStringOpToken( const FormulaStringOpToken& r ) :
+ FormulaByteToken( r ), maString( r.maString ) {}
+
+FormulaToken* FormulaStringOpToken::Clone() const
+{
+ return new FormulaStringOpToken(*this);
+}
+
+svl::SharedString FormulaStringOpToken::GetString() const
+{
+ return maString;
+}
-const OUString& FormulaStringOpToken::GetString() const { return aString; }
bool FormulaStringOpToken::operator==( const FormulaToken& r ) const
{
- return FormulaByteToken::operator==( r ) && aString == r.GetString();
+ return FormulaByteToken::operator==( r ) && maString == r.GetString();
}
sal_uInt16 FormulaIndexToken::GetIndex() const { return nIndex; }
@@ -1364,11 +1390,12 @@ bool FormulaErrorToken::operator==( const FormulaToken& r ) const
nError == static_cast< const FormulaErrorToken & >(r).GetError();
}
double FormulaMissingToken::GetDouble() const { return 0.0; }
-const OUString& FormulaMissingToken::GetString() const
+
+svl::SharedString FormulaMissingToken::GetString() const
{
- static OUString aDummyString;
- return aDummyString;
+ return svl::SharedString::getEmptyString();
}
+
bool FormulaMissingToken::operator==( const FormulaToken& r ) const
{
return FormulaToken::operator==( r );
diff --git a/include/formula/token.hxx b/include/formula/token.hxx
index d9486be..905be7b 100644
--- a/include/formula/token.hxx
+++ b/include/formula/token.hxx
@@ -28,6 +28,7 @@
#include "formula/IFunctionDescription.hxx"
#include "formula/formuladllapi.h"
#include "formula/types.hxx"
+#include "svl/sharedstring.hxx"
namespace formula
{
@@ -136,7 +137,7 @@ public:
virtual void SetForceArray( bool b );
virtual double GetDouble() const;
virtual double& GetDoubleAsReference();
- virtual const OUString& GetString() const;
+ virtual svl::SharedString GetString() const;
virtual sal_uInt16 GetIndex() const;
virtual void SetIndex( sal_uInt16 n );
virtual bool IsGlobal() const;
@@ -256,17 +257,14 @@ public:
class FORMULA_DLLPUBLIC FormulaStringToken : public FormulaToken
{
-private:
- OUString aString;
+ svl::SharedString maString;
public:
- FormulaStringToken( const OUString& r ) :
- FormulaToken( svString ), aString( r ) {}
- FormulaStringToken( const FormulaStringToken& r ) :
- FormulaToken( r ), aString( r.aString ) {}
+ FormulaStringToken( const svl::SharedString& r );
+ FormulaStringToken( const FormulaStringToken& r );
- virtual FormulaToken* Clone() const { return new FormulaStringToken(*this); }
- virtual const OUString& GetString() const;
- virtual bool operator==( const FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const;
+ virtual svl::SharedString GetString() const;
+ virtual bool operator==( const FormulaToken& rToken ) const;
DECL_FIXEDMEMPOOL_NEWDEL_DLL( FormulaStringToken )
};
@@ -276,17 +274,14 @@ public:
ocPush, and an optional sal_uInt8 for ocBad tokens. */
class FORMULA_DLLPUBLIC FormulaStringOpToken : public FormulaByteToken
{
-private:
- OUString aString;
+ svl::SharedString maString;
public:
- FormulaStringOpToken( OpCode e, const OUString& r ) :
- FormulaByteToken( e, 0, svString, false ), aString( r ) {}
- FormulaStringOpToken( const FormulaStringOpToken& r ) :
- FormulaByteToken( r ), aString( r.aString ) {}
+ FormulaStringOpToken( OpCode e, const svl::SharedString& r );
+ FormulaStringOpToken( const FormulaStringOpToken& r );
- virtual FormulaToken* Clone() const { return new FormulaStringOpToken(*this); }
- virtual const OUString& GetString() const;
- virtual bool operator==( const FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const;
+ virtual svl::SharedString GetString() const;
+ virtual bool operator==( const FormulaToken& rToken ) const;
};
class FORMULA_DLLPUBLIC FormulaIndexToken : public FormulaToken
@@ -343,7 +338,7 @@ public:
virtual FormulaToken* Clone() const { return new FormulaMissingToken(*this); }
virtual double GetDouble() const;
- virtual const OUString& GetString() const;
+ virtual svl::SharedString GetString() const;
virtual bool operator==( const FormulaToken& rToken ) const;
};
diff --git a/include/svl/sharedstring.hxx b/include/svl/sharedstring.hxx
index a3650a5..413717f 100644
--- a/include/svl/sharedstring.hxx
+++ b/include/svl/sharedstring.hxx
@@ -20,6 +20,9 @@ class SVL_DLLPUBLIC SharedString
rtl_uString* mpData;
rtl_uString* mpDataIgnoreCase;
public:
+
+ static SharedString getEmptyString();
+
SharedString();
SharedString( rtl_uString* pData, rtl_uString* pDataIgnoreCase );
SharedString( const OUString& rStr );
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index a494759..ea80b15 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -244,7 +244,7 @@ public:
bool IsValueNoError();
bool IsHybridValueCell(); // for cells after import to deal with inherited number formats
double GetValue();
- OUString GetString();
+ svl::SharedString GetString();
const ScMatrix* GetMatrix();
bool GetMatrixOrigin( ScAddress& rPos ) const;
void GetResultDimensions( SCSIZE& rCols, SCSIZE& rRows );
@@ -252,7 +252,7 @@ public:
sal_uInt16 GetErrCode(); // interpret first if necessary
sal_uInt16 GetRawError(); // don't interpret, just return code or result error
bool GetErrorOrValue( sal_uInt16& rErr, double& rVal );
- bool GetErrorOrString( sal_uInt16& rErr, OUString& rStr );
+ bool GetErrorOrString( sal_uInt16& rErr, svl::SharedString& rStr );
sal_uInt8 GetMatrixFlag() const;
ScTokenArray* GetCode();
const ScTokenArray* GetCode() const;
@@ -309,7 +309,7 @@ public:
void SetResultToken( const formula::FormulaToken* pToken );
- OUString GetResultString() const;
+ svl::SharedString GetResultString() const;
void SetErrCode( sal_uInt16 n );
bool IsHyperLinkCell() const;
diff --git a/sc/inc/formularesult.hxx b/sc/inc/formularesult.hxx
index d1c235f..8a7b365 100644
--- a/sc/inc/formularesult.hxx
+++ b/sc/inc/formularesult.hxx
@@ -135,7 +135,7 @@ public:
bool IsMultiline() const;
bool GetErrorOrDouble( sal_uInt16& rErr, double& rVal ) const;
- bool GetErrorOrString( sal_uInt16& rErr, OUString& rStr ) const;
+ bool GetErrorOrString( sal_uInt16& rErr, svl::SharedString& rStr ) const;
/** Get error code if set or GetCellResultType() is formula::svError or svUnknown,
else 0. */
@@ -159,7 +159,7 @@ public:
/** Return string if type formula::svString or formula::svHybridCell or formula::svMatrixCell and
upper left formula::svString, else empty string. */
- const OUString& GetString() const;
+ svl::SharedString GetString() const;
/** Return matrix if type formula::svMatrixCell and ScMatrix present, else NULL. */
ScConstMatrixRef GetMatrix() const;
diff --git a/sc/inc/simpleformulacalc.hxx b/sc/inc/simpleformulacalc.hxx
index 43ff6ea..4d13c6b 100644
--- a/sc/inc/simpleformulacalc.hxx
+++ b/sc/inc/simpleformulacalc.hxx
@@ -40,7 +40,7 @@ public:
bool IsValue();
sal_uInt16 GetErrCode();
double GetValue();
- OUString GetString();
+ svl::SharedString GetString();
short GetFormatType() const { return mnFormatType; }
sal_uLong GetFormatIndex() const { return mnFormatIndex; }
diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx
index 7b657e5..0046c44 100644
--- a/sc/inc/token.hxx
+++ b/sc/inc/token.hxx
@@ -210,19 +210,18 @@ public:
class ScExternalSingleRefToken : public ScToken
{
-private:
sal_uInt16 mnFileId;
- OUString maTabName;
+ svl::SharedString maTabName;
ScSingleRefData maSingleRef;
- ScExternalSingleRefToken(); // disabled
+ ScExternalSingleRefToken(); // disabled
public:
- ScExternalSingleRefToken( sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& r );
- ScExternalSingleRefToken( const ScExternalSingleRefToken& r );
- virtual ~ScExternalSingleRefToken();
+ ScExternalSingleRefToken( sal_uInt16 nFileId, const svl::SharedString& rTabName, const ScSingleRefData& r );
+ ScExternalSingleRefToken( const ScExternalSingleRefToken& r );
+ virtual ~ScExternalSingleRefToken();
virtual sal_uInt16 GetIndex() const;
- virtual const OUString& GetString() const;
+ virtual svl::SharedString GetString() const;
virtual const ScSingleRefData& GetSingleRef() const;
virtual ScSingleRefData& GetSingleRef();
virtual bool operator==( const formula::FormulaToken& rToken ) const;
@@ -232,19 +231,18 @@ public:
class ScExternalDoubleRefToken : public ScToken
{
-private:
sal_uInt16 mnFileId;
- OUString maTabName; // name of the first sheet
+ svl::SharedString maTabName; // name of the first sheet
ScComplexRefData maDoubleRef;
- ScExternalDoubleRefToken(); // disabled
+ ScExternalDoubleRefToken(); // disabled
public:
- ScExternalDoubleRefToken( sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& r );
- ScExternalDoubleRefToken( const ScExternalDoubleRefToken& r );
- virtual ~ScExternalDoubleRefToken();
+ ScExternalDoubleRefToken( sal_uInt16 nFileId, const svl::SharedString& rTabName, const ScComplexRefData& r );
+ ScExternalDoubleRefToken( const ScExternalDoubleRefToken& r );
+ virtual ~ScExternalDoubleRefToken();
virtual sal_uInt16 GetIndex() const;
- virtual const OUString& GetString() const;
+ virtual svl::SharedString GetString() const;
virtual const ScSingleRefData& GetSingleRef() const;
virtual ScSingleRefData& GetSingleRef();
virtual const ScSingleRefData& GetSingleRef2() const;
@@ -257,17 +255,17 @@ public:
class ScExternalNameToken : public ScToken
{
-private:
sal_uInt16 mnFileId;
- OUString maName;
-private:
- ScExternalNameToken(); // disabled
+ svl::SharedString maName;
+
+ ScExternalNameToken(); // disabled
public:
- ScExternalNameToken( sal_uInt16 nFileId, const OUString& rName );
- ScExternalNameToken( const ScExternalNameToken& r );
- virtual ~ScExternalNameToken();
+ ScExternalNameToken( sal_uInt16 nFileId, const svl::SharedString& rName );
+ ScExternalNameToken( const ScExternalNameToken& r );
+ virtual ~ScExternalNameToken();
+
virtual sal_uInt16 GetIndex() const;
- virtual const OUString& GetString() const;
+ virtual svl::SharedString GetString() const;
virtual bool operator==( const formula::FormulaToken& rToken ) const;
virtual FormulaToken* Clone() const { return new ScExternalNameToken(*this); }
};
@@ -325,7 +323,7 @@ public:
bool IsInherited() const { return bInherited; }
bool IsDisplayedAsString() const { return bDisplayedAsString; }
virtual double GetDouble() const;
- virtual const OUString & GetString() const;
+ virtual svl::SharedString GetString() const;
virtual bool operator==( const formula::FormulaToken& rToken ) const;
virtual FormulaToken* Clone() const { return new ScEmptyCellToken(*this); }
};
@@ -345,7 +343,7 @@ public:
ScMatrixCellResultToken( const ScConstMatrixRef& pMat, formula::FormulaToken* pUL );
ScMatrixCellResultToken( const ScMatrixCellResultToken& r );
virtual double GetDouble() const;
- virtual const OUString & GetString() const;
+ virtual svl::SharedString GetString() const;
virtual const ScMatrix* GetMatrix() const;
virtual bool operator==( const formula::FormulaToken& rToken ) const;
virtual FormulaToken* Clone() const;
@@ -414,11 +412,11 @@ class SC_DLLPUBLIC ScHybridCellToken : public ScToken
{
private:
double mfDouble;
- OUString maString;
+ svl::SharedString maString;
OUString maFormula;
public:
ScHybridCellToken( double f,
- const OUString & rStr,
+ const svl::SharedString & rStr,
const OUString & rFormula ) :
ScToken( formula::svHybridCell ),
mfDouble( f ), maString( rStr ),
@@ -426,7 +424,8 @@ public:
const OUString& GetFormula() const { return maFormula; }
virtual double GetDouble() const;
- virtual const OUString& GetString() const;
+
+ virtual svl::SharedString GetString() const;
virtual bool operator==( const formula::FormulaToken& rToken ) const;
virtual FormulaToken* Clone() const { return new ScHybridCellToken(*this); }
};
diff --git a/sc/source/core/data/autonamecache.cxx b/sc/source/core/data/autonamecache.cxx
index c40fa1f..ba261b1 100644
--- a/sc/source/core/data/autonamecache.cxx
+++ b/sc/source/core/data/autonamecache.cxx
@@ -66,7 +66,7 @@ const ScAutoNameAddresses& ScAutoNameCache::GetNameOccurrences( const OUString&
aStr = aIter.getString();
break;
case CELLTYPE_FORMULA:
- aStr = aIter.getFormulaCell()->GetString();
+ aStr = aIter.getFormulaCell()->GetString().getString();
break;
case CELLTYPE_EDIT:
{
diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx
index af12e19..12ef302 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -564,7 +564,7 @@ OUString ScRefCellValue::getString( const ScDocument* pDoc )
return ScEditUtil::GetString(*mpEditText, pDoc);
break;
case CELLTYPE_FORMULA:
- return mpFormula->GetString();
+ return mpFormula->GetString().getString();
default:
;
}
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 5270e4c..c62ff84 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1507,8 +1507,8 @@ void ScColumn::CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol
aDestPos.miCellPos = rDestCol.maCells.set(aDestPos.miCellPos, nRow, rFC.GetValue());
else
{
- svl::SharedString aSS = pDocument->GetSharedStringPool().intern(rFC.GetString());
- if (aSS.getData())
+ svl::SharedString aSS = rFC.GetString();
+ if (aSS.isValid())
aDestPos.miCellPos = rDestCol.maCells.set(aDestPos.miCellPos, nRow, aSS);
}
}
@@ -1785,7 +1785,7 @@ class CopyByCloneHandler
if (bCloneString)
{
- OUString aStr = rSrcCell.GetString();
+ svl::SharedString aStr = rSrcCell.GetString();
if (aStr.isEmpty())
// Don't create empty string cells.
return;
@@ -1794,18 +1794,14 @@ class CopyByCloneHandler
{
// Clone as an edit text object.
EditEngine& rEngine = mrDestCol.GetDoc().GetEditEngine();
- rEngine.SetText(aStr);
+ rEngine.SetText(aStr.getString());
maDestPos.miCellPos =
mrDestCol.GetCellStore().set(maDestPos.miCellPos, nRow, rEngine.CreateTextObject());
}
else
{
- svl::SharedString aSS = mrDestCol.GetDoc().GetSharedStringPool().intern(aStr);
- if (aSS.getData())
- {
- maDestPos.miCellPos =
- mrDestCol.GetCellStore().set(maDestPos.miCellPos, nRow, aSS);
- }
+ maDestPos.miCellPos =
+ mrDestCol.GetCellStore().set(maDestPos.miCellPos, nRow, aStr);
}
setDefaultAttrToDest(nRow);
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 62cd538..a0ee046 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1895,7 +1895,7 @@ public:
if (rCell.IsValue())
mrMat.PutDouble(rCell.GetValue(), mnMatCol, nRow - mnTopRow);
else
- mrMat.PutString(mrStrPool.intern(rCell.GetString()), mnMatCol, nRow - mnTopRow);
+ mrMat.PutString(rCell.GetString(), mnMatCol, nRow - mnTopRow);
}
void operator() (size_t nRow, const svl::SharedString& rSS)
@@ -2050,7 +2050,7 @@ public:
continue;
}
- svl::SharedString aStr = mrPool.intern(rCell.GetString());
+ svl::SharedString aStr = rCell.GetString();
if (!aBucket.maStrVals.empty() && nThisRow == nPrevRow + 1)
{
// Secondary strings.
@@ -2216,7 +2216,7 @@ bool appendStrings(
getBlockIterators<sc::formula_block>(it, nLenRemain, itData, itDataEnd);
sal_uInt16 nErr;
- OUString aStr;
+ svl::SharedString aStr;
for (; itData != itDataEnd; ++itData)
{
ScFormulaCell& rFC = **itData;
@@ -2231,7 +2231,7 @@ bool appendStrings(
return false;
}
- rArray.push_back(rPool.intern(aStr).getDataIgnoreCase());
+ rArray.push_back(aStr.getDataIgnoreCase());
}
}
break;
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index c34fa17..02ed182 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -847,7 +847,7 @@ public:
}
else if (bString)
{
- OUString aStr = rSrcCell.GetString();
+ svl::SharedString aStr = rSrcCell.GetString();
if (aStr.isEmpty())
// do not clone empty string
continue;
@@ -858,7 +858,7 @@ public:
{
// Clone as an edit text object.
ScFieldEditEngine& rEngine = mrDestCol.GetDoc().GetEditEngine();
- rEngine.SetText(aStr);
+ rEngine.SetText(aStr.getString());
mrDestCol.SetEditText(maDestBlockPos, nSrcRow + mnRowOffset, rEngine.CreateTextObject());
}
else
@@ -2073,19 +2073,16 @@ class FormulaToValueHandler
typedef std::vector<Entry> EntriesType;
EntriesType maEntries;
- svl::SharedStringPool& mrStrPool;
public:
- FormulaToValueHandler(ScDocument& rDoc) : mrStrPool(rDoc.GetSharedStringPool()) {}
-
void operator() (size_t nRow, const ScFormulaCell* p)
{
ScFormulaCell* p2 = const_cast<ScFormulaCell*>(p);
if (p2->IsValue())
maEntries.push_back(Entry(nRow, p2->GetValue()));
else
- maEntries.push_back(Entry(nRow, mrStrPool.intern(p2->GetString())));
+ maEntries.push_back(Entry(nRow, p2->GetString()));
}
void commitCells(ScColumn& rColumn)
@@ -2115,7 +2112,7 @@ public:
void ScColumn::RemoveProtected( SCROW nStartRow, SCROW nEndRow )
{
- FormulaToValueHandler aFunc(*pDocument);
+ FormulaToValueHandler aFunc;
sc::CellStoreType::const_iterator itPos = maCells.begin();
ScAttrIterator aAttrIter( pAttrArray, nStartRow, nEndRow );
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 418b303..3ab133c 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -280,7 +280,7 @@ ScConditionEntry::ScConditionEntry( ScConditionMode eOper,
else if ( pToken->GetType() == svString )
{
bIsStr1 = true;
- aStrVal1 = pToken->GetString();
+ aStrVal1 = pToken->GetString().getString();
DELETEZ(pFormula1); // nicht als Formel merken
}
}
@@ -304,7 +304,7 @@ ScConditionEntry::ScConditionEntry( ScConditionMode eOper,
else if ( pToken->GetType() == svString )
{
bIsStr2 = true;
- aStrVal2 = pToken->GetString();
+ aStrVal2 = pToken->GetString().getString();
DELETEZ(pFormula2); // nicht als Formel merken
}
}
@@ -360,7 +360,7 @@ void ScConditionEntry::Compile( const OUString& rExpr1, const OUString& rExpr2,
else if ( pToken->GetType() == svString )
{
bIsStr1 = true;
- aStrVal1 = pToken->GetString();
+ aStrVal1 = pToken->GetString().getString();
DELETEZ(pFormula1); // nicht als Formel merken
}
}
@@ -397,7 +397,7 @@ void ScConditionEntry::Compile( const OUString& rExpr1, const OUString& rExpr2,
else if ( pToken->GetType() == svString )
{
bIsStr2 = true;
- aStrVal2 = pToken->GetString();
+ aStrVal2 = pToken->GetString().getString();
DELETEZ(pFormula2); // nicht als Formel merken
}
}
@@ -649,7 +649,7 @@ void ScConditionEntry::Interpret( const ScAddress& rPos )
else
{
bIsStr1 = true;
- aStrVal1 = pEff1->GetString();
+ aStrVal1 = pEff1->GetString().getString();
nVal1 = 0.0;
}
}
@@ -678,7 +678,7 @@ void ScConditionEntry::Interpret( const ScAddress& rPos )
else
{
bIsStr2 = true;
- aStrVal2 = pEff2->GetString();
+ aStrVal2 = pEff2->GetString().getString();
nVal2 = 0.0;
}
}
@@ -717,7 +717,7 @@ static bool lcl_GetCellContent( ScRefCellValue& rCell, bool bIsStr1, double& rAr
if (bVal)
rArg = rCell.mpFormula->GetValue();
else
- rArgStr = rCell.mpFormula->GetString();
+ rArgStr = rCell.mpFormula->GetString().getString();
}
break;
case CELLTYPE_STRING:
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index eaa496a..a73b02b 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -440,7 +440,7 @@ bool ScDBQueryDataIterator::DataAccessInternal::getCurrent(Value& rValue)
incPos();
else
{
- rValue.maString = aCell.mpFormula->GetString();
+ rValue.maString = aCell.mpFormula->GetString().getString();
rValue.mfValue = 0.0;
rValue.mnError = aCell.mpFormula->GetErrCode();
rValue.mbIsNumber = false;
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 608cf4d..df4e434 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -438,14 +438,14 @@ bool setCacheTableReferenced(ScToken& rToken, ScExternalRefManager& rRefMgr, con
{
case svExternalSingleRef:
return rRefMgr.setCacheTableReferenced(
- rToken.GetIndex(), rToken.GetString(), 1);
+ rToken.GetIndex(), rToken.GetString().getString(), 1);
case svExternalDoubleRef:
{
const ScComplexRefData& rRef = rToken.GetDoubleRef();
ScRange aAbs = rRef.toAbs(rPos);
size_t nSheets = aAbs.aEnd.Tab() - aAbs.aStart.Tab() + 1;
return rRefMgr.setCacheTableReferenced(
- rToken.GetIndex(), rToken.GetString(), nSheets);
+ rToken.GetIndex(), rToken.GetString().getString(), nSheets);
}
case svExternalName:
/* TODO: external names aren't supported yet, but would
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 51a5c2e..8232af1 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3265,7 +3265,7 @@ sal_uInt16 ScDocument::GetStringForFormula( const ScAddress& rPos, OUString& rSt
pFormatter->GetInputLineString(fVal, nIndex, aStr);
}
else
- aStr = pFCell->GetString();
+ aStr = pFCell->GetString().getString();
}
break;
case CELLTYPE_VALUE:
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 498c1aa..f3bf7fc 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1700,7 +1700,7 @@ void ScFormulaCell::SetResultToken( const formula::FormulaToken* pToken )
aResult.SetToken(pToken);
}
-OUString ScFormulaCell::GetResultString() const
+svl::SharedString ScFormulaCell::GetResultString() const
{
return aResult.GetString();
}
@@ -1770,7 +1770,7 @@ void ScFormulaCell::GetURLResult( OUString& rURL, OUString& rCellText )
}
else
{
- aCellString = GetString();
+ aCellString = GetString().getString();
pFormatter->GetOutputString( aCellString, nCellFormat, rCellText, &pColor );
}
ScConstMatrixRef xMat( aResult.GetMatrix());
@@ -1864,13 +1864,14 @@ double ScFormulaCell::GetValue()
return 0.0;
}
-OUString ScFormulaCell::GetString()
+svl::SharedString ScFormulaCell::GetString()
{
MaybeInterpret();
if ((!pCode->GetCodeError() || pCode->GetCodeError() == errDoubleRef) &&
!aResult.GetResultError())
return aResult.GetString();
- return OUString();
+
+ return svl::SharedString::getEmptyString();
}
const ScMatrix* ScFormulaCell::GetMatrix()
@@ -2082,7 +2083,7 @@ bool ScFormulaCell::GetErrorOrValue( sal_uInt16& rErr, double& rVal )
return aResult.GetErrorOrDouble(rErr, rVal);
}
-bool ScFormulaCell::GetErrorOrString( sal_uInt16& rErr, OUString& rStr )
+bool ScFormulaCell::GetErrorOrString( sal_uInt16& rErr, svl::SharedString& rStr )
{
MaybeInterpret();
diff --git a/sc/source/core/data/simpleformulacalc.cxx b/sc/source/core/data/simpleformulacalc.cxx
index 1b2cd35..8702c3b 100644
--- a/sc/source/core/data/simpleformulacalc.cxx
+++ b/sc/source/core/data/simpleformulacalc.cxx
@@ -75,7 +75,7 @@ double ScSimpleFormulaCalculator::GetValue()
return 0.0;
}
-OUString ScSimpleFormulaCalculator::GetString()
+svl::SharedString ScSimpleFormulaCalculator::GetString()
{
Calculate();
@@ -83,7 +83,7 @@ OUString ScSimpleFormulaCalculator::GetString()
!maResult.GetResultError())
return maResult.GetString();
- return OUString();
+ return svl::SharedString::getEmptyString();
}
bool ScSimpleFormulaCalculator::HasColRowName()
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 9c24d96..9cbf6cb 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -199,7 +199,7 @@ bool ScValidationData::DoScript( const ScAddress& rPos, const OUString& rInput,
if ( bIsValue )
nValue = pCell->GetValue();
else
- aValStr = pCell->GetString();
+ aValStr = pCell->GetString().getString();
}
if ( bIsValue )
aParams[0] = ::com::sun::star::uno::makeAny( nValue );
@@ -318,7 +318,7 @@ bool ScValidationData::DoMacro( const ScAddress& rPos, const OUString& rInput,
if ( bIsValue )
nValue = pCell->GetValue();
else
- aValStr = pCell->GetString();
+ aValStr = pCell->GetString().getString();
}
if ( bIsValue )
refPar->Get(1)->PutDouble( nValue );
@@ -501,7 +501,7 @@ bool ScValidationData::IsDataValid( ScRefCellValue& rCell, const ScAddress& rPos
if ( bIsVal )
nVal = pFCell->GetValue();
else
- aString = pFCell->GetString();
+ aString = pFCell->GetString().getString();
}
break;
default: // Notizen, Broadcaster
@@ -560,27 +560,28 @@ public:
mrTokArr( rTokArr ), mbSkipEmpty( bSkipEmpty ), mbOk( true ) {}
/** Returns the string of the first string token or NULL on error or empty token array. */
- const OUString* First();
+ rtl_uString* First();
/** Returns the string of the next string token or NULL on error or end of token array. */
- const OUString* Next();
+ rtl_uString* Next();
/** Returns false, if a wrong token has been found. Does NOT return false on end of token array. */
inline bool Ok() const { return mbOk; }
private:
+ svl::SharedString maCurString; /// Current string.
ScTokenArray& mrTokArr; /// The token array for iteration.
bool mbSkipEmpty; /// Ignore empty strings.
bool mbOk; /// true = correct token or end of token array.
};
-const OUString* ScStringTokenIterator::First()
+rtl_uString* ScStringTokenIterator::First()
{
mrTokArr.Reset();
mbOk = true;
return Next();
}
-const OUString* ScStringTokenIterator::Next()
+rtl_uString* ScStringTokenIterator::Next()
{
if( !mbOk )
return NULL;
@@ -591,9 +592,13 @@ const OUString* ScStringTokenIterator::Next()
pToken = mrTokArr.NextNoSpaces();
mbOk = !pToken || (pToken->GetType() == formula::svString);
- const OUString* pString = (mbOk && pToken) ? &pToken->GetString() : NULL;
+
+ maCurString = svl::SharedString(); // start with invalid string.
+ if (mbOk && pToken)
+ maCurString = pToken->GetString();
+
// string found but empty -> get next token; otherwise return it
- return (mbSkipEmpty && pString && pString->isEmpty()) ? Next() : pString;
+ return (mbSkipEmpty && maCurString.isValid() && maCurString.isEmpty()) ? Next() : maCurString.getData();
}
// ----------------------------------------------------------------------------
@@ -660,8 +665,8 @@ bool ScValidationData::GetSelectionFromFormula(
xMatRef->PutDouble( aValidationSrc.GetValue(), 0);
else
{
- OUString aStr = aValidationSrc.GetString();
- xMatRef->PutString(pDocument->GetSharedStringPool().intern(aStr), 0);
+ svl::SharedString aStr = aValidationSrc.GetString();
+ xMatRef->PutString(aStr, 0);
}
pValues = xMatRef.get();
@@ -805,13 +810,14 @@ bool ScValidationData::FillSelectionList(std::vector<ScTypedStrData>& rStrColl,
sal_uInt32 nFormat = lclGetCellFormat( *GetDocument(), rPos );
ScStringTokenIterator aIt( *pTokArr );
- for( const OUString* pString = aIt.First(); pString && aIt.Ok(); pString = aIt.Next() )
+ for (rtl_uString* pString = aIt.First(); pString && aIt.Ok(); pString = aIt.Next())
{
double fValue;
- bool bIsValue = GetDocument()->GetFormatTable()->IsNumberFormat( *pString, nFormat, fValue );
+ OUString aStr(pString);
+ bool bIsValue = GetDocument()->GetFormatTable()->IsNumberFormat(aStr, nFormat, fValue);
rStrColl.push_back(
ScTypedStrData(
- *pString, fValue, bIsValue ? ScTypedStrData::Value : ScTypedStrData::Standard));
+ aStr, fValue, bIsValue ? ScTypedStrData::Value : ScTypedStrData::Standard));
}
bOk = aIt.Ok();
@@ -861,7 +867,7 @@ bool ScValidationData::IsListValid( ScRefCellValue& rCell, const ScAddress& rPos
sal_uInt32 nFormat = lclGetCellFormat( *GetDocument(), rPos );
ScStringTokenIterator aIt( *pTokArr );
- for( const OUString* pString = aIt.First(); pString && aIt.Ok(); pString = aIt.Next() )
+ for (rtl_uString* pString = aIt.First(); pString && aIt.Ok(); pString = aIt.Next())
{
/* Do not break the loop, if a valid string has been found.
This is to find invalid tokens following in the formula. */
@@ -870,10 +876,11 @@ bool ScValidationData::IsListValid( ScRefCellValue& rCell, const ScAddress& rPos
// create a formula containing a single string or number
ScTokenArray aCondTokArr;
double fValue;
- if( GetDocument()->GetFormatTable()->IsNumberFormat( *pString, nFormat, fValue ) )
+ OUString aStr(pString);
+ if (GetDocument()->GetFormatTable()->IsNumberFormat(aStr, nFormat, fValue))
aCondTokArr.AddDouble( fValue );
else
- aCondTokArr.AddString( *pString );
+ aCondTokArr.AddString(aStr);
bIsValid = IsEqualToTokenArray(rCell, rPos, aCondTokArr);
}
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 975ba25..29c722b 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -160,7 +160,6 @@ private:
const formula::FormulaToken*
pCur; // current token
- OUString aTempStr; // for GetString()
ScTokenStack* pStackObj; // contains the stacks
formula::FormulaToken** pStack; // the current stack
sal_uInt16 nGlobalError; // global (local to this formula expression) error
@@ -200,7 +199,7 @@ double ConvertStringToValue( const OUString& );
double GetCellValue( const ScAddress&, ScRefCellValue& rCell );
double GetCellValueOrZero( const ScAddress&, ScRefCellValue& rCell );
double GetValueCellValue( const ScAddress&, double fOrig );
-void GetCellString( OUString& rStr, ScRefCellValue& rCell );
+void GetCellString( svl::SharedString& rStr, ScRefCellValue& rCell );
sal_uInt16 GetCellErrCode( const ScRefCellValue& rCell );
bool CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
@@ -267,7 +266,7 @@ formula::FormulaTokenRef PopToken();
void Pop();
void PopError();
double PopDouble();
-const OUString& PopString();
+svl::SharedString PopString();
void ValidateRef( const ScSingleRefData & rRef );
void ValidateRef( const ScComplexRefData & rRef );
void ValidateRef( const ScRefList & rRefList );
@@ -317,7 +316,8 @@ void QueryMatrixType(ScMatrixRef& xMat, short& rRetTypeExpr, sal_uLong& rRetInde
void PushDouble(double nVal);
void PushInt( int nVal );
void PushStringBuffer( const sal_Unicode* pString );
-void PushString( const OUString& rString );
+void PushString( const OUString& rStr );
+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);
@@ -343,10 +343,10 @@ double GetDouble();
double GetDoubleWithDefault(double nDefault);
bool IsMissing();
bool GetBool() { return GetDouble() != 0.0; }
-const OUString& GetString();
-const OUString& GetStringFromMatrix(const ScMatrixRef& pMat);
+svl::SharedString GetString();
+svl::SharedString GetStringFromMatrix(const ScMatrixRef& pMat);
// pop matrix and obtain one element, upper left or according to jump matrix
-ScMatValType GetDoubleOrStringFromMatrix( double& rDouble, OUString& rString );
+ScMatValType GetDoubleOrStringFromMatrix( double& rDouble, svl::SharedString& rString );
ScMatrixRef CreateMatrixFromDoubleRef( const formula::FormulaToken* pToken,
SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2 );
@@ -833,7 +833,7 @@ public:
sal_uInt16 GetError() const { return nGlobalError; }
formula::StackVar GetResultType() const { return xResult->GetType(); }
- const OUString& GetStringResult() const { return xResult->GetString(); }
+ svl::SharedString GetStringResult() const;
double GetNumResult() const { return xResult->GetDouble(); }
formula::FormulaTokenRef GetResultToken() const { return xResult; }
short GetRetFormatType() const { return nRetFmtType; }
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index 1f394f7..fdeb7f8 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -112,13 +112,13 @@ void ScCellFormat::GetString( ScRefCellValue& rCell, sal_uLong nFormat, OUString
if ( !bNullVals && fValue == 0.0 )
rString = OUString();
else if ( pFCell->IsHybridValueCell() )
- rString = pFCell->GetString();
+ rString = pFCell->GetString().getString();
else
rFormatter.GetOutputString( fValue, nFormat, rString, ppColor, bUseStarFormat );
}
else
{
- OUString aCellString = pFCell->GetString();
+ OUString aCellString = pFCell->GetString().getString();
rFormatter.GetOutputString( aCellString, nFormat, rString, ppColor, bUseStarFormat );
}
}
@@ -205,12 +205,12 @@ OUString ScCellFormat::GetString(
{
double fValue = pFCell->GetValue();
if (!bNullVals && fValue == 0.0) aString = OUString();
- else if (pFCell->IsHybridValueCell()) aString = pFCell->GetString();
+ else if (pFCell->IsHybridValueCell()) aString = pFCell->GetString().getString();
else rFormatter.GetOutputString(fValue, nFormat, aString, ppColor, bUseStarFormat);
}
else
{
- OUString aCellString = pFCell->GetString();
+ OUString aCellString = pFCell->GetString().getString();
rFormatter.GetOutputString(aCellString, nFormat, aString, ppColor, bUseStarFormat);
}
}
@@ -250,7 +250,7 @@ void ScCellFormat::GetInputString(
else if (pFC->IsValue())
rFormatter.GetInputLineString(pFC->GetValue(), nFormat, aString);
else
- aString = pFC->GetString();
+ aString = pFC->GetString().getString();
sal_uInt16 nErrCode = pFC->GetErrCode();
if (nErrCode != 0)
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index c64c98f..128cf18 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3624,9 +3624,9 @@ void ScCompiler::CreateStringFromXMLTokenArray( OUString& rFormula, OUString& rF
{
FormulaToken** ppTokens = pArr->GetArray();
// string tokens expected, GetString() will assert if token type is wrong
- rFormula = ppTokens[ 0 ]->GetString();
+ rFormula = ppTokens[0]->GetString().getString();
if( bExternal )
- rFormulaNmsp = ppTokens[ 1 ]->GetString();
+ rFormulaNmsp = ppTokens[1]->GetString().getString();
}
}
@@ -3985,9 +3985,9 @@ bool ScCompiler::HandleExternalReference(const FormulaToken& _aToken)
return true;
}
- const OUString& rName = _aToken.GetString();
+ OUString aName = _aToken.GetString().getString();
ScExternalRefCache::TokenArrayRef xNew = pRefMgr->getRangeNameTokens(
- _aToken.GetIndex(), rName, &aPos);
+ _aToken.GetIndex(), aName, &aPos);
if (!xNew)
{
@@ -4111,16 +4111,16 @@ void ScCompiler::CreateStringFromExternal(OUStringBuffer& rBuffer, FormulaToken*
{
const OUString *pStr = pRefMgr->getExternalFileName(t->GetIndex());
OUString aFileName = pStr ? *pStr : ScGlobal::GetRscString(STR_NO_NAME_REF);
- rBuffer.append(pConv->makeExternalNameStr( aFileName, t->GetString()));
+ rBuffer.append(pConv->makeExternalNameStr( aFileName, t->GetString().getString()));
}
break;
case svExternalSingleRef:
pConv->makeExternalRefStr(
- rBuffer, *this, t->GetIndex(), t->GetString(), static_cast<ScToken*>(t)->GetSingleRef(), pRefMgr);
+ rBuffer, *this, t->GetIndex(), t->GetString().getString(), static_cast<ScToken*>(t)->GetSingleRef(), pRefMgr);
break;
case svExternalDoubleRef:
pConv->makeExternalRefStr(
- rBuffer, *this, t->GetIndex(), t->GetString(), static_cast<ScToken*>(t)->GetDoubleRef(), pRefMgr);
+ rBuffer, *this, t->GetIndex(), t->GetString().getString(), static_cast<ScToken*>(t)->GetDoubleRef(), pRefMgr);
break;
default:
// warning, not error, otherwise we may end up with a never
diff --git a/sc/source/core/tool/formularesult.cxx b/sc/source/core/tool/formularesult.cxx
index c0876cd..5015a85 100644
--- a/sc/source/core/tool/formularesult.cxx
+++ b/sc/source/core/tool/formularesult.cxx
@@ -294,8 +294,8 @@ bool ScFormulaResult::IsMultiline() const
{
if (meMultiline == MULTILINE_UNKNOWN)
{
- const OUString& rStr = GetString();
- if (!rStr.isEmpty() && rStr.indexOf( '\n' ) != -1)
+ svl::SharedString aStr = GetString();
+ if (!aStr.isEmpty() && aStr.getString().indexOf('\n') != -1)
const_cast<ScFormulaResult*>(this)->meMultiline = MULTILINE_TRUE;
else
const_cast<ScFormulaResult*>(this)->meMultiline = MULTILINE_FALSE;
@@ -336,7 +336,7 @@ bool ScFormulaResult::GetErrorOrDouble( sal_uInt16& rErr, double& rVal ) const
return true;
}
-bool ScFormulaResult::GetErrorOrString( sal_uInt16& rErr, OUString& rStr ) const
+bool ScFormulaResult::GetErrorOrString( sal_uInt16& rErr, svl::SharedString& rStr ) const
{
if (mnError)
{
@@ -440,7 +440,7 @@ double ScFormulaResult::GetDouble() const
return mfValue;
}
-const OUString & ScFormulaResult::GetString() const
+svl::SharedString ScFormulaResult::GetString() const
{
if (mbToken && mpToken)
{
@@ -462,7 +462,7 @@ const OUString & ScFormulaResult::GetString() const
; // nothing
}
}
- return EMPTY_OUSTRING;
+ return svl::SharedString::getEmptyString();
}
ScConstMatrixRef ScFormulaResult::GetMatrix() const
@@ -492,7 +492,7 @@ void ScFormulaResult::SetHybridDouble( double f )
SetDouble(f);
else
{
- OUString aString( GetString());
+ svl::SharedString aString = GetString();
OUString aFormula( GetHybridFormula());
mpToken->DecRef();
mpToken = new ScHybridCellToken( f, aString, aFormula);
@@ -524,7 +524,7 @@ void ScFormulaResult::SetHybridFormula( const OUString & rFormula )
{
// Obtain values before changing anything.
double f = GetDouble();
- OUString aStr( GetString());
+ svl::SharedString aStr = GetString();
ResetToDefaults();
if (mbToken && mpToken)
mpToken->DecRef();
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 4bf9e4a..d1e53df 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -314,7 +314,7 @@ void ScInterpreter::ScIfError( bool bNAonly )
case svExternalDoubleRef:
{
double fVal;
- OUString aStr;
+ svl::SharedString aStr;
// Handles also existing jump matrix case and sets error on
// elements.
GetDoubleOrStringFromMatrix( fVal, aStr);
@@ -592,7 +592,7 @@ bool ScInterpreter::JumpMatrix( short nStackLevel )
break;
case svString:
{
- const OUString& rStr = GetString();
+ svl::SharedString aStr = GetString();
if ( nGlobalError )
{
pResMat->PutDouble( CreateDoubleError( nGlobalError),
@@ -600,7 +600,7 @@ bool ScInterpreter::JumpMatrix( short nStackLevel )
nGlobalError = 0;
}
else
- pResMat->PutString(mrStrPool.intern(rStr), nC, nR);
+ pResMat->PutString(aStr, nC, nR);
}
break;
case svSingleRef:
@@ -632,7 +632,7 @@ bool ScInterpreter::JumpMatrix( short nStackLevel )
}
else
{
- OUString aStr;
+ svl::SharedString aStr;
GetCellString(aStr, aCell);
if ( nGlobalError )
{
@@ -641,7 +641,7 @@ bool ScInterpreter::JumpMatrix( short nStackLevel )
nGlobalError = 0;
}
else
- pResMat->PutString(mrStrPool.intern(aStr), nC, nR);
+ pResMat->PutString(aStr, nC, nR);
}
}
}
@@ -699,8 +699,8 @@ bool ScInterpreter::JumpMatrix( short nStackLevel )
pResMat->PutDouble( fCellVal, nC, nR );
}
else
- {
- OUString aStr;
+ {
+ svl::SharedString aStr;
GetCellString(aStr, aCell);
if ( nGlobalError )
{
@@ -709,7 +709,7 @@ bool ScInterpreter::JumpMatrix( short nStackLevel )
nGlobalError = 0;
}
else
- pResMat->PutString(mrStrPool.intern(aStr), nC, nR);
+ pResMat->PutString(aStr, nC, nR);
}
}
SCSIZE nParmCols = aRange.aEnd.Col() - aRange.aStart.Col() + 1;
@@ -1011,7 +1011,7 @@ double ScInterpreter::Compare()
aComp.bVal[ i ] = true;
break;
case svString:
- *aComp.pVal[ i ] = GetString();
+ *aComp.pVal[ i ] = GetString().getString();
aComp.bVal[ i ] = false;
break;
case svDoubleRef :
@@ -1026,9 +1026,9 @@ double ScInterpreter::Compare()
aComp.bEmpty[i] = true;
else if (aCell.hasString())
{
- OUString aStr;
+ svl::SharedString aStr;
GetCellString(aStr, aCell);
- *aComp.pVal[i] = aStr;
+ *aComp.pVal[i] = aStr.getString();
aComp.bVal[i] = false;
}
else
@@ -1102,7 +1102,7 @@ sc::RangeMatrix ScInterpreter::CompareMat( ScCompareOptions* pOptions )
aComp.bVal[ i ] = true;
break;
case svString:
- *aComp.pVal[ i ] = GetString();
+ *aComp.pVal[ i ] = GetString().getString();
aComp.bVal[ i ] = false;
break;
case svSingleRef:
@@ -1114,9 +1114,9 @@ sc::RangeMatrix ScInterpreter::CompareMat( ScCompareOptions* pOptions )
aComp.bEmpty[i] = true;
else if (aCell.hasString())
{
- OUString aStr;
+ svl::SharedString aStr;
GetCellString(aStr, aCell);
- *aComp.pVal[i] = aStr;
+ *aComp.pVal[i] = aStr.getString();
aComp.bVal[i] = false;
}
else
@@ -2401,7 +2401,7 @@ void ScInterpreter::ScCell()
}
bError = !PopDoubleRefOrSingleRef( aCellPos );
}
- OUString aInfoType( GetString() );
+ OUString aInfoType = GetString().getString();
if( bError || nGlobalError )
PushIllegalParameter();
else
@@ -2477,7 +2477,7 @@ void ScInterpreter::ScCell()
{ // contents of the cell, no formatting
if (aCell.hasString())
{
- OUString aStr;
+ svl::SharedString aStr;
GetCellString(aStr, aCell);
PushString( aStr );
}
@@ -2574,7 +2574,7 @@ void ScInterpreter::ScCellExternal()
return;
}
- OUString aInfoType = GetString();
+ OUString aInfoType = GetString().getString();
if (nGlobalError)
{
PushIllegalParameter();
@@ -3135,7 +3135,7 @@ void ScInterpreter::ScN()
void ScInterpreter::ScTrim()
{
// Doesn't only trim but also removes duplicated blanks within!
- OUString aVal = comphelper::string::strip(GetString(), ' ');
+ OUString aVal = comphelper::string::strip(GetString().getString(), ' ');
OUStringBuffer aStr;
const sal_Unicode* p = aVal.getStr();
const sal_Unicode* const pEnd = p + aVal.getLength();
@@ -3151,7 +3151,7 @@ void ScInterpreter::ScTrim()
void ScInterpreter::ScUpper()
{
- OUString aString = ScGlobal::pCharClass->uppercase(GetString());
+ OUString aString = ScGlobal::pCharClass->uppercase(GetString().getString());
PushString(aString);
}
@@ -3159,7 +3159,7 @@ void ScInterpreter::ScUpper()
void ScInterpreter::ScPropper()
{
//2do: what to do with I18N-CJK ?!?
- OUStringBuffer aStr(GetString());
+ OUStringBuffer aStr(GetString().getString());
const sal_Int32 nLen = aStr.getLength();
if ( nLen > 0 )
{
@@ -3183,15 +3183,14 @@ void ScInterpreter::ScPropper()
void ScInterpreter::ScLower()
{
- OUString aString = ScGlobal::pCharClass->lowercase(GetString());
+ OUString aString = ScGlobal::pCharClass->lowercase(GetString().getString());
PushString(aString);
}
void ScInterpreter::ScLen()
{
- const OUString& aStr = GetString();
- PushDouble( aStr.getLength() );
+ PushDouble(GetString().getLength());
}
@@ -3230,8 +3229,9 @@ void ScInterpreter::ScT()
else
{
// like GetString()
- GetCellString(aTempStr, aCell);
- PushString( aTempStr );
+ svl::SharedString aStr;
+ GetCellString(aStr, aCell);
+ PushString(aStr);
}
}
break;
@@ -3240,10 +3240,10 @@ void ScInterpreter::ScT()
case svExternalDoubleRef:
{
double fVal;
- OUString aStr;
+ svl::SharedString aStr;
ScMatValType nMatValType = GetDoubleOrStringFromMatrix( fVal, aStr);
if (ScMatrix::IsValueType( nMatValType))
- PushString( EMPTY_STRING);
+ PushString(svl::SharedString::getEmptyString());
else
PushString( aStr);
}
@@ -3291,7 +3291,11 @@ void ScInterpreter::ScValue()
ScRefCellValue aCell;
aCell.assign(*pDok, aAdr);
if (aCell.hasString())
- GetCellString(aInputString, aCell);
+ {
+ svl::SharedString aSS;
+ GetCellString(aSS, aCell);
+ aInputString = aSS.getString();
+ }
else if (aCell.hasNumeric())
{
PushDouble( GetCellValue(aAdr, aCell) );
@@ -3306,8 +3310,10 @@ void ScInterpreter::ScValue()
break;
case svMatrix:
{
+ svl::SharedString aSS;
ScMatValType nType = GetDoubleOrStringFromMatrix( fVal,
- aInputString);
+ aSS);
+ aInputString = aSS.getString();
switch (nType)
{
case SC_MATVAL_EMPTY:
@@ -3327,7 +3333,7 @@ void ScInterpreter::ScValue()
}
break;
default:
- aInputString = GetString();
+ aInputString = GetString().getString();
break;
}
@@ -3352,11 +3358,11 @@ void ScInterpreter::ScNumberValue()
sal_Unicode cDecimalSeparator = 0;
if ( nParamCount == 3 )
- aGroupSeparator = GetString();
+ aGroupSeparator = GetString().getString();
if ( nParamCount >= 2 )
{
- aDecimalSeparator = GetString();
+ aDecimalSeparator = GetString().getString();
if ( aDecimalSeparator.getLength() == 1 )
cDecimalSeparator = aDecimalSeparator[ 0 ];
else
@@ -3377,7 +3383,7 @@ void ScInterpreter::ScNumberValue()
case svDouble:
return; // leave on stack
default:
- aInputString = GetString();
+ aInputString = GetString().getString();
}
if ( nGlobalError )
{
@@ -3444,7 +3450,7 @@ static inline bool lcl_ScInterpreter_IsPrintable( sal_Unicode c )
void ScInterpreter::ScClean()
{
- OUString aStr( GetString() );
+ OUString aStr = GetString().getString();
for ( xub_StrLen i = 0; i < aStr.getLength(); i++ )
{
if ( !lcl_ScInterpreter_IsPrintable( aStr[i] ) )
@@ -3457,7 +3463,7 @@ void ScInterpreter::ScClean()
void ScInterpreter::ScCode()
{
//2do: make it full range unicode?
- OUString aStr = GetString();
+ OUString aStr = GetString().getString();
//"classic" ByteString conversion flags
const sal_uInt32 convertFlags =
RTL_UNICODETOTEXT_FLAGS_NONSPACING_IGNORE |
@@ -3538,7 +3544,7 @@ static OUString lcl_convertIntoFullWidth( const OUString & rStr )
void ScInterpreter::ScJis()
{
if (MustHaveParamCount( GetByte(), 1))
- PushString( lcl_convertIntoFullWidth( GetString()));
+ PushString( lcl_convertIntoFullWidth( GetString().getString()));
}
@@ -3551,20 +3557,20 @@ void ScInterpreter::ScJis()
void ScInterpreter::ScAsc()
{
if (MustHaveParamCount( GetByte(), 1))
- PushString( lcl_convertIntoHalfWidth( GetString()));
+ PushString( lcl_convertIntoHalfWidth( GetString().getString()));
}
void ScInterpreter::ScUnicode()
{
if ( MustHaveParamCount( GetByte(), 1 ) )
{
- const OUString& rStr = GetString();
- if (rStr.isEmpty())
+ OUString aStr = GetString().getString();
+ if (aStr.isEmpty())
PushIllegalParameter();
else
{
sal_Int32 i = 0;
- PushDouble( rStr.iterateCodePoints(&i) );
+ PushDouble(aStr.iterateCodePoints(&i));
}
}
}
@@ -4299,8 +4305,8 @@ void ScInterpreter::ScTable()
{
case svString :
{
- OUString aStr( PopString() );
- if ( pDok->GetTable( aStr, nVal ) )
+ svl::SharedString aStr = PopString();
+ if ( pDok->GetTable(aStr.getString(), nVal))
++nVal;
else
SetError( errIllegalArgument );
@@ -4541,9 +4547,7 @@ void ScInterpreter::ScMatch()
if (nGlobalError == 0)
{
- svl::SharedStringPool& rPool = pDok->GetSharedStringPool();
double fVal;
- OUString sStr;
ScQueryParam rParam;
rParam.nCol1 = nCol1;
rParam.nRow1 = nRow1;
@@ -4568,9 +4572,8 @@ void ScInterpreter::ScMatch()
break;
case svString:
{
- sStr = GetString();
rItem.meType = ScQueryEntry::ByString;
- rItem.maString = rPool.intern(sStr);
+ rItem.maString = GetString();
}
break;
case svDoubleRef :
@@ -4592,9 +4595,8 @@ void ScInterpreter::ScMatch()
}
else
{
- GetCellString(sStr, aCell);
+ GetCellString(rItem.maString, aCell);
rItem.meType = ScQueryEntry::ByString;
- rItem.maString = rPool.intern(sStr);
}
}
break;
@@ -4615,7 +4617,7 @@ void ScInterpreter::ScMatch()
else
{
rItem.meType = ScQueryEntry::ByString;
- rItem.maString = rPool.intern(pToken->GetString());
+ rItem.maString = pToken->GetString();
}
}
break;
@@ -4626,10 +4628,10 @@ void ScInterpreter::ScMatch()
break;
case svMatrix :
{
- OUString aStr;
+ svl::SharedString aStr;
ScMatValType nType = GetDoubleOrStringFromMatrix(
rItem.mfVal, aStr);
- rItem.maString = rPool.intern(aStr);
+ rItem.maString = aStr;
rItem.meType = ScMatrix::IsNonValueType(nType) ?
ScQueryEntry::ByString : ScQueryEntry::ByValue;
}
@@ -4899,7 +4901,7 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
if (pToken->GetType() == svDouble)
pSumExtraMatrix->PutDouble(pToken->GetDouble(), 0, 0);
else
- pSumExtraMatrix->PutString(mrStrPool.intern(pToken->GetString()), 0, 0);
+ pSumExtraMatrix->PutString(pToken->GetString(), 0, 0);
}
break;
case svExternalDoubleRef:
@@ -4911,7 +4913,7 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
}
}
- OUString aString;
+ svl::SharedString aString;
double fVal = 0.0;
bool bIsString = true;
switch ( GetStackType() )
@@ -5112,7 +5114,7 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
}
else
{
- rParam.FillInExcelSyntax(pDok->GetSharedStringPool(), aString, 0);
+ rParam.FillInExcelSyntax(pDok->GetSharedStringPool(), aString.getString(), 0);
sal_uInt32 nIndex = 0;
bool bNumber = pFormatter->IsNumberFormat(
rItem.maString.getString(), nIndex, rItem.mfVal);
@@ -5274,7 +5276,7 @@ void ScInterpreter::ScCountIf()
{
if ( MustHaveParamCount( GetByte(), 2 ) )
{
- OUString aString;
+ svl::SharedString aString;
double fVal = 0.0;
bool bIsString = true;
switch ( GetStackType() )
@@ -5319,8 +5321,7 @@ void ScInterpreter::ScCountIf()
case svExternalSingleRef:
case svExternalDoubleRef:
{
- ScMatValType nType = GetDoubleOrStringFromMatrix( fVal,
- aString);
+ ScMatValType nType = GetDoubleOrStringFromMatrix(fVal, aString);
bIsString = ScMatrix::IsNonValueType( nType);
}
break;
@@ -5412,7 +5413,7 @@ void ScInterpreter::ScCountIf()
}
else
{
- rParam.FillInExcelSyntax(pDok->GetSharedStringPool(), aString, 0);
+ rParam.FillInExcelSyntax(pDok->GetSharedStringPool(), aString.getString(), 0);
sal_uInt32 nIndex = 0;
bool bNumber = pFormatter->IsNumberFormat(
rItem.maString.getString(), nIndex, rItem.mfVal);
@@ -5497,7 +5498,7 @@ double ScInterpreter::IterateParametersIfs( ScIterFuncIfs eFunc )
while (nParamCount > 1 && !nGlobalError)
{
// take criteria
- OUString aString;
+ svl::SharedString aString;
fVal = 0.0;
bool bIsString = true;
switch ( GetStackType() )
@@ -5664,7 +5665,7 @@ double ScInterpreter::IterateParametersIfs( ScIterFuncIfs eFunc )
}
else
{
- rParam.FillInExcelSyntax(pDok->GetSharedStringPool(), aString, 0);
+ rParam.FillInExcelSyntax(pDok->GetSharedStringPool(), aString.getString(), 0);
sal_uInt32 nIndex = 0;
bool bNumber = pFormatter->IsNumberFormat(
rItem.maString.getString(), nIndex, rItem.mfVal);
@@ -5902,7 +5903,7 @@ void ScInterpreter::ScLookup()
// The third parameter, result array, for double, string and single reference.
double fResVal = 0.0;
- OUString aResStr;
+ svl::SharedString aResStr;
ScAddress aResAdr;
StackVar eResArrayType = svUnknown;
@@ -5962,7 +5963,7 @@ void ScInterpreter::ScLookup()
// For double, string and single reference.
double fDataVal = 0.0;
- OUString aDataStr;
+ svl::SharedString aDataStr;
ScAddress aDataAdr;
bool bValueData = false;
@@ -6074,7 +6075,7 @@ void ScInterpreter::ScLookup()
if (rItem.meType != ScQueryEntry::ByString)
bFound = false;
else
- bFound = (ScGlobal::GetCollator()->compareString(aDataStr, rItem.maString.getString()) <= 0);
+ bFound = (ScGlobal::GetCollator()->compareString(aDataStr.getString(), rItem.maString.getString()) <= 0);
}
if (!bFound)
@@ -6088,7 +6089,7 @@ void ScInterpreter::ScLookup()
if (pResMat->IsValue( 0, 0 ))
PushDouble(pResMat->GetDouble( 0, 0 ));
else
- PushString(pResMat->GetString(0, 0).getString());
+ PushString(pResMat->GetString(0, 0));
}
else if (nParamCount == 3)
{
@@ -6293,14 +6294,14 @@ void ScInterpreter::ScLookup()
if (pDataMat->IsValue(nC-1, nDelta))
PushDouble(pDataMat->GetDouble(nC-1, nDelta));
else
- PushString(pDataMat->GetString(nC-1, nDelta).getString());
+ PushString(pDataMat->GetString(nC-1, nDelta));
}
else
{
if (pDataMat->IsValue(nDelta, nR-1))
PushDouble(pDataMat->GetDouble(nDelta, nR-1));
else
- PushString(pDataMat->GetString(nDelta, nR-1).getString());
+ PushString(pDataMat->GetString(nDelta, nR-1));
}
}
@@ -6705,7 +6706,6 @@ void ScInterpreter::CalculateLookup(bool bHLookup)
bool ScInterpreter::FillEntry(ScQueryEntry& rEntry)
{
ScQueryEntry::Item& rItem = rEntry.GetQueryItem();
- svl::SharedStringPool& rPool = pDok->GetSharedStringPool();
switch ( GetStackType() )
{
case svDouble:
@@ -6716,9 +6716,8 @@ bool ScInterpreter::FillEntry(ScQueryEntry& rEntry)
break;
case svString:
{
- const OUString& sStr = GetString();
rItem.meType = ScQueryEntry::ByString;
- rItem.maString = rPool.intern(sStr);
+ rItem.maString = GetString();
}
break;
case svDoubleRef :
@@ -6739,18 +6738,16 @@ bool ScInterpreter::FillEntry(ScQueryEntry& rEntry)
}
else
{
- OUString aStr;
- GetCellString(aStr, aCell);
+ GetCellString(rItem.maString, aCell);
rItem.meType = ScQueryEntry::ByString;
- rItem.maString = rPool.intern(aStr);
}
}
break;
case svMatrix :
{
- OUString aStr;
+ svl::SharedString aStr;
const ScMatValType nType = GetDoubleOrStringFromMatrix(rItem.mfVal, aStr);
- rItem.maString = rPool.intern(aStr);
+ rItem.maString = aStr;
rItem.meType = ScMatrix::IsNonValueType(nType) ?
ScQueryEntry::ByString : ScQueryEntry::ByValue;
}
@@ -6836,7 +6833,7 @@ ScDBQueryParamBase* ScInterpreter::GetDBParams( bool& rMissingField )
bool bByVal = true;
double nVal = 0.0;
- OUString aStr;
+ svl::SharedString aStr;
ScRange aMissingRange;
bool bRangeFake = false;
switch (GetStackType())
@@ -6919,7 +6916,7 @@ ScDBQueryParamBase* ScInterpreter::GetDBParams( bool& rMissingField )
else
{
sal_uInt16 nErr = 0;
- nField = pDBRef->findFieldColumn(aStr, &nErr);
+ nField = pDBRef->findFieldColumn(aStr.getString(), &nErr);
SetError(nErr);
}
@@ -7248,7 +7245,7 @@ void ScInterpreter::ScIndirect()
}
const ScAddress::Details aDetails( eConv, aPos );
SCTAB nTab = aPos.Tab();
- OUString sRefStr( GetString() );
+ OUString sRefStr = GetString().getString();
ScRefAddress aRefAd, aRefAd2;
ScAddress::ExternalInfo aExtInfo;
if (ConvertDoubleRef(pDok, sRefStr, nTab, aRefAd, aRefAd2, aDetails, &aExtInfo))
@@ -7320,7 +7317,7 @@ void ScInterpreter::ScAddressFunc()
return;
if( nParamCount >= 5 )
- sTabStr = GetString();
+ sTabStr = GetString().getString();
FormulaGrammar::AddressConvention eConv = FormulaGrammar::CONV_OOO; // default
if( nParamCount >= 4 && 0.0 == ::rtl::math::approxFloor( GetDoubleWithDefault( 1.0)))
@@ -7870,10 +7867,10 @@ void ScInterpreter::ScReplace()
{
if ( MustHaveParamCount( GetByte(), 4 ) )
{
- OUString aNewStr( GetString() );
+ OUString aNewStr = GetString().getString();
double fCount = ::rtl::math::approxFloor( GetDouble());
double fPos = ::rtl::math::approxFloor( GetDouble());
- OUString aOldStr( GetString() );
+ OUString aOldStr = GetString().getString();
if (fPos < 1.0 || fPos > static_cast<double>(STRING_MAXLEN)
|| fCount < 0.0 || fCount > static_cast<double>(STRING_MAXLEN))
PushIllegalArgument();
@@ -7963,12 +7960,12 @@ void ScInterpreter::ScFind()
fAnz = GetDouble();
else
fAnz = 1.0;
- OUString sStr = GetString();
+ OUString sStr = GetString().getString();
if( fAnz < 1.0 || fAnz > (double) sStr.getLength() )
PushNoValue();
else
{
- sal_Int32 nPos = sStr.indexOf( GetString(), (xub_StrLen) fAnz - 1 );
+ sal_Int32 nPos = sStr.indexOf(GetString().getString(), static_cast<sal_Int32>(fAnz - 1));
if (nPos == -1)
PushNoValue();
else
@@ -7983,9 +7980,9 @@ void ScInterpreter::ScExact()
nFuncFmtType = NUMBERFORMAT_LOGICAL;
if ( MustHaveParamCount( GetByte(), 2 ) )
{
- OUString s1( GetString() );
- OUString s2( GetString() );
- PushInt( s1 == s2 );
+ svl::SharedString s1 = GetString();
+ svl::SharedString s2 = GetString();
+ PushInt( s1.getData() == s2.getData() );
}
}
@@ -8009,7 +8006,7 @@ void ScInterpreter::ScLeft()
}
else
n = 1;
- OUString aStr( GetString() );
+ OUString aStr = GetString().getString();
aStr = aStr.copy( 0, n );
PushString( aStr );
}
@@ -8067,7 +8064,7 @@ sal_Int32 getLengthB(const OUString &str)
}
void ScInterpreter::ScLenB()
{
- PushDouble( getLengthB(GetString()) );
+ PushDouble( getLengthB(GetString().getString()) );
}
OUString lcl_RightB(const OUString &rStr, sal_Int32 n)
{
@@ -8116,7 +8113,7 @@ void ScInterpreter::ScRightB()
}
else
n = 1;
- OUString aStr(lcl_RightB(GetString(), n));
+ OUString aStr(lcl_RightB(GetString().getString(), n));
PushString( aStr );
}
}
@@ -8167,7 +8164,7 @@ void ScInterpreter::ScLeftB()
}
else
n = 1;
- OUString aStr(lcl_LeftB(GetString(), n));
+ OUString aStr(lcl_LeftB(GetString().getString(), n));
PushString( aStr );
}
}
@@ -8177,7 +8174,7 @@ void ScInterpreter::ScMidB()
{
double fAnz = ::rtl::math::approxFloor(GetDouble());
double fAnfang = ::rtl::math::approxFloor(GetDouble());
- OUString aStr( GetString() );
+ OUString aStr = GetString().getString();
if (fAnfang < 1.0 || fAnz < 0.0 || fAnfang > double(STRING_MAXLEN) || fAnz > double(STRING_MAXLEN))
PushIllegalArgument();
else
@@ -8210,7 +8207,7 @@ void ScInterpreter::ScRight()
}
else
n = 1;
- OUString aStr( GetString() );
+ OUString aStr = GetString().getString();
if( n < aStr.getLength() )
aStr = aStr.copy( aStr.getLength() - n );
PushString( aStr );
@@ -8235,8 +8232,8 @@ void ScInterpreter::ScSearch()
}
else
fAnz = 1.0;
- OUString sStr = GetString();
- OUString SearchStr = GetString();
+ OUString sStr = GetString().getString();
+ OUString SearchStr = GetString().getString();
sal_Int32 nPos = fAnz - 1;
sal_Int32 nEndPos = sStr.getLength();
if( nPos >= nEndPos )
@@ -8264,11 +8261,11 @@ void ScInterpreter::ScMid()
{
double fAnz = ::rtl::math::approxFloor(GetDouble());
double fAnfang = ::rtl::math::approxFloor(GetDouble());
- OUString aStr = GetString();
+ OUString aStr = GetString().getString();
if (fAnfang < 1.0 || fAnz < 0.0 || fAnfang > double(STRING_MAXLEN) || fAnz > double(STRING_MAXLEN))
PushIllegalArgument();
else
- PushString(aStr.copy( (xub_StrLen) fAnfang - 1, (xub_StrLen) fAnz ));
+ PushString(aStr.copy(static_cast<sal_Int32>(fAnfang-1), static_cast<sal_Int32>(fAnz)));
}
}
@@ -8277,8 +8274,8 @@ void ScInterpreter::ScText()
{
if ( MustHaveParamCount( GetByte(), 2 ) )
{
- const OUString& sFormatString = GetString();
- OUString aStr;
+ OUString sFormatString = GetString().getString();
+ svl::SharedString aStr;
bool bString = false;
double fVal = 0.0;
switch (GetStackType())
@@ -8328,7 +8325,7 @@ void ScInterpreter::ScText()
eCellLang = ScGlobal::eLnge;
if (bString)
{
- if (!pFormatter->GetPreviewString( sFormatString, aStr,
+ if (!pFormatter->GetPreviewString( sFormatString, aStr.getString(),
aResult, &pColor, eCellLang))
PushIllegalArgument();
else
@@ -8366,9 +8363,9 @@ void ScInterpreter::ScSubstitute()
}
else
nAnz = 0;
- OUString sNewStr = GetString();
- OUString sOldStr = GetString();
- OUString sStr = GetString();
+ OUString sNewStr = GetString().getString();
+ OUString sOldStr = GetString().getString();
+ OUString sStr = GetString().getString();
sal_Int32 nPos = 0;
xub_StrLen nCount = 0;
xub_StrLen nNewLen = sNewStr.getLength();
@@ -8406,7 +8403,7 @@ void ScInterpreter::ScRept()
if ( MustHaveParamCount( GetByte(), 2 ) )
{
double fAnz = ::rtl::math::approxFloor(GetDouble());
- OUString aStr( GetString() );
+ OUString aStr = GetString().getString();
if ( fAnz < 0.0 )
PushIllegalArgument();
else if ( fAnz * aStr.getLength() > STRING_MAXLEN )
@@ -8434,8 +8431,8 @@ void ScInterpreter::ScConcat()
OUString aRes;
while( nParamCount-- > 0)
{
- const OUString& rStr = GetString();
- aRes = rStr + aRes;
+ OUString aStr = GetString().getString();
+ aRes = aStr + aRes;
}
PushString( aRes );
}
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 3797c42..3d13382 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -163,7 +163,7 @@ void ScInterpreter::ScGetHour()
void ScInterpreter::ScGetDateValue()
{
- const OUString& aInputString = GetString();
+ OUString aInputString = GetString().getString();
sal_uInt32 nFIndex = 0; // damit default Land/Spr.
double fVal;
if (pFormatter->IsNumberFormat(aInputString, nFIndex, fVal))
@@ -389,7 +389,7 @@ void ScInterpreter::ScGetDateDif()
{
if ( MustHaveParamCount( GetByte(), 3 ) )
{
- const OUString& aInterval = GetString();
+ OUString aInterval = GetString().getString();
double nDate2 = GetDouble();
double nDate1 = GetDouble();
@@ -532,7 +532,7 @@ void ScInterpreter::ScGetDateDif()
void ScInterpreter::ScGetTimeValue()
{
- OUString aInputString = GetString();
+ OUString aInputString = GetString().getString();
sal_uInt32 nFIndex = 0; // damit default Land/Spr.
double fVal;
if (pFormatter->IsNumberFormat(aInputString, nFIndex, fVal))
@@ -1941,11 +1941,11 @@ void ScInterpreter::ScStyle()
{
OUString aStyle2; // Vorlage nach Timer
if (nParamCount >= 3)
- aStyle2 = GetString();
+ aStyle2 = GetString().getString();
long nTimeOut = 0; // Timeout
if (nParamCount >= 2)
nTimeOut = (long)(GetDouble()*1000.0);
- OUString aStyle1 = GetString(); // Vorlage fuer sofort
+ OUString aStyle1 = GetString().getString(); // Vorlage fuer sofort
if (nTimeOut < 0)
nTimeOut = 0;
@@ -2005,9 +2005,9 @@ void ScInterpreter::ScDde()
sal_uInt8 nMode = SC_DDE_DEFAULT;
if (nParamCount == 4)
nMode = (sal_uInt8) ::rtl::math::approxFloor(GetDouble());
- OUString aItem = GetString();
- OUString aTopic = GetString();
- OUString aAppl = GetString();
+ OUString aItem = GetString().getString();
+ OUString aTopic = GetString().getString();
+ OUString aAppl = GetString().getString();
if (nMode > SC_DDE_TEXT)
nMode = SC_DDE_DEFAULT;
@@ -2226,7 +2226,7 @@ void ScInterpreter::ScDecimal()
if ( MustHaveParamCount( GetByte(), 2 ) )
{
double fBase = ::rtl::math::approxFloor( GetDouble() );
- OUString aStr( GetString() );
+ OUString aStr = GetString().getString();
if ( !nGlobalError && 2 <= fBase && fBase <= 36 )
{
double fVal = 0.0;
@@ -2281,8 +2281,8 @@ void ScInterpreter::ScConvert()
{ // Value, FromUnit, ToUnit
if ( MustHaveParamCount( GetByte(), 3 ) )
{
- OUString aToUnit( GetString() );
- OUString aFromUnit( GetString() );
+ OUString aToUnit = GetString().getString();
+ OUString aFromUnit = GetString().getString();
double fVal = GetDouble();
if ( nGlobalError )
PushError( nGlobalError);
@@ -2388,7 +2388,7 @@ static bool lcl_GetArabicValue( sal_Unicode cChar, sal_uInt16& rnValue, bool& rb
void ScInterpreter::ScArabic()
{
- OUString aRoman( GetString() );
+ OUString aRoman = GetString().getString();
if( nGlobalError )
PushError( nGlobalError);
else
@@ -2449,7 +2449,7 @@ void ScInterpreter::ScHyperLink()
if ( MustHaveParamCount( nParamCount, 1, 2 ) )
{
double fVal = 0.0;
- OUString aStr;
+ svl::SharedString aStr;
ScMatValType nResultType = SC_MATVAL_STRING;
if ( nParamCount == 2 )
@@ -2504,7 +2504,7 @@ void ScInterpreter::ScHyperLink()
SetError( errIllegalArgument);
}
}
- OUString aUrl = GetString();
+ svl::SharedString aUrl = GetString();
ScMatrixRef pResMat = GetNewMat( 1, 2);
if (nGlobalError)
{
@@ -2516,13 +2516,13 @@ void ScInterpreter::ScHyperLink()
if (ScMatrix::IsValueType( nResultType))
pResMat->PutDouble( fVal, 0);
else if (ScMatrix::IsRealStringType( nResultType))
- pResMat->PutString(mrStrPool.intern(aStr), 0);
+ pResMat->PutString(aStr, 0);
else // EmptyType, EmptyPathType, mimic xcl
pResMat->PutDouble( 0.0, 0 );
}
else
- pResMat->PutString(mrStrPool.intern(aUrl), 0);
- pResMat->PutString(mrStrPool.intern(aUrl), 1);
+ pResMat->PutString(aUrl, 0);
+ pResMat->PutString(aUrl, 1);
bMatrixFormula = true;
PushMatrix(pResMat);
}
@@ -2585,8 +2585,8 @@ void ScInterpreter::ScEuroConvert()
bool bFullPrecision = false;
if ( nParamCount >= 4 )
bFullPrecision = GetBool();
- OUString aToUnit( GetString() );
- OUString aFromUnit( GetString() );
+ OUString aToUnit = GetString().getString();
+ OUString aFromUnit = GetString().getString();
double fVal = GetDouble();
if ( nGlobalError )
PushError( nGlobalError);
@@ -2829,7 +2829,7 @@ void ScInterpreter::ScGetPivotData()
}
std::vector<sheet::DataPilotFieldFilter> aFilters;
- OUString aDataFieldName;
+ svl::SharedString aDataFieldName;
ScRange aBlock;
if (bOldSyntax)
@@ -2864,8 +2864,8 @@ void ScInterpreter::ScGetPivotData()
while (i-- > 0)
{
//! should allow numeric constraint values
- aFilters[i].MatchValue = GetString();
- aFilters[i].FieldName = GetString();
+ aFilters[i].MatchValue = GetString().getString();
+ aFilters[i].FieldName = GetString().getString();
}
switch (GetStackType())
@@ -2898,7 +2898,7 @@ void ScInterpreter::ScGetPivotData()
return;
}
- double fVal = pDPObj->GetPivotData(aDataFieldName, aFilters);
+ double fVal = pDPObj->GetPivotData(aDataFieldName.getString(), aFilters);
if (rtl::math::isNan(fVal))
{
PushError(errNoRef);
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 4435907..4e83602 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -461,8 +461,7 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, ScRefCellValue&
}
else
{
- OUString aStr = pFCell->GetString();
- fValue = ConvertStringToValue( aStr );
+ fValue = ConvertStringToValue(pFCell->GetString().getString());
}
}
else
@@ -498,7 +497,7 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, ScRefCellValue&
return fValue;
}
-void ScInterpreter::GetCellString( OUString& rStr, ScRefCellValue& rCell )
+void ScInterpreter::GetCellString( svl::SharedString& rStr, ScRefCellValue& rCell )
{
sal_uInt16 nErr = 0;
@@ -506,7 +505,7 @@ void ScInterpreter::GetCellString( OUString& rStr, ScRefCellValue& rCell )
{
case CELLTYPE_STRING:
case CELLTYPE_EDIT:
- rStr = rCell.getString(pDok);
+ rStr = mrStrPool.intern(rCell.getString(pDok));
break;
case CELLTYPE_FORMULA:
{
@@ -518,7 +517,9 @@ void ScInterpreter::GetCellString( OUString& rStr, ScRefCellValue& rCell )
sal_uLong nIndex = pFormatter->GetStandardFormat(
NUMBERFORMAT_NUMBER,
ScGlobal::eLnge);
- pFormatter->GetInputLineString(fVal, nIndex, rStr);
+ OUString aStr;
+ pFormatter->GetInputLineString(fVal, nIndex, aStr);
+ rStr = mrStrPool.intern(aStr);
}
else
rStr = pFCell->GetString();
@@ -530,11 +531,13 @@ void ScInterpreter::GetCellString( OUString& rStr, ScRefCellValue& rCell )
sal_uLong nIndex = pFormatter->GetStandardFormat(
NUMBERFORMAT_NUMBER,
ScGlobal::eLnge);
- pFormatter->GetInputLineString(fVal, nIndex, rStr);
+ OUString aStr;
+ pFormatter->GetInputLineString(fVal, nIndex, aStr);
+ rStr = mrStrPool.intern(aStr);
}
break;
default:
- rStr = ScGlobal::GetEmptyString();
+ rStr = svl::SharedString::getEmptyString();
break;
}
@@ -676,7 +679,7 @@ bool ScInterpreter::CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
if (!aCell.mpFormula->IsValue())
{
nErr = aCell.mpFormula->GetErrCode();
- aStr = aCell.mpFormula->GetString();
+ aStr = aCell.mpFormula->GetString().getString();
}
else
bOk = false;
@@ -785,7 +788,7 @@ bool ScInterpreter::CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
if (aCell.mpFormula->IsValue())
nVal = aCell.mpFormula->GetValue();
else
- aStr = aCell.mpFormula->GetString();
+ aStr = aCell.mpFormula->GetString().getString();
break;
default :
bOk = false;
@@ -978,7 +981,7 @@ void ScInterpreter::PushCellResultToken( bool bDisplayEmptyAsString,
}
else if (aCell.hasString())
{
- OUString aRes;
+ svl::SharedString aRes;
GetCellString( aRes, aCell);
PushString( aRes);
if (pRetTypeExpr)
@@ -1068,7 +1071,7 @@ double ScInterpreter::PopDouble()
}
-const OUString& ScInterpreter::PopString()
+svl::SharedString ScInterpreter::PopString()
{
nCurFmtType = NUMBERFORMAT_TEXT;
nCurFmtIndex = 0;
@@ -1082,18 +1085,18 @@ const OUString& ScInterpreter::PopString()
nGlobalError = p->GetError();
break;
case svString:
- aTempStr = p->GetString();
- return aTempStr;
+ return p->GetString();
case svEmptyCell:
case svMissing:
- return EMPTY_OUSTRING;
+ return svl::SharedString::getEmptyString();
default:
SetError( errIllegalArgument);
}
}
else
SetError( errUnknownStackVariable);
- return EMPTY_OUSTRING;
+
+ return svl::SharedString::getEmptyString();
}
@@ -1401,7 +1404,7 @@ void ScInterpreter::PopExternalSingleRef(sal_uInt16& rFileId, OUString& rTabName
}
rFileId = p->GetIndex();
- rTabName = p->GetString();
+ rTabName = p->GetString().getString();
rRef = static_cast<ScToken*>(p)->GetSingleRef();
}
@@ -1477,7 +1480,7 @@ void ScInterpreter::PopExternalDoubleRef(sal_uInt16& rFileId, OUString& rTabName
}
rFileId = p->GetIndex();
- rTabName = p->GetString();
+ rTabName = p->GetString().getString();
rRef = static_cast<ScToken*>(p)->GetDoubleRef();
}
@@ -1689,10 +1692,10 @@ bool ScInterpreter::ConvertMatrixParameters()
if (eType == ScParameterClassification::Array)
{
sal_uInt16 nFileId = p->GetIndex();
- const OUString& rTabName = p->GetString();
+ OUString aTabName = p->GetString().getString();
const ScComplexRefData& rRef = static_cast<ScToken*>(p)->GetDoubleRef();
ScExternalRefCache::TokenArrayRef pArray;
- GetExternalDoubleRef(nFileId, rTabName, rRef, pArray);
+ GetExternalDoubleRef(nFileId, aTabName, rRef, pArray);
if (nGlobalError)
break;
@@ -1896,13 +1899,20 @@ void ScInterpreter::PushInt(int nVal)
void ScInterpreter::PushStringBuffer( const sal_Unicode* pString )
{
if ( pString )
- PushString( OUString(pString) );
+ {
+ svl::SharedString aSS = pDok->GetSharedStringPool().intern(OUString(pString));
+ PushString(aSS);
+ }
else
- PushString( EMPTY_STRING );
+ PushString(svl::SharedString::getEmptyString());
}
+void ScInterpreter::PushString( const OUString& rStr )
+{
+ PushString(pDok->GetSharedStringPool().intern(rStr));
+}
-void ScInterpreter::PushString( const OUString& rString )
+void ScInterpreter::PushString( const svl::SharedString& rString )
{
if (!IfErrorPushError())
PushTempTokenWithoutError( new FormulaStringToken( rString ) );
@@ -2187,7 +2197,7 @@ double ScInterpreter::GetDouble()
nVal = PopDouble();
break;
case svString:
- nVal = ConvertStringToValue( PopString());
+ nVal = ConvertStringToValue( PopString().getString());
break;
case svSingleRef:
{
@@ -2267,25 +2277,26 @@ double ScInterpreter::GetDoubleWithDefault(double nDefault)
}
-const OUString& ScInterpreter::GetString()
+svl::SharedString ScInterpreter::GetString()
{
switch (GetRawStackType())
{
case svError:
PopError();
- return EMPTY_OUSTRING;
+ return svl::SharedString::getEmptyString();
case svMissing:
case svEmptyCell:
Pop();
- return EMPTY_OUSTRING;
+ return svl::SharedString::getEmptyString();
case svDouble:
{
double fVal = PopDouble();
sal_uLong nIndex = pFormatter->GetStandardFormat(
NUMBERFORMAT_NUMBER,
ScGlobal::eLnge);
- pFormatter->GetInputLineString(fVal, nIndex, aTempStr);
- return aTempStr;
+ OUString aStr;
+ pFormatter->GetInputLineString(fVal, nIndex, aStr);
+ return mrStrPool.intern(aStr);
}
case svString:
return PopString();
@@ -2297,11 +2308,12 @@ const OUString& ScInterpreter::GetString()
{
ScRefCellValue aCell;
aCell.assign(*pDok, aAdr);
- GetCellString(aTempStr, aCell);
- return aTempStr;
+ svl::SharedString aSS;
+ GetCellString(aSS, aCell);
+ return aSS;
}
else
- return EMPTY_OUSTRING;
+ return svl::SharedString::getEmptyString();
}
case svDoubleRef:
{ // generate position dependent SingleRef
@@ -2312,21 +2324,21 @@ const OUString& ScInterpreter::GetString()
{
ScRefCellValue aCell;
aCell.assign(*pDok, aAdr);
- GetCellString(aTempStr, aCell);
- return aTempStr;
+ svl::SharedString aSS;
+ GetCellString(aSS, aCell);
+ return aSS;
}
else
- return EMPTY_OUSTRING;
+ return svl::SharedString::getEmptyString();
}
case svExternalSingleRef:
{
ScExternalRefCache::TokenRef pToken;
PopExternalSingleRef(pToken);
if (nGlobalError)
- return EMPTY_OUSTRING;
+ return svl::SharedString::getEmptyString();
- aTempStr = pToken->GetString();
- return aTempStr;
+ return pToken->GetString();
}
case svExternalDoubleRef:
{
@@ -2344,17 +2356,16 @@ const OUString& ScInterpreter::GetString()
PopError();
SetError( errIllegalArgument);
}
- return EMPTY_OUSTRING;
+ return svl::SharedString::getEmptyString();
}
-const OUString& ScInterpreter::GetStringFromMatrix(const ScMatrixRef& pMat)
+svl::SharedString ScInterpreter::GetStringFromMatrix(const ScMatrixRef& pMat)
{
if ( !pMat )
; // nothing
else if ( !pJumpMatrix )
{
- aTempStr = pMat->GetString( *pFormatter, 0, 0).getString();
- return aTempStr;
+ return pMat->GetString( *pFormatter, 0, 0);
}
else
{
@@ -2363,21 +2374,20 @@ const OUString& ScInterpreter::GetStringFromMatrix(const ScMatrixRef& pMat)
pJumpMatrix->GetPos( nC, nR);
if ( nC < nCols && nR < nRows )
{
- aTempStr = pMat->GetString( *pFormatter, nC, nR).getString();
- return aTempStr;
+ return pMat->GetString( *pFormatter, nC, nR);
}
else
SetError( errNoValue);
}
- return EMPTY_OUSTRING;
+ return svl::SharedString::getEmptyString();
}
ScMatValType ScInterpreter::GetDoubleOrStringFromMatrix(
- double& rDouble, OUString& rString )
+ double& rDouble, svl::SharedString& rString )
{
rDouble = 0.0;
- rString = EMPTY_OUSTRING;
+ rString = svl::SharedString::getEmptyString();
ScMatValType nMatValType = SC_MATVAL_EMPTY;
ScMatrixRef pMat;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list