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