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 "sheetlimits.hxx"
40 #include <o3tl/deleter.hxx>
41 #include <o3tl/sorted_vector.hxx>
42 #include <svl/hint.hxx>
43 #include <svl/typedwhich.hxx>
44 #include <svl/zforlist.hxx>
45 #include <tools/gen.hxx>
46 #include <tools/solar.h>
52 #include <unordered_map>
55 #include "markdata.hxx"
56 #include "drwlayer.hxx"
58 namespace com::sun::star::chart2
{ class XChartDocument
; }
62 enum class SvtScriptType
;
64 enum class FormulaError
: sal_uInt16
;
65 enum class CharCompressType
;
66 enum class EEHorizontalTextDirection
;
67 namespace editeng
{ class SvxBorderLine
; }
68 namespace formula
{ struct VectorRefArray
; }
72 class SharedStringPool
;
78 struct FormulaGroupContext
;
79 class StartListeningContext
;
80 class EndListeningContext
;
81 class CopyFromClipContext
;
83 class RangeColumnSpanSet
;
84 struct ColumnBlockPosition
;
85 struct RefUpdateContext
;
86 class EditTextIterator
;
88 class DocumentStreamAccess
;
89 class DocumentLinkManager
;
92 class RowHeightContext
;
93 struct SetFormulaDirtyContext
;
96 class FormulaGroupAreaListener
;
98 class UpdatedRangeNames
;
99 class TableColumnBlockPositionSet
;
100 class ColumnIterator
;
101 class ExternalDataMapper
;
109 class SfxBroadcaster
;
112 class SfxObjectShell
;
117 class SfxStyleSheetBase
;
118 class SvMemoryStream
;
119 class SvxBoxInfoItem
;
121 class SvxForbiddenCharactersTable
;
126 namespace vcl
{ class Window
; }
129 class ScAutoFormatData
;
130 class ScBroadcastAreaSlotMachine
;
131 class ScChangeViewSettings
;
132 class ScChartListenerCollection
;
135 class ScConditionalFormat
;
136 class ScConditionalFormatList
;
137 class ScDBCollection
;
142 class ScDocProtection
;
143 class ScDocumentPool
;
145 class ScExtDocOptions
;
146 class ScExternalRefManager
;
148 class ScMacroManager
;
149 class ScOutlineTable
;
150 class ScPrintRangeSaver
;
152 class ScStyleSheetPool
;
154 class ScTableProtection
;
156 class ScValidationData
;
157 class ScValidationDataList
;
160 class ScEditEngineDefaulter
;
161 class ScFieldEditEngine
;
162 class ScNoteEditEngine
;
164 class ScDPCollection
;
166 class ScScriptTypeData
;
169 class ScRefreshTimerControl
;
170 class ScUnoListenerCalls
;
172 class ScRecursionHelper
;
177 class ScAutoNameCache
;
178 class ScTemporaryChartLock
;
180 struct ScLookupCacheMap
;
181 class SfxUndoManager
;
182 class ScFormulaParserPool
;
184 class ScRowBreakIterator
;
185 struct ScSetStringParam
;
186 struct ScColWidthParam
;
190 class ScEditDataArray
;
191 class EditTextObject
;
192 struct ScRefCellValue
;
194 struct ScSubTotalParam
;
197 class SvtBroadcaster
;
198 enum class ScDBDataPortion
;
199 enum class ScSheetEventId
;
201 class ScColumnsRange
;
202 struct ScFilterEntries
;
203 typedef o3tl::sorted_vector
<sal_uInt32
> ScCondFormatIndexes
;
204 struct ScSheetLimits
;
208 typedef std::map
<OUString
, BitmapEx
> IconSetBitmapMap
;
212 namespace com::sun::star
{
217 class XBreakIterator
;
220 class XModifyListener
;
223 class XEmbeddedObject
;
225 namespace script::vba
{
226 class XVBAEventProcessor
;
229 struct TablePageBreakData
;
239 #define SC_DOC_NEW 0xFFFF
241 #define SC_MACROCALL_ALLOWED 0
243 #define SC_ASIANKERNING_INVALID 0xff
250 SCDOCMODE_FUNCTIONACCESS
253 enum CommentCaptionState
255 ALLSHOWN
, // All comments captions are shown
256 ALLHIDDEN
, // All comments captions are hidden
257 MIXED
// There are comments in shown and hidden.
262 GLOBAL
, // A range name can be defined
263 SHEET
// with two scope on Manage Names dialog.
266 /// Represents the type of sheet geometry data.
267 enum class SheetGeomType
269 SIZES
, // Column widths or row heights.
270 HIDDEN
, // Hidden columns/rows.
271 FILTERED
, // Filtered columns/rows.
272 GROUPS
// Grouping of columns/rows.
279 sal_uLong nCellCount
;
280 sal_uLong nFormulaCount
;
281 sal_uInt16 nPageCount
;
292 const sal_uInt8 SC_DDE_DEFAULT
= 0;
293 const sal_uInt8 SC_DDE_ENGLISH
= 1;
294 const sal_uInt8 SC_DDE_TEXT
= 2;
295 const sal_uInt8 SC_DDE_IGNOREMODE
= 255; /// For usage in FindDdeLink() only!
297 // During threaded calculation fields being mutated are kept in this struct
298 struct ScDocumentThreadSpecific
300 std::unique_ptr
<ScRecursionHelper
> xRecursionHelper
; // information for recursive and iterative cell formulas
301 ScInterpreterContext
* pContext
= nullptr; // references the context passed around for easier access
304 /// Enumeration to determine which pieces of the code should not be mutated when set.
305 enum ScMutationGuardFlags
308 CORE
= 0x0001, /// Core calc data structures should not be mutated
311 typedef std::unique_ptr
<ScTable
, o3tl::default_delete
<ScTable
>> ScTableUniquePtr
;
315 friend class ScValueIterator
;
316 friend class ScHorizontalValueIterator
;
317 friend class ScDBQueryDataIterator
;
318 friend class ScFormulaGroupIterator
;
319 friend class ScCellIterator
;
320 friend class ScQueryCellIterator
;
321 friend class ScCountIfCellIterator
;
322 friend class ScHorizontalCellIterator
;
323 friend class ScHorizontalAttrIterator
;
324 friend class ScDocAttrIterator
;
325 friend class ScAccessibleTableBase
;
326 friend class ScAttrRectIterator
;
327 friend class ScDocShell
;
328 friend class ScDocRowHeightUpdater
;
329 friend class ScColumnTextWidthIterator
;
330 friend class ScFormulaCell
;
331 friend class ScTable
;
332 friend class ScColumn
;
333 friend struct ScRefCellValue
;
334 friend class ScDocumentImport
;
335 friend class sc::DocumentStreamAccess
;
336 friend class sc::ColumnSpanSet
;
337 friend class sc::RangeColumnSpanSet
;
338 friend class sc::EditTextIterator
;
339 friend class sc::FormulaGroupAreaListener
;
340 friend class sc::TableColumnBlockPositionSet
;
341 friend struct ScMutationGuard
;
342 friend struct ScMutationDisable
;
344 typedef std::vector
<ScTableUniquePtr
> TableContainer
;
347 enum class HardRecalcState
349 OFF
, /// normal calculation of dependencies
350 TEMPORARY
, /// CalcAll() without broadcast/notify but setting up new listeners
351 ETERNAL
/// no new listeners are setup, no broadcast/notify
355 rtl::Reference
<ScPoolHelper
> mxPoolHelper
;
357 std::shared_ptr
<svl::SharedStringPool
> mpCellStringPool
;
358 std::unique_ptr
<sc::DocumentLinkManager
> mpDocLinkMgr
;
360 std::shared_ptr
<sc::FormulaGroupContext
> mpFormulaGroupCxt
;
361 bool mbFormulaGroupCxtBlockDiscard
;
363 ScCalcConfig maCalcConfig
;
365 SfxUndoManager
* mpUndoManager
;
366 std::unique_ptr
<ScFieldEditEngine
> mpEditEngine
; // uses pEditPool from xPoolHelper
367 std::unique_ptr
<ScNoteEditEngine
> mpNoteEngine
; // uses pEditPool from xPoolHelper
368 SfxObjectShell
* mpShell
;
369 VclPtr
<SfxPrinter
> mpPrinter
;
370 VclPtr
<VirtualDevice
> mpVirtualDevice_100th_mm
;
371 std::unique_ptr
<ScDrawLayer
> mpDrawLayer
; // SdrModel
372 rtl::Reference
<XColorList
> pColorList
;
373 std::unique_ptr
<ScValidationDataList
> pValidationList
; // validity
374 SvNumberFormatterIndexTable
* pFormatExchangeList
; // for application of number formats
375 TableContainer maTabs
;
376 rtl::Reference
<ScSheetLimits
> mxSheetLimits
;
377 std::vector
<OUString
> maTabNames
; // for undo document, we need the information tab name <-> index
378 mutable std::unique_ptr
<ScRangeName
> pRangeName
;
379 std::unique_ptr
<ScDBCollection
> pDBCollection
;
380 std::unique_ptr
<ScDPCollection
> pDPCollection
;
381 std::unique_ptr
< ScTemporaryChartLock
> apTemporaryChartLock
;
382 std::unique_ptr
<ScPatternAttr
> pSelectionAttr
; // Attributes of a block
383 ScFormulaCell
* pFormulaTree
; // formula tree (start)
384 ScFormulaCell
* pEOFormulaTree
; // formula tree (end), last cell
385 ScFormulaCell
* pFormulaTrack
; // BroadcastTrack (start)
386 ScFormulaCell
* pEOFormulaTrack
; // BroadcastTrack (end), last cell
387 std::unique_ptr
<ScBroadcastAreaSlotMachine
> pBASM
; // BroadcastAreas
388 std::unique_ptr
<ScChartListenerCollection
> pChartListenerCollection
;
389 std::unique_ptr
<SvMemoryStream
> pClipData
;
390 std::unique_ptr
<ScDetOpList
> pDetOpList
;
391 std::unique_ptr
<ScChangeTrack
> pChangeTrack
;
392 std::unique_ptr
<SfxBroadcaster
> pUnoBroadcaster
;
393 std::unique_ptr
<ScUnoListenerCalls
> pUnoListenerCalls
;
394 std::unique_ptr
<ScUnoRefList
> pUnoRefUndoList
;
395 std::unique_ptr
<ScChangeViewSettings
> pChangeViewSettings
;
396 std::unique_ptr
<ScScriptTypeData
> pScriptTypeData
;
397 std::unique_ptr
<ScRefreshTimerControl
> pRefreshTimerControl
;
398 std::shared_ptr
<SvxForbiddenCharactersTable
> xForbiddenCharacters
;
399 std::unique_ptr
<ScDBData
> mpAnonymousDBData
;
400 std::unique_ptr
<sc::ExternalDataMapper
> mpDataMapper
;
402 std::unique_ptr
<ScFieldEditEngine
> pCacheFieldEditEngine
;
404 std::unique_ptr
<ScDocProtection
> pDocProtection
;
405 std::unique_ptr
<ScClipParam
> mpClipParam
;
407 std::unique_ptr
<ScExternalRefManager
> pExternalRefMgr
;
408 std::unique_ptr
<ScMacroManager
> mpMacroMgr
;
410 // mutable for lazy construction
411 mutable std::unique_ptr
< ScFormulaParserPool
>
412 mxFormulaParserPool
; /// Pool for all external formula parsers used by this document.
414 OUString aDocName
; // optional: name of document
415 OUString aDocCodeName
; // optional: name of document (twice?)
416 OUString maFileURL
; // file URL for copy & paste
417 ScRangePairListRef xColNameRanges
;
418 ScRangePairListRef xRowNameRanges
;
420 std::unique_ptr
<ScViewOptions
> pViewOptions
; // view options
421 std::unique_ptr
<ScDocOptions
> pDocOptions
; // document options
422 std::unique_ptr
<ScExtDocOptions
> pExtDocOptions
; // for import etc.
423 std::unique_ptr
<ScClipOptions
> mpClipOptions
; // clipboard options
424 std::unique_ptr
<ScConsolidateParam
> pConsolidateDlgData
;
426 std::unique_ptr
<ScAutoNameCache
> pAutoNameCache
; // for automatic name lookup during CompileXML
428 std::unique_ptr
<SfxItemSet
> pPreviewFont
; // convert to std::unique_ptr or whatever
429 ScStyleSheet
* pPreviewCellStyle
;
430 ScMarkData maPreviewSelection
;
431 sal_Int64 nUnoObjectId
; // counted up for UNO objects
433 ErrCode nRangeOverflowType
; // used in (xml) loading for overflow warnings
436 ScAddress aCurTextWidthCalcPos
;
440 css::uno::Reference
< css::script::vba::XVBAEventProcessor
>
443 /// list of ScInterpreterTableOpParams currently in use
444 std::vector
<ScInterpreterTableOpParams
*> m_TableOpList
;
445 ScInterpreterTableOpParams aLastTableOpParams
; // remember last params
449 LanguageType eLanguage
; // default language
450 LanguageType eCjkLanguage
; // default language for asian text
451 LanguageType eCtlLanguage
; // default language for complex text
452 rtl_TextEncoding eSrcSet
; // during reading: source character set
454 /** The compiler grammar used in document storage. GRAM_PODF for ODF 1.1
455 documents, GRAM_ODFF for ODF 1.2 documents. */
456 formula::FormulaGrammar::Grammar eStorageGrammar
;
458 sal_uLong nFormulaCodeInTree
; // formula RPN in the formula tree
459 sal_uLong nXMLImportedFormulaCount
; // progress count during XML import
460 sal_uInt16 nInterpretLevel
; // >0 if in interpreter
461 sal_uInt16 nMacroInterpretLevel
; // >0 if macro in interpreter
462 sal_uInt16 nInterpreterTableOpLevel
; // >0 if in interpreter TableOp
464 ScDocumentThreadSpecific maNonThreaded
;
466 // There can be only one ScDocument being calculated in a thread at a time, so we can use a
467 // plain thread_local static member.
468 thread_local
static ScDocumentThreadSpecific maThreadSpecific
;
470 mutable ScInterpreterContext maInterpreterContext
;
472 osl::Mutex mScLookupMutex
; // protection for thread-unsafe parts of handling ScLookup
474 static const sal_uInt16 nSrcVer
; // file version (load/save)
475 sal_uInt16 nFormulaTrackCount
;
476 HardRecalcState eHardRecalcState
; // off, temporary, eternal
477 SCTAB nVisibleTab
; // for OLE etc., don't use inside ScDocument
478 SCCOL nPosLeft
; // for OLE etc., don't use inside ScDocument
479 SCROW nPosTop
; // for OLE etc., don't use inside ScDocument
481 ScLkUpdMode eLinkMode
;
483 bool bAutoCalc
; // calculate automatically
484 bool bAutoCalcShellDisabled
; // in/from/for ScDocShell disabled
485 // are there ForcedFormulas which have to be calculated
486 // in interaction with ScDocShell SetDocumentModified,
487 // AutoCalcShellDisabled and TrackFormulas
488 bool bForcedFormulaPending
;
489 bool bCalculatingFormulaTree
;
492 bool bIsFunctionAccess
;
493 bool bIsVisible
; // set from view ctor
495 bool bIsEmbedded
; // display/adjust Embedded area?
497 // no broadcast, construct no listener during insert from a different
498 // Doc (per filter or the like ), not until CompileAll / CalcAfterLoad
499 bool bInsertingFromOtherDoc
;
501 bool bImportingXML
; // special handling of formula text
502 bool bCalcingAfterLoad
; // in CalcAfterLoad TRUE
503 // don't construct/destruct listeners temporarily
506 bool bInLinkUpdate
; // TableLink or AreaLink
507 bool bChartListenerCollectionNeedsUpdate
;
508 // are/were there RC_FORCED formula cells in the document (if set once to TRUE then set forever)
509 bool bHasForcedFormulas
;
510 // is the Doc being destroyed? (no Notify-Tracking etc. needed anymore)
512 // expand reference if insert column/row takes place at the border
514 // is fetched in each UpdateReference from InputOptions,
515 // assigned, and restored at the end of UpdateReference
517 // for detective update, is set for each change of a formula
518 bool bDetectiveDirty
;
519 // If the pointer is set, formula cells will not be automatically grouped into shared formula groups,
520 // instead the range will be extended to contain all such cells.
521 std::unique_ptr
< ScRange
> pDelayedFormulaGrouping
;
522 // If non-empty, ScColumn::StartListeningFormulaCells() calls may be delayed using this,
523 // avoiding repeated calling for the same cells in the given range. The function will be called once
524 // later for all the cells in the range.
525 std::unordered_map
< ScColumn
*, std::pair
<SCROW
, SCROW
>> pDelayedStartListeningFormulaCells
;
527 bool bLinkFormulaNeedingCheck
; // valid only after loading, for ocDde and ocWebservice
529 CharCompressType nAsianCompression
;
530 sal_uInt8 nAsianKerning
;
532 bool bPastingDrawFromOtherDoc
;
534 sal_uInt8 nInDdeLinkUpdate
; // originating DDE links (stacked bool)
536 bool bInUnoBroadcast
;
537 bool bInUnoListenerCall
;
538 sal_uInt32 nAdjustHeightLock
;
539 formula::FormulaGrammar::Grammar eGrammar
;
541 mutable bool bStyleSheetUsageInvalid
;
543 bool mbUndoEnabled
:1;
544 bool mbExecuteLinkEnabled
:1;
545 bool mbChangeReadOnlyEnabled
:1; // allow changes in read-only document (for API import filters)
546 bool mbStreamValidLocked
:1;
547 bool mbUserInteractionEnabled
:1; // whether or not to launch any kind of interactive dialogs.
549 sal_Int16 mnNamedRangesLockCount
;
551 std::set
<ScFormulaCell
*> maSubTotalCells
;
554 bool mbEmbedFonts
: 1;
555 bool mbEmbedUsedFontsOnly
: 1;
556 bool mbEmbedFontScriptLatin
: 1;
557 bool mbEmbedFontScriptAsian
: 1;
558 bool mbEmbedFontScriptComplex
: 1;
560 std::unique_ptr
<sc::IconSetBitmapMap
> m_pIconSetBitmapMap
;
562 bool mbTrackFormulasPending
: 1;
563 bool mbFinalTrackFormulas
: 1;
564 // This indicates if a ScDocShell::DoRecalc() or ScDocShell::DoHardRecalc() is in progress.
565 bool mbDocShellRecalc
: 1;
567 size_t mnMutationGuardFlags
;
570 bool IsCellInChangeTrack(const ScAddress
&cell
,Color
*pColCellBorder
);
571 void GetCellChangeTrackNote(const ScAddress
&cell
, OUString
&strTrackText
, bool &pbLeftEdge
);
573 bool IsEmbedFonts() const { return mbEmbedFonts
; }
574 bool IsEmbedUsedFontsOnly() const { return mbEmbedUsedFontsOnly
; }
575 bool IsEmbedFontScriptLatin() const { return mbEmbedFontScriptLatin
; }
576 bool IsEmbedFontScriptAsian() const { return mbEmbedFontScriptAsian
; }
577 bool IsEmbedFontScriptComplex() const { return mbEmbedFontScriptComplex
; }
579 void SetEmbedFonts(bool bUse
) { mbEmbedFonts
= bUse
; }
580 void SetEmbedUsedFontsOnly(bool bUse
) { mbEmbedUsedFontsOnly
= bUse
; }
581 void SetEmbedFontScriptLatin(bool bUse
) { mbEmbedFontScriptLatin
= bUse
; }
582 void SetEmbedFontScriptAsian(bool bUse
) { mbEmbedFontScriptAsian
= bUse
; }
583 void SetEmbedFontScriptComplex(bool bUse
) { mbEmbedFontScriptComplex
= bUse
; }
585 SC_DLLPUBLIC sal_uLong
GetCellCount() const; // all cells
586 SC_DLLPUBLIC sal_uLong
GetFormulaGroupCount() const; // all cells
587 sal_uLong
GetCodeCount() const; // RPN-Code in formulas
588 DECL_LINK( GetUserDefinedColor
, sal_uInt16
, Color
* );
591 SC_DLLPUBLIC
ScDocument( ScDocumentMode eMode
= SCDOCMODE_DOCUMENT
,
592 SfxObjectShell
* pDocShell
= nullptr );
593 SC_DLLPUBLIC
~ScDocument();
595 void SetName( const OUString
& r
) { aDocName
= r
; }
596 const OUString
& GetCodeName() const { return aDocCodeName
; }
597 void SetCodeName( const OUString
& r
) { aDocCodeName
= r
; }
598 const OUString
& GetFileURL() const { return maFileURL
; }
600 void GetDocStat( ScDocStat
& rDocStat
);
602 SC_DLLPUBLIC
void InitDrawLayer( SfxObjectShell
* pDocShell
= nullptr );
604 ScInterpreterContext
& GetNonThreadedContext() const
606 assert(!IsThreadedGroupCalcInProgress());
607 return maInterpreterContext
;
609 // Uses thread_local.
610 ScInterpreterContext
& GetThreadedContext() const
612 return IsThreadedGroupCalcInProgress() ? *maThreadSpecific
.pContext
: GetNonThreadedContext();
614 void SetupContextFromNonThreadedContext( ScInterpreterContext
& threadedContext
, int threadNumber
);
615 void MergeContextBackIntoNonThreadedContext( ScInterpreterContext
& threadedContext
, int threadNumber
);
616 void SetThreadedGroupCalcInProgress( bool set
) { (void)this; ScGlobal::bThreadedGroupCalcInProgress
= set
; }
617 bool IsThreadedGroupCalcInProgress() const { (void)this; return ScGlobal::bThreadedGroupCalcInProgress
; }
619 SC_DLLPUBLIC
sfx2::LinkManager
* GetLinkManager();
620 SC_DLLPUBLIC
const sfx2::LinkManager
* GetLinkManager() const;
622 sc::DocumentLinkManager
& GetDocLinkManager();
623 const sc::DocumentLinkManager
& GetDocLinkManager() const;
625 SC_DLLPUBLIC
const ScDocOptions
& GetDocOptions() const;
626 SC_DLLPUBLIC
void SetDocOptions( const ScDocOptions
& rOpt
);
627 SC_DLLPUBLIC
const ScViewOptions
& GetViewOptions() const;
628 SC_DLLPUBLIC
void SetViewOptions( const ScViewOptions
& rOpt
);
629 void SetPrintOptions();
631 ScExtDocOptions
* GetExtDocOptions() { return pExtDocOptions
.get(); }
632 SC_DLLPUBLIC
void SetExtDocOptions( std::unique_ptr
<ScExtDocOptions
> pNewOptions
);
634 ScClipOptions
* GetClipOptions() { return mpClipOptions
.get(); }
635 void SetClipOptions(std::unique_ptr
<ScClipOptions
> pClipOptions
);
637 SC_DLLPUBLIC
void GetLanguage( LanguageType
& rLatin
, LanguageType
& rCjk
, LanguageType
& rCtl
) const;
638 void SetLanguage( LanguageType eLatin
, LanguageType eCjk
, LanguageType eCtl
);
640 void SetConsolidateDlgData( std::unique_ptr
<ScConsolidateParam
> pData
);
641 const ScConsolidateParam
* GetConsolidateDlgData() const { return pConsolidateDlgData
.get(); }
643 void Clear( bool bFromDestructor
= false );
645 std::unique_ptr
<ScFieldEditEngine
> CreateFieldEditEngine();
646 void DisposeFieldEditEngine(std::unique_ptr
<ScFieldEditEngine
>& rpEditEngine
);
649 * Get all range names that are local to each table. It only returns
650 * non-empty range name set.
652 SC_DLLPUBLIC
void GetAllTabRangeNames(ScRangeName::TabNameCopyMap
& rRangeNames
) const;
653 SC_DLLPUBLIC
void SetAllRangeNames(const std::map
<OUString
, std::unique_ptr
<ScRangeName
>>& rRangeMap
);
654 SC_DLLPUBLIC
void GetRangeNameMap(std::map
<OUString
, ScRangeName
*>& rRangeName
);
655 SC_DLLPUBLIC ScRangeName
* GetRangeName(SCTAB nTab
) const;
656 SC_DLLPUBLIC ScRangeName
* GetRangeName() const;
657 void SetRangeName(SCTAB nTab
, std::unique_ptr
<ScRangeName
> pNew
);
658 void SetRangeName( std::unique_ptr
<ScRangeName
> pNewRangeName
);
659 bool IsAddressInRangeName( RangeNameScope eScope
, const ScAddress
& rAddress
);
661 /** Find a named expression / range name in either global or a local scope.
663 If <0 search nIndex in global scope, if >=0 search nIndex in scope of nTab.
665 Index of named expression / range name.
666 @return nullptr if indexed name not found.
668 ScRangeData
* FindRangeNameBySheetAndIndex( SCTAB nTab
, sal_uInt16 nIndex
) const;
670 /** Recursively find all named expressions that directly or indirectly
671 (nested) reference a given sheet, starting from a given named
672 expression nTokenTab/nTokenIndex.
674 Used to collect all named expressions/ranges that will need to be
675 copied along when copying sheets.
677 The different tab/sheets passed cater for the situation that a sheet is
678 copied and was already inserted and global names are already adjusted
679 but the sheet-local names of the shifted original sheet are not yet. If
680 no sheet was inserted and global and local names' references not
681 updated yet, then all 4 tab arguments would be identical.
684 Tab/sheet on which to find the name, -1 if global scope.
685 For example obtained from ocName token.
688 Index of named expression. For example obtained from ocName token.
691 Tab to check if used in global names.
694 Tab to check if used in sheet-local names.
697 The original tab of the copied sheet, used as sheet-local
698 base position for relative references.
700 @param nOldTokenTabReplacement
701 The replacement to use for relative references if the name
702 encountered uses nOldTokenTab as base position.
705 FALSE if collecting names for a sheet to be copied to another
706 document. Then all names encountered are considered to be
707 referencing the sheet. Else TRUE if collecting names to be
708 copied into the same document.
711 Recursion guard, initialize with 0.
713 bool FindRangeNamesReferencingSheet( sc::UpdatedRangeNames
& rIndexes
,
714 SCTAB nTokenTab
, const sal_uInt16 nTokenIndex
,
715 SCTAB nGlobalRefTab
, SCTAB nLocalRefTab
, SCTAB nOldTokenTab
, SCTAB nOldTokenTabReplacement
,
716 bool bSameDoc
, int nRecursion
) const;
718 /** If necessary (name references sheet rOldPos.Tab()) copy and adjust
719 named expression/range from sheet-local to sheet-local, or global to
720 sheet-local if bGlobalNamesToLocal==true.
722 Also copies nested names and adjusts the ocName tokens of the calling name.
725 On entry, the original sheet of the named expression/range, <0 global.
726 On return TRUE, the new sheet. Else unchanged.
729 On entry, the original index of the named expression/range.
730 On return TRUE, the new index, or 0 if a new copied name couldn't be inserted. Else unchanged.
733 On entry, the pointer to the original named expression/range.
734 On return TRUE, the pointer to the new copied name, or nullptr if hits happened.
737 New position of formula cell if called for that, else new base
738 position of a to be created new name adjusted for Tab.
739 rNewPos.nTab MUST point to the new sheet copied to.
742 Old position of formula cell if called for that, else base
743 position of the existing name adjusted for Tab.
744 rOldPos.nTab MUST point to the old sheet copied from.
746 @param bGlobalNamesToLocal
747 If TRUE, affected global names are copied to sheet-local names.
748 If FALSE, global names are copied to global names in another document.
750 @param bUsedByFormula
751 If TRUE, forces a global name to be affected/used.
752 If FALSE, a global name is only affected if it evaluates to be
753 referencing the sheet.
755 @return TRUE if copied and caller may need to evaluate rpRangeData and rSheet and rIndex.
756 FALSE if nothing to be done.
758 bool CopyAdjustRangeName( SCTAB
& rSheet
, sal_uInt16
& rIndex
, ScRangeData
*& rpRangeData
, ScDocument
& rNewDoc
,
759 const ScAddress
& rNewPos
, const ScAddress
& rOldPos
, const bool bGlobalNamesToLocal
,
760 const bool bUsedByFormula
) const;
763 * Call this immediately before updating all named ranges.
765 SC_DLLPUBLIC
void PreprocessAllRangeNamesUpdate( const std::map
<OUString
, std::unique_ptr
<ScRangeName
>>& rRangeMap
);
766 SC_DLLPUBLIC
void PreprocessRangeNameUpdate();
767 SC_DLLPUBLIC
void PreprocessDBDataUpdate();
769 * Call this immediately after updating named ranges.
771 SC_DLLPUBLIC
void CompileHybridFormula();
774 * Insert a new named expression to the global scope.
776 * @param rName name for the expression.
777 * @param rPos base position.
778 * @param rExpr formula expression to be associated with the name. The
779 * current grammar is used to compile this expression.
781 * @return true if inserted successfully, false otherwise.
783 bool InsertNewRangeName( const OUString
& rName
, const ScAddress
& rPos
, const OUString
& rExpr
);
786 * Insert a new named expression to a sheet-local scope.
788 * @param nTab sheet for local scope.
789 * @param rName name for the expression.
790 * @param rPos base position.
791 * @param rExpr formula expression to be associated with the name. The
792 * current grammar is used to compile this expression.
794 * @return true if inserted successfully, false otherwise.
796 bool InsertNewRangeName( SCTAB nTab
, const OUString
& rName
, const ScAddress
& rPos
, const OUString
& rExpr
);
798 /** Obtain the sheet separator corresponding to the document's grammar.
800 @return '.' for our own grammars, '!' for Excel grammars.
802 SC_DLLPUBLIC sal_Unicode
GetSheetSeparator() const;
804 SCTAB
GetMaxTableNumber() const { return static_cast<SCTAB
>(maTabs
.size()) - 1; }
806 ScRangePairList
* GetColNameRanges() { return xColNameRanges
.get(); }
807 ScRangePairList
* GetRowNameRanges() { return xRowNameRanges
.get(); }
808 ScRangePairListRef
& GetColNameRangesRef() { return xColNameRanges
; }
809 ScRangePairListRef
& GetRowNameRangesRef() { return xRowNameRanges
; }
811 SC_DLLPUBLIC SCCOL
ClampToAllocatedColumns(SCTAB nTab
, SCCOL nCol
) const;
812 SC_DLLPUBLIC SCCOL
GetAllocatedColumnsCount(SCTAB nTab
) const;
814 SC_DLLPUBLIC ScDBCollection
* GetDBCollection() const { return pDBCollection
.get();}
815 void SetDBCollection( std::unique_ptr
<ScDBCollection
> pNewDBCollection
,
816 bool bRemoveAutoFilter
= false );
817 const ScDBData
* GetDBAtCursor(SCCOL nCol
, SCROW nRow
, SCTAB nTab
, ScDBDataPortion ePortion
) const;
818 ScDBData
* GetDBAtCursor(SCCOL nCol
, SCROW nRow
, SCTAB nTab
, ScDBDataPortion ePortion
);
819 SC_DLLPUBLIC
const ScDBData
* GetDBAtArea(SCTAB nTab
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
) const;
820 SC_DLLPUBLIC ScDBData
* GetDBAtArea(SCTAB nTab
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
821 void RefreshDirtyTableColumnNames();
822 SC_DLLPUBLIC
sc::ExternalDataMapper
& GetExternalDataMapper();
824 SC_DLLPUBLIC
const ScRangeData
* GetRangeAtBlock( const ScRange
& rBlock
, OUString
* pName
) const;
826 SC_DLLPUBLIC
bool HasPivotTable() const;
827 SC_DLLPUBLIC ScDPCollection
* GetDPCollection();
828 SC_DLLPUBLIC
const ScDPCollection
* GetDPCollection() const;
829 SC_DLLPUBLIC ScDPObject
* GetDPAtCursor(SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
830 ScDPObject
* GetDPAtBlock( const ScRange
& rBlock
) const;
832 void StopTemporaryChartLock();
834 void EnsureGraphicNames();
836 SdrObject
* GetObjectAtPoint( SCTAB nTab
, const Point
& rPos
);
837 bool HasChartAtPoint( SCTAB nTab
, const Point
& rPos
, OUString
& rName
);
839 css::uno::Reference
< css::chart2::XChartDocument
> GetChartByName( const OUString
& rChartName
);
841 SC_DLLPUBLIC
void GetChartRanges( const OUString
& rChartName
, std::vector
< ScRangeList
>& rRanges
, const ScDocument
& rSheetNameDoc
);
842 void SetChartRanges( const OUString
& rChartName
, const std::vector
< ScRangeList
>& rRanges
);
844 void UpdateChartArea( const OUString
& rChartName
, const ScRange
& rNewArea
,
845 bool bColHeaders
, bool bRowHeaders
, bool bAdd
);
846 void UpdateChartArea( const OUString
& rChartName
,
847 const ScRangeListRef
& rNewList
,
848 bool bColHeaders
, bool bRowHeaders
, bool bAdd
);
849 void GetOldChartParameters( const OUString
& rName
,
850 ScRangeList
& rRanges
, bool& rColHeaders
, bool& rRowHeaders
);
852 css::embed::XEmbeddedObject
>
853 FindOleObjectByName( const OUString
& rName
);
855 SC_DLLPUBLIC
void MakeTable( SCTAB nTab
,bool _bNeedsNameCheck
= true );
857 SCTAB
GetVisibleTab() const { return nVisibleTab
; }
858 SC_DLLPUBLIC
void SetVisibleTab(SCTAB nTab
) { nVisibleTab
= nTab
; }
859 SCCOL
GetPosLeft() const { return nPosLeft
; }
860 SC_DLLPUBLIC
void SetPosLeft(SCCOL nCol
) { nPosLeft
= nCol
; }
861 SCROW
GetPosTop() const { return nPosTop
; }
862 SC_DLLPUBLIC
void SetPosTop(SCROW nRow
) { nPosTop
= nRow
; }
864 SC_DLLPUBLIC
bool HasTable( SCTAB nTab
) const;
865 SC_DLLPUBLIC
bool GetHashCode( SCTAB nTab
, sal_Int64
& rHashCode
) const;
866 SC_DLLPUBLIC
bool GetName( SCTAB nTab
, OUString
& rName
) const;
867 SC_DLLPUBLIC
bool GetCodeName( SCTAB nTab
, OUString
& rName
) const;
868 SC_DLLPUBLIC
bool SetCodeName( SCTAB nTab
, const OUString
& rName
);
869 SC_DLLPUBLIC
bool GetTable( const OUString
& rName
, SCTAB
& rTab
) const;
870 SC_DLLPUBLIC SCCOL
MaxCol() const { return mxSheetLimits
->mnMaxCol
; }
871 SC_DLLPUBLIC SCROW
MaxRow() const { return mxSheetLimits
->mnMaxRow
; }
872 ScSheetLimits
& GetSheetLimits() const { return *mxSheetLimits
; }
873 [[nodiscard
]] bool ValidCol(SCCOL nCol
) const { return ::ValidCol(nCol
, mxSheetLimits
->mnMaxCol
); }
874 [[nodiscard
]] bool ValidRow(SCROW nRow
) const { return ::ValidRow(nRow
, mxSheetLimits
->mnMaxRow
); }
875 [[nodiscard
]] bool ValidColRow(SCCOL nCol
, SCROW nRow
) const { return ::ValidColRow(nCol
, nRow
, MaxCol(), MaxRow()); }
876 [[nodiscard
]] bool ValidColRowTab(SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const { return ::ValidColRowTab(nCol
, nRow
, nTab
, MaxCol(), MaxRow()); }
877 [[nodiscard
]] bool ValidRange(const ScRange
& rRange
) const { return ::ValidRange(rRange
, MaxCol(), MaxRow()); }
878 [[nodiscard
]] bool ValidAddress(const ScAddress
& rAddress
) const { return ::ValidAddress(rAddress
, MaxCol(), MaxRow()); }
879 [[nodiscard
]] SCCOL
SanitizeCol( SCCOL nCol
) const { return ::SanitizeCol(nCol
, MaxCol()); }
880 [[nodiscard
]] SCROW
SanitizeRow( SCROW nRow
) const { return ::SanitizeRow(nRow
, MaxRow()); }
882 SC_DLLPUBLIC
std::vector
<OUString
> GetAllTableNames() const;
884 OUString
GetCopyTabName(SCTAB nTab
) const;
886 SC_DLLPUBLIC
void SetAnonymousDBData(SCTAB nTab
, std::unique_ptr
<ScDBData
> pDBData
);
887 SC_DLLPUBLIC ScDBData
* GetAnonymousDBData(SCTAB nTab
);
889 /** One document global anonymous database range for temporary operations,
890 used if the corresponding sheet-local anonymous database range is
891 already used with AutoFilter and range differs. Not stored in document
893 SC_DLLPUBLIC
void SetAnonymousDBData(std::unique_ptr
<ScDBData
> pDBData
);
894 SC_DLLPUBLIC ScDBData
* GetAnonymousDBData();
896 SC_DLLPUBLIC SCTAB
GetTableCount() const;
897 SvNumberFormatterIndexTable
* GetFormatExchangeList() const { return pFormatExchangeList
; }
899 SC_DLLPUBLIC ScDocProtection
* GetDocProtection() const;
900 SC_DLLPUBLIC
void SetDocProtection(const ScDocProtection
* pProtect
);
901 SC_DLLPUBLIC
bool IsDocProtected() const;
902 bool IsDocEditable() const;
903 SC_DLLPUBLIC
bool IsTabProtected( SCTAB nTab
) const;
904 SC_DLLPUBLIC ScTableProtection
* GetTabProtection( SCTAB nTab
) const;
905 SC_DLLPUBLIC
void SetTabProtection(SCTAB nTab
, const ScTableProtection
* pProtect
);
906 void CopyTabProtection(SCTAB nTabSrc
, SCTAB nTabDest
);
908 void LockTable(SCTAB nTab
);
909 void UnlockTable(SCTAB nTab
);
911 bool IsBlockEditable( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
,
912 SCCOL nEndCol
, SCROW nEndRow
,
913 bool* pOnlyNotBecauseOfMatrix
= nullptr,
914 bool bNoMatrixAtAll
= false ) const;
915 bool IsSelectionEditable( const ScMarkData
& rMark
,
916 bool* pOnlyNotBecauseOfMatrix
= nullptr ) const;
917 bool HasSelectedBlockMatrixFragment( SCCOL nStartCol
, SCROW nStartRow
,
918 SCCOL nEndCol
, SCROW nEndRow
,
919 const ScMarkData
& rMark
) const;
921 bool IsEditActionAllowed( sc::ColRowEditAction eAction
, SCTAB nTab
, SCCOLROW nStart
, SCCOLROW nEnd
) const;
922 bool IsEditActionAllowed( sc::ColRowEditAction eAction
, const ScMarkData
& rMark
, SCCOLROW nStart
, SCCOLROW nEnd
) const;
924 SC_DLLPUBLIC
bool GetMatrixFormulaRange( const ScAddress
& rCellPos
, ScRange
& rMatrix
);
926 bool IsEmbedded() const { return bIsEmbedded
;}
927 void GetEmbedded( ScRange
& rRange
) const;
928 void SetEmbedded( const ScRange
& rRange
);
929 void ResetEmbedded();
930 tools::Rectangle
GetEmbeddedRect() const; // 1/100 mm
931 void SetEmbedded( SCTAB nTab
, const tools::Rectangle
& rRect
); // from VisArea (1/100 mm)
933 static SC_DLLPUBLIC
bool ValidTabName( const OUString
& rName
);
935 SC_DLLPUBLIC
bool ValidNewTabName( const OUString
& rName
) const;
936 SC_DLLPUBLIC
void CreateValidTabName(OUString
& rName
) const;
937 SC_DLLPUBLIC
void CreateValidTabNames(std::vector
<OUString
>& aNames
, SCTAB nCount
) const;
939 void AppendTabOnLoad(const OUString
& rName
);
940 void SetTabNameOnLoad(SCTAB nTab
, const OUString
& rName
);
941 void InvalidateStreamOnSave();
943 SC_DLLPUBLIC
bool InsertTab( SCTAB nPos
, const OUString
& rName
,
944 bool bExternalDocument
= false, bool bUndoDeleteTab
= false );
946 SC_DLLPUBLIC
bool InsertTabs( SCTAB nPos
, const std::vector
<OUString
>& rNames
,
947 bool bNamesValid
= false );
948 SC_DLLPUBLIC
bool DeleteTabs( SCTAB nTab
, SCTAB nSheets
);
949 SC_DLLPUBLIC
bool DeleteTab( SCTAB nTab
);
950 SC_DLLPUBLIC
bool RenameTab( SCTAB nTab
, const OUString
& rName
,
951 bool bExternalDocument
= false );
952 bool MoveTab( SCTAB nOldPos
, SCTAB nNewPos
, ScProgress
* pProgress
= nullptr );
953 bool CopyTab( SCTAB nOldPos
, SCTAB nNewPos
,
954 const ScMarkData
* pOnlyMarked
= nullptr );
955 SC_DLLPUBLIC sal_uLong
TransferTab(ScDocument
& rSrcDoc
, SCTAB nSrcPos
, SCTAB nDestPos
,
956 bool bInsertNew
= true,
957 bool bResultsOnly
= false );
958 SC_DLLPUBLIC
void TransferDrawPage(const ScDocument
& rSrcDoc
, SCTAB nSrcPos
, SCTAB nDestPos
);
959 SC_DLLPUBLIC
void SetVisible( SCTAB nTab
, bool bVisible
);
960 SC_DLLPUBLIC
bool IsVisible( SCTAB nTab
) const;
961 bool IsStreamValid( SCTAB nTab
) const;
962 void SetStreamValid( SCTAB nTab
, bool bSet
, bool bIgnoreLock
= false );
963 void LockStreamValid( bool bLock
);
964 bool IsStreamValidLocked() const { return mbStreamValidLocked
; }
965 bool IsPendingRowHeights( SCTAB nTab
) const;
966 void SetPendingRowHeights( SCTAB nTab
, bool bSet
);
967 SC_DLLPUBLIC
void SetLayoutRTL( SCTAB nTab
, bool bRTL
, ScObjectHandling eObjectHandling
= ScObjectHandling::RecalcPosMode
);
968 SC_DLLPUBLIC
bool IsLayoutRTL( SCTAB nTab
) const;
969 SC_DLLPUBLIC
bool IsNegativePage( SCTAB nTab
) const;
970 SC_DLLPUBLIC
void SetScenario( SCTAB nTab
, bool bFlag
);
971 SC_DLLPUBLIC
bool IsScenario( SCTAB nTab
) const;
972 SC_DLLPUBLIC
void GetScenarioData(SCTAB nTab
, OUString
& rComment
,
973 Color
& rColor
, ScScenarioFlags
&rFlags
) const;
974 SC_DLLPUBLIC
void SetScenarioData(SCTAB nTab
, const OUString
& rComment
,
975 const Color
& rColor
, ScScenarioFlags nFlags
);
976 SC_DLLPUBLIC Color
GetTabBgColor( SCTAB nTab
) const;
977 SC_DLLPUBLIC
void SetTabBgColor( SCTAB nTab
, const Color
& rColor
);
978 SC_DLLPUBLIC
bool IsDefaultTabBgColor( SCTAB nTab
) const;
979 void GetScenarioFlags(SCTAB nTab
, ScScenarioFlags
&rFlags
) const;
980 SC_DLLPUBLIC
bool IsActiveScenario( SCTAB nTab
) const;
981 SC_DLLPUBLIC
void SetActiveScenario( SCTAB nTab
, bool bActive
); // only for Undo etc.
982 SC_DLLPUBLIC
formula::FormulaGrammar::AddressConvention
GetAddressConvention() const;
983 SC_DLLPUBLIC
formula::FormulaGrammar::Grammar
GetGrammar() const { return eGrammar
;}
984 SC_DLLPUBLIC
void SetGrammar( formula::FormulaGrammar::Grammar eGram
);
985 SC_DLLPUBLIC ScLinkMode
GetLinkMode( SCTAB nTab
) const;
986 bool IsLinked( SCTAB nTab
) const;
987 SC_DLLPUBLIC OUString
GetLinkDoc( SCTAB nTab
) const;
988 OUString
GetLinkFlt( SCTAB nTab
) const;
989 OUString
GetLinkOpt( SCTAB nTab
) const;
990 SC_DLLPUBLIC OUString
GetLinkTab( SCTAB nTab
) const;
991 sal_uLong
GetLinkRefreshDelay( SCTAB nTab
) const;
992 void SetLink( SCTAB nTab
, ScLinkMode nMode
, const OUString
& rDoc
,
993 const OUString
& rFilter
, const OUString
& rOptions
,
994 const OUString
& rTabName
, sal_uLong nRefreshDelay
);
995 bool HasLink( const OUString
& rDoc
,
996 const OUString
& rFilter
, const OUString
& rOptions
) const;
997 SC_DLLPUBLIC
bool LinkExternalTab( SCTAB
& nTab
, const OUString
& aDocTab
,
998 const OUString
& aFileName
,
999 const OUString
& aTabName
);
1001 bool HasExternalRefManager() const { return bool(pExternalRefMgr
); }
1002 SC_DLLPUBLIC ScExternalRefManager
* GetExternalRefManager() const;
1003 bool IsInExternalReferenceMarking() const;
1004 void MarkUsedExternalReferences();
1005 bool MarkUsedExternalReferences( const ScTokenArray
& rArr
, const ScAddress
& rPos
);
1007 /** Returns the pool containing external formula parsers. Creates the pool
1009 ScFormulaParserPool
& GetFormulaParserPool() const;
1011 bool HasAreaLinks() const;
1012 void UpdateExternalRefLinks(weld::Window
* pWin
);
1013 void UpdateAreaLinks();
1015 // originating DDE links
1016 void IncInDdeLinkUpdate() { if ( nInDdeLinkUpdate
< 255 ) ++nInDdeLinkUpdate
; }
1017 void DecInDdeLinkUpdate() { if ( nInDdeLinkUpdate
) --nInDdeLinkUpdate
; }
1018 bool IsInDdeLinkUpdate() const { return nInDdeLinkUpdate
!= 0; }
1020 SC_DLLPUBLIC
void CopyDdeLinks( ScDocument
& rDestDoc
) const;
1022 /** Tries to find a DDE link with the specified connection data.
1023 @param rnDdePos (out-param) Returns the index of the DDE link (does not include other links from link manager).
1024 @return true = DDE link found, rnDdePos valid. */
1025 SC_DLLPUBLIC
bool FindDdeLink( const OUString
& rAppl
, const OUString
& rTopic
,
1026 const OUString
& rItem
, sal_uInt8 nMode
, size_t& rnDdePos
);
1028 /** Returns the connection data of the specified DDE link.
1029 @param nDdePos Index of the DDE link (does not include other links from link manager).
1030 @param rAppl (out-param) The application name.
1031 @param rTopic (out-param) The DDE topic.
1032 @param rItem (out-param) The DDE item.
1033 @return true = DDE link found, out-parameters valid. */
1034 bool GetDdeLinkData( size_t nDdePos
, OUString
& rAppl
, OUString
& rTopic
, OUString
& rItem
) const;
1035 /** Returns the link mode of the specified DDE link.
1036 @param nDdePos Index of the DDE link (does not include other links from link manager).
1037 @param rnMode (out-param) The link mode of the specified DDE link.
1038 @return true = DDE link found, rnMode valid. */
1039 bool GetDdeLinkMode( size_t nDdePos
, sal_uInt8
& rnMode
) const;
1040 /** Returns the result matrix of the specified DDE link.
1041 @param nDdePos Index of the DDE link (does not include other links from link manager).
1042 @return The result matrix, if the DDE link has been found, 0 otherwise. */
1043 SC_DLLPUBLIC
const ScMatrix
* GetDdeLinkResultMatrix( size_t nDdePos
) const;
1045 /** Tries to find a DDE link or creates a new, if not extant.
1046 @param pResults If not 0, sets the matrix as DDE link result matrix (also for existing links).
1047 @return true = DDE link found; false = Unpredictable error occurred, no DDE link created. */
1048 SC_DLLPUBLIC
bool CreateDdeLink( const OUString
& rAppl
, const OUString
& rTopic
, const OUString
& rItem
, sal_uInt8 nMode
, const ScMatrixRef
& pResults
);
1049 /** Sets a result matrix for the specified DDE link.
1050 @param nDdePos Index of the DDE link (does not include other links from link manager).
1051 @param pResults The array containing all results of the DDE link (intrusive-ref-counted, do not delete).
1052 @return true = DDE link found and matrix set. */
1053 bool SetDdeLinkResultMatrix( size_t nDdePos
, const ScMatrixRef
& pResults
);
1055 SfxBindings
* GetViewBindings();
1056 SfxObjectShell
* GetDocumentShell() const { return mpShell
; }
1057 SC_DLLPUBLIC ScDrawLayer
* GetDrawLayer() { return mpDrawLayer
.get(); }
1058 SC_DLLPUBLIC
const ScDrawLayer
* GetDrawLayer() const { return mpDrawLayer
.get(); }
1059 SfxBroadcaster
* GetDrawBroadcaster(); // to avoid header
1060 void BeginDrawUndo();
1062 void BeginUnoRefUndo();
1063 bool HasUnoRefUndo() const { return ( pUnoRefUndoList
!= nullptr ); }
1065 std::unique_ptr
<ScUnoRefList
> EndUnoRefUndo(); // must be deleted by caller!
1066 sal_Int64
GetNewUnoId() { return ++nUnoObjectId
; }
1067 void AddUnoRefChange( sal_Int64 nId
, const ScRangeList
& rOldRanges
);
1069 static bool IsChart( const SdrObject
* pObject
);
1071 void UpdateChartRef( UpdateRefMode eUpdateRefMode
,
1072 SCCOL nCol1
, SCROW nRow1
, SCTAB nTab1
,
1073 SCCOL nCol2
, SCROW nRow2
, SCTAB nTab2
,
1074 SCCOL nDx
, SCROW nDy
, SCTAB nDz
);
1075 //! only assigns the new RangeList, no ChartListener or the like
1076 void SetChartRangeList( const OUString
& rChartName
,
1077 const ScRangeListRef
& rNewRangeListRef
);
1079 void StartAnimations( SCTAB nTab
);
1081 bool HasBackgroundDraw( SCTAB nTab
, const tools::Rectangle
& rMMRect
) const;
1082 bool HasAnyDraw( SCTAB nTab
, const tools::Rectangle
& rMMRect
) const;
1084 const ScSheetEvents
* GetSheetEvents( SCTAB nTab
) const;
1085 void SetSheetEvents( SCTAB nTab
, std::unique_ptr
<ScSheetEvents
> pNew
);
1086 bool HasSheetEventScript( SCTAB nTab
, ScSheetEventId nEvent
, bool bWithVbaEvents
= false ) const;
1087 bool HasAnySheetEventScript( ScSheetEventId nEvent
, bool bWithVbaEvents
= false ) const; // on any sheet
1089 bool HasAnyCalcNotification() const;
1090 bool HasCalcNotification( SCTAB nTab
) const;
1091 void SetCalcNotification( SCTAB nTab
);
1092 void ResetCalcNotifications();
1094 SC_DLLPUBLIC ScOutlineTable
* GetOutlineTable( SCTAB nTab
, bool bCreate
= false );
1095 bool SetOutlineTable( SCTAB nTab
, const ScOutlineTable
* pNewOutline
);
1097 void DoAutoOutline( SCCOL nStartCol
, SCROW nStartRow
,
1098 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nTab
);
1100 bool DoSubTotals( SCTAB nTab
, ScSubTotalParam
& rParam
);
1101 void RemoveSubTotals( SCTAB nTab
, ScSubTotalParam
& rParam
);
1102 bool TestRemoveSubTotals( SCTAB nTab
, const ScSubTotalParam
& rParam
);
1103 bool HasSubTotalCells( const ScRange
& rRange
);
1105 SC_DLLPUBLIC
void EnsureTable( SCTAB nTab
);
1107 // return TRUE = number format is set
1108 SC_DLLPUBLIC
bool SetString( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, const OUString
& rString
,
1109 const ScSetStringParam
* pParam
= nullptr );
1110 SC_DLLPUBLIC
bool SetString( const ScAddress
& rPos
, const OUString
& rString
,
1111 const ScSetStringParam
* pParam
= nullptr );
1114 * This method manages the lifecycle of the passed edit text object. When
1115 * the text is successfully inserted, the cell takes over the ownership of
1116 * the text object. If not, the text object gets deleted.
1118 * <p>The caller must ensure that the passed edit text object <i>uses the
1119 * SfxItemPool instance returned from ScDocument::GetEditPool()</i>.
1120 * This is very important.</p>
1122 SC_DLLPUBLIC
bool SetEditText( const ScAddress
& rPos
, std::unique_ptr
<EditTextObject
> pEditText
);
1123 void SetEditText( const ScAddress
& rPos
, const EditTextObject
& rEditText
, const SfxItemPool
* pEditPool
);
1124 SC_DLLPUBLIC
void SetEditText( const ScAddress
& rPos
, const OUString
& rStr
);
1125 SC_DLLPUBLIC SCROW
GetFirstEditTextRow( const ScRange
& rRange
) const;
1128 * Call this if you are not sure whether to put this as an edit text or a
1131 SC_DLLPUBLIC
void SetTextCell( const ScAddress
& rPos
, const OUString
& rStr
);
1132 void SetEmptyCell( const ScAddress
& rPos
);
1133 SC_DLLPUBLIC
void SetValue( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, const double& rVal
);
1134 SC_DLLPUBLIC
void SetValue( const ScAddress
& rPos
, double fVal
);
1135 void SetValues( const ScAddress
& rPos
, const std::vector
<double>& rVals
);
1136 void SetError( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, const FormulaError nError
);
1137 SC_DLLPUBLIC
void SetFormula( const ScAddress
& rPos
, const ScTokenArray
& rArray
);
1138 SC_DLLPUBLIC
void SetFormula( const ScAddress
& rPos
, const OUString
& rFormula
,
1139 formula::FormulaGrammar::Grammar eGram
);
1142 * Set formula cell, and transfer its ownership to the document. This call
1143 * attempts to group the passed formula cell with the adjacent cells or
1144 * cell groups if appropriate.
1146 * @return pCell if it was successfully inserted, NULL otherwise. pCell
1147 * is deleted automatically on failure to insert.
1149 SC_DLLPUBLIC ScFormulaCell
* SetFormulaCell( const ScAddress
& rPos
, ScFormulaCell
* pCell
);
1150 bool SetFormulaCells( const ScAddress
& rPos
, std::vector
<ScFormulaCell
*>& rCells
);
1153 * Check if there is at least one formula cell in specified range.
1155 bool HasFormulaCell( const ScRange
& rRange
) const;
1156 SC_DLLPUBLIC
void InsertMatrixFormula(SCCOL nCol1
, SCROW nRow1
,
1157 SCCOL nCol2
, SCROW nRow2
,
1158 const ScMarkData
& rMark
,
1159 const OUString
& rFormula
,
1160 const ScTokenArray
* p
= nullptr,
1161 const formula::FormulaGrammar::Grammar
= formula::FormulaGrammar::GRAM_DEFAULT
);
1162 SC_DLLPUBLIC
void InsertTableOp(const ScTabOpParam
& rParam
, // multi-operation
1163 SCCOL nCol1
, SCROW nRow1
,
1164 SCCOL nCol2
, SCROW nRow2
, const ScMarkData
& rMark
);
1166 SC_DLLPUBLIC OUString
GetString( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1167 const ScInterpreterContext
* pContext
= nullptr ) const;
1168 SC_DLLPUBLIC OUString
GetString( const ScAddress
& rPos
,
1169 const ScInterpreterContext
* pContext
= nullptr ) const;
1172 * Return a pointer to the double value stored in value cell.
1174 * @param rPos cell position
1176 * @return pointer to the double value stored in a numeric cell, or NULL
1177 * if the cell at specified position is not a numeric cell.
1179 SC_DLLPUBLIC
double* GetValueCell( const ScAddress
& rPos
);
1181 SC_DLLPUBLIC
svl::SharedStringPool
& GetSharedStringPool();
1182 const svl::SharedStringPool
& GetSharedStringPool() const;
1184 svl::SharedString
GetSharedString( const ScAddress
& rPos
) const;
1186 std::shared_ptr
<sc::FormulaGroupContext
>& GetFormulaGroupContext();
1187 void DiscardFormulaGroupContext();
1188 void BlockFormulaGroupContextDiscard( bool block
)
1189 { mbFormulaGroupCxtBlockDiscard
= block
; }
1191 SC_DLLPUBLIC
void GetInputString( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, OUString
& rString
);
1192 FormulaError
GetStringForFormula( const ScAddress
& rPos
, OUString
& rString
);
1193 SC_DLLPUBLIC
double GetValue( const ScAddress
& rPos
) const;
1194 SC_DLLPUBLIC
double GetValue( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1195 SC_DLLPUBLIC
void GetValue( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, double& rValue
) const;
1196 SC_DLLPUBLIC
const EditTextObject
* GetEditText( const ScAddress
& rPos
) const;
1197 void RemoveEditTextCharAttribs( const ScAddress
& rPos
, const ScPatternAttr
& rAttr
);
1198 SC_DLLPUBLIC
double RoundValueAsShown( double fVal
, sal_uInt32 nFormat
, const ScInterpreterContext
* pContext
= nullptr ) const;
1199 SC_DLLPUBLIC
void GetNumberFormat( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1200 sal_uInt32
& rFormat
) const;
1201 sal_uInt32
GetNumberFormat( const ScRange
& rRange
) const;
1202 SC_DLLPUBLIC sal_uInt32
GetNumberFormat( const ScInterpreterContext
& rContext
, const ScAddress
& ) const;
1203 void SetNumberFormat( const ScAddress
& rPos
, sal_uInt32 nNumberFormat
);
1205 void GetNumberFormatInfo( const ScInterpreterContext
& rContext
, SvNumFormatType
& nType
, sal_uInt32
& nIndex
, const ScAddress
& rPos
) const;
1206 SC_DLLPUBLIC
const ScFormulaCell
* GetFormulaCell( const ScAddress
& rPos
) const;
1207 SC_DLLPUBLIC ScFormulaCell
* GetFormulaCell( const ScAddress
& rPos
);
1208 SC_DLLPUBLIC
void GetFormula( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, OUString
& rFormula
) const;
1209 SC_DLLPUBLIC
void GetCellType( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, CellType
& rCellType
) const;
1210 SC_DLLPUBLIC CellType
GetCellType( const ScAddress
& rPos
) const;
1212 SC_DLLPUBLIC
bool HasData( SCCOL nCol
, SCROW nRow
, SCTAB nTab
);
1213 SC_DLLPUBLIC
bool HasStringData( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1214 SC_DLLPUBLIC
bool HasValueData( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1215 SC_DLLPUBLIC
bool HasValueData( const ScAddress
& rPos
) const;
1216 bool HasStringCells( const ScRange
& rRange
) const;
1218 /** Returns true, if there is any data to create a selection list for rPos. */
1219 bool HasSelectionData( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1220 bool HasValidationData( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1223 * Check if the specified range contains either: 1) one non-empty cell, 2)
1224 * more than one non-empty cells, or 3) totally empty. In case the range
1225 * contains at least one non-empty cell, specify the position of the first
1228 sc::MultiDataCellState
HasMultipleDataCells( const ScRange
& rRange
) const;
1231 SC_DLLPUBLIC ScPostIt
* GetNote(const ScAddress
& rPos
);
1232 SC_DLLPUBLIC ScPostIt
* GetNote(SCCOL nCol
, SCROW nRow
, SCTAB nTab
);
1233 void SetNote(const ScAddress
& rPos
, std::unique_ptr
<ScPostIt
> pNote
);
1234 void SetNote(SCCOL nCol
, SCROW nRow
, SCTAB nTab
, std::unique_ptr
<ScPostIt
> pNote
);
1235 SC_DLLPUBLIC
bool HasNote(const ScAddress
& rPos
) const;
1236 bool HasNote(SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1237 SC_DLLPUBLIC
bool HasColNotes(SCCOL nCol
, SCTAB nTab
) const;
1238 SC_DLLPUBLIC
bool HasTabNotes(SCTAB nTab
) const;
1239 bool HasNotes() const;
1240 SC_DLLPUBLIC
std::unique_ptr
<ScPostIt
> ReleaseNote(const ScAddress
& rPos
);
1241 SC_DLLPUBLIC ScPostIt
* GetOrCreateNote(const ScAddress
& rPos
);
1242 SC_DLLPUBLIC ScPostIt
* CreateNote(const ScAddress
& rPos
);
1243 size_t GetNoteCount( SCTAB nTab
, SCCOL nCol
) const;
1246 * Ensure that all note objects have an associated sdr object. The export
1247 * code uses sdr objects to export note data.
1249 void CreateAllNoteCaptions();
1250 void ForgetNoteCaptions( const ScRangeList
& rRanges
, bool bPreserveData
);
1251 CommentCaptionState
GetAllNoteCaptionsState( const ScRangeList
& rRanges
);
1253 ScAddress
GetNotePosition( size_t nIndex
) const;
1254 ScAddress
GetNotePosition( size_t nIndex
, SCTAB nTab
) const;
1255 SCROW
GetNotePosition( SCTAB nTab
, SCCOL nCol
, size_t nIndex
) const;
1257 SC_DLLPUBLIC
void GetAllNoteEntries( std::vector
<sc::NoteEntry
>& rNotes
) const;
1258 SC_DLLPUBLIC
void GetAllNoteEntries( SCTAB nTab
, std::vector
<sc::NoteEntry
>& rNotes
) const;
1259 void GetNotesInRange( const ScRangeList
& rRange
, std::vector
<sc::NoteEntry
>& rNotes
) const;
1260 bool ContainsNotesInRange( const ScRangeList
& rRange
) const;
1262 SC_DLLPUBLIC
void SetDrawPageSize(SCTAB nTab
);
1264 bool IsMerged( const ScAddress
& rPos
) const;
1266 void ExtendMergeSel( SCCOL nStartCol
, SCROW nStartRow
,
1267 SCCOL
& rEndCol
, SCROW
& rEndRow
, const ScMarkData
& rMark
,
1268 bool bRefresh
= false );
1269 SC_DLLPUBLIC
bool ExtendMerge( SCCOL nStartCol
, SCROW nStartRow
,
1270 SCCOL
& rEndCol
, SCROW
& rEndRow
, SCTAB nTab
,
1271 bool bRefresh
= false );
1272 bool ExtendMerge( ScRange
& rRange
, bool bRefresh
= false );
1273 SC_DLLPUBLIC
void ExtendTotalMerge( ScRange
& rRange
) const;
1274 SC_DLLPUBLIC
void ExtendOverlapped( SCCOL
& rStartCol
, SCROW
& rStartRow
,
1275 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nTab
) const;
1276 SC_DLLPUBLIC
void ExtendOverlapped( ScRange
& rRange
) const;
1278 bool RefreshAutoFilter( SCCOL nStartCol
, SCROW nStartRow
,
1279 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nTab
);
1281 SC_DLLPUBLIC
void DoMergeContents( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
,
1282 SCCOL nEndCol
, SCROW nEndRow
);
1283 SC_DLLPUBLIC
void DoEmptyBlock( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
,
1284 SCCOL nEndCol
, SCROW nEndRow
);
1285 // without checking:
1286 SC_DLLPUBLIC
void DoMerge( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
,
1287 SCCOL nEndCol
, SCROW nEndRow
, bool bDeleteCaptions
= true );
1288 void RemoveMerge( SCCOL nCol
, SCROW nRow
, SCTAB nTab
);
1290 bool IsBlockEmpty( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
,
1291 SCCOL nEndCol
, SCROW nEndRow
, bool bIgnoreNotes
= false ) const;
1292 bool IsPrintEmpty( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
,
1293 SCCOL nEndCol
, SCROW nEndRow
,
1294 bool bLeftIsEmpty
= false,
1295 ScRange
* pLastRange
= nullptr,
1296 tools::Rectangle
* pLastMM
= nullptr ) const;
1298 void SkipOverlapped( SCCOL
& rCol
, SCROW
& rRow
, SCTAB nTab
) const;
1299 bool IsHorOverlapped( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1300 bool IsVerOverlapped( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1302 SC_DLLPUBLIC
bool HasAttrib( SCCOL nCol1
, SCROW nRow1
, SCTAB nTab1
,
1303 SCCOL nCol2
, SCROW nRow2
, SCTAB nTab2
, HasAttrFlags nMask
) const;
1304 SC_DLLPUBLIC
bool HasAttrib( const ScRange
& rRange
, HasAttrFlags nMask
) const;
1306 SC_DLLPUBLIC
void GetBorderLines( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1307 const ::editeng::SvxBorderLine
** ppLeft
,
1308 const ::editeng::SvxBorderLine
** ppTop
,
1309 const ::editeng::SvxBorderLine
** ppRight
,
1310 const ::editeng::SvxBorderLine
** ppBottom
) const;
1312 void ResetChanged( const ScRange
& rRange
);
1314 void CheckVectorizationState();
1315 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext
& rCxt
);
1316 void SetDirty( const ScRange
&, bool bIncludeEmptyCells
);
1317 void SetTableOpDirty( const ScRange
& ); // for Interpreter TableOp
1318 void InterpretDirtyCells( const ScRangeList
& rRanges
);
1319 SC_DLLPUBLIC
void CalcAll();
1320 SC_DLLPUBLIC
void CalcAfterLoad( bool bStartListening
= true );
1325 * Re-compile formula cells with error.
1327 * @param nErrCode specified error code to match. Only those cells with
1328 * this error code will be re-compiled. If this value is
1329 * 0, cells with any error values will be re-compiled.
1331 * @return true if at least one cell is re-compiled, false if no cells are
1334 bool CompileErrorCells(FormulaError nErrCode
);
1336 ScAutoNameCache
* GetAutoNameCache() { return pAutoNameCache
.get(); }
1337 void SetPreviewFont( std::unique_ptr
<SfxItemSet
> pFontSet
);
1338 SfxItemSet
* GetPreviewFont() { return pPreviewFont
.get(); }
1339 SfxItemSet
* GetPreviewFont( SCCOL nCol
, SCROW nRow
, SCTAB nTab
);
1340 const ScMarkData
& GetPreviewSelection() const { return maPreviewSelection
; }
1341 void SetPreviewSelection( const ScMarkData
& rSel
);
1342 ScStyleSheet
* GetPreviewCellStyle() { return pPreviewCellStyle
; }
1343 ScStyleSheet
* GetPreviewCellStyle( SCCOL nCol
, SCROW nRow
, SCTAB nTab
);
1344 void SetPreviewCellStyle( ScStyleSheet
* pStyle
) { pPreviewCellStyle
= pStyle
; }
1345 SC_DLLPUBLIC
void SetAutoNameCache( std::unique_ptr
<ScAutoNameCache
> pCache
);
1347 /** Creates a ScLookupCache cache for the range if it
1348 doesn't already exist. */
1349 ScLookupCache
& GetLookupCache( const ScRange
& rRange
, ScInterpreterContext
* pContext
);
1350 /** Only ScLookupCache dtor uses RemoveLookupCache(), do
1351 not use elsewhere! */
1352 void RemoveLookupCache( ScLookupCache
& rCache
);
1353 /** Zap all caches. */
1354 void ClearLookupCaches();
1356 // calculate automatically
1357 SC_DLLPUBLIC
void SetAutoCalc( bool bNewAutoCalc
);
1358 SC_DLLPUBLIC
bool GetAutoCalc() const { return bAutoCalc
; }
1359 // calculate automatically in/from/for ScDocShell disabled
1360 void SetAutoCalcShellDisabled( bool bNew
) { bAutoCalcShellDisabled
= bNew
; }
1361 bool IsAutoCalcShellDisabled() const { return bAutoCalcShellDisabled
; }
1362 // ForcedFormulas are to be calculated
1363 void SetForcedFormulaPending( bool bNew
) { bForcedFormulaPending
= bNew
; }
1364 bool IsForcedFormulaPending() const { return bForcedFormulaPending
; }
1365 // if CalcFormulaTree() is currently running
1366 bool IsCalculatingFormulaTree() const { return bCalculatingFormulaTree
; }
1367 /// If set, joining cells into shared formula groups will be delayed until reset again
1368 /// (RegroupFormulaCells() will be called as needed).
1369 void DelayFormulaGrouping( bool delay
);
1370 bool IsDelayedFormulaGrouping() const { return bool(pDelayedFormulaGrouping
); }
1371 /// To be used only by SharedFormulaUtil::joinFormulaCells().
1372 void AddDelayedFormulaGroupingCell( const ScFormulaCell
* cell
);
1373 /// If set, ScColumn::StartListeningFormulaCells() calls may be delayed using
1374 /// CanDelayStartListeningFormulaCells() until reset again, at which point the function will
1375 /// be called as necessary.
1376 void EnableDelayStartListeningFormulaCells( ScColumn
* column
, bool delay
);
1377 bool IsEnabledDelayStartListeningFormulaCells( ScColumn
* column
) const;
1378 /// If true is returned, ScColumn::StartListeningFormulaCells() for the given cells will be performed
1379 /// later. If false is returned, it needs to be done explicitly.
1380 bool CanDelayStartListeningFormulaCells( ScColumn
* column
, SCROW row1
, SCROW row2
);
1382 FormulaError
GetErrCode( const ScAddress
& ) const;
1384 /** Shrink a range to only include data area.
1386 This is not the actually used area within the
1387 selection, but the bounds of the sheet's data area
1390 @returns TRUE if the area passed intersected the data
1391 area, FALSE if not, in which case the values
1392 obtained may be out of bounds, not in order or
1393 unmodified. TRUE does not mean that there
1394 actually is any data within the selection.
1396 bool ShrinkToDataArea( SCTAB nTab
, SCCOL
& rStartCol
, SCROW
& rStartRow
, SCCOL
& rEndCol
, SCROW
& rEndRow
) const;
1398 /** Shrink a range to only include used data area.
1401 Out parameter, true if area was shrunk, false if not.
1402 @param bStickyTopRow
1403 If TRUE, do not adjust the top row.
1404 @param bStickyLeftCol
1405 If TRUE, do not adjust the left column.
1406 @param bConsiderCellNotes
1407 If TRUE, consider the presence of cell notes besides data.
1408 @param bConsiderCellDrawObjects
1409 If TRUE, consider the presence of draw objects anchored to the cell.
1411 @returns true if there is any data, false if not.
1413 bool ShrinkToUsedDataArea( bool& o_bShrunk
,
1414 SCTAB nTab
, SCCOL
& rStartCol
, SCROW
& rStartRow
,
1415 SCCOL
& rEndCol
, SCROW
& rEndRow
, bool bColumnsOnly
,
1416 bool bStickyTopRow
= false, bool bStickyLeftCol
= false,
1417 bool bConsiderCellNotes
= false,
1418 bool bConsiderCellDrawObjects
= false ) const;
1421 * Return the last non-empty row position in given columns that's no
1422 * greater than the initial last row position, or 0 if the columns are
1423 * empty. A negative value is returned if the given sheet or column
1424 * positions are invalid.
1426 * <p>It starts from the specified last row position, and finds the first
1427 * non-empty row position in the upward direction if the start row
1428 * position is empty.</p>
1430 SCROW
GetLastDataRow( SCTAB nTab
, SCCOL nCol1
, SCCOL nCol2
, SCROW nLastRow
) const;
1433 * Return the smallest area containing at least all contiguous cells
1434 * having data. This area is a square containing also empty cells. It may
1435 * shrink or extend the area given as input Flags as modifiers:
1437 * @param bIncludeOld when true, ensure that the returned area contains at
1438 * least the initial area even if the actual data area
1439 * is smaller than the initial area.
1441 * @param bOnlyDown when true, extend / shrink the data area only in a
1442 * downward direction i.e. only modify the end row
1445 SC_DLLPUBLIC
void GetDataArea( SCTAB nTab
, SCCOL
& rStartCol
, SCROW
& rStartRow
,
1446 SCCOL
& rEndCol
, SCROW
& rEndRow
,
1447 bool bIncludeOld
, bool bOnlyDown
) const;
1450 * Returns true if there is a non-empty subrange in the range given as input.
1451 * In that case it also modifies rRange to largest subrange that does not
1452 * have empty col/row inrange-segments in the beginning/end.
1453 * It returns false if rRange is completely empty and in this case rRange is
1456 bool GetDataAreaSubrange(ScRange
& rRange
) const;
1458 SC_DLLPUBLIC
bool GetCellArea( SCTAB nTab
, SCCOL
& rEndCol
, SCROW
& rEndRow
) const;
1459 SC_DLLPUBLIC
bool GetTableArea( SCTAB nTab
, SCCOL
& rEndCol
, SCROW
& rEndRow
) const;
1460 SC_DLLPUBLIC
bool GetPrintArea( SCTAB nTab
, SCCOL
& rEndCol
, SCROW
& rEndRow
,
1461 bool bNotes
= true ) const;
1462 SC_DLLPUBLIC
bool GetPrintAreaHor( SCTAB nTab
, SCROW nStartRow
, SCROW nEndRow
,
1463 SCCOL
& rEndCol
) const;
1464 SC_DLLPUBLIC
bool GetPrintAreaVer( SCTAB nTab
, SCCOL nStartCol
, SCCOL nEndCol
,
1465 SCROW
& rEndRow
, bool bNotes
) const;
1466 void InvalidateTableArea();
1468 /// Return the number of columns / rows that should be visible for the tiled rendering.
1469 SC_DLLPUBLIC
void GetTiledRenderingArea(SCTAB nTab
, SCCOL
& rEndCol
, SCROW
& rEndRow
) const;
1471 SC_DLLPUBLIC
bool GetDataStart( SCTAB nTab
, SCCOL
& rStartCol
, SCROW
& rStartRow
) const;
1474 * Find the maximum column position that contains printable data for the
1475 * specified row range. The final column position must be equal or less
1476 * than the initial value of rEndCol.
1478 void ExtendPrintArea( OutputDevice
* pDev
, SCTAB nTab
,
1479 SCCOL nStartCol
, SCROW nStartRow
,
1480 SCCOL
& rEndCol
, SCROW nEndRow
) const;
1481 SC_DLLPUBLIC SCSIZE
GetEmptyLinesInBlock( SCCOL nStartCol
, SCROW nStartRow
, SCTAB nStartTab
,
1482 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nEndTab
,
1485 void FindAreaPos( SCCOL
& rCol
, SCROW
& rRow
, SCTAB nTab
, ScMoveDirection eDirection
) const;
1486 SC_DLLPUBLIC
void GetNextPos( SCCOL
& rCol
, SCROW
& rRow
, SCTAB nTab
, SCCOL nMovX
, SCROW nMovY
,
1487 bool bMarked
, bool bUnprotected
, const ScMarkData
& rMark
,
1488 SCCOL nTabStartCol
= SC_TABSTART_NONE
) const;
1490 bool GetNextMarkedCell( SCCOL
& rCol
, SCROW
& rRow
, SCTAB nTab
,
1491 const ScMarkData
& rMark
);
1493 void LimitChartArea( SCTAB nTab
, SCCOL
& rStartCol
, SCROW
& rStartRow
,
1494 SCCOL
& rEndCol
, SCROW
& rEndRow
);
1495 void LimitChartIfAll( ScRangeListRef
& rRangeList
);
1497 bool InsertRow( SCCOL nStartCol
, SCTAB nStartTab
,
1498 SCCOL nEndCol
, SCTAB nEndTab
,
1499 SCROW nStartRow
, SCSIZE nSize
, ScDocument
* pRefUndoDoc
= nullptr,
1500 const ScMarkData
* pTabMark
= nullptr );
1501 SC_DLLPUBLIC
bool InsertRow( const ScRange
& rRange
);
1502 void DeleteRow( SCCOL nStartCol
, SCTAB nStartTab
,
1503 SCCOL nEndCol
, SCTAB nEndTab
,
1504 SCROW nStartRow
, SCSIZE nSize
,
1505 ScDocument
* pRefUndoDoc
= nullptr, bool* pUndoOutline
= nullptr,
1506 const ScMarkData
* pTabMark
= nullptr );
1507 SC_DLLPUBLIC
void DeleteRow( const ScRange
& rRange
);
1508 bool InsertCol( SCROW nStartRow
, SCTAB nStartTab
,
1509 SCROW nEndRow
, SCTAB nEndTab
,
1510 SCCOL nStartCol
, SCSIZE nSize
, ScDocument
* pRefUndoDoc
= nullptr,
1511 const ScMarkData
* pTabMark
= nullptr );
1512 SC_DLLPUBLIC
bool InsertCol( const ScRange
& rRange
);
1513 void DeleteCol( SCROW nStartRow
, SCTAB nStartTab
,
1514 SCROW nEndRow
, SCTAB nEndTab
,
1515 SCCOL nStartCol
, SCSIZE nSize
,
1516 ScDocument
* pRefUndoDoc
= nullptr, bool* pUndoOutline
= nullptr,
1517 const ScMarkData
* pTabMark
= nullptr );
1518 void DeleteCol( const ScRange
& rRange
);
1520 bool CanInsertRow( const ScRange
& rRange
) const;
1521 bool CanInsertCol( const ScRange
& rRange
) const;
1523 void FitBlock( const ScRange
& rOld
, const ScRange
& rNew
, bool bClear
= true );
1524 bool CanFitBlock( const ScRange
& rOld
, const ScRange
& rNew
);
1526 bool IsClipOrUndo() const { return bIsClip
|| bIsUndo
; }
1527 bool IsUndo() const { return bIsUndo
; }
1528 bool IsClipboard() const { return bIsClip
; }
1529 bool IsUndoEnabled() const { return mbUndoEnabled
; }
1530 SC_DLLPUBLIC
void EnableUndo( bool bVal
);
1531 bool IsFunctionAccess() const { return bIsFunctionAccess
; }
1533 bool IsAdjustHeightLocked() const { return nAdjustHeightLock
!= 0; }
1534 void LockAdjustHeight() { ++nAdjustHeightLock
; }
1535 SC_DLLPUBLIC
void UnlockAdjustHeight();
1536 bool IsExecuteLinkEnabled() const { return mbExecuteLinkEnabled
; }
1537 void EnableExecuteLink( bool bVal
) { mbExecuteLinkEnabled
= bVal
; }
1538 bool IsChangeReadOnlyEnabled() const { return mbChangeReadOnlyEnabled
; }
1539 void EnableChangeReadOnly( bool bVal
) { mbChangeReadOnlyEnabled
= bVal
; }
1540 SC_DLLPUBLIC
bool IsUserInteractionEnabled() const { return mbUserInteractionEnabled
;}
1541 SC_DLLPUBLIC
void EnableUserInteraction( bool bVal
);
1542 SC_DLLPUBLIC sal_Int16
GetNamedRangesLockCount() const { return mnNamedRangesLockCount
; }
1543 void SetNamedRangesLockCount( sal_Int16 nCount
) { mnNamedRangesLockCount
= nCount
; }
1544 SC_DLLPUBLIC
void ResetClip( ScDocument
* pSourceDoc
, const ScMarkData
* pMarks
);
1545 SC_DLLPUBLIC
void ResetClip( ScDocument
* pSourceDoc
, SCTAB nTab
);
1546 void SetCutMode( bool bCut
);
1548 void SetClipArea( const ScRange
& rArea
, bool bCut
= false );
1550 SC_DLLPUBLIC
bool IsDocVisible() const { return bIsVisible
; }
1551 SC_DLLPUBLIC
void SetDocVisible( bool bSet
);
1553 bool HasOLEObjectsInArea( const ScRange
& rRange
, const ScMarkData
* pTabMark
= nullptr );
1555 void DeleteObjectsInArea( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1556 const ScMarkData
& rMark
, bool bAnchored
= false );
1557 void DeleteObjectsInSelection( const ScMarkData
& rMark
);
1559 void DeleteArea( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, const ScMarkData
& rMark
,
1560 InsertDeleteFlags nDelFlag
, bool bBroadcast
= true,
1561 sc::ColumnSpanSet
* pBroadcastSpans
= nullptr );
1563 SC_DLLPUBLIC
void DeleteAreaTab(SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1564 SCTAB nTab
, InsertDeleteFlags nDelFlag
);
1565 void DeleteAreaTab(const ScRange
& rRange
, InsertDeleteFlags nDelFlag
);
1567 SC_DLLPUBLIC
void CopyToClip( const ScClipParam
& rClipParam
, ScDocument
* pClipDoc
,
1568 const ScMarkData
* pMarks
, bool bKeepScenarioFlags
,
1569 bool bIncludeObjects
);
1572 * Copy only raw cell values to another document. Formula cells are
1573 * converted to raw cells. No formatting info are copied except for
1576 * @param rSrcRange source range in the source document
1577 * @param nDestTab table in the clip document to copy to.
1578 * @param rDestDoc document to copy to
1580 SC_DLLPUBLIC
void CopyStaticToDocument(const ScRange
& rSrcRange
, SCTAB nDestTab
, ScDocument
& rDestDoc
);
1583 * Copy only cell, nothing but cell to another document.
1585 * @param rSrcPos source cell position
1586 * @param rDestPos destination cell position
1587 * @param rDestDoc destination document
1589 void CopyCellToDocument( const ScAddress
& rSrcPos
, const ScAddress
& rDestPos
, ScDocument
& rDestDoc
);
1591 void CopyTabToClip( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1592 SCTAB nTab
, ScDocument
* pClipDoc
);
1594 SC_DLLPUBLIC
bool InitColumnBlockPosition( sc::ColumnBlockPosition
& rBlockPos
, SCTAB nTab
, SCCOL nCol
);
1596 void DeleteBeforeCopyFromClip( sc::CopyFromClipContext
& rCxt
, const ScMarkData
& rMark
,
1597 sc::ColumnSpanSet
& rBroadcastSpans
);
1599 bool CopyOneCellFromClip(sc::CopyFromClipContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
,
1600 SCCOL nCol2
, SCROW nRow2
);
1601 void CopyBlockFromClip( sc::CopyFromClipContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
,
1602 SCCOL nCol2
, SCROW nRow2
, const ScMarkData
& rMark
,
1603 SCCOL nDx
, SCROW nDy
);
1604 void CopyNonFilteredFromClip( sc::CopyFromClipContext
& rCxt
, SCCOL nCol1
,
1605 SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1606 const ScMarkData
& rMark
, SCCOL nDx
, SCROW
& rClipStartRow
);
1608 void StartListeningFromClip( SCCOL nCol1
, SCROW nRow1
,
1609 SCCOL nCol2
, SCROW nRow2
,
1610 const ScMarkData
& rMark
, InsertDeleteFlags nInsFlag
);
1612 void SetDirtyFromClip( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1613 const ScMarkData
& rMark
, InsertDeleteFlags nInsFlag
,
1614 sc::ColumnSpanSet
& rBroadcastSpans
);
1616 /** If pDestRanges is given it overrides rDestRange, rDestRange in this
1617 case is the overall encompassing range. */
1618 SC_DLLPUBLIC
void CopyFromClip( const ScRange
& rDestRange
, const ScMarkData
& rMark
,
1619 InsertDeleteFlags nInsFlag
,
1620 ScDocument
* pRefUndoDoc
,
1621 ScDocument
* pClipDoc
,
1622 bool bResetCut
= true,
1623 bool bAsLink
= false,
1624 bool bIncludeFiltered
= true,
1625 bool bSkipAttrForEmpty
= false,
1626 const ScRangeList
* pDestRanges
= nullptr );
1628 void CopyMultiRangeFromClip(const ScAddress
& rDestPos
, const ScMarkData
& rMark
,
1629 InsertDeleteFlags nInsFlag
, ScDocument
* pClipDoc
,
1630 bool bResetCut
= true, bool bAsLink
= false,
1631 bool bIncludeFiltered
= true,
1632 bool bSkipAttrForEmpty
= false);
1634 void GetClipArea(SCCOL
& nClipX
, SCROW
& nClipY
, bool bIncludeFiltered
);
1635 void GetClipStart(SCCOL
& nClipX
, SCROW
& nClipY
);
1637 bool HasClipFilteredRows();
1639 bool IsClipboardSource() const;
1641 SC_DLLPUBLIC
void TransposeClip( ScDocument
* pTransClip
, InsertDeleteFlags nFlags
, bool bAsLink
);
1643 ScClipParam
& GetClipParam();
1644 void SetClipParam(const ScClipParam
& rParam
);
1646 /** To be called at the clipboard document when closing a document that is
1647 the current clipboard source to decouple things from the originating
1648 document. Done in ScDocument dtor after determining
1649 IsClipboardSource().
1651 void ClosingClipboardSource();
1653 void MixDocument( const ScRange
& rRange
, ScPasteFunc nFunction
, bool bSkipEmpty
,
1654 ScDocument
& rSrcDoc
);
1656 void FillTab( const ScRange
& rSrcArea
, const ScMarkData
& rMark
,
1657 InsertDeleteFlags nFlags
, ScPasteFunc nFunction
,
1658 bool bSkipEmpty
, bool bAsLink
);
1659 void FillTabMarked( SCTAB nSrcTab
, const ScMarkData
& rMark
,
1660 InsertDeleteFlags nFlags
, ScPasteFunc nFunction
,
1661 bool bSkipEmpty
, bool bAsLink
);
1663 void TransliterateText( const ScMarkData
& rMultiMark
, TransliterationFlags nType
);
1665 SC_DLLPUBLIC
void InitUndo( const ScDocument
& rSrcDoc
, SCTAB nTab1
, SCTAB nTab2
,
1666 bool bColInfo
= false, bool bRowInfo
= false );
1667 void AddUndoTab( SCTAB nTab1
, SCTAB nTab2
,
1668 bool bColInfo
= false, bool bRowInfo
= false );
1669 SC_DLLPUBLIC
void InitUndoSelected( const ScDocument
& rSrcDoc
, const ScMarkData
& rTabSelection
,
1670 bool bColInfo
= false, bool bRowInfo
= false );
1672 // don't use anymore:
1673 void CopyToDocument(SCCOL nCol1
, SCROW nRow1
, SCTAB nTab1
,
1674 SCCOL nCol2
, SCROW nRow2
, SCTAB nTab2
,
1675 InsertDeleteFlags nFlags
, bool bMarked
, ScDocument
& rDestDoc
,
1676 const ScMarkData
* pMarks
= nullptr, bool bColRowFlags
= true);
1677 void UndoToDocument(SCCOL nCol1
, SCROW nRow1
, SCTAB nTab1
,
1678 SCCOL nCol2
, SCROW nRow2
, SCTAB nTab2
,
1679 InsertDeleteFlags nFlags
, bool bMarked
, ScDocument
& rDestDoc
);
1681 void CopyToDocument(const ScRange
& rRange
,
1682 InsertDeleteFlags nFlags
, bool bMarked
, ScDocument
& rDestDoc
,
1683 const ScMarkData
* pMarks
= nullptr, bool bColRowFlags
= true);
1684 void UndoToDocument(const ScRange
& rRange
,
1685 InsertDeleteFlags nFlags
, bool bMarked
, ScDocument
& rDestDoc
);
1687 void CopyScenario( SCTAB nSrcTab
, SCTAB nDestTab
, bool bNewScenario
= false );
1688 bool TestCopyScenario( SCTAB nSrcTab
, SCTAB nDestTab
) const;
1689 void MarkScenario(SCTAB nSrcTab
, SCTAB nDestTab
,
1690 ScMarkData
& rDestMark
, bool bResetMark
= true,
1691 ScScenarioFlags nNeededBits
= ScScenarioFlags::NONE
) const;
1692 bool HasScenarioRange( SCTAB nTab
, const ScRange
& rRange
) const;
1693 SC_DLLPUBLIC
const ScRangeList
* GetScenarioRanges( SCTAB nTab
) const;
1695 SC_DLLPUBLIC
void CopyUpdated( ScDocument
* pPosDoc
, ScDocument
* pDestDoc
);
1697 void UpdateReference( sc::RefUpdateContext
& rCxt
, ScDocument
*
1698 pUndoDoc
= nullptr, bool bIncludeDraw
= true,
1699 bool bUpdateNoteCaptionPos
= true );
1701 SC_DLLPUBLIC
void UpdateTranspose( const ScAddress
& rDestPos
, ScDocument
* pClipDoc
,
1702 const ScMarkData
& rMark
, ScDocument
* pUndoDoc
);
1704 void UpdateGrow( const ScRange
& rArea
, SCCOL nGrowX
, SCROW nGrowY
);
1706 SC_DLLPUBLIC
void Fill( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1707 ScProgress
* pProgress
, const ScMarkData
& rMark
,
1708 sal_uLong nFillCount
, FillDir eFillDir
= FILL_TO_BOTTOM
,
1709 FillCmd eFillCmd
= FILL_LINEAR
, FillDateCmd eFillDateCmd
= FILL_DAY
,
1710 double nStepValue
= 1.0, double nMaxValue
= 1E307
);
1711 OUString
GetAutoFillPreview( const ScRange
& rSource
, SCCOL nEndX
, SCROW nEndY
);
1713 bool GetSelectionFunction( ScSubTotalFunc eFunc
,
1714 const ScAddress
& rCursor
, const ScMarkData
& rMark
,
1717 SC_DLLPUBLIC
const SfxPoolItem
* GetAttr( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, sal_uInt16 nWhich
) const;
1718 template<class T
> const T
* GetAttr( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, TypedWhichId
<T
> nWhich
) const
1720 return static_cast<const T
*>(GetAttr(nCol
, nRow
, nTab
, sal_uInt16(nWhich
)));
1722 SC_DLLPUBLIC
const SfxPoolItem
* GetAttr( const ScAddress
& rPos
, sal_uInt16 nWhich
) const;
1723 template<class T
> const T
* GetAttr( const ScAddress
& rPos
, TypedWhichId
<T
> nWhich
) const
1725 return static_cast<const T
*>(GetAttr(rPos
, sal_uInt16(nWhich
)));
1727 SC_DLLPUBLIC
const ScPatternAttr
* GetPattern( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1728 SC_DLLPUBLIC
const ScPatternAttr
* GetPattern( const ScAddress
& rPos
) const;
1729 SC_DLLPUBLIC
const ScPatternAttr
* GetMostUsedPattern( SCCOL nCol
, SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1730 const ScPatternAttr
* GetSelectionPattern( const ScMarkData
& rMark
);
1731 std::unique_ptr
<ScPatternAttr
> CreateSelectionPattern( const ScMarkData
& rMark
, bool bDeep
= true );
1732 SC_DLLPUBLIC
void AddCondFormatData( const ScRangeList
& rRange
, SCTAB nTab
, sal_uInt32 nIndex
);
1733 void RemoveCondFormatData( const ScRangeList
& rRange
, SCTAB nTab
, sal_uInt32 nIndex
);
1735 SC_DLLPUBLIC ScConditionalFormat
* GetCondFormat( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1736 // pCell is an optimization, must point to rPos
1737 SC_DLLPUBLIC
const SfxItemSet
* GetCondResult( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1738 ScRefCellValue
* pCell
= nullptr ) const;
1739 const SfxItemSet
* GetCondResult( ScRefCellValue
& rCell
, const ScAddress
& rPos
,
1740 const ScConditionalFormatList
& rList
,
1741 const ScCondFormatIndexes
& rIndex
) const;
1742 const SfxPoolItem
* GetEffItem( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, sal_uInt16 nWhich
) const;
1743 template<class T
> const T
* GetEffItem( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, TypedWhichId
<T
> nWhich
) const
1745 return static_cast<const T
*>(GetEffItem(nCol
, nRow
, nTab
, sal_uInt16(nWhich
)));
1748 SC_DLLPUBLIC
const css::uno::Reference
< css::i18n::XBreakIterator
>& GetBreakIterator();
1749 bool HasStringWeakCharacters( const OUString
& rString
);
1750 SC_DLLPUBLIC SvtScriptType
GetStringScriptType( const OUString
& rString
);
1751 // pCell is an optimization, must point to rPos
1752 SC_DLLPUBLIC SvtScriptType
GetCellScriptType( const ScAddress
& rPos
, sal_uInt32 nNumberFormat
,
1753 const ScRefCellValue
* pCell
= nullptr );
1754 // pCell is an optimization, must point to nCol,nRow,nTab
1755 SC_DLLPUBLIC SvtScriptType
GetScriptType( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1756 const ScRefCellValue
* pCell
= nullptr );
1757 SvtScriptType
GetRangeScriptType( sc::ColumnBlockPosition
& rBlockPos
, const ScAddress
& rPos
, SCROW nLength
);
1758 SvtScriptType
GetRangeScriptType( const ScRangeList
& rRanges
);
1760 bool HasDetectiveOperations() const;
1761 void AddDetectiveOperation( const ScDetOpData
& rData
);
1762 void ClearDetectiveOperations();
1763 ScDetOpList
* GetDetOpList() const { return pDetOpList
.get(); }
1764 void SetDetOpList(std::unique_ptr
<ScDetOpList
> pNew
);
1766 bool HasDetectiveObjects(SCTAB nTab
) const;
1768 void GetSelectionFrame( const ScMarkData
& rMark
,
1769 SvxBoxItem
& rLineOuter
,
1770 SvxBoxInfoItem
& rLineInner
);
1771 void ApplySelectionFrame(const ScMarkData
& rMark
,
1772 const SvxBoxItem
& rLineOuter
,
1773 const SvxBoxInfoItem
* pLineInner
);
1774 void ApplyFrameAreaTab(const ScRange
& rRange
,
1775 const SvxBoxItem
& rLineOuter
,
1776 const SvxBoxInfoItem
& rLineInner
);
1778 void ClearSelectionItems( const sal_uInt16
* pWhich
, const ScMarkData
& rMark
);
1779 void ChangeSelectionIndent( bool bIncrement
, const ScMarkData
& rMark
);
1781 SC_DLLPUBLIC sal_uLong
AddCondFormat( std::unique_ptr
<ScConditionalFormat
> pNew
, SCTAB nTab
);
1782 void DeleteConditionalFormat( sal_uLong nIndex
, SCTAB nTab
);
1784 void SetCondFormList( ScConditionalFormatList
* pList
, SCTAB nTab
);
1785 SC_DLLPUBLIC sal_uLong
AddValidationEntry( const ScValidationData
& rNew
);
1786 SC_DLLPUBLIC
const ScValidationData
* GetValidationEntry( sal_uLong nIndex
) const;
1788 SC_DLLPUBLIC ScConditionalFormatList
* GetCondFormList( SCTAB nTab
) const;
1790 const ScValidationDataList
* GetValidationList() const { return pValidationList
.get();}
1791 ScValidationDataList
* GetValidationList() { return pValidationList
.get();}
1793 SC_DLLPUBLIC
void ApplyAttr( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1794 const SfxPoolItem
& rAttr
);
1795 SC_DLLPUBLIC
void ApplyPattern( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1796 const ScPatternAttr
& rAttr
);
1797 SC_DLLPUBLIC
void ApplyPatternArea( SCCOL nStartCol
, SCROW nStartRow
,
1798 SCCOL nEndCol
, SCROW nEndRow
,
1799 const ScMarkData
& rMark
, const ScPatternAttr
& rAttr
,
1800 ScEditDataArray
* pDataArray
= nullptr,
1801 bool* const pIsChanged
= nullptr );
1802 SC_DLLPUBLIC
void ApplyPatternAreaTab( SCCOL nStartCol
, SCROW nStartRow
,
1803 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nTab
,
1804 const ScPatternAttr
& rAttr
);
1806 SC_DLLPUBLIC
void ApplyPatternIfNumberformatIncompatible( const ScRange
& rRange
,
1807 const ScMarkData
& rMark
,
1808 const ScPatternAttr
& rPattern
,
1809 SvNumFormatType nNewType
);
1811 void ApplyStyle( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1812 const ScStyleSheet
& rStyle
);
1813 void ApplyStyleArea( SCCOL nStartCol
, SCROW nStartRow
,
1814 SCCOL nEndCol
, SCROW nEndRow
,
1815 const ScMarkData
& rMark
, const ScStyleSheet
& rStyle
);
1816 SC_DLLPUBLIC
void ApplyStyleAreaTab( SCCOL nStartCol
, SCROW nStartRow
,
1817 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nTab
,
1818 const ScStyleSheet
& rStyle
);
1820 SC_DLLPUBLIC
void ApplySelectionStyle( const ScStyleSheet
& rStyle
, const ScMarkData
& rMark
);
1821 void ApplySelectionLineStyle( const ScMarkData
& rMark
,
1822 const ::editeng::SvxBorderLine
* pLine
, bool bColorOnly
);
1824 const ScStyleSheet
* GetStyle( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1825 const ScStyleSheet
* GetSelectionStyle( const ScMarkData
& rMark
) const;
1827 void StyleSheetChanged( const SfxStyleSheetBase
* pStyleSheet
, bool bRemoved
,
1829 double nPPTX
, double nPPTY
,
1830 const Fraction
& rZoomX
, const Fraction
& rZoomY
);
1832 bool IsStyleSheetUsed( const ScStyleSheet
& rStyle
) const;
1834 SC_DLLPUBLIC
bool ApplyFlagsTab( SCCOL nStartCol
, SCROW nStartRow
,
1835 SCCOL nEndCol
, SCROW nEndRow
,
1836 SCTAB nTab
, ScMF nFlags
);
1837 SC_DLLPUBLIC
bool RemoveFlagsTab( SCCOL nStartCol
, SCROW nStartRow
,
1838 SCCOL nEndCol
, SCROW nEndRow
,
1839 SCTAB nTab
, ScMF nFlags
);
1841 SC_DLLPUBLIC
void SetPattern( const ScAddress
&, const ScPatternAttr
& rAttr
);
1842 SC_DLLPUBLIC
const ScPatternAttr
* SetPattern( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, std::unique_ptr
<ScPatternAttr
> );
1843 SC_DLLPUBLIC
void SetPattern( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, const ScPatternAttr
& rAttr
);
1845 void AutoFormat( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
1846 sal_uInt16 nFormatNo
, const ScMarkData
& rMark
);
1847 void GetAutoFormatData( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
1848 ScAutoFormatData
& rData
);
1849 bool SearchAndReplace( const SvxSearchItem
& rSearchItem
,
1850 SCCOL
& rCol
, SCROW
& rRow
, SCTAB
& rTab
,
1851 const ScMarkData
& rMark
, ScRangeList
& rMatchedRanges
,
1852 OUString
& rUndoStr
, ScDocument
* pUndoDoc
= nullptr );
1854 // determine Col/Row of subsequent calls
1855 // (e.g. not found from the beginning, or subsequent tables)
1856 // meaning of explanation in "()" was already unclear in German
1857 void GetSearchAndReplaceStart( const SvxSearchItem
& rSearchItem
,
1858 SCCOL
& rCol
, SCROW
& rRow
);
1860 bool Solver( SCCOL nFCol
, SCROW nFRow
, SCTAB nFTab
,
1861 SCCOL nVCol
, SCROW nVRow
, SCTAB nVTab
,
1862 const OUString
& sValStr
, double& nX
);
1864 SC_DLLPUBLIC
void ApplySelectionPattern( const ScPatternAttr
& rAttr
, const ScMarkData
& rMark
,
1865 ScEditDataArray
* pDataArray
= nullptr, bool* pIsChanged
= nullptr );
1866 void DeleteSelection( InsertDeleteFlags nDelFlag
, const ScMarkData
& rMark
, bool bBroadcast
= true );
1867 void DeleteSelectionTab( SCTAB nTab
, InsertDeleteFlags nDelFlag
, const ScMarkData
& rMark
);
1869 SC_DLLPUBLIC
void SetColWidth( SCCOL nCol
, SCTAB nTab
, sal_uInt16 nNewWidth
);
1870 SC_DLLPUBLIC
void SetColWidthOnly( SCCOL nCol
, SCTAB nTab
, sal_uInt16 nNewWidth
);
1871 SC_DLLPUBLIC
void SetRowHeight( SCROW nRow
, SCTAB nTab
, sal_uInt16 nNewHeight
);
1872 SC_DLLPUBLIC
void SetRowHeightRange( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
,
1873 sal_uInt16 nNewHeight
);
1875 SC_DLLPUBLIC
void SetRowHeightOnly( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
,
1876 sal_uInt16 nNewHeight
);
1877 SC_DLLPUBLIC
void SetManualHeight( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, bool bManual
);
1879 SC_DLLPUBLIC sal_uInt16
GetColWidth( SCCOL nCol
, SCTAB nTab
, bool bHiddenAsZero
= true ) const;
1880 SC_DLLPUBLIC sal_uLong
GetColWidth( SCCOL nStartCol
, SCCOL nEndCol
, SCTAB nTab
) const;
1881 SC_DLLPUBLIC sal_uInt16
GetRowHeight( SCROW nRow
, SCTAB nTab
, bool bHiddenAsZero
= true ) const;
1882 SC_DLLPUBLIC sal_uInt16
GetRowHeight( SCROW nRow
, SCTAB nTab
, SCROW
* pStartRow
, SCROW
* pEndRow
) const;
1883 SC_DLLPUBLIC sal_uLong
GetRowHeight( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, bool bHiddenAsZero
= true ) const;
1886 * Given the height i.e. total vertical distance from the top of the sheet
1887 * grid, return the first visible row whose top position is below the
1890 SCROW
GetRowForHeight( SCTAB nTab
, sal_uLong nHeight
) const;
1891 sal_uLong
GetScaledRowHeight( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, double fScale
, const sal_uLong
* pnMaxHeight
= nullptr ) const;
1892 SC_DLLPUBLIC sal_uLong
GetColOffset( SCCOL nCol
, SCTAB nTab
, bool bHiddenAsZero
= true ) const;
1893 SC_DLLPUBLIC sal_uLong
GetRowOffset( SCROW nRow
, SCTAB nTab
, bool bHiddenAsZero
= true ) const;
1895 SC_DLLPUBLIC sal_uInt16
GetOriginalWidth( SCCOL nCol
, SCTAB nTab
) const;
1896 SC_DLLPUBLIC sal_uInt16
GetOriginalHeight( SCROW nRow
, SCTAB nTab
) const;
1898 sal_uInt16
GetCommonWidth( SCCOL nEndCol
, SCTAB nTab
) const;
1900 SCROW
GetHiddenRowCount( SCROW nRow
, SCTAB nTab
) const;
1902 sal_uInt16
GetOptimalColWidth( SCCOL nCol
, SCTAB nTab
, OutputDevice
* pDev
,
1903 double nPPTX
, double nPPTY
,
1904 const Fraction
& rZoomX
, const Fraction
& rZoomY
,
1906 const ScMarkData
* pMarkData
= nullptr,
1907 const ScColWidthParam
* pParam
= nullptr );
1909 SC_DLLPUBLIC
bool SetOptimalHeight( sc::RowHeightContext
& rCxt
, SCROW nStartRow
,
1910 SCROW nEndRow
, SCTAB nTab
);
1912 void UpdateAllRowHeights( sc::RowHeightContext
& rCxt
, const ScMarkData
* pTabMark
);
1914 tools::Long
GetNeededSize( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1916 double nPPTX
, double nPPTY
,
1917 const Fraction
& rZoomX
, const Fraction
& rZoomY
,
1918 bool bWidth
, bool bTotalSize
= false,
1919 bool bInPrintTwips
= false );
1921 SC_DLLPUBLIC
void ShowCol(SCCOL nCol
, SCTAB nTab
, bool bShow
);
1922 SC_DLLPUBLIC
void ShowRow(SCROW nRow
, SCTAB nTab
, bool bShow
);
1923 SC_DLLPUBLIC
void ShowRows(SCROW nRow1
, SCROW nRow2
, SCTAB nTab
, bool bShow
);
1924 SC_DLLPUBLIC
void SetRowFlags( SCROW nRow
, SCTAB nTab
, CRFlags nNewFlags
);
1925 SC_DLLPUBLIC
void SetRowFlags( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, CRFlags nNewFlags
);
1927 SC_DLLPUBLIC CRFlags
GetColFlags( SCCOL nCol
, SCTAB nTab
) const;
1928 SC_DLLPUBLIC CRFlags
GetRowFlags( SCROW nRow
, SCTAB nTab
) const;
1930 SC_DLLPUBLIC
void GetAllRowBreaks(std::set
<SCROW
>& rBreaks
, SCTAB nTab
, bool bPage
, bool bManual
) const;
1931 SC_DLLPUBLIC
void GetAllColBreaks(std::set
<SCCOL
>& rBreaks
, SCTAB nTab
, bool bPage
, bool bManual
) const;
1932 SC_DLLPUBLIC ScBreakType
HasRowBreak(SCROW nRow
, SCTAB nTab
) const;
1933 SC_DLLPUBLIC ScBreakType
HasColBreak(SCCOL nCol
, SCTAB nTab
) const;
1934 SC_DLLPUBLIC
void SetRowBreak(SCROW nRow
, SCTAB nTab
, bool bPage
, bool bManual
);
1935 SC_DLLPUBLIC
void SetColBreak(SCCOL nCol
, SCTAB nTab
, bool bPage
, bool bManual
);
1936 void RemoveRowBreak(SCROW nRow
, SCTAB nTab
, bool bPage
, bool bManual
);
1937 void RemoveColBreak(SCCOL nCol
, SCTAB nTab
, bool bPage
, bool bManual
);
1939 css::sheet::TablePageBreakData
> GetRowBreakData(SCTAB nTab
) const;
1941 SC_DLLPUBLIC
bool RowHidden(SCROW nRow
, SCTAB nTab
, SCROW
* pFirstRow
= nullptr, SCROW
* pLastRow
= nullptr) const;
1942 SC_DLLPUBLIC
bool HasHiddenRows(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1943 SC_DLLPUBLIC
bool ColHidden(SCCOL nCol
, SCTAB nTab
, SCCOL
* pFirstCol
= nullptr, SCCOL
* pLastCol
= nullptr) const;
1944 SC_DLLPUBLIC
void SetRowHidden(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, bool bHidden
);
1945 SC_DLLPUBLIC
void SetColHidden(SCCOL nStartCol
, SCCOL nEndCol
, SCTAB nTab
, bool bHidden
);
1946 SC_DLLPUBLIC SCROW
FirstVisibleRow(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1947 SC_DLLPUBLIC SCROW
LastVisibleRow(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1948 SCROW
CountVisibleRows(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1950 SC_DLLPUBLIC
bool RowFiltered(SCROW nRow
, SCTAB nTab
, SCROW
* pFirstRow
= nullptr, SCROW
* pLastRow
= nullptr) const;
1951 bool HasFilteredRows(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1952 bool ColFiltered(SCCOL nCol
, SCTAB nTab
) const;
1953 SC_DLLPUBLIC
void SetRowFiltered(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, bool bFiltered
);
1954 SCROW
FirstNonFilteredRow(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1955 SCROW
LastNonFilteredRow(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1956 SCROW
CountNonFilteredRows(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1958 SC_DLLPUBLIC
bool IsManualRowHeight(SCROW nRow
, SCTAB nTab
) const;
1960 bool HasUniformRowHeight( SCTAB nTab
, SCROW nRow1
, SCROW nRow2
) const;
1963 * Write all column row flags to table's flag data, because not all column
1964 * row attributes are stored in the flag data members. This is necessary
1967 void SyncColRowFlags();
1969 /// @return the index of the last row with any set flags (auto-pagebreak is ignored).
1970 SC_DLLPUBLIC SCROW
GetLastFlaggedRow( SCTAB nTab
) const;
1972 /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored).
1973 SCCOL
GetLastChangedCol( SCTAB nTab
) const;
1974 /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
1975 SCROW
GetLastChangedRow( SCTAB nTab
) const;
1977 SCCOL
GetNextDifferentChangedCol( SCTAB nTab
, SCCOL nStart
) const;
1979 SCROW
GetNextDifferentChangedRow( SCTAB nTab
, SCROW nStart
) const;
1981 // returns whether to export a Default style for this col or not
1982 // nDefault is set to one position in the current row where the Default style is
1983 void GetColDefault( SCTAB nTab
, SCCOL nCol
, SCROW nLastRow
, SCROW
& nDefault
);
1985 bool UpdateOutlineCol( SCCOL nStartCol
, SCCOL nEndCol
, SCTAB nTab
, bool bShow
);
1986 bool UpdateOutlineRow( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, bool bShow
);
1988 void StripHidden( SCCOL
& rX1
, SCROW
& rY1
, SCCOL
& rX2
, SCROW
& rY2
, SCTAB nTab
);
1989 void ExtendHidden( SCCOL
& rX1
, SCROW
& rY1
, SCCOL
& rX2
, SCROW
& rY2
, SCTAB nTab
);
1991 SC_DLLPUBLIC ScPatternAttr
* GetDefPattern() const;
1992 SC_DLLPUBLIC ScDocumentPool
* GetPool();
1993 SC_DLLPUBLIC ScStyleSheetPool
* GetStyleSheetPool() const;
1994 void GetUnprotectedCells( ScRangeList
& rRange
, SCTAB nTab
) const;
1997 SC_DLLPUBLIC OUString
GetPageStyle( SCTAB nTab
) const;
1998 SC_DLLPUBLIC
void SetPageStyle( SCTAB nTab
, const OUString
& rName
);
1999 Size
GetPageSize( SCTAB nTab
) const;
2000 void SetPageSize( SCTAB nTab
, const Size
& rSize
);
2001 void SetRepeatArea( SCTAB nTab
, SCCOL nStartCol
, SCCOL nEndCol
, SCROW nStartRow
, SCROW nEndRow
);
2002 void InvalidatePageBreaks(SCTAB nTab
);
2003 void UpdatePageBreaks( SCTAB nTab
, const ScRange
* pUserArea
= nullptr );
2004 void RemoveManualBreaks( SCTAB nTab
);
2005 bool HasManualBreaks( SCTAB nTab
) const;
2007 bool IsPageStyleInUse( const OUString
& rStrPageStyle
, SCTAB
* pInTab
);
2008 bool RemovePageStyleInUse( const OUString
& rStrPageStyle
);
2009 bool RenamePageStyleInUse( const OUString
& rOld
, const OUString
& rNew
);
2010 void ModifyStyleSheet( SfxStyleSheetBase
& rPageStyle
,
2011 const SfxItemSet
& rChanges
);
2013 void PageStyleModified( SCTAB nTab
, const OUString
& rNewName
);
2015 SC_DLLPUBLIC
bool NeedPageResetAfterTab( SCTAB nTab
) const;
2017 // Was stored in PageStyle previously. Now it exists for every table:
2018 SC_DLLPUBLIC
bool HasPrintRange();
2019 SC_DLLPUBLIC sal_uInt16
GetPrintRangeCount( SCTAB nTab
);
2020 SC_DLLPUBLIC
const ScRange
* GetPrintRange( SCTAB nTab
, sal_uInt16 nPos
);
2021 SC_DLLPUBLIC
const ScRange
* GetRepeatColRange( SCTAB nTab
);
2022 SC_DLLPUBLIC
const ScRange
* GetRepeatRowRange( SCTAB nTab
);
2023 /** Returns true, if the specified sheet is always printed. */
2024 bool IsPrintEntireSheet( SCTAB nTab
) const;
2026 /** Removes all print ranges. */
2027 SC_DLLPUBLIC
void ClearPrintRanges( SCTAB nTab
);
2028 /** Adds a new print ranges. */
2029 SC_DLLPUBLIC
void AddPrintRange( SCTAB nTab
, const ScRange
& rNew
);
2030 /** Marks the specified sheet to be printed completely. Deletes old print ranges on the sheet! */
2031 SC_DLLPUBLIC
void SetPrintEntireSheet( SCTAB nTab
);
2032 SC_DLLPUBLIC
void SetRepeatColRange( SCTAB nTab
, std::unique_ptr
<ScRange
> pNew
);
2033 SC_DLLPUBLIC
void SetRepeatRowRange( SCTAB nTab
, std::unique_ptr
<ScRange
> pNew
);
2034 std::unique_ptr
<ScPrintRangeSaver
> CreatePrintRangeSaver() const;
2035 void RestorePrintRanges( const ScPrintRangeSaver
& rSaver
);
2037 SC_DLLPUBLIC
tools::Rectangle
GetMMRect( SCCOL nStartCol
, SCROW nStartRow
,
2038 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nTab
, bool bHiddenAsZero
= true ) const;
2039 SC_DLLPUBLIC ScRange
GetRange( SCTAB nTab
, const tools::Rectangle
& rMMRect
, bool bHiddenAsZero
= true ) const;
2041 void UpdStlShtPtrsFrmNms();
2042 void StylesToNames();
2044 SC_DLLPUBLIC
void CopyStdStylesFrom( const ScDocument
& rSrcDoc
);
2046 static sal_uInt16
GetSrcVersion() { return nSrcVer
; }
2048 void SetSrcCharSet( rtl_TextEncoding eNew
) { eSrcSet
= eNew
; }
2049 void UpdateFontCharSet();
2051 void FillInfo( ScTableInfo
& rTabInfo
, SCCOL nCol1
, SCROW nRow1
,
2052 SCCOL nCol2
, SCROW nRow2
, SCTAB nTab
, double fColScale
,
2053 double fRowScale
, bool bPageMode
, bool bFormulaMode
,
2054 const ScMarkData
* pMarkData
= nullptr );
2056 SC_DLLPUBLIC SvNumberFormatter
* GetFormatTable() const;
2058 /** Sort a range of data. */
2059 void Sort( SCTAB nTab
, const ScSortParam
& rSortParam
,
2060 bool bKeepQuery
, bool bUpdateRefs
,
2061 ScProgress
* pProgress
, sc::ReorderParam
* pUndo
);
2063 void Reorder( const sc::ReorderParam
& rParam
);
2065 SCSIZE
Query( SCTAB nTab
, const ScQueryParam
& rQueryParam
, bool bKeepSub
);
2066 SC_DLLPUBLIC
bool CreateQueryParam( const ScRange
& rRange
, ScQueryParam
& rQueryParam
);
2067 void GetUpperCellString(SCCOL nCol
, SCROW nRow
, SCTAB nTab
, OUString
& rStr
);
2070 * Get a list of unique strings to use in filtering criteria. The string
2071 * values are sorted, and there are no duplicate values in the list. The
2072 * data range to use to populate the filter entries is inferred from the
2073 * database range that contains the specified cell position.
2075 void GetFilterEntries( SCCOL nCol
, SCROW nRow
,
2076 SCTAB nTab
, ScFilterEntries
& rFilterEntries
);
2078 SC_DLLPUBLIC
void GetFilterEntriesArea( SCCOL nCol
, SCROW nStartRow
, SCROW nEndRow
,
2079 SCTAB nTab
, bool bCaseSens
,
2080 ScFilterEntries
& rFilterEntries
);
2082 void GetDataEntries( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
2083 std::vector
<ScTypedStrData
>& rStrings
, bool bLimit
= false );
2084 void GetFormulaEntries( ScTypedCaseStrSet
& rStrings
);
2086 bool HasAutoFilter( SCCOL nCol
, SCROW nRow
, SCTAB nTab
);
2087 void GetFilterSelCount( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, SCSIZE
& nSelected
, SCSIZE
& nTotal
);
2089 SC_DLLPUBLIC
bool HasColHeader( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
2091 SC_DLLPUBLIC
bool HasRowHeader( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
2094 SfxPrinter
* GetPrinter( bool bCreateIfNotExist
= true );
2095 void SetPrinter( VclPtr
<SfxPrinter
> const & pNewPrinter
);
2096 VirtualDevice
* GetVirtualDevice_100th_mm();
2097 SC_DLLPUBLIC OutputDevice
* GetRefDevice(); // WYSIWYG: Printer, otherwise VirtualDevice...
2099 bool GetNextSpellingCell( SCCOL
& nCol
, SCROW
& nRow
, SCTAB nTab
,
2100 bool bInSel
, const ScMarkData
& rMark
) const;
2102 void ReplaceStyle( const SvxSearchItem
& rSearchItem
,
2103 SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
2104 const ScMarkData
& rMark
);
2106 void InvalidateTextWidth( const OUString
& rStyleName
);
2107 void InvalidateTextWidth( SCTAB nTab
);
2108 void InvalidateTextWidth( const ScAddress
* pAdrFrom
, const ScAddress
* pAdrTo
, bool bNumFormatChanged
);
2110 bool IdleCalcTextWidth();
2112 void RepaintRange( const ScRange
& rRange
);
2113 void RepaintRange( const ScRangeList
& rRange
);
2115 bool IsIdleEnabled() const { return mbIdleEnabled
; }
2116 void EnableIdle(bool bDo
) { mbIdleEnabled
= bDo
; }
2118 bool IsDetectiveDirty() const { return bDetectiveDirty
; }
2119 void SetDetectiveDirty(bool bSet
) { bDetectiveDirty
= bSet
; }
2121 bool HasLinkFormulaNeedingCheck() const { return bLinkFormulaNeedingCheck
; }
2122 void SetLinkFormulaNeedingCheck(bool bSet
) { bLinkFormulaNeedingCheck
= bSet
; }
2123 /** Check token array and set link check if ocDde/ocWebservice is contained. */
2124 SC_DLLPUBLIC
void CheckLinkFormulaNeedingCheck( const ScTokenArray
& rCode
);
2126 void SetRangeOverflowType(ErrCode nType
) { nRangeOverflowType
= nType
; }
2127 bool HasRangeOverflow() const { return nRangeOverflowType
!= ERRCODE_NONE
; }
2128 SC_DLLPUBLIC
const ErrCode
& GetRangeOverflowType() const { return nRangeOverflowType
; }
2130 // for broadcasting/listening
2131 void SetInsertingFromOtherDoc( bool bVal
) { bInsertingFromOtherDoc
= bVal
; }
2132 bool IsInsertingFromOtherDoc() const { return bInsertingFromOtherDoc
; }
2133 void SetLoadingMedium( bool bVal
);
2134 SC_DLLPUBLIC
void SetImportingXML( bool bVal
);
2135 bool IsImportingXML() const { return bImportingXML
; }
2136 bool IsCalcingAfterLoad() const { return bCalcingAfterLoad
; }
2137 void SetNoListening( bool bVal
) { bNoListening
= bVal
; }
2138 bool GetNoListening() const { return bNoListening
; }
2139 ScBroadcastAreaSlotMachine
* GetBASM() const { return pBASM
.get(); }
2141 SC_DLLPUBLIC ScChartListenerCollection
* GetChartListenerCollection() const { return pChartListenerCollection
.get(); }
2142 void SetChartListenerCollection( std::unique_ptr
<ScChartListenerCollection
>,
2143 bool bSetChartRangeLists
);
2144 void UpdateChart( const OUString
& rName
);
2145 void RestoreChartListener( const OUString
& rName
);
2146 SC_DLLPUBLIC
void UpdateChartListenerCollection();
2147 bool IsChartListenerCollectionNeedsUpdate() const { return bChartListenerCollectionNeedsUpdate
; }
2148 void SetChartListenerCollectionNeedsUpdate( bool bFlg
) { bChartListenerCollectionNeedsUpdate
= bFlg
; }
2149 void AddOLEObjectToCollection(const OUString
& rName
);
2151 ScChangeViewSettings
* GetChangeViewSettings() const { return pChangeViewSettings
.get(); }
2152 SC_DLLPUBLIC
void SetChangeViewSettings(const ScChangeViewSettings
& rNew
);
2154 const std::shared_ptr
<SvxForbiddenCharactersTable
>& GetForbiddenCharacters() const;
2155 void SetForbiddenCharacters(const std::shared_ptr
<SvxForbiddenCharactersTable
>& rNew
);
2157 CharCompressType
GetAsianCompression() const;
2158 bool IsValidAsianCompression() const;
2159 void SetAsianCompression(CharCompressType nNew
);
2161 bool GetAsianKerning() const;
2162 bool IsValidAsianKerning() const;
2163 void SetAsianKerning(bool bNew
);
2164 void ApplyAsianEditSettings(ScEditEngineDefaulter
& rEngine
);
2166 EEHorizontalTextDirection
GetEditTextDirection(SCTAB nTab
) const; // EEHorizontalTextDirection values
2168 SC_DLLPUBLIC ScLkUpdMode
GetLinkMode() const { return eLinkMode
;}
2169 void SetLinkMode( ScLkUpdMode nSet
) { eLinkMode
= nSet
;}
2171 SC_DLLPUBLIC ScMacroManager
* GetMacroManager();
2173 void FillMatrix( ScMatrix
& rMat
, SCTAB nTab
, SCCOL nCol1
,
2174 SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
2175 svl::SharedStringPool
* pPool
= nullptr) const;
2178 * Set an array of numerical formula results to a group of contiguous
2181 * @param rTopPos position of the top formula cell of a group.
2182 * @param pResults array of numeric results.
2183 * @param nLen length of numeric results.
2185 void SC_DLLPUBLIC
SetFormulaResults( const ScAddress
& rTopPos
, const double* pResults
, size_t nLen
);
2187 void CalculateInColumnInThread( ScInterpreterContext
& rContext
, const ScRange
& rCalcRange
, unsigned nThisThread
, unsigned nThreadsTotal
);
2188 void HandleStuffAfterParallelCalculation( SCCOL nColStart
, SCCOL nColEnd
, SCROW nRow
, size_t nLen
, SCTAB nTab
, ScInterpreter
* pInterpreter
);
2191 * Transfer a series of contiguous cell values from specified position to
2192 * the passed container. The specified segment will become empty after the
2195 void TransferCellValuesTo( const ScAddress
& rTopPos
, size_t nLen
, sc::CellValues
& rDest
);
2196 void CopyCellValuesFrom( const ScAddress
& rTopPos
, const sc::CellValues
& rSrc
);
2198 std::set
<Color
> GetDocColors();
2199 sc::IconSetBitmapMap
& GetIconSetBitmapMap();
2202 ScDocument(const ScDocument
& r
) = delete;
2204 void FindMaxRotCol( SCTAB nTab
, RowInfo
* pRowInfo
, SCSIZE nArrCount
,
2205 SCCOL nX1
, SCCOL nX2
) const;
2207 sal_uInt16
RowDifferences( SCROW nThisRow
, SCTAB nThisTab
,
2208 ScDocument
& rOtherDoc
,
2209 SCROW nOtherRow
, SCTAB nOtherTab
,
2210 SCCOL nMaxCol
, const SCCOLROW
* pOtherCols
);
2211 sal_uInt16
ColDifferences( SCCOL nThisCol
, SCTAB nThisTab
,
2212 ScDocument
& rOtherDoc
,
2213 SCCOL nOtherCol
, SCTAB nOtherTab
,
2214 SCROW nMaxRow
, const SCCOLROW
* pOtherRows
);
2215 void FindOrder( SCCOLROW
* pOtherRows
, SCCOLROW nThisEndRow
, SCCOLROW nOtherEndRow
,
2217 ScDocument
& rOtherDoc
, SCTAB nThisTab
, SCTAB nOtherTab
,
2218 SCCOLROW nEndCol
, const SCCOLROW
* pTranslate
,
2219 ScProgress
* pProgress
, sal_uLong nProAdd
);
2221 DECL_LINK(TrackTimeHdl
, Timer
*, void);
2223 /** Adjust a range to available sheets.
2225 Used to start and stop listening on a sane range. Both o_rRange and
2226 o_bEntirelyOutOfBounds are set only if needed and don't have to be
2227 initialized by the caller.
2229 @param o_bEntirelyOutOfBounds
2230 <TRUE/> if both sheets in the range point outside the
2231 available sheet range, in which case no adjustment is done and
2232 o_rRange is not modified.
2234 @return <TRUE/> if any adjustment was done or o_bEntirelyOutOfBounds
2236 <FALSE/> if rRange was within the available sheets.
2238 bool LimitRangeToAvailableSheets( const ScRange
& rRange
, ScRange
& o_rRange
,
2239 bool& o_bEntirelyOutOfBounds
) const;
2242 void StartListeningArea( const ScRange
& rRange
, bool bGroupListening
, SvtListener
* pListener
);
2244 void EndListeningArea( const ScRange
& rRange
, bool bGroupListening
, SvtListener
* pListener
);
2245 /** Broadcast wrapper, calls
2246 rHint.GetCell()->Broadcast() and AreaBroadcast()
2250 void Broadcast( const ScHint
& rHint
);
2252 void BroadcastCells( const ScRange
& rRange
, SfxHintId nHint
, bool bBroadcastSingleBroadcasters
= true );
2254 /// only area, no cell broadcast
2255 void AreaBroadcast( const ScHint
& rHint
);
2256 void DelBroadcastAreasInRange( const ScRange
& rRange
);
2257 void UpdateBroadcastAreas( UpdateRefMode eUpdateRefMode
,
2258 const ScRange
& rRange
,
2259 SCCOL nDx
, SCROW nDy
, SCTAB nDz
);
2261 void StartListeningCell( const ScAddress
& rAddress
,
2262 SvtListener
* pListener
);
2263 void EndListeningCell( const ScAddress
& rAddress
,
2264 SvtListener
* pListener
);
2266 void StartListeningCell( sc::StartListeningContext
& rCxt
, const ScAddress
& rPos
, SvtListener
& rListener
);
2267 void EndListeningCell( sc::EndListeningContext
& rCxt
, const ScAddress
& rPos
, SvtListener
& rListener
);
2269 void EndListeningFormulaCells( std::vector
<ScFormulaCell
*>& rCells
);
2271 void PutInFormulaTree( ScFormulaCell
* pCell
);
2272 void RemoveFromFormulaTree( ScFormulaCell
* pCell
);
2275 * Calculate formula cells that are on the formula tree either partially,
2278 * @param bOnlyForced when true, it only calculates those formula cells
2279 * that are marked "recalc forced".
2280 * @param bProgressBar whether or not to use progress bar.
2281 * @param bSetAllDirty when true, it marks all formula cells currently on
2282 * the formula tree dirty, which forces all of them to
2283 * be recalculated. When false, only those cells
2284 * that are marked dirty prior to this call get
2287 SC_DLLPUBLIC
void CalcFormulaTree( bool bOnlyForced
= false, bool bProgressBar
= true, bool bSetAllDirty
= true );
2288 void ClearFormulaTree();
2289 void AppendToFormulaTrack( ScFormulaCell
* pCell
);
2290 void RemoveFromFormulaTrack( ScFormulaCell
* pCell
);
2291 void TrackFormulas( SfxHintId nHintId
= SfxHintId::ScDataChanged
);
2292 void SetTrackFormulasPending() { mbTrackFormulasPending
= true; }
2293 bool IsTrackFormulasPending() const { return mbTrackFormulasPending
; }
2294 void FinalTrackFormulas( SfxHintId nHintId
);
2295 bool IsFinalTrackFormulas() const { return mbFinalTrackFormulas
; }
2296 bool IsInFormulaTree( const ScFormulaCell
* pCell
) const;
2297 bool IsInFormulaTrack( const ScFormulaCell
* pCell
) const;
2298 HardRecalcState
GetHardRecalcState() const { return eHardRecalcState
; }
2299 void SetHardRecalcState( HardRecalcState eVal
) { eHardRecalcState
= eVal
; }
2300 void StartAllListeners();
2301 void StartNeededListeners();
2302 void StartNeededListeners( const std::shared_ptr
<const sc::ColumnSet
>& rpColSet
);
2303 void StartAllListeners( const ScRange
& rRange
);
2305 void SetForcedFormulas( bool bVal
) { bHasForcedFormulas
= bVal
; }
2306 sal_uLong
GetFormulaCodeInTree() const { return nFormulaCodeInTree
; }
2308 bool IsInInterpreter() const { return nInterpretLevel
!= 0; }
2310 void IncInterpretLevel()
2312 assert(!IsThreadedGroupCalcInProgress());
2313 if ( nInterpretLevel
< USHRT_MAX
)
2316 void DecInterpretLevel()
2318 assert(!IsThreadedGroupCalcInProgress());
2319 if ( nInterpretLevel
)
2322 sal_uInt16
GetMacroInterpretLevel() const { return nMacroInterpretLevel
; }
2323 void IncMacroInterpretLevel()
2325 assert(!IsThreadedGroupCalcInProgress());
2326 if ( nMacroInterpretLevel
< USHRT_MAX
)
2327 nMacroInterpretLevel
++;
2329 void DecMacroInterpretLevel()
2331 assert(!IsThreadedGroupCalcInProgress());
2332 if ( nMacroInterpretLevel
)
2333 nMacroInterpretLevel
--;
2335 bool IsInInterpreterTableOp() const { return nInterpreterTableOpLevel
!= 0; }
2336 void IncInterpreterTableOpLevel()
2338 if ( nInterpreterTableOpLevel
< USHRT_MAX
)
2339 nInterpreterTableOpLevel
++;
2341 void DecInterpreterTableOpLevel()
2343 if ( nInterpreterTableOpLevel
)
2344 nInterpreterTableOpLevel
--;
2347 // add a formula to be remembered for TableOp broadcasts
2348 void AddTableOpFormulaCell( ScFormulaCell
* );
2349 void InvalidateLastTableOpParams() { aLastTableOpParams
.bValid
= false; }
2350 ScRecursionHelper
& GetRecursionHelper();
2351 bool IsInDtorClear() const { return bInDtorClear
; }
2352 void SetExpandRefs( bool bVal
);
2353 bool IsExpandRefs() const { return bExpandRefs
; }
2355 sal_uLong
GetXMLImportedFormulaCount() const { return nXMLImportedFormulaCount
; }
2356 void IncXMLImportedFormulaCount( sal_uLong nVal
)
2358 if ( nXMLImportedFormulaCount
+ nVal
> nXMLImportedFormulaCount
)
2359 nXMLImportedFormulaCount
+= nVal
;
2361 void DecXMLImportedFormulaCount( sal_uLong nVal
)
2363 if ( nVal
<= nXMLImportedFormulaCount
)
2364 nXMLImportedFormulaCount
-= nVal
;
2366 nXMLImportedFormulaCount
= 0;
2369 void StartTrackTimer();
2371 void CompileDBFormula();
2372 void CompileColRowNameFormula();
2374 /** Maximum string length of a column, e.g. for dBase export.
2375 @return String length in octets (!) of the destination encoding. In
2376 case of non-octet encodings (e.g. UCS2) the length in code
2377 points times sizeof(sal_Unicode) is returned. */
2378 sal_Int32
GetMaxStringLen( SCTAB nTab
, SCCOL nCol
,
2379 SCROW nRowStart
, SCROW nRowEnd
,
2380 rtl_TextEncoding eCharSet
) const;
2381 /** Maximum string length of numerical cells of a column, e.g. for dBase export.
2382 @return String length in characters (!) including the decimal
2383 separator, and the decimal precision needed. */
2384 sal_Int32
GetMaxNumberStringLen( sal_uInt16
& nPrecision
,
2385 SCTAB nTab
, SCCOL nCol
,
2386 SCROW nRowStart
, SCROW nRowEnd
) const;
2388 void KeyInput(); // TimerDelays etc.
2390 ScChangeTrack
* GetChangeTrack() const { return pChangeTrack
.get(); }
2392 //! only for import filter, deletes any existing ChangeTrack via
2393 //! EndChangeTracking() and takes ownership of new ChangeTrack pTrack
2394 SC_DLLPUBLIC
void SetChangeTrack( std::unique_ptr
<ScChangeTrack
> pTrack
);
2396 void StartChangeTracking();
2397 void EndChangeTracking();
2399 SC_DLLPUBLIC
void CompareDocument( ScDocument
& rOtherDoc
);
2401 void AddUnoObject( SfxListener
& rObject
);
2402 void RemoveUnoObject( SfxListener
& rObject
);
2403 void BroadcastUno( const SfxHint
&rHint
);
2404 void AddUnoListenerCall( const css::uno::Reference
<
2405 css::util::XModifyListener
>& rListener
,
2406 const css::lang::EventObject
& rEvent
);
2408 void SetInLinkUpdate(bool bSet
); // TableLink or AreaLink
2409 bool IsInLinkUpdate() const; // including DdeLink
2411 SC_DLLPUBLIC SfxItemPool
* GetEditPool() const;
2412 SC_DLLPUBLIC SfxItemPool
* GetEnginePool() const;
2413 SC_DLLPUBLIC ScFieldEditEngine
& GetEditEngine();
2414 SC_DLLPUBLIC ScNoteEditEngine
& GetNoteEngine();
2416 std::unique_ptr
<ScRefreshTimerControl
> const & GetRefreshTimerControlAddress() const
2417 { return pRefreshTimerControl
; }
2419 void SetPastingDrawFromOtherDoc( bool bVal
)
2420 { bPastingDrawFromOtherDoc
= bVal
; }
2421 bool PastingDrawFromOtherDoc() const
2422 { return bPastingDrawFromOtherDoc
; }
2424 /// an ID unique to each document instance
2425 sal_uInt32
GetDocumentID() const;
2427 void InvalidateStyleSheetUsage() { bStyleSheetUsageInvalid
= true; }
2428 void SC_DLLPUBLIC
GetSortParam( ScSortParam
& rParam
, SCTAB nTab
);
2429 void SC_DLLPUBLIC
SetSortParam( const ScSortParam
& rParam
, SCTAB nTab
);
2431 void SetVbaEventProcessor( const css::uno::Reference
< css::script::vba::XVBAEventProcessor
>& rxVbaEvents
)
2432 { mxVbaEvents
= rxVbaEvents
; }
2433 const css::uno::Reference
< css::script::vba::XVBAEventProcessor
>& GetVbaEventProcessor() const { return mxVbaEvents
; }
2435 /** Should only be GRAM_PODF or GRAM_ODFF. */
2436 void SetStorageGrammar( formula::FormulaGrammar::Grammar eGrammar
);
2437 formula::FormulaGrammar::Grammar
GetStorageGrammar() const { return eStorageGrammar
; }
2439 SC_DLLPUBLIC SfxUndoManager
* GetUndoManager();
2440 bool IsInVBAMode() const;
2441 ScRowBreakIterator
* GetRowBreakIterator(SCTAB nTab
) const;
2443 void AddSubTotalCell(ScFormulaCell
* pCell
);
2444 void RemoveSubTotalCell(ScFormulaCell
* pCell
);
2445 void SetSubTotalCellsDirty(const ScRange
& rDirtyRange
);
2447 sal_uInt16
GetTextWidth( const ScAddress
& rPos
) const;
2449 SvtScriptType
GetScriptType( const ScAddress
& rPos
) const;
2450 void SetScriptType( const ScAddress
& rPos
, SvtScriptType nType
);
2451 void UpdateScriptTypes( const ScAddress
& rPos
, SCCOL nColSize
, SCROW nRowSize
);
2453 size_t GetFormulaHash( const ScAddress
& rPos
) const;
2456 * Make specified formula cells non-grouped.
2458 * @param nTab sheet index
2459 * @param nCol column index
2460 * @param rRows list of row indices at which formula cells are to be
2461 * unshared. This call sorts the passed row indices and
2462 * removes duplicates, which is why the caller must pass it
2465 void UnshareFormulaCells( SCTAB nTab
, SCCOL nCol
, std::vector
<SCROW
>& rRows
);
2466 void RegroupFormulaCells( SCTAB nTab
, SCCOL nCol
);
2467 void RegroupFormulaCells( const ScRange
& range
);
2469 ScFormulaVectorState
GetFormulaVectorState( const ScAddress
& rPos
) const;
2471 formula::FormulaTokenRef
ResolveStaticReference( const ScAddress
& rPos
);
2472 formula::FormulaTokenRef
ResolveStaticReference( const ScRange
& rRange
);
2474 formula::VectorRefArray
FetchVectorRefArray( const ScAddress
& rPos
, SCROW nLength
);
2475 bool HandleRefArrayForParallelism( const ScAddress
& rPos
, SCROW nLength
, const ScFormulaCellGroupRef
& mxGroup
);
2477 void AssertNoInterpretNeeded( const ScAddress
& rPos
, SCROW nLength
);
2481 * Call this before any operations that might trigger one or more formula
2482 * cells to get calculated.
2484 void PrepareFormulaCalc();
2487 * Make sure all of the formula cells in the specified range have been
2488 * fully calculated. This method only re-calculates those formula cells
2489 * that have been flagged dirty. In case of formula-groups, this calculates
2490 * only the dirty subspans along with the dependents in the same way
2493 * @param rRange range in which to potentially calculate the formula
2495 * @param bSkipRunning flag to skip evaluation of formula-cells that are
2496 * marked as already being evaluated.
2497 * @return true if at least one formula-cell in the specified range was dirty
2498 * else returns false.
2500 SC_DLLPUBLIC
bool EnsureFormulaCellResults( const ScRange
& rRange
, bool bSkipRunning
= false );
2502 SvtBroadcaster
* GetBroadcaster( const ScAddress
& rPos
);
2503 const SvtBroadcaster
* GetBroadcaster( const ScAddress
& rPos
) const;
2504 void DeleteBroadcasters( sc::ColumnBlockPosition
& rBlockPos
, const ScAddress
& rTopPos
, SCROW nLength
);
2506 std::unique_ptr
<sc::ColumnIterator
> GetColumnIterator( SCTAB nTab
, SCCOL nCol
, SCROW nRow1
, SCROW nRow2
) const;
2507 void CreateColumnIfNotExists( SCTAB nTab
, SCCOL nCol
);
2509 SC_DLLPUBLIC
void StoreTabToCache(SCTAB nTab
, SvStream
& rStrm
) const;
2510 SC_DLLPUBLIC
void RestoreTabFromCache(SCTAB nTab
, SvStream
& rStream
);
2512 #if DUMP_COLUMN_STORAGE
2513 SC_DLLPUBLIC
void DumpColumnStorage( SCTAB nTab
, SCCOL nCol
) const;
2516 #if DEBUG_AREA_BROADCASTER
2517 SC_DLLPUBLIC
void DumpAreaBroadcasters() const;
2520 SC_DLLPUBLIC
void SetCalcConfig( const ScCalcConfig
& rConfig
);
2521 const ScCalcConfig
& GetCalcConfig() const { return maCalcConfig
; }
2522 void ConvertFormulaToValue( const ScRange
& rRange
, sc::TableValues
* pUndo
);
2523 void SwapNonEmpty( sc::TableValues
& rValues
);
2524 void finalizeOutlineImport();
2525 bool TableExists( SCTAB nTab
) const;
2527 SC_DLLPUBLIC ScColumnsRange
GetColumnsRange(SCTAB nTab
, SCCOL nColBegin
, SCCOL nColEnd
) const;
2529 bool IsInDocShellRecalc() const { return mbDocShellRecalc
; }
2530 void SetDocShellRecalc(bool bSet
) { mbDocShellRecalc
= bSet
; }
2533 * Serializes the specified sheet's geometry data.
2535 * @param nTab is the index of the sheet to operate on.
2536 * @param bColumns - if true it dumps the data for columns, else it does for rows.
2537 * @param eGeomType indicates the type of data to be dumped for rows/columns.
2538 * @return the serialization of the specified sheet's geometry data as an OString.
2540 OString
dumpSheetGeomData(SCTAB nTab
, bool bColumns
, SheetGeomType eGeomType
);
2542 SCCOL
GetLOKFreezeCol(SCTAB nTab
) const;
2543 SCROW
GetLOKFreezeRow(SCTAB nTab
) const;
2544 bool SetLOKFreezeCol(SCCOL nFreezeCol
, SCTAB nTab
);
2545 bool SetLOKFreezeRow(SCROW nFreezeRow
, SCTAB nTab
);
2550 * Use this class as a locale variable to merge number formatter from
2551 * another document, and set NULL pointer to pFormatExchangeList when
2554 class NumFmtMergeHandler
2557 explicit NumFmtMergeHandler(ScDocument
& rDoc
, const ScDocument
& rSrcDoc
);
2558 ~NumFmtMergeHandler();
2564 ScTable
* FetchTable( SCTAB nTab
);
2565 const ScTable
* FetchTable( SCTAB nTab
) const;
2567 void MergeNumberFormatter(const ScDocument
& rSrcDoc
);
2569 void ImplCreateOptions(); // Suggestion: switch to on-demand?
2570 void ImplDeleteOptions();
2572 void DeleteDrawLayer();
2573 SC_DLLPUBLIC
bool DrawGetPrintArea( ScRange
& rRange
, bool bSetHor
, bool bSetVer
) const;
2575 void UpdateDrawPrinter();
2576 void UpdateDrawLanguages();
2577 SC_DLLPUBLIC
void InitClipPtrs( ScDocument
* pSourceDoc
);
2579 void LoadDdeLinks(SvStream
& rStream
);
2580 void SaveDdeLinks(SvStream
& rStream
) const;
2582 void DeleteAreaLinksOnTab( SCTAB nTab
);
2583 void UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode
,
2584 const ScRange
& r
, SCCOL nDx
, SCROW nDy
, SCTAB nDz
);
2586 void CopyRangeNamesToClip(ScDocument
* pClipDoc
, const ScRange
& rClipRange
, const ScMarkData
* pMarks
);
2588 bool HasPartOfMerged( const ScRange
& rRange
);
2590 ScRefCellValue
GetRefCellValue( const ScAddress
& rPos
);
2591 ScRefCellValue
GetRefCellValue( const ScAddress
& rPos
, sc::ColumnBlockPosition
& rBlockPos
);
2593 std::map
< SCTAB
, ScSortParam
> mSheetSortParams
;
2595 SCSIZE
GetPatternCount( SCTAB nTab
, SCCOL nCol
) const;
2596 SCSIZE
GetPatternCount( SCTAB nTab
, SCCOL nCol
, SCROW nRow1
, SCROW nRow2
) const;
2597 void ReservePatternCount( SCTAB nTab
, SCCOL nCol
, SCSIZE nReserve
);
2599 void SharePooledResources( const ScDocument
* pSrcDoc
);
2601 void EndListeningIntersectedGroup(
2602 sc::EndListeningContext
& rCxt
, const ScAddress
& rPos
, std::vector
<ScAddress
>* pGroupPos
);
2604 void EndListeningIntersectedGroups(
2605 sc::EndListeningContext
& rCxt
, const ScRange
& rRange
, std::vector
<ScAddress
>* pGroupPos
);
2607 void EndListeningGroups( const std::vector
<ScAddress
>& rPosArray
);
2608 void SetNeedsListeningGroups( const std::vector
<ScAddress
>& rPosArray
);
2611 typedef std::unique_ptr
<ScDocument
, o3tl::default_delete
<ScDocument
>> ScDocumentUniquePtr
;
2614 * Instantiate this to ensure that subsequent modification of
2615 * the document will cause an assertion failure while this is
2618 struct ScMutationDisable
2621 ScMutationDisable(ScDocument
& rDocument
, ScMutationGuardFlags nFlags
)
2622 : mnFlagRestore(rDocument
.mnMutationGuardFlags
)
2623 , mrDocument(rDocument
)
2625 assert((mnFlagRestore
& nFlags
) == 0);
2626 mrDocument
.mnMutationGuardFlags
|= static_cast<size_t>(nFlags
);
2628 ~ScMutationDisable()
2630 mrDocument
.mnMutationGuardFlags
= mnFlagRestore
;
2632 size_t mnFlagRestore
;
2633 ScDocument
& mrDocument
;
2635 ScMutationDisable(ScDocument
& rDocument
, ScMutationGuardFlags nFlags
)
2637 (void)rDocument
; (void)nFlags
;
2643 * A pretty assertion that checks that the relevant bits in
2644 * the @nFlags are not set on the document at entry and exit.
2646 * Its primary use is for debugging threading. As such, an
2647 * @ScMutationDisable is created to forbid mutation, and this
2648 * condition is then asserted on at prominent sites that
2651 struct ScMutationGuard
2654 ScMutationGuard(ScDocument
& rDocument
, ScMutationGuardFlags nFlags
)
2655 : mnFlags(static_cast<size_t>(nFlags
))
2656 , mrDocument(rDocument
)
2658 assert((mrDocument
.mnMutationGuardFlags
& mnFlags
) == 0);
2663 assert((mrDocument
.mnMutationGuardFlags
& mnFlags
) == 0);
2666 ScDocument
& mrDocument
;
2668 ScMutationGuard(ScDocument
& rDocument
, ScMutationGuardFlags nFlags
)
2670 (void)rDocument
; (void)nFlags
;
2675 class ScDocShellRecalcGuard
2680 ScDocShellRecalcGuard(ScDocument
& rDoc
)
2683 assert(!mrDoc
.IsInDocShellRecalc());
2684 mrDoc
.SetDocShellRecalc(true);
2687 ~ScDocShellRecalcGuard()
2689 mrDoc
.SetDocShellRecalc(false);
2695 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */