tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / sc / source / filter / inc / xcl97rec.hxx
blob57210208ddad0cbff1d3b3052ce5c0a273ea1f03
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 #pragma once
22 #include <memory>
23 #include "excrecds.hxx"
24 #include "xlescher.hxx"
25 #include "xestring.hxx"
26 #include <tabprotection.hxx>
27 #include <svx/svdobj.hxx>
28 #include <oox/export/drawingml.hxx>
30 class XclObj;
31 class XclExpMsoDrawing;
32 class SdrCaptionObj;
33 class SdrTextObj;
34 class XclTxo;
35 class XclEscherEx;
36 class SdrOle2Obj;
38 class ScURLTransformer : public oox::drawingml::URLTransformer
40 public:
41 explicit ScURLTransformer(ScDocument& rDoc);
43 virtual OUString getTransformedString(const OUString& rURL) const override;
45 virtual bool isExternalURL(const OUString& rURL) const override;
47 private:
48 ScDocument& mrDoc;
51 class XclExpObjList : public ExcEmptyRec, protected XclExpRoot
53 public:
55 typedef std::vector<std::unique_ptr<XclObj>>::iterator iterator;
57 explicit XclExpObjList( const XclExpRoot& rRoot, XclEscherEx& rEscherEx );
58 virtual ~XclExpObjList() override;
60 /// return: 1-based ObjId
61 ///! count>=0xFFFF: Obj will be deleted, return 0
62 sal_uInt16 Add( std::unique_ptr<XclObj> );
64 /**
65 * @brief Remove last element in the list.
67 std::unique_ptr<XclObj> pop_back ();
69 bool empty () const { return maObjs.empty(); }
71 size_t size () const { return maObjs.size(); }
73 iterator begin () { return maObjs.begin(); }
75 iterator end () { return maObjs.end(); }
77 XclExpMsoDrawing* GetMsodrawingPerSheet() { return pMsodrawingPerSheet.get(); }
79 /// close groups and DgContainer opened in ctor
80 void EndSheet();
82 virtual void Save( XclExpStream& rStrm ) override;
83 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
85 private:
86 SCTAB mnScTab;
88 XclEscherEx& mrEscherEx;
89 std::unique_ptr<XclExpMsoDrawing> pMsodrawingPerSheet;
90 std::unique_ptr<XclExpMsoDrawing> pSolverContainer;
92 std::vector<std::unique_ptr<XclObj>> maObjs;
95 // --- class XclObj --------------------------------------------------
97 class XclObj : public XclExpRecord
99 protected:
100 XclEscherEx& mrEscherEx;
101 XclExpMsoDrawing* pMsodrawing;
102 std::unique_ptr<XclExpMsoDrawing> pClientTextbox;
103 std::unique_ptr<XclTxo> pTxo;
104 sal_uInt16 mnObjType;
105 sal_uInt16 nObjId;
106 sal_uInt16 nGrbit;
107 SCTAB mnScTab;
108 bool bFirstOnSheet;
110 bool mbOwnEscher; /// true = Escher part created on the fly.
112 /** @param bOwnEscher If set to true, this object will create its escher data.
113 See SetOwnEscher() for details. */
114 explicit XclObj( XclExpObjectManager& rObjMgr, sal_uInt16 nObjType, bool bOwnEscher = false );
116 void ImplWriteAnchor( const SdrObject* pSdrObj, const tools::Rectangle* pChildAnchor );
118 // overwritten for writing MSODRAWING record
119 virtual void WriteBody( XclExpStream& rStrm ) override;
120 virtual void WriteSubRecs( XclExpStream& rStrm );
121 void SaveTextRecs( XclExpStream& rStrm );
123 public:
124 virtual ~XclObj() override;
126 sal_uInt16 GetObjType() const { return mnObjType; }
128 void SetId( sal_uInt16 nId ) { nObjId = nId; }
130 void SetTab( SCTAB nScTab ) { mnScTab = nScTab; }
131 SCTAB GetTab() const { return mnScTab; }
133 void SetLocked( bool b ) { SetGrBit(b, 0x0001); }
134 void SetPrintable( bool b ) { SetGrBit(b, 0x0010); }
135 void SetAutoFill( bool b ) { SetGrBit(b, 0x2000); }
136 void SetAutoLine( bool b ) { SetGrBit(b, 0x4000); }
137 void SetGrBit( bool b, int f )
139 if (b)
140 nGrbit |= f;
141 else
142 nGrbit &= ~f;
145 // set corresponding Excel object type in OBJ/ftCmo
146 void SetEscherShapeType( sal_uInt16 nType );
147 void SetEscherShapeTypeGroup() { mnObjType = EXC_OBJTYPE_GROUP; }
149 /** If set to true, this object has created its own escher data.
150 @descr This causes the function EscherEx::EndShape() to not post process
151 this object. This is used i.e. for form controls. They are not handled in
152 the svx base code, so the XclExpEscherOcxCtrl c'tor creates the escher data
153 itself. The svx base code does not receive the correct shape ID after the
154 EscherEx::StartShape() call, which would result in deleting the object in
155 EscherEx::EndShape(). */
156 /** Returns true, if the object has created the escher data itself.
157 @descr See SetOwnEscher() for details. */
158 bool IsOwnEscher() const { return mbOwnEscher; }
160 //! actually writes ESCHER_ClientTextbox
161 void SetText( const XclExpRoot& rRoot, const SdrTextObj& rObj );
163 virtual void Save( XclExpStream& rStrm ) override;
166 // --- class XclObjComment -------------------------------------------
168 class XclObjComment : public XclObj
170 ScAddress maScPos;
172 // no need to use std::unique_ptr< SdrCaptionObj >
173 SdrCaptionObj* mpCaption;
175 bool mbVisible;
176 tools::Rectangle maFrom;
177 tools::Rectangle maTo;
179 public:
180 XclObjComment( XclExpObjectManager& rObjMgr,
181 const tools::Rectangle& rRect, const EditTextObject& rEditObj, SdrCaptionObj* pCaption, bool bVisible, const ScAddress& rAddress, const tools::Rectangle &rFrom, const tools::Rectangle &To );
182 virtual ~XclObjComment() override;
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 tools::Rectangle& rRect, SdrObject* pCaption, bool bVisible );
189 virtual void Save( XclExpStream& rStrm ) override;
190 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
193 // --- class XclObjDropDown ------------------------------------------
195 class XclObjDropDown : public XclObj
197 private:
198 bool bIsFiltered;
200 virtual void WriteSubRecs( XclExpStream& rStrm ) override;
202 protected:
203 public:
204 XclObjDropDown( XclExpObjectManager& rObjMgr, const ScAddress& rPos, bool bFilt );
205 virtual ~XclObjDropDown() override;
208 // --- class XclTxo --------------------------------------------------
210 class XclTxo : public ExcRecord
212 public:
213 XclTxo( const OUString& rString, sal_uInt16 nFontIx );
214 XclTxo( const XclExpRoot& rRoot, const SdrTextObj& rEditObj );
215 XclTxo( const XclExpRoot& rRoot, const EditTextObject& rEditObj, SdrObject* pCaption );
217 void SetHorAlign( sal_uInt8 nHorAlign ) { mnHorAlign = nHorAlign; }
218 void SetVerAlign( sal_uInt8 nVerAlign ) { mnVerAlign = nVerAlign; }
220 virtual void Save( XclExpStream& rStrm ) override;
222 virtual sal_uInt16 GetNum() const override;
223 virtual std::size_t GetLen() const override;
225 private:
226 virtual void SaveCont( XclExpStream& rStrm ) override;
228 private:
229 XclExpStringRef mpString; /// Text and formatting data.
230 sal_uInt16 mnRotation; /// Text rotation.
231 sal_uInt8 mnHorAlign; /// Horizontal alignment.
232 sal_uInt8 mnVerAlign; /// Vertical alignment.
235 // --- class XclObjOle -----------------------------------------------
237 class XclObjOle : public XclObj
239 private:
241 const SdrOle2Obj& rOleObj;
242 SotStorage* pRootStorage;
244 virtual void WriteSubRecs( XclExpStream& rStrm ) override;
246 public:
247 XclObjOle( XclExpObjectManager& rObjMgr, const SdrOle2Obj& rObj );
248 virtual ~XclObjOle() override;
250 virtual void Save( XclExpStream& rStrm ) override;
253 // --- class XclObjAny -----------------------------------------------
255 class XclObjAny : public XclObj
257 protected:
258 virtual void WriteSubRecs( XclExpStream& rStrm ) override;
260 public:
261 XclObjAny( XclExpObjectManager& rObjMgr,
262 const css::uno::Reference< css::drawing::XShape >& rShape,
263 ScDocument* pDoc);
264 virtual ~XclObjAny() override;
266 const css::uno::Reference< css::drawing::XShape >&
267 GetShape() const { return mxShape; }
269 virtual void Save( XclExpStream& rStrm ) override;
270 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
271 static void WriteFromTo( XclExpXmlStream& rStrm, const XclObjAny& rObj );
272 static void WriteFromTo( XclExpXmlStream& rStrm, const css::uno::Reference< css::drawing::XShape >& rShape, SCTAB nTab );
274 private:
275 css::uno::Reference< css::drawing::XShape >
276 mxShape;
277 ScDocument* mpDoc;
280 // --- class ExcBof8_Base --------------------------------------------
282 class ExcBof8_Base : public ExcBof_Base
284 protected:
285 virtual void SaveCont( XclExpStream& rStrm ) override;
287 public:
288 ExcBof8_Base();
290 virtual sal_uInt16 GetNum() const override;
291 virtual std::size_t GetLen() const override;
294 // --- class ExcBofW8 ------------------------------------------------
295 // Header Record for WORKBOOKS
297 class ExcBofW8 : public ExcBof8_Base
299 public:
300 ExcBofW8();
303 // --- class ExcBof8 -------------------------------------------------
304 // Header Record for WORKSHEETS
306 class ExcBof8 : public ExcBof8_Base
308 public:
309 ExcBof8();
312 // --- class ExcBundlesheet8 -----------------------------------------
314 class ExcBundlesheet8 : public ExcBundlesheetBase
316 private:
317 OUString sUnicodeName;
318 XclExpString GetName() const { return XclExpString( sUnicodeName, XclStrFlags::EightBitLength );}
320 virtual void SaveCont( XclExpStream& rStrm ) override;
322 public:
323 ExcBundlesheet8( const RootData& rRootData, SCTAB nTab );
324 ExcBundlesheet8( OUString aString );
326 virtual std::size_t GetLen() const override;
328 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
331 // --- class XclObproj -----------------------------------------------
333 class XclObproj : public ExcRecord
335 public:
336 virtual sal_uInt16 GetNum() const override;
337 virtual std::size_t GetLen() const override;
340 // ---- class XclCodename --------------------------------------------
342 class XclCodename : public ExcRecord
344 private:
345 XclExpString aName;
346 virtual void SaveCont( XclExpStream& rStrm ) override;
347 public:
348 XclCodename( const OUString& );
350 virtual sal_uInt16 GetNum() const override;
351 virtual std::size_t GetLen() const override;
354 // ---- Scenarios ----------------------------------------------------
355 // - ExcEScenarioCell a cell of a scenario range
356 // - ExcEScenario all ranges of a scenario table
357 // - ExcEScenarioManager list of scenario tables
359 class ExcEScenarioCell
361 private:
362 sal_uInt16 nCol;
363 sal_uInt16 nRow;
364 XclExpString sText;
366 protected:
367 public:
368 ExcEScenarioCell( sal_uInt16 nC, sal_uInt16 nR, const OUString& rTxt );
370 std::size_t GetStringBytes() const
371 { return sText.GetSize(); }
373 void WriteAddress( XclExpStream& rStrm ) const ;
374 void WriteText( XclExpStream& rStrm ) const;
376 void SaveXml( XclExpXmlStream& rStrm ) const;
379 class ExcEScenario : public ExcRecord
381 private:
382 std::size_t nRecLen;
383 XclExpString sName;
384 XclExpString sComment;
385 XclExpString sUserName;
386 bool bProtected;
388 std::vector<ExcEScenarioCell> aCells;
390 bool Append( sal_uInt16 nCol, sal_uInt16 nRow, const OUString& rTxt );
392 virtual void SaveCont( XclExpStream& rStrm ) override;
394 protected:
395 public:
396 ExcEScenario( const XclExpRoot& rRoot, SCTAB nTab );
398 virtual sal_uInt16 GetNum() const override;
399 virtual std::size_t GetLen() const override;
401 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
404 class ExcEScenarioManager : public ExcRecord
406 private:
407 sal_uInt16 nActive;
408 std::vector<ExcEScenario> aScenes;
410 virtual void SaveCont( XclExpStream& rStrm ) override;
412 protected:
413 public:
414 ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab );
415 virtual ~ExcEScenarioManager() override;
417 virtual void Save( XclExpStream& rStrm ) override;
418 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
420 virtual sal_uInt16 GetNum() const override;
421 virtual std::size_t GetLen() const override;
424 /** Represents a FEATHDR (SHEETPROTECTION) record that stores sheet protection
425 options. Note that a sheet still needs to save its sheet protection
426 options even when it's not protected. */
427 class XclExpSheetProtectOptions : public XclExpRecord
429 public:
430 explicit XclExpSheetProtectOptions( const XclExpRoot& rRoot, SCTAB nTab );
432 private:
433 virtual void WriteBody( XclExpStream& rStrm ) override;
435 private:
436 sal_uInt16 mnOptions; /// Encoded sheet protection options.
439 /** Represents one EnhancedProtection feature in a FEAT record.
440 To be written only if such feature exists. */
441 class XclExpSheetEnhancedProtection : public XclExpRecord
443 public:
444 explicit XclExpSheetEnhancedProtection( const XclExpRoot& rRoot, ScEnhancedProtection aProt );
446 private:
447 virtual void WriteBody( XclExpStream& rStrm ) override;
449 private:
450 const XclExpRoot& mrRoot;
451 ScEnhancedProtection maEnhancedProtection;
454 class XclCalccount : public ExcRecord
456 private:
457 sal_uInt16 nCount;
458 protected:
459 virtual void SaveCont( XclExpStream& rStrm ) override;
460 public:
461 XclCalccount( const ScDocument& );
463 virtual sal_uInt16 GetNum() const override;
464 virtual std::size_t GetLen() const override;
466 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
469 class XclIteration : public ExcRecord
471 private:
472 sal_uInt16 nIter;
473 protected:
474 virtual void SaveCont( XclExpStream& rStrm ) override;
475 public:
476 XclIteration( const ScDocument& );
478 virtual sal_uInt16 GetNum() const override;
479 virtual std::size_t GetLen() const override;
481 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
484 class XclDelta : public ExcRecord
486 private:
487 double fDelta;
488 protected:
489 virtual void SaveCont( XclExpStream& rStrm ) override;
490 public:
491 XclDelta( const ScDocument& );
493 virtual sal_uInt16 GetNum() const override;
494 virtual std::size_t GetLen() const override;
496 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
499 class XclRefmode : public XclExpBoolRecord
501 public:
502 XclRefmode( const ScDocument& );
504 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
507 class XclExpFileEncryption : public XclExpRecord
509 public:
510 explicit XclExpFileEncryption( const XclExpRoot& rRoot );
511 virtual ~XclExpFileEncryption() override;
513 private:
514 virtual void WriteBody( XclExpStream& rStrm ) override;
516 private:
517 const XclExpRoot& mrRoot;
520 /** Beginning of User Interface Records */
521 class XclExpInterfaceHdr : public XclExpUInt16Record
523 public:
524 explicit XclExpInterfaceHdr( sal_uInt16 nCodePage );
526 private:
527 virtual void WriteBody( XclExpStream& rStrm ) override;
530 /** End of User Interface Records */
531 class XclExpInterfaceEnd : public XclExpRecord
533 public:
534 explicit XclExpInterfaceEnd();
535 virtual ~XclExpInterfaceEnd() override;
537 private:
538 virtual void WriteBody( XclExpStream& rStrm ) override;
541 /** Write Access User Name - This record contains the user name, which is
542 the name you type when you install Excel. */
543 class XclExpWriteAccess : public XclExpRecord
545 public:
546 explicit XclExpWriteAccess();
547 virtual ~XclExpWriteAccess() override;
549 private:
550 virtual void WriteBody( XclExpStream& rStrm ) override;
553 class XclExpFileSharing : public XclExpRecord
555 public:
556 explicit XclExpFileSharing( const XclExpRoot& rRoot, sal_uInt16 nPasswordHash, bool bRecommendReadOnly );
558 virtual void Save( XclExpStream& rStrm ) override;
560 private:
561 virtual void WriteBody( XclExpStream& rStrm ) override;
563 private:
564 XclExpString maUserName;
565 sal_uInt16 mnPasswordHash;
566 bool mbRecommendReadOnly;
569 class XclExpProt4Rev : public XclExpRecord
571 public:
572 explicit XclExpProt4Rev();
573 virtual ~XclExpProt4Rev() override;
575 private:
576 virtual void WriteBody( XclExpStream& rStrm ) override;
579 class XclExpProt4RevPass : public XclExpRecord
581 public:
582 explicit XclExpProt4RevPass();
583 virtual ~XclExpProt4RevPass() override;
585 private:
586 virtual void WriteBody( XclExpStream& rStrm ) override;
589 class XclExpRecalcId : public XclExpDummyRecord
591 public:
592 explicit XclExpRecalcId();
595 class XclExpBookExt : public XclExpDummyRecord
597 public:
598 explicit XclExpBookExt();
601 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */