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