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