LibreOffice Module sc (master)  1
documen7.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <sal/log.hxx>
21 
22 #include <document.hxx>
23 #include <brdcst.hxx>
24 #include <bcaslot.hxx>
25 #include <formulacell.hxx>
26 #include <table.hxx>
27 #include <progress.hxx>
28 #include <scmod.hxx>
29 #include <inputopt.hxx>
30 #include <sheetevents.hxx>
31 #include <tokenarray.hxx>
32 #include <listenercontext.hxx>
33 
35  const ScRange& rRange, bool bGroupListening, SvtListener* pListener )
36 {
37  if (!pBASM)
38  return;
39 
40  // Ensure sane ranges for the slots, specifically don't attempt to listen
41  // to more sheets than the document has. The slot machine handles it but
42  // with memory waste. Binary import filters can set out-of-bounds ranges
43  // in formula expressions' references, so all middle layers would have to
44  // check it, rather have this central point here.
45  ScRange aLimitedRange( ScAddress::UNINITIALIZED );
46  bool bEntirelyOut;
47  if (!LimitRangeToAvailableSheets( rRange, aLimitedRange, bEntirelyOut))
48  {
49  pBASM->StartListeningArea(rRange, bGroupListening, pListener);
50  return;
51  }
52 
53  // If both sheets are out-of-bounds in the same direction then just bail out.
54  if (bEntirelyOut)
55  return;
56 
57  pBASM->StartListeningArea( aLimitedRange, bGroupListening, pListener);
58 }
59 
60 void ScDocument::EndListeningArea( const ScRange& rRange, bool bGroupListening, SvtListener* pListener )
61 {
62  if (!pBASM)
63  return;
64 
65  // End listening has to limit the range exactly the same as in
66  // StartListeningArea(), otherwise the range would not be found.
67  ScRange aLimitedRange( ScAddress::UNINITIALIZED );
68  bool bEntirelyOut;
69  if (!LimitRangeToAvailableSheets( rRange, aLimitedRange, bEntirelyOut))
70  {
71  pBASM->EndListeningArea(rRange, bGroupListening, pListener);
72  return;
73  }
74 
75  // If both sheets are out-of-bounds in the same direction then just bail out.
76  if (bEntirelyOut)
77  return;
78 
79  pBASM->EndListeningArea( aLimitedRange, bGroupListening, pListener);
80 }
81 
83  bool& o_bEntirelyOutOfBounds ) const
84 {
85  const SCTAB nMaxTab = GetTableCount() - 1;
86  if (ValidTab( rRange.aStart.Tab(), nMaxTab) && ValidTab( rRange.aEnd.Tab(), nMaxTab))
87  return false;
88 
89  // Originally BCA_LISTEN_ALWAYS uses an implicit tab 0 and should had been
90  // valid already, but in case that would change...
91  if (rRange == BCA_LISTEN_ALWAYS)
92  return false;
93 
94  SCTAB nTab1 = rRange.aStart.Tab();
95  SCTAB nTab2 = rRange.aEnd.Tab();
96  SAL_WARN("sc.core","ScDocument::LimitRangeToAvailableSheets - bad sheet range: " << nTab1 << ".." << nTab2 <<
97  ", sheets: 0.." << nMaxTab);
98 
99  // Both sheets are out-of-bounds in the same direction.
100  if ((nTab1 < 0 && nTab2 < 0) || (nMaxTab < nTab1 && nMaxTab < nTab2))
101  {
102  o_bEntirelyOutOfBounds = true;
103  return true;
104  }
105 
106  // Limit the sheet range to bounds.
107  o_bEntirelyOutOfBounds = false;
108  nTab1 = std::clamp<SCTAB>( nTab1, 0, nMaxTab);
109  nTab2 = std::clamp<SCTAB>( nTab2, 0, nMaxTab);
110  o_rRange = rRange;
111  o_rRange.aStart.SetTab(nTab1);
112  o_rRange.aEnd.SetTab(nTab2);
113  return true;
114 }
115 
116 void ScDocument::Broadcast( const ScHint& rHint )
117 {
118  if ( !pBASM )
119  return ; // Clipboard or Undo
121  {
122  ScBulkBroadcast aBulkBroadcast( pBASM.get(), rHint.GetId()); // scoped bulk broadcast
123  bool bIsBroadcasted = false;
124  SvtBroadcaster* pBC = GetBroadcaster(rHint.GetAddress());
125  if ( pBC )
126  {
127  pBC->Broadcast( rHint );
128  bIsBroadcasted = true;
129  }
130  if ( pBASM->AreaBroadcast( rHint ) || bIsBroadcasted )
131  TrackFormulas( rHint.GetId() );
132  }
133 
134  if ( rHint.GetAddress() != BCA_BRDCST_ALWAYS )
135  {
136  SCTAB nTab = rHint.GetAddress().Tab();
137  if (nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
138  maTabs[nTab]->SetStreamValid(false);
139  }
140 }
141 
142 void ScDocument::BroadcastCells( const ScRange& rRange, SfxHintId nHint, bool bBroadcastSingleBroadcasters )
143 {
145 
146  if (!pBASM)
147  return; // Clipboard or Undo
148 
149  SCTAB nTab1 = rRange.aStart.Tab();
150  SCTAB nTab2 = rRange.aEnd.Tab();
151  SCROW nRow1 = rRange.aStart.Row();
152  SCROW nRow2 = rRange.aEnd.Row();
153  SCCOL nCol1 = rRange.aStart.Col();
154  SCCOL nCol2 = rRange.aEnd.Col();
155 
157  {
158  ScBulkBroadcast aBulkBroadcast( pBASM.get(), nHint); // scoped bulk broadcast
159  bool bIsBroadcasted = false;
160 
161  if (bBroadcastSingleBroadcasters)
162  {
163  ScHint aHint(nHint, ScAddress());
164 
165  for (SCTAB nTab = nTab1; nTab <= nTab2; ++nTab)
166  {
167  ScTable* pTab = FetchTable(nTab);
168  if (!pTab)
169  continue;
170 
171  bIsBroadcasted |= pTab->BroadcastBroadcasters( nCol1, nRow1, nCol2, nRow2, aHint);
172  }
173  }
174 
175  if (pBASM->AreaBroadcast(rRange, nHint) || bIsBroadcasted)
176  TrackFormulas(nHint);
177  }
178 
179  for (SCTAB nTab = nTab1; nTab <= nTab2; ++nTab)
180  {
181  ScTable* pTab = FetchTable(nTab);
182  if (pTab)
183  pTab->SetStreamValid(false);
184  }
185 
186  BroadcastUno(SfxHint(SfxHintId::ScDataChanged));
187 }
188 
189 void ScDocument::AreaBroadcast( const ScHint& rHint )
190 {
191  if ( !pBASM )
192  return ; // Clipboard or Undo
194  {
195  ScBulkBroadcast aBulkBroadcast( pBASM.get(), rHint.GetId()); // scoped bulk broadcast
196  if ( pBASM->AreaBroadcast( rHint ) )
197  TrackFormulas( rHint.GetId() );
198  }
199 }
200 
202 {
203  if ( pBASM )
204  pBASM->DelBroadcastAreasInRange( rRange );
205 }
206 
208  SvtListener* pListener )
209 {
210  OSL_ENSURE(pListener, "StartListeningCell: pListener Null");
211  SCTAB nTab = rAddress.Tab();
212  if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
213  maTabs[nTab]->StartListening( rAddress, pListener );
214 }
215 
217  SvtListener* pListener )
218 {
219  OSL_ENSURE(pListener, "EndListeningCell: pListener Null");
220  SCTAB nTab = rAddress.Tab();
221  if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
222  maTabs[nTab]->EndListening( rAddress, pListener );
223 }
224 
226  sc::StartListeningContext& rCxt, const ScAddress& rPos, SvtListener& rListener )
227 {
228  ScTable* pTab = FetchTable(rPos.Tab());
229  if (!pTab)
230  return;
231 
232  pTab->StartListening(rCxt, rPos, rListener);
233 }
234 
236  sc::EndListeningContext& rCxt, const ScAddress& rPos, SvtListener& rListener )
237 {
238  ScTable* pTab = FetchTable(rPos.Tab());
239  if (!pTab)
240  return;
241 
242  pTab->EndListening(rCxt, rPos, rListener);
243 }
244 
245 void ScDocument::EndListeningFormulaCells( std::vector<ScFormulaCell*>& rCells )
246 {
247  if (rCells.empty())
248  return;
249 
250  sc::EndListeningContext aCxt(*this);
251  for (auto& pCell : rCells)
252  pCell->EndListeningTo(aCxt);
253 
254  aCxt.purgeEmptyBroadcasters();
255 }
256 
258 {
259  OSL_ENSURE( pCell, "PutInFormulaTree: pCell Null" );
260  RemoveFromFormulaTree( pCell );
261  // append
263  if ( pEOFormulaTree )
264  pEOFormulaTree->SetNext( pCell );
265  else
266  pFormulaTree = pCell; // No end, no beginning...
267  pCell->SetPrevious( pEOFormulaTree );
268  pCell->SetNext( nullptr );
269  pEOFormulaTree = pCell;
270  nFormulaCodeInTree += pCell->GetCode()->GetCodeLen();
271 }
272 
274 {
276  OSL_ENSURE( pCell, "RemoveFromFormulaTree: pCell Null" );
277  ScFormulaCell* pPrev = pCell->GetPrevious();
278  assert(pPrev != pCell); // pointing to itself?!?
279  // if the cell is first or somewhere in chain
280  if ( pPrev || pFormulaTree == pCell )
281  {
282  ScFormulaCell* pNext = pCell->GetNext();
283  assert(pNext != pCell); // pointing to itself?!?
284  if ( pPrev )
285  {
286  assert(pFormulaTree != pCell); // if this cell is also head something's wrong
287  pPrev->SetNext( pNext ); // predecessor exists, set successor
288  }
289  else
290  {
291  pFormulaTree = pNext; // this cell was first cell
292  }
293  if ( pNext )
294  {
295  assert(pEOFormulaTree != pCell); // if this cell is also tail something's wrong
296  pNext->SetPrevious( pPrev ); // successor exists, set predecessor
297  }
298  else
299  {
300  pEOFormulaTree = pPrev; // this cell was last cell
301  }
302  pCell->SetPrevious( nullptr );
303  pCell->SetNext( nullptr );
304  sal_uInt16 nRPN = pCell->GetCode()->GetCodeLen();
305  if ( nFormulaCodeInTree >= nRPN )
306  nFormulaCodeInTree -= nRPN;
307  else
308  {
309  OSL_FAIL( "RemoveFromFormulaTree: nFormulaCodeInTree < nRPN" );
310  nFormulaCodeInTree = 0;
311  }
312  }
313  else if ( !pFormulaTree && nFormulaCodeInTree )
314  {
315  OSL_FAIL( "!pFormulaTree && nFormulaCodeInTree != 0" );
316  nFormulaCodeInTree = 0;
317  }
318 }
319 
320 bool ScDocument::IsInFormulaTree( const ScFormulaCell* pCell ) const
321 {
322  return pCell->GetPrevious() || pFormulaTree == pCell;
323 }
324 
325 void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSetAllDirty )
326 {
327  OSL_ENSURE( !IsCalculatingFormulaTree(), "CalcFormulaTree recursion" );
328  // never ever recurse into this, might end up lost in infinity
329  if ( IsCalculatingFormulaTree() )
330  return ;
331 
333  mpFormulaGroupCxt.reset();
335 
336  SetForcedFormulaPending( false );
337  bool bOldIdleEnabled = IsIdleEnabled();
338  EnableIdle(false);
339  bool bOldAutoCalc = GetAutoCalc();
340  //ATTENTION: _not_ SetAutoCalc( true ) because this might call CalcFormulaTree( true )
341  //ATTENTION: if it was disabled before and bHasForcedFormulas is set
342  bAutoCalc = true;
344  CalcAll();
345  else
346  {
347  ::std::vector<ScFormulaCell*> vAlwaysDirty;
348  ScFormulaCell* pCell = pFormulaTree;
349  while ( pCell )
350  {
351  if ( pCell->GetDirty() )
352  ; // nothing to do
353  else if ( pCell->GetCode()->IsRecalcModeAlways() )
354  {
355  // pCell and dependents are to be set dirty again, collect
356  // them first and broadcast afterwards to not break the
357  // FormulaTree chain here.
358  vAlwaysDirty.push_back( pCell);
359  }
360  else if ( bSetAllDirty )
361  {
362  // Force calculating all in tree, without broadcasting.
363  pCell->SetDirtyVar();
364  }
365  pCell = pCell->GetNext();
366  }
367  for (const auto& rpCell : vAlwaysDirty)
368  {
369  pCell = rpCell;
370  if (!pCell->GetDirty())
371  pCell->SetDirty();
372  }
373 
374  bool bProgress = !bOnlyForced && nFormulaCodeInTree && bProgressBar;
375  if ( bProgress )
377 
378  pCell = pFormulaTree;
379  ScFormulaCell* pLastNoGood = nullptr;
380  while ( pCell )
381  {
382  // Interpret resets bDirty and calls Remove, also the referenced!
383  // the Cell remains when ScRecalcMode::ALWAYS.
384  if ( bOnlyForced )
385  {
386  if ( pCell->GetCode()->IsRecalcModeForced() )
387  pCell->Interpret();
388  }
389  else
390  {
391  pCell->Interpret();
392  }
393  if ( pCell->GetPrevious() || pCell == pFormulaTree )
394  { // (IsInFormulaTree(pCell)) no Remove was called => next
395  pLastNoGood = pCell;
396  pCell = pCell->GetNext();
397  }
398  else
399  {
400  if ( pFormulaTree )
401  {
402  if ( pFormulaTree->GetDirty() && !bOnlyForced )
403  {
404  pCell = pFormulaTree;
405  pLastNoGood = nullptr;
406  }
407  else
408  {
409  // IsInFormulaTree(pLastNoGood)
410  if ( pLastNoGood && (pLastNoGood->GetPrevious() ||
411  pLastNoGood == pFormulaTree) )
412  pCell = pLastNoGood->GetNext();
413  else
414  {
415  pCell = pFormulaTree;
416  while ( pCell && !pCell->GetDirty() )
417  pCell = pCell->GetNext();
418  if ( pCell )
419  pLastNoGood = pCell->GetPrevious();
420  }
421  }
422  }
423  else
424  pCell = nullptr;
425  }
426  }
427  if ( bProgress )
429  }
430  bAutoCalc = bOldAutoCalc;
431  EnableIdle(bOldIdleEnabled);
432  bCalculatingFormulaTree = false;
433 
434  mpFormulaGroupCxt.reset();
435 }
436 
438 {
439  ScFormulaCell* pCell;
440  ScFormulaCell* pTree = pFormulaTree;
441  while ( pTree )
442  {
443  pCell = pTree;
444  pTree = pCell->GetNext();
445  if ( !pCell->GetCode()->IsRecalcModeAlways() )
446  RemoveFromFormulaTree( pCell );
447  }
448 }
449 
451 {
452  OSL_ENSURE( pCell, "AppendToFormulaTrack: pCell Null" );
453  // The cell can not be in both lists at the same time
454  RemoveFromFormulaTrack( pCell );
455  RemoveFromFormulaTree( pCell );
456  if ( pEOFormulaTrack )
457  pEOFormulaTrack->SetNextTrack( pCell );
458  else
459  pFormulaTrack = pCell; // No end, no beginning...
461  pCell->SetNextTrack( nullptr );
462  pEOFormulaTrack = pCell;
464 }
465 
467 {
468  OSL_ENSURE( pCell, "RemoveFromFormulaTrack: pCell Null" );
469  ScFormulaCell* pPrev = pCell->GetPreviousTrack();
470  assert(pPrev != pCell); // pointing to itself?!?
471  // if the cell is first or somewhere in chain
472  if ( !(pPrev || pFormulaTrack == pCell) )
473  return;
474 
475  ScFormulaCell* pNext = pCell->GetNextTrack();
476  assert(pNext != pCell); // pointing to itself?!?
477  if ( pPrev )
478  {
479  assert(pFormulaTrack != pCell); // if this cell is also head something's wrong
480  pPrev->SetNextTrack( pNext ); // predecessor exists, set successor
481  }
482  else
483  {
484  pFormulaTrack = pNext; // this cell was first cell
485  }
486  if ( pNext )
487  {
488  assert(pEOFormulaTrack != pCell); // if this cell is also tail something's wrong
489  pNext->SetPreviousTrack( pPrev ); // successor exists, set predecessor
490  }
491  else
492  {
493  pEOFormulaTrack = pPrev; // this cell was last cell
494  }
495  pCell->SetPreviousTrack( nullptr );
496  pCell->SetNextTrack( nullptr );
498 }
499 
500 bool ScDocument::IsInFormulaTrack( const ScFormulaCell* pCell ) const
501 {
502  return pCell->GetPreviousTrack() || pFormulaTrack == pCell;
503 }
504 
506 {
507  mbTrackFormulasPending = false;
508  mbFinalTrackFormulas = true;
509  {
510  ScBulkBroadcast aBulk( GetBASM(), nHintId);
511  // Collect all pending formula cells in bulk.
512  TrackFormulas( nHintId );
513  }
514  // A final round not in bulk to track all remaining formula cells and their
515  // dependents that were collected during ScBulkBroadcast dtor.
516  TrackFormulas( nHintId );
517  mbFinalTrackFormulas = false;
518 }
519 
520 /*
521  The first is broadcasted,
522  the ones that are created through this are appended to the Track by Notify.
523  The next is broadcasted again, and so on.
524  View initiates Interpret.
525  */
527 {
528  if (!pBASM)
529  return;
530 
531  if (pBASM->IsInBulkBroadcast() && !IsFinalTrackFormulas() &&
532  (nHintId == SfxHintId::ScDataChanged || nHintId == SfxHintId::ScHiddenRowsChanged))
533  {
535  return;
536  }
537 
538  if ( pFormulaTrack )
539  {
540  // outside the loop, check if any sheet has a "calculate" event script
541  bool bCalcEvent = HasAnySheetEventScript( ScSheetEventId::CALCULATE, true );
542  ScFormulaCell* pTrack;
543  ScFormulaCell* pNext;
544  pTrack = pFormulaTrack;
545  do
546  {
547  SvtBroadcaster* pBC = GetBroadcaster(pTrack->aPos);
548  ScHint aHint(nHintId, pTrack->aPos);
549  if (pBC)
550  pBC->Broadcast( aHint );
551  pBASM->AreaBroadcast( aHint );
552  // for "calculate" event, keep track of which sheets are affected by tracked formulas
553  if ( bCalcEvent )
554  SetCalcNotification( pTrack->aPos.Tab() );
555  pTrack = pTrack->GetNextTrack();
556  } while ( pTrack );
557  pTrack = pFormulaTrack;
558  bool bHaveForced = false;
559  do
560  {
561  pNext = pTrack->GetNextTrack();
562  RemoveFromFormulaTrack( pTrack );
563  PutInFormulaTree( pTrack );
564  if ( pTrack->GetCode()->IsRecalcModeForced() )
565  bHaveForced = true;
566  pTrack = pNext;
567  } while ( pTrack );
568  if ( bHaveForced )
569  {
570  SetForcedFormulas( true );
573  CalcFormulaTree( true );
574  else
575  SetForcedFormulaPending( true );
576  }
577  }
578  OSL_ENSURE( nFormulaTrackCount==0, "TrackFormulas: nFormulaTrackCount!=0" );
579 }
580 
582 {
583  sc::StartListeningContext aCxt(*this);
584  for ( SCTAB i = 0; i < static_cast<SCTAB>(maTabs.size()); ++i )
585  if ( maTabs[i] )
586  maTabs[i]->StartListeners(aCxt, true);
587 }
588 
590  const ScRange& rRange, SCCOL nDx, SCROW nDy, SCTAB nDz
591  )
592 {
593  bool bExpandRefsOld = IsExpandRefs();
594  if ( eUpdateRefMode == URM_INSDEL && (nDx > 0 || nDy > 0 || nDz > 0) )
595  SetExpandRefs( SC_MOD()->GetInputOptions().GetExpandRefs() );
596  if ( pBASM )
597  pBASM->UpdateBroadcastAreas( eUpdateRefMode, rRange, nDx, nDy, nDz );
598  SetExpandRefs( bExpandRefsOld );
599 }
600 
601 void ScDocument::SetAutoCalc( bool bNewAutoCalc )
602 {
603  bool bOld = bAutoCalc;
604  bAutoCalc = bNewAutoCalc;
605  if ( !bOld && bNewAutoCalc && bHasForcedFormulas )
606  {
607  if ( IsAutoCalcShellDisabled() )
608  SetForcedFormulaPending( true );
609  else if ( !IsInInterpreter() )
610  CalcFormulaTree( true );
611  }
612 }
613 
614 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsInFormulaTree(const ScFormulaCell *pCell) const
Definition: documen7.cxx:320
void EnableIdle(bool bDo)
Definition: document.hxx:2115
SfxHintId
ScFormulaCell * pFormulaTree
Definition: document.hxx:382
ScAddress aStart
Definition: address.hxx:500
#define BCA_LISTEN_ALWAYS
Definition: address.hxx:952
void SetForcedFormulas(bool bVal)
Definition: document.hxx:2304
bool IsInInterpreter() const
Definition: document.hxx:2307
SCROW Row() const
Definition: address.hxx:262
bool IsRecalcModeAlways() const
ScTable * FetchTable(SCTAB nTab)
Definition: document.cxx:2503
void StartListening(const ScAddress &rAddress, SvtListener *pListener)
Definition: table5.cxx:1121
bool IsExpandRefs() const
Definition: document.hxx:2352
ScTokenArray * GetCode()
bool GetDirty() const
ScFormulaCell * GetPreviousTrack() const
sal_uInt16 nFormulaTrackCount
Definition: document.hxx:474
sal_uInt16 GetCodeLen() const
SvtBroadcaster * GetBroadcaster(const ScAddress &rPos)
Definition: document.cxx:2452
ScAddress aEnd
Definition: address.hxx:501
HardRecalcState eHardRecalcState
Definition: document.hxx:475
void AppendToFormulaTrack(ScFormulaCell *pCell)
Definition: documen7.cxx:450
ScFormulaCell * pEOFormulaTrack
Definition: document.hxx:385
SfxHintId GetId() const
const ScAddress & GetAddress() const
Definition: brdcst.hxx:31
void RemoveFromFormulaTrack(ScFormulaCell *pCell)
Definition: documen7.cxx:466
bool HasAnySheetEventScript(ScSheetEventId nEvent, bool bWithVbaEvents=false) const
Definition: documen3.cxx:690
void SetStreamValid(bool bSet, bool bIgnoreLock=false)
Definition: table1.cxx:368
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:312
void EndListening(const ScAddress &rAddress, SvtListener *pListener)
Definition: table5.cxx:1129
ScFormulaCell * pEOFormulaTree
Definition: document.hxx:383
void SetExpandRefs(bool bVal)
Definition: documen2.cxx:305
TableContainer maTabs
Definition: document.hxx:374
std::unique_ptr< ScBroadcastAreaSlotMachine > pBASM
Definition: document.hxx:386
bool IsFinalTrackFormulas() const
Definition: document.hxx:2294
bool IsAutoCalcShellDisabled() const
Definition: document.hxx:1360
SCTAB Tab() const
Definition: address.hxx:271
void EndListeningArea(const ScRange &rRange, bool bGroupListening, SvtListener *pListener)
Definition: documen7.cxx:60
void EndListeningFormulaCells(std::vector< ScFormulaCell * > &rCells)
Definition: documen7.cxx:245
ScAddress aPos
void PrepareFormulaCalc()
Call this before any operations that might trigger one or more formula cells to get calculated...
Definition: document.cxx:2446
ScBroadcastAreaSlotMachine * GetBASM() const
Definition: document.hxx:2138
bool mbTrackFormulasPending
Definition: document.hxx:561
bool bHasForcedFormulas
Definition: document.hxx:508
void FinalTrackFormulas(SfxHintId nHintId)
Definition: documen7.cxx:505
bool mbFinalTrackFormulas
Definition: document.hxx:562
void SetDirty(bool bDirtyFlag=true)
void PutInFormulaTree(ScFormulaCell *pCell)
Definition: documen7.cxx:257
void StartListeningCell(const ScAddress &rAddress, SvtListener *pListener)
Definition: documen7.cxx:207
A pretty assertion that checks that the relevant bits in the are not set on the document at entry an...
Definition: document.hxx:2650
void SetNext(ScFormulaCell *pF)
void SetTab(SCTAB nTabP)
Definition: address.hxx:283
void UpdateBroadcastAreas(UpdateRefMode eUpdateRefMode, const ScRange &rRange, SCCOL nDx, SCROW nDy, SCTAB nDz)
Definition: documen7.cxx:589
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.
Definition: documen7.cxx:325
void Broadcast(const SfxHint &rHint)
int i
void DelBroadcastAreasInRange(const ScRange &rRange)
Definition: documen7.cxx:201
std::shared_ptr< sc::FormulaGroupContext > mpFormulaGroupCxt
Definition: document.hxx:359
sal_Int16 SCCOL
Definition: types.hxx:22
SC_DLLPUBLIC void SetAutoCalc(bool bNewAutoCalc)
Definition: documen7.cxx:601
#define SC_MOD()
Definition: scmod.hxx:250
bool Interpret(SCROW nStartOffset=-1, SCROW nEndOffset=-1)
ScFormulaCell * GetNextTrack() const
void EndListeningCell(const ScAddress &rAddress, SvtListener *pListener)
Definition: documen7.cxx:216
#define BCA_BRDCST_ALWAYS
Definition: address.hxx:951
void TrackFormulas(SfxHintId nHintId=SfxHintId::ScDataChanged)
Definition: documen7.cxx:526
static void DeleteInterpretProgress()
Definition: progress.cxx:154
void BroadcastUno(const SfxHint &rHint)
Definition: documen3.cxx:943
sal_uLong nFormulaCodeInTree
Definition: document.hxx:457
static void CreateInterpretProgress(ScDocument *pDoc, bool bWait=true)
Definition: progress.cxx:134
ScFormulaCell * GetNext() const
void Broadcast(const ScHint &rHint)
Broadcast wrapper, calls rHint.GetCell()->Broadcast() and AreaBroadcast() and TrackFormulas() Preferr...
Definition: documen7.cxx:116
void BroadcastCells(const ScRange &rRange, SfxHintId nHint, bool bBroadcastSingleBroadcasters=true)
Definition: documen7.cxx:142
SCCOL Col() const
Definition: address.hxx:267
bool bCalculatingFormulaTree
Definition: document.hxx:488
void SetCalcNotification(SCTAB nTab)
Definition: documen3.cxx:715
ScFormulaCell * GetPrevious() const
bool IsCalculatingFormulaTree() const
Definition: document.hxx:1365
UpdateRefMode
Definition: global.hxx:312
void SetPrevious(ScFormulaCell *pF)
sal_Int32 SCROW
Definition: types.hxx:18
void SetForcedFormulaPending(bool bNew)
Definition: document.hxx:1362
void ClearFormulaTree()
Definition: documen7.cxx:437
SC_DLLPUBLIC void CalcAll()
Definition: document.cxx:3931
bool IsInFormulaTrack(const ScFormulaCell *pCell) const
Definition: documen7.cxx:500
CalcAll() without broadcast/notify but setting up new listeners.
bool BroadcastBroadcasters(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScHint &rHint)
Broadcast single broadcasters in range, without explicitly setting anything dirty, not doing area broadcasts.
Definition: table2.cxx:1928
bool IsRecalcModeForced() const
bool bAutoCalc
Definition: document.hxx:482
#define SAL_WARN(area, stream)
void StartAllListeners()
Definition: documen7.cxx:581
void SetTrackFormulasPending()
Definition: document.hxx:2291
void StartListeningArea(const ScRange &rRange, bool bGroupListening, SvtListener *pListener)
Definition: documen7.cxx:34
void RemoveFromFormulaTree(ScFormulaCell *pCell)
Definition: documen7.cxx:273
bool LimitRangeToAvailableSheets(const ScRange &rRange, ScRange &o_rRange, bool &o_bEntirelyOutOfBounds) const
Adjust a range to available sheets.
Definition: documen7.cxx:82
void SetNextTrack(ScFormulaCell *pF)
bool IsIdleEnabled() const
Definition: document.hxx:2114
void AreaBroadcast(const ScHint &rHint)
only area, no cell broadcast
Definition: documen7.cxx:189
bool ValidTab(SCTAB nTab)
Definition: address.hxx:105
void SetPreviousTrack(ScFormulaCell *pF)
sal_Int16 SCTAB
Definition: types.hxx:23
ScFormulaCell * pFormulaTrack
Definition: document.hxx:384
SC_DLLPUBLIC bool GetAutoCalc() const
Definition: document.hxx:1357