resolves: tdf#162337 Initial selection of tracked change when Manage
[LibreOffice.git] / lotuswordpro / source / filter / lwplaypiece.cxx
blob34a1e381e99c7be2b9dbe9cca014b59efb943b78
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"
62 #include "lwpstyledef.hxx"
63 #include <lwpfilehdr.hxx>
66 LwpRotor::LwpRotor()
67 : m_nRotation(0)
70 void LwpRotor:: Read(LwpObjectStream *pStrm)
72 m_nRotation = pStrm->QuickReadInt16();
75 LwpLayoutGeometry::LwpLayoutGeometry(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
76 : LwpVirtualPiece(objHdr, pStrm)
77 , m_nWidth(0)
78 , m_nHeight(0)
79 , m_ContentOrientation(0)
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.get());
94 m_AbsoluteOrigin.Read(m_pObjStrm.get());
95 m_ContainerRotor.Read(m_pObjStrm.get());
96 m_ContentOrientation = m_pObjStrm->QuickReaduInt8();
97 m_pObjStrm->SkipExtra();
100 void LwpLayoutGeometry::Parse(IXFStream* /*pOutputStream*/)
103 LwpLayoutScale::LwpLayoutScale(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
104 : LwpVirtualPiece(objHdr, pStrm)
105 , m_nScaleMode(0)
106 , m_nScalePercentage(0)
107 , m_nScaleWidth(0)
108 , m_nScaleHeight(0)
109 , m_nContentRotation(0)
110 , m_nPlacement(0)
113 LwpLayoutScale::~LwpLayoutScale()
116 void LwpLayoutScale::Read()
118 LwpVirtualPiece::Read();
120 if(LwpFileHeader::m_nFileRevision >= 0x000B)
122 m_nScaleMode = m_pObjStrm->QuickReaduInt16();
123 m_nScalePercentage = m_pObjStrm->QuickReaduInt32();
124 m_nScaleWidth = m_pObjStrm->QuickReadInt32();
125 m_nScaleHeight = m_pObjStrm->QuickReadInt32();
126 m_nContentRotation = m_pObjStrm->QuickReaduInt16();
127 m_Offset.Read(m_pObjStrm.get());
129 m_nPlacement = m_pObjStrm->QuickReaduInt16();
130 m_pObjStrm->SkipExtra();
134 void LwpLayoutScale::Parse(IXFStream* /*pOutputStream*/)
137 LwpLayoutMargins::LwpLayoutMargins(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
138 : LwpVirtualPiece(objHdr, pStrm)
141 LwpLayoutMargins::~LwpLayoutMargins()
144 void LwpLayoutMargins::Read()
146 LwpVirtualPiece::Read();
148 if( LwpFileHeader::m_nFileRevision >= 0x000B )
150 m_Margins.Read(m_pObjStrm.get());
151 m_ExtMargins.Read(m_pObjStrm.get());
152 m_ExtraMargins.Read(m_pObjStrm.get());
153 m_pObjStrm->SkipExtra();
157 void LwpLayoutMargins::Parse(IXFStream* /*pOutputStream*/)
160 LwpLayoutBorder::LwpLayoutBorder(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
161 : LwpVirtualPiece(objHdr, pStrm)
164 LwpLayoutBorder::~LwpLayoutBorder()
167 void LwpLayoutBorder::Read()
169 LwpVirtualPiece::Read();
171 if( LwpFileHeader::m_nFileRevision >= 0x000B )
173 m_BorderStuff.Read(m_pObjStrm.get());
174 m_pObjStrm->SkipExtra();
178 void LwpLayoutBorder::Parse(IXFStream* /*pOutputStream*/)
181 LwpLayoutBackground::LwpLayoutBackground(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
182 : LwpVirtualPiece(objHdr, pStrm)
185 LwpLayoutBackground::~LwpLayoutBackground()
188 void LwpLayoutBackground::Read()
190 LwpVirtualPiece::Read();
192 if( LwpFileHeader::m_nFileRevision >= 0x000B )
194 m_BackgroundStuff.Read(m_pObjStrm.get());
195 m_pObjStrm->SkipExtra();
199 void LwpLayoutBackground::Parse(IXFStream* /*pOutputStream*/)
202 LwpExternalBorder::LwpExternalBorder()
205 LwpExternalBorder::~LwpExternalBorder()
208 void LwpExternalBorder:: Read(LwpObjectStream *pStrm)
210 if( LwpFileHeader::m_nFileRevision < 0x000F )
211 return;
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();
226 LwpLayoutExternalBorder::LwpLayoutExternalBorder(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
227 : LwpVirtualPiece(objHdr, pStrm)
230 LwpLayoutExternalBorder::~LwpLayoutExternalBorder()
233 void LwpLayoutExternalBorder::Read()
235 LwpVirtualPiece::Read();
237 if( LwpFileHeader::m_nFileRevision >= 0x000B )
239 m_ExtranalBorder.Read(m_pObjStrm.get());
240 m_pObjStrm->SkipExtra();
244 void LwpLayoutExternalBorder::Parse(IXFStream* /*pOutputStream*/)
247 LwpColumnInfo::LwpColumnInfo()
248 : m_nWidth(0)
249 , m_nGap(0)
252 void LwpColumnInfo:: Read(LwpObjectStream *pStrm)
254 m_nWidth = pStrm->QuickReadInt32();
255 m_nGap = pStrm->QuickReadInt32();
258 LwpLayoutColumns::LwpLayoutColumns(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
259 : LwpVirtualPiece(objHdr, pStrm)
260 , m_nNumCols(0)
263 LwpLayoutColumns::~LwpLayoutColumns()
267 void LwpLayoutColumns::Read()
269 LwpVirtualPiece::Read();
271 if( LwpFileHeader::m_nFileRevision >= 0x000B )
273 m_nNumCols = m_pObjStrm->QuickReaduInt16();
274 m_pColumns.reset( new LwpColumnInfo[m_nNumCols] );
275 for(int i=0; i<m_nNumCols; i++)
277 m_pColumns[i].Read(m_pObjStrm.get());
279 m_pObjStrm->SkipExtra();
283 double LwpLayoutColumns::GetColGap(sal_uInt16 nIndex)
285 if(nIndex >= m_nNumCols)
287 return 0;
289 return m_pColumns[nIndex].GetGap();
292 void LwpLayoutColumns::Parse(IXFStream* /*pOutputStream*/)
295 LwpLayoutGutters::LwpLayoutGutters(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
296 : LwpVirtualPiece(objHdr, pStrm)
299 LwpLayoutGutters::~LwpLayoutGutters()
302 void LwpLayoutGutters::Read()
304 LwpVirtualPiece::Read();
306 if( LwpFileHeader::m_nFileRevision >= 0x000B )
308 m_BorderBuffer.Read(m_pObjStrm.get());
309 m_pObjStrm->SkipExtra();
313 void LwpLayoutGutters::Parse(IXFStream* /*pOutputStream*/)
316 LwpJoinStuff::LwpJoinStuff()
317 : m_nPercentage(0)
318 , m_nCorners(0)
319 , m_nWidth(0)
320 , m_nHeight(0)
321 , m_nID(0)
322 , m_nScaling(0)
325 void LwpJoinStuff:: Read(LwpObjectStream *pStrm)
327 m_nWidth = pStrm->QuickReadInt32();
328 m_nHeight = pStrm->QuickReadInt32();
329 m_nPercentage = pStrm->QuickReaduInt16();
330 m_nID = pStrm->QuickReaduInt16();
331 m_nCorners = pStrm->QuickReaduInt16();
332 m_nScaling = pStrm->QuickReaduInt16();
333 m_Color.Read(pStrm);
334 pStrm->SkipExtra();
336 // Bug fix: if reading in from something older than Release 9
337 // then check for the external ID and change it to solid.
338 if (LwpFileHeader::m_nFileRevision < 0x0010)
340 if (m_nID & EXTERNAL_ID)
341 m_nID = MITRE;
345 LwpLayoutJoins::LwpLayoutJoins(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
346 : LwpVirtualPiece(objHdr, pStrm)
349 LwpLayoutJoins::~LwpLayoutJoins()
352 void LwpLayoutJoins::Read()
354 LwpVirtualPiece::Read();
356 if( LwpFileHeader::m_nFileRevision >= 0x000B )
358 m_JoinStuff.Read(m_pObjStrm.get());
359 m_pObjStrm->SkipExtra();
363 void LwpLayoutJoins::Parse(IXFStream* /*pOutputStream*/)
366 LwpLayoutShadow::LwpLayoutShadow(LwpObjectHeader const & objHdr, LwpSvStream* pStrm)
367 : LwpVirtualPiece(objHdr, pStrm)
370 LwpLayoutShadow::~LwpLayoutShadow()
373 void LwpLayoutShadow::Read()
375 LwpVirtualPiece::Read();
377 if( LwpFileHeader::m_nFileRevision >= 0x000B )
379 m_Shadow.Read(m_pObjStrm.get());
380 m_pObjStrm->SkipExtra();
384 void LwpLayoutShadow::Parse(IXFStream* /*pOutputStream*/)
387 LwpLayoutRelativityGuts::LwpLayoutRelativityGuts()
388 : m_nRelType(LAY_PARENT_RELATIVE),
389 m_nRelFromWhere(LAY_UPPERLEFT),
390 m_nTether(LAY_UPPERLEFT),
391 m_nTetherWhere(LAY_BORDER),
392 m_nFlags(0)
394 m_RelDistance.SetX(0);
395 m_RelDistance.SetY(0);
397 /**************************************************************************
398 * @descr: Read LayoutRelativityGuts' information.
399 **************************************************************************/
400 void LwpLayoutRelativityGuts::Read(LwpObjectStream *pStrm)
402 m_nRelType = pStrm->QuickReaduInt8();
403 m_nRelFromWhere = pStrm->QuickReaduInt8();
404 m_RelDistance.Read(pStrm);
405 m_nTether = pStrm->QuickReaduInt8();
406 m_nTetherWhere = pStrm->QuickReaduInt8();
407 if(LwpFileHeader::m_nFileRevision >= 0x000B)
409 m_nFlags = pStrm->QuickReaduInt8();
411 else
413 m_nFlags = 0;
417 LwpLayoutRelativity::LwpLayoutRelativity(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
418 : LwpVirtualPiece(objHdr, pStrm)
422 LwpLayoutRelativity::~LwpLayoutRelativity()
426 void LwpLayoutRelativity::Read()
428 LwpVirtualPiece::Read();
429 if(LwpFileHeader::m_nFileRevision >= 0x000B)
431 m_RelGuts.Read(m_pObjStrm.get());
432 m_pObjStrm->SkipExtra();
436 void LwpLayoutRelativity::Parse(IXFStream * /*pOutputStream*/)
440 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */