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 <sal/config.h>
67 #include <rtl/ref.hxx>
69 #include "lwpsdwdrawheader.hxx"
77 * Lwp-base-draw object.
82 DrawObjectType m_eType
;
84 SdwDrawObjHeader m_aObjHeader
;
85 SdwClosedObjStyleRec m_aClosedObjStyleRec
;
86 DrawingOffsetAndScale
* m_pTransData
;
89 LwpDrawObj(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
= NULL
);
90 virtual ~LwpDrawObj() {}
93 void ReadObjHeaderRecord();
96 void ReadClosedObjStyle();
97 void SetFillStyle(XFDrawStyle
* pStyle
);
98 static void SetLineStyle(XFDrawStyle
* pStyle
, sal_uInt8 nWidth
, sal_uInt8 nLineStyle
,
99 const SdwColor
& rColor
);
100 void SetPosition(XFFrame
* pObj
);
101 static void SetArrowHead(XFDrawStyle
* pOpenedObjStyle
, sal_uInt8 nArrowFlag
, sal_uInt8 nLineWidth
);
102 static OUString
GetArrowName(sal_uInt8 nArrowStyle
);
106 * @descr read out the record of a draw object.
108 virtual void Read() = 0;
111 * @descr register styles of a draw object according to the saved records data.
112 * @return the style name which has been registered.
114 virtual OUString
RegisterStyle() = 0;
117 * @descr create XF-draw object and assign the style name to it.
119 * @return pointer of the created XF-draw object.
121 virtual XFFrame
* CreateDrawObj(const OUString
& rStyleName
) = 0;
124 * @descr create XF-draw object and assign the style name to it.
126 * @return pointer of the created XF-draw object.
128 virtual XFFrame
* CreateStandardDrawObj(const OUString
& rStyleName
) = 0;
132 * @descr create a completed XF-draw object(read data, register styles and create XF-draw object)
133 * @return pointer of the created competed XF-draw object.
135 XFFrame
* CreateXFDrawObject();
138 * @param type of the object.
139 * @descr set the type to the draw object.
141 inline void SetObjectType(DrawObjectType eType
) { m_eType
= eType
; }
144 * @descr get the type of the draw object.
145 * @return the type of the object.
147 inline DrawObjectType
GetObjectType() const { return m_eType
; }
152 * Lwp-draw-group object.
154 class LwpDrawGroup
: public LwpDrawObj
157 LwpDrawGroup(SvStream
* pStream
) : LwpDrawObj(pStream
) {}
158 virtual ~LwpDrawGroup() {}
161 virtual void Read() SAL_OVERRIDE
{}
162 virtual OUString
RegisterStyle() SAL_OVERRIDE
166 virtual XFFrame
* CreateDrawObj(const OUString
& /*rStyleName*/) SAL_OVERRIDE
{ return NULL
; }
167 virtual XFFrame
* CreateStandardDrawObj(const OUString
& /*rStyleName*/) SAL_OVERRIDE
{ return NULL
; }
172 * Lwp-draw-line object.
174 class LwpDrawLine
: public LwpDrawObj
177 SdwLineRecord m_aLineRec
;
180 LwpDrawLine(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
181 virtual ~LwpDrawLine() {}
184 virtual void Read() SAL_OVERRIDE
;
185 virtual OUString
RegisterStyle() SAL_OVERRIDE
;
186 virtual XFFrame
* CreateDrawObj(const OUString
& rStyleName
) SAL_OVERRIDE
;
187 virtual XFFrame
* CreateStandardDrawObj(const OUString
& rStyleName
) SAL_OVERRIDE
;
192 * Lwp-draw-polyline object.
194 class LwpDrawPolyLine
: public LwpDrawObj
197 SdwPolyLineRecord m_aPolyLineRec
;
201 LwpDrawPolyLine(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
202 virtual ~LwpDrawPolyLine();
205 virtual void Read() SAL_OVERRIDE
;
206 virtual OUString
RegisterStyle() SAL_OVERRIDE
;
207 virtual XFFrame
* CreateDrawObj(const OUString
& rStyleName
) SAL_OVERRIDE
;
208 virtual XFFrame
* CreateStandardDrawObj(const OUString
& rStyleName
) SAL_OVERRIDE
;
213 * Lwp-draw-polygon object.
215 class LwpDrawPolygon
: public LwpDrawObj
218 sal_uInt16 m_nNumPoints
;
222 LwpDrawPolygon(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
223 virtual ~LwpDrawPolygon();
226 virtual void Read() SAL_OVERRIDE
;
227 virtual OUString
RegisterStyle() SAL_OVERRIDE
;
228 virtual XFFrame
* CreateDrawObj(const OUString
& rStyleName
) SAL_OVERRIDE
;
229 virtual XFFrame
* CreateStandardDrawObj(const OUString
& rStyleName
) SAL_OVERRIDE
;
234 * Lwp-draw-rectangle(rounded-corner rectangle) object.
236 class LwpDrawRectangle
: public LwpDrawObj
239 SdwPoint m_aVector
[16];
242 LwpDrawRectangle(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
243 virtual ~LwpDrawRectangle(){}
246 virtual void Read() SAL_OVERRIDE
;
247 virtual OUString
RegisterStyle() SAL_OVERRIDE
;
248 virtual XFFrame
* CreateDrawObj(const OUString
& rStyleName
) SAL_OVERRIDE
;
249 virtual XFFrame
* CreateStandardDrawObj(const OUString
& rStyleName
) SAL_OVERRIDE
;
252 XFFrame
* CreateRoundedRect(const OUString
& rStyleName
);
257 * Lwp-draw-ellipse object.
259 class LwpDrawEllipse
: public LwpDrawObj
262 SdwPoint m_aVector
[13];
265 LwpDrawEllipse(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
266 virtual ~LwpDrawEllipse(){}
269 virtual void Read() SAL_OVERRIDE
;
270 virtual OUString
RegisterStyle() SAL_OVERRIDE
;
271 virtual XFFrame
* CreateDrawObj(const OUString
& rStyleName
) SAL_OVERRIDE
;
272 virtual XFFrame
* CreateStandardDrawObj(const OUString
& rStyleName
) SAL_OVERRIDE
;
277 * Lwp-draw-arc object.
279 class LwpDrawArc
: public LwpDrawObj
282 SdwArcRecord m_aArcRec
;
283 SdwPoint m_aVector
[4];
286 LwpDrawArc(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
287 virtual ~LwpDrawArc() {}
290 virtual void Read() SAL_OVERRIDE
;
291 virtual OUString
RegisterStyle() SAL_OVERRIDE
;
292 virtual XFFrame
* CreateDrawObj(const OUString
& rStyleName
) SAL_OVERRIDE
;
293 virtual XFFrame
* CreateStandardDrawObj(const OUString
& rStyleName
) SAL_OVERRIDE
;
298 * Lwp-draw-textbox object.
301 class LwpDrawTextBox
: public LwpDrawObj
304 SdwTextBoxRecord m_aTextRec
;
308 LwpDrawTextBox(SvStream
* pStream
);
309 virtual ~LwpDrawTextBox();
310 static void SetFontStyle(rtl::Reference
<XFFont
> const & pFont
, SdwTextBoxRecord
* pRec
);
313 virtual void Read() SAL_OVERRIDE
;
314 virtual OUString
RegisterStyle() SAL_OVERRIDE
;
315 virtual XFFrame
* CreateDrawObj(const OUString
& rStyleName
) SAL_OVERRIDE
;
316 virtual XFFrame
* CreateStandardDrawObj(const OUString
& rStyleName
) SAL_OVERRIDE
;
321 * Lwp-draw-curved-text object.
324 class LwpDrawTextArt
: public LwpDrawObj
327 SdwTextArt m_aTextArtRec
;
328 SdwPoint m_aVector
[4];
331 void CreateFWPath(XFDrawPath
* pPath
);
334 LwpDrawTextArt(SvStream
* pStream
, DrawingOffsetAndScale
* pTransData
);
335 virtual ~LwpDrawTextArt();
338 virtual void Read() SAL_OVERRIDE
;
339 virtual OUString
RegisterStyle() SAL_OVERRIDE
;
340 virtual XFFrame
* CreateDrawObj(const OUString
& rStyleName
) SAL_OVERRIDE
;
341 virtual XFFrame
* CreateStandardDrawObj(const OUString
& rStyleName
) SAL_OVERRIDE
;
346 * Lwp-draw-metafile object.
348 class LwpDrawMetafile
: public LwpDrawObj
351 LwpDrawMetafile(SvStream
* pStream
);
352 virtual ~LwpDrawMetafile() {}
355 virtual void Read() SAL_OVERRIDE
;
356 virtual OUString
RegisterStyle() SAL_OVERRIDE
360 virtual XFFrame
* CreateDrawObj(const OUString
& /*rStyleName*/) SAL_OVERRIDE
{return NULL
;}
361 virtual XFFrame
* CreateStandardDrawObj(const OUString
& /*rStyleName*/) SAL_OVERRIDE
{return NULL
;}
366 * Lwp-draw-bitmap object.
368 class LwpDrawBitmap
: public LwpDrawObj
371 SdwBmpRecord m_aBmpRec
;
372 sal_uInt8
* m_pImageData
;
374 LwpDrawBitmap(SvStream
* pStream
);
375 virtual ~LwpDrawBitmap();
378 virtual void Read() SAL_OVERRIDE
;
379 virtual OUString
RegisterStyle() SAL_OVERRIDE
;
380 virtual XFFrame
* CreateDrawObj(const OUString
& rStyleName
) SAL_OVERRIDE
;
381 virtual XFFrame
* CreateStandardDrawObj(const OUString
& rStyleName
) SAL_OVERRIDE
;
385 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */