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