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