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