1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef SC_XCL97ESC_HXX
29 #define SC_XCL97ESC_HXX
32 #include <tools/table.hxx>
33 #include <tools/stack.hxx>
34 #include <filter/msfilter/escherex.hxx>
35 #include "xlescher.hxx"
38 // 0 = Export TBX form controls, 1 = Export OCX form controls.
39 #define EXC_EXP_OCX_CTRL 0
41 namespace utl
{ class TempFile
; }
43 // ============================================================================
47 class XclEscherExGlobal
: public EscherExGlobal
, protected XclExpRoot
50 explicit XclEscherExGlobal( const XclExpRoot
& rRoot
);
53 /** Overloaded to create a new temporary file and return its stream. */
54 virtual SvStream
* ImplQueryPictureStream();
57 ::std::auto_ptr
< ::utl::TempFile
> mxPicTempFile
;
58 ::std::auto_ptr
< SvStream
> mxPicStrm
;
61 // ============================================================================
64 class XclExpDffAnchorBase
;
65 class XclEscherHostAppData
;
66 class XclEscherClientData
;
67 class XclEscherClientTextbox
;
69 class XclExpOcxControlObj
;
71 class XclExpTbxControlObj
;
74 class XclEscherEx
: public EscherEx
, protected XclExpRoot
78 const XclExpRoot
& rRoot
,
79 XclExpObjectManager
& rObjMgr
,
81 const XclEscherEx
* pParent
= 0 );
82 virtual ~XclEscherEx();
84 /** Called by MSODRAWING record constructors to initialize the DFF stream
85 fragment they will own. returns the DFF fragment identifier. */
86 sal_uInt32
InitNextDffFragment();
87 /** Called after some data has been written to the DFF stream, to update
88 the end position of the DFF fragment owned by an MSODRAWING record. */
89 void UpdateDffFragmentEnd();
91 /** Returns the position of the specified DFF stream fragment. */
92 sal_uInt32
GetDffFragmentPos( sal_uInt32 nFragmentKey
);
93 /** Returns the size of the specified DFF stream fragment. */
94 sal_uInt32
GetDffFragmentSize( sal_uInt32 nFragmentKey
);
95 /** Returns true, if there is more data left in the DFF stream than owned
96 by the last MSODRAWING record. */
97 bool HasPendingDffData();
99 /** Creates a new DFF client anchor object and calculates the anchor
100 position of the passed object. Caller takes ownership! */
101 XclExpDffAnchorBase
* CreateDffAnchor( const SdrObject
& rSdrObj
) const;
103 virtual EscherExHostAppData
* StartShape(
104 const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& rxShape
,
105 const Rectangle
* pChildAnchor
);
106 virtual void EndShape( UINT16 nShapeType
, UINT32 nShapeID
);
107 virtual EscherExHostAppData
* EnterAdditionalTextGroup();
109 /// Flush and merge PicStream into EscherStream
113 /** Creates an OCX form control OBJ record from the passed form control.
114 @descr Writes the form control data to the 'Ctls' stream. */
115 XclExpOcxControlObj
* CreateCtrlObj(
116 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
> xShape
,
117 const Rectangle
* pChildAnchor
);
120 SotStorageStreamRef mxCtlsStrm
; /// The 'Ctls' stream.
122 /** Creates a TBX form control OBJ record from the passed form control. */
123 XclExpTbxControlObj
* CreateCtrlObj(
124 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
> xShape
,
125 const Rectangle
* pChildAnchor
);
128 /** Tries to get the name of a Basic macro from a control. */
129 void ConvertTbxMacro(
130 XclExpTbxControlObj
& rTbxCtrlObj
,
131 ::com::sun::star::uno::Reference
<
132 ::com::sun::star::awt::XControlModel
> xCtrlModel
);
135 void DeleteCurrAppData();
138 XclExpObjectManager
& mrObjMgr
;
141 XclEscherHostAppData
* pCurrAppData
;
142 XclEscherClientData
* pTheClientData
; // always the same
143 XclEscherClientTextbox
* pAdditionalText
;
144 USHORT nAdditionalText
;
145 sal_uInt32 mnNextKey
;
149 // --- class XclEscherHostAppData ------------------------------------
151 class XclEscherHostAppData
: public EscherExHostAppData
157 XclEscherHostAppData() : bStackedGroup( FALSE
)
159 inline void SetStackedGroup( BOOL b
) { bStackedGroup
= b
; }
160 inline BOOL
IsStackedGroup() const { return bStackedGroup
; }
165 // ============================================================================
167 // --- class XclEscherClientData -------------------------------------
169 class XclEscherClientData
: public EscherExClientRecord_Base
172 XclEscherClientData() {}
173 virtual void WriteData( EscherEx
& rEx
) const;
177 // --- class XclEscherClientTextbox ----------------------------------
181 class XclEscherClientTextbox
: public EscherExClientRecord_Base
, protected XclExpRoot
184 const SdrTextObj
& rTextObj
;
188 XclEscherClientTextbox(
189 const XclExpRoot
& rRoot
,
190 const SdrTextObj
& rObj
,
193 //! ONLY for the AdditionalText mimic
194 inline void SetXclObj( XclObj
* p
) { pXclObj
= p
; }
196 virtual void WriteData( EscherEx
& rEx
) const;
201 #endif // _XCL97ESC_HXX