Update ooo320-m1
[ooovba.git] / sc / inc / document.hxx
blob5056b121cae0b57eecc96747aad02e62724022b1
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: document.hxx,v $
10 * $Revision: 1.115.36.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_DOCUMENT_HXX
32 #define SC_DOCUMENT_HXX
35 #include <vcl/prntypes.hxx>
36 #include <vcl/timer.hxx>
37 #include <com/sun/star/uno/Reference.hxx>
38 #include <vos/ref.hxx>
39 #include "scdllapi.h"
40 #include "table.hxx" // FastGetRowHeight (inline)
41 #include "rangelst.hxx"
42 #include "brdcst.hxx"
43 #include "tabopparams.hxx"
44 #include "formula/grammar.hxx"
45 #include <com/sun/star/chart2/XChartDocument.hpp>
46 #include "scdllapi.h"
48 #include <memory>
49 #include <map>
50 #include <set>
52 class KeyEvent;
53 class OutputDevice;
54 class SdrObject;
55 class SfxBroadcaster;
56 class SfxListener;
57 class SfxHint;
58 class SfxItemSet;
59 class SfxObjectShell;
60 class SfxBindings;
61 class SfxPoolItem;
62 class SfxItemPool;
63 class SfxPrinter;
64 class SfxStatusBarManager;
65 class SfxStyleSheetBase;
66 class SvMemoryStream;
67 class SvNumberFormatter;
68 class SvxBorderLine;
69 class SvxBoxInfoItem;
70 class SvxBoxItem;
71 class SvxBrushItem;
72 class SvxForbiddenCharactersTable;
73 class SvxLinkManager;
74 class SvxSearchItem;
75 class SvxShadowItem;
76 class Window;
77 class XColorTable;
78 class List;
80 class ScAutoFormatData;
81 class ScBaseCell;
82 class ScStringCell;
83 class ScBroadcastAreaSlotMachine;
84 class ScChangeViewSettings;
85 class ScChartCollection;
86 class ScChartListenerCollection;
87 class ScConditionalFormat;
88 class ScConditionalFormatList;
89 class ScDBCollection;
90 class ScDBData;
91 class ScDetOpData;
92 class ScDetOpList;
93 class ScDocOptions;
94 class ScDocProtection;
95 class ScDocumentPool;
96 class ScDrawLayer;
97 class ScExtDocOptions;
98 class ScExternalRefManager;
99 class ScFormulaCell;
100 class ScMacroManager;
101 class ScMarkData;
102 class ScOutlineTable;
103 class ScPatternAttr;
104 class ScPrintRangeSaver;
105 class ScRangeData;
106 class ScRangeName;
107 class ScStyleSheet;
108 class ScStyleSheetPool;
109 class ScTable;
110 class ScTableProtection;
111 class ScTokenArray;
112 class ScValidationData;
113 class ScValidationDataList;
114 class ScViewOptions;
115 class ScStrCollection;
116 class TypedScStrCollection;
117 class ScChangeTrack;
118 class ScFieldEditEngine;
119 class ScNoteEditEngine;
120 struct ScConsolidateParam;
121 class ScDPObject;
122 class ScDPCollection;
123 class ScMatrix;
124 class ScScriptTypeData;
125 class ScPoolHelper;
126 struct ScSortParam;
127 class ScRefreshTimerControl;
128 class ScUnoListenerCalls;
129 class ScUnoRefList;
130 class ScRecursionHelper;
131 struct RowInfo;
132 struct ScTableInfo;
133 struct ScTabOpParam;
134 class VirtualDevice;
135 class ScAutoNameCache;
136 class ScTemporaryChartLock;
137 class ScLookupCache;
138 struct ScLookupCacheMapImpl;
139 class SfxUndoManager;
140 class ScFormulaParserPool;
141 struct ScClipParam;
142 struct ScClipRangeNameData;
143 struct ScSetStringParam;
145 namespace com { namespace sun { namespace star {
146 namespace lang {
147 class XMultiServiceFactory;
148 struct EventObject;
150 namespace i18n {
151 class XBreakIterator;
153 namespace util {
154 class XModifyListener;
156 namespace embed {
157 class XEmbeddedObject;
159 namespace sheet {
160 struct TablePageBreakData;
162 } } }
164 namespace com { namespace sun { namespace star { namespace document {
165 class XVbaEventsHelper;
166 } } } }
167 #include <svtools/zforlist.hxx>
169 #ifdef _ZFORLIST_DECLARE_TABLE
170 class SvNumberFormatterIndexTable;
171 #else
172 class Table;
173 typedef Table SvNumberFormatterIndexTable;
174 #endif
177 #define SC_DOC_NEW 0xFFFF
179 #define SC_MACROCALL_ALLOWED 0
180 #define SC_MACROCALL_NOTALLOWED 1
181 #define SC_MACROCALL_ASK 2
183 #define SC_ASIANCOMPRESSION_INVALID 0xff
184 #define SC_ASIANKERNING_INVALID 0xff
187 enum ScDocumentMode
189 SCDOCMODE_DOCUMENT,
190 SCDOCMODE_CLIP,
191 SCDOCMODE_UNDO
195 struct ScDocStat
197 String aDocName;
198 SCTAB nTableCount;
199 ULONG nCellCount;
200 USHORT nPageCount;
203 // The constant parameters to CopyBlockFromClip
204 struct ScCopyBlockFromClipParams
206 ScDocument* pRefUndoDoc;
207 ScDocument* pClipDoc;
208 USHORT nInsFlag;
209 SCTAB nTabStart;
210 SCTAB nTabEnd;
211 BOOL bAsLink;
212 BOOL bSkipAttrForEmpty;
216 // for loading of binary file format symbol string cells which need font conversion
217 struct ScSymbolStringCellEntry
219 ScStringCell* pCell;
220 SCROW nRow;
224 // -----------------------------------------------------------------------
226 // DDE link modes
227 const BYTE SC_DDE_DEFAULT = 0;
228 const BYTE SC_DDE_ENGLISH = 1;
229 const BYTE SC_DDE_TEXT = 2;
230 const BYTE SC_DDE_IGNOREMODE = 255; /// For usage in FindDdeLink() only!
233 // -----------------------------------------------------------------------
235 class ScDocument
237 friend class ScDocumentIterator;
238 friend class ScValueIterator;
239 friend class ScDBQueryDataIterator;
240 friend class ScCellIterator;
241 friend class ScQueryCellIterator;
242 friend class ScHorizontalCellIterator;
243 friend class ScHorizontalAttrIterator;
244 friend class ScDocAttrIterator;
245 friend class ScAttrRectIterator;
246 friend class ScDocShell;
248 private:
249 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager;
251 vos::ORef<ScPoolHelper> xPoolHelper;
253 SfxUndoManager* mpUndoManager;
254 ScFieldEditEngine* pEditEngine; // uses pEditPool from xPoolHelper
255 ScNoteEditEngine* pNoteEngine; // uses pEditPool from xPoolHelper
256 SfxItemPool* pNoteItemPool; // SfxItemPool to be used if pDrawLayer not created.
257 SfxObjectShell* pShell;
258 SfxPrinter* pPrinter;
259 VirtualDevice* pVirtualDevice_100th_mm;
260 ScDrawLayer* pDrawLayer; // SdrModel
261 XColorTable* pColorTable;
262 ScConditionalFormatList* pCondFormList; // bedingte Formate
263 ScValidationDataList* pValidationList; // Gueltigkeit
264 SvNumberFormatterIndexTable* pFormatExchangeList; // zum Umsetzen von Zahlenformaten
265 ScTable* pTab[MAXTABCOUNT];
266 ScRangeName* pRangeName;
267 ScDBCollection* pDBCollection;
268 ScDPCollection* pDPCollection;
269 ScChartCollection* pChartCollection;
270 std::auto_ptr< ScTemporaryChartLock > apTemporaryChartLock;
271 ScPatternAttr* pSelectionAttr; // Attribute eines Blocks
272 mutable SvxLinkManager* pLinkManager;
273 ScFormulaCell* pFormulaTree; // Berechnungsbaum Start
274 ScFormulaCell* pEOFormulaTree; // Berechnungsbaum Ende, letzte Zelle
275 ScFormulaCell* pFormulaTrack; // BroadcastTrack Start
276 ScFormulaCell* pEOFormulaTrack; // BrodcastTrack Ende, letzte Zelle
277 ScBroadcastAreaSlotMachine* pBASM; // BroadcastAreas
278 ScChartListenerCollection* pChartListenerCollection;
279 ScStrCollection* pOtherObjects; // non-chart OLE objects
280 SvMemoryStream* pClipData;
281 ScDetOpList* pDetOpList;
282 ScChangeTrack* pChangeTrack;
283 SfxBroadcaster* pUnoBroadcaster;
284 ScUnoListenerCalls* pUnoListenerCalls;
285 ScUnoRefList* pUnoRefUndoList;
286 ScChangeViewSettings* pChangeViewSettings;
287 ScScriptTypeData* pScriptTypeData;
288 ScRefreshTimerControl* pRefreshTimerControl;
289 vos::ORef<SvxForbiddenCharactersTable> xForbiddenCharacters;
291 ScFieldEditEngine* pCacheFieldEditEngine;
293 ::std::auto_ptr<ScDocProtection> pDocProtection;
294 ::std::auto_ptr<ScClipParam> mpClipParam;
296 ::std::auto_ptr<ScExternalRefManager> pExternalRefMgr;
297 ::std::auto_ptr<ScMacroManager> mpMacroMgr;
300 // mutable for lazy construction
301 mutable ::std::auto_ptr< ScFormulaParserPool >
302 mxFormulaParserPool; /// Pool for all external formula parsers used by this document.
304 String aDocName; // opt: Dokumentname
305 String aDocCodeName; // opt: Dokumentname
306 ScRangePairListRef xColNameRanges;
307 ScRangePairListRef xRowNameRanges;
309 ScViewOptions* pViewOptions; // View-Optionen
310 ScDocOptions* pDocOptions; // Dokument-Optionen
311 ScExtDocOptions* pExtDocOptions; // fuer Import etc.
312 ScConsolidateParam* pConsolidateDlgData;
314 ScRecursionHelper* pRecursionHelper; // information for recursive and iterative cell formulas
316 ScAutoNameCache* pAutoNameCache; // for automatic name lookup during CompileXML
318 ScLookupCacheMapImpl* pLookupCacheMapImpl; // cache for lookups like VLOOKUP and MATCH
320 sal_Int64 nUnoObjectId; // counted up for UNO objects
322 sal_uInt32 nRangeOverflowType; // used in (xml) loading for overflow warnings
324 ScRange aEmbedRange;
325 ScAddress aCurTextWidthCalcPos;
326 ScAddress aOnlineSpellPos; // within whole document
327 ScRange aVisSpellRange;
328 ScAddress aVisSpellPos; // within aVisSpellRange (see nVisSpellState)
330 Timer aTrackTimer;
332 com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > mxVbaEventsHelper;
334 public:
335 ScTabOpList aTableOpList; // list of ScInterpreterTableOpParams currently in use
336 ScInterpreterTableOpParams aLastTableOpParams; // remember last params
337 private:
339 LanguageType eLanguage; // default language
340 LanguageType eCjkLanguage; // default language for asian text
341 LanguageType eCtlLanguage; // default language for complex text
342 CharSet eSrcSet; // Einlesen: Quell-Zeichensatz
344 /** The compiler grammar used in document storage. GRAM_PODF for ODF 1.1
345 documents, GRAM_ODFF for ODF 1.2 documents. */
346 formula::FormulaGrammar::Grammar eStorageGrammar;
348 /** The compiler grammar used in ODF import after brackets had been
349 stripped (which they shouldn't, but until that's fixed) by the XML
350 importer. */
351 formula::FormulaGrammar::Grammar eXmlImportGrammar;
353 ULONG nFormulaCodeInTree; // FormelRPN im Formelbaum
354 ULONG nXMLImportedFormulaCount; // progress count during XML import
355 USHORT nInterpretLevel; // >0 wenn im Interpreter
356 USHORT nMacroInterpretLevel; // >0 wenn Macro im Interpreter
357 USHORT nInterpreterTableOpLevel; // >0 if in Interpreter TableOp
358 SCTAB nMaxTableNumber;
359 USHORT nSrcVer; // Dateiversion (Laden/Speichern)
360 SCROW nSrcMaxRow; // Zeilenzahl zum Laden/Speichern
361 USHORT nFormulaTrackCount;
362 USHORT nHardRecalcState; // 0: soft, 1: hard-warn, 2: hard
363 SCTAB nVisibleTab; // fuer OLE etc.
365 ScLkUpdMode eLinkMode;
367 BOOL bAutoCalc; // Automatisch Berechnen
368 BOOL bAutoCalcShellDisabled; // in/von/fuer ScDocShell disabled
369 // ob noch ForcedFormulas berechnet werden muessen,
370 // im Zusammenspiel mit ScDocShell SetDocumentModified,
371 // AutoCalcShellDisabled und TrackFormulas
372 BOOL bForcedFormulaPending;
373 BOOL bCalculatingFormulaTree;
374 BOOL bIsClip;
375 BOOL bIsUndo;
376 BOOL bIsVisible; // set from view ctor
378 BOOL bIsEmbedded; // Embedded-Bereich anzeigen/anpassen ?
380 // kein SetDirty bei ScFormulaCell::CompileTokenArray sondern am Ende
381 // von ScDocument::CompileAll[WithFormats], CopyScenario, CopyBlockFromClip
382 BOOL bNoSetDirty;
383 // kein Broadcast, keine Listener aufbauen waehrend aus einem anderen
384 // Doc (per Filter o.ae.) inserted wird, erst bei CompileAll / CalcAfterLoad
385 BOOL bInsertingFromOtherDoc;
386 bool bLoadingMedium;
387 BOOL bImportingXML; // special handling of formula text
388 BOOL bXMLFromWrapper; // distinguish ScXMLImportWrapper from external component
389 BOOL bCalcingAfterLoad; // in CalcAfterLoad TRUE
390 // wenn temporaer keine Listener auf/abgebaut werden sollen
391 BOOL bNoListening;
392 BOOL bLoadingDone;
393 BOOL bIdleDisabled;
394 BOOL bInLinkUpdate; // TableLink or AreaLink
395 BOOL bChartListenerCollectionNeedsUpdate;
396 // ob RC_FORCED Formelzellen im Dokument sind/waren (einmal an immer an)
397 BOOL bHasForcedFormulas;
398 // ob das Doc gerade zerstoert wird (kein Notify-Tracking etc. mehr)
399 BOOL bInDtorClear;
400 // ob bei Spalte/Zeile einfuegen am Rand einer Referenz die Referenz
401 // erweitert wird, wird in jedem UpdateReference aus InputOptions geholt,
402 // gesetzt und am Ende von UpdateReference zurueckgesetzt
403 BOOL bExpandRefs;
404 // fuer Detektiv-Update, wird bei jeder Aenderung an Formeln gesetzt
405 BOOL bDetectiveDirty;
407 BYTE nMacroCallMode; // Makros per Warnung-Dialog disabled?
408 BOOL bHasMacroFunc; // valid only after loading
410 BYTE nVisSpellState;
412 BYTE nAsianCompression;
413 BYTE nAsianKerning;
414 BOOL bSetDrawDefaults;
416 BOOL bPastingDrawFromOtherDoc;
418 BYTE nInDdeLinkUpdate; // originating DDE links (stacked bool)
420 BOOL bInUnoBroadcast;
421 BOOL bInUnoListenerCall;
422 formula::FormulaGrammar::Grammar eGrammar;
424 mutable BOOL bStyleSheetUsageInvalid;
426 bool mbUndoEnabled;
427 bool mbAdjustHeightEnabled;
428 bool mbExecuteLinkEnabled;
429 bool mbChangeReadOnlyEnabled; // allow changes in read-only document (for API import filters)
430 bool mbStreamValidLocked;
432 sal_Int16 mnNamedRangesLockCount;
434 // for worksheet calculate event
435 ::std::vector< SCTAB > maTabs;
437 public:
438 SC_DLLPUBLIC ULONG GetCellCount() const; // alle Zellen
439 ULONG GetWeightedCount() const; // Formeln und Edit staerker gewichtet
440 ULONG GetCodeCount() const; // RPN-Code in Formeln
441 DECL_LINK( GetUserDefinedColor, USHORT * );
443 public:
444 SC_DLLPUBLIC ScDocument( ScDocumentMode eMode = SCDOCMODE_DOCUMENT,
445 SfxObjectShell* pDocShell = NULL );
446 SC_DLLPUBLIC ~ScDocument();
448 inline ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
449 GetServiceManager() const { return xServiceManager; }
451 SC_DLLPUBLIC const String& GetName() const { return aDocName; }
452 void SetName( const String& r ) { aDocName = r; }
453 const String& GetCodeName() const { return aDocCodeName; }
454 void SetCodeName( const String& r ) { aDocCodeName = r; }
456 void GetDocStat( ScDocStat& rDocStat );
458 SC_DLLPUBLIC void InitDrawLayer( SfxObjectShell* pDocShell = NULL );
459 XColorTable* GetColorTable();
461 SC_DLLPUBLIC SvxLinkManager* GetLinkManager() const;
463 SC_DLLPUBLIC const ScDocOptions& GetDocOptions() const;
464 SC_DLLPUBLIC void SetDocOptions( const ScDocOptions& rOpt );
465 SC_DLLPUBLIC const ScViewOptions& GetViewOptions() const;
466 SC_DLLPUBLIC void SetViewOptions( const ScViewOptions& rOpt );
467 void SetPrintOptions();
469 ScExtDocOptions* GetExtDocOptions() { return pExtDocOptions; }
470 SC_DLLPUBLIC void SetExtDocOptions( ScExtDocOptions* pNewOptions );
472 void GetLanguage( LanguageType& rLatin, LanguageType& rCjk, LanguageType& rCtl ) const;
473 void SetLanguage( LanguageType eLatin, LanguageType eCjk, LanguageType eCtl );
475 void SetDrawDefaults();
477 void SetConsolidateDlgData( const ScConsolidateParam* pData );
478 const ScConsolidateParam* GetConsolidateDlgData() const { return pConsolidateDlgData; }
480 void Clear( sal_Bool bFromDestructor = sal_False );
482 ScFieldEditEngine* CreateFieldEditEngine();
483 void DisposeFieldEditEngine(ScFieldEditEngine*& rpEditEngine);
485 SC_DLLPUBLIC ScRangeName* GetRangeName();
486 void SetRangeName( ScRangeName* pNewRangeName );
487 SCTAB GetMaxTableNumber() { return nMaxTableNumber; }
488 void SetMaxTableNumber(SCTAB nNumber) { nMaxTableNumber = nNumber; }
490 ScRangePairList* GetColNameRanges() { return &xColNameRanges; }
491 ScRangePairList* GetRowNameRanges() { return &xRowNameRanges; }
492 ScRangePairListRef& GetColNameRangesRef() { return xColNameRanges; }
493 ScRangePairListRef& GetRowNameRangesRef() { return xRowNameRanges; }
495 SC_DLLPUBLIC ScDBCollection* GetDBCollection() const;
496 void SetDBCollection( ScDBCollection* pNewDBCollection,
497 BOOL bRemoveAutoFilter = FALSE );
498 ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab,
499 BOOL bStartOnly = FALSE) const;
500 ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const;
502 //UNUSED2008-05 ScRangeData* GetRangeAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab,
503 //UNUSED2008-05 BOOL bStartOnly = FALSE) const;
504 SC_DLLPUBLIC ScRangeData* GetRangeAtBlock( const ScRange& rBlock, String* pName=NULL ) const;
506 SC_DLLPUBLIC ScDPCollection* GetDPCollection();
507 ScDPObject* GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
508 ScDPObject* GetDPAtBlock( const ScRange& rBlock ) const;
509 SC_DLLPUBLIC ScChartCollection* GetChartCollection() const;
511 void StopTemporaryChartLock();
513 void EnsureGraphicNames();
515 SdrObject* GetObjectAtPoint( SCTAB nTab, const Point& rPos );
516 BOOL HasChartAtPoint( SCTAB nTab, const Point& rPos, String* pName = NULL );
518 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > GetChartByName( const String& rChartName );
519 SC_DLLPUBLIC void GetChartRanges( const String& rChartName, ::std::vector< ScRangeList >& rRanges, ScDocument* pSheetNameDoc );
520 void SetChartRanges( const String& rChartName, const ::std::vector< ScRangeList >& rRanges );
522 void UpdateChartArea( const String& rChartName, const ScRange& rNewArea,
523 BOOL bColHeaders, BOOL bRowHeaders, BOOL bAdd );
524 void UpdateChartArea( const String& rChartName,
525 const ScRangeListRef& rNewList,
526 BOOL bColHeaders, BOOL bRowHeaders, BOOL bAdd );
527 void GetOldChartParameters( const String& rName,
528 ScRangeList& rRanges, BOOL& rColHeaders, BOOL& rRowHeaders );
529 ::com::sun::star::uno::Reference<
530 ::com::sun::star::embed::XEmbeddedObject >
531 FindOleObjectByName( const String& rName );
533 SC_DLLPUBLIC void MakeTable( SCTAB nTab,bool _bNeedsNameCheck = true );
535 SCTAB GetVisibleTab() const { return nVisibleTab; }
536 SC_DLLPUBLIC void SetVisibleTab(SCTAB nTab) { nVisibleTab = nTab; }
538 SC_DLLPUBLIC BOOL HasTable( SCTAB nTab ) const;
539 SC_DLLPUBLIC BOOL GetName( SCTAB nTab, String& rName ) const;
540 SC_DLLPUBLIC BOOL GetCodeName( SCTAB nTab, String& rName ) const;
541 SC_DLLPUBLIC BOOL SetCodeName( SCTAB nTab, String& rName );
542 SC_DLLPUBLIC BOOL GetTable( const String& rName, SCTAB& rTab ) const;
543 SC_DLLPUBLIC inline SCTAB GetTableCount() const { return nMaxTableNumber; }
544 SvNumberFormatterIndexTable* GetFormatExchangeList() const { return pFormatExchangeList; }
546 SC_DLLPUBLIC ScDocProtection* GetDocProtection() const;
547 SC_DLLPUBLIC void SetDocProtection(const ScDocProtection* pProtect);
548 SC_DLLPUBLIC BOOL IsDocProtected() const;
549 BOOL IsDocEditable() const;
550 SC_DLLPUBLIC BOOL IsTabProtected( SCTAB nTab ) const;
551 SC_DLLPUBLIC ScTableProtection* GetTabProtection( SCTAB nTab ) const;
552 SC_DLLPUBLIC void SetTabProtection(SCTAB nTab, const ScTableProtection* pProtect);
553 void CopyTabProtection(SCTAB nTabSrc, SCTAB nTabDest);
555 void LockTable(SCTAB nTab);
556 void UnlockTable(SCTAB nTab);
558 BOOL IsBlockEditable( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
559 SCCOL nEndCol, SCROW nEndRow,
560 BOOL* pOnlyNotBecauseOfMatrix = NULL ) const;
561 BOOL IsSelectionEditable( const ScMarkData& rMark,
562 BOOL* pOnlyNotBecauseOfMatrix = NULL ) const;
563 BOOL HasSelectedBlockMatrixFragment( SCCOL nStartCol, SCROW nStartRow,
564 SCCOL nEndCol, SCROW nEndRow,
565 const ScMarkData& rMark ) const;
567 BOOL GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMatrix );
569 BOOL IsEmbedded() const;
570 void GetEmbedded( ScRange& rRange ) const;
571 void SetEmbedded( const ScRange& rRange );
572 void ResetEmbedded();
573 Rectangle GetEmbeddedRect() const; // 1/100 mm
574 void SetEmbedded( const Rectangle& rRect ); // aus VisArea (1/100 mm)
575 void SnapVisArea( Rectangle& rRect ) const; // 1/100 mm
577 SC_DLLPUBLIC BOOL ValidTabName( const String& rName ) const;
578 SC_DLLPUBLIC BOOL ValidNewTabName( const String& rName ) const;
579 SC_DLLPUBLIC void CreateValidTabName(String& rName) const;
580 SC_DLLPUBLIC BOOL InsertTab( SCTAB nPos, const String& rName,
581 BOOL bExternalDocument = FALSE );
582 SC_DLLPUBLIC BOOL DeleteTab( SCTAB nTab, ScDocument* pRefUndoDoc = NULL );
583 SC_DLLPUBLIC BOOL RenameTab( SCTAB nTab, const String& rName,
584 BOOL bUpdateRef = TRUE,
585 BOOL bExternalDocument = FALSE );
586 BOOL MoveTab( SCTAB nOldPos, SCTAB nNewPos );
587 BOOL CopyTab( SCTAB nOldPos, SCTAB nNewPos,
588 const ScMarkData* pOnlyMarked = NULL );
589 SC_DLLPUBLIC ULONG TransferTab(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos,
590 BOOL bInsertNew = TRUE,
591 BOOL bResultsOnly = FALSE );
592 SC_DLLPUBLIC void TransferDrawPage(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos);
593 SC_DLLPUBLIC void SetVisible( SCTAB nTab, BOOL bVisible );
594 SC_DLLPUBLIC BOOL IsVisible( SCTAB nTab ) const;
595 BOOL IsStreamValid( SCTAB nTab ) const;
596 void SetStreamValid( SCTAB nTab, BOOL bSet, BOOL bIgnoreLock = FALSE );
597 void LockStreamValid( bool bLock );
598 bool IsStreamValidLocked() const { return mbStreamValidLocked; }
599 BOOL IsPendingRowHeights( SCTAB nTab ) const;
600 void SetPendingRowHeights( SCTAB nTab, BOOL bSet );
601 SC_DLLPUBLIC void SetLayoutRTL( SCTAB nTab, BOOL bRTL );
602 SC_DLLPUBLIC BOOL IsLayoutRTL( SCTAB nTab ) const;
603 BOOL IsNegativePage( SCTAB nTab ) const;
604 SC_DLLPUBLIC void SetScenario( SCTAB nTab, BOOL bFlag );
605 SC_DLLPUBLIC BOOL IsScenario( SCTAB nTab ) const;
606 SC_DLLPUBLIC void GetScenarioData( SCTAB nTab, String& rComment,
607 Color& rColor, USHORT& rFlags ) const;
608 SC_DLLPUBLIC void SetScenarioData( SCTAB nTab, const String& rComment,
609 const Color& rColor, USHORT nFlags );
610 void GetScenarioFlags( SCTAB nTab, USHORT& rFlags ) const;
611 SC_DLLPUBLIC BOOL IsActiveScenario( SCTAB nTab ) const;
612 SC_DLLPUBLIC void SetActiveScenario( SCTAB nTab, BOOL bActive ); // nur fuer Undo etc.
613 SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const;
614 SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const;
615 void SetGrammar( formula::FormulaGrammar::Grammar eGram );
616 SC_DLLPUBLIC BYTE GetLinkMode( SCTAB nTab ) const;
617 BOOL IsLinked( SCTAB nTab ) const;
618 SC_DLLPUBLIC const String& GetLinkDoc( SCTAB nTab ) const;
619 const String& GetLinkFlt( SCTAB nTab ) const;
620 const String& GetLinkOpt( SCTAB nTab ) const;
621 SC_DLLPUBLIC const String& GetLinkTab( SCTAB nTab ) const;
622 ULONG GetLinkRefreshDelay( SCTAB nTab ) const;
623 void SetLink( SCTAB nTab, BYTE nMode, const String& rDoc,
624 const String& rFilter, const String& rOptions,
625 const String& rTabName, ULONG nRefreshDelay );
626 BOOL HasLink( const String& rDoc,
627 const String& rFilter, const String& rOptions ) const;
628 SC_DLLPUBLIC BOOL LinkExternalTab( SCTAB& nTab, const String& aDocTab,
629 const String& aFileName,
630 const String& aTabName );
632 bool HasExternalRefManager() const { return pExternalRefMgr.get(); }
633 SC_DLLPUBLIC ScExternalRefManager* GetExternalRefManager() const;
634 bool IsInExternalReferenceMarking() const;
635 void MarkUsedExternalReferences();
636 bool MarkUsedExternalReferences( ScTokenArray & rArr );
638 /** Returns the pool containing external formula parsers. Creates the pool
639 on first call. */
640 ScFormulaParserPool& GetFormulaParserPool() const;
642 BOOL HasDdeLinks() const;
643 BOOL HasAreaLinks() const;
644 void UpdateExternalRefLinks();
645 void UpdateDdeLinks();
646 void UpdateAreaLinks();
648 // originating DDE links
649 void IncInDdeLinkUpdate() { if ( nInDdeLinkUpdate < 255 ) ++nInDdeLinkUpdate; }
650 void DecInDdeLinkUpdate() { if ( nInDdeLinkUpdate ) --nInDdeLinkUpdate; }
651 BOOL IsInDdeLinkUpdate() const { return nInDdeLinkUpdate != 0; }
653 SC_DLLPUBLIC void CopyDdeLinks( ScDocument* pDestDoc ) const;
654 void DisconnectDdeLinks();
656 // Fuer StarOne Api:
657 USHORT GetDdeLinkCount() const;
658 BOOL UpdateDdeLink( const String& rAppl, const String& rTopic, const String& rItem );
660 /** Tries to find a DDE link with the specified connection data.
661 @param rnDdePos (out-param) Returns the index of the DDE link (does not include other links from link manager).
662 @return true = DDE link found, rnDdePos valid. */
663 SC_DLLPUBLIC bool FindDdeLink( const String& rAppl, const String& rTopic, const String& rItem, BYTE nMode, USHORT& rnDdePos );
665 /** Returns the connection data of the specified DDE link.
666 @param nDdePos Index of the DDE link (does not include other links from link manager).
667 @param rAppl (out-param) The application name.
668 @param rTopic (out-param) The DDE topic.
669 @param rItem (out-param) The DDE item.
670 @return true = DDE link found, out-parameters valid. */
671 bool GetDdeLinkData( USHORT nDdePos, String& rAppl, String& rTopic, String& rItem ) const;
672 /** Returns the link mode of the specified DDE link.
673 @param nDdePos Index of the DDE link (does not include other links from link manager).
674 @param rnMode (out-param) The link mode of the specified DDE link.
675 @return true = DDE link found, rnMode valid. */
676 bool GetDdeLinkMode( USHORT nDdePos, BYTE& rnMode ) const;
677 /** Returns the result matrix of the specified DDE link.
678 @param nDdePos Index of the DDE link (does not include other links from link manager).
679 @return The result matrix, if the DDE link has been found, 0 otherwise. */
680 SC_DLLPUBLIC const ScMatrix* GetDdeLinkResultMatrix( USHORT nDdePos ) const;
682 /** Tries to find a DDE link or creates a new, if not extant.
683 @param pResults If not 0, sets the matrix as as DDE link result matrix (also for existing links).
684 @return true = DDE link found; false = Unpredictable error occured, no DDE link created. */
685 SC_DLLPUBLIC bool CreateDdeLink( const String& rAppl, const String& rTopic, const String& rItem, BYTE nMode, ScMatrix* pResults = NULL );
686 /** Sets a result matrix for the specified DDE link.
687 @param nDdePos Index of the DDE link (does not include other links from link manager).
688 @param pResults The array containing all results of the DDE link (intrusive-ref-counted, do not delete).
689 @return true = DDE link found and matrix set. */
690 bool SetDdeLinkResultMatrix( USHORT nDdePos, ScMatrix* pResults );
693 SfxBindings* GetViewBindings();
694 SfxObjectShell* GetDocumentShell() const { return pShell; }
695 ScDrawLayer* GetDrawLayer() { return pDrawLayer; }
696 SfxBroadcaster* GetDrawBroadcaster(); // zwecks Header-Vermeidung
697 void BeginDrawUndo();
699 void BeginUnoRefUndo();
700 bool HasUnoRefUndo() const { return ( pUnoRefUndoList != NULL ); }
701 ScUnoRefList* EndUnoRefUndo(); // must be deleted by caller!
702 sal_Int64 GetNewUnoId();
703 void AddUnoRefChange( sal_Int64 nId, const ScRangeList& rOldRanges );
705 // #109985#
706 sal_Bool IsChart( const SdrObject* pObject );
708 SC_DLLPUBLIC void UpdateAllCharts();
709 void UpdateChartRef( UpdateRefMode eUpdateRefMode,
710 SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
711 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
712 SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
713 //! setzt nur die neue RangeList, keine ChartListener o.ae.
714 void SetChartRangeList( const String& rChartName,
715 const ScRangeListRef& rNewRangeListRef );
717 BOOL HasControl( SCTAB nTab, const Rectangle& rMMRect );
718 void InvalidateControls( Window* pWin, SCTAB nTab, const Rectangle& rMMRect );
720 void StartAnimations( SCTAB nTab, Window* pWin );
722 BOOL HasBackgroundDraw( SCTAB nTab, const Rectangle& rMMRect );
723 BOOL HasAnyDraw( SCTAB nTab, const Rectangle& rMMRect );
725 SC_DLLPUBLIC ScOutlineTable* GetOutlineTable( SCTAB nTab, BOOL bCreate = FALSE );
726 BOOL SetOutlineTable( SCTAB nTab, const ScOutlineTable* pNewOutline );
728 void DoAutoOutline( SCCOL nStartCol, SCROW nStartRow,
729 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab );
731 BOOL DoSubTotals( SCTAB nTab, ScSubTotalParam& rParam );
732 void RemoveSubTotals( SCTAB nTab, ScSubTotalParam& rParam );
733 BOOL TestRemoveSubTotals( SCTAB nTab, const ScSubTotalParam& rParam );
734 BOOL HasSubTotalCells( const ScRange& rRange );
736 SC_DLLPUBLIC void PutCell( const ScAddress&, ScBaseCell* pCell, BOOL bForceTab = FALSE );
737 //UNUSED2009-05 SC_DLLPUBLIC void PutCell( const ScAddress&, ScBaseCell* pCell,
738 //UNUSED2009-05 ULONG nFormatIndex, BOOL bForceTab = FALSE);
739 SC_DLLPUBLIC void PutCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell,
740 BOOL bForceTab = FALSE );
741 SC_DLLPUBLIC void PutCell(SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell,
742 ULONG nFormatIndex, BOOL bForceTab = FALSE);
743 // return TRUE = Zahlformat gesetzt
744 SC_DLLPUBLIC BOOL SetString(
745 SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString, ScSetStringParam* pParam = NULL );
746 SC_DLLPUBLIC void SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rVal );
747 void SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const USHORT nError);
749 SC_DLLPUBLIC void InsertMatrixFormula(SCCOL nCol1, SCROW nRow1,
750 SCCOL nCol2, SCROW nRow2,
751 const ScMarkData& rMark,
752 const String& rFormula,
753 const ScTokenArray* p = NULL,
754 const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT );
755 SC_DLLPUBLIC void InsertTableOp(const ScTabOpParam& rParam, // Mehrfachoperation
756 SCCOL nCol1, SCROW nRow1,
757 SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark);
759 SC_DLLPUBLIC void GetString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString );
760 SC_DLLPUBLIC void GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString );
761 SC_DLLPUBLIC double GetValue( const ScAddress& );
762 SC_DLLPUBLIC void GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, double& rValue );
763 SC_DLLPUBLIC double RoundValueAsShown( double fVal, ULONG nFormat );
764 SC_DLLPUBLIC void GetNumberFormat( SCCOL nCol, SCROW nRow, SCTAB nTab,
765 sal_uInt32& rFormat );
766 sal_uInt32 GetNumberFormat( const ScRange& rRange ) const;
767 SC_DLLPUBLIC sal_uInt32 GetNumberFormat( const ScAddress& ) const;
768 /** If no number format attribute is set and the cell
769 pointer passed is of type formula cell, the calculated
770 number format of the formula cell is returned. pCell
771 may be NULL. */
772 SC_DLLPUBLIC void GetNumberFormatInfo( short& nType, ULONG& nIndex,
773 const ScAddress& rPos, const ScBaseCell* pCell ) const;
774 void GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rFormula,
775 BOOL bAsciiExport = FALSE ) const;
776 SC_DLLPUBLIC void GetCellType( SCCOL nCol, SCROW nRow, SCTAB nTab, CellType& rCellType ) const;
777 SC_DLLPUBLIC CellType GetCellType( const ScAddress& rPos ) const;
778 SC_DLLPUBLIC void GetCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell*& rpCell ) const;
779 SC_DLLPUBLIC ScBaseCell* GetCell( const ScAddress& rPos ) const;
781 //UNUSED2008-05 void RefreshNoteFlags();
783 SC_DLLPUBLIC BOOL HasData( SCCOL nCol, SCROW nRow, SCTAB nTab );
784 SC_DLLPUBLIC BOOL HasStringData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
785 SC_DLLPUBLIC BOOL HasValueData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
786 BOOL HasStringCells( const ScRange& rRange ) const;
788 /** Returns true, if there is any data to create a selection list for rPos. */
789 BOOL HasSelectionData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
791 /** Returns the pointer to a cell note object at the passed cell address. */
792 ScPostIt* GetNote( const ScAddress& rPos );
793 /** Sets the passed note at the cell with the passed cell address. */
794 void TakeNote( const ScAddress& rPos, ScPostIt*& rpNote );
795 /** Returns and forgets the cell note object at the passed cell address. */
796 ScPostIt* ReleaseNote( const ScAddress& rPos );
797 /** Returns the pointer to an existing or created cell note object at the passed cell address. */
798 SC_DLLPUBLIC ScPostIt* GetOrCreateNote( const ScAddress& rPos );
799 /** Deletes the note at the passed cell address. */
800 void DeleteNote( const ScAddress& rPos );
801 /** Creates the captions of all uninitialized cell notes in the specified sheet.
802 @param bForced True = always create all captions, false = skip when Undo is disabled. */
803 void InitializeNoteCaptions( SCTAB nTab, bool bForced = false );
804 /** Creates the captions of all uninitialized cell notes in all sheets.
805 @param bForced True = always create all captions, false = skip when Undo is disabled. */
806 void InitializeAllNoteCaptions( bool bForced = false );
808 BOOL ExtendMergeSel( SCCOL nStartCol, SCROW nStartRow,
809 SCCOL& rEndCol, SCROW& rEndRow, const ScMarkData& rMark,
810 BOOL bRefresh = FALSE, BOOL bAttrs = FALSE );
811 BOOL ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
812 SCCOL& rEndCol, SCROW& rEndRow, SCTAB nTab,
813 BOOL bRefresh = FALSE, BOOL bAttrs = FALSE );
814 BOOL ExtendMerge( ScRange& rRange, BOOL bRefresh = FALSE, BOOL bAttrs = FALSE );
815 BOOL ExtendTotalMerge( ScRange& rRange );
816 SC_DLLPUBLIC BOOL ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow,
817 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab );
818 SC_DLLPUBLIC BOOL ExtendOverlapped( ScRange& rRange );
820 BOOL RefreshAutoFilter( SCCOL nStartCol, SCROW nStartRow,
821 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab );
823 SC_DLLPUBLIC void DoMergeContents( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
824 SCCOL nEndCol, SCROW nEndRow );
825 // ohne Ueberpruefung:
826 SC_DLLPUBLIC void DoMerge( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
827 SCCOL nEndCol, SCROW nEndRow, bool bDeleteCaptions = true );
828 void RemoveMerge( SCCOL nCol, SCROW nRow, SCTAB nTab );
830 BOOL IsBlockEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
831 SCCOL nEndCol, SCROW nEndRow, bool bIgnoreNotes = false ) const;
832 BOOL IsPrintEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
833 SCCOL nEndCol, SCROW nEndRow,
834 BOOL bLeftIsEmpty = FALSE,
835 ScRange* pLastRange = NULL,
836 Rectangle* pLastMM = NULL ) const;
838 void SkipOverlapped( SCCOL& rCol, SCROW& rRow, SCTAB nTab ) const;
839 BOOL IsHorOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
840 BOOL IsVerOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
842 SC_DLLPUBLIC BOOL HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
843 SCCOL nCol2, SCROW nRow2, SCTAB nTab2, USHORT nMask );
844 SC_DLLPUBLIC BOOL HasAttrib( const ScRange& rRange, USHORT nMask );
846 void GetBorderLines( SCCOL nCol, SCROW nRow, SCTAB nTab,
847 const SvxBorderLine** ppLeft,
848 const SvxBorderLine** ppTop,
849 const SvxBorderLine** ppRight,
850 const SvxBorderLine** ppBottom ) const;
852 void ResetChanged( const ScRange& rRange );
854 void SetDirty();
855 void SetDirty( const ScRange& );
856 void SetTableOpDirty( const ScRange& ); // for Interpreter TableOp
857 void InterpretDirtyCells( const ScRangeList& rRanges );
858 void CalcAll();
859 SC_DLLPUBLIC void CalcAfterLoad();
860 void CompileAll();
861 void CompileXML();
863 ScAutoNameCache* GetAutoNameCache() { return pAutoNameCache; }
865 /** Creates a ScLookupCache cache for the range if it
866 doesn't already exist. */
867 ScLookupCache & GetLookupCache( const ScRange & rRange );
868 /** Only ScLookupCache ctor uses AddLookupCache(), do not
869 use elsewhere! */
870 void AddLookupCache( ScLookupCache & rCache );
871 /** Only ScLookupCache dtor uses RemoveLookupCache(), do
872 not use elsewhere! */
873 void RemoveLookupCache( ScLookupCache & rCache );
874 /** Zap all caches. */
875 void ClearLookupCaches();
877 // Automatisch Berechnen
878 void SetAutoCalc( BOOL bNewAutoCalc );
879 BOOL GetAutoCalc() const { return bAutoCalc; }
880 // Automatisch Berechnen in/von/fuer ScDocShell disabled
881 void SetAutoCalcShellDisabled( BOOL bNew ) { bAutoCalcShellDisabled = bNew; }
882 BOOL IsAutoCalcShellDisabled() const { return bAutoCalcShellDisabled; }
883 // ForcedFormulas zu berechnen
884 void SetForcedFormulaPending( BOOL bNew ) { bForcedFormulaPending = bNew; }
885 BOOL IsForcedFormulaPending() const { return bForcedFormulaPending; }
886 // if CalcFormulaTree() is currently running
887 BOOL IsCalculatingFormulaTree() { return bCalculatingFormulaTree; }
889 // for worksheet calculate event
890 BOOL FireCalculateEvent( SCTAB nTab );
891 void AddCalculateTable( SCTAB nTab );
893 USHORT GetErrCode( const ScAddress& ) const;
895 bool ShrinkToDataArea(SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow) const;
897 void GetDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
898 SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld ) const;
899 SC_DLLPUBLIC BOOL GetCellArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const;
900 SC_DLLPUBLIC BOOL GetTableArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const;
901 SC_DLLPUBLIC BOOL GetPrintArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow,
902 BOOL bNotes = TRUE ) const;
903 SC_DLLPUBLIC BOOL GetPrintAreaHor( SCTAB nTab, SCROW nStartRow, SCROW nEndRow,
904 SCCOL& rEndCol, BOOL bNotes = TRUE ) const;
905 SC_DLLPUBLIC BOOL GetPrintAreaVer( SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol,
906 SCROW& rEndRow, BOOL bNotes = TRUE ) const;
907 void InvalidateTableArea();
909 SC_DLLPUBLIC BOOL GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow ) const;
911 void ExtendPrintArea( OutputDevice* pDev, SCTAB nTab,
912 SCCOL nStartCol, SCROW nStartRow,
913 SCCOL& rEndCol, SCROW nEndRow );
915 SC_DLLPUBLIC SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab,
916 SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab,
917 ScDirection eDir );
919 void FindAreaPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX, SCsROW nMovY );
920 SC_DLLPUBLIC void GetNextPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX, SCsROW nMovY,
921 BOOL bMarked, BOOL bUnprotected, const ScMarkData& rMark );
923 BOOL GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, SCTAB nTab,
924 const ScMarkData& rMark );
926 void LimitChartArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
927 SCCOL& rEndCol, SCROW& rEndRow );
928 void LimitChartIfAll( ScRangeListRef& rRangeList );
930 BOOL InsertRow( SCCOL nStartCol, SCTAB nStartTab,
931 SCCOL nEndCol, SCTAB nEndTab,
932 SCROW nStartRow, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL,
933 const ScMarkData* pTabMark = NULL );
934 SC_DLLPUBLIC BOOL InsertRow( const ScRange& rRange, ScDocument* pRefUndoDoc = NULL );
935 void DeleteRow( SCCOL nStartCol, SCTAB nStartTab,
936 SCCOL nEndCol, SCTAB nEndTab,
937 SCROW nStartRow, SCSIZE nSize,
938 ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL,
939 const ScMarkData* pTabMark = NULL );
940 SC_DLLPUBLIC void DeleteRow( const ScRange& rRange,
941 ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL );
942 BOOL InsertCol( SCROW nStartRow, SCTAB nStartTab,
943 SCROW nEndRow, SCTAB nEndTab,
944 SCCOL nStartCol, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL,
945 const ScMarkData* pTabMark = NULL );
946 SC_DLLPUBLIC BOOL InsertCol( const ScRange& rRange, ScDocument* pRefUndoDoc = NULL );
947 void DeleteCol( SCROW nStartRow, SCTAB nStartTab,
948 SCROW nEndRow, SCTAB nEndTab,
949 SCCOL nStartCol, SCSIZE nSize,
950 ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL,
951 const ScMarkData* pTabMark = NULL );
952 void DeleteCol( const ScRange& rRange,
953 ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL );
955 BOOL CanInsertRow( const ScRange& rRange ) const;
956 BOOL CanInsertCol( const ScRange& rRange ) const;
958 void FitBlock( const ScRange& rOld, const ScRange& rNew, BOOL bClear = TRUE );
959 BOOL CanFitBlock( const ScRange& rOld, const ScRange& rNew );
961 BOOL IsClipOrUndo() const { return bIsClip || bIsUndo; }
962 BOOL IsUndo() const { return bIsUndo; }
963 BOOL IsClipboard() const { return bIsClip; }
964 bool IsUndoEnabled() const { return mbUndoEnabled; }
965 void EnableUndo( bool bVal );
967 bool IsAdjustHeightEnabled() const { return mbAdjustHeightEnabled; }
968 void EnableAdjustHeight( bool bVal ) { mbAdjustHeightEnabled = bVal; }
969 bool IsExecuteLinkEnabled() const { return mbExecuteLinkEnabled; }
970 void EnableExecuteLink( bool bVal ) { mbExecuteLinkEnabled = bVal; }
971 bool IsChangeReadOnlyEnabled() const { return mbChangeReadOnlyEnabled; }
972 void EnableChangeReadOnly( bool bVal ) { mbChangeReadOnlyEnabled = bVal; }
973 SC_DLLPUBLIC sal_Int16 GetNamedRangesLockCount() const { return mnNamedRangesLockCount; }
974 void SetNamedRangesLockCount( sal_Int16 nCount ) { mnNamedRangesLockCount = nCount; }
975 SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, const ScMarkData* pMarks );
976 SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, SCTAB nTab );
977 void SetCutMode( BOOL bCut );
978 BOOL IsCutMode();
979 void SetClipArea( const ScRange& rArea, BOOL bCut = FALSE );
981 SC_DLLPUBLIC BOOL IsDocVisible() const { return bIsVisible; }
982 void SetDocVisible( BOOL bSet );
984 BOOL HasOLEObjectsInArea( const ScRange& rRange, const ScMarkData* pTabMark = NULL );
986 void DeleteObjectsInArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
987 const ScMarkData& rMark );
988 void DeleteObjectsInSelection( const ScMarkData& rMark );
990 void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
991 const ScMarkData& rMark, USHORT nDelFlag);
992 void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
993 SCTAB nTab, USHORT nDelFlag);
994 void DeleteAreaTab(const ScRange& rRange, USHORT nDelFlag);
996 void CopyToClip(const ScClipParam& rClipParam, ScDocument* pClipDoc,
997 const ScMarkData* pMarks = NULL, bool bAllTabs = false, bool bKeepScenarioFlags = false,
998 bool bIncludeObjects = false, bool bCloneNoteCaptions = true);
1000 void CopyTabToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1001 SCTAB nTab, ScDocument* pClipDoc = NULL);
1002 void CopyBlockFromClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1003 const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy,
1004 const ScCopyBlockFromClipParams* pCBFCP );
1005 void CopyNonFilteredFromClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1006 const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy,
1007 const ScCopyBlockFromClipParams* pCBFCP,
1008 SCROW & rClipStartRow );
1009 void StartListeningFromClip( SCCOL nCol1, SCROW nRow1,
1010 SCCOL nCol2, SCROW nRow2,
1011 const ScMarkData& rMark, USHORT nInsFlag );
1012 void BroadcastFromClip( SCCOL nCol1, SCROW nRow1,
1013 SCCOL nCol2, SCROW nRow2,
1014 const ScMarkData& rMark, USHORT nInsFlag );
1015 /** If pDestRanges is given it overrides rDestRange, rDestRange in this
1016 case is the overall encompassing range. */
1017 void CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMark,
1018 USHORT nInsFlag,
1019 ScDocument* pRefUndoDoc = NULL,
1020 ScDocument* pClipDoc = NULL,
1021 BOOL bResetCut = TRUE,
1022 BOOL bAsLink = FALSE,
1023 BOOL bIncludeFiltered = TRUE,
1024 BOOL bSkipAttrForEmpty = FALSE,
1025 const ScRangeList * pDestRanges = NULL );
1027 void CopyMultiRangeFromClip(const ScAddress& rDestPos, const ScMarkData& rMark,
1028 sal_uInt16 nInsFlag, ScDocument* pClipDoc,
1029 bool bResetCut = true, bool bAsLink = false,
1030 bool bIncludeFiltered = true,
1031 bool bSkipAttrForEmpty = false);
1033 void GetClipArea(SCCOL& nClipX, SCROW& nClipY, BOOL bIncludeFiltered);
1034 void GetClipStart(SCCOL& nClipX, SCROW& nClipY);
1036 BOOL HasClipFilteredRows();
1038 BOOL IsClipboardSource() const;
1040 SC_DLLPUBLIC void TransposeClip( ScDocument* pTransClip, USHORT nFlags, BOOL bAsLink );
1042 ScClipParam& GetClipParam();
1043 void SetClipParam(const ScClipParam& rParam);
1045 void MixDocument( const ScRange& rRange, USHORT nFunction, BOOL bSkipEmpty,
1046 ScDocument* pSrcDoc );
1048 void FillTab( const ScRange& rSrcArea, const ScMarkData& rMark,
1049 USHORT nFlags, USHORT nFunction,
1050 BOOL bSkipEmpty, BOOL bAsLink );
1051 void FillTabMarked( SCTAB nSrcTab, const ScMarkData& rMark,
1052 USHORT nFlags, USHORT nFunction,
1053 BOOL bSkipEmpty, BOOL bAsLink );
1055 void TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nType );
1057 SC_DLLPUBLIC void InitUndo( ScDocument* pSrcDoc, SCTAB nTab1, SCTAB nTab2,
1058 BOOL bColInfo = FALSE, BOOL bRowInfo = FALSE );
1059 void AddUndoTab( SCTAB nTab1, SCTAB nTab2,
1060 BOOL bColInfo = FALSE, BOOL bRowInfo = FALSE );
1061 SC_DLLPUBLIC void InitUndoSelected( ScDocument* pSrcDoc, const ScMarkData& rTabSelection,
1062 BOOL bColInfo = FALSE, BOOL bRowInfo = FALSE );
1064 // nicht mehr benutzen:
1065 void CopyToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
1066 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
1067 USHORT nFlags, BOOL bMarked, ScDocument* pDestDoc,
1068 const ScMarkData* pMarks = NULL, BOOL bColRowFlags = TRUE);
1069 void UndoToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
1070 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
1071 USHORT nFlags, BOOL bMarked, ScDocument* pDestDoc,
1072 const ScMarkData* pMarks = NULL);
1074 void CopyToDocument(const ScRange& rRange,
1075 USHORT nFlags, BOOL bMarked, ScDocument* pDestDoc,
1076 const ScMarkData* pMarks = NULL, BOOL bColRowFlags = TRUE);
1077 void UndoToDocument(const ScRange& rRange,
1078 USHORT nFlags, BOOL bMarked, ScDocument* pDestDoc,
1079 const ScMarkData* pMarks = NULL);
1081 void CopyScenario( SCTAB nSrcTab, SCTAB nDestTab, BOOL bNewScenario = FALSE );
1082 BOOL TestCopyScenario( SCTAB nSrcTab, SCTAB nDestTab ) const;
1083 void MarkScenario( SCTAB nSrcTab, SCTAB nDestTab,
1084 ScMarkData& rDestMark, BOOL bResetMark = TRUE,
1085 USHORT nNeededBits = 0 ) const;
1086 BOOL HasScenarioRange( SCTAB nTab, const ScRange& rRange ) const;
1087 SC_DLLPUBLIC const ScRangeList* GetScenarioRanges( SCTAB nTab ) const;
1089 SC_DLLPUBLIC void CopyUpdated( ScDocument* pPosDoc, ScDocument* pDestDoc );
1091 void UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
1092 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
1093 SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
1094 ScDocument* pUndoDoc = NULL, BOOL bIncludeDraw = TRUE );
1096 SC_DLLPUBLIC void UpdateTranspose( const ScAddress& rDestPos, ScDocument* pClipDoc,
1097 const ScMarkData& rMark, ScDocument* pUndoDoc = NULL );
1099 void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
1101 void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1102 const ScMarkData& rMark,
1103 ULONG nFillCount, FillDir eFillDir = FILL_TO_BOTTOM,
1104 FillCmd eFillCmd = FILL_LINEAR, FillDateCmd eFillDateCmd = FILL_DAY,
1105 double nStepValue = 1.0, double nMaxValue = 1E307);
1106 String GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY );
1108 BOOL GetSelectionFunction( ScSubTotalFunc eFunc,
1109 const ScAddress& rCursor, const ScMarkData& rMark,
1110 double& rResult );
1112 SC_DLLPUBLIC const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, USHORT nWhich ) const;
1113 SC_DLLPUBLIC const ScPatternAttr* GetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1114 SC_DLLPUBLIC const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow, SCTAB nTab ) const;
1115 const ScPatternAttr* GetSelectionPattern( const ScMarkData& rMark, BOOL bDeep = TRUE );
1116 ScPatternAttr* CreateSelectionPattern( const ScMarkData& rMark, BOOL bDeep = TRUE );
1118 const ScConditionalFormat* GetCondFormat( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1119 SC_DLLPUBLIC const SfxItemSet* GetCondResult( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1120 const SfxPoolItem* GetEffItem( SCCOL nCol, SCROW nRow, SCTAB nTab, USHORT nWhich ) const;
1122 SC_DLLPUBLIC const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator >& GetBreakIterator();
1123 BOOL HasStringWeakCharacters( const String& rString );
1124 SC_DLLPUBLIC BYTE GetStringScriptType( const String& rString );
1125 SC_DLLPUBLIC BYTE GetCellScriptType( ScBaseCell* pCell, ULONG nNumberFormat );
1126 SC_DLLPUBLIC BYTE GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell = NULL );
1128 BOOL HasDetectiveOperations() const;
1129 void AddDetectiveOperation( const ScDetOpData& rData );
1130 void ClearDetectiveOperations();
1131 ScDetOpList* GetDetOpList() const { return pDetOpList; }
1132 void SetDetOpList(ScDetOpList* pNew);
1134 BOOL HasDetectiveObjects(SCTAB nTab) const;
1136 void GetSelectionFrame( const ScMarkData& rMark,
1137 SvxBoxItem& rLineOuter,
1138 SvxBoxInfoItem& rLineInner );
1139 void ApplySelectionFrame( const ScMarkData& rMark,
1140 const SvxBoxItem* pLineOuter,
1141 const SvxBoxInfoItem* pLineInner );
1142 void ApplyFrameAreaTab( const ScRange& rRange,
1143 const SvxBoxItem* pLineOuter,
1144 const SvxBoxInfoItem* pLineInner );
1146 void ClearSelectionItems( const USHORT* pWhich, const ScMarkData& rMark );
1147 void ChangeSelectionIndent( BOOL bIncrement, const ScMarkData& rMark );
1149 SC_DLLPUBLIC ULONG AddCondFormat( const ScConditionalFormat& rNew );
1150 SC_DLLPUBLIC void FindConditionalFormat( ULONG nKey, ScRangeList& rRanges );
1151 SC_DLLPUBLIC void FindConditionalFormat( ULONG nKey, ScRangeList& rRanges, SCTAB nTab );
1152 void ConditionalChanged( ULONG nKey );
1154 SC_DLLPUBLIC ULONG AddValidationEntry( const ScValidationData& rNew );
1156 SC_DLLPUBLIC const ScValidationData* GetValidationEntry( ULONG nIndex ) const;
1158 ScConditionalFormatList* GetCondFormList() const // Ref-Undo
1159 { return pCondFormList; }
1160 void SetCondFormList(ScConditionalFormatList* pNew);
1162 ScValidationDataList* GetValidationList() const
1163 { return pValidationList; }
1165 SC_DLLPUBLIC void ApplyAttr( SCCOL nCol, SCROW nRow, SCTAB nTab,
1166 const SfxPoolItem& rAttr );
1167 SC_DLLPUBLIC void ApplyPattern( SCCOL nCol, SCROW nRow, SCTAB nTab,
1168 const ScPatternAttr& rAttr );
1169 SC_DLLPUBLIC void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow,
1170 SCCOL nEndCol, SCROW nEndRow,
1171 const ScMarkData& rMark, const ScPatternAttr& rAttr,
1172 ScEditDataArray* pDataArray = NULL );
1173 SC_DLLPUBLIC void ApplyPatternAreaTab( SCCOL nStartCol, SCROW nStartRow,
1174 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab,
1175 const ScPatternAttr& rAttr );
1176 SC_DLLPUBLIC void ApplyPatternIfNumberformatIncompatible(
1177 const ScRange& rRange, const ScMarkData& rMark,
1178 const ScPatternAttr& rPattern, short nNewType );
1180 void ApplyStyle( SCCOL nCol, SCROW nRow, SCTAB nTab,
1181 const ScStyleSheet& rStyle);
1182 void ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow,
1183 SCCOL nEndCol, SCROW nEndRow,
1184 const ScMarkData& rMark, const ScStyleSheet& rStyle);
1185 SC_DLLPUBLIC void ApplyStyleAreaTab( SCCOL nStartCol, SCROW nStartRow,
1186 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab,
1187 const ScStyleSheet& rStyle);
1189 void ApplySelectionStyle( const ScStyleSheet& rStyle, const ScMarkData& rMark );
1190 void ApplySelectionLineStyle( const ScMarkData& rMark,
1191 const SvxBorderLine* pLine, BOOL bColorOnly );
1193 const ScStyleSheet* GetStyle( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1194 const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark ) const;
1196 void StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, BOOL bRemoved,
1197 OutputDevice* pDev,
1198 double nPPTX, double nPPTY,
1199 const Fraction& rZoomX, const Fraction& rZoomY );
1201 BOOL IsStyleSheetUsed( const ScStyleSheet& rStyle, BOOL bGatherAllStyles ) const;
1203 SC_DLLPUBLIC BOOL ApplyFlagsTab( SCCOL nStartCol, SCROW nStartRow,
1204 SCCOL nEndCol, SCROW nEndRow,
1205 SCTAB nTab, INT16 nFlags );
1206 BOOL RemoveFlagsTab( SCCOL nStartCol, SCROW nStartRow,
1207 SCCOL nEndCol, SCROW nEndRow,
1208 SCTAB nTab, INT16 nFlags );
1210 SC_DLLPUBLIC void SetPattern( const ScAddress&, const ScPatternAttr& rAttr,
1211 BOOL bPutToPool = FALSE );
1212 SC_DLLPUBLIC void SetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatternAttr& rAttr,
1213 BOOL bPutToPool = FALSE );
1214 void DeleteNumberFormat( const sal_uInt32* pDelKeys, sal_uInt32 nCount );
1216 void AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1217 USHORT nFormatNo, const ScMarkData& rMark );
1218 void GetAutoFormatData( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1219 ScAutoFormatData& rData );
1220 BOOL SearchAndReplace( const SvxSearchItem& rSearchItem,
1221 SCCOL& rCol, SCROW& rRow, SCTAB& rTab,
1222 ScMarkData& rMark,
1223 String& rUndoStr, ScDocument* pUndoDoc = NULL );
1225 // Col/Row von Folgeaufrufen bestimmen
1226 // (z.B. nicht gefunden von Anfang, oder folgende Tabellen)
1227 static void GetSearchAndReplaceStart( const SvxSearchItem& rSearchItem,
1228 SCCOL& rCol, SCROW& rRow );
1230 BOOL Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
1231 SCCOL nVCol, SCROW nVRow, SCTAB nVTab,
1232 const String& sValStr, double& nX);
1234 void ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark,
1235 ScEditDataArray* pDataArray = NULL );
1236 void DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark );
1237 void DeleteSelectionTab( SCTAB nTab, USHORT nDelFlag, const ScMarkData& rMark );
1241 SC_DLLPUBLIC void SetColWidth( SCCOL nCol, SCTAB nTab, USHORT nNewWidth );
1242 SC_DLLPUBLIC void SetRowHeight( SCROW nRow, SCTAB nTab, USHORT nNewHeight );
1243 SC_DLLPUBLIC void SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, SCTAB nTab,
1244 USHORT nNewHeight );
1245 void SetManualHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, BOOL bManual );
1247 SC_DLLPUBLIC USHORT GetColWidth( SCCOL nCol, SCTAB nTab ) const;
1248 SC_DLLPUBLIC USHORT GetRowHeight( SCROW nRow, SCTAB nTab ) const;
1249 SC_DLLPUBLIC ULONG GetRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab ) const;
1250 ULONG GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, double fScale ) const;
1251 SC_DLLPUBLIC const ScSummableCompressedArray< SCROW, USHORT> & GetRowHeightArray( SCTAB nTab ) const;
1252 SC_DLLPUBLIC ULONG GetColOffset( SCCOL nCol, SCTAB nTab ) const;
1253 SC_DLLPUBLIC ULONG GetRowOffset( SCROW nRow, SCTAB nTab ) const;
1255 SC_DLLPUBLIC USHORT GetOriginalWidth( SCCOL nCol, SCTAB nTab ) const;
1256 SC_DLLPUBLIC USHORT GetOriginalHeight( SCROW nRow, SCTAB nTab ) const;
1258 USHORT GetCommonWidth( SCCOL nEndCol, SCTAB nTab ) const;
1260 // All FastGet...() methods have no check for valid nTab!
1261 // They access ScCompressedArray objects, so using the
1262 // single row taking ones in loops to access a sequence of
1263 // single rows is no good idea! Use specialized range
1264 // taking methods instead, or iterators.
1265 SC_DLLPUBLIC ULONG FastGetRowHeight( SCROW nStartRow, SCROW nEndRow,
1266 SCTAB nTab ) const;
1267 inline ULONG FastGetScaledRowHeight( SCROW nStartRow, SCROW nEndRow,
1268 SCTAB nTab, double fScale ) const;
1269 SC_DLLPUBLIC inline USHORT FastGetRowHeight( SCROW nRow, SCTAB nTab ) const;
1270 inline SCROW FastGetRowForHeight( SCTAB nTab, ULONG nHeight ) const;
1271 /** No check for flags whether row is hidden, height value
1272 is returned unconditionally. */
1273 inline USHORT FastGetOriginalRowHeight( SCROW nRow, SCTAB nTab ) const;
1275 SCROW GetHiddenRowCount( SCROW nRow, SCTAB nTab ) const;
1277 USHORT GetOptimalColWidth( SCCOL nCol, SCTAB nTab, OutputDevice* pDev,
1278 double nPPTX, double nPPTY,
1279 const Fraction& rZoomX, const Fraction& rZoomY,
1280 BOOL bFormula,
1281 const ScMarkData* pMarkData = NULL,
1282 BOOL bSimpleTextImport = FALSE );
1283 SC_DLLPUBLIC BOOL SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, USHORT nExtra,
1284 OutputDevice* pDev,
1285 double nPPTX, double nPPTY,
1286 const Fraction& rZoomX, const Fraction& rZoomY,
1287 BOOL bShrink );
1288 void UpdateAllRowHeights( OutputDevice* pDev,
1289 double nPPTX, double nPPTY,
1290 const Fraction& rZoomX, const Fraction& rZoomY,
1291 const ScMarkData* pTabMark = NULL );
1292 long GetNeededSize( SCCOL nCol, SCROW nRow, SCTAB nTab,
1293 OutputDevice* pDev,
1294 double nPPTX, double nPPTY,
1295 const Fraction& rZoomX, const Fraction& rZoomY,
1296 BOOL bWidth, BOOL bTotalSize = FALSE );
1298 SC_DLLPUBLIC void ShowCol(SCCOL nCol, SCTAB nTab, BOOL bShow);
1299 SC_DLLPUBLIC void ShowRow(SCROW nRow, SCTAB nTab, BOOL bShow);
1300 SC_DLLPUBLIC void ShowRows(SCROW nRow1, SCROW nRow2, SCTAB nTab, BOOL bShow);
1301 SC_DLLPUBLIC void SetColFlags( SCCOL nCol, SCTAB nTab, BYTE nNewFlags );
1302 SC_DLLPUBLIC void SetRowFlags( SCROW nRow, SCTAB nTab, BYTE nNewFlags );
1303 SC_DLLPUBLIC void SetRowFlags( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, BYTE nNewFlags );
1305 SC_DLLPUBLIC BYTE GetColFlags( SCCOL nCol, SCTAB nTab ) const;
1306 SC_DLLPUBLIC BYTE GetRowFlags( SCROW nRow, SCTAB nTab ) const;
1308 SC_DLLPUBLIC const ScBitMaskCompressedArray< SCROW, BYTE> & GetRowFlagsArray( SCTAB nTab ) const;
1309 SC_DLLPUBLIC ScBitMaskCompressedArray< SCROW, BYTE> & GetRowFlagsArrayModifiable( SCTAB nTab );
1311 SC_DLLPUBLIC void GetAllRowBreaks(::std::set<SCROW>& rBreaks, SCTAB nTab, bool bPage, bool bManual) const;
1312 SC_DLLPUBLIC void GetAllColBreaks(::std::set<SCCOL>& rBreaks, SCTAB nTab, bool bPage, bool bManual) const;
1313 SC_DLLPUBLIC ScBreakType HasRowBreak(SCROW nRow, SCTAB nTab) const;
1314 SC_DLLPUBLIC ScBreakType HasColBreak(SCCOL nCol, SCTAB nTab) const;
1315 SC_DLLPUBLIC void SetRowBreak(SCROW nRow, SCTAB nTab, bool bPage, bool bManual);
1316 SC_DLLPUBLIC void SetColBreak(SCCOL nCol, SCTAB nTab, bool bPage, bool bManual);
1317 void RemoveRowBreak(SCROW nRow, SCTAB nTab, bool bPage, bool bManual);
1318 void RemoveColBreak(SCCOL nCol, SCTAB nTab, bool bPage, bool bManual);
1319 ::com::sun::star::uno::Sequence<
1320 ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData(SCTAB nTab) const;
1322 SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL);
1323 SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW& rLastRow);
1324 SC_DLLPUBLIC bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
1325 SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL& rLastCol);
1326 SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL);
1327 SC_DLLPUBLIC void SetRowHidden(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bHidden);
1328 SC_DLLPUBLIC void SetColHidden(SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, bool bHidden);
1329 SC_DLLPUBLIC SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
1330 SC_DLLPUBLIC SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
1331 SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
1333 bool RowFiltered(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL);
1334 bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
1335 bool ColFiltered(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL);
1336 SC_DLLPUBLIC void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bFiltered);
1337 SC_DLLPUBLIC void SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, bool bFiltered);
1338 SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
1339 SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
1340 SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
1342 /**
1343 * Write all column row flags to table's flag data, because not all column
1344 * row attributes are stored in the flag data members. This is necessary
1345 * for ods export.
1347 void SyncColRowFlags();
1349 /// @return the index of the last row with any set flags (auto-pagebreak is ignored).
1350 SC_DLLPUBLIC SCROW GetLastFlaggedRow( SCTAB nTab ) const;
1352 /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored).
1353 SCCOL GetLastChangedCol( SCTAB nTab ) const;
1354 /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
1355 SCROW GetLastChangedRow( SCTAB nTab ) const;
1357 SCCOL GetNextDifferentChangedCol( SCTAB nTab, SCCOL nStart) const;
1359 // #108550#; if bCareManualSize is set then the row
1360 // heights are compared only if the manual size flag for
1361 // the row is set. If the bCareManualSize is not set then
1362 // the row heights are always compared.
1363 SCROW GetNextDifferentChangedRow( SCTAB nTab, SCROW nStart, bool bCareManualSize = true) const;
1365 // returns whether to export a Default style for this col/row or not
1366 // nDefault is setted to one possition in the current row/col where the Default style is
1367 BOOL GetColDefault( SCTAB nTab, SCCOL nCol, SCROW nLastRow, SCROW& nDefault);
1368 BOOL GetRowDefault( SCTAB nTab, SCROW nRow, SCCOL nLastCol, SCCOL& nDefault);
1370 BOOL UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, BOOL bShow );
1371 BOOL UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, BOOL bShow );
1373 void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, SCTAB nTab );
1374 void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, SCTAB nTab );
1376 SC_DLLPUBLIC ScPatternAttr* GetDefPattern() const;
1377 SC_DLLPUBLIC ScDocumentPool* GetPool();
1378 SC_DLLPUBLIC ScStyleSheetPool* GetStyleSheetPool() const;
1380 // PageStyle:
1381 SC_DLLPUBLIC const String& GetPageStyle( SCTAB nTab ) const;
1382 SC_DLLPUBLIC void SetPageStyle( SCTAB nTab, const String& rName );
1383 Size GetPageSize( SCTAB nTab ) const;
1384 void SetPageSize( SCTAB nTab, const Size& rSize );
1385 void SetRepeatArea( SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
1386 void InvalidatePageBreaks(SCTAB nTab);
1387 void UpdatePageBreaks( SCTAB nTab, const ScRange* pUserArea = NULL );
1388 void RemoveManualBreaks( SCTAB nTab );
1389 BOOL HasManualBreaks( SCTAB nTab ) const;
1391 BOOL IsPageStyleInUse( const String& rStrPageStyle, SCTAB* pInTab = NULL );
1392 BOOL RemovePageStyleInUse( const String& rStrPageStyle );
1393 BOOL RenamePageStyleInUse( const String& rOld, const String& rNew );
1394 void ModifyStyleSheet( SfxStyleSheetBase& rPageStyle,
1395 const SfxItemSet& rChanges );
1397 void PageStyleModified( SCTAB nTab, const String& rNewName );
1399 SC_DLLPUBLIC BOOL NeedPageResetAfterTab( SCTAB nTab ) const;
1401 // war vorher im PageStyle untergracht. Jetzt an jeder Tabelle:
1402 SC_DLLPUBLIC BOOL HasPrintRange();
1403 SC_DLLPUBLIC USHORT GetPrintRangeCount( SCTAB nTab );
1404 SC_DLLPUBLIC const ScRange* GetPrintRange( SCTAB nTab, USHORT nPos );
1405 SC_DLLPUBLIC const ScRange* GetRepeatColRange( SCTAB nTab );
1406 SC_DLLPUBLIC const ScRange* GetRepeatRowRange( SCTAB nTab );
1407 /** Returns true, if the specified sheet is always printed. */
1408 BOOL IsPrintEntireSheet( SCTAB nTab ) const;
1410 /** Removes all print ranges. */
1411 SC_DLLPUBLIC void ClearPrintRanges( SCTAB nTab );
1412 /** Adds a new print ranges. */
1413 SC_DLLPUBLIC void AddPrintRange( SCTAB nTab, const ScRange& rNew );
1414 //UNUSED2009-05 /** Removes all old print ranges and sets the passed print ranges. */
1415 //UNUSED2009-05 void SetPrintRange( SCTAB nTab, const ScRange& rNew );
1416 /** Marks the specified sheet to be printed completely. Deletes old print ranges on the sheet! */
1417 SC_DLLPUBLIC void SetPrintEntireSheet( SCTAB nTab );
1418 SC_DLLPUBLIC void SetRepeatColRange( SCTAB nTab, const ScRange* pNew );
1419 SC_DLLPUBLIC void SetRepeatRowRange( SCTAB nTab, const ScRange* pNew );
1420 ScPrintRangeSaver* CreatePrintRangeSaver() const;
1421 void RestorePrintRanges( const ScPrintRangeSaver& rSaver );
1423 SC_DLLPUBLIC Rectangle GetMMRect( SCCOL nStartCol, SCROW nStartRow,
1424 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab );
1425 SC_DLLPUBLIC ScRange GetRange( SCTAB nTab, const Rectangle& rMMRect );
1427 void UpdStlShtPtrsFrmNms();
1428 void StylesToNames();
1430 SC_DLLPUBLIC void CopyStdStylesFrom( ScDocument* pSrcDoc );
1432 CharSet GetSrcCharSet() const { return eSrcSet; }
1433 ULONG GetSrcVersion() const { return nSrcVer; }
1434 SCROW GetSrcMaxRow() const { return nSrcMaxRow; }
1436 void SetSrcCharSet( CharSet eNew ) { eSrcSet = eNew; }
1437 void UpdateFontCharSet();
1439 void FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
1440 SCTAB nTab, double nScaleX, double nScaleY,
1441 BOOL bPageMode, BOOL bFormulaMode,
1442 const ScMarkData* pMarkData = NULL );
1444 SC_DLLPUBLIC SvNumberFormatter* GetFormatTable() const;
1446 void Sort( SCTAB nTab, const ScSortParam& rSortParam, BOOL bKeepQuery );
1447 SCSIZE Query( SCTAB nTab, const ScQueryParam& rQueryParam, BOOL bKeepSub );
1448 BOOL ValidQuery( SCROW nRow, SCTAB nTab, const ScQueryParam& rQueryParam, BOOL* pSpecial = NULL );
1449 SC_DLLPUBLIC BOOL CreateQueryParam( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1450 SCTAB nTab, ScQueryParam& rQueryParam );
1451 void GetUpperCellString(SCCOL nCol, SCROW nRow, SCTAB nTab, String& rStr);
1453 /** Update the dynamic end row position of a current data area. */
1454 void UpdateDynamicEndRow(ScDBData& rDBData) const;
1456 BOOL GetFilterEntries( SCCOL nCol, SCROW nRow, SCTAB nTab,
1457 bool bFilter, TypedScStrCollection& rStrings, bool& rHasDates);
1458 SC_DLLPUBLIC BOOL GetFilterEntriesArea( SCCOL nCol, SCROW nStartRow, SCROW nEndRow,
1459 SCTAB nTab, TypedScStrCollection& rStrings, bool& rHasDates );
1460 BOOL GetDataEntries( SCCOL nCol, SCROW nRow, SCTAB nTab,
1461 TypedScStrCollection& rStrings, BOOL bLimit = FALSE );
1462 BOOL GetFormulaEntries( TypedScStrCollection& rStrings );
1464 BOOL HasAutoFilter( SCCOL nCol, SCROW nRow, SCTAB nTab );
1466 SC_DLLPUBLIC BOOL HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1467 SCTAB nTab );
1468 SC_DLLPUBLIC BOOL HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1469 SCTAB nTab );
1471 SfxPrinter* GetPrinter( BOOL bCreateIfNotExist = TRUE );
1472 void SetPrinter( SfxPrinter* pNewPrinter );
1473 VirtualDevice* GetVirtualDevice_100th_mm();
1474 SC_DLLPUBLIC OutputDevice* GetRefDevice(); // WYSIWYG: Printer, otherwise VirtualDevice...
1476 void EraseNonUsedSharedNames(USHORT nLevel);
1477 BOOL GetNextSpellingCell(SCCOL& nCol, SCROW& nRow, SCTAB nTab,
1478 BOOL bInSel, const ScMarkData& rMark) const;
1480 BOOL ReplaceStyle(const SvxSearchItem& rSearchItem,
1481 SCCOL nCol, SCROW nRow, SCTAB nTab,
1482 ScMarkData& rMark, BOOL bIsUndo);
1484 void DoColResize( SCTAB nTab, SCCOL nCol1, SCCOL nCol2, SCSIZE nAdd );
1486 // Idleberechnung der OutputDevice-Zelltextbreite
1487 BOOL IsLoadingDone() const { return bLoadingDone; }
1488 void InvalidateTextWidth( const String& rStyleName );
1489 void InvalidateTextWidth( SCTAB nTab );
1490 void InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo, BOOL bNumFormatChanged );
1492 BOOL IdleCalcTextWidth();
1493 BOOL IdleCheckLinks();
1495 BOOL ContinueOnlineSpelling(); // TRUE = etwas gefunden
1497 BOOL IsIdleDisabled() const { return bIdleDisabled; }
1498 void DisableIdle(BOOL bDo) { bIdleDisabled = bDo; }
1500 BOOL IsDetectiveDirty() const { return bDetectiveDirty; }
1501 void SetDetectiveDirty(BOOL bSet) { bDetectiveDirty = bSet; }
1503 void RemoveAutoSpellObj();
1504 void SetOnlineSpellPos( const ScAddress& rPos );
1505 SC_DLLPUBLIC BOOL SetVisibleSpellRange( const ScRange& rRange ); // TRUE = changed
1507 BYTE GetMacroCallMode() const { return nMacroCallMode; }
1508 void SetMacroCallMode(BYTE nNew) { nMacroCallMode = nNew; }
1510 BOOL GetHasMacroFunc() const { return bHasMacroFunc; }
1511 void SetHasMacroFunc(BOOL bSet) { bHasMacroFunc = bSet; }
1513 BOOL CheckMacroWarn();
1515 void SetRangeOverflowType(sal_uInt32 nType) { nRangeOverflowType = nType; }
1516 sal_Bool HasRangeOverflow() const { return nRangeOverflowType != 0; }
1517 SC_DLLPUBLIC sal_uInt32 GetRangeOverflowType() const { return nRangeOverflowType; }
1519 // fuer Broadcasting/Listening
1520 void SetNoSetDirty( BOOL bVal ) { bNoSetDirty = bVal; }
1521 BOOL GetNoSetDirty() const { return bNoSetDirty; }
1522 void SetInsertingFromOtherDoc( BOOL bVal ) { bInsertingFromOtherDoc = bVal; }
1523 BOOL IsInsertingFromOtherDoc() const { return bInsertingFromOtherDoc; }
1524 void SetLoadingMedium( bool bVal );
1525 bool IsLoadingMedium() const;
1526 void SetImportingXML( BOOL bVal );
1527 BOOL IsImportingXML() const { return bImportingXML; }
1528 void SetXMLFromWrapper( BOOL bVal );
1529 BOOL IsXMLFromWrapper() const { return bXMLFromWrapper; }
1530 void SetCalcingAfterLoad( BOOL bVal ) { bCalcingAfterLoad = bVal; }
1531 BOOL IsCalcingAfterLoad() const { return bCalcingAfterLoad; }
1532 void SetNoListening( BOOL bVal ) { bNoListening = bVal; }
1533 BOOL GetNoListening() const { return bNoListening; }
1534 ScBroadcastAreaSlotMachine* GetBASM() const { return pBASM; }
1536 ScChartListenerCollection* GetChartListenerCollection() const
1537 { return pChartListenerCollection; }
1538 void SetChartListenerCollection( ScChartListenerCollection*,
1539 BOOL bSetChartRangeLists = FALSE );
1540 void UpdateChart( const String& rName );
1541 void RestoreChartListener( const String& rName );
1542 SC_DLLPUBLIC void UpdateChartListenerCollection();
1543 BOOL IsChartListenerCollectionNeedsUpdate() const
1544 { return bChartListenerCollectionNeedsUpdate; }
1545 void SetChartListenerCollectionNeedsUpdate( BOOL bFlg )
1546 { bChartListenerCollectionNeedsUpdate = bFlg; }
1547 void AddOLEObjectToCollection(const String& rName);
1549 ScChangeViewSettings* GetChangeViewSettings() const { return pChangeViewSettings; }
1550 SC_DLLPUBLIC void SetChangeViewSettings(const ScChangeViewSettings& rNew);
1552 vos::ORef<SvxForbiddenCharactersTable> GetForbiddenCharacters();
1553 void SetForbiddenCharacters( const vos::ORef<SvxForbiddenCharactersTable> xNew );
1555 BYTE GetAsianCompression() const; // CharacterCompressionType values
1556 BOOL IsValidAsianCompression() const;
1557 void SetAsianCompression(BYTE nNew);
1559 BOOL GetAsianKerning() const;
1560 BOOL IsValidAsianKerning() const;
1561 void SetAsianKerning(BOOL bNew);
1563 BYTE GetEditTextDirection(SCTAB nTab) const; // EEHorizontalTextDirection values
1565 SC_DLLPUBLIC ScLkUpdMode GetLinkMode() const { return eLinkMode ;}
1566 void SetLinkMode( ScLkUpdMode nSet ) { eLinkMode = nSet;}
1568 SC_DLLPUBLIC ScMacroManager* GetMacroManager();
1570 private:
1571 ScDocument(const ScDocument& r); // disabled with no definition
1573 void FindMaxRotCol( SCTAB nTab, RowInfo* pRowInfo, SCSIZE nArrCount,
1574 SCCOL nX1, SCCOL nX2 ) const;
1576 USHORT RowDifferences( SCROW nThisRow, SCTAB nThisTab,
1577 ScDocument& rOtherDoc,
1578 SCROW nOtherRow, SCTAB nOtherTab,
1579 SCCOL nMaxCol, SCCOLROW* pOtherCols );
1580 USHORT ColDifferences( SCCOL nThisCol, SCTAB nThisTab,
1581 ScDocument& rOtherDoc,
1582 SCCOL nOtherCol, SCTAB nOtherTab,
1583 SCROW nMaxRow, SCCOLROW* pOtherRows );
1584 void FindOrder( SCCOLROW* pOtherRows, SCCOLROW nThisEndRow, SCCOLROW nOtherEndRow,
1585 BOOL bColumns,
1586 ScDocument& rOtherDoc, SCTAB nThisTab, SCTAB nOtherTab,
1587 SCCOLROW nEndCol, SCCOLROW* pTranslate,
1588 ScProgress* pProgress, ULONG nProAdd );
1589 BOOL OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpellPos,
1590 USHORT nMaxTest );
1592 DECL_LINK( TrackTimeHdl, Timer* );
1594 static ScRecursionHelper* CreateRecursionHelperInstance();
1596 public:
1597 void StartListeningArea( const ScRange& rRange,
1598 SvtListener* pListener );
1599 void EndListeningArea( const ScRange& rRange,
1600 SvtListener* pListener );
1601 /** Broadcast wrapper, calls
1602 SC_DLLPUBLIC rHint.GetCell()->Broadcast() and AreaBroadcast()
1603 and TrackFormulas() and conditional format list
1604 SourceChanged().
1605 Preferred.
1607 void Broadcast( const ScHint& rHint );
1608 /// deprecated
1609 void Broadcast( ULONG nHint, const ScAddress& rAddr,
1610 ScBaseCell* pCell );
1611 /// only area, no cell broadcast
1612 void AreaBroadcast( const ScHint& rHint );
1613 /// only areas in range, no cell broadcasts
1614 void AreaBroadcastInRange( const ScRange& rRange,
1615 const ScHint& rHint );
1616 void DelBroadcastAreasInRange( const ScRange& rRange );
1617 void UpdateBroadcastAreas( UpdateRefMode eUpdateRefMode,
1618 const ScRange& rRange,
1619 SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
1622 void StartListeningCell( const ScAddress& rAddress,
1623 SvtListener* pListener );
1624 void EndListeningCell( const ScAddress& rAddress,
1625 SvtListener* pListener );
1626 void PutInFormulaTree( ScFormulaCell* pCell );
1627 void RemoveFromFormulaTree( ScFormulaCell* pCell );
1628 void CalcFormulaTree( BOOL bOnlyForced = FALSE,
1629 BOOL bNoProgressBar = FALSE );
1630 void ClearFormulaTree();
1631 void AppendToFormulaTrack( ScFormulaCell* pCell );
1632 void RemoveFromFormulaTrack( ScFormulaCell* pCell );
1633 void TrackFormulas( ULONG nHintId = SC_HINT_DATACHANGED );
1634 USHORT GetFormulaTrackCount() const { return nFormulaTrackCount; }
1635 BOOL IsInFormulaTree( ScFormulaCell* pCell ) const;
1636 BOOL IsInFormulaTrack( ScFormulaCell* pCell ) const;
1637 USHORT GetHardRecalcState() { return nHardRecalcState; }
1638 void SetHardRecalcState( USHORT nVal ) { nHardRecalcState = nVal; }
1639 void StartAllListeners();
1640 const ScFormulaCell* GetFormulaTree() const { return pFormulaTree; }
1641 BOOL HasForcedFormulas() const { return bHasForcedFormulas; }
1642 void SetForcedFormulas( BOOL bVal ) { bHasForcedFormulas = bVal; }
1643 ULONG GetFormulaCodeInTree() const { return nFormulaCodeInTree; }
1644 BOOL IsInInterpreter() const { return nInterpretLevel != 0; }
1645 USHORT GetInterpretLevel() { return nInterpretLevel; }
1646 void IncInterpretLevel()
1648 if ( nInterpretLevel < USHRT_MAX )
1649 nInterpretLevel++;
1651 void DecInterpretLevel()
1653 if ( nInterpretLevel )
1654 nInterpretLevel--;
1656 BOOL IsInMacroInterpreter() const { return nMacroInterpretLevel != 0; }
1657 USHORT GetMacroInterpretLevel() { return nMacroInterpretLevel; }
1658 void IncMacroInterpretLevel()
1660 if ( nMacroInterpretLevel < USHRT_MAX )
1661 nMacroInterpretLevel++;
1663 void DecMacroInterpretLevel()
1665 if ( nMacroInterpretLevel )
1666 nMacroInterpretLevel--;
1668 BOOL IsInInterpreterTableOp() const { return nInterpreterTableOpLevel != 0; }
1669 USHORT GetInterpreterTableOpLevel() { return nInterpreterTableOpLevel; }
1670 void IncInterpreterTableOpLevel()
1672 if ( nInterpreterTableOpLevel < USHRT_MAX )
1673 nInterpreterTableOpLevel++;
1675 void DecInterpreterTableOpLevel()
1677 if ( nInterpreterTableOpLevel )
1678 nInterpreterTableOpLevel--;
1680 // add a formula to be remembered for TableOp broadcasts
1681 void AddTableOpFormulaCell( ScFormulaCell* );
1682 void InvalidateLastTableOpParams() { aLastTableOpParams.bValid = FALSE; }
1683 ScRecursionHelper& GetRecursionHelper()
1685 if (!pRecursionHelper)
1686 pRecursionHelper = CreateRecursionHelperInstance();
1687 return *pRecursionHelper;
1689 BOOL IsInDtorClear() const { return bInDtorClear; }
1690 void SetExpandRefs( BOOL bVal ) { bExpandRefs = bVal; }
1691 BOOL IsExpandRefs() { return bExpandRefs; }
1693 SC_DLLPUBLIC void IncSizeRecalcLevel( SCTAB nTab );
1694 SC_DLLPUBLIC void DecSizeRecalcLevel( SCTAB nTab );
1696 ULONG GetXMLImportedFormulaCount() const { return nXMLImportedFormulaCount; }
1697 void IncXMLImportedFormulaCount( ULONG nVal )
1699 if ( nXMLImportedFormulaCount + nVal > nXMLImportedFormulaCount )
1700 nXMLImportedFormulaCount += nVal;
1702 void DecXMLImportedFormulaCount( ULONG nVal )
1704 if ( nVal <= nXMLImportedFormulaCount )
1705 nXMLImportedFormulaCount -= nVal;
1706 else
1707 nXMLImportedFormulaCount = 0;
1710 void StartTrackTimer();
1712 void CompileDBFormula();
1713 void CompileDBFormula( BOOL bCreateFormulaString );
1714 void CompileNameFormula( BOOL bCreateFormulaString );
1715 void CompileColRowNameFormula();
1717 /** Maximum string length of a column, e.g. for dBase export.
1718 @return String length in octets (!) of the destination encoding. In
1719 case of non-octet encodings (e.g. UCS2) the length in code
1720 points times sizeof(sal_Unicode) is returned. */
1721 sal_Int32 GetMaxStringLen( SCTAB nTab, SCCOL nCol,
1722 SCROW nRowStart, SCROW nRowEnd,
1723 CharSet eCharSet ) const;
1724 /** Maximum string length of numerical cells of a column, e.g. for dBase export.
1725 @return String length in characters (!) including the decimal
1726 separator, and the decimal precision needed. */
1727 xub_StrLen GetMaxNumberStringLen( USHORT& nPrecision,
1728 SCTAB nTab, SCCOL nCol,
1729 SCROW nRowStart, SCROW nRowEnd ) const;
1731 void KeyInput( const KeyEvent& rKEvt ); // TimerDelays etc.
1733 ScChangeTrack* GetChangeTrack() const { return pChangeTrack; }
1735 //! only for import filter, deletes any existing ChangeTrack via
1736 //! EndChangeTracking() and takes ownership of new ChangeTrack pTrack
1737 SC_DLLPUBLIC void SetChangeTrack( ScChangeTrack* pTrack );
1739 void StartChangeTracking();
1740 void EndChangeTracking();
1742 SC_DLLPUBLIC void CompareDocument( ScDocument& rOtherDoc );
1744 void AddUnoObject( SfxListener& rObject );
1745 void RemoveUnoObject( SfxListener& rObject );
1746 void BroadcastUno( const SfxHint &rHint );
1747 void AddUnoListenerCall( const ::com::sun::star::uno::Reference<
1748 ::com::sun::star::util::XModifyListener >& rListener,
1749 const ::com::sun::star::lang::EventObject& rEvent );
1751 void SetInLinkUpdate(BOOL bSet); // TableLink or AreaLink
1752 BOOL IsInLinkUpdate() const; // including DdeLink
1754 SC_DLLPUBLIC SfxItemPool* GetEditPool() const;
1755 SC_DLLPUBLIC SfxItemPool* GetEnginePool() const;
1756 SC_DLLPUBLIC ScFieldEditEngine& GetEditEngine();
1757 SC_DLLPUBLIC ScNoteEditEngine& GetNoteEngine();
1758 //UNUSED2009-05 SfxItemPool& GetNoteItemPool();
1760 ScRefreshTimerControl* GetRefreshTimerControl() const
1761 { return pRefreshTimerControl; }
1762 ScRefreshTimerControl * const * GetRefreshTimerControlAddress() const
1763 { return &pRefreshTimerControl; }
1765 void SetPastingDrawFromOtherDoc( BOOL bVal )
1766 { bPastingDrawFromOtherDoc = bVal; }
1767 BOOL PastingDrawFromOtherDoc() const
1768 { return bPastingDrawFromOtherDoc; }
1770 /// an ID unique to each document instance
1771 sal_uInt32 GetDocumentID() const;
1773 void InvalidateStyleSheetUsage()
1774 { bStyleSheetUsageInvalid = TRUE; }
1775 void GetSortParam( ScSortParam& rParam, SCTAB nTab );
1776 void SetSortParam( ScSortParam& rParam, SCTAB nTab );
1778 com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > GetVbaEventsHelper();
1780 /** Should only be GRAM_PODF or GRAM_ODFF. */
1781 void SetStorageGrammar( formula::FormulaGrammar::Grammar eGrammar );
1782 formula::FormulaGrammar::Grammar GetStorageGrammar() const
1783 { return eStorageGrammar; }
1785 SfxUndoManager* GetUndoManager();
1786 private: // CLOOK-Impl-Methoden
1788 /**
1789 * Use this class as a locale variable to merge number formatter from
1790 * another document, and set NULL pointer to pFormatExchangeList when
1791 * done.
1793 class NumFmtMergeHandler
1795 public:
1796 explicit NumFmtMergeHandler(ScDocument* pDoc, ScDocument* pSrcDoc);
1797 ~NumFmtMergeHandler();
1799 private:
1800 ScDocument* mpDoc;
1803 void MergeNumberFormatter(ScDocument* pSrcDoc);
1805 void ImplCreateOptions(); // bei Gelegenheit auf on-demand umstellen?
1806 void ImplDeleteOptions();
1808 void DeleteDrawLayer();
1809 void DeleteColorTable();
1810 SC_DLLPUBLIC BOOL DrawGetPrintArea( ScRange& rRange, BOOL bSetHor, BOOL bSetVer ) const;
1811 void DrawMovePage( USHORT nOldPos, USHORT nNewPos );
1812 void DrawCopyPage( USHORT nOldPos, USHORT nNewPos );
1814 void UpdateDrawPrinter();
1815 void UpdateDrawLanguages();
1816 void UpdateDrawDefaults();
1817 SC_DLLPUBLIC void InitClipPtrs( ScDocument* pSourceDoc );
1819 void LoadDdeLinks(SvStream& rStream);
1820 void SaveDdeLinks(SvStream& rStream) const;
1822 void DeleteAreaLinksOnTab( SCTAB nTab );
1823 void UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode,
1824 const ScRange& r, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
1826 void CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, const ScMarkData* pMarks, bool bAllTabs);
1827 void CopyRangeNamesFromClip(ScDocument* pClipDoc, ScClipRangeNameData& rRangeNames);
1828 void UpdateRangeNamesInFormulas(
1829 ScClipRangeNameData& rRangeNames, const ScRangeList& rDestRanges, const ScMarkData& rMark,
1830 SCCOL nXw, SCROW nYw);
1832 BOOL HasPartOfMerged( const ScRange& rRange );
1834 std::map< SCTAB, ScSortParam > mSheetSortParams;
1837 inline void ScDocument::GetSortParam( ScSortParam& rParam, SCTAB nTab )
1839 rParam = mSheetSortParams[ nTab ];
1842 inline void ScDocument::SetSortParam( ScSortParam& rParam, SCTAB nTab )
1844 mSheetSortParams[ nTab ] = rParam;
1848 inline ULONG ScDocument::FastGetScaledRowHeight( SCROW nStartRow, SCROW nEndRow,
1849 SCTAB nTab, double fScale ) const
1851 ULONG nHeight = FastGetRowHeight(nStartRow, nEndRow, nTab);
1852 return nHeight * fScale;
1855 inline USHORT ScDocument::FastGetRowHeight( SCROW nRow, SCTAB nTab ) const
1857 return pTab[nTab]->GetRowHeight(nRow);
1860 inline SCROW ScDocument::FastGetRowForHeight( SCTAB nTab, ULONG nHeight ) const
1862 return pTab[nTab]->GetRowForHeight(nHeight);
1865 inline USHORT ScDocument::FastGetOriginalRowHeight( SCROW nRow, SCTAB nTab ) const
1867 return pTab[nTab]->pRowHeight->GetValue(nRow);
1870 #endif