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