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

CellStorageModified() is the right (and only) place to mark group dirty.

CellStorageModified is supposed to be called whenever the cell array
content changes. We should take advantage of it.

Change-Id: Ib1cd0e91f3d5a3d03d2172ed6cc916520d1baa49
üst 27a5bafe
......@@ -139,7 +139,7 @@ class ScColumn
ScAttrArray* pAttrArray;
ScDocument* pDocument;
bool bDirtyGroups; /// formula groups are dirty.
bool mbDirtyGroups; /// formula groups are dirty.
friend class ScDocument; // for FillInfo
friend class ScDocumentIterator;
......
......@@ -116,7 +116,7 @@ ScColumn::ScColumn() :
nCol( 0 ),
pAttrArray( NULL ),
pDocument( NULL ),
bDirtyGroups( true )
mbDirtyGroups(true)
{
}
......@@ -134,7 +134,6 @@ void ScColumn::Init(SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc)
nTab = nNewTab;
pDocument = pDoc;
pAttrArray = new ScAttrArray( nCol, nTab, pDocument );
bDirtyGroups = true;
}
......@@ -893,8 +892,6 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
::std::swap( pCell1, pCell2 );
}
bDirtyGroups = true;
// from here: first cell (pCell1, nIndex1) exists always
ScAddress aPos1( nCol, nRow1, nTab );
......@@ -1054,8 +1051,6 @@ void ScColumn::SwapCell( SCROW nRow, ScColumn& rCol)
return;
}
bDirtyGroups = true;
// from here: own cell (pCell1, nIndex1) exists always
ScFormulaCell* pFmlaCell1 = (pCell1->GetCellType() == CELLTYPE_FORMULA) ? static_cast< ScFormulaCell* >( pCell1 ) : 0;
......@@ -1175,8 +1170,6 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize )
if ( i >= maItems.size() )
return ;
bDirtyGroups = true;
bool bOldAutoCalc = pDocument->GetAutoCalc();
pDocument->SetAutoCalc( false ); // avoid recalculations
......@@ -1711,9 +1704,7 @@ void ScColumn::SwapCol(ScColumn& rCol)
pAttrArray->SetCol(nCol);
rCol.pAttrArray->SetCol(rCol.nCol);
bool bDirty = bDirtyGroups;
bDirtyGroups = rCol.bDirtyGroups;
rCol.bDirtyGroups = bDirty;
std::swap(mbDirtyGroups, rCol.mbDirtyGroups);
SCSIZE i;
for (i = 0; i < maItems.size(); i++)
......
......@@ -1398,6 +1398,7 @@ SCROW ScColumn::FindNextVisibleRowWithContent(SCROW nRow, bool bForward) const
void ScColumn::CellStorageModified()
{
mbDirtyGroups = true;
#if DEBUG_COLUMN_STORAGE
if (maItems.empty())
{
......
......@@ -87,7 +87,6 @@ void ScColumn::Insert( SCROW nRow, ScBaseCell* pNewCell )
ScAddress( nCol, nRow, nTab ), pNewCell->GetBroadcaster()) );
}
}
bDirtyGroups = true;
}
......@@ -95,7 +94,6 @@ void ScColumn::Insert( SCROW nRow, sal_uInt32 nNumberFormat, ScBaseCell* pCell )
{
Insert(nRow, pCell);
SetNumberFormat(nRow, nNumberFormat);
bDirtyGroups = true;
}
......@@ -105,7 +103,6 @@ void ScColumn::Append( SCROW nRow, ScBaseCell* pCell )
maItems.back().pCell = pCell;
maItems.back().nRow = nRow;
bDirtyGroups = true;
maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY);
maScriptTypes.set<unsigned short>(nRow, SC_SCRIPTTYPE_UNKNOWN);
CellStorageModified();
......@@ -138,7 +135,6 @@ void ScColumn::Delete( SCROW nRow )
if (pCell->GetCellType() == CELLTYPE_FORMULA)
static_cast<ScFormulaCell*>(pCell)->EndListeningTo(pDocument);
pCell->Delete();
bDirtyGroups = true;
CellStorageModified();
}
......@@ -159,7 +155,6 @@ void ScColumn::DeleteAtIndex( SCSIZE nIndex )
static_cast<ScFormulaCell*>(pCell)->EndListeningTo(pDocument);
pCell->Delete();
bDirtyGroups = true;
maTextWidths.set_empty(nRow, nRow);
maScriptTypes.set_empty(nRow, nRow);
CellStorageModified();
......@@ -196,8 +191,6 @@ void ScColumn::DeleteRow( SCROW nStartRow, SCSIZE nSize )
sal_Bool bOldAutoCalc = pDocument->GetAutoCalc();
pDocument->SetAutoCalc( false ); // Avoid calculating it multiple times
bDirtyGroups = true;
sal_Bool bFound=false;
SCROW nEndRow = nStartRow + nSize - 1;
SCSIZE nStartIndex = 0;
......@@ -526,8 +519,6 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe
(*aIt)->Delete();
}
}
bDirtyGroups = true;
}
......@@ -575,8 +566,6 @@ void ScColumn::DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag)
// Delete attributes just now
if ((nDelFlag & IDF_ATTRIB) == IDF_ATTRIB) pAttrArray->DeleteArea( nStartRow, nEndRow );
else if ((nDelFlag & IDF_ATTRIB) != 0) pAttrArray->DeleteHardAttr( nStartRow, nEndRow );
bDirtyGroups = true;
}
......@@ -2072,7 +2061,7 @@ public:
// of similar formulae into a formulagroup
void ScColumn::RebuildFormulaGroups()
{
if ( maItems.empty() || !bDirtyGroups )
if ( maItems.empty() || !mbDirtyGroups )
return;
// clear double groups
......@@ -2180,7 +2169,7 @@ void ScColumn::RebuildFormulaGroups()
}
#endif
bDirtyGroups = false;
mbDirtyGroups = false;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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