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 92 : LwpRotor::LwpRotor()
65 92 : : m_nRotation(0)
66 92 : {}
67 :
68 92 : LwpRotor::~LwpRotor()
69 92 : {}
70 :
71 92 : void LwpRotor:: Read(LwpObjectStream *pStrm)
72 : {
73 92 : m_nRotation = pStrm->QuickReadInt16();
74 92 : }
75 :
76 92 : LwpLayoutGeometry::LwpLayoutGeometry(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
77 : : LwpVirtualPiece(objHdr, pStrm)
78 : , m_nWidth(0)
79 : , m_nHeight(0)
80 92 : , m_ContentOrientation(0)
81 92 : {}
82 :
83 184 : LwpLayoutGeometry::~LwpLayoutGeometry()
84 184 : {}
85 :
86 92 : void LwpLayoutGeometry::Read()
87 : {
88 92 : LwpVirtualPiece::Read();
89 :
90 92 : if(LwpFileHeader::m_nFileRevision >= 0x000B)
91 : {
92 92 : m_nWidth = m_pObjStrm->QuickReadInt32();
93 92 : m_nHeight = m_pObjStrm->QuickReadInt32();
94 92 : m_Origin.Read(m_pObjStrm);
95 92 : m_AbsoluteOrigin.Read(m_pObjStrm);
96 92 : m_ContainerRotor.Read(m_pObjStrm);
97 92 : m_ContentOrientation = m_pObjStrm->QuickReaduInt8();
98 92 : m_pObjStrm->SkipExtra();
99 : }
100 92 : }
101 0 : void LwpLayoutGeometry::Parse(IXFStream* /*pOutputStream*/)
102 0 : {}
103 :
104 28 : LwpLayoutScale::LwpLayoutScale(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
105 : : LwpVirtualPiece(objHdr, pStrm)
106 : , m_nScaleMode(0)
107 : , m_nScalePercentage(0)
108 : , m_nScaleWidth(0)
109 : , m_nScaleHeight(0)
110 : , m_nContentRotation(0)
111 28 : , m_nPlacement(0)
112 28 : {}
113 :
114 56 : LwpLayoutScale::~LwpLayoutScale()
115 56 : {}
116 :
117 28 : void LwpLayoutScale::Read()
118 : {
119 28 : LwpVirtualPiece::Read();
120 :
121 28 : if(LwpFileHeader::m_nFileRevision >= 0x000B)
122 : {
123 28 : m_nScaleMode = m_pObjStrm->QuickReaduInt16();
124 28 : m_nScalePercentage = m_pObjStrm->QuickReaduInt32();
125 28 : m_nScaleWidth = m_pObjStrm->QuickReadInt32();
126 28 : m_nScaleHeight = m_pObjStrm->QuickReadInt32();
127 28 : m_nContentRotation = m_pObjStrm->QuickReaduInt16();
128 28 : m_Offset.Read(m_pObjStrm);
129 :
130 28 : m_nPlacement = m_pObjStrm->QuickReaduInt16();
131 28 : m_pObjStrm->SkipExtra();
132 : }
133 28 : }
134 :
135 0 : void LwpLayoutScale::Parse(IXFStream* /*pOutputStream*/)
136 0 : {}
137 :
138 72 : LwpLayoutMargins::LwpLayoutMargins(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
139 72 : : LwpVirtualPiece(objHdr, pStrm)
140 72 : {}
141 :
142 144 : LwpLayoutMargins::~LwpLayoutMargins()
143 144 : {}
144 :
145 72 : void LwpLayoutMargins::Read()
146 : {
147 72 : LwpVirtualPiece::Read();
148 :
149 72 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
150 : {
151 72 : m_Margins.Read(m_pObjStrm);
152 72 : m_ExtMargins.Read(m_pObjStrm);
153 72 : m_ExtraMargins.Read(m_pObjStrm);
154 72 : m_pObjStrm->SkipExtra();
155 : }
156 72 : }
157 :
158 0 : void LwpLayoutMargins::Parse(IXFStream* /*pOutputStream*/)
159 0 : {}
160 :
161 20 : LwpLayoutBorder::LwpLayoutBorder(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
162 20 : : LwpVirtualPiece(objHdr, pStrm)
163 20 : {}
164 :
165 40 : LwpLayoutBorder::~LwpLayoutBorder()
166 40 : {}
167 :
168 20 : void LwpLayoutBorder::Read()
169 : {
170 20 : LwpVirtualPiece::Read();
171 :
172 20 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
173 : {
174 20 : m_BorderStuff.Read(m_pObjStrm);
175 20 : m_pObjStrm->SkipExtra();
176 : }
177 20 : }
178 :
179 0 : void LwpLayoutBorder::Parse(IXFStream* /*pOutputStream*/)
180 0 : {}
181 :
182 16 : LwpLayoutBackground::LwpLayoutBackground(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
183 16 : : LwpVirtualPiece(objHdr, pStrm)
184 16 : {}
185 :
186 32 : LwpLayoutBackground::~LwpLayoutBackground()
187 32 : {}
188 :
189 16 : void LwpLayoutBackground::Read()
190 : {
191 16 : LwpVirtualPiece::Read();
192 :
193 16 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
194 : {
195 16 : m_BackgroundStuff.Read(m_pObjStrm);
196 16 : m_pObjStrm->SkipExtra();
197 : }
198 16 : }
199 :
200 0 : void LwpLayoutBackground::Parse(IXFStream* /*pOutputStream*/)
201 0 : {}
202 :
203 0 : LwpExternalBorder::LwpExternalBorder()
204 0 : {}
205 :
206 0 : LwpExternalBorder::~LwpExternalBorder()
207 0 : {}
208 :
209 0 : void LwpExternalBorder:: Read(LwpObjectStream *pStrm)
210 : {
211 0 : if( LwpFileHeader::m_nFileRevision >= 0x000F )
212 : {
213 : //enum {BORDER,JOIN};
214 0 : m_LeftName.Read(pStrm);
215 0 : m_TopName.Read(pStrm);
216 0 : m_RightName.Read(pStrm);
217 0 : 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 0 : pStrm->SkipExtra();
224 : }
225 0 : }
226 :
227 0 : LwpLayoutExternalBorder::LwpLayoutExternalBorder(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
228 0 : : LwpVirtualPiece(objHdr, pStrm)
229 0 : {}
230 :
231 0 : LwpLayoutExternalBorder::~LwpLayoutExternalBorder()
232 0 : {}
233 :
234 0 : void LwpLayoutExternalBorder::Read()
235 : {
236 0 : LwpVirtualPiece::Read();
237 :
238 0 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
239 : {
240 0 : m_ExtranalBorder.Read(m_pObjStrm);
241 0 : m_pObjStrm->SkipExtra();
242 : }
243 0 : }
244 :
245 0 : void LwpLayoutExternalBorder::Parse(IXFStream* /*pOutputStream*/)
246 0 : {}
247 :
248 24 : LwpColumnInfo::LwpColumnInfo()
249 : : m_nWidth(0)
250 24 : , m_nGap(0)
251 24 : {}
252 :
253 24 : LwpColumnInfo::~LwpColumnInfo()
254 24 : {}
255 :
256 24 : void LwpColumnInfo:: Read(LwpObjectStream *pStrm)
257 : {
258 24 : m_nWidth = pStrm->QuickReadInt32();
259 24 : m_nGap = pStrm->QuickReadInt32();
260 24 : }
261 :
262 24 : LwpLayoutColumns::LwpLayoutColumns(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
263 : : LwpVirtualPiece(objHdr, pStrm)
264 : , m_nNumCols(0)
265 24 : , m_pColumns(NULL)
266 24 : {}
267 :
268 72 : LwpLayoutColumns::~LwpLayoutColumns()
269 : {
270 24 : if(m_pColumns)
271 : {
272 24 : delete[] m_pColumns;
273 24 : m_pColumns = NULL;
274 : }
275 :
276 48 : }
277 :
278 24 : void LwpLayoutColumns::Read()
279 : {
280 24 : LwpVirtualPiece::Read();
281 :
282 24 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
283 : {
284 24 : m_nNumCols = m_pObjStrm->QuickReaduInt16();
285 24 : m_pColumns = new LwpColumnInfo[m_nNumCols];
286 48 : for(int i=0; i<m_nNumCols; i++)
287 : {
288 24 : m_pColumns[i].Read(m_pObjStrm);
289 : }
290 24 : m_pObjStrm->SkipExtra();
291 : }
292 24 : }
293 :
294 0 : double LwpLayoutColumns::GetColWidth(sal_uInt16 nIndex)
295 : {
296 0 : if(nIndex >= m_nNumCols)
297 : {
298 0 : return 0;
299 : }
300 0 : return m_pColumns[nIndex].GetWidth();
301 : }
302 :
303 0 : double LwpLayoutColumns::GetColGap(sal_uInt16 nIndex)
304 : {
305 0 : if(nIndex >= m_nNumCols)
306 : {
307 0 : return 0;
308 : }
309 0 : return m_pColumns[nIndex].GetGap();
310 : }
311 :
312 0 : void LwpLayoutColumns::Parse(IXFStream* /*pOutputStream*/)
313 0 : {}
314 :
315 0 : LwpLayoutGutters::LwpLayoutGutters(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
316 0 : : LwpVirtualPiece(objHdr, pStrm)
317 0 : {}
318 :
319 0 : LwpLayoutGutters::~LwpLayoutGutters()
320 0 : {}
321 :
322 0 : void LwpLayoutGutters::Read()
323 : {
324 0 : LwpVirtualPiece::Read();
325 :
326 0 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
327 : {
328 0 : m_BorderBuffer.Read(m_pObjStrm);
329 0 : m_pObjStrm->SkipExtra();
330 : }
331 0 : }
332 :
333 0 : void LwpLayoutGutters::Parse(IXFStream* /*pOutputStream*/)
334 0 : {}
335 :
336 0 : LwpJoinStuff::LwpJoinStuff()
337 : : m_nPercentage(0)
338 : , m_nCorners(0)
339 : , m_nWidth(0)
340 : , m_nHeight(0)
341 : , m_nID(0)
342 0 : , m_nScaling(0)
343 0 : {}
344 :
345 0 : LwpJoinStuff::~LwpJoinStuff()
346 0 : {}
347 :
348 : #include "lwpstyledef.hxx"
349 0 : void LwpJoinStuff:: Read(LwpObjectStream *pStrm)
350 : {
351 0 : m_nWidth = pStrm->QuickReadInt32();
352 0 : m_nHeight = pStrm->QuickReadInt32();
353 0 : m_nPercentage = pStrm->QuickReaduInt16();
354 0 : m_nID = pStrm->QuickReaduInt16();
355 0 : m_nCorners = pStrm->QuickReaduInt16();
356 0 : m_nScaling = pStrm->QuickReaduInt16();
357 0 : m_Color.Read(pStrm);
358 0 : pStrm->SkipExtra();
359 :
360 : // Bug fix: if reading in from something older than Release 9
361 : // then check for the external ID and change it to solid.
362 0 : if (LwpFileHeader::m_nFileRevision < 0x0010)
363 : {
364 0 : if (m_nID & EXTERNAL_ID)
365 0 : m_nID = MITRE;
366 : }
367 0 : }
368 :
369 0 : LwpLayoutJoins::LwpLayoutJoins(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
370 0 : : LwpVirtualPiece(objHdr, pStrm)
371 0 : {}
372 :
373 0 : LwpLayoutJoins::~LwpLayoutJoins()
374 0 : {}
375 :
376 0 : void LwpLayoutJoins::Read()
377 : {
378 0 : LwpVirtualPiece::Read();
379 :
380 0 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
381 : {
382 0 : m_JoinStuff.Read(m_pObjStrm);
383 0 : m_pObjStrm->SkipExtra();
384 : }
385 0 : }
386 :
387 0 : void LwpLayoutJoins::Parse(IXFStream* /*pOutputStream*/)
388 0 : {}
389 :
390 8 : LwpLayoutShadow::LwpLayoutShadow(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
391 8 : : LwpVirtualPiece(objHdr, pStrm)
392 8 : {}
393 :
394 16 : LwpLayoutShadow::~LwpLayoutShadow()
395 16 : {}
396 :
397 8 : void LwpLayoutShadow::Read()
398 : {
399 8 : LwpVirtualPiece::Read();
400 :
401 8 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
402 : {
403 8 : m_Shadow.Read(m_pObjStrm);
404 8 : m_pObjStrm->SkipExtra();
405 : }
406 8 : }
407 :
408 0 : void LwpLayoutShadow::Parse(IXFStream* /*pOutputStream*/)
409 0 : {}
410 : /**************************************************************************
411 : * @descr: Constructor
412 : * @param:
413 : * @param:
414 : * @return:
415 : **************************************************************************/
416 88 : LwpLayoutRelativityGuts::LwpLayoutRelativityGuts()
417 : {
418 88 : m_nRelType = LAY_PARENT_RELATIVE;
419 88 : m_nRelFromWhere = LAY_UPPERLEFT;
420 88 : m_RelDistance.SetX(0);
421 88 : m_RelDistance.SetY(0);
422 88 : m_nTether = LAY_UPPERLEFT;
423 88 : m_nTetherWhere = LAY_BORDER;
424 88 : m_nFlags = 0;
425 88 : }
426 : /**************************************************************************
427 : * @descr: Read LayoutRelativityGuts' information.
428 : * @param:
429 : * @param:
430 : * @return:
431 : **************************************************************************/
432 88 : void LwpLayoutRelativityGuts::Read(LwpObjectStream *pStrm)
433 : {
434 88 : m_nRelType = pStrm->QuickReaduInt8();
435 88 : m_nRelFromWhere = pStrm->QuickReaduInt8();
436 88 : m_RelDistance.Read(pStrm);
437 88 : m_nTether = pStrm->QuickReaduInt8();
438 88 : m_nTetherWhere = pStrm->QuickReaduInt8();
439 88 : if(LwpFileHeader::m_nFileRevision >= 0x000B)
440 : {
441 88 : m_nFlags = pStrm->QuickReaduInt8();
442 : }
443 : else
444 : {
445 0 : m_nFlags = 0;
446 : }
447 88 : }
448 : /**************************************************************************
449 : * @descr: Constructor
450 : * @param:
451 : * @param:
452 : * @return:
453 : **************************************************************************/
454 88 : LwpLayoutRelativity::LwpLayoutRelativity(LwpObjectHeader &objHdr, LwpSvStream *pStrm)
455 88 : : LwpVirtualPiece(objHdr, pStrm)
456 : {
457 88 : }
458 : /**************************************************************************
459 : * @descr: destructor
460 : * @param:
461 : * @param:
462 : * @return:
463 : **************************************************************************/
464 176 : LwpLayoutRelativity::~LwpLayoutRelativity()
465 : {
466 176 : }
467 :
468 88 : void LwpLayoutRelativity::Read()
469 : {
470 88 : LwpVirtualPiece::Read();
471 88 : if(LwpFileHeader::m_nFileRevision >= 0x000B)
472 : {
473 88 : m_RelGuts.Read(m_pObjStrm);
474 88 : m_pObjStrm->SkipExtra();
475 : }
476 88 : }
477 :
478 0 : void LwpLayoutRelativity::Parse(IXFStream * /*pOutputStream*/)
479 : {
480 0 : }
481 :
482 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|