update dev300-m57
[ooovba.git] / sc / inc / document.hxx
blobcd19d02dd64f9286332c02933b4409832b950e36
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>
51 class KeyEvent;
52 class OutputDevice;
53 class SdrObject;
54 class SfxBroadcaster;
55 class SfxListener;
56 class SfxHint;
57 class SfxItemSet;
58 class SfxObjectShell;
59 class SfxBindings;
60 class SfxPoolItem;
61 class SfxItemPool;
62 class SfxPrinter;
63 class SfxStatusBarManager;
64 class SfxStyleSheetBase;
65 class SvMemoryStream;
66 class SvNumberFormatter;
67 class SvxBorderLine;
68 class SvxBoxInfoItem;
69 class SvxBoxItem;
70 class SvxBrushItem;
71 class SvxForbiddenCharactersTable;
72 class SvxLinkManager;
73 class SvxSearchItem;
74 class SvxShadowItem;
75 class Window;
76 class XColorTable;
77 class List;
79 class ScAutoFormatData;
80 class ScBaseCell;
81 class ScStringCell;
82 class ScBroadcastAreaSlotMachine;
83 class ScChangeViewSettings;
84 class ScChartCollection;
85 class ScChartListenerCollection;
86 class ScConditionalFormat;
87 class ScConditionalFormatList;
88 class ScDBCollection;
89 class ScDBData;
90 class ScDetOpData;
91 class ScDetOpList;
92 class ScDocOptions;
93 class ScDocProtection;
94 class ScDocumentPool;
95 class ScDrawLayer;
96 class ScExtDocOptions;
97 class ScExternalRefManager;
98 class ScFormulaCell;
99 class ScMacroManager;
100 class ScMarkData;
101 class ScOutlineTable;
102 class ScPatternAttr;
103 class ScPrintRangeSaver;
104 class ScRangeData;
105 class ScRangeName;
106 class ScStyleSheet;
107 class ScStyleSheetPool;
108 class ScTable;
109 class ScTableProtection;
110 class ScTokenArray;
111 class ScValidationData;
112 class ScValidationDataList;
113 class ScViewOptions;
114 class ScStrCollection;
115 class TypedScStrCollection;
116 class ScChangeTrack;
117 class ScFieldEditEngine;
118 class ScNoteEditEngine;
119 struct ScConsolidateParam;
120 class ScDPObject;
121 class ScDPCollection;
122 class ScMatrix;
123 class ScScriptTypeData;
124 class ScPoolHelper;
125 struct ScSortParam;
126 class ScRefreshTimerControl;
127 class ScUnoListenerCalls;
128 class ScUnoRefList;
129 class ScRecursionHelper;
130 struct RowInfo;
131 struct ScTableInfo;
132 struct ScTabOpParam;
133 class VirtualDevice;
134 class ScAutoNameCache;
135 class ScTemporaryChartLock;
136 class ScLookupCache;
137 struct ScLookupCacheMapImpl;
138 struct ScClipParam;
139 struct ScClipRangeNameData;
140 class SfxUndoManager;
141 class ScFormulaParserPool;
143 namespace com { namespace sun { namespace star {
144 namespace lang {
145 class XMultiServiceFactory;
146 struct EventObject;
148 namespace i18n {
149 class XBreakIterator;
151 namespace util {
152 class XModifyListener;
154 namespace embed {
155 class XEmbeddedObject;
157 } } }
159 namespace com { namespace sun { namespace star { namespace document {
160 class XVbaEventsHelper;
161 } } } }
162 #include <svtools/zforlist.hxx>
164 #ifdef _ZFORLIST_DECLARE_TABLE
165 class SvNumberFormatterIndexTable;
166 #else
167 class Table;
168 typedef Table SvNumberFormatterIndexTable;
169 #endif
172 #define SC_DOC_NEW 0xFFFF
174 #define SC_MACROCALL_ALLOWED 0
175 #define SC_MACROCALL_NOTALLOWED 1
176 #define SC_MACROCALL_ASK 2
178 #define SC_ASIANCOMPRESSION_INVALID 0xff
179 #define SC_ASIANKERNING_INVALID 0xff
182 enum ScDocumentMode
184 SCDOCMODE_DOCUMENT,
185 SCDOCMODE_CLIP,
186 SCDOCMODE_UNDO
190 struct ScDocStat
192 String aDocName;
193 SCTAB nTableCount;
194 ULONG nCellCount;
195 USHORT nPageCount;
198 // The constant parameters to CopyBlockFromClip
199 struct ScCopyBlockFromClipParams
201 ScDocument* pRefUndoDoc;
202 ScDocument* pClipDoc;
203 USHORT nInsFlag;
204 SCTAB nTabStart;
205 SCTAB nTabEnd;
206 BOOL bAsLink;
207 BOOL bSkipAttrForEmpty;
211 // for loading of binary file format symbol string cells which need font conversion
212 struct ScSymbolStringCellEntry
214 ScStringCell* pCell;
215 SCROW nRow;
219 // -----------------------------------------------------------------------
221 // DDE link modes
222 const BYTE SC_DDE_DEFAULT = 0;
223 const BYTE SC_DDE_ENGLISH = 1;
224 const BYTE SC_DDE_TEXT = 2;
225 const BYTE SC_DDE_IGNOREMODE = 255; /// For usage in FindDdeLink() only!
228 // -----------------------------------------------------------------------
230 class ScDocument
232 friend class ScDocumentIterator;
233 friend class ScValueIterator;
234 friend class ScQueryValueIterator;
235 friend class ScCellIterator;
236 friend class ScQueryCellIterator;
237 friend class ScHorizontalCellIterator;
238 friend class ScHorizontalAttrIterator;
239 friend class ScDocAttrIterator;
240 friend class ScAttrRectIterator;
241 friend class ScDocShell;
243 private:
244 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager;
246 vos::ORef<ScPoolHelper> xPoolHelper;
248 SfxUndoManager* mpUndoManager;
249 ScFieldEditEngine* pEditEngine; // uses pEditPool from xPoolHelper
250 ScNoteEditEngine* pNoteEngine; // uses pEditPool from xPoolHelper
251 SfxItemPool* pNoteItemPool; // SfxItemPool to be used if pDrawLayer not created.
252 SfxObjectShell* pShell;
253 SfxPrinter* pPrinter;
254 VirtualDevice* pVirtualDevice_100th_mm;
255 ScDrawLayer* pDrawLayer; // SdrModel
256 XColorTable* pColorTable;
257 ScConditionalFormatList* pCondFormList; // bedingte Formate
258 ScValidationDataList* pValidationList; // Gueltigkeit
259 SvNumberFormatterIndexTable* pFormatExchangeList; // zum Umsetzen von Zahlenformaten
260 ScTable* pTab[MAXTABCOUNT];
261 ScRangeName* pRangeName;
262 ScDBCollection* pDBCollection;
263 ScDPCollection* pDPCollection;
264 ScChartCollection* pChartCollection;
265 std::auto_ptr< ScTemporaryChartLock > apTemporaryChartLock;
266 ScPatternAttr* pSelectionAttr; // Attribute eines Blocks
267 SvxLinkManager* pLinkManager;
268 ScFormulaCell* pFormulaTree; // Berechnungsbaum Start
269 ScFormulaCell* pEOFormulaTree; // Berechnungsbaum Ende, letzte Zelle
270 ScFormulaCell* pFormulaTrack; // BroadcastTrack Start
271 ScFormulaCell* pEOFormulaTrack; // BrodcastTrack Ende, letzte Zelle
272 ScBroadcastAreaSlotMachine* pBASM; // BroadcastAreas
273 ScChartListenerCollection* pChartListenerCollection;
274 ScStrCollection* pOtherObjects; // non-chart OLE objects
275 SvMemoryStream* pClipData;
276 ScDetOpList* pDetOpList;
277 ScChangeTrack* pChangeTrack;
278 SfxBroadcaster* pUnoBroadcaster;
279 ScUnoListenerCalls* pUnoListenerCalls;
280 ScUnoRefList* pUnoRefUndoList;
281 ScChangeViewSettings* pChangeViewSettings;
282 ScScriptTypeData* pScriptTypeData;
283 ScRefreshTimerControl* pRefreshTimerControl;
284 vos::ORef<SvxForbiddenCharactersTable> xForbiddenCharacters;
286 ScFieldEditEngine* pCacheFieldEditEngine;
288 ::std::auto_ptr<ScDocProtection> pDocProtection;
289 ::std::auto_ptr<ScClipParam> mpClipParam;
291 ::std::auto_ptr<ScExternalRefManager> pExternalRefMgr;
292 ::std::auto_ptr<ScMacroManager> mpMacroMgr;
295 // mutable for lazy construction
296 mutable ::std::auto_ptr< ScFormulaParserPool >
297 mxFormulaParserPool; /// Pool for all external formula parsers used by this document.
299 String aDocName; // opt: Dokumentname
300 String aDocCodeName; // opt: Dokumentname
301 ScRangePairListRef xColNameRanges;
302 ScRangePairListRef xRowNameRanges;
304 ScViewOptions* pViewOptions; // View-Optionen
305 ScDocOptions* pDocOptions; // Dokument-Optionen
306 ScExtDocOptions* pExtDocOptions; // fuer Import etc.
307 ScConsolidateParam* pConsolidateDlgData;
309 ScRecursionHelper* pRecursionHelper; // information for recursive and iterative cell formulas
311 ScAutoNameCache* pAutoNameCache; // for automatic name lookup during CompileXML
313 ScLookupCacheMapImpl* pLookupCacheMapImpl; // cache for lookups like VLOOKUP and MATCH
315 sal_Int64 nUnoObjectId; // counted up for UNO objects
317 sal_uInt32 nRangeOverflowType; // used in (xml) loading for overflow warnings
319 ScRange aEmbedRange;
320 ScAddress aCurTextWidthCalcPos;
321 ScAddress aOnlineSpellPos; // within whole document
322 ScRange aVisSpellRange;
323 ScAddress aVisSpellPos; // within aVisSpellRange (see nVisSpellState)
325 Timer aTrackTimer;
327 com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > mxVbaEventsHelper;
329 public:
330 ScTabOpList aTableOpList; // list of ScInterpreterTableOpParams currently in use
331 ScInterpreterTableOpParams aLastTableOpParams; // remember last params
332 private:
334 LanguageType eLanguage; // default language
335 LanguageType eCjkLanguage; // default language for asian text
336 LanguageType eCtlLanguage; // default language for complex text
337 CharSet eSrcSet; // Einlesen: Quell-Zeichensatz
339 /** The compiler grammar used in document storage. GRAM_PODF for ODF 1.1
340 documents, GRAM_ODFF for ODF 1.2 documents. */
341 formula::FormulaGrammar::Grammar eStorageGrammar;
343 /** The compiler grammar used in ODF import after brackets had been
344 stripped (which they shouldn't, but until that's fixed) by the XML
345 importer. */
346 formula::FormulaGrammar::Grammar eXmlImportGrammar;
348 ULONG nFormulaCodeInTree; // FormelRPN im Formelbaum
349 ULONG nXMLImportedFormulaCount; // progress count during XML import
350 USHORT nInterpretLevel; // >0 wenn im Interpreter
351 USHORT nMacroInterpretLevel; // >0 wenn Macro im Interpreter
352 USHORT nInterpreterTableOpLevel; // >0 if in Interpreter TableOp
353 SCTAB nMaxTableNumber;
354 USHORT nSrcVer; // Dateiversion (Laden/Speichern)
355 SCROW nSrcMaxRow; // Zeilenzahl zum Laden/Speichern
356 USHORT nFormulaTrackCount;
357 USHORT nHardRecalcState; // 0: soft, 1: hard-warn, 2: hard
358 SCTAB nVisibleTab; // fuer OLE etc.
360 ScLkUpdMode eLinkMode;
362 BOOL bAutoCalc; // Automatisch Berechnen
363 BOOL bAutoCalcShellDisabled; // in/von/fuer ScDocShell disabled
364 // ob noch ForcedFormulas berechnet werden muessen,
365 // im Zusammenspiel mit ScDocShell SetDocumentModified,
366 // AutoCalcShellDisabled und TrackFormulas
367 BOOL bForcedFormulaPending;
368 BOOL bCalculatingFormulaTree;
369 BOOL bIsClip;
370 BOOL bIsUndo;
371 BOOL bIsVisible; // set from view ctor
373 BOOL bIsEmbedded; // Embedded-Bereich anzeigen/anpassen ?
375 // kein SetDirty bei ScFormulaCell::CompileTokenArray sondern am Ende
376 // von ScDocument::CompileAll[WithFormats], CopyScenario, CopyBlockFromClip
377 BOOL bNoSetDirty;
378 // kein Broadcast, keine Listener aufbauen waehrend aus einem anderen
379 // Doc (per Filter o.ae.) inserted wird, erst bei CompileAll / CalcAfterLoad
380 BOOL bInsertingFromOtherDoc;
381 bool bLoadingMedium;
382 BOOL bImportingXML; // special handling of formula text
383 BOOL bXMLFromWrapper; // distinguish ScXMLImportWrapper from external component
384 BOOL bCalcingAfterLoad; // in CalcAfterLoad TRUE
385 // wenn temporaer keine Listener auf/abgebaut werden sollen
386 BOOL bNoListening;
387 BOOL bLoadingDone;
388 BOOL bIdleDisabled;
389 BOOL bInLinkUpdate; // TableLink or AreaLink
390 BOOL bChartListenerCollectionNeedsUpdate;
391 // ob RC_FORCED Formelzellen im Dokument sind/waren (einmal an immer an)
392 BOOL bHasForcedFormulas;
393 // ob das Doc gerade zerstoert wird (kein Notify-Tracking etc. mehr)
394 BOOL bInDtorClear;
395 // ob bei Spalte/Zeile einfuegen am Rand einer Referenz die Referenz
396 // erweitert wird, wird in jedem UpdateReference aus InputOptions geholt,
397 // gesetzt und am Ende von UpdateReference zurueckgesetzt
398 BOOL bExpandRefs;
399 // fuer Detektiv-Update, wird bei jeder Aenderung an Formeln gesetzt
400 BOOL bDetectiveDirty;
402 BYTE nMacroCallMode; // Makros per Warnung-Dialog disabled?
403 BOOL bHasMacroFunc; // valid only after loading
405 BYTE nVisSpellState;
407 BYTE nAsianCompression;
408 BYTE nAsianKerning;
409 BOOL bSetDrawDefaults;
411 BOOL bPastingDrawFromOtherDoc;
413 BYTE nInDdeLinkUpdate; // originating DDE links (stacked bool)
415 BOOL bInUnoBroadcast;
416 BOOL bInUnoListenerCall;
417 formula::FormulaGrammar::Grammar eGrammar;
419 mutable BOOL bStyleSheetUsageInvalid;
421 bool mbUndoEnabled;
422 bool mbAdjustHeightEnabled;
423 bool mbExecuteLinkEnabled;
424 bool mbChangeReadOnlyEnabled; // allow changes in read-only document (for API import filters)
426 sal_Int16 mnNamedRangesLockCount;
428 // for worksheet calculate event
429 ::std::vector< SCTAB > maTabs;
431 inline BOOL RowHidden( SCROW nRow, SCTAB nTab ); // FillInfo
433 public:
434 SC_DLLPUBLIC ULONG GetCellCount() const; // alle Zellen
435 ULONG GetWeightedCount() const; // Formeln und Edit staerker gewichtet
436 ULONG GetCodeCount() const; // RPN-Code in Formeln
437 DECL_LINK( GetUserDefinedColor, USHORT * );
438 BOOL RowFiltered( SCROW nRow, SCTAB nTab ) const; // FillInfo
439 BOOL ColFiltered( SCCOL nCol, SCTAB nTab ) const; // FillInfo
440 // Numberformatter
442 public:
443 SC_DLLPUBLIC ScDocument( ScDocumentMode eMode = SCDOCMODE_DOCUMENT,
444 SfxObjectShell* pDocShell = NULL );
445 SC_DLLPUBLIC ~ScDocument();
447 inline ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
448 GetServiceManager() const { return xServiceManager; }
450 SC_DLLPUBLIC const String& GetName() const { return aDocName; }
451 void SetName( const String& r ) { aDocName = r; }
452 const String& GetCodeName() const { return aDocCodeName; }
453 void SetCodeName( const String& r ) { aDocCodeName = r; }
455 void GetDocStat( ScDocStat& rDocStat );
457 SC_DLLPUBLIC void InitDrawLayer( SfxObjectShell* pDocShell = NULL );
458 XColorTable* GetColorTable();
460 SvxLinkManager* GetLinkManager() { return pLinkManager; }
462 SC_DLLPUBLIC const ScDocOptions& GetDocOptions() const;
463 SC_DLLPUBLIC void SetDocOptions( const ScDocOptions& rOpt );
464 SC_DLLPUBLIC const ScViewOptions& GetViewOptions() const;
465 SC_DLLPUBLIC void SetViewOptions( const ScViewOptions& rOpt );
466 void SetPrintOptions();
468 ScExtDocOptions* GetExtDocOptions() { return pExtDocOptions; }
469 SC_DLLPUBLIC void SetExtDocOptions( ScExtDocOptions* pNewOptions );
471 void GetLanguage( LanguageType& rLatin, LanguageType& rCjk, LanguageType& rCtl ) const;
472 void SetLanguage( LanguageType eLatin, LanguageType eCjk, LanguageType eCtl );
474 void SetDrawDefaults();
476 void SetConsolidateDlgData( const ScConsolidateParam* pData );
477 const ScConsolidateParam* GetConsolidateDlgData() const { return pConsolidateDlgData; }
479 void Clear( sal_Bool bFromDestructor = sal_False );
481 ScFieldEditEngine* CreateFieldEditEngine();
482 void DisposeFieldEditEngine(ScFieldEditEngine*& rpEditEngine);
484 SC_DLLPUBLIC ScRangeName* GetRangeName();
485 void SetRangeName( ScRangeName* pNewRangeName );
486 SCTAB GetMaxTableNumber() { return nMaxTableNumber; }
487 void SetMaxTableNumber(SCTAB nNumber) { nMaxTableNumber = nNumber; }
489 ScRangePairList* GetColNameRanges() { return &xColNameRanges; }
490 ScRangePairList* GetRowNameRanges() { return &xRowNameRanges; }
491 ScRangePairListRef& GetColNameRangesRef() { return xColNameRanges; }
492 ScRangePairListRef& GetRowNameRangesRef() { return xRowNameRanges; }
494 SC_DLLPUBLIC ScDBCollection* GetDBCollection() const;
495 void SetDBCollection( ScDBCollection* pNewDBCollection,
496 BOOL bRemoveAutoFilter = FALSE );
497 ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab,
498 BOOL bStartOnly = FALSE) const;
499 ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const;
501 //UNUSED2008-05 ScRangeData* GetRangeAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab,
502 //UNUSED2008-05 BOOL bStartOnly = FALSE) const;
503 SC_DLLPUBLIC ScRangeData* GetRangeAtBlock( const ScRange& rBlock, String* pName=NULL ) const;
505 SC_DLLPUBLIC ScDPCollection* GetDPCollection();
506 ScDPObject* GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
507 ScDPObject* GetDPAtBlock( const ScRange& rBlock ) const;
508 SC_DLLPUBLIC ScChartCollection* GetChartCollection() const;
510 void StopTemporaryChartLock();
512 void EnsureGraphicNames();
514 SdrObject* GetObjectAtPoint( SCTAB nTab, const Point& rPos );
515 BOOL HasChartAtPoint( SCTAB nTab, const Point& rPos, String* pName = NULL );
517 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > GetChartByName( const String& rChartName );
518 SC_DLLPUBLIC void GetChartRanges( const String& rChartName, ::std::vector< ScRangeList >& rRanges, ScDocument* pSheetNameDoc );
519 void SetChartRanges( const String& rChartName, const ::std::vector< ScRangeList >& rRanges );
521 void UpdateChartArea( const String& rChartName, const ScRange& rNewArea,
522 BOOL bColHeaders, BOOL bRowHeaders, BOOL bAdd );
523 void UpdateChartArea( const String& rChartName,
524 const ScRangeListRef& rNewList,
525 BOOL bColHeaders, BOOL bRowHeaders, BOOL bAdd );
526 void GetOldChartParameters( const String& rName,
527 ScRangeList& rRanges, BOOL& rColHeaders, BOOL& rRowHeaders );
528 ::com::sun::star::uno::Reference<
529 ::com::sun::star::embed::XEmbeddedObject >
530 FindOleObjectByName( const String& rName );
532 SC_DLLPUBLIC void MakeTable( SCTAB nTab );
534 SCTAB GetVisibleTab() const { return nVisibleTab; }
535 SC_DLLPUBLIC void SetVisibleTab(SCTAB nTab) { nVisibleTab = nTab; }
537 SC_DLLPUBLIC BOOL HasTable( SCTAB nTab ) const;
538 SC_DLLPUBLIC BOOL GetName( SCTAB nTab, String& rName ) const;
539 SC_DLLPUBLIC BOOL GetCodeName( SCTAB nTab, String& rName ) const;
540 SC_DLLPUBLIC BOOL SetCodeName( SCTAB nTab, String& rName );
541 SC_DLLPUBLIC BOOL GetTable( const String& rName, SCTAB& rTab ) const;
542 SC_DLLPUBLIC inline SCTAB GetTableCount() const { return nMaxTableNumber; }
543 SvNumberFormatterIndexTable* GetFormatExchangeList() const { return pFormatExchangeList; }
545 SC_DLLPUBLIC ScDocProtection* GetDocProtection() const;
546 SC_DLLPUBLIC void SetDocProtection(const ScDocProtection* pProtect);
547 SC_DLLPUBLIC BOOL IsDocProtected() const;
548 BOOL IsDocEditable() const;
549 SC_DLLPUBLIC BOOL IsTabProtected( SCTAB nTab ) const;
550 SC_DLLPUBLIC ScTableProtection* GetTabProtection( SCTAB nTab ) const;
551 SC_DLLPUBLIC void SetTabProtection(SCTAB nTab, const ScTableProtection* pProtect);
552 void CopyTabProtection(SCTAB nTabSrc, SCTAB nTabDest);
554 void LockTable(SCTAB nTab);
555 void UnlockTable(SCTAB nTab);
557 BOOL IsBlockEditable( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
558 SCCOL nEndCol, SCROW nEndRow,
559 BOOL* pOnlyNotBecauseOfMatrix = NULL ) const;
560 BOOL IsSelectionEditable( const ScMarkData& rMark,
561 BOOL* pOnlyNotBecauseOfMatrix = NULL ) const;
562 BOOL HasSelectedBlockMatrixFragment( SCCOL nStartCol, SCROW nStartRow,
563 SCCOL nEndCol, SCROW nEndRow,
564 const ScMarkData& rMark ) const;
566 BOOL GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMatrix );
568 BOOL IsEmbedded() const;
569 void GetEmbedded( ScRange& rRange ) const;
570 void SetEmbedded( const ScRange& rRange );
571 void ResetEmbedded();
572 Rectangle GetEmbeddedRect() const; // 1/100 mm
573 void SetEmbedded( const Rectangle& rRect ); // aus VisArea (1/100 mm)
574 void SnapVisArea( Rectangle& rRect ) const; // 1/100 mm
576 SC_DLLPUBLIC BOOL ValidTabName( const String& rName ) const;
577 SC_DLLPUBLIC BOOL ValidNewTabName( const String& rName ) const;
578 SC_DLLPUBLIC void CreateValidTabName(String& rName) const;
579 SC_DLLPUBLIC BOOL InsertTab( SCTAB nPos, const String& rName,
580 BOOL bExternalDocument = FALSE );
581 SC_DLLPUBLIC BOOL DeleteTab( SCTAB nTab, ScDocument* pRefUndoDoc = NULL );
582 SC_DLLPUBLIC BOOL RenameTab( SCTAB nTab, const String& rName,
583 BOOL bUpdateRef = TRUE,
584 BOOL bExternalDocument = FALSE );
585 BOOL MoveTab( SCTAB nOldPos, SCTAB nNewPos );
586 BOOL CopyTab( SCTAB nOldPos, SCTAB nNewPos,
587 const ScMarkData* pOnlyMarked = NULL );
588 SC_DLLPUBLIC ULONG TransferTab(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos,
589 BOOL bInsertNew = TRUE,
590 BOOL bResultsOnly = FALSE );
591 SC_DLLPUBLIC void TransferDrawPage(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos);
592 SC_DLLPUBLIC void SetVisible( SCTAB nTab, BOOL bVisible );
593 SC_DLLPUBLIC BOOL IsVisible( SCTAB nTab ) const;
594 BOOL IsPendingRowHeights( SCTAB nTab ) const;
595 void SetPendingRowHeights( SCTAB nTab, BOOL bSet );
596 SC_DLLPUBLIC void SetLayoutRTL( SCTAB nTab, BOOL bRTL );
597 SC_DLLPUBLIC BOOL IsLayoutRTL( SCTAB nTab ) const;
598 BOOL IsNegativePage( SCTAB nTab ) const;
599 SC_DLLPUBLIC void SetScenario( SCTAB nTab, BOOL bFlag );
600 SC_DLLPUBLIC BOOL IsScenario( SCTAB nTab ) const;
601 SC_DLLPUBLIC void GetScenarioData( SCTAB nTab, String& rComment,
602 Color& rColor, USHORT& rFlags ) const;
603 SC_DLLPUBLIC void SetScenarioData( SCTAB nTab, const String& rComment,
604 const Color& rColor, USHORT nFlags );
605 void GetScenarioFlags( SCTAB nTab, USHORT& rFlags ) const;
606 SC_DLLPUBLIC BOOL IsActiveScenario( SCTAB nTab ) const;
607 SC_DLLPUBLIC void SetActiveScenario( SCTAB nTab, BOOL bActive ); // nur fuer Undo etc.
608 SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const;
609 SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const;
610 void SetGrammar( formula::FormulaGrammar::Grammar eGram );
611 SC_DLLPUBLIC BYTE GetLinkMode( SCTAB nTab ) const;
612 BOOL IsLinked( SCTAB nTab ) const;
613 SC_DLLPUBLIC const String& GetLinkDoc( SCTAB nTab ) const;
614 const String& GetLinkFlt( SCTAB nTab ) const;
615 const String& GetLinkOpt( SCTAB nTab ) const;
616 SC_DLLPUBLIC const String& GetLinkTab( SCTAB nTab ) const;
617 ULONG GetLinkRefreshDelay( SCTAB nTab ) const;
618 void SetLink( SCTAB nTab, BYTE nMode, const String& rDoc,
619 const String& rFilter, const String& rOptions,
620 const String& rTabName, ULONG nRefreshDelay );
621 BOOL HasLink( const String& rDoc,
622 const String& rFilter, const String& rOptions ) const;
623 SC_DLLPUBLIC BOOL LinkExternalTab( SCTAB& nTab, const String& aDocTab,
624 const String& aFileName,
625 const String& aTabName );
627 bool HasExternalRefManager() { return pExternalRefMgr.get(); }
628 SC_DLLPUBLIC ScExternalRefManager* GetExternalRefManager();
629 bool IsInExternalReferenceMarking() const;
630 void MarkUsedExternalReferences();
631 bool MarkUsedExternalReferences( ScTokenArray & rArr );
633 /** Returns the pool containing external formula parsers. Creates the pool
634 on first call. */
635 ScFormulaParserPool& GetFormulaParserPool() const;
637 BOOL HasDdeLinks() const;
638 BOOL HasAreaLinks() const;
639 void UpdateExternalRefLinks();
640 void UpdateDdeLinks();
641 void UpdateAreaLinks();
643 // originating DDE links
644 void IncInDdeLinkUpdate() { if ( nInDdeLinkUpdate < 255 ) ++nInDdeLinkUpdate; }
645 void DecInDdeLinkUpdate() { if ( nInDdeLinkUpdate ) --nInDdeLinkUpdate; }
646 BOOL IsInDdeLinkUpdate() const { return nInDdeLinkUpdate != 0; }
648 SC_DLLPUBLIC void CopyDdeLinks( ScDocument* pDestDoc ) const;
649 void DisconnectDdeLinks();
651 // Fuer StarOne Api:
652 USHORT GetDdeLinkCount() const;
653 BOOL UpdateDdeLink( const String& rAppl, const String& rTopic, const String& rItem );
655 /** Tries to find a DDE link with the specified connection data.
656 @param rnDdePos (out-param) Returns the index of the DDE link (does not include other links from link manager).
657 @return true = DDE link found, rnDdePos valid. */
658 SC_DLLPUBLIC bool FindDdeLink( const String& rAppl, const String& rTopic, const String& rItem, BYTE nMode, USHORT& rnDdePos );
660 /** Returns the connection data of the specified DDE link.
661 @param nDdePos Index of the DDE link (does not include other links from link manager).
662 @param rAppl (out-param) The application name.
663 @param rTopic (out-param) The DDE topic.
664 @param rItem (out-param) The DDE item.
665 @return true = DDE link found, out-parameters valid. */
666 bool GetDdeLinkData( USHORT nDdePos, String& rAppl, String& rTopic, String& rItem ) const;
667 /** Returns the link mode of the specified DDE link.
668 @param nDdePos Index of the DDE link (does not include other links from link manager).
669 @param rnMode (out-param) The link mode of the specified DDE link.
670 @return true = DDE link found, rnMode valid. */
671 bool GetDdeLinkMode( USHORT nDdePos, BYTE& rnMode ) const;
672 /** Returns the result matrix of the specified DDE link.
673 @param nDdePos Index of the DDE link (does not include other links from link manager).
674 @return The result matrix, if the DDE link has been found, 0 otherwise. */
675 SC_DLLPUBLIC const ScMatrix* GetDdeLinkResultMatrix( USHORT nDdePos ) const;
677 /** Tries to find a DDE link or creates a new, if not extant.
678 @param pResults If not 0, sets the matrix as as DDE link result matrix (also for existing links).
679 @return true = DDE link found; false = Unpredictable error occured, no DDE link created. */
680 SC_DLLPUBLIC bool CreateDdeLink( const String& rAppl, const String& rTopic, const String& rItem, BYTE nMode, ScMatrix* pResults = NULL );
681 /** Sets a result matrix for the specified DDE link.
682 @param nDdePos Index of the DDE link (does not include other links from link manager).
683 @param pResults The array containing all results of the DDE link (intrusive-ref-counted, do not delete).
684 @return true = DDE link found and matrix set. */
685 bool SetDdeLinkResultMatrix( USHORT nDdePos, ScMatrix* pResults );
688 SfxBindings* GetViewBindings();
689 SfxObjectShell* GetDocumentShell() const { return pShell; }
690 ScDrawLayer* GetDrawLayer() { return pDrawLayer; }
691 SfxBroadcaster* GetDrawBroadcaster(); // zwecks Header-Vermeidung
692 void BeginDrawUndo();
694 void BeginUnoRefUndo();
695 bool HasUnoRefUndo() const { return ( pUnoRefUndoList != NULL ); }
696 ScUnoRefList* EndUnoRefUndo(); // must be deleted by caller!
697 sal_Int64 GetNewUnoId();
698 void AddUnoRefChange( sal_Int64 nId, const ScRangeList& rOldRanges );
700 // #109985#
701 sal_Bool IsChart( const SdrObject* pObject );
703 SC_DLLPUBLIC void UpdateAllCharts();
704 void UpdateChartRef( UpdateRefMode eUpdateRefMode,
705 SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
706 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
707 SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
708 //! setzt nur die neue RangeList, keine ChartListener o.ae.
709 void SetChartRangeList( const String& rChartName,
710 const ScRangeListRef& rNewRangeListRef );
712 BOOL HasControl( SCTAB nTab, const Rectangle& rMMRect );
713 void InvalidateControls( Window* pWin, SCTAB nTab, const Rectangle& rMMRect );
715 void StartAnimations( SCTAB nTab, Window* pWin );
717 BOOL HasBackgroundDraw( SCTAB nTab, const Rectangle& rMMRect );
718 BOOL HasAnyDraw( SCTAB nTab, const Rectangle& rMMRect );
720 SC_DLLPUBLIC ScOutlineTable* GetOutlineTable( SCTAB nTab, BOOL bCreate = FALSE );
721 BOOL SetOutlineTable( SCTAB nTab, const ScOutlineTable* pNewOutline );
723 void DoAutoOutline( SCCOL nStartCol, SCROW nStartRow,
724 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab );
726 BOOL DoSubTotals( SCTAB nTab, ScSubTotalParam& rParam );
727 void RemoveSubTotals( SCTAB nTab, ScSubTotalParam& rParam );
728 BOOL TestRemoveSubTotals( SCTAB nTab, const ScSubTotalParam& rParam );
729 BOOL HasSubTotalCells( const ScRange& rRange );
731 SC_DLLPUBLIC void PutCell( const ScAddress&, ScBaseCell* pCell, BOOL bForceTab = FALSE );
732 //UNUSED2009-05 SC_DLLPUBLIC void PutCell( const ScAddress&, ScBaseCell* pCell,
733 //UNUSED2009-05 ULONG nFormatIndex, BOOL bForceTab = FALSE);
734 SC_DLLPUBLIC void PutCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell,
735 BOOL bForceTab = FALSE );
736 SC_DLLPUBLIC void PutCell(SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell,
737 ULONG nFormatIndex, BOOL bForceTab = FALSE);
738 // return TRUE = Zahlformat gesetzt
739 SC_DLLPUBLIC BOOL SetString(
740 SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString,
741 SvNumberFormatter* pFormatter = NULL, bool bDetectNumberFormat = true );
742 SC_DLLPUBLIC void SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rVal );
743 void SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const USHORT nError);
745 SC_DLLPUBLIC void InsertMatrixFormula(SCCOL nCol1, SCROW nRow1,
746 SCCOL nCol2, SCROW nRow2,
747 const ScMarkData& rMark,
748 const String& rFormula,
749 const ScTokenArray* p = NULL,
750 const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT );
751 SC_DLLPUBLIC void InsertTableOp(const ScTabOpParam& rParam, // Mehrfachoperation
752 SCCOL nCol1, SCROW nRow1,
753 SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark);
755 SC_DLLPUBLIC void GetString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString );
756 SC_DLLPUBLIC void GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString );
757 SC_DLLPUBLIC double GetValue( const ScAddress& );
758 SC_DLLPUBLIC void GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, double& rValue );
759 SC_DLLPUBLIC double RoundValueAsShown( double fVal, ULONG nFormat );
760 SC_DLLPUBLIC void GetNumberFormat( SCCOL nCol, SCROW nRow, SCTAB nTab,
761 sal_uInt32& rFormat );
762 sal_uInt32 GetNumberFormat( const ScRange& rRange ) const;
763 SC_DLLPUBLIC sal_uInt32 GetNumberFormat( const ScAddress& ) const;
764 /** If no number format attribute is set and the cell
765 pointer passed is of type formula cell, the calculated
766 number format of the formula cell is returned. pCell
767 may be NULL. */
768 SC_DLLPUBLIC void GetNumberFormatInfo( short& nType, ULONG& nIndex,
769 const ScAddress& rPos, const ScBaseCell* pCell ) const;
770 void GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rFormula,
771 BOOL bAsciiExport = FALSE ) const;
772 SC_DLLPUBLIC void GetCellType( SCCOL nCol, SCROW nRow, SCTAB nTab, CellType& rCellType ) const;
773 SC_DLLPUBLIC CellType GetCellType( const ScAddress& rPos ) const;
774 SC_DLLPUBLIC void GetCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell*& rpCell ) const;
775 SC_DLLPUBLIC ScBaseCell* GetCell( const ScAddress& rPos ) const;
777 //UNUSED2008-05 void RefreshNoteFlags();
779 SC_DLLPUBLIC BOOL HasData( SCCOL nCol, SCROW nRow, SCTAB nTab );
780 SC_DLLPUBLIC BOOL HasStringData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
781 SC_DLLPUBLIC BOOL HasValueData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
782 BOOL HasStringCells( const ScRange& rRange ) const;
784 /** Returns true, if there is any data to create a selection list for rPos. */
785 BOOL HasSelectionData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
787 /** Returns the pointer to a cell note object at the passed cell address. */
788 ScPostIt* GetNote( const ScAddress& rPos );
789 /** Sets the passed note at the cell with the passed cell address. */
790 void TakeNote( const ScAddress& rPos, ScPostIt*& rpNote );
791 /** Returns and forgets the cell note object at the passed cell address. */
792 ScPostIt* ReleaseNote( const ScAddress& rPos );
793 /** Returns the pointer to an existing or created cell note object at the passed cell address. */
794 SC_DLLPUBLIC ScPostIt* GetOrCreateNote( const ScAddress& rPos );
795 /** Deletes the note at the passed cell address. */
796 void DeleteNote( const ScAddress& rPos );
797 /** Creates the captions of all uninitialized cell notes in the specified sheet.
798 @param bForced True = always create all captions, false = skip when Undo is disabled. */
799 void InitializeNoteCaptions( SCTAB nTab, bool bForced = false );
800 /** Creates the captions of all uninitialized cell notes in all sheets.
801 @param bForced True = always create all captions, false = skip when Undo is disabled. */
802 void InitializeAllNoteCaptions( bool bForced = false );
804 BOOL ExtendMergeSel( SCCOL nStartCol, SCROW nStartRow,
805 SCCOL& rEndCol, SCROW& rEndRow, const ScMarkData& rMark,
806 BOOL bRefresh = FALSE, BOOL bAttrs = FALSE );
807 BOOL ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
808 SCCOL& rEndCol, SCROW& rEndRow, SCTAB nTab,
809 BOOL bRefresh = FALSE, BOOL bAttrs = FALSE );
810 BOOL ExtendMerge( ScRange& rRange, BOOL bRefresh = FALSE, BOOL bAttrs = FALSE );
811 BOOL ExtendTotalMerge( ScRange& rRange );
812 SC_DLLPUBLIC BOOL ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow,
813 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab );
814 SC_DLLPUBLIC BOOL ExtendOverlapped( ScRange& rRange );
816 BOOL RefreshAutoFilter( SCCOL nStartCol, SCROW nStartRow,
817 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab );
819 SC_DLLPUBLIC void DoMergeContents( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
820 SCCOL nEndCol, SCROW nEndRow );
821 // ohne Ueberpruefung:
822 SC_DLLPUBLIC void DoMerge( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
823 SCCOL nEndCol, SCROW nEndRow, bool bDeleteCaptions = true );
824 void RemoveMerge( SCCOL nCol, SCROW nRow, SCTAB nTab );
826 BOOL IsBlockEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
827 SCCOL nEndCol, SCROW nEndRow, bool bIgnoreNotes = false ) const;
828 BOOL IsPrintEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
829 SCCOL nEndCol, SCROW nEndRow,
830 BOOL bLeftIsEmpty = FALSE,
831 ScRange* pLastRange = NULL,
832 Rectangle* pLastMM = NULL ) const;
834 void SkipOverlapped( SCCOL& rCol, SCROW& rRow, SCTAB nTab ) const;
835 BOOL IsHorOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
836 BOOL IsVerOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
838 SC_DLLPUBLIC BOOL HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
839 SCCOL nCol2, SCROW nRow2, SCTAB nTab2, USHORT nMask );
840 SC_DLLPUBLIC BOOL HasAttrib( const ScRange& rRange, USHORT nMask );
842 void GetBorderLines( SCCOL nCol, SCROW nRow, SCTAB nTab,
843 const SvxBorderLine** ppLeft,
844 const SvxBorderLine** ppTop,
845 const SvxBorderLine** ppRight,
846 const SvxBorderLine** ppBottom ) const;
848 void ResetChanged( const ScRange& rRange );
850 void SetDirty();
851 void SetDirty( const ScRange& );
852 void SetTableOpDirty( const ScRange& ); // for Interpreter TableOp
853 void CalcAll();
854 SC_DLLPUBLIC void CalcAfterLoad();
855 void CompileAll();
856 void CompileXML();
858 ScAutoNameCache* GetAutoNameCache() { return pAutoNameCache; }
860 /** Creates a ScLookupCache cache for the range if it
861 doesn't already exist. */
862 ScLookupCache & GetLookupCache( const ScRange & rRange );
863 /** Only ScLookupCache ctor uses AddLookupCache(), do not
864 use elsewhere! */
865 void AddLookupCache( ScLookupCache & rCache );
866 /** Only ScLookupCache dtor uses RemoveLookupCache(), do
867 not use elsewhere! */
868 void RemoveLookupCache( ScLookupCache & rCache );
869 /** Zap all caches. */
870 void ClearLookupCaches();
872 // Automatisch Berechnen
873 void SetAutoCalc( BOOL bNewAutoCalc );
874 BOOL GetAutoCalc() const { return bAutoCalc; }
875 // Automatisch Berechnen in/von/fuer ScDocShell disabled
876 void SetAutoCalcShellDisabled( BOOL bNew ) { bAutoCalcShellDisabled = bNew; }
877 BOOL IsAutoCalcShellDisabled() const { return bAutoCalcShellDisabled; }
878 // ForcedFormulas zu berechnen
879 void SetForcedFormulaPending( BOOL bNew ) { bForcedFormulaPending = bNew; }
880 BOOL IsForcedFormulaPending() const { return bForcedFormulaPending; }
881 // if CalcFormulaTree() is currently running
882 BOOL IsCalculatingFormulaTree() { return bCalculatingFormulaTree; }
884 // for worksheet calculate event
885 BOOL FireCalculateEvent( SCTAB nTab );
886 void AddCalculateTable( SCTAB nTab );
888 USHORT GetErrCode( const ScAddress& ) const;
890 bool ShrinkToDataArea(SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow) const;
892 void GetDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
893 SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld ) const;
894 SC_DLLPUBLIC BOOL GetCellArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const;
895 SC_DLLPUBLIC BOOL GetTableArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const;
896 SC_DLLPUBLIC BOOL GetPrintArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow,
897 BOOL bNotes = TRUE ) const;
898 SC_DLLPUBLIC BOOL GetPrintAreaHor( SCTAB nTab, SCROW nStartRow, SCROW nEndRow,
899 SCCOL& rEndCol, BOOL bNotes = TRUE ) const;
900 SC_DLLPUBLIC BOOL GetPrintAreaVer( SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol,
901 SCROW& rEndRow, BOOL bNotes = TRUE ) const;
902 void InvalidateTableArea();
904 SC_DLLPUBLIC BOOL GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow ) const;
906 void ExtendPrintArea( OutputDevice* pDev, SCTAB nTab,
907 SCCOL nStartCol, SCROW nStartRow,
908 SCCOL& rEndCol, SCROW nEndRow );
910 SC_DLLPUBLIC SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab,
911 SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab,
912 ScDirection eDir );
914 void FindAreaPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX, SCsROW nMovY );
915 SC_DLLPUBLIC void GetNextPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX, SCsROW nMovY,
916 BOOL bMarked, BOOL bUnprotected, const ScMarkData& rMark );
918 BOOL GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, SCTAB nTab,
919 const ScMarkData& rMark );
921 void LimitChartArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow,
922 SCCOL& rEndCol, SCROW& rEndRow );
923 void LimitChartIfAll( ScRangeListRef& rRangeList );
925 BOOL InsertRow( SCCOL nStartCol, SCTAB nStartTab,
926 SCCOL nEndCol, SCTAB nEndTab,
927 SCROW nStartRow, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL,
928 const ScMarkData* pTabMark = NULL );
929 SC_DLLPUBLIC BOOL InsertRow( const ScRange& rRange, ScDocument* pRefUndoDoc = NULL );
930 void DeleteRow( SCCOL nStartCol, SCTAB nStartTab,
931 SCCOL nEndCol, SCTAB nEndTab,
932 SCROW nStartRow, SCSIZE nSize,
933 ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL,
934 const ScMarkData* pTabMark = NULL );
935 SC_DLLPUBLIC void DeleteRow( const ScRange& rRange,
936 ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL );
937 BOOL InsertCol( SCROW nStartRow, SCTAB nStartTab,
938 SCROW nEndRow, SCTAB nEndTab,
939 SCCOL nStartCol, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL,
940 const ScMarkData* pTabMark = NULL );
941 SC_DLLPUBLIC BOOL InsertCol( const ScRange& rRange, ScDocument* pRefUndoDoc = NULL );
942 void DeleteCol( SCROW nStartRow, SCTAB nStartTab,
943 SCROW nEndRow, SCTAB nEndTab,
944 SCCOL nStartCol, SCSIZE nSize,
945 ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL,
946 const ScMarkData* pTabMark = NULL );
947 void DeleteCol( const ScRange& rRange,
948 ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL );
950 BOOL CanInsertRow( const ScRange& rRange ) const;
951 BOOL CanInsertCol( const ScRange& rRange ) const;
953 void FitBlock( const ScRange& rOld, const ScRange& rNew, BOOL bClear = TRUE );
954 BOOL CanFitBlock( const ScRange& rOld, const ScRange& rNew );
956 BOOL IsClipOrUndo() const { return bIsClip || bIsUndo; }
957 BOOL IsUndo() const { return bIsUndo; }
958 BOOL IsClipboard() const { return bIsClip; }
959 bool IsUndoEnabled() const { return mbUndoEnabled; }
960 void EnableUndo( bool bVal );
962 bool IsAdjustHeightEnabled() const { return mbAdjustHeightEnabled; }
963 void EnableAdjustHeight( bool bVal ) { mbAdjustHeightEnabled = bVal; }
964 bool IsExecuteLinkEnabled() const { return mbExecuteLinkEnabled; }
965 void EnableExecuteLink( bool bVal ) { mbExecuteLinkEnabled = bVal; }
966 bool IsChangeReadOnlyEnabled() const { return mbChangeReadOnlyEnabled; }
967 void EnableChangeReadOnly( bool bVal ) { mbChangeReadOnlyEnabled = bVal; }
968 SC_DLLPUBLIC sal_Int16 GetNamedRangesLockCount() const { return mnNamedRangesLockCount; }
969 void SetNamedRangesLockCount( sal_Int16 nCount ) { mnNamedRangesLockCount = nCount; }
970 SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, const ScMarkData* pMarks );
971 SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, SCTAB nTab );
972 void SetCutMode( BOOL bCut );
973 BOOL IsCutMode();
974 void SetClipArea( const ScRange& rArea, BOOL bCut = FALSE );
976 SC_DLLPUBLIC BOOL IsDocVisible() const { return bIsVisible; }
977 void SetDocVisible( BOOL bSet );
979 BOOL HasOLEObjectsInArea( const ScRange& rRange, const ScMarkData* pTabMark = NULL );
981 void DeleteObjectsInArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
982 const ScMarkData& rMark );
983 void DeleteObjectsInSelection( const ScMarkData& rMark );
985 void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
986 const ScMarkData& rMark, USHORT nDelFlag);
987 void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
988 SCTAB nTab, USHORT nDelFlag);
989 void DeleteAreaTab(const ScRange& rRange, USHORT nDelFlag);
990 void CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
991 BOOL bCut, ScDocument* pClipDoc, BOOL bAllTabs,
992 const ScMarkData* pMarks = NULL,
993 BOOL bKeepScenarioFlags = FALSE,
994 BOOL bIncludeObjects = FALSE,
995 BOOL bCloneNoteCaptions = TRUE);
996 void CopyToClip(const ScClipParam& rClipParam, ScDocument* pClipDoc,
997 const ScMarkData* pMarks = NULL, bool bKeepScenarioFlags = false,
998 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 inline SCROW FastGetFirstNonHiddenRow( SCROW nStartRow, SCTAB nTab ) 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 /// @return the index of the last row with any set flags (auto-pagebreak is ignored).
1312 SC_DLLPUBLIC SCROW GetLastFlaggedRow( SCTAB nTab ) const;
1314 /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored).
1315 SCCOL GetLastChangedCol( SCTAB nTab ) const;
1316 /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
1317 SCROW GetLastChangedRow( SCTAB nTab ) const;
1319 SCCOL GetNextDifferentChangedCol( SCTAB nTab, SCCOL nStart) const;
1321 // #108550#; if bCareManualSize is set then the row
1322 // heights are compared only if the manual size flag for
1323 // the row is set. If the bCareManualSize is not set then
1324 // the row heights are always compared.
1325 SCROW GetNextDifferentChangedRow( SCTAB nTab, SCROW nStart, bool bCareManualSize = true) const;
1327 // returns whether to export a Default style for this col/row or not
1328 // nDefault is setted to one possition in the current row/col where the Default style is
1329 BOOL GetColDefault( SCTAB nTab, SCCOL nCol, SCROW nLastRow, SCROW& nDefault);
1330 BOOL GetRowDefault( SCTAB nTab, SCROW nRow, SCCOL nLastCol, SCCOL& nDefault);
1332 BOOL IsFiltered( SCROW nRow, SCTAB nTab ) const;
1334 BOOL UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, BOOL bShow );
1335 BOOL UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, BOOL bShow );
1337 void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, SCTAB nTab );
1338 void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, SCTAB nTab );
1340 SC_DLLPUBLIC ScPatternAttr* GetDefPattern() const;
1341 SC_DLLPUBLIC ScDocumentPool* GetPool();
1342 SC_DLLPUBLIC ScStyleSheetPool* GetStyleSheetPool() const;
1344 // PageStyle:
1345 SC_DLLPUBLIC const String& GetPageStyle( SCTAB nTab ) const;
1346 SC_DLLPUBLIC void SetPageStyle( SCTAB nTab, const String& rName );
1347 Size GetPageSize( SCTAB nTab ) const;
1348 void SetPageSize( SCTAB nTab, const Size& rSize );
1349 void SetRepeatArea( SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
1350 void UpdatePageBreaks( SCTAB nTab, const ScRange* pUserArea = NULL );
1351 void RemoveManualBreaks( SCTAB nTab );
1352 BOOL HasManualBreaks( SCTAB nTab ) const;
1354 BOOL IsPageStyleInUse( const String& rStrPageStyle, SCTAB* pInTab = NULL );
1355 BOOL RemovePageStyleInUse( const String& rStrPageStyle );
1356 BOOL RenamePageStyleInUse( const String& rOld, const String& rNew );
1357 void ModifyStyleSheet( SfxStyleSheetBase& rPageStyle,
1358 const SfxItemSet& rChanges );
1360 void PageStyleModified( SCTAB nTab, const String& rNewName );
1362 SC_DLLPUBLIC BOOL NeedPageResetAfterTab( SCTAB nTab ) const;
1364 // war vorher im PageStyle untergracht. Jetzt an jeder Tabelle:
1365 SC_DLLPUBLIC BOOL HasPrintRange();
1366 SC_DLLPUBLIC USHORT GetPrintRangeCount( SCTAB nTab );
1367 SC_DLLPUBLIC const ScRange* GetPrintRange( SCTAB nTab, USHORT nPos );
1368 SC_DLLPUBLIC const ScRange* GetRepeatColRange( SCTAB nTab );
1369 SC_DLLPUBLIC const ScRange* GetRepeatRowRange( SCTAB nTab );
1370 /** Returns true, if the specified sheet is always printed. */
1371 BOOL IsPrintEntireSheet( SCTAB nTab ) const;
1373 /** Removes all print ranges. */
1374 SC_DLLPUBLIC void ClearPrintRanges( SCTAB nTab );
1375 /** Adds a new print ranges. */
1376 SC_DLLPUBLIC void AddPrintRange( SCTAB nTab, const ScRange& rNew );
1377 //UNUSED2009-05 /** Removes all old print ranges and sets the passed print ranges. */
1378 //UNUSED2009-05 void SetPrintRange( SCTAB nTab, const ScRange& rNew );
1379 /** Marks the specified sheet to be printed completely. Deletes old print ranges on the sheet! */
1380 SC_DLLPUBLIC void SetPrintEntireSheet( SCTAB nTab );
1381 SC_DLLPUBLIC void SetRepeatColRange( SCTAB nTab, const ScRange* pNew );
1382 SC_DLLPUBLIC void SetRepeatRowRange( SCTAB nTab, const ScRange* pNew );
1383 ScPrintRangeSaver* CreatePrintRangeSaver() const;
1384 void RestorePrintRanges( const ScPrintRangeSaver& rSaver );
1386 SC_DLLPUBLIC Rectangle GetMMRect( SCCOL nStartCol, SCROW nStartRow,
1387 SCCOL nEndCol, SCROW nEndRow, SCTAB nTab );
1388 SC_DLLPUBLIC ScRange GetRange( SCTAB nTab, const Rectangle& rMMRect );
1390 void UpdStlShtPtrsFrmNms();
1391 void StylesToNames();
1393 SC_DLLPUBLIC void CopyStdStylesFrom( ScDocument* pSrcDoc );
1395 CharSet GetSrcCharSet() const { return eSrcSet; }
1396 ULONG GetSrcVersion() const { return nSrcVer; }
1397 SCROW GetSrcMaxRow() const { return nSrcMaxRow; }
1399 void SetSrcCharSet( CharSet eNew ) { eSrcSet = eNew; }
1400 void UpdateFontCharSet();
1402 void FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
1403 SCTAB nTab, double nScaleX, double nScaleY,
1404 BOOL bPageMode, BOOL bFormulaMode,
1405 const ScMarkData* pMarkData = NULL );
1407 SC_DLLPUBLIC SvNumberFormatter* GetFormatTable() const;
1409 void Sort( SCTAB nTab, const ScSortParam& rSortParam, BOOL bKeepQuery );
1410 SCSIZE Query( SCTAB nTab, const ScQueryParam& rQueryParam, BOOL bKeepSub );
1411 BOOL ValidQuery( SCROW nRow, SCTAB nTab, const ScQueryParam& rQueryParam, BOOL* pSpecial = NULL );
1412 SC_DLLPUBLIC BOOL CreateQueryParam( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1413 SCTAB nTab, ScQueryParam& rQueryParam );
1414 void GetUpperCellString(SCCOL nCol, SCROW nRow, SCTAB nTab, String& rStr);
1416 /** Update the dynamic end row position of a current data area. */
1417 void UpdateDynamicEndRow(ScDBData& rDBData) const;
1419 BOOL GetFilterEntries( SCCOL nCol, SCROW nRow, SCTAB nTab,
1420 TypedScStrCollection& rStrings, bool bFilter = false );
1421 SC_DLLPUBLIC BOOL GetFilterEntriesArea( SCCOL nCol, SCROW nStartRow, SCROW nEndRow,
1422 SCTAB nTab, TypedScStrCollection& rStrings );
1423 BOOL GetDataEntries( SCCOL nCol, SCROW nRow, SCTAB nTab,
1424 TypedScStrCollection& rStrings, BOOL bLimit = FALSE );
1425 BOOL GetFormulaEntries( TypedScStrCollection& rStrings );
1427 BOOL HasAutoFilter( SCCOL nCol, SCROW nRow, SCTAB nTab );
1429 SC_DLLPUBLIC BOOL HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1430 SCTAB nTab );
1431 SC_DLLPUBLIC BOOL HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1432 SCTAB nTab );
1434 SfxPrinter* GetPrinter( BOOL bCreateIfNotExist = TRUE );
1435 void SetPrinter( SfxPrinter* pNewPrinter );
1436 VirtualDevice* GetVirtualDevice_100th_mm();
1437 SC_DLLPUBLIC OutputDevice* GetRefDevice(); // WYSIWYG: Printer, otherwise VirtualDevice...
1439 void EraseNonUsedSharedNames(USHORT nLevel);
1440 BOOL GetNextSpellingCell(SCCOL& nCol, SCROW& nRow, SCTAB nTab,
1441 BOOL bInSel, const ScMarkData& rMark) const;
1443 BOOL ReplaceStyle(const SvxSearchItem& rSearchItem,
1444 SCCOL nCol, SCROW nRow, SCTAB nTab,
1445 ScMarkData& rMark, BOOL bIsUndo);
1447 void DoColResize( SCTAB nTab, SCCOL nCol1, SCCOL nCol2, SCSIZE nAdd );
1449 // Idleberechnung der OutputDevice-Zelltextbreite
1450 BOOL IsLoadingDone() const { return bLoadingDone; }
1451 void InvalidateTextWidth( const String& rStyleName );
1452 void InvalidateTextWidth( SCTAB nTab );
1453 void InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo, BOOL bNumFormatChanged );
1455 BOOL IdleCalcTextWidth();
1456 BOOL IdleCheckLinks();
1458 BOOL ContinueOnlineSpelling(); // TRUE = etwas gefunden
1460 BOOL IsIdleDisabled() const { return bIdleDisabled; }
1461 void DisableIdle(BOOL bDo) { bIdleDisabled = bDo; }
1463 BOOL IsDetectiveDirty() const { return bDetectiveDirty; }
1464 void SetDetectiveDirty(BOOL bSet) { bDetectiveDirty = bSet; }
1466 void RemoveAutoSpellObj();
1467 void SetOnlineSpellPos( const ScAddress& rPos );
1468 SC_DLLPUBLIC BOOL SetVisibleSpellRange( const ScRange& rRange ); // TRUE = changed
1470 BYTE GetMacroCallMode() const { return nMacroCallMode; }
1471 void SetMacroCallMode(BYTE nNew) { nMacroCallMode = nNew; }
1473 BOOL GetHasMacroFunc() const { return bHasMacroFunc; }
1474 void SetHasMacroFunc(BOOL bSet) { bHasMacroFunc = bSet; }
1476 BOOL CheckMacroWarn();
1478 void SetRangeOverflowType(sal_uInt32 nType) { nRangeOverflowType = nType; }
1479 sal_Bool HasRangeOverflow() const { return nRangeOverflowType != 0; }
1480 SC_DLLPUBLIC sal_uInt32 GetRangeOverflowType() const { return nRangeOverflowType; }
1482 // fuer Broadcasting/Listening
1483 void SetNoSetDirty( BOOL bVal ) { bNoSetDirty = bVal; }
1484 BOOL GetNoSetDirty() const { return bNoSetDirty; }
1485 void SetInsertingFromOtherDoc( BOOL bVal ) { bInsertingFromOtherDoc = bVal; }
1486 BOOL IsInsertingFromOtherDoc() const { return bInsertingFromOtherDoc; }
1487 void SetLoadingMedium( bool bVal );
1488 bool IsLoadingMedium() const;
1489 void SetImportingXML( BOOL bVal );
1490 BOOL IsImportingXML() const { return bImportingXML; }
1491 void SetXMLFromWrapper( BOOL bVal );
1492 BOOL IsXMLFromWrapper() const { return bXMLFromWrapper; }
1493 void SetCalcingAfterLoad( BOOL bVal ) { bCalcingAfterLoad = bVal; }
1494 BOOL IsCalcingAfterLoad() const { return bCalcingAfterLoad; }
1495 void SetNoListening( BOOL bVal ) { bNoListening = bVal; }
1496 BOOL GetNoListening() const { return bNoListening; }
1497 ScBroadcastAreaSlotMachine* GetBASM() const { return pBASM; }
1499 ScChartListenerCollection* GetChartListenerCollection() const
1500 { return pChartListenerCollection; }
1501 void SetChartListenerCollection( ScChartListenerCollection*,
1502 BOOL bSetChartRangeLists = FALSE );
1503 void UpdateChart( const String& rName );
1504 void RestoreChartListener( const String& rName );
1505 SC_DLLPUBLIC void UpdateChartListenerCollection();
1506 BOOL IsChartListenerCollectionNeedsUpdate() const
1507 { return bChartListenerCollectionNeedsUpdate; }
1508 void SetChartListenerCollectionNeedsUpdate( BOOL bFlg )
1509 { bChartListenerCollectionNeedsUpdate = bFlg; }
1510 void AddOLEObjectToCollection(const String& rName);
1512 ScChangeViewSettings* GetChangeViewSettings() const { return pChangeViewSettings; }
1513 SC_DLLPUBLIC void SetChangeViewSettings(const ScChangeViewSettings& rNew);
1515 vos::ORef<SvxForbiddenCharactersTable> GetForbiddenCharacters();
1516 void SetForbiddenCharacters( const vos::ORef<SvxForbiddenCharactersTable> xNew );
1518 BYTE GetAsianCompression() const; // CharacterCompressionType values
1519 BOOL IsValidAsianCompression() const;
1520 void SetAsianCompression(BYTE nNew);
1522 BOOL GetAsianKerning() const;
1523 BOOL IsValidAsianKerning() const;
1524 void SetAsianKerning(BOOL bNew);
1526 BYTE GetEditTextDirection(SCTAB nTab) const; // EEHorizontalTextDirection values
1528 SC_DLLPUBLIC ScLkUpdMode GetLinkMode() const { return eLinkMode ;}
1529 void SetLinkMode( ScLkUpdMode nSet ) { eLinkMode = nSet;}
1531 SC_DLLPUBLIC ScMacroManager* GetMacroManager();
1533 private:
1534 ScDocument(const ScDocument& r); // disabled with no definition
1536 void FindMaxRotCol( SCTAB nTab, RowInfo* pRowInfo, SCSIZE nArrCount,
1537 SCCOL nX1, SCCOL nX2 ) const;
1539 USHORT RowDifferences( SCROW nThisRow, SCTAB nThisTab,
1540 ScDocument& rOtherDoc,
1541 SCROW nOtherRow, SCTAB nOtherTab,
1542 SCCOL nMaxCol, SCCOLROW* pOtherCols );
1543 USHORT ColDifferences( SCCOL nThisCol, SCTAB nThisTab,
1544 ScDocument& rOtherDoc,
1545 SCCOL nOtherCol, SCTAB nOtherTab,
1546 SCROW nMaxRow, SCCOLROW* pOtherRows );
1547 void FindOrder( SCCOLROW* pOtherRows, SCCOLROW nThisEndRow, SCCOLROW nOtherEndRow,
1548 BOOL bColumns,
1549 ScDocument& rOtherDoc, SCTAB nThisTab, SCTAB nOtherTab,
1550 SCCOLROW nEndCol, SCCOLROW* pTranslate,
1551 ScProgress* pProgress, ULONG nProAdd );
1552 BOOL OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpellPos,
1553 USHORT nMaxTest );
1555 DECL_LINK( TrackTimeHdl, Timer* );
1557 static ScRecursionHelper* CreateRecursionHelperInstance();
1559 public:
1560 void StartListeningArea( const ScRange& rRange,
1561 SvtListener* pListener );
1562 void EndListeningArea( const ScRange& rRange,
1563 SvtListener* pListener );
1564 /** Broadcast wrapper, calls
1565 SC_DLLPUBLIC rHint.GetCell()->Broadcast() and AreaBroadcast()
1566 and TrackFormulas() and conditional format list
1567 SourceChanged().
1568 Preferred.
1570 void Broadcast( const ScHint& rHint );
1571 /// deprecated
1572 void Broadcast( ULONG nHint, const ScAddress& rAddr,
1573 ScBaseCell* pCell );
1574 /// only area, no cell broadcast
1575 void AreaBroadcast( const ScHint& rHint );
1576 /// only areas in range, no cell broadcasts
1577 void AreaBroadcastInRange( const ScRange& rRange,
1578 const ScHint& rHint );
1579 void DelBroadcastAreasInRange( const ScRange& rRange );
1580 void UpdateBroadcastAreas( UpdateRefMode eUpdateRefMode,
1581 const ScRange& rRange,
1582 SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
1585 void StartListeningCell( const ScAddress& rAddress,
1586 SvtListener* pListener );
1587 void EndListeningCell( const ScAddress& rAddress,
1588 SvtListener* pListener );
1589 void PutInFormulaTree( ScFormulaCell* pCell );
1590 void RemoveFromFormulaTree( ScFormulaCell* pCell );
1591 void CalcFormulaTree( BOOL bOnlyForced = FALSE,
1592 BOOL bNoProgressBar = FALSE );
1593 void ClearFormulaTree();
1594 void AppendToFormulaTrack( ScFormulaCell* pCell );
1595 void RemoveFromFormulaTrack( ScFormulaCell* pCell );
1596 void TrackFormulas( ULONG nHintId = SC_HINT_DATACHANGED );
1597 USHORT GetFormulaTrackCount() const { return nFormulaTrackCount; }
1598 BOOL IsInFormulaTree( ScFormulaCell* pCell ) const;
1599 BOOL IsInFormulaTrack( ScFormulaCell* pCell ) const;
1600 USHORT GetHardRecalcState() { return nHardRecalcState; }
1601 void SetHardRecalcState( USHORT nVal ) { nHardRecalcState = nVal; }
1602 void StartAllListeners();
1603 const ScFormulaCell* GetFormulaTree() const { return pFormulaTree; }
1604 BOOL HasForcedFormulas() const { return bHasForcedFormulas; }
1605 void SetForcedFormulas( BOOL bVal ) { bHasForcedFormulas = bVal; }
1606 ULONG GetFormulaCodeInTree() const { return nFormulaCodeInTree; }
1607 BOOL IsInInterpreter() const { return nInterpretLevel != 0; }
1608 USHORT GetInterpretLevel() { return nInterpretLevel; }
1609 void IncInterpretLevel()
1611 if ( nInterpretLevel < USHRT_MAX )
1612 nInterpretLevel++;
1614 void DecInterpretLevel()
1616 if ( nInterpretLevel )
1617 nInterpretLevel--;
1619 BOOL IsInMacroInterpreter() const { return nMacroInterpretLevel != 0; }
1620 USHORT GetMacroInterpretLevel() { return nMacroInterpretLevel; }
1621 void IncMacroInterpretLevel()
1623 if ( nMacroInterpretLevel < USHRT_MAX )
1624 nMacroInterpretLevel++;
1626 void DecMacroInterpretLevel()
1628 if ( nMacroInterpretLevel )
1629 nMacroInterpretLevel--;
1631 BOOL IsInInterpreterTableOp() const { return nInterpreterTableOpLevel != 0; }
1632 USHORT GetInterpreterTableOpLevel() { return nInterpreterTableOpLevel; }
1633 void IncInterpreterTableOpLevel()
1635 if ( nInterpreterTableOpLevel < USHRT_MAX )
1636 nInterpreterTableOpLevel++;
1638 void DecInterpreterTableOpLevel()
1640 if ( nInterpreterTableOpLevel )
1641 nInterpreterTableOpLevel--;
1643 // add a formula to be remembered for TableOp broadcasts
1644 void AddTableOpFormulaCell( ScFormulaCell* );
1645 void InvalidateLastTableOpParams() { aLastTableOpParams.bValid = FALSE; }
1646 ScRecursionHelper& GetRecursionHelper()
1648 if (!pRecursionHelper)
1649 pRecursionHelper = CreateRecursionHelperInstance();
1650 return *pRecursionHelper;
1652 BOOL IsInDtorClear() const { return bInDtorClear; }
1653 void SetExpandRefs( BOOL bVal ) { bExpandRefs = bVal; }
1654 BOOL IsExpandRefs() { return bExpandRefs; }
1656 SC_DLLPUBLIC void IncSizeRecalcLevel( SCTAB nTab );
1657 SC_DLLPUBLIC void DecSizeRecalcLevel( SCTAB nTab );
1659 ULONG GetXMLImportedFormulaCount() const { return nXMLImportedFormulaCount; }
1660 void IncXMLImportedFormulaCount( ULONG nVal )
1662 if ( nXMLImportedFormulaCount + nVal > nXMLImportedFormulaCount )
1663 nXMLImportedFormulaCount += nVal;
1665 void DecXMLImportedFormulaCount( ULONG nVal )
1667 if ( nVal <= nXMLImportedFormulaCount )
1668 nXMLImportedFormulaCount -= nVal;
1669 else
1670 nXMLImportedFormulaCount = 0;
1673 void StartTrackTimer();
1675 void CompileDBFormula();
1676 void CompileDBFormula( BOOL bCreateFormulaString );
1677 void CompileNameFormula( BOOL bCreateFormulaString );
1678 void CompileColRowNameFormula();
1680 /** Maximum string length of a column, e.g. for dBase export.
1681 @return String length in octets (!) of the destination encoding. In
1682 case of non-octet encodings (e.g. UCS2) the length in code
1683 points times sizeof(sal_Unicode) is returned. */
1684 sal_Int32 GetMaxStringLen( SCTAB nTab, SCCOL nCol,
1685 SCROW nRowStart, SCROW nRowEnd,
1686 CharSet eCharSet ) const;
1687 /** Maximum string length of numerical cells of a column, e.g. for dBase export.
1688 @return String length in characters (!) including the decimal
1689 separator, and the decimal precision needed. */
1690 xub_StrLen GetMaxNumberStringLen( USHORT& nPrecision,
1691 SCTAB nTab, SCCOL nCol,
1692 SCROW nRowStart, SCROW nRowEnd ) const;
1694 void KeyInput( const KeyEvent& rKEvt ); // TimerDelays etc.
1696 ScChangeTrack* GetChangeTrack() const { return pChangeTrack; }
1698 //! only for import filter, deletes any existing ChangeTrack via
1699 //! EndChangeTracking() and takes ownership of new ChangeTrack pTrack
1700 SC_DLLPUBLIC void SetChangeTrack( ScChangeTrack* pTrack );
1702 void StartChangeTracking();
1703 void EndChangeTracking();
1705 SC_DLLPUBLIC void CompareDocument( ScDocument& rOtherDoc );
1707 void AddUnoObject( SfxListener& rObject );
1708 void RemoveUnoObject( SfxListener& rObject );
1709 void BroadcastUno( const SfxHint &rHint );
1710 void AddUnoListenerCall( const ::com::sun::star::uno::Reference<
1711 ::com::sun::star::util::XModifyListener >& rListener,
1712 const ::com::sun::star::lang::EventObject& rEvent );
1714 void SetInLinkUpdate(BOOL bSet); // TableLink or AreaLink
1715 BOOL IsInLinkUpdate() const; // including DdeLink
1717 SC_DLLPUBLIC SfxItemPool* GetEditPool() const;
1718 SC_DLLPUBLIC SfxItemPool* GetEnginePool() const;
1719 SC_DLLPUBLIC ScFieldEditEngine& GetEditEngine();
1720 SC_DLLPUBLIC ScNoteEditEngine& GetNoteEngine();
1721 //UNUSED2009-05 SfxItemPool& GetNoteItemPool();
1723 ScRefreshTimerControl* GetRefreshTimerControl() const
1724 { return pRefreshTimerControl; }
1725 ScRefreshTimerControl * const * GetRefreshTimerControlAddress() const
1726 { return &pRefreshTimerControl; }
1728 void SetPastingDrawFromOtherDoc( BOOL bVal )
1729 { bPastingDrawFromOtherDoc = bVal; }
1730 BOOL PastingDrawFromOtherDoc() const
1731 { return bPastingDrawFromOtherDoc; }
1733 /// an ID unique to each document instance
1734 sal_uInt32 GetDocumentID() const;
1736 void InvalidateStyleSheetUsage()
1737 { bStyleSheetUsageInvalid = TRUE; }
1738 void GetSortParam( ScSortParam& rParam, SCTAB nTab );
1739 void SetSortParam( ScSortParam& rParam, SCTAB nTab );
1741 com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > GetVbaEventsHelper();
1743 /** Should only be GRAM_PODF or GRAM_ODFF. */
1744 void SetStorageGrammar( formula::FormulaGrammar::Grammar eGrammar );
1745 formula::FormulaGrammar::Grammar GetStorageGrammar() const
1746 { return eStorageGrammar; }
1748 SfxUndoManager* GetUndoManager();
1749 private: // CLOOK-Impl-Methoden
1751 /**
1752 * Use this class as a locale variable to merge number formatter from
1753 * another document, and set NULL pointer to pFormatExchangeList when
1754 * done.
1756 class NumFmtMergeHandler
1758 public:
1759 explicit NumFmtMergeHandler(ScDocument* pDoc, ScDocument* pSrcDoc);
1760 ~NumFmtMergeHandler();
1762 private:
1763 ScDocument* mpDoc;
1766 void MergeNumberFormatter(ScDocument* pSrcDoc);
1768 void ImplCreateOptions(); // bei Gelegenheit auf on-demand umstellen?
1769 void ImplDeleteOptions();
1771 void DeleteDrawLayer();
1772 void DeleteColorTable();
1773 SC_DLLPUBLIC BOOL DrawGetPrintArea( ScRange& rRange, BOOL bSetHor, BOOL bSetVer ) const;
1774 void DrawMovePage( USHORT nOldPos, USHORT nNewPos );
1775 void DrawCopyPage( USHORT nOldPos, USHORT nNewPos );
1777 void UpdateDrawPrinter();
1778 void UpdateDrawLanguages();
1779 void UpdateDrawDefaults();
1780 SC_DLLPUBLIC void InitClipPtrs( ScDocument* pSourceDoc );
1782 void LoadDdeLinks(SvStream& rStream);
1783 void SaveDdeLinks(SvStream& rStream) const;
1785 void DeleteAreaLinksOnTab( SCTAB nTab );
1786 void UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode,
1787 const ScRange& r, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
1789 void CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, const ScMarkData* pMarks, bool bAllTabs);
1790 void CopyRangeNamesFromClip(ScDocument* pClipDoc, ScClipRangeNameData& rRangeNames);
1791 void UpdateRangeNamesInFormulas(
1792 ScClipRangeNameData& rRangeNames, const ScRangeList& rDestRanges, const ScMarkData& rMark,
1793 SCCOL nXw, SCROW nYw);
1795 BOOL HasPartOfMerged( const ScRange& rRange );
1797 std::map< SCTAB, ScSortParam > mSheetSortParams;
1800 inline void ScDocument::GetSortParam( ScSortParam& rParam, SCTAB nTab )
1802 rParam = mSheetSortParams[ nTab ];
1805 inline void ScDocument::SetSortParam( ScSortParam& rParam, SCTAB nTab )
1807 mSheetSortParams[ nTab ] = rParam;
1811 inline ULONG ScDocument::FastGetScaledRowHeight( SCROW nStartRow, SCROW nEndRow,
1812 SCTAB nTab, double fScale ) const
1814 return pTab[nTab]->pRowFlags->SumScaledCoupledArrayForCondition( nStartRow,
1815 nEndRow, CR_HIDDEN, 0, *(pTab[nTab]->pRowHeight), fScale);
1818 inline USHORT ScDocument::FastGetRowHeight( SCROW nRow, SCTAB nTab ) const
1820 return ( pTab[nTab]->pRowFlags->GetValue(nRow) & CR_HIDDEN ) ? 0 :
1821 pTab[nTab]->pRowHeight->GetValue(nRow);
1824 inline SCROW ScDocument::FastGetRowForHeight( SCTAB nTab, ULONG nHeight ) const
1826 ScCoupledCompressedArrayIterator< SCROW, BYTE, USHORT> aIter(
1827 *(pTab[nTab]->pRowFlags), 0, MAXROW, CR_HIDDEN, 0,
1828 *(pTab[nTab]->pRowHeight));
1829 ULONG nSum = 0;
1830 for ( ; aIter; aIter.NextRange() )
1832 ULONG nNew = *aIter * (aIter.GetRangeEnd() - aIter.GetRangeStart() + 1);
1833 if (nSum + nNew > nHeight)
1835 for ( ; aIter && nSum <= nHeight; ++aIter )
1837 nSum += *aIter;
1839 return aIter.GetPos();
1841 nSum += nNew;
1843 return aIter.GetPos();
1846 inline SCROW ScDocument::FastGetFirstNonHiddenRow( SCROW nStartRow, SCTAB nTab) const
1848 return pTab[nTab]->pRowFlags->GetFirstForCondition( nStartRow, MAXROW,
1849 CR_HIDDEN, 0);
1852 inline USHORT ScDocument::FastGetOriginalRowHeight( SCROW nRow, SCTAB nTab ) const
1854 return pTab[nTab]->pRowHeight->GetValue(nRow);
1857 inline BOOL ScDocument::ColFiltered( SCCOL nCol, SCTAB nTab ) const
1859 return ( pTab[nTab]->pColFlags[nCol] & CR_FILTERED) != 0;
1862 inline BOOL ScDocument::RowFiltered( SCROW nRow, SCTAB nTab ) const
1864 return pTab[nTab]->IsFiltered(nRow);
1867 #endif