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 _LWPDRAWOBJ_HXX
63 : #define _LWPDRAWOBJ_HXX
64 :
65 : #include "lwpsdwdrawheader.hxx"
66 :
67 : class SvStream;
68 : class XFFrame;
69 : class XFDrawStyle;
70 :
71 : /**
72 : * @brief
73 : * Lwp-base-draw object.
74 : */
75 : class LwpDrawObj
76 : {
77 : protected:
78 : DrawObjectType m_eType;
79 : SvStream* m_pStream;
80 : SdwDrawObjHeader m_aObjHeader;
81 : SdwClosedObjStyleRec m_aClosedObjStyleRec;
82 : DrawingOffsetAndScale* m_pTransData;
83 :
84 : public:
85 : LwpDrawObj(SvStream* pStream, DrawingOffsetAndScale* pTransData = NULL);
86 0 : virtual ~LwpDrawObj() {}
87 :
88 : private:
89 : void ReadObjHeaderRecord();
90 :
91 : protected:
92 : void ReadClosedObjStyle();
93 : void SetFillStyle(XFDrawStyle* pStyle);
94 : void SetLineStyle(XFDrawStyle* pStyle, sal_uInt8 nWidth, sal_uInt8 nLineStyle,
95 : const SdwColor& rColor);
96 : void SetPosition(XFFrame* pObj);
97 : void SetArrowHead(XFDrawStyle* pOpenedObjStyle, sal_uInt8 nArrowFlag, sal_uInt8 nLineWidth);
98 : OUString GetArrowName(sal_uInt8 nArrowStyle);
99 :
100 : protected:
101 : /**
102 : * @descr read out the record of a draw object.
103 : */
104 : virtual void Read() = 0;
105 :
106 : /**
107 : * @descr register styles of a draw object according to the saved records data.
108 : * @return the style name which has been registered.
109 : */
110 : virtual OUString RegisterStyle() = 0;
111 :
112 : /**
113 : * @descr create XF-draw object and assign the style name to it.
114 : * @param style name.
115 : * @return pointer of the created XF-draw object.
116 : */
117 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) = 0;
118 :
119 : /**
120 : * @descr create XF-draw object and assign the style name to it.
121 : * @param style name.
122 : * @return pointer of the created XF-draw object.
123 : */
124 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) = 0;
125 :
126 : public:
127 : /**
128 : * @descr create a completed XF-draw object(read data, register styles and create XF-draw object)
129 : * @return pointer of the created competed XF-draw object.
130 : */
131 : XFFrame* CreateXFDrawObject();
132 :
133 : /**
134 : * @param type of the object.
135 : * @descr set the type to the draw object.
136 : */
137 0 : inline void SetObjectType(DrawObjectType eType) { m_eType = eType; }
138 :
139 : /**
140 : * @descr get the type of the draw object.
141 : * @return the type of the object.
142 : */
143 : inline DrawObjectType GetObjectType() const { return m_eType; }
144 : };
145 :
146 : /**
147 : * @brief
148 : * Lwp-draw-group object.
149 : */
150 : class LwpDrawGroup : public LwpDrawObj
151 : {
152 : public:
153 0 : LwpDrawGroup(SvStream* pStream) : LwpDrawObj(pStream) {}
154 0 : virtual ~LwpDrawGroup() {}
155 :
156 : protected:
157 0 : virtual void Read() SAL_OVERRIDE {}
158 0 : virtual OUString RegisterStyle() SAL_OVERRIDE
159 : {
160 0 : return OUString();
161 : }
162 0 : virtual XFFrame* CreateDrawObj(const OUString& /*rStyleName*/) SAL_OVERRIDE { return NULL; }
163 0 : virtual XFFrame* CreateStandardDrawObj(const OUString& /*rStyleName*/) SAL_OVERRIDE { return NULL; }
164 : };
165 :
166 : /**
167 : * @brief
168 : * Lwp-draw-line object.
169 : */
170 : class LwpDrawLine : public LwpDrawObj
171 : {
172 : private:
173 : SdwLineRecord m_aLineRec;
174 :
175 : public:
176 : LwpDrawLine(SvStream * pStream, DrawingOffsetAndScale* pTransData);
177 0 : virtual ~LwpDrawLine() {}
178 :
179 : protected:
180 : virtual void Read() SAL_OVERRIDE;
181 : virtual OUString RegisterStyle() SAL_OVERRIDE;
182 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
183 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
184 : };
185 :
186 : /**
187 : * @brief
188 : * Lwp-draw-polyline object.
189 : */
190 : class LwpDrawPolyLine : public LwpDrawObj
191 : {
192 : private:
193 : SdwPolyLineRecord m_aPolyLineRec;
194 : SdwPoint* m_pVector;
195 :
196 : public:
197 : LwpDrawPolyLine(SvStream * pStream, DrawingOffsetAndScale* pTransData);
198 : virtual ~LwpDrawPolyLine();
199 :
200 : protected:
201 : virtual void Read() SAL_OVERRIDE;
202 : virtual OUString RegisterStyle() SAL_OVERRIDE;
203 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
204 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
205 : };
206 :
207 : /**
208 : * @brief
209 : * Lwp-draw-polygon object.
210 : */
211 : class LwpDrawPolygon : public LwpDrawObj
212 : {
213 : private:
214 : sal_uInt16 m_nNumPoints;
215 : SdwPoint* m_pVector;
216 :
217 : public:
218 : LwpDrawPolygon(SvStream * pStream, DrawingOffsetAndScale* pTransData);
219 : virtual ~LwpDrawPolygon();
220 :
221 : protected:
222 : virtual void Read() SAL_OVERRIDE;
223 : virtual OUString RegisterStyle() SAL_OVERRIDE;
224 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
225 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
226 : };
227 :
228 : /**
229 : * @brief
230 : * Lwp-draw-rectangle(rounded-corner rectangle) object.
231 : */
232 : class LwpDrawRectangle : public LwpDrawObj
233 : {
234 : private:
235 : SdwPoint m_aVector[16];
236 :
237 : public:
238 : LwpDrawRectangle(SvStream* pStream, DrawingOffsetAndScale* pTransData);
239 0 : virtual ~LwpDrawRectangle(){}
240 :
241 : protected:
242 : virtual void Read() SAL_OVERRIDE;
243 : virtual OUString RegisterStyle() SAL_OVERRIDE;
244 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
245 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
246 :
247 : private:
248 : XFFrame* CreateRoundedRect(const OUString& rStyleName);
249 : };
250 :
251 : /**
252 : * @brief
253 : * Lwp-draw-ellipse object.
254 : */
255 : class LwpDrawEllipse : public LwpDrawObj
256 : {
257 : private:
258 : SdwPoint m_aVector[13];
259 :
260 : public:
261 : LwpDrawEllipse(SvStream * pStream, DrawingOffsetAndScale* pTransData);
262 0 : virtual ~LwpDrawEllipse(){}
263 :
264 : protected:
265 : virtual void Read() SAL_OVERRIDE;
266 : virtual OUString RegisterStyle() SAL_OVERRIDE;
267 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
268 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
269 : };
270 :
271 : /**
272 : * @brief
273 : * Lwp-draw-arc object.
274 : */
275 : class LwpDrawArc : public LwpDrawObj
276 : {
277 : private:
278 : SdwArcRecord m_aArcRec;
279 : SdwPoint m_aVector[4];
280 :
281 : public:
282 : LwpDrawArc(SvStream * pStream, DrawingOffsetAndScale* pTransData);
283 0 : virtual ~LwpDrawArc() {}
284 :
285 : protected:
286 : virtual void Read() SAL_OVERRIDE;
287 : virtual OUString RegisterStyle() SAL_OVERRIDE;
288 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
289 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
290 : };
291 :
292 : /**
293 : * @brief
294 : * Lwp-draw-textbox object.
295 : */
296 : class XFFont;
297 : class LwpDrawTextBox : public LwpDrawObj
298 : {
299 : private:
300 : SdwTextBoxRecord m_aTextRec;
301 : SdwPoint m_aVector;
302 :
303 : public:
304 : LwpDrawTextBox(SvStream* pStream);
305 : virtual ~LwpDrawTextBox();
306 : static void SetFontStyle(XFFont* pFont, SdwTextBoxRecord* pRec);
307 :
308 : protected:
309 : virtual void Read() SAL_OVERRIDE;
310 : virtual OUString RegisterStyle() SAL_OVERRIDE;
311 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
312 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
313 : };
314 :
315 : /**
316 : * @brief
317 : * Lwp-draw-curved-text object.
318 : */
319 : class XFDrawPath;
320 : class LwpDrawTextArt : public LwpDrawObj
321 : {
322 : private:
323 : SdwTextArt m_aTextArtRec;
324 : SdwPoint m_aVector[4];
325 :
326 : private:
327 : void CreateFWPath(XFDrawPath* pPath);
328 :
329 : public:
330 : LwpDrawTextArt(SvStream* pStream, DrawingOffsetAndScale* pTransData);
331 : virtual ~LwpDrawTextArt();
332 :
333 : protected:
334 : virtual void Read() SAL_OVERRIDE;
335 : virtual OUString RegisterStyle() SAL_OVERRIDE;
336 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
337 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
338 : };
339 :
340 : /**
341 : * @brief
342 : * Lwp-draw-metafile object.
343 : */
344 : class LwpDrawMetafile : public LwpDrawObj
345 : {
346 : public:
347 : LwpDrawMetafile(SvStream* pStream);
348 0 : virtual ~LwpDrawMetafile() {}
349 :
350 : protected:
351 : virtual void Read() SAL_OVERRIDE;
352 0 : virtual OUString RegisterStyle() SAL_OVERRIDE
353 : {
354 0 : return OUString();
355 : }
356 0 : virtual XFFrame* CreateDrawObj(const OUString& /*rStyleName*/) SAL_OVERRIDE {return NULL;}
357 0 : virtual XFFrame* CreateStandardDrawObj(const OUString& /*rStyleName*/) SAL_OVERRIDE {return NULL;}
358 : };
359 :
360 : /**
361 : * @brief
362 : * Lwp-draw-bitmap object.
363 : */
364 : class LwpDrawBitmap : public LwpDrawObj
365 : {
366 : private:
367 : SdwBmpRecord m_aBmpRec;
368 : sal_uInt8* m_pImageData;
369 : public:
370 : LwpDrawBitmap(SvStream* pStream);
371 : virtual ~LwpDrawBitmap();
372 :
373 : protected:
374 : virtual void Read() SAL_OVERRIDE;
375 : virtual OUString RegisterStyle() SAL_OVERRIDE;
376 : virtual XFFrame* CreateDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
377 : virtual XFFrame* CreateStandardDrawObj(const OUString& rStyleName) SAL_OVERRIDE;
378 : };
379 : #endif
380 :
381 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|