m11-master update
[ooovba.git] / sc / source / filter / inc / xcl97rec.hxx
blobc0bd30974614bb1f98a7b7a44c179365df08b35f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xcl97rec.hxx,v $
10 * $Revision: 1.48.30.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_XCL97REC_HXX
32 #define SC_XCL97REC_HXX
34 #include "excrecds.hxx"
35 #include "xcl97esc.hxx"
36 #include "xlstyle.hxx"
38 #include <vector>
40 // --- class XclMsodrawing_Base --------------------------------------
42 class XclMsodrawing_Base
44 protected:
45 XclEscher* pEscher;
46 sal_Size nStartPos; // position in OffsetMap
47 sal_Size nStopPos; // position in OffsetMap
49 public:
50 XclMsodrawing_Base( XclEscher& rEscher, sal_Size nInitialSize = 0 );
51 virtual ~XclMsodrawing_Base();
53 inline XclEscher* GetEscher() const { return pEscher; }
54 inline XclEscherEx* GetEscherEx() const { return pEscher->GetEx(); }
55 void UpdateStopPos();
56 sal_Size GetDataLen() const;
60 // --- class XclMsodrawinggroup --------------------------------------
62 class XclMsodrawinggroup : public XclMsodrawing_Base, public XclExpRecord
64 private:
66 virtual void WriteBody( XclExpStream& rStrm );
68 public:
69 XclMsodrawinggroup( RootData& rRoot,
70 UINT16 nEscherType = 0 );
71 virtual ~XclMsodrawinggroup();
75 // --- class XclMsodrawing -------------------------------------------
77 class XclMsodrawing : public XclMsodrawing_Base, public XclExpRecord
79 private:
81 virtual void WriteBody( XclExpStream& rStrm );
83 public:
84 XclMsodrawing(
85 const XclExpRoot& rRoot,
86 UINT16 nEscherType = 0,
87 sal_Size nInitialSize = 0 );
88 virtual ~XclMsodrawing();
92 // --- class XclObjList ----------------------------------------------
94 class XclObj;
95 class XclMsodrawing;
97 class XclObjList : public List, public ExcEmptyRec, protected XclExpRoot
99 private:
100 XclMsodrawing* pMsodrawingPerSheet;
101 XclMsodrawing* pSolverContainer;
103 public:
104 XclObjList( const XclExpRoot& rRoot );
105 virtual ~XclObjList();
107 XclObj* First() { return (XclObj*) List::First(); }
108 XclObj* Next() { return (XclObj*) List::Next(); }
110 /// return: 1-based ObjId
111 ///! count>=0xFFFF: Obj will be deleted, return 0
112 UINT16 Add( XclObj* );
114 inline XclMsodrawing* GetMsodrawingPerSheet() { return pMsodrawingPerSheet; }
116 /// close groups and DgContainer opened in ctor
117 void EndSheet();
119 virtual void Save( XclExpStream& rStrm );
123 // --- class XclObj --------------------------------------------------
125 class XclTxo;
126 class SdrTextObj;
128 class XclObj : public XclExpRecord
130 protected:
131 XclMsodrawing* pMsodrawing;
132 XclMsodrawing* pClientTextbox;
133 XclTxo* pTxo;
134 sal_uInt16 mnObjType;
135 UINT16 nObjId;
136 UINT16 nGrbit;
137 BOOL bFirstOnSheet;
139 bool mbOwnEscher; /// true = Escher part created on the fly.
141 /** @param bOwnEscher If set to true, this object will create its escher data.
142 See SetOwnEscher() for details. */
143 explicit XclObj( const XclExpRoot& rRoot, sal_uInt16 nObjType, bool bOwnEscher = false );
145 // overwritten for writing MSODRAWING record
146 virtual void WriteBody( XclExpStream& rStrm );
147 virtual void WriteSubRecs( XclExpStream& rStrm );
148 void SaveTextRecs( XclExpStream& rStrm );
150 public:
151 virtual ~XclObj();
153 inline sal_uInt16 GetObjType() const { return mnObjType; }
155 inline void SetId( UINT16 nId ) { nObjId = nId; }
157 inline void SetLocked( BOOL b )
158 { b ? nGrbit |= 0x0001 : nGrbit &= ~0x0001; }
159 inline void SetPrintable( BOOL b )
160 { b ? nGrbit |= 0x0010 : nGrbit &= ~0x0010; }
161 inline void SetAutoFill( BOOL b )
162 { b ? nGrbit |= 0x2000 : nGrbit &= ~0x2000; }
163 inline void SetAutoLine( BOOL b )
164 { b ? nGrbit |= 0x4000 : nGrbit &= ~0x4000; }
166 // set corresponding Excel object type in OBJ/ftCmo
167 void SetEscherShapeType( UINT16 nType );
168 inline void SetEscherShapeTypeGroup() { mnObjType = EXC_OBJTYPE_GROUP; }
170 /** If set to true, this object has created its own escher data.
171 @descr This causes the function EscherEx::EndShape() to not post process
172 this object. This is used i.e. for form controls. They are not handled in
173 the svx base code, so the XclExpEscherOcxCtrl c'tor creates the escher data
174 itself. The svx base code does not receive the correct shape ID after the
175 EscherEx::StartShape() call, which would result in deleting the object in
176 EscherEx::EndShape(). */
177 inline void SetOwnEscher( bool bOwnEscher = true ) { mbOwnEscher = bOwnEscher; }
178 /** Returns true, if the object has created the escher data itself.
179 @descr See SetOwnEscher() for details. */
180 inline bool IsOwnEscher() const { return mbOwnEscher; }
182 //! actually writes ESCHER_ClientTextbox
183 void SetText( const XclExpRoot& rRoot, const SdrTextObj& rObj );
185 inline void UpdateStopPos();
187 virtual void Save( XclExpStream& rStrm );
191 inline void XclObj::UpdateStopPos()
193 if ( pClientTextbox )
194 pClientTextbox->UpdateStopPos();
195 else
196 pMsodrawing->UpdateStopPos();
200 // --- class XclObjComment -------------------------------------------
202 class XclObjComment : public XclObj
204 public:
205 XclObjComment( const XclExpRoot& rRoot,
206 const Rectangle& rRect, const EditTextObject& rEditObj, SdrObject* pCaption, bool bVisible );
207 virtual ~XclObjComment();
209 /** c'tor process for formatted text objects above .
210 @descr used to construct the MSODRAWING Escher object properties. */
211 void ProcessEscherObj( const XclExpRoot& rRoot,
212 const Rectangle& rRect, SdrObject* pCaption, bool bVisible );
215 virtual void Save( XclExpStream& rStrm );
219 // --- class XclObjDropDown ------------------------------------------
221 class XclObjDropDown : public XclObj
223 private:
224 BOOL bIsFiltered;
226 virtual void WriteSubRecs( XclExpStream& rStrm );
228 protected:
229 public:
230 XclObjDropDown( const XclExpRoot& rRoot, const ScAddress& rPos, BOOL bFilt );
231 virtual ~XclObjDropDown();
235 // --- class XclTxo --------------------------------------------------
237 class SdrTextObj;
239 class XclTxo : public ExcRecord
241 public:
242 XclTxo( const String& rString, sal_uInt16 nFontIx = EXC_FONT_APP );
243 XclTxo( const XclExpRoot& rRoot, const SdrTextObj& rEditObj );
244 XclTxo( const XclExpRoot& rRoot, const EditTextObject& rEditObj, SdrObject* pCaption );
246 inline void SetHorAlign( sal_uInt8 nHorAlign ) { mnHorAlign = nHorAlign; }
247 inline void SetVerAlign( sal_uInt8 nVerAlign ) { mnVerAlign = nVerAlign; }
249 virtual void Save( XclExpStream& rStrm );
251 virtual UINT16 GetNum() const;
252 virtual sal_Size GetLen() const;
254 private:
255 virtual void SaveCont( XclExpStream& rStrm );
257 private:
258 XclExpStringRef mpString; /// Text and formatting data.
259 sal_uInt16 mnRotation; /// Text rotation.
260 sal_uInt8 mnHorAlign; /// Horizontal alignment.
261 sal_uInt8 mnVerAlign; /// Vertical alignment.
265 // --- class XclObjOle -----------------------------------------------
267 class XclObjOle : public XclObj
269 private:
271 const SdrObject& rOleObj;
272 SotStorage* pRootStorage;
274 virtual void WriteSubRecs( XclExpStream& rStrm );
276 public:
277 XclObjOle( const XclExpRoot& rRoot, const SdrObject& rObj );
278 virtual ~XclObjOle();
280 virtual void Save( XclExpStream& rStrm );
284 // --- class XclObjAny -----------------------------------------------
286 class XclObjAny : public XclObj
288 protected:
289 virtual void WriteSubRecs( XclExpStream& rStrm );
291 public:
292 XclObjAny( const XclExpRoot& rRoot );
293 virtual ~XclObjAny();
295 virtual void Save( XclExpStream& rStrm );
299 // --- class ExcBof8_Base --------------------------------------------
301 class ExcBof8_Base : public ExcBof_Base
303 protected:
304 UINT32 nFileHistory; // bfh
305 UINT32 nLowestBiffVer; // sfo
307 virtual void SaveCont( XclExpStream& rStrm );
309 public:
310 ExcBof8_Base();
312 virtual UINT16 GetNum() const;
313 virtual sal_Size GetLen() const;
317 // --- class ExcBofW8 ------------------------------------------------
318 // Header Record fuer WORKBOOKS
320 class ExcBofW8 : public ExcBof8_Base
322 public:
323 ExcBofW8();
327 // --- class ExcBof8 -------------------------------------------------
328 // Header Record fuer WORKSHEETS
330 class ExcBof8 : public ExcBof8_Base
332 public:
333 ExcBof8();
337 // --- class ExcBundlesheet8 -----------------------------------------
339 class ExcBundlesheet8 : public ExcBundlesheetBase
341 private:
342 String sUnicodeName;
343 XclExpString GetName() const;
345 virtual void SaveCont( XclExpStream& rStrm );
347 public:
348 ExcBundlesheet8( RootData& rRootData, SCTAB nTab );
349 ExcBundlesheet8( const String& rString );
351 virtual sal_Size GetLen() const;
353 virtual void SaveXml( XclExpXmlStream& rStrm );
357 // --- class XclObproj -----------------------------------------------
359 class XclObproj : public ExcRecord
361 public:
362 virtual UINT16 GetNum() const;
363 virtual sal_Size GetLen() const;
367 // ---- class XclCodename --------------------------------------------
369 class XclCodename : public ExcRecord
371 private:
372 XclExpString aName;
373 virtual void SaveCont( XclExpStream& rStrm );
374 public:
375 XclCodename( const String& );
377 virtual UINT16 GetNum() const;
378 virtual sal_Size GetLen() const;
382 // ---- Scenarios ----------------------------------------------------
383 // - ExcEScenarioCell a cell of a scenario range
384 // - ExcEScenario all ranges of a scenario table
385 // - ExcEScenarioManager list of scenario tables
387 class ExcEScenarioCell
389 private:
390 UINT16 nCol;
391 UINT16 nRow;
392 XclExpString sText;
394 protected:
395 public:
396 ExcEScenarioCell( UINT16 nC, UINT16 nR, const String& rTxt );
398 inline sal_Size GetStringBytes()
399 { return sText.GetSize(); }
401 void WriteAddress( XclExpStream& rStrm );
402 void WriteText( XclExpStream& rStrm );
404 void SaveXml( XclExpXmlStream& rStrm );
409 class ExcEScenario : public ExcRecord, private List
411 private:
412 sal_Size nRecLen;
413 XclExpString sName;
414 XclExpString sComment;
415 static XclExpString sUsername;
416 UINT8 nProtected;
418 inline ExcEScenarioCell* _First() { return (ExcEScenarioCell*) List::First(); }
419 inline ExcEScenarioCell* _Next() { return (ExcEScenarioCell*) List::Next(); }
421 BOOL Append( UINT16 nCol, UINT16 nRow, const String& rTxt );
423 virtual void SaveCont( XclExpStream& rStrm );
425 protected:
426 public:
427 ExcEScenario( ScDocument& rDoc, SCTAB nTab );
428 virtual ~ExcEScenario();
430 virtual UINT16 GetNum() const;
431 virtual sal_Size GetLen() const;
433 virtual void SaveXml( XclExpXmlStream& rStrm );
438 class ExcEScenarioManager : public ExcRecord, private List
440 private:
441 UINT16 nActive;
443 inline ExcEScenario* _First() { return (ExcEScenario*) List::First(); }
444 inline ExcEScenario* _Next() { return (ExcEScenario*) List::Next(); }
446 inline void Append( ExcEScenario* pScen )
447 { List::Insert( pScen, LIST_APPEND ); }
449 virtual void SaveCont( XclExpStream& rStrm );
451 protected:
452 public:
453 ExcEScenarioManager( ScDocument& rDoc, SCTAB nTab );
454 virtual ~ExcEScenarioManager();
456 virtual void Save( XclExpStream& rStrm );
457 virtual void SaveXml( XclExpXmlStream& rStrm );
459 virtual UINT16 GetNum() const;
460 virtual sal_Size GetLen() const;
463 // ============================================================================
465 /** Represents a SHEETPROTECTION record that stores sheet protection
466 options. Note that a sheet still needs to save its sheet protection
467 options even when it's not protected. */
468 class XclExpSheetProtectOptions : public XclExpRecord
470 public:
471 explicit XclExpSheetProtectOptions( const XclExpRoot& rRoot, SCTAB nTab );
473 private:
474 virtual void WriteBody( XclExpStream& rStrm );
476 private:
477 sal_uInt16 mnOptions; /// Encoded sheet protection options.
480 // ============================================================================
482 class XclCalccount : public ExcRecord
484 private:
485 UINT16 nCount;
486 protected:
487 virtual void SaveCont( XclExpStream& rStrm );
488 public:
489 XclCalccount( const ScDocument& );
491 virtual UINT16 GetNum() const;
492 virtual sal_Size GetLen() const;
494 virtual void SaveXml( XclExpXmlStream& rStrm );
500 class XclIteration : public ExcRecord
502 private:
503 UINT16 nIter;
504 protected:
505 virtual void SaveCont( XclExpStream& rStrm );
506 public:
507 XclIteration( const ScDocument& );
509 virtual UINT16 GetNum() const;
510 virtual sal_Size GetLen() const;
512 virtual void SaveXml( XclExpXmlStream& rStrm );
518 class XclDelta : public ExcRecord
520 private:
521 double fDelta;
522 protected:
523 virtual void SaveCont( XclExpStream& rStrm );
524 public:
525 XclDelta( const ScDocument& );
527 virtual UINT16 GetNum() const;
528 virtual sal_Size GetLen() const;
530 virtual void SaveXml( XclExpXmlStream& rStrm );
533 // ============================================================================
535 class XclExpFilePass : public XclExpRecord
537 public:
538 explicit XclExpFilePass( const XclExpRoot& rRoot );
539 virtual ~XclExpFilePass();
541 private:
542 virtual void WriteBody( XclExpStream& rStrm );
544 private:
545 const XclExpRoot& mrRoot;
548 // ============================================================================
550 class XclExpFnGroupCount : public XclExpRecord
552 public:
553 explicit XclExpFnGroupCount();
554 virtual ~XclExpFnGroupCount();
556 private:
557 virtual void WriteBody( XclExpStream& rStrm );
560 // ============================================================================
562 /** Beginning of User Interface Records */
563 class XclExpInterfaceHdr : public XclExpRecord
565 public:
566 explicit XclExpInterfaceHdr();
567 virtual ~XclExpInterfaceHdr();
569 private:
570 virtual void WriteBody( XclExpStream& rStrm );
573 // ============================================================================
575 /** Beginning of User Interface Records */
576 class XclExpInterfaceEnd : public XclExpRecord
578 public:
579 explicit XclExpInterfaceEnd();
580 virtual ~XclExpInterfaceEnd();
582 private:
583 virtual void WriteBody( XclExpStream& rStrm );
586 // ============================================================================
588 /** ADDMENU/DELMENU Record Group Count */
589 class XclExpMMS : public XclExpRecord
591 public:
592 explicit XclExpMMS();
593 virtual ~XclExpMMS();
595 private:
596 virtual void WriteBody( XclExpStream& rStrm );
599 // ============================================================================
601 /** Write Access User Name - This record contains the user name, which is
602 the name you type when you install Excel. */
603 class XclExpWriteAccess : public XclExpRecord
605 public:
606 explicit XclExpWriteAccess();
607 virtual ~XclExpWriteAccess();
609 private:
610 virtual void WriteBody( XclExpStream& rStrm );
613 // ============================================================================
615 class XclExpCodePage : public XclExpRecord
617 public:
618 explicit XclExpCodePage();
619 virtual ~XclExpCodePage();
621 private:
622 virtual void WriteBody( XclExpStream& rStrm );
625 // ============================================================================
627 class XclExpDSF : public XclExpRecord
629 public:
630 explicit XclExpDSF();
631 virtual ~XclExpDSF();
633 private:
634 virtual void WriteBody( XclExpStream& rStrm );
637 // ============================================================================
639 class XclExpProt4Rev : public XclExpRecord
641 public:
642 explicit XclExpProt4Rev();
643 virtual ~XclExpProt4Rev();
645 private:
646 virtual void WriteBody( XclExpStream& rStrm );
649 // ============================================================================
651 class XclExpProt4RevPass : public XclExpRecord
653 public:
654 explicit XclExpProt4RevPass();
655 virtual ~XclExpProt4RevPass();
657 private:
658 virtual void WriteBody( XclExpStream& rStrm );
661 // ============================================================================
663 /** What's this record for? It is a zero-byte record. */
664 class XclExpExcel9File : public XclExpRecord
666 public:
667 explicit XclExpExcel9File();
668 virtual ~XclExpExcel9File();
670 private:
671 virtual void WriteBody( XclExpStream& rStrm );
674 // ============================================================================
676 class XclExpRecalcId : public XclExpDummyRecord
678 public:
679 explicit XclExpRecalcId();
682 // ============================================================================
684 class XclExpBookExt : public XclExpDummyRecord
686 public:
687 explicit XclExpBookExt();
693 class XclRefmode : public XclExpBoolRecord
695 public:
696 XclRefmode( const ScDocument& );
698 virtual void SaveXml( XclExpXmlStream& rStrm );
702 #endif // _XCL97REC_HXX