[Libreoffice-commits] core.git: Branch 'private/kohei/excel-2003-xml-orcus-filter' - sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Sun Dec 17 19:27:14 UTC 2017
sc/source/filter/inc/orcusinterface.hxx | 7 ++++++-
sc/source/filter/orcus/interface.cxx | 17 ++++++++++++++---
2 files changed, 20 insertions(+), 4 deletions(-)
New commits:
commit b77ca38424edefa0ece572b33d4c2f98034735f0
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Sun Dec 17 14:24:57 2017 -0500
Pick up sheet-local named expressions as well.
Change-Id: I8a081b5f81740fa91f43ac152a950d73d031ed10
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index 8259b55f9d64..1486f93b891b 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -80,9 +80,10 @@ class ScOrcusNamedExpression : public orcus::spreadsheet::iface::import_named_ex
{
ScDocumentImport& mrDoc;
const ScOrcusGlobalSettings& mrGlobalSettings;
+ SCTAB mnTab; //< negative if global, else >= 0 for sheet-local named expressions.
public:
- ScOrcusNamedExpression( ScDocumentImport& rDoc, const ScOrcusGlobalSettings& rGS );
+ ScOrcusNamedExpression( ScDocumentImport& rDoc, const ScOrcusGlobalSettings& rGS, SCTAB nTab = -1 );
virtual void define_name(const char* p_name, size_t n_name, const char* p_exp, size_t n_exp) override;
};
@@ -224,6 +225,7 @@ class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet
ScOrcusAutoFilter maAutoFilter;
ScOrcusSheetProperties maProperties;
ScOrcusConditionalFormat maConditionalFormat;
+ ScOrcusNamedExpression maNamedExpressions;
int mnCellCount;
@@ -236,6 +238,7 @@ public:
virtual orcus::spreadsheet::iface::import_table* get_table() override;
virtual orcus::spreadsheet::iface::import_sheet_properties* get_sheet_properties() override;
virtual orcus::spreadsheet::iface::import_conditional_format* get_conditional_format() override;
+ virtual orcus::spreadsheet::iface::import_named_expression* get_named_expression() override;
// Orcus import interface
virtual void set_auto(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, const char* p, size_t n) override;
@@ -595,6 +598,8 @@ public:
void incrementProgress();
void setStatusIndicator(const css::uno::Reference<css::task::XStatusIndicator>& rIndicator);
+
+ const ScOrcusGlobalSettings& getGlobalSettings() const;
};
#endif
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 78142ffea7e6..1ce694635747 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -153,15 +153,15 @@ os::range_t ScOrcusRefResolver::resolve_range(const char* p, size_t n)
}
ScOrcusNamedExpression::ScOrcusNamedExpression(
- ScDocumentImport& rDoc, const ScOrcusGlobalSettings& rGS ) :
- mrDoc(rDoc), mrGlobalSettings(rGS) {}
+ ScDocumentImport& rDoc, const ScOrcusGlobalSettings& rGS, SCTAB nTab ) :
+ mrDoc(rDoc), mrGlobalSettings(rGS), mnTab(nTab) {}
void ScOrcusNamedExpression::define_name(const char* p_name, size_t n_name, const char* p_exp, size_t n_exp)
{
OUString aName(p_name, n_name, RTL_TEXTENCODING_UTF8);
OUString aExpr(p_exp, n_exp, RTL_TEXTENCODING_UTF8);
- ScRangeName* pNames = mrDoc.getDoc().GetRangeName();
+ ScRangeName* pNames = mnTab >= 0 ? mrDoc.getDoc().GetRangeName(mnTab) : mrDoc.getDoc().GetRangeName();
if (!pNames)
return;
@@ -549,6 +549,11 @@ void ScOrcusFactory::setStatusIndicator(const uno::Reference<task::XStatusIndica
mxStatusIndicator = rIndicator;
}
+const ScOrcusGlobalSettings& ScOrcusFactory::getGlobalSettings() const
+{
+ return maGlobalSettings;
+}
+
ScOrcusSheetProperties::ScOrcusSheetProperties(SCTAB nTab, ScDocumentImport& rDoc):
mrDoc(rDoc),
mnTab(nTab)
@@ -780,6 +785,7 @@ ScOrcusSheet::ScOrcusSheet(ScDocumentImport& rDoc, SCTAB nTab, ScOrcusFactory& r
maAutoFilter(),
maProperties(mnTab, mrDoc),
maConditionalFormat(mnTab, rDoc.getDoc()),
+ maNamedExpressions(rDoc, rFactory.getGlobalSettings(), nTab),
mnCellCount(0)
{
}
@@ -814,6 +820,11 @@ os::iface::import_conditional_format* ScOrcusSheet::get_conditional_format()
return &maConditionalFormat;
}
+os::iface::import_named_expression* ScOrcusSheet::get_named_expression()
+{
+ return &maNamedExpressions;
+}
+
void ScOrcusSheet::set_auto(os::row_t row, os::col_t col, const char* p, size_t n)
{
OUString aVal(p, n, RTL_TEXTENCODING_UTF8);
More information about the Libreoffice-commits
mailing list