summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2017-12-17 14:24:57 -0500
committerKohei Yoshida <libreoffice@kohei.us>2017-12-19 01:16:33 +0100
commit40e1cb217396c7183ea3a7379a8a15c8df3aea2e (patch)
treedda004a7b50c1ac32362adb618be2795bce52756 /sc
parenta2158c6ca2ba831665019827889f01e98dc93394 (diff)
Pick up sheet-local named expressions as well.
Change-Id: I8a081b5f81740fa91f43ac152a950d73d031ed10 Reviewed-on: https://gerrit.libreoffice.org/46666 Reviewed-by: Kohei Yoshida <libreoffice@kohei.us> Tested-by: Kohei Yoshida <libreoffice@kohei.us>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/inc/orcusinterface.hxx7
-rw-r--r--sc/source/filter/orcus/interface.cxx17
2 files changed, 20 insertions, 4 deletions
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index 07c35fa78dfe..5d6cc1f55135 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -79,9 +79,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;
};
@@ -223,6 +224,7 @@ class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet
ScOrcusAutoFilter maAutoFilter;
ScOrcusSheetProperties maProperties;
ScOrcusConditionalFormat maConditionalFormat;
+ ScOrcusNamedExpression maNamedExpressions;
int mnCellCount;
@@ -235,6 +237,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;
@@ -594,6 +597,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 04581dc70d72..89f65027a3e4 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -158,15 +158,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;
@@ -554,6 +554,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)
@@ -785,6 +790,7 @@ ScOrcusSheet::ScOrcusSheet(ScDocumentImport& rDoc, SCTAB nTab, ScOrcusFactory& r
maAutoFilter(),
maProperties(mnTab, mrDoc),
maConditionalFormat(mnTab, rDoc.getDoc()),
+ maNamedExpressions(rDoc, rFactory.getGlobalSettings(), nTab),
mnCellCount(0)
{
}
@@ -819,6 +825,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);