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,
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 ************************************************************************/
57 * The file declares the LwpDrawObjcts and associated class like LwpDrawGroup, LwpDrawRectange
61 #ifndef _LWPDRAWOBJ_HXX
62 #define _LWPDRAWOBJ_HXX
64 #include "lwpsdwdrawheader.hxx"
72 * Lwp-base-draw object.
77 DrawObjectType m_eType
;
79 SdwDrawObjHeader m_aObjHeader
;
80 SdwClosedObjStyleRec m_aClosedObjStyleRec
;
81 DrawingOffsetAndScale
* m_pTransData
;
84 LwpDrawObj(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
= NULL
);
85 virtual ~LwpDrawObj() {};
88 void ReadObjHeaderRecord();
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
);
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.
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.
121 * @return pointer of the created XF-draw object.
123 virtual XFFrame
* CreateStandardDrawObj(const rtl::OUString
& rStyleName
) = 0;
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
; }
148 * Lwp-draw-group object.
150 class LwpDrawGroup
: public LwpDrawObj
153 LwpDrawGroup(SvStream
* pStream
) : LwpDrawObj(pStream
) {}
154 virtual ~LwpDrawGroup() {}
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
; }
166 * Lwp-draw-line object.
168 class LwpDrawLine
: public LwpDrawObj
171 SdwLineRecord m_aLineRec
;
174 LwpDrawLine(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
175 virtual ~LwpDrawLine() {};
179 virtual rtl::OUString
RegisterStyle();
180 virtual XFFrame
* CreateDrawObj(const rtl::OUString
& rStyleName
);
181 virtual XFFrame
* CreateStandardDrawObj(const rtl::OUString
& rStyleName
);
186 * Lwp-draw-polyline object.
188 class LwpDrawPolyLine
: public LwpDrawObj
191 SdwPolyLineRecord m_aPolyLineRec
;
195 LwpDrawPolyLine(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
196 virtual ~LwpDrawPolyLine();
200 virtual rtl::OUString
RegisterStyle();
201 virtual XFFrame
* CreateDrawObj(const rtl::OUString
& rStyleName
);
202 virtual XFFrame
* CreateStandardDrawObj(const rtl::OUString
& rStyleName
);
208 * Lwp-draw-polygon object.
210 class LwpDrawPolygon
: public LwpDrawObj
213 sal_uInt16 m_nNumPoints
;
217 LwpDrawPolygon(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
218 virtual ~LwpDrawPolygon();
222 virtual rtl::OUString
RegisterStyle();
223 virtual XFFrame
* CreateDrawObj(const rtl::OUString
& rStyleName
);
224 virtual XFFrame
* CreateStandardDrawObj(const rtl::OUString
& rStyleName
);
229 * Lwp-draw-rectangle(rounded-corner rectangle) object.
231 class LwpDrawRectangle
: public LwpDrawObj
234 SdwPoint m_aVector
[16];
237 LwpDrawRectangle(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
238 virtual ~LwpDrawRectangle(){}
242 virtual rtl::OUString
RegisterStyle();
243 virtual XFFrame
* CreateDrawObj(const rtl::OUString
& rStyleName
);
244 virtual XFFrame
* CreateStandardDrawObj(const rtl::OUString
& rStyleName
);
247 XFFrame
* CreateRoundedRect(const rtl::OUString
& rStyleName
);
252 * Lwp-draw-ellipse object.
254 class LwpDrawEllipse
: public LwpDrawObj
257 SdwPoint m_aVector
[13];
260 LwpDrawEllipse(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
261 virtual ~LwpDrawEllipse(){};
265 virtual rtl::OUString
RegisterStyle();
266 virtual XFFrame
* CreateDrawObj(const rtl::OUString
& rStyleName
);
267 virtual XFFrame
* CreateStandardDrawObj(const rtl::OUString
& rStyleName
);
273 * Lwp-draw-arc object.
275 class LwpDrawArc
: public LwpDrawObj
278 SdwArcRecord m_aArcRec
;
279 SdwPoint m_aVector
[4];
282 LwpDrawArc(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
283 virtual ~LwpDrawArc() {};
287 virtual rtl::OUString
RegisterStyle();
288 virtual XFFrame
* CreateDrawObj(const rtl::OUString
& rStyleName
);
289 virtual XFFrame
* CreateStandardDrawObj(const rtl::OUString
& rStyleName
);
294 * Lwp-draw-textbox object.
297 class LwpDrawTextBox
: public LwpDrawObj
300 SdwTextBoxRecord m_aTextRec
;
304 LwpDrawTextBox(SvStream
* pStream
);
305 virtual ~LwpDrawTextBox();
306 static void SetFontStyle(XFFont
* pFont
, SdwTextBoxRecord
* pRec
);
310 virtual rtl::OUString
RegisterStyle();
311 virtual XFFrame
* CreateDrawObj(const rtl::OUString
& rStyleName
);
312 virtual XFFrame
* CreateStandardDrawObj(const rtl::OUString
& rStyleName
);
317 * Lwp-draw-curved-text object.
320 class LwpDrawTextArt
: public LwpDrawObj
323 SdwTextArt m_aTextArtRec
;
324 SdwPoint m_aVector
[4];
327 void CreateFWPath(XFDrawPath
* pPath
);
330 LwpDrawTextArt(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
331 virtual ~LwpDrawTextArt();
335 virtual rtl::OUString
RegisterStyle();
336 virtual XFFrame
* CreateDrawObj(const rtl::OUString
& rStyleName
);
337 virtual XFFrame
* CreateStandardDrawObj(const rtl::OUString
& rStyleName
);
342 * Lwp-draw-metafile object.
344 class LwpDrawMetafile
: public LwpDrawObj
347 LwpDrawMetafile(SvStream
* pStream
);
348 virtual ~LwpDrawMetafile() {}
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
;}
359 * Lwp-draw-bitmap object.
361 class LwpDrawBitmap
: public LwpDrawObj
364 SdwBmpRecord m_aBmpRec
;
365 sal_uInt8
* m_pImageData
;
367 LwpDrawBitmap(SvStream
* pStream
);
368 virtual ~LwpDrawBitmap();
372 virtual rtl::OUString
RegisterStyle();
373 virtual XFFrame
* CreateDrawObj(const rtl::OUString
& rStyleName
);
374 virtual XFFrame
* CreateStandardDrawObj(const rtl::OUString
& rStyleName
);