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"
63 #include "lwpfilehdr.hxx"
70 void LwpRotor:: Read(LwpObjectStream
*pStrm
)
72 m_nRotation
= pStrm
->QuickReadInt16();
75 LwpLayoutGeometry::LwpLayoutGeometry(LwpObjectHeader
& objHdr
, LwpSvStream
* pStrm
)
76 : LwpVirtualPiece(objHdr
, pStrm
)
79 LwpLayoutGeometry::~LwpLayoutGeometry()
82 void LwpLayoutGeometry::Read()
84 LwpVirtualPiece::Read();
86 if(LwpFileHeader::m_nFileRevision
>= 0x000B)
88 m_nWidth
= m_pObjStrm
->QuickReadInt32();
89 m_nHeight
= m_pObjStrm
->QuickReadInt32();
90 m_Origin
.Read(m_pObjStrm
);
91 m_AbsoluteOrigin
.Read(m_pObjStrm
);
92 m_ContainerRotor
.Read(m_pObjStrm
);
93 m_ContentOrientation
= m_pObjStrm
->QuickReaduInt8();
94 m_pObjStrm
->SkipExtra();
97 void LwpLayoutGeometry::Parse(IXFStream
* /*pOutputStream*/)
100 LwpLayoutScale::LwpLayoutScale(LwpObjectHeader
& objHdr
, LwpSvStream
* pStrm
)
101 : LwpVirtualPiece(objHdr
, pStrm
)
104 LwpLayoutScale::~LwpLayoutScale()
107 void LwpLayoutScale::Read()
109 LwpVirtualPiece::Read();
111 if(LwpFileHeader::m_nFileRevision
>= 0x000B)
113 m_nScaleMode
= m_pObjStrm
->QuickReaduInt16();
114 m_nScalePercentage
= m_pObjStrm
->QuickReaduInt32();
115 m_nScaleWidth
= m_pObjStrm
->QuickReadInt32();
116 m_nScaleHeight
= m_pObjStrm
->QuickReadInt32();
117 m_nContentRotation
= m_pObjStrm
->QuickReaduInt16();
118 m_Offset
.Read(m_pObjStrm
);
120 m_nPlacement
= m_pObjStrm
->QuickReaduInt16();
121 m_pObjStrm
->SkipExtra();
125 void LwpLayoutScale::Parse(IXFStream
* /*pOutputStream*/)
128 LwpLayoutMargins::LwpLayoutMargins(LwpObjectHeader
& objHdr
, LwpSvStream
* pStrm
)
129 : LwpVirtualPiece(objHdr
, pStrm
)
132 LwpLayoutMargins::~LwpLayoutMargins()
135 void LwpLayoutMargins::Read()
137 LwpVirtualPiece::Read();
139 if( LwpFileHeader::m_nFileRevision
>= 0x000B )
141 m_Margins
.Read(m_pObjStrm
);
142 m_ExtMargins
.Read(m_pObjStrm
);
143 m_ExtraMargins
.Read(m_pObjStrm
);
144 m_pObjStrm
->SkipExtra();
148 void LwpLayoutMargins::Parse(IXFStream
* /*pOutputStream*/)
151 LwpLayoutBorder::LwpLayoutBorder(LwpObjectHeader
& objHdr
, LwpSvStream
* pStrm
)
152 : LwpVirtualPiece(objHdr
, pStrm
)
155 LwpLayoutBorder::~LwpLayoutBorder()
158 void LwpLayoutBorder::Read()
160 LwpVirtualPiece::Read();
162 if( LwpFileHeader::m_nFileRevision
>= 0x000B )
164 m_BorderStuff
.Read(m_pObjStrm
);
165 m_pObjStrm
->SkipExtra();
169 void LwpLayoutBorder::Parse(IXFStream
* /*pOutputStream*/)
172 LwpLayoutBackground::LwpLayoutBackground(LwpObjectHeader
& objHdr
, LwpSvStream
* pStrm
)
173 : LwpVirtualPiece(objHdr
, pStrm
)
176 LwpLayoutBackground::~LwpLayoutBackground()
179 void LwpLayoutBackground::Read()
181 LwpVirtualPiece::Read();
183 if( LwpFileHeader::m_nFileRevision
>= 0x000B )
185 m_BackgroundStuff
.Read(m_pObjStrm
);
186 m_pObjStrm
->SkipExtra();
190 void LwpLayoutBackground::Parse(IXFStream
* /*pOutputStream*/)
193 LwpExternalBorder::LwpExternalBorder()
196 LwpExternalBorder::~LwpExternalBorder()
199 void LwpExternalBorder:: Read(LwpObjectStream
*pStrm
)
201 if( LwpFileHeader::m_nFileRevision
>= 0x000F )
203 //enum {BORDER,JOIN};
204 m_LeftName
.Read(pStrm
);
205 m_TopName
.Read(pStrm
);
206 m_RightName
.Read(pStrm
);
207 m_BottomName
.Read(pStrm
);
208 // TODO: Do not know what it is for
209 /*cLeftName = CStyleMgr::GetUniqueMetaFileName(cLeftName,BORDER);
210 cRightName = CStyleMgr::GetUniqueMetaFileName(cRightName,BORDER);
211 cTopName = CStyleMgr::GetUniqueMetaFileName(cTopName,BORDER);
212 cBottomName = CStyleMgr::GetUniqueMetaFileName(cBottomName,BORDER);*/
217 LwpLayoutExternalBorder::LwpLayoutExternalBorder(LwpObjectHeader
& objHdr
, LwpSvStream
* pStrm
)
218 : LwpVirtualPiece(objHdr
, pStrm
)
221 LwpLayoutExternalBorder::~LwpLayoutExternalBorder()
224 void LwpLayoutExternalBorder::Read()
226 LwpVirtualPiece::Read();
228 if( LwpFileHeader::m_nFileRevision
>= 0x000B )
230 m_ExtranalBorder
.Read(m_pObjStrm
);
231 m_pObjStrm
->SkipExtra();
235 void LwpLayoutExternalBorder::Parse(IXFStream
* /*pOutputStream*/)
238 LwpColumnInfo::LwpColumnInfo()
241 LwpColumnInfo::~LwpColumnInfo()
244 void LwpColumnInfo:: Read(LwpObjectStream
*pStrm
)
246 m_nWidth
= pStrm
->QuickReadInt32();
247 m_nGap
= pStrm
->QuickReadInt32();
250 LwpLayoutColumns::LwpLayoutColumns(LwpObjectHeader
& objHdr
, LwpSvStream
* pStrm
)
251 : LwpVirtualPiece(objHdr
, pStrm
),m_pColumns(NULL
)
254 LwpLayoutColumns::~LwpLayoutColumns()
264 void LwpLayoutColumns::Read()
266 LwpVirtualPiece::Read();
268 if( LwpFileHeader::m_nFileRevision
>= 0x000B )
270 m_nNumCols
= m_pObjStrm
->QuickReaduInt16();
271 m_pColumns
= new LwpColumnInfo
[m_nNumCols
];
272 for(int i
=0; i
<m_nNumCols
; i
++)
274 m_pColumns
[i
].Read(m_pObjStrm
);
276 m_pObjStrm
->SkipExtra();
280 double LwpLayoutColumns::GetColWidth(sal_uInt16 nIndex
)
282 if(nIndex
>= m_nNumCols
)
286 return m_pColumns
[nIndex
].GetWidth();
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
& 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
);
315 m_pObjStrm
->SkipExtra();
320 void LwpLayoutGutters::Parse(IXFStream
* /*pOutputStream*/)
323 LwpJoinStuff::LwpJoinStuff()
326 LwpJoinStuff::~LwpJoinStuff()
329 #include "lwpstyledef.hxx"
330 void LwpJoinStuff:: Read(LwpObjectStream
*pStrm
)
332 m_nWidth
= pStrm
->QuickReadInt32();
333 m_nHeight
= pStrm
->QuickReadInt32();
334 m_nPercentage
= pStrm
->QuickReaduInt16();
335 m_nID
= pStrm
->QuickReaduInt16();
336 m_nCorners
= pStrm
->QuickReaduInt16();
337 m_nScaling
= pStrm
->QuickReaduInt16();
341 // Bug fix: if reading in from something older than Release 9
342 // then check for the external ID and change it to solid.
343 if (LwpFileHeader::m_nFileRevision
< 0x0010)
345 if (m_nID
& EXTERNAL_ID
)
350 LwpLayoutJoins::LwpLayoutJoins(LwpObjectHeader
& objHdr
, LwpSvStream
* pStrm
)
351 : LwpVirtualPiece(objHdr
, pStrm
)
354 LwpLayoutJoins::~LwpLayoutJoins()
357 void LwpLayoutJoins::Read()
359 LwpVirtualPiece::Read();
361 if( LwpFileHeader::m_nFileRevision
>= 0x000B )
363 m_JoinStuff
.Read(m_pObjStrm
);
364 m_pObjStrm
->SkipExtra();
368 void LwpLayoutJoins::Parse(IXFStream
* /*pOutputStream*/)
371 LwpLayoutShadow::LwpLayoutShadow(LwpObjectHeader
& objHdr
, LwpSvStream
* pStrm
)
372 : LwpVirtualPiece(objHdr
, pStrm
)
375 LwpLayoutShadow::~LwpLayoutShadow()
378 void LwpLayoutShadow::Read()
380 LwpVirtualPiece::Read();
382 if( LwpFileHeader::m_nFileRevision
>= 0x000B )
384 m_Shadow
.Read(m_pObjStrm
);
385 m_pObjStrm
->SkipExtra();
389 void LwpLayoutShadow::Parse(IXFStream
* /*pOutputStream*/)
391 /**************************************************************************
392 * @descr: Constructor
396 **************************************************************************/
397 LwpLayoutRelativityGuts::LwpLayoutRelativityGuts()
399 m_nRelType
= LAY_PARENT_RELATIVE
;
400 m_nRelFromWhere
= LAY_UPPERLEFT
;
401 m_RelDistance
.SetX(0);
402 m_RelDistance
.SetY(0);
403 m_nTether
= LAY_UPPERLEFT
;
404 m_nTetherWhere
= LAY_BORDER
;
407 /**************************************************************************
408 * @descr: Read LayoutRelativityGuts' information.
412 **************************************************************************/
413 void LwpLayoutRelativityGuts::Read(LwpObjectStream
*pStrm
)
415 m_nRelType
= pStrm
->QuickReaduInt8();
416 m_nRelFromWhere
= pStrm
->QuickReaduInt8();
417 m_RelDistance
.Read(pStrm
);
418 m_nTether
= pStrm
->QuickReaduInt8();
419 m_nTetherWhere
= pStrm
->QuickReaduInt8();
420 if(LwpFileHeader::m_nFileRevision
>= 0x000B)
422 m_nFlags
= pStrm
->QuickReaduInt8();
429 /**************************************************************************
430 * @descr: Constructor
434 **************************************************************************/
435 LwpLayoutRelativity::LwpLayoutRelativity(LwpObjectHeader
&objHdr
, LwpSvStream
*pStrm
)
436 : LwpVirtualPiece(objHdr
, pStrm
)
439 /**************************************************************************
444 **************************************************************************/
445 LwpLayoutRelativity::~LwpLayoutRelativity()
449 void LwpLayoutRelativity::Read()
451 LwpVirtualPiece::Read();
452 if(LwpFileHeader::m_nFileRevision
>= 0x000B)
454 m_RelGuts
.Read(m_pObjStrm
);
455 m_pObjStrm
->SkipExtra();
459 void LwpLayoutRelativity::Parse(IXFStream
* /*pOutputStream*/)
463 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */