diff options
author | Tor Lillqvist <tml@collabora.com> | 2013-11-20 16:41:51 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2013-11-20 18:23:07 +0000 |
commit | 0c7e7043bdeab5ad683e9621573441891ef4868b (patch) | |
tree | 23540757510ed503056244c4fc8d0d4bf78c14f7 /sc | |
parent | 4787398ff07fe1bfe34ea878e9c8ee96e5d9994f (diff) |
Fix a few of my own thinkos, and add some assertions
Fix two obvious mistakes from 8c37bafbc5adc0c79f218f9db2dc25ca8e683125.
Add asserts to make sure the calls to ScFormulaCell::CreateCellGroup() that
now don't take the nStart parameter any more (but assume that the cell for
which this methoid is called is the start one) match the old ones in semantics.
Change-Id: I50cb0cdaf620253881225baf39ae9cd935917b27
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/column3.cxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/sharedformula.cxx | 1 | ||||
-rw-r--r-- | sc/source/filter/oox/formulabuffer.cxx | 6 |
4 files changed, 11 insertions, 3 deletions
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 141240f029b0..7a7f0a7cdea1 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2786,13 +2786,14 @@ public: nRow += xCurGrp->mnLength; std::advance(it, xCurGrp->mnLength); pPrev->SetCellGroup(xCurGrp); - --xCurGrp->mpTopCell = pPrev; + xCurGrp->mpTopCell = pPrev; ++xCurGrp->mnLength; xPrevGrp = xCurGrp; } else { // Both previous and current cells are regular cells. + assert(pPrev->aPos.Row() == (SCROW)(nRow - 1)); xPrevGrp = pPrev->CreateCellGroup(2, eCompState == ScFormulaCell::EqualInvariant); pCur->SetCellGroup(xPrevGrp); ++nRow; diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 9f6465f78160..6144c09fae14 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3329,8 +3329,12 @@ void ScFormulaCell::SetNextTrack( ScFormulaCell* pF ) { pNextTr ScFormulaCellGroupRef ScFormulaCell::CreateCellGroup( SCROW nLen, bool bInvariant ) { if (mxGroup) + { // You can't create a new group if the cell is already a part of a group. + // Is this a sign of some inconsistent or incorrect data structures? Or normal? + SAL_INFO("sc.opencl", "You can't create a new group if the cell is already a part of a group"); return ScFormulaCellGroupRef(); + } mxGroup.reset(new ScFormulaCellGroup); mxGroup->mpTopCell = this; diff --git a/sc/source/core/tool/sharedformula.cxx b/sc/source/core/tool/sharedformula.cxx index 20eef831a956..ed35690a63a7 100644 --- a/sc/source/core/tool/sharedformula.cxx +++ b/sc/source/core/tool/sharedformula.cxx @@ -151,6 +151,7 @@ void SharedFormulaUtil::joinFormulaCells(const CellStoreType::position_type& rPo else { // neither cells are shared. + assert(rCell1.aPos.Row() == (SCROW)(rPos.first->position + rPos.second)); xGroup1 = rCell1.CreateCellGroup(2, eState == ScFormulaCell::EqualInvariant); rCell2.SetCellGroup(xGroup1); } diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index ca48ecab3914..cb427f2dd97a 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -197,9 +197,11 @@ void applyCellFormulas( ScFormulaCell& rPrev = *p->mpCell; ScFormulaCellGroupRef xGroup = rPrev.GetCellGroup(); if (!xGroup) + { // Last cell is not grouped yet. Start a new group. - xGroup = rPrev.CreateCellGroup(p->mnRow, false); - + assert(rPrev.aPos.Row() == p->mnRow); + xGroup = rPrev.CreateCellGroup(1, false); + } ++xGroup->mnLength; pCell = new ScFormulaCell(&rDoc.getDoc(), aPos, xGroup); |