1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
10 * Sun Microsystems Inc., October, 2000
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
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.
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.
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,
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.
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.
46 * The Initial Developer of the Original Code is: IBM Corporation
48 * Copyright: 2008 by IBM Corporation
50 * All Rights Reserved.
52 * Contributor(s): _______________________________________
55 ************************************************************************/
58 * The file declares the LwpDrawObjcts and associated class like LwpDrawGroup, LwpDrawRectange
62 #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPDRAWOBJ_HXX
63 #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPDRAWOBJ_HXX
65 #include "lwpsdwdrawheader.hxx"
73 * Lwp-base-draw object.
78 DrawObjectType m_eType
;
80 SdwDrawObjHeader m_aObjHeader
;
81 SdwClosedObjStyleRec m_aClosedObjStyleRec
;
82 DrawingOffsetAndScale
* m_pTransData
;
85 LwpDrawObj(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
= NULL
);
86 virtual ~LwpDrawObj() {}
89 void ReadObjHeaderRecord();
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
);
102 * @descr read out the record of a draw object.
104 virtual void Read() = 0;
107 * @descr register styles of a draw object according to the saved records data.
108 * @return the style name which has been registered.
110 virtual OUString
RegisterStyle() = 0;
113 * @descr create XF-draw object and assign the style name to it.
115 * @return pointer of the created XF-draw object.
117 virtual XFFrame
* CreateDrawObj(const OUString
& rStyleName
) = 0;
120 * @descr create XF-draw object and assign the style name to it.
122 * @return pointer of the created XF-draw object.
124 virtual XFFrame
* CreateStandardDrawObj(const OUString
& rStyleName
) = 0;
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.
131 XFFrame
* CreateXFDrawObject();
134 * @param type of the object.
135 * @descr set the type to the draw object.
137 inline void SetObjectType(DrawObjectType eType
) { m_eType
= eType
; }
140 * @descr get the type of the draw object.
141 * @return the type of the object.
143 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() SAL_OVERRIDE
{}
158 virtual OUString
RegisterStyle() SAL_OVERRIDE
162 virtual XFFrame
* CreateDrawObj(const OUString
& /*rStyleName*/) SAL_OVERRIDE
{ return NULL
; }
163 virtual XFFrame
* CreateStandardDrawObj(const OUString
& /*rStyleName*/) SAL_OVERRIDE
{ return NULL
; }
168 * Lwp-draw-line object.
170 class LwpDrawLine
: public LwpDrawObj
173 SdwLineRecord m_aLineRec
;
176 LwpDrawLine(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
177 virtual ~LwpDrawLine() {}
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
;
188 * Lwp-draw-polyline object.
190 class LwpDrawPolyLine
: public LwpDrawObj
193 SdwPolyLineRecord m_aPolyLineRec
;
197 LwpDrawPolyLine(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
198 virtual ~LwpDrawPolyLine();
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
;
209 * Lwp-draw-polygon object.
211 class LwpDrawPolygon
: public LwpDrawObj
214 sal_uInt16 m_nNumPoints
;
218 LwpDrawPolygon(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
219 virtual ~LwpDrawPolygon();
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
;
230 * Lwp-draw-rectangle(rounded-corner rectangle) object.
232 class LwpDrawRectangle
: public LwpDrawObj
235 SdwPoint m_aVector
[16];
238 LwpDrawRectangle(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
239 virtual ~LwpDrawRectangle(){}
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
;
248 XFFrame
* CreateRoundedRect(const OUString
& rStyleName
);
253 * Lwp-draw-ellipse object.
255 class LwpDrawEllipse
: public LwpDrawObj
258 SdwPoint m_aVector
[13];
261 LwpDrawEllipse(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
262 virtual ~LwpDrawEllipse(){}
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
;
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() {}
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
;
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
);
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
;
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();
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
;
342 * Lwp-draw-metafile object.
344 class LwpDrawMetafile
: public LwpDrawObj
347 LwpDrawMetafile(SvStream
* pStream
);
348 virtual ~LwpDrawMetafile() {}
351 virtual void Read() SAL_OVERRIDE
;
352 virtual OUString
RegisterStyle() SAL_OVERRIDE
356 virtual XFFrame
* CreateDrawObj(const OUString
& /*rStyleName*/) SAL_OVERRIDE
{return NULL
;}
357 virtual XFFrame
* CreateStandardDrawObj(const OUString
& /*rStyleName*/) SAL_OVERRIDE
{return NULL
;}
362 * Lwp-draw-bitmap object.
364 class LwpDrawBitmap
: public LwpDrawObj
367 SdwBmpRecord m_aBmpRec
;
368 sal_uInt8
* m_pImageData
;
370 LwpDrawBitmap(SvStream
* pStream
);
371 virtual ~LwpDrawBitmap();
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
;
381 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */