tdf#163948: fix crash when NotesPane is enabled on Tabbed UI
[LibreOffice.git] / lotuswordpro / source / filter / lwpdrawobj.hxx
blob6c1b9273fbc74f8d205f83ebc692b4f86caa6e15
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,
29 * MA 02111-1307 USA
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 ************************************************************************/
56 /**
57 * @file
58 * The file declares the LwpDrawObjects and associated class like LwpDrawGroup, LwpDrawRectangle
59 * and so on.
62 #pragma once
64 #include <sal/config.h>
66 #include <rtl/ref.hxx>
67 #include <rtl/ustring.hxx>
69 #include "lwpsdwdrawheader.hxx"
71 #include <memory>
73 class SvStream;
74 class XFFrame;
75 class XFDrawStyle;
77 /**
78 * @brief
79 * Lwp-base-draw object.
81 class LwpDrawObj
83 protected:
84 DrawObjectType m_eType;
85 SvStream* m_pStream;
86 SdwDrawObjHeader m_aObjHeader;
87 SdwClosedObjStyleRec m_aClosedObjStyleRec;
88 DrawingOffsetAndScale* m_pTransData;
90 public:
91 LwpDrawObj(SvStream* pStream, DrawingOffsetAndScale* pTransData = nullptr);
92 virtual ~LwpDrawObj() {}
94 private:
95 void ReadObjHeaderRecord();
97 protected:
98 void ReadClosedObjStyle();
99 void SetFillStyle(XFDrawStyle* pStyle);
100 static void SetLineStyle(XFDrawStyle* pStyle, sal_uInt8 nWidth, sal_uInt8 nLineStyle,
101 const SdwColor& rColor);
102 void SetPosition(XFFrame* pObj);
103 static void SetArrowHead(XFDrawStyle* pOpenedObjStyle, sal_uInt8 nArrowFlag, sal_uInt8 nLineWidth);
104 static OUString GetArrowName(sal_uInt8 nArrowStyle);
106 protected:
108 * @descr read out the record of a draw object.
110 virtual void Read() = 0;
113 * @descr register styles of a draw object according to the saved records data.
114 * @return the style name which has been registered.
116 virtual OUString RegisterStyle() = 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 rtl::Reference<XFFrame> CreateDrawObj(const OUString& rStyleName) = 0;
126 * @descr create XF-draw object and assign the style name to it.
127 * @param style name.
128 * @return pointer of the created XF-draw object.
130 virtual rtl::Reference<XFFrame> CreateStandardDrawObj(const OUString& rStyleName) = 0;
132 public:
134 * @descr create a completed XF-draw object(read data, register styles and create XF-draw object)
135 * @return pointer of the created completed XF-draw object.
137 rtl::Reference<XFFrame> CreateXFDrawObject();
140 * @param type of the object.
141 * @descr set the type to the draw object.
143 void SetObjectType(DrawObjectType eType) { m_eType = eType; }
147 * @brief
148 * Lwp-draw-group object.
150 class LwpDrawGroup : public LwpDrawObj
152 public:
153 explicit LwpDrawGroup(SvStream* pStream) : LwpDrawObj(pStream) {}
155 protected:
156 virtual void Read() override {}
157 virtual OUString RegisterStyle() override
159 return OUString();
161 virtual rtl::Reference<XFFrame> CreateDrawObj(const OUString& /*rStyleName*/) override { return nullptr; }
162 virtual rtl::Reference<XFFrame> CreateStandardDrawObj(const OUString& /*rStyleName*/) override { return nullptr; }
166 * @brief
167 * Lwp-draw-line object.
169 class LwpDrawLine : public LwpDrawObj
171 private:
172 SdwLineRecord m_aLineRec;
174 public:
175 LwpDrawLine(SvStream * pStream, DrawingOffsetAndScale* pTransData);
177 protected:
178 virtual void Read() override;
179 virtual OUString RegisterStyle() override;
180 virtual rtl::Reference<XFFrame> CreateDrawObj(const OUString& rStyleName) override;
181 virtual rtl::Reference<XFFrame> CreateStandardDrawObj(const OUString& rStyleName) override;
185 * @brief
186 * Lwp-draw-polyline object.
188 class LwpDrawPolyLine : public LwpDrawObj
190 private:
191 SdwPolyLineRecord m_aPolyLineRec;
192 std::unique_ptr<SdwPoint[]> m_pVector;
194 public:
195 LwpDrawPolyLine(SvStream * pStream, DrawingOffsetAndScale* pTransData);
196 virtual ~LwpDrawPolyLine() override;
198 protected:
199 virtual void Read() override;
200 virtual OUString RegisterStyle() override;
201 virtual rtl::Reference<XFFrame> CreateDrawObj(const OUString& rStyleName) override;
202 virtual rtl::Reference<XFFrame> CreateStandardDrawObj(const OUString& rStyleName) override;
206 * @brief
207 * Lwp-draw-polygon object.
209 class LwpDrawPolygon : public LwpDrawObj
211 private:
212 sal_uInt16 m_nNumPoints;
213 std::unique_ptr<SdwPoint[]> m_pVector;
215 public:
216 LwpDrawPolygon(SvStream * pStream, DrawingOffsetAndScale* pTransData);
217 virtual ~LwpDrawPolygon() override;
219 protected:
220 virtual void Read() override;
221 virtual OUString RegisterStyle() override;
222 virtual rtl::Reference<XFFrame> CreateDrawObj(const OUString& rStyleName) override;
223 virtual rtl::Reference<XFFrame> CreateStandardDrawObj(const OUString& rStyleName) override;
227 * @brief
228 * Lwp-draw-rectangle(rounded-corner rectangle) object.
230 class LwpDrawRectangle : public LwpDrawObj
232 private:
233 SdwPoint m_aVector[16];
235 public:
236 LwpDrawRectangle(SvStream* pStream, DrawingOffsetAndScale* pTransData);
238 protected:
239 virtual void Read() override;
240 virtual OUString RegisterStyle() override;
241 virtual rtl::Reference<XFFrame> CreateDrawObj(const OUString& rStyleName) override;
242 virtual rtl::Reference<XFFrame> CreateStandardDrawObj(const OUString& rStyleName) override;
244 private:
245 XFFrame* CreateRoundedRect(const OUString& rStyleName);
249 * @brief
250 * Lwp-draw-ellipse object.
252 class LwpDrawEllipse : public LwpDrawObj
254 private:
255 SdwPoint m_aVector[13];
257 public:
258 LwpDrawEllipse(SvStream * pStream, DrawingOffsetAndScale* pTransData);
260 protected:
261 virtual void Read() override;
262 virtual OUString RegisterStyle() override;
263 virtual rtl::Reference<XFFrame> CreateDrawObj(const OUString& rStyleName) override;
264 virtual rtl::Reference<XFFrame> CreateStandardDrawObj(const OUString& rStyleName) override;
268 * @brief
269 * Lwp-draw-arc object.
271 class LwpDrawArc : public LwpDrawObj
273 private:
274 SdwArcRecord m_aArcRec;
275 SdwPoint m_aVector[4];
277 public:
278 LwpDrawArc(SvStream * pStream, DrawingOffsetAndScale* pTransData);
280 protected:
281 virtual void Read() override;
282 virtual OUString RegisterStyle() override;
283 virtual rtl::Reference<XFFrame> CreateDrawObj(const OUString& rStyleName) override;
284 virtual rtl::Reference<XFFrame> CreateStandardDrawObj(const OUString& rStyleName) override;
288 * @brief
289 * Lwp-draw-textbox object.
291 class XFFont;
292 class LwpDrawTextBox : public LwpDrawObj
294 private:
295 SdwTextBoxRecord m_aTextRec;
296 SdwPoint m_aVector;
298 public:
299 explicit LwpDrawTextBox(SvStream* pStream);
300 virtual ~LwpDrawTextBox() override;
301 static void SetFontStyle(rtl::Reference<XFFont> const & pFont, SdwTextBoxRecord const * pRec);
303 protected:
304 virtual void Read() override;
305 virtual OUString RegisterStyle() override;
306 virtual rtl::Reference<XFFrame> CreateDrawObj(const OUString& rStyleName) override;
307 virtual rtl::Reference<XFFrame> CreateStandardDrawObj(const OUString& rStyleName) override;
311 * @brief
312 * Lwp-draw-curved-text object.
314 class XFDrawPath;
315 class LwpDrawTextArt : public LwpDrawObj
317 private:
318 SdwTextArt m_aTextArtRec;
319 SdwPoint m_aVector[4];
321 private:
322 void CreateFWPath(XFDrawPath* pPath);
324 public:
325 LwpDrawTextArt(SvStream* pStream, DrawingOffsetAndScale* pTransData);
326 virtual ~LwpDrawTextArt() override;
328 protected:
329 virtual void Read() override;
330 virtual OUString RegisterStyle() override;
331 virtual rtl::Reference<XFFrame> CreateDrawObj(const OUString& rStyleName) override;
332 virtual rtl::Reference<XFFrame> CreateStandardDrawObj(const OUString& rStyleName) override;
336 * @brief
337 * Lwp-draw-metafile object.
339 class LwpDrawMetafile : public LwpDrawObj
341 public:
342 explicit LwpDrawMetafile(SvStream* pStream);
344 protected:
345 virtual void Read() override;
346 virtual OUString RegisterStyle() override
348 return OUString();
350 virtual rtl::Reference<XFFrame> CreateDrawObj(const OUString& /*rStyleName*/) override {return nullptr;}
351 virtual rtl::Reference<XFFrame> CreateStandardDrawObj(const OUString& /*rStyleName*/) override {return nullptr;}
355 * @brief
356 * Lwp-draw-bitmap object.
358 class LwpDrawBitmap : public LwpDrawObj
360 private:
361 SdwBmpRecord m_aBmpRec;
362 std::unique_ptr<sal_uInt8[]> m_pImageData;
363 public:
364 explicit LwpDrawBitmap(SvStream* pStream);
365 virtual ~LwpDrawBitmap() override;
367 protected:
368 virtual void Read() override;
369 virtual OUString RegisterStyle() override;
370 virtual rtl::Reference<XFFrame> CreateDrawObj(const OUString& rStyleName) override;
371 virtual rtl::Reference<XFFrame> CreateStandardDrawObj(const OUString& rStyleName) override;
374 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */