Kaydet (Commit) 63229066 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

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
üst 7ac77e31
...@@ -852,7 +852,6 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2) ...@@ -852,7 +852,6 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
be performed (but keep broadcasters and notes at old position). */ be performed (but keep broadcasters and notes at old position). */
maItems[nIndex1].pCell = pCell2; maItems[nIndex1].pCell = pCell2;
maItems[nIndex2].pCell = pCell1; maItems[nIndex2].pCell = pCell1;
CellStorageModified();
SvtBroadcaster* pBC2 = pCell2->ReleaseBroadcaster(); SvtBroadcaster* pBC2 = pCell2->ReleaseBroadcaster();
pCell1->TakeBroadcaster( pBC2 ); pCell1->TakeBroadcaster( pBC2 );
...@@ -863,6 +862,7 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2) ...@@ -863,6 +862,7 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
unsigned short nVal2 = maTextWidths.get<unsigned short>(nRow2); unsigned short nVal2 = maTextWidths.get<unsigned short>(nRow2);
maTextWidths.set<unsigned short>(nRow1, nVal2); maTextWidths.set<unsigned short>(nRow1, nVal2);
maTextWidths.set<unsigned short>(nRow2, nVal1); maTextWidths.set<unsigned short>(nRow2, nVal1);
CellStorageModified();
} }
else else
{ {
...@@ -874,19 +874,18 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2) ...@@ -874,19 +874,18 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
{ {
// insert dummy note cell (without note) containing old broadcaster // insert dummy note cell (without note) containing old broadcaster
maItems[nIndex1].pCell = pDummyCell; maItems[nIndex1].pCell = pDummyCell;
CellStorageModified();
} }
else else
{ {
// remove ColEntry at old position // remove ColEntry at old position
maItems.erase( maItems.begin() + nIndex1 ); maItems.erase( maItems.begin() + nIndex1 );
CellStorageModified();
} }
// Empty text width at the cell 1 position. For now, we don't // 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 // transfer the old value to the cell 2 position since Insert() is
// quite complicated. // quite complicated.
maTextWidths.set_empty(nRow1, nRow1); maTextWidths.set_empty(nRow1, nRow1);
CellStorageModified();
// insert ColEntry at new position. // insert ColEntry at new position.
Insert( nRow2, pCell1 ); Insert( nRow2, pCell1 );
...@@ -1013,14 +1012,14 @@ void ScColumn::SwapCell( SCROW nRow, ScColumn& rCol) ...@@ -1013,14 +1012,14 @@ void ScColumn::SwapCell( SCROW nRow, ScColumn& rCol)
pFmlaCell2->UpdateReference(URM_MOVE, aRange, -dx, 0, 0); pFmlaCell2->UpdateReference(URM_MOVE, aRange, -dx, 0, 0);
} }
CellStorageModified();
rCol.CellStorageModified();
// Swap the text widths. // Swap the text widths.
unsigned short nVal1 = maTextWidths.get<unsigned short>(nRow); unsigned short nVal1 = maTextWidths.get<unsigned short>(nRow);
unsigned short nVal2 = rCol.maTextWidths.get<unsigned short>(nRow); unsigned short nVal2 = rCol.maTextWidths.get<unsigned short>(nRow);
maTextWidths.set<unsigned short>(nRow, nVal2); maTextWidths.set<unsigned short>(nRow, nVal2);
rCol.maTextWidths.set<unsigned short>(nRow, nVal1); rCol.maTextWidths.set<unsigned short>(nRow, nVal1);
CellStorageModified();
rCol.CellStorageModified();
} }
else else
{ {
...@@ -1037,8 +1036,9 @@ void ScColumn::SwapCell( SCROW nRow, ScColumn& rCol) ...@@ -1037,8 +1036,9 @@ void ScColumn::SwapCell( SCROW nRow, ScColumn& rCol)
pFmlaCell1->UpdateReference(URM_MOVE, aRange, dx, 0, 0); pFmlaCell1->UpdateReference(URM_MOVE, aRange, dx, 0, 0);
} }
CellStorageModified();
maTextWidths.set_empty(nRow, nRow); maTextWidths.set_empty(nRow, nRow);
CellStorageModified();
// We don't transfer the text width to the destination column because // We don't transfer the text width to the destination column because
// of Insert()'s complexity. // of Insert()'s complexity.
...@@ -1189,8 +1189,8 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize ) ...@@ -1189,8 +1189,8 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize )
pDocument->SetAutoCalc( bOldAutoCalc ); pDocument->SetAutoCalc( bOldAutoCalc );
CellStorageModified();
maTextWidths.insert_empty(nStartRow, nSize); maTextWidths.insert_empty(nStartRow, nSize);
CellStorageModified();
} }
...@@ -1691,8 +1691,8 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol) ...@@ -1691,8 +1691,8 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol)
if (bErased) if (bErased)
{ {
CellStorageModified();
maTextWidths.set_empty(nStartRow, nEndRow); maTextWidths.set_empty(nStartRow, nEndRow);
CellStorageModified();
} }
} }
} }
......
...@@ -88,17 +88,16 @@ void ScColumn::Insert( SCROW nRow, ScBaseCell* pNewCell ) ...@@ -88,17 +88,16 @@ void ScColumn::Insert( SCROW nRow, ScBaseCell* pNewCell )
} }
pOldCell->Delete(); pOldCell->Delete();
maItems[nIndex].pCell = pNewCell; maItems[nIndex].pCell = pNewCell;
CellStorageModified();
} }
else else
{ {
maItems.insert(maItems.begin() + nIndex, ColEntry()); maItems.insert(maItems.begin() + nIndex, ColEntry());
maItems[nIndex].pCell = pNewCell; maItems[nIndex].pCell = pNewCell;
maItems[nIndex].nRow = nRow; maItems[nIndex].nRow = nRow;
CellStorageModified();
} }
maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY); maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY);
CellStorageModified();
} }
// When we insert from the Clipboard we still have wrong (old) References! // When we insert from the Clipboard we still have wrong (old) References!
// First they are rewired in CopyBlockFromClip via UpdateReference and the // First they are rewired in CopyBlockFromClip via UpdateReference and the
...@@ -142,8 +141,8 @@ void ScColumn::Append( SCROW nRow, ScBaseCell* pCell ) ...@@ -142,8 +141,8 @@ void ScColumn::Append( SCROW nRow, ScBaseCell* pCell )
maItems.back().pCell = pCell; maItems.back().pCell = pCell;
maItems.back().nRow = nRow; maItems.back().nRow = nRow;
CellStorageModified();
maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY); maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY);
CellStorageModified();
} }
...@@ -156,7 +155,6 @@ void ScColumn::Delete( SCROW nRow ) ...@@ -156,7 +155,6 @@ void ScColumn::Delete( SCROW nRow )
ScBaseCell* pCell = maItems[nIndex].pCell; ScBaseCell* pCell = maItems[nIndex].pCell;
ScNoteCell* pNoteCell = new ScNoteCell; ScNoteCell* pNoteCell = new ScNoteCell;
maItems[nIndex].pCell = pNoteCell; // Dummy for Interpret maItems[nIndex].pCell = pNoteCell; // Dummy for Interpret
CellStorageModified();
pDocument->Broadcast( ScHint( SC_HINT_DYING, pDocument->Broadcast( ScHint( SC_HINT_DYING,
ScAddress( nCol, nRow, nTab ), pCell ) ); ScAddress( nCol, nRow, nTab ), pCell ) );
if ( SvtBroadcaster* pBC = pCell->ReleaseBroadcaster() ) if ( SvtBroadcaster* pBC = pCell->ReleaseBroadcaster() )
...@@ -167,13 +165,13 @@ void ScColumn::Delete( SCROW nRow ) ...@@ -167,13 +165,13 @@ void ScColumn::Delete( SCROW nRow )
{ {
pNoteCell->Delete(); pNoteCell->Delete();
maItems.erase( maItems.begin() + nIndex); maItems.erase( maItems.begin() + nIndex);
CellStorageModified();
// Should we free memory here (delta)? It'll be slower! // Should we free memory here (delta)? It'll be slower!
} }
pCell->EndListeningTo( pDocument ); pCell->EndListeningTo( pDocument );
pCell->Delete(); pCell->Delete();
maTextWidths.set_empty(nRow, nRow); maTextWidths.set_empty(nRow, nRow);
CellStorageModified();
} }
} }
...@@ -191,8 +189,8 @@ void ScColumn::DeleteAtIndex( SCSIZE nIndex ) ...@@ -191,8 +189,8 @@ void ScColumn::DeleteAtIndex( SCSIZE nIndex )
pCell->EndListeningTo( pDocument ); pCell->EndListeningTo( pDocument );
pCell->Delete(); pCell->Delete();
CellStorageModified();
maTextWidths.set_empty(nRow, nRow); maTextWidths.set_empty(nRow, nRow);
CellStorageModified();
} }
...@@ -202,8 +200,8 @@ void ScColumn::FreeAll() ...@@ -202,8 +200,8 @@ void ScColumn::FreeAll()
maItems[i].pCell->Delete(); maItems[i].pCell->Delete();
maItems.clear(); maItems.clear();
CellStorageModified();
maTextWidths.clear(); maTextWidths.clear();
CellStorageModified();
} }
...@@ -502,8 +500,8 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe ...@@ -502,8 +500,8 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe
if (bRemoved) if (bRemoved)
nShift += maItems.size() - nStartSegment; nShift += maItems.size() - nStartSegment;
maItems.erase(maItems.end() - nShift, maItems.end()); maItems.erase(maItems.end() - nShift, maItems.end());
CellStorageModified();
maTextWidths.set_empty(nStartRow, nEndRow); maTextWidths.set_empty(nStartRow, nEndRow);
CellStorageModified();
} }
// *** delete all formula cells *** // *** delete all formula cells ***
...@@ -1430,8 +1428,8 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString, ...@@ -1430,8 +1428,8 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
pOldCell->Delete(); pOldCell->Delete();
maItems[i].pCell = pNewCell; // Replace maItems[i].pCell = pNewCell; // Replace
maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY);
CellStorageModified(); CellStorageModified();
SetTextWidth(nRow, TEXTWIDTH_DIRTY);
if ( pNewCell->GetCellType() == CELLTYPE_FORMULA ) if ( pNewCell->GetCellType() == CELLTYPE_FORMULA )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment