diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2011-06-29 05:24:58 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2011-06-29 05:24:58 +0200 |
commit | 686ede63656aebbb498fffc21c8219924c593779 (patch) | |
tree | 6670902138ff8c752f65d4a8c77c7878684e1747 /sc | |
parent | e5df38040587459525c82782d78839e65c13f284 (diff) |
export local range names to xlsx
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/document.hxx | 4 | ||||
-rw-r--r-- | sc/source/filter/excel/xename.cxx | 14 | ||||
-rw-r--r-- | sc/source/filter/excel/xlroot.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/inc/xlroot.hxx | 2 |
4 files changed, 23 insertions, 2 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 673dc3ec18d9..19dad8283aee 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -464,8 +464,8 @@ public: * Get all range names that are local to each table. It only returns * non-empty range name set. */ - void GetAllTabRangeNames(ScRangeName::TabNameCopyMap& rRangeNames) const; - void SetAllTabRangeNames(const ScRangeName::TabNameCopyMap& rRangeNames); + SC_DLLPUBLIC void GetAllTabRangeNames(ScRangeName::TabNameCopyMap& rRangeNames) const; + SC_DLLPUBLIC void SetAllTabRangeNames(const ScRangeName::TabNameCopyMap& rRangeNames); SC_DLLPUBLIC ScRangeName* GetRangeName(SCTAB nTab) const; SC_DLLPUBLIC ScRangeName* GetRangeName() const; void SetRangeName(SCTAB nTab, ScRangeName* pNew); diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index fcdc6a797b89..18e38cb5bc02 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -677,6 +677,20 @@ void XclExpNameManagerImpl::CreateUserNames() if (!itr->HasType(RT_SHARED) && !FindNamedExpIndex(SCTAB_GLOBAL, itr->GetIndex())) CreateName(SCTAB_GLOBAL, *itr); } + //look at every sheet for local range names + ScRangeName::TabNameCopyMap rLocalNames; + GetDoc().GetAllTabRangeNames(rLocalNames); + ScRangeName::TabNameCopyMap::iterator tabIt = rLocalNames.begin(), tabItEnd = rLocalNames.end(); + for (; tabIt != tabItEnd; ++tabIt) + { + itr = tabIt->second->begin(), itrEnd = tabIt->second->end(); + for (; itr != itrEnd; ++itr) + { + // skip definitions of shared formulas + if (!itr->HasType(RT_SHARED) && !FindNamedExpIndex(tabIt->first, itr->GetIndex())) + CreateName(tabIt->first, *itr); + } + } } // ---------------------------------------------------------------------------- diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx index 7b6f24a23241..8c49ecbcac05 100644 --- a/sc/source/filter/excel/xlroot.cxx +++ b/sc/source/filter/excel/xlroot.cxx @@ -317,6 +317,11 @@ ScRangeName& XclRoot::GetNamedRanges() const return *GetDoc().GetRangeName(); } +ScRangeName* XclRoot::GetNamedRanges(SCTAB nTab) const +{ + return GetDoc().GetRangeName(nTab); +} + ScDBCollection& XclRoot::GetDatabaseRanges() const { return *GetDoc().GetDBCollection(); diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx index 20eb819cff9b..ca97755a0b07 100644 --- a/sc/source/filter/inc/xlroot.hxx +++ b/sc/source/filter/inc/xlroot.hxx @@ -235,6 +235,8 @@ public: ScStyleSheetPool& GetStyleSheetPool() const; /** Returns the defined names container of the Calc document. */ ScRangeName& GetNamedRanges() const; + /** Returns the defined names container of the Calc sheet. */ + ScRangeName* GetNamedRanges(SCTAB nTab) const; /** Returns the database ranges container of the Calc document. */ ScDBCollection& GetDatabaseRanges() const; /** Returns the drawing layer page of the passed sheet, if present. */ |