[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter' - 5 commits - sc/inc sc/Module_sc.mk sc/qa sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Fri Jun 28 09:02:30 PDT 2013


 sc/Module_sc.mk                     |    2 
 sc/inc/column.hxx                   |    2 
 sc/inc/document.hxx                 |    2 
 sc/inc/table.hxx                    |    2 
 sc/qa/unit/ucalc.cxx                |   40 +++---
 sc/source/core/data/column2.cxx     |  227 +++++++++++++++++++++++++++++++-----
 sc/source/core/data/documen2.cxx    |    2 
 sc/source/core/data/document.cxx    |    2 
 sc/source/core/data/formulacell.cxx |   13 --
 sc/source/core/data/table1.cxx      |    2 
 10 files changed, 231 insertions(+), 63 deletions(-)

New commits:
commit be4db37dddc261c2fe86bdaa67c4c042d2b0b0a3
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Jun 28 11:50:25 2013 -0400

    ResolveStaticReference() to also dynamically recalc formula cells.
    
    Change-Id: If42e5105be0e6db7c63d7c4e7c43de23716d6cbf

diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index c2ce0e5..55fb97a 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1862,13 +1862,10 @@ formula::FormulaTokenRef ScColumn::ResolveStaticReference( SCROW nRow )
         case sc::element_type_formula:
         {
             ScFormulaCell* p = sc::formula_block::at(*it->data, aPos.second);
-            if (p->GetDirty())
-                // Dirty formula cell is not considered static (for now).
-                // Return null token. Later we will switch to dynamically
-                // interpreting all dirty formula cells.
-                return formula::FormulaTokenRef();
+            if (p->IsValue())
+                return formula::FormulaTokenRef(new formula::FormulaDoubleToken(p->GetValue()));
 
-            return formula::FormulaTokenRef(new formula::FormulaDoubleToken(p->GetResultDouble()));
+            return formula::FormulaTokenRef(new formula::FormulaStringToken(p->GetString()));
         }
         case sc::element_type_empty:
         default:
@@ -1884,28 +1881,34 @@ class ToMatrixHandler
     ScMatrix& mrMat;
     SCCOL mnMatCol;
     SCROW mnTopRow;
-    bool mbSuccess;
 public:
     ToMatrixHandler(ScMatrix& rMat, SCCOL nMatCol, SCROW nTopRow) :
-        mrMat(rMat), mnMatCol(nMatCol), mnTopRow(nTopRow), mbSuccess(true) {}
+        mrMat(rMat), mnMatCol(nMatCol), mnTopRow(nTopRow) {}
 
     void operator() (size_t nRow, double fVal)
     {
         mrMat.PutDouble(fVal, mnMatCol, nRow - mnTopRow);
     }
 
-    void operator() (size_t nRow, ScFormulaCell* p)
+    void operator() (size_t nRow, const ScFormulaCell* p)
     {
-        if (p->GetDirty())
-        {
-            mbSuccess = false;
-            return;
-        }
+        // Formula cell may need to re-calculate.
+        ScFormulaCell& rCell = const_cast<ScFormulaCell&>(*p);
+        if (rCell.IsValue())
+            mrMat.PutDouble(rCell.GetValue(), mnMatCol, nRow - mnTopRow);
+        else
+            mrMat.PutString(rCell.GetString(), mnMatCol, nRow - mnTopRow);
+    }
 
-        mrMat.PutDouble(p->GetResultDouble(), mnMatCol, nRow - mnTopRow);
+    void operator() (size_t nRow, const OUString& rStr)
+    {
+        mrMat.PutString(rStr, mnMatCol, nRow - mnTopRow);
     }
 
-    bool isSuccess() const { return mbSuccess; }
+    void operator() (size_t nRow, const EditTextObject* pStr)
+    {
+        mrMat.PutString(ScEditUtil::GetString(*pStr), mnMatCol, nRow - mnTopRow);
+    }
 };
 
 }
