Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*************************************************************************
3 : *
4 : * The Contents of this file are made available subject to the terms of
5 : * either of the following licenses
6 : *
7 : * - GNU Lesser General Public License Version 2.1
8 : * - Sun Industry Standards Source License Version 1.1
9 : *
10 : * Sun Microsystems Inc., October, 2000
11 : *
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
16 : *
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.
20 : *
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.
25 : *
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
30 : *
31 : *
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.
38 : *
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.
45 : *
46 : * The Initial Developer of the Original Code is: IBM Corporation
47 : *
48 : * Copyright: 2008 by IBM Corporation
49 : *
50 : * All Rights Reserved.
51 : *
52 : * Contributor(s): _______________________________________
53 : *
54 : *
55 : ************************************************************************/
56 : /*************************************************************************
57 : * @file
58 : * For LWP filter architecture prototype
59 : ************************************************************************/
60 :
61 : #include "lwplaypiece.hxx"
62 :
63 : #include "lwpfilehdr.hxx"
64 46 : LwpRotor::LwpRotor()
65 46 : {}
66 :
67 46 : LwpRotor::~LwpRotor()
68 46 : {}
69 :
70 46 : void LwpRotor:: Read(LwpObjectStream *pStrm)
71 : {
72 46 : m_nRotation = pStrm->QuickReadInt16();
73 46 : }
74 :
75 46 : LwpLayoutGeometry::LwpLayoutGeometry(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
76 46 : : LwpVirtualPiece(objHdr, pStrm)
77 46 : {}
78 :
79 92 : LwpLayoutGeometry::~LwpLayoutGeometry()
80 92 : {}
81 :
82 46 : void LwpLayoutGeometry::Read()
83 : {
84 46 : LwpVirtualPiece::Read();
85 :
86 46 : if(LwpFileHeader::m_nFileRevision >= 0x000B)
87 : {
88 46 : m_nWidth = m_pObjStrm->QuickReadInt32();
89 46 : m_nHeight = m_pObjStrm->QuickReadInt32();
90 46 : m_Origin.Read(m_pObjStrm);
91 46 : m_AbsoluteOrigin.Read(m_pObjStrm);
92 46 : m_ContainerRotor.Read(m_pObjStrm);
93 46 : m_ContentOrientation = m_pObjStrm->QuickReaduInt8();
94 46 : m_pObjStrm->SkipExtra();
95 : }
96 46 : }
97 0 : void LwpLayoutGeometry::Parse(IXFStream* /*pOutputStream*/)
98 0 : {}
99 :
100 14 : LwpLayoutScale::LwpLayoutScale(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
101 14 : : LwpVirtualPiece(objHdr, pStrm)
102 14 : {}
103 :
104 28 : LwpLayoutScale::~LwpLayoutScale()
105 28 : {}
106 :
107 14 : void LwpLayoutScale::Read()
108 : {
109 14 : LwpVirtualPiece::Read();
110 :
111 14 : if(LwpFileHeader::m_nFileRevision >= 0x000B)
112 : {
113 14 : m_nScaleMode = m_pObjStrm->QuickReaduInt16();
114 14 : m_nScalePercentage = m_pObjStrm->QuickReaduInt32();
115 14 : m_nScaleWidth = m_pObjStrm->QuickReadInt32();
116 14 : m_nScaleHeight = m_pObjStrm->QuickReadInt32();
117 14 : m_nContentRotation = m_pObjStrm->QuickReaduInt16();
118 14 : m_Offset.Read(m_pObjStrm);
119 :
120 14 : m_nPlacement = m_pObjStrm->QuickReaduInt16();
121 14 : m_pObjStrm->SkipExtra();
122 : }
123 14 : }
124 :
125 0 : void LwpLayoutScale::Parse(IXFStream* /*pOutputStream*/)
126 0 : {}
127 :
128 36 : LwpLayoutMargins::LwpLayoutMargins(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
129 36 : : LwpVirtualPiece(objHdr, pStrm)
130 36 : {}
131 :
132 72 : LwpLayoutMargins::~LwpLayoutMargins()
133 72 : {}
134 :
135 36 : void LwpLayoutMargins::Read()
136 : {
137 36 : LwpVirtualPiece::Read();
138 :
139 36 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
140 : {
141 36 : m_Margins.Read(m_pObjStrm);
142 36 : m_ExtMargins.Read(m_pObjStrm);
143 36 : m_ExtraMargins.Read(m_pObjStrm);
144 36 : m_pObjStrm->SkipExtra();
145 : }
146 36 : }
147 :
148 0 : void LwpLayoutMargins::Parse(IXFStream* /*pOutputStream*/)
149 0 : {}
150 :
151 10 : LwpLayoutBorder::LwpLayoutBorder(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
152 10 : : LwpVirtualPiece(objHdr, pStrm)
153 10 : {}
154 :
155 20 : LwpLayoutBorder::~LwpLayoutBorder()
156 20 : {}
157 :
158 10 : void LwpLayoutBorder::Read()
159 : {
160 10 : LwpVirtualPiece::Read();
161 :
162 10 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
163 : {
164 10 : m_BorderStuff.Read(m_pObjStrm);
165 10 : m_pObjStrm->SkipExtra();
166 : }
167 10 : }
168 :
169 0 : void LwpLayoutBorder::Parse(IXFStream* /*pOutputStream*/)
170 0 : {}
171 :
172 8 : LwpLayoutBackground::LwpLayoutBackground(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
173 8 : : LwpVirtualPiece(objHdr, pStrm)
174 8 : {}
175 :
176 16 : LwpLayoutBackground::~LwpLayoutBackground()
177 16 : {}
178 :
179 8 : void LwpLayoutBackground::Read()
180 : {
181 8 : LwpVirtualPiece::Read();
182 :
183 8 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
184 : {
185 8 : m_BackgroundStuff.Read(m_pObjStrm);
186 8 : m_pObjStrm->SkipExtra();
187 : }
188 8 : }
189 :
190 0 : void LwpLayoutBackground::Parse(IXFStream* /*pOutputStream*/)
191 0 : {}
192 :
193 0 : LwpExternalBorder::LwpExternalBorder()
194 0 : {}
195 :
196 0 : LwpExternalBorder::~LwpExternalBorder()
197 0 : {}
198 :
199 0 : void LwpExternalBorder:: Read(LwpObjectStream *pStrm)
200 : {
201 0 : if( LwpFileHeader::m_nFileRevision >= 0x000F )
202 : {
203 : //enum {BORDER,JOIN};
204 0 : m_LeftName.Read(pStrm);
205 0 : m_TopName.Read(pStrm);
206 0 : m_RightName.Read(pStrm);
207 0 : 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);*/
213 0 : pStrm->SkipExtra();
214 : }
215 0 : }
216 :
217 0 : LwpLayoutExternalBorder::LwpLayoutExternalBorder(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
218 0 : : LwpVirtualPiece(objHdr, pStrm)
219 0 : {}
220 :
221 0 : LwpLayoutExternalBorder::~LwpLayoutExternalBorder()
222 0 : {}
223 :
224 0 : void LwpLayoutExternalBorder::Read()
225 : {
226 0 : LwpVirtualPiece::Read();
227 :
228 0 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
229 : {
230 0 : m_ExtranalBorder.Read(m_pObjStrm);
231 0 : m_pObjStrm->SkipExtra();
232 : }
233 0 : }
234 :
235 0 : void LwpLayoutExternalBorder::Parse(IXFStream* /*pOutputStream*/)
236 0 : {}
237 :
238 12 : LwpColumnInfo::LwpColumnInfo()
239 12 : {}
240 :
241 12 : LwpColumnInfo::~LwpColumnInfo()
242 12 : {}
243 :
244 12 : void LwpColumnInfo:: Read(LwpObjectStream *pStrm)
245 : {
246 12 : m_nWidth = pStrm->QuickReadInt32();
247 12 : m_nGap = pStrm->QuickReadInt32();
248 12 : }
249 :
250 12 : LwpLayoutColumns::LwpLayoutColumns(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
251 12 : : LwpVirtualPiece(objHdr, pStrm),m_pColumns(NULL)
252 12 : {}
253 :
254 36 : LwpLayoutColumns::~LwpLayoutColumns()
255 : {
256 12 : if(m_pColumns)
257 : {
258 12 : delete[] m_pColumns;
259 12 : m_pColumns = NULL;
260 : }
261 :
262 24 : }
263 :
264 12 : void LwpLayoutColumns::Read()
265 : {
266 12 : LwpVirtualPiece::Read();
267 :
268 12 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
269 : {
270 12 : m_nNumCols = m_pObjStrm->QuickReaduInt16();
271 12 : m_pColumns = new LwpColumnInfo[m_nNumCols];
272 24 : for(int i=0; i<m_nNumCols; i++)
273 : {
274 12 : m_pColumns[i].Read(m_pObjStrm);
275 : }
276 12 : m_pObjStrm->SkipExtra();
277 : }
278 12 : }
279 :
280 0 : double LwpLayoutColumns::GetColWidth(sal_uInt16 nIndex)
281 : {
282 0 : if(nIndex >= m_nNumCols)
283 : {
284 0 : return 0;
285 : }
286 0 : return m_pColumns[nIndex].GetWidth();
287 : }
288 :
289 0 : double LwpLayoutColumns::GetColGap(sal_uInt16 nIndex)
290 : {
291 0 : if(nIndex >= m_nNumCols)
292 : {
293 0 : return 0;
294 : }
295 0 : return m_pColumns[nIndex].GetGap();
296 : }
297 :
298 0 : void LwpLayoutColumns::Parse(IXFStream* /*pOutputStream*/)
299 0 : {}
300 :
301 0 : LwpLayoutGutters::LwpLayoutGutters(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
302 0 : : LwpVirtualPiece(objHdr, pStrm)
303 0 : {}
304 :
305 0 : LwpLayoutGutters::~LwpLayoutGutters()
306 0 : {}
307 :
308 0 : void LwpLayoutGutters::Read()
309 : {
310 0 : LwpVirtualPiece::Read();
311 :
312 0 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
313 : {
314 0 : m_BorderBuffer.Read(m_pObjStrm);
315 0 : m_pObjStrm->SkipExtra();
316 : }
317 0 : }
318 :
319 :
320 0 : void LwpLayoutGutters::Parse(IXFStream* /*pOutputStream*/)
321 0 : {}
322 :
323 0 : LwpJoinStuff::LwpJoinStuff()
324 0 : {}
325 :
326 0 : LwpJoinStuff::~LwpJoinStuff()
327 0 : {}
328 :
329 : #include "lwpstyledef.hxx"
330 0 : void LwpJoinStuff:: Read(LwpObjectStream *pStrm)
331 : {
332 0 : m_nWidth = pStrm->QuickReadInt32();
333 0 : m_nHeight = pStrm->QuickReadInt32();
334 0 : m_nPercentage = pStrm->QuickReaduInt16();
335 0 : m_nID = pStrm->QuickReaduInt16();
336 0 : m_nCorners = pStrm->QuickReaduInt16();
337 0 : m_nScaling = pStrm->QuickReaduInt16();
338 0 : m_Color.Read(pStrm);
339 0 : pStrm->SkipExtra();
340 :
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 0 : if (LwpFileHeader::m_nFileRevision < 0x0010)
344 : {
345 0 : if (m_nID & EXTERNAL_ID)
346 0 : m_nID = MITRE;
347 : }
348 0 : }
349 :
350 0 : LwpLayoutJoins::LwpLayoutJoins(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
351 0 : : LwpVirtualPiece(objHdr, pStrm)
352 0 : {}
353 :
354 0 : LwpLayoutJoins::~LwpLayoutJoins()
355 0 : {}
356 :
357 0 : void LwpLayoutJoins::Read()
358 : {
359 0 : LwpVirtualPiece::Read();
360 :
361 0 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
362 : {
363 0 : m_JoinStuff.Read(m_pObjStrm);
364 0 : m_pObjStrm->SkipExtra();
365 : }
366 0 : }
367 :
368 0 : void LwpLayoutJoins::Parse(IXFStream* /*pOutputStream*/)
369 0 : {}
370 :
371 4 : LwpLayoutShadow::LwpLayoutShadow(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
372 4 : : LwpVirtualPiece(objHdr, pStrm)
373 4 : {}
374 :
375 8 : LwpLayoutShadow::~LwpLayoutShadow()
376 8 : {}
377 :
378 4 : void LwpLayoutShadow::Read()
379 : {
380 4 : LwpVirtualPiece::Read();
381 :
382 4 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
383 : {
384 4 : m_Shadow.Read(m_pObjStrm);
385 4 : m_pObjStrm->SkipExtra();
386 : }
387 4 : }
388 :
389 0 : void LwpLayoutShadow::Parse(IXFStream* /*pOutputStream*/)
390 0 : {}
391 : /**************************************************************************
392 : * @descr: Constructor
393 : * @param:
394 : * @param:
395 : * @return:
396 : **************************************************************************/
397 44 : LwpLayoutRelativityGuts::LwpLayoutRelativityGuts()
398 : {
399 44 : m_nRelType = LAY_PARENT_RELATIVE;
400 44 : m_nRelFromWhere = LAY_UPPERLEFT;
401 44 : m_RelDistance.SetX(0);
402 44 : m_RelDistance.SetY(0);
403 44 : m_nTether = LAY_UPPERLEFT;
404 44 : m_nTetherWhere = LAY_BORDER;
405 44 : m_nFlags = 0;
406 44 : }
407 : /**************************************************************************
408 : * @descr: Read LayoutRelativityGuts' information.
409 : * @param:
410 : * @param:
411 : * @return:
412 : **************************************************************************/
413 44 : void LwpLayoutRelativityGuts::Read(LwpObjectStream *pStrm)
414 : {
415 44 : m_nRelType = pStrm->QuickReaduInt8();
416 44 : m_nRelFromWhere = pStrm->QuickReaduInt8();
417 44 : m_RelDistance.Read(pStrm);
418 44 : m_nTether = pStrm->QuickReaduInt8();
419 44 : m_nTetherWhere = pStrm->QuickReaduInt8();
420 44 : if(LwpFileHeader::m_nFileRevision >= 0x000B)
421 : {
422 44 : m_nFlags = pStrm->QuickReaduInt8();
423 : }
424 : else
425 : {
426 0 : m_nFlags = 0;
427 : }
428 44 : }
429 : /**************************************************************************
430 : * @descr: Constructor
431 : * @param:
432 : * @param:
433 : * @return:
434 : **************************************************************************/
435 44 : LwpLayoutRelativity::LwpLayoutRelativity(LwpObjectHeader &objHdr, LwpSvStream *pStrm)
436 44 : : LwpVirtualPiece(objHdr, pStrm)
437 : {
438 44 : }
439 : /**************************************************************************
440 : * @descr: destructor
441 : * @param:
442 : * @param:
443 : * @return:
444 : **************************************************************************/
445 88 : LwpLayoutRelativity::~LwpLayoutRelativity()
446 : {
447 88 : }
448 :
449 44 : void LwpLayoutRelativity::Read()
450 : {
451 44 : LwpVirtualPiece::Read();
452 44 : if(LwpFileHeader::m_nFileRevision >= 0x000B)
453 : {
454 44 : m_RelGuts.Read(m_pObjStrm);
455 44 : m_pObjStrm->SkipExtra();
456 : }
457 44 : }
458 :
459 0 : void LwpLayoutRelativity::Parse(IXFStream * /*pOutputStream*/)
460 : {
461 0 : }
462 :
463 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|