summaryrefslogtreecommitdiff
path: root/sc/source/core/data
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-05-03 15:05:51 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-05-09 13:34:31 -0400
commit59f38babd074cc0b835a5d2a1c81af013dba0deb (patch)
tree6a9fd62c6b8eabe939845e85f3dd5942963cc51b /sc/source/core/data
parentff4731fb89f3b9d394c3826ab8dbe9d77df90a5a (diff)
Remove broadcaster from ScBaseCell, remove ScNoteCell and CELLTYPE_NOTE...
and Calc is now officially broken. Let's start fixing this bit by bit... Change-Id: I383c88245fe1e573666da636c6a8ca8815352ce7
Diffstat (limited to 'sc/source/core/data')
-rw-r--r--sc/source/core/data/autonamecache.cxx1
-rw-r--r--sc/source/core/data/cell.cxx47
-rw-r--r--sc/source/core/data/cellvalue.cxx6
-rw-r--r--sc/source/core/data/column.cxx64
-rw-r--r--sc/source/core/data/column2.cxx122
-rw-r--r--sc/source/core/data/column3.cxx300
-rw-r--r--sc/source/core/data/conditio.cxx2
-rw-r--r--sc/source/core/data/dociter.cxx6
-rw-r--r--sc/source/core/data/documen4.cxx2
-rw-r--r--sc/source/core/data/documen7.cxx5
-rw-r--r--sc/source/core/data/document.cxx8
-rw-r--r--sc/source/core/data/fillinfo.cxx7
-rw-r--r--sc/source/core/data/table1.cxx12
-rw-r--r--sc/source/core/data/table3.cxx17
-rw-r--r--sc/source/core/data/table4.cxx2
-rw-r--r--sc/source/core/data/table5.cxx4
-rw-r--r--sc/source/core/data/table6.cxx23
17 files changed, 162 insertions, 466 deletions
diff --git a/sc/source/core/data/autonamecache.cxx b/sc/source/core/data/autonamecache.cxx
index 1dca11e62afe..ab03a959707b 100644
--- a/sc/source/core/data/autonamecache.cxx
+++ b/sc/source/core/data/autonamecache.cxx
@@ -81,7 +81,6 @@ const ScAutoNameAddresses& ScAutoNameCache::GetNameOccurrences( const String& rN
break;
case CELLTYPE_NONE:
case CELLTYPE_VALUE:
- case CELLTYPE_NOTE:
#if OSL_DEBUG_LEVEL > 0
case CELLTYPE_DESTROYED:
#endif
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index 0bde4bf2080b..b5c8d33cff8e 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -29,26 +29,22 @@
#ifdef USE_MEMPOOL
IMPL_FIXEDMEMPOOL_NEWDEL( ScValueCell )
IMPL_FIXEDMEMPOOL_NEWDEL( ScStringCell )
-IMPL_FIXEDMEMPOOL_NEWDEL( ScNoteCell )
#endif
// ============================================================================
ScBaseCell::ScBaseCell( CellType eNewType ) :
- mpBroadcaster( 0 ),
eCellType( sal::static_int_cast<sal_uInt8>(eNewType) )
{
}
ScBaseCell::ScBaseCell( const ScBaseCell& rCell ) :
- mpBroadcaster( 0 ),
eCellType( rCell.eCellType )
{
}
ScBaseCell::~ScBaseCell()
{
- delete mpBroadcaster;
OSL_ENSURE( eCellType == CELLTYPE_DESTROYED, "BaseCell Destructor" );
}
@@ -66,8 +62,6 @@ ScBaseCell* lclCloneCell( const ScBaseCell& rSrcCell, ScDocument& rDestDoc, cons
return new ScEditCell(static_cast<const ScEditCell&>(rSrcCell), rDestDoc, rDestPos);
case CELLTYPE_FORMULA:
return new ScFormulaCell( static_cast< const ScFormulaCell& >( rSrcCell ), rDestDoc, rDestPos, nCloneFlags );
- case CELLTYPE_NOTE:
- return new ScNoteCell;
default:;
}
OSL_FAIL( "lclCloneCell - unknown cell type" );
@@ -106,9 +100,6 @@ void ScBaseCell::Delete()
case CELLTYPE_FORMULA:
delete (ScFormulaCell*) this;
break;
- case CELLTYPE_NOTE:
- delete (ScNoteCell*) this;
- break;
default:
OSL_FAIL("Attempt to Delete() an unknown CELLTYPE");
break;
@@ -117,36 +108,13 @@ void ScBaseCell::Delete()
bool ScBaseCell::IsBlank() const
{
- if(eCellType == CELLTYPE_NOTE)
- return true;
-
return false;
}
-void ScBaseCell::TakeBroadcaster( SvtBroadcaster* pBroadcaster )
-{
- delete mpBroadcaster;
- mpBroadcaster = pBroadcaster;
-}
-
-SvtBroadcaster* ScBaseCell::ReleaseBroadcaster()
-{
- SvtBroadcaster* pBroadcaster = mpBroadcaster;
- mpBroadcaster = 0;
- return pBroadcaster;
-}
-
-void ScBaseCell::DeleteBroadcaster()
-{
- DELETEZ( mpBroadcaster );
-}
-
bool ScBaseCell::HasEmptyData() const
{
switch ( eCellType )
{
- case CELLTYPE_NOTE :
- return true;
case CELLTYPE_FORMULA :
return ((ScFormulaCell*)this)->IsEmpty();
default:
@@ -201,21 +169,6 @@ OUString ScBaseCell::GetStringData() const
return aStr;
}
-ScNoteCell::ScNoteCell( SvtBroadcaster* pBC ) :
- ScBaseCell( CELLTYPE_NOTE )
-{
- TakeBroadcaster( pBC );
-}
-
-#if OSL_DEBUG_LEVEL > 0
-ScNoteCell::~ScNoteCell()
-{
- eCellType = CELLTYPE_DESTROYED;
-}
-#endif
-
-// ============================================================================
-
ScValueCell::ScValueCell( double fValue ) :
ScBaseCell( CELLTYPE_VALUE ),
mfValue( fValue )
diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx
index 588ccfbc17e9..17a426278679 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -24,8 +24,6 @@ CellType adjustCellType( CellType eOrig )
{
switch (eOrig)
{
- case CELLTYPE_NOTE:
- return CELLTYPE_NONE;
case CELLTYPE_EDIT:
return CELLTYPE_STRING;
default:
@@ -354,7 +352,7 @@ bool ScCellValue::hasNumeric() const
bool ScCellValue::isEmpty() const
{
- return meType == CELLTYPE_NOTE || meType == CELLTYPE_NONE;
+ return meType == CELLTYPE_NONE;
}
bool ScCellValue::equalsWithoutFormat( const ScCellValue& r ) const
@@ -498,7 +496,7 @@ OUString ScRefCellValue::getString()
bool ScRefCellValue::isEmpty() const
{
- return meType == CELLTYPE_NOTE || meType == CELLTYPE_NONE;
+ return meType == CELLTYPE_NONE;
}
bool ScRefCellValue::hasEmptyValue()
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index c98cc396288c..188932be6078 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -843,23 +843,6 @@ void ScColumn::ReserveSize( SCSIZE nSize )
maItems.reserve(nSize);
}
-
-namespace {
-
-/** Moves broadcaster from old cell to new cell if exists, otherwise creates a new note cell. */
-void lclTakeBroadcaster( ScBaseCell*& rpCell, SvtBroadcaster* pBC )
-{
- if( pBC )
- {
- if( rpCell )
- rpCell->TakeBroadcaster( pBC );
- else
- rpCell = new ScNoteCell( pBC );
- }
-}
-
-} // namespace
-
// SwapRow for sorting
void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
{
@@ -907,9 +890,6 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
// simple swap if no formula cells present
if ( !pFmlaCell1 && !pFmlaCell2 )
{
- // remember cell broadcasters, must remain at old position
- SvtBroadcaster* pBC1 = pCell1->ReleaseBroadcaster();
-
if ( pCell2 )
{
/* Both cells exist, no formula cells involved, a simple swap can
@@ -917,10 +897,6 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
maItems[nIndex1].pCell = pCell2;
maItems[nIndex2].pCell = pCell1;
- SvtBroadcaster* pBC2 = pCell2->ReleaseBroadcaster();
- pCell1->TakeBroadcaster( pBC2 );
- pCell2->TakeBroadcaster( pBC1 );
-
// Swap text width values.
unsigned short nVal1 = maTextWidths.get<unsigned short>(nRow1);
unsigned short nVal2 = maTextWidths.get<unsigned short>(nRow2);
@@ -937,19 +913,10 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
// Only cell 1 exists; cell 2 is empty. Move cell 1 from to row
// 2.
- ScNoteCell* pDummyCell = pBC1 ? new ScNoteCell( pBC1 ) : 0;
- if ( pDummyCell )
- {
- // insert dummy note cell (without note) containing old broadcaster
- maItems[nIndex1].pCell = pDummyCell;
- }
- else
- {
- // remove ColEntry at old position
- maItems.erase( maItems.begin() + nIndex1 );
- maTextWidths.set_empty(nRow1, nRow1);
- maScriptTypes.set_empty(nRow1, nRow1);
- }
+ // remove ColEntry at old position
+ maItems.erase( maItems.begin() + nIndex1 );
+ maTextWidths.set_empty(nRow1, nRow1);
+ maScriptTypes.set_empty(nRow1, nRow1);
// Empty text width at the cell 1 position. For now, we don't
// transfer the old value to the cell 2 position since Insert() is
@@ -1012,12 +979,6 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
pNew1 = pCell2->Clone( *pDocument, aPos1, SC_CLONECELL_ADJUST3DREL );
}
- // move old broadcasters new cells at the same old position
- SvtBroadcaster* pBC1 = pCell1->ReleaseBroadcaster();
- lclTakeBroadcaster( pNew1, pBC1 );
- SvtBroadcaster* pBC2 = pCell2 ? pCell2->ReleaseBroadcaster() : 0;
- lclTakeBroadcaster( pNew2, pBC2 );
-
/* Insert the new cells. Old cell has to be deleted, if there is no new
cell (call to Insert deletes old cell by itself). */
if ( !pNew1 )
@@ -1245,14 +1206,13 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize )
for (i = 0; i < nDelCount; i++)
{
- ScBaseCell* pCell = ppDelCells[i];
- OSL_ENSURE( pCell->IsBlank(), "visible cell moved away" );
- SvtBroadcaster* pBC = pCell->GetBroadcaster();
+ SCROW nDelRow = pDelRows[i];
+ SvtBroadcaster* pBC = GetBroadcaster(nDelRow);
if (pBC)
{
MoveListeners( *pBC, pDelRows[i] - nSize );
- pCell->DeleteBroadcaster();
- pCell->Delete();
+ maBroadcasters.set_empty(nDelRow, nDelRow);
+ ppDelCells[i]->Delete();
}
}
@@ -1773,7 +1733,6 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol)
ScAddress aAdr( nCol, 0, nTab );
ScHint aHint( SC_HINT_DYING, aAdr, NULL ); // areas only
ScAddress& rAddress = aHint.GetAddress();
- ScNoteCell* pNoteCell = new ScNoteCell; // Dummy like in DeleteRange
// must iterate backwards, because indexes of following cells become invalid
bool bErased = false;
@@ -1783,8 +1742,6 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol)
nStartPos = (*it).first;
nStopPos = (*it).second;
for (i=nStartPos; i<nStopPos; ++i)
- maItems[i].pCell = pNoteCell; // Assign the dumpy cell instance to all slots.
- for (i=nStartPos; i<nStopPos; ++i)
{
rAddress.SetRow( maItems[i].nRow );
pDocument->AreaBroadcast( aHint );
@@ -1793,7 +1750,6 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol)
maItems.erase(maItems.begin() + nStartPos, maItems.begin() + nStopPos);
bErased = true;
}
- pNoteCell->Delete(); // Delete the dummy cell instance.
if (bErased)
{
@@ -2175,7 +2131,7 @@ void ScColumn::SetDirty( const ScRange& rRange )
else
{
aHint.GetAddress().SetRow( nRow );
- aHint.SetBroadcaster(pCell->GetBroadcaster());
+ aHint.SetBroadcaster(maBroadcasters.get<SvtBroadcaster*>(nRow));
pDocument->Broadcast( aHint );
}
nIndex++;
@@ -2204,7 +2160,7 @@ void ScColumn::SetTableOpDirty( const ScRange& rRange )
else
{
aHint.GetAddress().SetRow( nRow );
- aHint.SetBroadcaster(pCell->GetBroadcaster());
+ aHint.SetBroadcaster(maBroadcasters.get<SvtBroadcaster*>(nRow));
pDocument->Broadcast( aHint );
}
nIndex++;
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index bad84e9e5469..817fca09b7c9 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -61,6 +61,8 @@
#include <math.h>
+#include <boost/scoped_ptr.hpp>
+
#if DEBUG_COLUMN_STORAGE
#include "columniterator.hxx"
#include <iostream>
@@ -902,7 +904,7 @@ bool ScColumn::GetNextSpellingCell(SCROW& nRow, bool bInSel, const ScMarkData& r
void ScColumn::RemoveAutoSpellObj()
{
- ScTabEditEngine* pEngine = NULL;
+ boost::scoped_ptr<ScTabEditEngine> pEngine;
for (SCSIZE i=0; i<maItems.size(); i++)
if ( maItems[i].pCell->GetCellType() == CELLTYPE_EDIT )
@@ -918,29 +920,26 @@ void ScColumn::RemoveAutoSpellObj()
// test for attributes
if ( !pEngine )
- pEngine = new ScTabEditEngine(pDocument);
+ pEngine.reset(new ScTabEditEngine(pDocument));
pEngine->SetText( *pData );
- ScEditAttrTester aTester( pEngine );
+ ScEditAttrTester aTester(pEngine.get());
if ( aTester.NeedsObject() ) // only remove spelling errors
{
pOldCell->SetData(pEngine->CreateTextObject());
}
else // create a string
{
- String aText = ScEditUtil::GetSpaceDelimitedString( *pEngine );
+ OUString aText = ScEditUtil::GetSpaceDelimitedString(*pEngine);
ScBaseCell* pNewCell = new ScStringCell( aText );
- pNewCell->TakeBroadcaster( pOldCell->ReleaseBroadcaster() );
maItems[i].pCell = pNewCell;
delete pOldCell;
}
}
-
- delete pEngine;
}
void ScColumn::RemoveEditAttribs( SCROW nStartRow, SCROW nEndRow )
{
- ScFieldEditEngine* pEngine = NULL;
+ boost::scoped_ptr<ScFieldEditEngine> pEngine;
SCSIZE i;
Search( nStartRow, i );
@@ -958,7 +957,7 @@ void ScColumn::RemoveEditAttribs( SCROW nStartRow, SCROW nEndRow )
// test for attributes
if ( !pEngine )
{
- pEngine = new ScFieldEditEngine(pDocument, pDocument->GetEditPool());
+ pEngine.reset(new ScFieldEditEngine(pDocument, pDocument->GetEditPool()));
// EE_CNTRL_ONLINESPELLING if there are errors already
pEngine->SetControlWord( pEngine->GetControlWord() | EE_CNTRL_ONLINESPELLING );
pDocument->ApplyAsianEditSettings( *pEngine );
@@ -994,13 +993,10 @@ void ScColumn::RemoveEditAttribs( SCROW nStartRow, SCROW nEndRow )
{
String aText = ScEditUtil::GetSpaceDelimitedString( *pEngine );
ScBaseCell* pNewCell = new ScStringCell( aText );
- pNewCell->TakeBroadcaster( pOldCell->ReleaseBroadcaster() );
maItems[i].pCell = pNewCell;
delete pOldCell;
}
}
-
- delete pEngine;
}
// =========================================================================================
@@ -1522,18 +1518,8 @@ void ScColumn::SetCell(SCROW nRow, ScBaseCell* pNewCell)
if (Search(nRow, nIndex))
{
ScBaseCell* pOldCell = maItems[nIndex].pCell;
-
- // move broadcaster and note to new cell, if not existing in new cell
- if (pOldCell->HasBroadcaster() && !pNewCell->HasBroadcaster())
- pNewCell->TakeBroadcaster( pOldCell->ReleaseBroadcaster() );
-
if ( pOldCell->GetCellType() == CELLTYPE_FORMULA && !pDocument->IsClipOrUndo() )
- {
static_cast<ScFormulaCell*>(pOldCell)->EndListeningTo( pDocument );
- // If in EndListening NoteCell is destroyed in same Col
- if ( nIndex >= maItems.size() || maItems[nIndex].nRow != nRow )
- Search(nRow, nIndex);
- }
pOldCell->Delete();
maItems[nIndex].pCell = pNewCell;
}
@@ -1550,6 +1536,11 @@ void ScColumn::SetCell(SCROW nRow, ScBaseCell* pNewCell)
}
}
+SvtBroadcaster* ScColumn::GetBroadcaster(SCROW nRow)
+{
+ return maBroadcasters.get<SvtBroadcaster*>(nRow);
+}
+
unsigned short ScColumn::GetTextWidth(SCROW nRow) const
{
return maTextWidths.get<unsigned short>(nRow);
@@ -1883,83 +1874,46 @@ void ScColumn::FindUsed( SCROW nStartRow, SCROW nEndRow, bool* pUsed ) const
void ScColumn::StartListening( SvtListener& rLst, SCROW nRow )
{
- SvtBroadcaster* pBC = NULL;
- ScBaseCell* pCell;
-
- SCSIZE nIndex;
- if (Search(nRow,nIndex))
- {
- pCell = maItems[nIndex].pCell;
- pBC = pCell->GetBroadcaster();
- }
- else
- {
- pCell = new ScNoteCell;
- Insert(nRow, pCell);
- }
-
- if (!pBC)
- {
- pBC = new SvtBroadcaster;
- pCell->TakeBroadcaster(pBC);
- }
+ SvtBroadcaster* pBC = new SvtBroadcaster;
+ maBroadcasters.set(nRow, pBC);
rLst.StartListening(*pBC);
}
void ScColumn::MoveListeners( SvtBroadcaster& rSource, SCROW nDestRow )
{
- SvtBroadcaster* pBC = NULL;
- ScBaseCell* pCell;
-
- SCSIZE nIndex;
- if (Search(nDestRow,nIndex))
- {
- pCell = maItems[nIndex].pCell;
- pBC = pCell->GetBroadcaster();
- }
- else
- {
- pCell = new ScNoteCell;
- Insert(nDestRow, pCell);
- }
+ // Move listeners from the source position to the destination position.
+ if (!rSource.HasListeners())
+ // No listeners to relocate. Bail out.
+ return;
- if (!pBC)
+ // See if the destination position already has a broadcaster, if not, create one.
+ SvtBroadcaster* pBC = NULL;
+ if (maBroadcasters.is_empty(nDestRow))
{
pBC = new SvtBroadcaster;
- pCell->TakeBroadcaster(pBC);
+ maBroadcasters.set(nDestRow, pBC);
}
+ else
+ pBC = maBroadcasters.get<SvtBroadcaster*>(nDestRow);
- if (rSource.HasListeners())
+ SvtListenerIter aIter(rSource);
+ for (SvtListener* pLst = aIter.GoStart(); pLst; pLst = aIter.GoNext())
{
- SvtListenerIter aIter( rSource);
- for (SvtListener* pLst = aIter.GoStart(); pLst; pLst = aIter.GoNext())
- {
- pLst->StartListening( *pBC);
- pLst->EndListening( rSource);
- }
+ pLst->StartListening(*pBC);
+ pLst->EndListening(rSource);
}
}
void ScColumn::EndListening( SvtListener& rLst, SCROW nRow )
{
- SCSIZE nIndex;
- if (Search(nRow,nIndex))
- {
- ScBaseCell* pCell = maItems[nIndex].pCell;
- SvtBroadcaster* pBC = pCell->GetBroadcaster();
- if (pBC)
- {
- rLst.EndListening(*pBC);
+ SvtBroadcaster* pBC = maBroadcasters.get<SvtBroadcaster*>(nRow);
+ if (!pBC)
+ return;
- if (!pBC->HasListeners())
- {
- if (pCell->IsBlank())
- DeleteAtIndex(nIndex);
- else
- pCell->DeleteBroadcaster();
- }
- }
- }
+ rLst.EndListening(*pBC);
+ if (!pBC->HasListeners())
+ // There is no more listeners for this cell. Remove the broadcaster.
+ maBroadcasters.set_empty(nRow, nRow);
}
void ScColumn::CompileDBFormula()
@@ -2036,10 +1990,6 @@ static void lcl_UpdateSubTotal( ScFunctionData& rData, const ScBaseCell* pCell )
}
}
break;
- case CELLTYPE_NOTE:
- bCell = false;
- break;
- // nothing for strings
default:
{
// added to avoid warnings
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 233433032c4f..8cd890ec60e4 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -75,17 +75,6 @@ void ScColumn::Insert( SCROW nRow, ScBaseCell* pNewCell )
CellType eCellType = pNewCell->GetCellType();
if (eCellType == CELLTYPE_FORMULA)
static_cast<ScFormulaCell*>(pNewCell)->StartListeningTo(pDocument);
-
- // A note cell is only created by StartListeningCell when loading,
- // triggering Formula cells must be dirty anyway.
- if ( !(pDocument->IsCalcingAfterLoad() && eCellType == CELLTYPE_NOTE) )
- {
- if ( eCellType == CELLTYPE_FORMULA )
- ((ScFormulaCell*)pNewCell)->SetDirty();
- else
- pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED,
- ScAddress( nCol, nRow, nTab ), pNewCell->GetBroadcaster()) );
- }
}
}
@@ -112,32 +101,22 @@ void ScColumn::Append( SCROW nRow, ScBaseCell* pCell )
void ScColumn::Delete( SCROW nRow )
{
SCSIZE nIndex;
+ if (!Search(nRow, nIndex))
+ return;
- if (Search(nRow, nIndex))
- {
- ScBaseCell* pCell = maItems[nIndex].pCell;
- ScNoteCell* pNoteCell = new ScNoteCell;
- maItems[nIndex].pCell = pNoteCell; // Dummy for Interpret
- pDocument->Broadcast( ScHint( SC_HINT_DYING,
- ScAddress( nCol, nRow, nTab ), pCell->GetBroadcaster()));
- if ( SvtBroadcaster* pBC = pCell->ReleaseBroadcaster() )
- {
- pNoteCell->TakeBroadcaster( pBC );
- }
- else
- {
- pNoteCell->Delete();
- maItems.erase( maItems.begin() + nIndex);
- maTextWidths.set_empty(nRow, nRow);
- maScriptTypes.set_empty(nRow, nRow);
- // Should we free memory here (delta)? It'll be slower!
- }
- if (pCell->GetCellType() == CELLTYPE_FORMULA)
- static_cast<ScFormulaCell*>(pCell)->EndListeningTo(pDocument);
- pCell->Delete();
+ ScBaseCell* pCell = maItems[nIndex].pCell;
+ pDocument->Broadcast(
+ ScHint(SC_HINT_DYING, ScAddress(nCol, nRow, nTab), GetBroadcaster(nRow)));
- CellStorageModified();
- }
+ maItems.erase(maItems.begin() + nIndex);
+ maTextWidths.set_empty(nRow, nRow);
+ maScriptTypes.set_empty(nRow, nRow);
+ // Should we free memory here (delta)? It'll be slower!
+ if (pCell->GetCellType() == CELLTYPE_FORMULA)
+ static_cast<ScFormulaCell*>(pCell)->EndListeningTo(pDocument);
+ pCell->Delete();
+
+ CellStorageModified();
}
@@ -145,11 +124,8 @@ void ScColumn::DeleteAtIndex( SCSIZE nIndex )
{
ScBaseCell* pCell = maItems[nIndex].pCell;
SCROW nRow = maItems[nIndex].nRow;
- ScNoteCell* pNoteCell = new ScNoteCell;
- maItems[nIndex].pCell = pNoteCell; // Dummy for Interpret
pDocument->Broadcast(
- ScHint(SC_HINT_DYING, ScAddress(nCol, nRow, nTab), pCell->GetBroadcaster()));
- pNoteCell->Delete();
+ ScHint(SC_HINT_DYING, ScAddress(nCol, nRow, nTab), maBroadcasters.get<SvtBroadcaster*>(nRow)));
maItems.erase(maItems.begin() + nIndex);
if (pCell->GetCellType() == CELLTYPE_FORMULA)
static_cast<ScFormulaCell*>(pCell)->EndListeningTo(pDocument);
@@ -191,30 +167,24 @@ void ScColumn::DeleteRow( SCROW nStartRow, SCSIZE nSize )
sal_Bool bOldAutoCalc = pDocument->GetAutoCalc();
pDocument->SetAutoCalc( false ); // Avoid calculating it multiple times
- sal_Bool bFound=false;
+ bool bFound = false;
SCROW nEndRow = nStartRow + nSize - 1;
SCSIZE nStartIndex = 0;
SCSIZE nEndIndex = 0;
SCSIZE i;
+ maBroadcasters.set_empty(nStartRow, nEndRow);
+
for ( i = nFirstIndex; i < maItems.size() && maItems[i].nRow <= nEndRow; i++ )
{
if (!bFound)
{
nStartIndex = i;
- bFound = sal_True;
+ bFound = true;
}
nEndIndex = i;
-
- ScBaseCell* pCell = maItems[i].pCell;
- SvtBroadcaster* pBC = pCell->GetBroadcaster();
- if (pBC)
- {
- // Now returns invalid reference; direct References are not moved
- pCell->DeleteBroadcaster();
- // We delete empty Broadcaster in DeleteRange
- }
}
+
if (bFound)
{
DeleteRange( nStartIndex, nEndIndex, IDF_CONTENTS );
@@ -319,10 +289,6 @@ bool checkDeleteCellByFlag(
case CELLTYPE_FORMULA:
bDelete = (nDelFlag & IDF_FORMULA) != 0;
break;
- case CELLTYPE_NOTE:
- // do note delete note cell with broadcaster
- bDelete = !rEntry.pCell->GetBroadcaster();
- break;
default:; // added to avoid warnings
}
@@ -349,12 +315,10 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe
RemovedSegments_t aRemovedSegments(nStartIndex, maItems.size(), false);
SCSIZE nFirst = nStartIndex;
- // dummy replacement for old cells, to prevent that interpreter uses old cell
- boost::scoped_ptr<ScNoteCell> pDummyCell(new ScNoteCell);
-
for ( SCSIZE nIdx = nStartIndex; nIdx <= nEndIndex; ++nIdx )
{
- if (((nDelFlag & IDF_CONTENTS) == IDF_CONTENTS) && !maItems[ nIdx ].pCell->GetBroadcaster())
+ SCROW nRow = maItems[nIdx].nRow;
+ if (((nDelFlag & IDF_CONTENTS) == IDF_CONTENTS) && maBroadcasters.is_empty(nRow))
{
// all content is deleted and cell does not contain broadcaster
@@ -365,14 +329,8 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe
aDelCells.push_back( static_cast< ScFormulaCell* >( pOldCell ) );
}
else
- {
- // interpret in broadcast must not use the old cell
- maItems[ nIdx ].pCell = pDummyCell.get();
- aHint.GetAddress().SetRow( maItems[ nIdx ].nRow );
- aHint.SetBroadcaster(pOldCell->GetBroadcaster());
- pDocument->Broadcast( aHint );
pOldCell->Delete();
- }
+
continue;
}
@@ -392,51 +350,14 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe
if (bDelete)
{
- // Try to create a replacement "note" cell if broadcaster exists.
- ScNoteCell* pNoteCell = NULL;
- SvtBroadcaster* pBC = pOldCell->GetBroadcaster();
- if (pBC && pBC->HasListeners())
- {
- // NOTE: the broadcaster here is transferred and released only
- // if it has listeners! If it does not, it will simply be
- // deleted when the cell is deleted and no replacement cell is
- // created.
- pNoteCell = new ScNoteCell(pBC);
- pOldCell->ReleaseBroadcaster();
- }
-
// remove cell entry in cell item list
- SCROW nOldRow = maItems[nIdx].nRow;
- if (pNoteCell)
- {
- // replace old cell with the replacement note cell
- maItems[nIdx].pCell = pNoteCell;
- // ... so it's not really deleted
- bDelete = false;
- }
- else
- maItems[nIdx].pCell = pDummyCell.get();
-
if (eCellType == CELLTYPE_FORMULA)
{
// Cache formula cells (will be deleted later), delete cell of other type.
aDelCells.push_back(static_cast<ScFormulaCell*>(pOldCell));
}
else
- {
- aHint.GetAddress().SetRow(nOldRow);
- SvtBroadcaster* pHintBC = NULL;
- if (pNoteCell)
- pHintBC = pNoteCell->GetBroadcaster();
- else if (pOldCell)
- pHintBC = pOldCell->GetBroadcaster();
- aHint.SetBroadcaster(pHintBC);
- pDocument->Broadcast(aHint);
- if (pNoteCell != pOldCell)
- {
- pOldCell->Delete();
- }
- }
+ pOldCell->Delete();
}
if (!bDelete)
@@ -498,27 +419,14 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe
// NOTE: this actually may remove ScNoteCell entries from maItems if
// the last listener is removed from a broadcaster.
for ( FormulaCellVector::iterator aIt = aDelCells.begin(), aEnd = aDelCells.end(); aIt != aEnd; ++aIt )
- (*aIt)->EndListeningTo( pDocument );
-
- // NOTE: the vector does not contain cells with broadcasters that have
- // listeners. If it would, broadcasters that were deleted during
- // EndListeningTo() would have to be released from these cells.
-
- // broadcast SC_HINT_DYING for all cells and delete them
- for ( FormulaCellVector::iterator aIt = aDelCells.begin(), aEnd = aDelCells.end(); aIt != aEnd; ++aIt )
{
- // A formula cell's broadcaster now is at the replacement cell, use
- // that. If there is no cell anymore it means all listeners are
- // gone for this formula cell and the replacement cell was removed
- // from maItems.
- SCSIZE nIndex;
- ScBaseCell* pCell = (Search( (*aIt)->aPos.Row(), nIndex) ? maItems[nIndex].pCell : NULL);
- aHint.SetBroadcaster(pCell ? pCell->GetBroadcaster() : NULL);
- aHint.SetAddress( (*aIt)->aPos );
- pDocument->Broadcast( aHint );
+ (*aIt)->EndListeningTo( pDocument );
(*aIt)->Delete();
}
}
+
+ // TODO: Broadcasting is temporarily removed from this method. Add it back
+ // once the broadcaster refactoring is finished.
}
@@ -652,23 +560,19 @@ void ScColumn::CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy,
while ( nStartIndex < rColumn.maItems.size() && rColumn.maItems[nStartIndex].nRow <= nRow2-nDy )
{
SCSIZE nEndIndex = nStartIndex;
- if ( rColumn.maItems[nStartIndex].pCell->GetCellType() != CELLTYPE_NOTE )
- {
- SCROW nStartRow = rColumn.maItems[nStartIndex].nRow;
- SCROW nEndRow = nStartRow;
-
- // find consecutive non-empty cells
- while ( nEndRow < nRow2-nDy &&
- nEndIndex+1 < rColumn.maItems.size() &&
- rColumn.maItems[nEndIndex+1].nRow == nEndRow+1 &&
- rColumn.maItems[nEndIndex+1].pCell->GetCellType() != CELLTYPE_NOTE )
- {
- ++nEndIndex;
- ++nEndRow;
- }
+ SCROW nStartRow = rColumn.maItems[nStartIndex].nRow;
+ SCROW nEndRow = nStartRow;
- rColumn.pAttrArray->CopyAreaSafe( nStartRow+nDy, nEndRow+nDy, nDy, *pAttrArray );
+ // find consecutive non-empty cells
+ while ( nEndRow < nRow2-nDy &&
+ nEndIndex+1 < rColumn.maItems.size() &&
+ rColumn.maItems[nEndIndex+1].nRow == nEndRow+1 )
+ {
+ ++nEndIndex;
+ ++nEndRow;
}
+
+ rColumn.pAttrArray->CopyAreaSafe( nStartRow+nDy, nEndRow+nDy, nDy, *pAttrArray );
nStartIndex = nEndIndex + 1;
}
}
@@ -780,10 +684,6 @@ ScBaseCell* ScColumn::CloneCell(
ScBaseCell& rSource = *maItems[nIndex].pCell;
switch (rSource.GetCellType())
{
- case CELLTYPE_NOTE:
- // note will be cloned below
- break;
-
case CELLTYPE_STRING:
case CELLTYPE_EDIT:
// note will be cloned below
@@ -960,8 +860,8 @@ void ScColumn::MixData( SCROW nRow1, SCROW nRow2,
CellType eSrcType = pSrc ? pSrc->GetCellType() : CELLTYPE_NONE;
CellType eDestType = pDest ? pDest->GetCellType() : CELLTYPE_NONE;
- sal_Bool bSrcEmpty = ( eSrcType == CELLTYPE_NONE || eSrcType == CELLTYPE_NOTE );
- sal_Bool bDestEmpty = ( eDestType == CELLTYPE_NONE || eDestType == CELLTYPE_NOTE );
+ bool bSrcEmpty = (eSrcType == CELLTYPE_NONE);
+ bool bDestEmpty = (eDestType == CELLTYPE_NONE);
if ( bSkipEmpty && bDestEmpty ) // Restore original row
{
@@ -1060,10 +960,7 @@ void ScColumn::MixData( SCROW nRow1, SCROW nRow2,
{
if (pDest && !pNew) // Old cell present?
{
- if ( pDest->GetBroadcaster() )
- pNew = new ScNoteCell; // Take over Broadcaster
- else
- Delete(nRow); // -> Delete
+ Delete(nRow); // -> Delete
}
if (pNew)
Insert(nRow, pNew); // Insert new one
@@ -1139,21 +1036,23 @@ void ScColumn::StartNeededListeners()
void ScColumn::BroadcastInArea( SCROW nRow1, SCROW nRow2 )
{
- if ( !maItems.empty() )
+ if (maItems.empty())
+ return;
+
+ SCROW nRow;
+ SCSIZE nIndex;
+ if (!Search(nRow1, nIndex))
+ return;
+
+ while ( nIndex < maItems.size() && (nRow = maItems[nIndex].nRow) <= nRow2 )
{
- SCROW nRow;
- SCSIZE nIndex;
- Search( nRow1, nIndex );
- while ( nIndex < maItems.size() && (nRow = maItems[nIndex].nRow) <= nRow2 )
- {
- ScBaseCell* pCell = maItems[nIndex].pCell;
- if ( pCell->GetCellType() == CELLTYPE_FORMULA )
- ((ScFormulaCell*)pCell)->SetDirty();
- else
- pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED,
- ScAddress(nCol, nRow, nTab), pCell->GetBroadcaster()));
- nIndex++;
- }
+ ScBaseCell* pCell = maItems[nIndex].pCell;
+ if ( pCell->GetCellType() == CELLTYPE_FORMULA )
+ ((ScFormulaCell*)pCell)->SetDirty();
+ else
+ pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED,
+ ScAddress(nCol, nRow, nTab), GetBroadcaster(nRow)));
+ nIndex++;
}
}
@@ -1272,8 +1171,6 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
if ( rString == aStr )
bIsText = true;
break;
- case CELLTYPE_NOTE : // Referenced via = Formula
- break;
default:
if ( i == maItems.size() - 1 )
i = 0;
@@ -1392,25 +1289,10 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
if (Search(nRow, i))
{
ScBaseCell* pOldCell = maItems[i].pCell;
- SvtBroadcaster* pBC = pOldCell->ReleaseBroadcaster();
- if (pNewCell || pBC)
+ if (pNewCell)
{
- if(!pNewCell)
- pNewCell = new ScNoteCell();
-
- if (pBC)
- {
- pNewCell->TakeBroadcaster(pBC);
- pLastFormulaTreeTop = 0; // Err527 Workaround
- }
-
if ( pOldCell->GetCellType() == CELLTYPE_FORMULA )
- {
static_cast<ScFormulaCell*>(pOldCell)->EndListeningTo(pDocument);
- // If in EndListening NoteCell destroyed in same in gleicher Col
- if ( i >= maItems.size() || maItems[i].nRow != nRow )
- Search(nRow, i);
- }
pOldCell->Delete();
maItems[i].pCell = pNewCell; // Replace
@@ -1425,7 +1307,7 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
}
else
pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED,
- ScAddress(nCol, nRow, nTabP), pNewCell->GetBroadcaster()));
+ ScAddress(nCol, nRow, nTabP), GetBroadcaster(nRow)));
}
else
{
@@ -1525,11 +1407,6 @@ void ScColumn::GetFilterEntries(SCROW nStartRow, SCROW nEndRow, std::vector<ScTy
nValue = pFC->GetValue();
}
break;
-
- // skip broadcaster cells
- case CELLTYPE_NOTE:
- continue;
-
default:
;
}
@@ -1710,13 +1587,8 @@ void ScColumn::GetString( SCROW nRow, OUString& rString ) const
{
ScRefCellValue aCell;
aCell.assign(*maItems[nIndex].pCell);
- if (aCell.meType != CELLTYPE_NOTE)
- {
- sal_uLong nFormat = GetNumberFormat( nRow );
- ScCellFormat::GetString(aCell, nFormat, rString, &pColor, *(pDocument->GetFormatTable()));
- }
- else
- rString = EMPTY_OUSTRING;
+ sal_uLong nFormat = GetNumberFormat( nRow );
+ ScCellFormat::GetString(aCell, nFormat, rString, &pColor, *(pDocument->GetFormatTable()));
}
else
rString = EMPTY_OUSTRING;
@@ -1755,13 +1627,8 @@ void ScColumn::GetInputString( SCROW nRow, OUString& rString ) const
{
ScRefCellValue aCell;
aCell.assign(*maItems[nIndex].pCell);
- if (aCell.meType != CELLTYPE_NOTE)
- {
- sal_uLong nFormat = GetNumberFormat( nRow );
- ScCellFormat::GetInputString(aCell, nFormat, rString, *(pDocument->GetFormatTable()));
- }
- else
- rString = OUString();
+ sal_uLong nFormat = GetNumberFormat( nRow );
+ ScCellFormat::GetInputString(aCell, nFormat, rString, *(pDocument->GetFormatTable()));
}
else
rString = OUString();
@@ -1936,31 +1803,28 @@ sal_Int32 ScColumn::GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, CharSet eCh
{
ScRefCellValue aCell;
aCell.assign(*maItems[nIndex].pCell);
- if (aCell.meType != CELLTYPE_NOTE)
+ Color* pColor;
+ sal_uLong nFormat = (sal_uLong) ((SfxUInt32Item*) GetAttr(
+ nRow, ATTR_VALUE_FORMAT ))->GetValue();
+ ScCellFormat::GetString(aCell, nFormat, aString, &pColor, *pNumFmt);
+ sal_Int32 nLen;
+ if (bIsOctetTextEncoding)
{
- Color* pColor;
- sal_uLong nFormat = (sal_uLong) ((SfxUInt32Item*) GetAttr(
- nRow, ATTR_VALUE_FORMAT ))->GetValue();
- ScCellFormat::GetString(aCell, nFormat, aString, &pColor, *pNumFmt);
- sal_Int32 nLen;
- if (bIsOctetTextEncoding)
+ if (!aString.convertToString( &aOString, eCharSet,
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))
{
- if (!aString.convertToString( &aOString, eCharSet,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
- RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))
- {
- // TODO: anything? this is used by the dBase export filter
- // that throws an error anyway, but in case of another
- // context we might want to indicate a conversion error
- // early.
- }
- nLen = aOString.getLength();
+ // TODO: anything? this is used by the dBase export filter
+ // that throws an error anyway, but in case of another
+ // context we might want to indicate a conversion error
+ // early.
}
- else
- nLen = aString.getLength() * sizeof(sal_Unicode);
- if ( nStringLen < nLen)
- nStringLen = nLen;
+ nLen = aOString.getLength();
}
+ else
+ nLen = aString.getLength() * sizeof(sal_Unicode);
+ if ( nStringLen < nLen)
+ nStringLen = nLen;
nIndex++;
}
}
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index c091cd592643..e889a9372b45 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1650,7 +1650,7 @@ bool ScCondDateFormatEntry::IsValid( const ScAddress& rPos ) const
{
CellType eCellType = mpDoc->GetCellType(rPos);
- if (eCellType == CELLTYPE_NONE || eCellType == CELLTYPE_NOTE)
+ if (eCellType == CELLTYPE_NONE)
// empty cell.
return false;
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 173905ae51ea..b834a0c33b66 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1245,9 +1245,7 @@ ScBaseCell* ScQueryCellIterator::GetThis()
(nRow = pCol->maItems[nColRow].nRow) <= mpParam->nRow2 )
{
ScBaseCell* pCell = pCol->maItems[nColRow].pCell;
- if ( pCell->GetCellType() == CELLTYPE_NOTE )
- ++nRow;
- else if (bAllStringIgnore && pCell->HasStringData())
+ if (bAllStringIgnore && pCell->HasStringData())
++nRow;
else
{
@@ -1559,8 +1557,6 @@ ScBaseCell* ScQueryCellIterator::BinarySearch()
{
SCSIZE nMid = (nLo+nHi)/2;
SCSIZE i = nMid;
- while (i <= nHi && pCol->maItems[i].pCell->GetCellType() == CELLTYPE_NOTE)
- ++i;
if (i > nHi)
{
if (nMid > 0)
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 37e4be0db04e..fa5f79edee73 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -69,7 +69,7 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
// as previously done in ScInterpreter::GetDouble
double nTargetVal = 0.0;
sal_uInt32 nFIndex = 0;
- if (eFType == CELLTYPE_FORMULA && (eVType == CELLTYPE_VALUE || eVType == CELLTYPE_NOTE) &&
+ if (eFType == CELLTYPE_FORMULA && (eVType == CELLTYPE_VALUE) &&
GetFormatTable()->IsNumberFormat(sValStr, nFIndex, nTargetVal))
{
ScSingleRefData aRefData;
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 191ca7d8d4af..1af78e04e2c3 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -444,8 +444,9 @@ void ScDocument::TrackFormulas( sal_uLong nHintId )
pTrack = pFormulaTrack;
do
{
- ScHint aHint( nHintId, pTrack->aPos, pTrack->GetBroadcaster() );
- if ( ( pBC = pTrack->GetBroadcaster() ) != NULL )
+ pBC = GetBroadcaster(pTrack->aPos);
+ ScHint aHint(nHintId, pTrack->aPos, pBC);
+ if (pBC)
pBC->Broadcast( aHint );
pBASM->AreaBroadcast( aHint );
// Repaint fuer bedingte Formate mit relativen Referenzen:
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 3a07d3fc05c9..7a2671901b60 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2202,6 +2202,14 @@ ScDocument::NumFmtMergeHandler::~NumFmtMergeHandler()
mpDoc->pFormatExchangeList = NULL;
}
+SvtBroadcaster* ScDocument::GetBroadcaster( const ScAddress& rPos )
+{
+ if (!TableExists(rPos.Tab()))
+ return NULL;
+
+ return maTabs[rPos.Tab()]->GetBroadcaster(rPos.Col(), rPos.Row());
+}
+
bool ScDocument::TableExists( SCTAB nTab ) const
{
return ValidTab(nTab) && static_cast<size_t>(nTab) < maTabs.size() && maTabs[nTab];
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index 1e37c6deaa9e..8eb78e649127 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -381,11 +381,8 @@ void ScDocument::FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX
RowInfo* pThisRowInfo = &pRowInfo[nArrY];
CellInfo* pInfo = &pThisRowInfo->pCellInfo[nArrX];
pInfo->maCell.assign(*pThisCol->maItems[nUIndex].pCell);
- if (pInfo->maCell.meType != CELLTYPE_NOTE)
- {
- pThisRowInfo->bEmptyText = false; // Zeile nicht leer
- pInfo->bEmptyCellText = false; // Zelle nicht leer
- }
+ pThisRowInfo->bEmptyText = false; // Zeile nicht leer
+ pInfo->bEmptyCellText = false; // Zelle nicht leer
++nArrY;
}
++nUIndex;
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 7abc2793faf0..37278d649ad8 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1390,7 +1390,7 @@ bool ScTable::GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMa
ScBaseCell* pCell = NULL;
while ( aColIter.Next( nCellRow, pCell ) )
{
- if ( pCell && pCell->GetCellType() != CELLTYPE_NOTE )
+ if (pCell)
{
rRow = nCellRow;
return true; // Zelle gefunden
@@ -1800,7 +1800,7 @@ void ScTable::MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, d
while (nMissing > 0 && nNewCol < MAXCOL)
{
ScBaseCell* pNextCell = aCol[nNewCol+1].GetCell(nRow);
- if (pNextCell && pNextCell->GetCellType() != CELLTYPE_NOTE)
+ if (pNextCell)
// Cell content in a next column ends display of this string.
nMissing = 0;
else
@@ -2160,6 +2160,14 @@ ScRefCellValue ScTable::GetRefCellValue( SCCOL nCol, SCROW nRow )
return aCol[nCol].GetRefCellValue(nRow);
}
+SvtBroadcaster* ScTable::GetBroadcaster( SCCOL nCol, SCROW nRow )
+{
+ if (!ValidColRow(nCol, nRow))
+ return NULL;
+
+ return aCol[nCol].GetBroadcaster(nRow);
+}
+
void ScTable::DeleteConditionalFormat( sal_uLong nIndex )
{
mpCondFormatList->erase(nIndex);
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index ec4e67bb4912..a668a2c9a166 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -377,18 +377,6 @@ short ScTable::CompareCell( sal_uInt16 nSort,
short nRes = 0;
CellType eType1 = CELLTYPE_NONE, eType2 = CELLTYPE_NONE;
- if (pCell1)
- {
- eType1 = pCell1->GetCellType();
- if (eType1 == CELLTYPE_NOTE)
- pCell1 = NULL;
- }
- if (pCell2)
- {
- eType2 = pCell2->GetCellType();
- if (eType2 == CELLTYPE_NOTE)
- pCell2 = NULL;
- }
if (pCell1)
{
@@ -1367,7 +1355,7 @@ public:
// Error cell is evaluated as string (for now).
aCellStr = ScGlobal::GetErrorString(static_cast<ScFormulaCell*>(pCell)->GetErrCode());
}
- else if (pCell->GetCellType() != CELLTYPE_NOTE)
+ else
{
sal_uLong nFormat = mrTab.GetNumberFormat( static_cast<SCCOL>(rEntry.nField), nRow );
ScRefCellValue aCell;
@@ -1660,8 +1648,7 @@ void ScTable::TopTenQuery( ScQueryParam& rParam )
ScSortInfo** ppInfo = pArray->GetFirstArray();
SCSIZE nValidCount = nCount;
// keine Note-/Leerzellen zaehlen, sind ans Ende sortiert
- while ( nValidCount > 0 && ( ppInfo[nValidCount-1]->pCell == NULL ||
- ppInfo[nValidCount-1]->pCell->GetCellType() == CELLTYPE_NOTE ) )
+ while ( nValidCount > 0 && (ppInfo[nValidCount-1]->pCell == NULL) )
nValidCount--;
// keine Strings zaehlen, sind zwischen Value und Leer
while ( nValidCount > 0
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 8b8b67ba5020..d63971e779df 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1477,7 +1477,7 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
pProgress->SetStateOnPercent( ++nProgress );
}
}
- else if (eCellType != CELLTYPE_NOTE)
+ else
{
for (rInner = nIMin; rInner <= nIMax; rInner++)
{
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index cbffff1560b4..852c2c04db57 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), pCell->GetBroadcaster()));
+ pDocument->Broadcast(ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab), GetBroadcaster(nCol, nRow)));
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), pCell->GetBroadcaster()));
+ ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab), GetBroadcaster(nCol, nRow)));
break;
case CELLTYPE_FORMULA :
((ScFormulaCell*)pCell)->SetDirty();
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 729f91254663..17f62da32837 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -817,7 +817,7 @@ bool lcl_maybeReplaceCellString(
ScColumn& rColObj, SCCOL& rCol, SCROW& rRow, OUString& rUndoStr, SCCOL nCol, SCROW nRow, const SvxSearchItem& rSearchItem)
{
ScBaseCell* pCell = rColObj.GetCell(nRow);
- if (!pCell || pCell->GetCellType() == CELLTYPE_NOTE)
+ if (!pCell)
{
// empty cell found.
rCol = nCol;
@@ -1020,27 +1020,6 @@ bool ScTable::SearchRangeForAllEmptyCells(
}
}
}
- else if (pCell->GetCellType() == CELLTYPE_NOTE)
- {
- rMatchedRanges.Join(ScRange(nCol, nRow, nTab));
- bFound = true;
-
- if (bReplace)
- {
- if (pUndoDoc)
- {
- ScAddress aCellPos(nCol, nRow, nTab);
- pUndoDoc->PutCell(aCellPos, pCell->Clone(*pUndoDoc, aCellPos));
- ScNotes* pNotes = pUndoDoc->GetNotes(nTab);
- ScPostIt* pPostIt = maNotes.findByAddress(nCol, nRow);
- if (pPostIt)
- {
- pNotes->insert(nCol, nRow, pPostIt->Clone(ScAddress(nCol, nRow, nTab), *pUndoDoc, ScAddress(nCol, nRow, nTab), true));
- }
- }
- aCol[nCol].SetString(nRow, nTab, rSearchItem.GetReplaceString(), pDocument->GetAddressConvention());
- }
- }
}
}
return bFound;