@@ -1916,8 +1919,8 @@ bool ScColumn::ResolveStaticReference( ScMatrix& rMat, SCCOL nMatCol, SCROW nRow
         return false;
 
     ToMatrixHandler aFunc(rMat, nMatCol, nRow1);
-    sc::ProcessFormulaNumeric(maCells.begin(), maCells, nRow1, nRow2, aFunc);
-    return aFunc.isSuccess();
+    sc::ParseAllNonEmpty(maCells.begin(), maCells, nRow1, nRow2, aFunc);
+    return true;
 }
 
 namespace {
commit 3c339eb948ca49b3b7ca31d9267dbd98a6fa708f
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Jun 28 11:29:14 2013 -0400

    Have FetchDoubleArray() to optionally calculate dependent formula cells.
    
    Change-Id: Ide29df664ff002f9cd8fe3edbf9512dd0cbb9eb6

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index eef6442..13a0651 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -464,7 +464,7 @@ public:
     formula::FormulaTokenRef ResolveStaticReference( SCROW nRow );
     bool ResolveStaticReference( ScMatrix& rMat, SCCOL nMatCol, SCROW nRow1, SCROW nRow2 );
     void FillMatrix( ScMatrix& rMat, size_t nMatCol, SCROW nRow1, SCROW nRow2 ) const;
-    const double* FetchDoubleArray( sc::FormulaGroupContext& rCxt, SCROW nRow1, SCROW nRow2 ) const;
+    const double* FetchDoubleArray( sc::FormulaGroupContext& rCxt, SCROW nRow1, SCROW nRow2 );
     void SetFormulaResults( SCROW nRow, const double* pResults, size_t nLen );
 
     void SetNumberFormat( SCROW nRow, sal_uInt32 nNumberFormat );
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 12cd7ff..3d12935 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1979,7 +1979,7 @@ public:
     formula::FormulaTokenRef ResolveStaticReference( const ScRange& rRange );
 
     const double* FetchDoubleArray(
-        sc::FormulaGroupContext& rCxt, const ScAddress& rPos, SCROW nLength ) const;
+        sc::FormulaGroupContext& rCxt, const ScAddress& rPos, SCROW nLength );
 
     SvtBroadcaster* GetBroadcaster( const ScAddress& rPos );
     const SvtBroadcaster* GetBroadcaster( const ScAddress& rPos ) const;
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 0d0aa8e..41dd35e 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -836,7 +836,7 @@ public:
     formula::FormulaTokenRef ResolveStaticReference( SCCOL nCol, SCROW nRow );
     formula::FormulaTokenRef ResolveStaticReference( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
     const double* FetchDoubleArray(
-        sc::FormulaGroupContext& rCxt, SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const;
+        sc::FormulaGroupContext& rCxt, SCCOL nCol, SCROW nRow1, SCROW nRow2 );
 
     ScRefCellValue GetRefCellValue( SCCOL nCol, SCROW nRow );
 
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 5b2e718..c2ce0e5 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -2076,23 +2076,189 @@ void ScColumn::FillMatrix( ScMatrix& rMat, size_t nMatCol, SCROW nRow1, SCROW nR
     sc::ParseBlock(maCells.begin(), maCells, aFunc, nRow1, nRow2);
 }
 
-const double* ScColumn::FetchDoubleArray( sc::FormulaGroupContext& /*rCxt*/, SCROW nRow1, SCROW nRow2 ) const
+namespace {
+
+bool appendDouble(
+    sc::FormulaGroupContext::DoubleArrayType& rArray, size_t nLen,
+    sc::CellStoreType::iterator it, const sc::CellStoreType::iterator& itEnd )
 {
-    // TODO: I'll use the context object later.
-    if (nRow1 > nRow2)
-        return NULL;
+    size_t nLenRemain = nLen;
+    for (; it != itEnd; ++it)
+    {
+        switch (it->type)
+        {
+            case sc::element_type_numeric:
+            {
+                sc::numeric_block::iterator itData = sc::numeric_block::begin(*it->data);
+                sc::numeric_block::iterator itDataEnd;
+                if (nLenRemain >= it->size)
+                {
+                    // Block is shorter than the remaining requested length.
+                    itDataEnd = sc::numeric_block::end(*it->data);
+                    nLenRemain -= it->size;
+                }
+                else
+                {
+                    itDataEnd = itData;
+                    std::advance(itDataEnd, nLenRemain);
+                    nLenRemain = 0;
+                }
 
-    std::pair<sc::CellStoreType::const_iterator,size_t> aPos = maCells.position(nRow1);
-    if (aPos.first->type != sc::element_type_numeric)
-        // This is not a numeric cell block.
+                for (; itData != itDataEnd; ++itData)
+                    rArray.push_back(*itData);
+            }
+            break;
+            case sc::element_type_formula:
+            {
+                sc::formula_block::iterator itData = sc::formula_block::begin(*it->data);
+                sc::formula_block::iterator itDataEnd;
+                if (nLenRemain >= it->size)
+                {
+                    // Block is shorter than the remaining requested length.
+                    itDataEnd = sc::formula_block::end(*it->data);
+                    nLenRemain -= it->size;
+                }
+                else
+                {
+                    itDataEnd = itData;
+                    std::advance(itDataEnd, nLenRemain);
+                    nLenRemain = 0;
+                }
+
+                for (; itData != itDataEnd; ++itData)
+                {
+                    ScFormulaCell& rFC = **itData;
+                    rArray.push_back(rFC.GetValue());
+                }
+            }
+            break;
+            case sc::element_type_empty:
+            {
+                // Fill it with 0's.
+                if (nLenRemain >= it->size)
+                {
+                    rArray.resize(rArray.size() + it->size, 0);
+                    nLenRemain -= it->size;
+                }
+                else
+                {
+                    rArray.resize(rArray.size() + nLenRemain, 0);
+                    nLenRemain = 0;
+                }
+            }
+            break;
+            case sc::element_type_string:
+            case sc::element_type_edittext:
+            default:
+                return false;
+        }
+
+        if (!nLenRemain)
+            return true;
+    }
+
+    return false;
+}
+
+}
+
+const double* ScColumn::FetchDoubleArray( sc::FormulaGroupContext& rCxt, SCROW nRow1, SCROW nRow2 )
+{
+    if (nRow1 > nRow2)
         return NULL;
 
+    size_t nLenRequested = nRow2 - nRow1 + 1;
+    sc::CellStoreType::position_type aPos = maCells.position(nRow1);
     size_t nLen = aPos.first->size - aPos.second;
-    if (static_cast<SCROW>(nLen) < nRow2 - nRow1 + 1)
-        // Array shorter than requested.
-        return NULL;
+    switch (aPos.first->type)
+    {
+        case sc::element_type_numeric:
+        {
+            // This is a numeric cell block.
+            if (nLenRequested <= nLen)
+                // Requested length fits a single block.
+                return &sc::numeric_block::at(*aPos.first->data, aPos.second);
+
+            // Allocate a new array and copy the values to it.
+            sc::numeric_block::const_iterator it = sc::numeric_block::begin(*aPos.first->data);
+            sc::numeric_block::const_iterator itEnd = sc::numeric_block::end(*aPos.first->data);
+            std::advance(it, aPos.second);
+            rCxt.maArrays.push_back(new sc::FormulaGroupContext::DoubleArrayType(it, itEnd));
+            sc::FormulaGroupContext::DoubleArrayType& rArray = rCxt.maArrays.back();
+            rArray.reserve(nLenRequested);
+
+            // Fill the remaining array with values from the following blocks.
+            ++aPos.first;
+            if (!appendDouble(rArray, nLenRequested - nLen, aPos.first, maCells.end()))
+                return NULL;
+
+            return &rArray[0];
+        }
+        break;
+        case sc::element_type_formula:
+        {
+            rCxt.maArrays.push_back(new sc::FormulaGroupContext::DoubleArrayType);
+            sc::FormulaGroupContext::DoubleArrayType& rArray = rCxt.maArrays.back();
+            rArray.reserve(nLenRequested);
+
+            sc::formula_block::const_iterator it = sc::formula_block::begin(*aPos.first->data);
+            sc::formula_block::const_iterator itEnd;
+            if (nLenRequested <= nLen)
+            {
+                // Requested length is within a single block.
+                itEnd = it;
+                std::advance(itEnd, nLenRequested);
+                for (; it != itEnd; ++it)
+                {
+                    ScFormulaCell& rCell = **it;
+                    rArray.push_back(rCell.GetValue()); // the cell may be interpreted.
+                }
+
+                return &rArray[0];
+            }
+
+            itEnd = sc::formula_block::end(*aPos.first->data);
+            std::advance(itEnd, nLenRequested);
+            for (; it != itEnd; ++it)
+            {
+                ScFormulaCell& rCell = **it;
+                rArray.push_back(rCell.GetValue()); // the cell may be interpreted.
+            }
+
+            // Fill the remaining array with values from the following blocks.
+            ++aPos.first;
+            if (!appendDouble(rArray, nLenRequested - nLen, aPos.first, maCells.end()))
+                return NULL;
+
+            return &rArray[0];
+        }
+        break;
+        case sc::element_type_empty:
+        {
+            if (nLenRequested <= nLen)
+            {
+                // Fill the whole length with zero.
+                rCxt.maArrays.push_back(new sc::FormulaGroupContext::DoubleArrayType(nLenRequested, 0.0));
+                return &rCxt.maArrays.back()[0];
+            }
+
+            // Fill the array with zero for the length of the empty block.
+            rCxt.maArrays.push_back(new sc::FormulaGroupContext::DoubleArrayType(nLen, 0.0));
+            sc::FormulaGroupContext::DoubleArrayType& rArray = rCxt.maArrays.back();
+            rArray.reserve(nLenRequested);
+
+            // Fill the remaining array with values from the following blocks.
+            ++aPos.first;
+            if (!appendDouble(rArray, nLenRequested - nLen, aPos.first, maCells.end()))
+                return NULL;
+
+            return &rArray[0];
+        }
+        default:
+            ;
+    }
 
-    return &sc::numeric_block::at(*aPos.first->data, aPos.second);
+    return NULL;
 }
 
 void ScColumn::SetFormulaResults( SCROW nRow, const double* pResults, size_t nLen )
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 1e23d7a..9e0c4af 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -1608,7 +1608,7 @@ formula::FormulaTokenRef ScDocument::ResolveStaticReference( const ScRange& rRan
 }
 
 const double* ScDocument::FetchDoubleArray(
-    sc::FormulaGroupContext& rCxt, const ScAddress& rPos, SCROW nLength ) const
+    sc::FormulaGroupContext& rCxt, const ScAddress& rPos, SCROW nLength )
 {
     SCTAB nTab = rPos.Tab();
     if (!TableExists(nTab))
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 8c2ed77..9c0a2b5 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -2956,13 +2956,13 @@ namespace {
 
 class GroupTokenConverter
 {
-    sc::FormulaGroupContext maCxt;
+    sc::FormulaGroupContext& mrCxt;
     ScTokenArray& mrGroupTokens;
     ScDocument& mrDoc;
     ScFormulaCell& mrCell;
 public:
-    GroupTokenConverter(ScTokenArray& rGroupTokens, ScDocument& rDoc, ScFormulaCell& rCell) :
-        mrGroupTokens(rGroupTokens), mrDoc(rDoc), mrCell(rCell) {}
+    GroupTokenConverter(sc::FormulaGroupContext& rCxt, ScTokenArray& rGroupTokens, ScDocument& rDoc, ScFormulaCell& rCell) :
+        mrCxt(rCxt), mrGroupTokens(rGroupTokens), mrDoc(rDoc), mrCell(rCell) {}
 
     bool convert(ScTokenArray& rCode)
     {
@@ -2993,7 +2993,7 @@ public:
                         // we finish cell storage rework, we'll support temporary
                         // generation of a double array which is a combination of
                         // multiple cell array segments.
-                        const double* pArray = mrDoc.FetchDoubleArray(maCxt, aRefPos, mrCell.GetCellGroup()->mnLength);
+                        const double* pArray = mrDoc.FetchDoubleArray(mrCxt, aRefPos, mrCell.GetCellGroup()->mnLength);
                         if (!pArray)
                             return false;
 
@@ -3035,7 +3035,7 @@ public:
                         for (SCCOL i = aRef.Ref1.nCol; i <= aRef.Ref2.nCol; ++i)
                         {
                             aRefPos.SetCol(i);
-                            const double* pArray = mrDoc.FetchDoubleArray(maCxt, aRefPos, nArrayLength);
+                            const double* pArray = mrDoc.FetchDoubleArray(mrCxt, aRefPos, nArrayLength);
                             if (!pArray)
                                 return false;
 
@@ -3123,9 +3123,8 @@ bool ScFormulaCell::InterpretFormulaGroup()
         return InterpretInvariantFormulaGroup();
 
     sc::FormulaGroupContext aCxt;
-
     ScTokenArray aCode;
-    GroupTokenConverter aConverter(aCode, *pDocument, *this);
+    GroupTokenConverter aConverter(aCxt, aCode, *pDocument, *this);
     if (!aConverter.convert(*pCode))
         return false;
     return sc::FormulaGroupInterpreter::getStatic()->interpret(*pDocument, aPos, xGroup, aCode);
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 2d90fa9..dcd0344 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -2156,7 +2156,7 @@ formula::FormulaTokenRef ScTable::ResolveStaticReference( SCCOL nCol1, SCROW nRo
 }
 
 const double* ScTable::FetchDoubleArray(
-    sc::FormulaGroupContext& rCxt, SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const
+    sc::FormulaGroupContext& rCxt, SCCOL nCol, SCROW nRow1, SCROW nRow2 )
 {
     if (nRow2 < nRow1)
         return NULL;
commit 6e53dadc46bf0be0345bb12fdbc7a71811621f9f
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Jun 27 20:11:14 2013 -0400

    These test were removed by accident.
    
    Change-Id: I11ec1972c714b867f3b1be71a45b8e3d65cce656

diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 74888f0..0b3970f 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -37,6 +37,8 @@ endif
 
 $(eval $(call gb_Module_add_check_targets,sc,\
     CppunitTest_sc_ucalc \
+    CppunitTest_sc_filters_test \
+    CppunitTest_sc_rangelst_test \
 ))
 
 $(eval $(call gb_Module_add_slowcheck_targets,sc, \
commit 8f99e30ff74af0e9b301b3c28e496182593a59c7
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Jun 27 18:38:06 2013 -0400

    Specify type for cppunit macros.
    
    Change-Id: Ia639be24af7dd480fbe45530673ff01b700de324

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 3d3b353..9fc681e 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -6242,15 +6242,15 @@ void Test::testSharedFormulas()
     m_pDoc->SetString(aPos, "=A11*2");
     pFC = m_pDoc->GetFormulaCell(aPos);
     CPPUNIT_ASSERT_MESSAGE("This cell is expected to be a shared formula cell.", pFC && pFC->IsShared());
-    CPPUNIT_ASSERT_EQUAL(9, pFC->GetSharedTopRow());
-    CPPUNIT_ASSERT_EQUAL(2, pFC->GetSharedLength());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(9), pFC->GetSharedTopRow());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength());
 
     aPos.SetRow(8); // B9
     m_pDoc->SetString(aPos, "=A9*2");
     pFC = m_pDoc->GetFormulaCell(aPos);
     CPPUNIT_ASSERT_MESSAGE("This cell is expected to be a shared formula cell.", pFC && pFC->IsShared());
-    CPPUNIT_ASSERT_EQUAL(8, pFC->GetSharedTopRow());
-    CPPUNIT_ASSERT_EQUAL(3, pFC->GetSharedLength());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedTopRow());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(3), pFC->GetSharedLength());
 
     aPos.SetRow(12); // B13
     m_pDoc->SetString(aPos, "=A13*2");
@@ -6262,8 +6262,8 @@ void Test::testSharedFormulas()
     m_pDoc->SetString(aPos, "=A12*2");
     pFC = m_pDoc->GetFormulaCell(aPos);
     CPPUNIT_ASSERT_MESSAGE("This cell is expected to be a shared formula cell.", pFC && pFC->IsShared());
-    CPPUNIT_ASSERT_EQUAL(8, pFC->GetSharedTopRow());
-    CPPUNIT_ASSERT_EQUAL(5, pFC->GetSharedLength());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedTopRow());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(5), pFC->GetSharedLength());
 
     // Insert formulas to B15:B16.
     aPos.SetRow(14); // B15
@@ -6272,16 +6272,16 @@ void Test::testSharedFormulas()
     m_pDoc->SetString(aPos, "=A16*2");
     pFC = m_pDoc->GetFormulaCell(aPos);
     CPPUNIT_ASSERT_MESSAGE("This cell is expected to be a shared formula cell.", pFC && pFC->IsShared());
-    CPPUNIT_ASSERT_EQUAL(14, pFC->GetSharedTopRow());
-    CPPUNIT_ASSERT_EQUAL(2, pFC->GetSharedLength());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(14), pFC->GetSharedTopRow());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength());
 
     // Insert a formula to B14, and B9:B16 should be shared.
     aPos.SetRow(13); // B14
     m_pDoc->SetString(aPos, "=A14*2");
     pFC = m_pDoc->GetFormulaCell(aPos);
     CPPUNIT_ASSERT_MESSAGE("This cell is expected to be a shared formula cell.", pFC && pFC->IsShared());
-    CPPUNIT_ASSERT_EQUAL(8, pFC->GetSharedTopRow());
-    CPPUNIT_ASSERT_EQUAL(8, pFC->GetSharedLength());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedTopRow());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedLength());
 
     // Insert an incompatible formula to B12, to split the shared range to B9:B11 and B13:B16.
     aPos.SetRow(11); // B12
@@ -6292,14 +6292,14 @@ void Test::testSharedFormulas()
     aPos.SetRow(8); // B9
     pFC = m_pDoc->GetFormulaCell(aPos);
     CPPUNIT_ASSERT_MESSAGE("This cell is expected to be a shared formula cell.", pFC && pFC->IsShared());
-    CPPUNIT_ASSERT_EQUAL(8, pFC->GetSharedTopRow());
-    CPPUNIT_ASSERT_EQUAL(3, pFC->GetSharedLength());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedTopRow());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(3), pFC->GetSharedLength());
 
     aPos.SetRow(12); // B13
     pFC = m_pDoc->GetFormulaCell(aPos);
     CPPUNIT_ASSERT_MESSAGE("This cell is expected to be a shared formula cell.", pFC && pFC->IsShared());
-    CPPUNIT_ASSERT_EQUAL(12, pFC->GetSharedTopRow());
-    CPPUNIT_ASSERT_EQUAL(4, pFC->GetSharedLength());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(12), pFC->GetSharedTopRow());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(4), pFC->GetSharedLength());
 
     // Extend B13:B16 to B13:B20.
     aPos.SetRow(16); // B17
@@ -6312,8 +6312,8 @@ void Test::testSharedFormulas()
     m_pDoc->SetString(aPos, "=A20*2");
     pFC = m_pDoc->GetFormulaCell(aPos);
     CPPUNIT_ASSERT_MESSAGE("This cell is expected to be a shared formula cell.", pFC && pFC->IsShared());
-    CPPUNIT_ASSERT_EQUAL(12, pFC->GetSharedTopRow());
-    CPPUNIT_ASSERT_EQUAL(8, pFC->GetSharedLength());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(12), pFC->GetSharedTopRow());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedLength());
 
 #if 0
     // Insert empty rows at B16 to split B13:B20 into B13:B15 and B21:B25.
@@ -6322,14 +6322,14 @@ void Test::testSharedFormulas()
     aPos.SetRow(12); // B13
     pFC = m_pDoc->GetFormulaCell(aPos);
     CPPUNIT_ASSERT_MESSAGE("This cell is expected to be a shared formula cell.", pFC && pFC->IsShared());
-    CPPUNIT_ASSERT_EQUAL(12, pFC->GetSharedTopRow());
-    CPPUNIT_ASSERT_EQUAL(3, pFC->GetSharedLength());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(12), pFC->GetSharedTopRow());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(3), pFC->GetSharedLength());
 
     aPos.SetRow(23); // B24
     pFC = m_pDoc->GetFormulaCell(aPos);
     CPPUNIT_ASSERT_MESSAGE("This cell is expected to be a shared formula cell.", pFC && pFC->IsShared());
-    CPPUNIT_ASSERT_EQUAL(20, pFC->GetSharedTopRow());
-    CPPUNIT_ASSERT_EQUAL(5, pFC->GetSharedLength());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(20), pFC->GetSharedTopRow());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(5), pFC->GetSharedLength());
 #endif
 
     m_pDoc->DeleteTab(0);
commit 72a117f73b71ba98856456cd98c905981bc966e9
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Jun 27 16:47:17 2013 -0400

    We don't need these header includes.
    
    Change-Id: Ia2f7226fa3c7dc5ac98bd23833e67d7262cd8b9b

diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 6c520a0..3869f6e 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -86,8 +86,6 @@
 #include "macromgr.hxx"
 #include "formulacell.hxx"
 #include "clipcontext.hxx"
-#include "interpre.hxx"
-#include "formulagroup.hxx"
 
 using namespace com::sun::star;
 


More information about the Libreoffice-commits mailing list