summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-04-29 15:17:47 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-04-30 13:10:42 -0400
commitd9f9c9ddfb49d297526d931925374163caa2f43d (patch)
tree46b546ff8c26a6582ccd69ec1d22ce08169c54d0 /sc
parent27a5bafeb6f18811d5d1414b8ce56f0fe89cd055 (diff)
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
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/column.hxx2
-rw-r--r--sc/source/core/data/column.cxx13
-rw-r--r--sc/source/core/data/column2.cxx1
-rw-r--r--sc/source/core/data/column3.cxx15
4 files changed, 6 insertions, 25 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 6b3202ae6f1c..9b6e614de024 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -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;
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 17bbe687ceb8..da9aa3c13a9a 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -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++)
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 25725ae5fa57..434edad81474 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1398,6 +1398,7 @@ SCROW ScColumn::FindNextVisibleRowWithContent(SCROW nRow, bool bForward) const
void ScColumn::CellStorageModified()
{
+ mbDirtyGroups = true;
#if DEBUG_COLUMN_STORAGE
if (maItems.empty())
{
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 615fbaf8c30e..63b3a5ff7b55 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -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: */