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