Kaydet (Commit) e6103885 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

We only need to send the broadcaster instance with ScHint.

Another ScBaseCell eliminated.

Change-Id: I32a07024dd1d8ab536038942aa7209a7829d193c
üst f847a0e2
......@@ -180,6 +180,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/core/tool/adiasync \
sc/source/core/tool/appoptio \
sc/source/core/tool/autoform \
sc/source/core/tool/brdcst \
sc/source/core/tool/calcconfig \
sc/source/core/tool/callform \
sc/source/core/tool/cellform \
......
......@@ -24,7 +24,8 @@
#include <tools/rtti.hxx>
#include <svl/hint.hxx>
#include <svl/smplhint.hxx>
class ScBaseCell;
class SvtBroadcaster;
#define SC_HINT_DYING SFX_HINT_DYING
#define SC_HINT_DATACHANGED SFX_HINT_DATACHANGED
......@@ -35,14 +36,13 @@ class ScHint : public SfxSimpleHint
{
private:
ScAddress aAddress;
ScBaseCell* pCell;
SvtBroadcaster* mpBroadcaster;
public:
TYPEINFO();
ScHint( sal_uLong n, const ScAddress& a, ScBaseCell* p )
: SfxSimpleHint( n ), aAddress( a ), pCell( p ) {}
ScBaseCell* GetCell() const { return pCell; }
void SetCell( ScBaseCell* p ) { pCell = p; }
ScHint( sal_uLong n, const ScAddress& a, SvtBroadcaster* p );
SvtBroadcaster* GetBroadcaster() const;
void SetBroadcaster( SvtBroadcaster* p );
const ScAddress& GetAddress() const { return aAddress; }
ScAddress& GetAddress() { return aAddress; }
void SetAddress( const ScAddress& rAdr ) { aAddress = rAdr; }
......
......@@ -2155,7 +2155,7 @@ void ScColumn::SetDirty( const ScRange& rRange )
else
{
aHint.GetAddress().SetRow( nRow );
aHint.SetCell( pCell );
aHint.SetBroadcaster(pCell->GetBroadcaster());
pDocument->Broadcast( aHint );
}
nIndex++;
......@@ -2184,7 +2184,7 @@ void ScColumn::SetTableOpDirty( const ScRange& rRange )
else
{
aHint.GetAddress().SetRow( nRow );
aHint.SetCell( pCell );
aHint.SetBroadcaster(pCell->GetBroadcaster());
pDocument->Broadcast( aHint );
}
nIndex++;
......
......@@ -122,7 +122,7 @@ void ScColumn::Insert( SCROW nRow, ScBaseCell* pNewCell )
((ScFormulaCell*)pNewCell)->SetDirty();
else
pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED,
ScAddress( nCol, nRow, nTab ), pNewCell ) );
ScAddress( nCol, nRow, nTab ), pNewCell->GetBroadcaster()) );
}
}
bDirtyGroups = true;
......@@ -160,7 +160,7 @@ void ScColumn::Delete( SCROW nRow )
ScNoteCell* pNoteCell = new ScNoteCell;
maItems[nIndex].pCell = pNoteCell; // Dummy for Interpret
pDocument->Broadcast( ScHint( SC_HINT_DYING,
ScAddress( nCol, nRow, nTab ), pCell ) );
ScAddress( nCol, nRow, nTab ), pCell->GetBroadcaster()));
if ( SvtBroadcaster* pBC = pCell->ReleaseBroadcaster() )
{
pNoteCell->TakeBroadcaster( pBC );
......@@ -190,7 +190,7 @@ void ScColumn::DeleteAtIndex( SCSIZE nIndex )
ScNoteCell* pNoteCell = new ScNoteCell;
maItems[nIndex].pCell = pNoteCell; // Dummy for Interpret
pDocument->Broadcast(
ScHint(SC_HINT_DYING, ScAddress(nCol, nRow, nTab), pCell));
ScHint(SC_HINT_DYING, ScAddress(nCol, nRow, nTab), pCell->GetBroadcaster()));
pNoteCell->Delete();
maItems.erase(maItems.begin() + nIndex);
if (pCell->GetCellType() == CELLTYPE_FORMULA)
......@@ -414,7 +414,7 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe
// interpret in broadcast must not use the old cell
maItems[ nIdx ].pCell = pDummyCell.get();
aHint.GetAddress().SetRow( maItems[ nIdx ].nRow );
aHint.SetCell( pOldCell );
aHint.SetBroadcaster(pOldCell->GetBroadcaster());
pDocument->Broadcast( aHint );
pOldCell->Delete();
}
......@@ -470,7 +470,12 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe
else
{
aHint.GetAddress().SetRow(nOldRow);
aHint.SetCell(pNoteCell ? pNoteCell : pOldCell);
SvtBroadcaster* pHintBC = NULL;
if (pNoteCell)
pHintBC = pNoteCell->GetBroadcaster();
else if (pOldCell)
pHintBC = pOldCell->GetBroadcaster();
aHint.SetBroadcaster(pHintBC);
pDocument->Broadcast(aHint);
if (pNoteCell != pOldCell)
{
......@@ -553,7 +558,7 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe
// from maItems.
SCSIZE nIndex;
ScBaseCell* pCell = (Search( (*aIt)->aPos.Row(), nIndex) ? maItems[nIndex].pCell : NULL);
aHint.SetCell( pCell );
aHint.SetBroadcaster(pCell ? pCell->GetBroadcaster() : NULL);
aHint.SetAddress( (*aIt)->aPos );
pDocument->Broadcast( aHint );
(*aIt)->Delete();
......@@ -1195,7 +1200,7 @@ void ScColumn::BroadcastInArea( SCROW nRow1, SCROW nRow2 )
((ScFormulaCell*)pCell)->SetDirty();
else
pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED,
ScAddress( nCol, nRow, nTab ), pCell ) );
ScAddress(nCol, nRow, nTab), pCell->GetBroadcaster()));
nIndex++;
}
}
......@@ -1469,7 +1474,7 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
}
else
pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED,
ScAddress( nCol, nRow, nTabP ), pNewCell ) );
ScAddress(nCol, nRow, nTabP), pNewCell->GetBroadcaster()));
}
else
{
......
......@@ -69,7 +69,7 @@ void ScDocument::Broadcast( sal_uLong nHint, const ScAddress& rAddr,
{
if ( !pBASM )
return ; // Clipboard or Undo
ScHint aHint( nHint, rAddr, pCell );
ScHint aHint(nHint, rAddr, pCell ? pCell->GetBroadcaster() : NULL);
Broadcast( aHint );
}
......@@ -82,15 +82,11 @@ void ScDocument::Broadcast( const ScHint& rHint )
{
ScBulkBroadcast aBulkBroadcast( pBASM); // scoped bulk broadcast
bool bIsBroadcasted = false;
ScBaseCell* pCell = rHint.GetCell();
if ( pCell )
SvtBroadcaster* pBC = rHint.GetBroadcaster();
if ( pBC )
{
SvtBroadcaster* pBC = pCell->GetBroadcaster();
if ( pBC )
{
pBC->Broadcast( rHint );
bIsBroadcasted = true;
}
pBC->Broadcast( rHint );
bIsBroadcasted = true;
}
if ( pBASM->AreaBroadcast( rHint ) || bIsBroadcasted )
TrackFormulas( rHint.GetId() );
......@@ -457,7 +453,7 @@ void ScDocument::TrackFormulas( sal_uLong nHintId )
pTrack = pFormulaTrack;
do
{
ScHint aHint( nHintId, pTrack->aPos, pTrack );
ScHint aHint( nHintId, pTrack->aPos, pTrack->GetBroadcaster() );
if ( ( pBC = pTrack->GetBroadcaster() ) != NULL )
pBC->Broadcast( aHint );
pBASM->AreaBroadcast( aHint );
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#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;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment