1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_INC_DOCUMENT_HXX
21 #define INCLUDED_SC_INC_DOCUMENT_HXX
23 #include <vcl/idle.hxx>
24 #include <vcl/errcode.hxx>
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <vcl/vclptr.hxx>
27 #include "patattr.hxx"
29 #include "interpretercontext.hxx"
30 #include "rangelst.hxx"
31 #include "rangenam.hxx"
32 #include "tabopparams.hxx"
34 #include <formula/grammar.hxx>
35 #include <formula/types.hxx>
36 #include "typedstrdata.hxx"
37 #include "calcmacros.hxx"
38 #include "calcconfig.hxx"
39 #include <o3tl/deleter.hxx>
40 #include <o3tl/sorted_vector.hxx>
41 #include <svl/hint.hxx>
42 #include <svl/typedwhich.hxx>
43 #include <svl/zforlist.hxx>
44 #include <tools/gen.hxx>
45 #include <tools/solar.h>
53 #include "markdata.hxx"
55 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ class XChartDocument
; } } } }
59 enum class SvtScriptType
;
61 enum class FormulaError
: sal_uInt16
;
62 enum class CharCompressType
;
63 enum class EEHorizontalTextDirection
;
64 namespace editeng
{ class SvxBorderLine
; }
65 namespace formula
{ struct VectorRefArray
; }
69 class SharedStringPool
;
75 struct FormulaGroupContext
;
76 class StartListeningContext
;
77 class EndListeningContext
;
78 class CopyFromClipContext
;
80 class RangeColumnSpanSet
;
81 struct ColumnBlockPosition
;
82 struct RefUpdateContext
;
83 class EditTextIterator
;
85 class DocumentStreamAccess
;
86 class DocumentLinkManager
;
89 class RowHeightContext
;
90 struct SetFormulaDirtyContext
;
93 class FormulaGroupAreaListener
;
95 class UpdatedRangeNames
;
96 class TableColumnBlockPositionSet
;
98 class ExternalDataMapper
;
106 class SfxBroadcaster
;
109 class SfxObjectShell
;
114 class SfxStyleSheetBase
;
115 class SvMemoryStream
;
116 class SvxBoxInfoItem
;
118 class SvxForbiddenCharactersTable
;
123 namespace vcl
{ class Window
; }
126 class ScAutoFormatData
;
127 class ScBroadcastAreaSlotMachine
;
128 class ScChangeViewSettings
;
129 class ScChartListenerCollection
;
131 class ScConditionalFormat
;
132 class ScConditionalFormatList
;
133 class ScDBCollection
;
138 class ScDocProtection
;
139 class ScDocumentPool
;
141 class ScExtDocOptions
;
142 class ScExternalRefManager
;
144 class ScMacroManager
;
145 class ScOutlineTable
;
146 class ScPrintRangeSaver
;
148 class ScStyleSheetPool
;
150 class ScTableProtection
;
152 class ScValidationData
;
153 class ScValidationDataList
;
156 class ScEditEngineDefaulter
;
157 class ScFieldEditEngine
;
158 class ScNoteEditEngine
;
160 class ScDPCollection
;
162 class ScScriptTypeData
;
165 class ScRefreshTimerControl
;
166 class ScUnoListenerCalls
;
168 class ScRecursionHelper
;
173 class ScAutoNameCache
;
174 class ScTemporaryChartLock
;
176 struct ScLookupCacheMap
;
177 class SfxUndoManager
;
178 class ScFormulaParserPool
;
180 class ScRowBreakIterator
;
181 struct ScSetStringParam
;
182 struct ScColWidthParam
;
186 class ScEditDataArray
;
187 class EditTextObject
;
188 struct ScRefCellValue
;
190 struct ScSubTotalParam
;
193 class SvtBroadcaster
;
194 enum class ScDBDataPortion
;
195 enum class ScSheetEventId
;
197 class ScColumnsRange
;
198 struct ScFilterEntries
;
199 typedef o3tl::sorted_vector
<sal_uInt32
> ScCondFormatIndexes
;
203 typedef std::map
<OUString
, BitmapEx
> IconSetBitmapMap
;
207 namespace com
{ namespace sun
{ namespace star
{
212 class XBreakIterator
;
215 class XModifyListener
;
218 class XEmbeddedObject
;
220 namespace script
{ namespace vba
{
221 class XVBAEventProcessor
;
224 struct TablePageBreakData
;
234 #define SC_DOC_NEW 0xFFFF
236 #define SC_MACROCALL_ALLOWED 0
238 #define SC_ASIANKERNING_INVALID 0xff
245 SCDOCMODE_FUNCTIONACCESS
248 enum CommentCaptionState
250 ALLSHOWN
, // All comments captions are shown
251 ALLHIDDEN
, // All comments captions are hidden
252 MIXED
// There are comments in shown and hidden.
257 GLOBAL
, // A range name can be defined
258 SHEET
// with two scope on Manage Names dialog.
261 /// Represents the type of sheet geometry data.
262 enum class SheetGeomType
264 SIZES
, // Column widths or row heights.
265 HIDDEN
, // Hidden columns/rows.
266 FILTERED
, // Filtered columns/rows.
267 GROUPS
// Grouping of columns/rows.
274 sal_uLong nCellCount
;
275 sal_uLong nFormulaCount
;
276 sal_uInt16 nPageCount
;
287 const sal_uInt8 SC_DDE_DEFAULT
= 0;
288 const sal_uInt8 SC_DDE_ENGLISH
= 1;
289 const sal_uInt8 SC_DDE_TEXT
= 2;
290 const sal_uInt8 SC_DDE_IGNOREMODE
= 255; /// For usage in FindDdeLink() only!
292 // During threaded calculation fields being mutated are kept in this struct
293 struct ScDocumentThreadSpecific
295 ScRecursionHelper
* pRecursionHelper
; // information for recursive and iterative cell formulas
296 ScInterpreterContext
* pContext
; // references the context passed around for easier access
298 ScDocumentThreadSpecific()
299 : pRecursionHelper(nullptr)
304 // To be called in the thread at start
305 static void SetupFromNonThreadedData(const ScDocumentThreadSpecific
& rNonThreadedData
);
307 // To be called in the main thread after the thread has finished
308 static void MergeBackIntoNonThreadedData(ScDocumentThreadSpecific
& rNonThreadedData
);
311 /// Enumeration to determine which pieces of the code should not be mutated when set.
312 enum ScMutationGuardFlags
315 CORE
= 0x0001, /// Core calc data structures should not be mutated
318 typedef std::unique_ptr
<ScTable
, o3tl::default_delete
<ScTable
>> ScTableUniquePtr
;
322 friend class ScValueIterator
;
323 friend class ScHorizontalValueIterator
;
324 friend class ScDBQueryDataIterator
;
325 friend class ScFormulaGroupIterator
;
326 friend class ScCellIterator
;
327 friend class ScQueryCellIterator
;
328 friend class ScCountIfCellIterator
;
329 friend class ScHorizontalCellIterator
;
330 friend class ScHorizontalAttrIterator
;
331 friend class ScDocAttrIterator
;
332 friend class ScAccessibleTableBase
;
333 friend class ScAttrRectIterator
;
334 friend class ScDocShell
;
335 friend class ScDocRowHeightUpdater
;
336 friend class ScColumnTextWidthIterator
;
337 friend class ScFormulaCell
;
338 friend class ScTable
;
339 friend class ScColumn
;
340 friend struct ScRefCellValue
;
341 friend class ScDocumentImport
;
342 friend class sc::DocumentStreamAccess
;
343 friend class sc::ColumnSpanSet
;
344 friend class sc::RangeColumnSpanSet
;
345 friend class sc::EditTextIterator
;
346 friend class sc::FormulaGroupAreaListener
;
347 friend class sc::TableColumnBlockPositionSet
;
348 friend struct ScMutationGuard
;
349 friend struct ScMutationDisable
;
351 typedef std::vector
<ScTableUniquePtr
> TableContainer
;
354 enum class HardRecalcState
356 OFF
, /// normal calculation of dependencies
357 TEMPORARY
, /// CalcAll() without broadcast/notify but setting up new listeners
358 ETERNAL
/// no new listeners are setup, no broadcast/notify
362 rtl::Reference
<ScPoolHelper
> mxPoolHelper
;
364 std::shared_ptr
<svl::SharedStringPool
> mpCellStringPool
;
365 std::unique_ptr
<sc::DocumentLinkManager
> mpDocLinkMgr
;
367 std::shared_ptr
<sc::FormulaGroupContext
> mpFormulaGroupCxt
;
368 bool mbFormulaGroupCxtBlockDiscard
;
370 ScCalcConfig maCalcConfig
;
372 SfxUndoManager
* mpUndoManager
;
373 std::unique_ptr
<ScFieldEditEngine
> mpEditEngine
; // uses pEditPool from xPoolHelper
374 std::unique_ptr
<ScNoteEditEngine
> mpNoteEngine
; // uses pEditPool from xPoolHelper
375 SfxObjectShell
* mpShell
;
376 VclPtr
<SfxPrinter
> mpPrinter
;
377 VclPtr
<VirtualDevice
> mpVirtualDevice_100th_mm
;
378 std::unique_ptr
<ScDrawLayer
> mpDrawLayer
; // SdrModel
379 rtl::Reference
<XColorList
> pColorList
;
380 std::unique_ptr
<ScValidationDataList
> pValidationList
; // validity
381 SvNumberFormatterIndexTable
* pFormatExchangeList
; // for application of number formats
382 TableContainer maTabs
;
383 SCCOL mnMaxCol
; /// Maximum addressable column
384 SCROW mnMaxRow
; /// Maximum addressable row
385 std::vector
<OUString
> maTabNames
; // for undo document, we need the information tab name <-> index
386 mutable std::unique_ptr
<ScRangeName
> pRangeName
;
387 std::unique_ptr
<ScDBCollection
> pDBCollection
;
388 std::unique_ptr
<ScDPCollection
> pDPCollection
;
389 std::unique_ptr
< ScTemporaryChartLock
> apTemporaryChartLock
;
390 std::unique_ptr
<ScPatternAttr
> pSelectionAttr
; // Attributes of a block
391 ScFormulaCell
* pFormulaTree
; // formula tree (start)
392 ScFormulaCell
* pEOFormulaTree
; // formula tree (end), last cell
393 ScFormulaCell
* pFormulaTrack
; // BroadcastTrack (start)
394 ScFormulaCell
* pEOFormulaTrack
; // BroadcastTrack (end), last cell
395 std::unique_ptr
<ScBroadcastAreaSlotMachine
> pBASM
; // BroadcastAreas
396 std::unique_ptr
<ScChartListenerCollection
> pChartListenerCollection
;
397 std::unique_ptr
<SvMemoryStream
> pClipData
;
398 std::unique_ptr
<ScDetOpList
> pDetOpList
;
399 std::unique_ptr
<ScChangeTrack
> pChangeTrack
;
400 std::unique_ptr
<SfxBroadcaster
> pUnoBroadcaster
;
401 std::unique_ptr
<ScUnoListenerCalls
> pUnoListenerCalls
;
402 std::unique_ptr
<ScUnoRefList
> pUnoRefUndoList
;
403 std::unique_ptr
<ScChangeViewSettings
> pChangeViewSettings
;
404 std::unique_ptr
<ScScriptTypeData
> pScriptTypeData
;
405 std::unique_ptr
<ScRefreshTimerControl
> pRefreshTimerControl
;
406 std::shared_ptr
<SvxForbiddenCharactersTable
> xForbiddenCharacters
;
407 std::unique_ptr
<ScDBData
> mpAnonymousDBData
;
408 std::unique_ptr
<sc::ExternalDataMapper
> mpDataMapper
;
410 std::unique_ptr
<ScFieldEditEngine
> pCacheFieldEditEngine
;
412 std::unique_ptr
<ScDocProtection
> pDocProtection
;
413 std::unique_ptr
<ScClipParam
> mpClipParam
;
415 std::unique_ptr
<ScExternalRefManager
> pExternalRefMgr
;
416 std::unique_ptr
<ScMacroManager
> mpMacroMgr
;
418 // mutable for lazy construction
419 mutable std::unique_ptr
< ScFormulaParserPool
>
420 mxFormulaParserPool
; /// Pool for all external formula parsers used by this document.
422 OUString aDocName
; // optional: name of document
423 OUString aDocCodeName
; // optional: name of document (twice?)
424 OUString maFileURL
; // file URL for copy & paste
425 ScRangePairListRef xColNameRanges
;
426 ScRangePairListRef xRowNameRanges
;
428 std::unique_ptr
<ScViewOptions
> pViewOptions
; // view options
429 std::unique_ptr
<ScDocOptions
> pDocOptions
; // document options
430 std::unique_ptr
<ScExtDocOptions
> pExtDocOptions
; // for import etc.
431 std::unique_ptr
<ScClipOptions
> mpClipOptions
; // clipboard options
432 std::unique_ptr
<ScConsolidateParam
> pConsolidateDlgData
;
434 std::unique_ptr
<ScAutoNameCache
> pAutoNameCache
; // for automatic name lookup during CompileXML
436 std::unique_ptr
<SfxItemSet
> pPreviewFont
; // convert to std::unique_ptr or whatever
437 ScStyleSheet
* pPreviewCellStyle
;
438 ScMarkData maPreviewSelection
;
439 sal_Int64 nUnoObjectId
; // counted up for UNO objects
441 ErrCode nRangeOverflowType
; // used in (xml) loading for overflow warnings
444 ScAddress aCurTextWidthCalcPos
;
448 css::uno::Reference
< css::script::vba::XVBAEventProcessor
>
451 /// list of ScInterpreterTableOpParams currently in use
452 std::vector
<ScInterpreterTableOpParams
*> m_TableOpList
;
453 ScInterpreterTableOpParams aLastTableOpParams
; // remember last params
457 LanguageType eLanguage
; // default language
458 LanguageType eCjkLanguage
; // default language for asian text
459 LanguageType eCtlLanguage
; // default language for complex text
460 rtl_TextEncoding eSrcSet
; // during reading: source character set
462 /** The compiler grammar used in document storage. GRAM_PODF for ODF 1.1
463 documents, GRAM_ODFF for ODF 1.2 documents. */
464 formula::FormulaGrammar::Grammar eStorageGrammar
;
466 sal_uLong nFormulaCodeInTree
; // formula RPN in the formula tree
467 sal_uLong nXMLImportedFormulaCount
; // progress count during XML import
468 sal_uInt16 nInterpretLevel
; // >0 if in interpreter
469 sal_uInt16 nMacroInterpretLevel
; // >0 if macro in interpreter
470 sal_uInt16 nInterpreterTableOpLevel
; // >0 if in interpreter TableOp
472 ScDocumentThreadSpecific maNonThreaded
;
474 // There can be only one ScDocument being calculated in a thread at a time, so we can use a
475 // plain thread_local static member.
476 thread_local
static ScDocumentThreadSpecific maThreadSpecific
;
478 mutable ScInterpreterContext maInterpreterContext
;
480 osl::Mutex mScLookupMutex
; // protection for thread-unsafe parts of handling ScLookup
482 static const sal_uInt16 nSrcVer
; // file version (load/save)
483 sal_uInt16 nFormulaTrackCount
;
484 HardRecalcState eHardRecalcState
; // off, temporary, eternal
485 SCTAB nVisibleTab
; // for OLE etc., don't use inside ScDocument
486 SCCOL nPosLeft
; // for OLE etc., don't use inside ScDocument
487 SCROW nPosTop
; // for OLE etc., don't use inside ScDocument
489 ScLkUpdMode eLinkMode
;
491 bool bAutoCalc
; // calculate automatically
492 bool bAutoCalcShellDisabled
; // in/from/for ScDocShell disabled
493 // are there ForcedFormulas which have to be calculated
494 // in interaction with ScDocShell SetDocumentModified,
495 // AutoCalcShellDisabled and TrackFormulas
496 bool bForcedFormulaPending
;
497 bool bCalculatingFormulaTree
;
500 bool const bIsFunctionAccess
;
501 bool bIsVisible
; // set from view ctor
503 bool bIsEmbedded
; // display/adjust Embedded area?
505 // no broadcast, construct no listener during insert from a different
506 // Doc (per filter or the like ), not until CompileAll / CalcAfterLoad
507 bool bInsertingFromOtherDoc
;
509 bool bImportingXML
; // special handling of formula text
510 bool bCalcingAfterLoad
; // in CalcAfterLoad TRUE
511 // don't construct/destruct listeners temporarily
514 bool bInLinkUpdate
; // TableLink or AreaLink
515 bool bChartListenerCollectionNeedsUpdate
;
516 // are/were there RC_FORCED formula cells in the document (if set once to TRUE then set forever)
517 bool bHasForcedFormulas
;
518 // is the Doc being destroyed? (no Notify-Tracking etc. needed anymore)
520 // expand reference if insert column/row takes place at the border
522 // is fetched in each UpdateReference from InputOptions,
523 // assigned, and restored at the end of UpdateReference
525 // for detective update, is set for each change of a formula
526 bool bDetectiveDirty
;
527 // If the pointer is set, formula cells will not be automatically grouped into shared formula groups,
528 // instead the range will be extended to contain all such cells.
529 std::unique_ptr
< ScRange
> pDelayedFormulaGrouping
;
531 bool bLinkFormulaNeedingCheck
; // valid only after loading, for ocDde and ocWebservice
533 CharCompressType nAsianCompression
;
534 sal_uInt8 nAsianKerning
;
536 bool bPastingDrawFromOtherDoc
;
538 sal_uInt8 nInDdeLinkUpdate
; // originating DDE links (stacked bool)
540 bool bInUnoBroadcast
;
541 bool bInUnoListenerCall
;
542 sal_uInt32 nAdjustHeightLock
;
543 formula::FormulaGrammar::Grammar eGrammar
;
545 mutable bool bStyleSheetUsageInvalid
;
547 bool mbUndoEnabled
:1;
548 bool mbExecuteLinkEnabled
:1;
549 bool mbChangeReadOnlyEnabled
:1; // allow changes in read-only document (for API import filters)
550 bool mbStreamValidLocked
:1;
551 bool mbUserInteractionEnabled
:1; // whether or not to launch any kind of interactive dialogs.
553 sal_Int16 mnNamedRangesLockCount
;
555 std::set
<ScFormulaCell
*> maSubTotalCells
;
558 bool mbEmbedFonts
: 1;
559 bool mbEmbedUsedFontsOnly
: 1;
560 bool mbEmbedFontScriptLatin
: 1;
561 bool mbEmbedFontScriptAsian
: 1;
562 bool mbEmbedFontScriptComplex
: 1;
564 std::unique_ptr
<sc::IconSetBitmapMap
> m_pIconSetBitmapMap
;
566 bool mbTrackFormulasPending
: 1;
567 bool mbFinalTrackFormulas
: 1;
568 // This indicates if a ScDocShell::DoRecalc() or ScDocShell::DoHardRecalc() is in progress.
569 bool mbDocShellRecalc
: 1;
571 size_t mnMutationGuardFlags
;
574 bool IsCellInChangeTrack(const ScAddress
&cell
,Color
*pColCellBorder
);
575 void GetCellChangeTrackNote(const ScAddress
&cell
, OUString
&strTrackText
, bool &pbLeftEdge
);
577 bool IsEmbedFonts() const { return mbEmbedFonts
; }
578 bool IsEmbedUsedFontsOnly() const { return mbEmbedUsedFontsOnly
; }
579 bool IsEmbedFontScriptLatin() const { return mbEmbedFontScriptLatin
; }
580 bool IsEmbedFontScriptAsian() const { return mbEmbedFontScriptAsian
; }
581 bool IsEmbedFontScriptComplex() const { return mbEmbedFontScriptComplex
; }
583 void SetEmbedFonts(bool bUse
) { mbEmbedFonts
= bUse
; }
584 void SetEmbedUsedFontsOnly(bool bUse
) { mbEmbedUsedFontsOnly
= bUse
; }
585 void SetEmbedFontScriptLatin(bool bUse
) { mbEmbedFontScriptLatin
= bUse
; }
586 void SetEmbedFontScriptAsian(bool bUse
) { mbEmbedFontScriptAsian
= bUse
; }
587 void SetEmbedFontScriptComplex(bool bUse
) { mbEmbedFontScriptComplex
= bUse
; }
589 SC_DLLPUBLIC sal_uLong
GetCellCount() const; // all cells
590 SC_DLLPUBLIC sal_uLong
GetFormulaGroupCount() const; // all cells
591 sal_uLong
GetCodeCount() const; // RPN-Code in formulas
592 DECL_LINK( GetUserDefinedColor
, sal_uInt16
, Color
* );
595 SC_DLLPUBLIC
ScDocument( ScDocumentMode eMode
= SCDOCMODE_DOCUMENT
,
596 SfxObjectShell
* pDocShell
= nullptr );
597 SC_DLLPUBLIC
~ScDocument();
599 void SetName( const OUString
& r
) { aDocName
= r
; }
600 const OUString
& GetCodeName() const { return aDocCodeName
; }
601 void SetCodeName( const OUString
& r
) { aDocCodeName
= r
; }
602 const OUString
& GetFileURL() const { return maFileURL
; }
604 void GetDocStat( ScDocStat
& rDocStat
);
606 SC_DLLPUBLIC
void InitDrawLayer( SfxObjectShell
* pDocShell
= nullptr );
608 ScInterpreterContext
& GetNonThreadedContext() const
610 assert(!IsThreadedGroupCalcInProgress());
611 return maInterpreterContext
;
613 // Uses thread_local.
614 ScInterpreterContext
& GetThreadedContext() const
616 return IsThreadedGroupCalcInProgress() ? *maThreadSpecific
.pContext
: GetNonThreadedContext();
618 static void SetupFromNonThreadedContext( ScInterpreterContext
& threadedContext
, int threadNumber
);
619 void MergeBackIntoNonThreadedContext( ScInterpreterContext
& threadedContext
, int threadNumber
);
620 void SetThreadedGroupCalcInProgress( bool set
) { (void)this; ScGlobal::bThreadedGroupCalcInProgress
= set
; }
621 bool IsThreadedGroupCalcInProgress() const { (void)this; return ScGlobal::bThreadedGroupCalcInProgress
; }
623 SC_DLLPUBLIC
sfx2::LinkManager
* GetLinkManager();
624 SC_DLLPUBLIC
const sfx2::LinkManager
* GetLinkManager() const;
626 sc::DocumentLinkManager
& GetDocLinkManager();
627 const sc::DocumentLinkManager
& GetDocLinkManager() const;
629 SC_DLLPUBLIC
const ScDocOptions
& GetDocOptions() const;
630 SC_DLLPUBLIC
void SetDocOptions( const ScDocOptions
& rOpt
);
631 SC_DLLPUBLIC
const ScViewOptions
& GetViewOptions() const;
632 SC_DLLPUBLIC
void SetViewOptions( const ScViewOptions
& rOpt
);
633 void SetPrintOptions();
635 ScExtDocOptions
* GetExtDocOptions() { return pExtDocOptions
.get(); }
636 SC_DLLPUBLIC
void SetExtDocOptions( std::unique_ptr
<ScExtDocOptions
> pNewOptions
);
638 ScClipOptions
* GetClipOptions() { return mpClipOptions
.get(); }
639 void SetClipOptions(std::unique_ptr
<ScClipOptions
> pClipOptions
);
641 SC_DLLPUBLIC
void GetLanguage( LanguageType
& rLatin
, LanguageType
& rCjk
, LanguageType
& rCtl
) const;
642 void SetLanguage( LanguageType eLatin
, LanguageType eCjk
, LanguageType eCtl
);
644 void SetConsolidateDlgData( std::unique_ptr
<ScConsolidateParam
> pData
);
645 const ScConsolidateParam
* GetConsolidateDlgData() const { return pConsolidateDlgData
.get(); }
647 void Clear( bool bFromDestructor
= false );
649 std::unique_ptr
<ScFieldEditEngine
> CreateFieldEditEngine();
650 void DisposeFieldEditEngine(std::unique_ptr
<ScFieldEditEngine
>& rpEditEngine
);
653 * Get all range names that are local to each table. It only returns
654 * non-empty range name set.
656 SC_DLLPUBLIC
void GetAllTabRangeNames(ScRangeName::TabNameCopyMap
& rRangeNames
) const;
657 SC_DLLPUBLIC
void SetAllRangeNames(const std::map
<OUString
, std::unique_ptr
<ScRangeName
>>& rRangeMap
);
658 SC_DLLPUBLIC
void GetRangeNameMap(std::map
<OUString
, ScRangeName
*>& rRangeName
);
659 SC_DLLPUBLIC ScRangeName
* GetRangeName(SCTAB nTab
) const;
660 SC_DLLPUBLIC ScRangeName
* GetRangeName() const;
661 void SetRangeName(SCTAB nTab
, std::unique_ptr
<ScRangeName
> pNew
);
662 void SetRangeName( std::unique_ptr
<ScRangeName
> pNewRangeName
);
663 bool IsAddressInRangeName( RangeNameScope eScope
, const ScAddress
& rAddress
);
665 /** Find a named expression / range name in either global or a local scope.
667 If <0 search nIndex in global scope, if >=0 search nIndex in scope of nTab.
669 Index of named expression / range name.
670 @return nullptr if indexed name not found.
672 ScRangeData
* FindRangeNameBySheetAndIndex( SCTAB nTab
, sal_uInt16 nIndex
) const;
674 /** Recursively find all named expressions that directly or indirectly
675 (nested) reference a given sheet, starting from a given named
676 expression nTokenTab/nTokenIndex.
678 Used to collect all named expressions/ranges that will need to be
679 copied along when copying sheets.
681 The different tab/sheets passed cater for the situation that a sheet is
682 copied and was already inserted and global names are already adjusted
683 but the sheet-local names of the shifted original sheet are not yet. If
684 no sheet was inserted and global and local names' references not
685 updated yet, then all 4 tab arguments would be identical.
688 Tab/sheet on which to find the name, -1 if global scope.
689 For example obtained from ocName token.
692 Index of named expression. For example obtained from ocName token.
695 Tab to check if used in global names.
698 Tab to check if used in sheet-local names.
701 The original tab of the copied sheet, used as sheet-local
702 base position for relative references.
704 @param nOldTokenTabReplacement
705 The replacement to use for relative references if the name
706 encountered uses nOldTokenTab as base position.
709 FALSE if collecting names for a sheet to be copied to another
710 document. Then all names encountered are considered to be
711 referencing the sheet. Else TRUE if collecting names to be
712 copied into the same document.
715 Recursion guard, initialize with 0.
717 bool FindRangeNamesReferencingSheet( sc::UpdatedRangeNames
& rIndexes
,
718 SCTAB nTokenTab
, const sal_uInt16 nTokenIndex
,
719 SCTAB nGlobalRefTab
, SCTAB nLocalRefTab
, SCTAB nOldTokenTab
, SCTAB nOldTokenTabReplacement
,
720 bool bSameDoc
, int nRecursion
) const;
722 /** If necessary (name references sheet rOldPos.Tab()) copy and adjust
723 named expression/range from sheet-local to sheet-local, or global to
724 sheet-local if bGlobalNamesToLocal==true.
726 Also copies nested names and adjusts the ocName tokens of the calling name.
729 On entry, the original sheet of the named expression/range, <0 global.
730 On return TRUE, the new sheet. Else unchanged.
733 On entry, the original index of the named expression/range.
734 On return TRUE, the new index, or 0 if a new copied name couldn't be inserted. Else unchanged.
737 On entry, the pointer to the original named expression/range.
738 On return TRUE, the pointer to the new copied name, or nullptr if hits happened.
741 New position of formula cell if called for that, else new base
742 position of a to be created new name adjusted for Tab.
743 rNewPos.nTab MUST point to the new sheet copied to.
746 Old position of formula cell if called for that, else base
747 position of the existing name adjusted for Tab.
748 rOldPos.nTab MUST point to the old sheet copied from.
750 @param bGlobalNamesToLocal
751 If TRUE, affected global names are copied to sheet-local names.
752 If FALSE, global names are copied to global names in another document.
754 @param bUsedByFormula
755 If TRUE, forces a global name to be affected/used.
756 If FALSE, a global name is only affected if it evaluates to be
757 referencing the sheet.
759 @return TRUE if copied and caller may need to evaluate rpRangeData and rSheet and rIndex.
760 FALSE if nothing to be done.
762 bool CopyAdjustRangeName( SCTAB
& rSheet
, sal_uInt16
& rIndex
, ScRangeData
*& rpRangeData
, ScDocument
& rNewDoc
,
763 const ScAddress
& rNewPos
, const ScAddress
& rOldPos
, const bool bGlobalNamesToLocal
,
764 const bool bUsedByFormula
) const;
767 * Call this immediately before updating all named ranges.
769 SC_DLLPUBLIC
void PreprocessAllRangeNamesUpdate( const std::map
<OUString
, std::unique_ptr
<ScRangeName
>>& rRangeMap
);
770 SC_DLLPUBLIC
void PreprocessRangeNameUpdate();
771 SC_DLLPUBLIC
void PreprocessDBDataUpdate();
773 * Call this immediately after updating named ranges.
775 SC_DLLPUBLIC
void CompileHybridFormula();
778 * Insert a new named expression to the global scope.
780 * @param rName name for the expression.
781 * @param rPos base position.
782 * @param rExpr formula expression to be associated with the name. The
783 * current grammar is used to compile this expression.
785 * @return true if inserted successfully, false otherwise.
787 bool InsertNewRangeName( const OUString
& rName
, const ScAddress
& rPos
, const OUString
& rExpr
);
790 * Insert a new named expression to a sheet-local scope.
792 * @param nTab sheet for local scope.
793 * @param rName name for the expression.
794 * @param rPos base position.
795 * @param rExpr formula expression to be associated with the name. The
796 * current grammar is used to compile this expression.
798 * @return true if inserted successfully, false otherwise.
800 bool InsertNewRangeName( SCTAB nTab
, const OUString
& rName
, const ScAddress
& rPos
, const OUString
& rExpr
);
802 SCTAB
GetMaxTableNumber() const { return static_cast<SCTAB
>(maTabs
.size()) - 1; }
804 ScRangePairList
* GetColNameRanges() { return xColNameRanges
.get(); }
805 ScRangePairList
* GetRowNameRanges() { return xRowNameRanges
.get(); }
806 ScRangePairListRef
& GetColNameRangesRef() { return xColNameRanges
; }
807 ScRangePairListRef
& GetRowNameRangesRef() { return xRowNameRanges
; }
809 SC_DLLPUBLIC SCCOL
ClampToAllocatedColumns(SCTAB nTab
, SCCOL nCol
) const;
810 SC_DLLPUBLIC SCCOL
GetAllocatedColumnsCount(SCTAB nTab
) const;
812 SC_DLLPUBLIC ScDBCollection
* GetDBCollection() const { return pDBCollection
.get();}
813 void SetDBCollection( std::unique_ptr
<ScDBCollection
> pNewDBCollection
,
814 bool bRemoveAutoFilter
= false );
815 const ScDBData
* GetDBAtCursor(SCCOL nCol
, SCROW nRow
, SCTAB nTab
, ScDBDataPortion ePortion
) const;
816 ScDBData
* GetDBAtCursor(SCCOL nCol
, SCROW nRow
, SCTAB nTab
, ScDBDataPortion ePortion
);
817 SC_DLLPUBLIC
const ScDBData
* GetDBAtArea(SCTAB nTab
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
) const;
818 SC_DLLPUBLIC ScDBData
* GetDBAtArea(SCTAB nTab
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
819 void RefreshDirtyTableColumnNames();
820 SC_DLLPUBLIC
sc::ExternalDataMapper
& GetExternalDataMapper();
822 SC_DLLPUBLIC
const ScRangeData
* GetRangeAtBlock( const ScRange
& rBlock
, OUString
* pName
) const;
824 SC_DLLPUBLIC
bool HasPivotTable() const;
825 SC_DLLPUBLIC ScDPCollection
* GetDPCollection();
826 SC_DLLPUBLIC
const ScDPCollection
* GetDPCollection() const;
827 SC_DLLPUBLIC ScDPObject
* GetDPAtCursor(SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
828 ScDPObject
* GetDPAtBlock( const ScRange
& rBlock
) const;
830 void StopTemporaryChartLock();
832 void EnsureGraphicNames();
834 SdrObject
* GetObjectAtPoint( SCTAB nTab
, const Point
& rPos
);
835 bool HasChartAtPoint( SCTAB nTab
, const Point
& rPos
, OUString
& rName
);
837 css::uno::Reference
< css::chart2::XChartDocument
> GetChartByName( const OUString
& rChartName
);
839 SC_DLLPUBLIC
void GetChartRanges( const OUString
& rChartName
, std::vector
< ScRangeList
>& rRanges
, const ScDocument
* pSheetNameDoc
);
840 void SetChartRanges( const OUString
& rChartName
, const std::vector
< ScRangeList
>& rRanges
);
842 void UpdateChartArea( const OUString
& rChartName
, const ScRange
& rNewArea
,
843 bool bColHeaders
, bool bRowHeaders
, bool bAdd
);
844 void UpdateChartArea( const OUString
& rChartName
,
845 const ScRangeListRef
& rNewList
,
846 bool bColHeaders
, bool bRowHeaders
, bool bAdd
);
847 void GetOldChartParameters( const OUString
& rName
,
848 ScRangeList
& rRanges
, bool& rColHeaders
, bool& rRowHeaders
);
850 css::embed::XEmbeddedObject
>
851 FindOleObjectByName( const OUString
& rName
);
853 SC_DLLPUBLIC
void MakeTable( SCTAB nTab
,bool _bNeedsNameCheck
= true );
855 SCTAB
GetVisibleTab() const { return nVisibleTab
; }
856 SC_DLLPUBLIC
void SetVisibleTab(SCTAB nTab
) { nVisibleTab
= nTab
; }
857 SCCOL
GetPosLeft() const { return nPosLeft
; }
858 SC_DLLPUBLIC
void SetPosLeft(SCCOL nCol
) { nPosLeft
= nCol
; }
859 SCROW
GetPosTop() const { return nPosTop
; }
860 SC_DLLPUBLIC
void SetPosTop(SCROW nRow
) { nPosTop
= nRow
; }
862 SC_DLLPUBLIC
bool HasTable( SCTAB nTab
) const;
863 SC_DLLPUBLIC
bool GetHashCode( SCTAB nTab
, sal_Int64
& rHashCode
) const;
864 SC_DLLPUBLIC
bool GetName( SCTAB nTab
, OUString
& rName
) const;
865 SC_DLLPUBLIC
bool GetCodeName( SCTAB nTab
, OUString
& rName
) const;
866 SC_DLLPUBLIC
bool SetCodeName( SCTAB nTab
, const OUString
& rName
);
867 SC_DLLPUBLIC
bool GetTable( const OUString
& rName
, SCTAB
& rTab
) const;
868 SC_DLLPUBLIC SCCOL
MaxCol() const { return mnMaxCol
; }
869 SC_DLLPUBLIC SCROW
MaxRow() const { return mnMaxRow
; }
871 SC_DLLPUBLIC
std::vector
<OUString
> GetAllTableNames() const;
873 OUString
GetCopyTabName(SCTAB nTab
) const;
875 SC_DLLPUBLIC
void SetAnonymousDBData(SCTAB nTab
, std::unique_ptr
<ScDBData
> pDBData
);
876 SC_DLLPUBLIC ScDBData
* GetAnonymousDBData(SCTAB nTab
);
878 /** One document global anonymous database range for temporary operations,
879 used if the corresponding sheet-local anonymous database range is
880 already used with AutoFilter and range differs. Not stored in document
882 SC_DLLPUBLIC
void SetAnonymousDBData(std::unique_ptr
<ScDBData
> pDBData
);
883 SC_DLLPUBLIC ScDBData
* GetAnonymousDBData();
885 SC_DLLPUBLIC SCTAB
GetTableCount() const;
886 SvNumberFormatterIndexTable
* GetFormatExchangeList() const { return pFormatExchangeList
; }
888 SC_DLLPUBLIC ScDocProtection
* GetDocProtection() const;
889 SC_DLLPUBLIC
void SetDocProtection(const ScDocProtection
* pProtect
);
890 SC_DLLPUBLIC
bool IsDocProtected() const;
891 bool IsDocEditable() const;
892 SC_DLLPUBLIC
bool IsTabProtected( SCTAB nTab
) const;
893 SC_DLLPUBLIC ScTableProtection
* GetTabProtection( SCTAB nTab
) const;
894 SC_DLLPUBLIC
void SetTabProtection(SCTAB nTab
, const ScTableProtection
* pProtect
);
895 void CopyTabProtection(SCTAB nTabSrc
, SCTAB nTabDest
);
897 void LockTable(SCTAB nTab
);
898 void UnlockTable(SCTAB nTab
);
900 bool IsBlockEditable( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
,
901 SCCOL nEndCol
, SCROW nEndRow
,
902 bool* pOnlyNotBecauseOfMatrix
= nullptr,
903 bool bNoMatrixAtAll
= false ) const;
904 bool IsSelectionEditable( const ScMarkData
& rMark
,
905 bool* pOnlyNotBecauseOfMatrix
= nullptr ) const;
906 bool HasSelectedBlockMatrixFragment( SCCOL nStartCol
, SCROW nStartRow
,
907 SCCOL nEndCol
, SCROW nEndRow
,
908 const ScMarkData
& rMark
) const;
910 bool IsEditActionAllowed( sc::ColRowEditAction eAction
, SCTAB nTab
, SCCOLROW nStart
, SCCOLROW nEnd
) const;
911 bool IsEditActionAllowed( sc::ColRowEditAction eAction
, const ScMarkData
& rMark
, SCCOLROW nStart
, SCCOLROW nEnd
) const;
913 SC_DLLPUBLIC
bool GetMatrixFormulaRange( const ScAddress
& rCellPos
, ScRange
& rMatrix
);
915 bool IsEmbedded() const { return bIsEmbedded
;}
916 void GetEmbedded( ScRange
& rRange
) const;
917 void SetEmbedded( const ScRange
& rRange
);
918 void ResetEmbedded();
919 tools::Rectangle
GetEmbeddedRect() const; // 1/100 mm
920 void SetEmbedded( SCTAB nTab
, const tools::Rectangle
& rRect
); // from VisArea (1/100 mm)
922 static SC_DLLPUBLIC
bool ValidTabName( const OUString
& rName
);
924 SC_DLLPUBLIC
bool ValidNewTabName( const OUString
& rName
) const;
925 SC_DLLPUBLIC
void CreateValidTabName(OUString
& rName
) const;
926 SC_DLLPUBLIC
void CreateValidTabNames(std::vector
<OUString
>& aNames
, SCTAB nCount
) const;
928 void AppendTabOnLoad(const OUString
& rName
);
929 void SetTabNameOnLoad(SCTAB nTab
, const OUString
& rName
);
930 void InvalidateStreamOnSave();
932 SC_DLLPUBLIC
bool InsertTab( SCTAB nPos
, const OUString
& rName
,
933 bool bExternalDocument
= false, bool bUndoDeleteTab
= false );
935 SC_DLLPUBLIC
bool InsertTabs( SCTAB nPos
, const std::vector
<OUString
>& rNames
,
936 bool bNamesValid
= false );
937 SC_DLLPUBLIC
bool DeleteTabs( SCTAB nTab
, SCTAB nSheets
);
938 SC_DLLPUBLIC
bool DeleteTab( SCTAB nTab
);
939 SC_DLLPUBLIC
bool RenameTab( SCTAB nTab
, const OUString
& rName
,
940 bool bExternalDocument
= false );
941 bool MoveTab( SCTAB nOldPos
, SCTAB nNewPos
, ScProgress
* pProgress
= nullptr );
942 bool CopyTab( SCTAB nOldPos
, SCTAB nNewPos
,
943 const ScMarkData
* pOnlyMarked
= nullptr );
944 SC_DLLPUBLIC sal_uLong
TransferTab(ScDocument
* pSrcDoc
, SCTAB nSrcPos
, SCTAB nDestPos
,
945 bool bInsertNew
= true,
946 bool bResultsOnly
= false );
947 SC_DLLPUBLIC
void TransferDrawPage(const ScDocument
* pSrcDoc
, SCTAB nSrcPos
, SCTAB nDestPos
);
948 SC_DLLPUBLIC
void SetVisible( SCTAB nTab
, bool bVisible
);
949 SC_DLLPUBLIC
bool IsVisible( SCTAB nTab
) const;
950 bool IsStreamValid( SCTAB nTab
) const;
951 void SetStreamValid( SCTAB nTab
, bool bSet
, bool bIgnoreLock
= false );
952 void LockStreamValid( bool bLock
);
953 bool IsStreamValidLocked() const { return mbStreamValidLocked
; }
954 bool IsPendingRowHeights( SCTAB nTab
) const;
955 void SetPendingRowHeights( SCTAB nTab
, bool bSet
);
956 SC_DLLPUBLIC
void SetLayoutRTL( SCTAB nTab
, bool bRTL
);
957 SC_DLLPUBLIC
bool IsLayoutRTL( SCTAB nTab
) const;
958 SC_DLLPUBLIC
bool IsNegativePage( SCTAB nTab
) const;
959 SC_DLLPUBLIC
void SetScenario( SCTAB nTab
, bool bFlag
);
960 SC_DLLPUBLIC
bool IsScenario( SCTAB nTab
) const;
961 SC_DLLPUBLIC
void GetScenarioData(SCTAB nTab
, OUString
& rComment
,
962 Color
& rColor
, ScScenarioFlags
&rFlags
) const;
963 SC_DLLPUBLIC
void SetScenarioData(SCTAB nTab
, const OUString
& rComment
,
964 const Color
& rColor
, ScScenarioFlags nFlags
);
965 SC_DLLPUBLIC Color
GetTabBgColor( SCTAB nTab
) const;
966 SC_DLLPUBLIC
void SetTabBgColor( SCTAB nTab
, const Color
& rColor
);
967 SC_DLLPUBLIC
bool IsDefaultTabBgColor( SCTAB nTab
) const;
968 void GetScenarioFlags(SCTAB nTab
, ScScenarioFlags
&rFlags
) const;
969 SC_DLLPUBLIC
bool IsActiveScenario( SCTAB nTab
) const;
970 SC_DLLPUBLIC
void SetActiveScenario( SCTAB nTab
, bool bActive
); // only for Undo etc.
971 SC_DLLPUBLIC
formula::FormulaGrammar::AddressConvention
GetAddressConvention() const;
972 SC_DLLPUBLIC
formula::FormulaGrammar::Grammar
GetGrammar() const { return eGrammar
;}
973 SC_DLLPUBLIC
void SetGrammar( formula::FormulaGrammar::Grammar eGram
);
974 SC_DLLPUBLIC ScLinkMode
GetLinkMode( SCTAB nTab
) const;
975 bool IsLinked( SCTAB nTab
) const;
976 SC_DLLPUBLIC OUString
GetLinkDoc( SCTAB nTab
) const;
977 OUString
GetLinkFlt( SCTAB nTab
) const;
978 OUString
GetLinkOpt( SCTAB nTab
) const;
979 SC_DLLPUBLIC OUString
GetLinkTab( SCTAB nTab
) const;
980 sal_uLong
GetLinkRefreshDelay( SCTAB nTab
) const;
981 void SetLink( SCTAB nTab
, ScLinkMode nMode
, const OUString
& rDoc
,
982 const OUString
& rFilter
, const OUString
& rOptions
,
983 const OUString
& rTabName
, sal_uLong nRefreshDelay
);
984 bool HasLink( const OUString
& rDoc
,
985 const OUString
& rFilter
, const OUString
& rOptions
) const;
986 SC_DLLPUBLIC
bool LinkExternalTab( SCTAB
& nTab
, const OUString
& aDocTab
,
987 const OUString
& aFileName
,
988 const OUString
& aTabName
);
990 bool HasExternalRefManager() const { return pExternalRefMgr
.get(); }
991 SC_DLLPUBLIC ScExternalRefManager
* GetExternalRefManager() const;
992 bool IsInExternalReferenceMarking() const;
993 void MarkUsedExternalReferences();
994 bool MarkUsedExternalReferences( const ScTokenArray
& rArr
, const ScAddress
& rPos
);
996 /** Returns the pool containing external formula parsers. Creates the pool
998 ScFormulaParserPool
& GetFormulaParserPool() const;
1000 bool HasAreaLinks() const;
1001 void UpdateExternalRefLinks(weld::Window
* pWin
);
1002 void UpdateAreaLinks();
1004 // originating DDE links
1005 void IncInDdeLinkUpdate() { if ( nInDdeLinkUpdate
< 255 ) ++nInDdeLinkUpdate
; }
1006 void DecInDdeLinkUpdate() { if ( nInDdeLinkUpdate
) --nInDdeLinkUpdate
; }
1007 bool IsInDdeLinkUpdate() const { return nInDdeLinkUpdate
!= 0; }
1009 SC_DLLPUBLIC
void CopyDdeLinks( ScDocument
* pDestDoc
) const;
1011 /** Tries to find a DDE link with the specified connection data.
1012 @param rnDdePos (out-param) Returns the index of the DDE link (does not include other links from link manager).
1013 @return true = DDE link found, rnDdePos valid. */
1014 SC_DLLPUBLIC
bool FindDdeLink( const OUString
& rAppl
, const OUString
& rTopic
,
1015 const OUString
& rItem
, sal_uInt8 nMode
, size_t& rnDdePos
);
1017 /** Returns the connection data of the specified DDE link.
1018 @param nDdePos Index of the DDE link (does not include other links from link manager).
1019 @param rAppl (out-param) The application name.
1020 @param rTopic (out-param) The DDE topic.
1021 @param rItem (out-param) The DDE item.
1022 @return true = DDE link found, out-parameters valid. */
1023 bool GetDdeLinkData( size_t nDdePos
, OUString
& rAppl
, OUString
& rTopic
, OUString
& rItem
) const;
1024 /** Returns the link mode of the specified DDE link.
1025 @param nDdePos Index of the DDE link (does not include other links from link manager).
1026 @param rnMode (out-param) The link mode of the specified DDE link.
1027 @return true = DDE link found, rnMode valid. */
1028 bool GetDdeLinkMode( size_t nDdePos
, sal_uInt8
& rnMode
) const;
1029 /** Returns the result matrix of the specified DDE link.
1030 @param nDdePos Index of the DDE link (does not include other links from link manager).
1031 @return The result matrix, if the DDE link has been found, 0 otherwise. */
1032 SC_DLLPUBLIC
const ScMatrix
* GetDdeLinkResultMatrix( size_t nDdePos
) const;
1034 /** Tries to find a DDE link or creates a new, if not extant.
1035 @param pResults If not 0, sets the matrix as DDE link result matrix (also for existing links).
1036 @return true = DDE link found; false = Unpredictable error occurred, no DDE link created. */
1037 SC_DLLPUBLIC
bool CreateDdeLink( const OUString
& rAppl
, const OUString
& rTopic
, const OUString
& rItem
, sal_uInt8 nMode
, const ScMatrixRef
& pResults
);
1038 /** Sets a result matrix for the specified DDE link.
1039 @param nDdePos Index of the DDE link (does not include other links from link manager).
1040 @param pResults The array containing all results of the DDE link (intrusive-ref-counted, do not delete).
1041 @return true = DDE link found and matrix set. */
1042 bool SetDdeLinkResultMatrix( size_t nDdePos
, const ScMatrixRef
& pResults
);
1044 SfxBindings
* GetViewBindings();
1045 SfxObjectShell
* GetDocumentShell() const { return mpShell
; }
1046 SC_DLLPUBLIC ScDrawLayer
* GetDrawLayer() { return mpDrawLayer
.get(); }
1047 SC_DLLPUBLIC
const ScDrawLayer
* GetDrawLayer() const { return mpDrawLayer
.get(); }
1048 SfxBroadcaster
* GetDrawBroadcaster(); // to avoid header
1049 void BeginDrawUndo();
1051 void BeginUnoRefUndo();
1052 bool HasUnoRefUndo() const { return ( pUnoRefUndoList
!= nullptr ); }
1054 std::unique_ptr
<ScUnoRefList
> EndUnoRefUndo(); // must be deleted by caller!
1055 sal_Int64
GetNewUnoId() { return ++nUnoObjectId
; }
1056 void AddUnoRefChange( sal_Int64 nId
, const ScRangeList
& rOldRanges
);
1058 static bool IsChart( const SdrObject
* pObject
);
1060 void UpdateChartRef( UpdateRefMode eUpdateRefMode
,
1061 SCCOL nCol1
, SCROW nRow1
, SCTAB nTab1
,
1062 SCCOL nCol2
, SCROW nRow2
, SCTAB nTab2
,
1063 SCCOL nDx
, SCROW nDy
, SCTAB nDz
);
1064 //! only assigns the new RangeList, no ChartListener or the like
1065 void SetChartRangeList( const OUString
& rChartName
,
1066 const ScRangeListRef
& rNewRangeListRef
);
1068 void StartAnimations( SCTAB nTab
);
1070 bool HasBackgroundDraw( SCTAB nTab
, const tools::Rectangle
& rMMRect
) const;
1071 bool HasAnyDraw( SCTAB nTab
, const tools::Rectangle
& rMMRect
) const;
1073 const ScSheetEvents
* GetSheetEvents( SCTAB nTab
) const;
1074 void SetSheetEvents( SCTAB nTab
, std::unique_ptr
<ScSheetEvents
> pNew
);
1075 bool HasSheetEventScript( SCTAB nTab
, ScSheetEventId nEvent
, bool bWithVbaEvents
= false ) const;
1076 bool HasAnySheetEventScript( ScSheetEventId nEvent
, bool bWithVbaEvents
= false ) const; // on any sheet
1078 bool HasAnyCalcNotification() const;
1079 bool HasCalcNotification( SCTAB nTab
) const;
1080 void SetCalcNotification( SCTAB nTab
);
1081 void ResetCalcNotifications();
1083 SC_DLLPUBLIC ScOutlineTable
* GetOutlineTable( SCTAB nTab
, bool bCreate
= false );
1084 bool SetOutlineTable( SCTAB nTab
, const ScOutlineTable
* pNewOutline
);
1086 void DoAutoOutline( SCCOL nStartCol
, SCROW nStartRow
,
1087 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nTab
);
1089 bool DoSubTotals( SCTAB nTab
, ScSubTotalParam
& rParam
);
1090 void RemoveSubTotals( SCTAB nTab
, ScSubTotalParam
& rParam
);
1091 bool TestRemoveSubTotals( SCTAB nTab
, const ScSubTotalParam
& rParam
);
1092 bool HasSubTotalCells( const ScRange
& rRange
);
1094 SC_DLLPUBLIC
void EnsureTable( SCTAB nTab
);
1096 // return TRUE = number format is set
1097 SC_DLLPUBLIC
bool SetString( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, const OUString
& rString
,
1098 const ScSetStringParam
* pParam
= nullptr );
1099 SC_DLLPUBLIC
bool SetString( const ScAddress
& rPos
, const OUString
& rString
,
1100 const ScSetStringParam
* pParam
= nullptr );
1103 * This method manages the lifecycle of the passed edit text object. When
1104 * the text is successfully inserted, the cell takes over the ownership of
1105 * the text object. If not, the text object gets deleted.
1107 * <p>The caller must ensure that the passed edit text object <i>uses the
1108 * SfxItemPool instance returned from ScDocument::GetEditPool()</i>.
1109 * This is very important.</p>
1111 SC_DLLPUBLIC
bool SetEditText( const ScAddress
& rPos
, std::unique_ptr
<EditTextObject
> pEditText
);
1112 void SetEditText( const ScAddress
& rPos
, const EditTextObject
& rEditText
, const SfxItemPool
* pEditPool
);
1113 SC_DLLPUBLIC
void SetEditText( const ScAddress
& rPos
, const OUString
& rStr
);
1114 SC_DLLPUBLIC SCROW
GetFirstEditTextRow( const ScRange
& rRange
) const;
1117 * Call this if you are not sure whether to put this as an edit text or a
1120 SC_DLLPUBLIC
void SetTextCell( const ScAddress
& rPos
, const OUString
& rStr
);
1121 void SetEmptyCell( const ScAddress
& rPos
);
1122 SC_DLLPUBLIC
void SetValue( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, const double& rVal
);
1123 SC_DLLPUBLIC
void SetValue( const ScAddress
& rPos
, double fVal
);
1124 void SetValues( const ScAddress
& rPos
, const std::vector
<double>& rVals
);
1125 void SetError( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, const FormulaError nError
);
1126 SC_DLLPUBLIC
void SetFormula( const ScAddress
& rPos
, const ScTokenArray
& rArray
);
1127 SC_DLLPUBLIC
void SetFormula( const ScAddress
& rPos
, const OUString
& rFormula
,
1128 formula::FormulaGrammar::Grammar eGram
);
1131 * Set formula cell, and transfer its ownership to the document. This call
1132 * attempts to group the passed formula cell with the adjacent cells or
1133 * cell groups if appropriate.
1135 * @return pCell if it was successfully inserted, NULL otherwise. pCell
1136 * is deleted automatically on failure to insert.
1138 SC_DLLPUBLIC ScFormulaCell
* SetFormulaCell( const ScAddress
& rPos
, ScFormulaCell
* pCell
);
1139 bool SetFormulaCells( const ScAddress
& rPos
, std::vector
<ScFormulaCell
*>& rCells
);
1142 * Check if there is at least one formula cell in specified range.
1144 bool HasFormulaCell( const ScRange
& rRange
) const;
1145 SC_DLLPUBLIC
void InsertMatrixFormula(SCCOL nCol1
, SCROW nRow1
,
1146 SCCOL nCol2
, SCROW nRow2
,
1147 const ScMarkData
& rMark
,
1148 const OUString
& rFormula
,
1149 const ScTokenArray
* p
= nullptr,
1150 const formula::FormulaGrammar::Grammar
= formula::FormulaGrammar::GRAM_DEFAULT
);
1151 SC_DLLPUBLIC
void InsertTableOp(const ScTabOpParam
& rParam
, // multi-operation
1152 SCCOL nCol1
, SCROW nRow1
,
1153 SCCOL nCol2
, SCROW nRow2
, const ScMarkData
& rMark
);
1155 SC_DLLPUBLIC OUString
GetString( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1156 const ScInterpreterContext
* pContext
= nullptr ) const;
1157 SC_DLLPUBLIC OUString
GetString( const ScAddress
& rPos
,
1158 const ScInterpreterContext
* pContext
= nullptr ) const;
1161 * Return a pointer to the double value stored in value cell.
1163 * @param rPos cell position
1165 * @return pointer to the double value stored in a numeric cell, or NULL
1166 * if the cell at specified position is not a numeric cell.
1168 double* GetValueCell( const ScAddress
& rPos
);
1170 SC_DLLPUBLIC
svl::SharedStringPool
& GetSharedStringPool();
1171 const svl::SharedStringPool
& GetSharedStringPool() const;
1173 svl::SharedString
GetSharedString( const ScAddress
& rPos
) const;
1175 std::shared_ptr
<sc::FormulaGroupContext
>& GetFormulaGroupContext();
1176 void DiscardFormulaGroupContext();
1177 void BlockFormulaGroupContextDiscard( bool block
)
1178 { mbFormulaGroupCxtBlockDiscard
= block
; }
1180 SC_DLLPUBLIC
void GetInputString( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, OUString
& rString
);
1181 FormulaError
GetStringForFormula( const ScAddress
& rPos
, OUString
& rString
);
1182 SC_DLLPUBLIC
double GetValue( const ScAddress
& rPos
) const;
1183 SC_DLLPUBLIC
double GetValue( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1184 SC_DLLPUBLIC
void GetValue( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, double& rValue
) const;
1185 SC_DLLPUBLIC
const EditTextObject
* GetEditText( const ScAddress
& rPos
) const;
1186 void RemoveEditTextCharAttribs( const ScAddress
& rPos
, const ScPatternAttr
& rAttr
);
1187 SC_DLLPUBLIC
double RoundValueAsShown( double fVal
, sal_uInt32 nFormat
, const ScInterpreterContext
* pContext
= nullptr ) const;
1188 SC_DLLPUBLIC
void GetNumberFormat( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1189 sal_uInt32
& rFormat
) const;
1190 sal_uInt32
GetNumberFormat( const ScRange
& rRange
) const;
1191 SC_DLLPUBLIC sal_uInt32
GetNumberFormat( const ScInterpreterContext
& rContext
, const ScAddress
& ) const;
1192 void SetNumberFormat( const ScAddress
& rPos
, sal_uInt32 nNumberFormat
);
1194 void GetNumberFormatInfo( const ScInterpreterContext
& rContext
, SvNumFormatType
& nType
, sal_uInt32
& nIndex
, const ScAddress
& rPos
) const;
1195 SC_DLLPUBLIC
const ScFormulaCell
* GetFormulaCell( const ScAddress
& rPos
) const;
1196 SC_DLLPUBLIC ScFormulaCell
* GetFormulaCell( const ScAddress
& rPos
);
1197 SC_DLLPUBLIC
void GetFormula( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, OUString
& rFormula
) const;
1198 SC_DLLPUBLIC
void GetCellType( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, CellType
& rCellType
) const;
1199 SC_DLLPUBLIC CellType
GetCellType( const ScAddress
& rPos
) const;
1201 SC_DLLPUBLIC
bool HasData( SCCOL nCol
, SCROW nRow
, SCTAB nTab
);
1202 SC_DLLPUBLIC
bool HasStringData( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1203 SC_DLLPUBLIC
bool HasValueData( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1204 SC_DLLPUBLIC
bool HasValueData( const ScAddress
& rPos
) const;
1205 bool HasStringCells( const ScRange
& rRange
) const;
1207 /** Returns true, if there is any data to create a selection list for rPos. */
1208 bool HasSelectionData( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1209 bool HasValidationData( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1212 * Check if the specified range contains either: 1) one non-empty cell, 2)
1213 * more than one non-empty cells, or 3) totally empty. In case the range
1214 * contains at least one non-empty cell, specify the position of the first
1217 sc::MultiDataCellState
HasMultipleDataCells( const ScRange
& rRange
) const;
1220 SC_DLLPUBLIC ScPostIt
* GetNote(const ScAddress
& rPos
);
1221 SC_DLLPUBLIC ScPostIt
* GetNote(SCCOL nCol
, SCROW nRow
, SCTAB nTab
);
1222 void SetNote(const ScAddress
& rPos
, std::unique_ptr
<ScPostIt
> pNote
);
1223 void SetNote(SCCOL nCol
, SCROW nRow
, SCTAB nTab
, std::unique_ptr
<ScPostIt
> pNote
);
1224 SC_DLLPUBLIC
bool HasNote(const ScAddress
& rPos
) const;
1225 bool HasNote(SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1226 SC_DLLPUBLIC
bool HasColNotes(SCCOL nCol
, SCTAB nTab
) const;
1227 SC_DLLPUBLIC
bool HasTabNotes(SCTAB nTab
) const;
1228 bool HasNotes() const;
1229 SC_DLLPUBLIC
std::unique_ptr
<ScPostIt
> ReleaseNote(const ScAddress
& rPos
);
1230 SC_DLLPUBLIC ScPostIt
* GetOrCreateNote(const ScAddress
& rPos
);
1231 SC_DLLPUBLIC ScPostIt
* CreateNote(const ScAddress
& rPos
);
1232 size_t GetNoteCount( SCTAB nTab
, SCCOL nCol
) const;
1235 * Ensure that all note objects have an associated sdr object. The export
1236 * code uses sdr objects to export note data.
1238 void CreateAllNoteCaptions();
1239 void ForgetNoteCaptions( const ScRangeList
& rRanges
, bool bPreserveData
);
1240 CommentCaptionState
GetAllNoteCaptionsState( const ScRangeList
& rRanges
);
1242 ScAddress
GetNotePosition( size_t nIndex
) const;
1243 ScAddress
GetNotePosition( size_t nIndex
, SCTAB nTab
) const;
1244 SCROW
GetNotePosition( SCTAB nTab
, SCCOL nCol
, size_t nIndex
) const;
1246 SC_DLLPUBLIC
void GetAllNoteEntries( std::vector
<sc::NoteEntry
>& rNotes
) const;
1247 SC_DLLPUBLIC
void GetAllNoteEntries( SCTAB nTab
, std::vector
<sc::NoteEntry
>& rNotes
) const;
1248 void GetNotesInRange( const ScRangeList
& rRange
, std::vector
<sc::NoteEntry
>& rNotes
) const;
1249 bool ContainsNotesInRange( const ScRangeList
& rRange
) const;
1251 SC_DLLPUBLIC
void SetDrawPageSize(SCTAB nTab
);
1253 bool IsMerged( const ScAddress
& rPos
) const;
1255 void ExtendMergeSel( SCCOL nStartCol
, SCROW nStartRow
,
1256 SCCOL
& rEndCol
, SCROW
& rEndRow
, const ScMarkData
& rMark
,
1257 bool bRefresh
= false );
1258 SC_DLLPUBLIC
bool ExtendMerge( SCCOL nStartCol
, SCROW nStartRow
,
1259 SCCOL
& rEndCol
, SCROW
& rEndRow
, SCTAB nTab
,
1260 bool bRefresh
= false );
1261 bool ExtendMerge( ScRange
& rRange
, bool bRefresh
= false );
1262 SC_DLLPUBLIC
void ExtendTotalMerge( ScRange
& rRange
) const;
1263 SC_DLLPUBLIC
void ExtendOverlapped( SCCOL
& rStartCol
, SCROW
& rStartRow
,
1264 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nTab
) const;
1265 SC_DLLPUBLIC
void ExtendOverlapped( ScRange
& rRange
) const;
1267 bool RefreshAutoFilter( SCCOL nStartCol
, SCROW nStartRow
,
1268 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nTab
);
1270 SC_DLLPUBLIC
void DoMergeContents( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
,
1271 SCCOL nEndCol
, SCROW nEndRow
);
1272 SC_DLLPUBLIC
void DoEmptyBlock( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
,
1273 SCCOL nEndCol
, SCROW nEndRow
);
1274 // without checking:
1275 SC_DLLPUBLIC
void DoMerge( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
,
1276 SCCOL nEndCol
, SCROW nEndRow
, bool bDeleteCaptions
= true );
1277 void RemoveMerge( SCCOL nCol
, SCROW nRow
, SCTAB nTab
);
1279 bool IsBlockEmpty( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
,
1280 SCCOL nEndCol
, SCROW nEndRow
, bool bIgnoreNotes
= false ) const;
1281 bool IsPrintEmpty( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
,
1282 SCCOL nEndCol
, SCROW nEndRow
,
1283 bool bLeftIsEmpty
= false,
1284 ScRange
* pLastRange
= nullptr,
1285 tools::Rectangle
* pLastMM
= nullptr ) const;
1287 void SkipOverlapped( SCCOL
& rCol
, SCROW
& rRow
, SCTAB nTab
) const;
1288 bool IsHorOverlapped( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1289 bool IsVerOverlapped( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1291 SC_DLLPUBLIC
bool HasAttrib( SCCOL nCol1
, SCROW nRow1
, SCTAB nTab1
,
1292 SCCOL nCol2
, SCROW nRow2
, SCTAB nTab2
, HasAttrFlags nMask
) const;
1293 SC_DLLPUBLIC
bool HasAttrib( const ScRange
& rRange
, HasAttrFlags nMask
) const;
1295 SC_DLLPUBLIC
void GetBorderLines( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1296 const ::editeng::SvxBorderLine
** ppLeft
,
1297 const ::editeng::SvxBorderLine
** ppTop
,
1298 const ::editeng::SvxBorderLine
** ppRight
,
1299 const ::editeng::SvxBorderLine
** ppBottom
) const;
1301 void ResetChanged( const ScRange
& rRange
);
1303 void CheckVectorizationState();
1304 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext
& rCxt
);
1305 void SetDirty( const ScRange
&, bool bIncludeEmptyCells
);
1306 void SetTableOpDirty( const ScRange
& ); // for Interpreter TableOp
1307 void InterpretDirtyCells( const ScRangeList
& rRanges
);
1308 SC_DLLPUBLIC
void CalcAll();
1309 SC_DLLPUBLIC
void CalcAfterLoad( bool bStartListening
= true );
1314 * Re-compile formula cells with error.
1316 * @param nErrCode specified error code to match. Only those cells with
1317 * this error code will be re-compiled. If this value is
1318 * 0, cells with any error values will be re-compiled.
1320 * @return true if at least one cell is re-compiled, false if no cells are
1323 bool CompileErrorCells(FormulaError nErrCode
);
1325 ScAutoNameCache
* GetAutoNameCache() { return pAutoNameCache
.get(); }
1326 void SetPreviewFont( std::unique_ptr
<SfxItemSet
> pFontSet
);
1327 SfxItemSet
* GetPreviewFont() { return pPreviewFont
.get(); }
1328 SfxItemSet
* GetPreviewFont( SCCOL nCol
, SCROW nRow
, SCTAB nTab
);
1329 const ScMarkData
& GetPreviewSelection() const { return maPreviewSelection
; }
1330 void SetPreviewSelection( const ScMarkData
& rSel
);
1331 ScStyleSheet
* GetPreviewCellStyle() { return pPreviewCellStyle
; }
1332 ScStyleSheet
* GetPreviewCellStyle( SCCOL nCol
, SCROW nRow
, SCTAB nTab
);
1333 void SetPreviewCellStyle( ScStyleSheet
* pStyle
) { pPreviewCellStyle
= pStyle
; }
1334 SC_DLLPUBLIC
void SetAutoNameCache( std::unique_ptr
<ScAutoNameCache
> pCache
);
1336 /** Creates a ScLookupCache cache for the range if it
1337 doesn't already exist. */
1338 ScLookupCache
& GetLookupCache( const ScRange
& rRange
, ScInterpreterContext
* pContext
);
1339 /** Only ScLookupCache dtor uses RemoveLookupCache(), do
1340 not use elsewhere! */
1341 void RemoveLookupCache( ScLookupCache
& rCache
);
1342 /** Zap all caches. */
1343 void ClearLookupCaches();
1345 // calculate automatically
1346 SC_DLLPUBLIC
void SetAutoCalc( bool bNewAutoCalc
);
1347 SC_DLLPUBLIC
bool GetAutoCalc() const { return bAutoCalc
; }
1348 // calculate automatically in/from/for ScDocShell disabled
1349 void SetAutoCalcShellDisabled( bool bNew
) { bAutoCalcShellDisabled
= bNew
; }
1350 bool IsAutoCalcShellDisabled() const { return bAutoCalcShellDisabled
; }
1351 // ForcedFormulas are to be calculated
1352 void SetForcedFormulaPending( bool bNew
) { bForcedFormulaPending
= bNew
; }
1353 bool IsForcedFormulaPending() const { return bForcedFormulaPending
; }
1354 // if CalcFormulaTree() is currently running
1355 bool IsCalculatingFormulaTree() const { return bCalculatingFormulaTree
; }
1356 /// If set, joining cells into shared formula groups will be delayed until reset again
1357 /// (RegroupFormulaCells() will be called as needed).
1358 void DelayFormulaGrouping( bool delay
);
1359 bool IsDelayedFormulaGrouping() const { return pDelayedFormulaGrouping
.get() != nullptr; }
1360 /// To be used only by SharedFormulaUtil::joinFormulaCells().
1361 void AddDelayedFormulaGroupingCell( const ScFormulaCell
* cell
);
1363 FormulaError
GetErrCode( const ScAddress
& ) const;
1365 /** Shrink a range to only include data area.
1367 This is not the actually used area within the
1368 selection, but the bounds of the sheet's data area
1371 @returns TRUE if the area passed intersected the data
1372 area, FALSE if not, in which case the values
1373 obtained may be out of bounds, not in order or
1374 unmodified. TRUE does not mean that there
1375 actually is any data within the selection.
1377 bool ShrinkToDataArea( SCTAB nTab
, SCCOL
& rStartCol
, SCROW
& rStartRow
, SCCOL
& rEndCol
, SCROW
& rEndRow
) const;
1379 /** Shrink a range to only include used data area.
1382 Out parameter, true if area was shrunk, false if not.
1383 @param bStickyTopRow
1384 If TRUE, do not adjust the top row.
1385 @param bStickyLeftCol
1386 If TRUE, do not adjust the left column.
1387 @param bConsiderCellNotes
1388 If TRUE, consider the presence of cell notes besides data.
1389 @param bConsiderCellDrawObjects
1390 If TRUE, consider the presence of draw objects anchored to the cell.
1392 @returns true if there is any data, false if not.
1394 bool ShrinkToUsedDataArea( bool& o_bShrunk
,
1395 SCTAB nTab
, SCCOL
& rStartCol
, SCROW
& rStartRow
,
1396 SCCOL
& rEndCol
, SCROW
& rEndRow
, bool bColumnsOnly
,
1397 bool bStickyTopRow
= false, bool bStickyLeftCol
= false,
1398 bool bConsiderCellNotes
= false,
1399 bool bConsiderCellDrawObjects
= false ) const;
1402 * Return the last non-empty row position in given columns that's no
1403 * greater than the initial last row position, or 0 if the columns are
1404 * empty. A negative value is returned if the given sheet or column
1405 * positions are invalid.
1407 * <p>It starts from the specified last row position, and finds the first
1408 * non-empty row position in the upward direction if the start row
1409 * position is empty.</p>
1411 SCROW
GetLastDataRow( SCTAB nTab
, SCCOL nCol1
, SCCOL nCol2
, SCROW nLastRow
) const;
1414 * Return the smallest area containing at least all contiguous cells
1415 * having data. This area is a square containing also empty cells. It may
1416 * shrink or extend the area given as input Flags as modifiers:
1418 * @param bIncludeOld when true, ensure that the returned area contains at
1419 * least the initial area even if the actual data area
1420 * is smaller than the initial area.
1422 * @param bOnlyDown when true, extend / shrink the data area only in a
1423 * downward direction i.e. only modify the end row
1426 SC_DLLPUBLIC
void GetDataArea( SCTAB nTab
, SCCOL
& rStartCol
, SCROW
& rStartRow
,
1427 SCCOL
& rEndCol
, SCROW
& rEndRow
,
1428 bool bIncludeOld
, bool bOnlyDown
) const;
1431 * Returns true if there is a non-empty subrange in the range given as input.
1432 * In that case it also modifies rRange to largest subrange that does not
1433 * have empty col/row inrange-segments in the beginning/end.
1434 * It returns false if rRange is completely empty and in this case rRange is
1437 bool GetDataAreaSubrange(ScRange
& rRange
) const;
1439 SC_DLLPUBLIC
bool GetCellArea( SCTAB nTab
, SCCOL
& rEndCol
, SCROW
& rEndRow
) const;
1440 SC_DLLPUBLIC
bool GetTableArea( SCTAB nTab
, SCCOL
& rEndCol
, SCROW
& rEndRow
) const;
1441 SC_DLLPUBLIC
bool GetPrintArea( SCTAB nTab
, SCCOL
& rEndCol
, SCROW
& rEndRow
,
1442 bool bNotes
= true ) const;
1443 SC_DLLPUBLIC
bool GetPrintAreaHor( SCTAB nTab
, SCROW nStartRow
, SCROW nEndRow
,
1444 SCCOL
& rEndCol
) const;
1445 SC_DLLPUBLIC
bool GetPrintAreaVer( SCTAB nTab
, SCCOL nStartCol
, SCCOL nEndCol
,
1446 SCROW
& rEndRow
, bool bNotes
) const;
1447 void InvalidateTableArea();
1449 /// Return the number of columns / rows that should be visible for the tiled rendering.
1450 SC_DLLPUBLIC
void GetTiledRenderingArea(SCTAB nTab
, SCCOL
& rEndCol
, SCROW
& rEndRow
) const;
1452 SC_DLLPUBLIC
bool GetDataStart( SCTAB nTab
, SCCOL
& rStartCol
, SCROW
& rStartRow
) const;
1455 * Find the maximum column position that contains printable data for the
1456 * specified row range. The final column position must be equal or less
1457 * than the initial value of rEndCol.
1459 void ExtendPrintArea( OutputDevice
* pDev
, SCTAB nTab
,
1460 SCCOL nStartCol
, SCROW nStartRow
,
1461 SCCOL
& rEndCol
, SCROW nEndRow
) const;
1462 SC_DLLPUBLIC SCSIZE
GetEmptyLinesInBlock( SCCOL nStartCol
, SCROW nStartRow
, SCTAB nStartTab
,
1463 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nEndTab
,
1466 void FindAreaPos( SCCOL
& rCol
, SCROW
& rRow
, SCTAB nTab
, ScMoveDirection eDirection
) const;
1467 SC_DLLPUBLIC
void GetNextPos( SCCOL
& rCol
, SCROW
& rRow
, SCTAB nTab
, SCCOL nMovX
, SCROW nMovY
,
1468 bool bMarked
, bool bUnprotected
, const ScMarkData
& rMark
,
1469 SCCOL nTabStartCol
= SC_TABSTART_NONE
) const;
1471 bool GetNextMarkedCell( SCCOL
& rCol
, SCROW
& rRow
, SCTAB nTab
,
1472 const ScMarkData
& rMark
);
1474 void LimitChartArea( SCTAB nTab
, SCCOL
& rStartCol
, SCROW
& rStartRow
,
1475 SCCOL
& rEndCol
, SCROW
& rEndRow
);
1476 void LimitChartIfAll( ScRangeListRef
& rRangeList
);
1478 bool InsertRow( SCCOL nStartCol
, SCTAB nStartTab
,
1479 SCCOL nEndCol
, SCTAB nEndTab
,
1480 SCROW nStartRow
, SCSIZE nSize
, ScDocument
* pRefUndoDoc
= nullptr,
1481 const ScMarkData
* pTabMark
= nullptr );
1482 SC_DLLPUBLIC
bool InsertRow( const ScRange
& rRange
);
1483 void DeleteRow( SCCOL nStartCol
, SCTAB nStartTab
,
1484 SCCOL nEndCol
, SCTAB nEndTab
,
1485 SCROW nStartRow
, SCSIZE nSize
,
1486 ScDocument
* pRefUndoDoc
= nullptr, bool* pUndoOutline
= nullptr,
1487 const ScMarkData
* pTabMark
= nullptr );
1488 SC_DLLPUBLIC
void DeleteRow( const ScRange
& rRange
);
1489 bool InsertCol( SCROW nStartRow
, SCTAB nStartTab
,
1490 SCROW nEndRow
, SCTAB nEndTab
,
1491 SCCOL nStartCol
, SCSIZE nSize
, ScDocument
* pRefUndoDoc
= nullptr,
1492 const ScMarkData
* pTabMark
= nullptr );
1493 SC_DLLPUBLIC
bool InsertCol( const ScRange
& rRange
);
1494 void DeleteCol( SCROW nStartRow
, SCTAB nStartTab
,
1495 SCROW nEndRow
, SCTAB nEndTab
,
1496 SCCOL nStartCol
, SCSIZE nSize
,
1497 ScDocument
* pRefUndoDoc
= nullptr, bool* pUndoOutline
= nullptr,
1498 const ScMarkData
* pTabMark
= nullptr );
1499 void DeleteCol( const ScRange
& rRange
);
1501 bool CanInsertRow( const ScRange
& rRange
) const;
1502 bool CanInsertCol( const ScRange
& rRange
) const;
1504 void FitBlock( const ScRange
& rOld
, const ScRange
& rNew
, bool bClear
= true );
1505 bool CanFitBlock( const ScRange
& rOld
, const ScRange
& rNew
);
1507 bool IsClipOrUndo() const { return bIsClip
|| bIsUndo
; }
1508 bool IsUndo() const { return bIsUndo
; }
1509 bool IsClipboard() const { return bIsClip
; }
1510 bool IsUndoEnabled() const { return mbUndoEnabled
; }
1511 SC_DLLPUBLIC
void EnableUndo( bool bVal
);
1512 bool IsFunctionAccess() const { return bIsFunctionAccess
; }
1514 bool IsAdjustHeightLocked() const { return nAdjustHeightLock
!= 0; }
1515 void LockAdjustHeight() { ++nAdjustHeightLock
; }
1516 SC_DLLPUBLIC
void UnlockAdjustHeight();
1517 bool IsExecuteLinkEnabled() const { return mbExecuteLinkEnabled
; }
1518 void EnableExecuteLink( bool bVal
) { mbExecuteLinkEnabled
= bVal
; }
1519 bool IsChangeReadOnlyEnabled() const { return mbChangeReadOnlyEnabled
; }
1520 void EnableChangeReadOnly( bool bVal
) { mbChangeReadOnlyEnabled
= bVal
; }
1521 SC_DLLPUBLIC
bool IsUserInteractionEnabled() const { return mbUserInteractionEnabled
;}
1522 SC_DLLPUBLIC
void EnableUserInteraction( bool bVal
);
1523 SC_DLLPUBLIC sal_Int16
GetNamedRangesLockCount() const { return mnNamedRangesLockCount
; }
1524 void SetNamedRangesLockCount( sal_Int16 nCount
) { mnNamedRangesLockCount
= nCount
; }
1525 SC_DLLPUBLIC
void ResetClip( ScDocument
* pSourceDoc
, const ScMarkData
* pMarks
);
1526 SC_DLLPUBLIC
void ResetClip( ScDocument
* pSourceDoc
, SCTAB nTab
);
1527 void SetCutMode( bool bCut
);
1529 void SetClipArea( const ScRange
& rArea
, bool bCut
= false );
1531 SC_DLLPUBLIC
bool IsDocVisible() const { return bIsVisible
; }
1532 SC_DLLPUBLIC
void SetDocVisible( bool bSet
);
1534 bool HasOLEObjectsInArea( const ScRange
& rRange
, const ScMarkData
* pTabMark
= nullptr );
1536 void DeleteObjectsInArea( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1537 const ScMarkData
& rMark
, bool bAnchored
= false );
1538 void DeleteObjectsInSelection( const ScMarkData
& rMark
);
1540 void DeleteArea( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, const ScMarkData
& rMark
,
1541 InsertDeleteFlags nDelFlag
, bool bBroadcast
= true,
1542 sc::ColumnSpanSet
* pBroadcastSpans
= nullptr );
1544 SC_DLLPUBLIC
void DeleteAreaTab(SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1545 SCTAB nTab
, InsertDeleteFlags nDelFlag
);
1546 void DeleteAreaTab(const ScRange
& rRange
, InsertDeleteFlags nDelFlag
);
1548 SC_DLLPUBLIC
void CopyToClip( const ScClipParam
& rClipParam
, ScDocument
* pClipDoc
,
1549 const ScMarkData
* pMarks
, bool bKeepScenarioFlags
,
1550 bool bIncludeObjects
);
1553 * Copy only raw cell values to another document. Formula cells are
1554 * converted to raw cells. No formatting info are copied except for
1557 * @param rSrcRange source range in the source document
1558 * @param nDestTab table in the clip document to copy to.
1559 * @param pDestDoc document to copy to
1561 SC_DLLPUBLIC
void CopyStaticToDocument(const ScRange
& rSrcRange
, SCTAB nDestTab
, ScDocument
* pDestDoc
);
1564 * Copy only cell, nothing but cell to another document.
1566 * @param rSrcPos source cell position
1567 * @param rDestPos destination cell position
1568 * @param rDestDoc destination document
1570 void CopyCellToDocument( const ScAddress
& rSrcPos
, const ScAddress
& rDestPos
, ScDocument
& rDestDoc
);
1572 void CopyTabToClip( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1573 SCTAB nTab
, ScDocument
* pClipDoc
);
1575 SC_DLLPUBLIC
bool InitColumnBlockPosition( sc::ColumnBlockPosition
& rBlockPos
, SCTAB nTab
, SCCOL nCol
);
1577 void DeleteBeforeCopyFromClip( sc::CopyFromClipContext
& rCxt
, const ScMarkData
& rMark
,
1578 sc::ColumnSpanSet
& rBroadcastSpans
);
1580 bool CopyOneCellFromClip(sc::CopyFromClipContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
,
1581 SCCOL nCol2
, SCROW nRow2
);
1582 void CopyBlockFromClip( sc::CopyFromClipContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
,
1583 SCCOL nCol2
, SCROW nRow2
, const ScMarkData
& rMark
,
1584 SCCOL nDx
, SCROW nDy
);
1585 void CopyNonFilteredFromClip( sc::CopyFromClipContext
& rCxt
, SCCOL nCol1
,
1586 SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1587 const ScMarkData
& rMark
, SCCOL nDx
, SCROW
& rClipStartRow
);
1589 void StartListeningFromClip( SCCOL nCol1
, SCROW nRow1
,
1590 SCCOL nCol2
, SCROW nRow2
,
1591 const ScMarkData
& rMark
, InsertDeleteFlags nInsFlag
);
1593 void SetDirtyFromClip( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1594 const ScMarkData
& rMark
, InsertDeleteFlags nInsFlag
,
1595 sc::ColumnSpanSet
& rBroadcastSpans
);
1597 /** If pDestRanges is given it overrides rDestRange, rDestRange in this
1598 case is the overall encompassing range. */
1599 SC_DLLPUBLIC
void CopyFromClip( const ScRange
& rDestRange
, const ScMarkData
& rMark
,
1600 InsertDeleteFlags nInsFlag
,
1601 ScDocument
* pRefUndoDoc
,
1602 ScDocument
* pClipDoc
,
1603 bool bResetCut
= true,
1604 bool bAsLink
= false,
1605 bool bIncludeFiltered
= true,
1606 bool bSkipAttrForEmpty
= false,
1607 const ScRangeList
* pDestRanges
= nullptr );
1609 void CopyMultiRangeFromClip(const ScAddress
& rDestPos
, const ScMarkData
& rMark
,
1610 InsertDeleteFlags nInsFlag
, ScDocument
* pClipDoc
,
1611 bool bResetCut
= true, bool bAsLink
= false,
1612 bool bIncludeFiltered
= true,
1613 bool bSkipAttrForEmpty
= false);
1615 void GetClipArea(SCCOL
& nClipX
, SCROW
& nClipY
, bool bIncludeFiltered
);
1616 void GetClipStart(SCCOL
& nClipX
, SCROW
& nClipY
);
1618 bool HasClipFilteredRows();
1620 bool IsClipboardSource() const;
1622 SC_DLLPUBLIC
void TransposeClip( ScDocument
* pTransClip
, InsertDeleteFlags nFlags
, bool bAsLink
);
1624 ScClipParam
& GetClipParam();
1625 void SetClipParam(const ScClipParam
& rParam
);
1627 /** To be called at the clipboard document when closing a document that is
1628 the current clipboard source to decouple things from the originating
1629 document. Done in ScDocument dtor after determining
1630 IsClipboardSource().
1632 void ClosingClipboardSource();
1634 void MixDocument( const ScRange
& rRange
, ScPasteFunc nFunction
, bool bSkipEmpty
,
1635 ScDocument
* pSrcDoc
);
1637 void FillTab( const ScRange
& rSrcArea
, const ScMarkData
& rMark
,
1638 InsertDeleteFlags nFlags
, ScPasteFunc nFunction
,
1639 bool bSkipEmpty
, bool bAsLink
);
1640 void FillTabMarked( SCTAB nSrcTab
, const ScMarkData
& rMark
,
1641 InsertDeleteFlags nFlags
, ScPasteFunc nFunction
,
1642 bool bSkipEmpty
, bool bAsLink
);
1644 void TransliterateText( const ScMarkData
& rMultiMark
, TransliterationFlags nType
);
1646 SC_DLLPUBLIC
void InitUndo( const ScDocument
* pSrcDoc
, SCTAB nTab1
, SCTAB nTab2
,
1647 bool bColInfo
= false, bool bRowInfo
= false );
1648 void AddUndoTab( SCTAB nTab1
, SCTAB nTab2
,
1649 bool bColInfo
= false, bool bRowInfo
= false );
1650 SC_DLLPUBLIC
void InitUndoSelected( const ScDocument
* pSrcDoc
, const ScMarkData
& rTabSelection
,
1651 bool bColInfo
= false, bool bRowInfo
= false );
1653 // don't use anymore:
1654 void CopyToDocument(SCCOL nCol1
, SCROW nRow1
, SCTAB nTab1
,
1655 SCCOL nCol2
, SCROW nRow2
, SCTAB nTab2
,
1656 InsertDeleteFlags nFlags
, bool bMarked
, ScDocument
& rDestDoc
,
1657 const ScMarkData
* pMarks
= nullptr, bool bColRowFlags
= true);
1658 void UndoToDocument(SCCOL nCol1
, SCROW nRow1
, SCTAB nTab1
,
1659 SCCOL nCol2
, SCROW nRow2
, SCTAB nTab2
,
1660 InsertDeleteFlags nFlags
, bool bMarked
, ScDocument
& rDestDoc
);
1662 void CopyToDocument(const ScRange
& rRange
,
1663 InsertDeleteFlags nFlags
, bool bMarked
, ScDocument
& rDestDoc
,
1664 const ScMarkData
* pMarks
= nullptr, bool bColRowFlags
= true);
1665 void UndoToDocument(const ScRange
& rRange
,
1666 InsertDeleteFlags nFlags
, bool bMarked
, ScDocument
& rDestDoc
);
1668 void CopyScenario( SCTAB nSrcTab
, SCTAB nDestTab
, bool bNewScenario
= false );
1669 bool TestCopyScenario( SCTAB nSrcTab
, SCTAB nDestTab
) const;
1670 void MarkScenario(SCTAB nSrcTab
, SCTAB nDestTab
,
1671 ScMarkData
& rDestMark
, bool bResetMark
= true,
1672 ScScenarioFlags nNeededBits
= ScScenarioFlags::NONE
) const;
1673 bool HasScenarioRange( SCTAB nTab
, const ScRange
& rRange
) const;
1674 SC_DLLPUBLIC
const ScRangeList
* GetScenarioRanges( SCTAB nTab
) const;
1676 SC_DLLPUBLIC
void CopyUpdated( ScDocument
* pPosDoc
, ScDocument
* pDestDoc
);
1678 void UpdateReference( sc::RefUpdateContext
& rCxt
, ScDocument
*
1679 pUndoDoc
= nullptr, bool bIncludeDraw
= true,
1680 bool bUpdateNoteCaptionPos
= true );
1682 SC_DLLPUBLIC
void UpdateTranspose( const ScAddress
& rDestPos
, ScDocument
* pClipDoc
,
1683 const ScMarkData
& rMark
, ScDocument
* pUndoDoc
);
1685 void UpdateGrow( const ScRange
& rArea
, SCCOL nGrowX
, SCROW nGrowY
);
1687 SC_DLLPUBLIC
void Fill( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1688 ScProgress
* pProgress
, const ScMarkData
& rMark
,
1689 sal_uLong nFillCount
, FillDir eFillDir
= FILL_TO_BOTTOM
,
1690 FillCmd eFillCmd
= FILL_LINEAR
, FillDateCmd eFillDateCmd
= FILL_DAY
,
1691 double nStepValue
= 1.0, double nMaxValue
= 1E307
);
1692 OUString
GetAutoFillPreview( const ScRange
& rSource
, SCCOL nEndX
, SCROW nEndY
);
1694 bool GetSelectionFunction( ScSubTotalFunc eFunc
,
1695 const ScAddress
& rCursor
, const ScMarkData
& rMark
,
1698 SC_DLLPUBLIC
const SfxPoolItem
* GetAttr( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, sal_uInt16 nWhich
) const;
1699 template<class T
> const T
* GetAttr( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, TypedWhichId
<T
> nWhich
) const
1701 return static_cast<const T
*>(GetAttr(nCol
, nRow
, nTab
, sal_uInt16(nWhich
)));
1703 SC_DLLPUBLIC
const SfxPoolItem
* GetAttr( const ScAddress
& rPos
, sal_uInt16 nWhich
) const;
1704 template<class T
> const T
* GetAttr( const ScAddress
& rPos
, TypedWhichId
<T
> nWhich
) const
1706 return static_cast<const T
*>(GetAttr(rPos
, sal_uInt16(nWhich
)));
1708 SC_DLLPUBLIC
const ScPatternAttr
* GetPattern( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1709 SC_DLLPUBLIC
const ScPatternAttr
* GetPattern( const ScAddress
& rPos
) const;
1710 SC_DLLPUBLIC
const ScPatternAttr
* GetMostUsedPattern( SCCOL nCol
, SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1711 const ScPatternAttr
* GetSelectionPattern( const ScMarkData
& rMark
);
1712 std::unique_ptr
<ScPatternAttr
> CreateSelectionPattern( const ScMarkData
& rMark
, bool bDeep
= true );
1713 SC_DLLPUBLIC
void AddCondFormatData( const ScRangeList
& rRange
, SCTAB nTab
, sal_uInt32 nIndex
);
1714 void RemoveCondFormatData( const ScRangeList
& rRange
, SCTAB nTab
, sal_uInt32 nIndex
);
1716 SC_DLLPUBLIC ScConditionalFormat
* GetCondFormat( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1717 // pCell is an optimization, must point to rPos
1718 SC_DLLPUBLIC
const SfxItemSet
* GetCondResult( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1719 ScRefCellValue
* pCell
= nullptr ) const;
1720 const SfxItemSet
* GetCondResult( ScRefCellValue
& rCell
, const ScAddress
& rPos
,
1721 const ScConditionalFormatList
& rList
,
1722 const ScCondFormatIndexes
& rIndex
) const;
1723 const SfxPoolItem
* GetEffItem( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, sal_uInt16 nWhich
) const;
1724 template<class T
> const T
* GetEffItem( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, TypedWhichId
<T
> nWhich
) const
1726 return static_cast<const T
*>(GetEffItem(nCol
, nRow
, nTab
, sal_uInt16(nWhich
)));
1729 SC_DLLPUBLIC
const css::uno::Reference
< css::i18n::XBreakIterator
>& GetBreakIterator();
1730 bool HasStringWeakCharacters( const OUString
& rString
);
1731 SC_DLLPUBLIC SvtScriptType
GetStringScriptType( const OUString
& rString
);
1732 // pCell is an optimization, must point to rPos
1733 SC_DLLPUBLIC SvtScriptType
GetCellScriptType( const ScAddress
& rPos
, sal_uInt32 nNumberFormat
,
1734 const ScRefCellValue
* pCell
= nullptr );
1735 // pCell is an optimization, must point to nCol,nRow,nTab
1736 SC_DLLPUBLIC SvtScriptType
GetScriptType( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1737 const ScRefCellValue
* pCell
= nullptr );
1738 SvtScriptType
GetRangeScriptType( sc::ColumnBlockPosition
& rBlockPos
, const ScAddress
& rPos
, SCROW nLength
);
1739 SvtScriptType
GetRangeScriptType( const ScRangeList
& rRanges
);
1741 bool HasDetectiveOperations() const;
1742 void AddDetectiveOperation( const ScDetOpData
& rData
);
1743 void ClearDetectiveOperations();
1744 ScDetOpList
* GetDetOpList() const { return pDetOpList
.get(); }
1745 void SetDetOpList(std::unique_ptr
<ScDetOpList
> pNew
);
1747 bool HasDetectiveObjects(SCTAB nTab
) const;
1749 void GetSelectionFrame( const ScMarkData
& rMark
,
1750 SvxBoxItem
& rLineOuter
,
1751 SvxBoxInfoItem
& rLineInner
);
1752 void ApplySelectionFrame(const ScMarkData
& rMark
,
1753 const SvxBoxItem
& rLineOuter
,
1754 const SvxBoxInfoItem
* pLineInner
);
1755 void ApplyFrameAreaTab(const ScRange
& rRange
,
1756 const SvxBoxItem
& rLineOuter
,
1757 const SvxBoxInfoItem
& rLineInner
);
1759 void ClearSelectionItems( const sal_uInt16
* pWhich
, const ScMarkData
& rMark
);
1760 void ChangeSelectionIndent( bool bIncrement
, const ScMarkData
& rMark
);
1762 SC_DLLPUBLIC sal_uLong
AddCondFormat( std::unique_ptr
<ScConditionalFormat
> pNew
, SCTAB nTab
);
1763 void DeleteConditionalFormat( sal_uLong nIndex
, SCTAB nTab
);
1765 void SetCondFormList( ScConditionalFormatList
* pList
, SCTAB nTab
);
1766 SC_DLLPUBLIC sal_uLong
AddValidationEntry( const ScValidationData
& rNew
);
1767 SC_DLLPUBLIC
const ScValidationData
* GetValidationEntry( sal_uLong nIndex
) const;
1769 SC_DLLPUBLIC ScConditionalFormatList
* GetCondFormList( SCTAB nTab
) const;
1771 const ScValidationDataList
* GetValidationList() const { return pValidationList
.get();}
1772 ScValidationDataList
* GetValidationList() { return pValidationList
.get();}
1774 SC_DLLPUBLIC
void ApplyAttr( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1775 const SfxPoolItem
& rAttr
);
1776 SC_DLLPUBLIC
void ApplyPattern( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1777 const ScPatternAttr
& rAttr
);
1778 SC_DLLPUBLIC
void ApplyPatternArea( SCCOL nStartCol
, SCROW nStartRow
,
1779 SCCOL nEndCol
, SCROW nEndRow
,
1780 const ScMarkData
& rMark
, const ScPatternAttr
& rAttr
,
1781 ScEditDataArray
* pDataArray
= nullptr,
1782 bool* const pIsChanged
= nullptr );
1783 SC_DLLPUBLIC
void ApplyPatternAreaTab( SCCOL nStartCol
, SCROW nStartRow
,
1784 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nTab
,
1785 const ScPatternAttr
& rAttr
);
1787 SC_DLLPUBLIC
void ApplyPatternIfNumberformatIncompatible( const ScRange
& rRange
,
1788 const ScMarkData
& rMark
,
1789 const ScPatternAttr
& rPattern
,
1790 SvNumFormatType nNewType
);
1792 void ApplyStyle( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1793 const ScStyleSheet
& rStyle
);
1794 void ApplyStyleArea( SCCOL nStartCol
, SCROW nStartRow
,
1795 SCCOL nEndCol
, SCROW nEndRow
,
1796 const ScMarkData
& rMark
, const ScStyleSheet
& rStyle
);
1797 SC_DLLPUBLIC
void ApplyStyleAreaTab( SCCOL nStartCol
, SCROW nStartRow
,
1798 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nTab
,
1799 const ScStyleSheet
& rStyle
);
1801 SC_DLLPUBLIC
void ApplySelectionStyle( const ScStyleSheet
& rStyle
, const ScMarkData
& rMark
);
1802 void ApplySelectionLineStyle( const ScMarkData
& rMark
,
1803 const ::editeng::SvxBorderLine
* pLine
, bool bColorOnly
);
1805 const ScStyleSheet
* GetStyle( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1806 const ScStyleSheet
* GetSelectionStyle( const ScMarkData
& rMark
) const;
1808 void StyleSheetChanged( const SfxStyleSheetBase
* pStyleSheet
, bool bRemoved
,
1810 double nPPTX
, double nPPTY
,
1811 const Fraction
& rZoomX
, const Fraction
& rZoomY
);
1813 bool IsStyleSheetUsed( const ScStyleSheet
& rStyle
) const;
1815 SC_DLLPUBLIC
bool ApplyFlagsTab( SCCOL nStartCol
, SCROW nStartRow
,
1816 SCCOL nEndCol
, SCROW nEndRow
,
1817 SCTAB nTab
, ScMF nFlags
);
1818 SC_DLLPUBLIC
bool RemoveFlagsTab( SCCOL nStartCol
, SCROW nStartRow
,
1819 SCCOL nEndCol
, SCROW nEndRow
,
1820 SCTAB nTab
, ScMF nFlags
);
1822 SC_DLLPUBLIC
void SetPattern( const ScAddress
&, const ScPatternAttr
& rAttr
);
1823 SC_DLLPUBLIC
const ScPatternAttr
* SetPattern( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, std::unique_ptr
<ScPatternAttr
> );
1824 SC_DLLPUBLIC
void SetPattern( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, const ScPatternAttr
& rAttr
);
1826 void AutoFormat( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
1827 sal_uInt16 nFormatNo
, const ScMarkData
& rMark
);
1828 void GetAutoFormatData( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
1829 ScAutoFormatData
& rData
);
1830 bool SearchAndReplace( const SvxSearchItem
& rSearchItem
,
1831 SCCOL
& rCol
, SCROW
& rRow
, SCTAB
& rTab
,
1832 const ScMarkData
& rMark
, ScRangeList
& rMatchedRanges
,
1833 OUString
& rUndoStr
, ScDocument
* pUndoDoc
= nullptr );
1835 // determine Col/Row of subsequent calls
1836 // (e.g. not found from the beginning, or subsequent tables)
1837 // meaning of explanation in "()" was already unclear in German
1838 void GetSearchAndReplaceStart( const SvxSearchItem
& rSearchItem
,
1839 SCCOL
& rCol
, SCROW
& rRow
);
1841 bool Solver( SCCOL nFCol
, SCROW nFRow
, SCTAB nFTab
,
1842 SCCOL nVCol
, SCROW nVRow
, SCTAB nVTab
,
1843 const OUString
& sValStr
, double& nX
);
1845 SC_DLLPUBLIC
void ApplySelectionPattern( const ScPatternAttr
& rAttr
, const ScMarkData
& rMark
,
1846 ScEditDataArray
* pDataArray
= nullptr, bool* pIsChanged
= nullptr );
1847 void DeleteSelection( InsertDeleteFlags nDelFlag
, const ScMarkData
& rMark
, bool bBroadcast
= true );
1848 void DeleteSelectionTab( SCTAB nTab
, InsertDeleteFlags nDelFlag
, const ScMarkData
& rMark
);
1850 SC_DLLPUBLIC
void SetColWidth( SCCOL nCol
, SCTAB nTab
, sal_uInt16 nNewWidth
);
1851 SC_DLLPUBLIC
void SetColWidthOnly( SCCOL nCol
, SCTAB nTab
, sal_uInt16 nNewWidth
);
1852 SC_DLLPUBLIC
void SetRowHeight( SCROW nRow
, SCTAB nTab
, sal_uInt16 nNewHeight
);
1853 SC_DLLPUBLIC
void SetRowHeightRange( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
,
1854 sal_uInt16 nNewHeight
);
1856 SC_DLLPUBLIC
void SetRowHeightOnly( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
,
1857 sal_uInt16 nNewHeight
);
1858 SC_DLLPUBLIC
void SetManualHeight( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, bool bManual
);
1860 SC_DLLPUBLIC sal_uInt16
GetColWidth( SCCOL nCol
, SCTAB nTab
, bool bHiddenAsZero
= true ) const;
1861 SC_DLLPUBLIC sal_uLong
GetColWidth( SCCOL nStartCol
, SCCOL nEndCol
, SCTAB nTab
) const;
1862 SC_DLLPUBLIC sal_uInt16
GetRowHeight( SCROW nRow
, SCTAB nTab
, bool bHiddenAsZero
= true ) const;
1863 SC_DLLPUBLIC sal_uInt16
GetRowHeight( SCROW nRow
, SCTAB nTab
, SCROW
* pStartRow
, SCROW
* pEndRow
) const;
1864 SC_DLLPUBLIC sal_uLong
GetRowHeight( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, bool bHiddenAsZero
= true ) const;
1867 * Given the height i.e. total vertical distance from the top of the sheet
1868 * grid, return the first visible row whose top position is below the
1871 SCROW
GetRowForHeight( SCTAB nTab
, sal_uLong nHeight
) const;
1872 sal_uLong
GetScaledRowHeight( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, double fScale
, const sal_uLong
* pnMaxHeight
= nullptr ) const;
1873 SC_DLLPUBLIC sal_uLong
GetColOffset( SCCOL nCol
, SCTAB nTab
, bool bHiddenAsZero
= true ) const;
1874 SC_DLLPUBLIC sal_uLong
GetRowOffset( SCROW nRow
, SCTAB nTab
, bool bHiddenAsZero
= true ) const;
1876 SC_DLLPUBLIC sal_uInt16
GetOriginalWidth( SCCOL nCol
, SCTAB nTab
) const;
1877 SC_DLLPUBLIC sal_uInt16
GetOriginalHeight( SCROW nRow
, SCTAB nTab
) const;
1879 sal_uInt16
GetCommonWidth( SCCOL nEndCol
, SCTAB nTab
) const;
1881 SCROW
GetHiddenRowCount( SCROW nRow
, SCTAB nTab
) const;
1883 sal_uInt16
GetOptimalColWidth( SCCOL nCol
, SCTAB nTab
, OutputDevice
* pDev
,
1884 double nPPTX
, double nPPTY
,
1885 const Fraction
& rZoomX
, const Fraction
& rZoomY
,
1887 const ScMarkData
* pMarkData
= nullptr,
1888 const ScColWidthParam
* pParam
= nullptr );
1890 SC_DLLPUBLIC
bool SetOptimalHeight( sc::RowHeightContext
& rCxt
, SCROW nStartRow
,
1891 SCROW nEndRow
, SCTAB nTab
);
1893 void UpdateAllRowHeights( sc::RowHeightContext
& rCxt
, const ScMarkData
* pTabMark
);
1895 long GetNeededSize( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1897 double nPPTX
, double nPPTY
,
1898 const Fraction
& rZoomX
, const Fraction
& rZoomY
,
1899 bool bWidth
, bool bTotalSize
= false,
1900 bool bInPrintTwips
= false );
1902 SC_DLLPUBLIC
void ShowCol(SCCOL nCol
, SCTAB nTab
, bool bShow
);
1903 SC_DLLPUBLIC
void ShowRow(SCROW nRow
, SCTAB nTab
, bool bShow
);
1904 SC_DLLPUBLIC
void ShowRows(SCROW nRow1
, SCROW nRow2
, SCTAB nTab
, bool bShow
);
1905 SC_DLLPUBLIC
void SetRowFlags( SCROW nRow
, SCTAB nTab
, CRFlags nNewFlags
);
1906 SC_DLLPUBLIC
void SetRowFlags( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, CRFlags nNewFlags
);
1908 SC_DLLPUBLIC CRFlags
GetColFlags( SCCOL nCol
, SCTAB nTab
) const;
1909 SC_DLLPUBLIC CRFlags
GetRowFlags( SCROW nRow
, SCTAB nTab
) const;
1911 SC_DLLPUBLIC
void GetAllRowBreaks(std::set
<SCROW
>& rBreaks
, SCTAB nTab
, bool bPage
, bool bManual
) const;
1912 SC_DLLPUBLIC
void GetAllColBreaks(std::set
<SCCOL
>& rBreaks
, SCTAB nTab
, bool bPage
, bool bManual
) const;
1913 SC_DLLPUBLIC ScBreakType
HasRowBreak(SCROW nRow
, SCTAB nTab
) const;
1914 SC_DLLPUBLIC ScBreakType
HasColBreak(SCCOL nCol
, SCTAB nTab
) const;
1915 SC_DLLPUBLIC
void SetRowBreak(SCROW nRow
, SCTAB nTab
, bool bPage
, bool bManual
);
1916 SC_DLLPUBLIC
void SetColBreak(SCCOL nCol
, SCTAB nTab
, bool bPage
, bool bManual
);
1917 void RemoveRowBreak(SCROW nRow
, SCTAB nTab
, bool bPage
, bool bManual
);
1918 void RemoveColBreak(SCCOL nCol
, SCTAB nTab
, bool bPage
, bool bManual
);
1920 css::sheet::TablePageBreakData
> GetRowBreakData(SCTAB nTab
) const;
1922 SC_DLLPUBLIC
bool RowHidden(SCROW nRow
, SCTAB nTab
, SCROW
* pFirstRow
= nullptr, SCROW
* pLastRow
= nullptr) const;
1923 SC_DLLPUBLIC
bool HasHiddenRows(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1924 SC_DLLPUBLIC
bool ColHidden(SCCOL nCol
, SCTAB nTab
, SCCOL
* pFirstCol
= nullptr, SCCOL
* pLastCol
= nullptr) const;
1925 SC_DLLPUBLIC
void SetRowHidden(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, bool bHidden
);
1926 SC_DLLPUBLIC
void SetColHidden(SCCOL nStartCol
, SCCOL nEndCol
, SCTAB nTab
, bool bHidden
);
1927 SC_DLLPUBLIC SCROW
FirstVisibleRow(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1928 SC_DLLPUBLIC SCROW
LastVisibleRow(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1929 SCROW
CountVisibleRows(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1931 bool RowFiltered(SCROW nRow
, SCTAB nTab
, SCROW
* pFirstRow
= nullptr, SCROW
* pLastRow
= nullptr) const;
1932 bool HasFilteredRows(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1933 bool ColFiltered(SCCOL nCol
, SCTAB nTab
) const;
1934 SC_DLLPUBLIC
void SetRowFiltered(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, bool bFiltered
);
1935 SCROW
FirstNonFilteredRow(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1936 SCROW
LastNonFilteredRow(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1937 SCROW
CountNonFilteredRows(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1939 SC_DLLPUBLIC
bool IsManualRowHeight(SCROW nRow
, SCTAB nTab
) const;
1941 bool HasUniformRowHeight( SCTAB nTab
, SCROW nRow1
, SCROW nRow2
) const;
1944 * Write all column row flags to table's flag data, because not all column
1945 * row attributes are stored in the flag data members. This is necessary
1948 void SyncColRowFlags();
1950 /// @return the index of the last row with any set flags (auto-pagebreak is ignored).
1951 SC_DLLPUBLIC SCROW
GetLastFlaggedRow( SCTAB nTab
) const;
1953 /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored).
1954 SCCOL
GetLastChangedCol( SCTAB nTab
) const;
1955 /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
1956 SCROW
GetLastChangedRow( SCTAB nTab
) const;
1958 SCCOL
GetNextDifferentChangedCol( SCTAB nTab
, SCCOL nStart
) const;
1960 SCROW
GetNextDifferentChangedRow( SCTAB nTab
, SCROW nStart
) const;
1962 // returns whether to export a Default style for this col or not
1963 // nDefault is set to one position in the current row where the Default style is
1964 void GetColDefault( SCTAB nTab
, SCCOL nCol
, SCROW nLastRow
, SCROW
& nDefault
);
1966 bool UpdateOutlineCol( SCCOL nStartCol
, SCCOL nEndCol
, SCTAB nTab
, bool bShow
);
1967 bool UpdateOutlineRow( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, bool bShow
);
1969 void StripHidden( SCCOL
& rX1
, SCROW
& rY1
, SCCOL
& rX2
, SCROW
& rY2
, SCTAB nTab
);
1970 void ExtendHidden( SCCOL
& rX1
, SCROW
& rY1
, SCCOL
& rX2
, SCROW
& rY2
, SCTAB nTab
);
1972 SC_DLLPUBLIC ScPatternAttr
* GetDefPattern() const;
1973 SC_DLLPUBLIC ScDocumentPool
* GetPool();
1974 SC_DLLPUBLIC ScStyleSheetPool
* GetStyleSheetPool() const;
1975 void GetUnprotectedCells( ScRangeList
& rRange
, SCTAB nTab
) const;
1978 SC_DLLPUBLIC OUString
GetPageStyle( SCTAB nTab
) const;
1979 SC_DLLPUBLIC
void SetPageStyle( SCTAB nTab
, const OUString
& rName
);
1980 Size
GetPageSize( SCTAB nTab
) const;
1981 void SetPageSize( SCTAB nTab
, const Size
& rSize
);
1982 void SetRepeatArea( SCTAB nTab
, SCCOL nStartCol
, SCCOL nEndCol
, SCROW nStartRow
, SCROW nEndRow
);
1983 void InvalidatePageBreaks(SCTAB nTab
);
1984 void UpdatePageBreaks( SCTAB nTab
, const ScRange
* pUserArea
= nullptr );
1985 void RemoveManualBreaks( SCTAB nTab
);
1986 bool HasManualBreaks( SCTAB nTab
) const;
1988 bool IsPageStyleInUse( const OUString
& rStrPageStyle
, SCTAB
* pInTab
);
1989 bool RemovePageStyleInUse( const OUString
& rStrPageStyle
);
1990 bool RenamePageStyleInUse( const OUString
& rOld
, const OUString
& rNew
);
1991 void ModifyStyleSheet( SfxStyleSheetBase
& rPageStyle
,
1992 const SfxItemSet
& rChanges
);
1994 void PageStyleModified( SCTAB nTab
, const OUString
& rNewName
);
1996 SC_DLLPUBLIC
bool NeedPageResetAfterTab( SCTAB nTab
) const;
1998 // Was stored in PageStyle previously. Now it exists for every table:
1999 SC_DLLPUBLIC
bool HasPrintRange();
2000 SC_DLLPUBLIC sal_uInt16
GetPrintRangeCount( SCTAB nTab
);
2001 SC_DLLPUBLIC
const ScRange
* GetPrintRange( SCTAB nTab
, sal_uInt16 nPos
);
2002 SC_DLLPUBLIC
const ScRange
* GetRepeatColRange( SCTAB nTab
);
2003 SC_DLLPUBLIC
const ScRange
* GetRepeatRowRange( SCTAB nTab
);
2004 /** Returns true, if the specified sheet is always printed. */
2005 bool IsPrintEntireSheet( SCTAB nTab
) const;
2007 /** Removes all print ranges. */
2008 SC_DLLPUBLIC
void ClearPrintRanges( SCTAB nTab
);
2009 /** Adds a new print ranges. */
2010 SC_DLLPUBLIC
void AddPrintRange( SCTAB nTab
, const ScRange
& rNew
);
2011 /** Marks the specified sheet to be printed completely. Deletes old print ranges on the sheet! */
2012 SC_DLLPUBLIC
void SetPrintEntireSheet( SCTAB nTab
);
2013 SC_DLLPUBLIC
void SetRepeatColRange( SCTAB nTab
, std::unique_ptr
<ScRange
> pNew
);
2014 SC_DLLPUBLIC
void SetRepeatRowRange( SCTAB nTab
, std::unique_ptr
<ScRange
> pNew
);
2015 std::unique_ptr
<ScPrintRangeSaver
> CreatePrintRangeSaver() const;
2016 void RestorePrintRanges( const ScPrintRangeSaver
& rSaver
);
2018 SC_DLLPUBLIC
tools::Rectangle
GetMMRect( SCCOL nStartCol
, SCROW nStartRow
,
2019 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nTab
, bool bHiddenAsZero
= true ) const;
2020 SC_DLLPUBLIC ScRange
GetRange( SCTAB nTab
, const tools::Rectangle
& rMMRect
, bool bHiddenAsZero
= true ) const;
2022 void UpdStlShtPtrsFrmNms();
2023 void StylesToNames();
2025 SC_DLLPUBLIC
void CopyStdStylesFrom( const ScDocument
* pSrcDoc
);
2027 static sal_uInt16
GetSrcVersion() { return nSrcVer
; }
2029 void SetSrcCharSet( rtl_TextEncoding eNew
) { eSrcSet
= eNew
; }
2030 void UpdateFontCharSet();
2032 void FillInfo( ScTableInfo
& rTabInfo
, SCCOL nCol1
, SCROW nRow1
,
2033 SCCOL nCol2
, SCROW nRow2
, SCTAB nTab
, double fColScale
,
2034 double fRowScale
, bool bPageMode
, bool bFormulaMode
,
2035 const ScMarkData
* pMarkData
= nullptr );
2037 SC_DLLPUBLIC SvNumberFormatter
* GetFormatTable() const;
2039 /** Sort a range of data. */
2040 void Sort( SCTAB nTab
, const ScSortParam
& rSortParam
,
2041 bool bKeepQuery
, bool bUpdateRefs
,
2042 ScProgress
* pProgress
, sc::ReorderParam
* pUndo
);
2044 void Reorder( const sc::ReorderParam
& rParam
);
2046 SCSIZE
Query( SCTAB nTab
, const ScQueryParam
& rQueryParam
, bool bKeepSub
);
2047 SC_DLLPUBLIC
bool CreateQueryParam( const ScRange
& rRange
, ScQueryParam
& rQueryParam
);
2048 void GetUpperCellString(SCCOL nCol
, SCROW nRow
, SCTAB nTab
, OUString
& rStr
);
2051 * Get a list of unique strings to use in filtering criteria. The string
2052 * values are sorted, and there are no duplicate values in the list. The
2053 * data range to use to populate the filter entries is inferred from the
2054 * database range that contains the specified cell position.
2056 void GetFilterEntries( SCCOL nCol
, SCROW nRow
,
2057 SCTAB nTab
, ScFilterEntries
& rFilterEntries
);
2059 SC_DLLPUBLIC
void GetFilterEntriesArea( SCCOL nCol
, SCROW nStartRow
, SCROW nEndRow
,
2060 SCTAB nTab
, bool bCaseSens
,
2061 ScFilterEntries
& rFilterEntries
);
2063 void GetDataEntries( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
2064 std::vector
<ScTypedStrData
>& rStrings
, bool bLimit
= false );
2065 void GetFormulaEntries( ScTypedCaseStrSet
& rStrings
);
2067 bool HasAutoFilter( SCCOL nCol
, SCROW nRow
, SCTAB nTab
);
2068 void GetFilterSelCount( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, SCSIZE
& nSelected
, SCSIZE
& nTotal
);
2070 SC_DLLPUBLIC
bool HasColHeader( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
2072 SC_DLLPUBLIC
bool HasRowHeader( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
2075 SfxPrinter
* GetPrinter( bool bCreateIfNotExist
= true );
2076 void SetPrinter( VclPtr
<SfxPrinter
> const & pNewPrinter
);
2077 VirtualDevice
* GetVirtualDevice_100th_mm();
2078 SC_DLLPUBLIC OutputDevice
* GetRefDevice(); // WYSIWYG: Printer, otherwise VirtualDevice...
2080 bool GetNextSpellingCell( SCCOL
& nCol
, SCROW
& nRow
, SCTAB nTab
,
2081 bool bInSel
, const ScMarkData
& rMark
) const;
2083 void ReplaceStyle( const SvxSearchItem
& rSearchItem
,
2084 SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
2085 const ScMarkData
& rMark
);
2087 void InvalidateTextWidth( const OUString
& rStyleName
);
2088 void InvalidateTextWidth( SCTAB nTab
);
2089 void InvalidateTextWidth( const ScAddress
* pAdrFrom
, const ScAddress
* pAdrTo
, bool bNumFormatChanged
);
2091 bool IdleCalcTextWidth();
2093 void RepaintRange( const ScRange
& rRange
);
2094 void RepaintRange( const ScRangeList
& rRange
);
2096 bool IsIdleEnabled() const { return mbIdleEnabled
; }
2097 void EnableIdle(bool bDo
) { mbIdleEnabled
= bDo
; }
2099 bool IsDetectiveDirty() const { return bDetectiveDirty
; }
2100 void SetDetectiveDirty(bool bSet
) { bDetectiveDirty
= bSet
; }
2102 bool HasLinkFormulaNeedingCheck() const { return bLinkFormulaNeedingCheck
; }
2103 void SetLinkFormulaNeedingCheck(bool bSet
) { bLinkFormulaNeedingCheck
= bSet
; }
2104 /** Check token array and set link check if ocDde/ocWebservice is contained. */
2105 SC_DLLPUBLIC
void CheckLinkFormulaNeedingCheck( const ScTokenArray
& rCode
);
2107 void SetRangeOverflowType(ErrCode nType
) { nRangeOverflowType
= nType
; }
2108 bool HasRangeOverflow() const { return nRangeOverflowType
!= ERRCODE_NONE
; }
2109 SC_DLLPUBLIC
const ErrCode
& GetRangeOverflowType() const { return nRangeOverflowType
; }
2111 // for broadcasting/listening
2112 void SetInsertingFromOtherDoc( bool bVal
) { bInsertingFromOtherDoc
= bVal
; }
2113 bool IsInsertingFromOtherDoc() const { return bInsertingFromOtherDoc
; }
2114 void SetLoadingMedium( bool bVal
);
2115 SC_DLLPUBLIC
void SetImportingXML( bool bVal
);
2116 bool IsImportingXML() const { return bImportingXML
; }
2117 bool IsCalcingAfterLoad() const { return bCalcingAfterLoad
; }
2118 void SetNoListening( bool bVal
) { bNoListening
= bVal
; }
2119 bool GetNoListening() const { return bNoListening
; }
2120 ScBroadcastAreaSlotMachine
* GetBASM() const { return pBASM
.get(); }
2122 SC_DLLPUBLIC ScChartListenerCollection
* GetChartListenerCollection() const { return pChartListenerCollection
.get(); }
2123 void SetChartListenerCollection( std::unique_ptr
<ScChartListenerCollection
>,
2124 bool bSetChartRangeLists
);
2125 void UpdateChart( const OUString
& rName
);
2126 void RestoreChartListener( const OUString
& rName
);
2127 SC_DLLPUBLIC
void UpdateChartListenerCollection();
2128 bool IsChartListenerCollectionNeedsUpdate() const { return bChartListenerCollectionNeedsUpdate
; }
2129 void SetChartListenerCollectionNeedsUpdate( bool bFlg
) { bChartListenerCollectionNeedsUpdate
= bFlg
; }
2130 void AddOLEObjectToCollection(const OUString
& rName
);
2132 ScChangeViewSettings
* GetChangeViewSettings() const { return pChangeViewSettings
.get(); }
2133 SC_DLLPUBLIC
void SetChangeViewSettings(const ScChangeViewSettings
& rNew
);
2135 const std::shared_ptr
<SvxForbiddenCharactersTable
>& GetForbiddenCharacters() const;
2136 void SetForbiddenCharacters(const std::shared_ptr
<SvxForbiddenCharactersTable
>& rNew
);
2138 CharCompressType
GetAsianCompression() const;
2139 bool IsValidAsianCompression() const;
2140 void SetAsianCompression(CharCompressType nNew
);
2142 bool GetAsianKerning() const;
2143 bool IsValidAsianKerning() const;
2144 void SetAsianKerning(bool bNew
);
2145 void ApplyAsianEditSettings(ScEditEngineDefaulter
& rEngine
);
2147 EEHorizontalTextDirection
GetEditTextDirection(SCTAB nTab
) const; // EEHorizontalTextDirection values
2149 SC_DLLPUBLIC ScLkUpdMode
GetLinkMode() const { return eLinkMode
;}
2150 void SetLinkMode( ScLkUpdMode nSet
) { eLinkMode
= nSet
;}
2152 SC_DLLPUBLIC ScMacroManager
* GetMacroManager();
2154 void FillMatrix( ScMatrix
& rMat
, SCTAB nTab
, SCCOL nCol1
,
2155 SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
2156 svl::SharedStringPool
* pPool
= nullptr) const;
2159 * Set an array of numerical formula results to a group of contiguous
2162 * @param rTopPos position of the top formula cell of a group.
2163 * @param pResults array of numeric results.
2164 * @param nLen length of numeric results.
2166 void SC_DLLPUBLIC
SetFormulaResults( const ScAddress
& rTopPos
, const double* pResults
, size_t nLen
);
2168 const ScDocumentThreadSpecific
& CalculateInColumnInThread( ScInterpreterContext
& rContext
, const ScRange
& rCalcRange
, unsigned nThisThread
, unsigned nThreadsTotal
);
2169 void HandleStuffAfterParallelCalculation( SCCOL nColStart
, SCCOL nColEnd
, SCROW nRow
, size_t nLen
, SCTAB nTab
, ScInterpreter
* pInterpreter
);
2172 * Transfer a series of contiguous cell values from specified position to
2173 * the passed container. The specified segment will become empty after the
2176 void TransferCellValuesTo( const ScAddress
& rTopPos
, size_t nLen
, sc::CellValues
& rDest
);
2177 void CopyCellValuesFrom( const ScAddress
& rTopPos
, const sc::CellValues
& rSrc
);
2179 std::set
<Color
> GetDocColors();
2180 sc::IconSetBitmapMap
& GetIconSetBitmapMap();
2183 ScDocument(const ScDocument
& r
) = delete;
2185 void FindMaxRotCol( SCTAB nTab
, RowInfo
* pRowInfo
, SCSIZE nArrCount
,
2186 SCCOL nX1
, SCCOL nX2
) const;
2188 sal_uInt16
RowDifferences( SCROW nThisRow
, SCTAB nThisTab
,
2189 ScDocument
& rOtherDoc
,
2190 SCROW nOtherRow
, SCTAB nOtherTab
,
2191 SCCOL nMaxCol
, const SCCOLROW
* pOtherCols
);
2192 sal_uInt16
ColDifferences( SCCOL nThisCol
, SCTAB nThisTab
,
2193 ScDocument
& rOtherDoc
,
2194 SCCOL nOtherCol
, SCTAB nOtherTab
,
2195 SCROW nMaxRow
, const SCCOLROW
* pOtherRows
);
2196 void FindOrder( SCCOLROW
* pOtherRows
, SCCOLROW nThisEndRow
, SCCOLROW nOtherEndRow
,
2198 ScDocument
& rOtherDoc
, SCTAB nThisTab
, SCTAB nOtherTab
,
2199 SCCOLROW nEndCol
, const SCCOLROW
* pTranslate
,
2200 ScProgress
* pProgress
, sal_uLong nProAdd
);
2202 DECL_LINK(TrackTimeHdl
, Timer
*, void);
2204 static ScRecursionHelper
* CreateRecursionHelperInstance();
2206 /** Adjust a range to available sheets.
2208 Used to start and stop listening on a sane range. Both o_rRange and
2209 o_bEntirelyOutOfBounds are set only if needed and don't have to be
2210 initialized by the caller.
2212 @param o_bEntirelyOutOfBounds
2213 <TRUE/> if both sheets in the range point outside the
2214 available sheet range, in which case no adjustment is done and
2215 o_rRange is not modified.
2217 @return <TRUE/> if any adjustment was done or o_bEntirelyOutOfBounds
2219 <FALSE/> if rRange was within the available sheets.
2221 bool LimitRangeToAvailableSheets( const ScRange
& rRange
, ScRange
& o_rRange
,
2222 bool& o_bEntirelyOutOfBounds
) const;
2225 void StartListeningArea( const ScRange
& rRange
, bool bGroupListening
, SvtListener
* pListener
);
2227 void EndListeningArea( const ScRange
& rRange
, bool bGroupListening
, SvtListener
* pListener
);
2228 /** Broadcast wrapper, calls
2229 rHint.GetCell()->Broadcast() and AreaBroadcast()
2233 void Broadcast( const ScHint
& rHint
);
2235 void BroadcastCells( const ScRange
& rRange
, SfxHintId nHint
, bool bBroadcastSingleBroadcasters
= true );
2237 /// only area, no cell broadcast
2238 void AreaBroadcast( const ScHint
& rHint
);
2239 void DelBroadcastAreasInRange( const ScRange
& rRange
);
2240 void UpdateBroadcastAreas( UpdateRefMode eUpdateRefMode
,
2241 const ScRange
& rRange
,
2242 SCCOL nDx
, SCROW nDy
, SCTAB nDz
);
2244 void StartListeningCell( const ScAddress
& rAddress
,
2245 SvtListener
* pListener
);
2246 void EndListeningCell( const ScAddress
& rAddress
,
2247 SvtListener
* pListener
);
2249 void StartListeningCell( sc::StartListeningContext
& rCxt
, const ScAddress
& rPos
, SvtListener
& rListener
);
2250 void EndListeningCell( sc::EndListeningContext
& rCxt
, const ScAddress
& rPos
, SvtListener
& rListener
);
2252 void EndListeningFormulaCells( std::vector
<ScFormulaCell
*>& rCells
);
2254 void PutInFormulaTree( ScFormulaCell
* pCell
);
2255 void RemoveFromFormulaTree( ScFormulaCell
* pCell
);
2258 * Calculate formula cells that are on the formula tree either partially,
2261 * @param bOnlyForced when true, it only calculates those formula cells
2262 * that are marked "recalc forced".
2263 * @param bProgressBar whether or not to use progress bar.
2264 * @param bSetAllDirty when true, it marks all formula cells currently on
2265 * the formula tree dirty, which forces all of them to
2266 * be recalculated. When false, only those cells
2267 * that are marked dirty prior to this call get
2270 SC_DLLPUBLIC
void CalcFormulaTree( bool bOnlyForced
= false, bool bProgressBar
= true, bool bSetAllDirty
= true );
2271 void ClearFormulaTree();
2272 void AppendToFormulaTrack( ScFormulaCell
* pCell
);
2273 void RemoveFromFormulaTrack( ScFormulaCell
* pCell
);
2274 void TrackFormulas( SfxHintId nHintId
= SfxHintId::ScDataChanged
);
2275 void SetTrackFormulasPending() { mbTrackFormulasPending
= true; }
2276 bool IsTrackFormulasPending() const { return mbTrackFormulasPending
; }
2277 void FinalTrackFormulas( SfxHintId nHintId
);
2278 bool IsFinalTrackFormulas() const { return mbFinalTrackFormulas
; }
2279 bool IsInFormulaTree( const ScFormulaCell
* pCell
) const;
2280 bool IsInFormulaTrack( const ScFormulaCell
* pCell
) const;
2281 HardRecalcState
GetHardRecalcState() const { return eHardRecalcState
; }
2282 void SetHardRecalcState( HardRecalcState eVal
) { eHardRecalcState
= eVal
; }
2283 void StartAllListeners();
2284 void StartNeededListeners();
2285 void StartNeededListeners( const std::shared_ptr
<const sc::ColumnSet
>& rpColSet
);
2286 void StartAllListeners( const ScRange
& rRange
);
2288 void SetForcedFormulas( bool bVal
) { bHasForcedFormulas
= bVal
; }
2289 sal_uLong
GetFormulaCodeInTree() const { return nFormulaCodeInTree
; }
2291 bool IsInInterpreter() const { return nInterpretLevel
!= 0; }
2293 void IncInterpretLevel()
2295 assert(!IsThreadedGroupCalcInProgress());
2296 if ( nInterpretLevel
< USHRT_MAX
)
2299 void DecInterpretLevel()
2301 assert(!IsThreadedGroupCalcInProgress());
2302 if ( nInterpretLevel
)
2305 sal_uInt16
GetMacroInterpretLevel() const { return nMacroInterpretLevel
; }
2306 void IncMacroInterpretLevel()
2308 assert(!IsThreadedGroupCalcInProgress());
2309 if ( nMacroInterpretLevel
< USHRT_MAX
)
2310 nMacroInterpretLevel
++;
2312 void DecMacroInterpretLevel()
2314 assert(!IsThreadedGroupCalcInProgress());
2315 if ( nMacroInterpretLevel
)
2316 nMacroInterpretLevel
--;
2318 bool IsInInterpreterTableOp() const { return nInterpreterTableOpLevel
!= 0; }
2319 void IncInterpreterTableOpLevel()
2321 if ( nInterpreterTableOpLevel
< USHRT_MAX
)
2322 nInterpreterTableOpLevel
++;
2324 void DecInterpreterTableOpLevel()
2326 if ( nInterpreterTableOpLevel
)
2327 nInterpreterTableOpLevel
--;
2330 // add a formula to be remembered for TableOp broadcasts
2331 void AddTableOpFormulaCell( ScFormulaCell
* );
2332 void InvalidateLastTableOpParams() { aLastTableOpParams
.bValid
= false; }
2333 ScRecursionHelper
& GetRecursionHelper();
2334 bool IsInDtorClear() const { return bInDtorClear
; }
2335 void SetExpandRefs( bool bVal
);
2336 bool IsExpandRefs() const { return bExpandRefs
; }
2338 sal_uLong
GetXMLImportedFormulaCount() const { return nXMLImportedFormulaCount
; }
2339 void IncXMLImportedFormulaCount( sal_uLong nVal
)
2341 if ( nXMLImportedFormulaCount
+ nVal
> nXMLImportedFormulaCount
)
2342 nXMLImportedFormulaCount
+= nVal
;
2344 void DecXMLImportedFormulaCount( sal_uLong nVal
)
2346 if ( nVal
<= nXMLImportedFormulaCount
)
2347 nXMLImportedFormulaCount
-= nVal
;
2349 nXMLImportedFormulaCount
= 0;
2352 void StartTrackTimer();
2354 void CompileDBFormula();
2355 void CompileColRowNameFormula();
2357 /** Maximum string length of a column, e.g. for dBase export.
2358 @return String length in octets (!) of the destination encoding. In
2359 case of non-octet encodings (e.g. UCS2) the length in code
2360 points times sizeof(sal_Unicode) is returned. */
2361 sal_Int32
GetMaxStringLen( SCTAB nTab
, SCCOL nCol
,
2362 SCROW nRowStart
, SCROW nRowEnd
,
2363 rtl_TextEncoding eCharSet
) const;
2364 /** Maximum string length of numerical cells of a column, e.g. for dBase export.
2365 @return String length in characters (!) including the decimal
2366 separator, and the decimal precision needed. */
2367 sal_Int32
GetMaxNumberStringLen( sal_uInt16
& nPrecision
,
2368 SCTAB nTab
, SCCOL nCol
,
2369 SCROW nRowStart
, SCROW nRowEnd
) const;
2371 void KeyInput(); // TimerDelays etc.
2373 ScChangeTrack
* GetChangeTrack() const { return pChangeTrack
.get(); }
2375 //! only for import filter, deletes any existing ChangeTrack via
2376 //! EndChangeTracking() and takes ownership of new ChangeTrack pTrack
2377 SC_DLLPUBLIC
void SetChangeTrack( std::unique_ptr
<ScChangeTrack
> pTrack
);
2379 void StartChangeTracking();
2380 void EndChangeTracking();
2382 SC_DLLPUBLIC
void CompareDocument( ScDocument
& rOtherDoc
);
2384 void AddUnoObject( SfxListener
& rObject
);
2385 void RemoveUnoObject( SfxListener
& rObject
);
2386 void BroadcastUno( const SfxHint
&rHint
);
2387 void AddUnoListenerCall( const css::uno::Reference
<
2388 css::util::XModifyListener
>& rListener
,
2389 const css::lang::EventObject
& rEvent
);
2391 void SetInLinkUpdate(bool bSet
); // TableLink or AreaLink
2392 bool IsInLinkUpdate() const; // including DdeLink
2394 SC_DLLPUBLIC SfxItemPool
* GetEditPool() const;
2395 SC_DLLPUBLIC SfxItemPool
* GetEnginePool() const;
2396 SC_DLLPUBLIC ScFieldEditEngine
& GetEditEngine();
2397 SC_DLLPUBLIC ScNoteEditEngine
& GetNoteEngine();
2399 std::unique_ptr
<ScRefreshTimerControl
> const & GetRefreshTimerControlAddress() const
2400 { return pRefreshTimerControl
; }
2402 void SetPastingDrawFromOtherDoc( bool bVal
)
2403 { bPastingDrawFromOtherDoc
= bVal
; }
2404 bool PastingDrawFromOtherDoc() const
2405 { return bPastingDrawFromOtherDoc
; }
2407 /// an ID unique to each document instance
2408 sal_uInt32
GetDocumentID() const;
2410 void InvalidateStyleSheetUsage() { bStyleSheetUsageInvalid
= true; }
2411 void SC_DLLPUBLIC
GetSortParam( ScSortParam
& rParam
, SCTAB nTab
);
2412 void SC_DLLPUBLIC
SetSortParam( const ScSortParam
& rParam
, SCTAB nTab
);
2414 void SetVbaEventProcessor( const css::uno::Reference
< css::script::vba::XVBAEventProcessor
>& rxVbaEvents
)
2415 { mxVbaEvents
= rxVbaEvents
; }
2416 const css::uno::Reference
< css::script::vba::XVBAEventProcessor
>& GetVbaEventProcessor() const { return mxVbaEvents
; }
2418 /** Should only be GRAM_PODF or GRAM_ODFF. */
2419 void SetStorageGrammar( formula::FormulaGrammar::Grammar eGrammar
);
2420 formula::FormulaGrammar::Grammar
GetStorageGrammar() const { return eStorageGrammar
; }
2422 SC_DLLPUBLIC SfxUndoManager
* GetUndoManager();
2423 bool IsInVBAMode() const;
2424 ScRowBreakIterator
* GetRowBreakIterator(SCTAB nTab
) const;
2426 void AddSubTotalCell(ScFormulaCell
* pCell
);
2427 void RemoveSubTotalCell(ScFormulaCell
* pCell
);
2428 void SetSubTotalCellsDirty(const ScRange
& rDirtyRange
);
2430 sal_uInt16
GetTextWidth( const ScAddress
& rPos
) const;
2432 SvtScriptType
GetScriptType( const ScAddress
& rPos
) const;
2433 void SetScriptType( const ScAddress
& rPos
, SvtScriptType nType
);
2434 void UpdateScriptTypes( const ScAddress
& rPos
, SCCOL nColSize
, SCROW nRowSize
);
2436 size_t GetFormulaHash( const ScAddress
& rPos
) const;
2439 * Make specified formula cells non-grouped.
2441 * @param nTab sheet index
2442 * @param nCol column index
2443 * @param rRows list of row indices at which formula cells are to be
2444 * unshared. This call sorts the passed row indices and
2445 * removes duplicates, which is why the caller must pass it
2448 void UnshareFormulaCells( SCTAB nTab
, SCCOL nCol
, std::vector
<SCROW
>& rRows
);
2449 void RegroupFormulaCells( SCTAB nTab
, SCCOL nCol
);
2450 void RegroupFormulaCells( const ScRange
& range
);
2452 ScFormulaVectorState
GetFormulaVectorState( const ScAddress
& rPos
) const;
2454 formula::FormulaTokenRef
ResolveStaticReference( const ScAddress
& rPos
);
2455 formula::FormulaTokenRef
ResolveStaticReference( const ScRange
& rRange
);
2457 formula::VectorRefArray
FetchVectorRefArray( const ScAddress
& rPos
, SCROW nLength
);
2458 bool HandleRefArrayForParallelism( const ScAddress
& rPos
, SCROW nLength
, const ScFormulaCellGroupRef
& mxGroup
);
2460 void AssertNoInterpretNeeded( const ScAddress
& rPos
, SCROW nLength
);
2464 * Call this before any operations that might trigger one or more formula
2465 * cells to get calculated.
2467 void PrepareFormulaCalc();
2470 * Make sure all of the formula cells in the specified range have been
2471 * fully calculated. This method only re-calculates those formula cells
2472 * that have been flagged dirty. In case of formula-groups, this calculates
2473 * only the dirty subspans along with the dependents in the same way
2476 * @param rRange range in which to potentially calculate the formula
2478 * @param bSkipRunning flag to skip evaluation of formula-cells that are
2479 * marked as already being evaluated.
2480 * @return true if at least one formula-cell in the specified range was dirty
2481 * else returns false.
2483 SC_DLLPUBLIC
bool EnsureFormulaCellResults( const ScRange
& rRange
, bool bSkipRunning
= false );
2485 SvtBroadcaster
* GetBroadcaster( const ScAddress
& rPos
);
2486 const SvtBroadcaster
* GetBroadcaster( const ScAddress
& rPos
) const;
2487 void DeleteBroadcasters( sc::ColumnBlockPosition
& rBlockPos
, const ScAddress
& rTopPos
, SCROW nLength
);
2489 std::unique_ptr
<sc::ColumnIterator
> GetColumnIterator( SCTAB nTab
, SCCOL nCol
, SCROW nRow1
, SCROW nRow2
) const;
2490 void CreateColumnIfNotExists( SCTAB nTab
, SCCOL nCol
);
2492 SC_DLLPUBLIC
void StoreTabToCache(SCTAB nTab
, SvStream
& rStrm
) const;
2493 SC_DLLPUBLIC
void RestoreTabFromCache(SCTAB nTab
, SvStream
& rStream
);
2495 #if DUMP_COLUMN_STORAGE
2496 SC_DLLPUBLIC
void DumpColumnStorage( SCTAB nTab
, SCCOL nCol
) const;
2499 #if DEBUG_AREA_BROADCASTER
2500 SC_DLLPUBLIC
void DumpAreaBroadcasters() const;
2503 SC_DLLPUBLIC
void SetCalcConfig( const ScCalcConfig
& rConfig
);
2504 const ScCalcConfig
& GetCalcConfig() const { return maCalcConfig
; }
2505 void ConvertFormulaToValue( const ScRange
& rRange
, sc::TableValues
* pUndo
);
2506 void SwapNonEmpty( sc::TableValues
& rValues
);
2507 void finalizeOutlineImport();
2508 bool TableExists( SCTAB nTab
) const;
2510 SC_DLLPUBLIC ScColumnsRange
GetColumnsRange(SCTAB nTab
, SCCOL nColBegin
, SCCOL nColEnd
) const;
2512 bool IsInDocShellRecalc() const { return mbDocShellRecalc
; }
2513 void SetDocShellRecalc(bool bSet
) { mbDocShellRecalc
= bSet
; }
2516 * Serializes the specified sheet's geometry data.
2518 * @param nTab is the index of the sheet to operate on.
2519 * @param bColumns - if true it dumps the data for columns, else it does for rows.
2520 * @param eGeomType indicates the type of data to be dumped for rows/columns.
2521 * @return the serialization of the specified sheet's geometry data as an OString.
2523 OString
dumpSheetGeomData(SCTAB nTab
, bool bColumns
, SheetGeomType eGeomType
);
2525 SCCOL
GetLOKFreezeCol(SCTAB nTab
) const;
2526 SCROW
GetLOKFreezeRow(SCTAB nTab
) const;
2527 bool SetLOKFreezeCol(SCCOL nFreezeCol
, SCTAB nTab
);
2528 bool SetLOKFreezeRow(SCROW nFreezeRow
, SCTAB nTab
);
2533 * Use this class as a locale variable to merge number formatter from
2534 * another document, and set NULL pointer to pFormatExchangeList when
2537 class NumFmtMergeHandler
2540 explicit NumFmtMergeHandler(ScDocument
* pDoc
, const ScDocument
* pSrcDoc
);
2541 ~NumFmtMergeHandler();
2547 ScTable
* FetchTable( SCTAB nTab
);
2548 const ScTable
* FetchTable( SCTAB nTab
) const;
2550 void MergeNumberFormatter(const ScDocument
* pSrcDoc
);
2552 void ImplCreateOptions(); // Suggestion: switch to on-demand?
2553 void ImplDeleteOptions();
2555 void DeleteDrawLayer();
2556 SC_DLLPUBLIC
bool DrawGetPrintArea( ScRange
& rRange
, bool bSetHor
, bool bSetVer
) const;
2558 void UpdateDrawPrinter();
2559 void UpdateDrawLanguages();
2560 SC_DLLPUBLIC
void InitClipPtrs( ScDocument
* pSourceDoc
);
2562 void LoadDdeLinks(SvStream
& rStream
);
2563 void SaveDdeLinks(SvStream
& rStream
) const;
2565 void DeleteAreaLinksOnTab( SCTAB nTab
);
2566 void UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode
,
2567 const ScRange
& r
, SCCOL nDx
, SCROW nDy
, SCTAB nDz
);
2569 void CopyRangeNamesToClip(ScDocument
* pClipDoc
, const ScRange
& rClipRange
, const ScMarkData
* pMarks
);
2571 bool HasPartOfMerged( const ScRange
& rRange
);
2573 ScRefCellValue
GetRefCellValue( const ScAddress
& rPos
);
2574 ScRefCellValue
GetRefCellValue( const ScAddress
& rPos
, sc::ColumnBlockPosition
& rBlockPos
);
2576 std::map
< SCTAB
, ScSortParam
> mSheetSortParams
;
2578 SCSIZE
GetPatternCount( SCTAB nTab
, SCCOL nCol
) const;
2579 SCSIZE
GetPatternCount( SCTAB nTab
, SCCOL nCol
, SCROW nRow1
, SCROW nRow2
) const;
2580 void ReservePatternCount( SCTAB nTab
, SCCOL nCol
, SCSIZE nReserve
);
2582 void SharePooledResources( const ScDocument
* pSrcDoc
);
2584 void EndListeningIntersectedGroup(
2585 sc::EndListeningContext
& rCxt
, const ScAddress
& rPos
, std::vector
<ScAddress
>* pGroupPos
);
2587 void EndListeningIntersectedGroups(
2588 sc::EndListeningContext
& rCxt
, const ScRange
& rRange
, std::vector
<ScAddress
>* pGroupPos
);
2590 void EndListeningGroups( const std::vector
<ScAddress
>& rPosArray
);
2591 void SetNeedsListeningGroups( const std::vector
<ScAddress
>& rPosArray
);
2594 typedef std::unique_ptr
<ScDocument
, o3tl::default_delete
<ScDocument
>> ScDocumentUniquePtr
;
2597 * Instantiate this to ensure that subsequent modification of
2598 * the document will cause an assertion failure while this is
2601 struct ScMutationDisable
2603 ScMutationDisable(ScDocument
* pDocument
, ScMutationGuardFlags nFlags
)
2606 mpDocument
= pDocument
;
2607 mnFlagRestore
= pDocument
->mnMutationGuardFlags
;
2608 assert((mnFlagRestore
& nFlags
) == 0);
2609 mpDocument
->mnMutationGuardFlags
|= static_cast<size_t>(nFlags
);
2611 (void)pDocument
; (void)nFlags
;
2615 ~ScMutationDisable()
2617 mpDocument
->mnMutationGuardFlags
= mnFlagRestore
;
2619 size_t mnFlagRestore
;
2620 ScDocument
* mpDocument
;
2625 * A pretty assertion that checks that the relevant bits in
2626 * the @nFlags are not set on the document at entry and exit.
2628 * Its primary use is for debugging threading. As such, an
2629 * @ScMutationDisable is created to forbid mutation, and this
2630 * condition is then asserted on at prominent sites that
2633 struct ScMutationGuard
2635 ScMutationGuard(ScDocument
* pDocument
, ScMutationGuardFlags nFlags
)
2638 mpDocument
= pDocument
;
2639 mnFlags
= static_cast<size_t>(nFlags
);
2640 assert((mpDocument
->mnMutationGuardFlags
& mnFlags
) == 0);
2642 (void)pDocument
; (void)nFlags
;
2648 assert((mpDocument
->mnMutationGuardFlags
& mnFlags
) == 0);
2651 ScDocument
* mpDocument
;
2656 class ScDocShellRecalcGuard
2661 ScDocShellRecalcGuard(ScDocument
& rDoc
)
2664 assert(!mrDoc
.IsInDocShellRecalc());
2665 mrDoc
.SetDocShellRecalc(true);
2668 ~ScDocShellRecalcGuard()
2670 mrDoc
.SetDocShellRecalc(false);
2676 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */