merge the formfield patch from ooo-build
[ooovba.git] / lotuswordpro / source / filter / lwplaypiece.cxx
blobd336a0c2dd3c5c1c6dc187dd80d60d1afc548cb7
1 /*************************************************************************
3 * The Contents of this file are made available subject to the terms of
4 * either of the following licenses
6 * - GNU Lesser General Public License Version 2.1
7 * - Sun Industry Standards Source License Version 1.1
9 * Sun Microsystems Inc., October, 2000
11 * GNU Lesser General Public License Version 2.1
12 * =============================================
13 * Copyright 2000 by Sun Microsystems, Inc.
14 * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License version 2.1, as published by the Free Software Foundation.
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA
31 * Sun Industry Standards Source License Version 1.1
32 * =================================================
33 * The contents of this file are subject to the Sun Industry Standards
34 * Source License Version 1.1 (the "License"); You may not use this file
35 * except in compliance with the License. You may obtain a copy of the
36 * License at http://www.openoffice.org/license.html.
38 * Software provided under this License is provided on an "AS IS" basis,
39 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
40 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
41 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
42 * See the License for the specific provisions governing your rights and
43 * obligations concerning the Software.
45 * The Initial Developer of the Original Code is: IBM Corporation
47 * Copyright: 2008 by IBM Corporation
49 * All Rights Reserved.
51 * Contributor(s): _______________________________________
54 ************************************************************************/
55 /*************************************************************************
56 * @file
57 * For LWP filter architecture prototype
58 ************************************************************************/
59 /*************************************************************************
60 * Change History
61 Jan 28 2005 Created
62 ************************************************************************/
64 #include "lwplaypiece.hxx"
66 #include "lwpfilehdr.hxx"
67 LwpRotor::LwpRotor()
70 LwpRotor::~LwpRotor()
73 void LwpRotor:: Read(LwpObjectStream *pStrm)
75 m_nRotation = pStrm->QuickReadInt16();
78 LwpLayoutGeometry::LwpLayoutGeometry(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
79 : LwpVirtualPiece(objHdr, pStrm)
82 LwpLayoutGeometry::~LwpLayoutGeometry()
85 void LwpLayoutGeometry::Read()
87 LwpVirtualPiece::Read();
89 if(LwpFileHeader::m_nFileRevision >= 0x000B)
91 m_nWidth = m_pObjStrm->QuickReadInt32();
92 m_nHeight = m_pObjStrm->QuickReadInt32();
93 m_Origin.Read(m_pObjStrm);
94 m_AbsoluteOrigin.Read(m_pObjStrm);
95 m_ContainerRotor.Read(m_pObjStrm);
96 m_ContentOrientation = m_pObjStrm->QuickReaduInt8();
97 m_pObjStrm->SkipExtra();
100 void LwpLayoutGeometry::Parse(IXFStream* pOutputStream)
103 LwpLayoutScale::LwpLayoutScale(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
104 : LwpVirtualPiece(objHdr, pStrm)
107 LwpLayoutScale::~LwpLayoutScale()
110 void LwpLayoutScale::Read()
112 LwpVirtualPiece::Read();
114 if(LwpFileHeader::m_nFileRevision >= 0x000B)
116 m_nScaleMode = m_pObjStrm->QuickReaduInt16();
117 m_nScalePercentage = m_pObjStrm->QuickReaduInt32();
118 m_nScaleWidth = m_pObjStrm->QuickReadInt32();
119 m_nScaleHeight = m_pObjStrm->QuickReadInt32();
120 m_nContentRotation = m_pObjStrm->QuickReaduInt16();
121 m_Offset.Read(m_pObjStrm);
123 m_nPlacement = m_pObjStrm->QuickReaduInt16();
124 m_pObjStrm->SkipExtra();
128 void LwpLayoutScale::Parse(IXFStream* pOutputStream)
131 LwpLayoutMargins::LwpLayoutMargins(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
132 : LwpVirtualPiece(objHdr, pStrm)
135 LwpLayoutMargins::~LwpLayoutMargins()
138 void LwpLayoutMargins::Read()
140 LwpVirtualPiece::Read();
142 if( LwpFileHeader::m_nFileRevision >= 0x000B )
144 m_Margins.Read(m_pObjStrm);
145 m_ExtMargins.Read(m_pObjStrm);
146 m_ExtraMargins.Read(m_pObjStrm);
147 m_pObjStrm->SkipExtra();
151 void LwpLayoutMargins::Parse(IXFStream* pOutputStream)
154 LwpLayoutBorder::LwpLayoutBorder(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
155 : LwpVirtualPiece(objHdr, pStrm)
158 LwpLayoutBorder::~LwpLayoutBorder()
161 void LwpLayoutBorder::Read()
163 LwpVirtualPiece::Read();
165 if( LwpFileHeader::m_nFileRevision >= 0x000B )
167 m_BorderStuff.Read(m_pObjStrm);
168 m_pObjStrm->SkipExtra();
172 void LwpLayoutBorder::Parse(IXFStream* pOutputStream)
175 LwpLayoutBackground::LwpLayoutBackground(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
176 : LwpVirtualPiece(objHdr, pStrm)
179 LwpLayoutBackground::~LwpLayoutBackground()
182 void LwpLayoutBackground::Read()
184 LwpVirtualPiece::Read();
186 if( LwpFileHeader::m_nFileRevision >= 0x000B )
188 m_BackgroundStuff.Read(m_pObjStrm);
189 m_pObjStrm->SkipExtra();
193 void LwpLayoutBackground::Parse(IXFStream* pOutputStream)
196 LwpExternalBorder::LwpExternalBorder()
199 LwpExternalBorder::~LwpExternalBorder()
202 void LwpExternalBorder:: Read(LwpObjectStream *pStrm)
204 if( LwpFileHeader::m_nFileRevision >= 0x000F )
206 //enum {BORDER,JOIN};
207 m_LeftName.Read(pStrm);
208 m_TopName.Read(pStrm);
209 m_RightName.Read(pStrm);
210 m_BottomName.Read(pStrm);
211 // TODO: Do not know what it is for
212 /*cLeftName = CStyleMgr::GetUniqueMetaFileName(cLeftName,BORDER);
213 cRightName = CStyleMgr::GetUniqueMetaFileName(cRightName,BORDER);
214 cTopName = CStyleMgr::GetUniqueMetaFileName(cTopName,BORDER);
215 cBottomName = CStyleMgr::GetUniqueMetaFileName(cBottomName,BORDER);*/
216 pStrm->SkipExtra();
220 LwpLayoutExternalBorder::LwpLayoutExternalBorder(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
221 : LwpVirtualPiece(objHdr, pStrm)
224 LwpLayoutExternalBorder::~LwpLayoutExternalBorder()
227 void LwpLayoutExternalBorder::Read()
229 LwpVirtualPiece::Read();
231 if( LwpFileHeader::m_nFileRevision >= 0x000B )
233 m_ExtranalBorder.Read(m_pObjStrm);
234 m_pObjStrm->SkipExtra();
238 void LwpLayoutExternalBorder::Parse(IXFStream* pOutputStream)
241 LwpColumnInfo::LwpColumnInfo()
244 LwpColumnInfo::~LwpColumnInfo()
247 void LwpColumnInfo:: Read(LwpObjectStream *pStrm)
249 m_nWidth = pStrm->QuickReadInt32();
250 m_nGap = pStrm->QuickReadInt32();
253 LwpLayoutColumns::LwpLayoutColumns(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
254 : LwpVirtualPiece(objHdr, pStrm),m_pColumns(NULL)
257 LwpLayoutColumns::~LwpLayoutColumns()
259 if(m_pColumns)
261 delete[] m_pColumns;
262 m_pColumns = NULL;
267 void LwpLayoutColumns::Read()
269 LwpVirtualPiece::Read();
271 if( LwpFileHeader::m_nFileRevision >= 0x000B )
273 m_nNumCols = m_pObjStrm->QuickReaduInt16();
274 m_pColumns = new LwpColumnInfo[m_nNumCols];
275 for(int i=0; i<m_nNumCols; i++)
277 m_pColumns[i].Read(m_pObjStrm);
279 m_pObjStrm->SkipExtra();
283 double LwpLayoutColumns::GetColWidth(sal_uInt16 nIndex)
285 if(nIndex >= m_nNumCols)
287 return 0;
289 return m_pColumns[nIndex].GetWidth();
292 double LwpLayoutColumns::GetColGap(sal_uInt16 nIndex)
294 if(nIndex >= m_nNumCols)
296 return 0;
298 return m_pColumns[nIndex].GetGap();
301 void LwpLayoutColumns::Parse(IXFStream* pOutputStream)
304 LwpLayoutGutters::LwpLayoutGutters(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
305 : LwpVirtualPiece(objHdr, pStrm)
308 LwpLayoutGutters::~LwpLayoutGutters()
311 void LwpLayoutGutters::Read()
313 LwpVirtualPiece::Read();
315 if( LwpFileHeader::m_nFileRevision >= 0x000B )
317 m_BorderBuffer.Read(m_pObjStrm);
318 m_pObjStrm->SkipExtra();
323 void LwpLayoutGutters::Parse(IXFStream* pOutputStream)
326 LwpJoinStuff::LwpJoinStuff()
329 LwpJoinStuff::~LwpJoinStuff()
332 #include "lwpstyledef.hxx"
333 void LwpJoinStuff:: Read(LwpObjectStream *pStrm)
335 m_nWidth = pStrm->QuickReadInt32();
336 m_nHeight = pStrm->QuickReadInt32();
337 m_nPercentage = pStrm->QuickReaduInt16();
338 m_nID = pStrm->QuickReaduInt16();
339 m_nCorners = pStrm->QuickReaduInt16();
340 m_nScaling = pStrm->QuickReaduInt16();
341 m_Color.Read(pStrm);
342 pStrm->SkipExtra();
344 // Bug fix: if reading in from something older than Release 9
345 // then check for the external ID and change it to solid.
346 if (LwpFileHeader::m_nFileRevision < 0x0010)
348 if (m_nID & EXTERNAL_ID)
349 m_nID = MITRE;
353 LwpLayoutJoins::LwpLayoutJoins(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
354 : LwpVirtualPiece(objHdr, pStrm)
357 LwpLayoutJoins::~LwpLayoutJoins()
360 void LwpLayoutJoins::Read()
362 LwpVirtualPiece::Read();
364 if( LwpFileHeader::m_nFileRevision >= 0x000B )
366 m_JoinStuff.Read(m_pObjStrm);
367 m_pObjStrm->SkipExtra();
371 void LwpLayoutJoins::Parse(IXFStream* pOutputStream)
374 LwpLayoutShadow::LwpLayoutShadow(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
375 : LwpVirtualPiece(objHdr, pStrm)
378 LwpLayoutShadow::~LwpLayoutShadow()
381 void LwpLayoutShadow::Read()
383 LwpVirtualPiece::Read();
385 if( LwpFileHeader::m_nFileRevision >= 0x000B )
387 m_Shadow.Read(m_pObjStrm);
388 m_pObjStrm->SkipExtra();
392 void LwpLayoutShadow::Parse(IXFStream* pOutputStream)
394 /**************************************************************************
395 * @descr: Constructor
396 * @param:
397 * @param:
398 * @return:
399 **************************************************************************/
400 LwpLayoutRelativityGuts::LwpLayoutRelativityGuts()
402 m_nRelType = LAY_PARENT_RELATIVE;
403 m_nRelFromWhere = LAY_UPPERLEFT;
404 m_RelDistance.SetX(0);
405 m_RelDistance.SetY(0);
406 m_nTether = LAY_UPPERLEFT;
407 m_nTetherWhere = LAY_BORDER;
408 m_nFlags = 0;
410 /**************************************************************************
411 * @descr: Read LayoutRelativityGuts' infomation.
412 * @param:
413 * @param:
414 * @return:
415 **************************************************************************/
416 void LwpLayoutRelativityGuts::Read(LwpObjectStream *pStrm)
418 m_nRelType = pStrm->QuickReaduInt8();
419 m_nRelFromWhere = pStrm->QuickReaduInt8();
420 m_RelDistance.Read(pStrm);
421 m_nTether = pStrm->QuickReaduInt8();
422 m_nTetherWhere = pStrm->QuickReaduInt8();
423 if(LwpFileHeader::m_nFileRevision >= 0x000B)
425 m_nFlags = pStrm->QuickReaduInt8();
427 else
429 m_nFlags = 0;
432 /**************************************************************************
433 * @descr: Constructor
434 * @param:
435 * @param:
436 * @return:
437 **************************************************************************/
438 LwpLayoutRelativity::LwpLayoutRelativity(LwpObjectHeader &objHdr, LwpSvStream *pStrm)
439 : LwpVirtualPiece(objHdr, pStrm)
442 /**************************************************************************
443 * @descr: destructor
444 * @param:
445 * @param:
446 * @return:
447 **************************************************************************/
448 LwpLayoutRelativity::~LwpLayoutRelativity()
452 void LwpLayoutRelativity::Read()
454 LwpVirtualPiece::Read();
455 if(LwpFileHeader::m_nFileRevision >= 0x000B)
457 m_RelGuts.Read(m_pObjStrm);
458 m_pObjStrm->SkipExtra();
462 void LwpLayoutRelativity::Parse(IXFStream *pOutputStream)