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