make it possible to est formula string in csv files
This commit is contained in:
parent
7a60be6e00
commit
e7cd70302c
3 changed files with 27 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue