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