21#include <osl/diagnose.h>
23#include <document.hxx>
28#include <progress.hxx>
32#include <tokenarray.hxx>
50 pBASM->StartListeningArea(rRange, bGroupListening, pListener);
58 pBASM->StartListeningArea( aLimitedRange, bGroupListening, pListener);
72 pBASM->EndListeningArea(rRange, bGroupListening, pListener);
80 pBASM->EndListeningArea( aLimitedRange, bGroupListening, pListener);
84 bool& o_bEntirelyOutOfBounds )
const
97 SAL_WARN(
"sc.core",
"ScDocument::LimitRangeToAvailableSheets - bad sheet range: " << nTab1 <<
".." << nTab2 <<
98 ", sheets: 0.." << nMaxTab);
101 if ((nTab1 < 0 && nTab2 < 0) || (nMaxTab < nTab1 && nMaxTab < nTab2))
103 o_bEntirelyOutOfBounds =
true;
108 o_bEntirelyOutOfBounds =
false;
109 nTab1 = std::clamp<SCTAB>( nTab1, 0, nMaxTab);
110 nTab2 = std::clamp<SCTAB>( nTab2, 0, nMaxTab);
125 if (
pBASM->AreaBroadcast( rHint ) || bIsBroadcasted )
133 maTabs[nTab]->SetStreamValid(
false);
139 bool bIsBroadcasted =
false;
146 a.SetRow(address.
Row() + nRow);
148 if ( pBC && pBC != pLastBC )
151 bIsBroadcasted =
true;
155 return bIsBroadcasted;
175 bool bIsBroadcasted =
false;
177 if (bBroadcastSingleBroadcasters)
179 for (
SCTAB nTab = nTab1; nTab <= nTab2; ++nTab)
189 if (
pBASM->AreaBroadcast(rRange, nHint) || bIsBroadcasted)
193 for (
SCTAB nTab = nTab1; nTab <= nTab2; ++nTab)
210 if (
pBASM->AreaBroadcast( rHint ) )
218 pBASM->DelBroadcastAreasInRange( rRange );
224 OSL_ENSURE(pListener,
"StartListeningCell: pListener Null");
227 maTabs[nTab]->StartListening( rAddress, pListener );
233 OSL_ENSURE(pListener,
"EndListeningCell: pListener Null");
236 maTabs[nTab]->EndListening( rAddress, pListener );
265 for (
auto& pCell : rCells)
266 pCell->EndListeningTo(aCxt);
273 OSL_ENSURE( pCell,
"PutInFormulaTree: pCell Null" );
290 OSL_ENSURE( pCell,
"RemoveFromFormulaTree: pCell Null" );
292 assert(pPrev != pCell);
297 assert(pNext != pCell);
323 OSL_FAIL(
"RemoveFromFormulaTree: nFormulaCodeInTree < nRPN" );
329 OSL_FAIL(
"!pFormulaTree && nFormulaCodeInTree != 0" );
356 ::std::vector<ScFormulaCell*> vAlwaysDirty;
367 vAlwaysDirty.push_back( pCell);
369 else if ( bSetAllDirty )
376 for (
const auto& rpCell : vAlwaysDirty)
414 pLastNoGood =
nullptr;
421 pCell = pLastNoGood->
GetNext();
425 while ( pCell && !pCell->
GetDirty() )
461 OSL_ENSURE( pCell,
"AppendToFormulaTrack: pCell Null" );
477 OSL_ENSURE( pCell,
"RemoveFromFormulaTrack: pCell Null" );
479 assert(pPrev != pCell);
485 assert(pNext != pCell);
536 (nHintId == SfxHintId::ScDataChanged || nHintId == SfxHintId::ScHiddenRowsChanged))
558 ScHint aHint( nHintId, address, rowCount );
560 pBASM->AreaBroadcast( aHint );
565 bool bHaveForced =
false;
571 if ( pTrack->GetCode()->IsRecalcModeForced() )
593 i->StartListeners(aCxt,
true);
601 if ( eUpdateRefMode ==
URM_INSDEL && (nDx > 0 || nDy > 0 || nDz > 0) )
604 pBASM->UpdateBroadcastAreas( eUpdateRefMode, rRange, nDx, nDy, nDz );
bool ValidTab(SCTAB nTab)
#define BCA_LISTEN_ALWAYS
#define BCA_BRDCST_ALWAYS
void TrackFormulas(SfxHintId nHintId=SfxHintId::ScDataChanged)
void FinalTrackFormulas(SfxHintId nHintId)
bool IsCalculatingFormulaTree() const
void SetTrackFormulasPending()
bool BroadcastHintInternal(const ScHint &rHint)
ScFormulaCell * pFormulaTree
SvtBroadcaster * GetBroadcaster(const ScAddress &rPos)
ScTable * FetchTable(SCTAB nTab)
bool IsFinalTrackFormulas() const
bool IsIdleEnabled() const
void EndListeningArea(const ScRange &rRange, bool bGroupListening, SvtListener *pListener)
bool mbFinalTrackFormulas
void SetExpandRefs(bool bVal)
void SetCalcNotification(SCTAB nTab)
std::unique_ptr< ScBroadcastAreaSlotMachine > pBASM
void RemoveFromFormulaTree(ScFormulaCell *pCell)
void BroadcastCells(const ScRange &rRange, SfxHintId nHint, bool bBroadcastSingleBroadcasters=true)
void PrepareFormulaCalc()
Call this before any operations that might trigger one or more formula cells to get calculated.
ScFormulaCell * pEOFormulaTree
bool mbTrackFormulasPending
void Broadcast(const ScHint &rHint)
Broadcast wrapper, calls rHint.GetCell()->Broadcast() and AreaBroadcast() and TrackFormulas() Preferr...
SC_DLLPUBLIC bool GetAutoCalc() const
SC_DLLPUBLIC void CalcFormulaTree(bool bOnlyForced=false, bool bProgressBar=true, bool bSetAllDirty=true)
Calculate formula cells that are on the formula tree either partially, or in full.
void DelBroadcastAreasInRange(const ScRange &rRange)
ScBroadcastAreaSlotMachine * GetBASM() const
void RemoveFromFormulaTrack(ScFormulaCell *pCell)
HardRecalcState eHardRecalcState
@ ETERNAL
CalcAll() without broadcast/notify but setting up new listeners.
void StartListeningArea(const ScRange &rRange, bool bGroupListening, SvtListener *pListener)
void EndListeningFormulaCells(std::vector< ScFormulaCell * > &rCells)
void EndListeningCell(const ScAddress &rAddress, SvtListener *pListener)
void EnableIdle(bool bDo)
void UpdateBroadcastAreas(UpdateRefMode eUpdateRefMode, const ScRange &rRange, SCCOL nDx, SCROW nDy, SCTAB nDz)
bool IsInInterpreter() const
void AppendToFormulaTrack(ScFormulaCell *pCell)
sal_uInt64 nFormulaCodeInTree
sal_uInt16 nFormulaTrackCount
bool IsExpandRefs() const
bool HasAnySheetEventScript(ScSheetEventId nEvent, bool bWithVbaEvents=false) const
void SetForcedFormulas(bool bVal)
SC_DLLPUBLIC void SetAutoCalc(bool bNewAutoCalc)
SC_DLLPUBLIC void CalcAll()
bool bCalculatingFormulaTree
bool IsAutoCalcShellDisabled() const
ScFormulaCell * pEOFormulaTrack
void PutInFormulaTree(ScFormulaCell *pCell)
bool LimitRangeToAvailableSheets(const ScRange &rRange, ScRange &o_rRange, bool &o_bEntirelyOutOfBounds) const
Adjust a range to available sheets.
std::shared_ptr< sc::FormulaGroupContext > mpFormulaGroupCxt
void AreaBroadcast(const ScHint &rHint)
only area, no cell broadcast
void StartListeningCell(const ScAddress &rAddress, SvtListener *pListener)
void SetForcedFormulaPending(bool bNew)
void BroadcastUno(const SfxHint &rHint)
SC_DLLPUBLIC SCTAB GetTableCount() const
ScFormulaCell * pFormulaTrack
SCROW GetRowCount() const
const ScAddress & GetStartAddress() const
static void DeleteInterpretProgress()
static void CreateInterpretProgress(ScDocument *pDoc, bool bWait=true)
void EndListening(const ScAddress &rAddress, SvtListener *pListener)
void SetStreamValid(bool bSet, bool bIgnoreLock=false)
void StartListening(const ScAddress &rAddress, SvtListener *pListener)
bool BroadcastBroadcasters(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SfxHintId nHint)
Broadcast single broadcasters in range, without explicitly setting anything dirty,...
void Broadcast(const SfxHint &rHint)
void purgeEmptyBroadcasters()
#define SAL_WARN(area, stream)
A pretty assertion that checks that the relevant bits in the @nFlags are not set on the document at e...