Kaydet (Commit) e7cd7030 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

make it possible to est formula string in csv files

üst 7a60be6e
...@@ -787,6 +787,7 @@ public: ...@@ -787,6 +787,7 @@ public:
SC_DLLPUBLIC void GetNumberFormatInfo( short& nType, sal_uLong& nIndex, SC_DLLPUBLIC void GetNumberFormatInfo( short& nType, sal_uLong& nIndex,
const ScAddress& rPos, const ScBaseCell* pCell ) const; const ScAddress& rPos, const ScBaseCell* pCell ) const;
void GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rFormula ) 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 void GetCellType( SCCOL nCol, SCROW nRow, SCTAB nTab, CellType& rCellType ) const;
SC_DLLPUBLIC CellType GetCellType( const ScAddress& rPos ) const; SC_DLLPUBLIC CellType GetCellType( const ScAddress& rPos ) const;
SC_DLLPUBLIC void GetCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell*& rpCell ) const; SC_DLLPUBLIC void GetCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell*& rpCell ) const;
......
...@@ -32,11 +32,15 @@ ...@@ -32,11 +32,15 @@
class csv_handler class csv_handler
{ {
public: public:
csv_handler(ScDocument* pDoc, SCTAB nTab):
enum StringType { PureString, FormulaString };
csv_handler(ScDocument* pDoc, SCTAB nTab, StringType aType = PureString):
mpDoc(pDoc), mpDoc(pDoc),
mnCol(0), mnCol(0),
mnRow(0), mnRow(0),
mnTab(nTab) {} mnTab(nTab),
maStringType(aType) {}
void begin_parse() void begin_parse()
{ {
...@@ -70,7 +74,17 @@ public: ...@@ -70,7 +74,17 @@ public:
if (*pRemainingChars) if (*pRemainingChars)
{ {
rtl::OUString aString; 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); rtl::OUString aCSVString(p, n, RTL_TEXTENCODING_UTF8);
#if DEBUG_CSV_HANDLER #if DEBUG_CSV_HANDLER
std::cout << "String: " << rtl::OUStringToOString(aString, RTL_TEXTENCODING_UTF8).getStr() << std::endl; std::cout << "String: " << rtl::OUStringToOString(aString, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
...@@ -94,4 +108,5 @@ private: ...@@ -94,4 +108,5 @@ private:
SCCOL mnCol; SCCOL mnCol;
SCROW mnRow; SCROW mnRow;
SCTAB mnTab; SCTAB mnTab;
StringType maStringType;
}; };
...@@ -3154,6 +3154,14 @@ void ScDocument::GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rFormul ...@@ -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 CellType ScDocument::GetCellType( const ScAddress& rPos ) const
{ {
SCTAB nTab = rPos.Tab(); SCTAB nTab = rPos.Tab();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment