Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_XCL97REC_HXX
30 : : #define SC_XCL97REC_HXX
31 : :
32 : : #include "excrecds.hxx"
33 : : #include "xcl97esc.hxx"
34 : : #include "xlstyle.hxx"
35 : :
36 : : // ============================================================================
37 : :
38 : : class XclObj;
39 : : class XclExpMsoDrawing;
40 : : class SdrCaptionObj;
41 : :
42 : : class XclExpObjList : public ExcEmptyRec, protected XclExpRoot
43 : : {
44 : : public:
45 : :
46 : : typedef std::vector<XclObj*>::iterator iterator;
47 : :
48 : : explicit XclExpObjList( const XclExpRoot& rRoot, XclEscherEx& rEscherEx );
49 : : virtual ~XclExpObjList();
50 : :
51 : : /// return: 1-based ObjId
52 : : ///! count>=0xFFFF: Obj will be deleted, return 0
53 : : sal_uInt16 Add( XclObj* );
54 : :
55 [ # # ]: 0 : XclObj* back () { return maObjs.empty() ? NULL : maObjs.back(); }
56 : :
57 : : /**
58 : : *
59 : : * @brief Remove last element in the list.
60 : : *
61 : : */
62 : :
63 : : void pop_back ();
64 : :
65 : 0 : inline bool empty () const { return maObjs.empty(); }
66 : :
67 : 0 : inline size_t size () const { return maObjs.size(); }
68 : :
69 : 0 : inline iterator begin () { return maObjs.begin(); }
70 : :
71 : 0 : inline iterator end () { return maObjs.end(); }
72 : :
73 : 0 : inline XclExpMsoDrawing* GetMsodrawingPerSheet() { return pMsodrawingPerSheet; }
74 : :
75 : : /// close groups and DgContainer opened in ctor
76 : : void EndSheet();
77 : :
78 : : virtual void Save( XclExpStream& rStrm );
79 : : virtual void SaveXml( XclExpXmlStream& rStrm );
80 : :
81 : : static void ResetCounters();
82 : :
83 : : private:
84 : : static sal_Int32 mnDrawingMLCount, mnVmlCount;
85 : : SCTAB mnScTab;
86 : :
87 : : XclEscherEx& mrEscherEx;
88 : : XclExpMsoDrawing* pMsodrawingPerSheet;
89 : : XclExpMsoDrawing* pSolverContainer;
90 : :
91 : : std::vector<XclObj*> maObjs;
92 : : };
93 : :
94 : :
95 : : // --- class XclObj --------------------------------------------------
96 : :
97 : : class XclTxo;
98 : : class SdrTextObj;
99 : :
100 : : class XclObj : public XclExpRecord
101 : : {
102 : : protected:
103 : : XclEscherEx& mrEscherEx;
104 : : XclExpMsoDrawing* pMsodrawing;
105 : : XclExpMsoDrawing* pClientTextbox;
106 : : XclTxo* pTxo;
107 : : sal_uInt16 mnObjType;
108 : : sal_uInt16 nObjId;
109 : : sal_uInt16 nGrbit;
110 : : SCTAB mnScTab;
111 : : sal_Bool bFirstOnSheet;
112 : :
113 : : bool mbOwnEscher; /// true = Escher part created on the fly.
114 : :
115 : : /** @param bOwnEscher If set to true, this object will create its escher data.
116 : : See SetOwnEscher() for details. */
117 : : explicit XclObj( XclExpObjectManager& rObjMgr, sal_uInt16 nObjType, bool bOwnEscher = false );
118 : :
119 : : void ImplWriteAnchor( const XclExpRoot& rRoot, const SdrObject* pSdrObj, const Rectangle* pChildAnchor );
120 : :
121 : : // overwritten for writing MSODRAWING record
122 : : virtual void WriteBody( XclExpStream& rStrm );
123 : : virtual void WriteSubRecs( XclExpStream& rStrm );
124 : : void SaveTextRecs( XclExpStream& rStrm );
125 : :
126 : : public:
127 : : virtual ~XclObj();
128 : :
129 : 0 : inline sal_uInt16 GetObjType() const { return mnObjType; }
130 : :
131 : 0 : inline void SetId( sal_uInt16 nId ) { nObjId = nId; }
132 : : inline sal_uInt16 GetId() const { return nObjId; }
133 : :
134 : 0 : inline void SetTab( SCTAB nScTab ) { mnScTab = nScTab; }
135 : 0 : inline SCTAB GetTab() const { return mnScTab; }
136 : :
137 : 0 : inline void SetLocked( sal_Bool b )
138 [ # # ]: 0 : { b ? nGrbit |= 0x0001 : nGrbit &= ~0x0001; }
139 : 0 : inline void SetPrintable( sal_Bool b )
140 [ # # ]: 0 : { b ? nGrbit |= 0x0010 : nGrbit &= ~0x0010; }
141 : 0 : inline void SetAutoFill( sal_Bool b )
142 [ # # ]: 0 : { b ? nGrbit |= 0x2000 : nGrbit &= ~0x2000; }
143 : 0 : inline void SetAutoLine( sal_Bool b )
144 [ # # ]: 0 : { b ? nGrbit |= 0x4000 : nGrbit &= ~0x4000; }
145 : :
146 : : // set corresponding Excel object type in OBJ/ftCmo
147 : : void SetEscherShapeType( sal_uInt16 nType );
148 : 0 : inline void SetEscherShapeTypeGroup() { mnObjType = EXC_OBJTYPE_GROUP; }
149 : :
150 : : /** If set to true, this object has created its own escher data.
151 : : @descr This causes the function EscherEx::EndShape() to not post process
152 : : this object. This is used i.e. for form controls. They are not handled in
153 : : the svx base code, so the XclExpEscherOcxCtrl c'tor creates the escher data
154 : : itself. The svx base code does not receive the correct shape ID after the
155 : : EscherEx::StartShape() call, which would result in deleting the object in
156 : : EscherEx::EndShape(). */
157 : : inline void SetOwnEscher( bool bOwnEscher = true ) { mbOwnEscher = bOwnEscher; }
158 : : /** Returns true, if the object has created the escher data itself.
159 : : @descr See SetOwnEscher() for details. */
160 : 0 : inline bool IsOwnEscher() const { return mbOwnEscher; }
161 : :
162 : : //! actually writes ESCHER_ClientTextbox
163 : : void SetText( const XclExpRoot& rRoot, const SdrTextObj& rObj );
164 : :
165 : : virtual void Save( XclExpStream& rStrm );
166 : : };
167 : :
168 : : // --- class XclObjComment -------------------------------------------
169 : :
170 : : class XclObjComment : public XclObj
171 : : {
172 : : ScAddress maScPos;
173 : : std::auto_ptr< SdrCaptionObj >
174 : : mpCaption;
175 : : bool mbVisible;
176 : : Rectangle maFrom;
177 : : Rectangle maTo;
178 : :
179 : : public:
180 : : XclObjComment( XclExpObjectManager& rObjMgr,
181 : : const Rectangle& rRect, const EditTextObject& rEditObj, SdrCaptionObj* pCaption, bool bVisible, const ScAddress& rAddress, Rectangle &rFrom, Rectangle &To );
182 : : virtual ~XclObjComment();
183 : :
184 : : /** c'tor process for formatted text objects above .
185 : : @descr used to construct the MSODRAWING Escher object properties. */
186 : : void ProcessEscherObj( const XclExpRoot& rRoot,
187 : : const Rectangle& rRect, SdrObject* pCaption, bool bVisible );
188 : :
189 : :
190 : : virtual void Save( XclExpStream& rStrm );
191 : : virtual void SaveXml( XclExpXmlStream& rStrm );
192 : : };
193 : :
194 : :
195 : : // --- class XclObjDropDown ------------------------------------------
196 : :
197 : : class XclObjDropDown : public XclObj
198 : : {
199 : : private:
200 : : sal_Bool bIsFiltered;
201 : :
202 : : virtual void WriteSubRecs( XclExpStream& rStrm );
203 : :
204 : : protected:
205 : : public:
206 : : XclObjDropDown( XclExpObjectManager& rObjMgr, const ScAddress& rPos, sal_Bool bFilt );
207 : : virtual ~XclObjDropDown();
208 : : };
209 : :
210 : :
211 : : // --- class XclTxo --------------------------------------------------
212 : :
213 : : class SdrTextObj;
214 : :
215 [ # # ][ # # ]: 0 : class XclTxo : public ExcRecord
216 : : {
217 : : public:
218 : : XclTxo( const String& rString, sal_uInt16 nFontIx = EXC_FONT_APP );
219 : : XclTxo( const XclExpRoot& rRoot, const SdrTextObj& rEditObj );
220 : : XclTxo( const XclExpRoot& rRoot, const EditTextObject& rEditObj, SdrObject* pCaption );
221 : :
222 : 0 : inline void SetHorAlign( sal_uInt8 nHorAlign ) { mnHorAlign = nHorAlign; }
223 : 0 : inline void SetVerAlign( sal_uInt8 nVerAlign ) { mnVerAlign = nVerAlign; }
224 : :
225 : : virtual void Save( XclExpStream& rStrm );
226 : :
227 : : virtual sal_uInt16 GetNum() const;
228 : : virtual sal_Size GetLen() const;
229 : :
230 : : private:
231 : : virtual void SaveCont( XclExpStream& rStrm );
232 : :
233 : : private:
234 : : XclExpStringRef mpString; /// Text and formatting data.
235 : : sal_uInt16 mnRotation; /// Text rotation.
236 : : sal_uInt8 mnHorAlign; /// Horizontal alignment.
237 : : sal_uInt8 mnVerAlign; /// Vertical alignment.
238 : : };
239 : :
240 : :
241 : : // --- class XclObjOle -----------------------------------------------
242 : :
243 : : class XclObjOle : public XclObj
244 : : {
245 : : private:
246 : :
247 : : const SdrObject& rOleObj;
248 : : SotStorage* pRootStorage;
249 : :
250 : : virtual void WriteSubRecs( XclExpStream& rStrm );
251 : :
252 : : public:
253 : : XclObjOle( XclExpObjectManager& rObjMgr, const SdrObject& rObj );
254 : : virtual ~XclObjOle();
255 : :
256 : : virtual void Save( XclExpStream& rStrm );
257 : : };
258 : :
259 : :
260 : : // --- class XclObjAny -----------------------------------------------
261 : :
262 : : class XclObjAny : public XclObj
263 : : {
264 : : protected:
265 : : virtual void WriteSubRecs( XclExpStream& rStrm );
266 : :
267 : : public:
268 : : XclObjAny( XclExpObjectManager& rObjMgr,
269 : : const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rShape );
270 : : virtual ~XclObjAny();
271 : :
272 : : com::sun::star::uno::Reference< com::sun::star::drawing::XShape >
273 : 0 : GetShape() const { return mxShape; }
274 : :
275 : :
276 : : virtual void Save( XclExpStream& rStrm );
277 : : virtual void SaveXml( XclExpXmlStream& rStrm );
278 : : static void WriteFromTo( XclExpXmlStream& rStrm, const XclObjAny& rObj );
279 : : static void WriteFromTo( XclExpXmlStream& rStrm, const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rShape, SCTAB nTab );
280 : :
281 : : private:
282 : : com::sun::star::uno::Reference< com::sun::star::drawing::XShape >
283 : : mxShape;
284 : : };
285 : :
286 : :
287 : : // --- class ExcBof8_Base --------------------------------------------
288 : :
289 [ # # ]: 0 : class ExcBof8_Base : public ExcBof_Base
290 : : {
291 : : protected:
292 : : sal_uInt32 nFileHistory; // bfh
293 : : sal_uInt32 nLowestBiffVer; // sfo
294 : :
295 : : virtual void SaveCont( XclExpStream& rStrm );
296 : :
297 : : public:
298 : : ExcBof8_Base();
299 : :
300 : : virtual sal_uInt16 GetNum() const;
301 : : virtual sal_Size GetLen() const;
302 : : };
303 : :
304 : :
305 : : // --- class ExcBofW8 ------------------------------------------------
306 : : // Header Record fuer WORKBOOKS
307 : :
308 [ # # ]: 0 : class ExcBofW8 : public ExcBof8_Base
309 : : {
310 : : public:
311 : : ExcBofW8();
312 : : };
313 : :
314 : :
315 : : // --- class ExcBof8 -------------------------------------------------
316 : : // Header Record fuer WORKSHEETS
317 : :
318 [ # # ]: 0 : class ExcBof8 : public ExcBof8_Base
319 : : {
320 : : public:
321 : : ExcBof8();
322 : : };
323 : :
324 : :
325 : : // --- class ExcBundlesheet8 -----------------------------------------
326 : :
327 [ # # ][ # # ]: 0 : class ExcBundlesheet8 : public ExcBundlesheetBase
328 : : {
329 : : private:
330 : : String sUnicodeName;
331 : : XclExpString GetName() const;
332 : :
333 : : virtual void SaveCont( XclExpStream& rStrm );
334 : :
335 : : public:
336 : : ExcBundlesheet8( RootData& rRootData, SCTAB nTab );
337 : : ExcBundlesheet8( const String& rString );
338 : :
339 : : virtual sal_Size GetLen() const;
340 : :
341 : : virtual void SaveXml( XclExpXmlStream& rStrm );
342 : : };
343 : :
344 : :
345 : : // --- class XclObproj -----------------------------------------------
346 : :
347 [ # # ]: 0 : class XclObproj : public ExcRecord
348 : : {
349 : : public:
350 : : virtual sal_uInt16 GetNum() const;
351 : : virtual sal_Size GetLen() const;
352 : : };
353 : :
354 : :
355 : : // ---- class XclCodename --------------------------------------------
356 : :
357 [ # # ]: 0 : class XclCodename : public ExcRecord
358 : : {
359 : : private:
360 : : XclExpString aName;
361 : : virtual void SaveCont( XclExpStream& rStrm );
362 : : public:
363 : : XclCodename( const String& );
364 : :
365 : : virtual sal_uInt16 GetNum() const;
366 : : virtual sal_Size GetLen() const;
367 : : };
368 : :
369 : :
370 : : // ---- Scenarios ----------------------------------------------------
371 : : // - ExcEScenarioCell a cell of a scenario range
372 : : // - ExcEScenario all ranges of a scenario table
373 : : // - ExcEScenarioManager list of scenario tables
374 : :
375 : 0 : class ExcEScenarioCell
376 : : {
377 : : private:
378 : : sal_uInt16 nCol;
379 : : sal_uInt16 nRow;
380 : : XclExpString sText;
381 : :
382 : : protected:
383 : : public:
384 : : ExcEScenarioCell( sal_uInt16 nC, sal_uInt16 nR, const String& rTxt );
385 : :
386 : 0 : inline sal_Size GetStringBytes() const
387 : 0 : { return sText.GetSize(); }
388 : :
389 : : void WriteAddress( XclExpStream& rStrm ) const ;
390 : : void WriteText( XclExpStream& rStrm ) const;
391 : :
392 : : void SaveXml( XclExpXmlStream& rStrm ) const;
393 : : };
394 : :
395 : :
396 : :
397 : : class ExcEScenario : public ExcRecord
398 : : {
399 : : private:
400 : : sal_Size nRecLen;
401 : : XclExpString sName;
402 : : XclExpString sComment;
403 : : XclExpString sUserName;
404 : : sal_uInt8 nProtected;
405 : :
406 : : std::vector<ExcEScenarioCell> aCells;
407 : :
408 : : sal_Bool Append( sal_uInt16 nCol, sal_uInt16 nRow, const String& rTxt );
409 : :
410 : : virtual void SaveCont( XclExpStream& rStrm );
411 : :
412 : : protected:
413 : : public:
414 : : ExcEScenario( const XclExpRoot& rRoot, SCTAB nTab );
415 : : virtual ~ExcEScenario();
416 : :
417 : : virtual sal_uInt16 GetNum() const;
418 : : virtual sal_Size GetLen() const;
419 : :
420 : : virtual void SaveXml( XclExpXmlStream& rStrm );
421 : : };
422 : :
423 : :
424 : :
425 : : class ExcEScenarioManager : public ExcRecord
426 : : {
427 : : private:
428 : : sal_uInt16 nActive;
429 : : std::vector<ExcEScenario*> aScenes;
430 : :
431 : : virtual void SaveCont( XclExpStream& rStrm );
432 : :
433 : : protected:
434 : : public:
435 : : ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab );
436 : : virtual ~ExcEScenarioManager();
437 : :
438 : : virtual void Save( XclExpStream& rStrm );
439 : : virtual void SaveXml( XclExpXmlStream& rStrm );
440 : :
441 : : virtual sal_uInt16 GetNum() const;
442 : : virtual sal_Size GetLen() const;
443 : : };
444 : :
445 : : // ============================================================================
446 : :
447 : : /** Represents a SHEETPROTECTION record that stores sheet protection
448 : : options. Note that a sheet still needs to save its sheet protection
449 : : options even when it's not protected. */
450 [ # # ]: 0 : class XclExpSheetProtectOptions : public XclExpRecord
451 : : {
452 : : public:
453 : : explicit XclExpSheetProtectOptions( const XclExpRoot& rRoot, SCTAB nTab );
454 : :
455 : : private:
456 : : virtual void WriteBody( XclExpStream& rStrm );
457 : :
458 : : private:
459 : : sal_uInt16 mnOptions; /// Encoded sheet protection options.
460 : : };
461 : :
462 : : // ============================================================================
463 : :
464 [ # # ]: 0 : class XclCalccount : public ExcRecord
465 : : {
466 : : private:
467 : : sal_uInt16 nCount;
468 : : protected:
469 : : virtual void SaveCont( XclExpStream& rStrm );
470 : : public:
471 : : XclCalccount( const ScDocument& );
472 : :
473 : : virtual sal_uInt16 GetNum() const;
474 : : virtual sal_Size GetLen() const;
475 : :
476 : : virtual void SaveXml( XclExpXmlStream& rStrm );
477 : : };
478 : :
479 : :
480 : :
481 : :
482 [ # # ]: 0 : class XclIteration : public ExcRecord
483 : : {
484 : : private:
485 : : sal_uInt16 nIter;
486 : : protected:
487 : : virtual void SaveCont( XclExpStream& rStrm );
488 : : public:
489 : : XclIteration( const ScDocument& );
490 : :
491 : : virtual sal_uInt16 GetNum() const;
492 : : virtual sal_Size GetLen() const;
493 : :
494 : : virtual void SaveXml( XclExpXmlStream& rStrm );
495 : : };
496 : :
497 : :
498 : :
499 : :
500 [ # # ]: 0 : class XclDelta : public ExcRecord
501 : : {
502 : : private:
503 : : double fDelta;
504 : : protected:
505 : : virtual void SaveCont( XclExpStream& rStrm );
506 : : public:
507 : : XclDelta( const ScDocument& );
508 : :
509 : : virtual sal_uInt16 GetNum() const;
510 : : virtual sal_Size GetLen() const;
511 : :
512 : : virtual void SaveXml( XclExpXmlStream& rStrm );
513 : : };
514 : :
515 : :
516 : :
517 : :
518 [ # # ]: 0 : class XclRefmode : public XclExpBoolRecord
519 : : {
520 : : public:
521 : : XclRefmode( const ScDocument& );
522 : :
523 : : virtual void SaveXml( XclExpXmlStream& rStrm );
524 : : };
525 : :
526 : : // ============================================================================
527 : :
528 : : class XclExpFileEncryption : public XclExpRecord
529 : : {
530 : : public:
531 : : explicit XclExpFileEncryption( const XclExpRoot& rRoot );
532 : : virtual ~XclExpFileEncryption();
533 : :
534 : : private:
535 : : virtual void WriteBody( XclExpStream& rStrm );
536 : :
537 : : private:
538 : : const XclExpRoot& mrRoot;
539 : : };
540 : :
541 : : // ============================================================================
542 : :
543 : : /** Beginning of User Interface Records */
544 [ # # ]: 0 : class XclExpInterfaceHdr : public XclExpUInt16Record
545 : : {
546 : : public:
547 : : explicit XclExpInterfaceHdr( sal_uInt16 nCodePage );
548 : :
549 : : private:
550 : : virtual void WriteBody( XclExpStream& rStrm );
551 : : };
552 : :
553 : : // ============================================================================
554 : :
555 : : /** End of User Interface Records */
556 : : class XclExpInterfaceEnd : public XclExpRecord
557 : : {
558 : : public:
559 : : explicit XclExpInterfaceEnd();
560 : : virtual ~XclExpInterfaceEnd();
561 : :
562 : : private:
563 : : virtual void WriteBody( XclExpStream& rStrm );
564 : : };
565 : :
566 : : // ============================================================================
567 : :
568 : : /** Write Access User Name - This record contains the user name, which is
569 : : the name you type when you install Excel. */
570 : : class XclExpWriteAccess : public XclExpRecord
571 : : {
572 : : public:
573 : : explicit XclExpWriteAccess();
574 : : virtual ~XclExpWriteAccess();
575 : :
576 : : private:
577 : : virtual void WriteBody( XclExpStream& rStrm );
578 : : };
579 : :
580 : : // ============================================================================
581 : :
582 [ # # ]: 0 : class XclExpFileSharing : public XclExpRecord
583 : : {
584 : : public:
585 : : explicit XclExpFileSharing( const XclExpRoot& rRoot, sal_uInt16 nPasswordHash, bool bRecommendReadOnly );
586 : :
587 : : virtual void Save( XclExpStream& rStrm );
588 : :
589 : : private:
590 : : virtual void WriteBody( XclExpStream& rStrm );
591 : :
592 : : private:
593 : : XclExpString maUserName;
594 : : sal_uInt16 mnPasswordHash;
595 : : bool mbRecommendReadOnly;
596 : : };
597 : :
598 : : // ============================================================================
599 : :
600 : : class XclExpProt4Rev : public XclExpRecord
601 : : {
602 : : public:
603 : : explicit XclExpProt4Rev();
604 : : virtual ~XclExpProt4Rev();
605 : :
606 : : private:
607 : : virtual void WriteBody( XclExpStream& rStrm );
608 : : };
609 : :
610 : : // ============================================================================
611 : :
612 : : class XclExpProt4RevPass : public XclExpRecord
613 : : {
614 : : public:
615 : : explicit XclExpProt4RevPass();
616 : : virtual ~XclExpProt4RevPass();
617 : :
618 : : private:
619 : : virtual void WriteBody( XclExpStream& rStrm );
620 : : };
621 : :
622 : : // ============================================================================
623 : :
624 [ # # ]: 0 : class XclExpRecalcId : public XclExpDummyRecord
625 : : {
626 : : public:
627 : : explicit XclExpRecalcId();
628 : : };
629 : :
630 : : // ============================================================================
631 : :
632 [ # # ]: 0 : class XclExpBookExt : public XclExpDummyRecord
633 : : {
634 : : public:
635 : : explicit XclExpBookExt();
636 : : };
637 : :
638 : :
639 : : #endif // _XCL97REC_HXX
640 : :
641 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|