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