update dev300-m58
[ooovba.git] / sc / inc / document.hxx
blobdc8710efd36ce0ea2324a1d0f6ea833a0f91efe3
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() { return pExternalRefMgr.get(); }
633 SC_DLLPUBLIC ScExternalRefManager* GetExternalRefManager();
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 CalcAll();
858 SC_DLLPUBLIC void CalcAfterLoad();
859 void CompileAll();
860 void CompileXML();
862 ScAutoNameCache* GetAutoNameCache() { return pAutoNameCache; }
864 /** Creates a ScLookupCache cache for the range if it
865 doesn't already exist. */
866 ScLookupCache & GetLookupCache( const ScRange & rRange );
867 /** Only ScLookupCache ctor uses AddLookupCache(), do not
868 use elsewhere! */
869 void AddLookupCache( ScLookupCache & rCache );
870 /** Only ScLookupCache dtor uses RemoveLookupCache(), do
871 not use elsewhere! */
872 void RemoveLookupCache( ScLookupCache & rCache );
873 /** Zap all caches. */
874 void ClearLookupCaches();
876 // Automatisch Berechnen
877 void SetAutoCalc( BOOL bNewAutoCalc );
878 BOOL GetAutoCalc() const { return bAutoCalc; }
879 // Automatisch Berechnen in/von/fuer ScDocShell disabled
880 void SetAutoCalcShellDisabled( BOOL bNew ) { bAutoCalcShellDisabled = bNew; }
881 BOOL IsAutoCalcShellDisabled() const { return bAutoCalcShellDisabled; }
882 // ForcedFormulas zu berechnen
883 void SetForcedFormulaPending( BOOL bNew ) { bForcedFormulaPending = bNew; }
884 BOOL IsForcedFormulaPending() const { return bForcedFormulaPending; }
885 // if CalcFormulaTree() is currently running
886 BOOL IsCalculatingFormulaTree() { return bCalculatingFormulaTree; }
888 // for worksheet calculate event
889 BOOL FireCalculateEvent( SCTAB nTab );
890 void AddCalculateTable( SCTAB nTab );
892 USHORT GetErrCode( const ScAddress& ) const;
894 bool ShrinkToDataArea(SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow) const;
896 void GetDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
897 SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld ) const;
898 SC_DLLPUBLIC BOOL GetCellArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const;
899 SC_DLLPUBLIC BOOL GetTableArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const;
900 SC_DLLPUBLIC BOOL GetPrintArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow,
901 BOOL bNotes = TRUE ) const;
902 SC_DLLPUBLIC BOOL GetPrintAreaHor( SCTAB nTab, SCROW nStartRow, SCROW nEndRow,
903 SCCOL& rEndCol, BOOL bNotes = TRUE ) const;
904 SC_DLLPUBLIC BOOL GetPrintAreaVer( SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol,
905 SCROW& rEndRow, BOOL bNotes = TRUE ) const;
906 void InvalidateTableArea();
908 SC_DLLPUBLIC BOOL GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow ) const;
910 void ExtendPrintArea( OutputDevice* pDev, SCTAB nTab,
911 SCCOL nStartCol, SCROW nStartRow,
912 SCCOL& rEndCol, SCROW nEndRow );
914 SC_DLLPUBLIC SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab,
915 SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab,
916 ScDirection eDir );
918 void FindAreaPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX, SCsROW nMovY );
919 SC_DLLPUBLIC void GetNextPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX, SCsROW nMovY,
920 BOOL bMarked, BOOL bUnprotected, const ScMarkData& rMark );
922 BOOL GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, SCTAB nTab,
923 const ScMarkData& rMark );
925 void LimitChartArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
926 SCCOL& rEndCol, SCROW& rEndRow );
927 void LimitChartIfAll( ScRangeListRef& rRangeList );
929 BOOL InsertRow( SCCOL nStartCol, SCTAB nStartTab,
930 SCCOL nEndCol, SCTAB nEndTab,
931 SCROW nStartRow, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL,
932 const ScMarkData* pTabMark = NULL );
933 SC_DLLPUBLIC BOOL InsertRow( const ScRange& rRange, ScDocument* pRefUndoDoc = NULL );
934 void DeleteRow( SCCOL nStartCol, SCTAB nStartTab,
935 SCCOL nEndCol, SCTAB nEndTab,
936 SCROW nStartRow, SCSIZE nSize,
937 ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL,
938 const ScMarkData* pTabMark = NULL );
939 SC_DLLPUBLIC void DeleteRow( const ScRange& rRange,
940 ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL );
941 BOOL InsertCol( SCROW nStartRow, SCTAB nStartTab,
942 SCROW nEndRow, SCTAB nEndTab,
943 SCCOL nStartCol, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL,
944 const ScMarkData* pTabMark = NULL );
945 SC_DLLPUBLIC BOOL InsertCol( const ScRange& rRange, ScDocument* pRefUndoDoc = NULL );
946 void DeleteCol( SCROW nStartRow, SCTAB nStartTab,
947 SCROW nEndRow, SCTAB nEndTab,
948 SCCOL nStartCol, SCSIZE nSize,
949 ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL,
950 const ScMarkData* pTabMark = NULL );
951 void DeleteCol( const ScRange& rRange,
952 ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL );
954 BOOL CanInsertRow( const ScRange& rRange ) const;
955 BOOL CanInsertCol( const ScRange& rRange ) const;
957 void FitBlock( const ScRange& rOld, const ScRange& rNew, BOOL bClear = TRUE );
958 BOOL CanFitBlock( const ScRange& rOld, const ScRange& rNew );
960 BOOL IsClipOrUndo() const { return bIsClip || bIsUndo; }
961 BOOL IsUndo() const { return bIsUndo; }
962 BOOL IsClipboard() const { return bIsClip; }
963 bool IsUndoEnabled() const { return mbUndoEnabled; }
964 void EnableUndo( bool bVal );
966 bool IsAdjustHeightEnabled() const { return mbAdjustHeightEnabled; }
967 void EnableAdjustHeight( bool bVal ) { mbAdjustHeightEnabled = bVal; }
968 bool IsExecuteLinkEnabled() const { return mbExecuteLinkEnabled; }
969 void EnableExecuteLink( bool bVal ) { mbExecuteLinkEnabled = bVal; }
970 bool IsChangeReadOnlyEnabled() const { return mbChangeReadOnlyEnabled; }
971 void EnableChangeReadOnly( bool bVal ) { mbChangeReadOnlyEnabled = bVal; }
972 SC_DLLPUBLIC sal_Int16 GetNamedRangesLockCount() const { return mnNamedRangesLockCount; }
973 void SetNamedRangesLockCount( sal_Int16 nCount ) { mnNamedRangesLockCount = nCount; }
974 SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, const ScMarkData* pMarks );
975 SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, SCTAB nTab );
976 void SetCutMode( BOOL bCut );
977 BOOL IsCutMode();
978 void SetClipArea( const ScRange& rArea, BOOL bCut = FALSE );
980 SC_DLLPUBLIC BOOL IsDocVisible() const { return bIsVisible; }
981 void SetDocVisible( BOOL bSet );
983 BOOL HasOLEObjectsInArea( const ScRange& rRange, const ScMarkData* pTabMark = NULL );
985 void DeleteObjectsInArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
986 const ScMarkData& rMark );
987 void DeleteObjectsInSelection( const ScMarkData& rMark );
989 void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
990 const ScMarkData& rMark, USHORT nDelFlag);
991 void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
992 SCTAB nTab, USHORT nDelFlag);
993 void DeleteAreaTab(const ScRange& rRange, USHORT nDelFlag);
995 void CopyToClip(const ScClipParam& rClipParam, ScDocument* pClipDoc,
996 const ScMarkData* pMarks = NULL, bool bAllTabs = false, bool bKeepScenarioFlags = false,
997 bool bIncludeObjects = false, bool bCloneNoteCaptions = true);
999 void CopyTabToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1000 SCTAB nTab, ScDocument* pClipDoc = NULL);
1001 void CopyBlockFromClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1002 const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy,
1003 const ScCopyBlockFromClipParams* pCBFCP );
1004 void CopyNonFilteredFromClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1005 const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy,
1006 const ScCopyBlockFromClipParams* pCBFCP,
1007 SCROW & rClipStartRow );
1008 void StartListeningFromClip( SCCOL nCol1, SCROW nRow1,
1009 SCCOL nCol2, SCROW nRow2,
1010 const ScMarkData& rMark, USHORT nInsFlag );
1011 void BroadcastFromClip( SCCOL nCol1, SCROW nRow1,
1012 SCCOL nCol2, SCROW nRow2,
1013 const ScMarkData& rMark, USHORT nInsFlag );
1014 /** If pDestRanges is given it overrides rDestRange, rDestRange in this
1015 case is the overall encompassing range. */
1016 void CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMark,
1017 USHORT nInsFlag,
1018 ScDocument* pRefUndoDoc = NULL,
1019 ScDocument* pClipDoc = NULL,
1020 BOOL bResetCut = TRUE,
1021 BOOL bAsLink = FALSE,
1022 BOOL bIncludeFiltered = TRUE,
1023 BOOL bSkipAttrForEmpty = FALSE,
1024 const ScRangeList * pDestRanges = NULL );
1026 void CopyMultiRangeFromClip(const ScAddress& rDestPos, const ScMarkData& rMark,
1027 sal_uInt16 nInsFlag, ScDocument* pClipDoc,
1028 bool bResetCut = true, bool bAsLink = false,
1029 bool bIncludeFiltered = true,
1030 bool bSkipAttrForEmpty = false);
1032 void GetClipArea(SCCOL& nClipX, SCROW& nClipY, BOOL bIncludeFiltered);
1033 void GetClipStart(SCCOL& nClipX, SCROW& nClipY);
1035 BOOL HasClipFilteredRows();
1037 BOOL IsClipboardSource() const;
1039 SC_DLLPUBLIC void TransposeClip( ScDocument* pTransClip, USHORT nFlags, BOOL bAsLink );
1041 ScClipParam& GetClipParam();
1042 void SetClipParam(const ScClipParam& rParam);
1044 void MixDocument( const ScRange& rRange, USHORT nFunction, BOOL bSkipEmpty,
1045 ScDocument* pSrcDoc );
1047 void FillTab( const ScRange& rSrcArea, const ScMarkData& rMark,
1048 USHORT nFlags, USHORT nFunction,
1049 BOOL bSkipEmpty, BOOL bAsLink );
1050 void FillTabMarked( SCTAB nSrcTab, const ScMarkData& rMark,
1051 USHORT nFlags, USHORT nFunction,
1052 BOOL bSkipEmpty, BOOL bAsLink );
1054 void TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nType );
1056 SC_DLLPUBLIC void InitUndo( ScDocument* pSrcDoc, SCTAB nTab1, SCTAB nTab2,
1057 BOOL bColInfo = FALSE, BOOL bRowInfo = FALSE );
1058 void AddUndoTab( SCTAB nTab1, SCTAB nTab2,
1059 BOOL bColInfo = FALSE, BOOL bRowInfo = FALSE );
1060 SC_DLLPUBLIC void InitUndoSelected( ScDocument* pSrcDoc, const ScMarkData& rTabSelection,
1061 BOOL bColInfo = FALSE, BOOL bRowInfo = FALSE );
1063 // nicht mehr benutzen:
1064 void CopyToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
1065 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
1066 USHORT nFlags, BOOL bMarked, ScDocument* pDestDoc,
1067 const ScMarkData* pMarks = NULL, BOOL bColRowFlags = TRUE);
1068 void UndoToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
1069 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
1070 USHORT nFlags, BOOL bMarked, ScDocument* pDestDoc,
1071 const ScMarkData* pMarks = NULL);
1073 void CopyToDocument(const ScRange& rRange,
1074 USHORT nFlags, BOOL bMarked, ScDocument* pDestDoc,
1075 const ScMarkData* pMarks = NULL, BOOL bColRowFlags = TRUE);
1076 void UndoToDocument(const ScRange& rRange,
1077 USHORT nFlags, BOOL bMarked, ScDocument* pDestDoc,
1078 const ScMarkData* pMarks = NULL);
1080 void CopyScenario( SCTAB nSrcTab, SCTAB nDestTab, BOOL bNewScenario = FALSE );
1081 BOOL TestCopyScenario( SCTAB nSrcTab, SCTAB nDestTab ) const;
1082 void MarkScenario( SCTAB nSrcTab, SCTAB nDestTab,
1083 ScMarkData& rDestMark, BOOL bResetMark = TRUE,
1084 USHORT nNeededBits = 0 ) const;
1085 BOOL HasScenarioRange( SCTAB nTab, const ScRange& rRange ) const;
1086 SC_DLLPUBLIC const ScRangeList* GetScenarioRanges( SCTAB nTab ) const;
1088 SC_DLLPUBLIC void CopyUpdated( ScDocument* pPosDoc, ScDocument* pDestDoc );
1090 void UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
1091 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
1092 SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
1093 ScDocument* pUndoDoc = NULL, BOOL bIncludeDraw = TRUE );
1095 SC_DLLPUBLIC void UpdateTranspose( const ScAddress& rDestPos, ScDocument* pClipDoc,
1096 const ScMarkData& rMark, ScDocument* pUndoDoc = NULL );
1098 void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
1100 void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1101 const ScMarkData& rMark,
1102 ULONG nFillCount, FillDir eFillDir = FILL_TO_BOTTOM,
1103 FillCmd eFillCmd = FILL_LINEAR, FillDateCmd eFillDateCmd = FILL_DAY,
1104 double nStepValue = 1.0, double nMaxValue = 1E307);
1105 String GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY );
1107 BOOL GetSelectionFunction( ScSubTotalFunc eFunc,
1108 const ScAddress& rCursor, const ScMarkData& rMark,
1109 double& rResult );
1111 SC_DLLPUBLIC const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, USHORT nWhich ) const;
1112 SC_DLLPUBLIC const ScPatternAttr* GetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1113 SC_DLLPUBLIC const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow, SCTAB nTab ) const;
1114 const ScPatternAttr* GetSelectionPattern( const ScMarkData& rMark, BOOL bDeep = TRUE );
1115 ScPatternAttr* CreateSelectionPattern( const ScMarkData& rMark, BOOL bDeep = TRUE );
1117 const ScConditionalFormat* GetCondFormat( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1118 SC_DLLPUBLIC const SfxItemSet* GetCondResult( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1119 const SfxPoolItem* GetEffItem( SCCOL nCol, SCROW nRow, SCTAB nTab, USHORT nWhich ) const;
1121 SC_DLLPUBLIC const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator >& GetBreakIterator();
1122 BOOL HasStringWeakCharacters( const String& rString );
1123 SC_DLLPUBLIC BYTE GetStringScriptType( const String& rString );
1124 SC_DLLPUBLIC BYTE GetCellScriptType( ScBaseCell* pCell, ULONG nNumberFormat );
1125 SC_DLLPUBLIC BYTE GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell = NULL );
1127 BOOL HasDetectiveOperations() const;
1128 void AddDetectiveOperation( const ScDetOpData& rData );
1129 void ClearDetectiveOperations();
1130 ScDetOpList* GetDetOpList() const { return pDetOpList; }
1131 void SetDetOpList(ScDetOpList* pNew);
1133 BOOL HasDetectiveObjects(SCTAB nTab) const;
1135 void GetSelectionFrame( const ScMarkData& rMark,
1136 SvxBoxItem& rLineOuter,
1137 SvxBoxInfoItem& rLineInner );
1138 void ApplySelectionFrame( const ScMarkData& rMark,
1139 const SvxBoxItem* pLineOuter,
1140 const SvxBoxInfoItem* pLineInner );
1141 void ApplyFrameAreaTab( const ScRange& rRange,
1142 const SvxBoxItem* pLineOuter,
1143 const SvxBoxInfoItem* pLineInner );
1145 void ClearSelectionItems( const USHORT* pWhich, const ScMarkData& rMark );
1146 void ChangeSelectionIndent( BOOL bIncrement, const ScMarkData& rMark );
1148 SC_DLLPUBLIC ULONG AddCondFormat( const ScConditionalFormat& rNew );
1149 SC_DLLPUBLIC void FindConditionalFormat( ULONG nKey, ScRangeList& rRanges );
1150 SC_DLLPUBLIC void FindConditionalFormat( ULONG nKey, ScRangeList& rRanges, SCTAB nTab );
1151 void ConditionalChanged( ULONG nKey );
1153 SC_DLLPUBLIC ULONG AddValidationEntry( const ScValidationData& rNew );
1155 SC_DLLPUBLIC const ScValidationData* GetValidationEntry( ULONG nIndex ) const;
1157 ScConditionalFormatList* GetCondFormList() const // Ref-Undo
1158 { return pCondFormList; }
1159 void SetCondFormList(ScConditionalFormatList* pNew);
1161 ScValidationDataList* GetValidationList() const
1162 { return pValidationList; }
1164 SC_DLLPUBLIC void ApplyAttr( SCCOL nCol, SCROW nRow, SCTAB nTab,
1165 const SfxPoolItem& rAttr );
1166 SC_DLLPUBLIC void ApplyPattern( SCCOL nCol, SCROW nRow, SCTAB nTab,
1167 const ScPatternAttr& rAttr );
1168 SC_DLLPUBLIC void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow,
1169 SCCOL nEndCol, SCROW nEndRow,
1170 const ScMarkData& rMark, const ScPatternAttr& rAttr,
1171 ScEditDataArray* pDataArray = NULL );
1172 SC_DLLPUBLIC void ApplyPatternAreaTab( SCCOL nStartCol, SCROW nStartRow,
1173 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab,
1174 const ScPatternAttr& rAttr );
1175 SC_DLLPUBLIC void ApplyPatternIfNumberformatIncompatible(
1176 const ScRange& rRange, const ScMarkData& rMark,
1177 const ScPatternAttr& rPattern, short nNewType );
1179 void ApplyStyle( SCCOL nCol, SCROW nRow, SCTAB nTab,
1180 const ScStyleSheet& rStyle);
1181 void ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow,
1182 SCCOL nEndCol, SCROW nEndRow,
1183 const ScMarkData& rMark, const ScStyleSheet& rStyle);
1184 SC_DLLPUBLIC void ApplyStyleAreaTab( SCCOL nStartCol, SCROW nStartRow,
1185 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab,
1186 const ScStyleSheet& rStyle);
1188 void ApplySelectionStyle( const ScStyleSheet& rStyle, const ScMarkData& rMark );
1189 void ApplySelectionLineStyle( const ScMarkData& rMark,
1190 const SvxBorderLine* pLine, BOOL bColorOnly );
1192 const ScStyleSheet* GetStyle( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
1193 const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark ) const;
1195 void StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, BOOL bRemoved,
1196 OutputDevice* pDev,
1197 double nPPTX, double nPPTY,
1198 const Fraction& rZoomX, const Fraction& rZoomY );
1200 BOOL IsStyleSheetUsed( const ScStyleSheet& rStyle, BOOL bGatherAllStyles ) const;
1202 SC_DLLPUBLIC BOOL ApplyFlagsTab( SCCOL nStartCol, SCROW nStartRow,
1203 SCCOL nEndCol, SCROW nEndRow,
1204 SCTAB nTab, INT16 nFlags );
1205 BOOL RemoveFlagsTab( SCCOL nStartCol, SCROW nStartRow,
1206 SCCOL nEndCol, SCROW nEndRow,
1207 SCTAB nTab, INT16 nFlags );
1209 SC_DLLPUBLIC void SetPattern( const ScAddress&, const ScPatternAttr& rAttr,
1210 BOOL bPutToPool = FALSE );
1211 SC_DLLPUBLIC void SetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatternAttr& rAttr,
1212 BOOL bPutToPool = FALSE );
1213 void DeleteNumberFormat( const sal_uInt32* pDelKeys, sal_uInt32 nCount );
1215 void AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1216 USHORT nFormatNo, const ScMarkData& rMark );
1217 void GetAutoFormatData( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1218 ScAutoFormatData& rData );
1219 BOOL SearchAndReplace( const SvxSearchItem& rSearchItem,
1220 SCCOL& rCol, SCROW& rRow, SCTAB& rTab,
1221 ScMarkData& rMark,
1222 String& rUndoStr, ScDocument* pUndoDoc = NULL );
1224 // Col/Row von Folgeaufrufen bestimmen
1225 // (z.B. nicht gefunden von Anfang, oder folgende Tabellen)
1226 static void GetSearchAndReplaceStart( const SvxSearchItem& rSearchItem,
1227 SCCOL& rCol, SCROW& rRow );
1229 BOOL Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
1230 SCCOL nVCol, SCROW nVRow, SCTAB nVTab,
1231 const String& sValStr, double& nX);
1233 void ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark,
1234 ScEditDataArray* pDataArray = NULL );
1235 void DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark );
1236 void DeleteSelectionTab( SCTAB nTab, USHORT nDelFlag, const ScMarkData& rMark );
1240 SC_DLLPUBLIC void SetColWidth( SCCOL nCol, SCTAB nTab, USHORT nNewWidth );
1241 SC_DLLPUBLIC void SetRowHeight( SCROW nRow, SCTAB nTab, USHORT nNewHeight );
1242 SC_DLLPUBLIC void SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, SCTAB nTab,
1243 USHORT nNewHeight );
1244 void SetManualHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, BOOL bManual );
1246 SC_DLLPUBLIC USHORT GetColWidth( SCCOL nCol, SCTAB nTab ) const;
1247 SC_DLLPUBLIC USHORT GetRowHeight( SCROW nRow, SCTAB nTab ) const;
1248 SC_DLLPUBLIC ULONG GetRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab ) const;
1249 ULONG GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, double fScale ) const;
1250 SC_DLLPUBLIC const ScSummableCompressedArray< SCROW, USHORT> & GetRowHeightArray( SCTAB nTab ) const;
1251 SC_DLLPUBLIC ULONG GetColOffset( SCCOL nCol, SCTAB nTab ) const;
1252 SC_DLLPUBLIC ULONG GetRowOffset( SCROW nRow, SCTAB nTab ) const;
1254 SC_DLLPUBLIC USHORT GetOriginalWidth( SCCOL nCol, SCTAB nTab ) const;
1255 SC_DLLPUBLIC USHORT GetOriginalHeight( SCROW nRow, SCTAB nTab ) const;
1257 USHORT GetCommonWidth( SCCOL nEndCol, SCTAB nTab ) const;
1259 // All FastGet...() methods have no check for valid nTab!
1260 // They access ScCompressedArray objects, so using the
1261 // single row taking ones in loops to access a sequence of
1262 // single rows is no good idea! Use specialized range
1263 // taking methods instead, or iterators.
1264 SC_DLLPUBLIC ULONG FastGetRowHeight( SCROW nStartRow, SCROW nEndRow,
1265 SCTAB nTab ) const;
1266 inline ULONG FastGetScaledRowHeight( SCROW nStartRow, SCROW nEndRow,
1267 SCTAB nTab, double fScale ) const;
1268 SC_DLLPUBLIC inline USHORT FastGetRowHeight( SCROW nRow, SCTAB nTab ) const;
1269 inline SCROW FastGetRowForHeight( SCTAB nTab, ULONG nHeight ) const;
1270 /** No check for flags whether row is hidden, height value
1271 is returned unconditionally. */
1272 inline USHORT FastGetOriginalRowHeight( SCROW nRow, SCTAB nTab ) const;
1274 SCROW GetHiddenRowCount( SCROW nRow, SCTAB nTab ) const;
1276 USHORT GetOptimalColWidth( SCCOL nCol, SCTAB nTab, OutputDevice* pDev,
1277 double nPPTX, double nPPTY,
1278 const Fraction& rZoomX, const Fraction& rZoomY,
1279 BOOL bFormula,
1280 const ScMarkData* pMarkData = NULL,
1281 BOOL bSimpleTextImport = FALSE );
1282 SC_DLLPUBLIC BOOL SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, USHORT nExtra,
1283 OutputDevice* pDev,
1284 double nPPTX, double nPPTY,
1285 const Fraction& rZoomX, const Fraction& rZoomY,
1286 BOOL bShrink );
1287 void UpdateAllRowHeights( OutputDevice* pDev,
1288 double nPPTX, double nPPTY,
1289 const Fraction& rZoomX, const Fraction& rZoomY,
1290 const ScMarkData* pTabMark = NULL );
1291 long GetNeededSize( SCCOL nCol, SCROW nRow, SCTAB nTab,
1292 OutputDevice* pDev,
1293 double nPPTX, double nPPTY,
1294 const Fraction& rZoomX, const Fraction& rZoomY,
1295 BOOL bWidth, BOOL bTotalSize = FALSE );
1297 SC_DLLPUBLIC void ShowCol(SCCOL nCol, SCTAB nTab, BOOL bShow);
1298 SC_DLLPUBLIC void ShowRow(SCROW nRow, SCTAB nTab, BOOL bShow);
1299 SC_DLLPUBLIC void ShowRows(SCROW nRow1, SCROW nRow2, SCTAB nTab, BOOL bShow);
1300 SC_DLLPUBLIC void SetColFlags( SCCOL nCol, SCTAB nTab, BYTE nNewFlags );
1301 SC_DLLPUBLIC void SetRowFlags( SCROW nRow, SCTAB nTab, BYTE nNewFlags );
1302 SC_DLLPUBLIC void SetRowFlags( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, BYTE nNewFlags );
1304 SC_DLLPUBLIC BYTE GetColFlags( SCCOL nCol, SCTAB nTab ) const;
1305 SC_DLLPUBLIC BYTE GetRowFlags( SCROW nRow, SCTAB nTab ) const;
1307 SC_DLLPUBLIC const ScBitMaskCompressedArray< SCROW, BYTE> & GetRowFlagsArray( SCTAB nTab ) const;
1308 SC_DLLPUBLIC ScBitMaskCompressedArray< SCROW, BYTE> & GetRowFlagsArrayModifiable( SCTAB nTab );
1310 SC_DLLPUBLIC void GetAllRowBreaks(::std::set<SCROW>& rBreaks, SCTAB nTab, bool bPage, bool bManual) const;
1311 SC_DLLPUBLIC void GetAllColBreaks(::std::set<SCCOL>& rBreaks, SCTAB nTab, bool bPage, bool bManual) const;
1312 SC_DLLPUBLIC ScBreakType HasRowBreak(SCROW nRow, SCTAB nTab) const;
1313 SC_DLLPUBLIC ScBreakType HasColBreak(SCCOL nCol, SCTAB nTab) const;
1314 SC_DLLPUBLIC void SetRowBreak(SCROW nRow, SCTAB nTab, bool bPage, bool bManual);
1315 SC_DLLPUBLIC void SetColBreak(SCCOL nCol, SCTAB nTab, bool bPage, bool bManual);
1316 void RemoveRowBreak(SCROW nRow, SCTAB nTab, bool bPage, bool bManual);
1317 void RemoveColBreak(SCCOL nCol, SCTAB nTab, bool bPage, bool bManual);
1318 ::com::sun::star::uno::Sequence<
1319 ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData(SCTAB nTab) const;
1321 SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL);
1322 SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW& rLastRow);
1323 SC_DLLPUBLIC bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
1324 SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL& rLastCol);
1325 SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL);
1326 SC_DLLPUBLIC void SetRowHidden(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bHidden);
1327 SC_DLLPUBLIC void SetColHidden(SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, bool bHidden);
1328 SC_DLLPUBLIC SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
1329 SC_DLLPUBLIC SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
1330 SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
1332 bool RowFiltered(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL);
1333 bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
1334 bool ColFiltered(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL);
1335 SC_DLLPUBLIC void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bFiltered);
1336 SC_DLLPUBLIC void SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, bool bFiltered);
1337 SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
1338 SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
1339 SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab);
1341 /**
1342 * Write all column row flags to table's flag data, because not all column
1343 * row attributes are stored in the flag data members. This is necessary
1344 * for ods export.
1346 void SyncColRowFlags();
1348 /// @return the index of the last row with any set flags (auto-pagebreak is ignored).
1349 SC_DLLPUBLIC SCROW GetLastFlaggedRow( SCTAB nTab ) const;
1351 /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored).
1352 SCCOL GetLastChangedCol( SCTAB nTab ) const;
1353 /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
1354 SCROW GetLastChangedRow( SCTAB nTab ) const;
1356 SCCOL GetNextDifferentChangedCol( SCTAB nTab, SCCOL nStart) const;
1358 // #108550#; if bCareManualSize is set then the row
1359 // heights are compared only if the manual size flag for
1360 // the row is set. If the bCareManualSize is not set then
1361 // the row heights are always compared.
1362 SCROW GetNextDifferentChangedRow( SCTAB nTab, SCROW nStart, bool bCareManualSize = true) const;
1364 // returns whether to export a Default style for this col/row or not
1365 // nDefault is setted to one possition in the current row/col where the Default style is
1366 BOOL GetColDefault( SCTAB nTab, SCCOL nCol, SCROW nLastRow, SCROW& nDefault);
1367 BOOL GetRowDefault( SCTAB nTab, SCROW nRow, SCCOL nLastCol, SCCOL& nDefault);
1369 BOOL UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, BOOL bShow );
1370 BOOL UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, BOOL bShow );
1372 void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, SCTAB nTab );
1373 void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, SCTAB nTab );
1375 SC_DLLPUBLIC ScPatternAttr* GetDefPattern() const;
1376 SC_DLLPUBLIC ScDocumentPool* GetPool();
1377 SC_DLLPUBLIC ScStyleSheetPool* GetStyleSheetPool() const;
1379 // PageStyle:
1380 SC_DLLPUBLIC const String& GetPageStyle( SCTAB nTab ) const;
1381 SC_DLLPUBLIC void SetPageStyle( SCTAB nTab, const String& rName );
1382 Size GetPageSize( SCTAB nTab ) const;
1383 void SetPageSize( SCTAB nTab, const Size& rSize );
1384 void SetRepeatArea( SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
1385 void InvalidatePageBreaks(SCTAB nTab);
1386 void UpdatePageBreaks( SCTAB nTab, const ScRange* pUserArea = NULL );
1387 void RemoveManualBreaks( SCTAB nTab );
1388 BOOL HasManualBreaks( SCTAB nTab ) const;
1390 BOOL IsPageStyleInUse( const String& rStrPageStyle, SCTAB* pInTab = NULL );
1391 BOOL RemovePageStyleInUse( const String& rStrPageStyle );
1392 BOOL RenamePageStyleInUse( const String& rOld, const String& rNew );
1393 void ModifyStyleSheet( SfxStyleSheetBase& rPageStyle,
1394 const SfxItemSet& rChanges );
1396 void PageStyleModified( SCTAB nTab, const String& rNewName );
1398 SC_DLLPUBLIC BOOL NeedPageResetAfterTab( SCTAB nTab ) const;
1400 // war vorher im PageStyle untergracht. Jetzt an jeder Tabelle:
1401 SC_DLLPUBLIC BOOL HasPrintRange();
1402 SC_DLLPUBLIC USHORT GetPrintRangeCount( SCTAB nTab );
1403 SC_DLLPUBLIC const ScRange* GetPrintRange( SCTAB nTab, USHORT nPos );
1404 SC_DLLPUBLIC const ScRange* GetRepeatColRange( SCTAB nTab );
1405 SC_DLLPUBLIC const ScRange* GetRepeatRowRange( SCTAB nTab );
1406 /** Returns true, if the specified sheet is always printed. */
1407 BOOL IsPrintEntireSheet( SCTAB nTab ) const;
1409 /** Removes all print ranges. */
1410 SC_DLLPUBLIC void ClearPrintRanges( SCTAB nTab );
1411 /** Adds a new print ranges. */
1412 SC_DLLPUBLIC void AddPrintRange( SCTAB nTab, const ScRange& rNew );
1413 //UNUSED2009-05 /** Removes all old print ranges and sets the passed print ranges. */
1414 //UNUSED2009-05 void SetPrintRange( SCTAB nTab, const ScRange& rNew );
1415 /** Marks the specified sheet to be printed completely. Deletes old print ranges on the sheet! */
1416 SC_DLLPUBLIC void SetPrintEntireSheet( SCTAB nTab );
1417 SC_DLLPUBLIC void SetRepeatColRange( SCTAB nTab, const ScRange* pNew );
1418 SC_DLLPUBLIC void SetRepeatRowRange( SCTAB nTab, const ScRange* pNew );
1419 ScPrintRangeSaver* CreatePrintRangeSaver() const;
1420 void RestorePrintRanges( const ScPrintRangeSaver& rSaver );
1422 SC_DLLPUBLIC Rectangle GetMMRect( SCCOL nStartCol, SCROW nStartRow,
1423 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab );
1424 SC_DLLPUBLIC ScRange GetRange( SCTAB nTab, const Rectangle& rMMRect );
1426 void UpdStlShtPtrsFrmNms();
1427 void StylesToNames();
1429 SC_DLLPUBLIC void CopyStdStylesFrom( ScDocument* pSrcDoc );
1431 CharSet GetSrcCharSet() const { return eSrcSet; }
1432 ULONG GetSrcVersion() const { return nSrcVer; }
1433 SCROW GetSrcMaxRow() const { return nSrcMaxRow; }
1435 void SetSrcCharSet( CharSet eNew ) { eSrcSet = eNew; }
1436 void UpdateFontCharSet();
1438 void FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
1439 SCTAB nTab, double nScaleX, double nScaleY,
1440 BOOL bPageMode, BOOL bFormulaMode,
1441 const ScMarkData* pMarkData = NULL );
1443 SC_DLLPUBLIC SvNumberFormatter* GetFormatTable() const;
1445 void Sort( SCTAB nTab, const ScSortParam& rSortParam, BOOL bKeepQuery );
1446 SCSIZE Query( SCTAB nTab, const ScQueryParam& rQueryParam, BOOL bKeepSub );
1447 BOOL ValidQuery( SCROW nRow, SCTAB nTab, const ScQueryParam& rQueryParam, BOOL* pSpecial = NULL );
1448 SC_DLLPUBLIC BOOL CreateQueryParam( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1449 SCTAB nTab, ScQueryParam& rQueryParam );
1450 void GetUpperCellString(SCCOL nCol, SCROW nRow, SCTAB nTab, String& rStr);
1452 /** Update the dynamic end row position of a current data area. */
1453 void UpdateDynamicEndRow(ScDBData& rDBData) const;
1455 BOOL GetFilterEntries( SCCOL nCol, SCROW nRow, SCTAB nTab,
1456 bool bFilter, TypedScStrCollection& rStrings, bool& rHasDates);
1457 SC_DLLPUBLIC BOOL GetFilterEntriesArea( SCCOL nCol, SCROW nStartRow, SCROW nEndRow,
1458 SCTAB nTab, TypedScStrCollection& rStrings, bool& rHasDates );
1459 BOOL GetDataEntries( SCCOL nCol, SCROW nRow, SCTAB nTab,
1460 TypedScStrCollection& rStrings, BOOL bLimit = FALSE );
1461 BOOL GetFormulaEntries( TypedScStrCollection& rStrings );
1463 BOOL HasAutoFilter( SCCOL nCol, SCROW nRow, SCTAB nTab );
1465 SC_DLLPUBLIC BOOL HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1466 SCTAB nTab );
1467 SC_DLLPUBLIC BOOL HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1468 SCTAB nTab );
1470 SfxPrinter* GetPrinter( BOOL bCreateIfNotExist = TRUE );
1471 void SetPrinter( SfxPrinter* pNewPrinter );
1472 VirtualDevice* GetVirtualDevice_100th_mm();
1473 SC_DLLPUBLIC OutputDevice* GetRefDevice(); // WYSIWYG: Printer, otherwise VirtualDevice...
1475 void EraseNonUsedSharedNames(USHORT nLevel);
1476 BOOL GetNextSpellingCell(SCCOL& nCol, SCROW& nRow, SCTAB nTab,
1477 BOOL bInSel, const ScMarkData& rMark) const;
1479 BOOL ReplaceStyle(const SvxSearchItem& rSearchItem,
1480 SCCOL nCol, SCROW nRow, SCTAB nTab,
1481 ScMarkData& rMark, BOOL bIsUndo);
1483 void DoColResize( SCTAB nTab, SCCOL nCol1, SCCOL nCol2, SCSIZE nAdd );
1485 // Idleberechnung der OutputDevice-Zelltextbreite
1486 BOOL IsLoadingDone() const { return bLoadingDone; }
1487 void InvalidateTextWidth( const String& rStyleName );
1488 void InvalidateTextWidth( SCTAB nTab );
1489 void InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo, BOOL bNumFormatChanged );
1491 BOOL IdleCalcTextWidth();
1492 BOOL IdleCheckLinks();
1494 BOOL ContinueOnlineSpelling(); // TRUE = etwas gefunden
1496 BOOL IsIdleDisabled() const { return bIdleDisabled; }
1497 void DisableIdle(BOOL bDo) { bIdleDisabled = bDo; }
1499 BOOL IsDetectiveDirty() const { return bDetectiveDirty; }
1500 void SetDetectiveDirty(BOOL bSet) { bDetectiveDirty = bSet; }
1502 void RemoveAutoSpellObj();
1503 void SetOnlineSpellPos( const ScAddress& rPos );
1504 SC_DLLPUBLIC BOOL SetVisibleSpellRange( const ScRange& rRange ); // TRUE = changed
1506 BYTE GetMacroCallMode() const { return nMacroCallMode; }
1507 void SetMacroCallMode(BYTE nNew) { nMacroCallMode = nNew; }
1509 BOOL GetHasMacroFunc() const { return bHasMacroFunc; }
1510 void SetHasMacroFunc(BOOL bSet) { bHasMacroFunc = bSet; }
1512 BOOL CheckMacroWarn();
1514 void SetRangeOverflowType(sal_uInt32 nType) { nRangeOverflowType = nType; }
1515 sal_Bool HasRangeOverflow() const { return nRangeOverflowType != 0; }
1516 SC_DLLPUBLIC sal_uInt32 GetRangeOverflowType() const { return nRangeOverflowType; }
1518 // fuer Broadcasting/Listening
1519 void SetNoSetDirty( BOOL bVal ) { bNoSetDirty = bVal; }
1520 BOOL GetNoSetDirty() const { return bNoSetDirty; }
1521 void SetInsertingFromOtherDoc( BOOL bVal ) { bInsertingFromOtherDoc = bVal; }
1522 BOOL IsInsertingFromOtherDoc() const { return bInsertingFromOtherDoc; }
1523 void SetLoadingMedium( bool bVal );
1524 bool IsLoadingMedium() const;
1525 void SetImportingXML( BOOL bVal );
1526 BOOL IsImportingXML() const { return bImportingXML; }
1527 void SetXMLFromWrapper( BOOL bVal );
1528 BOOL IsXMLFromWrapper() const { return bXMLFromWrapper; }
1529 void SetCalcingAfterLoad( BOOL bVal ) { bCalcingAfterLoad = bVal; }
1530 BOOL IsCalcingAfterLoad() const { return bCalcingAfterLoad; }
1531 void SetNoListening( BOOL bVal ) { bNoListening = bVal; }
1532 BOOL GetNoListening() const { return bNoListening; }
1533 ScBroadcastAreaSlotMachine* GetBASM() const { return pBASM; }
1535 ScChartListenerCollection* GetChartListenerCollection() const
1536 { return pChartListenerCollection; }
1537 void SetChartListenerCollection( ScChartListenerCollection*,
1538 BOOL bSetChartRangeLists = FALSE );
1539 void UpdateChart( const String& rName );
1540 void RestoreChartListener( const String& rName );
1541 SC_DLLPUBLIC void UpdateChartListenerCollection();
1542 BOOL IsChartListenerCollectionNeedsUpdate() const
1543 { return bChartListenerCollectionNeedsUpdate; }
1544 void SetChartListenerCollectionNeedsUpdate( BOOL bFlg )
1545 { bChartListenerCollectionNeedsUpdate = bFlg; }
1546 void AddOLEObjectToCollection(const String& rName);
1548 ScChangeViewSettings* GetChangeViewSettings() const { return pChangeViewSettings; }
1549 SC_DLLPUBLIC void SetChangeViewSettings(const ScChangeViewSettings& rNew);
1551 vos::ORef<SvxForbiddenCharactersTable> GetForbiddenCharacters();
1552 void SetForbiddenCharacters( const vos::ORef<SvxForbiddenCharactersTable> xNew );
1554 BYTE GetAsianCompression() const; // CharacterCompressionType values
1555 BOOL IsValidAsianCompression() const;
1556 void SetAsianCompression(BYTE nNew);
1558 BOOL GetAsianKerning() const;
1559 BOOL IsValidAsianKerning() const;
1560 void SetAsianKerning(BOOL bNew);
1562 BYTE GetEditTextDirection(SCTAB nTab) const; // EEHorizontalTextDirection values
1564 SC_DLLPUBLIC ScLkUpdMode GetLinkMode() const { return eLinkMode ;}
1565 void SetLinkMode( ScLkUpdMode nSet ) { eLinkMode = nSet;}
1567 SC_DLLPUBLIC ScMacroManager* GetMacroManager();
1569 private:
1570 ScDocument(const ScDocument& r); // disabled with no definition
1572 void FindMaxRotCol( SCTAB nTab, RowInfo* pRowInfo, SCSIZE nArrCount,
1573 SCCOL nX1, SCCOL nX2 ) const;
1575 USHORT RowDifferences( SCROW nThisRow, SCTAB nThisTab,
1576 ScDocument& rOtherDoc,
1577 SCROW nOtherRow, SCTAB nOtherTab,
1578 SCCOL nMaxCol, SCCOLROW* pOtherCols );
1579 USHORT ColDifferences( SCCOL nThisCol, SCTAB nThisTab,
1580 ScDocument& rOtherDoc,
1581 SCCOL nOtherCol, SCTAB nOtherTab,
1582 SCROW nMaxRow, SCCOLROW* pOtherRows );
1583 void FindOrder( SCCOLROW* pOtherRows, SCCOLROW nThisEndRow, SCCOLROW nOtherEndRow,
1584 BOOL bColumns,
1585 ScDocument& rOtherDoc, SCTAB nThisTab, SCTAB nOtherTab,
1586 SCCOLROW nEndCol, SCCOLROW* pTranslate,
1587 ScProgress* pProgress, ULONG nProAdd );
1588 BOOL OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpellPos,
1589 USHORT nMaxTest );
1591 DECL_LINK( TrackTimeHdl, Timer* );
1593 static ScRecursionHelper* CreateRecursionHelperInstance();
1595 public:
1596 void StartListeningArea( const ScRange& rRange,
1597 SvtListener* pListener );
1598 void EndListeningArea( const ScRange& rRange,
1599 SvtListener* pListener );
1600 /** Broadcast wrapper, calls
1601 SC_DLLPUBLIC rHint.GetCell()->Broadcast() and AreaBroadcast()
1602 and TrackFormulas() and conditional format list
1603 SourceChanged().
1604 Preferred.
1606 void Broadcast( const ScHint& rHint );
1607 /// deprecated
1608 void Broadcast( ULONG nHint, const ScAddress& rAddr,
1609 ScBaseCell* pCell );
1610 /// only area, no cell broadcast
1611 void AreaBroadcast( const ScHint& rHint );
1612 /// only areas in range, no cell broadcasts
1613 void AreaBroadcastInRange( const ScRange& rRange,
1614 const ScHint& rHint );
1615 void DelBroadcastAreasInRange( const ScRange& rRange );
1616 void UpdateBroadcastAreas( UpdateRefMode eUpdateRefMode,
1617 const ScRange& rRange,
1618 SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
1621 void StartListeningCell( const ScAddress& rAddress,
1622 SvtListener* pListener );
1623 void EndListeningCell( const ScAddress& rAddress,
1624 SvtListener* pListener );
1625 void PutInFormulaTree( ScFormulaCell* pCell );
1626 void RemoveFromFormulaTree( ScFormulaCell* pCell );
1627 void CalcFormulaTree( BOOL bOnlyForced = FALSE,
1628 BOOL bNoProgressBar = FALSE );
1629 void ClearFormulaTree();
1630 void AppendToFormulaTrack( ScFormulaCell* pCell );
1631 void RemoveFromFormulaTrack( ScFormulaCell* pCell );
1632 void TrackFormulas( ULONG nHintId = SC_HINT_DATACHANGED );
1633 USHORT GetFormulaTrackCount() const { return nFormulaTrackCount; }
1634 BOOL IsInFormulaTree( ScFormulaCell* pCell ) const;
1635 BOOL IsInFormulaTrack( ScFormulaCell* pCell ) const;
1636 USHORT GetHardRecalcState() { return nHardRecalcState; }
1637 void SetHardRecalcState( USHORT nVal ) { nHardRecalcState = nVal; }
1638 void StartAllListeners();
1639 const ScFormulaCell* GetFormulaTree() const { return pFormulaTree; }
1640 BOOL HasForcedFormulas() const { return bHasForcedFormulas; }
1641 void SetForcedFormulas( BOOL bVal ) { bHasForcedFormulas = bVal; }
1642 ULONG GetFormulaCodeInTree() const { return nFormulaCodeInTree; }
1643 BOOL IsInInterpreter() const { return nInterpretLevel != 0; }
1644 USHORT GetInterpretLevel() { return nInterpretLevel; }
1645 void IncInterpretLevel()
1647 if ( nInterpretLevel < USHRT_MAX )
1648 nInterpretLevel++;
1650 void DecInterpretLevel()
1652 if ( nInterpretLevel )
1653 nInterpretLevel--;
1655 BOOL IsInMacroInterpreter() const { return nMacroInterpretLevel != 0; }
1656 USHORT GetMacroInterpretLevel() { return nMacroInterpretLevel; }
1657 void IncMacroInterpretLevel()
1659 if ( nMacroInterpretLevel < USHRT_MAX )
1660 nMacroInterpretLevel++;
1662 void DecMacroInterpretLevel()
1664 if ( nMacroInterpretLevel )
1665 nMacroInterpretLevel--;
1667 BOOL IsInInterpreterTableOp() const { return nInterpreterTableOpLevel != 0; }
1668 USHORT GetInterpreterTableOpLevel() { return nInterpreterTableOpLevel; }
1669 void IncInterpreterTableOpLevel()
1671 if ( nInterpreterTableOpLevel < USHRT_MAX )
1672 nInterpreterTableOpLevel++;
1674 void DecInterpreterTableOpLevel()
1676 if ( nInterpreterTableOpLevel )
1677 nInterpreterTableOpLevel--;
1679 // add a formula to be remembered for TableOp broadcasts
1680 void AddTableOpFormulaCell( ScFormulaCell* );
1681 void InvalidateLastTableOpParams() { aLastTableOpParams.bValid = FALSE; }
1682 ScRecursionHelper& GetRecursionHelper()
1684 if (!pRecursionHelper)
1685 pRecursionHelper = CreateRecursionHelperInstance();
1686 return *pRecursionHelper;
1688 BOOL IsInDtorClear() const { return bInDtorClear; }
1689 void SetExpandRefs( BOOL bVal ) { bExpandRefs = bVal; }
1690 BOOL IsExpandRefs() { return bExpandRefs; }
1692 SC_DLLPUBLIC void IncSizeRecalcLevel( SCTAB nTab );
1693 SC_DLLPUBLIC void DecSizeRecalcLevel( SCTAB nTab );
1695 ULONG GetXMLImportedFormulaCount() const { return nXMLImportedFormulaCount; }
1696 void IncXMLImportedFormulaCount( ULONG nVal )
1698 if ( nXMLImportedFormulaCount + nVal > nXMLImportedFormulaCount )
1699 nXMLImportedFormulaCount += nVal;
1701 void DecXMLImportedFormulaCount( ULONG nVal )
1703 if ( nVal <= nXMLImportedFormulaCount )
1704 nXMLImportedFormulaCount -= nVal;
1705 else
1706 nXMLImportedFormulaCount = 0;
1709 void StartTrackTimer();
1711 void CompileDBFormula();
1712 void CompileDBFormula( BOOL bCreateFormulaString );
1713 void CompileNameFormula( BOOL bCreateFormulaString );
1714 void CompileColRowNameFormula();
1716 /** Maximum string length of a column, e.g. for dBase export.
1717 @return String length in octets (!) of the destination encoding. In
1718 case of non-octet encodings (e.g. UCS2) the length in code
1719 points times sizeof(sal_Unicode) is returned. */
1720 sal_Int32 GetMaxStringLen( SCTAB nTab, SCCOL nCol,
1721 SCROW nRowStart, SCROW nRowEnd,
1722 CharSet eCharSet ) const;
1723 /** Maximum string length of numerical cells of a column, e.g. for dBase export.
1724 @return String length in characters (!) including the decimal
1725 separator, and the decimal precision needed. */
1726 xub_StrLen GetMaxNumberStringLen( USHORT& nPrecision,
1727 SCTAB nTab, SCCOL nCol,
1728 SCROW nRowStart, SCROW nRowEnd ) const;
1730 void KeyInput( const KeyEvent& rKEvt ); // TimerDelays etc.
1732 ScChangeTrack* GetChangeTrack() const { return pChangeTrack; }
1734 //! only for import filter, deletes any existing ChangeTrack via
1735 //! EndChangeTracking() and takes ownership of new ChangeTrack pTrack
1736 SC_DLLPUBLIC void SetChangeTrack( ScChangeTrack* pTrack );
1738 void StartChangeTracking();
1739 void EndChangeTracking();
1741 SC_DLLPUBLIC void CompareDocument( ScDocument& rOtherDoc );
1743 void AddUnoObject( SfxListener& rObject );
1744 void RemoveUnoObject( SfxListener& rObject );
1745 void BroadcastUno( const SfxHint &rHint );
1746 void AddUnoListenerCall( const ::com::sun::star::uno::Reference<
1747 ::com::sun::star::util::XModifyListener >& rListener,
1748 const ::com::sun::star::lang::EventObject& rEvent );
1750 void SetInLinkUpdate(BOOL bSet); // TableLink or AreaLink
1751 BOOL IsInLinkUpdate() const; // including DdeLink
1753 SC_DLLPUBLIC SfxItemPool* GetEditPool() const;
1754 SC_DLLPUBLIC SfxItemPool* GetEnginePool() const;
1755 SC_DLLPUBLIC ScFieldEditEngine& GetEditEngine();
1756 SC_DLLPUBLIC ScNoteEditEngine& GetNoteEngine();
1757 //UNUSED2009-05 SfxItemPool& GetNoteItemPool();
1759 ScRefreshTimerControl* GetRefreshTimerControl() const
1760 { return pRefreshTimerControl; }
1761 ScRefreshTimerControl * const * GetRefreshTimerControlAddress() const
1762 { return &pRefreshTimerControl; }
1764 void SetPastingDrawFromOtherDoc( BOOL bVal )
1765 { bPastingDrawFromOtherDoc = bVal; }
1766 BOOL PastingDrawFromOtherDoc() const
1767 { return bPastingDrawFromOtherDoc; }
1769 /// an ID unique to each document instance
1770 sal_uInt32 GetDocumentID() const;
1772 void InvalidateStyleSheetUsage()
1773 { bStyleSheetUsageInvalid = TRUE; }
1774 void GetSortParam( ScSortParam& rParam, SCTAB nTab );
1775 void SetSortParam( ScSortParam& rParam, SCTAB nTab );
1777 com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > GetVbaEventsHelper();
1779 /** Should only be GRAM_PODF or GRAM_ODFF. */
1780 void SetStorageGrammar( formula::FormulaGrammar::Grammar eGrammar );
1781 formula::FormulaGrammar::Grammar GetStorageGrammar() const
1782 { return eStorageGrammar; }
1784 SfxUndoManager* GetUndoManager();
1785 private: // CLOOK-Impl-Methoden
1787 /**
1788 * Use this class as a locale variable to merge number formatter from
1789 * another document, and set NULL pointer to pFormatExchangeList when
1790 * done.
1792 class NumFmtMergeHandler
1794 public:
1795 explicit NumFmtMergeHandler(ScDocument* pDoc, ScDocument* pSrcDoc);
1796 ~NumFmtMergeHandler();
1798 private:
1799 ScDocument* mpDoc;
1802 void MergeNumberFormatter(ScDocument* pSrcDoc);
1804 void ImplCreateOptions(); // bei Gelegenheit auf on-demand umstellen?
1805 void ImplDeleteOptions();
1807 void DeleteDrawLayer();
1808 void DeleteColorTable();
1809 SC_DLLPUBLIC BOOL DrawGetPrintArea( ScRange& rRange, BOOL bSetHor, BOOL bSetVer ) const;
1810 void DrawMovePage( USHORT nOldPos, USHORT nNewPos );
1811 void DrawCopyPage( USHORT nOldPos, USHORT nNewPos );
1813 void UpdateDrawPrinter();
1814 void UpdateDrawLanguages();
1815 void UpdateDrawDefaults();
1816 SC_DLLPUBLIC void InitClipPtrs( ScDocument* pSourceDoc );
1818 void LoadDdeLinks(SvStream& rStream);
1819 void SaveDdeLinks(SvStream& rStream) const;
1821 void DeleteAreaLinksOnTab( SCTAB nTab );
1822 void UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode,
1823 const ScRange& r, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
1825 void CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, const ScMarkData* pMarks, bool bAllTabs);
1826 void CopyRangeNamesFromClip(ScDocument* pClipDoc, ScClipRangeNameData& rRangeNames);
1827 void UpdateRangeNamesInFormulas(
1828 ScClipRangeNameData& rRangeNames, const ScRangeList& rDestRanges, const ScMarkData& rMark,
1829 SCCOL nXw, SCROW nYw);
1831 BOOL HasPartOfMerged( const ScRange& rRange );
1833 std::map< SCTAB, ScSortParam > mSheetSortParams;
1836 inline void ScDocument::GetSortParam( ScSortParam& rParam, SCTAB nTab )
1838 rParam = mSheetSortParams[ nTab ];
1841 inline void ScDocument::SetSortParam( ScSortParam& rParam, SCTAB nTab )
1843 mSheetSortParams[ nTab ] = rParam;
1847 inline ULONG ScDocument::FastGetScaledRowHeight( SCROW nStartRow, SCROW nEndRow,
1848 SCTAB nTab, double fScale ) const
1850 ULONG nHeight = FastGetRowHeight(nStartRow, nEndRow, nTab);
1851 return nHeight * fScale;
1854 inline USHORT ScDocument::FastGetRowHeight( SCROW nRow, SCTAB nTab ) const
1856 return pTab[nTab]->GetRowHeight(nRow);
1859 inline SCROW ScDocument::FastGetRowForHeight( SCTAB nTab, ULONG nHeight ) const
1861 return pTab[nTab]->GetRowForHeight(nHeight);
1864 inline USHORT ScDocument::FastGetOriginalRowHeight( SCROW nRow, SCTAB nTab ) const
1866 return pTab[nTab]->pRowHeight->GetValue(nRow);
1869 #endif