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 pTable->StartListening(rAddress, pListener);
233 OSL_ENSURE(pListener,
"EndListeningCell: pListener Null");
236 pTable->EndListening( rAddress, pListener );
243 pTable->StartListening(rCxt, rPos, rListener);
250 pTable->EndListening(rCxt, rPos, rListener);
259 for (
auto& pCell : rCells)
260 pCell->EndListeningTo(aCxt);
267 OSL_ENSURE( pCell,
"PutInFormulaTree: pCell Null" );
284 OSL_ENSURE( pCell,
"RemoveFromFormulaTree: pCell Null" );
286 assert(pPrev != pCell);
291 assert(pNext != pCell);
317 OSL_FAIL(
"RemoveFromFormulaTree: nFormulaCodeInTree < nRPN" );
323 OSL_FAIL(
"!pFormulaTree && nFormulaCodeInTree != 0" );
350 ::std::vector<ScFormulaCell*> vAlwaysDirty;
361 vAlwaysDirty.push_back( pCell);
363 else if ( bSetAllDirty )
370 for (
const auto& rpCell : vAlwaysDirty)
408 pLastNoGood =
nullptr;
415 pCell = pLastNoGood->
GetNext();
419 while ( pCell && !pCell->
GetDirty() )
455 OSL_ENSURE( pCell,
"AppendToFormulaTrack: pCell Null" );
471 OSL_ENSURE( pCell,
"RemoveFromFormulaTrack: pCell Null" );
473 assert(pPrev != pCell);
479 assert(pNext != pCell);
530 (nHintId == SfxHintId::ScDataChanged || nHintId == SfxHintId::ScHiddenRowsChanged))
552 ScHint aHint( nHintId, address, rowCount );
554 pBASM->AreaBroadcast( aHint );
559 bool bHaveForced =
false;
565 if ( pTrack->GetCode()->IsRecalcModeForced() )
587 i->StartListeners(aCxt,
true);
595 if ( eUpdateRefMode ==
URM_INSDEL && (nDx > 0 || nDy > 0 || nDz > 0) )
598 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)
SC_DLLPUBLIC 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 SetStreamValid(bool bSet, bool bIgnoreLock=false)
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...