[Libreoffice-commits] .: sc/inc sc/source

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Tue Jun 28 20:42:52 PDT 2011


 sc/inc/document.hxx               |    4 ++--
 sc/source/filter/excel/xename.cxx |   14 ++++++++++++++
 sc/source/filter/excel/xlroot.cxx |    5 +++++
 sc/source/filter/inc/xlroot.hxx   |    2 ++
 4 files changed, 23 insertions(+), 2 deletions(-)

New commits:
commit c0df9e35ed3be1b305a67af4ff74300b35d8734e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Jun 29 05:24:58 2011 +0200

    export local range names to xlsx

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index b547bc2..7dd81a6 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 59a90b3..3a695b4 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 a0ee852..8514cd5 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 d1e575e..7f2c7a3 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. */


More information about the Libreoffice-commits mailing list