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