sc/inc/rangenam.hxx                |    1 +
 sc/source/core/tool/rangenam.cxx   |    5 +++++
 sc/source/ui/miscdlgs/linkarea.cxx |   14 +++++++++-----
 3 files changed, 15 insertions(+), 5 deletions(-)

New commits:
commit 462f9d1f589a7afd66d3fc61925467d3b68e5b31
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Sun Jun 6 22:57:11 2021 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Wed Jul 21 17:46:27 2021 +0200

    tdf#142600 - List tables in order of their appearance
    
    Change-Id: I1e653bf3a646161825b465ea2fc20ab48308f0ca
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116767
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index f7c6cecc649a..b98a9a1d93c3 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -239,6 +239,7 @@ public:
     SC_DLLPUBLIC iterator begin();
     SC_DLLPUBLIC iterator end();
     SC_DLLPUBLIC size_t size() const;
+    SC_DLLPUBLIC size_t index_size() const;
     bool empty() const;
 
     /** Insert object into set.
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index 7987b8a313a4..5465a289d240 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -801,6 +801,11 @@ size_t ScRangeName::size() const
     return m_Data.size();
 }
 
+size_t ScRangeName::index_size() const
+{
+    return maIndexToData.size();
+}
+
 bool ScRangeName::empty() const
 {
     return m_Data.empty();
diff --git a/sc/source/ui/miscdlgs/linkarea.cxx 
b/sc/source/ui/miscdlgs/linkarea.cxx
index 480347e159a7..1deb97767b8c 100644
--- a/sc/source/ui/miscdlgs/linkarea.cxx
+++ b/sc/source/ui/miscdlgs/linkarea.cxx
@@ -250,11 +250,15 @@ void ScLinkedAreaDlg::UpdateSourceRanges()
             m_xLbRanges->append_text("CSV_all");
         }
 
-        ScAreaNameIterator aIter(m_pSourceShell->GetDocument());
-        ScRange aDummy;
-        OUString aName;
-        while ( aIter.Next( aName, aDummy ) )
-            m_xLbRanges->append_text(aName);
+        // tdf#142600 - list tables in order of their appearance in the 
document's source
+        const ScRangeName* pRangeName = 
m_pSourceShell->GetDocument().GetRangeName();
+        for (size_t i = 1; i <= pRangeName->index_size(); i++)
+        {
+            if (const ScRangeData* pRangeData = pRangeName->findByIndex(i))
+            {
+                m_xLbRanges->append_text(pRangeData->GetName());
+            }
+        }
     }
 
     m_xLbRanges->thaw();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to