diff options
-rw-r--r-- | sc/inc/document.hxx | 1 | ||||
-rw-r--r-- | sc/qa/unit/helper/csv_handler.hxx | 21 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 8 |
3 files changed, 27 insertions, 3 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 64ceab9ff86d..77439d10a503 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -787,6 +787,7 @@ public: SC_DLLPUBLIC void GetNumberFormatInfo( short& nType, sal_uLong& nIndex, const ScAddress& rPos, const ScBaseCell* pCell ) const; void GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rFormula ) const; + SC_DLLPUBLIC void GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, rtl::OUString& rFormula ) const; SC_DLLPUBLIC void GetCellType( SCCOL nCol, SCROW nRow, SCTAB nTab, CellType& rCellType ) const; SC_DLLPUBLIC CellType GetCellType( const ScAddress& rPos ) const; SC_DLLPUBLIC void GetCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell*& rpCell ) const; diff --git a/sc/qa/unit/helper/csv_handler.hxx b/sc/qa/unit/helper/csv_handler.hxx index 56269846a41e..59436e280a86 100644 --- a/sc/qa/unit/helper/csv_handler.hxx +++ b/sc/qa/unit/helper/csv_handler.hxx @@ -32,11 +32,15 @@ class csv_handler { public: - csv_handler(ScDocument* pDoc, SCTAB nTab): + + enum StringType { PureString, FormulaString }; + + csv_handler(ScDocument* pDoc, SCTAB nTab, StringType aType = PureString): mpDoc(pDoc), mnCol(0), mnRow(0), - mnTab(nTab) {} + mnTab(nTab), + maStringType(aType) {} void begin_parse() { @@ -70,7 +74,17 @@ public: if (*pRemainingChars) { rtl::OUString aString; - mpDoc->GetString(mnCol, mnRow, mnTab, aString); + switch (maStringType) + { + case PureString: + mpDoc->GetString(mnCol, mnRow, mnTab, aString); + break; + case FormulaString: + mpDoc->GetFormula(mnCol, mnRow, mnTab, aString); + break; + default: + break; + } rtl::OUString aCSVString(p, n, RTL_TEXTENCODING_UTF8); #if DEBUG_CSV_HANDLER std::cout << "String: " << rtl::OUStringToOString(aString, RTL_TEXTENCODING_UTF8).getStr() << std::endl; @@ -94,4 +108,5 @@ private: SCCOL mnCol; SCROW mnRow; SCTAB mnTab; + StringType maStringType; }; diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 0b561ab8b7df..e06f650611d0 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3154,6 +3154,14 @@ void ScDocument::GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rFormul } +void ScDocument::GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, rtl::OUString& rFormula) const +{ + String aString; + GetFormula(nCol, nRow, nTab, aString); + rFormula = aString; +} + + CellType ScDocument::GetCellType( const ScAddress& rPos ) const { SCTAB nTab = rPos.Tab(); |