Branch data 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 : : rtl::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 rtl::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 rtl::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 rtl::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 : : /**
148 : : * @brief
149 : : * Lwp-draw-group object.
150 : : */
151 : : class LwpDrawGroup : public LwpDrawObj
152 : : {
153 : : public:
154 : 0 : LwpDrawGroup(SvStream* pStream) : LwpDrawObj(pStream) {}
155 [ # # ]: 0 : virtual ~LwpDrawGroup() {}
156 : :
157 : : protected:
158 : 0 : virtual void Read() {}
159 : 0 : virtual rtl::OUString RegisterStyle()
160 : : {
161 : 0 : return rtl::OUString();
162 : : }
163 : 0 : virtual XFFrame* CreateDrawObj(const rtl::OUString& /*rStyleName*/) { return NULL; }
164 : 0 : virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& /*rStyleName*/) { return NULL; }
165 : : };
166 : :
167 : :
168 : : /**
169 : : * @brief
170 : : * Lwp-draw-line object.
171 : : */
172 : : class LwpDrawLine : public LwpDrawObj
173 : : {
174 : : private:
175 : : SdwLineRecord m_aLineRec;
176 : :
177 : : public:
178 : : LwpDrawLine(SvStream * pStream, DrawingOffsetAndScale* pTransData);
179 [ # # ]: 0 : virtual ~LwpDrawLine() {}
180 : :
181 : : protected:
182 : : virtual void Read();
183 : : virtual rtl::OUString RegisterStyle();
184 : : virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName);
185 : : virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName);
186 : : };
187 : :
188 : : /**
189 : : * @brief
190 : : * Lwp-draw-polyline object.
191 : : */
192 : : class LwpDrawPolyLine : public LwpDrawObj
193 : : {
194 : : private:
195 : : SdwPolyLineRecord m_aPolyLineRec;
196 : : SdwPoint* m_pVector;
197 : :
198 : : public:
199 : : LwpDrawPolyLine(SvStream * pStream, DrawingOffsetAndScale* pTransData);
200 : : virtual ~LwpDrawPolyLine();
201 : :
202 : : protected:
203 : : virtual void Read();
204 : : virtual rtl::OUString RegisterStyle();
205 : : virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName);
206 : : virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName);
207 : : };
208 : :
209 : :
210 : : /**
211 : : * @brief
212 : : * Lwp-draw-polygon object.
213 : : */
214 : : class LwpDrawPolygon : public LwpDrawObj
215 : : {
216 : : private:
217 : : sal_uInt16 m_nNumPoints;
218 : : SdwPoint* m_pVector;
219 : :
220 : : public:
221 : : LwpDrawPolygon(SvStream * pStream, DrawingOffsetAndScale* pTransData);
222 : : virtual ~LwpDrawPolygon();
223 : :
224 : : protected:
225 : : virtual void Read();
226 : : virtual rtl::OUString RegisterStyle();
227 : : virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName);
228 : : virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName);
229 : : };
230 : :
231 : : /**
232 : : * @brief
233 : : * Lwp-draw-rectangle(rounded-corner rectangle) object.
234 : : */
235 : : class LwpDrawRectangle : public LwpDrawObj
236 : : {
237 : : private:
238 : : SdwPoint m_aVector[16];
239 : :
240 : : public:
241 : : LwpDrawRectangle(SvStream* pStream, DrawingOffsetAndScale* pTransData);
242 [ # # ]: 0 : virtual ~LwpDrawRectangle(){}
243 : :
244 : : protected:
245 : : virtual void Read();
246 : : virtual rtl::OUString RegisterStyle();
247 : : virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName);
248 : : virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName);
249 : :
250 : : private:
251 : : XFFrame* CreateRoundedRect(const rtl::OUString& rStyleName);
252 : : };
253 : :
254 : : /**
255 : : * @brief
256 : : * Lwp-draw-ellipse object.
257 : : */
258 : : class LwpDrawEllipse : public LwpDrawObj
259 : : {
260 : : private:
261 : : SdwPoint m_aVector[13];
262 : :
263 : : public:
264 : : LwpDrawEllipse(SvStream * pStream, DrawingOffsetAndScale* pTransData);
265 [ # # ]: 0 : virtual ~LwpDrawEllipse(){}
266 : :
267 : : protected:
268 : : virtual void Read();
269 : : virtual rtl::OUString RegisterStyle();
270 : : virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName);
271 : : virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName);
272 : : };
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();
291 : : virtual rtl::OUString RegisterStyle();
292 : : virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName);
293 : : virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName);
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(XFFont* pFont, SdwTextBoxRecord* pRec);
311 : :
312 : : protected:
313 : : virtual void Read();
314 : : virtual rtl::OUString RegisterStyle();
315 : : virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName);
316 : : virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName);
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();
339 : : virtual rtl::OUString RegisterStyle();
340 : : virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName);
341 : : virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName);
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();
356 : 0 : virtual rtl::OUString RegisterStyle()
357 : : {
358 : 0 : return rtl::OUString();
359 : : }
360 : 0 : virtual XFFrame* CreateDrawObj(const rtl::OUString& /*rStyleName*/){return NULL;}
361 : 0 : virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& /*rStyleName*/){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();
379 : : virtual rtl::OUString RegisterStyle();
380 : : virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName);
381 : : virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName);
382 : : };
383 : : #endif
384 : :
385 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|