LibreOffice Module sc (master)  1
documen2.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 <scextopt.hxx>
21 #include <autonamecache.hxx>
22 
23 #include <o3tl/safeint.hxx>
24 #include <osl/thread.h>
25 #include <svx/xtable.hxx>
26 #include <sfx2/bindings.hxx>
27 #include <sfx2/objsh.hxx>
28 #include <sfx2/docfile.hxx>
29 #include <sfx2/printer.hxx>
30 #include <svl/asiancfg.hxx>
31 #include <vcl/virdev.hxx>
32 #include <svl/sharedstringpool.hxx>
33 #include <tools/urlobj.hxx>
34 #include <rtl/crc.h>
35 #include <basic/basmgr.hxx>
37 #include <sal/log.hxx>
38 
39 #include <scmod.hxx>
40 #include <document.hxx>
41 #include <table.hxx>
42 #include <patattr.hxx>
43 #include <rangenam.hxx>
44 #include <dbdata.hxx>
45 #include <chartlock.hxx>
46 #include <rechead.hxx>
47 #include <global.hxx>
48 #include <bcaslot.hxx>
49 #include <adiasync.hxx>
50 #include <addinlis.hxx>
51 #include <chartlis.hxx>
52 #include <markdata.hxx>
53 #include <validat.hxx>
54 #include <detdata.hxx>
55 #include <defaultsoptions.hxx>
56 #include <sc.hrc>
57 #include <ddelink.hxx>
58 #include <chgtrack.hxx>
59 #include <chgviset.hxx>
60 #include <editutil.hxx>
61 #include <hints.hxx>
62 #include <dpobject.hxx>
63 #include <scrdata.hxx>
64 #include <poolhelp.hxx>
65 #include <unoreflist.hxx>
66 #include <listenercalls.hxx>
67 #include <recursionhelper.hxx>
68 #include <lookupcache.hxx>
69 #include <externalrefmgr.hxx>
70 #include <viewdata.hxx>
71 #include <viewutil.hxx>
72 #include <tabprotection.hxx>
73 #include <formulaparserpool.hxx>
74 #include <clipparam.hxx>
75 #include <macromgr.hxx>
76 #include <formulacell.hxx>
77 #include <clipcontext.hxx>
78 #include <refupdatecontext.hxx>
80 #include <scopetools.hxx>
81 #include <documentlinkmgr.hxx>
82 #include <interpre.hxx>
83 #include <tokenstringcontext.hxx>
84 #include <docsh.hxx>
85 #include <clipoptions.hxx>
86 #include <listenercontext.hxx>
87 #include <datamapper.hxx>
88 #include <drwlayer.hxx>
89 
90 using namespace com::sun::star;
91 
92 const sal_uInt16 ScDocument::nSrcVer = SC_CURRENT_VERSION;
93 
95 {
96  const ScDefaultsOptions& rOpt = SC_MOD()->GetDefaultsOptions();
97  if (rOpt.GetInitJumboSheets())
99  else
100  return new ScSheetLimits(MAXCOL, MAXROW);
101 }
102 
104  mpCellStringPool(std::make_shared<svl::SharedStringPool>(*ScGlobal::getCharClassPtr())),
105  mpDocLinkMgr(new sc::DocumentLinkManager(pDocShell)),
106  mbFormulaGroupCxtBlockDiscard(false),
107  maCalcConfig( ScInterpreter::GetGlobalConfig()),
108  mpUndoManager( nullptr ),
109  mpShell( pDocShell ),
110  mpPrinter( nullptr ),
111  mpVirtualDevice_100th_mm( nullptr ),
112  pFormatExchangeList( nullptr ),
113  mxSheetLimits(CreateSheetLimits()),
114  pFormulaTree( nullptr ),
115  pEOFormulaTree( nullptr ),
116  pFormulaTrack( nullptr ),
117  pEOFormulaTrack( nullptr ),
118  pPreviewCellStyle( nullptr ),
119  maPreviewSelection(*mxSheetLimits),
120  nUnoObjectId( 0 ),
121  nRangeOverflowType( 0 ),
122  aCurTextWidthCalcPos(MaxCol(),0,0),
123  nFormulaCodeInTree(0),
124  nXMLImportedFormulaCount( 0 ),
125  nInterpretLevel(0),
126  nMacroInterpretLevel(0),
127  nInterpreterTableOpLevel(0),
128  maInterpreterContext( *this, nullptr ),
129  nFormulaTrackCount(0),
130  eHardRecalcState(HardRecalcState::OFF),
131  nVisibleTab( 0 ),
132  nPosLeft( 0 ),
133  nPosTop( 0 ),
134  eLinkMode(LM_UNKNOWN),
135  bAutoCalc( eMode == SCDOCMODE_DOCUMENT || eMode == SCDOCMODE_FUNCTIONACCESS ),
136  bAutoCalcShellDisabled( false ),
137  bForcedFormulaPending( false ),
138  bCalculatingFormulaTree( false ),
139  bIsClip( eMode == SCDOCMODE_CLIP ),
140  bIsUndo( eMode == SCDOCMODE_UNDO ),
141  bIsFunctionAccess( eMode == SCDOCMODE_FUNCTIONACCESS ),
142  bIsVisible( false ),
143  bIsEmbedded( false ),
144  bInsertingFromOtherDoc( false ),
145  bLoadingMedium( false ),
146  bImportingXML( false ),
147  bCalcingAfterLoad( false ),
148  bNoListening( false ),
149  mbIdleEnabled(true),
150  bInLinkUpdate( false ),
151  bChartListenerCollectionNeedsUpdate( false ),
152  bHasForcedFormulas( false ),
153  bInDtorClear( false ),
154  bExpandRefs( false ),
155  bDetectiveDirty( false ),
156  bLinkFormulaNeedingCheck( false ),
157  nAsianCompression(CharCompressType::Invalid),
158  nAsianKerning(SC_ASIANKERNING_INVALID),
159  bPastingDrawFromOtherDoc( false ),
160  nInDdeLinkUpdate( 0 ),
161  bInUnoBroadcast( false ),
162  bInUnoListenerCall( false ),
163  nAdjustHeightLock(0),
164  eGrammar( formula::FormulaGrammar::GRAM_NATIVE ),
165  bStyleSheetUsageInvalid( true ),
166  mbUndoEnabled( true ),
167  mbExecuteLinkEnabled( true ),
168  mbChangeReadOnlyEnabled( false ),
169  mbStreamValidLocked( false ),
170  mbUserInteractionEnabled(true),
171  mnNamedRangesLockCount(0),
172  mbEmbedFonts(false),
173  mbEmbedUsedFontsOnly(false),
174  mbEmbedFontScriptLatin(true),
175  mbEmbedFontScriptAsian(true),
176  mbEmbedFontScriptComplex(true),
177  mbTrackFormulasPending(false),
178  mbFinalTrackFormulas(false),
179  mbDocShellRecalc(false),
180  mnMutationGuardFlags(0)
181 {
183  aCurTextWidthCalcPos = { MaxCol(), 0, 0 };
184 
186 
187  eSrcSet = osl_getThreadTextEncoding();
188 
189  /* TODO: for SCDOCMODE_FUNCTIONACCESS it might not even be necessary to
190  * have all of these available. */
191  if ( eMode == SCDOCMODE_DOCUMENT || eMode == SCDOCMODE_FUNCTIONACCESS )
192  {
193  mxPoolHelper = new ScPoolHelper( this );
194 
195  pBASM.reset( new ScBroadcastAreaSlotMachine( this ) );
198  }
199  else
200  {
201  pChartListenerCollection = nullptr;
202  }
203  pDBCollection.reset( new ScDBCollection(this) );
204  pSelectionAttr = nullptr;
205  apTemporaryChartLock.reset( new ScTemporaryChartLock(this) );
209  // languages for a visible document are set by docshell later (from options)
211 
212  aTrackIdle.SetInvokeHandler( LINK( this, ScDocument, TrackTimeHdl ) );
213 }
214 
216 {
218 }
219 
221 {
223 }
224 
226 {
227  return *mpDocLinkMgr;
228 }
229 
231 {
232  return const_cast<ScDocument*>(this)->GetDocLinkManager();
233 }
234 
236 {
237  OSL_PRECOND(
240  "ScDocument::SetStorageGrammar: wrong storage grammar");
241 
242  eStorageGrammar = eGram;
243 }
244 
245 void ScDocument::SetDocVisible( bool bSet )
246 {
247  // called from view ctor - only for a visible document,
248  // each new sheet's RTL flag is initialized from the locale
249  bIsVisible = bSet;
250 }
251 
252 sal_uInt32 ScDocument::GetDocumentID() const
253 {
254  const ScDocument* pThis = this;
255  sal_uInt32 nCrc = rtl_crc32( 0, &pThis, sizeof(ScDocument*) );
256  // the this pointer only might not be sufficient
257  nCrc = rtl_crc32( nCrc, &mpShell, sizeof(SfxObjectShell*) );
258  return nCrc;
259 }
260 
262 {
263  if (!pChangeTrack)
264  pChangeTrack.reset( new ScChangeTrack( this ) );
265 }
266 
268 {
269  pChangeTrack.reset();
270 }
271 
272 void ScDocument::SetChangeTrack( std::unique_ptr<ScChangeTrack> pTrack )
273 {
274  OSL_ENSURE( pTrack->GetDocument() == this, "SetChangeTrack: different documents" );
275  if ( !pTrack || pTrack == pChangeTrack || pTrack->GetDocument() != this )
276  return ;
278  pChangeTrack = std::move(pTrack);
279 }
280 
281 IMPL_LINK_NOARG(ScDocument, TrackTimeHdl, Timer *, void)
282 {
283  if ( ScDdeLink::IsInUpdate() ) // do not nest
284  {
285  aTrackIdle.Start(); // try again later
286  }
287  else if (mpShell) // execute
288  {
289  TrackFormulas();
290  mpShell->Broadcast( SfxHint( SfxHintId::ScDataChanged ) );
291 
292  if (!mpShell->IsModified())
293  {
294  mpShell->SetModified();
295  SfxBindings* pBindings = GetViewBindings();
296  if (pBindings)
297  {
298  pBindings->Invalidate( SID_SAVEDOC );
299  pBindings->Invalidate( SID_DOC_MODIFIED );
300  }
301  }
302  }
303 }
304 
305 void ScDocument::SetExpandRefs( bool bVal )
306 {
307  bExpandRefs = bVal;
308 }
309 
311 {
312  if (!aTrackIdle.IsActive()) // do not postpone for forever
313  aTrackIdle.Start();
314 }
315 
317 {
318  if (!bIsClip)
319  return;
320 
321  ForgetNoteCaptions( ScRangeList( ScRange( 0,0,0, MaxCol(), MaxRow(), GetTableCount()-1)), true);
322 }
323 
325 {
326  OSL_PRECOND( !bInLinkUpdate, "bInLinkUpdate in dtor" );
327 
328  // Join any pending(recalc) threads in global threadpool
330 
331  bInDtorClear = true;
332 
333  // first of all disable all refresh timers by deleting the control
334  if ( pRefreshTimerControl )
335  { // To be sure there isn't anything running do it with a protector,
336  // this ensures also that nothing needs the control anymore.
338  pRefreshTimerControl.reset();
339  }
340 
341  mxFormulaParserPool.reset();
342  // Destroy the external ref mgr instance here because it has a timer
343  // which needs to be stopped before the app closes.
344  pExternalRefMgr.reset();
345 
348  pChartListenerCollection.reset(); // before pBASM because of potential Listener!
349 
350  ClearLookupCaches(); // before pBASM because of listeners
351 
352  // destroy BroadcastAreas first to avoid un-needed Single-EndListenings of Formula-Cells
353  pBASM.reset(); // BroadcastAreaSlotMachine
354 
355  pUnoBroadcaster.reset(); // broadcasts SfxHintId::Dying again
356 
357  pUnoRefUndoList.reset();
358  pUnoListenerCalls.reset();
359 
360  Clear( true ); // true = from destructor (needed for SdrModel::ClearModel)
361 
362  pValidationList.reset();
363  pRangeName.reset();
364  pDBCollection.reset();
365  pSelectionAttr.reset();
366  apTemporaryChartLock.reset();
367  DeleteDrawLayer();
370  pConsolidateDlgData.reset();
371  pClipData.reset();
372  pDetOpList.reset(); // also deletes entries
373  pChangeTrack.reset();
374  mpEditEngine.reset();
375  mpNoteEngine.reset();
376  pChangeViewSettings.reset(); // and delete
378 
379  pDPCollection.reset();
380  mpAnonymousDBData.reset();
381 
382  // delete the EditEngine before destroying the mxPoolHelper
383  pCacheFieldEditEngine.reset();
384 
385  if ( mxPoolHelper.is() && !bIsClip && !bIsUndo)
386  mxPoolHelper->SourceDocumentGone();
387  mxPoolHelper.clear();
388 
389  pScriptTypeData.reset();
392 
393  pPreviewFont.reset();
394  SAL_WARN_IF( pAutoNameCache, "sc.core", "AutoNameCache still set in dtor" );
395 
396  mpFormulaGroupCxt.reset();
397  // Purge unused items if the string pool will be still used (e.g. by undo history).
398  if(mpCellStringPool.use_count() > 1)
399  mpCellStringPool->purge();
400  mpCellStringPool.reset();
401 
402  assert( pDelayedFormulaGrouping == nullptr );
404 }
405 
407 {
408  OSL_ENSURE(bIsClip, "InitClipPtrs and not bIsClip");
409 
411 
412  pValidationList.reset();
413 
414  Clear();
415 
416  SharePooledResources(pSourceDoc);
417 
418  // conditional Formats / validations
419  // TODO: Copy Templates?
420  const ScValidationDataList* pSourceValid = pSourceDoc->pValidationList.get();
421  if ( pSourceValid )
422  pValidationList.reset(new ScValidationDataList(this, *pSourceValid));
423 
424  // store Links in Stream
425  pClipData.reset();
426  if (pSourceDoc->GetDocLinkManager().hasDdeLinks())
427  {
428  pClipData.reset( new SvMemoryStream );
429  pSourceDoc->SaveDdeLinks(*pClipData);
430  }
431 
432  // Options pointers exist (ImplCreateOptions) for any document.
433  // Must be copied for correct results in OLE objects (#i42666#).
434  SetDocOptions( pSourceDoc->GetDocOptions() );
435  SetViewOptions( pSourceDoc->GetViewOptions() );
436 }
437 
439 {
441  return mxPoolHelper->GetFormTable();
442 }
443 
445 {
446  return mxPoolHelper->GetEditPool();
447 }
448 
450 {
451  return mxPoolHelper->GetEnginePool();
452 }
453 
455 {
456  if ( !mpEditEngine )
457  {
458  mpEditEngine.reset( new ScFieldEditEngine(this, GetEnginePool(), GetEditPool()) );
459  mpEditEngine->SetUpdateMode( false );
460  mpEditEngine->EnableUndo( false );
461  mpEditEngine->SetRefMapMode(MapMode(MapUnit::Map100thMM));
463  }
464  return *mpEditEngine;
465 }
466 
468 {
469  if ( !mpNoteEngine )
470  {
473  mpNoteEngine->SetUpdateMode( false );
474  mpNoteEngine->EnableUndo( false );
475  mpNoteEngine->SetRefMapMode(MapMode(MapUnit::Map100thMM));
477  const SfxItemSet& rItemSet = GetDefPattern()->GetItemSet();
478  std::unique_ptr<SfxItemSet> pEEItemSet(new SfxItemSet( mpNoteEngine->GetEmptyItemSet() ));
479  ScPatternAttr::FillToEditItemSet( *pEEItemSet, rItemSet );
480  mpNoteEngine->SetDefaults( std::move(pEEItemSet) ); // edit engine takes ownership
481  }
482  return *mpNoteEngine;
483 }
484 
485 void ScDocument::ResetClip( ScDocument* pSourceDoc, const ScMarkData* pMarks )
486 {
487  if (bIsClip)
488  {
489  InitClipPtrs(pSourceDoc);
490 
491  for (SCTAB i = 0; i < static_cast<SCTAB>(pSourceDoc->maTabs.size()); i++)
492  if (pSourceDoc->maTabs[i])
493  if (!pMarks || pMarks->GetTableSelect(i))
494  {
495  OUString aString = pSourceDoc->maTabs[i]->GetName();
496  if ( i < static_cast<SCTAB>(maTabs.size()) )
497  {
498  maTabs[i].reset( new ScTable(this, i, aString) );
499 
500  }
501  else
502  {
503  if( i > static_cast<SCTAB>(maTabs.size()) )
504  {
505  maTabs.resize(i);
506  }
507  maTabs.emplace_back(new ScTable(this, i, aString));
508  }
509  maTabs[i]->SetLayoutRTL( pSourceDoc->maTabs[i]->IsLayoutRTL() );
510  }
511  }
512  else
513  {
514  OSL_FAIL("ResetClip");
515  }
516 }
517 
518 void ScDocument::ResetClip( ScDocument* pSourceDoc, SCTAB nTab )
519 {
520  if (bIsClip)
521  {
522  InitClipPtrs(pSourceDoc);
523  if (nTab >= static_cast<SCTAB>(maTabs.size()))
524  {
525  maTabs.resize(nTab+1);
526  }
527  maTabs[nTab].reset( new ScTable(this, nTab, "baeh") );
528  if (nTab < static_cast<SCTAB>(pSourceDoc->maTabs.size()) && pSourceDoc->maTabs[nTab])
529  maTabs[nTab]->SetLayoutRTL( pSourceDoc->maTabs[nTab]->IsLayoutRTL() );
530  }
531  else
532  {
533  OSL_FAIL("ResetClip");
534  }
535 }
536 
538 {
539  bool bExtras = !bIsUndo; // Column-Widths, Row-Heights, Flags
540  if (o3tl::make_unsigned(nTab) >= maTabs.size())
541  maTabs.resize(nTab+1);
542 
543  if (!maTabs[nTab])
544  maTabs[nTab].reset( new ScTable(this, nTab, "temp", bExtras, bExtras) );
545 }
546 
548 {
549  if (!TableExists(rPos.Tab()))
550  return ScRefCellValue(); // empty
551 
552  return maTabs[rPos.Tab()]->GetRefCellValue(rPos.Col(), rPos.Row());
553 }
554 
556 {
557  if (!TableExists(rPos.Tab()))
558  return ScRefCellValue(); // empty
559 
560  return maTabs[rPos.Tab()]->GetRefCellValue(rPos.Col(), rPos.Row(), rBlockPos);
561 }
562 
564 {
565  return *mpCellStringPool;
566 }
567 
569 {
570  return *mpCellStringPool;
571 }
572 
573 bool ScDocument::GetPrintArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow,
574  bool bNotes ) const
575 {
576  if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
577  {
578  bool bAny = maTabs[nTab]->GetPrintArea( rEndCol, rEndRow, bNotes );
579  if (mpDrawLayer)
580  {
581  ScRange aDrawRange(0,0,nTab, MaxCol(),MaxRow(),nTab);
582  if (DrawGetPrintArea( aDrawRange, true, true ))
583  {
584  if (aDrawRange.aEnd.Col()>rEndCol) rEndCol=aDrawRange.aEnd.Col();
585  if (aDrawRange.aEnd.Row()>rEndRow) rEndRow=aDrawRange.aEnd.Row();
586  bAny = true;
587  }
588  }
589  return bAny;
590  }
591 
592  rEndCol = 0;
593  rEndRow = 0;
594  return false;
595 }
596 
597 bool ScDocument::GetPrintAreaHor( SCTAB nTab, SCROW nStartRow, SCROW nEndRow,
598  SCCOL& rEndCol ) const
599 {
600  if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
601  {
602  bool bAny = maTabs[nTab]->GetPrintAreaHor( nStartRow, nEndRow, rEndCol );
603  if (mpDrawLayer)
604  {
605  ScRange aDrawRange(0,nStartRow,nTab, MaxCol(),nEndRow,nTab);
606  if (DrawGetPrintArea( aDrawRange, true, false ))
607  {
608  if (aDrawRange.aEnd.Col()>rEndCol) rEndCol=aDrawRange.aEnd.Col();
609  bAny = true;
610  }
611  }
612  return bAny;
613  }
614 
615  rEndCol = 0;
616  return false;
617 }
618 
619 bool ScDocument::GetPrintAreaVer( SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol,
620  SCROW& rEndRow, bool bNotes ) const
621 {
622  if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
623  {
624  bool bAny = maTabs[nTab]->GetPrintAreaVer( nStartCol, nEndCol, rEndRow, bNotes );
625  if (mpDrawLayer)
626  {
627  ScRange aDrawRange(nStartCol,0,nTab, nEndCol,MaxRow(),nTab);
628  if (DrawGetPrintArea( aDrawRange, false, true ))
629  {
630  if (aDrawRange.aEnd.Row()>rEndRow) rEndRow=aDrawRange.aEnd.Row();
631  bAny = true;
632  }
633  }
634  return bAny;
635  }
636 
637  rEndRow = 0;
638  return false;
639 }
640 
641 bool ScDocument::GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow ) const
642 {
643  if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
644  {
645  bool bAny = maTabs[nTab]->GetDataStart( rStartCol, rStartRow );
646  if (mpDrawLayer)
647  {
648  ScRange aDrawRange(0,0,nTab, MaxCol(),MaxRow(),nTab);
649  if (DrawGetPrintArea( aDrawRange, true, true ))
650  {
651  if (aDrawRange.aStart.Col()<rStartCol) rStartCol=aDrawRange.aStart.Col();
652  if (aDrawRange.aStart.Row()<rStartRow) rStartRow=aDrawRange.aStart.Row();
653  bAny = true;
654  }
655  }
656  return bAny;
657  }
658 
659  rStartCol = 0;
660  rStartRow = 0;
661  return false;
662 }
663 
664 void ScDocument::GetTiledRenderingArea(SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow) const
665 {
666  bool bHasPrintArea = GetPrintArea(nTab, rEndCol, rEndRow, false);
667 
668  // we need some reasonable minimal document size
669  ScViewData* pViewData = ScDocShell::GetViewData();
670  if (!pViewData)
671  {
672  if (!bHasPrintArea)
673  {
674  rEndCol = 20;
675  rEndRow = 50;
676  }
677  else
678  {
679  rEndCol += 20;
680  rEndRow += 50;
681  }
682  }
683  else if (!bHasPrintArea)
684  {
685  rEndCol = pViewData->GetMaxTiledCol();
686  rEndRow = pViewData->GetMaxTiledRow();
687  }
688  else
689  {
690  rEndCol = std::max(rEndCol, pViewData->GetMaxTiledCol());
691  rEndRow = std::max(rEndRow, pViewData->GetMaxTiledRow());
692  }
693 }
694 
695 bool ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress )
696 {
697  if (nOldPos == nNewPos)
698  return false;
699 
700  SCTAB nTabCount = static_cast<SCTAB>(maTabs.size());
701  if(nTabCount < 2)
702  return false;
703 
704  bool bValid = false;
705  if (ValidTab(nOldPos) && nOldPos < nTabCount )
706  {
707  if (maTabs[nOldPos])
708  {
709  sc::AutoCalcSwitch aACSwitch(*this, false);
710 
711  SetNoListening( true );
712  if (nNewPos == SC_TAB_APPEND || nNewPos >= nTabCount)
713  nNewPos = nTabCount-1;
714 
715  // Update Reference
716  // TODO: combine with UpdateReference!
717 
718  sc::RefUpdateMoveTabContext aCxt( *this, nOldPos, nNewPos);
719 
720  SCTAB nDz = nNewPos - nOldPos;
721  ScRange aSourceRange( 0,0,nOldPos, MaxCol(),MaxRow(),nOldPos );
722  if (pRangeName)
723  pRangeName->UpdateMoveTab(aCxt);
724 
725  pDBCollection->UpdateMoveTab( nOldPos, nNewPos );
726  xColNameRanges->UpdateReference( URM_REORDER, this, aSourceRange, 0,0,nDz );
727  xRowNameRanges->UpdateReference( URM_REORDER, this, aSourceRange, 0,0,nDz );
728  if (pDPCollection)
729  pDPCollection->UpdateReference( URM_REORDER, aSourceRange, 0,0,nDz );
730  if (pDetOpList)
731  pDetOpList->UpdateReference( this, URM_REORDER, aSourceRange, 0,0,nDz );
733  0,0,nOldPos, MaxCol(),MaxRow(),nOldPos, 0,0,nDz );
734  UpdateRefAreaLinks( URM_REORDER, aSourceRange, 0,0,nDz );
735  if ( pValidationList )
736  pValidationList->UpdateMoveTab(aCxt);
737  if ( pUnoBroadcaster )
739  aSourceRange, 0,0,nDz ) );
740 
741  ScTableUniquePtr pSaveTab = std::move(maTabs[nOldPos]);
742  maTabs.erase(maTabs.begin()+nOldPos);
743  maTabs.insert(maTabs.begin()+nNewPos, std::move(pSaveTab));
744  for (SCTAB i = 0; i < nTabCount; i++)
745  if (maTabs[i])
746  maTabs[i]->UpdateMoveTab(aCxt, i, pProgress);
747  for (auto& rxTab : maTabs)
748  if (rxTab)
749  rxTab->UpdateCompile();
750  SetNoListening( false );
752 
753  sc::SetFormulaDirtyContext aFormulaDirtyCxt;
754  SetAllFormulasDirty(aFormulaDirtyCxt);
755 
756  if (mpDrawLayer)
757  mpDrawLayer->ScMovePage( static_cast<sal_uInt16>(nOldPos), static_cast<sal_uInt16>(nNewPos) );
758 
759  bValid = true;
760  }
761  }
762  return bValid;
763 }
764 
765 bool ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pOnlyMarked )
766 {
767  if (SC_TAB_APPEND == nNewPos || nNewPos >= static_cast<SCTAB>(maTabs.size()))
768  nNewPos = static_cast<SCTAB>(maTabs.size());
769  OUString aName;
770  GetName(nOldPos, aName);
771 
772  // check first if Prefix is valid; if not, then only avoid duplicates
773  bool bPrefix = ValidTabName( aName );
774  OSL_ENSURE(bPrefix, "invalid table name");
775  SCTAB nDummy;
776 
777  CreateValidTabName(aName);
778 
779  bool bValid;
780  if (bPrefix)
781  bValid = ValidNewTabName(aName);
782  else
783  bValid = !GetTable( aName, nDummy );
784 
785  sc::AutoCalcSwitch aACSwitch(*this, false);
786  sc::RefUpdateInsertTabContext aCxt( *this, nNewPos, 1);
787 
788  if (bValid)
789  {
790  if (nNewPos >= static_cast<SCTAB>(maTabs.size()))
791  {
792  nNewPos = static_cast<SCTAB>(maTabs.size());
793  maTabs.emplace_back(new ScTable(this, nNewPos, aName));
794  }
795  else
796  {
797  if (ValidTab(nNewPos) && (nNewPos < static_cast<SCTAB>(maTabs.size())))
798  {
799  SetNoListening( true );
800 
801  ScRange aRange( 0,0,nNewPos, MaxCol(),MaxRow(),MAXTAB );
802  xColNameRanges->UpdateReference( URM_INSDEL, this, aRange, 0,0,1 );
803  xRowNameRanges->UpdateReference( URM_INSDEL, this, aRange, 0,0,1 );
804  if (pRangeName)
805  pRangeName->UpdateInsertTab(aCxt);
806 
807  pDBCollection->UpdateReference(
808  URM_INSDEL, 0,0,nNewPos, MaxCol(),MaxRow(),MAXTAB, 0,0,1 );
809  if (pDPCollection)
810  pDPCollection->UpdateReference( URM_INSDEL, aRange, 0,0,1 );
811  if (pDetOpList)
812  pDetOpList->UpdateReference( this, URM_INSDEL, aRange, 0,0,1 );
813  UpdateChartRef( URM_INSDEL, 0,0,nNewPos, MaxCol(),MaxRow(),MAXTAB, 0,0,1 );
814  UpdateRefAreaLinks( URM_INSDEL, aRange, 0,0,1 );
815  if ( pUnoBroadcaster )
816  pUnoBroadcaster->Broadcast( ScUpdateRefHint( URM_INSDEL, aRange, 0,0,1 ) );
817 
818  for (TableContainer::iterator it = maTabs.begin(); it != maTabs.end(); ++it)
819  if (*it && it != (maTabs.begin() + nOldPos))
820  (*it)->UpdateInsertTab(aCxt);
821  if (nNewPos <= nOldPos)
822  nOldPos++;
823  maTabs.emplace(maTabs.begin() + nNewPos, new ScTable(this, nNewPos, aName));
824  bValid = true;
825  for (TableContainer::iterator it = maTabs.begin(); it != maTabs.end(); ++it)
826  if (*it && it != maTabs.begin()+nOldPos && it != maTabs.begin() + nNewPos)
827  (*it)->UpdateCompile();
828  SetNoListening( false );
829  sc::StartListeningContext aSLCxt(*this);
830  for (TableContainer::iterator it = maTabs.begin(); it != maTabs.end(); ++it)
831  if (*it && it != maTabs.begin()+nOldPos && it != maTabs.begin()+nNewPos)
832  (*it)->StartListeners(aSLCxt, true);
833 
834  if (pValidationList)
835  pValidationList->UpdateInsertTab(aCxt);
836  }
837  else
838  bValid = false;
839  }
840  }
841 
842  if (bValid)
843  {
844  SetNoListening( true ); // not yet at CopyToTable/Insert
845 
846  const bool bGlobalNamesToLocal = true;
847  const SCTAB nRealOldPos = (nNewPos < nOldPos) ? nOldPos - 1 : nOldPos;
848  const ScRangeName* pNames = GetRangeName( nOldPos);
849  if (pNames)
850  pNames->CopyUsedNames( nOldPos, nRealOldPos, nNewPos, *this, *this, bGlobalNamesToLocal);
851  GetRangeName()->CopyUsedNames( -1, nRealOldPos, nNewPos, *this, *this, bGlobalNamesToLocal);
852 
853  sc::CopyToDocContext aCopyDocCxt(*this);
854  maTabs[nOldPos]->CopyToTable(aCopyDocCxt, 0, 0, MaxCol(), MaxRow(), InsertDeleteFlags::ALL,
855  (pOnlyMarked != nullptr), maTabs[nNewPos].get(), pOnlyMarked,
856  false /*bAsLink*/, true /*bColRowFlags*/, bGlobalNamesToLocal, false /*bCopyCaptions*/ );
857  maTabs[nNewPos]->SetTabBgColor(maTabs[nOldPos]->GetTabBgColor());
858 
859  SCTAB nDz = nNewPos - nOldPos;
860  sc::RefUpdateContext aRefCxt(*this);
861  aRefCxt.meMode = URM_COPY;
862  aRefCxt.maRange = ScRange(0, 0, nNewPos, MaxCol(), MaxRow(), nNewPos);
863  aRefCxt.mnTabDelta = nDz;
864  maTabs[nNewPos]->UpdateReference(aRefCxt);
865 
866  maTabs[nNewPos]->UpdateInsertTabAbs(nNewPos); // move all paragraphs up by one!!
867  maTabs[nOldPos]->UpdateInsertTab(aCxt);
868 
869  maTabs[nOldPos]->UpdateCompile();
870  maTabs[nNewPos]->UpdateCompile( true ); // maybe already compiled in Clone, but used names need recompilation
871  SetNoListening( false );
872  sc::StartListeningContext aSLCxt(*this);
873  maTabs[nOldPos]->StartListeners(aSLCxt, true);
874  maTabs[nNewPos]->StartListeners(aSLCxt, true);
875 
876  sc::SetFormulaDirtyContext aFormulaDirtyCxt;
877  SetAllFormulasDirty(aFormulaDirtyCxt);
878 
879  if (mpDrawLayer) // Skip cloning Note caption object
880  // page is already created in ScTable ctor
881  mpDrawLayer->ScCopyPage( static_cast<sal_uInt16>(nOldPos), static_cast<sal_uInt16>(nNewPos) );
882 
883  if (pDPCollection)
884  pDPCollection->CopyToTab(nOldPos, nNewPos);
885 
886  maTabs[nNewPos]->SetPageStyle( maTabs[nOldPos]->GetPageStyle() );
887  maTabs[nNewPos]->SetPendingRowHeights( maTabs[nOldPos]->IsPendingRowHeights() );
888 
889  // Copy the custom print range if exists.
890  maTabs[nNewPos]->CopyPrintRange(*maTabs[nOldPos]);
891 
892  // Copy the RTL settings
893  maTabs[nNewPos]->SetLayoutRTL(maTabs[nOldPos]->IsLayoutRTL());
894  maTabs[nNewPos]->SetLoadingRTL(maTabs[nOldPos]->IsLoadingRTL());
895 
896  // Finally copy the note captions, which need
897  // 1. the updated source ScColumn::nTab members if nNewPos <= nOldPos
898  // 2. row heights and column widths of the destination
899  // 3. RTL settings of the destination
900  maTabs[nOldPos]->CopyCaptionsToTable( 0, 0, MaxCol(), MaxRow(), maTabs[nNewPos].get(), true /*bCloneCaption*/);
901  }
902 
903  return bValid;
904 }
905 
907  SCTAB nDestPos, bool bInsertNew,
908  bool bResultsOnly )
909 {
910  sal_uLong nRetVal = 1; // 0 => error 1 = ok
911  // 3 => NameBox
912  // 4 => both
913 
914  if (pSrcDoc->mpShell->GetMedium())
915  {
917  // for unsaved files use the title name and adjust during save of file
918  if (pSrcDoc->maFileURL.isEmpty())
919  pSrcDoc->maFileURL = pSrcDoc->mpShell->GetName();
920  }
921  else
922  {
923  pSrcDoc->maFileURL = pSrcDoc->mpShell->GetName();
924  }
925 
926  bool bValid = true;
927  if (bInsertNew) // re-insert
928  {
929  OUString aName;
930  pSrcDoc->GetName(nSrcPos, aName);
931  CreateValidTabName(aName);
932  bValid = InsertTab(nDestPos, aName);
933 
934  // Copy the RTL settings
935  maTabs[nDestPos]->SetLayoutRTL(pSrcDoc->maTabs[nSrcPos]->IsLayoutRTL());
936  maTabs[nDestPos]->SetLoadingRTL(pSrcDoc->maTabs[nSrcPos]->IsLoadingRTL());
937  }
938  else // replace existing tables
939  {
940  if (ValidTab(nDestPos) && nDestPos < static_cast<SCTAB>(maTabs.size()) && maTabs[nDestPos])
941  {
942  maTabs[nDestPos]->DeleteArea( 0,0, MaxCol(),MaxRow(), InsertDeleteFlags::ALL );
943  }
944  else
945  bValid = false;
946  }
947 
948  if (bValid)
949  {
950  bool bOldAutoCalcSrc = false;
951  bool bOldAutoCalc = GetAutoCalc();
952  SetAutoCalc( false ); // avoid repeated calculations
953  SetNoListening( true );
954  if ( bResultsOnly )
955  {
956  bOldAutoCalcSrc = pSrcDoc->GetAutoCalc();
957  pSrcDoc->SetAutoCalc( true ); // in case something needs calculation
958  }
959 
960  {
961  NumFmtMergeHandler aNumFmtMergeHdl(this, pSrcDoc);
962 
963  sc::CopyToDocContext aCxt(*this);
964  nDestPos = std::min(nDestPos, static_cast<SCTAB>(GetTableCount() - 1));
965  { // scope for bulk broadcast
966  ScBulkBroadcast aBulkBroadcast( pBASM.get(), SfxHintId::ScDataChanged);
967  if (!bResultsOnly)
968  {
969  const bool bGlobalNamesToLocal = false;
970  const ScRangeName* pNames = pSrcDoc->GetRangeName( nSrcPos);
971  if (pNames)
972  pNames->CopyUsedNames( nSrcPos, nSrcPos, nDestPos, *pSrcDoc, *this, bGlobalNamesToLocal);
973  pSrcDoc->GetRangeName()->CopyUsedNames( -1, nSrcPos, nDestPos, *pSrcDoc, *this, bGlobalNamesToLocal);
974  }
975  pSrcDoc->maTabs[nSrcPos]->CopyToTable(aCxt, 0, 0, MaxCol(), MaxRow(),
977  false, maTabs[nDestPos].get(), /*pMarkData*/nullptr, /*bAsLink*/false, /*bColRowFlags*/true,
978  /*bGlobalNamesToLocal*/false, /*bCopyCaptions*/true );
979  }
980  }
981  maTabs[nDestPos]->SetTabNo(nDestPos);
982  maTabs[nDestPos]->SetTabBgColor(pSrcDoc->maTabs[nSrcPos]->GetTabBgColor());
983 
984  if ( !bResultsOnly )
985  {
986  sc::RefUpdateContext aRefCxt(*this);
987  aRefCxt.meMode = URM_COPY;
988  aRefCxt.maRange = ScRange(0, 0, nDestPos, MaxCol(), MaxRow(), nDestPos);
989  aRefCxt.mnTabDelta = nDestPos - nSrcPos;
990  maTabs[nDestPos]->UpdateReference(aRefCxt);
991 
992  // Readjust self-contained absolute references to this sheet
993  maTabs[nDestPos]->TestTabRefAbs(nSrcPos);
994  sc::CompileFormulaContext aFormulaCxt(this);
995  maTabs[nDestPos]->CompileAll(aFormulaCxt);
996  }
997 
998  SetNoListening( false );
999  if ( !bResultsOnly )
1000  {
1001  sc::StartListeningContext aSLCxt(*this);
1002  maTabs[nDestPos]->StartListeners(aSLCxt, true);
1003  }
1004  SetDirty( ScRange( 0, 0, nDestPos, MaxCol(), MaxRow(), nDestPos), false);
1005 
1006  if ( bResultsOnly )
1007  pSrcDoc->SetAutoCalc( bOldAutoCalcSrc );
1008  SetAutoCalc( bOldAutoCalc );
1009 
1010  // copy Drawing
1011 
1012  if (bInsertNew)
1013  TransferDrawPage( pSrcDoc, nSrcPos, nDestPos );
1014 
1015  maTabs[nDestPos]->SetPendingRowHeights( pSrcDoc->maTabs[nSrcPos]->IsPendingRowHeights() );
1016  }
1017  if (!bValid)
1018  nRetVal = 0;
1019  bool bVbaEnabled = IsInVBAMode();
1020 
1021  if ( bVbaEnabled )
1022  {
1023  SfxObjectShell* pSrcShell = pSrcDoc->GetDocumentShell();
1024  if ( pSrcShell )
1025  {
1026  OUString aLibName("Standard");
1027  const BasicManager *pBasicManager = pSrcShell->GetBasicManager();
1028  if (pBasicManager && !pBasicManager->GetName().isEmpty())
1029  {
1030  aLibName = pSrcShell->GetBasicManager()->GetName();
1031  }
1032  OUString sSource;
1033  uno::Reference< script::XLibraryContainer > xLibContainer = pSrcShell->GetBasicContainer();
1034  uno::Reference< container::XNameContainer > xLib;
1035  if( xLibContainer.is() )
1036  {
1037  uno::Any aLibAny = xLibContainer->getByName(aLibName);
1038  aLibAny >>= xLib;
1039  }
1040 
1041  if( xLib.is() )
1042  {
1043  OUString sSrcCodeName;
1044  pSrcDoc->GetCodeName( nSrcPos, sSrcCodeName );
1045  OUString sRTLSource;
1046  xLib->getByName( sSrcCodeName ) >>= sRTLSource;
1047  sSource = sRTLSource;
1048  }
1049  VBA_InsertModule( *this, nDestPos, sSource );
1050  }
1051  }
1052 
1053  return nRetVal;
1054 }
1055 
1056 void ScDocument::SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const FormulaError nError)
1057 {
1058  if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()))
1059  if (maTabs[nTab])
1060  maTabs[nTab]->SetError( nCol, nRow, nError );
1061 }
1062 
1064  const ScAddress& rPos, const ScTokenArray& rArray )
1065 {
1066  if (!TableExists(rPos.Tab()))
1067  return;
1068 
1069  maTabs[rPos.Tab()]->SetFormula(rPos.Col(), rPos.Row(), rArray, formula::FormulaGrammar::GRAM_DEFAULT);
1070 }
1071 
1073  const ScAddress& rPos, const OUString& rFormula, formula::FormulaGrammar::Grammar eGram )
1074 {
1075  if (!TableExists(rPos.Tab()))
1076  return;
1077 
1078  maTabs[rPos.Tab()]->SetFormula(rPos.Col(), rPos.Row(), rFormula, eGram);
1079 }
1080 
1082 {
1083  if (!TableExists(rPos.Tab()))
1084  {
1085  delete pCell;
1086  return nullptr;
1087  }
1088 
1089  return maTabs[rPos.Tab()]->SetFormulaCell(rPos.Col(), rPos.Row(), pCell);
1090 }
1091 
1092 bool ScDocument::SetFormulaCells( const ScAddress& rPos, std::vector<ScFormulaCell*>& rCells )
1093 {
1094  if (rCells.empty())
1095  return false;
1096 
1097  ScTable* pTab = FetchTable(rPos.Tab());
1098  if (!pTab)
1099  return false;
1100 
1101  return pTab->SetFormulaCells(rPos.Col(), rPos.Row(), rCells);
1102 }
1103 
1104 void ScDocument::SetConsolidateDlgData( std::unique_ptr<ScConsolidateParam> pData )
1105 {
1106  pConsolidateDlgData = std::move(pData);
1107 }
1108 
1110 {
1111  if (pChangeViewSettings==nullptr)
1113 
1114  *pChangeViewSettings=rNew;
1115 }
1116 
1117 std::unique_ptr<ScFieldEditEngine> ScDocument::CreateFieldEditEngine()
1118 {
1119  std::unique_ptr<ScFieldEditEngine> pNewEditEngine;
1120  if (!pCacheFieldEditEngine)
1121  {
1122  pNewEditEngine.reset( new ScFieldEditEngine(
1123  this, GetEnginePool(), GetEditPool(), false) );
1124  }
1125  else
1126  {
1127  if ( !bImportingXML )
1128  {
1129  // #i66209# previous use might not have restored update mode,
1130  // ensure same state as for a new EditEngine (UpdateMode = true)
1131  if ( !pCacheFieldEditEngine->GetUpdateMode() )
1132  pCacheFieldEditEngine->SetUpdateMode(true);
1133  }
1134 
1135  pNewEditEngine = std::move(pCacheFieldEditEngine);
1136  }
1137  return pNewEditEngine;
1138 }
1139 
1140 void ScDocument::DisposeFieldEditEngine(std::unique_ptr<ScFieldEditEngine>& rpEditEngine)
1141 {
1142  if (!pCacheFieldEditEngine && rpEditEngine)
1143  {
1144  pCacheFieldEditEngine = std::move( rpEditEngine );
1145  pCacheFieldEditEngine->Clear();
1146  }
1147  else
1148  rpEditEngine.reset();
1149 }
1150 
1152 {
1153  return new ScRecursionHelper;
1154 }
1155 
1157 {
1158  ScLookupCache* pCache = nullptr;
1159  ScLookupCacheMap*& rpCacheMap = pContext->mScLookupCache;
1160  if (!rpCacheMap)
1161  rpCacheMap = new ScLookupCacheMap;
1162  // insert with temporary value to avoid doing two lookups
1163  auto [findIt, bInserted] = rpCacheMap->aCacheMap.emplace(rRange, nullptr);
1164  if (bInserted)
1165  {
1166  findIt->second = std::make_unique<ScLookupCache>(this, rRange, *rpCacheMap);
1167  pCache = findIt->second.get();
1168  // The StartListeningArea() call is not thread-safe, as all threads
1169  // would access the same SvtBroadcaster.
1170  osl::MutexGuard guard( mScLookupMutex );
1171  StartListeningArea(rRange, false, pCache);
1172  }
1173  else
1174  pCache = (*findIt).second.get();
1175 
1176  return *pCache;
1177 }
1178 
1180 {
1181  // Data changes leading to this should never happen during calculation (they are either
1182  // a result of user input or recalc). If it turns out this can be the case, locking is needed
1183  // here and also in ScLookupCache::Notify().
1185  auto & cacheMap = rCache.getCacheMap();
1186  auto it(cacheMap.aCacheMap.find(rCache.getRange()));
1187  if (it != cacheMap.aCacheMap.end())
1188  {
1189  ScLookupCache* pCache = (*it).second.release();
1190  cacheMap.aCacheMap.erase(it);
1191  assert(!IsThreadedGroupCalcInProgress()); // EndListeningArea() is not thread-safe
1192  EndListeningArea(pCache->getRange(), false, &rCache);
1193  return;
1194  }
1195  OSL_FAIL( "ScDocument::RemoveLookupCache: range not found in hash map");
1196 }
1197 
1199 {
1201  DELETEZ(GetNonThreadedContext().mScLookupCache);
1202  // Clear lookup cache in all interpreter-contexts in the (threaded/non-threaded) pools.
1204 }
1205 
1206 bool ScDocument::IsCellInChangeTrack(const ScAddress &cell,Color *pColCellBorder)
1207 {
1208  ScChangeTrack* pTrack = GetChangeTrack();
1210  if ( !pTrack || !pTrack->GetFirst() || !pSettings || !pSettings->ShowChanges() )
1211  return false; // missing or turned-off
1212  ScActionColorChanger aColorChanger(*pTrack);
1213  // Clipping happens from outside
1215  const ScChangeAction* pAction = pTrack->GetFirst();
1216  while (pAction)
1217  {
1219  if ( pAction->IsVisible() )
1220  {
1221  eType = pAction->GetType();
1222  const ScBigRange& rBig = pAction->GetBigRange();
1223  if ( rBig.aStart.Tab() == cell.Tab())
1224  {
1225  ScRange aRange = rBig.MakeRange();
1226  if ( eType == SC_CAT_DELETE_ROWS )
1227  aRange.aEnd.SetRow( aRange.aStart.Row() );
1228  else if ( eType == SC_CAT_DELETE_COLS )
1229  aRange.aEnd.SetCol( aRange.aStart.Col() );
1230  if (ScViewUtil::IsActionShown( *pAction, *pSettings, *this ) )
1231  {
1232  if (aRange.In(cell))
1233  {
1234  if (pColCellBorder != nullptr)
1235  {
1236  aColorChanger.Update( *pAction );
1237  Color aColor( aColorChanger.GetColor() );
1238  *pColCellBorder = aColor;
1239  }
1240  return true;
1241  }
1242  }
1243  }
1244  if ( eType == SC_CAT_MOVE &&
1245  static_cast<const ScChangeActionMove*>(pAction)->
1246  GetFromRange().aStart.Tab() == cell.Col() )
1247  {
1248  ScRange aRange = static_cast<const ScChangeActionMove*>(pAction)->
1249  GetFromRange().MakeRange();
1250  if (ScViewUtil::IsActionShown( *pAction, *pSettings, *this ) )
1251  {
1252  if (aRange.In(cell))
1253  {
1254  if (pColCellBorder != nullptr)
1255  {
1256  aColorChanger.Update( *pAction );
1257  Color aColor( aColorChanger.GetColor() );
1258  *pColCellBorder = aColor;
1259  }
1260  return true;
1261  }
1262  }
1263  }
1264  }
1265  pAction = pAction->GetNext();
1266  }
1267  return false;
1268 }
1269 
1270 void ScDocument::GetCellChangeTrackNote( const ScAddress &aCellPos, OUString &aTrackText,bool &bLeftEdge)
1271 {
1272  aTrackText.clear();
1273  // Change-Tracking
1274  ScChangeTrack* pTrack = GetChangeTrack();
1276  if ( !(pTrack && pTrack->GetFirst() && pSettings && pSettings->ShowChanges()))
1277  return;
1278 
1279  const ScChangeAction* pFound = nullptr;
1280  const ScChangeAction* pFoundContent = nullptr;
1281  const ScChangeAction* pFoundMove = nullptr;
1282  const ScChangeAction* pAction = pTrack->GetFirst();
1283  while (pAction)
1284  {
1285  if ( pAction->IsVisible() &&
1286  ScViewUtil::IsActionShown( *pAction, *pSettings, *this ) )
1287  {
1288  ScChangeActionType eType = pAction->GetType();
1289  const ScBigRange& rBig = pAction->GetBigRange();
1290  if ( rBig.aStart.Tab() == aCellPos.Tab())
1291  {
1292  ScRange aRange = rBig.MakeRange();
1293  if ( eType == SC_CAT_DELETE_ROWS )
1294  aRange.aEnd.SetRow( aRange.aStart.Row() );
1295  else if ( eType == SC_CAT_DELETE_COLS )
1296  aRange.aEnd.SetCol( aRange.aStart.Col() );
1297  if ( aRange.In( aCellPos ) )
1298  {
1299  pFound = pAction; // the last wins
1300  switch ( eType )
1301  {
1302  case SC_CAT_CONTENT :
1303  pFoundContent = pAction;
1304  break;
1305  case SC_CAT_MOVE :
1306  pFoundMove = pAction;
1307  break;
1308  default:
1309  break;
1310  }
1311  }
1312  }
1313  if ( eType == SC_CAT_MOVE )
1314  {
1315  ScRange aRange =
1316  static_cast<const ScChangeActionMove*>(pAction)->
1317  GetFromRange().MakeRange();
1318  if ( aRange.In( aCellPos ) )
1319  {
1320  pFound = pAction;
1321  }
1322  }
1323  }
1324  pAction = pAction->GetNext();
1325  }
1326  if ( !pFound )
1327  return;
1328 
1329  if ( pFoundContent && pFound->GetType() != SC_CAT_CONTENT )
1330  pFound = pFoundContent; // Content wins
1331  if ( pFoundMove && pFound->GetType() != SC_CAT_MOVE &&
1332  pFoundMove->GetActionNumber() >
1333  pFound->GetActionNumber() )
1334  pFound = pFoundMove; // Move wins
1335  // for deleted columns: arrow on left side of row
1336  if ( pFound->GetType() == SC_CAT_DELETE_COLS )
1337  bLeftEdge = true;
1338  DateTime aDT = pFound->GetDateTime();
1339  aTrackText = pFound->GetUser();
1340  aTrackText += ", ";
1341  aTrackText += ScGlobal::getLocaleDataPtr()->getDate(aDT);
1342  aTrackText += " ";
1343  aTrackText += ScGlobal::getLocaleDataPtr()->getTime(aDT);
1344  aTrackText += ":\n";
1345  OUString aComStr = pFound->GetComment();
1346  if(!aComStr.isEmpty())
1347  {
1348  aTrackText += aComStr;
1349  aTrackText += "\n( ";
1350  }
1351  pFound->GetDescription( aTrackText, this );
1352  if (!aComStr.isEmpty())
1353  {
1354  aTrackText += ")";
1355  }
1356 }
1357 
1358 void ScDocument::SetPreviewFont( std::unique_ptr<SfxItemSet> pFont )
1359 {
1360  pPreviewFont = std::move(pFont);
1361 }
1362 
1364 {
1365  maPreviewSelection = rSel;
1366 }
1367 
1369 {
1370  SfxItemSet* pRet = nullptr;
1371  if ( pPreviewFont )
1372  {
1374  if ( aSel.IsCellMarked( nCol, nRow ) && aSel.GetFirstSelected() == nTab )
1375  pRet = pPreviewFont.get();
1376  }
1377  return pRet;
1378 }
1379 
1381 {
1382  ScStyleSheet* pRet = nullptr;
1384  if ( pPreviewCellStyle && aSel.IsCellMarked( nCol, nRow ) && aSel.GetFirstSelected() == nTab )
1385  pRet = pPreviewCellStyle;
1386  return pRet;
1387 }
1388 
1390 {
1391  if (!m_pIconSetBitmapMap)
1392  {
1394  }
1395  return *m_pIconSetBitmapMap;
1396 }
1397 
1398 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SC_DLLPUBLIC bool GetPrintArea(SCTAB nTab, SCCOL &rEndCol, SCROW &rEndRow, bool bNotes=true) const
Definition: documen2.cxx:573
std::unique_ptr< ScFieldEditEngine > mpEditEngine
Definition: document.hxx:377
IMPL_LINK_NOARG(ScDocument, TrackTimeHdl, Timer *, void)
Definition: documen2.cxx:281
void ClearLookupCaches()
Zap all caches.
Definition: documen2.cxx:1198
VclPtr< SfxPrinter > mpPrinter
Definition: document.hxx:380
bool bIsUndo
Definition: document.hxx:502
Temporarily switch on/off auto calculation mode.
Definition: scopetools.hxx:24
SfxItemSet * GetPreviewFont()
Definition: document.hxx:1343
ScAddress aStart
Definition: address.hxx:500
void EndChangeTracking()
Definition: documen2.cxx:267
SC_DLLPUBLIC bool GetDataStart(SCTAB nTab, SCCOL &rStartCol, SCROW &rStartRow) const
Definition: documen2.cxx:641
std::unique_ptr< ScChangeTrack > pChangeTrack
Definition: document.hxx:402
SC_DLLPUBLIC svl::SharedStringPool & GetSharedStringPool()
Definition: documen2.cxx:563
void SetConsolidateDlgData(std::unique_ptr< ScConsolidateParam > pData)
Definition: documen2.cxx:1104
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
ScChangeActionType GetType() const
Definition: chgtrack.hxx:318
VclPtr< VirtualDevice > mpVirtualDevice_100th_mm
Definition: document.hxx:381
SC_DLLPUBLIC sal_uLong TransferTab(ScDocument *pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos, bool bInsertNew=true, bool bResultsOnly=false)
Definition: documen2.cxx:906
static bool IsActionShown(const ScChangeAction &rAction, const ScChangeViewSettings &rSettings, ScDocument &rDocument)
Definition: viewutil.cxx:134
Use this to lock all charts in the calc for a little time.
Definition: chartlock.hxx:53
bool bInDtorClear
Definition: document.hxx:522
SCROW Row() const
Definition: address.hxx:262
SC_DLLPUBLIC ScRangeName * GetRangeName() const
Definition: documen3.cxx:176
OUString maFileURL
Definition: document.hxx:427
ScChangeAction * GetNext() const
Definition: chgtrack.hxx:323
std::unique_ptr< ScRefreshTimerControl > const & GetRefreshTimerControlAddress() const
Definition: document.hxx:2423
SC_DLLPUBLIC void SetChangeViewSettings(const ScChangeViewSettings &rNew)
Definition: documen2.cxx:1109
void SetPreviewSelection(const ScMarkData &rSel)
Definition: documen2.cxx:1363
ScTable * FetchTable(SCTAB nTab)
Definition: document.cxx:2507
std::unique_ptr< ScFieldEditEngine > pCacheFieldEditEngine
Definition: document.hxx:413
SfxObjectShell * mpShell
Definition: document.hxx:379
sc::IconSetBitmapMap & GetIconSetBitmapMap()
Definition: documen2.cxx:1389
sal_uIntPtr sal_uLong
void disposeAndClear()
Context for reference update during shifting, moving or copying of cell ranges.
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:168
SC_DLLPUBLIC bool ValidNewTabName(const OUString &rName) const
Definition: document.cxx:373
static const sal_uInt16 nSrcVer
Definition: document.hxx:485
SCROW GetMaxTiledRow() const
Definition: viewdata.hxx:423
const ScMarkData & GetPreviewSelection() const
Definition: document.hxx:1345
rtl_TextEncoding eSrcSet
Definition: document.hxx:463
Store position data for column array storage.
const SfxItemSet & GetItemSet() const
ScDocumentThreadSpecific maNonThreaded
Definition: document.hxx:475
ScChangeActionType
Definition: chgtrack.hxx:63
const sfx2::LinkManager * getExistingLinkManager() const
static ScRecursionHelper * CreateRecursionHelperInstance()
Definition: documen2.cxx:1151
ScAddress aEnd
Definition: address.hxx:501
This is very similar to ScCellValue, except that it references the original value instead of copying ...
Definition: cellvalue.hxx:104
void UpdateReference(UpdateRefMode, const ScDocument *, const ScRange &rWhere, SCCOL nDx, SCROW nDy, SCTAB nDz)
Definition: rangelst.cxx:1236
std::shared_ptr< T > make_shared(Args &&...args)
std::unique_ptr< ScValidationDataList > pValidationList
Definition: document.hxx:384
void Invalidate(sal_uInt16 nId)
static void FillToEditItemSet(SfxItemSet &rEditSet, const SfxItemSet &rSrcSet, const SfxItemSet *pCondSet=nullptr)
Converts all Calc items contained in rSrcSet to edit engine items and puts them into rEditSet...
Definition: patattr.cxx:552
bool bImportingXML
Definition: document.hxx:512
void SetPreviewFont(std::unique_ptr< SfxItemSet > pFontSet)
Definition: documen2.cxx:1358
Lookup cache for one range used with interpreter functions such as VLOOKUP and MATCH.
Definition: lookupcache.hxx:40
void ApplyAsianEditSettings(ScEditEngineDefaulter &rEngine)
Definition: documen9.cxx:669
sc::DocumentLinkManager & GetDocLinkManager()
Definition: documen2.cxx:225
bool TableExists(SCTAB nTab) const
Definition: document.cxx:2502
sfx2::LinkManager * getLinkManager(bool bCreate=true)
SC_DLLPUBLIC ScNoteEditEngine & GetNoteEngine()
Definition: documen2.cxx:467
ScAddress aCurTextWidthCalcPos
Definition: document.hxx:447
bool IsCellMarked(SCCOL nCol, SCROW nRow, bool bNoSimple=false) const
Definition: markdata.cxx:285
std::unique_ptr< SfxBroadcaster > pUnoBroadcaster
Definition: document.hxx:403
bool IsActive() const
void DeleteDrawLayer()
Definition: documen9.cxx:227
void SetAllFormulasDirty(const sc::SetFormulaDirtyContext &rCxt)
Definition: document.cxx:3837
SC_DLLPUBLIC bool GetPrintAreaVer(SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol, SCROW &rEndRow, bool bNotes) const
Definition: documen2.cxx:619
const SCROW MAXROW_JUMBO
Definition: address.hxx:73
bool IsPendingRowHeights(SCTAB nTab) const
Definition: document.cxx:935
bool ShowChanges() const
Definition: chgviset.hxx:78
std::unordered_map< ScColumn *, std::pair< SCROW, SCROW > > pDelayedStartListeningFormulaCells
Definition: document.hxx:536
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:876
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
#define SC_ASIANKERNING_INVALID
Definition: document.hxx:242
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:313
void SetExpandRefs(bool bVal)
Definition: documen2.cxx:305
TableContainer maTabs
Definition: document.hxx:386
const SCROW MAXROW
Definition: address.hxx:69
std::unique_ptr< ScRefreshTimerControl > pRefreshTimerControl
Definition: document.hxx:408
std::unique_ptr< ScBroadcastAreaSlotMachine > pBASM
Definition: document.hxx:398
std::unique_ptr< ScConsolidateParam > pConsolidateDlgData
Definition: document.hxx:435
#define SC_CURRENT_VERSION
Definition: rechead.hxx:39
void SetNoListening(bool bVal)
Definition: document.hxx:2142
virtual void Start() override
SC_DLLPUBLIC bool GetTable(const OUString &rName, SCTAB &rTab) const
Definition: document.cxx:259
ScChangeAction * GetFirst() const
Definition: chgtrack.hxx:964
void CopyUsedNames(const SCTAB nLocalTab, const SCTAB nOldTab, const SCTAB nNewTab, const ScDocument &rOldDoc, ScDocument &rNewDoc, const bool bGlobalNamesToLocal) const
Copy names while copying a sheet if they reference the sheet to be copied.
Definition: rangenam.cxx:764
std::map< OUString, BitmapEx > IconSetBitmapMap
Definition: document.hxx:207
SCTAB Tab() const
Definition: address.hxx:271
void SetRow(SCROW nRowP)
Definition: address.hxx:275
bool GetInitJumboSheets() const
void SetError(SCCOL nCol, SCROW nRow, SCTAB nTab, const FormulaError nError)
Definition: documen2.cxx:1056
ScLookupCacheMap * mScLookupCache
void Clear(bool bFromDestructor=false)
Definition: documen9.cxx:498
void EndListeningArea(const ScRange &rRange, bool bGroupListening, SvtListener *pListener)
Definition: documen7.cxx:61
SC_DLLPUBLIC ~ScDocument()
Definition: documen2.cxx:324
std::unique_ptr< ScDBData > mpAnonymousDBData
Definition: document.hxx:410
ScRecursionHelper * pRecursionHelper
Definition: document.hxx:299
const OUString & GetName() const
SCCOL GetMaxTiledCol() const
Definition: viewdata.hxx:422
SC_DLLPUBLIC void ResetClip(ScDocument *pSourceDoc, const ScMarkData *pMarks)
Definition: documen2.cxx:485
void SetCol(SCCOL nColP)
Definition: address.hxx:279
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2397
std::unique_ptr< ScDrawLayer > mpDrawLayer
Definition: document.hxx:382
void ImplCreateOptions()
Definition: documen8.cxx:100
ScStyleSheet * GetPreviewCellStyle()
Definition: document.hxx:1347
ScRangePairListRef xColNameRanges
Definition: document.hxx:428
static ThreadPool & getSharedOptimalPool()
DocumentType eType
SC_DLLPUBLIC const ScDocOptions & GetDocOptions() const
Definition: documen3.cxx:1904
const ScRange & getRange() const
A pretty assertion that checks that the relevant bits in the are not set on the document at entry an...
Definition: document.hxx:2657
ScRefCellValue GetRefCellValue(const ScAddress &rPos)
Definition: documen2.cxx:547
bool SetFormulaCells(SCCOL nCol, SCROW nRow, std::vector< ScFormulaCell * > &rCells)
Definition: table2.cxx:1573
bool IsCellInChangeTrack(const ScAddress &cell, Color *pColCellBorder)
Definition: documen2.cxx:1206
bool bExpandRefs
Definition: document.hxx:527
formula::FormulaGrammar::Grammar eStorageGrammar
The compiler grammar used in document storage.
Definition: document.hxx:467
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:875
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:438
bool CopyTab(SCTAB nOldPos, SCTAB nNewPos, const ScMarkData *pOnlyMarked=nullptr)
Definition: documen2.cxx:765
void SetStorageGrammar(formula::FormulaGrammar::Grammar eGrammar)
Should only be GRAM_PODF or GRAM_ODFF.
Definition: documen2.cxx:235
std::unique_ptr< ScDPCollection > pDPCollection
Definition: document.hxx:391
const SCTAB SC_TAB_APPEND
Definition: address.hxx:84
void GetCellChangeTrackNote(const ScAddress &cell, OUString &strTrackText, bool &pbLeftEdge)
Definition: documen2.cxx:1270
int i
rtl::Reference< ScSheetLimits > mxSheetLimits
Definition: document.hxx:387
CharCompressType
UpdateRefMode meMode
update mode - insert/delete, copy, or move.
std::shared_ptr< sc::FormulaGroupContext > mpFormulaGroupCxt
Definition: document.hxx:371
Color GetColor() const
Definition: chgtrack.hxx:60
sal_Int16 SCCOL
Definition: types.hxx:22
SC_DLLPUBLIC void SetAutoCalc(bool bNewAutoCalc)
Definition: documen7.cxx:602
#define SC_MOD()
Definition: scmod.hxx:253
const OUString & GetComment() const
Definition: chgtrack.hxx:353
const SCCOL MAXCOL
Definition: address.hxx:70
ScMarkData maPreviewSelection
Definition: document.hxx:441
SC_DLLPUBLIC void GetTiledRenderingArea(SCTAB nTab, SCCOL &rEndCol, SCROW &rEndRow) const
Return the number of columns / rows that should be visible for the tiled rendering.
Definition: documen2.cxx:664
SC_DLLPUBLIC void SetViewOptions(const ScViewOptions &rOpt)
Definition: documen3.cxx:1924
SC_DLLPUBLIC void CreateValidTabName(OUString &rName) const
Definition: document.cxx:391
SC_DLLPUBLIC SfxItemPool * GetEnginePool() const
Definition: documen2.cxx:449
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
void SharePooledResources(const ScDocument *pSrcDoc)
Definition: document10.cxx:327
ScLookupCacheMap & getCacheMap() const
SC_DLLPUBLIC bool InsertTab(SCTAB nPos, const OUString &rName, bool bExternalDocument=false, bool bUndoDeleteTab=false)
Definition: document.cxx:503
SC_DLLPUBLIC ScDocument(ScDocumentMode eMode=SCDOCMODE_DOCUMENT, SfxObjectShell *pDocShell=nullptr)
Definition: documen2.cxx:103
SC_DLLPUBLIC OUString GetPageStyle(SCTAB nTab) const
Definition: document.cxx:6188
BroadcastAreaSlots and their management, once per document.
Definition: bcaslot.hxx:246
ScBigRange & GetBigRange()
Definition: chgtrack.hxx:232
void SaveDdeLinks(SvStream &rStream) const
Definition: documen8.cxx:707
bool In(const ScAddress &) const
is Address& in Range?
Definition: address.hxx:733
static SC_DLLPUBLIC LanguageType eLnge
Definition: global.hxx:551
void Update(const ScChangeAction &rAction)
Definition: output.cxx:88
const SCTAB MAXTAB
Definition: address.hxx:71
std::unique_ptr< ScScriptTypeData > pScriptTypeData
Definition: document.hxx:407
std::unique_ptr< sc::DocumentLinkManager > mpDocLinkMgr
Definition: document.hxx:369
static ScViewData * GetViewData()
Definition: docsh4.cxx:2542
Use this class as a locale variable to merge number formatter from another document, and set NULL pointer to pFormatExchangeList when done.
Definition: document.hxx:2561
std::unique_ptr< ScNoteEditEngine > mpNoteEngine
Definition: document.hxx:378
void UpdateChartRef(UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, SCCOL nDx, SCROW nDy, SCTAB nDz)
Definition: documen5.cxx:390
void ForgetNoteCaptions(const ScRangeList &rRanges, bool bPreserveData)
Definition: document.cxx:6633
ScRange maRange
Range of cells that are about to be moved for insert/delete/move modes.
#define DELETEZ(p)
void UpdateRefAreaLinks(UpdateRefMode eUpdateRefMode, const ScRange &r, SCCOL nDx, SCROW nDy, SCTAB nDz)
Definition: documen8.cxx:1081
sal_uInt32 GetDocumentID() const
an ID unique to each document instance
Definition: documen2.cxx:252
friend struct ScRefCellValue
Definition: document.hxx:344
FormulaError
SCCOL Col() const
Definition: address.hxx:267
SC_DLLPUBLIC void EnsureTable(SCTAB nTab)
Definition: documen2.cxx:537
bool bInLinkUpdate
Definition: document.hxx:517
SC_DLLPUBLIC const ScViewOptions & GetViewOptions() const
Definition: documen3.cxx:1918
std::unique_ptr< ScUnoRefList > pUnoRefUndoList
Definition: document.hxx:405
std::unique_ptr< SvMemoryStream > pClipData
Definition: document.hxx:400
sal_uLong GetActionNumber() const
Definition: chgtrack.hxx:320
bool bIsVisible
Definition: document.hxx:504
void VBA_InsertModule(ScDocument &rDoc, SCTAB nTab, const OUString &sSource)
Definition: docfunc.cxx:3177
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
std::unordered_map< ScRange, std::unique_ptr< ScLookupCache >, ScLookupCache::Hash > aCacheMap
static thread_local ScDocumentThreadSpecific maThreadSpecific
Definition: document.hxx:479
static SC_DLLPUBLIC const LocaleDataWrapper * getLocaleDataPtr()
Definition: global.cxx:1009
OUString getDate(const Date &rDate) const
SC_DLLPUBLIC Color GetTabBgColor(SCTAB nTab) const
Definition: documen3.cxx:429
ScRange MakeRange() const
Definition: bigrange.hxx:137
SC_DLLPUBLIC void TransferDrawPage(const ScDocument *pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos)
Definition: documen9.cxx:64
sal_Int32 SCROW
Definition: types.hxx:18
ScBigAddress aStart
Definition: bigrange.hxx:111
SC_DLLPUBLIC void SetDocVisible(bool bSet)
Definition: documen2.cxx:245
sal_Int32 Tab() const
Definition: bigrange.hxx:49
bool IsThreadedGroupCalcInProgress() const
Definition: document.hxx:628
void SetDirty(const ScRange &, bool bIncludeEmptyCells)
Definition: document.cxx:3859
SC_DLLPUBLIC ScFormulaCell * SetFormulaCell(const ScAddress &rPos, ScFormulaCell *pCell)
Set formula cell, and transfer its ownership to the document.
Definition: documen2.cxx:1081
ScStyleSheet * pPreviewCellStyle
Definition: document.hxx:440
SC_DLLPUBLIC void InitClipPtrs(ScDocument *pSourceDoc)
Definition: documen2.cxx:406
SC_DLLPUBLIC void SetDocOptions(const ScDocOptions &rOpt)
Definition: documen3.cxx:1910
virtual void GetDescription(OUString &rStr, ScDocument *pDoc, bool bSplitRange=false, bool bWarning=true) const
Definition: chgtrack.cxx:427
bool MoveTab(SCTAB nOldPos, SCTAB nNewPos, ScProgress *pProgress=nullptr)
Definition: documen2.cxx:695
#define SAL_WARN_IF(condition, area, stream)
const SCCOL MAXCOL_JUMBO
Definition: address.hxx:74
SC_DLLPUBLIC bool GetPrintAreaHor(SCTAB nTab, SCROW nStartRow, SCROW nEndRow, SCCOL &rEndCol) const
Definition: documen2.cxx:597
std::unique_ptr< sc::IconSetBitmapMap > m_pIconSetBitmapMap
Definition: document.hxx:571
static SC_DLLPUBLIC bool ValidTabName(const OUString &rName)
Definition: document.cxx:334
static void RemoveDocument(ScDocument *pDocument)
Definition: addinlis.cxx:78
std::unique_ptr< ScTable, o3tl::default_delete< ScTable > > ScTableUniquePtr
Definition: document.hxx:322
SCTAB mnTabDelta
Amount and direction of movement in the sheet direction.
std::unique_ptr< ScFieldEditEngine > CreateFieldEditEngine()
Definition: documen2.cxx:1117
SC_DLLPUBLIC void SetChangeTrack(std::unique_ptr< ScChangeTrack > pTrack)
only for import filter, deletes any existing ChangeTrack via EndChangeTracking() and takes ownership ...
Definition: documen2.cxx:272
OUString aName
const OUString & GetName() const
SCTAB GetFirstSelected() const
Definition: markdata.cxx:200
std::unique_ptr< ScUnoListenerCalls > pUnoListenerCalls
Definition: document.hxx:404
bool IsVisible() const
Definition: chgtrack.cxx:149
void DisposeFieldEditEngine(std::unique_ptr< ScFieldEditEngine > &rpEditEngine)
Definition: documen2.cxx:1140
ScChangeViewSettings * GetChangeViewSettings() const
Definition: document.hxx:2156
std::unique_ptr< SfxItemSet > pPreviewFont
Definition: document.hxx:439
static ScSheetLimits * CreateSheetLimits()
Definition: documen2.cxx:94
osl::Mutex mScLookupMutex
Definition: document.hxx:483
bool IsInVBAMode() const
Definition: document.cxx:6493
const INetURLObject & GetURLObject() const
std::unique_ptr< ScPatternAttr > pSelectionAttr
Definition: document.hxx:393
void SetLanguage(LanguageType eLatin, LanguageType eCjk, LanguageType eCtl)
Definition: documen3.cxx:1937
ScRangePairListRef xRowNameRanges
Definition: document.hxx:429
std::unique_ptr< ScChangeViewSettings > pChangeViewSettings
Definition: document.hxx:406
These need to be in global namespace just like their respective types are.
SC_DLLPUBLIC ScPatternAttr * GetDefPattern() const
Definition: document.cxx:6058
void SetInvokeHandler(const Link< Timer *, void > &rLink)
std::unique_ptr< ScAutoNameCache > pAutoNameCache
Definition: document.hxx:437
static void RemoveDocument(ScDocument *pDocument)
Definition: adiasync.cxx:121
std::unique_ptr< ScFormulaParserPool > mxFormulaParserPool
Definition: document.hxx:423
SC_DLLPUBLIC SfxItemPool * GetEditPool() const
Definition: documen2.cxx:444
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
Definition: document.cxx:993
const OUString & GetUser() const
Definition: chgtrack.hxx:352
std::shared_ptr< svl::SharedStringPool > mpCellStringPool
Definition: document.hxx:368
void ClosingClipboardSource()
To be called at the clipboard document when closing a document that is the current clipboard source t...
Definition: documen2.cxx:316
void StartTrackTimer()
Definition: documen2.cxx:310
ScInterpreterContext & GetNonThreadedContext() const
Definition: document.hxx:615
std::unique_ptr< ScRangeName > pRangeName
Definition: document.hxx:389
rtl::Reference< ScPoolHelper > mxPoolHelper
Definition: document.hxx:366
SfxObjectShell * GetDocumentShell() const
Definition: document.hxx:1061
void StartAllListeners()
Definition: documen7.cxx:582
const OUString & GetCodeName() const
Definition: document.hxx:607
void StartListeningArea(const ScRange &rRange, bool bGroupListening, SvtListener *pListener)
Definition: documen7.cxx:35
void StartChangeTracking()
Definition: documen2.cxx:261
bool SetFormulaCells(const ScAddress &rPos, std::vector< ScFormulaCell * > &rCells)
Definition: documen2.cxx:1092
bool GetTableSelect(SCTAB nTab) const
Definition: markdata.cxx:184
OUString getTime(const tools::Time &rTime, bool bSec=true, bool b100Sec=false) const
friend class ScTable
Definition: document.hxx:342
SC_DLLPUBLIC sfx2::LinkManager * GetLinkManager()
Definition: documen2.cxx:215
std::unique_ptr< ScChartListenerCollection > pChartListenerCollection
Definition: document.hxx:399
Idle aTrackIdle
Definition: document.hxx:449
SC_DLLPUBLIC bool DrawGetPrintArea(ScRange &rRange, bool bSetHor, bool bSetVer) const
Definition: documen9.cxx:245
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:212
std::unique_ptr< ScRange > pDelayedFormulaGrouping
Definition: document.hxx:532
std::unique_ptr< ScDetOpList > pDetOpList
Definition: document.hxx:401
SC_DLLPUBLIC void SetFormula(const ScAddress &rPos, const ScTokenArray &rArray)
Definition: documen2.cxx:1063
bool ValidTab(SCTAB nTab)
Definition: address.hxx:105
std::unique_ptr< ScTemporaryChartLock > apTemporaryChartLock
Definition: document.hxx:392
void RemoveLookupCache(ScLookupCache &rCache)
Only ScLookupCache dtor uses RemoveLookupCache(), do not use elsewhere!
Definition: documen2.cxx:1179
SC_DLLPUBLIC DateTime GetDateTime() const
Definition: chgtrack.cxx:413
SC_DLLPUBLIC ScFieldEditEngine & GetEditEngine()
Definition: documen2.cxx:454
void ImplDeleteOptions()
Definition: documen8.cxx:106
BasicManager * GetBasicManager() const
bool bIsClip
Definition: document.hxx:501
sal_Int16 SCTAB
Definition: types.hxx:23
css::uno::Reference< css::script::XLibraryContainer > GetBasicContainer()
std::unique_ptr< ScDBCollection > pDBCollection
Definition: document.hxx:390
ScDocumentMode
Definition: document.hxx:244
SC_DLLPUBLIC bool GetAutoCalc() const
Definition: document.hxx:1363
std::unique_ptr< ScExternalRefManager > pExternalRefMgr
Definition: document.hxx:418
ScLookupCache & GetLookupCache(const ScRange &rRange, ScInterpreterContext *pContext)
Creates a ScLookupCache cache for the range if it doesn't already exist.
Definition: documen2.cxx:1156
SfxMedium * GetMedium() const