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