Version 4.2.0.1, tag libreoffice-4.2.0.1
[LibreOffice.git] / sc / inc / document.hxx
blobe283b3d2f8c3e2db7f3107b2a8aa4b73e70c1aa7
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 SC_DOCUMENT_HXX
21 #define SC_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 "sortparam.hxx"
33 #include "types.hxx"
34 #include "formula/grammar.hxx"
35 #include "formula/types.hxx"
36 #include <com/sun/star/chart2/XChartDocument.hpp>
37 #include "typedstrdata.hxx"
38 #include "compressedarray.hxx"
39 #include "calcmacros.hxx"
40 #include <tools/fract.hxx>
41 #include <tools/gen.hxx>
43 #include <memory>
44 #include <map>
45 #include <set>
46 #include <vector>
47 #include <boost/ptr_container/ptr_vector.hpp>
48 #include <boost/scoped_ptr.hpp>
49 #include "markdata.hxx"
51 namespace editeng { class SvxBorderLine; }
52 namespace formula { struct VectorRefArray; }
53 namespace svl {
55 class SharedString;
56 class SharedStringPool;
60 namespace sc {
62 struct FormulaGroupContext;
63 class StartListeningContext;
64 class EndListeningContext;
65 class CopyFromClipContext;
66 class ColumnSpanSet;
67 struct ColumnBlockPosition;
68 struct RefUpdateContext;
69 class EditTextIterator;
70 struct NoteEntry;
71 struct FormulaGroupContext;
75 class SvxFontItem;
77 class KeyEvent;
78 class OutputDevice;
79 class SdrObject;
80 class SfxBroadcaster;
81 class SfxListener;
82 class SfxHint;
83 class SfxItemSet;
84 class SfxObjectShell;
85 class SfxBindings;
86 class SfxPoolItem;
87 class SfxItemPool;
88 class SfxPrinter;
89 class SfxStyleSheetBase;
90 class SvMemoryStream;
91 class SvNumberFormatter;
92 class SvxBoxInfoItem;
93 class SvxBoxItem;
94 class SvxForbiddenCharactersTable;
95 namespace sfx2 {
96 class LinkManager;
98 class SvxSearchItem;
99 class Window;
100 class XColorList;
102 struct ScAttrEntry;
103 class ScAutoFormatData;
104 class ScBroadcastAreaSlotMachine;
105 class ScChangeViewSettings;
106 class ScChartCollection;
107 class ScChartListenerCollection;
108 class ScConditionalFormat;
109 class ScConditionalFormatList;
110 class ScDBCollection;
111 class ScDBData;
112 class ScDetOpData;
113 class ScDetOpList;
114 class ScDocOptions;
115 class ScDocProtection;
116 class ScDocumentPool;
117 class ScDrawLayer;
118 class ScExtDocOptions;
119 class ScExternalRefManager;
120 class ScFormulaCell;
121 class ScMacroManager;
122 class ScMarkData;
123 class ScOutlineTable;
124 class ScPatternAttr;
125 class ScPrintRangeSaver;
126 class ScRangeData;
127 class ScRangeName;
128 class ScStyleSheet;
129 class ScStyleSheetPool;
130 class ScTable;
131 class ScTableProtection;
132 class ScTokenArray;
133 class ScValidationData;
134 class ScValidationDataList;
135 class ScViewOptions;
136 class ScChangeTrack;
137 class ScEditEngineDefaulter;
138 class ScFieldEditEngine;
139 class ScNoteEditEngine;
140 struct ScConsolidateParam;
141 class ScDPObject;
142 class ScDPCollection;
143 class ScMatrix;
144 class ScScriptTypeData;
145 class ScPoolHelper;
146 struct ScSortParam;
147 class ScRefreshTimerControl;
148 class ScUnoListenerCalls;
149 class ScUnoRefList;
150 class ScRecursionHelper;
151 struct RowInfo;
152 struct ScTableInfo;
153 struct ScTabOpParam;
154 class VirtualDevice;
155 class ScAutoNameCache;
156 class ScTemporaryChartLock;
157 class ScLookupCache;
158 struct ScLookupCacheMapImpl;
159 class SfxUndoManager;
160 class ScFormulaParserPool;
161 struct ScClipParam;
162 class ScRowBreakIterator;
163 struct ScSetStringParam;
164 class ScDocRowHeightUpdater;
165 struct ScColWidthParam;
166 class ScSheetEvents;
167 class ScProgress;
168 class SvtListener;
169 class ScEditDataArray;
170 class EditTextObject;
171 struct ScRefCellValue;
172 class ScDocumentImport;
173 class ScPostIt;
175 namespace com { namespace sun { namespace star {
176 namespace lang {
177 class XMultiServiceFactory;
178 struct EventObject;
180 namespace i18n {
181 class XBreakIterator;
183 namespace util {
184 class XModifyListener;
186 namespace embed {
187 class XEmbeddedObject;
189 namespace script { namespace vba {
190 class XVBAEventProcessor;
192 namespace sheet {
193 struct TablePageBreakData;
195 } } }
197 #include <svl/zforlist.hxx>
199 #define SC_DOC_NEW 0xFFFF
201 #define SC_MACROCALL_ALLOWED 0
202 #define SC_MACROCALL_NOTALLOWED 1
203 #define SC_MACROCALL_ASK 2
205 #define SC_ASIANCOMPRESSION_INVALID 0xff
206 #define SC_ASIANKERNING_INVALID 0xff
208 enum ScDocumentMode
210 SCDOCMODE_DOCUMENT,
211 SCDOCMODE_CLIP,
212 SCDOCMODE_UNDO
216 struct ScDocStat
218 OUString aDocName;
219 SCTAB nTableCount;
220 sal_uLong nCellCount;
221 sal_uInt16 nPageCount;
224 // DDE link modes
225 const sal_uInt8 SC_DDE_DEFAULT = 0;
226 const sal_uInt8 SC_DDE_ENGLISH = 1;
227 const sal_uInt8 SC_DDE_TEXT = 2;
228 const sal_uInt8 SC_DDE_IGNOREMODE = 255; /// For usage in FindDdeLink() only!
230 class ScDocument
232 friend class ScValueIterator;
233 friend class ScHorizontalValueIterator;
234 friend class ScDBQueryDataIterator;
235 friend class ScCellIterator;
236 friend class ScQueryCellIterator;
237 friend class ScHorizontalCellIterator;
238 friend class ScHorizontalAttrIterator;
239 friend class ScDocAttrIterator;
240 friend class ScAttrRectIterator;
241 friend class ScDocShell;
242 friend class ScDocRowHeightUpdater;
243 friend class ScColumnTextWidthIterator;
244 friend class ScFormulaCell;
245 friend class ScTable;
246 friend class ScColumn;
247 friend struct ScRefCellValue;
248 friend class ScDocumentImport;
249 friend class sc::ColumnSpanSet;
250 friend class sc::EditTextIterator;
252 typedef ::std::vector<ScTable*> TableContainer;
253 private:
255 rtl::Reference<ScPoolHelper> xPoolHelper;
257 boost::scoped_ptr<svl::SharedStringPool> mpCellStringPool;
258 boost::scoped_ptr<sc::FormulaGroupContext> mpFormulaGroupCxt;
260 SfxUndoManager* mpUndoManager;
261 ScFieldEditEngine* pEditEngine; // uses pEditPool from xPoolHelper
262 ScNoteEditEngine* pNoteEngine; // uses pEditPool from xPoolHelper
263 SfxObjectShell* pShell;
264 SfxPrinter* pPrinter;
265 VirtualDevice* pVirtualDevice_100th_mm;
266 ScDrawLayer* pDrawLayer; // SdrModel
267 rtl::Reference<XColorList> pColorList;
268 ScValidationDataList* pValidationList; // validity
269 SvNumberFormatterIndexTable* pFormatExchangeList; // for application of number formats
270 TableContainer maTabs;
271 std::vector<OUString> maTabNames; // for undo document, we need the information tab name <-> index
272 mutable ScRangeName* pRangeName;
273 ScDBCollection* pDBCollection;
274 ScDPCollection* pDPCollection;
275 ScChartCollection* pChartCollection;
276 std::auto_ptr< ScTemporaryChartLock > apTemporaryChartLock;
277 ScPatternAttr* pSelectionAttr; // Attributes of a block
278 mutable sfx2::LinkManager* pLinkManager;
279 ScFormulaCell* pFormulaTree; // formula tree (start)
280 ScFormulaCell* pEOFormulaTree; // formula tree (end), last cell
281 ScFormulaCell* pFormulaTrack; // BroadcastTrack (start)
282 ScFormulaCell* pEOFormulaTrack; // BrodcastTrack (end), last cell
283 ScBroadcastAreaSlotMachine* pBASM; // BroadcastAreas
284 ScChartListenerCollection* pChartListenerCollection;
285 SvMemoryStream* pClipData;
286 ScDetOpList* pDetOpList;
287 ScChangeTrack* pChangeTrack;
288 SfxBroadcaster* pUnoBroadcaster;
289 ScUnoListenerCalls* pUnoListenerCalls;
290 ScUnoRefList* pUnoRefUndoList;
291 ScChangeViewSettings* pChangeViewSettings;
292 ScScriptTypeData* pScriptTypeData;
293 ScRefreshTimerControl* pRefreshTimerControl;
294 rtl::Reference<SvxForbiddenCharactersTable> xForbiddenCharacters;
296 ScFieldEditEngine* pCacheFieldEditEngine;
298 ::std::auto_ptr<ScDocProtection> pDocProtection;
299 ::std::auto_ptr<ScClipParam> mpClipParam;
301 ::std::auto_ptr<ScExternalRefManager> pExternalRefMgr;
302 ::std::auto_ptr<ScMacroManager> mpMacroMgr;
305 // mutable for lazy construction
306 mutable ::std::auto_ptr< ScFormulaParserPool >
307 mxFormulaParserPool; /// Pool for all external formula parsers used by this document.
309 OUString aDocName; // optional: name of document
310 OUString aDocCodeName; // optional: name of document (twice?)
311 OUString maFileURL; // file URL for copy & paste
312 ScRangePairListRef xColNameRanges;
313 ScRangePairListRef xRowNameRanges;
315 ScViewOptions* pViewOptions; // view options
316 ScDocOptions* pDocOptions; // document options
317 ScExtDocOptions* pExtDocOptions; // for import etc.
318 ScConsolidateParam* pConsolidateDlgData;
320 ScRecursionHelper* pRecursionHelper; // information for recursive and iterative cell formulas
322 ScAutoNameCache* pAutoNameCache; // for automatic name lookup during CompileXML
324 ScLookupCacheMapImpl* pLookupCacheMapImpl; // cache for lookups like VLOOKUP and MATCH
326 SfxItemSet* pPreviewFont; // convert to std::auto_ptr or whatever
327 ScStyleSheet* pPreviewCellStyle;
328 ScMarkData maPreviewSelection;
329 sal_Int64 nUnoObjectId; // counted up for UNO objects
331 sal_uInt32 nRangeOverflowType; // used in (xml) loading for overflow warnings
333 ScRange aEmbedRange;
334 ScAddress aCurTextWidthCalcPos;
336 Timer aTrackTimer;
338 com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor >
339 mxVbaEvents;
340 public:
341 boost::ptr_vector< ScInterpreterTableOpParams > aTableOpList; // list of ScInterpreterTableOpParams currently in use
342 ScInterpreterTableOpParams aLastTableOpParams; // remember last params
343 private:
345 LanguageType eLanguage; // default language
346 LanguageType eCjkLanguage; // default language for asian text
347 LanguageType eCtlLanguage; // default language for complex text
348 rtl_TextEncoding eSrcSet; // during reading: source character set
350 /** The compiler grammar used in document storage. GRAM_PODF for ODF 1.1
351 documents, GRAM_ODFF for ODF 1.2 documents. */
352 formula::FormulaGrammar::Grammar eStorageGrammar;
354 /** The compiler grammar used in ODF import after brackets had been
355 stripped (which they shouldn't, but until that's fixed) by the XML
356 importer. */
357 formula::FormulaGrammar::Grammar eXmlImportGrammar;
359 sal_uLong nFormulaCodeInTree; // FormelRPN im Formelbaum
360 sal_uLong nXMLImportedFormulaCount; // progress count during XML import
361 sal_uInt16 nInterpretLevel; // >0 if in interpreter
362 sal_uInt16 nMacroInterpretLevel; // >0 if macro in interpreter
363 sal_uInt16 nInterpreterTableOpLevel; // >0 if in interpreter TableOp
364 SCTAB nMaxTableNumber;
365 sal_uInt16 nSrcVer; // file version (load/save)
366 SCROW nSrcMaxRow; // number of lines to load/save
367 sal_uInt16 nFormulaTrackCount;
368 bool bHardRecalcState; // false: soft, true: hard
369 SCTAB nVisibleTab; // for OLE etc., don't use inside ScDocument
371 ScLkUpdMode eLinkMode;
373 bool bAutoCalc; // calculate automatically
374 bool bAutoCalcShellDisabled; // in/from/for ScDocShell disabled
375 // are there ForcedFormulas which have to be calculated
376 // in interaction with ScDocShell SetDocumentModified,
377 // AutoCalcShellDisabled and TrackFormulas
378 bool bForcedFormulaPending;
379 bool bCalculatingFormulaTree;
380 bool bIsClip;
381 bool bIsUndo;
382 bool bIsVisible; // set from view ctor
384 bool bIsEmbedded; // display/adjust Embedded area?
386 // no broadcast, construct no listener during insert from a different
387 // Doc (per filter or the like ), not until CompileAll / CalcAfterLoad
388 bool bInsertingFromOtherDoc;
389 bool bLoadingMedium;
390 bool bImportingXML; // special handling of formula text
391 bool bXMLFromWrapper; // distinguish ScXMLImportWrapper from external component
392 bool bCalcingAfterLoad; // in CalcAfterLoad TRUE
393 // don't construct/destruct listeners temporarily
394 bool bNoListening;
395 bool mbIdleEnabled;
396 bool bInLinkUpdate; // TableLink or AreaLink
397 bool bChartListenerCollectionNeedsUpdate;
398 // are/were there RC_FORCED formula cells in the document (if set once to TRUE then set forever)
399 bool bHasForcedFormulas;
400 // is the Doc being destroyed? (no Notify-Tracking etc. needed anymore)
401 bool bInDtorClear;
402 // expand reference if insert column/row takes place at the border
403 // of a reference
404 // is fetched in each UpdateReference from InputOptions,
405 // assigned, and restored at the end of UpdateReference
406 bool bExpandRefs;
407 // for detective update, is set for each change of a formula
408 bool bDetectiveDirty;
410 sal_uInt8 nMacroCallMode; // Macros per warning dialog disabled?
411 bool bHasMacroFunc; // valid only after loading
413 sal_uInt8 nVisSpellState;
415 sal_uInt8 nAsianCompression;
416 sal_uInt8 nAsianKerning;
418 bool bPastingDrawFromOtherDoc;
420 sal_uInt8 nInDdeLinkUpdate; // originating DDE links (stacked bool)
422 bool bInUnoBroadcast;
423 bool bInUnoListenerCall;
424 formula::FormulaGrammar::Grammar eGrammar;
426 mutable bool bStyleSheetUsageInvalid;
428 bool mbUndoEnabled:1;
429 bool mbAdjustHeightEnabled:1;
430 bool mbExecuteLinkEnabled:1;
431 bool mbChangeReadOnlyEnabled:1; // allow changes in read-only document (for API import filters)
432 bool mbStreamValidLocked:1;
433 bool mbUserInteractionEnabled:1; // whether or not to launch any kind of interactive dialogs.
435 sal_Int16 mnNamedRangesLockCount;
437 ::std::set<ScFormulaCell*> maSubTotalCells;
439 bool mbUseEmbedFonts;
441 public:
442 bool IsUsingEmbededFonts() { return mbUseEmbedFonts; }
443 void SetIsUsingEmbededFonts( bool bUse ) { mbUseEmbedFonts = bUse; }
444 SC_DLLPUBLIC sal_uLong GetCellCount() const; // all cells
445 SCSIZE GetCellCount(SCTAB nTab, SCCOL nCol) const;
446 sal_uLong GetCodeCount() const; // RPN-Code in formulas
447 DECL_LINK( GetUserDefinedColor, sal_uInt16 * );
448 // number formatter
449 public:
450 SC_DLLPUBLIC ScDocument( ScDocumentMode eMode = SCDOCMODE_DOCUMENT,
451 SfxObjectShell* pDocShell = NULL );
452 SC_DLLPUBLIC ~ScDocument();
454 SC_DLLPUBLIC const OUString& GetName() const { return aDocName; }
455 void SetName( const OUString& r ) { aDocName = r; }
456 const OUString& GetCodeName() const { return aDocCodeName; }
457 void SetCodeName( const OUString& r ) { aDocCodeName = r; }
458 const OUString& GetFileURL() const { return maFileURL; }
460 void GetDocStat( ScDocStat& rDocStat );
462 SC_DLLPUBLIC void InitDrawLayer( SfxObjectShell* pDocShell = NULL );
463 rtl::Reference<XColorList> GetColorList();
465 SC_DLLPUBLIC sfx2::LinkManager* GetLinkManager() const;
467 SC_DLLPUBLIC const ScDocOptions& GetDocOptions() const;
468 SC_DLLPUBLIC void SetDocOptions( const ScDocOptions& rOpt );
469 SC_DLLPUBLIC const ScViewOptions& GetViewOptions() const;
470 SC_DLLPUBLIC void SetViewOptions( const ScViewOptions& rOpt );
471 void SetPrintOptions();
473 ScExtDocOptions* GetExtDocOptions() { return pExtDocOptions; }
474 SC_DLLPUBLIC void SetExtDocOptions( ScExtDocOptions* pNewOptions );
476 SC_DLLPUBLIC void GetLanguage( LanguageType& rLatin, LanguageType& rCjk, LanguageType& rCtl ) const;
477 void SetLanguage( LanguageType eLatin, LanguageType eCjk, LanguageType eCtl );
479 void SetConsolidateDlgData( const ScConsolidateParam* pData );
480 const ScConsolidateParam* GetConsolidateDlgData() const { return pConsolidateDlgData; }
482 void Clear( bool bFromDestructor = false );
484 ScFieldEditEngine* CreateFieldEditEngine();
485 void DisposeFieldEditEngine(ScFieldEditEngine*& rpEditEngine);
488 * Get all range names that are local to each table. It only returns
489 * non-empty range name set.
491 SC_DLLPUBLIC void GetAllTabRangeNames(ScRangeName::TabNameCopyMap& rRangeNames) const;
492 SC_DLLPUBLIC void SetAllRangeNames( const boost::ptr_map<OUString, ScRangeName>& rRangeMap);
493 SC_DLLPUBLIC void GetTabRangeNameMap(std::map<OUString, ScRangeName*>& rRangeName);
494 SC_DLLPUBLIC void GetRangeNameMap(std::map<OUString, ScRangeName*>& rRangeName);
495 SC_DLLPUBLIC ScRangeName* GetRangeName(SCTAB nTab) const;
496 SC_DLLPUBLIC ScRangeName* GetRangeName() const;
497 void SetRangeName(SCTAB nTab, ScRangeName* pNew);
498 void SetRangeName( ScRangeName* pNewRangeName );
499 SCTAB GetMaxTableNumber() { return static_cast<SCTAB>(maTabs.size()) - 1; }
500 void SetMaxTableNumber(SCTAB nNumber) { nMaxTableNumber = nNumber; }
502 ScRangePairList* GetColNameRanges() { return &xColNameRanges; }
503 ScRangePairList* GetRowNameRanges() { return &xRowNameRanges; }
504 ScRangePairListRef& GetColNameRangesRef() { return xColNameRanges; }
505 ScRangePairListRef& GetRowNameRangesRef() { return xRowNameRanges; }
507 SC_DLLPUBLIC ScDBCollection* GetDBCollection() const;
508 void SetDBCollection( ScDBCollection* pNewDBCollection,
509 bool bRemoveAutoFilter = false );
510 const ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bStartOnly = false) const;
511 ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bStartOnly = false);
512 const ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const;
513 ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
515 SC_DLLPUBLIC const ScRangeData* GetRangeAtBlock( const ScRange& rBlock, OUString* pName=NULL ) const;
517 bool HasPivotTable() const;
518 SC_DLLPUBLIC ScDPCollection* GetDPCollection();
519 SC_DLLPUBLIC const ScDPCollection* GetDPCollection() const;
520 ScDPObject* GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
521 ScDPObject* GetDPAtBlock( const ScRange& rBlock ) const;
523 SC_DLLPUBLIC ScChartCollection* GetChartCollection() const;
525 void StopTemporaryChartLock();
527 void EnsureGraphicNames();
529 SdrObject* GetObjectAtPoint( SCTAB nTab, const Point& rPos );
530 bool HasChartAtPoint( SCTAB nTab, const Point& rPos, OUString& rName );
532 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > GetChartByName( const OUString& rChartName );
533 SC_DLLPUBLIC void GetChartRanges( const OUString& rChartName, ::std::vector< ScRangeList >& rRanges, ScDocument* pSheetNameDoc );
534 void SetChartRanges( const OUString& rChartName, const ::std::vector< ScRangeList >& rRanges );
536 void UpdateChartArea( const OUString& rChartName, const ScRange& rNewArea,
537 bool bColHeaders, bool bRowHeaders, bool bAdd );
538 void UpdateChartArea( const OUString& rChartName,
539 const ScRangeListRef& rNewList,
540 bool bColHeaders, bool bRowHeaders, bool bAdd );
541 void GetOldChartParameters( const OUString& rName,
542 ScRangeList& rRanges, bool& rColHeaders, bool& rRowHeaders );
543 ::com::sun::star::uno::Reference<
544 ::com::sun::star::embed::XEmbeddedObject >
545 FindOleObjectByName( const OUString& rName );
547 SC_DLLPUBLIC void MakeTable( SCTAB nTab,bool _bNeedsNameCheck = true );
549 SCTAB GetVisibleTab() const { return nVisibleTab; }
550 SC_DLLPUBLIC void SetVisibleTab(SCTAB nTab) { nVisibleTab = nTab; }
552 SC_DLLPUBLIC bool HasTable( SCTAB nTab ) const;
553 SC_DLLPUBLIC bool GetName( SCTAB nTab, OUString& rName ) const;
554 SC_DLLPUBLIC bool GetCodeName( SCTAB nTab, OUString& rName ) const;
555 SC_DLLPUBLIC bool SetCodeName( SCTAB nTab, const OUString& rName );
556 SC_DLLPUBLIC bool GetTable( const OUString& rName, SCTAB& rTab ) const;
558 std::vector<OUString> GetAllTableNames() const;
560 OUString GetCopyTabName(SCTAB nTab) const;
562 SC_DLLPUBLIC void SetAnonymousDBData(SCTAB nTab, ScDBData* pDBData);
563 SC_DLLPUBLIC ScDBData* GetAnonymousDBData(SCTAB nTab);
565 SC_DLLPUBLIC SCTAB GetTableCount() const;
566 SvNumberFormatterIndexTable* GetFormatExchangeList() const { return pFormatExchangeList; }
568 SC_DLLPUBLIC ScDocProtection* GetDocProtection() const;
569 SC_DLLPUBLIC void SetDocProtection(const ScDocProtection* pProtect);
570 SC_DLLPUBLIC bool IsDocProtected() const;
571 bool IsDocEditable() const;
572 SC_DLLPUBLIC bool IsTabProtected( SCTAB nTab ) const;
573 SC_DLLPUBLIC ScTableProtection* GetTabProtection( SCTAB nTab ) const;
574 SC_DLLPUBLIC void SetTabProtection(SCTAB nTab, const ScTableProtection* pProtect);
575 void CopyTabProtection(SCTAB nTabSrc, SCTAB nTabDest);
577 void LockTable(SCTAB nTab);
578 void UnlockTable(SCTAB nTab);
580 bool IsBlockEditable( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
581 SCCOL nEndCol, SCROW nEndRow,
582 bool* pOnlyNotBecauseOfMatrix = NULL ) const;
583 bool IsSelectionEditable( const ScMarkData& rMark,
584 bool* pOnlyNotBecauseOfMatrix = NULL ) const;
585 bool HasSelectedBlockMatrixFragment( SCCOL nStartCol, SCROW nStartRow,
586 SCCOL nEndCol, SCROW nEndRow,
587 const ScMarkData& rMark ) const;
589 SC_DLLPUBLIC bool GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMatrix );
591 bool IsEmbedded() const;
592 void GetEmbedded( ScRange& rRange ) const;
593 void SetEmbedded( const ScRange& rRange );
594 void ResetEmbedded();
595 Rectangle GetEmbeddedRect() const; // 1/100 mm
596 void SetEmbedded( SCTAB nTab, const Rectangle& rRect ); // from VisArea (1/100 mm)
598 static SC_DLLPUBLIC bool ValidTabName( const OUString& rName );
600 SC_DLLPUBLIC bool ValidNewTabName( const OUString& rName ) const;
601 SC_DLLPUBLIC void CreateValidTabName(OUString& rName) const;
602 SC_DLLPUBLIC void CreateValidTabNames(std::vector<OUString>& aNames, SCTAB nCount) const;
604 void AppendTabOnLoad(const OUString& rName);
605 void SetTabNameOnLoad(SCTAB nTab, const OUString& rName);
606 void InvalidateStreamOnSave();
608 SC_DLLPUBLIC bool InsertTab( SCTAB nPos, const OUString& rName,
609 bool bExternalDocument = false );
610 SC_DLLPUBLIC bool InsertTabs( SCTAB nPos, const std::vector<OUString>& rNames,
611 bool bExternalDocument = false, bool bNamesValid = false );
612 SC_DLLPUBLIC bool DeleteTabs( SCTAB nTab, SCTAB nSheets );
613 SC_DLLPUBLIC bool DeleteTab( SCTAB nTab );
614 SC_DLLPUBLIC bool RenameTab( SCTAB nTab, const OUString& rName,
615 bool bUpdateRef = true,
616 bool bExternalDocument = false );
617 bool MoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress = NULL );
618 bool CopyTab( SCTAB nOldPos, SCTAB nNewPos,
619 const ScMarkData* pOnlyMarked = NULL );
620 SC_DLLPUBLIC sal_uLong TransferTab(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos,
621 bool bInsertNew = true,
622 bool bResultsOnly = false );
623 SC_DLLPUBLIC void TransferDrawPage(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos);
624 SC_DLLPUBLIC void SetVisible( SCTAB nTab, bool bVisible );
625 SC_DLLPUBLIC bool IsVisible( SCTAB nTab ) const;
626 bool IsStreamValid( SCTAB nTab ) const;
627 void SetStreamValid( SCTAB nTab, bool bSet, bool bIgnoreLock = false );
628 void LockStreamValid( bool bLock );
629 bool IsStreamValidLocked() const { return mbStreamValidLocked; }
630 bool IsPendingRowHeights( SCTAB nTab ) const;
631 void SetPendingRowHeights( SCTAB nTab, bool bSet );
632 SC_DLLPUBLIC void SetLayoutRTL( SCTAB nTab, bool bRTL );
633 SC_DLLPUBLIC bool IsLayoutRTL( SCTAB nTab ) const;
634 bool IsNegativePage( SCTAB nTab ) const;
635 SC_DLLPUBLIC void SetScenario( SCTAB nTab, bool bFlag );
636 SC_DLLPUBLIC bool IsScenario( SCTAB nTab ) const;
637 SC_DLLPUBLIC void GetScenarioData( SCTAB nTab, OUString& rComment,
638 Color& rColor, sal_uInt16& rFlags ) const;
639 SC_DLLPUBLIC void SetScenarioData( SCTAB nTab, const OUString& rComment,
640 const Color& rColor, sal_uInt16 nFlags );
641 SC_DLLPUBLIC Color GetTabBgColor( SCTAB nTab ) const;
642 SC_DLLPUBLIC void SetTabBgColor( SCTAB nTab, const Color& rColor );
643 SC_DLLPUBLIC bool IsDefaultTabBgColor( SCTAB nTab ) const;
644 void GetScenarioFlags( SCTAB nTab, sal_uInt16& rFlags ) const;
645 SC_DLLPUBLIC bool IsActiveScenario( SCTAB nTab ) const;
646 SC_DLLPUBLIC void SetActiveScenario( SCTAB nTab, bool bActive ); // only for Undo etc.
647 SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const;
648 SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const;
649 void SetGrammar( formula::FormulaGrammar::Grammar eGram );
650 SC_DLLPUBLIC sal_uInt8 GetLinkMode( SCTAB nTab ) const;
651 bool IsLinked( SCTAB nTab ) const;
652 SC_DLLPUBLIC const OUString GetLinkDoc( SCTAB nTab ) const;
653 const OUString GetLinkFlt( SCTAB nTab ) const;
654 const OUString GetLinkOpt( SCTAB nTab ) const;
655 SC_DLLPUBLIC const OUString GetLinkTab( SCTAB nTab ) const;
656 sal_uLong GetLinkRefreshDelay( SCTAB nTab ) const;
657 void SetLink( SCTAB nTab, sal_uInt8 nMode, const OUString& rDoc,
658 const OUString& rFilter, const OUString& rOptions,
659 const OUString& rTabName, sal_uLong nRefreshDelay );
660 bool HasLink( const OUString& rDoc,
661 const OUString& rFilter, const OUString& rOptions ) const;
662 SC_DLLPUBLIC bool LinkExternalTab( SCTAB& nTab, const OUString& aDocTab,
663 const OUString& aFileName,
664 const OUString& aTabName );
666 bool HasExternalRefManager() const { return pExternalRefMgr.get(); }
667 SC_DLLPUBLIC ScExternalRefManager* GetExternalRefManager() const;
668 bool IsInExternalReferenceMarking() const;
669 void MarkUsedExternalReferences();
670 bool MarkUsedExternalReferences( ScTokenArray& rArr, const ScAddress& rPos );
672 /** Returns the pool containing external formula parsers. Creates the pool
673 on first call. */
674 ScFormulaParserPool& GetFormulaParserPool() const;
676 bool HasDdeLinks() const;
677 bool HasAreaLinks() const;
678 void UpdateExternalRefLinks(Window* pWin);
679 void UpdateDdeLinks(Window* pWin);
680 void UpdateAreaLinks();
682 // originating DDE links
683 void IncInDdeLinkUpdate() { if ( nInDdeLinkUpdate < 255 ) ++nInDdeLinkUpdate; }
684 void DecInDdeLinkUpdate() { if ( nInDdeLinkUpdate ) --nInDdeLinkUpdate; }
685 bool IsInDdeLinkUpdate() const { return nInDdeLinkUpdate != 0; }
687 SC_DLLPUBLIC void CopyDdeLinks( ScDocument* pDestDoc ) const;
688 void DisconnectDdeLinks();
690 // for StarOne Api:
691 size_t GetDdeLinkCount() const;
692 bool UpdateDdeLink( const OUString& rAppl, const OUString& rTopic, const OUString& rItem );
694 /** Tries to find a DDE link with the specified connection data.
695 @param rnDdePos (out-param) Returns the index of the DDE link (does not include other links from link manager).
696 @return true = DDE link found, rnDdePos valid. */
697 SC_DLLPUBLIC bool FindDdeLink( const OUString& rAppl, const OUString& rTopic,
698 const OUString& rItem, sal_uInt8 nMode, size_t& rnDdePos );
700 /** Returns the connection data of the specified DDE link.
701 @param nDdePos Index of the DDE link (does not include other links from link manager).
702 @param rAppl (out-param) The application name.
703 @param rTopic (out-param) The DDE topic.
704 @param rItem (out-param) The DDE item.
705 @return true = DDE link found, out-parameters valid. */
706 bool GetDdeLinkData( size_t nDdePos, OUString& rAppl, OUString& rTopic, OUString& rItem ) const;
707 /** Returns the link mode of the specified DDE link.
708 @param nDdePos Index of the DDE link (does not include other links from link manager).
709 @param rnMode (out-param) The link mode of the specified DDE link.
710 @return true = DDE link found, rnMode valid. */
711 bool GetDdeLinkMode( size_t nDdePos, sal_uInt8& rnMode ) const;
712 /** Returns the result matrix of the specified DDE link.
713 @param nDdePos Index of the DDE link (does not include other links from link manager).
714 @return The result matrix, if the DDE link has been found, 0 otherwise. */
715 SC_DLLPUBLIC const ScMatrix* GetDdeLinkResultMatrix( size_t nDdePos ) const;
717 /** Tries to find a DDE link or creates a new, if not extant.
718 @param pResults If not 0, sets the matrix as as DDE link result matrix (also for existing links).
719 @return true = DDE link found; false = Unpredictable error occurred, no DDE link created. */
720 SC_DLLPUBLIC bool CreateDdeLink( const OUString& rAppl, const OUString& rTopic, const OUString& rItem, sal_uInt8 nMode, ScMatrixRef pResults );
721 /** Sets a result matrix for the specified DDE link.
722 @param nDdePos Index of the DDE link (does not include other links from link manager).
723 @param pResults The array containing all results of the DDE link (intrusive-ref-counted, do not delete).
724 @return true = DDE link found and matrix set. */
725 bool SetDdeLinkResultMatrix( size_t nDdePos, ScMatrixRef pResults );
728 SfxBindings* GetViewBindings();
729 SfxObjectShell* GetDocumentShell() const { return pShell; }
730 SC_DLLPUBLIC ScDrawLayer* GetDrawLayer();
731 SfxBroadcaster* GetDrawBroadcaster(); // to avoid header
732 void BeginDrawUndo();
734 void BeginUnoRefUndo();
735 bool HasUnoRefUndo() const { return ( pUnoRefUndoList != NULL ); }
736 ScUnoRefList* EndUnoRefUndo(); // must be deleted by caller!
737 sal_Int64 GetNewUnoId();
738 void AddUnoRefChange( sal_Int64 nId, const ScRangeList& rOldRanges );
740 bool IsChart( const SdrObject* pObject );
742 SC_DLLPUBLIC void UpdateAllCharts();
743 void UpdateChartRef( UpdateRefMode eUpdateRefMode,
744 SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
745 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
746 SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
747 //! only assigns the new RangeList, no ChartListener or the like
748 void SetChartRangeList( const OUString& rChartName,
749 const ScRangeListRef& rNewRangeListRef );
751 void StartAnimations( SCTAB nTab, Window* pWin );
753 bool HasBackgroundDraw( SCTAB nTab, const Rectangle& rMMRect ) const;
754 bool HasAnyDraw( SCTAB nTab, const Rectangle& rMMRect ) const;
756 const ScSheetEvents* GetSheetEvents( SCTAB nTab ) const;
757 void SetSheetEvents( SCTAB nTab, const ScSheetEvents* pNew );
758 bool HasSheetEventScript( SCTAB nTab, sal_Int32 nEvent, bool bWithVbaEvents = false ) const;
759 bool HasAnySheetEventScript( sal_Int32 nEvent, bool bWithVbaEvents = false ) const; // on any sheet
761 bool HasAnyCalcNotification() const;
762 bool HasCalcNotification( SCTAB nTab ) const;
763 void SetCalcNotification( SCTAB nTab );
764 void ResetCalcNotifications();
766 SC_DLLPUBLIC ScOutlineTable* GetOutlineTable( SCTAB nTab, bool bCreate = false );
767 bool SetOutlineTable( SCTAB nTab, const ScOutlineTable* pNewOutline );
769 void DoAutoOutline( SCCOL nStartCol, SCROW nStartRow,
770 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab );
772 bool DoSubTotals( SCTAB nTab, ScSubTotalParam& rParam );
773 void RemoveSubTotals( SCTAB nTab, ScSubTotalParam& rParam );
774 bool TestRemoveSubTotals( SCTAB nTab, const ScSubTotalParam& rParam );
775 bool HasSubTotalCells( const ScRange& rRange );
777 SC_DLLPUBLIC void EnsureTable( SCTAB nTab );
779 // return TRUE = number format is set
780 SC_DLLPUBLIC bool SetString(
781 SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& rString,
782 ScSetStringParam* pParam = NULL );
783 SC_DLLPUBLIC bool SetString( const ScAddress& rPos, const OUString& rString, ScSetStringParam* pParam = NULL );
786 * This method manages the lifecycle of the passed edit text object. When
787 * the text is successfully inserted, the cell takes over the ownership of
788 * the text object. If not, the text object gets deleted.
790 * <p>The caller must ensure that the passed edit text object <i>uses the
791 * SfxItemPool instance returned from ScDocument::GetEditPool()</i>.
792 * This is very important.</p>
794 SC_DLLPUBLIC void SetEditText( const ScAddress& rPos, EditTextObject* pEditText );
796 void SetEditText( const ScAddress& rPos, const EditTextObject& rEditText, const SfxItemPool* pEditPool );
798 SC_DLLPUBLIC void SetEditText( const ScAddress& rPos, const OUString& rStr );
801 * Call this if you are not sure whether to put this as an edit text or a
802 * simple text.
804 SC_DLLPUBLIC void SetTextCell( const ScAddress& rPos, const OUString& rStr );
806 void SetEmptyCell( const ScAddress& rPos );
808 SC_DLLPUBLIC void SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rVal );
809 SC_DLLPUBLIC void SetValue( const ScAddress& rPos, double fVal );
810 void SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const sal_uInt16 nError);
812 SC_DLLPUBLIC void SetFormula(
813 const ScAddress& rPos, const ScTokenArray& rArray,
814 formula::FormulaGrammar::Grammar eGram = formula::FormulaGrammar::GRAM_DEFAULT );
816 SC_DLLPUBLIC void SetFormula(
817 const ScAddress& rPos, const OUString& rFormula,
818 formula::FormulaGrammar::Grammar eGram = formula::FormulaGrammar::GRAM_DEFAULT );
821 * Set formula cell, and transfer its ownership to the document. This call
822 * attempts to group the passed formula cell with the adjacent cells or
823 * cell groups if appropriate.
825 * @return pCell if it was successfully inserted, NULL otherwise. pCell
826 * is deleted automatically on failure to insert.
828 SC_DLLPUBLIC ScFormulaCell* SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell );
830 SC_DLLPUBLIC void InsertMatrixFormula(SCCOL nCol1, SCROW nRow1,
831 SCCOL nCol2, SCROW nRow2,
832 const ScMarkData& rMark,
833 const OUString& rFormula,
834 const ScTokenArray* p = NULL,
835 const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT,
836 bool bDirtyFlag=true );
837 SC_DLLPUBLIC void InsertTableOp(const ScTabOpParam& rParam, // multi-operation
838 SCCOL nCol1, SCROW nRow1,
839 SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark);
841 SC_DLLPUBLIC OUString GetString( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
842 SC_DLLPUBLIC OUString GetString( const ScAddress& rPos ) const;
845 * Return a pointer to the double value stored in value cell.
847 * @param rPos cell position
849 * @return pointer to the double value stored in a numeric cell, or NULL
850 * if the cell at specified position is not a numeric cell.
852 double* GetValueCell( const ScAddress& rPos );
854 SC_DLLPUBLIC svl::SharedStringPool& GetSharedStringPool();
855 const svl::SharedStringPool& GetSharedStringPool() const;
857 svl::SharedString GetSharedString( const ScAddress& rPos ) const;
859 sc::FormulaGroupContext& GetFormulaGroupContext();
861 SC_DLLPUBLIC void GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, OUString& rString );
862 sal_uInt16 GetStringForFormula( const ScAddress& rPos, OUString& rString );
863 SC_DLLPUBLIC double GetValue( const ScAddress& rPos ) const;
864 SC_DLLPUBLIC double GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
865 SC_DLLPUBLIC void GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, double& rValue ) const;
866 SC_DLLPUBLIC const EditTextObject* GetEditText( const ScAddress& rPos ) const;
867 void RemoveEditTextCharAttribs( const ScAddress& rPos, const ScPatternAttr& rAttr );
868 SC_DLLPUBLIC double RoundValueAsShown( double fVal, sal_uInt32 nFormat ) const;
869 SC_DLLPUBLIC void GetNumberFormat( SCCOL nCol, SCROW nRow, SCTAB nTab,
870 sal_uInt32& rFormat ) const;
871 sal_uInt32 GetNumberFormat( const ScRange& rRange ) const;
872 SC_DLLPUBLIC sal_uInt32 GetNumberFormat( const ScAddress& ) const;
873 void SetNumberFormat( const ScAddress& rPos, sal_uInt32 nNumberFormat );
875 void GetNumberFormatInfo( short& nType, sal_uLong& nIndex, const ScAddress& rPos ) const;
876 const ScTokenArray* GetFormulaTokens( const ScAddress& rPos ) const;
877 SC_DLLPUBLIC const ScFormulaCell* GetFormulaCell( const ScAddress& rPos ) const;
878 SC_DLLPUBLIC ScFormulaCell* GetFormulaCell( const ScAddress& rPos );
879 SC_DLLPUBLIC void GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, OUString& rFormula ) const;
880 SC_DLLPUBLIC void GetCellType( SCCOL nCol, SCROW nRow, SCTAB nTab, CellType& rCellType ) const;
881 SC_DLLPUBLIC CellType GetCellType( const ScAddress& rPos ) const;
883 SC_DLLPUBLIC bool HasData( SCCOL nCol, SCROW nRow, SCTAB nTab );
884 SC_DLLPUBLIC bool HasStringData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
885 SC_DLLPUBLIC bool HasValueData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
886 SC_DLLPUBLIC bool HasValueData( const ScAddress& rPos ) const;
887 bool HasStringCells( const ScRange& rRange ) const;
889 /** Returns true, if there is any data to create a selection list for rPos. */
890 bool HasSelectionData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
892 /** Notes **/
893 SC_DLLPUBLIC ScPostIt* GetNote(const ScAddress& rPos);
894 SC_DLLPUBLIC ScPostIt* GetNote(SCCOL nCol, SCROW nRow, SCTAB nTab);
895 void SetNote(const ScAddress& rPos, ScPostIt* pNote);
896 void SetNote(SCCOL nCol, SCROW nRow, SCTAB nTab, ScPostIt* pNote);
897 bool HasNote(const ScAddress& rPos);
898 bool HasNote(SCCOL nCol, SCROW nRow, SCTAB nTab);
899 SC_DLLPUBLIC bool HasColNotes(SCCOL nCol, SCTAB nTab);
900 SC_DLLPUBLIC bool HasTabNotes(SCTAB nTab);
901 SC_DLLPUBLIC ScPostIt* ReleaseNote(const ScAddress& rPos);
902 SC_DLLPUBLIC ScPostIt* ReleaseNote(SCCOL nCol, SCROW nRow, SCTAB nTab);
903 SC_DLLPUBLIC ScPostIt* GetOrCreateNote(const ScAddress& rPos);
904 SC_DLLPUBLIC ScPostIt* CreateNote(const ScAddress& rPos);
905 size_t CountNotes() const;
906 size_t GetNoteCount( SCTAB nTab, SCCOL nCol ) const;
908 ScAddress GetNotePosition( size_t nIndex ) const;
909 SCROW GetNotePosition( SCTAB nTab, SCCOL nCol, size_t nIndex ) const;
911 SC_DLLPUBLIC void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
912 void GetNotesInRange( const ScRangeList& rRange, std::vector<sc::NoteEntry>& rNotes ) const;
913 bool ContainsNotesInRange( const ScRangeList& rRange ) const;
915 SC_DLLPUBLIC void SetDrawPageSize(SCTAB nTab);
917 bool ExtendMergeSel( SCCOL nStartCol, SCROW nStartRow,
918 SCCOL& rEndCol, SCROW& rEndRow, const ScMarkData& rMark,
919 bool bRefresh = false );
920 SC_DLLPUBLIC bool ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
921 SCCOL& rEndCol, SCROW& rEndRow, SCTAB nTab,
922 bool bRefresh = false );
923 bool ExtendMerge( ScRange& rRange, bool bRefresh = false );
924 bool ExtendTotalMerge( ScRange& rRange ) const;
925 SC_DLLPUBLIC bool ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow,
926 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ) const;
927 SC_DLLPUBLIC bool ExtendOverlapped( ScRange& rRange ) const;
929 bool RefreshAutoFilter( SCCOL nStartCol, SCROW nStartRow,
930 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab );
932 SC_DLLPUBLIC void DoMergeContents( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
933 SCCOL nEndCol, SCROW nEndRow );
934 // without checking:
935 SC_DLLPUBLIC void DoMerge( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
936 SCCOL nEndCol, SCROW nEndRow, bool bDeleteCaptions = true );
937 void RemoveMerge( SCCOL nCol, SCROW nRow, SCTAB nTab );
939 bool IsBlockEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
940 SCCOL nEndCol, SCROW nEndRow, bool bIgnoreNotes = false ) const;
941 bool IsPrintEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
942 SCCOL nEndCol, SCROW nEndRow,
943 bool bLeftIsEmpty = false,
944 ScRange* pLastRange = NULL,
945 Rectangle* pLastMM = NULL ) const;
947 void SkipOverlapped( SCCOL& rCol, SCROW& rRow, SCTAB nTab ) const;
948 bool IsHorOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
949 bool IsVerOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
951 SC_DLLPUBLIC bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
952 SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt16 nMask ) const;
953 SC_DLLPUBLIC bool HasAttrib( const ScRange& rRange, sal_uInt16 nMask ) const;
955 SC_DLLPUBLIC void GetBorderLines( SCCOL nCol, SCROW nRow, SCTAB nTab,
956 const ::editeng::SvxBorderLine** ppLeft,
957 const ::editeng::SvxBorderLine** ppTop,
958 const ::editeng::SvxBorderLine** ppRight,
959 const ::editeng::SvxBorderLine** ppBottom ) const;
961 void ResetChanged( const ScRange& rRange );
963 void SetDirty();
964 void SetDirty( const ScRange& );
965 void SetTableOpDirty( const ScRange& ); // for Interpreter TableOp
966 void InterpretDirtyCells( const ScRangeList& rRanges );
967 SC_DLLPUBLIC void CalcAll();
968 SC_DLLPUBLIC void CalcAfterLoad();
969 void CompileAll();
970 void CompileXML();
973 * Re-compile formula cells with error.
975 * @param nErrCode specified error code to match. Only those cells with
976 * this error code will be re-compiled. If this value is
977 * 0, cells with any error values will be re-compiled.
979 * @return true if at least one cell is re-compiled, false if no cells are
980 * re-compiled.
982 bool CompileErrorCells(sal_uInt16 nErrCode);
984 ScAutoNameCache* GetAutoNameCache() { return pAutoNameCache; }
985 void SetPreviewFont( SfxItemSet* pFontSet );
986 SfxItemSet* GetPreviewFont() { return pPreviewFont; }
987 SfxItemSet* GetPreviewFont( SCCOL nCol, SCROW nRow, SCTAB nTab );
988 const ScMarkData GetPreviewSelection();
989 void SetPreviewSelection( ScMarkData& rSel );
990 ScStyleSheet* GetPreviewCellStyle() { return pPreviewCellStyle; }
991 ScStyleSheet* GetPreviewCellStyle( SCCOL nCol, SCROW nRow, SCTAB nTab );
992 void SetPreviewCellStyle( ScStyleSheet* pStyle ) { pPreviewCellStyle = pStyle; }
993 SC_DLLPUBLIC void SetAutoNameCache( ScAutoNameCache* pCache );
995 /** Creates a ScLookupCache cache for the range if it
996 doesn't already exist. */
997 ScLookupCache & GetLookupCache( const ScRange & rRange );
998 /** Only ScLookupCache ctor uses AddLookupCache(), do not
999 use elsewhere! */
1000 void AddLookupCache( ScLookupCache & rCache );
1001 /** Only ScLookupCache dtor uses RemoveLookupCache(), do
1002 not use elsewhere! */
1003 void RemoveLookupCache( ScLookupCache & rCache );
1004 /** Zap all caches. */
1005 void ClearLookupCaches();
1007 // calculate automatically
1008 void SetAutoCalc( bool bNewAutoCalc );
1009 bool GetAutoCalc() const { return bAutoCalc; }
1010 // calculate automatically in/from/for ScDocShell disabled
1011 void SetAutoCalcShellDisabled( bool bNew ) { bAutoCalcShellDisabled = bNew; }
1012 bool IsAutoCalcShellDisabled() const { return bAutoCalcShellDisabled; }
1013 // ForcedFormulas are to be calculated
1014 void SetForcedFormulaPending( bool bNew ) { bForcedFormulaPending = bNew; }
1015 bool IsForcedFormulaPending() const { return bForcedFormulaPending; }
1016 // if CalcFormulaTree() is currently running
1017 bool IsCalculatingFormulaTree() { return bCalculatingFormulaTree; }
1019 sal_uInt16 GetErrCode( const ScAddress& ) const;
1021 /** Shrink a range to only include data area.
1023 This is not the actually used area within the
1024 selection, but the bounds of the sheet's data area
1025 instead.
1027 @returns TRUE if the area passed intersected the data
1028 area, FALSE if not, in which case the values
1029 obtained may be out of bounds, not in order or
1030 unmodified. TRUE does not mean that there
1031 actually is any data within the selection.
1033 bool ShrinkToDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ) const;
1035 /** Shrink a range to only include used data area.
1037 @param o_bShrunk
1038 Out parameter, true if area was shrunk, false if not.
1040 @returns true if there is any data, false if not.
1042 bool ShrinkToUsedDataArea( bool& o_bShrunk,
1043 SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
1044 SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
1047 * Return the last non-empty row position in given columns that's no
1048 * greater than the initial last row position, or 0 if the columns are
1049 * empty. A negative value is returned if the given sheet or column
1050 * positions are invalid.
1052 * <p>It starts from the specified last row position, and finds the first
1053 * non-empty row position in the upward direction if the start row
1054 * position is empty.</p>
1056 SCROW GetLastDataRow( SCTAB nTab, SCCOL nCol1, SCCOL nCol2, SCROW nLastRow ) const;
1058 SC_DLLPUBLIC void GetDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
1059 SCCOL& rEndCol, SCROW& rEndRow, bool bIncludeOld, bool bOnlyDown ) const;
1060 SC_DLLPUBLIC bool GetCellArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const;
1061 SC_DLLPUBLIC bool GetTableArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const;
1062 SC_DLLPUBLIC bool GetPrintArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow,
1063 bool bNotes = true ) const;
1064 SC_DLLPUBLIC bool GetPrintAreaHor( SCTAB nTab, SCROW nStartRow, SCROW nEndRow,
1065 SCCOL& rEndCol, bool bNotes = true ) const;
1066 SC_DLLPUBLIC bool GetPrintAreaVer( SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol,
1067 SCROW& rEndRow, bool bNotes = true ) const;
1068 void InvalidateTableArea();
1071 SC_DLLPUBLIC bool GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow ) const;
1074 * Find the maximum column position that contains printable data for the
1075 * specified row range. The final column position must be equal or less
1076 * than the initial value of rEndCol.
1078 void ExtendPrintArea( OutputDevice* pDev, SCTAB nTab,
1079 SCCOL nStartCol, SCROW nStartRow,
1080 SCCOL& rEndCol, SCROW nEndRow ) const;
1081 SC_DLLPUBLIC SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab,
1082 SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab,
1083 ScDirection eDir );
1085 void FindAreaPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, ScMoveDirection eDirection ) const;
1086 SC_DLLPUBLIC void GetNextPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX, SCsROW nMovY,
1087 bool bMarked, bool bUnprotected, const ScMarkData& rMark ) const;
1089 bool GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, SCTAB nTab,
1090 const ScMarkData& rMark );
1092 void LimitChartArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
1093 SCCOL& rEndCol, SCROW& rEndRow );
1094 void LimitChartIfAll( ScRangeListRef& rRangeList );
1096 bool InsertRow( SCCOL nStartCol, SCTAB nStartTab,
1097 SCCOL nEndCol, SCTAB nEndTab,
1098 SCROW nStartRow, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL,
1099 const ScMarkData* pTabMark = NULL );
1100 SC_DLLPUBLIC bool InsertRow( const ScRange& rRange, ScDocument* pRefUndoDoc = NULL );
1101 void DeleteRow( SCCOL nStartCol, SCTAB nStartTab,
1102 SCCOL nEndCol, SCTAB nEndTab,
1103 SCROW nStartRow, SCSIZE nSize,
1104 ScDocument* pRefUndoDoc = NULL, bool* pUndoOutline = NULL,
1105 const ScMarkData* pTabMark = NULL );
1106 SC_DLLPUBLIC void DeleteRow( const ScRange& rRange,
1107 ScDocument* pRefUndoDoc = NULL, bool* pUndoOutline = NULL );
1108 bool InsertCol( SCROW nStartRow, SCTAB nStartTab,
1109 SCROW nEndRow, SCTAB nEndTab,
1110 SCCOL nStartCol, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL,
1111 const ScMarkData* pTabMark = NULL );
1112 SC_DLLPUBLIC bool InsertCol( const ScRange& rRange, ScDocument* pRefUndoDoc = NULL );
1113 void DeleteCol( SCROW nStartRow, SCTAB nStartTab,
1114 SCROW nEndRow, SCTAB nEndTab,
1115 SCCOL nStartCol, SCSIZE nSize,
1116 ScDocument* pRefUndoDoc = NULL, bool* pUndoOutline = NULL,
1117 const ScMarkData* pTabMark = NULL );
1118 void DeleteCol( const ScRange& rRange,
1119 ScDocument* pRefUndoDoc = NULL, bool* pUndoOutline = NULL );
1121 bool CanInsertRow( const ScRange& rRange ) const;
1122 bool CanInsertCol( const ScRange& rRange ) const;
1124 void FitBlock( const ScRange& rOld, const ScRange& rNew, bool bClear = true );
1125 bool CanFitBlock( const ScRange& rOld, const ScRange& rNew );
1127 bool IsClipOrUndo() const { return bIsClip || bIsUndo; }
1128 bool IsUndo() const { return bIsUndo; }
1129 bool IsClipboard() const { return bIsClip; }
1130 bool IsUndoEnabled() const { return mbUndoEnabled; }
1131 SC_DLLPUBLIC void EnableUndo( bool bVal );
1133 bool IsAdjustHeightEnabled() const { return mbAdjustHeightEnabled; }
1134 void EnableAdjustHeight( bool bVal ) { mbAdjustHeightEnabled = bVal; }
1135 bool IsExecuteLinkEnabled() const { return mbExecuteLinkEnabled; }
1136 void EnableExecuteLink( bool bVal ) { mbExecuteLinkEnabled = bVal; }
1137 bool IsChangeReadOnlyEnabled() const { return mbChangeReadOnlyEnabled; }
1138 void EnableChangeReadOnly( bool bVal ) { mbChangeReadOnlyEnabled = bVal; }
1139 SC_DLLPUBLIC bool IsUserInteractionEnabled() const;
1140 SC_DLLPUBLIC void EnableUserInteraction( bool bVal );
1141 SC_DLLPUBLIC sal_Int16 GetNamedRangesLockCount() const { return mnNamedRangesLockCount; }
1142 void SetNamedRangesLockCount( sal_Int16 nCount ) { mnNamedRangesLockCount = nCount; }
1143 SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, const ScMarkData* pMarks );
1144 SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, SCTAB nTab );
1145 void SetCutMode( bool bCut );
1146 bool IsCutMode();
1147 void SetClipArea( const ScRange& rArea, bool bCut = false );
1149 SC_DLLPUBLIC bool IsDocVisible() const { return bIsVisible; }
1150 void SetDocVisible( bool bSet );
1152 bool HasOLEObjectsInArea( const ScRange& rRange, const ScMarkData* pTabMark = NULL );
1154 void DeleteObjectsInArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1155 const ScMarkData& rMark );
1156 void DeleteObjectsInSelection( const ScMarkData& rMark );
1158 void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1159 const ScMarkData& rMark, sal_uInt16 nDelFlag);
1160 SC_DLLPUBLIC void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1161 SCTAB nTab, sal_uInt16 nDelFlag);
1162 void DeleteAreaTab(const ScRange& rRange, sal_uInt16 nDelFlag);
1164 void CopyToClip(const ScClipParam& rClipParam, ScDocument* pClipDoc,
1165 const ScMarkData* pMarks = NULL, bool bAllTabs = false, bool bKeepScenarioFlags = false,
1166 bool bIncludeObjects = false, bool bCloneNoteCaptions = true, bool bUseRangeForVBA = false );
1169 * Copy only raw cell values to another document. Formula cells are
1170 * converted to raw cells. No formatting info are copied.
1172 * @param rSrcRange source range in the source document
1173 * @param nDestTab table in the clip document to copy to.
1174 * @param pDestDoc document to copy to
1176 void CopyStaticToDocument(const ScRange& rSrcRange, SCTAB nDestTab, ScDocument* pDestDoc);
1179 * Copy only cell, nothing but cell to another document.
1181 * @param rSrcPos source cell position
1182 * @param rDestPos destination cell position
1183 * @param rDestDoc destination document
1185 void CopyCellToDocument( const ScAddress& rSrcPos, const ScAddress& rDestPos, ScDocument& rDestDoc );
1187 void CopyTabToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1188 SCTAB nTab, ScDocument* pClipDoc = NULL);
1190 bool InitColumnBlockPosition( sc::ColumnBlockPosition& rBlokPos, SCTAB nTab, SCCOL nCol );
1192 void CopyBlockFromClip(
1193 sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1194 const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy );
1195 void CopyNonFilteredFromClip(
1196 sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1197 const ScMarkData& rMark, SCsCOL nDx, SCROW & rClipStartRow );
1199 void StartListeningFromClip( SCCOL nCol1, SCROW nRow1,
1200 SCCOL nCol2, SCROW nRow2,
1201 const ScMarkData& rMark, sal_uInt16 nInsFlag );
1202 void BroadcastFromClip( SCCOL nCol1, SCROW nRow1,
1203 SCCOL nCol2, SCROW nRow2,
1204 const ScMarkData& rMark, sal_uInt16 nInsFlag );
1205 /** If pDestRanges is given it overrides rDestRange, rDestRange in this
1206 case is the overall encompassing range. */
1207 void CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMark,
1208 sal_uInt16 nInsFlag,
1209 ScDocument* pRefUndoDoc = NULL,
1210 ScDocument* pClipDoc = NULL,
1211 bool bResetCut = true,
1212 bool bAsLink = false,
1213 bool bIncludeFiltered = true,
1214 bool bSkipAttrForEmpty = false,
1215 const ScRangeList * pDestRanges = NULL );
1217 void CopyMultiRangeFromClip(const ScAddress& rDestPos, const ScMarkData& rMark,
1218 sal_uInt16 nInsFlag, ScDocument* pClipDoc,
1219 bool bResetCut = true, bool bAsLink = false,
1220 bool bIncludeFiltered = true,
1221 bool bSkipAttrForEmpty = false);
1223 void GetClipArea(SCCOL& nClipX, SCROW& nClipY, bool bIncludeFiltered);
1224 void GetClipStart(SCCOL& nClipX, SCROW& nClipY);
1226 bool HasClipFilteredRows();
1228 bool IsClipboardSource() const;
1230 SC_DLLPUBLIC void TransposeClip( ScDocument* pTransClip, sal_uInt16 nFlags, bool bAsLink );
1232 ScClipParam& GetClipParam();
1233 void SetClipParam(const ScClipParam& rParam);
1235 void MixDocument( const ScRange& rRange, sal_uInt16 nFunction, bool bSkipEmpty,
1236 ScDocument* pSrcDoc );
1238 void FillTab( const ScRange& rSrcArea, const ScMarkData& rMark,
1239 sal_uInt16 nFlags, sal_uInt16 nFunction,
1240 bool bSkipEmpty, bool bAsLink );
1241 void FillTabMarked( SCTAB nSrcTab, const ScMarkData& rMark,
1242 sal_uInt16 nFlags, sal_uInt16 nFunction,
1243 bool bSkipEmpty, bool bAsLink );
1245 void TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nType );
1247 SC_DLLPUBLIC void InitUndo( ScDocument* pSrcDoc, SCTAB nTab1, SCTAB nTab2,
1248 bool bColInfo = false, bool bRowInfo = false );
1249 void AddUndoTab( SCTAB nTab1, SCTAB nTab2,
1250 bool bColInfo = false, bool bRowInfo = false );
1251 SC_DLLPUBLIC void InitUndoSelected( ScDocument* pSrcDoc, const ScMarkData& rTabSelection,
1252 bool bColInfo = false, bool bRowInfo = false );
1254 // don't use anymore:
1255 void CopyToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
1256 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
1257 sal_uInt16 nFlags, bool bMarked, ScDocument* pDestDoc,
1258 const ScMarkData* pMarks = NULL, bool bColRowFlags = true);
1259 void UndoToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
1260 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
1261 sal_uInt16 nFlags, bool bMarked, ScDocument* pDestDoc,
1262 const ScMarkData* pMarks = NULL);
1264 void CopyToDocument(const ScRange& rRange,
1265 sal_uInt16 nFlags, bool bMarked, ScDocument* pDestDoc,
1266 const ScMarkData* pMarks = NULL, bool bColRowFlags = true);
1267 void UndoToDocument(const ScRange& rRange,
1268 sal_uInt16 nFlags, bool bMarked, ScDocument* pDestDoc,
1269 const ScMarkData* pMarks = NULL);
1271 void CopyScenario( SCTAB nSrcTab, SCTAB nDestTab, bool bNewScenario = false );
1272 bool TestCopyScenario( SCTAB nSrcTab, SCTAB nDestTab ) const;
1273 void MarkScenario( SCTAB nSrcTab, SCTAB nDestTab,
1274 ScMarkData& rDestMark, bool bResetMark = true,
1275 sal_uInt16 nNeededBits = 0 ) const;
1276 bool HasScenarioRange( SCTAB nTab, const ScRange& rRange ) const;
1277 SC_DLLPUBLIC const ScRangeList* GetScenarioRanges( SCTAB nTab ) const;
1279 SC_DLLPUBLIC void CopyUpdated( ScDocument* pPosDoc, ScDocument* pDestDoc );
1281 void UpdateReference(
1282 sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = NULL, bool bIncludeDraw = true,
1283 bool bUpdateNoteCaptionPos = true );
1285 SC_DLLPUBLIC void UpdateTranspose( const ScAddress& rDestPos, ScDocument* pClipDoc,
1286 const ScMarkData& rMark, ScDocument* pUndoDoc = NULL );
1288 void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
1290 SC_DLLPUBLIC void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1291 ScProgress* pProgress, const ScMarkData& rMark,
1292 sal_uLong nFillCount, FillDir eFillDir = FILL_TO_BOTTOM,
1293 FillCmd eFillCmd = FILL_LINEAR, FillDateCmd eFillDateCmd = FILL_DAY,
1294 double nStepValue = 1.0, double nMaxValue = 1E307 );
1295 OUString GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY );
1297 bool GetSelectionFunction( ScSubTotalFunc eFunc,
1298 const ScAddress& rCursor, const ScMarkData& rMark,
1299 double& rResult );
1301 SC_DLLPUBLIC const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich ) const;
1302 SC_DLLPUBLIC const SfxPoolItem* GetAttr( const ScAddress& rPos, sal_uInt16 nWhich ) const;
1303 SC_DLLPUBLIC const ScPatternAttr* GetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1304 SC_DLLPUBLIC const ScPatternAttr* GetPattern( const ScAddress& rPos ) const;
1305 SC_DLLPUBLIC const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow, SCTAB nTab ) const;
1306 const ScPatternAttr* GetSelectionPattern( const ScMarkData& rMark, bool bDeep = true );
1307 ScPatternAttr* CreateSelectionPattern( const ScMarkData& rMark, bool bDeep = true );
1308 SC_DLLPUBLIC void AddCondFormatData( const ScRangeList& rRange, SCTAB nTab, sal_uInt32 nIndex );
1309 void RemoveCondFormatData( const ScRangeList& rRange, SCTAB nTab, sal_uInt32 nIndex );
1311 SC_DLLPUBLIC ScConditionalFormat* GetCondFormat( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1312 SC_DLLPUBLIC const SfxItemSet* GetCondResult( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1313 const SfxItemSet* GetCondResult(
1314 ScRefCellValue& rCell, const ScAddress& rPos, const ScConditionalFormatList& rList,
1315 const std::vector<sal_uInt32>& rIndex ) const;
1316 const SfxPoolItem* GetEffItem( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich ) const;
1318 SC_DLLPUBLIC const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator >& GetBreakIterator();
1319 bool HasStringWeakCharacters( const OUString& rString );
1320 SC_DLLPUBLIC sal_uInt8 GetStringScriptType( const OUString& rString );
1321 SC_DLLPUBLIC sal_uInt8 GetCellScriptType( const ScAddress& rPos, sal_uLong nNumberFormat );
1322 SC_DLLPUBLIC sal_uInt8 GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab );
1323 sal_uInt8 GetRangeScriptType(
1324 sc::ColumnBlockPosition& rBlockPos, const ScAddress& rPos, SCROW nLength );
1325 sal_uInt8 GetRangeScriptType( const ScRangeList& rRanges );
1327 bool HasDetectiveOperations() const;
1328 void AddDetectiveOperation( const ScDetOpData& rData );
1329 void ClearDetectiveOperations();
1330 ScDetOpList* GetDetOpList() const { return pDetOpList; }
1331 void SetDetOpList(ScDetOpList* pNew);
1333 bool HasDetectiveObjects(SCTAB nTab) const;
1335 void GetSelectionFrame( const ScMarkData& rMark,
1336 SvxBoxItem& rLineOuter,
1337 SvxBoxInfoItem& rLineInner );
1338 void ApplySelectionFrame( const ScMarkData& rMark,
1339 const SvxBoxItem* pLineOuter,
1340 const SvxBoxInfoItem* pLineInner );
1341 void ApplyFrameAreaTab( const ScRange& rRange,
1342 const SvxBoxItem* pLineOuter,
1343 const SvxBoxInfoItem* pLineInner );
1345 void ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
1346 void ChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark );
1348 SC_DLLPUBLIC sal_uLong AddCondFormat( ScConditionalFormat* pNew, SCTAB nTab );
1349 void DeleteConditionalFormat( sal_uLong nIndex, SCTAB nTab );
1350 void ConditionalChanged( sal_uLong nKey, SCTAB nTab );
1352 void SetCondFormList( ScConditionalFormatList* pList, SCTAB nTab );
1354 SC_DLLPUBLIC sal_uLong AddValidationEntry( const ScValidationData& rNew );
1356 SC_DLLPUBLIC const ScValidationData* GetValidationEntry( sal_uLong nIndex ) const;
1358 SC_DLLPUBLIC ScConditionalFormatList* GetCondFormList( SCTAB nTab ) const;
1360 ScValidationDataList* GetValidationList() const
1361 { return pValidationList; }
1363 SC_DLLPUBLIC void ApplyAttr( SCCOL nCol, SCROW nRow, SCTAB nTab,
1364 const SfxPoolItem& rAttr );
1365 SC_DLLPUBLIC void ApplyPattern( SCCOL nCol, SCROW nRow, SCTAB nTab,
1366 const ScPatternAttr& rAttr );
1367 SC_DLLPUBLIC void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow,
1368 SCCOL nEndCol, SCROW nEndRow,
1369 const ScMarkData& rMark, const ScPatternAttr& rAttr,
1370 ScEditDataArray* pDataArray = NULL );
1371 SC_DLLPUBLIC void ApplyPatternAreaTab( SCCOL nStartCol, SCROW nStartRow,
1372 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab,
1373 const ScPatternAttr& rAttr );
1375 SC_DLLPUBLIC bool SetAttrEntries(SCCOL nCol, SCTAB nTab, ScAttrEntry* pData, SCSIZE nSize);
1377 SC_DLLPUBLIC void ApplyPatternIfNumberformatIncompatible(
1378 const ScRange& rRange, const ScMarkData& rMark,
1379 const ScPatternAttr& rPattern, short nNewType );
1381 void ApplyStyle( SCCOL nCol, SCROW nRow, SCTAB nTab,
1382 const ScStyleSheet& rStyle);
1383 void ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow,
1384 SCCOL nEndCol, SCROW nEndRow,
1385 const ScMarkData& rMark, const ScStyleSheet& rStyle);
1386 SC_DLLPUBLIC void ApplyStyleAreaTab( SCCOL nStartCol, SCROW nStartRow,
1387 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab,
1388 const ScStyleSheet& rStyle);
1390 SC_DLLPUBLIC void ApplySelectionStyle( const ScStyleSheet& rStyle, const ScMarkData& rMark );
1391 void ApplySelectionLineStyle( const ScMarkData& rMark,
1392 const ::editeng::SvxBorderLine* pLine, bool bColorOnly );
1394 const ScStyleSheet* GetStyle( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1395 const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark ) const;
1397 void StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool bRemoved,
1398 OutputDevice* pDev,
1399 double nPPTX, double nPPTY,
1400 const Fraction& rZoomX, const Fraction& rZoomY );
1402 bool IsStyleSheetUsed( const ScStyleSheet& rStyle, bool bGatherAllStyles ) const;
1404 SC_DLLPUBLIC bool ApplyFlagsTab( SCCOL nStartCol, SCROW nStartRow,
1405 SCCOL nEndCol, SCROW nEndRow,
1406 SCTAB nTab, sal_Int16 nFlags );
1407 SC_DLLPUBLIC bool RemoveFlagsTab( SCCOL nStartCol, SCROW nStartRow,
1408 SCCOL nEndCol, SCROW nEndRow,
1409 SCTAB nTab, sal_Int16 nFlags );
1411 SC_DLLPUBLIC void SetPattern( const ScAddress&, const ScPatternAttr& rAttr,
1412 bool bPutToPool = false );
1413 SC_DLLPUBLIC void SetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatternAttr& rAttr,
1414 bool bPutToPool = false );
1416 void AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1417 sal_uInt16 nFormatNo, const ScMarkData& rMark );
1418 void GetAutoFormatData( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1419 ScAutoFormatData& rData );
1420 bool SearchAndReplace( const SvxSearchItem& rSearchItem,
1421 SCCOL& rCol, SCROW& rRow, SCTAB& rTab,
1422 const ScMarkData& rMark, ScRangeList& rMatchedRanges,
1423 OUString& rUndoStr, ScDocument* pUndoDoc = NULL );
1425 // determine Col/Row of subsequent calls
1426 // (e.g. not found from the beginning, or subsequent tables)
1427 // meaning of explanation in "()" was already unclear in German
1428 static void GetSearchAndReplaceStart( const SvxSearchItem& rSearchItem,
1429 SCCOL& rCol, SCROW& rRow );
1431 bool Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
1432 SCCOL nVCol, SCROW nVRow, SCTAB nVTab,
1433 const OUString& sValStr, double& nX);
1435 SC_DLLPUBLIC void ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark,
1436 ScEditDataArray* pDataArray = NULL );
1437 void DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark );
1438 void DeleteSelectionTab( SCTAB nTab, sal_uInt16 nDelFlag, const ScMarkData& rMark );
1440 SC_DLLPUBLIC void SetColWidth( SCCOL nCol, SCTAB nTab, sal_uInt16 nNewWidth );
1441 SC_DLLPUBLIC void SetColWidthOnly( SCCOL nCol, SCTAB nTab, sal_uInt16 nNewWidth );
1442 SC_DLLPUBLIC void SetRowHeight( SCROW nRow, SCTAB nTab, sal_uInt16 nNewHeight );
1443 SC_DLLPUBLIC void SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, SCTAB nTab,
1444 sal_uInt16 nNewHeight );
1446 SC_DLLPUBLIC void SetRowHeightOnly( SCROW nStartRow, SCROW nEndRow, SCTAB nTab,
1447 sal_uInt16 nNewHeight );
1448 SC_DLLPUBLIC void SetManualHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bManual );
1450 SC_DLLPUBLIC sal_uInt16 GetColWidth( SCCOL nCol, SCTAB nTab, bool bHiddenAsZero = true ) const;
1451 SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCTAB nTab, bool bHiddenAsZero = true ) const;
1452 SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCTAB nTab, SCROW* pStartRow, SCROW* pEndRow, bool bHiddenAsZero = true ) const;
1453 SC_DLLPUBLIC sal_uLong GetRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero = true ) const;
1454 SCROW GetRowForHeight( SCTAB nTab, sal_uLong nHeight ) const;
1455 sal_uLong GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, double fScale ) const;
1456 SC_DLLPUBLIC sal_uLong GetColOffset( SCCOL nCol, SCTAB nTab, bool bHiddenAsZero = true ) const;
1457 SC_DLLPUBLIC sal_uLong GetRowOffset( SCROW nRow, SCTAB nTab, bool bHiddenAsZero = true ) const;
1459 SC_DLLPUBLIC sal_uInt16 GetOriginalWidth( SCCOL nCol, SCTAB nTab ) const;
1460 SC_DLLPUBLIC sal_uInt16 GetOriginalHeight( SCROW nRow, SCTAB nTab ) const;
1462 sal_uInt16 GetCommonWidth( SCCOL nEndCol, SCTAB nTab ) const;
1464 SCROW GetHiddenRowCount( SCROW nRow, SCTAB nTab ) const;
1466 sal_uInt16 GetOptimalColWidth( SCCOL nCol, SCTAB nTab, OutputDevice* pDev,
1467 double nPPTX, double nPPTY,
1468 const Fraction& rZoomX, const Fraction& rZoomY,
1469 bool bFormula,
1470 const ScMarkData* pMarkData = NULL,
1471 const ScColWidthParam* pParam = NULL );
1472 SC_DLLPUBLIC bool SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, sal_uInt16 nExtra,
1473 OutputDevice* pDev,
1474 double nPPTX, double nPPTY,
1475 const Fraction& rZoomX, const Fraction& rZoomY,
1476 bool bShrink );
1477 void UpdateAllRowHeights( OutputDevice* pDev,
1478 double nPPTX, double nPPTY,
1479 const Fraction& rZoomX, const Fraction& rZoomY,
1480 const ScMarkData* pTabMark = NULL );
1481 long GetNeededSize( SCCOL nCol, SCROW nRow, SCTAB nTab,
1482 OutputDevice* pDev,
1483 double nPPTX, double nPPTY,
1484 const Fraction& rZoomX, const Fraction& rZoomY,
1485 bool bWidth, bool bTotalSize = false );
1487 SC_DLLPUBLIC void ShowCol(SCCOL nCol, SCTAB nTab, bool bShow);
1488 SC_DLLPUBLIC void ShowRow(SCROW nRow, SCTAB nTab, bool bShow);
1489 SC_DLLPUBLIC void ShowRows(SCROW nRow1, SCROW nRow2, SCTAB nTab, bool bShow);
1490 SC_DLLPUBLIC void SetRowFlags( SCROW nRow, SCTAB nTab, sal_uInt8 nNewFlags );
1491 SC_DLLPUBLIC void SetRowFlags( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, sal_uInt8 nNewFlags );
1493 SC_DLLPUBLIC sal_uInt8 GetColFlags( SCCOL nCol, SCTAB nTab ) const;
1494 SC_DLLPUBLIC sal_uInt8 GetRowFlags( SCROW nRow, SCTAB nTab ) const;
1496 SC_DLLPUBLIC const ScBitMaskCompressedArray< SCROW, sal_uInt8> & GetRowFlagsArray( SCTAB nTab ) const;
1498 SC_DLLPUBLIC void GetAllRowBreaks(::std::set<SCROW>& rBreaks, SCTAB nTab, bool bPage, bool bManual) const;
1499 SC_DLLPUBLIC void GetAllColBreaks(::std::set<SCCOL>& rBreaks, SCTAB nTab, bool bPage, bool bManual) const;
1500 SC_DLLPUBLIC ScBreakType HasRowBreak(SCROW nRow, SCTAB nTab) const;
1501 SC_DLLPUBLIC ScBreakType HasColBreak(SCCOL nCol, SCTAB nTab) const;
1502 SC_DLLPUBLIC void SetRowBreak(SCROW nRow, SCTAB nTab, bool bPage, bool bManual);
1503 SC_DLLPUBLIC void SetColBreak(SCCOL nCol, SCTAB nTab, bool bPage, bool bManual);
1504 void RemoveRowBreak(SCROW nRow, SCTAB nTab, bool bPage, bool bManual);
1505 void RemoveColBreak(SCCOL nCol, SCTAB nTab, bool bPage, bool bManual);
1506 ::com::sun::star::uno::Sequence<
1507 ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData(SCTAB nTab) const;
1509 SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
1510 SC_DLLPUBLIC bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1511 SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
1512 SC_DLLPUBLIC void SetRowHidden(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bHidden);
1513 SC_DLLPUBLIC void SetColHidden(SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, bool bHidden);
1514 SC_DLLPUBLIC SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1515 SC_DLLPUBLIC SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1516 SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1518 bool RowFiltered(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
1519 bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1520 bool ColFiltered(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
1521 SC_DLLPUBLIC void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bFiltered);
1522 SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1523 SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1524 SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const;
1526 SC_DLLPUBLIC bool IsManualRowHeight(SCROW nRow, SCTAB nTab) const;
1529 * Write all column row flags to table's flag data, because not all column
1530 * row attributes are stored in the flag data members. This is necessary
1531 * for ods export.
1533 void SyncColRowFlags();
1535 /// @return the index of the last row with any set flags (auto-pagebreak is ignored).
1536 SC_DLLPUBLIC SCROW GetLastFlaggedRow( SCTAB nTab ) const;
1538 /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored).
1539 SCCOL GetLastChangedCol( SCTAB nTab ) const;
1540 /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
1541 SCROW GetLastChangedRow( SCTAB nTab ) const;
1543 SCCOL GetNextDifferentChangedCol( SCTAB nTab, SCCOL nStart) const;
1545 // if bCareManualSize is set then the row
1546 // heights are compared only if the manual size flag for
1547 // the row is set. If the bCareManualSize is not set then
1548 // the row heights are always compared.
1549 SCROW GetNextDifferentChangedRow( SCTAB nTab, SCROW nStart, bool bCareManualSize = true) const;
1551 // returns whether to export a Default style for this col or not
1552 // nDefault is setted to one possition in the current row where the Default style is
1553 bool GetColDefault( SCTAB nTab, SCCOL nCol, SCROW nLastRow, SCROW& nDefault);
1555 bool UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, bool bShow );
1556 bool UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bShow );
1558 void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, SCTAB nTab );
1559 void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, SCTAB nTab );
1561 SC_DLLPUBLIC ScPatternAttr* GetDefPattern() const;
1562 SC_DLLPUBLIC ScDocumentPool* GetPool();
1563 SC_DLLPUBLIC ScStyleSheetPool* GetStyleSheetPool() const;
1565 // PageStyle:
1566 SC_DLLPUBLIC const OUString GetPageStyle( SCTAB nTab ) const;
1567 SC_DLLPUBLIC void SetPageStyle( SCTAB nTab, const OUString& rName );
1568 Size GetPageSize( SCTAB nTab ) const;
1569 void SetPageSize( SCTAB nTab, const Size& rSize );
1570 void SetRepeatArea( SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
1571 void InvalidatePageBreaks(SCTAB nTab);
1572 void UpdatePageBreaks( SCTAB nTab, const ScRange* pUserArea = NULL );
1573 void RemoveManualBreaks( SCTAB nTab );
1574 bool HasManualBreaks( SCTAB nTab ) const;
1576 bool IsPageStyleInUse( const OUString& rStrPageStyle, SCTAB* pInTab = NULL );
1577 bool RemovePageStyleInUse( const OUString& rStrPageStyle );
1578 bool RenamePageStyleInUse( const OUString& rOld, const OUString& rNew );
1579 void ModifyStyleSheet( SfxStyleSheetBase& rPageStyle,
1580 const SfxItemSet& rChanges );
1582 void PageStyleModified( SCTAB nTab, const OUString& rNewName );
1584 SC_DLLPUBLIC bool NeedPageResetAfterTab( SCTAB nTab ) const;
1586 // Was stored in PageStyle previously. Now it exists for every table:
1587 SC_DLLPUBLIC bool HasPrintRange();
1588 SC_DLLPUBLIC sal_uInt16 GetPrintRangeCount( SCTAB nTab );
1589 SC_DLLPUBLIC const ScRange* GetPrintRange( SCTAB nTab, sal_uInt16 nPos );
1590 SC_DLLPUBLIC const ScRange* GetRepeatColRange( SCTAB nTab );
1591 SC_DLLPUBLIC const ScRange* GetRepeatRowRange( SCTAB nTab );
1592 /** Returns true, if the specified sheet is always printed. */
1593 bool IsPrintEntireSheet( SCTAB nTab ) const;
1595 /** Removes all print ranges. */
1596 SC_DLLPUBLIC void ClearPrintRanges( SCTAB nTab );
1597 /** Adds a new print ranges. */
1598 SC_DLLPUBLIC void AddPrintRange( SCTAB nTab, const ScRange& rNew );
1599 /** Marks the specified sheet to be printed completely. Deletes old print ranges on the sheet! */
1600 SC_DLLPUBLIC void SetPrintEntireSheet( SCTAB nTab );
1601 SC_DLLPUBLIC void SetRepeatColRange( SCTAB nTab, const ScRange* pNew );
1602 SC_DLLPUBLIC void SetRepeatRowRange( SCTAB nTab, const ScRange* pNew );
1603 ScPrintRangeSaver* CreatePrintRangeSaver() const;
1604 void RestorePrintRanges( const ScPrintRangeSaver& rSaver );
1606 SC_DLLPUBLIC Rectangle GetMMRect( SCCOL nStartCol, SCROW nStartRow,
1607 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero = true ) const;
1608 SC_DLLPUBLIC ScRange GetRange( SCTAB nTab, const Rectangle& rMMRect, bool bHiddenAsZero = true ) const;
1610 void UpdStlShtPtrsFrmNms();
1611 void StylesToNames();
1613 SC_DLLPUBLIC void CopyStdStylesFrom( ScDocument* pSrcDoc );
1615 rtl_TextEncoding GetSrcCharSet() const { return eSrcSet; }
1616 sal_uLong GetSrcVersion() const { return nSrcVer; }
1617 SCROW GetSrcMaxRow() const { return nSrcMaxRow; }
1619 void SetSrcCharSet( rtl_TextEncoding eNew ) { eSrcSet = eNew; }
1620 void UpdateFontCharSet();
1622 void FillInfo(
1623 ScTableInfo& rTabInfo, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1624 SCTAB nTab, double fColScale, double fRowScale, bool bPageMode, bool bFormulaMode,
1625 const ScMarkData* pMarkData = NULL );
1627 SC_DLLPUBLIC SvNumberFormatter* GetFormatTable() const;
1628 SC_DLLPUBLIC SvNumberFormatter* CreateFormatTable() const;
1630 void Sort( SCTAB nTab, const ScSortParam& rSortParam, bool bKeepQuery, ScProgress* pProgress );
1631 SCSIZE Query( SCTAB nTab, const ScQueryParam& rQueryParam, bool bKeepSub );
1632 SC_DLLPUBLIC bool CreateQueryParam( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1633 SCTAB nTab, ScQueryParam& rQueryParam );
1634 void GetUpperCellString(SCCOL nCol, SCROW nRow, SCTAB nTab, OUString& rStr);
1637 * Get a list of unique strings to use in filtering criteria. The string
1638 * values are sorted, and there are no duplicate values in the list. The
1639 * data range to use to populate the filter entries is inferred from the
1640 * database range that contains the specified cell position.
1642 bool GetFilterEntries(
1643 SCCOL nCol, SCROW nRow, SCTAB nTab, bool bFilter, std::vector<ScTypedStrData>& rStrings, bool& rHasDates);
1645 SC_DLLPUBLIC bool GetFilterEntriesArea(
1646 SCCOL nCol, SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bCaseSens,
1647 std::vector<ScTypedStrData>& rStrings, bool& rHasDates);
1649 bool GetDataEntries(
1650 SCCOL nCol, SCROW nRow, SCTAB nTab, bool bCaseSens,
1651 std::vector<ScTypedStrData>& rStrings, bool bLimit = false );
1652 bool GetFormulaEntries( ScTypedCaseStrSet& rStrings );
1654 bool HasAutoFilter( SCCOL nCol, SCROW nRow, SCTAB nTab );
1656 SC_DLLPUBLIC bool HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1657 SCTAB nTab );
1658 SC_DLLPUBLIC bool HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1659 SCTAB nTab );
1661 SfxPrinter* GetPrinter( bool bCreateIfNotExist = true );
1662 void SetPrinter( SfxPrinter* pNewPrinter );
1663 VirtualDevice* GetVirtualDevice_100th_mm();
1664 SC_DLLPUBLIC OutputDevice* GetRefDevice(); // WYSIWYG: Printer, otherwise VirtualDevice...
1666 bool GetNextSpellingCell(SCCOL& nCol, SCROW& nRow, SCTAB nTab,
1667 bool bInSel, const ScMarkData& rMark) const;
1669 bool ReplaceStyle(const SvxSearchItem& rSearchItem,
1670 SCCOL nCol, SCROW nRow, SCTAB nTab,
1671 ScMarkData& rMark, bool bIsUndo);
1673 void InvalidateTextWidth( const OUString& rStyleName );
1674 void InvalidateTextWidth( SCTAB nTab );
1675 void InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo, bool bNumFormatChanged );
1677 bool IdleCalcTextWidth();
1678 bool IdleCheckLinks();
1680 void RepaintRange( const ScRange& rRange );
1681 void RepaintRange( const ScRangeList& rRange );
1683 bool IsIdleEnabled() const { return mbIdleEnabled; }
1684 void EnableIdle(bool bDo) { mbIdleEnabled = bDo; }
1686 bool IsDetectiveDirty() const { return bDetectiveDirty; }
1687 void SetDetectiveDirty(bool bSet) { bDetectiveDirty = bSet; }
1689 sal_uInt8 GetMacroCallMode() const { return nMacroCallMode; }
1690 void SetMacroCallMode(sal_uInt8 nNew) { nMacroCallMode = nNew; }
1692 bool GetHasMacroFunc() const { return bHasMacroFunc; }
1693 void SetHasMacroFunc(bool bSet) { bHasMacroFunc = bSet; }
1695 bool CheckMacroWarn();
1697 void SetRangeOverflowType(sal_uInt32 nType) { nRangeOverflowType = nType; }
1698 bool HasRangeOverflow() const { return nRangeOverflowType != 0; }
1699 SC_DLLPUBLIC sal_uInt32 GetRangeOverflowType() const { return nRangeOverflowType; }
1701 // for broadcasting/listening
1702 void SetInsertingFromOtherDoc( bool bVal ) { bInsertingFromOtherDoc = bVal; }
1703 bool IsInsertingFromOtherDoc() const { return bInsertingFromOtherDoc; }
1704 void SetLoadingMedium( bool bVal );
1705 void SetImportingXML( bool bVal );
1706 bool IsImportingXML() const { return bImportingXML; }
1707 void SetXMLFromWrapper( bool bVal );
1708 bool IsXMLFromWrapper() const { return bXMLFromWrapper; }
1709 void SetCalcingAfterLoad( bool bVal ) { bCalcingAfterLoad = bVal; }
1710 bool IsCalcingAfterLoad() const { return bCalcingAfterLoad; }
1711 void SetNoListening( bool bVal ) { bNoListening = bVal; }
1712 bool GetNoListening() const { return bNoListening; }
1713 ScBroadcastAreaSlotMachine* GetBASM() const { return pBASM; }
1715 SC_DLLPUBLIC ScChartListenerCollection* GetChartListenerCollection() const;
1716 void SetChartListenerCollection( ScChartListenerCollection*,
1717 bool bSetChartRangeLists = false );
1718 void UpdateChart( const OUString& rName );
1719 void RestoreChartListener( const OUString& rName );
1720 SC_DLLPUBLIC void UpdateChartListenerCollection();
1721 bool IsChartListenerCollectionNeedsUpdate() const
1722 { return bChartListenerCollectionNeedsUpdate; }
1723 void SetChartListenerCollectionNeedsUpdate( bool bFlg )
1724 { bChartListenerCollectionNeedsUpdate = bFlg; }
1725 void AddOLEObjectToCollection(const OUString& rName);
1727 ScChangeViewSettings* GetChangeViewSettings() const { return pChangeViewSettings; }
1728 SC_DLLPUBLIC void SetChangeViewSettings(const ScChangeViewSettings& rNew);
1730 rtl::Reference<SvxForbiddenCharactersTable> GetForbiddenCharacters();
1731 void SetForbiddenCharacters( const rtl::Reference<SvxForbiddenCharactersTable> xNew );
1733 sal_uInt8 GetAsianCompression() const; // CharacterCompressionType values
1734 bool IsValidAsianCompression() const;
1735 void SetAsianCompression(sal_uInt8 nNew);
1737 bool GetAsianKerning() const;
1738 bool IsValidAsianKerning() const;
1739 void SetAsianKerning(bool bNew);
1740 void ApplyAsianEditSettings(ScEditEngineDefaulter& rEngine);
1742 sal_uInt8 GetEditTextDirection(SCTAB nTab) const; // EEHorizontalTextDirection values
1744 SC_DLLPUBLIC ScLkUpdMode GetLinkMode() const { return eLinkMode ;}
1745 void SetLinkMode( ScLkUpdMode nSet ) { eLinkMode = nSet;}
1747 SC_DLLPUBLIC ScMacroManager* GetMacroManager();
1750 * See if specified column has any non-empty cells.
1752 bool IsEmptyData( SCTAB nTab, SCCOL nCol ) const;
1754 void FillMatrix( ScMatrix& rMat, SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
1757 * Set an array of numerical formula results to a group of contiguous
1758 * formula cells.
1760 * @param rTopPos position of the top formula cell of a group.
1761 * @param pResults array of numeric results.
1762 * @param nLen length of numeric results.
1764 void SC_DLLPUBLIC SetFormulaResults( const ScAddress& rTopPos, const double* pResults, size_t nLen );
1766 void SC_DLLPUBLIC SetFormulaResults( const ScAddress& rTopPos, const formula::FormulaTokenRef* pResults, size_t nLen );
1768 private:
1769 ScDocument(const ScDocument& r); // disabled with no definition
1771 void FindMaxRotCol( SCTAB nTab, RowInfo* pRowInfo, SCSIZE nArrCount,
1772 SCCOL nX1, SCCOL nX2 ) const;
1774 sal_uInt16 RowDifferences( SCROW nThisRow, SCTAB nThisTab,
1775 ScDocument& rOtherDoc,
1776 SCROW nOtherRow, SCTAB nOtherTab,
1777 SCCOL nMaxCol, SCCOLROW* pOtherCols );
1778 sal_uInt16 ColDifferences( SCCOL nThisCol, SCTAB nThisTab,
1779 ScDocument& rOtherDoc,
1780 SCCOL nOtherCol, SCTAB nOtherTab,
1781 SCROW nMaxRow, SCCOLROW* pOtherRows );
1782 void FindOrder( SCCOLROW* pOtherRows, SCCOLROW nThisEndRow, SCCOLROW nOtherEndRow,
1783 bool bColumns,
1784 ScDocument& rOtherDoc, SCTAB nThisTab, SCTAB nOtherTab,
1785 SCCOLROW nEndCol, SCCOLROW* pTranslate,
1786 ScProgress* pProgress, sal_uLong nProAdd );
1788 DECL_LINK(TrackTimeHdl, void *);
1790 static ScRecursionHelper* CreateRecursionHelperInstance();
1792 public:
1793 void StartListeningArea( const ScRange& rRange,
1794 SvtListener* pListener );
1795 void EndListeningArea( const ScRange& rRange,
1796 SvtListener* pListener );
1797 /** Broadcast wrapper, calls
1798 rHint.GetCell()->Broadcast() and AreaBroadcast()
1799 and TrackFormulas() and conditional format list
1800 SourceChanged().
1801 Preferred.
1803 void Broadcast( const ScHint& rHint );
1804 /// only area, no cell broadcast
1805 void AreaBroadcast( const ScHint& rHint );
1806 /// only areas in range, no cell broadcasts
1807 void AreaBroadcastInRange( const ScRange& rRange,
1808 const ScHint& rHint );
1809 void DelBroadcastAreasInRange( const ScRange& rRange );
1810 void UpdateBroadcastAreas( UpdateRefMode eUpdateRefMode,
1811 const ScRange& rRange,
1812 SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
1815 void StartListeningCell( const ScAddress& rAddress,
1816 SvtListener* pListener );
1817 void EndListeningCell( const ScAddress& rAddress,
1818 SvtListener* pListener );
1820 void StartListeningCell( sc::StartListeningContext& rCxt, const ScAddress& rPos, SvtListener& rListener );
1821 void EndListeningCell( sc::EndListeningContext& rCxt, const ScAddress& rPos, SvtListener& rListener );
1823 void EndListeningFormulaCells( std::vector<ScFormulaCell*>& rCells );
1825 void PutInFormulaTree( ScFormulaCell* pCell );
1826 void RemoveFromFormulaTree( ScFormulaCell* pCell );
1829 * Calculate formula cells that are on the formula tree either partially,
1830 * or in full.
1832 * @param bOnlyForced when true, it only calculates those formula cells
1833 * that are marked "recalc forced".
1834 * @param bProgressBar whether or not to use progress bar.
1835 * @param bSetAllDirty when true, it marks all formula cells currently on
1836 * the formula tree dirty, which forces all of them to
1837 * be recalculated. When false, only those cells
1838 * that are marked dirty prior to this call get
1839 * recalculated.
1841 SC_DLLPUBLIC void CalcFormulaTree(
1842 bool bOnlyForced = false, bool bProgressBar = true, bool bSetAllDirty = true );
1843 void ClearFormulaTree();
1844 SC_DLLPUBLIC void RebuildFormulaGroups();
1845 void AppendToFormulaTrack( ScFormulaCell* pCell );
1846 void RemoveFromFormulaTrack( ScFormulaCell* pCell );
1847 void TrackFormulas( sal_uLong nHintId = SC_HINT_DATACHANGED );
1848 sal_uInt16 GetFormulaTrackCount() const { return nFormulaTrackCount; }
1849 bool IsInFormulaTree( ScFormulaCell* pCell ) const;
1850 bool IsInFormulaTrack( ScFormulaCell* pCell ) const;
1851 bool GetHardRecalcState() { return bHardRecalcState; }
1852 void SetHardRecalcState( bool bVal ) { bHardRecalcState = bVal; }
1853 void StartAllListeners();
1854 const ScFormulaCell* GetFormulaTree() const { return pFormulaTree; }
1855 bool HasForcedFormulas() const { return bHasForcedFormulas; }
1856 void SetForcedFormulas( bool bVal ) { bHasForcedFormulas = bVal; }
1857 sal_uLong GetFormulaCodeInTree() const { return nFormulaCodeInTree; }
1858 bool IsInInterpreter() const { return nInterpretLevel != 0; }
1859 sal_uInt16 GetInterpretLevel() { return nInterpretLevel; }
1860 void IncInterpretLevel()
1862 if ( nInterpretLevel < USHRT_MAX )
1863 nInterpretLevel++;
1865 void DecInterpretLevel()
1867 if ( nInterpretLevel )
1868 nInterpretLevel--;
1870 bool IsInMacroInterpreter() const { return nMacroInterpretLevel != 0; }
1871 sal_uInt16 GetMacroInterpretLevel() { return nMacroInterpretLevel; }
1872 void IncMacroInterpretLevel()
1874 if ( nMacroInterpretLevel < USHRT_MAX )
1875 nMacroInterpretLevel++;
1877 void DecMacroInterpretLevel()
1879 if ( nMacroInterpretLevel )
1880 nMacroInterpretLevel--;
1882 bool IsInInterpreterTableOp() const { return nInterpreterTableOpLevel != 0; }
1883 sal_uInt16 GetInterpreterTableOpLevel() { return nInterpreterTableOpLevel; }
1884 void IncInterpreterTableOpLevel()
1886 if ( nInterpreterTableOpLevel < USHRT_MAX )
1887 nInterpreterTableOpLevel++;
1889 void DecInterpreterTableOpLevel()
1891 if ( nInterpreterTableOpLevel )
1892 nInterpreterTableOpLevel--;
1894 // add a formula to be remembered for TableOp broadcasts
1895 void AddTableOpFormulaCell( ScFormulaCell* );
1896 void InvalidateLastTableOpParams() { aLastTableOpParams.bValid = false; }
1897 ScRecursionHelper& GetRecursionHelper()
1899 if (!pRecursionHelper)
1900 pRecursionHelper = CreateRecursionHelperInstance();
1901 return *pRecursionHelper;
1903 bool IsInDtorClear() const { return bInDtorClear; }
1904 void SetExpandRefs( bool bVal ) { bExpandRefs = bVal; }
1905 bool IsExpandRefs() { return bExpandRefs; }
1907 sal_uLong GetXMLImportedFormulaCount() const { return nXMLImportedFormulaCount; }
1908 void IncXMLImportedFormulaCount( sal_uLong nVal )
1910 if ( nXMLImportedFormulaCount + nVal > nXMLImportedFormulaCount )
1911 nXMLImportedFormulaCount += nVal;
1913 void DecXMLImportedFormulaCount( sal_uLong nVal )
1915 if ( nVal <= nXMLImportedFormulaCount )
1916 nXMLImportedFormulaCount -= nVal;
1917 else
1918 nXMLImportedFormulaCount = 0;
1921 void StartTrackTimer();
1923 void CompileDBFormula();
1924 void CompileDBFormula( bool bCreateFormulaString );
1925 SC_DLLPUBLIC void CompileNameFormula( bool bCreateFormulaString );
1926 void CompileColRowNameFormula();
1928 /** Maximum string length of a column, e.g. for dBase export.
1929 @return String length in octets (!) of the destination encoding. In
1930 case of non-octet encodings (e.g. UCS2) the length in code
1931 points times sizeof(sal_Unicode) is returned. */
1932 sal_Int32 GetMaxStringLen( SCTAB nTab, SCCOL nCol,
1933 SCROW nRowStart, SCROW nRowEnd,
1934 rtl_TextEncoding eCharSet ) const;
1935 /** Maximum string length of numerical cells of a column, e.g. for dBase export.
1936 @return String length in characters (!) including the decimal
1937 separator, and the decimal precision needed. */
1938 xub_StrLen GetMaxNumberStringLen( sal_uInt16& nPrecision,
1939 SCTAB nTab, SCCOL nCol,
1940 SCROW nRowStart, SCROW nRowEnd ) const;
1942 void KeyInput( const KeyEvent& rKEvt ); // TimerDelays etc.
1944 ScChangeTrack* GetChangeTrack() const { return pChangeTrack; }
1946 //! only for import filter, deletes any existing ChangeTrack via
1947 //! EndChangeTracking() and takes ownership of new ChangeTrack pTrack
1948 SC_DLLPUBLIC void SetChangeTrack( ScChangeTrack* pTrack );
1950 void StartChangeTracking();
1951 void EndChangeTracking();
1953 SC_DLLPUBLIC void CompareDocument( ScDocument& rOtherDoc );
1955 void AddUnoObject( SfxListener& rObject );
1956 void RemoveUnoObject( SfxListener& rObject );
1957 void BroadcastUno( const SfxHint &rHint );
1958 void AddUnoListenerCall( const ::com::sun::star::uno::Reference<
1959 ::com::sun::star::util::XModifyListener >& rListener,
1960 const ::com::sun::star::lang::EventObject& rEvent );
1962 void SetInLinkUpdate(bool bSet); // TableLink or AreaLink
1963 bool IsInLinkUpdate() const; // including DdeLink
1965 SC_DLLPUBLIC SfxItemPool* GetEditPool() const;
1966 SC_DLLPUBLIC SfxItemPool* GetEnginePool() const;
1967 SC_DLLPUBLIC ScFieldEditEngine& GetEditEngine();
1968 SC_DLLPUBLIC ScNoteEditEngine& GetNoteEngine();
1970 ScRefreshTimerControl* GetRefreshTimerControl() const
1971 { return pRefreshTimerControl; }
1972 ScRefreshTimerControl * const * GetRefreshTimerControlAddress() const
1973 { return &pRefreshTimerControl; }
1975 void SetPastingDrawFromOtherDoc( bool bVal )
1976 { bPastingDrawFromOtherDoc = bVal; }
1977 bool PastingDrawFromOtherDoc() const
1978 { return bPastingDrawFromOtherDoc; }
1980 /// an ID unique to each document instance
1981 sal_uInt32 GetDocumentID() const;
1983 void InvalidateStyleSheetUsage()
1984 { bStyleSheetUsageInvalid = true; }
1985 void GetSortParam( ScSortParam& rParam, SCTAB nTab );
1986 void SetSortParam( ScSortParam& rParam, SCTAB nTab );
1988 inline void SetVbaEventProcessor( const com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor >& rxVbaEvents )
1989 { mxVbaEvents = rxVbaEvents; }
1990 inline com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor >
1991 GetVbaEventProcessor() const { return mxVbaEvents; }
1993 /** Should only be GRAM_PODF or GRAM_ODFF. */
1994 void SetStorageGrammar( formula::FormulaGrammar::Grammar eGrammar );
1995 formula::FormulaGrammar::Grammar GetStorageGrammar() const
1996 { return eStorageGrammar; }
1998 SfxUndoManager* GetUndoManager();
1999 bool IsInVBAMode() const;
2000 ScRowBreakIterator* GetRowBreakIterator(SCTAB nTab) const;
2002 void AddSubTotalCell(ScFormulaCell* pCell);
2003 void RemoveSubTotalCell(ScFormulaCell* pCell);
2004 void SetSubTotalCellsDirty(const ScRange& rDirtyRange);
2005 void MarkSubTotalCells( sc::ColumnSpanSet& rSet, const ScRange& rRange, bool bVal ) const;
2007 sal_uInt16 GetTextWidth( const ScAddress& rPos ) const;
2009 sal_uInt8 GetScriptType( const ScAddress& rPos ) const;
2010 void SetScriptType( const ScAddress& rPos, sal_uInt8 nType );
2012 size_t GetFormulaHash( const ScAddress& rPos ) const;
2014 ScFormulaVectorState GetFormulaVectorState( const ScAddress& rPos ) const;
2016 formula::FormulaTokenRef ResolveStaticReference( const ScAddress& rPos );
2017 formula::FormulaTokenRef ResolveStaticReference( const ScRange& rRange );
2019 formula::VectorRefArray FetchVectorRefArray( const ScAddress& rPos, SCROW nLength );
2022 * Called whenever the value of a cell inside the document is modified.
2024 void CellContentModified();
2026 SvtBroadcaster* GetBroadcaster( const ScAddress& rPos );
2027 const SvtBroadcaster* GetBroadcaster( const ScAddress& rPos ) const;
2028 void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, const ScAddress& rTopPos, SCROW nLength );
2031 * See if specified column has any broadcaster at all.
2033 bool HasBroadcaster( SCTAB nTab, SCCOL nCol ) const;
2035 #if DEBUG_COLUMN_STORAGE
2036 SC_DLLPUBLIC void DumpFormulaGroups( SCTAB nTab, SCCOL nCol ) const;
2037 #endif
2039 private: // CLOOK-Impl-methods
2042 * Use this class as a locale variable to merge number formatter from
2043 * another document, and set NULL pointer to pFormatExchangeList when
2044 * done.
2046 class NumFmtMergeHandler
2048 public:
2049 explicit NumFmtMergeHandler(ScDocument* pDoc, ScDocument* pSrcDoc);
2050 ~NumFmtMergeHandler();
2052 private:
2053 ScDocument* mpDoc;
2056 bool TableExists( SCTAB nTab ) const;
2057 ScTable* FetchTable( SCTAB nTab );
2058 const ScTable* FetchTable( SCTAB nTab ) const;
2060 void MergeNumberFormatter(ScDocument* pSrcDoc);
2062 void ImplCreateOptions(); // Suggestion: switch to on-demand?
2063 void ImplDeleteOptions();
2065 void DeleteDrawLayer();
2066 SC_DLLPUBLIC bool DrawGetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer ) const;
2067 void DrawMovePage( sal_uInt16 nOldPos, sal_uInt16 nNewPos );
2068 void DrawCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos );
2070 void UpdateDrawPrinter();
2071 void UpdateDrawLanguages();
2072 SC_DLLPUBLIC void InitClipPtrs( ScDocument* pSourceDoc );
2074 void LoadDdeLinks(SvStream& rStream);
2075 void SaveDdeLinks(SvStream& rStream) const;
2077 void DeleteAreaLinksOnTab( SCTAB nTab );
2078 void UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode,
2079 const ScRange& r, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
2081 void CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, const ScMarkData* pMarks, bool bAllTabs);
2083 bool HasPartOfMerged( const ScRange& rRange );
2085 ScRefCellValue GetRefCellValue( const ScAddress& rPos );
2087 std::map< SCTAB, ScSortParam > mSheetSortParams;
2090 inline void ScDocument::GetSortParam( ScSortParam& rParam, SCTAB nTab )
2092 rParam = mSheetSortParams[ nTab ];
2095 inline void ScDocument::SetSortParam( ScSortParam& rParam, SCTAB nTab )
2097 mSheetSortParams[ nTab ] = rParam;
2100 #endif
2103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */