[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Mon Apr 29 12:16:23 PDT 2013
sc/inc/column.hxx | 2 +-
sc/source/core/data/column.cxx | 13 ++-----------
sc/source/core/data/column2.cxx | 1 +
sc/source/core/data/column3.cxx | 15 ++-------------
4 files changed, 6 insertions(+), 25 deletions(-)
New commits:
commit 5f461f32fea980df4d89fbbbc815800d8d5deb40
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 29 15:17:47 2013 -0400
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
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 6b3202a..9b6e614 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 17bbe68..da9aa3c 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 25725ae..434edad 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 615fbaf..63b3a5f 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: */
More information about the Libreoffice-commits
mailing list