[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Fri May 3 13:37:50 PDT 2013
sc/inc/brdcst.hxx | 1 -
sc/source/core/data/column.cxx | 2 +-
sc/source/core/data/column3.cxx | 13 ++++++-------
sc/source/core/data/formulacell.cxx | 2 +-
sc/source/core/tool/chartlis.cxx | 2 +-
sc/source/core/tool/lookupcache.cxx | 2 +-
sc/source/ui/docshell/servobj.cxx | 2 +-
sc/source/ui/unoobj/cellsuno.cxx | 2 +-
sc/source/ui/unoobj/chart2uno.cxx | 2 +-
9 files changed, 13 insertions(+), 15 deletions(-)
New commits:
commit 2ec086a11c2f61fd9bd703591e411793df11a700
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri May 3 16:39:10 2013 -0400
Remove SC_HINT_DYING. We don't do anything specific for this hint.
Use SC_HINT_DATACHANGED instead, and do broadcast *after* the cell is
removed from the cell array, to avoid the dying cell from being used
during recalculation after the broadcast.
Change-Id: I8eb31eafa50c737ab683ca697657e64e52ae52e7
diff --git a/sc/inc/brdcst.hxx b/sc/inc/brdcst.hxx
index 737e7e8..069f032 100644
--- a/sc/inc/brdcst.hxx
+++ b/sc/inc/brdcst.hxx
@@ -27,7 +27,6 @@
class SvtBroadcaster;
-#define SC_HINT_DYING SFX_HINT_DYING
#define SC_HINT_DATACHANGED SFX_HINT_DATACHANGED
#define SC_HINT_TABLEOPDIRTY SFX_HINT_USER00
#define SC_HINT_CALCALL SFX_HINT_USER01
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 4e061ab..e20521a 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1731,7 +1731,7 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol)
}
// Broadcast changes
ScAddress aAdr( nCol, 0, nTab );
- ScHint aHint( SC_HINT_DYING, aAdr, NULL ); // areas only
+ ScHint aHint(SC_HINT_DATACHANGED, aAdr, NULL); // areas only
ScAddress& rAddress = aHint.GetAddress();
// must iterate backwards, because indexes of following cells become invalid
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index dd22051..8983fa1 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -105,9 +105,6 @@ void ScColumn::Delete( SCROW nRow )
return;
ScBaseCell* pCell = maItems[nIndex].pCell;
- pDocument->Broadcast(
- ScHint(SC_HINT_DYING, ScAddress(nCol, nRow, nTab), GetBroadcaster(nRow)));
-
maItems.erase(maItems.begin() + nIndex);
maTextWidths.set_empty(nRow, nRow);
maScriptTypes.set_empty(nRow, nRow);
@@ -116,6 +113,9 @@ void ScColumn::Delete( SCROW nRow )
static_cast<ScFormulaCell*>(pCell)->EndListeningTo(pDocument);
pCell->Delete();
+ pDocument->Broadcast(
+ ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab), GetBroadcaster(nRow)));
+
CellStorageModified();
}
@@ -124,13 +124,14 @@ void ScColumn::DeleteAtIndex( SCSIZE nIndex )
{
ScBaseCell* pCell = maItems[nIndex].pCell;
SCROW nRow = maItems[nIndex].nRow;
- pDocument->Broadcast(
- ScHint(SC_HINT_DYING, ScAddress(nCol, nRow, nTab), GetBroadcaster(nRow)));
maItems.erase(maItems.begin() + nIndex);
if (pCell->GetCellType() == CELLTYPE_FORMULA)
static_cast<ScFormulaCell*>(pCell)->EndListeningTo(pDocument);
pCell->Delete();
+ pDocument->Broadcast(
+ ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab), GetBroadcaster(nRow)));
+
maTextWidths.set_empty(nRow, nRow);
maScriptTypes.set_empty(nRow, nRow);
CellStorageModified();
@@ -304,8 +305,6 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe
"paste cells" operation, which removes the caption objects later in
drawing undo. */
- ScHint aHint( SC_HINT_DYING, ScAddress( nCol, 0, nTab ), 0 );
-
// cache all formula cells, they will be deleted at end of this function
typedef ::std::vector< ScFormulaCell* > FormulaCellVector;
FormulaCellVector aDelCells;
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index aa36598..cb13563 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1512,7 +1512,7 @@ void ScFormulaCell::Notify( SvtBroadcaster&, const SfxHint& rHint)
{
const ScHint* p = PTR_CAST( ScHint, &rHint );
sal_uLong nHint = (p ? p->GetId() : 0);
- if (nHint & (SC_HINT_DATACHANGED | SC_HINT_DYING | SC_HINT_TABLEOPDIRTY))
+ if (nHint & (SC_HINT_DATACHANGED | SC_HINT_TABLEOPDIRTY))
{
bool bForceTrack = false;
if ( nHint & SC_HINT_TABLEOPDIRTY )
diff --git a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx
index 0b0f7a1..ed07960 100644
--- a/sc/source/core/tool/chartlis.cxx
+++ b/sc/source/core/tool/chartlis.cxx
@@ -213,7 +213,7 @@ uno::Reference< chart::XChartData > ScChartListener::GetUnoSource() const
void ScChartListener::Notify( SvtBroadcaster&, const SfxHint& rHint )
{
const ScHint* p = dynamic_cast<const ScHint*>(&rHint);
- if (p && (p->GetId() & (SC_HINT_DATACHANGED | SC_HINT_DYING)))
+ if (p && (p->GetId() & SC_HINT_DATACHANGED))
SetUpdateQueue();
}
diff --git a/sc/source/core/tool/lookupcache.cxx b/sc/source/core/tool/lookupcache.cxx
index 8e93647..235bb04 100644
--- a/sc/source/core/tool/lookupcache.cxx
+++ b/sc/source/core/tool/lookupcache.cxx
@@ -115,7 +115,7 @@ void ScLookupCache::Notify( SvtBroadcaster & /* rBC */ , const SfxHint & rHint
if (!mpDoc->IsInDtorClear())
{
const ScHint* p = PTR_CAST( ScHint, &rHint );
- if (p && (p->GetId() & (SC_HINT_DATACHANGED | SC_HINT_DYING)))
+ if (p && (p->GetId() & SC_HINT_DATACHANGED))
{
mpDoc->RemoveLookupCache( *this);
delete this;
diff --git a/sc/source/ui/docshell/servobj.cxx b/sc/source/ui/docshell/servobj.cxx
index e0eb9db..c5fbfe8 100644
--- a/sc/source/ui/docshell/servobj.cxx
+++ b/sc/source/ui/docshell/servobj.cxx
@@ -228,7 +228,7 @@ void ScServerObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
// must be from Area broadcasters
const ScHint* pScHint = PTR_CAST( ScHint, &rHint );
- if( pScHint && (pScHint->GetId() & (SC_HINT_DATACHANGED | SC_HINT_DYING)) )
+ if (pScHint && (pScHint->GetId() & SC_HINT_DATACHANGED))
bDataChanged = sal_True;
else if (rHint.ISA(ScAreaChangedHint)) // position of broadcaster changed
{
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index b3d6ece..f0f5a0e 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -2830,7 +2830,7 @@ void SAL_CALL ScCellRangesBase::firePropertiesChangeEvent( const uno::Sequence<
IMPL_LINK( ScCellRangesBase, ValueListenerHdl, SfxHint*, pHint )
{
if ( pDocShell && pHint && pHint->ISA( SfxSimpleHint ) &&
- ((const SfxSimpleHint*)pHint)->GetId() & (SC_HINT_DATACHANGED | SC_HINT_DYING) )
+ (((const SfxSimpleHint*)pHint)->GetId() & SC_HINT_DATACHANGED))
{
// This may be called several times for a single change, if several formulas
// in the range are notified. So only a flag is set that is checked when
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 6ce49d2..69b95aa 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -2937,7 +2937,7 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint
IMPL_LINK( ScChart2DataSequence, ValueListenerHdl, SfxHint*, pHint )
{
if ( m_pDocument && pHint && pHint->ISA( SfxSimpleHint ) &&
- ((const SfxSimpleHint*)pHint)->GetId() & (SC_HINT_DATACHANGED | SC_HINT_DYING) )
+ ((const SfxSimpleHint*)pHint)->GetId() & SC_HINT_DATACHANGED)
{
// This may be called several times for a single change, if several formulas
// in the range are notified. So only a flag is set that is checked when
More information about the Libreoffice-commits
mailing list