Update ooo320-m1
[ooovba.git] / sc / source / filter / inc / xcl97esc.hxx
blob67a6e3fec44e640b5c7a8ecde6ae9cb3405a2b54
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: xcl97esc.hxx,v $
10 * $Revision: 1.13.14.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_XCL97ESC_HXX
32 #define SC_XCL97ESC_HXX
34 #include <svx/escherex.hxx>
35 #include <tools/table.hxx>
36 #include <tools/stack.hxx>
37 #include "xlescher.hxx"
38 #include "xeroot.hxx"
40 // 0 = Export TBX form controls, 1 = Export OCX form controls.
41 #define EXC_EXP_OCX_CTRL 0
43 namespace utl { class TempFile; }
45 // --- class XclEscherEx ---------------------------------------------
47 class SvStream;
48 class XclObj;
49 class XclEscherHostAppData;
50 class XclEscherClientData;
51 class XclEscherClientTextbox;
52 #if EXC_EXP_OCX_CTRL
53 class XclExpOcxControlObj;
54 #else
55 class XclExpTbxControlObj;
56 #endif
57 class XclExpShapeObj;
58 class EscherExHostAppData;
59 class ShapeInteractionHelper
61 public:
62 static XclExpShapeObj* CreateShapeObj(const XclExpRoot& rRoot, const ::com::sun::star::uno::Reference<
63 ::com::sun::star::drawing::XShape >& xShape );
64 static void PopulateShapeInteractionInfo( const XclExpRoot& rRoot, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, EscherExHostAppData& rHostAppData );
67 class XclEscherEx : public EscherEx, protected XclExpRoot
69 private:
70 List aOffsetMap;
71 Stack aStack;
72 utl::TempFile* pPicTempFile;
73 SvStream* pPicStrm;
74 XclObj* pCurrXclObj;
75 XclEscherHostAppData* pCurrAppData;
76 XclEscherClientData* pTheClientData; // always the same
77 XclEscherClientTextbox* pAdditionalText;
78 USHORT nAdditionalText;
80 void DeleteCurrAppData();
82 public:
83 XclEscherEx( const XclExpRoot& rRoot, SvStream& rStrm, UINT32 nDrawings );
84 virtual ~XclEscherEx();
86 /// maintains OffsetMap
87 virtual void InsertAtCurrentPos( UINT32 nBytes, BOOL bCont = FALSE );
89 virtual SvStream* QueryPicStream();
90 virtual EscherExHostAppData* StartShape( const com::sun::star::uno::Reference<
91 com::sun::star::drawing::XShape>& rShape );
92 virtual void EndShape( UINT16 nShapeType, UINT32 nShapeID );
93 virtual EscherExHostAppData* EnterAdditionalTextGroup();
95 /// appends stream offset to list and returns position in list
96 ULONG AddCurrentOffsetToMap();
97 /// replaces position in list with current stream offset
98 void ReplaceCurrentOffsetInMap( ULONG nPos );
99 /// returns stream offset for position in list
100 inline ULONG GetOffsetFromMap( ULONG nPos ) const;
101 /// last position in list (count-1)
102 inline ULONG GetLastOffsetMapPos() const;
104 /// Flush and merge PicStream into EscherStream
105 void EndDocument();
107 #if EXC_EXP_OCX_CTRL
108 /** Creates an OCX form control OBJ record from the passed form control.
109 @descr Writes the form control data to the 'Ctls' stream. */
110 XclExpOcxControlObj* CreateCtrlObj( ::com::sun::star::uno::Reference<
111 ::com::sun::star::drawing::XShape > xShape );
113 private:
114 SotStorageStreamRef mxCtlsStrm; /// The 'Ctls' stream.
115 #else
116 /** Creates a TBX form control OBJ record from the passed form control. */
117 XclExpTbxControlObj* CreateCtrlObj( ::com::sun::star::uno::Reference<
118 ::com::sun::star::drawing::XShape > xShape );
120 private:
121 /** Tries to get the name of a Basic macro from a control. */
122 void ConvertTbxMacro(
123 XclExpTbxControlObj& rTbxCtrlObj,
124 ::com::sun::star::uno::Reference<
125 ::com::sun::star::awt::XControlModel > xCtrlModel );
126 #endif
130 inline ULONG XclEscherEx::GetOffsetFromMap( ULONG nPos ) const
132 return (ULONG) aOffsetMap.GetObject( nPos );
136 inline ULONG XclEscherEx::GetLastOffsetMapPos() const
138 return aOffsetMap.Count() - 1;
142 // --- class XclEscher -----------------------------------------------
144 struct RootData;
146 class XclEscher : protected XclExpRoot
148 private:
149 utl::TempFile* pTempFile;
150 SvStream* pStrm;
151 XclEscherEx* pEx;
153 public:
154 XclEscher( const XclExpRoot& rRoot, UINT32 nDrawings );
155 ~XclEscher();
157 inline XclEscherEx* GetEx() const { return pEx; }
158 inline SvStream& GetStrm() const { return *pStrm; }
160 void AddSdrPage();
164 // --- class XclEscherHostAppData ------------------------------------
166 class XclEscherHostAppData : public EscherExHostAppData
168 private:
169 BOOL bStackedGroup;
171 public:
172 XclEscherHostAppData() : bStackedGroup( FALSE )
174 inline void SetStackedGroup( BOOL b ) { bStackedGroup = b; }
175 inline BOOL IsStackedGroup() const { return bStackedGroup; }
179 // DFF client anchor ==========================================================
181 class Rectangle;
182 class SdrObject;
183 class ScAddress;
185 /** Represents the position (anchor) of an object in a Calc document. */
186 class XclExpDffAnchor : public EscherExClientAnchor_Base, protected XclExpRoot
188 public:
189 /** Constructs a dummy client anchor. */
190 explicit XclExpDffAnchor( const XclExpRoot& rRoot, sal_uInt16 nFlags = 0 );
191 /** Constructs a client anchor directly from an SdrObject. */
192 explicit XclExpDffAnchor( const XclExpRoot& rRoot, const SdrObject& rSdrObj );
194 /** Sets the flags according to the passed SdrObject. */
195 void SetFlags( const SdrObject& rSdrObj );
197 /** Called from SVX Escher exporter.
198 @param rRect The object anchor rectangle to be exported (in twips). */
199 virtual void WriteData( EscherEx& rEx, const Rectangle& rRect );
201 /** Writes the anchor structure with the current anchor position. */
202 void WriteData( EscherEx& rEx ) const;
204 protected: // for access in derived classes
205 XclObjAnchor maAnchor; /// The client anchor data.
206 sal_uInt16 mnFlags; /// Flags for DFF stream export.
209 // ----------------------------------------------------------------------------
211 /** Represents the position (anchor) of a note object. */
212 class XclExpDffNoteAnchor : public XclExpDffAnchor
214 public:
215 explicit XclExpDffNoteAnchor( const XclExpRoot& rRoot, const Rectangle& rRect );
219 // ----------------------------------------------------------------------------
221 /** Represents the position (anchor) of a cell dropdown object. */
222 class XclExpDffDropDownAnchor : public XclExpDffAnchor
224 public:
225 explicit XclExpDffDropDownAnchor( const XclExpRoot& rRoot, const ScAddress& rScPos );
229 // ============================================================================
231 // --- class XclEscherClientData -------------------------------------
233 class XclEscherClientData : public EscherExClientRecord_Base
235 public:
236 XclEscherClientData() {}
237 virtual void WriteData( EscherEx& rEx ) const;
241 // --- class XclEscherClientTextbox ----------------------------------
243 class SdrTextObj;
245 class XclEscherClientTextbox : public EscherExClientRecord_Base, protected XclExpRoot
247 private:
248 const SdrTextObj& rTextObj;
249 XclObj* pXclObj;
251 public:
252 XclEscherClientTextbox(
253 const XclExpRoot& rRoot,
254 const SdrTextObj& rObj,
255 XclObj* pObj
258 //! ONLY for the AdditionalText mimic
259 inline void SetXclObj( XclObj* p ) { pXclObj = p; }
261 virtual void WriteData( EscherEx& rEx ) const;
266 #endif // _XCL97ESC_HXX