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