update dev300-m57
[ooovba.git] / lotuswordpro / source / filter / lwpdrawobj.hxx
blobb4583768efc43dbef95b87fb565fff113c5d9615
1 /*************************************************************************
3 * The Contents of this file are made available subject to the terms of
4 * either of the following licenses
6 * - GNU Lesser General Public License Version 2.1
7 * - Sun Industry Standards Source License Version 1.1
9 * Sun Microsystems Inc., October, 2000
11 * GNU Lesser General Public License Version 2.1
12 * =============================================
13 * Copyright 2000 by Sun Microsystems, Inc.
14 * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License version 2.1, as published by the Free Software Foundation.
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA
31 * Sun Industry Standards Source License Version 1.1
32 * =================================================
33 * The contents of this file are subject to the Sun Industry Standards
34 * Source License Version 1.1 (the "License"); You may not use this file
35 * except in compliance with the License. You may obtain a copy of the
36 * License at http://www.openoffice.org/license.html.
38 * Software provided under this License is provided on an "AS IS" basis,
39 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
40 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
41 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
42 * See the License for the specific provisions governing your rights and
43 * obligations concerning the Software.
45 * The Initial Developer of the Original Code is: IBM Corporation
47 * Copyright: 2008 by IBM Corporation
49 * All Rights Reserved.
51 * Contributor(s): _______________________________________
54 ************************************************************************/
55 /**
56 * @file
57 * The file declares the LwpDrawObjcts and associated class like LwpDrawGroup, LwpDrawRectange
58 * and so on.
61 #ifndef _LWPDRAWOBJ_HXX
62 #define _LWPDRAWOBJ_HXX
64 #include "lwpsdwdrawheader.hxx"
66 class SvStream;
67 class XFFrame;
68 class XFDrawStyle;
70 /**
71 * @brief
72 * Lwp-base-draw object.
74 class LwpDrawObj
76 protected:
77 DrawObjectType m_eType;
78 SvStream* m_pStream;
79 SdwDrawObjHeader m_aObjHeader;
80 SdwClosedObjStyleRec m_aClosedObjStyleRec;
81 DrawingOffsetAndScale* m_pTransData;
83 public:
84 LwpDrawObj(SvStream* pStream, DrawingOffsetAndScale* pTransData = NULL);
85 virtual ~LwpDrawObj() {};
87 private:
88 void ReadObjHeaderRecord();
90 protected:
91 void ReadClosedObjStyle();
92 void SetFillStyle(XFDrawStyle* pStyle);
93 void SetLineStyle(XFDrawStyle* pStyle, sal_uInt8 nWidth, sal_uInt8 nLineStyle,
94 const SdwColor& rColor);
95 void SetPosition(XFFrame* pObj);
96 void SetArrowHead(XFDrawStyle* pOpenedObjStyle, sal_uInt8 nArrowFlag, sal_uInt8 nLineWidth);
97 rtl::OUString GetArrowName(sal_uInt8 nArrowStyle);
99 protected:
101 * @descr read out the record of a draw object.
103 virtual void Read() = 0;
106 * @descr register styles of a draw object according to the saved records data.
107 * @return the style name which has been registered.
109 virtual rtl::OUString RegisterStyle() = 0;
112 * @descr create XF-draw object and assign the style name to it.
113 * @param style name.
114 * @return pointer of the created XF-draw object.
116 virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName) = 0;
119 * @descr create XF-draw object and assign the style name to it.
120 * @param style name.
121 * @return pointer of the created XF-draw object.
123 virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName) = 0;
125 public:
127 * @descr create a completed XF-draw object(read data, register styles and create XF-draw object)
128 * @return pointer of the created competed XF-draw object.
130 XFFrame* CreateXFDrawObject();
133 * @param type of the object.
134 * @descr set the type to the draw object.
136 inline void SetObjectType(DrawObjectType eType) { m_eType = eType; }
139 * @descr get the type of the draw object.
140 * @return the type of the object.
142 inline DrawObjectType GetObjectType() const { return m_eType; }
147 * @brief
148 * Lwp-draw-group object.
150 class LwpDrawGroup : public LwpDrawObj
152 public:
153 LwpDrawGroup(SvStream* pStream) : LwpDrawObj(pStream) {}
154 virtual ~LwpDrawGroup() {}
156 protected:
157 virtual void Read() {}
158 virtual rtl::OUString RegisterStyle() { return rtl::OUString::createFromAscii(""); }
159 virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName) { return NULL; }
160 virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName) { return NULL; }
165 * @brief
166 * Lwp-draw-line object.
168 class LwpDrawLine : public LwpDrawObj
170 private:
171 SdwLineRecord m_aLineRec;
173 public:
174 LwpDrawLine(SvStream * pStream, DrawingOffsetAndScale* pTransData);
175 virtual ~LwpDrawLine() {};
177 protected:
178 virtual void Read();
179 virtual rtl::OUString RegisterStyle();
180 virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName);
181 virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName);
185 * @brief
186 * Lwp-draw-polyline object.
188 class LwpDrawPolyLine : public LwpDrawObj
190 private:
191 SdwPolyLineRecord m_aPolyLineRec;
192 SdwPoint* m_pVector;
194 public:
195 LwpDrawPolyLine(SvStream * pStream, DrawingOffsetAndScale* pTransData);
196 virtual ~LwpDrawPolyLine();
198 protected:
199 virtual void Read();
200 virtual rtl::OUString RegisterStyle();
201 virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName);
202 virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName);
207 * @brief
208 * Lwp-draw-polygon object.
210 class LwpDrawPolygon : public LwpDrawObj
212 private:
213 sal_uInt16 m_nNumPoints;
214 SdwPoint* m_pVector;
216 public:
217 LwpDrawPolygon(SvStream * pStream, DrawingOffsetAndScale* pTransData);
218 virtual ~LwpDrawPolygon();
220 protected:
221 virtual void Read();
222 virtual rtl::OUString RegisterStyle();
223 virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName);
224 virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName);
228 * @brief
229 * Lwp-draw-rectangle(rounded-corner rectangle) object.
231 class LwpDrawRectangle : public LwpDrawObj
233 private:
234 SdwPoint m_aVector[16];
236 public:
237 LwpDrawRectangle(SvStream* pStream, DrawingOffsetAndScale* pTransData);
238 virtual ~LwpDrawRectangle(){}
240 protected:
241 virtual void Read();
242 virtual rtl::OUString RegisterStyle();
243 virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName);
244 virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName);
246 private:
247 XFFrame* CreateRoundedRect(const rtl::OUString& rStyleName);
251 * @brief
252 * Lwp-draw-ellipse object.
254 class LwpDrawEllipse : public LwpDrawObj
256 private:
257 SdwPoint m_aVector[13];
259 public:
260 LwpDrawEllipse(SvStream * pStream, DrawingOffsetAndScale* pTransData);
261 virtual ~LwpDrawEllipse(){};
263 protected:
264 virtual void Read();
265 virtual rtl::OUString RegisterStyle();
266 virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName);
267 virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName);
272 * @brief
273 * Lwp-draw-arc object.
275 class LwpDrawArc : public LwpDrawObj
277 private:
278 SdwArcRecord m_aArcRec;
279 SdwPoint m_aVector[4];
281 public:
282 LwpDrawArc(SvStream * pStream, DrawingOffsetAndScale* pTransData);
283 virtual ~LwpDrawArc() {};
285 protected:
286 virtual void Read();
287 virtual rtl::OUString RegisterStyle();
288 virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName);
289 virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName);
293 * @brief
294 * Lwp-draw-textbox object.
296 class XFFont;
297 class LwpDrawTextBox : public LwpDrawObj
299 private:
300 SdwTextBoxRecord m_aTextRec;
301 SdwPoint m_aVector;
303 public:
304 LwpDrawTextBox(SvStream* pStream);
305 virtual ~LwpDrawTextBox();
306 static void SetFontStyle(XFFont* pFont, SdwTextBoxRecord* pRec);
308 protected:
309 virtual void Read();
310 virtual rtl::OUString RegisterStyle();
311 virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName);
312 virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName);
316 * @brief
317 * Lwp-draw-curved-text object.
319 class XFDrawPath;
320 class LwpDrawTextArt : public LwpDrawObj
322 private:
323 SdwTextArt m_aTextArtRec;
324 SdwPoint m_aVector[4];
326 private:
327 void CreateFWPath(XFDrawPath* pPath);
329 public:
330 LwpDrawTextArt(SvStream* pStream, DrawingOffsetAndScale* pTransData);
331 virtual ~LwpDrawTextArt();
333 protected:
334 virtual void Read();
335 virtual rtl::OUString RegisterStyle();
336 virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName);
337 virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName);
341 * @brief
342 * Lwp-draw-metafile object.
344 class LwpDrawMetafile : public LwpDrawObj
346 public:
347 LwpDrawMetafile(SvStream* pStream);
348 virtual ~LwpDrawMetafile() {}
350 protected:
351 virtual void Read();
352 virtual rtl::OUString RegisterStyle() {return rtl::OUString::createFromAscii("");}
353 virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName){return NULL;}
354 virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName){return NULL;}
358 * @brief
359 * Lwp-draw-bitmap object.
361 class LwpDrawBitmap : public LwpDrawObj
363 private:
364 SdwBmpRecord m_aBmpRec;
365 sal_uInt8* m_pImageData;
366 public:
367 LwpDrawBitmap(SvStream* pStream);
368 virtual ~LwpDrawBitmap();
370 protected:
371 virtual void Read();
372 virtual rtl::OUString RegisterStyle();
373 virtual XFFrame* CreateDrawObj(const rtl::OUString& rStyleName);
374 virtual XFFrame* CreateStandardDrawObj(const rtl::OUString& rStyleName);
376 #endif