Update ooo320-m1
[ooovba.git] / sc / source / filter / inc / xcl97rec.hxx
blob30b6e8a128748460b763ce3356fbfd2964588d7e
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 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( const XclExpRoot& rRoot, 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( const XclExpRoot& rRoot, 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 );
536 class XclRefmode : public XclExpBoolRecord
538 public:
539 XclRefmode( const ScDocument& );
541 virtual void SaveXml( XclExpXmlStream& rStrm );
544 // ============================================================================
546 class XclExpFilePass : public XclExpRecord
548 public:
549 explicit XclExpFilePass( const XclExpRoot& rRoot );
550 virtual ~XclExpFilePass();
552 private:
553 virtual void WriteBody( XclExpStream& rStrm );
555 private:
556 const XclExpRoot& mrRoot;
559 // ============================================================================
561 /** Beginning of User Interface Records */
562 class XclExpInterfaceHdr : public XclExpUInt16Record
564 public:
565 explicit XclExpInterfaceHdr( sal_uInt16 nCodePage );
567 private:
568 virtual void WriteBody( XclExpStream& rStrm );
571 // ============================================================================
573 /** Beginning of User Interface Records */
574 class XclExpInterfaceEnd : public XclExpRecord
576 public:
577 explicit XclExpInterfaceEnd();
578 virtual ~XclExpInterfaceEnd();
580 private:
581 virtual void WriteBody( XclExpStream& rStrm );
584 // ============================================================================
586 /** Write Access User Name - This record contains the user name, which is
587 the name you type when you install Excel. */
588 class XclExpWriteAccess : public XclExpRecord
590 public:
591 explicit XclExpWriteAccess();
592 virtual ~XclExpWriteAccess();
594 private:
595 virtual void WriteBody( XclExpStream& rStrm );
598 // ============================================================================
600 class XclExpFileSharing : public XclExpRecord
602 public:
603 explicit XclExpFileSharing( const XclExpRoot& rRoot, sal_uInt16 nPasswordHash );
605 virtual void Save( XclExpStream& rStrm );
607 private:
608 virtual void WriteBody( XclExpStream& rStrm );
610 private:
611 XclExpString maUserName;
612 sal_uInt16 mnPasswordHash;
615 // ============================================================================
617 class XclExpProt4Rev : public XclExpRecord
619 public:
620 explicit XclExpProt4Rev();
621 virtual ~XclExpProt4Rev();
623 private:
624 virtual void WriteBody( XclExpStream& rStrm );
627 // ============================================================================
629 class XclExpProt4RevPass : public XclExpRecord
631 public:
632 explicit XclExpProt4RevPass();
633 virtual ~XclExpProt4RevPass();
635 private:
636 virtual void WriteBody( XclExpStream& rStrm );
639 // ============================================================================
641 class XclExpRecalcId : public XclExpDummyRecord
643 public:
644 explicit XclExpRecalcId();
647 // ============================================================================
649 class XclExpBookExt : public XclExpDummyRecord
651 public:
652 explicit XclExpBookExt();
656 #endif // _XCL97REC_HXX