1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
3  *
4  *  The Contents of this file are made available subject to the terms of
5  *  either of the following licenses
6  *
7  *         - GNU Lesser General Public License Version 2.1
8  *         - Sun Industry Standards Source License Version 1.1
9  *
10  *  Sun Microsystems Inc., October, 2000
11  *
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
16  *
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.
20  *
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.
25  *
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
30  *
31  *
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.
38  *
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.
45  *
46  *  The Initial Developer of the Original Code is: IBM Corporation
47  *
48  *  Copyright: 2008 by IBM Corporation
49  *
50  *  All Rights Reserved.
51  *
52  *  Contributor(s): _______________________________________
53  *
54  *
55  ************************************************************************/
56 /*************************************************************************
57  * @file
58  *  For LWP filter architecture prototype
59  ************************************************************************/
60 
61 #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPLAYPIECE_HXX
62 #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPLAYPIECE_HXX
63 
64 #include "lwppiece.hxx"
65 #include <lwpbasetype.hxx>
66 #include "lwpmargins.hxx"
67 #include "lwpborderstuff.hxx"
68 #include "lwpshadow.hxx"
69 
70 
71 class LwpRotor
72 {
73 public:
74     LwpRotor();
75     ~LwpRotor();
76     void Read(LwpObjectStream *pStrm);
77 private:
78     sal_Int16 m_nRotation;  //angle
79 };
80 
81 class LwpLayoutGeometry final : public LwpVirtualPiece
82 {
83 public:
84     LwpLayoutGeometry(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
85     virtual void Parse(IXFStream* pOutputStream) override;
GetWidth() const86     sal_Int32 GetWidth() const { return m_nWidth; }
GetHeight() const87     sal_Int32 GetHeight() const { return m_nHeight; }
GetOrigin() const88     const LwpPoint& GetOrigin() const { return m_Origin; }
GetAbsoluteOrigin() const89     const LwpPoint& GetAbsoluteOrigin() const { return m_AbsoluteOrigin; }
GetContentOrientation() const90     sal_uInt8 GetContentOrientation() const { return m_ContentOrientation;}
91 
92 private:
93     virtual void Read() override;
94     virtual ~LwpLayoutGeometry() override;
95 
96     sal_Int32 m_nWidth;
97     sal_Int32 m_nHeight;
98     LwpPoint m_Origin;
99     LwpPoint m_AbsoluteOrigin;
100     LwpRotor m_ContainerRotor;
101     sal_uInt8 m_ContentOrientation;
102 };
103 
104 class LwpLayoutScale final : public LwpVirtualPiece
105 {
106 public:
107     enum    {ORIGINAL_SIZE = 1, FIT_IN_FRAME = 2, PERCENTAGE = 4,
108              CUSTOM = 8, MAINTAIN_ASPECT_RATIO = 16};
109 
110     enum    {CENTERED = 1, TILED = 2};
111     LwpLayoutScale(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
112     virtual void Parse(IXFStream* pOutputStream) override;
GetScaleMode() const113     sal_uInt16 GetScaleMode() const {return m_nScaleMode;}
GetScalePercentage() const114     sal_uInt32 GetScalePercentage() const {return m_nScalePercentage;}
GetScaleWidth() const115     sal_Int32 GetScaleWidth() const {return m_nScaleWidth;}
GetScaleHeight() const116     sal_Int32 GetScaleHeight() const {return m_nScaleHeight;}
GetPlacement() const117     sal_uInt16 GetPlacement() const {return m_nPlacement;}
GetOffset()118     LwpPoint& GetOffset() {return m_Offset;}
119 private:
120     virtual void Read() override;
121     virtual ~LwpLayoutScale() override;
122 
123     sal_uInt16 m_nScaleMode;
124     sal_uInt32 m_nScalePercentage;
125     sal_Int32 m_nScaleWidth;
126     sal_Int32 m_nScaleHeight;
127     sal_uInt16 m_nContentRotation;
128     LwpPoint m_Offset;
129     sal_uInt16 m_nPlacement;
130 };
131 
132 class LwpLayoutMargins final : public LwpVirtualPiece
133 {
134 public:
135     LwpLayoutMargins(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
136     virtual void Parse(IXFStream* pOutputStream) override;
GetMargins()137     LwpMargins& GetMargins() { return m_Margins; }
GetExtMargins()138     LwpMargins& GetExtMargins(){ return m_ExtMargins;}
139 private:
140     virtual void Read() override;
141     virtual ~LwpLayoutMargins() override;
142 
143     LwpMargins m_Margins;
144     LwpMargins m_ExtMargins;
145     LwpMargins m_ExtraMargins;
146 };
147 
148 class LwpLayoutBorder final : public LwpVirtualPiece
149 {
150 public:
151     LwpLayoutBorder(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
152     virtual void Parse(IXFStream* pOutputStream) override;
GetBorderStuff()153     LwpBorderStuff& GetBorderStuff(){ return m_BorderStuff;}
154 private:
155     virtual void Read() override;
156     virtual ~LwpLayoutBorder() override;
157 
158     LwpBorderStuff m_BorderStuff;
159 };
160 
161 class LwpLayoutBackground final : public LwpVirtualPiece
162 {
163 public:
164     LwpLayoutBackground(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
165     virtual void Parse(IXFStream* pOutputStream) override;
GetBackgoudStuff()166     LwpBackgroundStuff& GetBackgoudStuff(){return m_BackgroundStuff;}
167 private:
168     virtual void Read() override;
169     virtual ~LwpLayoutBackground() override;
170 
171     LwpBackgroundStuff m_BackgroundStuff;
172 };
173 
174 class LwpExternalBorder
175 {
176 public:
177     LwpExternalBorder();
178     ~LwpExternalBorder();
179     void Read(LwpObjectStream *pStrm);
180 private:
181     LwpAtomHolder m_LeftName;
182     LwpAtomHolder m_TopName;
183     LwpAtomHolder m_RightName;
184     LwpAtomHolder m_BottomName;
185 };
186 
187 //It seems that this class is used for designer border. Only read now.
188 class LwpLayoutExternalBorder final : public LwpVirtualPiece
189 {
190 public:
191     LwpLayoutExternalBorder(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
192     virtual void Parse(IXFStream* pOutputStream) override;
193 private:
194     virtual void Read() override;
195     virtual ~LwpLayoutExternalBorder() override;
196 
197     LwpExternalBorder   m_ExtranalBorder;
198 };
199 
200 class LwpColumnInfo
201 {
202 public:
203     LwpColumnInfo();
204     ~LwpColumnInfo();
205     void Read(LwpObjectStream *pStrm);
GetGap()206     double GetGap(){return LwpTools::ConvertFromUnitsToMetric(m_nGap);}
207 private:
208     sal_Int32 m_nWidth;
209     sal_Int32 m_nGap;
210 };
211 
212 class LwpLayoutColumns final : public LwpVirtualPiece
213 {
214 public:
215     LwpLayoutColumns(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
216     virtual void Parse(IXFStream* pOutputStream) override;
GetNumCols() const217     sal_uInt16 GetNumCols() const {return m_nNumCols;}
218     double GetColGap(sal_uInt16 nIndex);
219 private:
220     virtual void Read() override;
221     virtual ~LwpLayoutColumns() override;
222 
223     sal_uInt16 m_nNumCols;
224     std::unique_ptr<LwpColumnInfo[]> m_pColumns;
225 };
226 
227 class LwpLayoutGutters final : public LwpVirtualPiece
228 {
229 public:
230     LwpLayoutGutters(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
231     virtual void Parse(IXFStream* pOutputStream) override;
GetBorderStuff()232     LwpBorderStuff& GetBorderStuff() { return m_BorderBuffer; }
233 private:
234     virtual void Read() override;
235     virtual ~LwpLayoutGutters() override;
236 
237     LwpBorderStuff m_BorderBuffer;
238 };
239 
240 class LwpJoinStuff
241 {
242 public:
243     LwpJoinStuff();
244     ~LwpJoinStuff();
245     void Read(LwpObjectStream *pStrm);
246 private:
247     sal_uInt16 m_nPercentage;
248     sal_uInt16 m_nCorners;
249     sal_Int32 m_nWidth;
250     sal_Int32 m_nHeight;
251 
252     enum JoinType
253     {
254         MITRE = 1,
255         NEGATE = 2,
256         ROUNDED = 3,
257         RECTANGLE = 4,
258         SPECIAL = 5,
259         DIAGONAL = 6,
260         NEGATE_NO_CROSS = 7,
261         DOG_EAR_PAGE = 8,
262         DESKTOP = 9,
263         BOX_HIGHLIGHT = 10,
264         STAR = 11,
265         ROPE = 12,
266         DECO1 = 13,
267         DECO2 = 14,
268         RAIN = 15,
269         PIN = 16,
270         ROSE = 17,
271         SUNF = 18,
272         DECO3 = 19,
273         WARNING = 20,
274         BUBBLE = 21,
275         GIRDER = 22,
276         SMILE = 23,
277         ARROW = 24,
278         MAXJOIN = 24
279     };
280 
281     sal_uInt16 m_nID;//JoinType
282     sal_uInt16 m_nScaling;
283     LwpColor m_Color;
284 };
285 
286 class LwpLayoutJoins final : public LwpVirtualPiece
287 {
288 public:
289     LwpLayoutJoins(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
290     virtual void Parse(IXFStream* pOutputStream) override;
291 private:
292     virtual void Read() override;
293     virtual ~LwpLayoutJoins() override;
294 
295     LwpJoinStuff m_JoinStuff;
296 };
297 
298 class LwpLayoutShadow final : public LwpVirtualPiece
299 {
300 public:
301     LwpLayoutShadow(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
302     virtual void Parse(IXFStream* pOutputStream) override;
GetShadow()303     LwpShadow& GetShadow() { return m_Shadow; }
304 private:
305     virtual void Read() override;
306     virtual ~LwpLayoutShadow() override;
307 
308     LwpShadow m_Shadow;
309 };
310 
311 class LwpLayoutRelativityGuts
312 {
313 public:
314     LwpLayoutRelativityGuts();
315     void Read(LwpObjectStream *pStrm);
GetRelativeType() const316     sal_uInt8 GetRelativeType() const { return m_nRelType;}
317     enum RelativeType
318     {
319         LAY_PARENT_RELATIVE = 1,
320         LAY_PARA_RELATIVE,
321         LAY_INLINE,
322         LAY_INLINE_NEWLINE,
323         LAY_CONTENT_RELATIVE,
324         LAY_INLINE_VERTICAL
325     };
326     enum WhereType
327     {
328         LAY_UPPERLEFT = 1,
329         LAY_MIDDLETOP,
330         LAY_UPPERRIGHT,
331         LAY_MIDDLELEFT,
332         LAY_MIDDLERIGHT,
333         LAY_LOWERLEFT,
334         LAY_MIDDLEBOTTOM,
335         LAY_LOWERRIGHT,
336         LAY_MIDDLE
337     };
338     enum TetherWhereType
339     {
340         LAY_INTERNAL = 1,
341         LAY_EXTERNAL,
342         LAY_BORDER
343     };
344 private:
345     sal_uInt8   m_nRelType;
346     sal_uInt8   m_nRelFromWhere;
347     LwpPoint    m_RelDistance;
348     sal_uInt8   m_nTether;
349     sal_uInt8   m_nTetherWhere;
350     sal_uInt8   m_nFlags;
351 };
352 
353 class LwpLayoutRelativity final : public LwpVirtualPiece
354 {
355 public:
356     LwpLayoutRelativity(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
357     virtual void Parse(IXFStream* pOutputStream) override;
GetRelGuts()358     LwpLayoutRelativityGuts& GetRelGuts() { return m_RelGuts; }
359 private:
360     virtual void Read() override;
361     virtual ~LwpLayoutRelativity() override;
362 
363     LwpLayoutRelativityGuts m_RelGuts;
364 };
365 
366 #endif
367 
368 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
369