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

Kohei Yoshida kohei.yoshida at collabora.com
Mon Feb 10 19:35:51 PST 2014


 sc/inc/mtvfunctions.hxx        |    2 +-
 sc/qa/unit/ucalc_column.cxx    |    8 ++++++++
 sc/source/core/data/column.cxx |    8 ++++----
 3 files changed, 13 insertions(+), 5 deletions(-)

New commits:
commit 1da03a88a98b50633d61557de27e4c0702a665eb
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Mon Feb 10 22:34:35 2014 -0500

    fdo#74209: This search algorithm had another issue. This fixes it.
    
    When the search range was i.e. 1-3, and the match was found at 5, the old
    code would return 5 when in fact it should have failed.  This change would
    honor the end position and limit the search within specified search range.
    
    Change-Id: If12a92fd3930ad128a5b0699a1addd96fb3a8eba

diff --git a/sc/inc/mtvfunctions.hxx b/sc/inc/mtvfunctions.hxx
index 6955d21..fdf79fa 100644
--- a/sc/inc/mtvfunctions.hxx
+++ b/sc/inc/mtvfunctions.hxx
@@ -618,7 +618,7 @@ FindElement2(
             break;
             default:
             {
-                ElseRetType aRet = rFuncElse(*it, nOffset);
+                ElseRetType aRet = rFuncElse(*it, nOffset, nDataSize);
                 if (aRet.second)
                     return PositionType(it, aRet.first);
             }
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 8e3d365..3768808 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2984,20 +2984,20 @@ public:
         return const_cast<ScFormulaCell*>(p)->IsMultilineResult();
     }
 
-    std::pair<size_t,bool> operator() (const sc::CellStoreType::value_type& node, size_t nOffset)
+    std::pair<size_t,bool> operator() (const sc::CellStoreType::value_type& node, size_t nOffset, size_t nDataSize)
     {
         typedef std::pair<size_t,bool> RetType;
 
         if (node.type == sc::element_type_empty)
             return RetType(0, false);
 
-        for (size_t i = nOffset; i < node.size; ++i)
+        for (size_t i = 0; i < nDataSize; ++i)
         {
-            SCROW nRow = node.position + i;
+            SCROW nRow = node.position + i + nOffset;
             sal_uInt8 nScriptType = mrColumn.GetRangeScriptType(miAttrPos, nRow, nRow, miCellPos);
             if (IsAmbiguousScriptNonZero(nScriptType))
                 // Return the offset from the first row.
-                return RetType(i, true);
+                return RetType(i+nOffset, true);
         }
 
         return RetType(0, false);
commit be32e707859b3a80766ac29eb5879da3c07544bf
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Mon Feb 10 22:32:58 2014 -0500

    fdo#74209: Catch additional problem discovered.
    
    Change-Id: Iee9b4ed4ef1fd40a9bb5a1867330d54fed4866fc

diff --git a/sc/qa/unit/ucalc_column.cxx b/sc/qa/unit/ucalc_column.cxx
index 69218d0..40793bd 100644
--- a/sc/qa/unit/ucalc_column.cxx
+++ b/sc/qa/unit/ucalc_column.cxx
@@ -82,6 +82,14 @@ void Test::testColumnFindEditCells()
     nResRow = m_pDoc->GetFirstEditTextRow(ScAddress(1,12,0));
     CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(12), nResRow);
 
+    for (SCROW i = 0; i <= 5; ++i)
+        m_pDoc->SetString(ScAddress(2,i,0), "Text");
+
+    m_pDoc->SetScriptType(ScAddress(2,5,0), (SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN));
+
+    nResRow = m_pDoc->GetFirstEditTextRow(ScAddress(2,1,0));
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(-1), nResRow);
+
     m_pDoc->DeleteTab(0);
 }
 


More information about the Libreoffice-commits mailing list