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