Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_XCL97ESC_HXX
30 : : #define SC_XCL97ESC_HXX
31 : :
32 : : #include <memory>
33 : : #include <stack>
34 : : #include <filter/msfilter/escherex.hxx>
35 : : #include "xlescher.hxx"
36 : : #include "xeroot.hxx"
37 : : #include <vector>
38 : :
39 : : // 0 = Export TBX form controls, 1 = Export OCX form controls.
40 : : #define EXC_EXP_OCX_CTRL 0
41 : :
42 : : namespace utl { class TempFile; }
43 : :
44 : : // ============================================================================
45 : :
46 : : class SvStream;
47 : :
48 [ # # ][ # # ]: 0 : class XclEscherExGlobal : public EscherExGlobal, protected XclExpRoot
[ # # ][ # # ]
49 : : {
50 : : public:
51 : : explicit XclEscherExGlobal( const XclExpRoot& rRoot );
52 : :
53 : : private:
54 : : /** Overloaded to create a new temporary file and return its stream. */
55 : : virtual SvStream* ImplQueryPictureStream();
56 : :
57 : : private:
58 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
59 : : ::std::auto_ptr< ::utl::TempFile > mxPicTempFile;
60 : : ::std::auto_ptr< SvStream > mxPicStrm;
61 : : SAL_WNODEPRECATED_DECLARATIONS_POP
62 : : };
63 : :
64 : : // ============================================================================
65 : :
66 : : class XclObj;
67 : : class XclExpDffAnchorBase;
68 : : class XclEscherHostAppData;
69 : : class XclEscherClientData;
70 : : class XclEscherClientTextbox;
71 : : #if EXC_EXP_OCX_CTRL
72 : : class XclExpOcxControlObj;
73 : : #else
74 : : class XclExpTbxControlObj;
75 : : #endif
76 : : class XclExpShapeObj;
77 : : class EscherExHostAppData;
78 : : class ShapeInteractionHelper
79 : : {
80 : : public:
81 : : static XclExpShapeObj* CreateShapeObj( XclExpObjectManager& rObjMgr, const ::com::sun::star::uno::Reference<
82 : : ::com::sun::star::drawing::XShape >& xShape );
83 : : static void PopulateShapeInteractionInfo( XclExpObjectManager& rObjMgr, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, EscherExHostAppData& rHostAppData );
84 : : };
85 : :
86 : : class XclEscherEx : public EscherEx, protected XclExpRoot
87 : : {
88 : : public:
89 : : explicit XclEscherEx(
90 : : const XclExpRoot& rRoot,
91 : : XclExpObjectManager& rObjMgr,
92 : : SvStream& rStrm,
93 : : const XclEscherEx* pParent = 0 );
94 : : virtual ~XclEscherEx();
95 : :
96 : : /** Called by MSODRAWING record constructors to initialize the DFF stream
97 : : fragment they will own. returns the DFF fragment identifier. */
98 : : sal_uInt32 InitNextDffFragment();
99 : : /** Called after some data has been written to the DFF stream, to update
100 : : the end position of the DFF fragment owned by an MSODRAWING record. */
101 : : void UpdateDffFragmentEnd();
102 : :
103 : : /** Returns the position of the specified DFF stream fragment. */
104 : : sal_uInt32 GetDffFragmentPos( sal_uInt32 nFragmentKey );
105 : : /** Returns the size of the specified DFF stream fragment. */
106 : : sal_uInt32 GetDffFragmentSize( sal_uInt32 nFragmentKey );
107 : : /** Returns true, if there is more data left in the DFF stream than owned
108 : : by the last MSODRAWING record. */
109 : : bool HasPendingDffData();
110 : :
111 : : /** Creates a new DFF client anchor object and calculates the anchor
112 : : position of the passed object. Caller takes ownership! */
113 : : XclExpDffAnchorBase* CreateDffAnchor( const SdrObject& rSdrObj ) const;
114 : :
115 : : virtual EscherExHostAppData* StartShape(
116 : : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& rxShape,
117 : : const Rectangle* pChildAnchor );
118 : : virtual void EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID );
119 : : virtual EscherExHostAppData* EnterAdditionalTextGroup();
120 : :
121 : : /// Flush and merge PicStream into EscherStream
122 : : void EndDocument();
123 : :
124 : : #if EXC_EXP_OCX_CTRL
125 : : /** Creates an OCX form control OBJ record from the passed form control.
126 : : @descr Writes the form control data to the 'Ctls' stream. */
127 : : XclExpOcxControlObj* CreateCtrlObj(
128 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape,
129 : : const Rectangle* pChildAnchor );
130 : :
131 : : private:
132 : : SotStorageStreamRef mxCtlsStrm; /// The 'Ctls' stream.
133 : : #else
134 : : /** Creates a TBX form control OBJ record from the passed form control. */
135 : : XclExpTbxControlObj* CreateCtrlObj(
136 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape,
137 : : const Rectangle* pChildAnchor );
138 : :
139 : : private:
140 : : /** Tries to get the name of a Basic macro from a control. */
141 : : void ConvertTbxMacro(
142 : : XclExpTbxControlObj& rTbxCtrlObj,
143 : : ::com::sun::star::uno::Reference<
144 : : ::com::sun::star::awt::XControlModel > xCtrlModel );
145 : : #endif
146 : :
147 : : void DeleteCurrAppData();
148 : :
149 : : private:
150 : : XclExpObjectManager& mrObjMgr;
151 : : std::stack< std::pair< XclObj*, XclEscherHostAppData* > > aStack;
152 : : XclObj* pCurrXclObj;
153 : : XclEscherHostAppData* pCurrAppData;
154 : : XclEscherClientData* pTheClientData; // always the same
155 : : XclEscherClientTextbox* pAdditionalText;
156 : : sal_uInt16 nAdditionalText;
157 : : sal_uInt32 mnNextKey;
158 : : bool mbIsRootDff;
159 : : };
160 : :
161 : : // --- class XclEscherHostAppData ------------------------------------
162 : :
163 : : class XclEscherHostAppData : public EscherExHostAppData
164 : : {
165 : : private:
166 : : sal_Bool bStackedGroup;
167 : :
168 : : public:
169 : 0 : XclEscherHostAppData() : bStackedGroup( false )
170 : 0 : {}
171 : 0 : inline void SetStackedGroup( sal_Bool b ) { bStackedGroup = b; }
172 : 0 : inline sal_Bool IsStackedGroup() const { return bStackedGroup; }
173 : : };
174 : :
175 : :
176 : :
177 : : // ============================================================================
178 : :
179 : : // --- class XclEscherClientData -------------------------------------
180 : :
181 [ # # ]: 0 : class XclEscherClientData : public EscherExClientRecord_Base
182 : : {
183 : : public:
184 : 0 : XclEscherClientData() {}
185 : : virtual void WriteData( EscherEx& rEx ) const;
186 : : };
187 : :
188 : :
189 : : // --- class XclEscherClientTextbox ----------------------------------
190 : :
191 : : class SdrTextObj;
192 : :
193 [ # # ][ # # ]: 0 : class XclEscherClientTextbox : public EscherExClientRecord_Base, protected XclExpRoot
194 : : {
195 : : private:
196 : : const SdrTextObj& rTextObj;
197 : : XclObj* pXclObj;
198 : :
199 : : public:
200 : : XclEscherClientTextbox(
201 : : const XclExpRoot& rRoot,
202 : : const SdrTextObj& rObj,
203 : : XclObj* pObj );
204 : :
205 : : //! ONLY for the AdditionalText mimic
206 : 0 : inline void SetXclObj( XclObj* p ) { pXclObj = p; }
207 : :
208 : : virtual void WriteData( EscherEx& rEx ) const;
209 : : };
210 : :
211 : :
212 : :
213 : : #endif // _XCL97ESC_HXX
214 : :
215 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|