diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-01-24 00:32:41 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-01-24 00:48:02 +0100 |
commit | ae516fabd96a948b62c4d3a522555fc955750c3e (patch) | |
tree | 940342f47524f646f0ed7a3f2bc3efab487e2707 /sc/inc | |
parent | c3ea61ab29648bf93b3b4f809c7e98c40c1113f8 (diff) |
import inherited number formats with cached values, fdo#59724
Change-Id: I698f60daf4e591b57d8d99c130d2e524dc10c306
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/cell.hxx | 8 | ||||
-rw-r--r-- | sc/inc/formularesult.hxx | 4 | ||||
-rw-r--r-- | sc/inc/token.hxx | 45 |
3 files changed, 39 insertions, 18 deletions
diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx index 716b76f4113c..d146a98d2ee3 100644 --- a/sc/inc/cell.hxx +++ b/sc/inc/cell.hxx @@ -430,6 +430,7 @@ public: // display as empty string if formula::svEmptyCell result bool IsEmptyDisplayedAsString(); bool IsValue(); // also true if formula::svEmptyCell + bool IsHybridValueCell(); // for cells after import to deal with inherited number formats double GetValue(); double GetValueAlways(); // ignore errors rtl::OUString GetString(); @@ -493,6 +494,13 @@ public: const formula::FormulaGrammar::Grammar eGrammar ) { aResult.SetHybridFormula( r); eTempGrammar = eGrammar; } + /** + * For import only: use for formula cells that return a number + * formatted as some kind of string + */ + void SetHybridValueString( double nVal, const OUString& r ) + { aResult.SetHybridValueString( nVal, r ); } + void SetResultMatrix( SCCOL nCols, SCROW nRows, const ScConstMatrixRef& pMat, formula::FormulaToken* pUL ) { aResult.SetMatrix(nCols, nRows, pMat, pUL); diff --git a/sc/inc/formularesult.hxx b/sc/inc/formularesult.hxx index 2128636816b6..673bcdbf84bc 100644 --- a/sc/inc/formularesult.hxx +++ b/sc/inc/formularesult.hxx @@ -162,7 +162,7 @@ public: ScConstMatrixRef GetMatrix() const; /** Return formula string if type formula::svHybridCell, else empty string. */ - const String& GetHybridFormula() const; + const OUString& GetHybridFormula() const; /** Should only be used by import filters, best in the order SetHybridDouble(), SetHybridString(), or only SetHybridString() for @@ -179,6 +179,8 @@ public: SetHybridFormula() for formula string to be compiled later. */ SC_DLLPUBLIC void SetHybridFormula( const String & rFormula ); + void SetHybridValueString( double nVal, const OUString& rStr ); + SC_DLLPUBLIC void SetMatrix( SCCOL nCols, SCROW nRows, const ScConstMatrixRef& pMat, formula::FormulaToken* pUL ); /** Get the const ScMatrixFormulaCellToken* if token is of that type, else diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx index e08db6cb440c..a54055561bae 100644 --- a/sc/inc/token.hxx +++ b/sc/inc/token.hxx @@ -414,26 +414,37 @@ public: class SC_DLLPUBLIC ScHybridCellToken : public ScToken { private: - double fDouble; - String aString; - String aFormula; + double mfDouble; + String maString; + OUString maFormula; public: - ScHybridCellToken( double f, - const String & rStr, - const String & rFormula ) : - ScToken( formula::svHybridCell ), - fDouble( f ), aString( rStr ), - aFormula( rFormula ) {} - ScHybridCellToken( const ScHybridCellToken& r ) : - ScToken( r ), fDouble( r.fDouble), - aString( r.aString), aFormula( r.aFormula) {} - const String & GetFormula() const { return aFormula; } - virtual double GetDouble() const; - virtual const String & GetString() const; - virtual bool operator==( const formula::FormulaToken& rToken ) const; - virtual FormulaToken* Clone() const { return new ScHybridCellToken(*this); } + ScHybridCellToken( double f, + const OUString & rStr, + const OUString & rFormula ) : + ScToken( formula::svHybridCell ), + mfDouble( f ), maString( rStr ), + maFormula( rFormula ) {} + + const OUString& GetFormula() const { return maFormula; } + virtual double GetDouble() const; + virtual const String& GetString() const; + virtual bool operator==( const formula::FormulaToken& rToken ) const; + virtual FormulaToken* Clone() const { return new ScHybridCellToken(*this); } }; +class SC_DLLPUBLIC ScHybridValueCellToken : public ScToken +{ +private: + double mfValue; + String maString; +public: + ScHybridValueCellToken (double f, const OUString& rStr ): + ScToken( formula::svHybridValueCell ), + mfValue( f ), maString( rStr ) {} + + virtual double GetDouble() const { return mfValue; } + virtual const String & GetString() const { return maString; } +}; // Simplify argument passing to RefUpdate methods with ScSingleRefToken or // ScDoubleRefToken |