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