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"
40 // --- class XclMsodrawing_Base --------------------------------------
42 class XclMsodrawing_Base
46 sal_Size nStartPos
; // position in OffsetMap
47 sal_Size nStopPos
; // position in OffsetMap
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(); }
56 sal_Size
GetDataLen() const;
60 // --- class XclMsodrawinggroup --------------------------------------
62 class XclMsodrawinggroup
: public XclMsodrawing_Base
, public XclExpRecord
66 virtual void WriteBody( XclExpStream
& rStrm
);
69 XclMsodrawinggroup( RootData
& rRoot
,
70 UINT16 nEscherType
= 0 );
71 virtual ~XclMsodrawinggroup();
75 // --- class XclMsodrawing -------------------------------------------
77 class XclMsodrawing
: public XclMsodrawing_Base
, public XclExpRecord
81 virtual void WriteBody( XclExpStream
& rStrm
);
85 const XclExpRoot
& rRoot
,
86 UINT16 nEscherType
= 0,
87 sal_Size nInitialSize
= 0 );
88 virtual ~XclMsodrawing();
92 // --- class XclObjList ----------------------------------------------
97 class XclObjList
: public List
, public ExcEmptyRec
, protected XclExpRoot
100 XclMsodrawing
* pMsodrawingPerSheet
;
101 XclMsodrawing
* pSolverContainer
;
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
119 virtual void Save( XclExpStream
& rStrm
);
123 // --- class XclObj --------------------------------------------------
128 class XclObj
: public XclExpRecord
131 XclMsodrawing
* pMsodrawing
;
132 XclMsodrawing
* pClientTextbox
;
134 sal_uInt16 mnObjType
;
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
);
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();
196 pMsodrawing
->UpdateStopPos();
200 // --- class XclObjComment -------------------------------------------
202 class XclObjComment
: public XclObj
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
226 virtual void WriteSubRecs( XclExpStream
& rStrm
);
230 XclObjDropDown( const XclExpRoot
& rRoot
, const ScAddress
& rPos
, BOOL bFilt
);
231 virtual ~XclObjDropDown();
235 // --- class XclTxo --------------------------------------------------
239 class XclTxo
: public ExcRecord
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;
255 virtual void SaveCont( XclExpStream
& rStrm
);
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
271 const SdrObject
& rOleObj
;
272 SotStorage
* pRootStorage
;
274 virtual void WriteSubRecs( XclExpStream
& rStrm
);
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
289 virtual void WriteSubRecs( XclExpStream
& rStrm
);
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
304 UINT32 nFileHistory
; // bfh
305 UINT32 nLowestBiffVer
; // sfo
307 virtual void SaveCont( XclExpStream
& rStrm
);
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
327 // --- class ExcBof8 -------------------------------------------------
328 // Header Record fuer WORKSHEETS
330 class ExcBof8
: public ExcBof8_Base
337 // --- class ExcBundlesheet8 -----------------------------------------
339 class ExcBundlesheet8
: public ExcBundlesheetBase
343 XclExpString
GetName() const;
345 virtual void SaveCont( XclExpStream
& rStrm
);
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
362 virtual UINT16
GetNum() const;
363 virtual sal_Size
GetLen() const;
367 // ---- class XclCodename --------------------------------------------
369 class XclCodename
: public ExcRecord
373 virtual void SaveCont( XclExpStream
& rStrm
);
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
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
414 XclExpString sComment
;
415 XclExpString sUserName
;
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
);
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
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
);
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
471 explicit XclExpSheetProtectOptions( const XclExpRoot
& rRoot
, SCTAB nTab
);
474 virtual void WriteBody( XclExpStream
& rStrm
);
477 sal_uInt16 mnOptions
; /// Encoded sheet protection options.
480 // ============================================================================
482 class XclCalccount
: public ExcRecord
487 virtual void SaveCont( XclExpStream
& rStrm
);
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
505 virtual void SaveCont( XclExpStream
& rStrm
);
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
523 virtual void SaveCont( XclExpStream
& rStrm
);
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
539 XclRefmode( const ScDocument
& );
541 virtual void SaveXml( XclExpXmlStream
& rStrm
);
544 // ============================================================================
546 class XclExpFilePass
: public XclExpRecord
549 explicit XclExpFilePass( const XclExpRoot
& rRoot
);
550 virtual ~XclExpFilePass();
553 virtual void WriteBody( XclExpStream
& rStrm
);
556 const XclExpRoot
& mrRoot
;
559 // ============================================================================
561 /** Beginning of User Interface Records */
562 class XclExpInterfaceHdr
: public XclExpUInt16Record
565 explicit XclExpInterfaceHdr( sal_uInt16 nCodePage
);
568 virtual void WriteBody( XclExpStream
& rStrm
);
571 // ============================================================================
573 /** Beginning of User Interface Records */
574 class XclExpInterfaceEnd
: public XclExpRecord
577 explicit XclExpInterfaceEnd();
578 virtual ~XclExpInterfaceEnd();
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
591 explicit XclExpWriteAccess();
592 virtual ~XclExpWriteAccess();
595 virtual void WriteBody( XclExpStream
& rStrm
);
598 // ============================================================================
600 class XclExpFileSharing
: public XclExpRecord
603 explicit XclExpFileSharing( const XclExpRoot
& rRoot
, sal_uInt16 nPasswordHash
);
605 virtual void Save( XclExpStream
& rStrm
);
608 virtual void WriteBody( XclExpStream
& rStrm
);
611 XclExpString maUserName
;
612 sal_uInt16 mnPasswordHash
;
615 // ============================================================================
617 class XclExpProt4Rev
: public XclExpRecord
620 explicit XclExpProt4Rev();
621 virtual ~XclExpProt4Rev();
624 virtual void WriteBody( XclExpStream
& rStrm
);
627 // ============================================================================
629 class XclExpProt4RevPass
: public XclExpRecord
632 explicit XclExpProt4RevPass();
633 virtual ~XclExpProt4RevPass();
636 virtual void WriteBody( XclExpStream
& rStrm
);
639 // ============================================================================
641 class XclExpRecalcId
: public XclExpDummyRecord
644 explicit XclExpRecalcId();
647 // ============================================================================
649 class XclExpBookExt
: public XclExpDummyRecord
652 explicit XclExpBookExt();
656 #endif // _XCL97REC_HXX