summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-08-17 09:47:28 +0200
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2015-01-09 18:41:33 +0100
commit84993c08be9ec2ab0104bd8cdb89341ecbc53ccf (patch)
tree474b28e763dfbe4391b1c2ef003064a2261bc8ec
parentb7d07699c8142e33f9d05d4e203b6fb567f36a9b (diff)
make the code work against current orcus master
Change-Id: I9840b3b2a2d01514ba7b15112e66c878b7b395b1
-rw-r--r--sc/source/filter/inc/orcusinterface.hxx4
-rw-r--r--sc/source/filter/orcus/interface.cxx32
2 files changed, 32 insertions, 4 deletions
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index a77831043c8c..cc4d12c188f0 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -38,11 +38,14 @@ class XStatusIndicator;
class ScOrcusGlobalSettings : public orcus::spreadsheet::iface::import_global_settings
{
ScDocumentImport& mrDoc;
+ orcus::spreadsheet::formula_grammar_t meGrammar;
public:
ScOrcusGlobalSettings(ScDocumentImport& rDoc);
virtual void set_origin_date(int year, int month, int day) SAL_OVERRIDE;
+ virtual void set_default_formula_grammar(orcus::spreadsheet::formula_grammar_t) SAL_OVERRIDE;
+ virtual orcus::spreadsheet::formula_grammar_t get_default_formula_grammar() const SAL_OVERRIDE;
};
class ScOrcusSharedStrings : public orcus::spreadsheet::iface::import_shared_strings
@@ -123,6 +126,7 @@ public:
virtual void set_formula(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, orcus::spreadsheet::formula_grammar_t grammar, const char* p, size_t n) SAL_OVERRIDE;
virtual void set_formula_result(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, const char* p, size_t n) SAL_OVERRIDE;
+ virtual void set_formula_result(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, double value) SAL_OVERRIDE;
virtual void set_shared_formula(
orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, orcus::spreadsheet::formula_grammar_t grammar, size_t sindex,
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 3735f28c82b2..660512c534e6 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -35,6 +35,16 @@ void ScOrcusGlobalSettings::set_origin_date(int year, int month, int day)
mrDoc.setOriginDate(year, month, day);
}
+void ScOrcusGlobalSettings::set_default_formula_grammar(os::formula_grammar_t eGrammar)
+{
+ meGrammar = eGrammar;
+}
+
+os::formula_grammar_t ScOrcusGlobalSettings::get_default_formula_grammar() const
+{
+ return meGrammar;
+}
+
ScOrcusFactory::StringCellCache::StringCellCache(const ScAddress& rPos, size_t nIndex) :
maPos(rPos), mnIndex(nIndex) {}
@@ -270,16 +280,18 @@ formula::FormulaGrammar::Grammar getCalcGrammarFromOrcus( os::formula_grammar_t
formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_ODFF;
switch(grammar)
{
- case orcus::spreadsheet::ods:
+ case orcus::spreadsheet::formula_grammar_ods:
eGrammar = formula::FormulaGrammar::GRAM_ODFF;
break;
- case orcus::spreadsheet::xlsx_2007:
- case orcus::spreadsheet::xlsx_2010:
+ case orcus::spreadsheet::formula_grammar_xlsx_2007:
+ case orcus::spreadsheet::formula_grammar_xlsx_2010:
eGrammar = formula::FormulaGrammar::GRAM_OOXML;
break;
- case orcus::spreadsheet::gnumeric:
+ case orcus::spreadsheet::formula_grammar_gnumeric:
eGrammar = formula::FormulaGrammar::GRAM_ENGLISH_XL_A1;
break;
+ default:
+ break;
}
return eGrammar;
@@ -309,6 +321,18 @@ void ScOrcusSheet::set_formula_result(os::row_t row, os::col_t col, const char*
pCell->SetHybridString(mrDoc.getDoc().GetSharedStringPool().intern(aResult));
}
+void ScOrcusSheet::set_formula_result(os::row_t row, os::col_t col, double value)
+{
+ ScFormulaCell* pCell = mrDoc.getDoc().GetFormulaCell(ScAddress(col, row, mnTab));
+ if (!pCell)
+ {
+ SAL_WARN("sc", "trying to set formula result for non formula \
+ cell! Col: " << col << ";Row: " << row << ";Tab: " << mnTab);
+ return;
+ }
+ pCell->SetHybridDouble(value);
+}
+
void ScOrcusSheet::set_shared_formula(
os::row_t row, os::col_t col, os::formula_grammar_t grammar, size_t sindex,
const char* p_formula, size_t n_formula)