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