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 ************************************************************************/
56 /*************************************************************************
58 * For LWP filter architecture prototype
59 ************************************************************************/
61 #include "lwplaypiece.hxx"
62 #include "lwpstyledef.hxx"
63 #include <lwpfilehdr.hxx>
73 void LwpRotor:: Read(LwpObjectStream
*pStrm
)
75 m_nRotation
= pStrm
->QuickReadInt16();
78 LwpLayoutGeometry::LwpLayoutGeometry(LwpObjectHeader
const & objHdr
, LwpSvStream
* pStrm
)
79 : LwpVirtualPiece(objHdr
, pStrm
)
82 , m_ContentOrientation(0)
85 LwpLayoutGeometry::~LwpLayoutGeometry()
88 void LwpLayoutGeometry::Read()
90 LwpVirtualPiece::Read();
92 if(LwpFileHeader::m_nFileRevision
>= 0x000B)
94 m_nWidth
= m_pObjStrm
->QuickReadInt32();
95 m_nHeight
= m_pObjStrm
->QuickReadInt32();
96 m_Origin
.Read(m_pObjStrm
.get());
97 m_AbsoluteOrigin
.Read(m_pObjStrm
.get());
98 m_ContainerRotor
.Read(m_pObjStrm
.get());
99 m_ContentOrientation
= m_pObjStrm
->QuickReaduInt8();
100 m_pObjStrm
->SkipExtra();
103 void LwpLayoutGeometry::Parse(IXFStream
* /*pOutputStream*/)
106 LwpLayoutScale::LwpLayoutScale(LwpObjectHeader
const & objHdr
, LwpSvStream
* pStrm
)
107 : LwpVirtualPiece(objHdr
, pStrm
)
109 , m_nScalePercentage(0)
112 , m_nContentRotation(0)
116 LwpLayoutScale::~LwpLayoutScale()
119 void LwpLayoutScale::Read()
121 LwpVirtualPiece::Read();
123 if(LwpFileHeader::m_nFileRevision
>= 0x000B)
125 m_nScaleMode
= m_pObjStrm
->QuickReaduInt16();
126 m_nScalePercentage
= m_pObjStrm
->QuickReaduInt32();
127 m_nScaleWidth
= m_pObjStrm
->QuickReadInt32();
128 m_nScaleHeight
= m_pObjStrm
->QuickReadInt32();
129 m_nContentRotation
= m_pObjStrm
->QuickReaduInt16();
130 m_Offset
.Read(m_pObjStrm
.get());
132 m_nPlacement
= m_pObjStrm
->QuickReaduInt16();
133 m_pObjStrm
->SkipExtra();
137 void LwpLayoutScale::Parse(IXFStream
* /*pOutputStream*/)
140 LwpLayoutMargins::LwpLayoutMargins(LwpObjectHeader
const & objHdr
, LwpSvStream
* pStrm
)
141 : LwpVirtualPiece(objHdr
, pStrm
)
144 LwpLayoutMargins::~LwpLayoutMargins()
147 void LwpLayoutMargins::Read()
149 LwpVirtualPiece::Read();
151 if( LwpFileHeader::m_nFileRevision
>= 0x000B )
153 m_Margins
.Read(m_pObjStrm
.get());
154 m_ExtMargins
.Read(m_pObjStrm
.get());
155 m_ExtraMargins
.Read(m_pObjStrm
.get());
156 m_pObjStrm
->SkipExtra();
160 void LwpLayoutMargins::Parse(IXFStream
* /*pOutputStream*/)
163 LwpLayoutBorder::LwpLayoutBorder(LwpObjectHeader
const & objHdr
, LwpSvStream
* pStrm
)
164 : LwpVirtualPiece(objHdr
, pStrm
)
167 LwpLayoutBorder::~LwpLayoutBorder()
170 void LwpLayoutBorder::Read()
172 LwpVirtualPiece::Read();
174 if( LwpFileHeader::m_nFileRevision
>= 0x000B )
176 m_BorderStuff
.Read(m_pObjStrm
.get());
177 m_pObjStrm
->SkipExtra();
181 void LwpLayoutBorder::Parse(IXFStream
* /*pOutputStream*/)
184 LwpLayoutBackground::LwpLayoutBackground(LwpObjectHeader
const & objHdr
, LwpSvStream
* pStrm
)
185 : LwpVirtualPiece(objHdr
, pStrm
)
188 LwpLayoutBackground::~LwpLayoutBackground()
191 void LwpLayoutBackground::Read()
193 LwpVirtualPiece::Read();
195 if( LwpFileHeader::m_nFileRevision
>= 0x000B )
197 m_BackgroundStuff
.Read(m_pObjStrm
.get());
198 m_pObjStrm
->SkipExtra();
202 void LwpLayoutBackground::Parse(IXFStream
* /*pOutputStream*/)
205 LwpExternalBorder::LwpExternalBorder()
208 LwpExternalBorder::~LwpExternalBorder()
211 void LwpExternalBorder:: Read(LwpObjectStream
*pStrm
)
213 if( LwpFileHeader::m_nFileRevision
< 0x000F )
216 //enum {BORDER,JOIN};
217 m_LeftName
.Read(pStrm
);
218 m_TopName
.Read(pStrm
);
219 m_RightName
.Read(pStrm
);
220 m_BottomName
.Read(pStrm
);
221 // TODO: Do not know what it is for
222 /*cLeftName = CStyleMgr::GetUniqueMetaFileName(cLeftName,BORDER);
223 cRightName = CStyleMgr::GetUniqueMetaFileName(cRightName,BORDER);
224 cTopName = CStyleMgr::GetUniqueMetaFileName(cTopName,BORDER);
225 cBottomName = CStyleMgr::GetUniqueMetaFileName(cBottomName,BORDER);*/
229 LwpLayoutExternalBorder::LwpLayoutExternalBorder(LwpObjectHeader
const & objHdr
, LwpSvStream
* pStrm
)
230 : LwpVirtualPiece(objHdr
, pStrm
)
233 LwpLayoutExternalBorder::~LwpLayoutExternalBorder()
236 void LwpLayoutExternalBorder::Read()
238 LwpVirtualPiece::Read();
240 if( LwpFileHeader::m_nFileRevision
>= 0x000B )
242 m_ExtranalBorder
.Read(m_pObjStrm
.get());
243 m_pObjStrm
->SkipExtra();
247 void LwpLayoutExternalBorder::Parse(IXFStream
* /*pOutputStream*/)
250 LwpColumnInfo::LwpColumnInfo()
255 LwpColumnInfo::~LwpColumnInfo()
258 void LwpColumnInfo:: Read(LwpObjectStream
*pStrm
)
260 m_nWidth
= pStrm
->QuickReadInt32();
261 m_nGap
= pStrm
->QuickReadInt32();
264 LwpLayoutColumns::LwpLayoutColumns(LwpObjectHeader
const & objHdr
, LwpSvStream
* pStrm
)
265 : LwpVirtualPiece(objHdr
, pStrm
)
269 LwpLayoutColumns::~LwpLayoutColumns()
273 void LwpLayoutColumns::Read()
275 LwpVirtualPiece::Read();
277 if( LwpFileHeader::m_nFileRevision
>= 0x000B )
279 m_nNumCols
= m_pObjStrm
->QuickReaduInt16();
280 m_pColumns
.reset( new LwpColumnInfo
[m_nNumCols
] );
281 for(int i
=0; i
<m_nNumCols
; i
++)
283 m_pColumns
[i
].Read(m_pObjStrm
.get());
285 m_pObjStrm
->SkipExtra();
289 double LwpLayoutColumns::GetColGap(sal_uInt16 nIndex
)
291 if(nIndex
>= m_nNumCols
)
295 return m_pColumns
[nIndex
].GetGap();
298 void LwpLayoutColumns::Parse(IXFStream
* /*pOutputStream*/)
301 LwpLayoutGutters::LwpLayoutGutters(LwpObjectHeader
const & objHdr
, LwpSvStream
* pStrm
)
302 : LwpVirtualPiece(objHdr
, pStrm
)
305 LwpLayoutGutters::~LwpLayoutGutters()
308 void LwpLayoutGutters::Read()
310 LwpVirtualPiece::Read();
312 if( LwpFileHeader::m_nFileRevision
>= 0x000B )
314 m_BorderBuffer
.Read(m_pObjStrm
.get());
315 m_pObjStrm
->SkipExtra();
319 void LwpLayoutGutters::Parse(IXFStream
* /*pOutputStream*/)
322 LwpJoinStuff::LwpJoinStuff()
331 LwpJoinStuff::~LwpJoinStuff()
334 void LwpJoinStuff:: Read(LwpObjectStream
*pStrm
)
336 m_nWidth
= pStrm
->QuickReadInt32();
337 m_nHeight
= pStrm
->QuickReadInt32();
338 m_nPercentage
= pStrm
->QuickReaduInt16();
339 m_nID
= pStrm
->QuickReaduInt16();
340 m_nCorners
= pStrm
->QuickReaduInt16();
341 m_nScaling
= pStrm
->QuickReaduInt16();
345 // Bug fix: if reading in from something older than Release 9
346 // then check for the external ID and change it to solid.
347 if (LwpFileHeader::m_nFileRevision
< 0x0010)
349 if (m_nID
& EXTERNAL_ID
)
354 LwpLayoutJoins::LwpLayoutJoins(LwpObjectHeader
const & objHdr
, LwpSvStream
* pStrm
)
355 : LwpVirtualPiece(objHdr
, pStrm
)
358 LwpLayoutJoins::~LwpLayoutJoins()
361 void LwpLayoutJoins::Read()
363 LwpVirtualPiece::Read();
365 if( LwpFileHeader::m_nFileRevision
>= 0x000B )
367 m_JoinStuff
.Read(m_pObjStrm
.get());
368 m_pObjStrm
->SkipExtra();
372 void LwpLayoutJoins::Parse(IXFStream
* /*pOutputStream*/)
375 LwpLayoutShadow::LwpLayoutShadow(LwpObjectHeader
const & objHdr
, LwpSvStream
* pStrm
)
376 : LwpVirtualPiece(objHdr
, pStrm
)
379 LwpLayoutShadow::~LwpLayoutShadow()
382 void LwpLayoutShadow::Read()
384 LwpVirtualPiece::Read();
386 if( LwpFileHeader::m_nFileRevision
>= 0x000B )
388 m_Shadow
.Read(m_pObjStrm
.get());
389 m_pObjStrm
->SkipExtra();
393 void LwpLayoutShadow::Parse(IXFStream
* /*pOutputStream*/)
396 LwpLayoutRelativityGuts::LwpLayoutRelativityGuts()
397 : m_nRelType(LAY_PARENT_RELATIVE
),
398 m_nRelFromWhere(LAY_UPPERLEFT
),
399 m_nTether(LAY_UPPERLEFT
),
400 m_nTetherWhere(LAY_BORDER
),
403 m_RelDistance
.SetX(0);
404 m_RelDistance
.SetY(0);
406 /**************************************************************************
407 * @descr: Read LayoutRelativityGuts' information.
408 **************************************************************************/
409 void LwpLayoutRelativityGuts::Read(LwpObjectStream
*pStrm
)
411 m_nRelType
= pStrm
->QuickReaduInt8();
412 m_nRelFromWhere
= pStrm
->QuickReaduInt8();
413 m_RelDistance
.Read(pStrm
);
414 m_nTether
= pStrm
->QuickReaduInt8();
415 m_nTetherWhere
= pStrm
->QuickReaduInt8();
416 if(LwpFileHeader::m_nFileRevision
>= 0x000B)
418 m_nFlags
= pStrm
->QuickReaduInt8();
426 LwpLayoutRelativity::LwpLayoutRelativity(LwpObjectHeader
const &objHdr
, LwpSvStream
*pStrm
)
427 : LwpVirtualPiece(objHdr
, pStrm
)
431 LwpLayoutRelativity::~LwpLayoutRelativity()
435 void LwpLayoutRelativity::Read()
437 LwpVirtualPiece::Read();
438 if(LwpFileHeader::m_nFileRevision
>= 0x000B)
440 m_RelGuts
.Read(m_pObjStrm
.get());
441 m_pObjStrm
->SkipExtra();
445 void LwpLayoutRelativity::Parse(IXFStream
* /*pOutputStream*/)
449 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */