diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-14 22:35:43 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-15 11:37:06 -0400 |
commit | 632290663a9d2bc722ddfb96aec049d7362204d6 (patch) | |
tree | fc6bd1619671c8419d5830b8017da9a0a12332c4 /sc/source | |
parent | 7ac77e31a54d0b0545ed039426405f2b0c96a6e3 (diff) |
Call CellStorageModified() *after* the text widths get modified.
So that I can put some integrity check code in there to test the
integrity of cell storage.
Change-Id: I0cc141ea74c27db1a014390b7abf807220e7be9f
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/column.cxx | 18 | ||||
-rw-r--r-- | sc/source/core/data/column3.cxx | 16 |
2 files changed, 16 insertions, 18 deletions
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 682afc66d116..e778f964483d 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -852,7 +852,6 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2) be performed (but keep broadcasters and notes at old position). */ maItems[nIndex1].pCell = pCell2; maItems[nIndex2].pCell = pCell1; - CellStorageModified(); SvtBroadcaster* pBC2 = pCell2->ReleaseBroadcaster(); pCell1->TakeBroadcaster( pBC2 ); @@ -863,6 +862,7 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2) unsigned short nVal2 = maTextWidths.get<unsigned short>(nRow2); maTextWidths.set<unsigned short>(nRow1, nVal2); maTextWidths.set<unsigned short>(nRow2, nVal1); + CellStorageModified(); } else { @@ -874,19 +874,18 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2) { // insert dummy note cell (without note) containing old broadcaster maItems[nIndex1].pCell = pDummyCell; - CellStorageModified(); } else { // remove ColEntry at old position maItems.erase( maItems.begin() + nIndex1 ); - CellStorageModified(); } // Empty text width at the cell 1 position. For now, we don't // transfer the old value to the cell 2 position since Insert() is // quite complicated. maTextWidths.set_empty(nRow1, nRow1); + CellStorageModified(); // insert ColEntry at new position. Insert( nRow2, pCell1 ); @@ -1013,14 +1012,14 @@ void ScColumn::SwapCell( SCROW nRow, ScColumn& rCol) pFmlaCell2->UpdateReference(URM_MOVE, aRange, -dx, 0, 0); } - CellStorageModified(); - rCol.CellStorageModified(); - // Swap the text widths. unsigned short nVal1 = maTextWidths.get<unsigned short>(nRow); unsigned short nVal2 = rCol.maTextWidths.get<unsigned short>(nRow); maTextWidths.set<unsigned short>(nRow, nVal2); rCol.maTextWidths.set<unsigned short>(nRow, nVal1); + + CellStorageModified(); + rCol.CellStorageModified(); } else { @@ -1037,8 +1036,9 @@ void ScColumn::SwapCell( SCROW nRow, ScColumn& rCol) pFmlaCell1->UpdateReference(URM_MOVE, aRange, dx, 0, 0); } - CellStorageModified(); maTextWidths.set_empty(nRow, nRow); + CellStorageModified(); + // We don't transfer the text width to the destination column because // of Insert()'s complexity. @@ -1189,8 +1189,8 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize ) pDocument->SetAutoCalc( bOldAutoCalc ); - CellStorageModified(); maTextWidths.insert_empty(nStartRow, nSize); + CellStorageModified(); } @@ -1691,8 +1691,8 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol) if (bErased) { - CellStorageModified(); maTextWidths.set_empty(nStartRow, nEndRow); + CellStorageModified(); } } } diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 57b5370dcfef..cc25641893a2 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -88,17 +88,16 @@ void ScColumn::Insert( SCROW nRow, ScBaseCell* pNewCell ) } pOldCell->Delete(); maItems[nIndex].pCell = pNewCell; - CellStorageModified(); } else { maItems.insert(maItems.begin() + nIndex, ColEntry()); maItems[nIndex].pCell = pNewCell; maItems[nIndex].nRow = nRow; - CellStorageModified(); } maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY); + CellStorageModified(); } // When we insert from the Clipboard we still have wrong (old) References! // First they are rewired in CopyBlockFromClip via UpdateReference and the @@ -142,8 +141,8 @@ void ScColumn::Append( SCROW nRow, ScBaseCell* pCell ) maItems.back().pCell = pCell; maItems.back().nRow = nRow; - CellStorageModified(); maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY); + CellStorageModified(); } @@ -156,7 +155,6 @@ void ScColumn::Delete( SCROW nRow ) ScBaseCell* pCell = maItems[nIndex].pCell; ScNoteCell* pNoteCell = new ScNoteCell; maItems[nIndex].pCell = pNoteCell; // Dummy for Interpret - CellStorageModified(); pDocument->Broadcast( ScHint( SC_HINT_DYING, ScAddress( nCol, nRow, nTab ), pCell ) ); if ( SvtBroadcaster* pBC = pCell->ReleaseBroadcaster() ) @@ -167,13 +165,13 @@ void ScColumn::Delete( SCROW nRow ) { pNoteCell->Delete(); maItems.erase( maItems.begin() + nIndex); - CellStorageModified(); // Should we free memory here (delta)? It'll be slower! } pCell->EndListeningTo( pDocument ); pCell->Delete(); maTextWidths.set_empty(nRow, nRow); + CellStorageModified(); } } @@ -191,8 +189,8 @@ void ScColumn::DeleteAtIndex( SCSIZE nIndex ) pCell->EndListeningTo( pDocument ); pCell->Delete(); - CellStorageModified(); maTextWidths.set_empty(nRow, nRow); + CellStorageModified(); } @@ -202,8 +200,8 @@ void ScColumn::FreeAll() maItems[i].pCell->Delete(); maItems.clear(); - CellStorageModified(); maTextWidths.clear(); + CellStorageModified(); } @@ -502,8 +500,8 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe if (bRemoved) nShift += maItems.size() - nStartSegment; maItems.erase(maItems.end() - nShift, maItems.end()); - CellStorageModified(); maTextWidths.set_empty(nStartRow, nEndRow); + CellStorageModified(); } // *** delete all formula cells *** @@ -1430,8 +1428,8 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString, pOldCell->Delete(); maItems[i].pCell = pNewCell; // Replace + maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY); CellStorageModified(); - SetTextWidth(nRow, TEXTWIDTH_DIRTY); if ( pNewCell->GetCellType() == CELLTYPE_FORMULA ) { |