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_XCL97REC_HXX 25 #define SC_XCL97REC_HXX 26 27 #include "excrecds.hxx" 28 #include "xcl97esc.hxx" 29 #include "xlstyle.hxx" 30 31 // ============================================================================ 32 33 class XclObj; 34 class XclExpMsoDrawing; 35 36 class XclExpObjList : public List, public ExcEmptyRec, protected XclExpRoot 37 { 38 public: 39 explicit XclExpObjList( const XclExpRoot& rRoot, XclEscherEx& rEscherEx ); 40 virtual ~XclExpObjList(); 41 First()42 XclObj* First() { return (XclObj*) List::First(); } Next()43 XclObj* Next() { return (XclObj*) List::Next(); } 44 45 /// return: 1-based ObjId 46 ///! count>=0xFFFF: Obj will be deleted, return 0 47 sal_uInt16 Add( XclObj* ); 48 GetMsodrawingPerSheet()49 inline XclExpMsoDrawing* GetMsodrawingPerSheet() { return pMsodrawingPerSheet; } 50 51 /// close groups and DgContainer opened in ctor 52 void EndSheet(); 53 54 virtual void Save( XclExpStream& rStrm ); 55 56 private: 57 XclEscherEx& mrEscherEx; 58 XclExpMsoDrawing* pMsodrawingPerSheet; 59 XclExpMsoDrawing* pSolverContainer; 60 }; 61 62 63 // --- class XclObj -------------------------------------------------- 64 65 class XclTxo; 66 class SdrTextObj; 67 68 class XclObj : public XclExpRecord 69 { 70 protected: 71 XclEscherEx& mrEscherEx; 72 XclExpMsoDrawing* pMsodrawing; 73 XclExpMsoDrawing* pClientTextbox; 74 XclTxo* pTxo; 75 sal_uInt16 mnObjType; 76 sal_uInt16 nObjId; 77 sal_uInt16 nGrbit; 78 sal_Bool bFirstOnSheet; 79 80 bool mbOwnEscher; /// true = Escher part created on the fly. 81 82 /** @param bOwnEscher If set to true, this object will create its escher data. 83 See SetOwnEscher() for details. */ 84 explicit XclObj( XclExpObjectManager& rObjMgr, sal_uInt16 nObjType, bool bOwnEscher = false ); 85 86 void ImplWriteAnchor( const XclExpRoot& rRoot, const SdrObject* pSdrObj, const Rectangle* pChildAnchor ); 87 88 // overwritten for writing MSODRAWING record 89 virtual void WriteBody( XclExpStream& rStrm ); 90 virtual void WriteSubRecs( XclExpStream& rStrm ); 91 void SaveTextRecs( XclExpStream& rStrm ); 92 93 public: 94 virtual ~XclObj(); 95 GetObjType() const96 inline sal_uInt16 GetObjType() const { return mnObjType; } 97 SetId(sal_uInt16 nId)98 inline void SetId( sal_uInt16 nId ) { nObjId = nId; } 99 SetLocked(sal_Bool b)100 inline void SetLocked( sal_Bool b ) 101 { b ? nGrbit |= 0x0001 : nGrbit &= ~0x0001; } SetPrintable(sal_Bool b)102 inline void SetPrintable( sal_Bool b ) 103 { b ? nGrbit |= 0x0010 : nGrbit &= ~0x0010; } SetAutoFill(sal_Bool b)104 inline void SetAutoFill( sal_Bool b ) 105 { b ? nGrbit |= 0x2000 : nGrbit &= ~0x2000; } SetAutoLine(sal_Bool b)106 inline void SetAutoLine( sal_Bool b ) 107 { b ? nGrbit |= 0x4000 : nGrbit &= ~0x4000; } 108 109 // set corresponding Excel object type in OBJ/ftCmo 110 void SetEscherShapeType( sal_uInt16 nType ); SetEscherShapeTypeGroup()111 inline void SetEscherShapeTypeGroup() { mnObjType = EXC_OBJTYPE_GROUP; } 112 113 /** If set to true, this object has created its own escher data. 114 @descr This causes the function EscherEx::EndShape() to not post process 115 this object. This is used i.e. for form controls. They are not handled in 116 the svx base code, so the XclExpEscherOcxCtrl c'tor creates the escher data 117 itself. The svx base code does not receive the correct shape ID after the 118 EscherEx::StartShape() call, which would result in deleting the object in 119 EscherEx::EndShape(). */ SetOwnEscher(bool bOwnEscher=true)120 inline void SetOwnEscher( bool bOwnEscher = true ) { mbOwnEscher = bOwnEscher; } 121 /** Returns true, if the object has created the escher data itself. 122 @descr See SetOwnEscher() for details. */ IsOwnEscher() const123 inline bool IsOwnEscher() const { return mbOwnEscher; } 124 125 //! actually writes ESCHER_ClientTextbox 126 void SetText( const XclExpRoot& rRoot, const SdrTextObj& rObj ); 127 128 virtual void Save( XclExpStream& rStrm ); 129 }; 130 131 // --- class XclObjComment ------------------------------------------- 132 133 class XclObjComment : public XclObj 134 { 135 public: 136 XclObjComment( XclExpObjectManager& rObjMgr, 137 const Rectangle& rRect, const EditTextObject& rEditObj, SdrObject* pCaption, bool bVisible ); 138 virtual ~XclObjComment(); 139 140 /** c'tor process for formatted text objects above . 141 @descr used to construct the MSODRAWING Escher object properties. */ 142 void ProcessEscherObj( const XclExpRoot& rRoot, 143 const Rectangle& rRect, SdrObject* pCaption, bool bVisible ); 144 145 146 virtual void Save( XclExpStream& rStrm ); 147 }; 148 149 150 // --- class XclObjDropDown ------------------------------------------ 151 152 class XclObjDropDown : public XclObj 153 { 154 private: 155 sal_Bool bIsFiltered; 156 157 virtual void WriteSubRecs( XclExpStream& rStrm ); 158 159 protected: 160 public: 161 XclObjDropDown( XclExpObjectManager& rObjMgr, const ScAddress& rPos, sal_Bool bFilt ); 162 virtual ~XclObjDropDown(); 163 }; 164 165 166 // --- class XclTxo -------------------------------------------------- 167 168 class SdrTextObj; 169 170 class XclTxo : public ExcRecord 171 { 172 public: 173 XclTxo( const String& rString, sal_uInt16 nFontIx = EXC_FONT_APP ); 174 XclTxo( const XclExpRoot& rRoot, const SdrTextObj& rEditObj ); 175 XclTxo( const XclExpRoot& rRoot, const EditTextObject& rEditObj, SdrObject* pCaption ); 176 SetHorAlign(sal_uInt8 nHorAlign)177 inline void SetHorAlign( sal_uInt8 nHorAlign ) { mnHorAlign = nHorAlign; } SetVerAlign(sal_uInt8 nVerAlign)178 inline void SetVerAlign( sal_uInt8 nVerAlign ) { mnVerAlign = nVerAlign; } 179 180 virtual void Save( XclExpStream& rStrm ); 181 182 virtual sal_uInt16 GetNum() const; 183 virtual sal_Size GetLen() const; 184 185 private: 186 virtual void SaveCont( XclExpStream& rStrm ); 187 188 private: 189 XclExpStringRef mpString; /// Text and formatting data. 190 sal_uInt16 mnRotation; /// Text rotation. 191 sal_uInt8 mnHorAlign; /// Horizontal alignment. 192 sal_uInt8 mnVerAlign; /// Vertical alignment. 193 }; 194 195 196 // --- class XclObjOle ----------------------------------------------- 197 198 class XclObjOle : public XclObj 199 { 200 private: 201 202 const SdrObject& rOleObj; 203 SotStorage* pRootStorage; 204 205 virtual void WriteSubRecs( XclExpStream& rStrm ); 206 207 public: 208 XclObjOle( XclExpObjectManager& rObjMgr, const SdrObject& rObj ); 209 virtual ~XclObjOle(); 210 211 virtual void Save( XclExpStream& rStrm ); 212 }; 213 214 215 // --- class XclObjAny ----------------------------------------------- 216 217 class XclObjAny : public XclObj 218 { 219 private: 220 virtual void WriteSubRecs( XclExpStream& rStrm ); 221 222 public: 223 XclObjAny( XclExpObjectManager& rObjMgr ); 224 virtual ~XclObjAny(); 225 226 virtual void Save( XclExpStream& rStrm ); 227 }; 228 229 230 // --- class ExcBof8_Base -------------------------------------------- 231 232 class ExcBof8_Base : public ExcBof_Base 233 { 234 protected: 235 sal_uInt32 nFileHistory; // bfh 236 sal_uInt32 nLowestBiffVer; // sfo 237 238 virtual void SaveCont( XclExpStream& rStrm ); 239 240 public: 241 ExcBof8_Base(); 242 243 virtual sal_uInt16 GetNum() const; 244 virtual sal_Size GetLen() const; 245 }; 246 247 248 // --- class ExcBofW8 ------------------------------------------------ 249 // Header Record fuer WORKBOOKS 250 251 class ExcBofW8 : public ExcBof8_Base 252 { 253 public: 254 ExcBofW8(); 255 }; 256 257 258 // --- class ExcBof8 ------------------------------------------------- 259 // Header Record fuer WORKSHEETS 260 261 class ExcBof8 : public ExcBof8_Base 262 { 263 public: 264 ExcBof8(); 265 }; 266 267 268 // --- class ExcBundlesheet8 ----------------------------------------- 269 270 class ExcBundlesheet8 : public ExcBundlesheetBase 271 { 272 private: 273 String sUnicodeName; 274 XclExpString GetName() const; 275 276 virtual void SaveCont( XclExpStream& rStrm ); 277 278 public: 279 ExcBundlesheet8( RootData& rRootData, SCTAB nTab ); 280 ExcBundlesheet8( const String& rString ); 281 282 virtual sal_Size GetLen() const; 283 284 virtual void SaveXml( XclExpXmlStream& rStrm ); 285 }; 286 287 288 // --- class XclObproj ----------------------------------------------- 289 290 class XclObproj : public ExcRecord 291 { 292 public: 293 virtual sal_uInt16 GetNum() const; 294 virtual sal_Size GetLen() const; 295 }; 296 297 298 // ---- class XclCodename -------------------------------------------- 299 300 class XclCodename : public ExcRecord 301 { 302 private: 303 XclExpString aName; 304 virtual void SaveCont( XclExpStream& rStrm ); 305 public: 306 XclCodename( const String& ); 307 308 virtual sal_uInt16 GetNum() const; 309 virtual sal_Size GetLen() const; 310 }; 311 312 313 // ---- Scenarios ---------------------------------------------------- 314 // - ExcEScenarioCell a cell of a scenario range 315 // - ExcEScenario all ranges of a scenario table 316 // - ExcEScenarioManager list of scenario tables 317 318 class ExcEScenarioCell 319 { 320 private: 321 sal_uInt16 nCol; 322 sal_uInt16 nRow; 323 XclExpString sText; 324 325 protected: 326 public: 327 ExcEScenarioCell( sal_uInt16 nC, sal_uInt16 nR, const String& rTxt ); 328 GetStringBytes()329 inline sal_Size GetStringBytes() 330 { return sText.GetSize(); } 331 332 void WriteAddress( XclExpStream& rStrm ); 333 void WriteText( XclExpStream& rStrm ); 334 335 void SaveXml( XclExpXmlStream& rStrm ); 336 }; 337 338 339 340 class ExcEScenario : public ExcRecord, private List 341 { 342 private: 343 sal_Size nRecLen; 344 XclExpString sName; 345 XclExpString sComment; 346 XclExpString sUserName; 347 sal_uInt8 nProtected; 348 _First()349 inline ExcEScenarioCell* _First() { return (ExcEScenarioCell*) List::First(); } _Next()350 inline ExcEScenarioCell* _Next() { return (ExcEScenarioCell*) List::Next(); } 351 352 sal_Bool Append( sal_uInt16 nCol, sal_uInt16 nRow, const String& rTxt ); 353 354 virtual void SaveCont( XclExpStream& rStrm ); 355 356 protected: 357 public: 358 ExcEScenario( const XclExpRoot& rRoot, SCTAB nTab ); 359 virtual ~ExcEScenario(); 360 361 virtual sal_uInt16 GetNum() const; 362 virtual sal_Size GetLen() const; 363 364 virtual void SaveXml( XclExpXmlStream& rStrm ); 365 }; 366 367 368 369 class ExcEScenarioManager : public ExcRecord, private List 370 { 371 private: 372 sal_uInt16 nActive; 373 _First()374 inline ExcEScenario* _First() { return (ExcEScenario*) List::First(); } _Next()375 inline ExcEScenario* _Next() { return (ExcEScenario*) List::Next(); } 376 Append(ExcEScenario * pScen)377 inline void Append( ExcEScenario* pScen ) 378 { List::Insert( pScen, LIST_APPEND ); } 379 380 virtual void SaveCont( XclExpStream& rStrm ); 381 382 protected: 383 public: 384 ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab ); 385 virtual ~ExcEScenarioManager(); 386 387 virtual void Save( XclExpStream& rStrm ); 388 virtual void SaveXml( XclExpXmlStream& rStrm ); 389 390 virtual sal_uInt16 GetNum() const; 391 virtual sal_Size GetLen() const; 392 }; 393 394 // ============================================================================ 395 396 /** Represents a SHEETPROTECTION record that stores sheet protection 397 options. Note that a sheet still needs to save its sheet protection 398 options even when it's not protected. */ 399 class XclExpSheetProtectOptions : public XclExpRecord 400 { 401 public: 402 explicit XclExpSheetProtectOptions( const XclExpRoot& rRoot, SCTAB nTab ); 403 404 private: 405 virtual void WriteBody( XclExpStream& rStrm ); 406 407 private: 408 sal_uInt16 mnOptions; /// Encoded sheet protection options. 409 }; 410 411 // ============================================================================ 412 413 class XclCalccount : public ExcRecord 414 { 415 private: 416 sal_uInt16 nCount; 417 protected: 418 virtual void SaveCont( XclExpStream& rStrm ); 419 public: 420 XclCalccount( const ScDocument& ); 421 422 virtual sal_uInt16 GetNum() const; 423 virtual sal_Size GetLen() const; 424 425 virtual void SaveXml( XclExpXmlStream& rStrm ); 426 }; 427 428 429 430 431 class XclIteration : public ExcRecord 432 { 433 private: 434 sal_uInt16 nIter; 435 protected: 436 virtual void SaveCont( XclExpStream& rStrm ); 437 public: 438 XclIteration( const ScDocument& ); 439 440 virtual sal_uInt16 GetNum() const; 441 virtual sal_Size GetLen() const; 442 443 virtual void SaveXml( XclExpXmlStream& rStrm ); 444 }; 445 446 447 448 449 class XclDelta : public ExcRecord 450 { 451 private: 452 double fDelta; 453 protected: 454 virtual void SaveCont( XclExpStream& rStrm ); 455 public: 456 XclDelta( const ScDocument& ); 457 458 virtual sal_uInt16 GetNum() const; 459 virtual sal_Size GetLen() const; 460 461 virtual void SaveXml( XclExpXmlStream& rStrm ); 462 }; 463 464 465 466 467 class XclRefmode : public XclExpBoolRecord 468 { 469 public: 470 XclRefmode( const ScDocument& ); 471 472 virtual void SaveXml( XclExpXmlStream& rStrm ); 473 }; 474 475 // ============================================================================ 476 477 class XclExpFileEncryption : public XclExpRecord 478 { 479 public: 480 explicit XclExpFileEncryption( const XclExpRoot& rRoot ); 481 virtual ~XclExpFileEncryption(); 482 483 private: 484 virtual void WriteBody( XclExpStream& rStrm ); 485 486 private: 487 const XclExpRoot& mrRoot; 488 }; 489 490 // ============================================================================ 491 492 /** Beginning of User Interface Records */ 493 class XclExpInterfaceHdr : public XclExpUInt16Record 494 { 495 public: 496 explicit XclExpInterfaceHdr( sal_uInt16 nCodePage ); 497 498 private: 499 virtual void WriteBody( XclExpStream& rStrm ); 500 }; 501 502 // ============================================================================ 503 504 /** End of User Interface Records */ 505 class XclExpInterfaceEnd : public XclExpRecord 506 { 507 public: 508 explicit XclExpInterfaceEnd(); 509 virtual ~XclExpInterfaceEnd(); 510 511 private: 512 virtual void WriteBody( XclExpStream& rStrm ); 513 }; 514 515 // ============================================================================ 516 517 /** Write Access User Name - This record contains the user name, which is 518 the name you type when you install Excel. */ 519 class XclExpWriteAccess : public XclExpRecord 520 { 521 public: 522 explicit XclExpWriteAccess(); 523 virtual ~XclExpWriteAccess(); 524 525 private: 526 virtual void WriteBody( XclExpStream& rStrm ); 527 }; 528 529 // ============================================================================ 530 531 class XclExpFileSharing : public XclExpRecord 532 { 533 public: 534 explicit XclExpFileSharing( const XclExpRoot& rRoot, sal_uInt16 nPasswordHash, bool bRecommendReadOnly ); 535 536 virtual void Save( XclExpStream& rStrm ); 537 538 private: 539 virtual void WriteBody( XclExpStream& rStrm ); 540 541 private: 542 XclExpString maUserName; 543 sal_uInt16 mnPasswordHash; 544 bool mbRecommendReadOnly; 545 }; 546 547 // ============================================================================ 548 549 class XclExpProt4Rev : public XclExpRecord 550 { 551 public: 552 explicit XclExpProt4Rev(); 553 virtual ~XclExpProt4Rev(); 554 555 private: 556 virtual void WriteBody( XclExpStream& rStrm ); 557 }; 558 559 // ============================================================================ 560 561 class XclExpProt4RevPass : public XclExpRecord 562 { 563 public: 564 explicit XclExpProt4RevPass(); 565 virtual ~XclExpProt4RevPass(); 566 567 private: 568 virtual void WriteBody( XclExpStream& rStrm ); 569 }; 570 571 // ============================================================================ 572 573 class XclExpRecalcId : public XclExpDummyRecord 574 { 575 public: 576 explicit XclExpRecalcId(); 577 }; 578 579 // ============================================================================ 580 581 class XclExpBookExt : public XclExpDummyRecord 582 { 583 public: 584 explicit XclExpBookExt(); 585 }; 586 587 588 #endif // _XCL97REC_HXX 589