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

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Wed Oct 5 21:53:37 PDT 2011


 sc/inc/rangeutl.hxx               |    3 +++
 sc/qa/unit/data/ods/functions.ods |binary
 sc/qa/unit/filters-test.cxx       |    6 ++++++
 sc/source/core/tool/interpr1.cxx  |    7 ++-----
 sc/source/core/tool/rangeutl.cxx  |   19 +++++++++++++++++++
 5 files changed, 30 insertions(+), 5 deletions(-)

New commits:
commit 504634ef395ffa355a2d3737351f37568cc2887a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Oct 6 06:52:43 2011 +0200

    add unit test for fdo#41381

diff --git a/sc/qa/unit/data/ods/functions.ods b/sc/qa/unit/data/ods/functions.ods
index 374ca15..4b8c55a 100644
Binary files a/sc/qa/unit/data/ods/functions.ods and b/sc/qa/unit/data/ods/functions.ods differ
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index cc866c4..8e3c27d 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -381,8 +381,14 @@ void ScFiltersTest::testFunctions()
     CPPUNIT_ASSERT_MESSAGE("Failed to load functions.*", xDocSh.Is());
     ScDocument* pDoc = xDocSh->GetDocument();
     rtl::OUString aCSVFileName;
+
+    //test logical functions
     createCSVPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("logical-functions.")), aCSVFileName);
     testFile(aCSVFileName, pDoc, 0);
+    //test spreadsheet functions
+    createCSVPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("spreadsheet-functions.")), aCSVFileName);
+    testFile(aCSVFileName, pDoc, 1);
+
     xDocSh->DoClose();
 }
 
commit df1dc6edd4d5b823ce03b82873f0743453a04c5e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Oct 5 22:19:19 2011 +0200

    fix for fdo#41381: local range names don't work with INDIRECT

diff --git a/sc/inc/rangeutl.hxx b/sc/inc/rangeutl.hxx
index 18d15d5..d04b978 100644
--- a/sc/inc/rangeutl.hxx
+++ b/sc/inc/rangeutl.hxx
@@ -271,6 +271,9 @@ public:
                             ::rtl::OUString& rString,
                             const ::rtl::OUString& rXMLRange,
                             ScDocument* pDoc );
+
+// String to RangeData core
+    static ScRangeData* GetRangeDataFromString(const rtl::OUString& rString, const SCTAB nTab, const ScDocument* pDoc);
 };
 
 //------------------------------------------------------------------------
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 8f53283..3fc28bb 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -69,6 +69,7 @@
 #include "cellkeytranslator.hxx"
 #include "lookupcache.hxx"
 #include "rangenam.hxx"
+#include "rangeutl.hxx"
 #include "compiler.hxx"
 #include "externalrefmgr.hxx"
 #include <basic/sbstar.hxx>
@@ -6715,11 +6716,7 @@ void ScInterpreter::ScIndirect()
         {
             do
             {
-                ScRangeName* pNames = pDok->GetRangeName();
-                if (!pNames)
-                    break;
-
-                ScRangeData* pData = pNames->findByName(sRefStr);
+                ScRangeData* pData = ScRangeStringConverter::GetRangeDataFromString(sRefStr, nTab, pDok);
                 if (!pData)
                     break;
 
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 2a0ceb0..2ced67b 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -1017,6 +1017,25 @@ void ScRangeStringConverter::GetStringFromXMLRangeString( OUString& rString, con
     rString = aRetStr.makeStringAndClear();
 }
 
+ScRangeData* ScRangeStringConverter::GetRangeDataFromString(const rtl::OUString& rString, const SCTAB nTab, const ScDocument* pDoc)
+{
+    ScRangeName* pLocalRangeName = pDoc->GetRangeName(nTab);
+    ScRangeData* pData = NULL;
+    if(pLocalRangeName)
+    {
+        pData = pLocalRangeName->findByName(rString);
+    }
+    if (!pData)
+    {
+        ScRangeName* pGlobalRangeName = pDoc->GetRangeName();
+        if (pGlobalRangeName)
+        {
+            pData = pGlobalRangeName->findByName(rString);
+        }
+    }
+    return pData;
+}
+
 //========================================================================
 
 ScArea::ScArea( SCTAB tab,


More information about the Libreoffice-commits mailing list