Bump version to 4.3-4
[LibreOffice.git] / sc / inc / document.hxx
blob31da4707a8b6bb3dbf7f5f80703e6f6e77b40305
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 <com/sun/star/uno/Reference.hxx>
26 #include <rtl/ref.hxx>
27 #include "scdllapi.h"
28 #include "rangelst.hxx"
29 #include "rangenam.hxx"
30 #include "brdcst.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 "compressedarray.hxx"
38 #include "calcmacros.hxx"
39 #include "calcconfig.hxx"
40 #include <tools/fract.hxx>
41 #include <tools/gen.hxx>
42 #include <svl/zforlist.hxx>
44 #include <memory>
45 #include <map>
46 #include <set>
47 #include <vector>
48 #include <boost/ptr_container/ptr_vector.hpp>
49 #include <boost/scoped_ptr.hpp>
50 #include <boost/shared_ptr.hpp>
52 #include "markdata.hxx"
54 namespace editeng { class SvxBorderLine; }
55 namespace formula { struct VectorRefArray; }
56 namespace svl {
58 class SharedString;
59 class SharedStringPool;
63 namespace sc {
65 struct FormulaGroupContext;
66 class StartListeningContext;
67 class EndListeningContext;
68 class CopyFromClipContext;
69 class ColumnSpanSet;
70 struct ColumnBlockPosition;
71 struct RefUpdateContext;
72 class EditTextIterator;
73 struct NoteEntry;
74 struct FormulaGroupContext;
75 class DocumentStreamAccess;
76 class DocumentLinkManager;
77 class CellValues;
78 class RowHeightContext;
79 struct SetFormulaDirtyContext;
80 class RefMovedHint;
81 struct SortUndoParam;
82 struct ReorderParam;
86 class SvxFontItem;
88 class KeyEvent;
89 class OutputDevice;
90 class SdrObject;
91 class SfxBroadcaster;
92 class SfxListener;
93 class SfxHint;
94 class SfxItemSet;
95 class SfxObjectShell;
96 class SfxBindings;
97 class SfxPoolItem;
98 class SfxItemPool;
99 class SfxPrinter;
100 class SfxStyleSheetBase;
101 class SvMemoryStream;
102 class SvNumberFormatter;
103 class SvxBoxInfoItem;
104 class SvxBoxItem;
105 class SvxForbiddenCharactersTable;
106 namespace sfx2 {
107 class LinkManager;
109 class SvxSearchItem;
110 class Window;
111 class XColorList;
113 struct ScAttrEntry;
114 class ScAutoFormatData;
115 class ScBroadcastAreaSlotMachine;
116 class ScChangeViewSettings;
117 class ScChartCollection;
118 class ScChartListenerCollection;
119 class ScConditionalFormat;
120 class ScConditionalFormatList;
121 class ScDBCollection;
122 class ScDBData;
123 class ScDetOpData;
124 class ScDetOpList;
125 class ScDocOptions;
126 class ScDocProtection;
127 class ScDocumentPool;
128 class ScDrawLayer;
129 class ScExtDocOptions;
130 class ScExternalRefManager;
131 class ScFormulaCell;
132 class ScMacroManager;
133 class ScMarkData;
134 class ScOutlineTable;
135 class ScPatternAttr;
136 class ScPrintRangeSaver;
137 class ScRangeData;
138 class ScRangeName;
139 class ScStyleSheet;
140 class ScStyleSheetPool;
141 class ScTable;
142 class ScTableProtection;
143 class ScTokenArray;
144 class ScValidationData;
145 class ScValidationDataList;
146 class ScViewOptions;
147 class ScChangeTrack;
148 class ScEditEngineDefaulter;
149 class ScFieldEditEngine;
150 class ScNoteEditEngine;
151 struct ScConsolidateParam;
152 class ScDPObject;
153 class ScDPCollection;
154 class ScMatrix;
155 class ScScriptTypeData;
156 class ScPoolHelper;
157 struct ScSortParam;
158 class ScRefreshTimerControl;
159 class ScUnoListenerCalls;
160 class ScUnoRefList;
161 class ScRecursionHelper;
162 struct RowInfo;
163 struct ScTableInfo;
164 struct ScTabOpParam;
165 class VirtualDevice;
166 class ScAutoNameCache;
167 class ScTemporaryChartLock;
168 class ScLookupCache;
169 struct ScLookupCacheMapImpl;
170 class SfxUndoManager;
171 class ScFormulaParserPool;
172 struct ScClipParam;
173 class ScRowBreakIterator;
174 struct ScSetStringParam;
175 class ScDocRowHeightUpdater;
176 struct ScColWidthParam;
177 class ScSheetEvents;
178 class ScProgress;
179 class SvtListener;
180 class ScEditDataArray;
181 class EditTextObject;
182 struct ScRefCellValue;
183 class ScDocumentImport;
184 class ScPostIt;
185 struct ScSubTotalParam;
186 struct ScQueryParam;
188 namespace com { namespace sun { namespace star {
189 namespace lang {
190 class XMultiServiceFactory;
191 struct EventObject;
193 namespace i18n {
194 class XBreakIterator;
196 namespace util {
197 class XModifyListener;
199 namespace embed {
200 class XEmbeddedObject;
202 namespace script { namespace vba {
203 class XVBAEventProcessor;
205 namespace sheet {
206 struct TablePageBreakData;
208 } } }
210 #include <svl/zforlist.hxx>
212 #define SC_DOC_NEW 0xFFFF
214 #define SC_MACROCALL_ALLOWED 0
215 #define SC_MACROCALL_NOTALLOWED 1
216 #define SC_MACROCALL_ASK 2
218 #define SC_ASIANCOMPRESSION_INVALID 0xff
219 #define SC_ASIANKERNING_INVALID 0xff
221 enum ScDocumentMode
223 SCDOCMODE_DOCUMENT,
224 SCDOCMODE_CLIP,
225 SCDOCMODE_UNDO
229 struct ScDocStat
231 OUString aDocName;
232 SCTAB nTableCount;
233 sal_uLong nCellCount;
234 sal_uInt16 nPageCount;
237 // DDE link modes
238 const sal_uInt8 SC_DDE_DEFAULT = 0;
239 const sal_uInt8 SC_DDE_ENGLISH = 1;
240 const sal_uInt8 SC_DDE_TEXT = 2;
241 const sal_uInt8 SC_DDE_IGNOREMODE = 255; /// For usage in FindDdeLink() only!
243 class ScDocument
245 friend class ScValueIterator;
246 friend class ScHorizontalValueIterator;
247 friend class ScDBQueryDataIterator;
248 friend class ScCellIterator;
249 friend class ScQueryCellIterator;
250 friend class ScHorizontalCellIterator;
251 friend class ScHorizontalAttrIterator;
252 friend class ScDocAttrIterator;
253 friend class ScAccessibleTableBase;
254 friend class ScAttrRectIterator;
255 friend class ScDocShell;
256 friend class ScDocRowHeightUpdater;
257 friend class ScColumnTextWidthIterator;
258 friend class ScFormulaCell;
259 friend class ScTable;
260 friend class ScColumn;
261 friend struct ScRefCellValue;
262 friend class ScDocumentImport;
263 friend class sc::DocumentStreamAccess;
264 friend class sc::ColumnSpanSet;
265 friend class sc::EditTextIterator;
267 typedef ::std::vector<ScTable*> TableContainer;
268 private:
270 rtl::Reference<ScPoolHelper> xPoolHelper;
272 boost::shared_ptr<svl::SharedStringPool> mpCellStringPool;
273 boost::scoped_ptr<sc::FormulaGroupContext> mpFormulaGroupCxt;
274 mutable boost::scoped_ptr<sc::DocumentLinkManager> mpDocLinkMgr;
276 ScCalcConfig maCalcConfig;
278 SfxUndoManager* mpUndoManager;
279 ScFieldEditEngine* pEditEngine; // uses pEditPool from xPoolHelper
280 ScNoteEditEngine* pNoteEngine; // uses pEditPool from xPoolHelper
281 SfxObjectShell* pShell;
282 SfxPrinter* pPrinter;
283 VirtualDevice* pVirtualDevice_100th_mm;
284 ScDrawLayer* pDrawLayer; // SdrModel
285 rtl::Reference<XColorList> pColorList;
286 ScValidationDataList* pValidationList; // validity
287 SvNumberFormatterIndexTable* pFormatExchangeList; // for application of number formats
288 TableContainer maTabs;
289 std::vector<OUString> maTabNames; // for undo document, we need the information tab name <-> index
290 mutable ScRangeName* pRangeName;
291 ScDBCollection* pDBCollection;
292 ScDPCollection* pDPCollection;
293 ScChartCollection* pChartCollection;
294 std::auto_ptr< ScTemporaryChartLock > apTemporaryChartLock;
295 ScPatternAttr* pSelectionAttr; // Attributes of a block
296 ScFormulaCell* pFormulaTree; // formula tree (start)
297 ScFormulaCell* pEOFormulaTree; // formula tree (end), last cell
298 ScFormulaCell* pFormulaTrack; // BroadcastTrack (start)
299 ScFormulaCell* pEOFormulaTrack; // BrodcastTrack (end), last cell
300 ScBroadcastAreaSlotMachine* pBASM; // BroadcastAreas
301 ScChartListenerCollection* pChartListenerCollection;
302 SvMemoryStream* pClipData;
303 ScDetOpList* pDetOpList;
304 ScChangeTrack* pChangeTrack;
305 SfxBroadcaster* pUnoBroadcaster;
306 ScUnoListenerCalls* pUnoListenerCalls;
307 ScUnoRefList* pUnoRefUndoList;
308 ScChangeViewSettings* pChangeViewSettings;
309 ScScriptTypeData* pScriptTypeData;
310 ScRefreshTimerControl* pRefreshTimerControl;
311 rtl::Reference<SvxForbiddenCharactersTable> xForbiddenCharacters;
313 ScFieldEditEngine* pCacheFieldEditEngine;
315 ::std::auto_ptr<ScDocProtection> pDocProtection;
316 ::std::auto_ptr<ScClipParam> mpClipParam;
318 ::std::auto_ptr<ScExternalRefManager> pExternalRefMgr;
319 ::std::auto_ptr<ScMacroManager> mpMacroMgr;
322 // mutable for lazy construction
323 mutable ::std::auto_ptr< ScFormulaParserPool >
324 mxFormulaParserPool; /// Pool for all external formula parsers used by this document.
326 OUString aDocName; // optional: name of document
327 OUString aDocCodeName; // optional: name of document (twice?)
328 OUString maFileURL; // file URL for copy & paste
329 ScRangePairListRef xColNameRanges;
330 ScRangePairListRef xRowNameRanges;
332 ScViewOptions* pViewOptions; // view options
333 ScDocOptions* pDocOptions; // document options
334 ScExtDocOptions* pExtDocOptions; // for import etc.
335 ScConsolidateParam* pConsolidateDlgData;
337 ScRecursionHelper* pRecursionHelper; // information for recursive and iterative cell formulas
339 ScAutoNameCache* pAutoNameCache; // for automatic name lookup during CompileXML
341 ScLookupCacheMapImpl* pLookupCacheMapImpl; // cache for lookups like VLOOKUP and MATCH
343 SfxItemSet* pPreviewFont; // convert to std::auto_ptr or whatever
344 ScStyleSheet* pPreviewCellStyle;
345 ScMarkData maPreviewSelection;
346 sal_Int64 nUnoObjectId; // counted up for UNO objects
348 sal_uInt32 nRangeOverflowType; // used in (xml) loading for overflow warnings
350 ScRange aEmbedRange;
351 ScAddress aCurTextWidthCalcPos;
353 Timer aTrackTimer;
355 com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor >
356 mxVbaEvents;
357 public:
358 boost::ptr_vector< ScInterpreterTableOpParams > aTableOpList; // list of ScInterpreterTableOpParams currently in use
359 ScInterpreterTableOpParams aLastTableOpParams; // remember last params
360 private:
362 LanguageType eLanguage; // default language
363 LanguageType eCjkLanguage; // default language for asian text
364 LanguageType eCtlLanguage; // default language for complex text
365 rtl_TextEncoding eSrcSet; // during reading: source character set
367 /** The compiler grammar used in document storage. GRAM_PODF for ODF 1.1
368 documents, GRAM_ODFF for ODF 1.2 documents. */
369 formula::FormulaGrammar::Grammar eStorageGrammar;
371 /** The compiler grammar used in ODF import after brackets had been
372 stripped (which they shouldn't, but until that's fixed) by the XML
373 importer. */
374 formula::FormulaGrammar::Grammar eXmlImportGrammar;
376 sal_uLong nFormulaCodeInTree; // FormelRPN im Formelbaum
377 sal_uLong nXMLImportedFormulaCount; // progress count during XML import
378 sal_uInt16 nInterpretLevel; // >0 if in interpreter
379 sal_uInt16 nMacroInterpretLevel; // >0 if macro in interpreter
380 sal_uInt16 nInterpreterTableOpLevel; // >0 if in interpreter TableOp
381 sal_uInt16 nSrcVer; // file version (load/save)
382 SCROW nSrcMaxRow; // number of lines to load/save
383 sal_uInt16 nFormulaTrackCount;
384 bool bHardRecalcState; // false: soft, true: hard
385 SCTAB nVisibleTab; // for OLE etc., don't use inside ScDocument
387 ScLkUpdMode eLinkMode;
389 bool bAutoCalc; // calculate automatically
390 bool bAutoCalcShellDisabled; // in/from/for ScDocShell disabled
391 // are there ForcedFormulas which have to be calculated
392 // in interaction with ScDocShell SetDocumentModified,
393 // AutoCalcShellDisabled and TrackFormulas
394 bool bForcedFormulaPending;
395 bool bCalculatingFormulaTree;
396 bool bIsClip;
397 bool bIsUndo;
398 bool bIsVisible; // set from view ctor
400 bool bIsEmbedded; // display/adjust Embedded area?
402 // no broadcast, construct no listener during insert from a different
403 // Doc (per filter or the like ), not until CompileAll / CalcAfterLoad
404 bool bInsertingFromOtherDoc;
405 bool bLoadingMedium;
406 bool bImportingXML; // special handling of formula text
407 bool bCalcingAfterLoad; // in CalcAfterLoad TRUE
408 // don't construct/destruct listeners temporarily
409 bool bNoListening;
410 bool mbIdleEnabled;
411 bool bInLinkUpdate; // TableLink or AreaLink
412 bool bChartListenerCollectionNeedsUpdate;
413 // are/were there RC_FORCED formula cells in the document (if set once to TRUE then set forever)
414 bool bHasForcedFormulas;
415 // is the Doc being destroyed? (no Notify-Tracking etc. needed anymore)
416 bool bInDtorClear;
417 // expand reference if insert column/row takes place at the border
418 // of a reference
419 // is fetched in each UpdateReference from InputOptions,
420 // assigned, and restored at the end of UpdateReference
421 bool bExpandRefs;
422 // for detective update, is set for each change of a formula
423 bool bDetectiveDirty;
425 sal_uInt8 nMacroCallMode; // Macros per warning dialog disabled?
426 bool bHasMacroFunc; // valid only after loading
428 sal_uInt8 nVisSpellState;
430 sal_uInt8 nAsianCompression;
431 sal_uInt8 nAsianKerning;
433 bool bPastingDrawFromOtherDoc;
435 sal_uInt8 nInDdeLinkUpdate; // originating DDE links (stacked bool)
437 bool bInUnoBroadcast;
438 bool bInUnoListenerCall;
439 formula::FormulaGrammar::Grammar eGrammar;
441 mutable bool bStyleSheetUsageInvalid;
443 bool mbUndoEnabled:1;
444 bool mbAdjustHeightEnabled:1;
445 bool mbExecuteLinkEnabled:1;
446 bool mbChangeReadOnlyEnabled:1; // allow changes in read-only document (for API import filters)
447 bool mbStreamValidLocked:1;
448 bool mbUserInteractionEnabled:1; // whether or not to launch any kind of interactive dialogs.
450 sal_Int16 mnNamedRangesLockCount;
452 ::std::set<ScFormulaCell*> maSubTotalCells;
454 bool mbUseEmbedFonts;
456 public:
457 bool IsCellInChangeTrack(const ScAddress &cell,Color *pColCellBoder);
458 void GetCellChangeTrackNote(const ScAddress &cell, OUString &strTrackText, bool &pbLeftEdge);
459 bool IsUsingEmbededFonts() { return mbUseEmbedFonts; }
460 void SetIsUsingEmbededFonts( bool bUse ) { mbUseEmbedFonts = bUse; }
461 SC_DLLPUBLIC sal_uLong GetCellCount() const; // all cells
462 sal_uLong GetCodeCount() const; // RPN-Code in formulas
463 DECL_LINK( GetUserDefinedColor, sal_uInt16 * );
464 // number formatter
465 public:
466 SC_DLLPUBLIC ScDocument( ScDocumentMode eMode = SCDOCMODE_DOCUMENT,
467 SfxObjectShell* pDocShell = NULL );
468 SC_DLLPUBLIC ~ScDocument();
470 SC_DLLPUBLIC const OUString& GetName() const { return aDocName; }
471 void SetName( const OUString& r ) { aDocName = r; }
472 const OUString& GetCodeName() const { return aDocCodeName; }
473 void SetCodeName( const OUString& r ) { aDocCodeName = r; }
474 const OUString& GetFileURL() const { return maFileURL; }
476 void GetDocStat( ScDocStat& rDocStat );
478 SC_DLLPUBLIC void InitDrawLayer( SfxObjectShell* pDocShell = NULL );
479 rtl::Reference<XColorList> GetColorList();
481 SC_DLLPUBLIC sfx2::LinkManager* GetLinkManager();
482 SC_DLLPUBLIC const sfx2::LinkManager* GetLinkManager() const;
484 sc::DocumentLinkManager& GetDocLinkManager();
485 const sc::DocumentLinkManager& GetDocLinkManager() const;
487 SC_DLLPUBLIC const ScDocOptions& GetDocOptions() const;
488 SC_DLLPUBLIC void SetDocOptions( const ScDocOptions& rOpt );
489 SC_DLLPUBLIC const ScViewOptions& GetViewOptions() const;
490 SC_DLLPUBLIC void SetViewOptions( const ScViewOptions& rOpt );
491 void SetPrintOptions();
493 ScExtDocOptions* GetExtDocOptions() { return pExtDocOptions; }
494 SC_DLLPUBLIC void SetExtDocOptions( ScExtDocOptions* pNewOptions );
496 SC_DLLPUBLIC void GetLanguage( LanguageType& rLatin, LanguageType& rCjk, LanguageType& rCtl ) const;
497 void SetLanguage( LanguageType eLatin, LanguageType eCjk, LanguageType eCtl );
499 void SetConsolidateDlgData( const ScConsolidateParam* pData );
500 const ScConsolidateParam* GetConsolidateDlgData() const { return pConsolidateDlgData; }
502 void Clear( bool bFromDestructor = false );
504 ScFieldEditEngine* CreateFieldEditEngine();
505 void DisposeFieldEditEngine(ScFieldEditEngine*& rpEditEngine);
508 * Get all range names that are local to each table. It only returns
509 * non-empty range name set.
511 SC_DLLPUBLIC void GetAllTabRangeNames(ScRangeName::TabNameCopyMap& rRangeNames) const;
512 SC_DLLPUBLIC void SetAllRangeNames( const boost::ptr_map<OUString, ScRangeName>& rRangeMap);
513 SC_DLLPUBLIC void GetTabRangeNameMap(std::map<OUString, ScRangeName*>& rRangeName);
514 SC_DLLPUBLIC void GetRangeNameMap(std::map<OUString, ScRangeName*>& rRangeName);
515 SC_DLLPUBLIC ScRangeName* GetRangeName(SCTAB nTab) const;
516 SC_DLLPUBLIC ScRangeName* GetRangeName() const;
517 void SetRangeName(SCTAB nTab, ScRangeName* pNew);
518 void SetRangeName( ScRangeName* pNewRangeName );
521 * Call this immediately before updating all named ranges.
523 SC_DLLPUBLIC void PreprocessRangeNameUpdate();
524 SC_DLLPUBLIC void PreprocessDBDataUpdate();
525 SC_DLLPUBLIC void CompileHybridFormula();
528 * Insert a new named expression to the global scope.
530 * @param rName name for the expression.
531 * @param rPos base position.
532 * @param rExpr formula expression to be associated with the name. The
533 * current grammer is used to compile this expression.
535 * @return true if inserted successfully, false otherwise.
537 bool InsertNewRangeName( const OUString& rName, const ScAddress& rPos, const OUString& rExpr );
539 SCTAB GetMaxTableNumber() { return static_cast<SCTAB>(maTabs.size()) - 1; }
541 ScRangePairList* GetColNameRanges() { return &xColNameRanges; }
542 ScRangePairList* GetRowNameRanges() { return &xRowNameRanges; }
543 ScRangePairListRef& GetColNameRangesRef() { return xColNameRanges; }
544 ScRangePairListRef& GetRowNameRangesRef() { return xRowNameRanges; }
546 SC_DLLPUBLIC ScDBCollection* GetDBCollection() const;
547 void SetDBCollection( ScDBCollection* pNewDBCollection,
548 bool bRemoveAutoFilter = false );
549 const ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bStartOnly = false) const;
550 ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bStartOnly = false);
551 const ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const;
552 ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
554 SC_DLLPUBLIC const ScRangeData* GetRangeAtBlock( const ScRange& rBlock, OUString* pName=NULL ) const;
556 bool HasPivotTable() const;
557 SC_DLLPUBLIC ScDPCollection* GetDPCollection();
558 SC_DLLPUBLIC const ScDPCollection* GetDPCollection() const;
559 SC_DLLPUBLIC ScDPObject* GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
560 ScDPObject* GetDPAtBlock( const ScRange& rBlock ) const;
562 SC_DLLPUBLIC ScChartCollection* GetChartCollection() const;
564 void StopTemporaryChartLock();
566 void EnsureGraphicNames();
568 SdrObject* GetObjectAtPoint( SCTAB nTab, const Point& rPos );
569 bool HasChartAtPoint( SCTAB nTab, const Point& rPos, OUString& rName );
571 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > GetChartByName( const OUString& rChartName );
572 std::vector<std::pair<css::uno::Reference<
573 css::chart2::XChartDocument>, Rectangle> > GetAllCharts();
575 SC_DLLPUBLIC void GetChartRanges( const OUString& rChartName, ::std::vector< ScRangeList >& rRanges, ScDocument* pSheetNameDoc );
576 void SetChartRanges( const OUString& rChartName, const ::std::vector< ScRangeList >& rRanges );
578 void UpdateChartArea( const OUString& rChartName, const ScRange& rNewArea,
579 bool bColHeaders, bool bRowHeaders, bool bAdd );
580 void UpdateChartArea( const OUString& rChartName,
581 const ScRangeListRef& rNewList,
582 bool bColHeaders, bool bRowHeaders, bool bAdd );
583 void GetOldChartParameters( const OUString& rName,
584 ScRangeList& rRanges, bool& rColHeaders, bool& rRowHeaders );
585 ::com::sun::star::uno::Reference<
586 ::com::sun::star::embed::XEmbeddedObject >
587 FindOleObjectByName( const OUString& rName );
589 SC_DLLPUBLIC void MakeTable( SCTAB nTab,bool _bNeedsNameCheck = true );
591 SCTAB GetVisibleTab() const { return nVisibleTab; }
592 SC_DLLPUBLIC void SetVisibleTab(SCTAB nTab) { nVisibleTab = nTab; }
594 SC_DLLPUBLIC bool HasTable( SCTAB nTab ) const;
595 SC_DLLPUBLIC bool GetName( SCTAB nTab, OUString& rName ) const;
596 SC_DLLPUBLIC bool GetCodeName( SCTAB nTab, OUString& rName ) const;
597 SC_DLLPUBLIC bool SetCodeName( SCTAB nTab, const OUString& rName );
598 SC_DLLPUBLIC bool GetTable( const OUString& rName, SCTAB& rTab ) const;
600 SC_DLLPUBLIC std::vector<OUString> GetAllTableNames() const;
602 OUString GetCopyTabName(SCTAB nTab) const;
604 SC_DLLPUBLIC void SetAnonymousDBData(SCTAB nTab, ScDBData* pDBData);
605 SC_DLLPUBLIC ScDBData* GetAnonymousDBData(SCTAB nTab);
607 SC_DLLPUBLIC SCTAB GetTableCount() const;
608 SvNumberFormatterIndexTable* GetFormatExchangeList() const { return pFormatExchangeList; }
610 SC_DLLPUBLIC ScDocProtection* GetDocProtection() const;
611 SC_DLLPUBLIC void SetDocProtection(const ScDocProtection* pProtect);
612 SC_DLLPUBLIC bool IsDocProtected() const;
613 bool IsDocEditable() const;
614 SC_DLLPUBLIC bool IsTabProtected( SCTAB nTab ) const;
615 SC_DLLPUBLIC ScTableProtection* GetTabProtection( SCTAB nTab ) const;
616 SC_DLLPUBLIC void SetTabProtection(SCTAB nTab, const ScTableProtection* pProtect);
617 void CopyTabProtection(SCTAB nTabSrc, SCTAB nTabDest);
619 void LockTable(SCTAB nTab);
620 void UnlockTable(SCTAB nTab);
622 bool IsBlockEditable( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
623 SCCOL nEndCol, SCROW nEndRow,
624 bool* pOnlyNotBecauseOfMatrix = NULL ) const;
625 bool IsSelectionEditable( const ScMarkData& rMark,
626 bool* pOnlyNotBecauseOfMatrix = NULL ) const;
627 bool HasSelectedBlockMatrixFragment( SCCOL nStartCol, SCROW nStartRow,
628 SCCOL nEndCol, SCROW nEndRow,
629 const ScMarkData& rMark ) const;
631 SC_DLLPUBLIC bool GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMatrix );
633 bool IsEmbedded() const;
634 void GetEmbedded( ScRange& rRange ) const;
635 void SetEmbedded( const ScRange& rRange );
636 void ResetEmbedded();
637 Rectangle GetEmbeddedRect() const; // 1/100 mm
638 void SetEmbedded( SCTAB nTab, const Rectangle& rRect ); // from VisArea (1/100 mm)
640 static SC_DLLPUBLIC bool ValidTabName( const OUString& rName );
642 SC_DLLPUBLIC bool ValidNewTabName( const OUString& rName ) const;
643 SC_DLLPUBLIC void CreateValidTabName(OUString& rName) const;
644 SC_DLLPUBLIC void CreateValidTabNames(std::vector<OUString>& aNames, SCTAB nCount) const;
646 void AppendTabOnLoad(const OUString& rName);
647 void SetTabNameOnLoad(SCTAB nTab, const OUString& rName);
648 void InvalidateStreamOnSave();
650 SC_DLLPUBLIC bool InsertTab(
651 SCTAB nPos, const OUString& rName, bool bExternalDocument = false, bool bUndoDeleteTab = false );
653 SC_DLLPUBLIC bool InsertTabs( SCTAB nPos, const std::vector<OUString>& rNames,
654 bool bExternalDocument = false, bool bNamesValid = false );
655 SC_DLLPUBLIC bool DeleteTabs( SCTAB nTab, SCTAB nSheets );
656 SC_DLLPUBLIC bool DeleteTab( SCTAB nTab );
657 SC_DLLPUBLIC bool RenameTab( SCTAB nTab, const OUString& rName,
658 bool bUpdateRef = true,
659 bool bExternalDocument = false );
660 bool MoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress = NULL );
661 bool CopyTab( SCTAB nOldPos, SCTAB nNewPos,
662 const ScMarkData* pOnlyMarked = NULL );
663 SC_DLLPUBLIC sal_uLong TransferTab(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos,
664 bool bInsertNew = true,
665 bool bResultsOnly = false );
666 SC_DLLPUBLIC void TransferDrawPage(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos);
667 SC_DLLPUBLIC void SetVisible( SCTAB nTab, bool bVisible );
668 SC_DLLPUBLIC bool IsVisible( SCTAB nTab ) const;
669 bool IsStreamValid( SCTAB nTab ) const;
670 void SetStreamValid( SCTAB nTab, bool bSet, bool bIgnoreLock = false );
671 void LockStreamValid( bool bLock );
672 bool IsStreamValidLocked() const { return mbStreamValidLocked; }
673 bool IsPendingRowHeights( SCTAB nTab ) const;
674 void SetPendingRowHeights( SCTAB nTab, bool bSet );
675 SC_DLLPUBLIC void SetLayoutRTL( SCTAB nTab, bool bRTL );
676 SC_DLLPUBLIC bool IsLayoutRTL( SCTAB nTab ) const;
677 bool IsNegativePage( SCTAB nTab ) const;
678 SC_DLLPUBLIC void SetScenario( SCTAB nTab, bool bFlag );
679 SC_DLLPUBLIC bool IsScenario( SCTAB nTab ) const;
680 SC_DLLPUBLIC void GetScenarioData( SCTAB nTab, OUString& rComment,
681 Color& rColor, sal_uInt16& rFlags ) const;
682 SC_DLLPUBLIC void SetScenarioData( SCTAB nTab, const OUString& rComment,
683 const Color& rColor, sal_uInt16 nFlags );
684 SC_DLLPUBLIC Color GetTabBgColor( SCTAB nTab ) const;
685 SC_DLLPUBLIC void SetTabBgColor( SCTAB nTab, const Color& rColor );
686 SC_DLLPUBLIC bool IsDefaultTabBgColor( SCTAB nTab ) const;
687 void GetScenarioFlags( SCTAB nTab, sal_uInt16& rFlags ) const;
688 SC_DLLPUBLIC bool IsActiveScenario( SCTAB nTab ) const;
689 SC_DLLPUBLIC void SetActiveScenario( SCTAB nTab, bool bActive ); // only for Undo etc.
690 SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const;
691 SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const;
692 SC_DLLPUBLIC void SetGrammar( formula::FormulaGrammar::Grammar eGram );
693 SC_DLLPUBLIC sal_uInt8 GetLinkMode( SCTAB nTab ) const;
694 bool IsLinked( SCTAB nTab ) const;
695 SC_DLLPUBLIC const OUString GetLinkDoc( SCTAB nTab ) const;
696 const OUString GetLinkFlt( SCTAB nTab ) const;
697 const OUString GetLinkOpt( SCTAB nTab ) const;
698 SC_DLLPUBLIC const OUString GetLinkTab( SCTAB nTab ) const;
699 sal_uLong GetLinkRefreshDelay( SCTAB nTab ) const;
700 void SetLink( SCTAB nTab, sal_uInt8 nMode, const OUString& rDoc,
701 const OUString& rFilter, const OUString& rOptions,
702 const OUString& rTabName, sal_uLong nRefreshDelay );
703 bool HasLink( const OUString& rDoc,
704 const OUString& rFilter, const OUString& rOptions ) const;
705 SC_DLLPUBLIC bool LinkExternalTab( SCTAB& nTab, const OUString& aDocTab,
706 const OUString& aFileName,
707 const OUString& aTabName );
709 bool HasExternalRefManager() const { return pExternalRefMgr.get(); }
710 SC_DLLPUBLIC ScExternalRefManager* GetExternalRefManager() const;
711 bool IsInExternalReferenceMarking() const;
712 void MarkUsedExternalReferences();
713 bool MarkUsedExternalReferences( ScTokenArray& rArr, const ScAddress& rPos );
715 /** Returns the pool containing external formula parsers. Creates the pool
716 on first call. */
717 ScFormulaParserPool& GetFormulaParserPool() const;
719 bool HasAreaLinks() const;
720 void UpdateExternalRefLinks(Window* pWin);
721 void UpdateAreaLinks();
723 // originating DDE links
724 void IncInDdeLinkUpdate() { if ( nInDdeLinkUpdate < 255 ) ++nInDdeLinkUpdate; }
725 void DecInDdeLinkUpdate() { if ( nInDdeLinkUpdate ) --nInDdeLinkUpdate; }
726 bool IsInDdeLinkUpdate() const { return nInDdeLinkUpdate != 0; }
728 SC_DLLPUBLIC void CopyDdeLinks( ScDocument* pDestDoc ) const;
730 /** Tries to find a DDE link with the specified connection data.
731 @param rnDdePos (out-param) Returns the index of the DDE link (does not include other links from link manager).
732 @return true = DDE link found, rnDdePos valid. */
733 SC_DLLPUBLIC bool FindDdeLink( const OUString& rAppl, const OUString& rTopic,
734 const OUString& rItem, sal_uInt8 nMode, size_t& rnDdePos );
736 /** Returns the connection data of the specified DDE link.
737 @param nDdePos Index of the DDE link (does not include other links from link manager).
738 @param rAppl (out-param) The application name.
739 @param rTopic (out-param) The DDE topic.
740 @param rItem (out-param) The DDE item.
741 @return true = DDE link found, out-parameters valid. */
742 bool GetDdeLinkData( size_t nDdePos, OUString& rAppl, OUString& rTopic, OUString& rItem ) const;
743 /** Returns the link mode of the specified DDE link.
744 @param nDdePos Index of the DDE link (does not include other links from link manager).
745 @param rnMode (out-param) The link mode of the specified DDE link.
746 @return true = DDE link found, rnMode valid. */
747 bool GetDdeLinkMode( size_t nDdePos, sal_uInt8& rnMode ) const;
748 /** Returns the result matrix of the specified DDE link.
749 @param nDdePos Index of the DDE link (does not include other links from link manager).
750 @return The result matrix, if the DDE link has been found, 0 otherwise. */
751 SC_DLLPUBLIC const ScMatrix* GetDdeLinkResultMatrix( size_t nDdePos ) const;
753 /** Tries to find a DDE link or creates a new, if not extant.
754 @param pResults If not 0, sets the matrix as as DDE link result matrix (also for existing links).
755 @return true = DDE link found; false = Unpredictable error occurred, no DDE link created. */
756 SC_DLLPUBLIC bool CreateDdeLink( const OUString& rAppl, const OUString& rTopic, const OUString& rItem, sal_uInt8 nMode, ScMatrixRef pResults );
757 /** Sets a result matrix for the specified DDE link.
758 @param nDdePos Index of the DDE link (does not include other links from link manager).
759 @param pResults The array containing all results of the DDE link (intrusive-ref-counted, do not delete).
760 @return true = DDE link found and matrix set. */
761 bool SetDdeLinkResultMatrix( size_t nDdePos, ScMatrixRef pResults );
764 SfxBindings* GetViewBindings();
765 SfxObjectShell* GetDocumentShell() const { return pShell; }
766 SC_DLLPUBLIC ScDrawLayer* GetDrawLayer();
767 SfxBroadcaster* GetDrawBroadcaster(); // to avoid header
768 void BeginDrawUndo();
770 void BeginUnoRefUndo();
771 bool HasUnoRefUndo() const { return ( pUnoRefUndoList != NULL ); }
772 ScUnoRefList* EndUnoRefUndo(); // must be deleted by caller!
773 sal_Int64 GetNewUnoId();
774 void AddUnoRefChange( sal_Int64 nId, const ScRangeList& rOldRanges );
776 bool IsChart( const SdrObject* pObject );
778 SC_DLLPUBLIC void UpdateAllCharts();
779 void UpdateChartRef( UpdateRefMode eUpdateRefMode,
780 SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
781 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
782 SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
783 //! only assigns the new RangeList, no ChartListener or the like
784 void SetChartRangeList( const OUString& rChartName,
785 const ScRangeListRef& rNewRangeListRef );
787 void StartAnimations( SCTAB nTab, Window* pWin );
789 bool HasBackgroundDraw( SCTAB nTab, const Rectangle& rMMRect ) const;
790 bool HasAnyDraw( SCTAB nTab, const Rectangle& rMMRect ) const;
792 const ScSheetEvents* GetSheetEvents( SCTAB nTab ) const;
793 void SetSheetEvents( SCTAB nTab, const ScSheetEvents* pNew );
794 bool HasSheetEventScript( SCTAB nTab, sal_Int32 nEvent, bool bWithVbaEvents = false ) const;
795 bool HasAnySheetEventScript( sal_Int32 nEvent, bool bWithVbaEvents = false ) const; // on any sheet
797 bool HasAnyCalcNotification() const;
798 bool HasCalcNotification( SCTAB nTab ) const;
799 void SetCalcNotification( SCTAB nTab );
800 void ResetCalcNotifications();
802 SC_DLLPUBLIC ScOutlineTable* GetOutlineTable( SCTAB nTab, bool bCreate = false );
803 bool SetOutlineTable( SCTAB nTab, const ScOutlineTable* pNewOutline );
805 void DoAutoOutline( SCCOL nStartCol, SCROW nStartRow,
806 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab );
808 bool DoSubTotals( SCTAB nTab, ScSubTotalParam& rParam );
809 void RemoveSubTotals( SCTAB nTab, ScSubTotalParam& rParam );
810 bool TestRemoveSubTotals( SCTAB nTab, const ScSubTotalParam& rParam );
811 bool HasSubTotalCells( const ScRange& rRange );
813 SC_DLLPUBLIC void EnsureTable( SCTAB nTab );
815 // return TRUE = number format is set
816 SC_DLLPUBLIC bool SetString(
817 SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& rString,
818 ScSetStringParam* pParam = NULL );
819 SC_DLLPUBLIC bool SetString( const ScAddress& rPos, const OUString& rString, ScSetStringParam* pParam = NULL );
822 * This method manages the lifecycle of the passed edit text object. When
823 * the text is successfully inserted, the cell takes over the ownership of
824 * the text object. If not, the text object gets deleted.
826 * <p>The caller must ensure that the passed edit text object <i>uses the
827 * SfxItemPool instance returned from ScDocument::GetEditPool()</i>.
828 * This is very important.</p>
830 SC_DLLPUBLIC void SetEditText( const ScAddress& rPos, EditTextObject* pEditText );
832 void SetEditText( const ScAddress& rPos, const EditTextObject& rEditText, const SfxItemPool* pEditPool );
834 SC_DLLPUBLIC void SetEditText( const ScAddress& rPos, const OUString& rStr );
836 SC_DLLPUBLIC SCROW GetFirstEditTextRow( const ScRange& rRange ) const;
839 * Call this if you are not sure whether to put this as an edit text or a
840 * simple text.
842 SC_DLLPUBLIC void SetTextCell( const ScAddress& rPos, const OUString& rStr );
844 void SetEmptyCell( const ScAddress& rPos );
846 SC_DLLPUBLIC void SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rVal );
847 SC_DLLPUBLIC void SetValue( const ScAddress& rPos, double fVal );
849 void SetValues( const ScAddress& rPos, const std::vector<double>& rVals );
851 void SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const sal_uInt16 nError);
853 SC_DLLPUBLIC void SetFormula(
854 const ScAddress& rPos, const ScTokenArray& rArray,
855 formula::FormulaGrammar::Grammar eGram = formula::FormulaGrammar::GRAM_DEFAULT );
857 SC_DLLPUBLIC void SetFormula(
858 const ScAddress& rPos, const OUString& rFormula,
859 formula::FormulaGrammar::Grammar eGram = formula::FormulaGrammar::GRAM_DEFAULT );
862 * Set formula cell, and transfer its ownership to the document. This call
863 * attempts to group the passed formula cell with the adjacent cells or
864 * cell groups if appropriate.
866 * @return pCell if it was successfully inserted, NULL otherwise. pCell
867 * is deleted automatically on failure to insert.
869 SC_DLLPUBLIC ScFormulaCell* SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell );
871 bool SetFormulaCells( const ScAddress& rPos, std::vector<ScFormulaCell*>& rCells );
873 SC_DLLPUBLIC void InsertMatrixFormula(SCCOL nCol1, SCROW nRow1,
874 SCCOL nCol2, SCROW nRow2,
875 const ScMarkData& rMark,
876 const OUString& rFormula,
877 const ScTokenArray* p = NULL,
878 const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT,
879 bool bDirtyFlag=true );
880 SC_DLLPUBLIC void InsertTableOp(const ScTabOpParam& rParam, // multi-operation
881 SCCOL nCol1, SCROW nRow1,
882 SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark);
884 SC_DLLPUBLIC OUString GetString( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
885 SC_DLLPUBLIC OUString GetString( const ScAddress& rPos ) const;
888 * Return a pointer to the double value stored in value cell.
890 * @param rPos cell position
892 * @return pointer to the double value stored in a numeric cell, or NULL
893 * if the cell at specified position is not a numeric cell.
895 double* GetValueCell( const ScAddress& rPos );
897 SC_DLLPUBLIC svl::SharedStringPool& GetSharedStringPool();
898 const svl::SharedStringPool& GetSharedStringPool() const;
900 svl::SharedString GetSharedString( const ScAddress& rPos ) const;
902 sc::FormulaGroupContext& GetFormulaGroupContext();
904 SC_DLLPUBLIC void GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, OUString& rString );
905 sal_uInt16 GetStringForFormula( const ScAddress& rPos, OUString& rString );
906 SC_DLLPUBLIC double GetValue( const ScAddress& rPos ) const;
907 SC_DLLPUBLIC double GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
908 SC_DLLPUBLIC void GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, double& rValue ) const;
909 SC_DLLPUBLIC const EditTextObject* GetEditText( const ScAddress& rPos ) const;
910 void RemoveEditTextCharAttribs( const ScAddress& rPos, const ScPatternAttr& rAttr );
911 SC_DLLPUBLIC double RoundValueAsShown( double fVal, sal_uInt32 nFormat ) const;
912 SC_DLLPUBLIC void GetNumberFormat( SCCOL nCol, SCROW nRow, SCTAB nTab,
913 sal_uInt32& rFormat ) const;
914 sal_uInt32 GetNumberFormat( const ScRange& rRange ) const;
915 SC_DLLPUBLIC sal_uInt32 GetNumberFormat( const ScAddress& ) const;
916 void SetNumberFormat( const ScAddress& rPos, sal_uInt32 nNumberFormat );
918 void GetNumberFormatInfo( short& nType, sal_uLong& nIndex, const ScAddress& rPos ) const;
919 SC_DLLPUBLIC const ScFormulaCell* GetFormulaCell( const ScAddress& rPos ) const;
920 SC_DLLPUBLIC ScFormulaCell* GetFormulaCell( const ScAddress& rPos );
921 SC_DLLPUBLIC void GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, OUString& rFormula ) const;
922 SC_DLLPUBLIC void GetCellType( SCCOL nCol, SCROW nRow, SCTAB nTab, CellType& rCellType ) const;
923 SC_DLLPUBLIC CellType GetCellType( const ScAddress& rPos ) const;
925 SC_DLLPUBLIC bool HasData( SCCOL nCol, SCROW nRow, SCTAB nTab );
926 SC_DLLPUBLIC bool HasStringData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
927 SC_DLLPUBLIC bool HasValueData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
928 SC_DLLPUBLIC bool HasValueData( const ScAddress& rPos ) const;
929 bool HasStringCells( const ScRange& rRange ) const;
931 /** Returns true, if there is any data to create a selection list for rPos. */
932 bool HasSelectionData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
934 /** Notes **/
935 SC_DLLPUBLIC ScPostIt* GetNote(const ScAddress& rPos);
936 SC_DLLPUBLIC ScPostIt* GetNote(SCCOL nCol, SCROW nRow, SCTAB nTab);
937 void SetNote(const ScAddress& rPos, ScPostIt* pNote);
938 void SetNote(SCCOL nCol, SCROW nRow, SCTAB nTab, ScPostIt* pNote);
939 SC_DLLPUBLIC bool HasNote(const ScAddress& rPos) const;
940 bool HasNote(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
941 SC_DLLPUBLIC bool HasColNotes(SCCOL nCol, SCTAB nTab) const;
942 SC_DLLPUBLIC bool HasTabNotes(SCTAB nTab) const;
943 bool HasNotes() const;
944 SC_DLLPUBLIC ScPostIt* ReleaseNote(const ScAddress& rPos);
945 SC_DLLPUBLIC ScPostIt* GetOrCreateNote(const ScAddress& rPos);
946 SC_DLLPUBLIC ScPostIt* CreateNote(const ScAddress& rPos);
947 size_t GetNoteCount( SCTAB nTab, SCCOL nCol ) const;
950 * Ensure that all note objects have an associated sdr object. The export
951 * code uses sdr objects to export note data.
953 void CreateAllNoteCaptions();
954 void ForgetNoteCaptions( const ScRangeList& rRanges );
956 ScAddress GetNotePosition( size_t nIndex ) const;
957 SCROW GetNotePosition( SCTAB nTab, SCCOL nCol, size_t nIndex ) const;
959 SC_DLLPUBLIC void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
960 void GetNotesInRange( const ScRangeList& rRange, std::vector<sc::NoteEntry>& rNotes ) const;
961 bool ContainsNotesInRange( const ScRangeList& rRange ) const;
963 SC_DLLPUBLIC void SetDrawPageSize(SCTAB nTab);
965 bool IsMerged( const ScAddress& rPos ) const;
967 bool ExtendMergeSel( SCCOL nStartCol, SCROW nStartRow,
968 SCCOL& rEndCol, SCROW& rEndRow, const ScMarkData& rMark,
969 bool bRefresh = false );
970 SC_DLLPUBLIC bool ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
971 SCCOL& rEndCol, SCROW& rEndRow, SCTAB nTab,
972 bool bRefresh = false );
973 bool ExtendMerge( ScRange& rRange, bool bRefresh = false );
974 bool ExtendTotalMerge( ScRange& rRange ) const;
975 SC_DLLPUBLIC bool ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow,
976 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ) const;
977 SC_DLLPUBLIC bool ExtendOverlapped( ScRange& rRange ) const;
979 bool RefreshAutoFilter( SCCOL nStartCol, SCROW nStartRow,
980 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab );
982 SC_DLLPUBLIC void DoMergeContents( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
983 SCCOL nEndCol, SCROW nEndRow );
984 // without checking:
985 SC_DLLPUBLIC void DoMerge( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
986 SCCOL nEndCol, SCROW nEndRow, bool bDeleteCaptions = true );
987 void RemoveMerge( SCCOL nCol, SCROW nRow, SCTAB nTab );
989 bool IsBlockEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
990 SCCOL nEndCol, SCROW nEndRow, bool bIgnoreNotes = false ) const;
991 bool IsPrintEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
992 SCCOL nEndCol, SCROW nEndRow,
993 bool bLeftIsEmpty = false,
994 ScRange* pLastRange = NULL,
995 Rectangle* pLastMM = NULL ) const;
997 void SkipOverlapped( SCCOL& rCol, SCROW& rRow, SCTAB nTab ) const;
998 bool IsHorOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
999 bool IsVerOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1001 SC_DLLPUBLIC bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
1002 SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt16 nMask ) const;
1003 SC_DLLPUBLIC bool HasAttrib( const ScRange& rRange, sal_uInt16 nMask ) const;
1005 SC_DLLPUBLIC void GetBorderLines( SCCOL nCol, SCROW nRow, SCTAB nTab,
1006 const ::editeng::SvxBorderLine** ppLeft,
1007 const ::editeng::SvxBorderLine** ppTop,
1008 const ::editeng::SvxBorderLine** ppRight,
1009 const ::editeng::SvxBorderLine** ppBottom ) const;
1011 void ResetChanged( const ScRange& rRange );
1013 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
1014 void SetDirty( const ScRange&, bool bIncludeEmptyCells = false );
1015 void SetTableOpDirty( const ScRange& ); // for Interpreter TableOp
1016 void InterpretDirtyCells( const ScRangeList& rRanges );
1017 SC_DLLPUBLIC void CalcAll();
1018 SC_DLLPUBLIC void CalcAfterLoad();
1019 void CompileAll();
1020 void CompileXML();
1023 * Re-compile formula cells with error.
1025 * @param nErrCode specified error code to match. Only those cells with
1026 * this error code will be re-compiled. If this value is
1027 * 0, cells with any error values will be re-compiled.
1029 * @return true if at least one cell is re-compiled, false if no cells are
1030 * re-compiled.
1032 bool CompileErrorCells(sal_uInt16 nErrCode);
1034 ScAutoNameCache* GetAutoNameCache() { return pAutoNameCache; }
1035 void SetPreviewFont( SfxItemSet* pFontSet );
1036 SfxItemSet* GetPreviewFont() { return pPreviewFont; }
1037 SfxItemSet* GetPreviewFont( SCCOL nCol, SCROW nRow, SCTAB nTab );
1038 const ScMarkData GetPreviewSelection();
1039 void SetPreviewSelection( ScMarkData& rSel );
1040 ScStyleSheet* GetPreviewCellStyle() { return pPreviewCellStyle; }
1041 ScStyleSheet* GetPreviewCellStyle( SCCOL nCol, SCROW nRow, SCTAB nTab );
1042 void SetPreviewCellStyle( ScStyleSheet* pStyle ) { pPreviewCellStyle = pStyle; }
1043 SC_DLLPUBLIC void SetAutoNameCache( ScAutoNameCache* pCache );
1045 /** Creates a ScLookupCache cache for the range if it
1046 doesn't already exist. */
1047 ScLookupCache & GetLookupCache( const ScRange & rRange );
1048 /** Only ScLookupCache ctor uses AddLookupCache(), do not
1049 use elsewhere! */
1050 void AddLookupCache( ScLookupCache & rCache );
1051 /** Only ScLookupCache dtor uses RemoveLookupCache(), do
1052 not use elsewhere! */
1053 void RemoveLookupCache( ScLookupCache & rCache );
1054 /** Zap all caches. */
1055 void ClearLookupCaches();
1057 // calculate automatically
1058 void SetAutoCalc( bool bNewAutoCalc );
1059 bool GetAutoCalc() const { return bAutoCalc; }
1060 // calculate automatically in/from/for ScDocShell disabled
1061 void SetAutoCalcShellDisabled( bool bNew ) { bAutoCalcShellDisabled = bNew; }
1062 bool IsAutoCalcShellDisabled() const { return bAutoCalcShellDisabled; }
1063 // ForcedFormulas are to be calculated
1064 void SetForcedFormulaPending( bool bNew ) { bForcedFormulaPending = bNew; }
1065 bool IsForcedFormulaPending() const { return bForcedFormulaPending; }
1066 // if CalcFormulaTree() is currently running
1067 bool IsCalculatingFormulaTree() { return bCalculatingFormulaTree; }
1069 sal_uInt16 GetErrCode( const ScAddress& ) const;
1071 /** Shrink a range to only include data area.
1073 This is not the actually used area within the
1074 selection, but the bounds of the sheet's data area
1075 instead.
1077 @returns TRUE if the area passed intersected the data
1078 area, FALSE if not, in which case the values
1079 obtained may be out of bounds, not in order or
1080 unmodified. TRUE does not mean that there
1081 actually is any data within the selection.
1083 bool ShrinkToDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ) const;
1085 /** Shrink a range to only include used data area.
1087 @param o_bShrunk
1088 Out parameter, true if area was shrunk, false if not.
1090 @returns true if there is any data, false if not.
1092 bool ShrinkToUsedDataArea( bool& o_bShrunk,
1093 SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
1094 SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
1097 * Return the last non-empty row position in given columns that's no
1098 * greater than the initial last row position, or 0 if the columns are
1099 * empty. A negative value is returned if the given sheet or column
1100 * positions are invalid.
1102 * <p>It starts from the specified last row position, and finds the first
1103 * non-empty row position in the upward direction if the start row
1104 * position is empty.</p>
1106 SCROW GetLastDataRow( SCTAB nTab, SCCOL nCol1, SCCOL nCol2, SCROW nLastRow ) const;
1108 SC_DLLPUBLIC void GetDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
1109 SCCOL& rEndCol, SCROW& rEndRow, bool bIncludeOld, bool bOnlyDown ) const;
1110 SC_DLLPUBLIC bool GetCellArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const;
1111 SC_DLLPUBLIC bool GetTableArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const;
1112 SC_DLLPUBLIC bool GetPrintArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow,
1113 bool bNotes = true ) const;
1114 SC_DLLPUBLIC bool GetPrintAreaHor( SCTAB nTab, SCROW nStartRow, SCROW nEndRow,
1115 SCCOL& rEndCol, bool bNotes = true ) const;
1116 SC_DLLPUBLIC bool GetPrintAreaVer( SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol,
1117 SCROW& rEndRow, bool bNotes = true ) const;
1118 void InvalidateTableArea();
1121 SC_DLLPUBLIC bool GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow ) const;
1124 * Find the maximum column position that contains printable data for the
1125 * specified row range. The final column position must be equal or less
1126 * than the initial value of rEndCol.
1128 void ExtendPrintArea( OutputDevice* pDev, SCTAB nTab,
1129 SCCOL nStartCol, SCROW nStartRow,
1130 SCCOL& rEndCol, SCROW nEndRow ) const;
1131 SC_DLLPUBLIC SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab,
1132 SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab,
1133 ScDirection eDir );
1135 void FindAreaPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, ScMoveDirection eDirection ) const;
1136 SC_DLLPUBLIC void GetNextPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX, SCsROW nMovY,
1137 bool bMarked, bool bUnprotected, const ScMarkData& rMark ) const;
1139 bool GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, SCTAB nTab,
1140 const ScMarkData& rMark );
1142 void LimitChartArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
1143 SCCOL& rEndCol, SCROW& rEndRow );
1144 void LimitChartIfAll( ScRangeListRef& rRangeList );
1146 bool InsertRow( SCCOL nStartCol, SCTAB nStartTab,
1147 SCCOL nEndCol, SCTAB nEndTab,
1148 SCROW nStartRow, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL,
1149 const ScMarkData* pTabMark = NULL );
1150 SC_DLLPUBLIC bool InsertRow( const ScRange& rRange, ScDocument* pRefUndoDoc = NULL );
1151 void DeleteRow( SCCOL nStartCol, SCTAB nStartTab,
1152 SCCOL nEndCol, SCTAB nEndTab,
1153 SCROW nStartRow, SCSIZE nSize,
1154 ScDocument* pRefUndoDoc = NULL, bool* pUndoOutline = NULL,
1155 const ScMarkData* pTabMark = NULL );
1156 SC_DLLPUBLIC void DeleteRow( const ScRange& rRange,
1157 ScDocument* pRefUndoDoc = NULL, bool* pUndoOutline = NULL );
1158 bool InsertCol( SCROW nStartRow, SCTAB nStartTab,
1159 SCROW nEndRow, SCTAB nEndTab,
1160 SCCOL nStartCol, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL,
1161 const ScMarkData* pTabMark = NULL );
1162 SC_DLLPUBLIC bool InsertCol( const ScRange& rRange, ScDocument* pRefUndoDoc = NULL );
1163 void DeleteCol( SCROW nStartRow, SCTAB nStartTab,
1164 SCROW nEndRow, SCTAB nEndTab,
1165 SCCOL nStartCol, SCSIZE nSize,
1166 ScDocument* pRefUndoDoc = NULL, bool* pUndoOutline = NULL,
1167 const ScMarkData* pTabMark = NULL );
1168 void DeleteCol( const ScRange& rRange,
1169 ScDocument* pRefUndoDoc = NULL, bool* pUndoOutline = NULL );
1171 bool CanInsertRow( const ScRange& rRange ) const;
1172 bool CanInsertCol( const ScRange& rRange ) const;
1174 void FitBlock( const ScRange& rOld, const ScRange& rNew, bool bClear = true );
1175 bool CanFitBlock( const ScRange& rOld, const ScRange& rNew );
1177 bool IsClipOrUndo() const { return bIsClip || bIsUndo; }
1178 bool IsUndo() const { return bIsUndo; }
1179 bool IsClipboard() const { return bIsClip; }
1180 bool IsUndoEnabled() const { return mbUndoEnabled; }
1181 SC_DLLPUBLIC void EnableUndo( bool bVal );
1183 bool IsAdjustHeightEnabled() const { return mbAdjustHeightEnabled; }
1184 void EnableAdjustHeight( bool bVal ) { mbAdjustHeightEnabled = bVal; }
1185 bool IsExecuteLinkEnabled() const { return mbExecuteLinkEnabled; }
1186 void EnableExecuteLink( bool bVal ) { mbExecuteLinkEnabled = bVal; }
1187 bool IsChangeReadOnlyEnabled() const { return mbChangeReadOnlyEnabled; }
1188 void EnableChangeReadOnly( bool bVal ) { mbChangeReadOnlyEnabled = bVal; }
1189 SC_DLLPUBLIC bool IsUserInteractionEnabled() const;
1190 SC_DLLPUBLIC void EnableUserInteraction( bool bVal );
1191 SC_DLLPUBLIC sal_Int16 GetNamedRangesLockCount() const { return mnNamedRangesLockCount; }
1192 void SetNamedRangesLockCount( sal_Int16 nCount ) { mnNamedRangesLockCount = nCount; }
1193 SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, const ScMarkData* pMarks );
1194 SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, SCTAB nTab );
1195 void SetCutMode( bool bCut );
1196 bool IsCutMode();
1197 void SetClipArea( const ScRange& rArea, bool bCut = false );
1199 SC_DLLPUBLIC bool IsDocVisible() const { return bIsVisible; }
1200 void SetDocVisible( bool bSet );
1202 bool HasOLEObjectsInArea( const ScRange& rRange, const ScMarkData* pTabMark = NULL );
1204 void DeleteObjectsInArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1205 const ScMarkData& rMark );
1206 void DeleteObjectsInSelection( const ScMarkData& rMark );
1208 void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1209 const ScMarkData& rMark, sal_uInt16 nDelFlag);
1210 SC_DLLPUBLIC void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1211 SCTAB nTab, sal_uInt16 nDelFlag);
1212 void DeleteAreaTab(const ScRange& rRange, sal_uInt16 nDelFlag);
1214 void CopyToClip(const ScClipParam& rClipParam, ScDocument* pClipDoc,
1215 const ScMarkData* pMarks = NULL, bool bAllTabs = false, bool bKeepScenarioFlags = false,
1216 bool bIncludeObjects = false, bool bCloneNoteCaptions = true, bool bUseRangeForVBA = false );
1219 * Copy only raw cell values to another document. Formula cells are
1220 * converted to raw cells. No formatting info are copied.
1222 * @param rSrcRange source range in the source document
1223 * @param nDestTab table in the clip document to copy to.
1224 * @param pDestDoc document to copy to
1226 void CopyStaticToDocument(const ScRange& rSrcRange, SCTAB nDestTab, ScDocument* pDestDoc);
1229 * Copy only cell, nothing but cell to another document.
1231 * @param rSrcPos source cell position
1232 * @param rDestPos destination cell position
1233 * @param rDestDoc destination document
1235 void CopyCellToDocument( const ScAddress& rSrcPos, const ScAddress& rDestPos, ScDocument& rDestDoc );
1237 void CopyTabToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1238 SCTAB nTab, ScDocument* pClipDoc = NULL);
1240 bool InitColumnBlockPosition( sc::ColumnBlockPosition& rBlokPos, SCTAB nTab, SCCOL nCol );
1242 void DeleteBeforeCopyFromClip( sc::CopyFromClipContext& rCxt, const ScMarkData& rMark );
1244 bool CopyOneCellFromClip(
1245 sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
1246 void CopyBlockFromClip(
1247 sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1248 const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy );
1249 void CopyNonFilteredFromClip(
1250 sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1251 const ScMarkData& rMark, SCsCOL nDx, SCROW & rClipStartRow );
1253 void StartListeningFromClip( SCCOL nCol1, SCROW nRow1,
1254 SCCOL nCol2, SCROW nRow2,
1255 const ScMarkData& rMark, sal_uInt16 nInsFlag );
1256 void BroadcastFromClip( SCCOL nCol1, SCROW nRow1,
1257 SCCOL nCol2, SCROW nRow2,
1258 const ScMarkData& rMark, sal_uInt16 nInsFlag );
1259 /** If pDestRanges is given it overrides rDestRange, rDestRange in this
1260 case is the overall encompassing range. */
1261 void CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMark,
1262 sal_uInt16 nInsFlag,
1263 ScDocument* pRefUndoDoc = NULL,
1264 ScDocument* pClipDoc = NULL,
1265 bool bResetCut = true,
1266 bool bAsLink = false,
1267 bool bIncludeFiltered = true,
1268 bool bSkipAttrForEmpty = false,
1269 const ScRangeList * pDestRanges = NULL );
1271 void CopyMultiRangeFromClip(const ScAddress& rDestPos, const ScMarkData& rMark,
1272 sal_uInt16 nInsFlag, ScDocument* pClipDoc,
1273 bool bResetCut = true, bool bAsLink = false,
1274 bool bIncludeFiltered = true,
1275 bool bSkipAttrForEmpty = false);
1277 void GetClipArea(SCCOL& nClipX, SCROW& nClipY, bool bIncludeFiltered);
1278 void GetClipStart(SCCOL& nClipX, SCROW& nClipY);
1280 bool HasClipFilteredRows();
1282 bool IsClipboardSource() const;
1284 SC_DLLPUBLIC void TransposeClip( ScDocument* pTransClip, sal_uInt16 nFlags, bool bAsLink );
1286 ScClipParam& GetClipParam();
1287 void SetClipParam(const ScClipParam& rParam);
1289 void MixDocument( const ScRange& rRange, sal_uInt16 nFunction, bool bSkipEmpty,
1290 ScDocument* pSrcDoc );
1292 void FillTab( const ScRange& rSrcArea, const ScMarkData& rMark,
1293 sal_uInt16 nFlags, sal_uInt16 nFunction,
1294 bool bSkipEmpty, bool bAsLink );
1295 void FillTabMarked( SCTAB nSrcTab, const ScMarkData& rMark,
1296 sal_uInt16 nFlags, sal_uInt16 nFunction,
1297 bool bSkipEmpty, bool bAsLink );
1299 void TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nType );
1301 SC_DLLPUBLIC void InitUndo( ScDocument* pSrcDoc, SCTAB nTab1, SCTAB nTab2,
1302 bool bColInfo = false, bool bRowInfo = false );
1303 void AddUndoTab( SCTAB nTab1, SCTAB nTab2,
1304 bool bColInfo = false, bool bRowInfo = false );
1305 SC_DLLPUBLIC void InitUndoSelected( ScDocument* pSrcDoc, const ScMarkData& rTabSelection,
1306 bool bColInfo = false, bool bRowInfo = false );
1308 // don't use anymore:
1309 void CopyToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
1310 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
1311 sal_uInt16 nFlags, bool bMarked, ScDocument* pDestDoc,
1312 const ScMarkData* pMarks = NULL, bool bColRowFlags = true);
1313 void UndoToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
1314 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
1315 sal_uInt16 nFlags, bool bMarked, ScDocument* pDestDoc,
1316 const ScMarkData* pMarks = NULL);
1318 void CopyToDocument(const ScRange& rRange,
1319 sal_uInt16 nFlags, bool bMarked, ScDocument* pDestDoc,
1320 const ScMarkData* pMarks = NULL, bool bColRowFlags = true);
1321 void UndoToDocument(const ScRange& rRange,
1322 sal_uInt16 nFlags, bool bMarked, ScDocument* pDestDoc,
1323 const ScMarkData* pMarks = NULL);
1325 void CopyScenario( SCTAB nSrcTab, SCTAB nDestTab, bool bNewScenario = false );
1326 bool TestCopyScenario( SCTAB nSrcTab, SCTAB nDestTab ) const;
1327 void MarkScenario( SCTAB nSrcTab, SCTAB nDestTab,
1328 ScMarkData& rDestMark, bool bResetMark = true,
1329 sal_uInt16 nNeededBits = 0 ) const;
1330 bool HasScenarioRange( SCTAB nTab, const ScRange& rRange ) const;
1331 SC_DLLPUBLIC const ScRangeList* GetScenarioRanges( SCTAB nTab ) const;
1333 SC_DLLPUBLIC void CopyUpdated( ScDocument* pPosDoc, ScDocument* pDestDoc );
1335 void UpdateReference(
1336 sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = NULL, bool bIncludeDraw = true,
1337 bool bUpdateNoteCaptionPos = true );
1339 SC_DLLPUBLIC void UpdateTranspose( const ScAddress& rDestPos, ScDocument* pClipDoc,
1340 const ScMarkData& rMark, ScDocument* pUndoDoc = NULL );
1342 void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
1344 SC_DLLPUBLIC void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1345 ScProgress* pProgress, const ScMarkData& rMark,
1346 sal_uLong nFillCount, FillDir eFillDir = FILL_TO_BOTTOM,
1347 FillCmd eFillCmd = FILL_LINEAR, FillDateCmd eFillDateCmd = FILL_DAY,
1348 double nStepValue = 1.0, double nMaxValue = 1E307 );
1349 OUString GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY );
1351 bool GetSelectionFunction( ScSubTotalFunc eFunc,
1352 const ScAddress& rCursor, const ScMarkData& rMark,
1353 double& rResult );
1355 SC_DLLPUBLIC const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich ) const;
1356 SC_DLLPUBLIC const SfxPoolItem* GetAttr( const ScAddress& rPos, sal_uInt16 nWhich ) const;
1357 SC_DLLPUBLIC const ScPatternAttr* GetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1358 SC_DLLPUBLIC const ScPatternAttr* GetPattern( const ScAddress& rPos ) const;
1359 SC_DLLPUBLIC const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow, SCTAB nTab ) const;
1360 const ScPatternAttr* GetSelectionPattern( const ScMarkData& rMark, bool bDeep = true );
1361 ScPatternAttr* CreateSelectionPattern( const ScMarkData& rMark, bool bDeep = true );
1362 SC_DLLPUBLIC void AddCondFormatData( const ScRangeList& rRange, SCTAB nTab, sal_uInt32 nIndex );
1363 void RemoveCondFormatData( const ScRangeList& rRange, SCTAB nTab, sal_uInt32 nIndex );
1365 SC_DLLPUBLIC ScConditionalFormat* GetCondFormat( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1366 SC_DLLPUBLIC const SfxItemSet* GetCondResult( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1367 const SfxItemSet* GetCondResult(
1368 ScRefCellValue& rCell, const ScAddress& rPos, const ScConditionalFormatList& rList,
1369 const std::vector<sal_uInt32>& rIndex ) const;
1370 const SfxPoolItem* GetEffItem( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich ) const;
1372 SC_DLLPUBLIC const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator >& GetBreakIterator();
1373 bool HasStringWeakCharacters( const OUString& rString );
1374 SC_DLLPUBLIC sal_uInt8 GetStringScriptType( const OUString& rString );
1375 SC_DLLPUBLIC sal_uInt8 GetCellScriptType( const ScAddress& rPos, sal_uLong nNumberFormat );
1376 SC_DLLPUBLIC sal_uInt8 GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab );
1377 sal_uInt8 GetRangeScriptType(
1378 sc::ColumnBlockPosition& rBlockPos, const ScAddress& rPos, SCROW nLength );
1379 sal_uInt8 GetRangeScriptType( const ScRangeList& rRanges );
1381 bool HasDetectiveOperations() const;
1382 void AddDetectiveOperation( const ScDetOpData& rData );
1383 void ClearDetectiveOperations();
1384 ScDetOpList* GetDetOpList() const { return pDetOpList; }
1385 void SetDetOpList(ScDetOpList* pNew);
1387 bool HasDetectiveObjects(SCTAB nTab) const;
1389 void GetSelectionFrame( const ScMarkData& rMark,
1390 SvxBoxItem& rLineOuter,
1391 SvxBoxInfoItem& rLineInner );
1392 void ApplySelectionFrame( const ScMarkData& rMark,
1393 const SvxBoxItem* pLineOuter,
1394 const SvxBoxInfoItem* pLineInner );
1395 void ApplyFrameAreaTab( const ScRange& rRange,
1396 const SvxBoxItem* pLineOuter,
1397 const SvxBoxInfoItem* pLineInner );
1399 void ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
1400 void ChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark );
1402 SC_DLLPUBLIC sal_uLong AddCondFormat( ScConditionalFormat* pNew, SCTAB nTab );
1403 void DeleteConditionalFormat( sal_uLong nIndex, SCTAB nTab );
1404 void ConditionalChanged( sal_uLong nKey, SCTAB nTab );
1406 void SetCondFormList( ScConditionalFormatList* pList, SCTAB nTab );
1408 SC_DLLPUBLIC sal_uLong AddValidationEntry( const ScValidationData& rNew );
1410 SC_DLLPUBLIC const ScValidationData* GetValidationEntry( sal_uLong nIndex ) const;
1412 SC_DLLPUBLIC ScConditionalFormatList* GetCondFormList( SCTAB nTab ) const;
1414 const ScValidationDataList* GetValidationList() const;
1415 ScValidationDataList* GetValidationList();
1417 SC_DLLPUBLIC void ApplyAttr( SCCOL nCol, SCROW nRow, SCTAB nTab,
1418 const SfxPoolItem& rAttr );
1419 SC_DLLPUBLIC void ApplyPattern( SCCOL nCol, SCROW nRow, SCTAB nTab,
1420 const ScPatternAttr& rAttr );
1421 SC_DLLPUBLIC void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow,
1422 SCCOL nEndCol, SCROW nEndRow,
1423 const ScMarkData& rMark, const ScPatternAttr& rAttr,
1424 ScEditDataArray* pDataArray = NULL );
1425 SC_DLLPUBLIC void ApplyPatternAreaTab( SCCOL nStartCol, SCROW nStartRow,
1426 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab,
1427 const ScPatternAttr& rAttr );
1429 SC_DLLPUBLIC bool SetAttrEntries(SCCOL nCol, SCTAB nTab, ScAttrEntry* pData, SCSIZE nSize);
1431 SC_DLLPUBLIC void ApplyPatternIfNumberformatIncompatible(
1432 const ScRange& rRange, const ScMarkData& rMark,
1433 const ScPatternAttr& rPattern, short nNewType );
1435 void ApplyStyle( SCCOL nCol, SCROW nRow, SCTAB nTab,
1436 const ScStyleSheet& rStyle);
1437 void ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow,
1438 SCCOL nEndCol, SCROW nEndRow,
1439 const ScMarkData& rMark, const ScStyleSheet& rStyle);
1440 SC_DLLPUBLIC void ApplyStyleAreaTab( SCCOL nStartCol, SCROW nStartRow,
1441 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab,
1442 const ScStyleSheet& rStyle);
1444 SC_DLLPUBLIC void ApplySelectionStyle( const ScStyleSheet& rStyle, const ScMarkData& rMark );
1445 void ApplySelectionLineStyle( const ScMarkData& rMark,
1446 const ::editeng::SvxBorderLine* pLine, bool bColorOnly );
1448 const ScStyleSheet* GetStyle( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1449 const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark ) const;
1451 void StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool bRemoved,
1452 OutputDevice* pDev,
1453 double nPPTX, double nPPTY,
1454 const Fraction& rZoomX, const Fraction& rZoomY );
1456 bool IsStyleSheetUsed( const ScStyleSheet& rStyle, bool bGatherAllStyles ) const;
1458 SC_DLLPUBLIC bool ApplyFlagsTab( SCCOL nStartCol, SCROW nStartRow,
1459 SCCOL nEndCol, SCROW nEndRow,
1460 SCTAB nTab, sal_Int16 nFlags );
1461 SC_DLLPUBLIC bool RemoveFlagsTab( SCCOL nStartCol, SCROW nStartRow,
1462 SCCOL nEndCol, SCROW nEndRow,
1463 SCTAB nTab, sal_Int16 nFlags );
1465 SC_DLLPUBLIC void SetPattern( const ScAddress&, const ScPatternAttr& rAttr,
1466 bool bPutToPool = false );
1467 SC_DLLPUBLIC void SetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatternAttr& rAttr,
1468 bool bPutToPool = false );
1470 void AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1471 sal_uInt16 nFormatNo, const ScMarkData& rMark );
1472 void GetAutoFormatData( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1473 ScAutoFormatData& rData );
1474 bool SearchAndReplace( const SvxSearchItem& rSearchItem,
1475 SCCOL& rCol, SCROW& rRow, SCTAB& rTab,
1476 const ScMarkData& rMark, ScRangeList& rMatchedRanges,
1477 OUString& rUndoStr, ScDocument* pUndoDoc = NULL );
1479 // determine Col/Row of subsequent calls
1480 // (e.g. not found from the beginning, or subsequent tables)
1481 // meaning of explanation in "()" was already unclear in German
1482 static void GetSearchAndReplaceStart( const SvxSearchItem& rSearchItem,
1483 SCCOL& rCol, SCROW& rRow );
1485 bool Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
1486 SCCOL nVCol, SCROW nVRow, SCTAB nVTab,
1487 const OUString& sValStr, double& nX);
1489 SC_DLLPUBLIC void ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark,
1490 ScEditDataArray* pDataArray = NULL );
1491 void DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark, bool bBroadcast = true );
1492 void DeleteSelectionTab( SCTAB nTab, sal_uInt16 nDelFlag, const ScMarkData& rMark, bool bBroadcast = true );
1494 SC_DLLPUBLIC void SetColWidth( SCCOL nCol, SCTAB nTab, sal_uInt16 nNewWidth );
1495 SC_DLLPUBLIC void SetColWidthOnly( SCCOL nCol, SCTAB nTab, sal_uInt16 nNewWidth );
1496 SC_DLLPUBLIC void SetRowHeight( SCROW nRow, SCTAB nTab, sal_uInt16 nNewHeight );
1497 SC_DLLPUBLIC void SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, SCTAB nTab,
1498 sal_uInt16 nNewHeight );
1500 SC_DLLPUBLIC void SetRowHeightOnly( SCROW nStartRow, SCROW nEndRow, SCTAB nTab,
1501 sal_uInt16 nNewHeight );
1502 SC_DLLPUBLIC void SetManualHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bManual );
1504 SC_DLLPUBLIC sal_uInt16 GetColWidth( SCCOL nCol, SCTAB nTab, bool bHiddenAsZero = true ) const;
1505 SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCTAB nTab, bool bHiddenAsZero = true ) const;
1506 SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCTAB nTab, SCROW* pStartRow, SCROW* pEndRow, bool bHiddenAsZero = true ) const;
1507 SC_DLLPUBLIC sal_uLong GetRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero = true ) const;
1508 SCROW GetRowForHeight( SCTAB nTab, sal_uLong nHeight ) const;
1509 sal_uLong GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, double fScale ) const;
1510 SC_DLLPUBLIC sal_uLong GetColOffset( SCCOL nCol, SCTAB nTab, bool bHiddenAsZero = true ) const;
1511 SC_DLLPUBLIC sal_uLong GetRowOffset( SCROW nRow, SCTAB nTab, bool bHiddenAsZero = true ) const;
1513 SC_DLLPUBLIC sal_uInt16 GetOriginalWidth( SCCOL nCol, SCTAB nTab ) const;
1514 SC_DLLPUBLIC sal_uInt16 GetOriginalHeight( SCROW nRow, SCTAB nTab ) const;
1516 sal_uInt16 GetCommonWidth( SCCOL nEndCol, SCTAB nTab ) const;
1518 SCROW GetHiddenRowCount( SCROW nRow, SCTAB nTab ) const;
1520 sal_uInt16 GetOptimalColWidth( SCCOL nCol, SCTAB nTab, OutputDevice* pDev,
1521 double nPPTX, double nPPTY,
1522 const Fraction& rZoomX, const Fraction& rZoomY,
1523 bool bFormula,
1524 const ScMarkData* pMarkData = NULL,
1525 const ScColWidthParam* pParam = NULL );
1527 SC_DLLPUBLIC bool SetOptimalHeight(
1528 sc::RowHeightContext& rCxt, SCROW nStartRow, SCROW nEndRow, SCTAB nTab );
1530 void UpdateAllRowHeights( sc::RowHeightContext& rCxt, const ScMarkData* pTabMark = NULL );
1532 long GetNeededSize( SCCOL nCol, SCROW nRow, SCTAB nTab,
1533 OutputDevice* pDev,
1534 double nPPTX, double nPPTY,
1535 const Fraction& rZoomX, const Fraction& rZoomY,
1536 bool bWidth, bool bTotalSize = false );
1538 SC_DLLPUBLIC void ShowCol(SCCOL nCol, SCTAB nTab, bool bShow);
1539 SC_DLLPUBLIC void ShowRow(SCROW nRow, SCTAB nTab, bool bShow);
1540 SC_DLLPUBLIC void ShowRows(SCROW nRow1, SCROW nRow2, SCTAB nTab, bool bShow);
1541 SC_DLLPUBLIC void SetRowFlags( SCROW nRow, SCTAB nTab, sal_uInt8 nNewFlags );
1542 SC_DLLPUBLIC void SetRowFlags( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, sal_uInt8 nNewFlags );
1544 SC_DLLPUBLIC sal_uInt8 GetColFlags( SCCOL nCol, SCTAB nTab ) const;
1545 SC_DLLPUBLIC sal_uInt8 GetRowFlags( SCROW nRow, SCTAB nTab ) const;
1547 SC_DLLPUBLIC void GetAllRowBreaks(::std::set<SCROW>& rBreaks, SCTAB nTab, bool bPage, bool bManual) const;
1548 SC_DLLPUBLIC void GetAllColBreaks(::std::set<SCCOL>& rBreaks, SCTAB nTab, bool bPage, bool bManual) const;
1549 SC_DLLPUBLIC ScBreakType HasRowBreak(SCROW nRow, SCTAB nTab) const;
1550 SC_DLLPUBLIC ScBreakType HasColBreak(SCCOL nCol, SCTAB nTab) const;
1551 SC_DLLPUBLIC void SetRowBreak(SCROW nRow, SCTAB nTab, bool bPage, bool bManual);
1552 SC_DLLPUBLIC void SetColBreak(SCCOL nCol, SCTAB nTab, bool bPage, bool bManual);
1553 void RemoveRowBreak(SCROW nRow, SCTAB nTab, bool bPage, bool bManual);
1554 void RemoveColBreak(SCCOL nCol, SCTAB nTab, bool bPage, bool bManual);
1555 ::com::sun::star::uno::Sequence<
1556 ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData(SCTAB nTab) const;
1558 SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
1559 SC_DLLPUBLIC bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1560 SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
1561 SC_DLLPUBLIC void SetRowHidden(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bHidden);
1562 SC_DLLPUBLIC void SetColHidden(SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, bool bHidden);
1563 SC_DLLPUBLIC SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1564 SC_DLLPUBLIC SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1565 SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1567 bool RowFiltered(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
1568 bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1569 bool ColFiltered(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
1570 SC_DLLPUBLIC void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bFiltered);
1571 SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1572 SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1573 SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1575 SC_DLLPUBLIC bool IsManualRowHeight(SCROW nRow, SCTAB nTab) const;
1577 bool HasUniformRowHeight( SCTAB nTab, SCROW nRow1, SCROW nRow2 ) const;
1580 * Write all column row flags to table's flag data, because not all column
1581 * row attributes are stored in the flag data members. This is necessary
1582 * for ods export.
1584 void SyncColRowFlags();
1586 /// @return the index of the last row with any set flags (auto-pagebreak is ignored).
1587 SC_DLLPUBLIC SCROW GetLastFlaggedRow( SCTAB nTab ) const;
1589 /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored).
1590 SCCOL GetLastChangedCol( SCTAB nTab ) const;
1591 /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
1592 SCROW GetLastChangedRow( SCTAB nTab ) const;
1594 SCCOL GetNextDifferentChangedCol( SCTAB nTab, SCCOL nStart) const;
1596 // if bCareManualSize is set then the row
1597 // heights are compared only if the manual size flag for
1598 // the row is set. If the bCareManualSize is not set then
1599 // the row heights are always compared.
1600 SCROW GetNextDifferentChangedRow( SCTAB nTab, SCROW nStart, bool bCareManualSize = true) const;
1602 // returns whether to export a Default style for this col or not
1603 // nDefault is setted to one possition in the current row where the Default style is
1604 bool GetColDefault( SCTAB nTab, SCCOL nCol, SCROW nLastRow, SCROW& nDefault);
1606 bool UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, bool bShow );
1607 bool UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bShow );
1609 void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, SCTAB nTab );
1610 void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, SCTAB nTab );
1612 SC_DLLPUBLIC ScPatternAttr* GetDefPattern() const;
1613 SC_DLLPUBLIC ScDocumentPool* GetPool();
1614 SC_DLLPUBLIC ScStyleSheetPool* GetStyleSheetPool() const;
1616 // PageStyle:
1617 SC_DLLPUBLIC const OUString GetPageStyle( SCTAB nTab ) const;
1618 SC_DLLPUBLIC void SetPageStyle( SCTAB nTab, const OUString& rName );
1619 Size GetPageSize( SCTAB nTab ) const;
1620 void SetPageSize( SCTAB nTab, const Size& rSize );
1621 void SetRepeatArea( SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
1622 void InvalidatePageBreaks(SCTAB nTab);
1623 void UpdatePageBreaks( SCTAB nTab, const ScRange* pUserArea = NULL );
1624 void RemoveManualBreaks( SCTAB nTab );
1625 bool HasManualBreaks( SCTAB nTab ) const;
1627 bool IsPageStyleInUse( const OUString& rStrPageStyle, SCTAB* pInTab = NULL );
1628 bool RemovePageStyleInUse( const OUString& rStrPageStyle );
1629 bool RenamePageStyleInUse( const OUString& rOld, const OUString& rNew );
1630 void ModifyStyleSheet( SfxStyleSheetBase& rPageStyle,
1631 const SfxItemSet& rChanges );
1633 void PageStyleModified( SCTAB nTab, const OUString& rNewName );
1635 SC_DLLPUBLIC bool NeedPageResetAfterTab( SCTAB nTab ) const;
1637 // Was stored in PageStyle previously. Now it exists for every table:
1638 SC_DLLPUBLIC bool HasPrintRange();
1639 SC_DLLPUBLIC sal_uInt16 GetPrintRangeCount( SCTAB nTab );
1640 SC_DLLPUBLIC const ScRange* GetPrintRange( SCTAB nTab, sal_uInt16 nPos );
1641 SC_DLLPUBLIC const ScRange* GetRepeatColRange( SCTAB nTab );
1642 SC_DLLPUBLIC const ScRange* GetRepeatRowRange( SCTAB nTab );
1643 /** Returns true, if the specified sheet is always printed. */
1644 bool IsPrintEntireSheet( SCTAB nTab ) const;
1646 /** Removes all print ranges. */
1647 SC_DLLPUBLIC void ClearPrintRanges( SCTAB nTab );
1648 /** Adds a new print ranges. */
1649 SC_DLLPUBLIC void AddPrintRange( SCTAB nTab, const ScRange& rNew );
1650 /** Marks the specified sheet to be printed completely. Deletes old print ranges on the sheet! */
1651 SC_DLLPUBLIC void SetPrintEntireSheet( SCTAB nTab );
1652 SC_DLLPUBLIC void SetRepeatColRange( SCTAB nTab, const ScRange* pNew );
1653 SC_DLLPUBLIC void SetRepeatRowRange( SCTAB nTab, const ScRange* pNew );
1654 ScPrintRangeSaver* CreatePrintRangeSaver() const;
1655 void RestorePrintRanges( const ScPrintRangeSaver& rSaver );
1657 SC_DLLPUBLIC Rectangle GetMMRect( SCCOL nStartCol, SCROW nStartRow,
1658 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero = true ) const;
1659 SC_DLLPUBLIC ScRange GetRange( SCTAB nTab, const Rectangle& rMMRect, bool bHiddenAsZero = true ) const;
1661 void UpdStlShtPtrsFrmNms();
1662 void StylesToNames();
1664 SC_DLLPUBLIC void CopyStdStylesFrom( ScDocument* pSrcDoc );
1666 rtl_TextEncoding GetSrcCharSet() const { return eSrcSet; }
1667 sal_uLong GetSrcVersion() const { return nSrcVer; }
1668 SCROW GetSrcMaxRow() const { return nSrcMaxRow; }
1670 void SetSrcCharSet( rtl_TextEncoding eNew ) { eSrcSet = eNew; }
1671 void UpdateFontCharSet();
1673 void FillInfo(
1674 ScTableInfo& rTabInfo, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1675 SCTAB nTab, double fColScale, double fRowScale, bool bPageMode, bool bFormulaMode,
1676 const ScMarkData* pMarkData = NULL );
1678 SC_DLLPUBLIC SvNumberFormatter* GetFormatTable() const;
1679 SC_DLLPUBLIC SvNumberFormatter* CreateFormatTable() const;
1681 /** Sort a range of data.
1682 @param rSortParam may get adjusted to the actual range used if it did
1683 encompass leading or trailing empty blocks
1685 void Sort(
1686 SCTAB nTab, ScSortParam& rSortParam, bool bKeepQuery, bool bUpdateRefs,
1687 ScProgress* pProgress, sc::ReorderParam* pUndo );
1689 void Reorder( const sc::ReorderParam& rParam, ScProgress* pProgress );
1691 SCSIZE Query( SCTAB nTab, const ScQueryParam& rQueryParam, bool bKeepSub );
1692 SC_DLLPUBLIC bool CreateQueryParam( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1693 SCTAB nTab, ScQueryParam& rQueryParam );
1694 void GetUpperCellString(SCCOL nCol, SCROW nRow, SCTAB nTab, OUString& rStr);
1697 * Get a list of unique strings to use in filtering criteria. The string
1698 * values are sorted, and there are no duplicate values in the list. The
1699 * data range to use to populate the filter entries is inferred from the
1700 * database range that contains the specified cell position.
1702 bool GetFilterEntries(
1703 SCCOL nCol, SCROW nRow, SCTAB nTab, bool bFilter, std::vector<ScTypedStrData>& rStrings, bool& rHasDates);
1705 SC_DLLPUBLIC bool GetFilterEntriesArea(
1706 SCCOL nCol, SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bCaseSens,
1707 std::vector<ScTypedStrData>& rStrings, bool& rHasDates);
1709 bool GetDataEntries(
1710 SCCOL nCol, SCROW nRow, SCTAB nTab, bool bCaseSens,
1711 std::vector<ScTypedStrData>& rStrings, bool bLimit = false );
1712 bool GetFormulaEntries( ScTypedCaseStrSet& rStrings );
1714 bool HasAutoFilter( SCCOL nCol, SCROW nRow, SCTAB nTab );
1716 SC_DLLPUBLIC bool HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1717 SCTAB nTab );
1718 SC_DLLPUBLIC bool HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1719 SCTAB nTab );
1721 SfxPrinter* GetPrinter( bool bCreateIfNotExist = true );
1722 void SetPrinter( SfxPrinter* pNewPrinter );
1723 VirtualDevice* GetVirtualDevice_100th_mm();
1724 SC_DLLPUBLIC OutputDevice* GetRefDevice(); // WYSIWYG: Printer, otherwise VirtualDevice...
1726 bool GetNextSpellingCell(SCCOL& nCol, SCROW& nRow, SCTAB nTab,
1727 bool bInSel, const ScMarkData& rMark) const;
1729 bool ReplaceStyle(const SvxSearchItem& rSearchItem,
1730 SCCOL nCol, SCROW nRow, SCTAB nTab,
1731 ScMarkData& rMark, bool bIsUndo);
1733 void InvalidateTextWidth( const OUString& rStyleName );
1734 void InvalidateTextWidth( SCTAB nTab );
1735 void InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo, bool bNumFormatChanged );
1737 bool IdleCalcTextWidth();
1739 void RepaintRange( const ScRange& rRange );
1740 void RepaintRange( const ScRangeList& rRange );
1742 bool IsIdleEnabled() const { return mbIdleEnabled; }
1743 void EnableIdle(bool bDo) { mbIdleEnabled = bDo; }
1745 bool IsDetectiveDirty() const { return bDetectiveDirty; }
1746 void SetDetectiveDirty(bool bSet) { bDetectiveDirty = bSet; }
1748 sal_uInt8 GetMacroCallMode() const { return nMacroCallMode; }
1749 void SetMacroCallMode(sal_uInt8 nNew) { nMacroCallMode = nNew; }
1751 bool GetHasMacroFunc() const { return bHasMacroFunc; }
1752 void SetHasMacroFunc(bool bSet) { bHasMacroFunc = bSet; }
1754 bool CheckMacroWarn();
1756 void SetRangeOverflowType(sal_uInt32 nType) { nRangeOverflowType = nType; }
1757 bool HasRangeOverflow() const { return nRangeOverflowType != 0; }
1758 SC_DLLPUBLIC sal_uInt32 GetRangeOverflowType() const { return nRangeOverflowType; }
1760 // for broadcasting/listening
1761 void SetInsertingFromOtherDoc( bool bVal ) { bInsertingFromOtherDoc = bVal; }
1762 bool IsInsertingFromOtherDoc() const { return bInsertingFromOtherDoc; }
1763 void SetLoadingMedium( bool bVal );
1764 void SetImportingXML( bool bVal );
1765 bool IsImportingXML() const { return bImportingXML; }
1766 void SetCalcingAfterLoad( bool bVal ) { bCalcingAfterLoad = bVal; }
1767 bool IsCalcingAfterLoad() const { return bCalcingAfterLoad; }
1768 void SetNoListening( bool bVal ) { bNoListening = bVal; }
1769 bool GetNoListening() const { return bNoListening; }
1770 ScBroadcastAreaSlotMachine* GetBASM() const { return pBASM; }
1772 SC_DLLPUBLIC ScChartListenerCollection* GetChartListenerCollection() const;
1773 void SetChartListenerCollection( ScChartListenerCollection*,
1774 bool bSetChartRangeLists = false );
1775 void UpdateChart( const OUString& rName );
1776 void RestoreChartListener( const OUString& rName );
1777 SC_DLLPUBLIC void UpdateChartListenerCollection();
1778 bool IsChartListenerCollectionNeedsUpdate() const
1779 { return bChartListenerCollectionNeedsUpdate; }
1780 void SetChartListenerCollectionNeedsUpdate( bool bFlg )
1781 { bChartListenerCollectionNeedsUpdate = bFlg; }
1782 void AddOLEObjectToCollection(const OUString& rName);
1784 ScChangeViewSettings* GetChangeViewSettings() const { return pChangeViewSettings; }
1785 SC_DLLPUBLIC void SetChangeViewSettings(const ScChangeViewSettings& rNew);
1787 rtl::Reference<SvxForbiddenCharactersTable> GetForbiddenCharacters();
1788 void SetForbiddenCharacters( const rtl::Reference<SvxForbiddenCharactersTable> xNew );
1790 sal_uInt8 GetAsianCompression() const; // CharacterCompressionType values
1791 bool IsValidAsianCompression() const;
1792 void SetAsianCompression(sal_uInt8 nNew);
1794 bool GetAsianKerning() const;
1795 bool IsValidAsianKerning() const;
1796 void SetAsianKerning(bool bNew);
1797 void ApplyAsianEditSettings(ScEditEngineDefaulter& rEngine);
1799 sal_uInt8 GetEditTextDirection(SCTAB nTab) const; // EEHorizontalTextDirection values
1801 SC_DLLPUBLIC ScLkUpdMode GetLinkMode() const { return eLinkMode ;}
1802 void SetLinkMode( ScLkUpdMode nSet ) { eLinkMode = nSet;}
1804 SC_DLLPUBLIC ScMacroManager* GetMacroManager();
1806 void FillMatrix( ScMatrix& rMat, SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
1809 * Set an array of numerical formula results to a group of contiguous
1810 * formula cells.
1812 * @param rTopPos position of the top formula cell of a group.
1813 * @param pResults array of numeric results.
1814 * @param nLen length of numeric results.
1816 void SC_DLLPUBLIC SetFormulaResults( const ScAddress& rTopPos, const double* pResults, size_t nLen );
1818 void SC_DLLPUBLIC SetFormulaResults( const ScAddress& rTopPos, const formula::FormulaTokenRef* pResults, size_t nLen );
1821 * Transfer a series of contiguous cell values from specified position to
1822 * the passed container. The specified segment will become empty after the
1823 * transfer.
1825 void TransferCellValuesTo( const ScAddress& rTopPos, size_t nLen, sc::CellValues& rDest );
1827 void CopyCellValuesFrom( const ScAddress& rTopPos, const sc::CellValues& rSrc );
1829 private:
1830 ScDocument(const ScDocument& r); // disabled with no definition
1832 void FindMaxRotCol( SCTAB nTab, RowInfo* pRowInfo, SCSIZE nArrCount,
1833 SCCOL nX1, SCCOL nX2 ) const;
1835 sal_uInt16 RowDifferences( SCROW nThisRow, SCTAB nThisTab,
1836 ScDocument& rOtherDoc,
1837 SCROW nOtherRow, SCTAB nOtherTab,
1838 SCCOL nMaxCol, SCCOLROW* pOtherCols );
1839 sal_uInt16 ColDifferences( SCCOL nThisCol, SCTAB nThisTab,
1840 ScDocument& rOtherDoc,
1841 SCCOL nOtherCol, SCTAB nOtherTab,
1842 SCROW nMaxRow, SCCOLROW* pOtherRows );
1843 void FindOrder( SCCOLROW* pOtherRows, SCCOLROW nThisEndRow, SCCOLROW nOtherEndRow,
1844 bool bColumns,
1845 ScDocument& rOtherDoc, SCTAB nThisTab, SCTAB nOtherTab,
1846 SCCOLROW nEndCol, SCCOLROW* pTranslate,
1847 ScProgress* pProgress, sal_uLong nProAdd );
1849 DECL_LINK(TrackTimeHdl, void *);
1851 static ScRecursionHelper* CreateRecursionHelperInstance();
1853 public:
1854 void StartListeningArea( const ScRange& rRange,
1855 SvtListener* pListener );
1856 void EndListeningArea( const ScRange& rRange,
1857 SvtListener* pListener );
1858 /** Broadcast wrapper, calls
1859 rHint.GetCell()->Broadcast() and AreaBroadcast()
1860 and TrackFormulas() and conditional format list
1861 SourceChanged().
1862 Preferred.
1864 void Broadcast( const ScHint& rHint );
1866 void BroadcastCells( const ScRange& rRange, sal_uLong nHint );
1867 void BroadcastRefMoved( const sc::RefMovedHint& rHint );
1869 /// only area, no cell broadcast
1870 void AreaBroadcast( const ScHint& rHint );
1871 /// only areas in range, no cell broadcasts
1872 void AreaBroadcastInRange( const ScRange& rRange,
1873 const ScHint& rHint );
1874 void DelBroadcastAreasInRange( const ScRange& rRange );
1875 void UpdateBroadcastAreas( UpdateRefMode eUpdateRefMode,
1876 const ScRange& rRange,
1877 SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
1880 void StartListeningCell( const ScAddress& rAddress,
1881 SvtListener* pListener );
1882 void EndListeningCell( const ScAddress& rAddress,
1883 SvtListener* pListener );
1885 void StartListeningCell( sc::StartListeningContext& rCxt, const ScAddress& rPos, SvtListener& rListener );
1886 void EndListeningCell( sc::EndListeningContext& rCxt, const ScAddress& rPos, SvtListener& rListener );
1888 void EndListeningFormulaCells( std::vector<ScFormulaCell*>& rCells );
1890 void PutInFormulaTree( ScFormulaCell* pCell );
1891 void RemoveFromFormulaTree( ScFormulaCell* pCell );
1894 * Calculate formula cells that are on the formula tree either partially,
1895 * or in full.
1897 * @param bOnlyForced when true, it only calculates those formula cells
1898 * that are marked "recalc forced".
1899 * @param bProgressBar whether or not to use progress bar.
1900 * @param bSetAllDirty when true, it marks all formula cells currently on
1901 * the formula tree dirty, which forces all of them to
1902 * be recalculated. When false, only those cells
1903 * that are marked dirty prior to this call get
1904 * recalculated.
1906 SC_DLLPUBLIC void CalcFormulaTree(
1907 bool bOnlyForced = false, bool bProgressBar = true, bool bSetAllDirty = true );
1908 void ClearFormulaTree();
1909 void AppendToFormulaTrack( ScFormulaCell* pCell );
1910 void RemoveFromFormulaTrack( ScFormulaCell* pCell );
1911 void TrackFormulas( sal_uLong nHintId = SC_HINT_DATACHANGED );
1912 sal_uInt16 GetFormulaTrackCount() const { return nFormulaTrackCount; }
1913 bool IsInFormulaTree( ScFormulaCell* pCell ) const;
1914 bool IsInFormulaTrack( ScFormulaCell* pCell ) const;
1915 bool GetHardRecalcState() { return bHardRecalcState; }
1916 void SetHardRecalcState( bool bVal ) { bHardRecalcState = bVal; }
1917 void StartAllListeners();
1918 const ScFormulaCell* GetFormulaTree() const { return pFormulaTree; }
1919 bool HasForcedFormulas() const { return bHasForcedFormulas; }
1920 void SetForcedFormulas( bool bVal ) { bHasForcedFormulas = bVal; }
1921 sal_uLong GetFormulaCodeInTree() const { return nFormulaCodeInTree; }
1922 bool IsInInterpreter() const { return nInterpretLevel != 0; }
1923 sal_uInt16 GetInterpretLevel() { return nInterpretLevel; }
1924 void IncInterpretLevel()
1926 if ( nInterpretLevel < USHRT_MAX )
1927 nInterpretLevel++;
1929 void DecInterpretLevel()
1931 if ( nInterpretLevel )
1932 nInterpretLevel--;
1934 bool IsInMacroInterpreter() const { return nMacroInterpretLevel != 0; }
1935 sal_uInt16 GetMacroInterpretLevel() { return nMacroInterpretLevel; }
1936 void IncMacroInterpretLevel()
1938 if ( nMacroInterpretLevel < USHRT_MAX )
1939 nMacroInterpretLevel++;
1941 void DecMacroInterpretLevel()
1943 if ( nMacroInterpretLevel )
1944 nMacroInterpretLevel--;
1946 bool IsInInterpreterTableOp() const { return nInterpreterTableOpLevel != 0; }
1947 sal_uInt16 GetInterpreterTableOpLevel() { return nInterpreterTableOpLevel; }
1948 void IncInterpreterTableOpLevel()
1950 if ( nInterpreterTableOpLevel < USHRT_MAX )
1951 nInterpreterTableOpLevel++;
1953 void DecInterpreterTableOpLevel()
1955 if ( nInterpreterTableOpLevel )
1956 nInterpreterTableOpLevel--;
1958 // add a formula to be remembered for TableOp broadcasts
1959 void AddTableOpFormulaCell( ScFormulaCell* );
1960 void InvalidateLastTableOpParams() { aLastTableOpParams.bValid = false; }
1961 ScRecursionHelper& GetRecursionHelper()
1963 if (!pRecursionHelper)
1964 pRecursionHelper = CreateRecursionHelperInstance();
1965 return *pRecursionHelper;
1967 bool IsInDtorClear() const { return bInDtorClear; }
1968 void SetExpandRefs( bool bVal );
1969 bool IsExpandRefs() const;
1971 sal_uLong GetXMLImportedFormulaCount() const { return nXMLImportedFormulaCount; }
1972 void IncXMLImportedFormulaCount( sal_uLong nVal )
1974 if ( nXMLImportedFormulaCount + nVal > nXMLImportedFormulaCount )
1975 nXMLImportedFormulaCount += nVal;
1977 void DecXMLImportedFormulaCount( sal_uLong nVal )
1979 if ( nVal <= nXMLImportedFormulaCount )
1980 nXMLImportedFormulaCount -= nVal;
1981 else
1982 nXMLImportedFormulaCount = 0;
1985 void StartTrackTimer();
1987 void CompileDBFormula();
1988 void CompileColRowNameFormula();
1990 /** Maximum string length of a column, e.g. for dBase export.
1991 @return String length in octets (!) of the destination encoding. In
1992 case of non-octet encodings (e.g. UCS2) the length in code
1993 points times sizeof(sal_Unicode) is returned. */
1994 sal_Int32 GetMaxStringLen( SCTAB nTab, SCCOL nCol,
1995 SCROW nRowStart, SCROW nRowEnd,
1996 rtl_TextEncoding eCharSet ) const;
1997 /** Maximum string length of numerical cells of a column, e.g. for dBase export.
1998 @return String length in characters (!) including the decimal
1999 separator, and the decimal precision needed. */
2000 sal_Int32 GetMaxNumberStringLen( sal_uInt16& nPrecision,
2001 SCTAB nTab, SCCOL nCol,
2002 SCROW nRowStart, SCROW nRowEnd ) const;
2004 void KeyInput( const KeyEvent& rKEvt ); // TimerDelays etc.
2006 ScChangeTrack* GetChangeTrack() const { return pChangeTrack; }
2008 //! only for import filter, deletes any existing ChangeTrack via
2009 //! EndChangeTracking() and takes ownership of new ChangeTrack pTrack
2010 SC_DLLPUBLIC void SetChangeTrack( ScChangeTrack* pTrack );
2012 void StartChangeTracking();
2013 void EndChangeTracking();
2015 SC_DLLPUBLIC void CompareDocument( ScDocument& rOtherDoc );
2017 void AddUnoObject( SfxListener& rObject );
2018 void RemoveUnoObject( SfxListener& rObject );
2019 void BroadcastUno( const SfxHint &rHint );
2020 void AddUnoListenerCall( const ::com::sun::star::uno::Reference<
2021 ::com::sun::star::util::XModifyListener >& rListener,
2022 const ::com::sun::star::lang::EventObject& rEvent );
2024 void SetInLinkUpdate(bool bSet); // TableLink or AreaLink
2025 bool IsInLinkUpdate() const; // including DdeLink
2027 SC_DLLPUBLIC SfxItemPool* GetEditPool() const;
2028 SC_DLLPUBLIC SfxItemPool* GetEnginePool() const;
2029 SC_DLLPUBLIC ScFieldEditEngine& GetEditEngine();
2030 SC_DLLPUBLIC ScNoteEditEngine& GetNoteEngine();
2032 ScRefreshTimerControl* GetRefreshTimerControl() const
2033 { return pRefreshTimerControl; }
2034 ScRefreshTimerControl * const * GetRefreshTimerControlAddress() const
2035 { return &pRefreshTimerControl; }
2037 void SetPastingDrawFromOtherDoc( bool bVal )
2038 { bPastingDrawFromOtherDoc = bVal; }
2039 bool PastingDrawFromOtherDoc() const
2040 { return bPastingDrawFromOtherDoc; }
2042 /// an ID unique to each document instance
2043 sal_uInt32 GetDocumentID() const;
2045 void InvalidateStyleSheetUsage()
2046 { bStyleSheetUsageInvalid = true; }
2047 void SC_DLLPUBLIC GetSortParam( ScSortParam& rParam, SCTAB nTab );
2048 void SC_DLLPUBLIC SetSortParam( ScSortParam& rParam, SCTAB nTab );
2050 inline void SetVbaEventProcessor( const com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor >& rxVbaEvents )
2051 { mxVbaEvents = rxVbaEvents; }
2052 inline com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor >
2053 GetVbaEventProcessor() const { return mxVbaEvents; }
2055 /** Should only be GRAM_PODF or GRAM_ODFF. */
2056 void SetStorageGrammar( formula::FormulaGrammar::Grammar eGrammar );
2057 formula::FormulaGrammar::Grammar GetStorageGrammar() const
2058 { return eStorageGrammar; }
2060 SC_DLLPUBLIC SfxUndoManager* GetUndoManager();
2061 bool IsInVBAMode() const;
2062 ScRowBreakIterator* GetRowBreakIterator(SCTAB nTab) const;
2064 void AddSubTotalCell(ScFormulaCell* pCell);
2065 void RemoveSubTotalCell(ScFormulaCell* pCell);
2066 void SetSubTotalCellsDirty(const ScRange& rDirtyRange);
2067 void MarkSubTotalCells( sc::ColumnSpanSet& rSet, const ScRange& rRange, bool bVal ) const;
2069 sal_uInt16 GetTextWidth( const ScAddress& rPos ) const;
2071 sal_uInt8 GetScriptType( const ScAddress& rPos ) const;
2072 void SetScriptType( const ScAddress& rPos, sal_uInt8 nType );
2073 void UpdateScriptTypes( const ScAddress& rPos, SCCOL nColSize, SCROW nRowSize );
2075 size_t GetFormulaHash( const ScAddress& rPos ) const;
2078 * Make specified formula cells non-grouped.
2080 * @param nTab sheet index
2081 * @param nCol column index
2082 * @param rRows list of row indices at which formula cells are to be
2083 * unshared. This call sorts the passed row indices and
2084 * removes duplicates, which is why the caller must pass it
2085 * as reference.
2087 void UnshareFormulaCells( SCTAB nTab, SCCOL nCol, std::vector<SCROW>& rRows );
2088 void RegroupFormulaCells( SCTAB nTab, SCCOL nCol );
2090 ScFormulaVectorState GetFormulaVectorState( const ScAddress& rPos ) const;
2092 formula::FormulaTokenRef ResolveStaticReference( const ScAddress& rPos );
2093 formula::FormulaTokenRef ResolveStaticReference( const ScRange& rRange );
2095 formula::VectorRefArray FetchVectorRefArray( const ScAddress& rPos, SCROW nLength );
2098 * Call this before any operations that might trigger one or more formula
2099 * cells to get calculated.
2101 void ClearFormulaContext();
2103 SvtBroadcaster* GetBroadcaster( const ScAddress& rPos );
2104 const SvtBroadcaster* GetBroadcaster( const ScAddress& rPos ) const;
2105 void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, const ScAddress& rTopPos, SCROW nLength );
2108 * See if specified column has any broadcaster at all.
2110 bool HasBroadcaster( SCTAB nTab, SCCOL nCol ) const;
2112 #if DEBUG_COLUMN_STORAGE
2113 SC_DLLPUBLIC void DumpFormulaGroups( SCTAB nTab, SCCOL nCol ) const;
2114 #endif
2116 void SetCalcConfig( const ScCalcConfig& rConfig );
2117 const ScCalcConfig& GetCalcConfig() const;
2119 private: // CLOOK-Impl-methods
2122 * Use this class as a locale variable to merge number formatter from
2123 * another document, and set NULL pointer to pFormatExchangeList when
2124 * done.
2126 class NumFmtMergeHandler
2128 public:
2129 explicit NumFmtMergeHandler(ScDocument* pDoc, ScDocument* pSrcDoc);
2130 ~NumFmtMergeHandler();
2132 private:
2133 ScDocument* mpDoc;
2136 bool TableExists( SCTAB nTab ) const;
2137 ScTable* FetchTable( SCTAB nTab );
2138 const ScTable* FetchTable( SCTAB nTab ) const;
2140 void MergeNumberFormatter(ScDocument* pSrcDoc);
2142 void ImplCreateOptions(); // Suggestion: switch to on-demand?
2143 void ImplDeleteOptions();
2145 void DeleteDrawLayer();
2146 SC_DLLPUBLIC bool DrawGetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer ) const;
2147 void DrawMovePage( sal_uInt16 nOldPos, sal_uInt16 nNewPos );
2148 void DrawCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos );
2150 void UpdateDrawPrinter();
2151 void UpdateDrawLanguages();
2152 SC_DLLPUBLIC void InitClipPtrs( ScDocument* pSourceDoc );
2154 void LoadDdeLinks(SvStream& rStream);
2155 void SaveDdeLinks(SvStream& rStream) const;
2157 void DeleteAreaLinksOnTab( SCTAB nTab );
2158 void UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode,
2159 const ScRange& r, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
2161 void CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, const ScMarkData* pMarks, bool bAllTabs);
2163 bool HasPartOfMerged( const ScRange& rRange );
2165 ScRefCellValue GetRefCellValue( const ScAddress& rPos );
2167 std::map< SCTAB, ScSortParam > mSheetSortParams;
2169 SCSIZE GetPatternCount( SCTAB nTab, SCCOL nCol ) const;
2170 SCSIZE GetPatternCount( SCTAB nTab, SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const;
2171 bool ReservePatternCount( SCTAB nTab, SCCOL nCol, SCSIZE nReserve );
2173 void SharePooledResources( ScDocument* pSrcDoc );
2176 #endif
2179 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */