Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / sc / source / filter / inc / xcl97rec.hxx
blobb2a7f5621e2d30eb69ed986ebf12007c6dd418fa
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_XCL97REC_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_XCL97REC_HXX
23 #include "excrecds.hxx"
24 #include "xcl97esc.hxx"
25 #include "xlstyle.hxx"
26 #include "tabprotection.hxx"
28 class XclObj;
29 class XclExpMsoDrawing;
30 class SdrCaptionObj;
32 class XclExpObjList : public ExcEmptyRec, protected XclExpRoot
34 public:
36 typedef std::vector<XclObj*>::iterator iterator;
38 explicit XclExpObjList( const XclExpRoot& rRoot, XclEscherEx& rEscherEx );
39 virtual ~XclExpObjList();
41 /// return: 1-based ObjId
42 ///! count>=0xFFFF: Obj will be deleted, return 0
43 sal_uInt16 Add( XclObj* );
45 XclObj* back () { return maObjs.empty() ? nullptr : maObjs.back(); }
47 /**
49 * @brief Remove last element in the list.
53 void pop_back ();
55 inline bool empty () const { return maObjs.empty(); }
57 inline size_t size () const { return maObjs.size(); }
59 inline iterator begin () { return maObjs.begin(); }
61 inline iterator end () { return maObjs.end(); }
63 inline XclExpMsoDrawing* GetMsodrawingPerSheet() { return pMsodrawingPerSheet; }
65 /// close groups and DgContainer opened in ctor
66 void EndSheet();
68 virtual void Save( XclExpStream& rStrm ) override;
69 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
71 static void ResetCounters();
73 private:
74 static sal_Int32 mnDrawingMLCount, mnVmlCount;
75 SCTAB mnScTab;
77 XclEscherEx& mrEscherEx;
78 XclExpMsoDrawing* pMsodrawingPerSheet;
79 XclExpMsoDrawing* pSolverContainer;
81 std::vector<XclObj*> maObjs;
84 // --- class XclObj --------------------------------------------------
86 class XclTxo;
87 class SdrTextObj;
89 class XclObj : public XclExpRecord
91 protected:
92 XclEscherEx& mrEscherEx;
93 XclExpMsoDrawing* pMsodrawing;
94 XclExpMsoDrawing* pClientTextbox;
95 XclTxo* pTxo;
96 sal_uInt16 mnObjType;
97 sal_uInt16 nObjId;
98 sal_uInt16 nGrbit;
99 SCTAB mnScTab;
100 bool bFirstOnSheet;
102 bool mbOwnEscher; /// true = Escher part created on the fly.
104 /** @param bOwnEscher If set to true, this object will create its escher data.
105 See SetOwnEscher() for details. */
106 explicit XclObj( XclExpObjectManager& rObjMgr, sal_uInt16 nObjType, bool bOwnEscher = false );
108 void ImplWriteAnchor( const XclExpRoot& rRoot, const SdrObject* pSdrObj, const Rectangle* pChildAnchor );
110 // overwritten for writing MSODRAWING record
111 virtual void WriteBody( XclExpStream& rStrm ) override;
112 virtual void WriteSubRecs( XclExpStream& rStrm );
113 void SaveTextRecs( XclExpStream& rStrm );
115 public:
116 virtual ~XclObj();
118 inline sal_uInt16 GetObjType() const { return mnObjType; }
120 inline void SetId( sal_uInt16 nId ) { nObjId = nId; }
122 inline void SetTab( SCTAB nScTab ) { mnScTab = nScTab; }
123 inline SCTAB GetTab() const { return mnScTab; }
125 inline void SetLocked( bool b )
126 { b ? nGrbit |= 0x0001 : nGrbit &= ~0x0001; }
127 inline void SetPrintable( bool b )
128 { b ? nGrbit |= 0x0010 : nGrbit &= ~0x0010; }
129 inline void SetAutoFill( bool b )
130 { b ? nGrbit |= 0x2000 : nGrbit &= ~0x2000; }
131 inline void SetAutoLine( bool b )
132 { b ? nGrbit |= 0x4000 : nGrbit &= ~0x4000; }
134 // set corresponding Excel object type in OBJ/ftCmo
135 void SetEscherShapeType( sal_uInt16 nType );
136 inline void SetEscherShapeTypeGroup() { mnObjType = EXC_OBJTYPE_GROUP; }
138 /** If set to true, this object has created its own escher data.
139 @descr This causes the function EscherEx::EndShape() to not post process
140 this object. This is used i.e. for form controls. They are not handled in
141 the svx base code, so the XclExpEscherOcxCtrl c'tor creates the escher data
142 itself. The svx base code does not receive the correct shape ID after the
143 EscherEx::StartShape() call, which would result in deleting the object in
144 EscherEx::EndShape(). */
145 /** Returns true, if the object has created the escher data itself.
146 @descr See SetOwnEscher() for details. */
147 inline bool IsOwnEscher() const { return mbOwnEscher; }
149 //! actually writes ESCHER_ClientTextbox
150 void SetText( const XclExpRoot& rRoot, const SdrTextObj& rObj );
152 virtual void Save( XclExpStream& rStrm ) override;
155 // --- class XclObjComment -------------------------------------------
157 class XclObjComment : public XclObj
159 ScAddress maScPos;
160 std::unique_ptr< SdrCaptionObj >
161 mpCaption;
162 bool mbVisible;
163 Rectangle maFrom;
164 Rectangle maTo;
166 public:
167 XclObjComment( XclExpObjectManager& rObjMgr,
168 const Rectangle& rRect, const EditTextObject& rEditObj, SdrCaptionObj* pCaption, bool bVisible, const ScAddress& rAddress, Rectangle &rFrom, Rectangle &To );
169 virtual ~XclObjComment();
171 /** c'tor process for formatted text objects above .
172 @descr used to construct the MSODRAWING Escher object properties. */
173 void ProcessEscherObj( const XclExpRoot& rRoot,
174 const Rectangle& rRect, SdrObject* pCaption, bool bVisible );
176 virtual void Save( XclExpStream& rStrm ) override;
177 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
180 // --- class XclObjDropDown ------------------------------------------
182 class XclObjDropDown : public XclObj
184 private:
185 bool bIsFiltered;
187 virtual void WriteSubRecs( XclExpStream& rStrm ) override;
189 protected:
190 public:
191 XclObjDropDown( XclExpObjectManager& rObjMgr, const ScAddress& rPos, bool bFilt );
192 virtual ~XclObjDropDown();
195 // --- class XclTxo --------------------------------------------------
197 class SdrTextObj;
199 class XclTxo : public ExcRecord
201 public:
202 XclTxo( const OUString& rString, sal_uInt16 nFontIx = EXC_FONT_APP );
203 XclTxo( const XclExpRoot& rRoot, const SdrTextObj& rEditObj );
204 XclTxo( const XclExpRoot& rRoot, const EditTextObject& rEditObj, SdrObject* pCaption );
206 inline void SetHorAlign( sal_uInt8 nHorAlign ) { mnHorAlign = nHorAlign; }
207 inline void SetVerAlign( sal_uInt8 nVerAlign ) { mnVerAlign = nVerAlign; }
209 virtual void Save( XclExpStream& rStrm ) override;
211 virtual sal_uInt16 GetNum() const override;
212 virtual sal_Size GetLen() const override;
214 private:
215 virtual void SaveCont( XclExpStream& rStrm ) override;
217 private:
218 XclExpStringRef mpString; /// Text and formatting data.
219 sal_uInt16 mnRotation; /// Text rotation.
220 sal_uInt8 mnHorAlign; /// Horizontal alignment.
221 sal_uInt8 mnVerAlign; /// Vertical alignment.
224 // --- class XclObjOle -----------------------------------------------
226 class XclObjOle : public XclObj
228 private:
230 const SdrObject& rOleObj;
231 SotStorage* pRootStorage;
233 virtual void WriteSubRecs( XclExpStream& rStrm ) override;
235 public:
236 XclObjOle( XclExpObjectManager& rObjMgr, const SdrObject& rObj );
237 virtual ~XclObjOle();
239 virtual void Save( XclExpStream& rStrm ) override;
242 // --- class XclObjAny -----------------------------------------------
244 class XclObjAny : public XclObj
246 protected:
247 virtual void WriteSubRecs( XclExpStream& rStrm ) override;
249 public:
250 XclObjAny( XclExpObjectManager& rObjMgr,
251 const css::uno::Reference< css::drawing::XShape >& rShape,
252 ScDocument* pDoc);
253 virtual ~XclObjAny();
255 const css::uno::Reference< css::drawing::XShape >&
256 GetShape() const { return mxShape; }
258 virtual void Save( XclExpStream& rStrm ) override;
259 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
260 static void WriteFromTo( XclExpXmlStream& rStrm, const XclObjAny& rObj );
261 static void WriteFromTo( XclExpXmlStream& rStrm, const css::uno::Reference< css::drawing::XShape >& rShape, SCTAB nTab );
263 private:
264 css::uno::Reference< css::drawing::XShape >
265 mxShape;
266 ScDocument* mpDoc;
269 // --- class ExcBof8_Base --------------------------------------------
271 class ExcBof8_Base : public ExcBof_Base
273 protected:
274 sal_uInt32 nFileHistory; // bfh
275 sal_uInt32 nLowestBiffVer; // sfo
277 virtual void SaveCont( XclExpStream& rStrm ) override;
279 public:
280 ExcBof8_Base();
282 virtual sal_uInt16 GetNum() const override;
283 virtual sal_Size GetLen() const override;
286 // --- class ExcBofW8 ------------------------------------------------
287 // Header Record fuer WORKBOOKS
289 class ExcBofW8 : public ExcBof8_Base
291 public:
292 ExcBofW8();
295 // --- class ExcBof8 -------------------------------------------------
296 // Header Record fuer WORKSHEETS
298 class ExcBof8 : public ExcBof8_Base
300 public:
301 ExcBof8();
304 // --- class ExcBundlesheet8 -----------------------------------------
306 class ExcBundlesheet8 : public ExcBundlesheetBase
308 private:
309 OUString sUnicodeName;
310 XclExpString GetName() const { return XclExpString( sUnicodeName, EXC_STR_8BITLENGTH );}
312 virtual void SaveCont( XclExpStream& rStrm ) override;
314 public:
315 ExcBundlesheet8( RootData& rRootData, SCTAB nTab );
316 ExcBundlesheet8( const OUString& rString );
318 virtual sal_Size GetLen() const override;
320 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
323 // --- class XclObproj -----------------------------------------------
325 class XclObproj : public ExcRecord
327 public:
328 virtual sal_uInt16 GetNum() const override;
329 virtual sal_Size GetLen() const override;
332 // ---- class XclCodename --------------------------------------------
334 class XclCodename : public ExcRecord
336 private:
337 XclExpString aName;
338 virtual void SaveCont( XclExpStream& rStrm ) override;
339 public:
340 XclCodename( const OUString& );
342 virtual sal_uInt16 GetNum() const override;
343 virtual sal_Size GetLen() const override;
346 // ---- Scenarios ----------------------------------------------------
347 // - ExcEScenarioCell a cell of a scenario range
348 // - ExcEScenario all ranges of a scenario table
349 // - ExcEScenarioManager list of scenario tables
351 class ExcEScenarioCell
353 private:
354 sal_uInt16 nCol;
355 sal_uInt16 nRow;
356 XclExpString sText;
358 protected:
359 public:
360 ExcEScenarioCell( sal_uInt16 nC, sal_uInt16 nR, const OUString& rTxt );
362 inline sal_Size GetStringBytes() const
363 { return sText.GetSize(); }
365 void WriteAddress( XclExpStream& rStrm ) const ;
366 void WriteText( XclExpStream& rStrm ) const;
368 void SaveXml( XclExpXmlStream& rStrm ) const;
371 class ExcEScenario : public ExcRecord
373 private:
374 sal_Size nRecLen;
375 XclExpString sName;
376 XclExpString sComment;
377 XclExpString sUserName;
378 bool bProtected;
380 std::vector<ExcEScenarioCell> aCells;
382 bool Append( sal_uInt16 nCol, sal_uInt16 nRow, const OUString& rTxt );
384 virtual void SaveCont( XclExpStream& rStrm ) override;
386 protected:
387 public:
388 ExcEScenario( const XclExpRoot& rRoot, SCTAB nTab );
389 virtual ~ExcEScenario();
391 virtual sal_uInt16 GetNum() const override;
392 virtual sal_Size GetLen() const override;
394 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
397 class ExcEScenarioManager : public ExcRecord
399 private:
400 sal_uInt16 nActive;
401 std::vector<ExcEScenario*> aScenes;
403 virtual void SaveCont( XclExpStream& rStrm ) override;
405 protected:
406 public:
407 ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab );
408 virtual ~ExcEScenarioManager();
410 virtual void Save( XclExpStream& rStrm ) override;
411 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
413 virtual sal_uInt16 GetNum() const override;
414 virtual sal_Size GetLen() const override;
417 /** Represents a FEATHDR (SHEETPROTECTION) record that stores sheet protection
418 options. Note that a sheet still needs to save its sheet protection
419 options even when it's not protected. */
420 class XclExpSheetProtectOptions : public XclExpRecord
422 public:
423 explicit XclExpSheetProtectOptions( const XclExpRoot& rRoot, SCTAB nTab );
425 private:
426 virtual void WriteBody( XclExpStream& rStrm ) override;
428 private:
429 sal_uInt16 mnOptions; /// Encoded sheet protection options.
432 /** Represents one EnhancedProtection feature in a FEAT record.
433 To be written only if such feature exists. */
434 class XclExpSheetEnhancedProtection : public XclExpRecord
436 public:
437 explicit XclExpSheetEnhancedProtection( const XclExpRoot& rRoot, const ScEnhancedProtection& rProt );
439 private:
440 virtual void WriteBody( XclExpStream& rStrm ) override;
442 private:
443 const XclExpRoot& mrRoot;
444 ScEnhancedProtection maEnhancedProtection;
447 class XclCalccount : public ExcRecord
449 private:
450 sal_uInt16 nCount;
451 protected:
452 virtual void SaveCont( XclExpStream& rStrm ) override;
453 public:
454 XclCalccount( const ScDocument& );
456 virtual sal_uInt16 GetNum() const override;
457 virtual sal_Size GetLen() const override;
459 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
462 class XclIteration : public ExcRecord
464 private:
465 sal_uInt16 nIter;
466 protected:
467 virtual void SaveCont( XclExpStream& rStrm ) override;
468 public:
469 XclIteration( const ScDocument& );
471 virtual sal_uInt16 GetNum() const override;
472 virtual sal_Size GetLen() const override;
474 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
477 class XclDelta : public ExcRecord
479 private:
480 double fDelta;
481 protected:
482 virtual void SaveCont( XclExpStream& rStrm ) override;
483 public:
484 XclDelta( const ScDocument& );
486 virtual sal_uInt16 GetNum() const override;
487 virtual sal_Size GetLen() const override;
489 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
492 class XclRefmode : public XclExpBoolRecord
494 public:
495 XclRefmode( const ScDocument& );
497 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
500 class XclExpFileEncryption : public XclExpRecord
502 public:
503 explicit XclExpFileEncryption( const XclExpRoot& rRoot );
504 virtual ~XclExpFileEncryption();
506 private:
507 virtual void WriteBody( XclExpStream& rStrm ) override;
509 private:
510 const XclExpRoot& mrRoot;
513 /** Beginning of User Interface Records */
514 class XclExpInterfaceHdr : public XclExpUInt16Record
516 public:
517 explicit XclExpInterfaceHdr( sal_uInt16 nCodePage );
519 private:
520 virtual void WriteBody( XclExpStream& rStrm ) override;
523 /** End of User Interface Records */
524 class XclExpInterfaceEnd : public XclExpRecord
526 public:
527 explicit XclExpInterfaceEnd();
528 virtual ~XclExpInterfaceEnd();
530 private:
531 virtual void WriteBody( XclExpStream& rStrm ) override;
534 /** Write Access User Name - This record contains the user name, which is
535 the name you type when you install Excel. */
536 class XclExpWriteAccess : public XclExpRecord
538 public:
539 explicit XclExpWriteAccess();
540 virtual ~XclExpWriteAccess();
542 private:
543 virtual void WriteBody( XclExpStream& rStrm ) override;
546 class XclExpFileSharing : public XclExpRecord
548 public:
549 explicit XclExpFileSharing( const XclExpRoot& rRoot, sal_uInt16 nPasswordHash, bool bRecommendReadOnly );
551 virtual void Save( XclExpStream& rStrm ) override;
553 private:
554 virtual void WriteBody( XclExpStream& rStrm ) override;
556 private:
557 XclExpString maUserName;
558 sal_uInt16 mnPasswordHash;
559 bool mbRecommendReadOnly;
562 class XclExpProt4Rev : public XclExpRecord
564 public:
565 explicit XclExpProt4Rev();
566 virtual ~XclExpProt4Rev();
568 private:
569 virtual void WriteBody( XclExpStream& rStrm ) override;
572 class XclExpProt4RevPass : public XclExpRecord
574 public:
575 explicit XclExpProt4RevPass();
576 virtual ~XclExpProt4RevPass();
578 private:
579 virtual void WriteBody( XclExpStream& rStrm ) override;
582 class XclExpRecalcId : public XclExpDummyRecord
584 public:
585 explicit XclExpRecalcId();
588 class XclExpBookExt : public XclExpDummyRecord
590 public:
591 explicit XclExpBookExt();
594 #endif // _XCL97REC_HXX
596 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */