diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-09-07 11:13:47 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-09-07 12:55:45 +0200 |
commit | 801a657ea62365974d96033e95e2fa6174f751cc (patch) | |
tree | 2fe0af3a915245b5c3fb7845f371f3a3845685ff | |
parent | 8d36b558beb0c88d186b027f16c5d7d2da3afa59 (diff) |
iString to OUString in some calc core code
Change-Id: I25fc70cfd01f5ad25f7362157796d3ddf06139e1
-rw-r--r-- | formula/source/core/api/token.cxx | 36 | ||||
-rw-r--r-- | include/formula/token.hxx | 30 | ||||
-rw-r--r-- | include/formula/tokenarray.hxx | 8 | ||||
-rw-r--r-- | sc/inc/compiler.hxx | 6 | ||||
-rw-r--r-- | sc/inc/fmtuno.hxx | 8 | ||||
-rw-r--r-- | sc/inc/formularesult.hxx | 4 | ||||
-rw-r--r-- | sc/inc/token.hxx | 26 | ||||
-rw-r--r-- | sc/inc/tokenarray.hxx | 6 | ||||
-rw-r--r-- | sc/inc/validat.hxx | 59 | ||||
-rw-r--r-- | sc/source/core/data/validat.cxx | 113 | ||||
-rw-r--r-- | sc/source/core/inc/interpre.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/formularesult.cxx | 16 | ||||
-rw-r--r-- | sc/source/core/tool/reftokenhelper.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/token.cxx | 69 | ||||
-rw-r--r-- | sc/source/filter/excel/xecontent.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/excel/xelink.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/chart2uno.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/unoobj/fmtuno.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh2.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/tabview3.cxx | 4 |
20 files changed, 205 insertions, 218 deletions
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index 9ea036cd1f23..da9c6f873b34 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -174,10 +174,10 @@ double & FormulaToken::GetDoubleAsReference() return fVal; } -const String& FormulaToken::GetString() const +const OUString& FormulaToken::GetString() const { SAL_WARN( "formula.core", "FormulaToken::GetString: virtual dummy called" ); - static String aDummyString; + static OUString aDummyString; return aDummyString; } @@ -210,10 +210,10 @@ short* FormulaToken::GetJump() const } -const String& FormulaToken::GetExternal() const +const OUString& FormulaToken::GetExternal() const { SAL_WARN( "formula.core", "FormulaToken::GetExternal: virtual dummy called" ); - static String aDummyString; + static OUString aDummyString; return aDummyString; } @@ -304,7 +304,7 @@ bool FormulaTokenArray::AddFormulaToken(const sheet::FormulaToken& _aToken,Exter break; case uno::TypeClass_STRING: { - String aStrVal( _aToken.Data.get<OUString>() ); + OUString aStrVal( _aToken.Data.get<OUString>() ); if ( eOpCode == ocPush ) AddString( aStrVal ); else if ( eOpCode == ocBad ) @@ -756,7 +756,7 @@ FormulaToken* FormulaTokenArray::AddString( const sal_Unicode* pStr ) return AddString( OUString( pStr ) ); } -FormulaToken* FormulaTokenArray::AddString( const String& rStr ) +FormulaToken* FormulaTokenArray::AddString( const OUString& rStr ) { return Add( new FormulaStringToken( rStr ) ); } @@ -771,18 +771,18 @@ FormulaToken* FormulaTokenArray::AddExternal( const sal_Unicode* pStr ) return AddExternal( OUString( pStr ) ); } -FormulaToken* FormulaTokenArray::AddExternal( const String& rStr, +FormulaToken* FormulaTokenArray::AddExternal( const OUString& rStr, OpCode eOp /* = ocExternal */ ) { return Add( new FormulaExternalToken( eOp, rStr ) ); } -FormulaToken* FormulaTokenArray::AddBad( const String& rStr ) +FormulaToken* FormulaTokenArray::AddBad( const OUString& rStr ) { return Add( new FormulaStringOpToken( ocBad, rStr ) ); } -FormulaToken* FormulaTokenArray::AddStringXML( const String& rStr ) +FormulaToken* FormulaTokenArray::AddStringXML( const OUString& rStr ) { return Add( new FormulaStringOpToken( ocStringXML, rStr ) ); } @@ -977,19 +977,19 @@ bool FormulaMissingContext::AddMissingExternal( FormulaTokenArray *pNewArr ) con { // Only called for PODF, not ODFF. No need to distinguish. - const String &rName = mpFunc->GetExternal(); + const OUString &rName = mpFunc->GetExternal(); // initial (fast) check: - sal_Unicode nLastChar = rName.GetChar( rName.Len() - 1); + sal_Unicode nLastChar = rName[ rName.getLength() - 1]; if ( nLastChar != 't' && nLastChar != 'm' ) return false; - if (rName.EqualsIgnoreCaseAscii( + if (rName.equalsIgnoreAsciiCase( "com.sun.star.sheet.addin.Analysis.getAccrint" )) { return AddDefaultArg( pNewArr, 4, 1000.0 ); } - if (rName.EqualsIgnoreCaseAscii( + if (rName.equalsIgnoreAsciiCase( "com.sun.star.sheet.addin.Analysis.getAccrintm" )) { return AddDefaultArg( pNewArr, 3, 1000.0 ); @@ -1324,14 +1324,14 @@ bool FormulaDoubleToken::operator==( const FormulaToken& r ) const } -const String& FormulaStringToken::GetString() const { return aString; } +const OUString& FormulaStringToken::GetString() const { return aString; } bool FormulaStringToken::operator==( const FormulaToken& r ) const { return FormulaToken::operator==( r ) && aString == r.GetString(); } -const String& FormulaStringOpToken::GetString() const { return aString; } +const OUString& FormulaStringOpToken::GetString() const { return aString; } bool FormulaStringOpToken::operator==( const FormulaToken& r ) const { return FormulaByteToken::operator==( r ) && aString == r.GetString(); @@ -1346,7 +1346,7 @@ bool FormulaIndexToken::operator==( const FormulaToken& r ) const return FormulaToken::operator==( r ) && nIndex == r.GetIndex() && mbGlobal == r.IsGlobal(); } -const String& FormulaExternalToken::GetExternal() const { return aExternal; } +const OUString& FormulaExternalToken::GetExternal() const { return aExternal; } sal_uInt8 FormulaExternalToken::GetByte() const { return nByte; } void FormulaExternalToken::SetByte( sal_uInt8 n ) { nByte = n; } bool FormulaExternalToken::operator==( const FormulaToken& r ) const @@ -1364,9 +1364,9 @@ bool FormulaErrorToken::operator==( const FormulaToken& r ) const nError == static_cast< const FormulaErrorToken & >(r).GetError(); } double FormulaMissingToken::GetDouble() const { return 0.0; } -const String& FormulaMissingToken::GetString() const +const OUString& FormulaMissingToken::GetString() const { - static String aDummyString; + static OUString aDummyString; return aDummyString; } bool FormulaMissingToken::operator==( const FormulaToken& r ) const diff --git a/include/formula/token.hxx b/include/formula/token.hxx index c7fa0cd44ee3..d9486be9efe9 100644 --- a/include/formula/token.hxx +++ b/include/formula/token.hxx @@ -136,13 +136,13 @@ public: virtual void SetForceArray( bool b ); virtual double GetDouble() const; virtual double& GetDoubleAsReference(); - virtual const String& GetString() const; + virtual const OUString& GetString() const; virtual sal_uInt16 GetIndex() const; virtual void SetIndex( sal_uInt16 n ); virtual bool IsGlobal() const; virtual void SetGlobal( bool b ); virtual short* GetJump() const; - virtual const String& GetExternal() const; + virtual const OUString& GetExternal() const; virtual FormulaToken* GetFAPOrigToken() const; virtual sal_uInt16 GetError() const; virtual void SetError( sal_uInt16 ); @@ -169,8 +169,8 @@ public: static size_t GetStrLenBytes( xub_StrLen nLen ) { return nLen * sizeof(sal_Unicode); } - static size_t GetStrLenBytes( const String& rStr ) - { return GetStrLenBytes( rStr.Len() ); } + static size_t GetStrLenBytes( const OUString& rStr ) + { return GetStrLenBytes( rStr.getLength() ); } }; inline void intrusive_ptr_add_ref(const FormulaToken* p) @@ -257,15 +257,15 @@ public: class FORMULA_DLLPUBLIC FormulaStringToken : public FormulaToken { private: - String aString; + OUString aString; public: - FormulaStringToken( const String& r ) : + FormulaStringToken( const OUString& r ) : FormulaToken( svString ), aString( r ) {} FormulaStringToken( const FormulaStringToken& r ) : FormulaToken( r ), aString( r.aString ) {} virtual FormulaToken* Clone() const { return new FormulaStringToken(*this); } - virtual const String& GetString() const; + virtual const OUString& GetString() const; virtual bool operator==( const FormulaToken& rToken ) const; DECL_FIXEDMEMPOOL_NEWDEL_DLL( FormulaStringToken ) @@ -277,15 +277,15 @@ public: class FORMULA_DLLPUBLIC FormulaStringOpToken : public FormulaByteToken { private: - String aString; + OUString aString; public: - FormulaStringOpToken( OpCode e, const String& r ) : + FormulaStringOpToken( OpCode e, const OUString& r ) : FormulaByteToken( e, 0, svString, false ), aString( r ) {} FormulaStringOpToken( const FormulaStringOpToken& r ) : FormulaByteToken( r ), aString( r.aString ) {} virtual FormulaToken* Clone() const { return new FormulaStringOpToken(*this); } - virtual const String& GetString() const; + virtual const OUString& GetString() const; virtual bool operator==( const FormulaToken& rToken ) const; }; @@ -312,13 +312,13 @@ public: class FORMULA_DLLPUBLIC FormulaExternalToken : public FormulaToken { private: - String aExternal; + OUString aExternal; sal_uInt8 nByte; public: - FormulaExternalToken( OpCode e, sal_uInt8 n, const String& r ) : + FormulaExternalToken( OpCode e, sal_uInt8 n, const OUString& r ) : FormulaToken( svExternal, e ), aExternal( r ), nByte( n ) {} - FormulaExternalToken( OpCode e, const String& r ) : + FormulaExternalToken( OpCode e, const OUString& r ) : FormulaToken(svExternal, e ), aExternal( r ), nByte( 0 ) {} FormulaExternalToken( const FormulaExternalToken& r ) : @@ -326,7 +326,7 @@ public: nByte( r.nByte ) {} virtual FormulaToken* Clone() const { return new FormulaExternalToken(*this); } - virtual const String& GetExternal() const; + virtual const OUString& GetExternal() const; virtual sal_uInt8 GetByte() const; virtual void SetByte( sal_uInt8 n ); virtual bool operator==( const FormulaToken& rToken ) const; @@ -343,7 +343,7 @@ public: virtual FormulaToken* Clone() const { return new FormulaMissingToken(*this); } virtual double GetDouble() const; - virtual const String& GetString() const; + virtual const OUString& GetString() const; virtual bool operator==( const FormulaToken& rToken ) const; }; diff --git a/include/formula/tokenarray.hxx b/include/formula/tokenarray.hxx index 875b055a621a..45c0db0aa244 100644 --- a/include/formula/tokenarray.hxx +++ b/include/formula/tokenarray.hxx @@ -200,14 +200,14 @@ public: FormulaToken* AddToken( const FormulaToken& ); FormulaToken* AddString( const sal_Unicode* pStr ); - FormulaToken* AddString( const String& rStr ); + FormulaToken* AddString( const OUString& rStr ); FormulaToken* AddDouble( double fVal ); FormulaToken* AddExternal( const sal_Unicode* pStr ); /** Xcl import may play dirty tricks with OpCode!=ocExternal. Others don't use! */ - FormulaToken* AddExternal( const String& rStr, OpCode eOp = ocExternal ); - FormulaToken* AddBad( const String& rStr ); /// ocBad with String - FormulaToken* AddStringXML( const String& rStr ); /// ocStringXML with String, temporary during import + FormulaToken* AddExternal( const OUString& rStr, OpCode eOp = ocExternal ); + FormulaToken* AddBad( const OUString& rStr ); /// ocBad with OUString + FormulaToken* AddStringXML( const OUString& rStr ); /// ocStringXML with OUString, temporary during import virtual FormulaToken* MergeArray( ); diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 1870ddc1d07d..6d2a1e4bc218 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -169,9 +169,9 @@ public: // These methods are ok to use, reference count not cleared. void SetName(bool bGlobal, sal_uInt16 nIndex); - void SetExternalSingleRef( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef ); - void SetExternalDoubleRef( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef ); - void SetExternalName( sal_uInt16 nFileId, const String& rName ); + void SetExternalSingleRef( sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef ); + void SetExternalDoubleRef( sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef ); + void SetExternalName( sal_uInt16 nFileId, const OUString& rName ); void SetMatrix( ScMatrix* p ); void SetExternal(const sal_Unicode* pStr); diff --git a/sc/inc/fmtuno.hxx b/sc/inc/fmtuno.hxx index fbda9111ea3c..5006bd2c56a9 100644 --- a/sc/inc/fmtuno.hxx +++ b/sc/inc/fmtuno.hxx @@ -220,12 +220,12 @@ private: sal_Bool bIgnoreBlank; sal_Int16 nShowList; sal_Bool bShowInput; - String aInputTitle; - String aInputMessage; + OUString aInputTitle; + OUString aInputMessage; sal_Bool bShowError; sal_uInt16 nErrorStyle; // enum ScValidErrorStyle - String aErrorTitle; - String aErrorMessage; + OUString aErrorTitle; + OUString aErrorMessage; void ClearData_Impl(); diff --git a/sc/inc/formularesult.hxx b/sc/inc/formularesult.hxx index f1f7b5d60fac..00cc9fdd44d7 100644 --- a/sc/inc/formularesult.hxx +++ b/sc/inc/formularesult.hxx @@ -158,7 +158,7 @@ public: /** Return string if type formula::svString or formula::svHybridCell or formula::svMatrixCell and upper left formula::svString, else empty string. */ - const String& GetString() const; + const OUString& GetString() const; /** Return matrix if type formula::svMatrixCell and ScMatrix present, else NULL. */ ScConstMatrixRef GetMatrix() const; @@ -179,7 +179,7 @@ public: /** Should only be used by import filters, best in the order SetHybridDouble(), SetHybridString()/SetHybridFormula(), or only SetHybridFormula() for formula string to be compiled later. */ - SC_DLLPUBLIC void SetHybridFormula( const String & rFormula ); + SC_DLLPUBLIC void SetHybridFormula( const OUString & rFormula ); SC_DLLPUBLIC void SetMatrix( SCCOL nCols, SCROW nRows, const ScConstMatrixRef& pMat, formula::FormulaToken* pUL ); diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx index a852dd87b1fd..7b657e56d26f 100644 --- a/sc/inc/token.hxx +++ b/sc/inc/token.hxx @@ -212,17 +212,17 @@ class ScExternalSingleRefToken : public ScToken { private: sal_uInt16 mnFileId; - String maTabName; + OUString maTabName; ScSingleRefData maSingleRef; ScExternalSingleRefToken(); // disabled public: - ScExternalSingleRefToken( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& r ); + ScExternalSingleRefToken( sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& r ); ScExternalSingleRefToken( const ScExternalSingleRefToken& r ); virtual ~ScExternalSingleRefToken(); virtual sal_uInt16 GetIndex() const; - virtual const String& GetString() const; + virtual const OUString& GetString() const; virtual const ScSingleRefData& GetSingleRef() const; virtual ScSingleRefData& GetSingleRef(); virtual bool operator==( const formula::FormulaToken& rToken ) const; @@ -234,17 +234,17 @@ class ScExternalDoubleRefToken : public ScToken { private: sal_uInt16 mnFileId; - String maTabName; // name of the first sheet + OUString maTabName; // name of the first sheet ScComplexRefData maDoubleRef; ScExternalDoubleRefToken(); // disabled public: - ScExternalDoubleRefToken( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& r ); + ScExternalDoubleRefToken( sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& r ); ScExternalDoubleRefToken( const ScExternalDoubleRefToken& r ); virtual ~ScExternalDoubleRefToken(); virtual sal_uInt16 GetIndex() const; - virtual const String& GetString() const; + virtual const OUString& GetString() const; virtual const ScSingleRefData& GetSingleRef() const; virtual ScSingleRefData& GetSingleRef(); virtual const ScSingleRefData& GetSingleRef2() const; @@ -259,15 +259,15 @@ class ScExternalNameToken : public ScToken { private: sal_uInt16 mnFileId; - String maName; + OUString maName; private: ScExternalNameToken(); // disabled public: - ScExternalNameToken( sal_uInt16 nFileId, const String& rName ); + ScExternalNameToken( sal_uInt16 nFileId, const OUString& rName ); ScExternalNameToken( const ScExternalNameToken& r ); virtual ~ScExternalNameToken(); virtual sal_uInt16 GetIndex() const; - virtual const String& GetString() const; + virtual const OUString& GetString() const; virtual bool operator==( const formula::FormulaToken& rToken ) const; virtual FormulaToken* Clone() const { return new ScExternalNameToken(*this); } }; @@ -325,7 +325,7 @@ public: bool IsInherited() const { return bInherited; } bool IsDisplayedAsString() const { return bDisplayedAsString; } virtual double GetDouble() const; - virtual const String & GetString() const; + virtual const OUString & GetString() const; virtual bool operator==( const formula::FormulaToken& rToken ) const; virtual FormulaToken* Clone() const { return new ScEmptyCellToken(*this); } }; @@ -345,7 +345,7 @@ public: ScMatrixCellResultToken( const ScConstMatrixRef& pMat, formula::FormulaToken* pUL ); ScMatrixCellResultToken( const ScMatrixCellResultToken& r ); virtual double GetDouble() const; - virtual const String & GetString() const; + virtual const OUString & GetString() const; virtual const ScMatrix* GetMatrix() const; virtual bool operator==( const formula::FormulaToken& rToken ) const; virtual FormulaToken* Clone() const; @@ -414,7 +414,7 @@ class SC_DLLPUBLIC ScHybridCellToken : public ScToken { private: double mfDouble; - String maString; + OUString maString; OUString maFormula; public: ScHybridCellToken( double f, @@ -426,7 +426,7 @@ public: const OUString& GetFormula() const { return maFormula; } virtual double GetDouble() const; - virtual const String& GetString() const; + virtual const OUString& GetString() const; virtual bool operator==( const formula::FormulaToken& rToken ) const; virtual FormulaToken* Clone() const { return new ScHybridCellToken(*this); } }; diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx index 00f192d2e045..d926c9bb8c80 100644 --- a/sc/inc/tokenarray.hxx +++ b/sc/inc/tokenarray.hxx @@ -91,9 +91,9 @@ public: formula::FormulaToken* AddDoubleReference( const ScComplexRefData& rRef ); formula::FormulaToken* AddRangeName( sal_uInt16 n, bool bGlobal ); formula::FormulaToken* AddDBRange( sal_uInt16 n ); - formula::FormulaToken* AddExternalName( sal_uInt16 nFileId, const String& rName ); - formula::FormulaToken* AddExternalSingleReference( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef ); - formula::FormulaToken* AddExternalDoubleReference( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef ); + formula::FormulaToken* AddExternalName( sal_uInt16 nFileId, const OUString& rName ); + formula::FormulaToken* AddExternalSingleReference( sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef ); + formula::FormulaToken* AddExternalDoubleReference( sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef ); formula::FormulaToken* AddMatrix( const ScMatrixRef& p ); /** ScSingleRefOpToken with ocColRowName. */ formula::FormulaToken* AddColRowName( const ScSingleRefData& rRef ); diff --git a/sc/inc/validat.hxx b/sc/inc/validat.hxx index 9dd83f24ab24..c66c92916089 100644 --- a/sc/inc/validat.hxx +++ b/sc/inc/validat.hxx @@ -62,33 +62,34 @@ enum ScValidErrorStyle class SC_DLLPUBLIC ScValidationData : public ScConditionEntry { - sal_uInt32 nKey; // index in attributes +private: + sal_uInt32 nKey; // index in attributes - ScValidationMode eDataMode; - sal_Bool bShowInput; - sal_Bool bShowError; - ScValidErrorStyle eErrorStyle; - sal_Int16 mnListType; // selection list type: none, unsorted, sorted. - String aInputTitle; - String aInputMessage; - String aErrorTitle; - String aErrorMessage; + ScValidationMode eDataMode; + bool bShowInput; + bool bShowError; + ScValidErrorStyle eErrorStyle; + sal_Int16 mnListType; // selection list type: none, unsorted, sorted. + OUString aInputTitle; + OUString aInputMessage; + OUString aErrorTitle; + OUString aErrorMessage; - sal_Bool bIsUsed; // temporary during saving + bool bIsUsed; // temporary during saving - sal_Bool DoMacro( const ScAddress& rPos, const String& rInput, + bool DoMacro( const ScAddress& rPos, const OUString& rInput, ScFormulaCell* pCell, Window* pParent ) const; - sal_Bool DoScript( const ScAddress& rPos, const String& rInput, + bool DoScript( const ScAddress& rPos, const OUString& rInput, ScFormulaCell* pCell, Window* pParent ) const; using ScConditionEntry::operator==; public: ScValidationData( ScValidationMode eMode, ScConditionMode eOper, - const String& rExpr1, const String& rExpr2, + const OUString& rExpr1, const OUString& rExpr2, ScDocument* pDocument, const ScAddress& rPos, - const String& rExprNmsp1 = EMPTY_STRING, const String& rExprNmsp2 = EMPTY_STRING, + const OUString& rExprNmsp1 = EMPTY_OUSTRING, const OUString& rExprNmsp2 = EMPTY_OUSTRING, formula::FormulaGrammar::Grammar eGrammar1 = formula::FormulaGrammar::GRAM_DEFAULT, formula::FormulaGrammar::Grammar eGrammar2 = formula::FormulaGrammar::GRAM_DEFAULT ); ScValidationData( ScValidationMode eMode, ScConditionMode eOper, @@ -105,15 +106,15 @@ public: void ResetInput(); void ResetError(); - void SetInput( const String& rTitle, const String& rMsg ); - void SetError( const String& rTitle, const String& rMsg, + void SetInput( const OUString& rTitle, const OUString& rMsg ); + void SetError( const OUString& rTitle, const OUString& rMsg, ScValidErrorStyle eStyle ); - sal_Bool GetInput( String& rTitle, String& rMsg ) const + bool GetInput( OUString& rTitle, OUString& rMsg ) const { rTitle = aInputTitle; rMsg = aInputMessage; return bShowInput; } - sal_Bool GetErrMsg( String& rTitle, String& rMsg, ScValidErrorStyle& rStyle ) const; + bool GetErrMsg( OUString& rTitle, OUString& rMsg, ScValidErrorStyle& rStyle ) const; - sal_Bool HasErrMsg() const { return bShowError; } + bool HasErrMsg() const { return bShowError; } ScValidationMode GetDataMode() const { return eDataMode; } @@ -137,17 +138,17 @@ public: bool IsDataValid( ScRefCellValue& rCell, const ScAddress& rPos ) const; // TRUE -> break - sal_Bool DoError( Window* pParent, const String& rInput, const ScAddress& rPos ) const; - void DoCalcError( ScFormulaCell* pCell ) const; + bool DoError( Window* pParent, const OUString& rInput, const ScAddress& rPos ) const; + void DoCalcError( ScFormulaCell* pCell ) const; - sal_Bool IsEmpty() const; + bool IsEmpty() const; sal_uInt32 GetKey() const { return nKey; } void SetKey(sal_uInt32 nNew) { nKey = nNew; } // only if not inserted! - void SetUsed(sal_Bool bSet) { bIsUsed = bSet; } - sal_Bool IsUsed() const { return bIsUsed; } + void SetUsed(bool bSet) { bIsUsed = bSet; } + bool IsUsed() const { return bIsUsed; } - sal_Bool EqualEntries( const ScValidationData& r ) const; // for undo + bool EqualEntries( const ScValidationData& r ) const; // for undo // sort (using std::set) by index // operator== only for sorting @@ -203,18 +204,18 @@ public: iterator end(); const_iterator end() const; - void InsertNew( ScValidationData* pNew ) + void InsertNew( ScValidationData* pNew ) { if (!maData.insert(pNew).second) delete pNew; } ScValidationData* GetData( sal_uInt32 nKey ); - void CompileXML(); + void CompileXML(); void UpdateReference( sc::RefUpdateContext& rCxt ); void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt ); void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt ); void UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt ); - sal_Bool operator==( const ScValidationDataList& r ) const; // for ref-undo + bool operator==( const ScValidationDataList& r ) const; // for ref-undo void clear(); diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index 3304e732fd9f..2c66dd541b5d 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -56,9 +56,9 @@ using namespace formula; // ScValidationData::ScValidationData( ScValidationMode eMode, ScConditionMode eOper, - const String& rExpr1, const String& rExpr2, + const OUString& rExpr1, const OUString& rExpr2, ScDocument* pDocument, const ScAddress& rPos, - const String& rExprNmsp1, const String& rExprNmsp2, + const OUString& rExprNmsp1, const OUString& rExprNmsp2, FormulaGrammar::Grammar eGrammar1, FormulaGrammar::Grammar eGrammar2 ) : ScConditionEntry( eOper, rExpr1, rExpr2, pDocument, rPos, rExprNmsp1, rExprNmsp2, eGrammar1, eGrammar2 ), nKey( 0 ), @@ -117,14 +117,14 @@ ScValidationData::~ScValidationData() { } -sal_Bool ScValidationData::IsEmpty() const +bool ScValidationData::IsEmpty() const { - String aEmpty; + OUString aEmpty; ScValidationData aDefault( SC_VALID_ANY, SC_COND_EQUAL, aEmpty, aEmpty, GetDocument(), ScAddress() ); return EqualEntries( aDefault ); } -sal_Bool ScValidationData::EqualEntries( const ScValidationData& r ) const +bool ScValidationData::EqualEntries( const ScValidationData& r ) const { // gleiche Parameter eingestellt (ohne Key) @@ -150,23 +150,23 @@ void ScValidationData::ResetError() bShowError = false; } -void ScValidationData::SetInput( const String& rTitle, const String& rMsg ) +void ScValidationData::SetInput( const OUString& rTitle, const OUString& rMsg ) { - bShowInput = sal_True; + bShowInput = true; aInputTitle = rTitle; aInputMessage = rMsg; } -void ScValidationData::SetError( const String& rTitle, const String& rMsg, +void ScValidationData::SetError( const OUString& rTitle, const OUString& rMsg, ScValidErrorStyle eStyle ) { - bShowError = sal_True; + bShowError = true; eErrorStyle = eStyle; aErrorTitle = rTitle; aErrorMessage = rMsg; } -sal_Bool ScValidationData::GetErrMsg( String& rTitle, String& rMsg, +bool ScValidationData::GetErrMsg( OUString& rTitle, OUString& rMsg, ScValidErrorStyle& rStyle ) const { rTitle = aErrorTitle; @@ -175,7 +175,7 @@ sal_Bool ScValidationData::GetErrMsg( String& rTitle, String& rMsg, return bShowError; } -sal_Bool ScValidationData::DoScript( const ScAddress& rPos, const String& rInput, +bool ScValidationData::DoScript( const ScAddress& rPos, const OUString& rInput, ScFormulaCell* pCell, Window* pParent ) const { ScDocument* pDocument = GetDocument(); @@ -183,15 +183,15 @@ sal_Bool ScValidationData::DoScript( const ScAddress& rPos, const String& rInput if ( !pDocSh || !pDocument->CheckMacroWarn() ) return false; - sal_Bool bScriptReturnedFalse = false; // Standard: kein Abbruch + bool bScriptReturnedFalse = false; // Standard: kein Abbruch // Set up parameters ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aParams(2); // 1) eingegebener / berechneter Wert - String aValStr = rInput; + OUString aValStr = rInput; double nValue; - sal_Bool bIsValue = false; + bool bIsValue = false; if ( pCell ) // wenn Zelle gesetzt, aus Interpret gerufen { bIsValue = pCell->IsValue(); @@ -211,9 +211,9 @@ sal_Bool ScValidationData::DoScript( const ScAddress& rPos, const String& rInput // use link-update flag to prevent closing the document // while the macro is running - sal_Bool bWasInLinkUpdate = pDocument->IsInLinkUpdate(); + bool bWasInLinkUpdate = pDocument->IsInLinkUpdate(); if ( !bWasInLinkUpdate ) - pDocument->SetInLinkUpdate( sal_True ); + pDocument->SetInLinkUpdate( true ); if ( pCell ) pDocument->LockTable( rPos.Tab() ); @@ -233,13 +233,13 @@ sal_Bool ScValidationData::DoScript( const ScAddress& rPos, const String& rInput // Check the return value from the script // The contents of the cell get reset if the script returns false - sal_Bool bTmp = false; + bool bTmp = false; if ( eRet == ERRCODE_NONE && aRet.getValueType() == getCppuBooleanType() && - sal_True == ( aRet >>= bTmp ) && - bTmp == false ) + ( aRet >>= bTmp ) && + !bTmp ) { - bScriptReturnedFalse = sal_True; + bScriptReturnedFalse = true; } if ( eRet == ERRCODE_BASIC_METHOD_NOT_FOUND && !pCell ) @@ -255,9 +255,9 @@ sal_Bool ScValidationData::DoScript( const ScAddress& rPos, const String& rInput return bScriptReturnedFalse; } - // sal_True -> Abbruch + // true -> Abbruch -sal_Bool ScValidationData::DoMacro( const ScAddress& rPos, const String& rInput, +bool ScValidationData::DoMacro( const ScAddress& rPos, const OUString& rInput, ScFormulaCell* pCell, Window* pParent ) const { if ( SfxApplication::IsXScriptURL( aErrorTitle ) ) @@ -270,8 +270,8 @@ sal_Bool ScValidationData::DoMacro( const ScAddress& rPos, const String& rInput, if ( !pDocSh || !pDocument->CheckMacroWarn() ) return false; - sal_Bool bDone = false; - sal_Bool bRet = false; // Standard: kein Abbruch + bool bDone = false; + bool bRet = false; // Standard: kein Abbruch // Wenn das Dok waehrend eines Basic-Calls geladen wurde, // ist das Sbx-Objekt evtl. nicht angelegt (?) @@ -290,12 +290,9 @@ sal_Bool ScValidationData::DoMacro( const ScAddress& rPos, const String& rInput, SbMethod* pMethod = (SbMethod*)pVar; SbModule* pModule = pMethod->GetModule(); SbxObject* pObject = pModule->GetParent(); - String aMacroStr = pObject->GetName(); - aMacroStr += '.'; - aMacroStr += pModule->GetName(); - aMacroStr += '.'; - aMacroStr += pMethod->GetName(); - String aBasicStr; + OUStringBuffer aMacroStr = pObject->GetName(); + aMacroStr.append('.').append(pModule->GetName()).append('.').append(pMethod->GetName()); + OUString aBasicStr; // the distinction between document- and app-basic has to be done // by checking the parent (as in ScInterpreter::ScMacro), not by looping @@ -311,9 +308,9 @@ sal_Bool ScValidationData::DoMacro( const ScAddress& rPos, const String& rInput, SbxArrayRef refPar = new SbxArray; // 1) eingegebener / berechneter Wert - String aValStr = rInput; + OUString aValStr = rInput; double nValue = 0.0; - sal_Bool bIsValue = false; + bool bIsValue = false; if ( pCell ) // wenn Zelle gesetzt, aus Interpret gerufen { bIsValue = pCell->IsValue(); @@ -333,14 +330,14 @@ sal_Bool ScValidationData::DoMacro( const ScAddress& rPos, const String& rInput, // use link-update flag to prevent closing the document // while the macro is running - sal_Bool bWasInLinkUpdate = pDocument->IsInLinkUpdate(); + bool bWasInLinkUpdate = pDocument->IsInLinkUpdate(); if ( !bWasInLinkUpdate ) - pDocument->SetInLinkUpdate( sal_True ); + pDocument->SetInLinkUpdate( true ); if ( pCell ) pDocument->LockTable( rPos.Tab() ); SbxVariableRef refRes = new SbxVariable; - ErrCode eRet = pDocSh->CallBasic( aMacroStr, aBasicStr, refPar, refRes ); + ErrCode eRet = pDocSh->CallBasic( aMacroStr.makeStringAndClear(), aBasicStr, refPar, refRes ); if ( pCell ) pDocument->UnlockTable( rPos.Tab() ); @@ -349,8 +346,8 @@ sal_Bool ScValidationData::DoMacro( const ScAddress& rPos, const String& rInput, // Eingabe abbrechen, wenn Basic-Makro sal_False zurueckgibt if ( eRet == ERRCODE_NONE && refRes->GetType() == SbxBOOL && refRes->GetBool() == false ) - bRet = sal_True; - bDone = sal_True; + bRet = true; + bDone = true; } #endif if ( !bDone && !pCell ) // Makro nicht gefunden (nur bei Eingabe) @@ -371,9 +368,9 @@ void ScValidationData::DoCalcError( ScFormulaCell* pCell ) const DoMacro( pCell->aPos, EMPTY_STRING, pCell, NULL ); } - // sal_True -> Abbruch + // true -> Abbruch -sal_Bool ScValidationData::DoError( Window* pParent, const String& rInput, +bool ScValidationData::DoError( Window* pParent, const OUString& rInput, const ScAddress& rPos ) const { if ( eErrorStyle == SC_VALERR_MACRO ) @@ -381,11 +378,11 @@ sal_Bool ScValidationData::DoError( Window* pParent, const String& rInput, // Fehlermeldung ausgeben - String aTitle = aErrorTitle; - if (!aTitle.Len()) + OUString aTitle = aErrorTitle; + if (aTitle.isEmpty()) aTitle = ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ); // application title - String aMessage = aErrorMessage; - if (!aMessage.Len()) + OUString aMessage = aErrorMessage; + if (aMessage.isEmpty()) aMessage = ScGlobal::GetRscString( STR_VALID_DEFERROR ); //! ErrorBox / WarningBox / InfoBox ? @@ -420,7 +417,7 @@ bool ScValidationData::IsDataValid( const OUString& rTest, const ScPatternAttr& rPattern, const ScAddress& rPos ) const { if ( eDataMode == SC_VALID_ANY ) // check if any cell content is allowed - return sal_True; + return true; if (rTest.isEmpty()) // check whether empty cells are allowed return IsIgnoreBlank(); @@ -434,9 +431,9 @@ bool ScValidationData::IsDataValid( // get the value if any sal_uInt32 nFormat = rPattern.GetNumberFormat( pFormatter ); double nVal; - sal_Bool bIsVal = pFormatter->IsNumberFormat( rTest, nFormat, nVal ); + bool bIsVal = pFormatter->IsNumberFormat( rTest, nFormat, nVal ); - sal_Bool bRet; + bool bRet; if (SC_VALID_TEXTLEN == eDataMode) { double nLenVal; @@ -561,9 +558,9 @@ public: mrTokArr( rTokArr ), mbSkipEmpty( bSkipEmpty ), mbOk( true ) {} /** Returns the string of the first string token or NULL on error or empty token array. */ - const String* First(); + const OUString* First(); /** Returns the string of the next string token or NULL on error or end of token array. */ - const String* Next(); + const OUString* 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; } @@ -574,14 +571,14 @@ private: bool mbOk; /// true = correct token or end of token array. }; -const String* ScStringTokenIterator::First() +const OUString* ScStringTokenIterator::First() { mrTokArr.Reset(); mbOk = true; return Next(); } -const String* ScStringTokenIterator::Next() +const OUString* ScStringTokenIterator::Next() { if( !mbOk ) return NULL; @@ -592,9 +589,9 @@ const String* ScStringTokenIterator::Next() pToken = mrTokArr.NextNoSpaces(); mbOk = !pToken || (pToken->GetType() == formula::svString); - const String* pString = (mbOk && pToken) ? &pToken->GetString() : NULL; + const OUString* pString = (mbOk && pToken) ? &pToken->GetString() : NULL; // string found but empty -> get next token; otherwise return it - return (mbSkipEmpty && pString && !pString->Len()) ? Next() : pString; + return (mbSkipEmpty && pString && pString->isEmpty()) ? Next() : pString; } // ---------------------------------------------------------------------------- @@ -650,7 +647,7 @@ bool ScValidationData::GetSelectionFromFormula( if (nErrCode) { /* TODO : to use later in an alert box? - * String rStrResult = "..."; + * OUString rStrResult = "..."; * rStrResult += ScGlobal::GetLongErrorString(nErrCode); */ @@ -661,7 +658,7 @@ bool ScValidationData::GetSelectionFromFormula( xMatRef->PutDouble( aValidationSrc.GetValue(), 0); else { - String aStr = aValidationSrc.GetString(); + OUString aStr = aValidationSrc.GetString(); xMatRef->PutString( aStr, 0); } @@ -721,7 +718,7 @@ bool ScValidationData::GetSelectionFromFormula( { ScTokenArray aCondTokArr; ScTypedStrData* pEntry = NULL; - String aValStr; + OUString aValStr; ScMatrixValue nMatVal = pValues->Get( nCol, nRow); // strings and empties @@ -806,7 +803,7 @@ bool ScValidationData::FillSelectionList(std::vector<ScTypedStrData>& rStrColl, sal_uInt32 nFormat = lclGetCellFormat( *GetDocument(), rPos ); ScStringTokenIterator aIt( *pTokArr ); - for( const String* pString = aIt.First(); pString && aIt.Ok(); pString = aIt.Next() ) + for( const OUString* pString = aIt.First(); pString && aIt.Ok(); pString = aIt.Next() ) { double fValue; bool bIsValue = GetDocument()->GetFormatTable()->IsNumberFormat( *pString, nFormat, fValue ); @@ -862,7 +859,7 @@ bool ScValidationData::IsListValid( ScRefCellValue& rCell, const ScAddress& rPos sal_uInt32 nFormat = lclGetCellFormat( *GetDocument(), rPos ); ScStringTokenIterator aIt( *pTokArr ); - for( const String* pString = aIt.First(); pString && aIt.Ok(); pString = aIt.Next() ) + for( const OUString* 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. */ @@ -966,7 +963,7 @@ void ScValidationDataList::UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt ) (*it)->UpdateMoveTab(rCxt); } -sal_Bool ScValidationDataList::operator==( const ScValidationDataList& r ) const +bool ScValidationDataList::operator==( const ScValidationDataList& r ) const { // fuer Ref-Undo - interne Variablen werden nicht verglichen diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index b615b34ba97a..dfa5532394b9 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -826,7 +826,7 @@ public: sal_uInt16 GetError() const { return nGlobalError; } formula::StackVar GetResultType() const { return xResult->GetType(); } - const String& GetStringResult() const { return xResult->GetString(); } + const OUString& GetStringResult() const { return xResult->GetString(); } double GetNumResult() const { return xResult->GetDouble(); } formula::FormulaTokenRef GetResultToken() const { return xResult; } short GetRetFormatType() const { return nRetFmtType; } diff --git a/sc/source/core/tool/formularesult.cxx b/sc/source/core/tool/formularesult.cxx index 77de2ae19633..cf4906555a3b 100644 --- a/sc/source/core/tool/formularesult.cxx +++ b/sc/source/core/tool/formularesult.cxx @@ -279,8 +279,8 @@ bool ScFormulaResult::IsMultiline() const { if (meMultiline == MULTILINE_UNKNOWN) { - const String& rStr = GetString(); - if (rStr.Len() && rStr.Search( '\n' ) != STRING_NOTFOUND) + const OUString& rStr = GetString(); + if (!rStr.isEmpty() && rStr.indexOf( '\n' ) != -1) const_cast<ScFormulaResult*>(this)->meMultiline = MULTILINE_TRUE; else const_cast<ScFormulaResult*>(this)->meMultiline = MULTILINE_FALSE; @@ -389,7 +389,7 @@ double ScFormulaResult::GetDouble() const return mfValue; } -const String & ScFormulaResult::GetString() const +const OUString & ScFormulaResult::GetString() const { if (mbToken && mpToken) { @@ -441,8 +441,8 @@ void ScFormulaResult::SetHybridDouble( double f ) SetDouble(f); else { - String aString( GetString()); - String aFormula( GetHybridFormula()); + OUString aString( GetString()); + OUString aFormula( GetHybridFormula()); mpToken->DecRef(); mpToken = new ScHybridCellToken( f, aString, aFormula); mpToken->IncRef(); @@ -460,7 +460,7 @@ void ScFormulaResult::SetHybridString( const OUString & rStr ) { // Obtain values before changing anything. double f = GetDouble(); - String aFormula( GetHybridFormula()); + OUString aFormula( GetHybridFormula()); ResetToDefaults(); if (mbToken && mpToken) mpToken->DecRef(); @@ -469,11 +469,11 @@ void ScFormulaResult::SetHybridString( const OUString & rStr ) mbToken = true; } -void ScFormulaResult::SetHybridFormula( const String & rFormula ) +void ScFormulaResult::SetHybridFormula( const OUString & rFormula ) { // Obtain values before changing anything. double f = GetDouble(); - String aStr( GetString()); + OUString aStr( GetString()); ResetToDefaults(); if (mbToken && mpToken) mpToken->DecRef(); diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx index e6687ba78939..3925a18f7d96 100644 --- a/sc/source/core/tool/reftokenhelper.cxx +++ b/sc/source/core/tool/reftokenhelper.cxx @@ -105,7 +105,7 @@ void ScRefTokenHelper::compileRangeRepresentation( bFailure = true; break; case svString: - if (!pT->GetString().Len()) + if (pT->GetString().isEmpty()) bFailure = true; break; default: @@ -320,7 +320,7 @@ private: // Get the information of the new token. bool bExternal = ScRefTokenHelper::isExternalRef(pToken); sal_uInt16 nFileId = bExternal ? pToken->GetIndex() : 0; - String aTabName = bExternal ? pToken->GetString() : String(); + OUString aTabName = bExternal ? pToken->GetString() : OUString(); bool bJoined = false; vector<ScTokenRef>::iterator itr = rTokens.begin(), itrEnd = rTokens.end(); diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 08455f597d01..201bd430d0b8 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -233,7 +233,7 @@ void ScRawToken::SetName(bool bGlobal, sal_uInt16 nIndex) name.nIndex = nIndex; } -void ScRawToken::SetExternalSingleRef( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef ) +void ScRawToken::SetExternalSingleRef( sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef ) { eOp = ocPush; eType = svExternalSingleRef; @@ -243,12 +243,12 @@ void ScRawToken::SetExternalSingleRef( sal_uInt16 nFileId, const String& rTabNam extref.aRef.Ref1 = extref.aRef.Ref2 = rRef; - xub_StrLen n = rTabName.Len(); - memcpy(extref.cTabName, rTabName.GetBuffer(), n*sizeof(sal_Unicode)); + sal_Int32 n = rTabName.getLength(); + memcpy(extref.cTabName, rTabName.getStr(), n*sizeof(sal_Unicode)); extref.cTabName[n] = 0; } -void ScRawToken::SetExternalDoubleRef( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef ) +void ScRawToken::SetExternalDoubleRef( sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef ) { eOp = ocPush; eType = svExternalDoubleRef; @@ -257,12 +257,12 @@ void ScRawToken::SetExternalDoubleRef( sal_uInt16 nFileId, const String& rTabNam extref.nFileId = nFileId; extref.aRef = rRef; - xub_StrLen n = rTabName.Len(); - memcpy(extref.cTabName, rTabName.GetBuffer(), n*sizeof(sal_Unicode)); + sal_Int32 n = rTabName.getLength(); + memcpy(extref.cTabName, rTabName.getStr(), n*sizeof(sal_Unicode)); extref.cTabName[n] = 0; } -void ScRawToken::SetExternalName( sal_uInt16 nFileId, const String& rName ) +void ScRawToken::SetExternalName( sal_uInt16 nFileId, const OUString& rName ) { eOp = ocPush; eType = svExternalName; @@ -270,8 +270,8 @@ void ScRawToken::SetExternalName( sal_uInt16 nFileId, const String& rName ) extname.nFileId = nFileId; - xub_StrLen n = rName.Len(); - memcpy(extname.cName, rName.GetBuffer(), n*sizeof(sal_Unicode)); + sal_Int32 n = rName.getLength(); + memcpy(extname.cName, rName.getStr(), n*sizeof(sal_Unicode)); extname.cName[n] = 0; } @@ -854,7 +854,7 @@ FormulaToken* ScMatrixRangeToken::Clone() const // ============================================================================ -ScExternalSingleRefToken::ScExternalSingleRefToken( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& r ) : +ScExternalSingleRefToken::ScExternalSingleRefToken( sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& r ) : ScToken( svExternalSingleRef, ocPush), mnFileId(nFileId), maTabName(rTabName), @@ -879,7 +879,7 @@ sal_uInt16 ScExternalSingleRefToken::GetIndex() const return mnFileId; } -const String& ScExternalSingleRefToken::GetString() const +const OUString& ScExternalSingleRefToken::GetString() const { return maTabName; } @@ -910,7 +910,7 @@ bool ScExternalSingleRefToken::operator ==( const FormulaToken& r ) const // ============================================================================ -ScExternalDoubleRefToken::ScExternalDoubleRefToken( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& r ) : +ScExternalDoubleRefToken::ScExternalDoubleRefToken( sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& r ) : ScToken( svExternalDoubleRef, ocPush), mnFileId(nFileId), maTabName(rTabName), @@ -935,7 +935,7 @@ sal_uInt16 ScExternalDoubleRefToken::GetIndex() const return mnFileId; } -const String& ScExternalDoubleRefToken::GetString() const +const OUString& ScExternalDoubleRefToken::GetString() const { return maTabName; } @@ -986,7 +986,7 @@ bool ScExternalDoubleRefToken::operator ==( const FormulaToken& r ) const // ============================================================================ -ScExternalNameToken::ScExternalNameToken( sal_uInt16 nFileId, const String& rName ) : +ScExternalNameToken::ScExternalNameToken( sal_uInt16 nFileId, const OUString& rName ) : ScToken( svExternalName, ocPush), mnFileId(nFileId), maName(rName) @@ -1007,7 +1007,7 @@ sal_uInt16 ScExternalNameToken::GetIndex() const return mnFileId; } -const String& ScExternalNameToken::GetString() const +const OUString& ScExternalNameToken::GetString() const { return maName; } @@ -1020,19 +1020,8 @@ bool ScExternalNameToken::operator==( const FormulaToken& r ) const if (mnFileId != r.GetIndex()) return false; - xub_StrLen nLen = maName.Len(); - const String& rName = r.GetString(); - if (nLen != rName.Len()) - return false; - - const sal_Unicode* p1 = maName.GetBuffer(); - const sal_Unicode* p2 = rName.GetBuffer(); - for (xub_StrLen j = 0; j < nLen; ++j) - { - if (p1[j] != p2[j]) - return false; - } - return true; + const OUString& rName = r.GetString(); + return maName == rName; } // ============================================================================ @@ -1048,9 +1037,9 @@ ScJumpMatrixToken::~ScJumpMatrixToken() } double ScEmptyCellToken::GetDouble() const { return 0.0; } -const String & ScEmptyCellToken::GetString() const +const OUString & ScEmptyCellToken::GetString() const { - static String aDummyString; + static OUString aDummyString; return aDummyString; } bool ScEmptyCellToken::operator==( const FormulaToken& r ) const @@ -1067,7 +1056,7 @@ ScMatrixCellResultToken::ScMatrixCellResultToken( const ScMatrixCellResultToken& ScToken(r), xMatrix(r.xMatrix), xUpperLeft(r.xUpperLeft) {} double ScMatrixCellResultToken::GetDouble() const { return xUpperLeft->GetDouble(); } -const String & ScMatrixCellResultToken::GetString() const { return xUpperLeft->GetString(); } +const OUString & ScMatrixCellResultToken::GetString() const { return xUpperLeft->GetString(); } const ScMatrix* ScMatrixCellResultToken::GetMatrix() const { return xMatrix.get(); } // Non-const GetMatrix() is private and unused but must be implemented to // satisfy vtable linkage. @@ -1174,7 +1163,7 @@ void ScMatrixFormulaCellToken::ResetResult() double ScHybridCellToken::GetDouble() const { return mfDouble; } -const String& ScHybridCellToken::GetString() const { return maString; } +const OUString& ScHybridCellToken::GetString() const { return maString; } bool ScHybridCellToken::operator==( const FormulaToken& r ) const { return FormulaToken::operator==( r ) && @@ -1251,8 +1240,8 @@ bool ScTokenArray::AddFormulaToken(const com::sun::star::sheet::FormulaToken& _a { // try to resolve cache index to sheet name size_t nCacheId = static_cast< size_t >( aApiSRef.Sheet ); - String aTabName = _pRef->getCacheTableName( nFileId, nCacheId ); - if( aTabName.Len() > 0 ) + OUString aTabName = _pRef->getCacheTableName( nFileId, nCacheId ); + if( !aTabName.isEmpty() ) { ScSingleRefData aSingleRef; // convert column/row settings, set sheet index to absolute @@ -1266,8 +1255,8 @@ bool ScTokenArray::AddFormulaToken(const com::sun::star::sheet::FormulaToken& _a { // try to resolve cache index to sheet name. size_t nCacheId = static_cast< size_t >( aApiCRef.Reference1.Sheet ); - String aTabName = _pRef->getCacheTableName( nFileId, nCacheId ); - if( aTabName.Len() > 0 ) + OUString aTabName = _pRef->getCacheTableName( nFileId, nCacheId ); + if( !aTabName.isEmpty() ) { ScComplexRefData aComplRef; // convert column/row settings, set sheet index to absolute @@ -1478,7 +1467,7 @@ void ScTokenArray::GenHash() case svString: { // Constant string. - const String& rStr = p->GetString(); + const OUString& rStr = p->GetString(); nHash += aHasher(rStr); } break; @@ -1902,17 +1891,17 @@ FormulaToken* ScTokenArray::AddDBRange( sal_uInt16 n ) return Add( new FormulaIndexToken( ocDBArea, n)); } -FormulaToken* ScTokenArray::AddExternalName( sal_uInt16 nFileId, const String& rName ) +FormulaToken* ScTokenArray::AddExternalName( sal_uInt16 nFileId, const OUString& rName ) { return Add( new ScExternalNameToken(nFileId, rName) ); } -FormulaToken* ScTokenArray::AddExternalSingleReference( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef ) +FormulaToken* ScTokenArray::AddExternalSingleReference( sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef ) { return Add( new ScExternalSingleRefToken(nFileId, rTabName, rRef) ); } -FormulaToken* ScTokenArray::AddExternalDoubleReference( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef ) +FormulaToken* ScTokenArray::AddExternalDoubleReference( sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef ) { return Add( new ScExternalDoubleRefToken(nFileId, rTabName, rRef) ); } diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index ceaa95168b64..d183cab84643 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -1476,13 +1476,13 @@ XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) : if( const ScValidationData* pValData = GetDoc().GetValidationEntry( mnScHandle ) ) { // prompt box - empty string represented by single NUL character - String aTitle, aText; + OUString aTitle, aText; bool bShowPrompt = (pValData->GetInput( aTitle, aText ) == sal_True); - if( aTitle.Len() ) + if( !aTitle.isEmpty() ) maPromptTitle.Assign( aTitle ); else maPromptTitle.Assign( '\0' ); - if( aText.Len() ) + if( !aText.isEmpty() ) maPromptText.Assign( aText ); else maPromptText.Assign( '\0' ); @@ -1490,11 +1490,11 @@ XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) : // error box - empty string represented by single NUL character ScValidErrorStyle eScErrorStyle; bool bShowError = (pValData->GetErrMsg( aTitle, aText, eScErrorStyle ) == sal_True); - if( aTitle.Len() ) + if( !aTitle.isEmpty() ) maErrorTitle.Assign( aTitle ); else maErrorTitle.Assign( '\0' ); - if( aText.Len() ) + if( !aText.isEmpty() ) maErrorText.Assign( aText ); else maErrorText.Assign( '\0' ); diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index c1cd9a495946..cc69d1253b8e 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -1281,7 +1281,7 @@ void XclExpXct::Save( XclExpStream& rStrm ) break; case svString: // do not save empty strings (empty cells) to cache - if( xToken->GetString().Len() > 0 ) + if( !xToken->GetString().isEmpty() ) bValid = aCrnRecs.InsertValue( nScCol, nScRow, Any( OUString( xToken->GetString() ) ) ); break; default: diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index afd174325031..f052423367dd 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -732,7 +732,7 @@ void Chart2Positioner::createPositionMap() bool bExternal = ScRefTokenHelper::isExternalRef(pToken); sal_uInt16 nFileId = bExternal ? pToken->GetIndex() : 0; - String aTabName = bExternal ? pToken->GetString() : String(); + OUString aTabName = bExternal ? pToken->GetString() : OUString(); ScComplexRefData aData; if( !ScRefTokenHelper::getDoubleRefDataFromToken(aData, *itr) ) @@ -960,7 +960,7 @@ private: return false; bool bExternal = ScRefTokenHelper::isExternalRef(pToken); sal_uInt16 nFileId = bExternal ? pToken->GetIndex() : 0; - String aTabName = bExternal ? pToken->GetString() : String(); + OUString aTabName = bExternal ? pToken->GetString() : OUString(); // In saving to XML, we don't prepend address with '$'. setRelative(aData.Ref1); diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx index 51aa29aa585c..8f633140fa3e 100644 --- a/sc/source/ui/unoobj/fmtuno.cxx +++ b/sc/source/ui/unoobj/fmtuno.cxx @@ -624,7 +624,7 @@ ScTableValidationObj::ScTableValidationObj(ScDocument* pDoc, sal_uLong nKey, { // Eintrag aus dem Dokument lesen... - sal_Bool bFound = false; + bool bFound = false; if ( pDoc && nKey ) { const ScValidationData* pData = pDoc->GetValidationEntry( nKey ); @@ -650,7 +650,7 @@ ScTableValidationObj::ScTableValidationObj(ScDocument* pDoc, sal_uLong nKey, if (nValMode != SC_VALID_ANY && pDoc->IsInExternalReferenceMarking()) pData->MarkUsedExternalReferences(); - bFound = sal_True; + bFound = true; } } if (!bFound) @@ -716,10 +716,10 @@ void ScTableValidationObj::ClearData_Impl() maExprNmsp1.Erase(); maExprNmsp2.Erase(); meGrammar1 = meGrammar2 = FormulaGrammar::GRAM_UNSPECIFIED; // will be overriden when needed - aInputTitle.Erase(); - aInputMessage.Erase(); - aErrorTitle.Erase(); - aErrorMessage.Erase(); + aInputTitle = OUString(); + aInputMessage = OUString(); + aErrorTitle = OUString(); + aErrorMessage = OUString(); } ScTableValidationObj::~ScTableValidationObj() diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 3246cf050df0..a1403185e17b 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -755,10 +755,10 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) sal_Bool bBlank = sal_True; sal_Int16 nListType = ValidListType::UNSORTED; sal_Bool bShowHelp = false; - String aHelpTitle, aHelpText; + OUString aHelpTitle, aHelpText; sal_Bool bShowError = false; ScValidErrorStyle eErrStyle = SC_VALERR_STOP; - String aErrTitle, aErrText; + OUString aErrTitle, aErrText; ScDocument* pDoc = GetViewData()->GetDocument(); SCCOL nCurX = GetViewData()->GetCurX(); diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 30750750a697..cd99e5b54f92 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -615,8 +615,8 @@ void ScTabView::TestHintWindow() { const ScValidationData* pData = pDoc->GetValidationEntry( pItem->GetValue() ); OSL_ENSURE(pData,"ValidationData nicht gefunden"); - String aTitle, aMessage; - if ( pData && pData->GetInput( aTitle, aMessage ) && aMessage.Len() > 0 ) + OUString aTitle, aMessage; + if ( pData && pData->GetInput( aTitle, aMessage ) && !aMessage.isEmpty() ) { //! Abfrage, ob an gleicher Stelle !!!! |