[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Thu May 9 07:19:53 PDT 2013
sc/inc/brdcst.hxx | 6 +-----
sc/source/core/data/column.cxx | 10 ++++------
sc/source/core/data/column3.cxx | 19 +++++++++----------
sc/source/core/data/documen7.cxx | 4 ++--
sc/source/core/data/table5.cxx | 4 ++--
sc/source/core/tool/addinlis.cxx | 2 +-
sc/source/core/tool/adiasync.cxx | 2 +-
sc/source/core/tool/brdcst.cxx | 14 ++------------
sc/source/core/tool/ddelink.cxx | 2 +-
sc/source/ui/docshell/docsh.cxx | 6 +++---
sc/source/ui/unoobj/chart2uno.cxx | 2 +-
11 files changed, 27 insertions(+), 44 deletions(-)
New commits:
commit a417e759f737ecea4f4a28df70abc7c3b5572a8d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu May 9 10:20:39 2013 -0400
ScHint doesn't need to store broadcaster pointer. Let's not.
Change-Id: I86f9b44c87f3a730902d12505252e4b7e0a24fe4
diff --git a/sc/inc/brdcst.hxx b/sc/inc/brdcst.hxx
index 069f032..beef774 100644
--- a/sc/inc/brdcst.hxx
+++ b/sc/inc/brdcst.hxx
@@ -33,15 +33,11 @@ class SvtBroadcaster;
class ScHint : public SfxSimpleHint
{
-private:
ScAddress aAddress;
- SvtBroadcaster* mpBroadcaster;
public:
TYPEINFO();
- ScHint( sal_uLong n, const ScAddress& a, SvtBroadcaster* p );
- SvtBroadcaster* GetBroadcaster() const;
- void SetBroadcaster( SvtBroadcaster* p );
+ ScHint( sal_uLong n, const ScAddress& a );
const ScAddress& GetAddress() const { return aAddress; }
ScAddress& GetAddress() { return aAddress; }
void SetAddress( const ScAddress& rAdr ) { aAddress = rAdr; }
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index af373d6..a4371f2 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1138,7 +1138,7 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize )
SCSIZE nNewCount = maItems.size();
bool bCountChanged = false;
ScAddress aAdr( nCol, 0, nTab );
- ScHint aHint( SC_HINT_DATACHANGED, aAdr, NULL ); // only areas (ScBaseCell* == NULL)
+ ScHint aHint(SC_HINT_DATACHANGED, aAdr); // only areas (ScBaseCell* == NULL)
ScAddress& rAddress = aHint.GetAddress();
// for sparse occupation use single broadcasts, not ranges
bool bSingleBroadcasts = (((maItems.back().nRow - maItems[i].nRow) /
@@ -1725,7 +1725,7 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol)
}
// Broadcast changes
ScAddress aAdr( nCol, 0, nTab );
- ScHint aHint(SC_HINT_DATACHANGED, aAdr, NULL); // areas only
+ ScHint aHint(SC_HINT_DATACHANGED, aAdr); // areas only
ScAddress& rAddress = aHint.GetAddress();
// must iterate backwards, because indexes of following cells become invalid
@@ -2104,7 +2104,7 @@ void ScColumn::SetDirty( const ScRange& rRange )
pDocument->SetAutoCalc( false ); // no multiple recalculation
SCROW nRow2 = rRange.aEnd.Row();
ScAddress aPos( nCol, 0, nTab );
- ScHint aHint( SC_HINT_DATACHANGED, aPos, NULL );
+ ScHint aHint(SC_HINT_DATACHANGED, aPos);
SCROW nRow;
SCSIZE nIndex;
Search( rRange.aStart.Row(), nIndex );
@@ -2116,7 +2116,6 @@ void ScColumn::SetDirty( const ScRange& rRange )
else
{
aHint.GetAddress().SetRow( nRow );
- aHint.SetBroadcaster(GetBroadcaster(nRow));
pDocument->Broadcast( aHint );
}
nIndex++;
@@ -2133,7 +2132,7 @@ void ScColumn::SetTableOpDirty( const ScRange& rRange )
pDocument->SetAutoCalc( false ); // no multiple recalculation
SCROW nRow2 = rRange.aEnd.Row();
ScAddress aPos( nCol, 0, nTab );
- ScHint aHint( SC_HINT_TABLEOPDIRTY, aPos, NULL );
+ ScHint aHint(SC_HINT_TABLEOPDIRTY, aPos);
SCROW nRow;
SCSIZE nIndex;
Search( rRange.aStart.Row(), nIndex );
@@ -2145,7 +2144,6 @@ void ScColumn::SetTableOpDirty( const ScRange& rRange )
else
{
aHint.GetAddress().SetRow( nRow );
- aHint.SetBroadcaster(GetBroadcaster(nRow));
pDocument->Broadcast( aHint );
}
nIndex++;
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index e36312b..8e8ad31 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -82,7 +82,7 @@ void ScColumn::Insert( SCROW nRow, ScBaseCell* pNewCell )
((ScFormulaCell*)pNewCell)->SetDirty();
else
pDocument->Broadcast(
- ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab), GetBroadcaster(nRow)));
+ ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab)));
}
}
}
@@ -123,7 +123,7 @@ void ScColumn::Delete( SCROW nRow )
pCell->Delete();
pDocument->Broadcast(
- ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab), GetBroadcaster(nRow)));
+ ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab)));
CellStorageModified();
}
@@ -139,7 +139,7 @@ void ScColumn::DeleteAtIndex( SCSIZE nIndex )
pCell->Delete();
pDocument->Broadcast(
- ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab), GetBroadcaster(nRow)));
+ ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab)));
maTextWidths.set_empty(nRow, nRow);
maScriptTypes.set_empty(nRow, nRow);
@@ -220,7 +220,7 @@ void ScColumn::DeleteRow( SCROW nStartRow, SCSIZE nSize )
maScriptTypes.resize(MAXROWCOUNT);
ScAddress aAdr( nCol, 0, nTab );
- ScHint aHint( SC_HINT_DATACHANGED, aAdr, NULL ); // only areas (ScBaseCell* == NULL)
+ ScHint aHint(SC_HINT_DATACHANGED, aAdr); // only areas (ScBaseCell* == NULL)
ScAddress& rAddress = aHint.GetAddress();
// for sparse occupation use single broadcasts, not ranges
bool bSingleBroadcasts = (((maItems.back().nRow - maItems[i].nRow) /
@@ -485,11 +485,10 @@ void ScColumn::DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag)
pAttrArray->DeleteHardAttr( nStartRow, nEndRow );
// Broadcast the changes.
- ScHint aHint(SC_HINT_DATACHANGED, ScAddress(nCol, 0, nTab), NULL);
+ ScHint aHint(SC_HINT_DATACHANGED, ScAddress(nCol, 0, nTab));
for (SCROW i = nStartRow; i <= nEndRow; ++i)
{
aHint.GetAddress().SetRow(i);
- aHint.SetBroadcaster(GetBroadcaster(i));
pDocument->Broadcast(aHint);
}
}
@@ -1068,8 +1067,8 @@ void ScColumn::BroadcastInArea( SCROW nRow1, SCROW nRow2 )
if ( pCell->GetCellType() == CELLTYPE_FORMULA )
((ScFormulaCell*)pCell)->SetDirty();
else
- pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED,
- ScAddress(nCol, nRow, nTab), GetBroadcaster(nRow)));
+ pDocument->Broadcast( ScHint(SC_HINT_DATACHANGED,
+ ScAddress(nCol, nRow, nTab)));
nIndex++;
}
}
@@ -1324,8 +1323,8 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
((ScFormulaCell*)pNewCell)->SetDirty();
}
else
- pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED,
- ScAddress(nCol, nRow, nTabP), GetBroadcaster(nRow)));
+ pDocument->Broadcast(
+ ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTabP)));
}
else
{
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 1af78e0..3a1d635 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -73,7 +73,7 @@ void ScDocument::Broadcast( const ScHint& rHint )
{
ScBulkBroadcast aBulkBroadcast( pBASM); // scoped bulk broadcast
bool bIsBroadcasted = false;
- SvtBroadcaster* pBC = rHint.GetBroadcaster();
+ SvtBroadcaster* pBC = GetBroadcaster(rHint.GetAddress());
if ( pBC )
{
pBC->Broadcast( rHint );
@@ -445,7 +445,7 @@ void ScDocument::TrackFormulas( sal_uLong nHintId )
do
{
pBC = GetBroadcaster(pTrack->aPos);
- ScHint aHint(nHintId, pTrack->aPos, pBC);
+ ScHint aHint(nHintId, pTrack->aPos);
if (pBC)
pBC->Broadcast( aHint );
pBASM->AreaBroadcast( aHint );
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index 852c2c0..f24c56c 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -1166,7 +1166,7 @@ void ScTable::InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* p
switch ( pCell->GetCellType() )
{
case CELLTYPE_VALUE :
- pDocument->Broadcast(ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab), GetBroadcaster(nCol, nRow)));
+ pDocument->Broadcast(ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab)));
break;
case CELLTYPE_FORMULA :
((ScFormulaCell*)pCell)->SetDirty();
@@ -1209,7 +1209,7 @@ void ScTable::InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* p
{
case CELLTYPE_VALUE :
pDocument->Broadcast(
- ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab), GetBroadcaster(nCol, nRow)));
+ ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab)));
break;
case CELLTYPE_FORMULA :
((ScFormulaCell*)pCell)->SetDirty();
diff --git a/sc/source/core/tool/addinlis.cxx b/sc/source/core/tool/addinlis.cxx
index bc7d467a..fa945c0 100644
--- a/sc/source/core/tool/addinlis.cxx
+++ b/sc/source/core/tool/addinlis.cxx
@@ -115,7 +115,7 @@ void SAL_CALL ScAddInListener::modified( const ::com::sun::star::sheet::ResultEv
// notify document of changes
- Broadcast( ScHint( SC_HINT_DATACHANGED, ScAddress(), NULL ) );
+ Broadcast( ScHint(SC_HINT_DATACHANGED, ScAddress()) );
for ( ScAddInDocs::iterator it = pDocs->begin(); it != pDocs->end(); ++it )
{
diff --git a/sc/source/core/tool/adiasync.cxx b/sc/source/core/tool/adiasync.cxx
index 5a8af9b..f5e5edb 100644
--- a/sc/source/core/tool/adiasync.cxx
+++ b/sc/source/core/tool/adiasync.cxx
@@ -122,7 +122,7 @@ void ScAddInAsync::CallBack( sal_uLong nHandleP, void* pData )
return;
}
p->bValid = sal_True;
- p->Broadcast( ScHint( SC_HINT_DATACHANGED, ScAddress(), NULL ) );
+ p->Broadcast( ScHint(SC_HINT_DATACHANGED, ScAddress()) );
for ( ScAddInDocs::iterator it = p->pDocs->begin(); it != p->pDocs->end(); ++it )
{
diff --git a/sc/source/core/tool/brdcst.cxx b/sc/source/core/tool/brdcst.cxx
index e860026..dba508b 100644
--- a/sc/source/core/tool/brdcst.cxx
+++ b/sc/source/core/tool/brdcst.cxx
@@ -19,17 +19,7 @@
#include "brdcst.hxx"
-ScHint::ScHint( sal_uLong n, const ScAddress& a, SvtBroadcaster* p ) :
- SfxSimpleHint(n), aAddress(a), mpBroadcaster(p) {}
-
-SvtBroadcaster* ScHint::GetBroadcaster() const
-{
- return mpBroadcaster;
-}
-
-void ScHint::SetBroadcaster( SvtBroadcaster* p )
-{
- mpBroadcaster = p;
-}
+ScHint::ScHint( sal_uLong n, const ScAddress& a ) :
+ SfxSimpleHint(n), aAddress(a) {}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/ddelink.cxx b/sc/source/core/tool/ddelink.cxx
index 5ffbe27..d579eaa 100644
--- a/sc/source/core/tool/ddelink.cxx
+++ b/sc/source/core/tool/ddelink.cxx
@@ -199,7 +199,7 @@ sfx2::SvBaseLink::UpdateResult ScDdeLink::DataChanged(
if (HasListeners())
{
- Broadcast( ScHint( SC_HINT_DATACHANGED, ScAddress(), NULL ) );
+ Broadcast(ScHint(SC_HINT_DATACHANGED, ScAddress()));
pDoc->TrackFormulas(); // muss sofort passieren
pDoc->StartTrackTimer();
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 3b7e1fd..2e7ac5f 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -476,7 +476,7 @@ sal_Bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::un
else
{
// still need to recalc volatile formula cells.
- aDocument.Broadcast( ScHint(SC_HINT_DATACHANGED, BCA_BRDCST_ALWAYS, NULL) );
+ aDocument.Broadcast(ScHint(SC_HINT_DATACHANGED, BCA_BRDCST_ALWAYS));
}
aDocument.SetXMLFromWrapper( false );
@@ -2759,7 +2759,7 @@ void ScDocShell::SetDocumentModified( sal_Bool bIsModified /* = sal_True */ )
{
// #i115009# broadcast BCA_BRDCST_ALWAYS, so a component can read recalculated results
// of RecalcModeAlways formulas (like OFFSET) after modifying cells
- aDocument.Broadcast( ScHint(SC_HINT_DATACHANGED, BCA_BRDCST_ALWAYS, NULL) );
+ aDocument.Broadcast(ScHint(SC_HINT_DATACHANGED, BCA_BRDCST_ALWAYS));
aDocument.InvalidateTableArea(); // #i105279# needed here
aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
@@ -2779,7 +2779,7 @@ void ScDocShell::SetDocumentModified( sal_Bool bIsModified /* = sal_True */ )
aDocument.InvalidateStyleSheetUsage();
aDocument.InvalidateTableArea();
aDocument.InvalidateLastTableOpParams();
- aDocument.Broadcast( ScHint(SC_HINT_DATACHANGED, BCA_BRDCST_ALWAYS, NULL) );
+ aDocument.Broadcast(ScHint(SC_HINT_DATACHANGED, BCA_BRDCST_ALWAYS));
if ( aDocument.IsForcedFormulaPending() && aDocument.GetAutoCalc() )
aDocument.CalcFormulaTree( sal_True );
PostDataChanged();
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 69b95aa..c6363a4 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -2650,7 +2650,7 @@ void ScChart2DataSequence::RebuildDataCache()
if (!m_bExtDataRebuildQueued)
{
m_aDataArray.clear();
- m_pDocument->BroadcastUno(ScHint(SC_HINT_DATACHANGED, ScAddress(), NULL));
+ m_pDocument->BroadcastUno(ScHint(SC_HINT_DATACHANGED, ScAddress()));
m_bExtDataRebuildQueued = true;
m_bGotDataChangedHint = true;
}
More information about the Libreoffice-commits
mailing list