Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*************************************************************************
3 : *
4 : * The Contents of this file are made available subject to the terms of
5 : * either of the following licenses
6 : *
7 : * - GNU Lesser General Public License Version 2.1
8 : * - Sun Industry Standards Source License Version 1.1
9 : *
10 : * Sun Microsystems Inc., October, 2000
11 : *
12 : * GNU Lesser General Public License Version 2.1
13 : * =============================================
14 : * Copyright 2000 by Sun Microsystems, Inc.
15 : * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 : *
17 : * This library is free software; you can redistribute it and/or
18 : * modify it under the terms of the GNU Lesser General Public
19 : * License version 2.1, as published by the Free Software Foundation.
20 : *
21 : * This library is distributed in the hope that it will be useful,
22 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 : * Lesser General Public License for more details.
25 : *
26 : * You should have received a copy of the GNU Lesser General Public
27 : * License along with this library; if not, write to the Free Software
28 : * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 : * MA 02111-1307 USA
30 : *
31 : *
32 : * Sun Industry Standards Source License Version 1.1
33 : * =================================================
34 : * The contents of this file are subject to the Sun Industry Standards
35 : * Source License Version 1.1 (the "License"); You may not use this file
36 : * except in compliance with the License. You may obtain a copy of the
37 : * License at http://www.openoffice.org/license.html.
38 : *
39 : * Software provided under this License is provided on an "AS IS" basis,
40 : * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
41 : * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
42 : * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
43 : * See the License for the specific provisions governing your rights and
44 : * obligations concerning the Software.
45 : *
46 : * The Initial Developer of the Original Code is: IBM Corporation
47 : *
48 : * Copyright: 2008 by IBM Corporation
49 : *
50 : * All Rights Reserved.
51 : *
52 : * Contributor(s): _______________________________________
53 : *
54 : *
55 : ************************************************************************/
56 : /**
57 : * @file
58 : * The file declares the LwpDrawObjcts and associated class like LwpDrawGroup, LwpDrawRectange
59 : * and so on.
60 : */
61 :
62 : #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPDRAWOBJ_HXX
63 : #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPDRAWOBJ_HXX
64 :
65 : #include <sal/config.h>
66 :
67 : #include <rtl/ref.hxx>
68 :
69 : #include "lwpsdwdrawheader.hxx"
70 :
71 : class SvStream;
72 : class XFFrame;
73 : class XFDrawStyle;
74 :
75 : /**
76 : * @brief
77 : * Lwp-base-draw object.
78 : */
79 : class LwpDrawObj
80 : {
81 : protected:
82 : DrawObjectType m_eType;
83 : SvStream* m_pStream;
84 : SdwDrawObjHeader m_aObjHeader;
85 : SdwClosedObjStyleRec m_aClosedObjStyleRec;
86 : DrawingOffsetAndScale* m_pTransData;
87 :
88 : public:
89 : LwpDrawObj(SvStream* pStream, DrawingOffsetAndScale* pTransData = NULL);
90 0 : virtual ~LwpDrawObj() {}
91 :
92 : private:
93 : void ReadObjHeaderRecord();
94 :
95 : protected:
96 : void ReadClosedObjStyle();
97 : void SetFillStyle(XFDrawStyle* pStyle);
98 : void SetLineStyle(XFDrawStyle* pStyle, sal_uInt8 nWidth, sal_uInt8 nLineStyle,
99 : const SdwColor& rColor);
100 : void SetPosition(XFFrame* pObj);
101 : void SetArrowHead(XFDrawStyle* pOpenedObjStyle, sal_uInt8 nArrowFlag, sal_uInt8 nLineWidth);
102 : OUString GetArrowName(sal_uInt8 nArrowStyle);
103 :
104 : protected:
105 : /**
106 : * @descr read out the record of a draw object.
107 : */
108 : virtual void Read() = 0;
109 :
110 : /**
111 : * @descr register styles of a draw object according to the saved records data.
112 : * @return the style name which has been registered.
113 : */
114 : virtual OUString RegisterStyle() = 0;
115 :
116 : /**
117 : * @descr create XF-draw object and assign the style name to it.
118 : * @param style name.
119 : * @return pointer of the created XF-draw object.
120 : */
121 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) = 0;
122 :
123 : /**
124 : * @descr create XF-draw object and assign the style name to it.
125 : * @param style name.
126 : * @return pointer of the created XF-draw object.
127 : */
128 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) = 0;
129 :
130 : public:
131 : /**
132 : * @descr create a completed XF-draw object(read data, register styles and create XF-draw object)
133 : * @return pointer of the created competed XF-draw object.
134 : */
135 : XFFrame* CreateXFDrawObject();
136 :
137 : /**
138 : * @param type of the object.
139 : * @descr set the type to the draw object.
140 : */
141 0 : inline void SetObjectType(DrawObjectType eType) { m_eType = eType; }
142 :
143 : /**
144 : * @descr get the type of the draw object.
145 : * @return the type of the object.
146 : */
147 : inline DrawObjectType GetObjectType() const { return m_eType; }
148 : };
149 :
150 : /**
151 : * @brief
152 : * Lwp-draw-group object.
153 : */
154 : class LwpDrawGroup : public LwpDrawObj
155 : {
156 : public:
157 0 : LwpDrawGroup(SvStream* pStream) : LwpDrawObj(pStream) {}
158 0 : virtual ~LwpDrawGroup() {}
159 :
160 : protected:
161 0 : virtual void Read() SAL_OVERRIDE {}
162 0 : virtual OUString RegisterStyle() SAL_OVERRIDE
163 : {
164 0 : return OUString();
165 : }
166 0 : virtual XFFrame* CreateDrawObj(const OUString& /*rStyleName*/) SAL_OVERRIDE { return NULL; }
167 0 : virtual XFFrame* CreateStandardDrawObj(const OUString& /*rStyleName*/) SAL_OVERRIDE { return NULL; }
168 : };
169 :
170 : /**
171 : * @brief
172 : * Lwp-draw-line object.
173 : */
174 : class LwpDrawLine : public LwpDrawObj
175 : {
176 : private:
177 : SdwLineRecord m_aLineRec;
178 :
179 : public:
180 : LwpDrawLine(SvStream * pStream, DrawingOffsetAndScale* pTransData);
181 0 : virtual ~LwpDrawLine() {}
182 :
183 : protected:
184 : virtual void Read() SAL_OVERRIDE;
185 : virtual OUString RegisterStyle() SAL_OVERRIDE;
186 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
187 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
188 : };
189 :
190 : /**
191 : * @brief
192 : * Lwp-draw-polyline object.
193 : */
194 : class LwpDrawPolyLine : public LwpDrawObj
195 : {
196 : private:
197 : SdwPolyLineRecord m_aPolyLineRec;
198 : SdwPoint* m_pVector;
199 :
200 : public:
201 : LwpDrawPolyLine(SvStream * pStream, DrawingOffsetAndScale* pTransData);
202 : virtual ~LwpDrawPolyLine();
203 :
204 : protected:
205 : virtual void Read() SAL_OVERRIDE;
206 : virtual OUString RegisterStyle() SAL_OVERRIDE;
207 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
208 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
209 : };
210 :
211 : /**
212 : * @brief
213 : * Lwp-draw-polygon object.
214 : */
215 : class LwpDrawPolygon : public LwpDrawObj
216 : {
217 : private:
218 : sal_uInt16 m_nNumPoints;
219 : SdwPoint* m_pVector;
220 :
221 : public:
222 : LwpDrawPolygon(SvStream * pStream, DrawingOffsetAndScale* pTransData);
223 : virtual ~LwpDrawPolygon();
224 :
225 : protected:
226 : virtual void Read() SAL_OVERRIDE;
227 : virtual OUString RegisterStyle() SAL_OVERRIDE;
228 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
229 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
230 : };
231 :
232 : /**
233 : * @brief
234 : * Lwp-draw-rectangle(rounded-corner rectangle) object.
235 : */
236 : class LwpDrawRectangle : public LwpDrawObj
237 : {
238 : private:
239 : SdwPoint m_aVector[16];
240 :
241 : public:
242 : LwpDrawRectangle(SvStream* pStream, DrawingOffsetAndScale* pTransData);
243 0 : virtual ~LwpDrawRectangle(){}
244 :
245 : protected:
246 : virtual void Read() SAL_OVERRIDE;
247 : virtual OUString RegisterStyle() SAL_OVERRIDE;
248 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
249 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
250 :
251 : private:
252 : XFFrame* CreateRoundedRect(const OUString& rStyleName);
253 : };
254 :
255 : /**
256 : * @brief
257 : * Lwp-draw-ellipse object.
258 : */
259 : class LwpDrawEllipse : public LwpDrawObj
260 : {
261 : private:
262 : SdwPoint m_aVector[13];
263 :
264 : public:
265 : LwpDrawEllipse(SvStream * pStream, DrawingOffsetAndScale* pTransData);
266 0 : virtual ~LwpDrawEllipse(){}
267 :
268 : protected:
269 : virtual void Read() SAL_OVERRIDE;
270 : virtual OUString RegisterStyle() SAL_OVERRIDE;
271 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
272 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
273 : };
274 :
275 : /**
276 : * @brief
277 : * Lwp-draw-arc object.
278 : */
279 : class LwpDrawArc : public LwpDrawObj
280 : {
281 : private:
282 : SdwArcRecord m_aArcRec;
283 : SdwPoint m_aVector[4];
284 :
285 : public:
286 : LwpDrawArc(SvStream * pStream, DrawingOffsetAndScale* pTransData);
287 0 : virtual ~LwpDrawArc() {}
288 :
289 : protected:
290 : virtual void Read() SAL_OVERRIDE;
291 : virtual OUString RegisterStyle() SAL_OVERRIDE;
292 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
293 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
294 : };
295 :
296 : /**
297 : * @brief
298 : * Lwp-draw-textbox object.
299 : */
300 : class XFFont;
301 : class LwpDrawTextBox : public LwpDrawObj
302 : {
303 : private:
304 : SdwTextBoxRecord m_aTextRec;
305 : SdwPoint m_aVector;
306 :
307 : public:
308 : LwpDrawTextBox(SvStream* pStream);
309 : virtual ~LwpDrawTextBox();
310 : static void SetFontStyle(rtl::Reference<XFFont> const & pFont, SdwTextBoxRecord* pRec);
311 :
312 : protected:
313 : virtual void Read() SAL_OVERRIDE;
314 : virtual OUString RegisterStyle() SAL_OVERRIDE;
315 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
316 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
317 : };
318 :
319 : /**
320 : * @brief
321 : * Lwp-draw-curved-text object.
322 : */
323 : class XFDrawPath;
324 : class LwpDrawTextArt : public LwpDrawObj
325 : {
326 : private:
327 : SdwTextArt m_aTextArtRec;
328 : SdwPoint m_aVector[4];
329 :
330 : private:
331 : void CreateFWPath(XFDrawPath* pPath);
332 :
333 : public:
334 : LwpDrawTextArt(SvStream* pStream, DrawingOffsetAndScale* pTransData);
335 : virtual ~LwpDrawTextArt();
336 :
337 : protected:
338 : virtual void Read() SAL_OVERRIDE;
339 : virtual OUString RegisterStyle() SAL_OVERRIDE;
340 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
341 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
342 : };
343 :
344 : /**
345 : * @brief
346 : * Lwp-draw-metafile object.
347 : */
348 : class LwpDrawMetafile : public LwpDrawObj
349 : {
350 : public:
351 : LwpDrawMetafile(SvStream* pStream);
352 0 : virtual ~LwpDrawMetafile() {}
353 :
354 : protected:
355 : virtual void Read() SAL_OVERRIDE;
356 0 : virtual OUString RegisterStyle() SAL_OVERRIDE
357 : {
358 0 : return OUString();
359 : }
360 0 : virtual XFFrame* CreateDrawObj(const OUString& /*rStyleName*/) SAL_OVERRIDE {return NULL;}
361 0 : virtual XFFrame* CreateStandardDrawObj(const OUString& /*rStyleName*/) SAL_OVERRIDE {return NULL;}
362 : };
363 :
364 : /**
365 : * @brief
366 : * Lwp-draw-bitmap object.
367 : */
368 : class LwpDrawBitmap : public LwpDrawObj
369 : {
370 : private:
371 : SdwBmpRecord m_aBmpRec;
372 : sal_uInt8* m_pImageData;
373 : public:
374 : LwpDrawBitmap(SvStream* pStream);
375 : virtual ~LwpDrawBitmap();
376 :
377 : protected:
378 : virtual void Read() SAL_OVERRIDE;
379 : virtual OUString RegisterStyle() SAL_OVERRIDE;
380 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
381 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
382 : };
383 : #endif
384 :
385 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|