Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / sc / inc / document.hxx
blobb17296e539f2fe726a1736e48fe05a84d96e672e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/prntypes.hxx>
24 #include <vcl/timer.hxx>
25 #include <vcl/idle.hxx>
26 #include <com/sun/star/uno/Reference.hxx>
27 #include <vcl/vclptr.hxx>
28 #include "scdllapi.h"
29 #include "rangelst.hxx"
30 #include "rangenam.hxx"
31 #include "tabopparams.hxx"
32 #include "types.hxx"
33 #include <formula/grammar.hxx>
34 #include <formula/types.hxx>
35 #include <com/sun/star/chart2/XChartDocument.hpp>
36 #include "typedstrdata.hxx"
37 #include "calcmacros.hxx"
38 #include "calcconfig.hxx"
39 #include <simplehintids.hxx>
40 #include <tools/gen.hxx>
41 #include <svl/zforlist.hxx>
43 #include <memory>
44 #include <map>
45 #include <set>
46 #include <vector>
48 #include "markdata.hxx"
50 enum class SvtScriptType;
51 enum class ScMF;
52 namespace editeng { class SvxBorderLine; }
53 namespace formula { struct VectorRefArray; }
54 namespace svl {
56 class SharedString;
57 class SharedStringPool;
61 namespace sc {
63 struct FormulaGroupContext;
64 class StartListeningContext;
65 class EndListeningContext;
66 class CopyFromClipContext;
67 class ColumnSpanSet;
68 struct ColumnBlockPosition;
69 struct RefUpdateContext;
70 class EditTextIterator;
71 struct NoteEntry;
72 struct FormulaGroupContext;
73 class DocumentStreamAccess;
74 class DocumentLinkManager;
75 class CellValues;
76 class TableValues;
77 class RowHeightContext;
78 struct SetFormulaDirtyContext;
79 class RefMovedHint;
80 struct SortUndoParam;
81 struct ReorderParam;
82 class FormulaGroupAreaListener;
83 class ColumnSet;
84 class UpdatedRangeNames;
88 class Fraction;
89 class SvxFontItem;
91 class KeyEvent;
92 class OutputDevice;
93 class SdrObject;
94 class SfxBroadcaster;
95 class SfxListener;
96 class SfxHint;
97 class SfxItemSet;
98 class SfxObjectShell;
99 class SfxBindings;
100 class SfxPoolItem;
101 class SfxItemPool;
102 class SfxPrinter;
103 class SfxStyleSheetBase;
104 class SvMemoryStream;
105 class SvNumberFormatter;
106 class SvxBoxInfoItem;
107 class SvxBoxItem;
108 class SvxForbiddenCharactersTable;
109 namespace sfx2 {
110 class LinkManager;
112 class SvxSearchItem;
113 namespace vcl { class Window; }
114 class XColorList;
116 struct ScAttrEntry;
117 class ScAutoFormatData;
118 class ScBroadcastAreaSlotMachine;
119 class ScChangeViewSettings;
120 class ScChartCollection;
121 class ScChartListenerCollection;
122 class ScClipOptions;
123 class ScConditionalFormat;
124 class ScConditionalFormatList;
125 class ScDBCollection;
126 class ScDBData;
127 class ScDetOpData;
128 class ScDetOpList;
129 class ScDocOptions;
130 class ScDocProtection;
131 class ScDocumentPool;
132 class ScDrawLayer;
133 class ScExtDocOptions;
134 class ScExternalRefManager;
135 class ScFormulaCell;
136 class ScMacroManager;
137 class ScMarkData;
138 class ScOutlineTable;
139 class ScPatternAttr;
140 class ScPrintRangeSaver;
141 class ScRangeData;
142 class ScRangeName;
143 class ScStyleSheet;
144 class ScStyleSheetPool;
145 class ScTable;
146 class ScTableProtection;
147 class ScTokenArray;
148 class ScValidationData;
149 class ScValidationDataList;
150 class ScViewOptions;
151 class ScChangeTrack;
152 class ScEditEngineDefaulter;
153 class ScFieldEditEngine;
154 class ScNoteEditEngine;
155 struct ScConsolidateParam;
156 class ScDPObject;
157 class ScDPCollection;
158 class ScMatrix;
159 class ScScriptTypeData;
160 class ScPoolHelper;
161 struct ScSortParam;
162 class ScRefreshTimerControl;
163 class ScUnoListenerCalls;
164 class ScUnoRefList;
165 class ScRecursionHelper;
166 struct RowInfo;
167 struct ScTableInfo;
168 struct ScTabOpParam;
169 class VirtualDevice;
170 class ScAutoNameCache;
171 class ScTemporaryChartLock;
172 class ScLookupCache;
173 struct ScLookupCacheMapImpl;
174 class SfxUndoManager;
175 class ScFormulaParserPool;
176 struct ScClipParam;
177 class ScRowBreakIterator;
178 struct ScSetStringParam;
179 class ScDocRowHeightUpdater;
180 struct ScColWidthParam;
181 class ScSheetEvents;
182 class ScProgress;
183 class SvtListener;
184 class ScEditDataArray;
185 class EditTextObject;
186 struct ScRefCellValue;
187 class ScDocumentImport;
188 class ScPostIt;
189 struct ScSubTotalParam;
190 struct ScQueryParam;
191 class ScHint;
192 class SvtBroadcaster;
193 enum class ScDBDataPortion;
194 enum class ScSheetEventId;
195 class BitmapEx;
197 namespace sc {
199 typedef std::map<sal_Int32, BitmapEx> IconSetBitmapMap;
203 namespace com { namespace sun { namespace star {
204 namespace lang {
205 class XMultiServiceFactory;
206 struct EventObject;
208 namespace i18n {
209 class XBreakIterator;
211 namespace util {
212 class XModifyListener;
214 namespace embed {
215 class XEmbeddedObject;
217 namespace script { namespace vba {
218 class XVBAEventProcessor;
220 namespace sheet {
221 struct TablePageBreakData;
223 } } }
225 #define SC_DOC_NEW 0xFFFF
227 #define SC_MACROCALL_ALLOWED 0
229 #define SC_ASIANCOMPRESSION_INVALID 0xff
230 #define SC_ASIANKERNING_INVALID 0xff
232 enum ScDocumentMode
234 SCDOCMODE_DOCUMENT,
235 SCDOCMODE_CLIP,
236 SCDOCMODE_UNDO
239 struct ScDocStat
241 OUString aDocName;
242 SCTAB nTableCount;
243 sal_uLong nCellCount;
244 sal_uLong nFormulaCount;
245 sal_uInt16 nPageCount;
246 ScDocStat()
247 : nTableCount(0)
248 , nCellCount(0)
249 , nFormulaCount(0)
250 , nPageCount(0)
255 // DDE link modes
256 const sal_uInt8 SC_DDE_DEFAULT = 0;
257 const sal_uInt8 SC_DDE_ENGLISH = 1;
258 const sal_uInt8 SC_DDE_TEXT = 2;
259 const sal_uInt8 SC_DDE_IGNOREMODE = 255; /// For usage in FindDdeLink() only!
261 class ScDocument
263 friend class ScValueIterator;
264 friend class ScHorizontalValueIterator;
265 friend class ScDBQueryDataIterator;
266 friend class ScFormulaGroupIterator;
267 friend class ScCellIterator;
268 friend class ScQueryCellIterator;
269 friend class ScHorizontalCellIterator;
270 friend class ScHorizontalAttrIterator;
271 friend class ScDocAttrIterator;
272 friend class ScAccessibleTableBase;
273 friend class ScAttrRectIterator;
274 friend class ScDocShell;
275 friend class ScDocRowHeightUpdater;
276 friend class ScColumnTextWidthIterator;
277 friend class ScFormulaCell;
278 friend class ScTable;
279 friend class ScColumn;
280 friend struct ScRefCellValue;
281 friend class ScDocumentImport;
282 friend class sc::DocumentStreamAccess;
283 friend class sc::ColumnSpanSet;
284 friend class sc::EditTextIterator;
285 friend class sc::FormulaGroupAreaListener;
287 typedef std::vector<ScTable*> TableContainer;
289 public:
290 enum HardRecalcState
292 HARDRECALCSTATE_OFF = 0, /// normal calculation of dependencies
293 HARDRECALCSTATE_TEMPORARY, /// CalcAll() without broadcast/notify but setting up new listeners
294 HARDRECALCSTATE_ETERNAL /// no new listeners are setup, no broadcast/notify
297 private:
299 rtl::Reference<ScPoolHelper> xPoolHelper;
301 std::shared_ptr<svl::SharedStringPool> mpCellStringPool;
302 std::shared_ptr<sc::FormulaGroupContext> mpFormulaGroupCxt;
303 mutable std::unique_ptr<sc::DocumentLinkManager> mpDocLinkMgr;
305 ScCalcConfig maCalcConfig;
307 SfxUndoManager* mpUndoManager;
308 ScFieldEditEngine* pEditEngine; // uses pEditPool from xPoolHelper
309 ScNoteEditEngine* pNoteEngine; // uses pEditPool from xPoolHelper
310 SfxObjectShell* pShell;
311 VclPtr<SfxPrinter> pPrinter;
312 VclPtr<VirtualDevice> pVirtualDevice_100th_mm;
313 ScDrawLayer* pDrawLayer; // SdrModel
314 rtl::Reference<XColorList> pColorList;
315 ScValidationDataList* pValidationList; // validity
316 SvNumberFormatterIndexTable* pFormatExchangeList; // for application of number formats
317 TableContainer maTabs;
318 std::vector<OUString> maTabNames; // for undo document, we need the information tab name <-> index
319 mutable ScRangeName* pRangeName;
320 ScDBCollection* pDBCollection;
321 ScDPCollection* pDPCollection;
322 ScChartCollection* pChartCollection;
323 std::unique_ptr< ScTemporaryChartLock > apTemporaryChartLock;
324 ScPatternAttr* pSelectionAttr; // Attributes of a block
325 ScFormulaCell* pFormulaTree; // formula tree (start)
326 ScFormulaCell* pEOFormulaTree; // formula tree (end), last cell
327 ScFormulaCell* pFormulaTrack; // BroadcastTrack (start)
328 ScFormulaCell* pEOFormulaTrack; // BroadcastTrack (end), last cell
329 ScBroadcastAreaSlotMachine* pBASM; // BroadcastAreas
330 ScChartListenerCollection* pChartListenerCollection;
331 SvMemoryStream* pClipData;
332 ScDetOpList* pDetOpList;
333 ScChangeTrack* pChangeTrack;
334 SfxBroadcaster* pUnoBroadcaster;
335 ScUnoListenerCalls* pUnoListenerCalls;
336 ScUnoRefList* pUnoRefUndoList;
337 ScChangeViewSettings* pChangeViewSettings;
338 ScScriptTypeData* pScriptTypeData;
339 ScRefreshTimerControl* pRefreshTimerControl;
340 rtl::Reference<SvxForbiddenCharactersTable> xForbiddenCharacters;
341 ScDBData* mpAnonymousDBData;
343 ScFieldEditEngine* pCacheFieldEditEngine;
345 std::unique_ptr<ScDocProtection> pDocProtection;
346 std::unique_ptr<ScClipParam> mpClipParam;
348 std::unique_ptr<ScExternalRefManager> pExternalRefMgr;
349 std::unique_ptr<ScMacroManager> mpMacroMgr;
351 // mutable for lazy construction
352 mutable std::unique_ptr< ScFormulaParserPool >
353 mxFormulaParserPool; /// Pool for all external formula parsers used by this document.
355 OUString aDocName; // optional: name of document
356 OUString aDocCodeName; // optional: name of document (twice?)
357 OUString maFileURL; // file URL for copy & paste
358 ScRangePairListRef xColNameRanges;
359 ScRangePairListRef xRowNameRanges;
361 ScViewOptions* pViewOptions; // view options
362 ScDocOptions* pDocOptions; // document options
363 ScExtDocOptions* pExtDocOptions; // for import etc.
364 std::unique_ptr<ScClipOptions> mpClipOptions; // clipboard options
365 ScConsolidateParam* pConsolidateDlgData;
367 ScRecursionHelper* pRecursionHelper; // information for recursive and iterative cell formulas
369 ScAutoNameCache* pAutoNameCache; // for automatic name lookup during CompileXML
371 ScLookupCacheMapImpl* pLookupCacheMapImpl; // cache for lookups like VLOOKUP and MATCH
373 SfxItemSet* pPreviewFont; // convert to std::unique_ptr or whatever
374 ScStyleSheet* pPreviewCellStyle;
375 ScMarkData maPreviewSelection;
376 sal_Int64 nUnoObjectId; // counted up for UNO objects
378 sal_uInt32 nRangeOverflowType; // used in (xml) loading for overflow warnings
380 ScRange aEmbedRange;
381 ScAddress aCurTextWidthCalcPos;
383 Idle aTrackIdle;
385 css::uno::Reference< css::script::vba::XVBAEventProcessor >
386 mxVbaEvents;
387 public:
388 /// list of ScInterpreterTableOpParams currently in use
389 std::vector<std::unique_ptr<ScInterpreterTableOpParams>> m_TableOpList;
390 ScInterpreterTableOpParams aLastTableOpParams; // remember last params
391 private:
393 LanguageType eLanguage; // default language
394 LanguageType eCjkLanguage; // default language for asian text
395 LanguageType eCtlLanguage; // default language for complex text
396 rtl_TextEncoding eSrcSet; // during reading: source character set
398 /** The compiler grammar used in document storage. GRAM_PODF for ODF 1.1
399 documents, GRAM_ODFF for ODF 1.2 documents. */
400 formula::FormulaGrammar::Grammar eStorageGrammar;
402 sal_uLong nFormulaCodeInTree; // FormelRPN im Formelbaum
403 sal_uLong nXMLImportedFormulaCount; // progress count during XML import
404 sal_uInt16 nInterpretLevel; // >0 if in interpreter
405 sal_uInt16 nMacroInterpretLevel; // >0 if macro in interpreter
406 sal_uInt16 nInterpreterTableOpLevel; // >0 if in interpreter TableOp
407 sal_uInt16 nSrcVer; // file version (load/save)
408 sal_uInt16 nFormulaTrackCount;
409 HardRecalcState eHardRecalcState; // off, temporary, eternal
410 SCTAB nVisibleTab; // for OLE etc., don't use inside ScDocument
412 ScLkUpdMode eLinkMode;
414 bool bAutoCalc; // calculate automatically
415 bool bAutoCalcShellDisabled; // in/from/for ScDocShell disabled
416 // are there ForcedFormulas which have to be calculated
417 // in interaction with ScDocShell SetDocumentModified,
418 // AutoCalcShellDisabled and TrackFormulas
419 bool bForcedFormulaPending;
420 bool bCalculatingFormulaTree;
421 bool bIsClip;
422 bool bIsUndo;
423 bool bIsVisible; // set from view ctor
425 bool bIsEmbedded; // display/adjust Embedded area?
427 // no broadcast, construct no listener during insert from a different
428 // Doc (per filter or the like ), not until CompileAll / CalcAfterLoad
429 bool bInsertingFromOtherDoc;
430 bool bLoadingMedium;
431 bool bImportingXML; // special handling of formula text
432 bool bCalcingAfterLoad; // in CalcAfterLoad TRUE
433 // don't construct/destruct listeners temporarily
434 bool bNoListening;
435 bool mbIdleEnabled;
436 bool bInLinkUpdate; // TableLink or AreaLink
437 bool bChartListenerCollectionNeedsUpdate;
438 // are/were there RC_FORCED formula cells in the document (if set once to TRUE then set forever)
439 bool bHasForcedFormulas;
440 // is the Doc being destroyed? (no Notify-Tracking etc. needed anymore)
441 bool bInDtorClear;
442 // expand reference if insert column/row takes place at the border
443 // of a reference
444 // is fetched in each UpdateReference from InputOptions,
445 // assigned, and restored at the end of UpdateReference
446 bool bExpandRefs;
447 // for detective update, is set for each change of a formula
448 bool bDetectiveDirty;
450 bool bHasMacroFunc; // valid only after loading
452 sal_uInt8 nAsianCompression;
453 sal_uInt8 nAsianKerning;
455 bool bPastingDrawFromOtherDoc;
457 sal_uInt8 nInDdeLinkUpdate; // originating DDE links (stacked bool)
459 bool bInUnoBroadcast;
460 bool bInUnoListenerCall;
461 formula::FormulaGrammar::Grammar eGrammar;
463 mutable bool bStyleSheetUsageInvalid;
465 bool mbUndoEnabled:1;
466 bool mbAdjustHeightEnabled:1;
467 bool mbExecuteLinkEnabled:1;
468 bool mbChangeReadOnlyEnabled:1; // allow changes in read-only document (for API import filters)
469 bool mbStreamValidLocked:1;
470 bool mbUserInteractionEnabled:1; // whether or not to launch any kind of interactive dialogs.
472 sal_Int16 mnNamedRangesLockCount;
474 std::set<ScFormulaCell*> maSubTotalCells;
476 bool mbUseEmbedFonts;
478 std::unique_ptr<sc::IconSetBitmapMap> m_pIconSetBitmapMap;
480 public:
481 bool IsCellInChangeTrack(const ScAddress &cell,Color *pColCellBoder);
482 void GetCellChangeTrackNote(const ScAddress &cell, OUString &strTrackText, bool &pbLeftEdge);
483 bool IsUsingEmbededFonts() { return mbUseEmbedFonts; }
484 void SetIsUsingEmbededFonts( bool bUse ) { mbUseEmbedFonts = bUse; }
485 SC_DLLPUBLIC sal_uLong GetCellCount() const; // all cells
486 SC_DLLPUBLIC sal_uLong GetFormulaGroupCount() const; // all cells
487 sal_uLong GetCodeCount() const; // RPN-Code in formulas
488 DECL_LINK_TYPED( GetUserDefinedColor, sal_uInt16, Color* );
489 // number formatter
490 public:
491 SC_DLLPUBLIC ScDocument( ScDocumentMode eMode = SCDOCMODE_DOCUMENT,
492 SfxObjectShell* pDocShell = nullptr );
493 SC_DLLPUBLIC ~ScDocument();
495 void SetName( const OUString& r ) { aDocName = r; }
496 const OUString& GetCodeName() const { return aDocCodeName; }
497 void SetCodeName( const OUString& r ) { aDocCodeName = r; }
498 const OUString& GetFileURL() const { return maFileURL; }
500 void GetDocStat( ScDocStat& rDocStat );
502 SC_DLLPUBLIC void InitDrawLayer( SfxObjectShell* pDocShell = nullptr );
503 rtl::Reference<XColorList> GetColorList();
505 SC_DLLPUBLIC sfx2::LinkManager* GetLinkManager();
506 SC_DLLPUBLIC const sfx2::LinkManager* GetLinkManager() const;
508 sc::DocumentLinkManager& GetDocLinkManager();
509 const sc::DocumentLinkManager& GetDocLinkManager() const;
511 SC_DLLPUBLIC const ScDocOptions& GetDocOptions() const;
512 SC_DLLPUBLIC void SetDocOptions( const ScDocOptions& rOpt );
513 SC_DLLPUBLIC const ScViewOptions& GetViewOptions() const;
514 SC_DLLPUBLIC void SetViewOptions( const ScViewOptions& rOpt );
515 void SetPrintOptions();
517 ScExtDocOptions* GetExtDocOptions() { return pExtDocOptions; }
518 SC_DLLPUBLIC void SetExtDocOptions( ScExtDocOptions* pNewOptions );
520 ScClipOptions* GetClipOptions() { return mpClipOptions.get(); }
521 void SetClipOptions(const ScClipOptions& rClipOptions);
523 SC_DLLPUBLIC void GetLanguage( LanguageType& rLatin, LanguageType& rCjk, LanguageType& rCtl ) const;
524 void SetLanguage( LanguageType eLatin, LanguageType eCjk, LanguageType eCtl );
526 void SetConsolidateDlgData( const ScConsolidateParam* pData );
527 const ScConsolidateParam* GetConsolidateDlgData() const { return pConsolidateDlgData; }
529 void Clear( bool bFromDestructor = false );
531 ScFieldEditEngine* CreateFieldEditEngine();
532 void DisposeFieldEditEngine(ScFieldEditEngine*& rpEditEngine);
535 * Get all range names that are local to each table. It only returns
536 * non-empty range name set.
538 SC_DLLPUBLIC void GetAllTabRangeNames(ScRangeName::TabNameCopyMap& rRangeNames) const;
539 SC_DLLPUBLIC void SetAllRangeNames(const std::map<OUString, std::unique_ptr<ScRangeName>>& rRangeMap);
540 SC_DLLPUBLIC void GetTabRangeNameMap(std::map<OUString, ScRangeName*>& rRangeName);
541 SC_DLLPUBLIC void GetRangeNameMap(std::map<OUString, ScRangeName*>& rRangeName);
542 SC_DLLPUBLIC ScRangeName* GetRangeName(SCTAB nTab) const;
543 SC_DLLPUBLIC ScRangeName* GetRangeName() const;
544 void SetRangeName(SCTAB nTab, ScRangeName* pNew);
545 void SetRangeName( ScRangeName* pNewRangeName );
547 /** Find a named expression / range name in either global or a local scope.
548 @param nTab
549 If <0 search nIndex in global scope, if >=0 search nIndex in scope of nTab.
550 @param nIndex
551 Index of named expression / range name.
552 @return nullptr if indexed name not found.
554 ScRangeData* FindRangeNameBySheetAndIndex( SCTAB nTab, sal_uInt16 nIndex ) const;
556 /** Recursively find all named expressions that directly or indirectly
557 (nested) reference a given sheet, starting from a given named
558 expression nTokenTab/nTokenIndex.
560 Used to collect all named expressions/ranges that will need to be
561 copied along when copying sheets.
563 The different tab/sheets passed cater for the situation that a sheet is
564 copied and was already inserted and global names are already adjusted
565 but the sheet-local names of the shifted original sheet are not yet. If
566 no sheet was inserted and global and local names' references not
567 updated yet, then all 4 tab arguments would be identical.
569 @param nTokenTab
570 Tab/sheet on which to find the name, -1 if global scope.
571 For example obtained from ocName token.
573 @param nTokenIndex
574 Index of named expression. For example obtained from ocName token.
576 @param nGlobalRefTab
577 Tab to check if used in global names.
579 @param nLocalRefTab
580 Tab to check if used in sheet-local names.
582 @param nOldTokenTab
583 The original tab of the copied sheet, used as sheet-local
584 base position for relative references.
586 @param nOldTokenTabReplacement
587 The replacement to use for relative references if the name
588 encountered uses nOldTokenTab as base position.
590 @param bSameDoc
591 FALSE if collecting names for a sheet to be copied to another
592 document. Then all names encountered are considered to be
593 referencing the sheet. Else TRUE if collecting names to be
594 copied into the same document.
596 @param nRecursion
597 Recursion guard, initialize with 0.
599 bool FindRangeNamesReferencingSheet( sc::UpdatedRangeNames& rIndexes,
600 SCTAB nTokenTab, const sal_uInt16 nTokenIndex,
601 SCTAB nGlobalRefTab, SCTAB nLocalRefTab, SCTAB nOldTokenTab, SCTAB nOldTokenTabReplacement,
602 bool bSameDoc, int nRecursion ) const;
604 /** If necessary (name references sheet rOldPos.Tab()) copy and adjust
605 named expression/range from sheet-local to sheet-local, or global to
606 sheet-local if bGlobalNamesToLocal==true.
608 Also copies nested names and adjusts the ocName tokens of the calling name.
610 @param rSheet
611 On entry, the original sheet of the named expression/range, <0 global.
612 On return TRUE, the new sheet. Else unchanged.
614 @param rIndex
615 On entry, the original index of the named expression/range.
616 On return TRUE, the new index, or 0 if a new copied name couldn't be inserted. Else unchanged.
618 @param rpRangeData
619 On entry, the pointer to the original named expression/range.
620 On return TRUE, the pointer to the new copied name, or nullptr if hit shappened.
622 @param rNewPos
623 New position of formula cell if called for that, else new base
624 position of a to be created new name adjusted for Tab.
625 rNewPos.nTab MUST point to the new sheet copied to.
627 @param rOldPos
628 Old position of formula cell if called for that, else base
629 position of the existing name adjusted for Tab.
630 rOldPos.nTab MUST point to the old sheet copied from.
632 @param bGlobalNamesToLocal
633 If TRUE, affected global names are copied to sheet-local names.
634 If FALSE, global names are copied to global names in another document.
636 @param bUsedByFormula
637 If TRUE, forces a global name to be affected/used.
638 If FALSE, a global name is only affected if it evaluates to be
639 referencing the sheet.
641 @return TRUE if copied and caller may need to evaluate rpRangeData and rSheet and rIndex.
642 FALSE if nothing to be done.
644 bool CopyAdjustRangeName( SCTAB& rSheet, sal_uInt16& rIndex, ScRangeData*& rpRangeData, ScDocument& rNewDoc,
645 const ScAddress& rNewPos, const ScAddress& rOldPos, const bool bGlobalNamesToLocal,
646 const bool bUsedByFormula ) const;
649 * Call this immediately before updating all named ranges.
651 SC_DLLPUBLIC void PreprocessRangeNameUpdate();
652 SC_DLLPUBLIC void PreprocessDBDataUpdate();
653 SC_DLLPUBLIC void CompileHybridFormula();
656 * Insert a new named expression to the global scope.
658 * @param rName name for the expression.
659 * @param rPos base position.
660 * @param rExpr formula expression to be associated with the name. The
661 * current grammar is used to compile this expression.
663 * @return true if inserted successfully, false otherwise.
665 bool InsertNewRangeName( const OUString& rName, const ScAddress& rPos, const OUString& rExpr );
668 * Insert a new named expression to a sheet-local scope.
670 * @param nTab sheet for local scope.
671 * @param rName name for the expression.
672 * @param rPos base position.
673 * @param rExpr formula expression to be associated with the name. The
674 * current grammar is used to compile this expression.
676 * @return true if inserted successfully, false otherwise.
678 bool InsertNewRangeName( SCTAB nTab, const OUString& rName, const ScAddress& rPos, const OUString& rExpr );
680 SCTAB GetMaxTableNumber() { return static_cast<SCTAB>(maTabs.size()) - 1; }
682 ScRangePairList* GetColNameRanges() { return &xColNameRanges; }
683 ScRangePairList* GetRowNameRanges() { return &xRowNameRanges; }
684 ScRangePairListRef& GetColNameRangesRef() { return xColNameRanges; }
685 ScRangePairListRef& GetRowNameRangesRef() { return xRowNameRanges; }
687 SC_DLLPUBLIC ScDBCollection* GetDBCollection() const { return pDBCollection;}
688 void SetDBCollection( ScDBCollection* pNewDBCollection,
689 bool bRemoveAutoFilter = false );
690 const ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, ScDBDataPortion ePortion) const;
691 ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, ScDBDataPortion ePortion);
692 const ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const;
693 ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
694 void RefreshDirtyTableColumnNames();
696 SC_DLLPUBLIC const ScRangeData* GetRangeAtBlock( const ScRange& rBlock, OUString* pName=nullptr ) const;
698 SC_DLLPUBLIC bool HasPivotTable() const;
699 SC_DLLPUBLIC ScDPCollection* GetDPCollection();
700 SC_DLLPUBLIC const ScDPCollection* GetDPCollection() const;
701 SC_DLLPUBLIC ScDPObject* GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
702 ScDPObject* GetDPAtBlock( const ScRange& rBlock ) const;
704 SC_DLLPUBLIC ScChartCollection* GetChartCollection() const { return pChartCollection;}
706 void StopTemporaryChartLock();
708 void EnsureGraphicNames();
710 SdrObject* GetObjectAtPoint( SCTAB nTab, const Point& rPos );
711 bool HasChartAtPoint( SCTAB nTab, const Point& rPos, OUString& rName );
713 css::uno::Reference< css::chart2::XChartDocument > GetChartByName( const OUString& rChartName );
715 SC_DLLPUBLIC void GetChartRanges( const OUString& rChartName, std::vector< ScRangeList >& rRanges, ScDocument* pSheetNameDoc );
716 void SetChartRanges( const OUString& rChartName, const std::vector< ScRangeList >& rRanges );
718 void UpdateChartArea( const OUString& rChartName, const ScRange& rNewArea,
719 bool bColHeaders, bool bRowHeaders, bool bAdd );
720 void UpdateChartArea( const OUString& rChartName,
721 const ScRangeListRef& rNewList,
722 bool bColHeaders, bool bRowHeaders, bool bAdd );
723 void GetOldChartParameters( const OUString& rName,
724 ScRangeList& rRanges, bool& rColHeaders, bool& rRowHeaders );
725 css::uno::Reference<
726 css::embed::XEmbeddedObject >
727 FindOleObjectByName( const OUString& rName );
729 SC_DLLPUBLIC void MakeTable( SCTAB nTab,bool _bNeedsNameCheck = true );
731 SCTAB GetVisibleTab() const { return nVisibleTab; }
732 SC_DLLPUBLIC void SetVisibleTab(SCTAB nTab) { nVisibleTab = nTab; }
734 SC_DLLPUBLIC bool HasTable( SCTAB nTab ) const;
735 SC_DLLPUBLIC bool GetHashCode( SCTAB nTab, sal_Int64& rHashCode) const;
736 SC_DLLPUBLIC bool GetName( SCTAB nTab, OUString& rName ) const;
737 SC_DLLPUBLIC bool GetCodeName( SCTAB nTab, OUString& rName ) const;
738 SC_DLLPUBLIC bool SetCodeName( SCTAB nTab, const OUString& rName );
739 SC_DLLPUBLIC bool GetTable( const OUString& rName, SCTAB& rTab ) const;
741 SC_DLLPUBLIC std::vector<OUString> GetAllTableNames() const;
743 OUString GetCopyTabName(SCTAB nTab) const;
745 SC_DLLPUBLIC void SetAnonymousDBData(SCTAB nTab, ScDBData* pDBData);
746 SC_DLLPUBLIC ScDBData* GetAnonymousDBData(SCTAB nTab);
748 /** One document global anonymous database range for temporary operations,
749 used if the corresponding sheet-local anonymous database range is
750 already used with AutoFilter and range differs. Not stored in document
751 files. */
752 SC_DLLPUBLIC void SetAnonymousDBData(ScDBData* pDBData);
753 SC_DLLPUBLIC ScDBData* GetAnonymousDBData();
755 SC_DLLPUBLIC SCTAB GetTableCount() const;
756 SvNumberFormatterIndexTable* GetFormatExchangeList() const { return pFormatExchangeList; }
758 SC_DLLPUBLIC ScDocProtection* GetDocProtection() const;
759 SC_DLLPUBLIC void SetDocProtection(const ScDocProtection* pProtect);
760 SC_DLLPUBLIC bool IsDocProtected() const;
761 bool IsDocEditable() const;
762 SC_DLLPUBLIC bool IsTabProtected( SCTAB nTab ) const;
763 SC_DLLPUBLIC ScTableProtection* GetTabProtection( SCTAB nTab ) const;
764 SC_DLLPUBLIC void SetTabProtection(SCTAB nTab, const ScTableProtection* pProtect);
765 void CopyTabProtection(SCTAB nTabSrc, SCTAB nTabDest);
767 void LockTable(SCTAB nTab);
768 void UnlockTable(SCTAB nTab);
770 bool IsBlockEditable( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
771 SCCOL nEndCol, SCROW nEndRow,
772 bool* pOnlyNotBecauseOfMatrix = nullptr ) const;
773 bool IsSelectionEditable( const ScMarkData& rMark,
774 bool* pOnlyNotBecauseOfMatrix = nullptr ) const;
775 bool HasSelectedBlockMatrixFragment( SCCOL nStartCol, SCROW nStartRow,
776 SCCOL nEndCol, SCROW nEndRow,
777 const ScMarkData& rMark ) const;
779 SC_DLLPUBLIC bool GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMatrix );
781 bool IsEmbedded() const { return bIsEmbedded;}
782 void GetEmbedded( ScRange& rRange ) const;
783 void SetEmbedded( const ScRange& rRange );
784 void ResetEmbedded();
785 Rectangle GetEmbeddedRect() const; // 1/100 mm
786 void SetEmbedded( SCTAB nTab, const Rectangle& rRect ); // from VisArea (1/100 mm)
788 static SC_DLLPUBLIC bool ValidTabName( const OUString& rName );
790 SC_DLLPUBLIC bool ValidNewTabName( const OUString& rName ) const;
791 SC_DLLPUBLIC void CreateValidTabName(OUString& rName) const;
792 SC_DLLPUBLIC void CreateValidTabNames(std::vector<OUString>& aNames, SCTAB nCount) const;
794 void AppendTabOnLoad(const OUString& rName);
795 void SetTabNameOnLoad(SCTAB nTab, const OUString& rName);
796 void InvalidateStreamOnSave();
798 SC_DLLPUBLIC bool InsertTab(
799 SCTAB nPos, const OUString& rName, bool bExternalDocument = false, bool bUndoDeleteTab = false );
801 SC_DLLPUBLIC bool InsertTabs( SCTAB nPos, const std::vector<OUString>& rNames,
802 bool bNamesValid = false );
803 SC_DLLPUBLIC bool DeleteTabs( SCTAB nTab, SCTAB nSheets );
804 SC_DLLPUBLIC bool DeleteTab( SCTAB nTab );
805 SC_DLLPUBLIC bool RenameTab( SCTAB nTab, const OUString& rName,
806 bool bUpdateRef = true,
807 bool bExternalDocument = false );
808 bool MoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress = nullptr );
809 bool CopyTab( SCTAB nOldPos, SCTAB nNewPos,
810 const ScMarkData* pOnlyMarked = nullptr );
811 SC_DLLPUBLIC sal_uLong TransferTab(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos,
812 bool bInsertNew = true,
813 bool bResultsOnly = false );
814 SC_DLLPUBLIC void TransferDrawPage(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos);
815 SC_DLLPUBLIC void SetVisible( SCTAB nTab, bool bVisible );
816 SC_DLLPUBLIC bool IsVisible( SCTAB nTab ) const;
817 bool IsStreamValid( SCTAB nTab ) const;
818 void SetStreamValid( SCTAB nTab, bool bSet, bool bIgnoreLock = false );
819 void LockStreamValid( bool bLock );
820 bool IsStreamValidLocked() const { return mbStreamValidLocked; }
821 bool IsPendingRowHeights( SCTAB nTab ) const;
822 void SetPendingRowHeights( SCTAB nTab, bool bSet );
823 SC_DLLPUBLIC void SetLayoutRTL( SCTAB nTab, bool bRTL );
824 SC_DLLPUBLIC bool IsLayoutRTL( SCTAB nTab ) const;
825 SC_DLLPUBLIC bool IsNegativePage( SCTAB nTab ) const;
826 SC_DLLPUBLIC void SetScenario( SCTAB nTab, bool bFlag );
827 SC_DLLPUBLIC bool IsScenario( SCTAB nTab ) const;
828 SC_DLLPUBLIC void GetScenarioData( SCTAB nTab, OUString& rComment,
829 Color& rColor, sal_uInt16& rFlags ) const;
830 SC_DLLPUBLIC void SetScenarioData( SCTAB nTab, const OUString& rComment,
831 const Color& rColor, sal_uInt16 nFlags );
832 SC_DLLPUBLIC Color GetTabBgColor( SCTAB nTab ) const;
833 SC_DLLPUBLIC void SetTabBgColor( SCTAB nTab, const Color& rColor );
834 SC_DLLPUBLIC bool IsDefaultTabBgColor( SCTAB nTab ) const;
835 void GetScenarioFlags( SCTAB nTab, sal_uInt16& rFlags ) const;
836 SC_DLLPUBLIC bool IsActiveScenario( SCTAB nTab ) const;
837 SC_DLLPUBLIC void SetActiveScenario( SCTAB nTab, bool bActive ); // only for Undo etc.
838 SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const;
839 SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const { return eGrammar;}
840 SC_DLLPUBLIC void SetGrammar( formula::FormulaGrammar::Grammar eGram );
841 SC_DLLPUBLIC ScLinkMode GetLinkMode( SCTAB nTab ) const;
842 bool IsLinked( SCTAB nTab ) const;
843 SC_DLLPUBLIC const OUString GetLinkDoc( SCTAB nTab ) const;
844 const OUString GetLinkFlt( SCTAB nTab ) const;
845 const OUString GetLinkOpt( SCTAB nTab ) const;
846 SC_DLLPUBLIC const OUString GetLinkTab( SCTAB nTab ) const;
847 sal_uLong GetLinkRefreshDelay( SCTAB nTab ) const;
848 void SetLink( SCTAB nTab, ScLinkMode nMode, const OUString& rDoc,
849 const OUString& rFilter, const OUString& rOptions,
850 const OUString& rTabName, sal_uLong nRefreshDelay );
851 bool HasLink( const OUString& rDoc,
852 const OUString& rFilter, const OUString& rOptions ) const;
853 SC_DLLPUBLIC bool LinkExternalTab( SCTAB& nTab, const OUString& aDocTab,
854 const OUString& aFileName,
855 const OUString& aTabName );
857 bool HasExternalRefManager() const { return pExternalRefMgr.get(); }
858 SC_DLLPUBLIC ScExternalRefManager* GetExternalRefManager() const;
859 bool IsInExternalReferenceMarking() const;
860 void MarkUsedExternalReferences();
861 bool MarkUsedExternalReferences( ScTokenArray& rArr, const ScAddress& rPos );
863 /** Returns the pool containing external formula parsers. Creates the pool
864 on first call. */
865 ScFormulaParserPool& GetFormulaParserPool() const;
867 bool HasAreaLinks() const;
868 void UpdateExternalRefLinks(vcl::Window* pWin);
869 void UpdateAreaLinks();
871 // originating DDE links
872 void IncInDdeLinkUpdate() { if ( nInDdeLinkUpdate < 255 ) ++nInDdeLinkUpdate; }
873 void DecInDdeLinkUpdate() { if ( nInDdeLinkUpdate ) --nInDdeLinkUpdate; }
874 bool IsInDdeLinkUpdate() const { return nInDdeLinkUpdate != 0; }
876 SC_DLLPUBLIC void CopyDdeLinks( ScDocument* pDestDoc ) const;
878 /** Tries to find a DDE link with the specified connection data.
879 @param rnDdePos (out-param) Returns the index of the DDE link (does not include other links from link manager).
880 @return true = DDE link found, rnDdePos valid. */
881 SC_DLLPUBLIC bool FindDdeLink( const OUString& rAppl, const OUString& rTopic,
882 const OUString& rItem, sal_uInt8 nMode, size_t& rnDdePos );
884 /** Returns the connection data of the specified DDE link.
885 @param nDdePos Index of the DDE link (does not include other links from link manager).
886 @param rAppl (out-param) The application name.
887 @param rTopic (out-param) The DDE topic.
888 @param rItem (out-param) The DDE item.
889 @return true = DDE link found, out-parameters valid. */
890 bool GetDdeLinkData( size_t nDdePos, OUString& rAppl, OUString& rTopic, OUString& rItem ) const;
891 /** Returns the link mode of the specified DDE link.
892 @param nDdePos Index of the DDE link (does not include other links from link manager).
893 @param rnMode (out-param) The link mode of the specified DDE link.
894 @return true = DDE link found, rnMode valid. */
895 bool GetDdeLinkMode( size_t nDdePos, sal_uInt8& rnMode ) const;
896 /** Returns the result matrix of the specified DDE link.
897 @param nDdePos Index of the DDE link (does not include other links from link manager).
898 @return The result matrix, if the DDE link has been found, 0 otherwise. */
899 SC_DLLPUBLIC const ScMatrix* GetDdeLinkResultMatrix( size_t nDdePos ) const;
901 /** Tries to find a DDE link or creates a new, if not extant.
902 @param pResults If not 0, sets the matrix as DDE link result matrix (also for existing links).
903 @return true = DDE link found; false = Unpredictable error occurred, no DDE link created. */
904 SC_DLLPUBLIC bool CreateDdeLink( const OUString& rAppl, const OUString& rTopic, const OUString& rItem, sal_uInt8 nMode, const ScMatrixRef& pResults );
905 /** Sets a result matrix for the specified DDE link.
906 @param nDdePos Index of the DDE link (does not include other links from link manager).
907 @param pResults The array containing all results of the DDE link (intrusive-ref-counted, do not delete).
908 @return true = DDE link found and matrix set. */
909 bool SetDdeLinkResultMatrix( size_t nDdePos, const ScMatrixRef& pResults );
911 SfxBindings* GetViewBindings();
912 SfxObjectShell* GetDocumentShell() const { return pShell; }
913 SC_DLLPUBLIC ScDrawLayer* GetDrawLayer() { return pDrawLayer; }
914 SC_DLLPUBLIC const ScDrawLayer* GetDrawLayer() const { return pDrawLayer; }
915 SfxBroadcaster* GetDrawBroadcaster(); // to avoid header
916 void BeginDrawUndo();
918 void BeginUnoRefUndo();
919 bool HasUnoRefUndo() const { return ( pUnoRefUndoList != nullptr ); }
920 ScUnoRefList* EndUnoRefUndo(); // must be deleted by caller!
921 sal_Int64 GetNewUnoId() { return ++nUnoObjectId; }
922 void AddUnoRefChange( sal_Int64 nId, const ScRangeList& rOldRanges );
924 static bool IsChart( const SdrObject* pObject );
926 SC_DLLPUBLIC void UpdateAllCharts();
927 void UpdateChartRef( UpdateRefMode eUpdateRefMode,
928 SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
929 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
930 SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
931 //! only assigns the new RangeList, no ChartListener or the like
932 void SetChartRangeList( const OUString& rChartName,
933 const ScRangeListRef& rNewRangeListRef );
935 void StartAnimations( SCTAB nTab, vcl::Window* pWin );
937 bool HasBackgroundDraw( SCTAB nTab, const Rectangle& rMMRect ) const;
938 bool HasAnyDraw( SCTAB nTab, const Rectangle& rMMRect ) const;
940 const ScSheetEvents* GetSheetEvents( SCTAB nTab ) const;
941 void SetSheetEvents( SCTAB nTab, const ScSheetEvents* pNew );
942 bool HasSheetEventScript( SCTAB nTab, ScSheetEventId nEvent, bool bWithVbaEvents = false ) const;
943 bool HasAnySheetEventScript( ScSheetEventId nEvent, bool bWithVbaEvents = false ) const; // on any sheet
945 bool HasAnyCalcNotification() const;
946 bool HasCalcNotification( SCTAB nTab ) const;
947 void SetCalcNotification( SCTAB nTab );
948 void ResetCalcNotifications();
950 SC_DLLPUBLIC ScOutlineTable* GetOutlineTable( SCTAB nTab, bool bCreate = false );
951 bool SetOutlineTable( SCTAB nTab, const ScOutlineTable* pNewOutline );
953 void DoAutoOutline( SCCOL nStartCol, SCROW nStartRow,
954 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab );
956 bool DoSubTotals( SCTAB nTab, ScSubTotalParam& rParam );
957 void RemoveSubTotals( SCTAB nTab, ScSubTotalParam& rParam );
958 bool TestRemoveSubTotals( SCTAB nTab, const ScSubTotalParam& rParam );
959 bool HasSubTotalCells( const ScRange& rRange );
961 SC_DLLPUBLIC void EnsureTable( SCTAB nTab );
963 // return TRUE = number format is set
964 SC_DLLPUBLIC bool SetString(
965 SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& rString,
966 ScSetStringParam* pParam = nullptr );
967 SC_DLLPUBLIC bool SetString( const ScAddress& rPos, const OUString& rString, ScSetStringParam* pParam = nullptr );
970 * This method manages the lifecycle of the passed edit text object. When
971 * the text is successfully inserted, the cell takes over the ownership of
972 * the text object. If not, the text object gets deleted.
974 * <p>The caller must ensure that the passed edit text object <i>uses the
975 * SfxItemPool instance returned from ScDocument::GetEditPool()</i>.
976 * This is very important.</p>
978 SC_DLLPUBLIC bool SetEditText( const ScAddress& rPos, EditTextObject* pEditText );
980 void SetEditText( const ScAddress& rPos, const EditTextObject& rEditText, const SfxItemPool* pEditPool );
982 SC_DLLPUBLIC void SetEditText( const ScAddress& rPos, const OUString& rStr );
984 SC_DLLPUBLIC SCROW GetFirstEditTextRow( const ScRange& rRange ) const;
987 * Call this if you are not sure whether to put this as an edit text or a
988 * simple text.
990 SC_DLLPUBLIC void SetTextCell( const ScAddress& rPos, const OUString& rStr );
992 void SetEmptyCell( const ScAddress& rPos );
994 SC_DLLPUBLIC void SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rVal );
995 SC_DLLPUBLIC void SetValue( const ScAddress& rPos, double fVal );
997 void SetValues( const ScAddress& rPos, const std::vector<double>& rVals );
999 void SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const sal_uInt16 nError);
1001 SC_DLLPUBLIC void SetFormula(
1002 const ScAddress& rPos, const ScTokenArray& rArray );
1004 SC_DLLPUBLIC void SetFormula(
1005 const ScAddress& rPos, const OUString& rFormula,
1006 formula::FormulaGrammar::Grammar eGram = formula::FormulaGrammar::GRAM_DEFAULT );
1009 * Set formula cell, and transfer its ownership to the document. This call
1010 * attempts to group the passed formula cell with the adjacent cells or
1011 * cell groups if appropriate.
1013 * @return pCell if it was successfully inserted, NULL otherwise. pCell
1014 * is deleted automatically on failure to insert.
1016 SC_DLLPUBLIC ScFormulaCell* SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell );
1018 bool SetFormulaCells( const ScAddress& rPos, std::vector<ScFormulaCell*>& rCells );
1021 * Check if there is at least one formula cell in specified range.
1023 bool HasFormulaCell( const ScRange& rRange ) const;
1025 SC_DLLPUBLIC void InsertMatrixFormula(SCCOL nCol1, SCROW nRow1,
1026 SCCOL nCol2, SCROW nRow2,
1027 const ScMarkData& rMark,
1028 const OUString& rFormula,
1029 const ScTokenArray* p = nullptr,
1030 const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT );
1031 SC_DLLPUBLIC void InsertTableOp(const ScTabOpParam& rParam, // multi-operation
1032 SCCOL nCol1, SCROW nRow1,
1033 SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark);
1035 SC_DLLPUBLIC OUString GetString( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1036 SC_DLLPUBLIC OUString GetString( const ScAddress& rPos ) const;
1039 * Return a pointer to the double value stored in value cell.
1041 * @param rPos cell position
1043 * @return pointer to the double value stored in a numeric cell, or NULL
1044 * if the cell at specified position is not a numeric cell.
1046 double* GetValueCell( const ScAddress& rPos );
1048 SC_DLLPUBLIC svl::SharedStringPool& GetSharedStringPool();
1049 const svl::SharedStringPool& GetSharedStringPool() const;
1051 svl::SharedString GetSharedString( const ScAddress& rPos ) const;
1053 std::shared_ptr<sc::FormulaGroupContext>& GetFormulaGroupContext();
1055 SC_DLLPUBLIC void GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, OUString& rString );
1056 sal_uInt16 GetStringForFormula( const ScAddress& rPos, OUString& rString );
1057 SC_DLLPUBLIC double GetValue( const ScAddress& rPos ) const;
1058 SC_DLLPUBLIC double GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1059 SC_DLLPUBLIC void GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, double& rValue ) const;
1060 SC_DLLPUBLIC const EditTextObject* GetEditText( const ScAddress& rPos ) const;
1061 void RemoveEditTextCharAttribs( const ScAddress& rPos, const ScPatternAttr& rAttr );
1062 SC_DLLPUBLIC double RoundValueAsShown( double fVal, sal_uInt32 nFormat ) const;
1063 SC_DLLPUBLIC void GetNumberFormat( SCCOL nCol, SCROW nRow, SCTAB nTab,
1064 sal_uInt32& rFormat ) const;
1065 sal_uInt32 GetNumberFormat( const ScRange& rRange ) const;
1066 SC_DLLPUBLIC sal_uInt32 GetNumberFormat( const ScAddress& ) const;
1067 void SetNumberFormat( const ScAddress& rPos, sal_uInt32 nNumberFormat );
1069 void GetNumberFormatInfo( short& nType, sal_uLong& nIndex, const ScAddress& rPos ) const;
1070 SC_DLLPUBLIC const ScFormulaCell* GetFormulaCell( const ScAddress& rPos ) const;
1071 SC_DLLPUBLIC ScFormulaCell* GetFormulaCell( const ScAddress& rPos );
1072 SC_DLLPUBLIC void GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, OUString& rFormula ) const;
1073 SC_DLLPUBLIC void GetCellType( SCCOL nCol, SCROW nRow, SCTAB nTab, CellType& rCellType ) const;
1074 SC_DLLPUBLIC CellType GetCellType( const ScAddress& rPos ) const;
1076 SC_DLLPUBLIC bool HasData( SCCOL nCol, SCROW nRow, SCTAB nTab );
1077 SC_DLLPUBLIC bool HasStringData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1078 SC_DLLPUBLIC bool HasValueData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1079 SC_DLLPUBLIC bool HasValueData( const ScAddress& rPos ) const;
1080 bool HasStringCells( const ScRange& rRange ) const;
1082 /** Returns true, if there is any data to create a selection list for rPos. */
1083 bool HasSelectionData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1085 /** Notes **/
1086 SC_DLLPUBLIC ScPostIt* GetNote(const ScAddress& rPos);
1087 SC_DLLPUBLIC ScPostIt* GetNote(SCCOL nCol, SCROW nRow, SCTAB nTab);
1088 void SetNote(const ScAddress& rPos, ScPostIt* pNote);
1089 void SetNote(SCCOL nCol, SCROW nRow, SCTAB nTab, ScPostIt* pNote);
1090 SC_DLLPUBLIC bool HasNote(const ScAddress& rPos) const;
1091 bool HasNote(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
1092 SC_DLLPUBLIC bool HasColNotes(SCCOL nCol, SCTAB nTab) const;
1093 SC_DLLPUBLIC bool HasTabNotes(SCTAB nTab) const;
1094 bool HasNotes() const;
1095 SC_DLLPUBLIC ScPostIt* ReleaseNote(const ScAddress& rPos);
1096 SC_DLLPUBLIC ScPostIt* GetOrCreateNote(const ScAddress& rPos);
1097 SC_DLLPUBLIC ScPostIt* CreateNote(const ScAddress& rPos);
1098 size_t GetNoteCount( SCTAB nTab, SCCOL nCol ) const;
1101 * Ensure that all note objects have an associated sdr object. The export
1102 * code uses sdr objects to export note data.
1104 void CreateAllNoteCaptions();
1105 void ForgetNoteCaptions( const ScRangeList& rRanges );
1107 ScAddress GetNotePosition( size_t nIndex ) const;
1108 ScAddress GetNotePosition( size_t nIndex, SCTAB nTab ) const;
1109 SCROW GetNotePosition( SCTAB nTab, SCCOL nCol, size_t nIndex ) const;
1111 SC_DLLPUBLIC void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
1112 void GetNotesInRange( const ScRangeList& rRange, std::vector<sc::NoteEntry>& rNotes ) const;
1113 bool ContainsNotesInRange( const ScRangeList& rRange ) const;
1115 SC_DLLPUBLIC void SetDrawPageSize(SCTAB nTab);
1117 bool IsMerged( const ScAddress& rPos ) const;
1119 void ExtendMergeSel( SCCOL nStartCol, SCROW nStartRow,
1120 SCCOL& rEndCol, SCROW& rEndRow, const ScMarkData& rMark,
1121 bool bRefresh = false );
1122 SC_DLLPUBLIC bool ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
1123 SCCOL& rEndCol, SCROW& rEndRow, SCTAB nTab,
1124 bool bRefresh = false );
1125 bool ExtendMerge( ScRange& rRange, bool bRefresh = false );
1126 void ExtendTotalMerge( ScRange& rRange ) const;
1127 SC_DLLPUBLIC void ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow,
1128 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ) const;
1129 SC_DLLPUBLIC void ExtendOverlapped( ScRange& rRange ) const;
1131 bool RefreshAutoFilter( SCCOL nStartCol, SCROW nStartRow,
1132 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab );
1134 SC_DLLPUBLIC void DoMergeContents( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
1135 SCCOL nEndCol, SCROW nEndRow );
1136 // without checking:
1137 SC_DLLPUBLIC void DoMerge( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
1138 SCCOL nEndCol, SCROW nEndRow, bool bDeleteCaptions = true );
1139 void RemoveMerge( SCCOL nCol, SCROW nRow, SCTAB nTab );
1141 bool IsBlockEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
1142 SCCOL nEndCol, SCROW nEndRow, bool bIgnoreNotes = false ) const;
1143 bool IsPrintEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
1144 SCCOL nEndCol, SCROW nEndRow,
1145 bool bLeftIsEmpty = false,
1146 ScRange* pLastRange = nullptr,
1147 Rectangle* pLastMM = nullptr ) const;
1149 void SkipOverlapped( SCCOL& rCol, SCROW& rRow, SCTAB nTab ) const;
1150 bool IsHorOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1151 bool IsVerOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1153 SC_DLLPUBLIC bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
1154 SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt16 nMask ) const;
1155 SC_DLLPUBLIC bool HasAttrib( const ScRange& rRange, sal_uInt16 nMask ) const;
1157 SC_DLLPUBLIC void GetBorderLines( SCCOL nCol, SCROW nRow, SCTAB nTab,
1158 const ::editeng::SvxBorderLine** ppLeft,
1159 const ::editeng::SvxBorderLine** ppTop,
1160 const ::editeng::SvxBorderLine** ppRight,
1161 const ::editeng::SvxBorderLine** ppBottom ) const;
1163 void ResetChanged( const ScRange& rRange );
1165 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
1166 void SetDirty( const ScRange&, bool bIncludeEmptyCells );
1167 void SetTableOpDirty( const ScRange& ); // for Interpreter TableOp
1168 void InterpretDirtyCells( const ScRangeList& rRanges );
1169 SC_DLLPUBLIC void CalcAll();
1170 SC_DLLPUBLIC void CalcAfterLoad( bool bStartListening = true );
1171 void CompileAll();
1172 void CompileXML();
1175 * Re-compile formula cells with error.
1177 * @param nErrCode specified error code to match. Only those cells with
1178 * this error code will be re-compiled. If this value is
1179 * 0, cells with any error values will be re-compiled.
1181 * @return true if at least one cell is re-compiled, false if no cells are
1182 * re-compiled.
1184 bool CompileErrorCells(sal_uInt16 nErrCode);
1186 ScAutoNameCache* GetAutoNameCache() { return pAutoNameCache; }
1187 void SetPreviewFont( SfxItemSet* pFontSet );
1188 SfxItemSet* GetPreviewFont() { return pPreviewFont; }
1189 SfxItemSet* GetPreviewFont( SCCOL nCol, SCROW nRow, SCTAB nTab );
1190 const ScMarkData& GetPreviewSelection() const { return maPreviewSelection; }
1191 void SetPreviewSelection( ScMarkData& rSel );
1192 ScStyleSheet* GetPreviewCellStyle() { return pPreviewCellStyle; }
1193 ScStyleSheet* GetPreviewCellStyle( SCCOL nCol, SCROW nRow, SCTAB nTab );
1194 void SetPreviewCellStyle( ScStyleSheet* pStyle ) { pPreviewCellStyle = pStyle; }
1195 SC_DLLPUBLIC void SetAutoNameCache( ScAutoNameCache* pCache );
1197 /** Creates a ScLookupCache cache for the range if it
1198 doesn't already exist. */
1199 ScLookupCache & GetLookupCache( const ScRange & rRange );
1200 /** Only ScLookupCache ctor uses AddLookupCache(), do not
1201 use elsewhere! */
1202 void AddLookupCache( ScLookupCache & rCache );
1203 /** Only ScLookupCache dtor uses RemoveLookupCache(), do
1204 not use elsewhere! */
1205 void RemoveLookupCache( ScLookupCache & rCache );
1206 /** Zap all caches. */
1207 void ClearLookupCaches();
1209 // calculate automatically
1210 SC_DLLPUBLIC void SetAutoCalc( bool bNewAutoCalc );
1211 SC_DLLPUBLIC bool GetAutoCalc() const { return bAutoCalc; }
1212 // calculate automatically in/from/for ScDocShell disabled
1213 void SetAutoCalcShellDisabled( bool bNew ) { bAutoCalcShellDisabled = bNew; }
1214 bool IsAutoCalcShellDisabled() const { return bAutoCalcShellDisabled; }
1215 // ForcedFormulas are to be calculated
1216 void SetForcedFormulaPending( bool bNew ) { bForcedFormulaPending = bNew; }
1217 bool IsForcedFormulaPending() const { return bForcedFormulaPending; }
1218 // if CalcFormulaTree() is currently running
1219 bool IsCalculatingFormulaTree() { return bCalculatingFormulaTree; }
1221 sal_uInt16 GetErrCode( const ScAddress& ) const;
1223 /** Shrink a range to only include data area.
1225 This is not the actually used area within the
1226 selection, but the bounds of the sheet's data area
1227 instead.
1229 @returns TRUE if the area passed intersected the data
1230 area, FALSE if not, in which case the values
1231 obtained may be out of bounds, not in order or
1232 unmodified. TRUE does not mean that there
1233 actually is any data within the selection.
1235 bool ShrinkToDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ) const;
1237 /** Shrink a range to only include used data area.
1239 @param o_bShrunk
1240 Out parameter, true if area was shrunk, false if not.
1241 @param bStickyTopRow
1242 If TRUE, do not adjust the top row.
1243 @param bStickyLeftCol
1244 If TRUE, do not adjust the left column.
1246 @returns true if there is any data, false if not.
1248 bool ShrinkToUsedDataArea( bool& o_bShrunk,
1249 SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
1250 SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly,
1251 bool bStickyTopRow = false, bool bStickyLeftCol = false ) const;
1254 * Return the last non-empty row position in given columns that's no
1255 * greater than the initial last row position, or 0 if the columns are
1256 * empty. A negative value is returned if the given sheet or column
1257 * positions are invalid.
1259 * <p>It starts from the specified last row position, and finds the first
1260 * non-empty row position in the upward direction if the start row
1261 * position is empty.</p>
1263 SCROW GetLastDataRow( SCTAB nTab, SCCOL nCol1, SCCOL nCol2, SCROW nLastRow ) const;
1266 * Return the smallest area containing at least all contiguous cells
1267 * having data. This area is a square containing also empty cells. It may
1268 * shrink or extend the area given as input Flags as modifiers:
1270 * @param bIncludeOld when true, ensure that the returned area contains at
1271 * least the initial area even if the actual data area
1272 * is smaller than the initial area.
1274 * @param bOnlyDown when true, extend / shrink the data area only in a
1275 * downward direction i.e. only modify the end row
1276 * position.
1278 SC_DLLPUBLIC void GetDataArea(
1279 SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow,
1280 bool bIncludeOld, bool bOnlyDown ) const;
1282 SC_DLLPUBLIC bool GetCellArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const;
1283 SC_DLLPUBLIC bool GetTableArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const;
1284 SC_DLLPUBLIC bool GetPrintArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow,
1285 bool bNotes = true ) const;
1286 SC_DLLPUBLIC bool GetPrintAreaHor( SCTAB nTab, SCROW nStartRow, SCROW nEndRow,
1287 SCCOL& rEndCol, bool bNotes = true ) const;
1288 SC_DLLPUBLIC bool GetPrintAreaVer( SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol,
1289 SCROW& rEndRow, bool bNotes = true ) const;
1290 void InvalidateTableArea();
1292 /// Return the number of columns / rows that should be visible for the tiled rendering.
1293 SC_DLLPUBLIC void GetTiledRenderingArea(SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow) const;
1295 SC_DLLPUBLIC bool GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow ) const;
1298 * Find the maximum column position that contains printable data for the
1299 * specified row range. The final column position must be equal or less
1300 * than the initial value of rEndCol.
1302 void ExtendPrintArea( OutputDevice* pDev, SCTAB nTab,
1303 SCCOL nStartCol, SCROW nStartRow,
1304 SCCOL& rEndCol, SCROW nEndRow ) const;
1305 SC_DLLPUBLIC SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab,
1306 SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab,
1307 ScDirection eDir );
1309 void FindAreaPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, ScMoveDirection eDirection ) const;
1310 SC_DLLPUBLIC void GetNextPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX, SCsROW nMovY,
1311 bool bMarked, bool bUnprotected, const ScMarkData& rMark ) const;
1313 bool GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, SCTAB nTab,
1314 const ScMarkData& rMark );
1316 void LimitChartArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
1317 SCCOL& rEndCol, SCROW& rEndRow );
1318 void LimitChartIfAll( ScRangeListRef& rRangeList );
1320 bool InsertRow( SCCOL nStartCol, SCTAB nStartTab,
1321 SCCOL nEndCol, SCTAB nEndTab,
1322 SCROW nStartRow, SCSIZE nSize, ScDocument* pRefUndoDoc = nullptr,
1323 const ScMarkData* pTabMark = nullptr );
1324 SC_DLLPUBLIC bool InsertRow( const ScRange& rRange );
1325 void DeleteRow( SCCOL nStartCol, SCTAB nStartTab,
1326 SCCOL nEndCol, SCTAB nEndTab,
1327 SCROW nStartRow, SCSIZE nSize,
1328 ScDocument* pRefUndoDoc = nullptr, bool* pUndoOutline = nullptr,
1329 const ScMarkData* pTabMark = nullptr );
1330 SC_DLLPUBLIC void DeleteRow( const ScRange& rRange );
1331 bool InsertCol( SCROW nStartRow, SCTAB nStartTab,
1332 SCROW nEndRow, SCTAB nEndTab,
1333 SCCOL nStartCol, SCSIZE nSize, ScDocument* pRefUndoDoc = nullptr,
1334 const ScMarkData* pTabMark = nullptr );
1335 SC_DLLPUBLIC bool InsertCol( const ScRange& rRange );
1336 void DeleteCol( SCROW nStartRow, SCTAB nStartTab,
1337 SCROW nEndRow, SCTAB nEndTab,
1338 SCCOL nStartCol, SCSIZE nSize,
1339 ScDocument* pRefUndoDoc = nullptr, bool* pUndoOutline = nullptr,
1340 const ScMarkData* pTabMark = nullptr );
1341 void DeleteCol( const ScRange& rRange );
1343 bool CanInsertRow( const ScRange& rRange ) const;
1344 bool CanInsertCol( const ScRange& rRange ) const;
1346 void FitBlock( const ScRange& rOld, const ScRange& rNew, bool bClear = true );
1347 bool CanFitBlock( const ScRange& rOld, const ScRange& rNew );
1349 bool IsClipOrUndo() const { return bIsClip || bIsUndo; }
1350 bool IsUndo() const { return bIsUndo; }
1351 bool IsClipboard() const { return bIsClip; }
1352 bool IsUndoEnabled() const { return mbUndoEnabled; }
1353 SC_DLLPUBLIC void EnableUndo( bool bVal );
1355 bool IsAdjustHeightEnabled() const { return mbAdjustHeightEnabled; }
1356 void EnableAdjustHeight( bool bVal ) { mbAdjustHeightEnabled = bVal; }
1357 bool IsExecuteLinkEnabled() const { return mbExecuteLinkEnabled; }
1358 void EnableExecuteLink( bool bVal ) { mbExecuteLinkEnabled = bVal; }
1359 bool IsChangeReadOnlyEnabled() const { return mbChangeReadOnlyEnabled; }
1360 void EnableChangeReadOnly( bool bVal ) { mbChangeReadOnlyEnabled = bVal; }
1361 SC_DLLPUBLIC bool IsUserInteractionEnabled() const { return mbUserInteractionEnabled;}
1362 SC_DLLPUBLIC void EnableUserInteraction( bool bVal );
1363 SC_DLLPUBLIC sal_Int16 GetNamedRangesLockCount() const { return mnNamedRangesLockCount; }
1364 void SetNamedRangesLockCount( sal_Int16 nCount ) { mnNamedRangesLockCount = nCount; }
1365 SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, const ScMarkData* pMarks );
1366 SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, SCTAB nTab );
1367 void SetCutMode( bool bCut );
1368 bool IsCutMode();
1369 void SetClipArea( const ScRange& rArea, bool bCut = false );
1371 SC_DLLPUBLIC bool IsDocVisible() const { return bIsVisible; }
1372 void SetDocVisible( bool bSet );
1374 bool HasOLEObjectsInArea( const ScRange& rRange, const ScMarkData* pTabMark = nullptr );
1376 void DeleteObjectsInArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1377 const ScMarkData& rMark );
1378 void DeleteObjectsInSelection( const ScMarkData& rMark );
1380 void DeleteArea(
1381 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark,
1382 InsertDeleteFlags nDelFlag, bool bBroadcast = true,
1383 sc::ColumnSpanSet* pBroadcastSpans = nullptr );
1385 SC_DLLPUBLIC void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1386 SCTAB nTab, InsertDeleteFlags nDelFlag);
1387 void DeleteAreaTab(const ScRange& rRange, InsertDeleteFlags nDelFlag);
1389 void CopyToClip(const ScClipParam& rClipParam, ScDocument* pClipDoc,
1390 const ScMarkData* pMarks, bool bKeepScenarioFlags,
1391 bool bIncludeObjects );
1394 * Copy only raw cell values to another document. Formula cells are
1395 * converted to raw cells. No formatting info are copied except for
1396 * number formats.
1398 * @param rSrcRange source range in the source document
1399 * @param nDestTab table in the clip document to copy to.
1400 * @param pDestDoc document to copy to
1402 SC_DLLPUBLIC void CopyStaticToDocument(const ScRange& rSrcRange, SCTAB nDestTab, ScDocument* pDestDoc);
1405 * Copy only cell, nothing but cell to another document.
1407 * @param rSrcPos source cell position
1408 * @param rDestPos destination cell position
1409 * @param rDestDoc destination document
1411 void CopyCellToDocument( const ScAddress& rSrcPos, const ScAddress& rDestPos, ScDocument& rDestDoc );
1413 void CopyTabToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1414 SCTAB nTab, ScDocument* pClipDoc = nullptr);
1416 bool InitColumnBlockPosition( sc::ColumnBlockPosition& rBlokPos, SCTAB nTab, SCCOL nCol );
1418 void DeleteBeforeCopyFromClip(
1419 sc::CopyFromClipContext& rCxt, const ScMarkData& rMark, sc::ColumnSpanSet& rBroadcastSpans );
1421 bool CopyOneCellFromClip(
1422 sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
1423 void CopyBlockFromClip(
1424 sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1425 const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy );
1426 void CopyNonFilteredFromClip(
1427 sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1428 const ScMarkData& rMark, SCsCOL nDx, SCROW & rClipStartRow );
1430 void StartListeningFromClip( SCCOL nCol1, SCROW nRow1,
1431 SCCOL nCol2, SCROW nRow2,
1432 const ScMarkData& rMark, InsertDeleteFlags nInsFlag );
1434 void SetDirtyFromClip(
1435 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark,
1436 InsertDeleteFlags nInsFlag, sc::ColumnSpanSet& rBroadcastSpans );
1438 /** If pDestRanges is given it overrides rDestRange, rDestRange in this
1439 case is the overall encompassing range. */
1440 void CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMark,
1441 InsertDeleteFlags nInsFlag,
1442 ScDocument* pRefUndoDoc = nullptr,
1443 ScDocument* pClipDoc = nullptr,
1444 bool bResetCut = true,
1445 bool bAsLink = false,
1446 bool bIncludeFiltered = true,
1447 bool bSkipAttrForEmpty = false,
1448 const ScRangeList * pDestRanges = nullptr );
1450 void CopyMultiRangeFromClip(const ScAddress& rDestPos, const ScMarkData& rMark,
1451 InsertDeleteFlags nInsFlag, ScDocument* pClipDoc,
1452 bool bResetCut = true, bool bAsLink = false,
1453 bool bIncludeFiltered = true,
1454 bool bSkipAttrForEmpty = false);
1456 void GetClipArea(SCCOL& nClipX, SCROW& nClipY, bool bIncludeFiltered);
1457 void GetClipStart(SCCOL& nClipX, SCROW& nClipY);
1459 bool HasClipFilteredRows();
1461 bool IsClipboardSource() const;
1463 SC_DLLPUBLIC void TransposeClip( ScDocument* pTransClip, InsertDeleteFlags nFlags, bool bAsLink );
1465 ScClipParam& GetClipParam();
1466 void SetClipParam(const ScClipParam& rParam);
1468 void MixDocument( const ScRange& rRange, ScPasteFunc nFunction, bool bSkipEmpty,
1469 ScDocument* pSrcDoc );
1471 void FillTab( const ScRange& rSrcArea, const ScMarkData& rMark,
1472 InsertDeleteFlags nFlags, ScPasteFunc nFunction,
1473 bool bSkipEmpty, bool bAsLink );
1474 void FillTabMarked( SCTAB nSrcTab, const ScMarkData& rMark,
1475 InsertDeleteFlags nFlags, ScPasteFunc nFunction,
1476 bool bSkipEmpty, bool bAsLink );
1478 void TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nType );
1480 SC_DLLPUBLIC void InitUndo( ScDocument* pSrcDoc, SCTAB nTab1, SCTAB nTab2,
1481 bool bColInfo = false, bool bRowInfo = false );
1482 void AddUndoTab( SCTAB nTab1, SCTAB nTab2,
1483 bool bColInfo = false, bool bRowInfo = false );
1484 SC_DLLPUBLIC void InitUndoSelected( ScDocument* pSrcDoc, const ScMarkData& rTabSelection,
1485 bool bColInfo = false, bool bRowInfo = false );
1487 // don't use anymore:
1488 void CopyToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
1489 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
1490 InsertDeleteFlags nFlags, bool bMarked, ScDocument* pDestDoc,
1491 const ScMarkData* pMarks = nullptr, bool bColRowFlags = true);
1492 void UndoToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
1493 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
1494 InsertDeleteFlags nFlags, bool bMarked, ScDocument* pDestDoc);
1496 void CopyToDocument(const ScRange& rRange,
1497 InsertDeleteFlags nFlags, bool bMarked, ScDocument* pDestDoc,
1498 const ScMarkData* pMarks = nullptr, bool bColRowFlags = true);
1499 void UndoToDocument(const ScRange& rRange,
1500 InsertDeleteFlags nFlags, bool bMarked, ScDocument* pDestDoc);
1502 void CopyScenario( SCTAB nSrcTab, SCTAB nDestTab, bool bNewScenario = false );
1503 bool TestCopyScenario( SCTAB nSrcTab, SCTAB nDestTab ) const;
1504 void MarkScenario( SCTAB nSrcTab, SCTAB nDestTab,
1505 ScMarkData& rDestMark, bool bResetMark = true,
1506 sal_uInt16 nNeededBits = 0 ) const;
1507 bool HasScenarioRange( SCTAB nTab, const ScRange& rRange ) const;
1508 SC_DLLPUBLIC const ScRangeList* GetScenarioRanges( SCTAB nTab ) const;
1510 SC_DLLPUBLIC void CopyUpdated( ScDocument* pPosDoc, ScDocument* pDestDoc );
1512 void UpdateReference(
1513 sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = nullptr, bool bIncludeDraw = true,
1514 bool bUpdateNoteCaptionPos = true );
1516 SC_DLLPUBLIC void UpdateTranspose( const ScAddress& rDestPos, ScDocument* pClipDoc,
1517 const ScMarkData& rMark, ScDocument* pUndoDoc = nullptr );
1519 void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
1521 SC_DLLPUBLIC void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1522 ScProgress* pProgress, const ScMarkData& rMark,
1523 sal_uLong nFillCount, FillDir eFillDir = FILL_TO_BOTTOM,
1524 FillCmd eFillCmd = FILL_LINEAR, FillDateCmd eFillDateCmd = FILL_DAY,
1525 double nStepValue = 1.0, double nMaxValue = 1E307 );
1526 OUString GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY );
1528 bool GetSelectionFunction( ScSubTotalFunc eFunc,
1529 const ScAddress& rCursor, const ScMarkData& rMark,
1530 double& rResult );
1532 SC_DLLPUBLIC const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich ) const;
1533 SC_DLLPUBLIC const SfxPoolItem* GetAttr( const ScAddress& rPos, sal_uInt16 nWhich ) const;
1534 SC_DLLPUBLIC const ScPatternAttr* GetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1535 SC_DLLPUBLIC const ScPatternAttr* GetPattern( const ScAddress& rPos ) const;
1536 SC_DLLPUBLIC const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow, SCTAB nTab ) const;
1537 const ScPatternAttr* GetSelectionPattern( const ScMarkData& rMark );
1538 ScPatternAttr* CreateSelectionPattern( const ScMarkData& rMark, bool bDeep = true );
1539 SC_DLLPUBLIC void AddCondFormatData( const ScRangeList& rRange, SCTAB nTab, sal_uInt32 nIndex );
1540 void RemoveCondFormatData( const ScRangeList& rRange, SCTAB nTab, sal_uInt32 nIndex );
1542 SC_DLLPUBLIC ScConditionalFormat* GetCondFormat( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1543 SC_DLLPUBLIC const SfxItemSet* GetCondResult( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1544 const SfxItemSet* GetCondResult(
1545 ScRefCellValue& rCell, const ScAddress& rPos, const ScConditionalFormatList& rList,
1546 const std::vector<sal_uInt32>& rIndex ) const;
1547 const SfxPoolItem* GetEffItem( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich ) const;
1549 SC_DLLPUBLIC const css::uno::Reference< css::i18n::XBreakIterator >& GetBreakIterator();
1550 bool HasStringWeakCharacters( const OUString& rString );
1551 SC_DLLPUBLIC SvtScriptType GetStringScriptType( const OUString& rString );
1552 SC_DLLPUBLIC SvtScriptType GetCellScriptType( const ScAddress& rPos, sal_uLong nNumberFormat );
1553 SC_DLLPUBLIC SvtScriptType GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab );
1554 SvtScriptType GetRangeScriptType(
1555 sc::ColumnBlockPosition& rBlockPos, const ScAddress& rPos, SCROW nLength );
1556 SvtScriptType GetRangeScriptType( const ScRangeList& rRanges );
1558 bool HasDetectiveOperations() const;
1559 void AddDetectiveOperation( const ScDetOpData& rData );
1560 void ClearDetectiveOperations();
1561 ScDetOpList* GetDetOpList() const { return pDetOpList; }
1562 void SetDetOpList(ScDetOpList* pNew);
1564 bool HasDetectiveObjects(SCTAB nTab) const;
1566 void GetSelectionFrame( const ScMarkData& rMark,
1567 SvxBoxItem& rLineOuter,
1568 SvxBoxInfoItem& rLineInner );
1569 void ApplySelectionFrame( const ScMarkData& rMark,
1570 const SvxBoxItem* pLineOuter,
1571 const SvxBoxInfoItem* pLineInner );
1572 void ApplyFrameAreaTab( const ScRange& rRange,
1573 const SvxBoxItem* pLineOuter,
1574 const SvxBoxInfoItem* pLineInner );
1576 void ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
1577 void ChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark );
1579 SC_DLLPUBLIC sal_uLong AddCondFormat( ScConditionalFormat* pNew, SCTAB nTab );
1580 void DeleteConditionalFormat( sal_uLong nIndex, SCTAB nTab );
1582 void SetCondFormList( ScConditionalFormatList* pList, SCTAB nTab );
1584 SC_DLLPUBLIC sal_uLong AddValidationEntry( const ScValidationData& rNew );
1586 SC_DLLPUBLIC const ScValidationData* GetValidationEntry( sal_uLong nIndex ) const;
1588 SC_DLLPUBLIC ScConditionalFormatList* GetCondFormList( SCTAB nTab ) const;
1590 const ScValidationDataList* GetValidationList() const { return pValidationList;}
1591 ScValidationDataList* GetValidationList() { return pValidationList;}
1593 SC_DLLPUBLIC void ApplyAttr( SCCOL nCol, SCROW nRow, SCTAB nTab,
1594 const SfxPoolItem& rAttr );
1595 SC_DLLPUBLIC void ApplyPattern( SCCOL nCol, SCROW nRow, SCTAB nTab,
1596 const ScPatternAttr& rAttr );
1597 SC_DLLPUBLIC void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow,
1598 SCCOL nEndCol, SCROW nEndRow,
1599 const ScMarkData& rMark, const ScPatternAttr& rAttr,
1600 ScEditDataArray* pDataArray = nullptr );
1601 SC_DLLPUBLIC void ApplyPatternAreaTab( SCCOL nStartCol, SCROW nStartRow,
1602 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab,
1603 const ScPatternAttr& rAttr );
1605 SC_DLLPUBLIC void ApplyPatternIfNumberformatIncompatible(
1606 const ScRange& rRange, const ScMarkData& rMark,
1607 const ScPatternAttr& rPattern, short nNewType );
1609 void ApplyStyle( SCCOL nCol, SCROW nRow, SCTAB nTab,
1610 const ScStyleSheet& rStyle);
1611 void ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow,
1612 SCCOL nEndCol, SCROW nEndRow,
1613 const ScMarkData& rMark, const ScStyleSheet& rStyle);
1614 SC_DLLPUBLIC void ApplyStyleAreaTab( SCCOL nStartCol, SCROW nStartRow,
1615 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab,
1616 const ScStyleSheet& rStyle);
1618 SC_DLLPUBLIC void ApplySelectionStyle( const ScStyleSheet& rStyle, const ScMarkData& rMark );
1619 void ApplySelectionLineStyle( const ScMarkData& rMark,
1620 const ::editeng::SvxBorderLine* pLine, bool bColorOnly );
1622 const ScStyleSheet* GetStyle( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1623 const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark ) const;
1625 void StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool bRemoved,
1626 OutputDevice* pDev,
1627 double nPPTX, double nPPTY,
1628 const Fraction& rZoomX, const Fraction& rZoomY );
1630 bool IsStyleSheetUsed( const ScStyleSheet& rStyle ) const;
1632 SC_DLLPUBLIC bool ApplyFlagsTab( SCCOL nStartCol, SCROW nStartRow,
1633 SCCOL nEndCol, SCROW nEndRow,
1634 SCTAB nTab, ScMF nFlags );
1635 SC_DLLPUBLIC bool RemoveFlagsTab( SCCOL nStartCol, SCROW nStartRow,
1636 SCCOL nEndCol, SCROW nEndRow,
1637 SCTAB nTab, ScMF nFlags );
1639 SC_DLLPUBLIC void SetPattern( const ScAddress&, const ScPatternAttr& rAttr );
1640 SC_DLLPUBLIC void SetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatternAttr& rAttr );
1642 void AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1643 sal_uInt16 nFormatNo, const ScMarkData& rMark );
1644 void GetAutoFormatData( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1645 ScAutoFormatData& rData );
1646 bool SearchAndReplace( const SvxSearchItem& rSearchItem,
1647 SCCOL& rCol, SCROW& rRow, SCTAB& rTab,
1648 const ScMarkData& rMark, ScRangeList& rMatchedRanges,
1649 OUString& rUndoStr, ScDocument* pUndoDoc = nullptr );
1651 // determine Col/Row of subsequent calls
1652 // (e.g. not found from the beginning, or subsequent tables)
1653 // meaning of explanation in "()" was already unclear in German
1654 static void GetSearchAndReplaceStart( const SvxSearchItem& rSearchItem,
1655 SCCOL& rCol, SCROW& rRow );
1657 bool Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
1658 SCCOL nVCol, SCROW nVRow, SCTAB nVTab,
1659 const OUString& sValStr, double& nX);
1661 SC_DLLPUBLIC void ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark,
1662 ScEditDataArray* pDataArray = nullptr );
1663 void DeleteSelection( InsertDeleteFlags nDelFlag, const ScMarkData& rMark, bool bBroadcast = true );
1664 void DeleteSelectionTab( SCTAB nTab, InsertDeleteFlags nDelFlag, const ScMarkData& rMark );
1666 SC_DLLPUBLIC void SetColWidth( SCCOL nCol, SCTAB nTab, sal_uInt16 nNewWidth );
1667 SC_DLLPUBLIC void SetColWidthOnly( SCCOL nCol, SCTAB nTab, sal_uInt16 nNewWidth );
1668 SC_DLLPUBLIC void SetRowHeight( SCROW nRow, SCTAB nTab, sal_uInt16 nNewHeight );
1669 SC_DLLPUBLIC void SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, SCTAB nTab,
1670 sal_uInt16 nNewHeight );
1672 SC_DLLPUBLIC void SetRowHeightOnly( SCROW nStartRow, SCROW nEndRow, SCTAB nTab,
1673 sal_uInt16 nNewHeight );
1674 SC_DLLPUBLIC void SetManualHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bManual );
1676 SC_DLLPUBLIC sal_uInt16 GetColWidth( SCCOL nCol, SCTAB nTab, bool bHiddenAsZero = true ) const;
1677 SC_DLLPUBLIC sal_uLong GetColWidth( SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab ) const;
1678 SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCTAB nTab, bool bHiddenAsZero = true ) const;
1679 SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCTAB nTab, SCROW* pStartRow, SCROW* pEndRow ) const;
1680 SC_DLLPUBLIC sal_uLong GetRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero = true ) const;
1681 SCROW GetRowForHeight( SCTAB nTab, sal_uLong nHeight ) const;
1682 sal_uLong GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, double fScale ) const;
1683 SC_DLLPUBLIC sal_uLong GetColOffset( SCCOL nCol, SCTAB nTab, bool bHiddenAsZero = true ) const;
1684 SC_DLLPUBLIC sal_uLong GetRowOffset( SCROW nRow, SCTAB nTab, bool bHiddenAsZero = true ) const;
1686 SC_DLLPUBLIC sal_uInt16 GetOriginalWidth( SCCOL nCol, SCTAB nTab ) const;
1687 SC_DLLPUBLIC sal_uInt16 GetOriginalHeight( SCROW nRow, SCTAB nTab ) const;
1689 sal_uInt16 GetCommonWidth( SCCOL nEndCol, SCTAB nTab ) const;
1691 SCROW GetHiddenRowCount( SCROW nRow, SCTAB nTab ) const;
1693 sal_uInt16 GetOptimalColWidth( SCCOL nCol, SCTAB nTab, OutputDevice* pDev,
1694 double nPPTX, double nPPTY,
1695 const Fraction& rZoomX, const Fraction& rZoomY,
1696 bool bFormula,
1697 const ScMarkData* pMarkData = nullptr,
1698 const ScColWidthParam* pParam = nullptr );
1700 SC_DLLPUBLIC bool SetOptimalHeight(
1701 sc::RowHeightContext& rCxt, SCROW nStartRow, SCROW nEndRow, SCTAB nTab );
1703 void UpdateAllRowHeights( sc::RowHeightContext& rCxt, const ScMarkData* pTabMark = nullptr );
1705 long GetNeededSize( SCCOL nCol, SCROW nRow, SCTAB nTab,
1706 OutputDevice* pDev,
1707 double nPPTX, double nPPTY,
1708 const Fraction& rZoomX, const Fraction& rZoomY,
1709 bool bWidth, bool bTotalSize = false );
1711 SC_DLLPUBLIC void ShowCol(SCCOL nCol, SCTAB nTab, bool bShow);
1712 SC_DLLPUBLIC void ShowRow(SCROW nRow, SCTAB nTab, bool bShow);
1713 SC_DLLPUBLIC void ShowRows(SCROW nRow1, SCROW nRow2, SCTAB nTab, bool bShow);
1714 SC_DLLPUBLIC void SetRowFlags( SCROW nRow, SCTAB nTab, sal_uInt8 nNewFlags );
1715 SC_DLLPUBLIC void SetRowFlags( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, sal_uInt8 nNewFlags );
1717 SC_DLLPUBLIC sal_uInt8 GetColFlags( SCCOL nCol, SCTAB nTab ) const;
1718 SC_DLLPUBLIC sal_uInt8 GetRowFlags( SCROW nRow, SCTAB nTab ) const;
1720 SC_DLLPUBLIC void GetAllRowBreaks(std::set<SCROW>& rBreaks, SCTAB nTab, bool bPage, bool bManual) const;
1721 SC_DLLPUBLIC void GetAllColBreaks(std::set<SCCOL>& rBreaks, SCTAB nTab, bool bPage, bool bManual) const;
1722 SC_DLLPUBLIC ScBreakType HasRowBreak(SCROW nRow, SCTAB nTab) const;
1723 SC_DLLPUBLIC ScBreakType HasColBreak(SCCOL nCol, SCTAB nTab) const;
1724 SC_DLLPUBLIC void SetRowBreak(SCROW nRow, SCTAB nTab, bool bPage, bool bManual);
1725 SC_DLLPUBLIC void SetColBreak(SCCOL nCol, SCTAB nTab, bool bPage, bool bManual);
1726 void RemoveRowBreak(SCROW nRow, SCTAB nTab, bool bPage, bool bManual);
1727 void RemoveColBreak(SCCOL nCol, SCTAB nTab, bool bPage, bool bManual);
1728 css::uno::Sequence<
1729 css::sheet::TablePageBreakData> GetRowBreakData(SCTAB nTab) const;
1731 SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = nullptr, SCROW* pLastRow = nullptr) const;
1732 SC_DLLPUBLIC bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1733 SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol = nullptr, SCCOL* pLastCol = nullptr) const;
1734 SC_DLLPUBLIC void SetRowHidden(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bHidden);
1735 SC_DLLPUBLIC void SetColHidden(SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, bool bHidden);
1736 SC_DLLPUBLIC SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1737 SC_DLLPUBLIC SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1738 SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1740 bool RowFiltered(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = nullptr, SCROW* pLastRow = nullptr) const;
1741 bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1742 bool ColFiltered(SCCOL nCol, SCTAB nTab) const;
1743 SC_DLLPUBLIC void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bFiltered);
1744 SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1745 SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1746 SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1748 SC_DLLPUBLIC bool IsManualRowHeight(SCROW nRow, SCTAB nTab) const;
1750 bool HasUniformRowHeight( SCTAB nTab, SCROW nRow1, SCROW nRow2 ) const;
1753 * Write all column row flags to table's flag data, because not all column
1754 * row attributes are stored in the flag data members. This is necessary
1755 * for ods export.
1757 void SyncColRowFlags();
1759 /// @return the index of the last row with any set flags (auto-pagebreak is ignored).
1760 SC_DLLPUBLIC SCROW GetLastFlaggedRow( SCTAB nTab ) const;
1762 /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored).
1763 SCCOL GetLastChangedCol( SCTAB nTab ) const;
1764 /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
1765 SCROW GetLastChangedRow( SCTAB nTab ) const;
1767 SCCOL GetNextDifferentChangedCol( SCTAB nTab, SCCOL nStart) const;
1769 SCROW GetNextDifferentChangedRow( SCTAB nTab, SCROW nStart) const;
1771 // returns whether to export a Default style for this col or not
1772 // nDefault is setted to one position in the current row where the Default style is
1773 void GetColDefault( SCTAB nTab, SCCOL nCol, SCROW nLastRow, SCROW& nDefault);
1775 bool UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, bool bShow );
1776 bool UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bShow );
1778 void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, SCTAB nTab );
1779 void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, SCTAB nTab );
1781 SC_DLLPUBLIC ScPatternAttr* GetDefPattern() const;
1782 SC_DLLPUBLIC ScDocumentPool* GetPool();
1783 SC_DLLPUBLIC ScStyleSheetPool* GetStyleSheetPool() const;
1785 // PageStyle:
1786 SC_DLLPUBLIC const OUString GetPageStyle( SCTAB nTab ) const;
1787 SC_DLLPUBLIC void SetPageStyle( SCTAB nTab, const OUString& rName );
1788 Size GetPageSize( SCTAB nTab ) const;
1789 void SetPageSize( SCTAB nTab, const Size& rSize );
1790 void SetRepeatArea( SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
1791 void InvalidatePageBreaks(SCTAB nTab);
1792 void UpdatePageBreaks( SCTAB nTab, const ScRange* pUserArea = nullptr );
1793 void RemoveManualBreaks( SCTAB nTab );
1794 bool HasManualBreaks( SCTAB nTab ) const;
1796 bool IsPageStyleInUse( const OUString& rStrPageStyle, SCTAB* pInTab = nullptr );
1797 bool RemovePageStyleInUse( const OUString& rStrPageStyle );
1798 bool RenamePageStyleInUse( const OUString& rOld, const OUString& rNew );
1799 void ModifyStyleSheet( SfxStyleSheetBase& rPageStyle,
1800 const SfxItemSet& rChanges );
1802 void PageStyleModified( SCTAB nTab, const OUString& rNewName );
1804 SC_DLLPUBLIC bool NeedPageResetAfterTab( SCTAB nTab ) const;
1806 // Was stored in PageStyle previously. Now it exists for every table:
1807 SC_DLLPUBLIC bool HasPrintRange();
1808 SC_DLLPUBLIC sal_uInt16 GetPrintRangeCount( SCTAB nTab );
1809 SC_DLLPUBLIC const ScRange* GetPrintRange( SCTAB nTab, sal_uInt16 nPos );
1810 SC_DLLPUBLIC const ScRange* GetRepeatColRange( SCTAB nTab );
1811 SC_DLLPUBLIC const ScRange* GetRepeatRowRange( SCTAB nTab );
1812 /** Returns true, if the specified sheet is always printed. */
1813 bool IsPrintEntireSheet( SCTAB nTab ) const;
1815 /** Removes all print ranges. */
1816 SC_DLLPUBLIC void ClearPrintRanges( SCTAB nTab );
1817 /** Adds a new print ranges. */
1818 SC_DLLPUBLIC void AddPrintRange( SCTAB nTab, const ScRange& rNew );
1819 /** Marks the specified sheet to be printed completely. Deletes old print ranges on the sheet! */
1820 SC_DLLPUBLIC void SetPrintEntireSheet( SCTAB nTab );
1821 SC_DLLPUBLIC void SetRepeatColRange( SCTAB nTab, const ScRange* pNew );
1822 SC_DLLPUBLIC void SetRepeatRowRange( SCTAB nTab, const ScRange* pNew );
1823 ScPrintRangeSaver* CreatePrintRangeSaver() const;
1824 void RestorePrintRanges( const ScPrintRangeSaver& rSaver );
1826 SC_DLLPUBLIC Rectangle GetMMRect( SCCOL nStartCol, SCROW nStartRow,
1827 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero = true ) const;
1828 SC_DLLPUBLIC ScRange GetRange( SCTAB nTab, const Rectangle& rMMRect, bool bHiddenAsZero = true ) const;
1830 void UpdStlShtPtrsFrmNms();
1831 void StylesToNames();
1833 SC_DLLPUBLIC void CopyStdStylesFrom( ScDocument* pSrcDoc );
1835 sal_uLong GetSrcVersion() const { return nSrcVer; }
1837 void SetSrcCharSet( rtl_TextEncoding eNew ) { eSrcSet = eNew; }
1838 void UpdateFontCharSet();
1840 void FillInfo(
1841 ScTableInfo& rTabInfo, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1842 SCTAB nTab, double fColScale, double fRowScale, bool bPageMode, bool bFormulaMode,
1843 const ScMarkData* pMarkData = nullptr );
1845 SC_DLLPUBLIC SvNumberFormatter* GetFormatTable() const;
1846 SC_DLLPUBLIC SvNumberFormatter* CreateFormatTable() const;
1848 /** Sort a range of data. */
1849 void Sort(
1850 SCTAB nTab, const ScSortParam& rSortParam, bool bKeepQuery, bool bUpdateRefs,
1851 ScProgress* pProgress, sc::ReorderParam* pUndo );
1853 void Reorder( const sc::ReorderParam& rParam, ScProgress* pProgress );
1855 SCSIZE Query( SCTAB nTab, const ScQueryParam& rQueryParam, bool bKeepSub );
1856 SC_DLLPUBLIC bool CreateQueryParam( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1857 SCTAB nTab, ScQueryParam& rQueryParam );
1858 void GetUpperCellString(SCCOL nCol, SCROW nRow, SCTAB nTab, OUString& rStr);
1861 * Get a list of unique strings to use in filtering criteria. The string
1862 * values are sorted, and there are no duplicate values in the list. The
1863 * data range to use to populate the filter entries is inferred from the
1864 * database range that contains the specified cell position.
1866 void GetFilterEntries(
1867 SCCOL nCol, SCROW nRow, SCTAB nTab, std::vector<ScTypedStrData>& rStrings, bool& rHasDates);
1869 SC_DLLPUBLIC void GetFilterEntriesArea(
1870 SCCOL nCol, SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bCaseSens,
1871 std::vector<ScTypedStrData>& rStrings, bool& rHasDates);
1873 void GetDataEntries(
1874 SCCOL nCol, SCROW nRow, SCTAB nTab,
1875 std::vector<ScTypedStrData>& rStrings, bool bLimit = false );
1876 void GetFormulaEntries( ScTypedCaseStrSet& rStrings );
1878 bool HasAutoFilter( SCCOL nCol, SCROW nRow, SCTAB nTab );
1879 void GetFilterSelCount( SCCOL nCol, SCROW nRow, SCTAB nTab, SCSIZE& nSelected, SCSIZE& nTotal );
1881 SC_DLLPUBLIC bool HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1882 SCTAB nTab );
1883 SC_DLLPUBLIC bool HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1884 SCTAB nTab );
1886 SfxPrinter* GetPrinter( bool bCreateIfNotExist = true );
1887 void SetPrinter( SfxPrinter* pNewPrinter );
1888 VirtualDevice* GetVirtualDevice_100th_mm();
1889 SC_DLLPUBLIC OutputDevice* GetRefDevice(); // WYSIWYG: Printer, otherwise VirtualDevice...
1891 bool GetNextSpellingCell(SCCOL& nCol, SCROW& nRow, SCTAB nTab,
1892 bool bInSel, const ScMarkData& rMark) const;
1894 void ReplaceStyle(const SvxSearchItem& rSearchItem,
1895 SCCOL nCol, SCROW nRow, SCTAB nTab,
1896 ScMarkData& rMark);
1898 void InvalidateTextWidth( const OUString& rStyleName );
1899 void InvalidateTextWidth( SCTAB nTab );
1900 void InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo, bool bNumFormatChanged );
1902 bool IdleCalcTextWidth();
1904 void RepaintRange( const ScRange& rRange );
1905 void RepaintRange( const ScRangeList& rRange );
1907 bool IsIdleEnabled() const { return mbIdleEnabled; }
1908 void EnableIdle(bool bDo) { mbIdleEnabled = bDo; }
1910 bool IsDetectiveDirty() const { return bDetectiveDirty; }
1911 void SetDetectiveDirty(bool bSet) { bDetectiveDirty = bSet; }
1913 bool GetHasMacroFunc() const { return bHasMacroFunc; }
1914 void SetHasMacroFunc(bool bSet) { bHasMacroFunc = bSet; }
1916 static bool CheckMacroWarn();
1918 void SetRangeOverflowType(sal_uInt32 nType) { nRangeOverflowType = nType; }
1919 bool HasRangeOverflow() const { return nRangeOverflowType != 0; }
1920 SC_DLLPUBLIC sal_uInt32 GetRangeOverflowType() const { return nRangeOverflowType; }
1922 // for broadcasting/listening
1923 void SetInsertingFromOtherDoc( bool bVal ) { bInsertingFromOtherDoc = bVal; }
1924 bool IsInsertingFromOtherDoc() const { return bInsertingFromOtherDoc; }
1925 void SetLoadingMedium( bool bVal );
1926 void SetImportingXML( bool bVal );
1927 bool IsImportingXML() const { return bImportingXML; }
1928 bool IsCalcingAfterLoad() const { return bCalcingAfterLoad; }
1929 void SetNoListening( bool bVal ) { bNoListening = bVal; }
1930 bool GetNoListening() const { return bNoListening; }
1931 ScBroadcastAreaSlotMachine* GetBASM() const { return pBASM; }
1933 SC_DLLPUBLIC ScChartListenerCollection* GetChartListenerCollection() const { return pChartListenerCollection;}
1934 void SetChartListenerCollection( ScChartListenerCollection*,
1935 bool bSetChartRangeLists = false );
1936 void UpdateChart( const OUString& rName );
1937 void RestoreChartListener( const OUString& rName );
1938 SC_DLLPUBLIC void UpdateChartListenerCollection();
1939 bool IsChartListenerCollectionNeedsUpdate() const
1940 { return bChartListenerCollectionNeedsUpdate; }
1941 void SetChartListenerCollectionNeedsUpdate( bool bFlg )
1942 { bChartListenerCollectionNeedsUpdate = bFlg; }
1943 void AddOLEObjectToCollection(const OUString& rName);
1945 ScChangeViewSettings* GetChangeViewSettings() const { return pChangeViewSettings; }
1946 SC_DLLPUBLIC void SetChangeViewSettings(const ScChangeViewSettings& rNew);
1948 const rtl::Reference<SvxForbiddenCharactersTable>& GetForbiddenCharacters();
1949 void SetForbiddenCharacters(const rtl::Reference<SvxForbiddenCharactersTable>& rNew);
1951 sal_uInt8 GetAsianCompression() const; // CharacterCompressionType values
1952 bool IsValidAsianCompression() const;
1953 void SetAsianCompression(sal_uInt8 nNew);
1955 bool GetAsianKerning() const;
1956 bool IsValidAsianKerning() const;
1957 void SetAsianKerning(bool bNew);
1958 void ApplyAsianEditSettings(ScEditEngineDefaulter& rEngine);
1960 sal_uInt8 GetEditTextDirection(SCTAB nTab) const; // EEHorizontalTextDirection values
1962 SC_DLLPUBLIC ScLkUpdMode GetLinkMode() const { return eLinkMode ;}
1963 void SetLinkMode( ScLkUpdMode nSet ) { eLinkMode = nSet;}
1965 SC_DLLPUBLIC ScMacroManager* GetMacroManager();
1967 void FillMatrix( ScMatrix& rMat, SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, svl::SharedStringPool* pPool = nullptr) const;
1970 * Set an array of numerical formula results to a group of contiguous
1971 * formula cells.
1973 * @param rTopPos position of the top formula cell of a group.
1974 * @param pResults array of numeric results.
1975 * @param nLen length of numeric results.
1977 void SC_DLLPUBLIC SetFormulaResults( const ScAddress& rTopPos, const double* pResults, size_t nLen );
1979 void SC_DLLPUBLIC SetFormulaResults( const ScAddress& rTopPos, const formula::FormulaTokenRef* pResults, size_t nLen );
1982 * Transfer a series of contiguous cell values from specified position to
1983 * the passed container. The specified segment will become empty after the
1984 * transfer.
1986 void TransferCellValuesTo( const ScAddress& rTopPos, size_t nLen, sc::CellValues& rDest );
1988 void CopyCellValuesFrom( const ScAddress& rTopPos, const sc::CellValues& rSrc );
1990 std::set<Color> GetDocColors();
1992 sc::IconSetBitmapMap& GetIconSetBitmapMap();
1994 private:
1995 ScDocument(const ScDocument& r) = delete;
1997 void FindMaxRotCol( SCTAB nTab, RowInfo* pRowInfo, SCSIZE nArrCount,
1998 SCCOL nX1, SCCOL nX2 ) const;
2000 sal_uInt16 RowDifferences( SCROW nThisRow, SCTAB nThisTab,
2001 ScDocument& rOtherDoc,
2002 SCROW nOtherRow, SCTAB nOtherTab,
2003 SCCOL nMaxCol, SCCOLROW* pOtherCols );
2004 sal_uInt16 ColDifferences( SCCOL nThisCol, SCTAB nThisTab,
2005 ScDocument& rOtherDoc,
2006 SCCOL nOtherCol, SCTAB nOtherTab,
2007 SCROW nMaxRow, SCCOLROW* pOtherRows );
2008 void FindOrder( SCCOLROW* pOtherRows, SCCOLROW nThisEndRow, SCCOLROW nOtherEndRow,
2009 bool bColumns,
2010 ScDocument& rOtherDoc, SCTAB nThisTab, SCTAB nOtherTab,
2011 SCCOLROW nEndCol, SCCOLROW* pTranslate,
2012 ScProgress* pProgress, sal_uLong nProAdd );
2014 DECL_LINK_TYPED(TrackTimeHdl, Idle *, void);
2016 static ScRecursionHelper* CreateRecursionHelperInstance();
2018 public:
2019 void StartListeningArea( const ScRange& rRange, bool bGroupListening, SvtListener* pListener );
2021 void EndListeningArea( const ScRange& rRange, bool bGroupListening, SvtListener* pListener );
2022 /** Broadcast wrapper, calls
2023 rHint.GetCell()->Broadcast() and AreaBroadcast()
2024 and TrackFormulas()
2025 Preferred.
2027 void Broadcast( const ScHint& rHint );
2029 void BroadcastCells( const ScRange& rRange, sal_uInt32 nHint, bool bBroadcastSingleBroadcasters = true );
2030 void BroadcastRefMoved( const sc::RefMovedHint& rHint );
2032 /// only area, no cell broadcast
2033 void AreaBroadcast( const ScHint& rHint );
2034 void DelBroadcastAreasInRange( const ScRange& rRange );
2035 void UpdateBroadcastAreas( UpdateRefMode eUpdateRefMode,
2036 const ScRange& rRange,
2037 SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
2039 void StartListeningCell( const ScAddress& rAddress,
2040 SvtListener* pListener );
2041 void EndListeningCell( const ScAddress& rAddress,
2042 SvtListener* pListener );
2044 void StartListeningCell( sc::StartListeningContext& rCxt, const ScAddress& rPos, SvtListener& rListener );
2045 void EndListeningCell( sc::EndListeningContext& rCxt, const ScAddress& rPos, SvtListener& rListener );
2047 void EndListeningFormulaCells( std::vector<ScFormulaCell*>& rCells );
2048 void CollectAllAreaListeners(
2049 std::vector<SvtListener*>& rListeners, const ScRange& rRange, sc::AreaOverlapType eType );
2051 void PutInFormulaTree( ScFormulaCell* pCell );
2052 void RemoveFromFormulaTree( ScFormulaCell* pCell );
2055 * Calculate formula cells that are on the formula tree either partially,
2056 * or in full.
2058 * @param bOnlyForced when true, it only calculates those formula cells
2059 * that are marked "recalc forced".
2060 * @param bProgressBar whether or not to use progress bar.
2061 * @param bSetAllDirty when true, it marks all formula cells currently on
2062 * the formula tree dirty, which forces all of them to
2063 * be recalculated. When false, only those cells
2064 * that are marked dirty prior to this call get
2065 * recalculated.
2067 SC_DLLPUBLIC void CalcFormulaTree(
2068 bool bOnlyForced = false, bool bProgressBar = true, bool bSetAllDirty = true );
2069 void ClearFormulaTree();
2070 void AppendToFormulaTrack( ScFormulaCell* pCell );
2071 void RemoveFromFormulaTrack( ScFormulaCell* pCell );
2072 void TrackFormulas( sal_uInt32 nHintId = SC_HINT_DATACHANGED );
2073 bool IsInFormulaTree( ScFormulaCell* pCell ) const;
2074 bool IsInFormulaTrack( ScFormulaCell* pCell ) const;
2075 HardRecalcState GetHardRecalcState() { return eHardRecalcState; }
2076 void SetHardRecalcState( HardRecalcState eVal ) { eHardRecalcState = eVal; }
2077 void StartAllListeners();
2078 void StartNeededListeners();
2079 void StartNeededListeners( const std::shared_ptr<const sc::ColumnSet>& rpColSet );
2080 void StartAllListeners( const ScRange& rRange );
2082 void SetForcedFormulas( bool bVal ) { bHasForcedFormulas = bVal; }
2083 sal_uLong GetFormulaCodeInTree() const { return nFormulaCodeInTree; }
2084 bool IsInInterpreter() const { return nInterpretLevel != 0; }
2086 void IncInterpretLevel()
2088 if ( nInterpretLevel < USHRT_MAX )
2089 nInterpretLevel++;
2091 void DecInterpretLevel()
2093 if ( nInterpretLevel )
2094 nInterpretLevel--;
2096 sal_uInt16 GetMacroInterpretLevel() { return nMacroInterpretLevel; }
2097 void IncMacroInterpretLevel()
2099 if ( nMacroInterpretLevel < USHRT_MAX )
2100 nMacroInterpretLevel++;
2102 void DecMacroInterpretLevel()
2104 if ( nMacroInterpretLevel )
2105 nMacroInterpretLevel--;
2107 bool IsInInterpreterTableOp() const { return nInterpreterTableOpLevel != 0; }
2108 void IncInterpreterTableOpLevel()
2110 if ( nInterpreterTableOpLevel < USHRT_MAX )
2111 nInterpreterTableOpLevel++;
2113 void DecInterpreterTableOpLevel()
2115 if ( nInterpreterTableOpLevel )
2116 nInterpreterTableOpLevel--;
2118 // add a formula to be remembered for TableOp broadcasts
2119 void AddTableOpFormulaCell( ScFormulaCell* );
2120 void InvalidateLastTableOpParams() { aLastTableOpParams.bValid = false; }
2121 ScRecursionHelper& GetRecursionHelper()
2123 if (!pRecursionHelper)
2124 pRecursionHelper = CreateRecursionHelperInstance();
2125 return *pRecursionHelper;
2127 bool IsInDtorClear() const { return bInDtorClear; }
2128 void SetExpandRefs( bool bVal );
2129 bool IsExpandRefs() const { return bExpandRefs; }
2131 sal_uLong GetXMLImportedFormulaCount() const { return nXMLImportedFormulaCount; }
2132 void IncXMLImportedFormulaCount( sal_uLong nVal )
2134 if ( nXMLImportedFormulaCount + nVal > nXMLImportedFormulaCount )
2135 nXMLImportedFormulaCount += nVal;
2137 void DecXMLImportedFormulaCount( sal_uLong nVal )
2139 if ( nVal <= nXMLImportedFormulaCount )
2140 nXMLImportedFormulaCount -= nVal;
2141 else
2142 nXMLImportedFormulaCount = 0;
2145 void StartTrackTimer();
2147 void CompileDBFormula();
2148 void CompileColRowNameFormula();
2150 /** Maximum string length of a column, e.g. for dBase export.
2151 @return String length in octets (!) of the destination encoding. In
2152 case of non-octet encodings (e.g. UCS2) the length in code
2153 points times sizeof(sal_Unicode) is returned. */
2154 sal_Int32 GetMaxStringLen( SCTAB nTab, SCCOL nCol,
2155 SCROW nRowStart, SCROW nRowEnd,
2156 rtl_TextEncoding eCharSet ) const;
2157 /** Maximum string length of numerical cells of a column, e.g. for dBase export.
2158 @return String length in characters (!) including the decimal
2159 separator, and the decimal precision needed. */
2160 sal_Int32 GetMaxNumberStringLen( sal_uInt16& nPrecision,
2161 SCTAB nTab, SCCOL nCol,
2162 SCROW nRowStart, SCROW nRowEnd ) const;
2164 void KeyInput( const KeyEvent& rKEvt ); // TimerDelays etc.
2166 ScChangeTrack* GetChangeTrack() const { return pChangeTrack; }
2168 //! only for import filter, deletes any existing ChangeTrack via
2169 //! EndChangeTracking() and takes ownership of new ChangeTrack pTrack
2170 SC_DLLPUBLIC void SetChangeTrack( ScChangeTrack* pTrack );
2172 void StartChangeTracking();
2173 void EndChangeTracking();
2175 SC_DLLPUBLIC void CompareDocument( ScDocument& rOtherDoc );
2177 void AddUnoObject( SfxListener& rObject );
2178 void RemoveUnoObject( SfxListener& rObject );
2179 void BroadcastUno( const SfxHint &rHint );
2180 void AddUnoListenerCall( const css::uno::Reference<
2181 css::util::XModifyListener >& rListener,
2182 const css::lang::EventObject& rEvent );
2184 void SetInLinkUpdate(bool bSet); // TableLink or AreaLink
2185 bool IsInLinkUpdate() const; // including DdeLink
2187 SC_DLLPUBLIC SfxItemPool* GetEditPool() const;
2188 SC_DLLPUBLIC SfxItemPool* GetEnginePool() const;
2189 SC_DLLPUBLIC ScFieldEditEngine& GetEditEngine();
2190 SC_DLLPUBLIC ScNoteEditEngine& GetNoteEngine();
2192 ScRefreshTimerControl * const & GetRefreshTimerControlAddress() const
2193 { return pRefreshTimerControl; }
2195 void SetPastingDrawFromOtherDoc( bool bVal )
2196 { bPastingDrawFromOtherDoc = bVal; }
2197 bool PastingDrawFromOtherDoc() const
2198 { return bPastingDrawFromOtherDoc; }
2200 /// an ID unique to each document instance
2201 sal_uInt32 GetDocumentID() const;
2203 void InvalidateStyleSheetUsage()
2204 { bStyleSheetUsageInvalid = true; }
2205 void SC_DLLPUBLIC GetSortParam( ScSortParam& rParam, SCTAB nTab );
2206 void SC_DLLPUBLIC SetSortParam( ScSortParam& rParam, SCTAB nTab );
2208 inline void SetVbaEventProcessor( const css::uno::Reference< css::script::vba::XVBAEventProcessor >& rxVbaEvents )
2209 { mxVbaEvents = rxVbaEvents; }
2210 const css::uno::Reference< css::script::vba::XVBAEventProcessor >&
2211 GetVbaEventProcessor() const { return mxVbaEvents; }
2213 /** Should only be GRAM_PODF or GRAM_ODFF. */
2214 void SetStorageGrammar( formula::FormulaGrammar::Grammar eGrammar );
2215 formula::FormulaGrammar::Grammar GetStorageGrammar() const
2216 { return eStorageGrammar; }
2218 SC_DLLPUBLIC SfxUndoManager* GetUndoManager();
2219 bool IsInVBAMode() const;
2220 ScRowBreakIterator* GetRowBreakIterator(SCTAB nTab) const;
2222 void AddSubTotalCell(ScFormulaCell* pCell);
2223 void RemoveSubTotalCell(ScFormulaCell* pCell);
2224 void SetSubTotalCellsDirty(const ScRange& rDirtyRange);
2226 sal_uInt16 GetTextWidth( const ScAddress& rPos ) const;
2228 SvtScriptType GetScriptType( const ScAddress& rPos ) const;
2229 void SetScriptType( const ScAddress& rPos, SvtScriptType nType );
2230 void UpdateScriptTypes( const ScAddress& rPos, SCCOL nColSize, SCROW nRowSize );
2232 size_t GetFormulaHash( const ScAddress& rPos ) const;
2235 * Make specified formula cells non-grouped.
2237 * @param nTab sheet index
2238 * @param nCol column index
2239 * @param rRows list of row indices at which formula cells are to be
2240 * unshared. This call sorts the passed row indices and
2241 * removes duplicates, which is why the caller must pass it
2242 * as reference.
2244 void UnshareFormulaCells( SCTAB nTab, SCCOL nCol, std::vector<SCROW>& rRows );
2245 void RegroupFormulaCells( SCTAB nTab, SCCOL nCol );
2247 ScFormulaVectorState GetFormulaVectorState( const ScAddress& rPos ) const;
2249 formula::FormulaTokenRef ResolveStaticReference( const ScAddress& rPos );
2250 formula::FormulaTokenRef ResolveStaticReference( const ScRange& rRange );
2252 formula::VectorRefArray FetchVectorRefArray( const ScAddress& rPos, SCROW nLength );
2255 * Call this before any operations that might trigger one or more formula
2256 * cells to get calculated.
2258 void ClearFormulaContext();
2260 SvtBroadcaster* GetBroadcaster( const ScAddress& rPos );
2261 const SvtBroadcaster* GetBroadcaster( const ScAddress& rPos ) const;
2262 void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, const ScAddress& rTopPos, SCROW nLength );
2264 #if DEBUG_COLUMN_STORAGE
2265 SC_DLLPUBLIC void DumpFormulaGroups( SCTAB nTab, SCCOL nCol ) const;
2266 #endif
2268 #if DEBUG_AREA_BROADCASTER
2269 SC_DLLPUBLIC void DumpAreaBroadcasters() const;
2270 #endif
2272 SC_DLLPUBLIC void SetCalcConfig( const ScCalcConfig& rConfig );
2273 const ScCalcConfig& GetCalcConfig() const { return maCalcConfig; }
2275 void ConvertFormulaToValue( const ScRange& rRange, sc::TableValues* pUndo );
2277 void SwapNonEmpty( sc::TableValues& rValues );
2279 void finalizeOutlineImport();
2281 private:
2284 * Use this class as a locale variable to merge number formatter from
2285 * another document, and set NULL pointer to pFormatExchangeList when
2286 * done.
2288 class NumFmtMergeHandler
2290 public:
2291 explicit NumFmtMergeHandler(ScDocument* pDoc, ScDocument* pSrcDoc);
2292 ~NumFmtMergeHandler();
2294 private:
2295 ScDocument* mpDoc;
2298 bool TableExists( SCTAB nTab ) const;
2299 ScTable* FetchTable( SCTAB nTab );
2300 const ScTable* FetchTable( SCTAB nTab ) const;
2302 void MergeNumberFormatter(ScDocument* pSrcDoc);
2304 void ImplCreateOptions(); // Suggestion: switch to on-demand?
2305 void ImplDeleteOptions();
2307 void DeleteDrawLayer();
2308 SC_DLLPUBLIC bool DrawGetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer ) const;
2309 void DrawMovePage( sal_uInt16 nOldPos, sal_uInt16 nNewPos );
2310 void DrawCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos );
2312 void UpdateDrawPrinter();
2313 void UpdateDrawLanguages();
2314 SC_DLLPUBLIC void InitClipPtrs( ScDocument* pSourceDoc );
2316 void LoadDdeLinks(SvStream& rStream);
2317 void SaveDdeLinks(SvStream& rStream) const;
2319 void DeleteAreaLinksOnTab( SCTAB nTab );
2320 void UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode,
2321 const ScRange& r, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
2323 void CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, const ScMarkData* pMarks);
2325 bool HasPartOfMerged( const ScRange& rRange );
2327 ScRefCellValue GetRefCellValue( const ScAddress& rPos );
2329 std::map< SCTAB, ScSortParam > mSheetSortParams;
2331 SCSIZE GetPatternCount( SCTAB nTab, SCCOL nCol ) const;
2332 SCSIZE GetPatternCount( SCTAB nTab, SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const;
2333 void ReservePatternCount( SCTAB nTab, SCCOL nCol, SCSIZE nReserve );
2335 void SharePooledResources( ScDocument* pSrcDoc );
2337 void EndListeningIntersectedGroup(
2338 sc::EndListeningContext& rCxt, const ScAddress& rPos, std::vector<ScAddress>* pGroupPos = nullptr );
2340 void EndListeningIntersectedGroups(
2341 sc::EndListeningContext& rCxt, const ScRange& rRange, std::vector<ScAddress>* pGroupPos = nullptr );
2343 void EndListeningGroups( const std::vector<ScAddress>& rPosArray );
2344 void SetNeedsListeningGroups( const std::vector<ScAddress>& rPosArray );
2347 #endif
2349 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */