fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / lotuswordpro / source / filter / lwplaypiece.cxx
blob80c8d08841012b8c791c58a4afe055bfe329ef3a
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 * For LWP filter architecture prototype
59 ************************************************************************/
61 #include "lwplaypiece.hxx"
63 #include "lwpfilehdr.hxx"
64 LwpRotor::LwpRotor()
65 : m_nRotation(0)
68 LwpRotor::~LwpRotor()
71 void LwpRotor:: Read(LwpObjectStream *pStrm)
73 m_nRotation = pStrm->QuickReadInt16();
76 LwpLayoutGeometry::LwpLayoutGeometry(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
77 : LwpVirtualPiece(objHdr, pStrm)
78 , m_nWidth(0)
79 , m_nHeight(0)
80 , m_ContentOrientation(0)
83 LwpLayoutGeometry::~LwpLayoutGeometry()
86 void LwpLayoutGeometry::Read()
88 LwpVirtualPiece::Read();
90 if(LwpFileHeader::m_nFileRevision >= 0x000B)
92 m_nWidth = m_pObjStrm->QuickReadInt32();
93 m_nHeight = m_pObjStrm->QuickReadInt32();
94 m_Origin.Read(m_pObjStrm);
95 m_AbsoluteOrigin.Read(m_pObjStrm);
96 m_ContainerRotor.Read(m_pObjStrm);
97 m_ContentOrientation = m_pObjStrm->QuickReaduInt8();
98 m_pObjStrm->SkipExtra();
101 void LwpLayoutGeometry::Parse(IXFStream* /*pOutputStream*/)
104 LwpLayoutScale::LwpLayoutScale(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
105 : LwpVirtualPiece(objHdr, pStrm)
106 , m_nScaleMode(0)
107 , m_nScalePercentage(0)
108 , m_nScaleWidth(0)
109 , m_nScaleHeight(0)
110 , m_nContentRotation(0)
111 , m_nPlacement(0)
114 LwpLayoutScale::~LwpLayoutScale()
117 void LwpLayoutScale::Read()
119 LwpVirtualPiece::Read();
121 if(LwpFileHeader::m_nFileRevision >= 0x000B)
123 m_nScaleMode = m_pObjStrm->QuickReaduInt16();
124 m_nScalePercentage = m_pObjStrm->QuickReaduInt32();
125 m_nScaleWidth = m_pObjStrm->QuickReadInt32();
126 m_nScaleHeight = m_pObjStrm->QuickReadInt32();
127 m_nContentRotation = m_pObjStrm->QuickReaduInt16();
128 m_Offset.Read(m_pObjStrm);
130 m_nPlacement = m_pObjStrm->QuickReaduInt16();
131 m_pObjStrm->SkipExtra();
135 void LwpLayoutScale::Parse(IXFStream* /*pOutputStream*/)
138 LwpLayoutMargins::LwpLayoutMargins(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
139 : LwpVirtualPiece(objHdr, pStrm)
142 LwpLayoutMargins::~LwpLayoutMargins()
145 void LwpLayoutMargins::Read()
147 LwpVirtualPiece::Read();
149 if( LwpFileHeader::m_nFileRevision >= 0x000B )
151 m_Margins.Read(m_pObjStrm);
152 m_ExtMargins.Read(m_pObjStrm);
153 m_ExtraMargins.Read(m_pObjStrm);
154 m_pObjStrm->SkipExtra();
158 void LwpLayoutMargins::Parse(IXFStream* /*pOutputStream*/)
161 LwpLayoutBorder::LwpLayoutBorder(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
162 : LwpVirtualPiece(objHdr, pStrm)
165 LwpLayoutBorder::~LwpLayoutBorder()
168 void LwpLayoutBorder::Read()
170 LwpVirtualPiece::Read();
172 if( LwpFileHeader::m_nFileRevision >= 0x000B )
174 m_BorderStuff.Read(m_pObjStrm);
175 m_pObjStrm->SkipExtra();
179 void LwpLayoutBorder::Parse(IXFStream* /*pOutputStream*/)
182 LwpLayoutBackground::LwpLayoutBackground(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
183 : LwpVirtualPiece(objHdr, pStrm)
186 LwpLayoutBackground::~LwpLayoutBackground()
189 void LwpLayoutBackground::Read()
191 LwpVirtualPiece::Read();
193 if( LwpFileHeader::m_nFileRevision >= 0x000B )
195 m_BackgroundStuff.Read(m_pObjStrm);
196 m_pObjStrm->SkipExtra();
200 void LwpLayoutBackground::Parse(IXFStream* /*pOutputStream*/)
203 LwpExternalBorder::LwpExternalBorder()
206 LwpExternalBorder::~LwpExternalBorder()
209 void LwpExternalBorder:: Read(LwpObjectStream *pStrm)
211 if( LwpFileHeader::m_nFileRevision >= 0x000F )
213 //enum {BORDER,JOIN};
214 m_LeftName.Read(pStrm);
215 m_TopName.Read(pStrm);
216 m_RightName.Read(pStrm);
217 m_BottomName.Read(pStrm);
218 // TODO: Do not know what it is for
219 /*cLeftName = CStyleMgr::GetUniqueMetaFileName(cLeftName,BORDER);
220 cRightName = CStyleMgr::GetUniqueMetaFileName(cRightName,BORDER);
221 cTopName = CStyleMgr::GetUniqueMetaFileName(cTopName,BORDER);
222 cBottomName = CStyleMgr::GetUniqueMetaFileName(cBottomName,BORDER);*/
223 pStrm->SkipExtra();
227 LwpLayoutExternalBorder::LwpLayoutExternalBorder(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
228 : LwpVirtualPiece(objHdr, pStrm)
231 LwpLayoutExternalBorder::~LwpLayoutExternalBorder()
234 void LwpLayoutExternalBorder::Read()
236 LwpVirtualPiece::Read();
238 if( LwpFileHeader::m_nFileRevision >= 0x000B )
240 m_ExtranalBorder.Read(m_pObjStrm);
241 m_pObjStrm->SkipExtra();
245 void LwpLayoutExternalBorder::Parse(IXFStream* /*pOutputStream*/)
248 LwpColumnInfo::LwpColumnInfo()
249 : m_nWidth(0)
250 , m_nGap(0)
253 LwpColumnInfo::~LwpColumnInfo()
256 void LwpColumnInfo:: Read(LwpObjectStream *pStrm)
258 m_nWidth = pStrm->QuickReadInt32();
259 m_nGap = pStrm->QuickReadInt32();
262 LwpLayoutColumns::LwpLayoutColumns(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
263 : LwpVirtualPiece(objHdr, pStrm)
264 , m_nNumCols(0)
265 , m_pColumns(NULL)
268 LwpLayoutColumns::~LwpLayoutColumns()
270 if(m_pColumns)
272 delete[] m_pColumns;
273 m_pColumns = NULL;
278 void LwpLayoutColumns::Read()
280 LwpVirtualPiece::Read();
282 if( LwpFileHeader::m_nFileRevision >= 0x000B )
284 m_nNumCols = m_pObjStrm->QuickReaduInt16();
285 m_pColumns = new LwpColumnInfo[m_nNumCols];
286 for(int i=0; i<m_nNumCols; i++)
288 m_pColumns[i].Read(m_pObjStrm);
290 m_pObjStrm->SkipExtra();
294 double LwpLayoutColumns::GetColWidth(sal_uInt16 nIndex)
296 if(nIndex >= m_nNumCols)
298 return 0;
300 return m_pColumns[nIndex].GetWidth();
303 double LwpLayoutColumns::GetColGap(sal_uInt16 nIndex)
305 if(nIndex >= m_nNumCols)
307 return 0;
309 return m_pColumns[nIndex].GetGap();
312 void LwpLayoutColumns::Parse(IXFStream* /*pOutputStream*/)
315 LwpLayoutGutters::LwpLayoutGutters(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
316 : LwpVirtualPiece(objHdr, pStrm)
319 LwpLayoutGutters::~LwpLayoutGutters()
322 void LwpLayoutGutters::Read()
324 LwpVirtualPiece::Read();
326 if( LwpFileHeader::m_nFileRevision >= 0x000B )
328 m_BorderBuffer.Read(m_pObjStrm);
329 m_pObjStrm->SkipExtra();
333 void LwpLayoutGutters::Parse(IXFStream* /*pOutputStream*/)
336 LwpJoinStuff::LwpJoinStuff()
337 : m_nPercentage(0)
338 , m_nCorners(0)
339 , m_nWidth(0)
340 , m_nHeight(0)
341 , m_nID(0)
342 , m_nScaling(0)
345 LwpJoinStuff::~LwpJoinStuff()
348 #include "lwpstyledef.hxx"
349 void LwpJoinStuff:: Read(LwpObjectStream *pStrm)
351 m_nWidth = pStrm->QuickReadInt32();
352 m_nHeight = pStrm->QuickReadInt32();
353 m_nPercentage = pStrm->QuickReaduInt16();
354 m_nID = pStrm->QuickReaduInt16();
355 m_nCorners = pStrm->QuickReaduInt16();
356 m_nScaling = pStrm->QuickReaduInt16();
357 m_Color.Read(pStrm);
358 pStrm->SkipExtra();
360 // Bug fix: if reading in from something older than Release 9
361 // then check for the external ID and change it to solid.
362 if (LwpFileHeader::m_nFileRevision < 0x0010)
364 if (m_nID & EXTERNAL_ID)
365 m_nID = MITRE;
369 LwpLayoutJoins::LwpLayoutJoins(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
370 : LwpVirtualPiece(objHdr, pStrm)
373 LwpLayoutJoins::~LwpLayoutJoins()
376 void LwpLayoutJoins::Read()
378 LwpVirtualPiece::Read();
380 if( LwpFileHeader::m_nFileRevision >= 0x000B )
382 m_JoinStuff.Read(m_pObjStrm);
383 m_pObjStrm->SkipExtra();
387 void LwpLayoutJoins::Parse(IXFStream* /*pOutputStream*/)
390 LwpLayoutShadow::LwpLayoutShadow(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
391 : LwpVirtualPiece(objHdr, pStrm)
394 LwpLayoutShadow::~LwpLayoutShadow()
397 void LwpLayoutShadow::Read()
399 LwpVirtualPiece::Read();
401 if( LwpFileHeader::m_nFileRevision >= 0x000B )
403 m_Shadow.Read(m_pObjStrm);
404 m_pObjStrm->SkipExtra();
408 void LwpLayoutShadow::Parse(IXFStream* /*pOutputStream*/)
410 /**************************************************************************
411 * @descr: Constructor
412 * @param:
413 * @param:
414 * @return:
415 **************************************************************************/
416 LwpLayoutRelativityGuts::LwpLayoutRelativityGuts()
418 m_nRelType = LAY_PARENT_RELATIVE;
419 m_nRelFromWhere = LAY_UPPERLEFT;
420 m_RelDistance.SetX(0);
421 m_RelDistance.SetY(0);
422 m_nTether = LAY_UPPERLEFT;
423 m_nTetherWhere = LAY_BORDER;
424 m_nFlags = 0;
426 /**************************************************************************
427 * @descr: Read LayoutRelativityGuts' information.
428 * @param:
429 * @param:
430 * @return:
431 **************************************************************************/
432 void LwpLayoutRelativityGuts::Read(LwpObjectStream *pStrm)
434 m_nRelType = pStrm->QuickReaduInt8();
435 m_nRelFromWhere = pStrm->QuickReaduInt8();
436 m_RelDistance.Read(pStrm);
437 m_nTether = pStrm->QuickReaduInt8();
438 m_nTetherWhere = pStrm->QuickReaduInt8();
439 if(LwpFileHeader::m_nFileRevision >= 0x000B)
441 m_nFlags = pStrm->QuickReaduInt8();
443 else
445 m_nFlags = 0;
448 /**************************************************************************
449 * @descr: Constructor
450 * @param:
451 * @param:
452 * @return:
453 **************************************************************************/
454 LwpLayoutRelativity::LwpLayoutRelativity(LwpObjectHeader &objHdr, LwpSvStream *pStrm)
455 : LwpVirtualPiece(objHdr, pStrm)
458 /**************************************************************************
459 * @descr: destructor
460 * @param:
461 * @param:
462 * @return:
463 **************************************************************************/
464 LwpLayoutRelativity::~LwpLayoutRelativity()
468 void LwpLayoutRelativity::Read()
470 LwpVirtualPiece::Read();
471 if(LwpFileHeader::m_nFileRevision >= 0x000B)
473 m_RelGuts.Read(m_pObjStrm);
474 m_pObjStrm->SkipExtra();
478 void LwpLayoutRelativity::Parse(IXFStream * /*pOutputStream*/)
482 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */