1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef SC_DOCUMENT_HXX
21 #define SC_DOCUMENT_HXX
23 #include <vcl/prntypes.hxx>
24 #include <vcl/timer.hxx>
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <rtl/ref.hxx>
28 #include "rangelst.hxx"
29 #include "rangenam.hxx"
31 #include "tabopparams.hxx"
32 #include "sortparam.hxx"
34 #include "formula/grammar.hxx"
35 #include "formula/types.hxx"
36 #include <com/sun/star/chart2/XChartDocument.hpp>
37 #include "typedstrdata.hxx"
38 #include "compressedarray.hxx"
39 #include <tools/fract.hxx>
40 #include <tools/gen.hxx>
46 #include <boost/ptr_container/ptr_vector.hpp>
47 #include <boost/scoped_ptr.hpp>
49 namespace editeng
{ class SvxBorderLine
; }
51 struct FormulaGroupContext
;
52 class StartListeningContext
;
53 class EndListeningContext
;
54 class CopyFromClipContext
;
55 struct ColumnBlockPosition
;
71 class SfxStyleSheetBase
;
73 class SvNumberFormatter
;
76 class SvxForbiddenCharactersTable
;
85 class ScAutoFormatData
;
87 class ScBroadcastAreaSlotMachine
;
88 class ScChangeViewSettings
;
89 class ScChartCollection
;
90 class ScChartListenerCollection
;
91 class ScConditionalFormat
;
92 class ScConditionalFormatList
;
98 class ScDocProtection
;
101 class ScExtDocOptions
;
102 class ScExternalRefManager
;
104 class ScMacroManager
;
106 class ScOutlineTable
;
108 class ScPrintRangeSaver
;
112 class ScStyleSheetPool
;
114 class ScTableProtection
;
116 class ScValidationData
;
117 class ScValidationDataList
;
120 class ScEditEngineDefaulter
;
121 class ScFieldEditEngine
;
122 class ScNoteEditEngine
;
123 struct ScConsolidateParam
;
125 class ScDPCollection
;
127 class ScScriptTypeData
;
130 class ScRefreshTimerControl
;
131 class ScUnoListenerCalls
;
133 class ScRecursionHelper
;
138 class ScAutoNameCache
;
139 class ScTemporaryChartLock
;
141 struct ScLookupCacheMapImpl
;
142 class SfxUndoManager
;
143 class ScFormulaParserPool
;
145 class ScRowBreakIterator
;
146 struct ScSetStringParam
;
147 class ScDocRowHeightUpdater
;
148 struct ScColWidthParam
;
153 class ScEditDataArray
;
154 class EditTextObject
;
155 struct ScRefCellValue
;
156 class ScDocumentImport
;
158 namespace com
{ namespace sun
{ namespace star
{
160 class XMultiServiceFactory
;
164 class XBreakIterator
;
167 class XModifyListener
;
170 class XEmbeddedObject
;
172 namespace script
{ namespace vba
{
173 class XVBAEventProcessor
;
176 struct TablePageBreakData
;
180 #include <svl/zforlist.hxx>
182 #define SC_DOC_NEW 0xFFFF
184 #define SC_MACROCALL_ALLOWED 0
185 #define SC_MACROCALL_NOTALLOWED 1
186 #define SC_MACROCALL_ASK 2
188 #define SC_ASIANCOMPRESSION_INVALID 0xff
189 #define SC_ASIANKERNING_INVALID 0xff
203 sal_uLong nCellCount
;
204 sal_uInt16 nPageCount
;
208 const sal_uInt8 SC_DDE_DEFAULT
= 0;
209 const sal_uInt8 SC_DDE_ENGLISH
= 1;
210 const sal_uInt8 SC_DDE_TEXT
= 2;
211 const sal_uInt8 SC_DDE_IGNOREMODE
= 255; /// For usage in FindDdeLink() only!
215 friend class ScDocumentIterator
;
216 friend class ScValueIterator
;
217 friend class ScHorizontalValueIterator
;
218 friend class ScDBQueryDataIterator
;
219 friend class ScCellIterator
;
220 friend class ScQueryCellIterator
;
221 friend class ScHorizontalCellIterator
;
222 friend class ScHorizontalAttrIterator
;
223 friend class ScDocAttrIterator
;
224 friend class ScAttrRectIterator
;
225 friend class ScDocShell
;
226 friend class ScDocRowHeightUpdater
;
227 friend class ScColumnTextWidthIterator
;
228 friend class ScFormulaCell
;
229 friend class ScTable
;
230 friend struct ScRefCellValue
;
231 friend class ScDocumentImport
;
233 typedef ::std::vector
<ScTable
*> TableContainer
;
235 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> xServiceManager
;
237 rtl::Reference
<ScPoolHelper
> xPoolHelper
;
239 SfxUndoManager
* mpUndoManager
;
240 ScFieldEditEngine
* pEditEngine
; // uses pEditPool from xPoolHelper
241 ScNoteEditEngine
* pNoteEngine
; // uses pEditPool from xPoolHelper
242 SfxObjectShell
* pShell
;
243 SfxPrinter
* pPrinter
;
244 VirtualDevice
* pVirtualDevice_100th_mm
;
245 ScDrawLayer
* pDrawLayer
; // SdrModel
246 rtl::Reference
<XColorList
> pColorList
;
247 ScValidationDataList
* pValidationList
; // validity
248 SvNumberFormatterIndexTable
* pFormatExchangeList
; // for application of number formats
249 TableContainer maTabs
;
250 std::vector
<OUString
> maTabNames
; // for undo document, we need the information tab name <-> index
251 mutable ScRangeName
* pRangeName
;
252 ScDBCollection
* pDBCollection
;
253 ScDPCollection
* pDPCollection
;
254 ScChartCollection
* pChartCollection
;
255 std::auto_ptr
< ScTemporaryChartLock
> apTemporaryChartLock
;
256 ScPatternAttr
* pSelectionAttr
; // Attributes of a block
257 mutable sfx2::LinkManager
* pLinkManager
;
258 ScFormulaCell
* pFormulaTree
; // formula tree (start)
259 ScFormulaCell
* pEOFormulaTree
; // formula tree (end), last cell
260 ScFormulaCell
* pFormulaTrack
; // BroadcastTrack (start)
261 ScFormulaCell
* pEOFormulaTrack
; // BrodcastTrack (end), last cell
262 ScBroadcastAreaSlotMachine
* pBASM
; // BroadcastAreas
263 ScChartListenerCollection
* pChartListenerCollection
;
264 SvMemoryStream
* pClipData
;
265 ScDetOpList
* pDetOpList
;
266 ScChangeTrack
* pChangeTrack
;
267 SfxBroadcaster
* pUnoBroadcaster
;
268 ScUnoListenerCalls
* pUnoListenerCalls
;
269 ScUnoRefList
* pUnoRefUndoList
;
270 ScChangeViewSettings
* pChangeViewSettings
;
271 ScScriptTypeData
* pScriptTypeData
;
272 ScRefreshTimerControl
* pRefreshTimerControl
;
273 rtl::Reference
<SvxForbiddenCharactersTable
> xForbiddenCharacters
;
275 ScFieldEditEngine
* pCacheFieldEditEngine
;
277 ::std::auto_ptr
<ScDocProtection
> pDocProtection
;
278 ::std::auto_ptr
<ScClipParam
> mpClipParam
;
280 ::std::auto_ptr
<ScExternalRefManager
> pExternalRefMgr
;
281 ::std::auto_ptr
<ScMacroManager
> mpMacroMgr
;
284 // mutable for lazy construction
285 mutable ::std::auto_ptr
< ScFormulaParserPool
>
286 mxFormulaParserPool
; /// Pool for all external formula parsers used by this document.
288 OUString aDocName
; // optional: name of document
289 OUString aDocCodeName
; // optional: name of document (twice?)
290 OUString maFileURL
; // file URL for copy & paste
291 ScRangePairListRef xColNameRanges
;
292 ScRangePairListRef xRowNameRanges
;
294 ScViewOptions
* pViewOptions
; // view options
295 ScDocOptions
* pDocOptions
; // document options
296 ScExtDocOptions
* pExtDocOptions
; // for import etc.
297 ScConsolidateParam
* pConsolidateDlgData
;
299 ScRecursionHelper
* pRecursionHelper
; // information for recursive and iterative cell formulas
301 ScAutoNameCache
* pAutoNameCache
; // for automatic name lookup during CompileXML
303 ScLookupCacheMapImpl
* pLookupCacheMapImpl
; // cache for lookups like VLOOKUP and MATCH
305 SfxItemSet
* pPreviewFont
; // convert to std::auto_ptr or whatever
306 ScMarkData
* pPreviewSelection
;
307 sal_Int64 nUnoObjectId
; // counted up for UNO objects
309 sal_uInt32 nRangeOverflowType
; // used in (xml) loading for overflow warnings
312 ScAddress aCurTextWidthCalcPos
;
313 ScAddress aOnlineSpellPos
; // within whole document
314 ScRange aVisSpellRange
;
315 ScAddress aVisSpellPos
; // within aVisSpellRange (see nVisSpellState)
319 com::sun::star::uno::Reference
< com::sun::star::script::vba::XVBAEventProcessor
>
322 boost::ptr_vector
< ScInterpreterTableOpParams
> aTableOpList
; // list of ScInterpreterTableOpParams currently in use
323 ScInterpreterTableOpParams aLastTableOpParams
; // remember last params
326 LanguageType eLanguage
; // default language
327 LanguageType eCjkLanguage
; // default language for asian text
328 LanguageType eCtlLanguage
; // default language for complex text
329 CharSet eSrcSet
; // during reading: source character set
331 /** The compiler grammar used in document storage. GRAM_PODF for ODF 1.1
332 documents, GRAM_ODFF for ODF 1.2 documents. */
333 formula::FormulaGrammar::Grammar eStorageGrammar
;
335 /** The compiler grammar used in ODF import after brackets had been
336 stripped (which they shouldn't, but until that's fixed) by the XML
338 formula::FormulaGrammar::Grammar eXmlImportGrammar
;
340 sal_uLong nFormulaCodeInTree
; // FormelRPN im Formelbaum
341 sal_uLong nXMLImportedFormulaCount
; // progress count during XML import
342 sal_uInt16 nInterpretLevel
; // >0 if in interpreter
343 sal_uInt16 nMacroInterpretLevel
; // >0 if macro in interpreter
344 sal_uInt16 nInterpreterTableOpLevel
; // >0 if in interpreter TableOp
345 SCTAB nMaxTableNumber
;
346 sal_uInt16 nSrcVer
; // file version (load/save)
347 SCROW nSrcMaxRow
; // number of lines to load/save
348 sal_uInt16 nFormulaTrackCount
;
349 bool bHardRecalcState
; // false: soft, true: hard
350 SCTAB nVisibleTab
; // for OLE etc., don't use inside ScDocument
352 ScLkUpdMode eLinkMode
;
354 bool bAutoCalc
; // calculate automatically
355 bool bAutoCalcShellDisabled
; // in/from/for ScDocShell disabled
356 // are there ForcedFormulas which have to be calculated
357 // in interaction with ScDocShell SetDocumentModified,
358 // AutoCalcShellDisabled and TrackFormulas
359 bool bForcedFormulaPending
;
360 bool bCalculatingFormulaTree
;
363 bool bIsVisible
; // set from view ctor
365 bool bIsEmbedded
; // display/adjust Embedded area?
367 // no broadcast, construct no listener during insert from a different
368 // Doc (per filter or the like ), not until CompileAll / CalcAfterLoad
369 bool bInsertingFromOtherDoc
;
371 bool bImportingXML
; // special handling of formula text
372 bool bXMLFromWrapper
; // distinguish ScXMLImportWrapper from external component
373 bool bCalcingAfterLoad
; // in CalcAfterLoad TRUE
374 // don't construct/destruct listeners temporarily
377 bool bInLinkUpdate
; // TableLink or AreaLink
378 bool bChartListenerCollectionNeedsUpdate
;
379 // are/were there RC_FORCED formula cells in the document (if set once to TRUE then set forever)
380 bool bHasForcedFormulas
;
381 // is the Doc being destroyed? (no Notify-Tracking etc. needed anymore)
383 // expand reference if insert column/row takes place at the border
385 // is fetched in each UpdateReference from InputOptions,
386 // assigned, and restored at the end of UpdateReference
388 // for detective update, is set for each change of a formula
389 bool bDetectiveDirty
;
391 sal_uInt8 nMacroCallMode
; // Macros per warning dialog disabled?
392 bool bHasMacroFunc
; // valid only after loading
394 sal_uInt8 nVisSpellState
;
396 sal_uInt8 nAsianCompression
;
397 sal_uInt8 nAsianKerning
;
398 bool bSetDrawDefaults
;
400 bool bPastingDrawFromOtherDoc
;
402 sal_uInt8 nInDdeLinkUpdate
; // originating DDE links (stacked bool)
404 bool bInUnoBroadcast
;
405 bool bInUnoListenerCall
;
406 formula::FormulaGrammar::Grammar eGrammar
;
408 mutable bool bStyleSheetUsageInvalid
;
410 bool mbUndoEnabled
:1;
411 bool mbAdjustHeightEnabled
:1;
412 bool mbExecuteLinkEnabled
:1;
413 bool mbChangeReadOnlyEnabled
:1; // allow changes in read-only document (for API import filters)
414 bool mbStreamValidLocked
:1;
415 bool mbUserInteractionEnabled
:1; // whether or not to launch any kind of interactive dialogs.
417 sal_Int16 mnNamedRangesLockCount
;
419 ::std::set
<ScFormulaCell
*> maSubTotalCells
;
421 bool mbUseEmbedFonts
;
423 bool IsUsingEmbededFonts() { return mbUseEmbedFonts
; }
424 void SetIsUsingEmbededFonts( bool bUse
) { mbUseEmbedFonts
= bUse
; }
425 SC_DLLPUBLIC sal_uLong
GetCellCount() const; // all cells
426 SCSIZE
GetCellCount(SCTAB nTab
, SCCOL nCol
) const;
427 sal_uLong
GetCodeCount() const; // RPN-Code in formulas
428 DECL_LINK( GetUserDefinedColor
, sal_uInt16
* );
432 SC_DLLPUBLIC
ScDocument( ScDocumentMode eMode
= SCDOCMODE_DOCUMENT
,
433 SfxObjectShell
* pDocShell
= NULL
);
434 SC_DLLPUBLIC
~ScDocument();
436 inline ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>
437 GetServiceManager() const { return xServiceManager
; }
439 SC_DLLPUBLIC
const OUString
& GetName() const { return aDocName
; }
440 void SetName( const OUString
& r
) { aDocName
= r
; }
441 const OUString
& GetCodeName() const { return aDocCodeName
; }
442 void SetCodeName( const OUString
& r
) { aDocCodeName
= r
; }
443 const OUString
& GetFileURL() const { return maFileURL
; }
445 void GetDocStat( ScDocStat
& rDocStat
);
447 SC_DLLPUBLIC
void InitDrawLayer( SfxObjectShell
* pDocShell
= NULL
);
448 rtl::Reference
<XColorList
> GetColorList();
450 SC_DLLPUBLIC
sfx2::LinkManager
* GetLinkManager() const;
452 SC_DLLPUBLIC
const ScDocOptions
& GetDocOptions() const;
453 SC_DLLPUBLIC
void SetDocOptions( const ScDocOptions
& rOpt
);
454 SC_DLLPUBLIC
const ScViewOptions
& GetViewOptions() const;
455 SC_DLLPUBLIC
void SetViewOptions( const ScViewOptions
& rOpt
);
456 void SetPrintOptions();
458 ScExtDocOptions
* GetExtDocOptions() { return pExtDocOptions
; }
459 SC_DLLPUBLIC
void SetExtDocOptions( ScExtDocOptions
* pNewOptions
);
461 SC_DLLPUBLIC
void GetLanguage( LanguageType
& rLatin
, LanguageType
& rCjk
, LanguageType
& rCtl
) const;
462 void SetLanguage( LanguageType eLatin
, LanguageType eCjk
, LanguageType eCtl
);
464 void SetDrawDefaults();
466 void SetConsolidateDlgData( const ScConsolidateParam
* pData
);
467 const ScConsolidateParam
* GetConsolidateDlgData() const { return pConsolidateDlgData
; }
469 void Clear( bool bFromDestructor
= false );
471 ScFieldEditEngine
* CreateFieldEditEngine();
472 void DisposeFieldEditEngine(ScFieldEditEngine
*& rpEditEngine
);
475 * Get all range names that are local to each table. It only returns
476 * non-empty range name set.
478 SC_DLLPUBLIC
void GetAllTabRangeNames(ScRangeName::TabNameCopyMap
& rRangeNames
) const;
479 SC_DLLPUBLIC
void SetAllRangeNames( const boost::ptr_map
<OUString
, ScRangeName
>& rRangeMap
);
480 SC_DLLPUBLIC
void GetTabRangeNameMap(std::map
<OUString
, ScRangeName
*>& rRangeName
);
481 SC_DLLPUBLIC
void GetRangeNameMap(std::map
<OUString
, ScRangeName
*>& rRangeName
);
482 SC_DLLPUBLIC ScRangeName
* GetRangeName(SCTAB nTab
) const;
483 SC_DLLPUBLIC ScRangeName
* GetRangeName() const;
484 void SetRangeName(SCTAB nTab
, ScRangeName
* pNew
);
485 void SetRangeName( ScRangeName
* pNewRangeName
);
486 SCTAB
GetMaxTableNumber() { return static_cast<SCTAB
>(maTabs
.size()) - 1; }
487 void SetMaxTableNumber(SCTAB nNumber
) { nMaxTableNumber
= nNumber
; }
489 ScRangePairList
* GetColNameRanges() { return &xColNameRanges
; }
490 ScRangePairList
* GetRowNameRanges() { return &xRowNameRanges
; }
491 ScRangePairListRef
& GetColNameRangesRef() { return xColNameRanges
; }
492 ScRangePairListRef
& GetRowNameRangesRef() { return xRowNameRanges
; }
494 SC_DLLPUBLIC ScDBCollection
* GetDBCollection() const;
495 void SetDBCollection( ScDBCollection
* pNewDBCollection
,
496 bool bRemoveAutoFilter
= false );
497 const ScDBData
* GetDBAtCursor(SCCOL nCol
, SCROW nRow
, SCTAB nTab
, bool bStartOnly
= false) const;
498 ScDBData
* GetDBAtCursor(SCCOL nCol
, SCROW nRow
, SCTAB nTab
, bool bStartOnly
= false);
499 const ScDBData
* GetDBAtArea(SCTAB nTab
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
) const;
500 ScDBData
* GetDBAtArea(SCTAB nTab
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
502 SC_DLLPUBLIC
const ScRangeData
* GetRangeAtBlock( const ScRange
& rBlock
, OUString
* pName
=NULL
) const;
504 bool HasPivotTable() const;
505 SC_DLLPUBLIC ScDPCollection
* GetDPCollection();
506 SC_DLLPUBLIC
const ScDPCollection
* GetDPCollection() const;
507 ScDPObject
* GetDPAtCursor(SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
508 ScDPObject
* GetDPAtBlock( const ScRange
& rBlock
) const;
510 SC_DLLPUBLIC ScChartCollection
* GetChartCollection() const;
512 void StopTemporaryChartLock();
514 void EnsureGraphicNames();
516 SdrObject
* GetObjectAtPoint( SCTAB nTab
, const Point
& rPos
);
517 bool HasChartAtPoint( SCTAB nTab
, const Point
& rPos
, OUString
& rName
);
519 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartDocument
> GetChartByName( const OUString
& rChartName
);
520 SC_DLLPUBLIC
void GetChartRanges( const OUString
& rChartName
, ::std::vector
< ScRangeList
>& rRanges
, ScDocument
* pSheetNameDoc
);
521 void SetChartRanges( const OUString
& rChartName
, const ::std::vector
< ScRangeList
>& rRanges
);
523 void UpdateChartArea( const OUString
& rChartName
, const ScRange
& rNewArea
,
524 bool bColHeaders
, bool bRowHeaders
, bool bAdd
);
525 void UpdateChartArea( const OUString
& rChartName
,
526 const ScRangeListRef
& rNewList
,
527 bool bColHeaders
, bool bRowHeaders
, bool bAdd
);
528 void GetOldChartParameters( const OUString
& rName
,
529 ScRangeList
& rRanges
, bool& rColHeaders
, bool& rRowHeaders
);
530 ::com::sun::star::uno::Reference
<
531 ::com::sun::star::embed::XEmbeddedObject
>
532 FindOleObjectByName( const OUString
& rName
);
534 SC_DLLPUBLIC
void MakeTable( SCTAB nTab
,bool _bNeedsNameCheck
= true );
536 SCTAB
GetVisibleTab() const { return nVisibleTab
; }
537 SC_DLLPUBLIC
void SetVisibleTab(SCTAB nTab
) { nVisibleTab
= nTab
; }
539 SC_DLLPUBLIC
bool HasTable( SCTAB nTab
) const;
540 SC_DLLPUBLIC
bool GetName( SCTAB nTab
, OUString
& rName
) const;
541 SC_DLLPUBLIC
bool GetCodeName( SCTAB nTab
, OUString
& rName
) const;
542 SC_DLLPUBLIC
bool SetCodeName( SCTAB nTab
, const OUString
& rName
);
543 SC_DLLPUBLIC
bool GetTable( const OUString
& rName
, SCTAB
& rTab
) const;
544 OUString
GetCopyTabName(SCTAB nTab
) const;
546 SC_DLLPUBLIC
void SetAnonymousDBData(SCTAB nTab
, ScDBData
* pDBData
);
547 SC_DLLPUBLIC ScDBData
* GetAnonymousDBData(SCTAB nTab
);
549 SC_DLLPUBLIC
inline SCTAB
GetTableCount() const { return static_cast<SCTAB
>(maTabs
.size()); }
550 SvNumberFormatterIndexTable
* GetFormatExchangeList() const { return pFormatExchangeList
; }
552 SC_DLLPUBLIC ScDocProtection
* GetDocProtection() const;
553 SC_DLLPUBLIC
void SetDocProtection(const ScDocProtection
* pProtect
);
554 SC_DLLPUBLIC
bool IsDocProtected() const;
555 bool IsDocEditable() const;
556 SC_DLLPUBLIC
bool IsTabProtected( SCTAB nTab
) const;
557 SC_DLLPUBLIC ScTableProtection
* GetTabProtection( SCTAB nTab
) const;
558 SC_DLLPUBLIC
void SetTabProtection(SCTAB nTab
, const ScTableProtection
* pProtect
);
559 void CopyTabProtection(SCTAB nTabSrc
, SCTAB nTabDest
);
561 void LockTable(SCTAB nTab
);
562 void UnlockTable(SCTAB nTab
);
564 bool IsBlockEditable( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
,
565 SCCOL nEndCol
, SCROW nEndRow
,
566 bool* pOnlyNotBecauseOfMatrix
= NULL
) const;
567 bool IsSelectionEditable( const ScMarkData
& rMark
,
568 bool* pOnlyNotBecauseOfMatrix
= NULL
) const;
569 bool HasSelectedBlockMatrixFragment( SCCOL nStartCol
, SCROW nStartRow
,
570 SCCOL nEndCol
, SCROW nEndRow
,
571 const ScMarkData
& rMark
) const;
573 bool GetMatrixFormulaRange( const ScAddress
& rCellPos
, ScRange
& rMatrix
);
575 bool IsEmbedded() const;
576 void GetEmbedded( ScRange
& rRange
) const;
577 void SetEmbedded( const ScRange
& rRange
);
578 void ResetEmbedded();
579 Rectangle
GetEmbeddedRect() const; // 1/100 mm
580 void SetEmbedded( SCTAB nTab
, const Rectangle
& rRect
); // from VisArea (1/100 mm)
582 static SC_DLLPUBLIC
bool ValidTabName( const OUString
& rName
);
584 SC_DLLPUBLIC
bool ValidNewTabName( const OUString
& rName
) const;
585 SC_DLLPUBLIC
void CreateValidTabName(OUString
& rName
) const;
586 SC_DLLPUBLIC
void CreateValidTabNames(std::vector
<OUString
>& aNames
, SCTAB nCount
) const;
588 void AppendTabOnLoad(const OUString
& rName
);
589 void SetTabNameOnLoad(SCTAB nTab
, const OUString
& rName
);
590 void InvalidateStreamOnSave();
592 SC_DLLPUBLIC
bool InsertTab( SCTAB nPos
, const OUString
& rName
,
593 bool bExternalDocument
= false );
594 SC_DLLPUBLIC
bool InsertTabs( SCTAB nPos
, const std::vector
<OUString
>& rNames
,
595 bool bExternalDocument
= false, bool bNamesValid
= false );
596 SC_DLLPUBLIC
bool DeleteTabs( SCTAB nTab
, SCTAB nSheets
, ScDocument
* pRefUndoDoc
= NULL
);
597 SC_DLLPUBLIC
bool DeleteTab( SCTAB nTab
, ScDocument
* pRefUndoDoc
= NULL
);
598 SC_DLLPUBLIC
bool RenameTab( SCTAB nTab
, const OUString
& rName
,
599 bool bUpdateRef
= true,
600 bool bExternalDocument
= false );
601 bool MoveTab( SCTAB nOldPos
, SCTAB nNewPos
, ScProgress
* pProgress
= NULL
);
602 bool CopyTab( SCTAB nOldPos
, SCTAB nNewPos
,
603 const ScMarkData
* pOnlyMarked
= NULL
);
604 SC_DLLPUBLIC sal_uLong
TransferTab(ScDocument
* pSrcDoc
, SCTAB nSrcPos
, SCTAB nDestPos
,
605 bool bInsertNew
= true,
606 bool bResultsOnly
= false );
607 SC_DLLPUBLIC
void TransferDrawPage(ScDocument
* pSrcDoc
, SCTAB nSrcPos
, SCTAB nDestPos
);
608 SC_DLLPUBLIC
void SetVisible( SCTAB nTab
, bool bVisible
);
609 SC_DLLPUBLIC
bool IsVisible( SCTAB nTab
) const;
610 bool IsStreamValid( SCTAB nTab
) const;
611 void SetStreamValid( SCTAB nTab
, bool bSet
, bool bIgnoreLock
= false );
612 void LockStreamValid( bool bLock
);
613 bool IsStreamValidLocked() const { return mbStreamValidLocked
; }
614 bool IsPendingRowHeights( SCTAB nTab
) const;
615 void SetPendingRowHeights( SCTAB nTab
, bool bSet
);
616 SC_DLLPUBLIC
void SetLayoutRTL( SCTAB nTab
, bool bRTL
);
617 SC_DLLPUBLIC
bool IsLayoutRTL( SCTAB nTab
) const;
618 bool IsNegativePage( SCTAB nTab
) const;
619 SC_DLLPUBLIC
void SetScenario( SCTAB nTab
, bool bFlag
);
620 SC_DLLPUBLIC
bool IsScenario( SCTAB nTab
) const;
621 SC_DLLPUBLIC
void GetScenarioData( SCTAB nTab
, OUString
& rComment
,
622 Color
& rColor
, sal_uInt16
& rFlags
) const;
623 SC_DLLPUBLIC
void SetScenarioData( SCTAB nTab
, const OUString
& rComment
,
624 const Color
& rColor
, sal_uInt16 nFlags
);
625 SC_DLLPUBLIC Color
GetTabBgColor( SCTAB nTab
) const;
626 SC_DLLPUBLIC
void SetTabBgColor( SCTAB nTab
, const Color
& rColor
);
627 SC_DLLPUBLIC
bool IsDefaultTabBgColor( SCTAB nTab
) const;
628 void GetScenarioFlags( SCTAB nTab
, sal_uInt16
& rFlags
) const;
629 SC_DLLPUBLIC
bool IsActiveScenario( SCTAB nTab
) const;
630 SC_DLLPUBLIC
void SetActiveScenario( SCTAB nTab
, bool bActive
); // only for Undo etc.
631 SC_DLLPUBLIC
formula::FormulaGrammar::AddressConvention
GetAddressConvention() const;
632 SC_DLLPUBLIC
formula::FormulaGrammar::Grammar
GetGrammar() const;
633 void SetGrammar( formula::FormulaGrammar::Grammar eGram
);
634 SC_DLLPUBLIC sal_uInt8
GetLinkMode( SCTAB nTab
) const;
635 bool IsLinked( SCTAB nTab
) const;
636 SC_DLLPUBLIC
const OUString
GetLinkDoc( SCTAB nTab
) const;
637 const OUString
GetLinkFlt( SCTAB nTab
) const;
638 const OUString
GetLinkOpt( SCTAB nTab
) const;
639 SC_DLLPUBLIC
const OUString
GetLinkTab( SCTAB nTab
) const;
640 sal_uLong
GetLinkRefreshDelay( SCTAB nTab
) const;
641 void SetLink( SCTAB nTab
, sal_uInt8 nMode
, const OUString
& rDoc
,
642 const OUString
& rFilter
, const OUString
& rOptions
,
643 const OUString
& rTabName
, sal_uLong nRefreshDelay
);
644 bool HasLink( const OUString
& rDoc
,
645 const OUString
& rFilter
, const OUString
& rOptions
) const;
646 SC_DLLPUBLIC
bool LinkExternalTab( SCTAB
& nTab
, const OUString
& aDocTab
,
647 const OUString
& aFileName
,
648 const OUString
& aTabName
);
650 bool HasExternalRefManager() const { return pExternalRefMgr
.get(); }
651 SC_DLLPUBLIC ScExternalRefManager
* GetExternalRefManager() const;
652 bool IsInExternalReferenceMarking() const;
653 void MarkUsedExternalReferences();
654 bool MarkUsedExternalReferences( ScTokenArray
& rArr
);
656 /** Returns the pool containing external formula parsers. Creates the pool
658 ScFormulaParserPool
& GetFormulaParserPool() const;
660 bool HasDdeLinks() const;
661 bool HasAreaLinks() const;
662 void UpdateExternalRefLinks(Window
* pWin
);
663 void UpdateDdeLinks(Window
* pWin
);
664 void UpdateAreaLinks();
666 // originating DDE links
667 void IncInDdeLinkUpdate() { if ( nInDdeLinkUpdate
< 255 ) ++nInDdeLinkUpdate
; }
668 void DecInDdeLinkUpdate() { if ( nInDdeLinkUpdate
) --nInDdeLinkUpdate
; }
669 bool IsInDdeLinkUpdate() const { return nInDdeLinkUpdate
!= 0; }
671 SC_DLLPUBLIC
void CopyDdeLinks( ScDocument
* pDestDoc
) const;
672 void DisconnectDdeLinks();
675 sal_uInt16
GetDdeLinkCount() const;
676 bool UpdateDdeLink( const OUString
& rAppl
, const OUString
& rTopic
, const OUString
& rItem
);
678 /** Tries to find a DDE link with the specified connection data.
679 @param rnDdePos (out-param) Returns the index of the DDE link (does not include other links from link manager).
680 @return true = DDE link found, rnDdePos valid. */
681 SC_DLLPUBLIC
bool FindDdeLink( const OUString
& rAppl
, const OUString
& rTopic
, const OUString
& rItem
, sal_uInt8 nMode
, sal_uInt16
& rnDdePos
);
683 /** Returns the connection data of the specified DDE link.
684 @param nDdePos Index of the DDE link (does not include other links from link manager).
685 @param rAppl (out-param) The application name.
686 @param rTopic (out-param) The DDE topic.
687 @param rItem (out-param) The DDE item.
688 @return true = DDE link found, out-parameters valid. */
689 bool GetDdeLinkData( sal_uInt16 nDdePos
, OUString
& rAppl
, OUString
& rTopic
, OUString
& rItem
) const;
690 /** Returns the link mode of the specified DDE link.
691 @param nDdePos Index of the DDE link (does not include other links from link manager).
692 @param rnMode (out-param) The link mode of the specified DDE link.
693 @return true = DDE link found, rnMode valid. */
694 bool GetDdeLinkMode( sal_uInt16 nDdePos
, sal_uInt8
& rnMode
) const;
695 /** Returns the result matrix of the specified DDE link.
696 @param nDdePos Index of the DDE link (does not include other links from link manager).
697 @return The result matrix, if the DDE link has been found, 0 otherwise. */
698 SC_DLLPUBLIC
const ScMatrix
* GetDdeLinkResultMatrix( sal_uInt16 nDdePos
) const;
700 /** Tries to find a DDE link or creates a new, if not extant.
701 @param pResults If not 0, sets the matrix as as DDE link result matrix (also for existing links).
702 @return true = DDE link found; false = Unpredictable error occurred, no DDE link created. */
703 SC_DLLPUBLIC
bool CreateDdeLink( const OUString
& rAppl
, const OUString
& rTopic
, const OUString
& rItem
, sal_uInt8 nMode
, ScMatrixRef pResults
);
704 /** Sets a result matrix for the specified DDE link.
705 @param nDdePos Index of the DDE link (does not include other links from link manager).
706 @param pResults The array containing all results of the DDE link (intrusive-ref-counted, do not delete).
707 @return true = DDE link found and matrix set. */
708 bool SetDdeLinkResultMatrix( sal_uInt16 nDdePos
, ScMatrixRef pResults
);
711 SfxBindings
* GetViewBindings();
712 SfxObjectShell
* GetDocumentShell() const { return pShell
; }
713 SC_DLLPUBLIC ScDrawLayer
* GetDrawLayer();
714 SfxBroadcaster
* GetDrawBroadcaster(); // to avoid header
715 void BeginDrawUndo();
717 void BeginUnoRefUndo();
718 bool HasUnoRefUndo() const { return ( pUnoRefUndoList
!= NULL
); }
719 ScUnoRefList
* EndUnoRefUndo(); // must be deleted by caller!
720 sal_Int64
GetNewUnoId();
721 void AddUnoRefChange( sal_Int64 nId
, const ScRangeList
& rOldRanges
);
723 bool IsChart( const SdrObject
* pObject
);
725 SC_DLLPUBLIC
void UpdateAllCharts();
726 void UpdateChartRef( UpdateRefMode eUpdateRefMode
,
727 SCCOL nCol1
, SCROW nRow1
, SCTAB nTab1
,
728 SCCOL nCol2
, SCROW nRow2
, SCTAB nTab2
,
729 SCsCOL nDx
, SCsROW nDy
, SCsTAB nDz
);
730 //! only assigns the new RangeList, no ChartListener or the like
731 void SetChartRangeList( const OUString
& rChartName
,
732 const ScRangeListRef
& rNewRangeListRef
);
734 void StartAnimations( SCTAB nTab
, Window
* pWin
);
736 bool HasBackgroundDraw( SCTAB nTab
, const Rectangle
& rMMRect
) const;
737 bool HasAnyDraw( SCTAB nTab
, const Rectangle
& rMMRect
) const;
739 const ScSheetEvents
* GetSheetEvents( SCTAB nTab
) const;
740 void SetSheetEvents( SCTAB nTab
, const ScSheetEvents
* pNew
);
741 bool HasSheetEventScript( SCTAB nTab
, sal_Int32 nEvent
, bool bWithVbaEvents
= false ) const;
742 bool HasAnySheetEventScript( sal_Int32 nEvent
, bool bWithVbaEvents
= false ) const; // on any sheet
744 bool HasAnyCalcNotification() const;
745 bool HasCalcNotification( SCTAB nTab
) const;
746 void SetCalcNotification( SCTAB nTab
);
747 void ResetCalcNotifications();
749 SC_DLLPUBLIC ScOutlineTable
* GetOutlineTable( SCTAB nTab
, bool bCreate
= false );
750 bool SetOutlineTable( SCTAB nTab
, const ScOutlineTable
* pNewOutline
);
752 void DoAutoOutline( SCCOL nStartCol
, SCROW nStartRow
,
753 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nTab
);
755 bool DoSubTotals( SCTAB nTab
, ScSubTotalParam
& rParam
);
756 void RemoveSubTotals( SCTAB nTab
, ScSubTotalParam
& rParam
);
757 bool TestRemoveSubTotals( SCTAB nTab
, const ScSubTotalParam
& rParam
);
758 bool HasSubTotalCells( const ScRange
& rRange
);
760 SC_DLLPUBLIC
void EnsureTable( SCTAB nTab
);
762 // return TRUE = number format is set
763 SC_DLLPUBLIC
bool SetString(
764 SCCOL nCol
, SCROW nRow
, SCTAB nTab
, const OUString
& rString
,
765 ScSetStringParam
* pParam
= NULL
);
766 SC_DLLPUBLIC
bool SetString( const ScAddress
& rPos
, const OUString
& rString
, ScSetStringParam
* pParam
= NULL
);
769 * This method manages the lifecycle of the passed edit text object. When
770 * the text is successfully inserted, the cell takes over the ownership of
771 * the text object. If not, the text object gets deleted.
773 * <p>The caller must ensure that the passed edit text object <i>uses the
774 * SfxItemPool instance returned from ScDocument::GetEditPool()</i>.
775 * This is very important.</p>
777 SC_DLLPUBLIC
void SetEditText( const ScAddress
& rPos
, EditTextObject
* pEditText
);
779 void SetEditText( const ScAddress
& rPos
, const EditTextObject
& rEditText
, const SfxItemPool
* pEditPool
);
781 SC_DLLPUBLIC
void SetEditText( const ScAddress
& rPos
, const OUString
& rStr
);
784 * Call this if you are not sure whether to put this as an edit text or a
787 SC_DLLPUBLIC
void SetTextCell( const ScAddress
& rPos
, const OUString
& rStr
);
789 void SetEmptyCell( const ScAddress
& rPos
);
791 SC_DLLPUBLIC
void SetValue( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, const double& rVal
);
792 SC_DLLPUBLIC
void SetValue( const ScAddress
& rPos
, double fVal
);
793 void SetError( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, const sal_uInt16 nError
);
795 SC_DLLPUBLIC
void SetFormula(
796 const ScAddress
& rPos
, const ScTokenArray
& rArray
,
797 formula::FormulaGrammar::Grammar eGram
= formula::FormulaGrammar::GRAM_DEFAULT
);
799 SC_DLLPUBLIC
void SetFormula(
800 const ScAddress
& rPos
, const OUString
& rFormula
,
801 formula::FormulaGrammar::Grammar eGram
= formula::FormulaGrammar::GRAM_DEFAULT
);
803 SC_DLLPUBLIC
void SetFormulaCell( const ScAddress
& rPos
, ScFormulaCell
* pCell
);
805 SC_DLLPUBLIC
void InsertMatrixFormula(SCCOL nCol1
, SCROW nRow1
,
806 SCCOL nCol2
, SCROW nRow2
,
807 const ScMarkData
& rMark
,
808 const OUString
& rFormula
,
809 const ScTokenArray
* p
= NULL
,
810 const formula::FormulaGrammar::Grammar
= formula::FormulaGrammar::GRAM_DEFAULT
,
811 bool bDirtyFlag
=true );
812 SC_DLLPUBLIC
void InsertTableOp(const ScTabOpParam
& rParam
, // multi-operation
813 SCCOL nCol1
, SCROW nRow1
,
814 SCCOL nCol2
, SCROW nRow2
, const ScMarkData
& rMark
);
816 SC_DLLPUBLIC OUString
GetString( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
817 OUString
GetString( const ScAddress
& rPos
) const;
820 * Return a pointer to the string object stored in string cell.
822 * @param rPos cell position.
824 * @return pointer to the string object stored in string cell, or NULL if
825 * the cell at specified position is not a string cell. Note that
826 * it returns NULL even for a edit cell.
828 const OUString
* GetStringCell( const ScAddress
& rPos
) const;
831 * Return a pointer to the double value stored in value cell.
833 * @param rPos cell position
835 * @return pointer to the double value stored in a numeric cell, or NULL
836 * if the cell at specified position is not a numeric cell.
838 double* GetValueCell( const ScAddress
& rPos
);
840 SC_DLLPUBLIC
void GetInputString( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, String
& rString
);
841 SC_DLLPUBLIC
void GetInputString( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, OUString
& rString
);
842 sal_uInt16
GetStringForFormula( const ScAddress
& rPos
, OUString
& rString
);
843 SC_DLLPUBLIC
double GetValue( const ScAddress
& rPos
) const;
844 SC_DLLPUBLIC
double GetValue( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const { ScAddress
aAdr(nCol
, nRow
, nTab
); return GetValue(aAdr
);}
845 SC_DLLPUBLIC
void GetValue( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, double& rValue
) const;
846 SC_DLLPUBLIC
const EditTextObject
* GetEditText( const ScAddress
& rPos
) const;
847 void RemoveEditTextCharAttribs( const ScAddress
& rPos
, const ScPatternAttr
& rAttr
);
848 SC_DLLPUBLIC
double RoundValueAsShown( double fVal
, sal_uInt32 nFormat
) const;
849 SC_DLLPUBLIC
void GetNumberFormat( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
850 sal_uInt32
& rFormat
) const;
851 sal_uInt32
GetNumberFormat( const ScRange
& rRange
) const;
852 SC_DLLPUBLIC sal_uInt32
GetNumberFormat( const ScAddress
& ) const;
853 void SetNumberFormat( const ScAddress
& rPos
, sal_uInt32 nNumberFormat
);
855 void GetNumberFormatInfo( short& nType
, sal_uLong
& nIndex
, const ScAddress
& rPos
) const;
856 void GetFormula( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, String
& rFormula
) const;
857 const ScTokenArray
* GetFormulaTokens( const ScAddress
& rPos
) const;
858 SC_DLLPUBLIC
const ScFormulaCell
* GetFormulaCell( const ScAddress
& rPos
) const;
859 SC_DLLPUBLIC ScFormulaCell
* GetFormulaCell( const ScAddress
& rPos
);
860 SC_DLLPUBLIC
void GetFormula( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, OUString
& rFormula
) const;
861 SC_DLLPUBLIC
void GetCellType( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, CellType
& rCellType
) const;
862 SC_DLLPUBLIC CellType
GetCellType( const ScAddress
& rPos
) const;
864 SC_DLLPUBLIC
bool HasData( SCCOL nCol
, SCROW nRow
, SCTAB nTab
);
865 SC_DLLPUBLIC
bool HasStringData( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
866 SC_DLLPUBLIC
bool HasValueData( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
867 SC_DLLPUBLIC
bool HasValueData( const ScAddress
& rPos
) const;
868 bool HasStringCells( const ScRange
& rRange
) const;
870 /** Returns true, if there is any data to create a selection list for rPos. */
871 bool HasSelectionData( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
873 /** Returns a table notes container. */
874 SC_DLLPUBLIC ScNotes
* GetNotes(SCTAB nTab
);
876 /** Creates the captions of all uninitialized cell notes in the specified sheet.
877 @param bForced True = always create all captions, false = skip when Undo is disabled. */
878 void InitializeNoteCaptions( SCTAB nTab
, bool bForced
= false );
880 SC_DLLPUBLIC
void SetDrawPageSize(SCTAB nTab
);
882 bool ExtendMergeSel( SCCOL nStartCol
, SCROW nStartRow
,
883 SCCOL
& rEndCol
, SCROW
& rEndRow
, const ScMarkData
& rMark
,
884 bool bRefresh
= false );
885 SC_DLLPUBLIC
bool ExtendMerge( SCCOL nStartCol
, SCROW nStartRow
,
886 SCCOL
& rEndCol
, SCROW
& rEndRow
, SCTAB nTab
,
887 bool bRefresh
= false );
888 bool ExtendMerge( ScRange
& rRange
, bool bRefresh
= false );
889 bool ExtendTotalMerge( ScRange
& rRange
) const;
890 SC_DLLPUBLIC
bool ExtendOverlapped( SCCOL
& rStartCol
, SCROW
& rStartRow
,
891 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nTab
) const;
892 SC_DLLPUBLIC
bool ExtendOverlapped( ScRange
& rRange
) const;
894 bool RefreshAutoFilter( SCCOL nStartCol
, SCROW nStartRow
,
895 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nTab
);
897 SC_DLLPUBLIC
void DoMergeContents( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
,
898 SCCOL nEndCol
, SCROW nEndRow
);
900 SC_DLLPUBLIC
void DoMerge( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
,
901 SCCOL nEndCol
, SCROW nEndRow
, bool bDeleteCaptions
= true );
902 void RemoveMerge( SCCOL nCol
, SCROW nRow
, SCTAB nTab
);
904 bool IsBlockEmpty( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
,
905 SCCOL nEndCol
, SCROW nEndRow
, bool bIgnoreNotes
= false ) const;
906 bool IsPrintEmpty( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
,
907 SCCOL nEndCol
, SCROW nEndRow
,
908 bool bLeftIsEmpty
= false,
909 ScRange
* pLastRange
= NULL
,
910 Rectangle
* pLastMM
= NULL
) const;
912 void SkipOverlapped( SCCOL
& rCol
, SCROW
& rRow
, SCTAB nTab
) const;
913 bool IsHorOverlapped( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
914 bool IsVerOverlapped( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
916 SC_DLLPUBLIC
bool HasAttrib( SCCOL nCol1
, SCROW nRow1
, SCTAB nTab1
,
917 SCCOL nCol2
, SCROW nRow2
, SCTAB nTab2
, sal_uInt16 nMask
) const;
918 SC_DLLPUBLIC
bool HasAttrib( const ScRange
& rRange
, sal_uInt16 nMask
) const;
920 SC_DLLPUBLIC
void GetBorderLines( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
921 const ::editeng::SvxBorderLine
** ppLeft
,
922 const ::editeng::SvxBorderLine
** ppTop
,
923 const ::editeng::SvxBorderLine
** ppRight
,
924 const ::editeng::SvxBorderLine
** ppBottom
) const;
926 void ResetChanged( const ScRange
& rRange
);
929 void SetDirty( const ScRange
& );
930 void SetTableOpDirty( const ScRange
& ); // for Interpreter TableOp
931 void InterpretDirtyCells( const ScRangeList
& rRanges
);
933 SC_DLLPUBLIC
void CalcAfterLoad();
938 * Re-compile formula cells with error.
940 * @param nErrCode specified error code to match. Only those cells with
941 * this error code will be re-compiled. If this value is
942 * 0, cells with any error values will be re-compiled.
944 * @return true if at least one cell is re-compiled, false if no cells are
947 bool CompileErrorCells(sal_uInt16 nErrCode
);
949 ScAutoNameCache
* GetAutoNameCache() { return pAutoNameCache
; }
950 void SetPreviewFont( SfxItemSet
* pFontSet
);
951 SfxItemSet
* GetPreviewFont() { return pPreviewFont
; }
952 SfxItemSet
* GetPreviewFont( SCCOL nCol
, SCROW nRow
, SCTAB nTab
);
953 const ScMarkData
& GetPreviewSelection();
954 void SetPreviewSelection( ScMarkData
& rSel
);
955 SC_DLLPUBLIC
void SetAutoNameCache( ScAutoNameCache
* pCache
);
957 /** Creates a ScLookupCache cache for the range if it
958 doesn't already exist. */
959 ScLookupCache
& GetLookupCache( const ScRange
& rRange
);
960 /** Only ScLookupCache ctor uses AddLookupCache(), do not
962 void AddLookupCache( ScLookupCache
& rCache
);
963 /** Only ScLookupCache dtor uses RemoveLookupCache(), do
964 not use elsewhere! */
965 void RemoveLookupCache( ScLookupCache
& rCache
);
966 /** Zap all caches. */
967 void ClearLookupCaches();
969 // calculate automatically
970 void SetAutoCalc( bool bNewAutoCalc
);
971 bool GetAutoCalc() const { return bAutoCalc
; }
972 // calculate automatically in/from/for ScDocShell disabled
973 void SetAutoCalcShellDisabled( bool bNew
) { bAutoCalcShellDisabled
= bNew
; }
974 bool IsAutoCalcShellDisabled() const { return bAutoCalcShellDisabled
; }
975 // ForcedFormulas are to be calculated
976 void SetForcedFormulaPending( bool bNew
) { bForcedFormulaPending
= bNew
; }
977 bool IsForcedFormulaPending() const { return bForcedFormulaPending
; }
978 // if CalcFormulaTree() is currently running
979 bool IsCalculatingFormulaTree() { return bCalculatingFormulaTree
; }
981 sal_uInt16
GetErrCode( const ScAddress
& ) const;
983 /** Shrink a range to only include data area.
985 This is not the actually used area within the
986 selection, but the bounds of the sheet's data area
989 @returns TRUE if the area passed intersected the data
990 area, FALSE if not, in which case the values
991 obtained may be out of bounds, not in order or
992 unmodified. TRUE does not mean that there
993 actually is any data within the selection.
995 bool ShrinkToDataArea( SCTAB nTab
, SCCOL
& rStartCol
, SCROW
& rStartRow
, SCCOL
& rEndCol
, SCROW
& rEndRow
) const;
997 /** Shrink a range to only include used data area.
1000 Out parameter, true if area was shrunk, false if not.
1002 @returns true if there is any data, false if not.
1004 bool ShrinkToUsedDataArea( bool& o_bShrunk
,
1005 SCTAB nTab
, SCCOL
& rStartCol
, SCROW
& rStartRow
,
1006 SCCOL
& rEndCol
, SCROW
& rEndRow
, bool bColumnsOnly
) const;
1008 SC_DLLPUBLIC
void GetDataArea( SCTAB nTab
, SCCOL
& rStartCol
, SCROW
& rStartRow
,
1009 SCCOL
& rEndCol
, SCROW
& rEndRow
, bool bIncludeOld
, bool bOnlyDown
) const;
1010 SC_DLLPUBLIC
bool GetCellArea( SCTAB nTab
, SCCOL
& rEndCol
, SCROW
& rEndRow
) const;
1011 SC_DLLPUBLIC
bool GetTableArea( SCTAB nTab
, SCCOL
& rEndCol
, SCROW
& rEndRow
) const;
1012 SC_DLLPUBLIC
bool GetPrintArea( SCTAB nTab
, SCCOL
& rEndCol
, SCROW
& rEndRow
,
1013 bool bNotes
= true ) const;
1014 SC_DLLPUBLIC
bool GetPrintAreaHor( SCTAB nTab
, SCROW nStartRow
, SCROW nEndRow
,
1015 SCCOL
& rEndCol
, bool bNotes
= true ) const;
1016 SC_DLLPUBLIC
bool GetPrintAreaVer( SCTAB nTab
, SCCOL nStartCol
, SCCOL nEndCol
,
1017 SCROW
& rEndRow
, bool bNotes
= true ) const;
1018 void InvalidateTableArea();
1021 SC_DLLPUBLIC
bool GetDataStart( SCTAB nTab
, SCCOL
& rStartCol
, SCROW
& rStartRow
) const;
1024 * Find the maximum column position that contains printable data for the
1025 * specified row range. The final column position must be equal or less
1026 * than the initial value of rEndCol.
1028 void ExtendPrintArea( OutputDevice
* pDev
, SCTAB nTab
,
1029 SCCOL nStartCol
, SCROW nStartRow
,
1030 SCCOL
& rEndCol
, SCROW nEndRow
) const;
1031 SC_DLLPUBLIC SCSIZE
GetEmptyLinesInBlock( SCCOL nStartCol
, SCROW nStartRow
, SCTAB nStartTab
,
1032 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nEndTab
,
1035 void FindAreaPos( SCCOL
& rCol
, SCROW
& rRow
, SCTAB nTab
, ScMoveDirection eDirection
) const;
1036 SC_DLLPUBLIC
void GetNextPos( SCCOL
& rCol
, SCROW
& rRow
, SCTAB nTab
, SCsCOL nMovX
, SCsROW nMovY
,
1037 bool bMarked
, bool bUnprotected
, const ScMarkData
& rMark
) const;
1039 bool GetNextMarkedCell( SCCOL
& rCol
, SCROW
& rRow
, SCTAB nTab
,
1040 const ScMarkData
& rMark
);
1042 void LimitChartArea( SCTAB nTab
, SCCOL
& rStartCol
, SCROW
& rStartRow
,
1043 SCCOL
& rEndCol
, SCROW
& rEndRow
);
1044 void LimitChartIfAll( ScRangeListRef
& rRangeList
);
1046 bool InsertRow( SCCOL nStartCol
, SCTAB nStartTab
,
1047 SCCOL nEndCol
, SCTAB nEndTab
,
1048 SCROW nStartRow
, SCSIZE nSize
, ScDocument
* pRefUndoDoc
= NULL
,
1049 const ScMarkData
* pTabMark
= NULL
);
1050 SC_DLLPUBLIC
bool InsertRow( const ScRange
& rRange
, ScDocument
* pRefUndoDoc
= NULL
);
1051 void DeleteRow( SCCOL nStartCol
, SCTAB nStartTab
,
1052 SCCOL nEndCol
, SCTAB nEndTab
,
1053 SCROW nStartRow
, SCSIZE nSize
,
1054 ScDocument
* pRefUndoDoc
= NULL
, bool* pUndoOutline
= NULL
,
1055 const ScMarkData
* pTabMark
= NULL
);
1056 SC_DLLPUBLIC
void DeleteRow( const ScRange
& rRange
,
1057 ScDocument
* pRefUndoDoc
= NULL
, bool* pUndoOutline
= NULL
);
1058 bool InsertCol( SCROW nStartRow
, SCTAB nStartTab
,
1059 SCROW nEndRow
, SCTAB nEndTab
,
1060 SCCOL nStartCol
, SCSIZE nSize
, ScDocument
* pRefUndoDoc
= NULL
,
1061 const ScMarkData
* pTabMark
= NULL
);
1062 SC_DLLPUBLIC
bool InsertCol( const ScRange
& rRange
, ScDocument
* pRefUndoDoc
= NULL
);
1063 void DeleteCol( SCROW nStartRow
, SCTAB nStartTab
,
1064 SCROW nEndRow
, SCTAB nEndTab
,
1065 SCCOL nStartCol
, SCSIZE nSize
,
1066 ScDocument
* pRefUndoDoc
= NULL
, bool* pUndoOutline
= NULL
,
1067 const ScMarkData
* pTabMark
= NULL
);
1068 void DeleteCol( const ScRange
& rRange
,
1069 ScDocument
* pRefUndoDoc
= NULL
, bool* pUndoOutline
= NULL
);
1071 bool CanInsertRow( const ScRange
& rRange
) const;
1072 bool CanInsertCol( const ScRange
& rRange
) const;
1074 void FitBlock( const ScRange
& rOld
, const ScRange
& rNew
, bool bClear
= true );
1075 bool CanFitBlock( const ScRange
& rOld
, const ScRange
& rNew
);
1077 bool IsClipOrUndo() const { return bIsClip
|| bIsUndo
; }
1078 bool IsUndo() const { return bIsUndo
; }
1079 bool IsClipboard() const { return bIsClip
; }
1080 bool IsUndoEnabled() const { return mbUndoEnabled
; }
1081 void EnableUndo( bool bVal
);
1083 bool IsAdjustHeightEnabled() const { return mbAdjustHeightEnabled
; }
1084 void EnableAdjustHeight( bool bVal
) { mbAdjustHeightEnabled
= bVal
; }
1085 bool IsExecuteLinkEnabled() const { return mbExecuteLinkEnabled
; }
1086 void EnableExecuteLink( bool bVal
) { mbExecuteLinkEnabled
= bVal
; }
1087 bool IsChangeReadOnlyEnabled() const { return mbChangeReadOnlyEnabled
; }
1088 void EnableChangeReadOnly( bool bVal
) { mbChangeReadOnlyEnabled
= bVal
; }
1089 SC_DLLPUBLIC
bool IsUserInteractionEnabled() const;
1090 SC_DLLPUBLIC
void EnableUserInteraction( bool bVal
);
1091 SC_DLLPUBLIC sal_Int16
GetNamedRangesLockCount() const { return mnNamedRangesLockCount
; }
1092 void SetNamedRangesLockCount( sal_Int16 nCount
) { mnNamedRangesLockCount
= nCount
; }
1093 SC_DLLPUBLIC
void ResetClip( ScDocument
* pSourceDoc
, const ScMarkData
* pMarks
);
1094 SC_DLLPUBLIC
void ResetClip( ScDocument
* pSourceDoc
, SCTAB nTab
);
1095 void SetCutMode( bool bCut
);
1097 void SetClipArea( const ScRange
& rArea
, bool bCut
= false );
1099 SC_DLLPUBLIC
bool IsDocVisible() const { return bIsVisible
; }
1100 void SetDocVisible( bool bSet
);
1102 bool HasOLEObjectsInArea( const ScRange
& rRange
, const ScMarkData
* pTabMark
= NULL
);
1104 void DeleteObjectsInArea( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1105 const ScMarkData
& rMark
);
1106 void DeleteObjectsInSelection( const ScMarkData
& rMark
);
1108 void DeleteArea(SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1109 const ScMarkData
& rMark
, sal_uInt16 nDelFlag
);
1110 SC_DLLPUBLIC
void DeleteAreaTab(SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1111 SCTAB nTab
, sal_uInt16 nDelFlag
);
1112 void DeleteAreaTab(const ScRange
& rRange
, sal_uInt16 nDelFlag
);
1114 void CopyToClip(const ScClipParam
& rClipParam
, ScDocument
* pClipDoc
,
1115 const ScMarkData
* pMarks
= NULL
, bool bAllTabs
= false, bool bKeepScenarioFlags
= false,
1116 bool bIncludeObjects
= false, bool bCloneNoteCaptions
= true, bool bUseRangeForVBA
= false );
1119 * Copy only raw cell values to another document. Formula cells are
1120 * converted to raw cells. No formatting info are copied.
1122 * @param rSrcRange source range in the source document
1123 * @param nDestTab table in the clip document to copy to.
1124 * @param pDestDoc document to copy to
1126 void CopyStaticToDocument(const ScRange
& rSrcRange
, SCTAB nDestTab
, ScDocument
* pDestDoc
);
1129 * Copy only cell, nothing but cell to another document.
1131 * @param rSrcPos source cell position
1132 * @param rDestPos destination cell position
1133 * @param rDestDoc destination document
1135 void CopyCellToDocument( const ScAddress
& rSrcPos
, const ScAddress
& rDestPos
, ScDocument
& rDestDoc
);
1137 void CopyTabToClip(SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1138 SCTAB nTab
, ScDocument
* pClipDoc
= NULL
);
1140 bool InitColumnBlockPosition( sc::ColumnBlockPosition
& rBlokPos
, SCTAB nTab
, SCCOL nCol
);
1142 void CopyBlockFromClip(
1143 sc::CopyFromClipContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1144 const ScMarkData
& rMark
, SCsCOL nDx
, SCsROW nDy
);
1145 void CopyNonFilteredFromClip(
1146 sc::CopyFromClipContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1147 const ScMarkData
& rMark
, SCsCOL nDx
, SCROW
& rClipStartRow
);
1149 void StartListeningFromClip( SCCOL nCol1
, SCROW nRow1
,
1150 SCCOL nCol2
, SCROW nRow2
,
1151 const ScMarkData
& rMark
, sal_uInt16 nInsFlag
);
1152 void BroadcastFromClip( SCCOL nCol1
, SCROW nRow1
,
1153 SCCOL nCol2
, SCROW nRow2
,
1154 const ScMarkData
& rMark
, sal_uInt16 nInsFlag
);
1155 /** If pDestRanges is given it overrides rDestRange, rDestRange in this
1156 case is the overall encompassing range. */
1157 void CopyFromClip( const ScRange
& rDestRange
, const ScMarkData
& rMark
,
1158 sal_uInt16 nInsFlag
,
1159 ScDocument
* pRefUndoDoc
= NULL
,
1160 ScDocument
* pClipDoc
= NULL
,
1161 bool bResetCut
= true,
1162 bool bAsLink
= false,
1163 bool bIncludeFiltered
= true,
1164 bool bSkipAttrForEmpty
= false,
1165 const ScRangeList
* pDestRanges
= NULL
);
1167 void CopyMultiRangeFromClip(const ScAddress
& rDestPos
, const ScMarkData
& rMark
,
1168 sal_uInt16 nInsFlag
, ScDocument
* pClipDoc
,
1169 bool bResetCut
= true, bool bAsLink
= false,
1170 bool bIncludeFiltered
= true,
1171 bool bSkipAttrForEmpty
= false);
1173 void GetClipArea(SCCOL
& nClipX
, SCROW
& nClipY
, bool bIncludeFiltered
);
1174 void GetClipStart(SCCOL
& nClipX
, SCROW
& nClipY
);
1176 bool HasClipFilteredRows();
1178 bool IsClipboardSource() const;
1180 SC_DLLPUBLIC
void TransposeClip( ScDocument
* pTransClip
, sal_uInt16 nFlags
, bool bAsLink
);
1182 ScClipParam
& GetClipParam();
1183 void SetClipParam(const ScClipParam
& rParam
);
1185 void MixDocument( const ScRange
& rRange
, sal_uInt16 nFunction
, bool bSkipEmpty
,
1186 ScDocument
* pSrcDoc
);
1188 void FillTab( const ScRange
& rSrcArea
, const ScMarkData
& rMark
,
1189 sal_uInt16 nFlags
, sal_uInt16 nFunction
,
1190 bool bSkipEmpty
, bool bAsLink
);
1191 void FillTabMarked( SCTAB nSrcTab
, const ScMarkData
& rMark
,
1192 sal_uInt16 nFlags
, sal_uInt16 nFunction
,
1193 bool bSkipEmpty
, bool bAsLink
);
1195 void TransliterateText( const ScMarkData
& rMultiMark
, sal_Int32 nType
);
1197 SC_DLLPUBLIC
void InitUndo( ScDocument
* pSrcDoc
, SCTAB nTab1
, SCTAB nTab2
,
1198 bool bColInfo
= false, bool bRowInfo
= false );
1199 void AddUndoTab( SCTAB nTab1
, SCTAB nTab2
,
1200 bool bColInfo
= false, bool bRowInfo
= false );
1201 SC_DLLPUBLIC
void InitUndoSelected( ScDocument
* pSrcDoc
, const ScMarkData
& rTabSelection
,
1202 bool bColInfo
= false, bool bRowInfo
= false );
1204 // don't use anymore:
1205 void CopyToDocument(SCCOL nCol1
, SCROW nRow1
, SCTAB nTab1
,
1206 SCCOL nCol2
, SCROW nRow2
, SCTAB nTab2
,
1207 sal_uInt16 nFlags
, bool bMarked
, ScDocument
* pDestDoc
,
1208 const ScMarkData
* pMarks
= NULL
, bool bColRowFlags
= true);
1209 void UndoToDocument(SCCOL nCol1
, SCROW nRow1
, SCTAB nTab1
,
1210 SCCOL nCol2
, SCROW nRow2
, SCTAB nTab2
,
1211 sal_uInt16 nFlags
, bool bMarked
, ScDocument
* pDestDoc
,
1212 const ScMarkData
* pMarks
= NULL
);
1214 void CopyToDocument(const ScRange
& rRange
,
1215 sal_uInt16 nFlags
, bool bMarked
, ScDocument
* pDestDoc
,
1216 const ScMarkData
* pMarks
= NULL
, bool bColRowFlags
= true);
1217 void UndoToDocument(const ScRange
& rRange
,
1218 sal_uInt16 nFlags
, bool bMarked
, ScDocument
* pDestDoc
,
1219 const ScMarkData
* pMarks
= NULL
);
1221 void CopyScenario( SCTAB nSrcTab
, SCTAB nDestTab
, bool bNewScenario
= false );
1222 bool TestCopyScenario( SCTAB nSrcTab
, SCTAB nDestTab
) const;
1223 void MarkScenario( SCTAB nSrcTab
, SCTAB nDestTab
,
1224 ScMarkData
& rDestMark
, bool bResetMark
= true,
1225 sal_uInt16 nNeededBits
= 0 ) const;
1226 bool HasScenarioRange( SCTAB nTab
, const ScRange
& rRange
) const;
1227 SC_DLLPUBLIC
const ScRangeList
* GetScenarioRanges( SCTAB nTab
) const;
1229 SC_DLLPUBLIC
void CopyUpdated( ScDocument
* pPosDoc
, ScDocument
* pDestDoc
);
1231 void UpdateReference( UpdateRefMode eUpdateRefMode
, SCCOL nCol1
, SCROW nRow1
, SCTAB nTab1
,
1232 SCCOL nCol2
, SCROW nRow2
, SCTAB nTab2
,
1233 SCsCOL nDx
, SCsROW nDy
, SCsTAB nDz
,
1234 ScDocument
* pUndoDoc
= NULL
, bool bIncludeDraw
= true,
1235 bool bUpdateNoteCaptionPos
= true );
1237 SC_DLLPUBLIC
void UpdateTranspose( const ScAddress
& rDestPos
, ScDocument
* pClipDoc
,
1238 const ScMarkData
& rMark
, ScDocument
* pUndoDoc
= NULL
);
1240 void UpdateGrow( const ScRange
& rArea
, SCCOL nGrowX
, SCROW nGrowY
);
1242 SC_DLLPUBLIC
void Fill( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1243 ScProgress
* pProgress
, const ScMarkData
& rMark
,
1244 sal_uLong nFillCount
, FillDir eFillDir
= FILL_TO_BOTTOM
,
1245 FillCmd eFillCmd
= FILL_LINEAR
, FillDateCmd eFillDateCmd
= FILL_DAY
,
1246 double nStepValue
= 1.0, double nMaxValue
= 1E307
);
1247 OUString
GetAutoFillPreview( const ScRange
& rSource
, SCCOL nEndX
, SCROW nEndY
);
1249 bool GetSelectionFunction( ScSubTotalFunc eFunc
,
1250 const ScAddress
& rCursor
, const ScMarkData
& rMark
,
1253 SC_DLLPUBLIC
const SfxPoolItem
* GetAttr( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, sal_uInt16 nWhich
) const;
1254 SC_DLLPUBLIC
const SfxPoolItem
* GetAttr( const ScAddress
& rPos
, sal_uInt16 nWhich
) const;
1255 SC_DLLPUBLIC
const ScPatternAttr
* GetPattern( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1256 SC_DLLPUBLIC
const ScPatternAttr
* GetPattern( const ScAddress
& rPos
) const;
1257 SC_DLLPUBLIC
const ScPatternAttr
* GetMostUsedPattern( SCCOL nCol
, SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1258 const ScPatternAttr
* GetSelectionPattern( const ScMarkData
& rMark
, bool bDeep
= true );
1259 ScPatternAttr
* CreateSelectionPattern( const ScMarkData
& rMark
, bool bDeep
= true );
1260 SC_DLLPUBLIC
void AddCondFormatData( const ScRangeList
& rRange
, SCTAB nTab
, sal_uInt32 nIndex
);
1261 void RemoveCondFormatData( const ScRangeList
& rRange
, SCTAB nTab
, sal_uInt32 nIndex
);
1263 SC_DLLPUBLIC ScConditionalFormat
* GetCondFormat( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1264 SC_DLLPUBLIC
const SfxItemSet
* GetCondResult( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1265 const SfxItemSet
* GetCondResult(
1266 ScRefCellValue
& rCell
, const ScAddress
& rPos
, const ScConditionalFormatList
& rList
,
1267 const std::vector
<sal_uInt32
>& rIndex
) const;
1268 const SfxPoolItem
* GetEffItem( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, sal_uInt16 nWhich
) const;
1270 SC_DLLPUBLIC
const ::com::sun::star::uno::Reference
< ::com::sun::star::i18n::XBreakIterator
>& GetBreakIterator();
1271 bool HasStringWeakCharacters( const OUString
& rString
);
1272 SC_DLLPUBLIC sal_uInt8
GetStringScriptType( const OUString
& rString
);
1273 SC_DLLPUBLIC sal_uInt8
GetCellScriptType( const ScAddress
& rPos
, sal_uLong nNumberFormat
);
1274 SC_DLLPUBLIC sal_uInt8
GetScriptType( SCCOL nCol
, SCROW nRow
, SCTAB nTab
);
1275 sal_uInt8
GetRangeScriptType(
1276 sc::ColumnBlockPosition
& rBlockPos
, const ScAddress
& rPos
, SCROW nLength
);
1277 sal_uInt8
GetRangeScriptType( const ScRangeList
& rRanges
);
1279 bool HasDetectiveOperations() const;
1280 void AddDetectiveOperation( const ScDetOpData
& rData
);
1281 void ClearDetectiveOperations();
1282 ScDetOpList
* GetDetOpList() const { return pDetOpList
; }
1283 void SetDetOpList(ScDetOpList
* pNew
);
1285 bool HasDetectiveObjects(SCTAB nTab
) const;
1287 void GetSelectionFrame( const ScMarkData
& rMark
,
1288 SvxBoxItem
& rLineOuter
,
1289 SvxBoxInfoItem
& rLineInner
);
1290 void ApplySelectionFrame( const ScMarkData
& rMark
,
1291 const SvxBoxItem
* pLineOuter
,
1292 const SvxBoxInfoItem
* pLineInner
);
1293 void ApplyFrameAreaTab( const ScRange
& rRange
,
1294 const SvxBoxItem
* pLineOuter
,
1295 const SvxBoxInfoItem
* pLineInner
);
1297 void ClearSelectionItems( const sal_uInt16
* pWhich
, const ScMarkData
& rMark
);
1298 void ChangeSelectionIndent( bool bIncrement
, const ScMarkData
& rMark
);
1300 SC_DLLPUBLIC sal_uLong
AddCondFormat( ScConditionalFormat
* pNew
, SCTAB nTab
);
1301 void DeleteConditionalFormat( sal_uLong nIndex
, SCTAB nTab
);
1302 void ConditionalChanged( sal_uLong nKey
, SCTAB nTab
);
1304 void SetCondFormList( ScConditionalFormatList
* pList
, SCTAB nTab
);
1306 SC_DLLPUBLIC sal_uLong
AddValidationEntry( const ScValidationData
& rNew
);
1308 SC_DLLPUBLIC
const ScValidationData
* GetValidationEntry( sal_uLong nIndex
) const;
1310 SC_DLLPUBLIC ScConditionalFormatList
* GetCondFormList( SCTAB nTab
) const;
1312 ScValidationDataList
* GetValidationList() const
1313 { return pValidationList
; }
1315 SC_DLLPUBLIC
void ApplyAttr( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1316 const SfxPoolItem
& rAttr
);
1317 SC_DLLPUBLIC
void ApplyPattern( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1318 const ScPatternAttr
& rAttr
);
1319 SC_DLLPUBLIC
void ApplyPatternArea( SCCOL nStartCol
, SCROW nStartRow
,
1320 SCCOL nEndCol
, SCROW nEndRow
,
1321 const ScMarkData
& rMark
, const ScPatternAttr
& rAttr
,
1322 ScEditDataArray
* pDataArray
= NULL
);
1323 SC_DLLPUBLIC
void ApplyPatternAreaTab( SCCOL nStartCol
, SCROW nStartRow
,
1324 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nTab
,
1325 const ScPatternAttr
& rAttr
);
1327 SC_DLLPUBLIC
bool SetAttrEntries(SCCOL nCol
, SCTAB nTab
, ScAttrEntry
* pData
, SCSIZE nSize
);
1329 SC_DLLPUBLIC
void ApplyPatternIfNumberformatIncompatible(
1330 const ScRange
& rRange
, const ScMarkData
& rMark
,
1331 const ScPatternAttr
& rPattern
, short nNewType
);
1333 void ApplyStyle( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1334 const ScStyleSheet
& rStyle
);
1335 void ApplyStyleArea( SCCOL nStartCol
, SCROW nStartRow
,
1336 SCCOL nEndCol
, SCROW nEndRow
,
1337 const ScMarkData
& rMark
, const ScStyleSheet
& rStyle
);
1338 SC_DLLPUBLIC
void ApplyStyleAreaTab( SCCOL nStartCol
, SCROW nStartRow
,
1339 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nTab
,
1340 const ScStyleSheet
& rStyle
);
1342 SC_DLLPUBLIC
void ApplySelectionStyle( const ScStyleSheet
& rStyle
, const ScMarkData
& rMark
);
1343 void ApplySelectionLineStyle( const ScMarkData
& rMark
,
1344 const ::editeng::SvxBorderLine
* pLine
, bool bColorOnly
);
1346 const ScStyleSheet
* GetStyle( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
1347 const ScStyleSheet
* GetSelectionStyle( const ScMarkData
& rMark
) const;
1349 void StyleSheetChanged( const SfxStyleSheetBase
* pStyleSheet
, bool bRemoved
,
1351 double nPPTX
, double nPPTY
,
1352 const Fraction
& rZoomX
, const Fraction
& rZoomY
);
1354 bool IsStyleSheetUsed( const ScStyleSheet
& rStyle
, bool bGatherAllStyles
) const;
1356 SC_DLLPUBLIC
bool ApplyFlagsTab( SCCOL nStartCol
, SCROW nStartRow
,
1357 SCCOL nEndCol
, SCROW nEndRow
,
1358 SCTAB nTab
, sal_Int16 nFlags
);
1359 SC_DLLPUBLIC
bool RemoveFlagsTab( SCCOL nStartCol
, SCROW nStartRow
,
1360 SCCOL nEndCol
, SCROW nEndRow
,
1361 SCTAB nTab
, sal_Int16 nFlags
);
1363 SC_DLLPUBLIC
void SetPattern( const ScAddress
&, const ScPatternAttr
& rAttr
,
1364 bool bPutToPool
= false );
1365 SC_DLLPUBLIC
void SetPattern( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, const ScPatternAttr
& rAttr
,
1366 bool bPutToPool
= false );
1368 void AutoFormat( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
1369 sal_uInt16 nFormatNo
, const ScMarkData
& rMark
);
1370 void GetAutoFormatData( SCTAB nTab
, SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
1371 ScAutoFormatData
& rData
);
1372 bool SearchAndReplace( const SvxSearchItem
& rSearchItem
,
1373 SCCOL
& rCol
, SCROW
& rRow
, SCTAB
& rTab
,
1374 const ScMarkData
& rMark
, ScRangeList
& rMatchedRanges
,
1375 OUString
& rUndoStr
, ScDocument
* pUndoDoc
= NULL
);
1377 // determine Col/Row of subsequent calls
1378 // (e.g. not found from the beginning, or subsequent tables)
1379 // meaning of explanation in "()" was already unclear in German
1380 static void GetSearchAndReplaceStart( const SvxSearchItem
& rSearchItem
,
1381 SCCOL
& rCol
, SCROW
& rRow
);
1383 bool Solver(SCCOL nFCol
, SCROW nFRow
, SCTAB nFTab
,
1384 SCCOL nVCol
, SCROW nVRow
, SCTAB nVTab
,
1385 const OUString
& sValStr
, double& nX
);
1387 SC_DLLPUBLIC
void ApplySelectionPattern( const ScPatternAttr
& rAttr
, const ScMarkData
& rMark
,
1388 ScEditDataArray
* pDataArray
= NULL
);
1389 void DeleteSelection( sal_uInt16 nDelFlag
, const ScMarkData
& rMark
);
1390 void DeleteSelectionTab( SCTAB nTab
, sal_uInt16 nDelFlag
, const ScMarkData
& rMark
);
1392 SC_DLLPUBLIC
void SetColWidth( SCCOL nCol
, SCTAB nTab
, sal_uInt16 nNewWidth
);
1393 SC_DLLPUBLIC
void SetColWidthOnly( SCCOL nCol
, SCTAB nTab
, sal_uInt16 nNewWidth
);
1394 SC_DLLPUBLIC
void SetRowHeight( SCROW nRow
, SCTAB nTab
, sal_uInt16 nNewHeight
);
1395 SC_DLLPUBLIC
void SetRowHeightRange( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
,
1396 sal_uInt16 nNewHeight
);
1398 SC_DLLPUBLIC
void SetRowHeightOnly( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
,
1399 sal_uInt16 nNewHeight
);
1400 SC_DLLPUBLIC
void SetManualHeight( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, bool bManual
);
1402 SC_DLLPUBLIC sal_uInt16
GetColWidth( SCCOL nCol
, SCTAB nTab
, bool bHiddenAsZero
= true ) const;
1403 SC_DLLPUBLIC sal_uInt16
GetRowHeight( SCROW nRow
, SCTAB nTab
, bool bHiddenAsZero
= true ) const;
1404 SC_DLLPUBLIC sal_uInt16
GetRowHeight( SCROW nRow
, SCTAB nTab
, SCROW
* pStartRow
, SCROW
* pEndRow
, bool bHiddenAsZero
= true ) const;
1405 SC_DLLPUBLIC sal_uLong
GetRowHeight( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, bool bHiddenAsZero
= true ) const;
1406 SCROW
GetRowForHeight( SCTAB nTab
, sal_uLong nHeight
) const;
1407 sal_uLong
GetScaledRowHeight( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, double fScale
) const;
1408 SC_DLLPUBLIC sal_uLong
GetColOffset( SCCOL nCol
, SCTAB nTab
, bool bHiddenAsZero
= true ) const;
1409 SC_DLLPUBLIC sal_uLong
GetRowOffset( SCROW nRow
, SCTAB nTab
, bool bHiddenAsZero
= true ) const;
1411 SC_DLLPUBLIC sal_uInt16
GetOriginalWidth( SCCOL nCol
, SCTAB nTab
) const;
1412 SC_DLLPUBLIC sal_uInt16
GetOriginalHeight( SCROW nRow
, SCTAB nTab
) const;
1414 sal_uInt16
GetCommonWidth( SCCOL nEndCol
, SCTAB nTab
) const;
1416 SCROW
GetHiddenRowCount( SCROW nRow
, SCTAB nTab
) const;
1418 sal_uInt16
GetOptimalColWidth( SCCOL nCol
, SCTAB nTab
, OutputDevice
* pDev
,
1419 double nPPTX
, double nPPTY
,
1420 const Fraction
& rZoomX
, const Fraction
& rZoomY
,
1422 const ScMarkData
* pMarkData
= NULL
,
1423 const ScColWidthParam
* pParam
= NULL
);
1424 SC_DLLPUBLIC
bool SetOptimalHeight( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, sal_uInt16 nExtra
,
1426 double nPPTX
, double nPPTY
,
1427 const Fraction
& rZoomX
, const Fraction
& rZoomY
,
1429 void UpdateAllRowHeights( OutputDevice
* pDev
,
1430 double nPPTX
, double nPPTY
,
1431 const Fraction
& rZoomX
, const Fraction
& rZoomY
,
1432 const ScMarkData
* pTabMark
= NULL
);
1433 long GetNeededSize( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1435 double nPPTX
, double nPPTY
,
1436 const Fraction
& rZoomX
, const Fraction
& rZoomY
,
1437 bool bWidth
, bool bTotalSize
= false );
1439 SC_DLLPUBLIC
void ShowCol(SCCOL nCol
, SCTAB nTab
, bool bShow
);
1440 SC_DLLPUBLIC
void ShowRow(SCROW nRow
, SCTAB nTab
, bool bShow
);
1441 SC_DLLPUBLIC
void ShowRows(SCROW nRow1
, SCROW nRow2
, SCTAB nTab
, bool bShow
);
1442 SC_DLLPUBLIC
void SetRowFlags( SCROW nRow
, SCTAB nTab
, sal_uInt8 nNewFlags
);
1443 SC_DLLPUBLIC
void SetRowFlags( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, sal_uInt8 nNewFlags
);
1445 SC_DLLPUBLIC sal_uInt8
GetColFlags( SCCOL nCol
, SCTAB nTab
) const;
1446 SC_DLLPUBLIC sal_uInt8
GetRowFlags( SCROW nRow
, SCTAB nTab
) const;
1448 SC_DLLPUBLIC
const ScBitMaskCompressedArray
< SCROW
, sal_uInt8
> & GetRowFlagsArray( SCTAB nTab
) const;
1450 SC_DLLPUBLIC
void GetAllRowBreaks(::std::set
<SCROW
>& rBreaks
, SCTAB nTab
, bool bPage
, bool bManual
) const;
1451 SC_DLLPUBLIC
void GetAllColBreaks(::std::set
<SCCOL
>& rBreaks
, SCTAB nTab
, bool bPage
, bool bManual
) const;
1452 SC_DLLPUBLIC ScBreakType
HasRowBreak(SCROW nRow
, SCTAB nTab
) const;
1453 SC_DLLPUBLIC ScBreakType
HasColBreak(SCCOL nCol
, SCTAB nTab
) const;
1454 SC_DLLPUBLIC
void SetRowBreak(SCROW nRow
, SCTAB nTab
, bool bPage
, bool bManual
);
1455 SC_DLLPUBLIC
void SetColBreak(SCCOL nCol
, SCTAB nTab
, bool bPage
, bool bManual
);
1456 void RemoveRowBreak(SCROW nRow
, SCTAB nTab
, bool bPage
, bool bManual
);
1457 void RemoveColBreak(SCCOL nCol
, SCTAB nTab
, bool bPage
, bool bManual
);
1458 ::com::sun::star::uno::Sequence
<
1459 ::com::sun::star::sheet::TablePageBreakData
> GetRowBreakData(SCTAB nTab
) const;
1461 SC_DLLPUBLIC
bool RowHidden(SCROW nRow
, SCTAB nTab
, SCROW
* pFirstRow
= NULL
, SCROW
* pLastRow
= NULL
) const;
1462 SC_DLLPUBLIC
bool HasHiddenRows(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1463 SC_DLLPUBLIC
bool ColHidden(SCCOL nCol
, SCTAB nTab
, SCCOL
* pFirstCol
= NULL
, SCCOL
* pLastCol
= NULL
) const;
1464 SC_DLLPUBLIC
void SetRowHidden(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, bool bHidden
);
1465 SC_DLLPUBLIC
void SetColHidden(SCCOL nStartCol
, SCCOL nEndCol
, SCTAB nTab
, bool bHidden
);
1466 SC_DLLPUBLIC SCROW
FirstVisibleRow(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1467 SC_DLLPUBLIC SCROW
LastVisibleRow(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1468 SCROW
CountVisibleRows(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1470 bool RowFiltered(SCROW nRow
, SCTAB nTab
, SCROW
* pFirstRow
= NULL
, SCROW
* pLastRow
= NULL
) const;
1471 bool HasFilteredRows(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1472 bool ColFiltered(SCCOL nCol
, SCTAB nTab
, SCCOL
* pFirstCol
= NULL
, SCCOL
* pLastCol
= NULL
) const;
1473 SC_DLLPUBLIC
void SetRowFiltered(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, bool bFiltered
);
1474 SCROW
FirstNonFilteredRow(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1475 SCROW
LastNonFilteredRow(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1476 SCROW
CountNonFilteredRows(SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
) const;
1478 SC_DLLPUBLIC
bool IsManualRowHeight(SCROW nRow
, SCTAB nTab
) const;
1481 * Write all column row flags to table's flag data, because not all column
1482 * row attributes are stored in the flag data members. This is necessary
1485 void SyncColRowFlags();
1487 /// @return the index of the last row with any set flags (auto-pagebreak is ignored).
1488 SC_DLLPUBLIC SCROW
GetLastFlaggedRow( SCTAB nTab
) const;
1490 /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored).
1491 SCCOL
GetLastChangedCol( SCTAB nTab
) const;
1492 /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
1493 SCROW
GetLastChangedRow( SCTAB nTab
) const;
1495 SCCOL
GetNextDifferentChangedCol( SCTAB nTab
, SCCOL nStart
) const;
1497 // if bCareManualSize is set then the row
1498 // heights are compared only if the manual size flag for
1499 // the row is set. If the bCareManualSize is not set then
1500 // the row heights are always compared.
1501 SCROW
GetNextDifferentChangedRow( SCTAB nTab
, SCROW nStart
, bool bCareManualSize
= true) const;
1503 // returns whether to export a Default style for this col/row or not
1504 // nDefault is setted to one possition in the current row/col where the Default style is
1505 bool GetColDefault( SCTAB nTab
, SCCOL nCol
, SCROW nLastRow
, SCROW
& nDefault
);
1506 bool GetRowDefault( SCTAB nTab
, SCROW nRow
, SCCOL nLastCol
, SCCOL
& nDefault
);
1508 bool UpdateOutlineCol( SCCOL nStartCol
, SCCOL nEndCol
, SCTAB nTab
, bool bShow
);
1509 bool UpdateOutlineRow( SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, bool bShow
);
1511 void StripHidden( SCCOL
& rX1
, SCROW
& rY1
, SCCOL
& rX2
, SCROW
& rY2
, SCTAB nTab
);
1512 void ExtendHidden( SCCOL
& rX1
, SCROW
& rY1
, SCCOL
& rX2
, SCROW
& rY2
, SCTAB nTab
);
1514 SC_DLLPUBLIC ScPatternAttr
* GetDefPattern() const;
1515 SC_DLLPUBLIC ScDocumentPool
* GetPool();
1516 SC_DLLPUBLIC ScStyleSheetPool
* GetStyleSheetPool() const;
1519 SC_DLLPUBLIC
const OUString
GetPageStyle( SCTAB nTab
) const;
1520 SC_DLLPUBLIC
void SetPageStyle( SCTAB nTab
, const OUString
& rName
);
1521 Size
GetPageSize( SCTAB nTab
) const;
1522 void SetPageSize( SCTAB nTab
, const Size
& rSize
);
1523 void SetRepeatArea( SCTAB nTab
, SCCOL nStartCol
, SCCOL nEndCol
, SCROW nStartRow
, SCROW nEndRow
);
1524 void InvalidatePageBreaks(SCTAB nTab
);
1525 void UpdatePageBreaks( SCTAB nTab
, const ScRange
* pUserArea
= NULL
);
1526 void RemoveManualBreaks( SCTAB nTab
);
1527 bool HasManualBreaks( SCTAB nTab
) const;
1529 bool IsPageStyleInUse( const OUString
& rStrPageStyle
, SCTAB
* pInTab
= NULL
);
1530 bool RemovePageStyleInUse( const OUString
& rStrPageStyle
);
1531 bool RenamePageStyleInUse( const OUString
& rOld
, const OUString
& rNew
);
1532 void ModifyStyleSheet( SfxStyleSheetBase
& rPageStyle
,
1533 const SfxItemSet
& rChanges
);
1535 void PageStyleModified( SCTAB nTab
, const OUString
& rNewName
);
1537 SC_DLLPUBLIC
bool NeedPageResetAfterTab( SCTAB nTab
) const;
1539 // Was stored in PageStyle previously. Now it exists for every table:
1540 SC_DLLPUBLIC
bool HasPrintRange();
1541 SC_DLLPUBLIC sal_uInt16
GetPrintRangeCount( SCTAB nTab
);
1542 SC_DLLPUBLIC
const ScRange
* GetPrintRange( SCTAB nTab
, sal_uInt16 nPos
);
1543 SC_DLLPUBLIC
const ScRange
* GetRepeatColRange( SCTAB nTab
);
1544 SC_DLLPUBLIC
const ScRange
* GetRepeatRowRange( SCTAB nTab
);
1545 /** Returns true, if the specified sheet is always printed. */
1546 bool IsPrintEntireSheet( SCTAB nTab
) const;
1548 /** Removes all print ranges. */
1549 SC_DLLPUBLIC
void ClearPrintRanges( SCTAB nTab
);
1550 /** Adds a new print ranges. */
1551 SC_DLLPUBLIC
void AddPrintRange( SCTAB nTab
, const ScRange
& rNew
);
1552 /** Marks the specified sheet to be printed completely. Deletes old print ranges on the sheet! */
1553 SC_DLLPUBLIC
void SetPrintEntireSheet( SCTAB nTab
);
1554 SC_DLLPUBLIC
void SetRepeatColRange( SCTAB nTab
, const ScRange
* pNew
);
1555 SC_DLLPUBLIC
void SetRepeatRowRange( SCTAB nTab
, const ScRange
* pNew
);
1556 ScPrintRangeSaver
* CreatePrintRangeSaver() const;
1557 void RestorePrintRanges( const ScPrintRangeSaver
& rSaver
);
1559 SC_DLLPUBLIC Rectangle
GetMMRect( SCCOL nStartCol
, SCROW nStartRow
,
1560 SCCOL nEndCol
, SCROW nEndRow
, SCTAB nTab
, bool bHiddenAsZero
= true ) const;
1561 SC_DLLPUBLIC ScRange
GetRange( SCTAB nTab
, const Rectangle
& rMMRect
, bool bHiddenAsZero
= true ) const;
1563 void UpdStlShtPtrsFrmNms();
1564 void StylesToNames();
1566 SC_DLLPUBLIC
void CopyStdStylesFrom( ScDocument
* pSrcDoc
);
1568 CharSet
GetSrcCharSet() const { return eSrcSet
; }
1569 sal_uLong
GetSrcVersion() const { return nSrcVer
; }
1570 SCROW
GetSrcMaxRow() const { return nSrcMaxRow
; }
1572 void SetSrcCharSet( CharSet eNew
) { eSrcSet
= eNew
; }
1573 void UpdateFontCharSet();
1575 void FillInfo( ScTableInfo
& rTabInfo
, SCCOL nX1
, SCROW nY1
, SCCOL nX2
, SCROW nY2
,
1576 SCTAB nTab
, double nScaleX
, double nScaleY
,
1577 bool bPageMode
, bool bFormulaMode
,
1578 const ScMarkData
* pMarkData
= NULL
);
1580 SC_DLLPUBLIC SvNumberFormatter
* GetFormatTable() const;
1582 void Sort( SCTAB nTab
, const ScSortParam
& rSortParam
, bool bKeepQuery
, ScProgress
* pProgress
);
1583 SCSIZE
Query( SCTAB nTab
, const ScQueryParam
& rQueryParam
, bool bKeepSub
);
1584 SC_DLLPUBLIC
bool CreateQueryParam( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1585 SCTAB nTab
, ScQueryParam
& rQueryParam
);
1586 void GetUpperCellString(SCCOL nCol
, SCROW nRow
, SCTAB nTab
, OUString
& rStr
);
1589 * Get a list of unique strings to use in filtering criteria. The string
1590 * values are sorted, and there are no duplicate values in the list. The
1591 * data range to use to populate the filter entries is inferred from the
1592 * database range that contains the specified cell position.
1594 bool GetFilterEntries(
1595 SCCOL nCol
, SCROW nRow
, SCTAB nTab
, bool bFilter
, std::vector
<ScTypedStrData
>& rStrings
, bool& rHasDates
);
1597 SC_DLLPUBLIC
bool GetFilterEntriesArea(
1598 SCCOL nCol
, SCROW nStartRow
, SCROW nEndRow
, SCTAB nTab
, bool bCaseSens
,
1599 std::vector
<ScTypedStrData
>& rStrings
, bool& rHasDates
);
1601 bool GetDataEntries(
1602 SCCOL nCol
, SCROW nRow
, SCTAB nTab
, bool bCaseSens
,
1603 std::vector
<ScTypedStrData
>& rStrings
, bool bLimit
= false );
1604 bool GetFormulaEntries( ScTypedCaseStrSet
& rStrings
);
1606 bool HasAutoFilter( SCCOL nCol
, SCROW nRow
, SCTAB nTab
);
1608 SC_DLLPUBLIC
bool HasColHeader( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
1610 SC_DLLPUBLIC
bool HasRowHeader( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
1613 SfxPrinter
* GetPrinter( bool bCreateIfNotExist
= true );
1614 void SetPrinter( SfxPrinter
* pNewPrinter
);
1615 VirtualDevice
* GetVirtualDevice_100th_mm();
1616 SC_DLLPUBLIC OutputDevice
* GetRefDevice(); // WYSIWYG: Printer, otherwise VirtualDevice...
1618 bool GetNextSpellingCell(SCCOL
& nCol
, SCROW
& nRow
, SCTAB nTab
,
1619 bool bInSel
, const ScMarkData
& rMark
) const;
1621 bool ReplaceStyle(const SvxSearchItem
& rSearchItem
,
1622 SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
1623 ScMarkData
& rMark
, bool bIsUndo
);
1625 void DoColResize( SCTAB nTab
, SCCOL nCol1
, SCCOL nCol2
, SCSIZE nAdd
);
1627 void InvalidateTextWidth( const OUString
& rStyleName
);
1628 void InvalidateTextWidth( SCTAB nTab
);
1629 void InvalidateTextWidth( const ScAddress
* pAdrFrom
, const ScAddress
* pAdrTo
, bool bNumFormatChanged
);
1631 bool IdleCalcTextWidth();
1632 bool IdleCheckLinks();
1634 bool ContinueOnlineSpelling(); // TRUE = found s.th.
1636 void RepaintRange( const ScRange
& rRange
);
1637 void RepaintRange( const ScRangeList
& rRange
);
1639 bool IsIdleEnabled() const { return mbIdleEnabled
; }
1640 void EnableIdle(bool bDo
) { mbIdleEnabled
= bDo
; }
1642 bool IsDetectiveDirty() const { return bDetectiveDirty
; }
1643 void SetDetectiveDirty(bool bSet
) { bDetectiveDirty
= bSet
; }
1645 void RemoveAutoSpellObj();
1646 void SetOnlineSpellPos( const ScAddress
& rPos
);
1647 SC_DLLPUBLIC
bool SetVisibleSpellRange( const ScRange
& rRange
); // true = changed
1649 sal_uInt8
GetMacroCallMode() const { return nMacroCallMode
; }
1650 void SetMacroCallMode(sal_uInt8 nNew
) { nMacroCallMode
= nNew
; }
1652 bool GetHasMacroFunc() const { return bHasMacroFunc
; }
1653 void SetHasMacroFunc(bool bSet
) { bHasMacroFunc
= bSet
; }
1655 bool CheckMacroWarn();
1657 void SetRangeOverflowType(sal_uInt32 nType
) { nRangeOverflowType
= nType
; }
1658 bool HasRangeOverflow() const { return nRangeOverflowType
!= 0; }
1659 SC_DLLPUBLIC sal_uInt32
GetRangeOverflowType() const { return nRangeOverflowType
; }
1661 // for broadcasting/listening
1662 void SetInsertingFromOtherDoc( bool bVal
) { bInsertingFromOtherDoc
= bVal
; }
1663 bool IsInsertingFromOtherDoc() const { return bInsertingFromOtherDoc
; }
1664 void SetLoadingMedium( bool bVal
);
1665 void SetImportingXML( bool bVal
);
1666 bool IsImportingXML() const { return bImportingXML
; }
1667 void SetXMLFromWrapper( bool bVal
);
1668 bool IsXMLFromWrapper() const { return bXMLFromWrapper
; }
1669 void SetCalcingAfterLoad( bool bVal
) { bCalcingAfterLoad
= bVal
; }
1670 bool IsCalcingAfterLoad() const { return bCalcingAfterLoad
; }
1671 void SetNoListening( bool bVal
) { bNoListening
= bVal
; }
1672 bool GetNoListening() const { return bNoListening
; }
1673 ScBroadcastAreaSlotMachine
* GetBASM() const { return pBASM
; }
1675 SC_DLLPUBLIC ScChartListenerCollection
* GetChartListenerCollection() const;
1676 void SetChartListenerCollection( ScChartListenerCollection
*,
1677 bool bSetChartRangeLists
= false );
1678 void UpdateChart( const OUString
& rName
);
1679 void RestoreChartListener( const OUString
& rName
);
1680 SC_DLLPUBLIC
void UpdateChartListenerCollection();
1681 bool IsChartListenerCollectionNeedsUpdate() const
1682 { return bChartListenerCollectionNeedsUpdate
; }
1683 void SetChartListenerCollectionNeedsUpdate( bool bFlg
)
1684 { bChartListenerCollectionNeedsUpdate
= bFlg
; }
1685 void AddOLEObjectToCollection(const OUString
& rName
);
1687 ScChangeViewSettings
* GetChangeViewSettings() const { return pChangeViewSettings
; }
1688 SC_DLLPUBLIC
void SetChangeViewSettings(const ScChangeViewSettings
& rNew
);
1690 rtl::Reference
<SvxForbiddenCharactersTable
> GetForbiddenCharacters();
1691 void SetForbiddenCharacters( const rtl::Reference
<SvxForbiddenCharactersTable
> xNew
);
1693 sal_uInt8
GetAsianCompression() const; // CharacterCompressionType values
1694 bool IsValidAsianCompression() const;
1695 void SetAsianCompression(sal_uInt8 nNew
);
1697 bool GetAsianKerning() const;
1698 bool IsValidAsianKerning() const;
1699 void SetAsianKerning(bool bNew
);
1700 void ApplyAsianEditSettings(ScEditEngineDefaulter
& rEngine
);
1702 sal_uInt8
GetEditTextDirection(SCTAB nTab
) const; // EEHorizontalTextDirection values
1704 SC_DLLPUBLIC ScLkUpdMode
GetLinkMode() const { return eLinkMode
;}
1705 void SetLinkMode( ScLkUpdMode nSet
) { eLinkMode
= nSet
;}
1707 SC_DLLPUBLIC ScMacroManager
* GetMacroManager();
1710 ScDocument(const ScDocument
& r
); // disabled with no definition
1712 void FindMaxRotCol( SCTAB nTab
, RowInfo
* pRowInfo
, SCSIZE nArrCount
,
1713 SCCOL nX1
, SCCOL nX2
) const;
1715 sal_uInt16
RowDifferences( SCROW nThisRow
, SCTAB nThisTab
,
1716 ScDocument
& rOtherDoc
,
1717 SCROW nOtherRow
, SCTAB nOtherTab
,
1718 SCCOL nMaxCol
, SCCOLROW
* pOtherCols
);
1719 sal_uInt16
ColDifferences( SCCOL nThisCol
, SCTAB nThisTab
,
1720 ScDocument
& rOtherDoc
,
1721 SCCOL nOtherCol
, SCTAB nOtherTab
,
1722 SCROW nMaxRow
, SCCOLROW
* pOtherRows
);
1723 void FindOrder( SCCOLROW
* pOtherRows
, SCCOLROW nThisEndRow
, SCCOLROW nOtherEndRow
,
1725 ScDocument
& rOtherDoc
, SCTAB nThisTab
, SCTAB nOtherTab
,
1726 SCCOLROW nEndCol
, SCCOLROW
* pTranslate
,
1727 ScProgress
* pProgress
, sal_uLong nProAdd
);
1728 bool OnlineSpellInRange( const ScRange
& rSpellRange
, ScAddress
& rSpellPos
,
1729 sal_uInt16 nMaxTest
);
1731 DECL_LINK(TrackTimeHdl
, void *);
1733 static ScRecursionHelper
* CreateRecursionHelperInstance();
1736 void StartListeningArea( const ScRange
& rRange
,
1737 SvtListener
* pListener
);
1738 void EndListeningArea( const ScRange
& rRange
,
1739 SvtListener
* pListener
);
1740 /** Broadcast wrapper, calls
1741 rHint.GetCell()->Broadcast() and AreaBroadcast()
1742 and TrackFormulas() and conditional format list
1746 void Broadcast( const ScHint
& rHint
);
1747 /// only area, no cell broadcast
1748 void AreaBroadcast( const ScHint
& rHint
);
1749 /// only areas in range, no cell broadcasts
1750 void AreaBroadcastInRange( const ScRange
& rRange
,
1751 const ScHint
& rHint
);
1752 void DelBroadcastAreasInRange( const ScRange
& rRange
);
1753 void UpdateBroadcastAreas( UpdateRefMode eUpdateRefMode
,
1754 const ScRange
& rRange
,
1755 SCsCOL nDx
, SCsROW nDy
, SCsTAB nDz
);
1758 void StartListeningCell( const ScAddress
& rAddress
,
1759 SvtListener
* pListener
);
1760 void EndListeningCell( const ScAddress
& rAddress
,
1761 SvtListener
* pListener
);
1763 void StartListeningCell( sc::StartListeningContext
& rCxt
, const ScAddress
& rPos
, SvtListener
& rListener
);
1764 void EndListeningCell( sc::EndListeningContext
& rCxt
, const ScAddress
& rPos
, SvtListener
& rListener
);
1766 void EndListeningFormulaCells( std::vector
<ScFormulaCell
*>& rCells
);
1768 void PutInFormulaTree( ScFormulaCell
* pCell
);
1769 void RemoveFromFormulaTree( ScFormulaCell
* pCell
);
1772 * Calculate formula cells that are on the formula tree either partially,
1775 * @param bOnlyForced when true, it only calculates those formula cells
1776 * that are marked "recalc forced".
1777 * @param bProgressBar whether or not to use progress bar.
1778 * @param bSetAllDirty when true, it marks all formula cells currently on
1779 * the formula tree dirty, which forces all of them to
1780 * be recalculated. When false, only those cells
1781 * that are marked dirty prior to this call get
1784 SC_DLLPUBLIC
void CalcFormulaTree(
1785 bool bOnlyForced
= false, bool bProgressBar
= true, bool bSetAllDirty
= true );
1786 void ClearFormulaTree();
1787 void RebuildFormulaGroups();
1788 void AppendToFormulaTrack( ScFormulaCell
* pCell
);
1789 void RemoveFromFormulaTrack( ScFormulaCell
* pCell
);
1790 void TrackFormulas( sal_uLong nHintId
= SC_HINT_DATACHANGED
);
1791 sal_uInt16
GetFormulaTrackCount() const { return nFormulaTrackCount
; }
1792 bool IsInFormulaTree( ScFormulaCell
* pCell
) const;
1793 bool IsInFormulaTrack( ScFormulaCell
* pCell
) const;
1794 bool GetHardRecalcState() { return bHardRecalcState
; }
1795 void SetHardRecalcState( bool bVal
) { bHardRecalcState
= bVal
; }
1796 void StartAllListeners();
1797 const ScFormulaCell
* GetFormulaTree() const { return pFormulaTree
; }
1798 bool HasForcedFormulas() const { return bHasForcedFormulas
; }
1799 void SetForcedFormulas( bool bVal
) { bHasForcedFormulas
= bVal
; }
1800 sal_uLong
GetFormulaCodeInTree() const { return nFormulaCodeInTree
; }
1801 bool IsInInterpreter() const { return nInterpretLevel
!= 0; }
1802 sal_uInt16
GetInterpretLevel() { return nInterpretLevel
; }
1803 void IncInterpretLevel()
1805 if ( nInterpretLevel
< USHRT_MAX
)
1808 void DecInterpretLevel()
1810 if ( nInterpretLevel
)
1813 bool IsInMacroInterpreter() const { return nMacroInterpretLevel
!= 0; }
1814 sal_uInt16
GetMacroInterpretLevel() { return nMacroInterpretLevel
; }
1815 void IncMacroInterpretLevel()
1817 if ( nMacroInterpretLevel
< USHRT_MAX
)
1818 nMacroInterpretLevel
++;
1820 void DecMacroInterpretLevel()
1822 if ( nMacroInterpretLevel
)
1823 nMacroInterpretLevel
--;
1825 bool IsInInterpreterTableOp() const { return nInterpreterTableOpLevel
!= 0; }
1826 sal_uInt16
GetInterpreterTableOpLevel() { return nInterpreterTableOpLevel
; }
1827 void IncInterpreterTableOpLevel()
1829 if ( nInterpreterTableOpLevel
< USHRT_MAX
)
1830 nInterpreterTableOpLevel
++;
1832 void DecInterpreterTableOpLevel()
1834 if ( nInterpreterTableOpLevel
)
1835 nInterpreterTableOpLevel
--;
1837 // add a formula to be remembered for TableOp broadcasts
1838 void AddTableOpFormulaCell( ScFormulaCell
* );
1839 void InvalidateLastTableOpParams() { aLastTableOpParams
.bValid
= false; }
1840 ScRecursionHelper
& GetRecursionHelper()
1842 if (!pRecursionHelper
)
1843 pRecursionHelper
= CreateRecursionHelperInstance();
1844 return *pRecursionHelper
;
1846 bool IsInDtorClear() const { return bInDtorClear
; }
1847 void SetExpandRefs( bool bVal
) { bExpandRefs
= bVal
; }
1848 bool IsExpandRefs() { return bExpandRefs
; }
1850 sal_uLong
GetXMLImportedFormulaCount() const { return nXMLImportedFormulaCount
; }
1851 void IncXMLImportedFormulaCount( sal_uLong nVal
)
1853 if ( nXMLImportedFormulaCount
+ nVal
> nXMLImportedFormulaCount
)
1854 nXMLImportedFormulaCount
+= nVal
;
1856 void DecXMLImportedFormulaCount( sal_uLong nVal
)
1858 if ( nVal
<= nXMLImportedFormulaCount
)
1859 nXMLImportedFormulaCount
-= nVal
;
1861 nXMLImportedFormulaCount
= 0;
1864 void StartTrackTimer();
1866 void CompileDBFormula();
1867 void CompileDBFormula( bool bCreateFormulaString
);
1868 void CompileNameFormula( bool bCreateFormulaString
);
1869 void CompileColRowNameFormula();
1871 /** Maximum string length of a column, e.g. for dBase export.
1872 @return String length in octets (!) of the destination encoding. In
1873 case of non-octet encodings (e.g. UCS2) the length in code
1874 points times sizeof(sal_Unicode) is returned. */
1875 sal_Int32
GetMaxStringLen( SCTAB nTab
, SCCOL nCol
,
1876 SCROW nRowStart
, SCROW nRowEnd
,
1877 CharSet eCharSet
) const;
1878 /** Maximum string length of numerical cells of a column, e.g. for dBase export.
1879 @return String length in characters (!) including the decimal
1880 separator, and the decimal precision needed. */
1881 xub_StrLen
GetMaxNumberStringLen( sal_uInt16
& nPrecision
,
1882 SCTAB nTab
, SCCOL nCol
,
1883 SCROW nRowStart
, SCROW nRowEnd
) const;
1885 void KeyInput( const KeyEvent
& rKEvt
); // TimerDelays etc.
1887 ScChangeTrack
* GetChangeTrack() const { return pChangeTrack
; }
1889 //! only for import filter, deletes any existing ChangeTrack via
1890 //! EndChangeTracking() and takes ownership of new ChangeTrack pTrack
1891 SC_DLLPUBLIC
void SetChangeTrack( ScChangeTrack
* pTrack
);
1893 void StartChangeTracking();
1894 void EndChangeTracking();
1896 SC_DLLPUBLIC
void CompareDocument( ScDocument
& rOtherDoc
);
1898 void AddUnoObject( SfxListener
& rObject
);
1899 void RemoveUnoObject( SfxListener
& rObject
);
1900 void BroadcastUno( const SfxHint
&rHint
);
1901 void AddUnoListenerCall( const ::com::sun::star::uno::Reference
<
1902 ::com::sun::star::util::XModifyListener
>& rListener
,
1903 const ::com::sun::star::lang::EventObject
& rEvent
);
1905 void SetInLinkUpdate(bool bSet
); // TableLink or AreaLink
1906 bool IsInLinkUpdate() const; // including DdeLink
1908 SC_DLLPUBLIC SfxItemPool
* GetEditPool() const;
1909 SC_DLLPUBLIC SfxItemPool
* GetEnginePool() const;
1910 SC_DLLPUBLIC ScFieldEditEngine
& GetEditEngine();
1911 SC_DLLPUBLIC ScNoteEditEngine
& GetNoteEngine();
1913 ScRefreshTimerControl
* GetRefreshTimerControl() const
1914 { return pRefreshTimerControl
; }
1915 ScRefreshTimerControl
* const * GetRefreshTimerControlAddress() const
1916 { return &pRefreshTimerControl
; }
1918 void SetPastingDrawFromOtherDoc( bool bVal
)
1919 { bPastingDrawFromOtherDoc
= bVal
; }
1920 bool PastingDrawFromOtherDoc() const
1921 { return bPastingDrawFromOtherDoc
; }
1923 /// an ID unique to each document instance
1924 sal_uInt32
GetDocumentID() const;
1926 void InvalidateStyleSheetUsage()
1927 { bStyleSheetUsageInvalid
= true; }
1928 void GetSortParam( ScSortParam
& rParam
, SCTAB nTab
);
1929 void SetSortParam( ScSortParam
& rParam
, SCTAB nTab
);
1931 inline void SetVbaEventProcessor( const com::sun::star::uno::Reference
< com::sun::star::script::vba::XVBAEventProcessor
>& rxVbaEvents
)
1932 { mxVbaEvents
= rxVbaEvents
; }
1933 inline com::sun::star::uno::Reference
< com::sun::star::script::vba::XVBAEventProcessor
>
1934 GetVbaEventProcessor() const { return mxVbaEvents
; }
1936 /** Should only be GRAM_PODF or GRAM_ODFF. */
1937 void SetStorageGrammar( formula::FormulaGrammar::Grammar eGrammar
);
1938 formula::FormulaGrammar::Grammar
GetStorageGrammar() const
1939 { return eStorageGrammar
; }
1941 SfxUndoManager
* GetUndoManager();
1942 bool IsInVBAMode() const;
1943 ScRowBreakIterator
* GetRowBreakIterator(SCTAB nTab
) const;
1945 void AddSubTotalCell(ScFormulaCell
* pCell
);
1946 void RemoveSubTotalCell(ScFormulaCell
* pCell
);
1947 void SetSubTotalCellsDirty(const ScRange
& rDirtyRange
);
1949 sal_uInt16
GetTextWidth( const ScAddress
& rPos
) const;
1950 void SetTextWidth( const ScAddress
& rPos
, sal_uInt16 nWidth
);
1952 sal_uInt8
GetScriptType( const ScAddress
& rPos
) const;
1953 void SetScriptType( const ScAddress
& rPos
, sal_uInt8 nType
);
1955 size_t GetFormulaHash( const ScAddress
& rPos
) const;
1957 ScFormulaVectorState
GetFormulaVectorState( const ScAddress
& rPos
) const;
1959 formula::FormulaTokenRef
ResolveStaticReference( const ScAddress
& rPos
);
1960 formula::FormulaTokenRef
ResolveStaticReference( const ScRange
& rRange
);
1962 const double* FetchDoubleArray(
1963 sc::FormulaGroupContext
& rCxt
, const ScAddress
& rPos
, SCROW nLength
) const;
1965 SvtBroadcaster
* GetBroadcaster( const ScAddress
& rPos
);
1966 const SvtBroadcaster
* GetBroadcaster( const ScAddress
& rPos
) const;
1967 void DeleteBroadcasters( sc::ColumnBlockPosition
& rBlockPos
, const ScAddress
& rTopPos
, SCROW nLength
);
1970 * See if specified column has any broadcaster at all.
1972 bool HasBroadcaster( SCTAB nTab
, SCCOL nCol
) const;
1974 private: // CLOOK-Impl-methods
1977 * Use this class as a locale variable to merge number formatter from
1978 * another document, and set NULL pointer to pFormatExchangeList when
1981 class NumFmtMergeHandler
1984 explicit NumFmtMergeHandler(ScDocument
* pDoc
, ScDocument
* pSrcDoc
);
1985 ~NumFmtMergeHandler();
1991 bool TableExists( SCTAB nTab
) const;
1992 ScTable
* FetchTable( SCTAB nTab
);
1993 const ScTable
* FetchTable( SCTAB nTab
) const;
1995 void MergeNumberFormatter(ScDocument
* pSrcDoc
);
1997 void ImplCreateOptions(); // Suggestion: switch to on-demand?
1998 void ImplDeleteOptions();
2000 void DeleteDrawLayer();
2001 SC_DLLPUBLIC
bool DrawGetPrintArea( ScRange
& rRange
, bool bSetHor
, bool bSetVer
) const;
2002 void DrawMovePage( sal_uInt16 nOldPos
, sal_uInt16 nNewPos
);
2003 void DrawCopyPage( sal_uInt16 nOldPos
, sal_uInt16 nNewPos
);
2005 void UpdateDrawPrinter();
2006 void UpdateDrawLanguages();
2007 void UpdateDrawDefaults();
2008 SC_DLLPUBLIC
void InitClipPtrs( ScDocument
* pSourceDoc
);
2010 void LoadDdeLinks(SvStream
& rStream
);
2011 void SaveDdeLinks(SvStream
& rStream
) const;
2013 void DeleteAreaLinksOnTab( SCTAB nTab
);
2014 void UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode
,
2015 const ScRange
& r
, SCsCOL nDx
, SCsROW nDy
, SCsTAB nDz
);
2017 void CopyRangeNamesToClip(ScDocument
* pClipDoc
, const ScRange
& rClipRange
, const ScMarkData
* pMarks
, bool bAllTabs
);
2019 bool HasPartOfMerged( const ScRange
& rRange
);
2021 void PutCell( const ScAddress
&, ScBaseCell
* pCell
, bool bForceTab
= false );
2022 void PutCell(SCCOL nCol
, SCROW nRow
, SCTAB nTab
, ScBaseCell
* pCell
, sal_uLong nFormatIndex
, bool bForceTab
= false );
2024 ScRefCellValue
GetRefCellValue( const ScAddress
& rPos
);
2026 std::map
< SCTAB
, ScSortParam
> mSheetSortParams
;
2029 inline void ScDocument::GetSortParam( ScSortParam
& rParam
, SCTAB nTab
)
2031 rParam
= mSheetSortParams
[ nTab
];
2034 inline void ScDocument::SetSortParam( ScSortParam
& rParam
, SCTAB nTab
)
2036 mSheetSortParams
[ nTab
] = rParam
;
2042 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */