Branch data 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 : 138 : LwpRotor::LwpRotor()
65 : 138 : {}
66 : :
67 : 138 : LwpRotor::~LwpRotor()
68 : 138 : {}
69 : :
70 : 138 : void LwpRotor:: Read(LwpObjectStream *pStrm)
71 : : {
72 : 138 : m_nRotation = pStrm->QuickReadInt16();
73 : 138 : }
74 : :
75 : 138 : LwpLayoutGeometry::LwpLayoutGeometry(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
76 [ + - ][ + - ]: 138 : : LwpVirtualPiece(objHdr, pStrm)
77 : 138 : {}
78 : :
79 : 138 : LwpLayoutGeometry::~LwpLayoutGeometry()
80 [ - + ]: 276 : {}
81 : :
82 : 138 : void LwpLayoutGeometry::Read()
83 : : {
84 : 138 : LwpVirtualPiece::Read();
85 : :
86 [ + - ]: 138 : if(LwpFileHeader::m_nFileRevision >= 0x000B)
87 : : {
88 : 138 : m_nWidth = m_pObjStrm->QuickReadInt32();
89 : 138 : m_nHeight = m_pObjStrm->QuickReadInt32();
90 : 138 : m_Origin.Read(m_pObjStrm);
91 : 138 : m_AbsoluteOrigin.Read(m_pObjStrm);
92 : 138 : m_ContainerRotor.Read(m_pObjStrm);
93 : 138 : m_ContentOrientation = m_pObjStrm->QuickReaduInt8();
94 : 138 : m_pObjStrm->SkipExtra();
95 : : }
96 : 138 : }
97 : 0 : void LwpLayoutGeometry::Parse(IXFStream* /*pOutputStream*/)
98 : 0 : {}
99 : :
100 : 42 : LwpLayoutScale::LwpLayoutScale(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
101 [ + - ]: 42 : : LwpVirtualPiece(objHdr, pStrm)
102 : 42 : {}
103 : :
104 : 42 : LwpLayoutScale::~LwpLayoutScale()
105 [ - + ]: 84 : {}
106 : :
107 : 42 : void LwpLayoutScale::Read()
108 : : {
109 : 42 : LwpVirtualPiece::Read();
110 : :
111 [ + - ]: 42 : if(LwpFileHeader::m_nFileRevision >= 0x000B)
112 : : {
113 : 42 : m_nScaleMode = m_pObjStrm->QuickReaduInt16();
114 : 42 : m_nScalePercentage = m_pObjStrm->QuickReaduInt32();
115 : 42 : m_nScaleWidth = m_pObjStrm->QuickReadInt32();
116 : 42 : m_nScaleHeight = m_pObjStrm->QuickReadInt32();
117 : 42 : m_nContentRotation = m_pObjStrm->QuickReaduInt16();
118 : 42 : m_Offset.Read(m_pObjStrm);
119 : :
120 : 42 : m_nPlacement = m_pObjStrm->QuickReaduInt16();
121 : 42 : m_pObjStrm->SkipExtra();
122 : : }
123 : 42 : }
124 : :
125 : 0 : void LwpLayoutScale::Parse(IXFStream* /*pOutputStream*/)
126 : 0 : {}
127 : :
128 : 108 : LwpLayoutMargins::LwpLayoutMargins(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
129 : 108 : : LwpVirtualPiece(objHdr, pStrm)
130 : 108 : {}
131 : :
132 : 108 : LwpLayoutMargins::~LwpLayoutMargins()
133 [ - + ]: 216 : {}
134 : :
135 : 108 : void LwpLayoutMargins::Read()
136 : : {
137 : 108 : LwpVirtualPiece::Read();
138 : :
139 [ + - ]: 108 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
140 : : {
141 : 108 : m_Margins.Read(m_pObjStrm);
142 : 108 : m_ExtMargins.Read(m_pObjStrm);
143 : 108 : m_ExtraMargins.Read(m_pObjStrm);
144 : 108 : m_pObjStrm->SkipExtra();
145 : : }
146 : 108 : }
147 : :
148 : 0 : void LwpLayoutMargins::Parse(IXFStream* /*pOutputStream*/)
149 : 0 : {}
150 : :
151 : 30 : LwpLayoutBorder::LwpLayoutBorder(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
152 [ + - ]: 30 : : LwpVirtualPiece(objHdr, pStrm)
153 : 30 : {}
154 : :
155 : 30 : LwpLayoutBorder::~LwpLayoutBorder()
156 [ - + ]: 60 : {}
157 : :
158 : 30 : void LwpLayoutBorder::Read()
159 : : {
160 : 30 : LwpVirtualPiece::Read();
161 : :
162 [ + - ]: 30 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
163 : : {
164 : 30 : m_BorderStuff.Read(m_pObjStrm);
165 : 30 : m_pObjStrm->SkipExtra();
166 : : }
167 : 30 : }
168 : :
169 : 0 : void LwpLayoutBorder::Parse(IXFStream* /*pOutputStream*/)
170 : 0 : {}
171 : :
172 : 24 : LwpLayoutBackground::LwpLayoutBackground(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
173 : 24 : : LwpVirtualPiece(objHdr, pStrm)
174 : 24 : {}
175 : :
176 : 24 : LwpLayoutBackground::~LwpLayoutBackground()
177 [ - + ]: 48 : {}
178 : :
179 : 24 : void LwpLayoutBackground::Read()
180 : : {
181 : 24 : LwpVirtualPiece::Read();
182 : :
183 [ + - ]: 24 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
184 : : {
185 : 24 : m_BackgroundStuff.Read(m_pObjStrm);
186 : 24 : m_pObjStrm->SkipExtra();
187 : : }
188 : 24 : }
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 : 36 : LwpColumnInfo::LwpColumnInfo()
239 : 36 : {}
240 : :
241 : 36 : LwpColumnInfo::~LwpColumnInfo()
242 : 36 : {}
243 : :
244 : 36 : void LwpColumnInfo:: Read(LwpObjectStream *pStrm)
245 : : {
246 : 36 : m_nWidth = pStrm->QuickReadInt32();
247 : 36 : m_nGap = pStrm->QuickReadInt32();
248 : 36 : }
249 : :
250 : 36 : LwpLayoutColumns::LwpLayoutColumns(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
251 : 36 : : LwpVirtualPiece(objHdr, pStrm),m_pColumns(NULL)
252 : 36 : {}
253 : :
254 : 36 : LwpLayoutColumns::~LwpLayoutColumns()
255 : : {
256 [ + - ]: 36 : if(m_pColumns)
257 : : {
258 [ + - ][ + + ]: 72 : delete[] m_pColumns;
259 : 36 : m_pColumns = NULL;
260 : : }
261 : :
262 [ - + ]: 72 : }
263 : :
264 : 36 : void LwpLayoutColumns::Read()
265 : : {
266 : 36 : LwpVirtualPiece::Read();
267 : :
268 [ + - ]: 36 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
269 : : {
270 : 36 : m_nNumCols = m_pObjStrm->QuickReaduInt16();
271 [ + + ]: 72 : m_pColumns = new LwpColumnInfo[m_nNumCols];
272 [ + + ]: 72 : for(int i=0; i<m_nNumCols; i++)
273 : : {
274 : 36 : m_pColumns[i].Read(m_pObjStrm);
275 : : }
276 : 36 : m_pObjStrm->SkipExtra();
277 : : }
278 : 36 : }
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 : 12 : LwpLayoutShadow::LwpLayoutShadow(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
372 : 12 : : LwpVirtualPiece(objHdr, pStrm)
373 : 12 : {}
374 : :
375 : 12 : LwpLayoutShadow::~LwpLayoutShadow()
376 [ - + ]: 24 : {}
377 : :
378 : 12 : void LwpLayoutShadow::Read()
379 : : {
380 : 12 : LwpVirtualPiece::Read();
381 : :
382 [ + - ]: 12 : if( LwpFileHeader::m_nFileRevision >= 0x000B )
383 : : {
384 : 12 : m_Shadow.Read(m_pObjStrm);
385 : 12 : m_pObjStrm->SkipExtra();
386 : : }
387 : 12 : }
388 : :
389 : 0 : void LwpLayoutShadow::Parse(IXFStream* /*pOutputStream*/)
390 : 0 : {}
391 : : /**************************************************************************
392 : : * @descr: Constructor
393 : : * @param:
394 : : * @param:
395 : : * @return:
396 : : **************************************************************************/
397 : 132 : LwpLayoutRelativityGuts::LwpLayoutRelativityGuts()
398 : : {
399 : 132 : m_nRelType = LAY_PARENT_RELATIVE;
400 : 132 : m_nRelFromWhere = LAY_UPPERLEFT;
401 : 132 : m_RelDistance.SetX(0);
402 : 132 : m_RelDistance.SetY(0);
403 : 132 : m_nTether = LAY_UPPERLEFT;
404 : 132 : m_nTetherWhere = LAY_BORDER;
405 : 132 : m_nFlags = 0;
406 : 132 : }
407 : : /**************************************************************************
408 : : * @descr: Read LayoutRelativityGuts' information.
409 : : * @param:
410 : : * @param:
411 : : * @return:
412 : : **************************************************************************/
413 : 132 : void LwpLayoutRelativityGuts::Read(LwpObjectStream *pStrm)
414 : : {
415 : 132 : m_nRelType = pStrm->QuickReaduInt8();
416 : 132 : m_nRelFromWhere = pStrm->QuickReaduInt8();
417 : 132 : m_RelDistance.Read(pStrm);
418 : 132 : m_nTether = pStrm->QuickReaduInt8();
419 : 132 : m_nTetherWhere = pStrm->QuickReaduInt8();
420 [ + - ]: 132 : if(LwpFileHeader::m_nFileRevision >= 0x000B)
421 : : {
422 : 132 : m_nFlags = pStrm->QuickReaduInt8();
423 : : }
424 : : else
425 : : {
426 : 0 : m_nFlags = 0;
427 : : }
428 : 132 : }
429 : : /**************************************************************************
430 : : * @descr: Constructor
431 : : * @param:
432 : : * @param:
433 : : * @return:
434 : : **************************************************************************/
435 : 132 : LwpLayoutRelativity::LwpLayoutRelativity(LwpObjectHeader &objHdr, LwpSvStream *pStrm)
436 [ + - ]: 132 : : LwpVirtualPiece(objHdr, pStrm)
437 : : {
438 : 132 : }
439 : : /**************************************************************************
440 : : * @descr: destructor
441 : : * @param:
442 : : * @param:
443 : : * @return:
444 : : **************************************************************************/
445 : 132 : LwpLayoutRelativity::~LwpLayoutRelativity()
446 : : {
447 [ - + ]: 264 : }
448 : :
449 : 132 : void LwpLayoutRelativity::Read()
450 : : {
451 : 132 : LwpVirtualPiece::Read();
452 [ + - ]: 132 : if(LwpFileHeader::m_nFileRevision >= 0x000B)
453 : : {
454 : 132 : m_RelGuts.Read(m_pObjStrm);
455 : 132 : m_pObjStrm->SkipExtra();
456 : : }
457 : 132 : }
458 : :
459 : 0 : void LwpLayoutRelativity::Parse(IXFStream * /*pOutputStream*/)
460 : : {
461 : 0 : }
462 : :
463 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|