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 : : * Change History
62 : : Jan 2005 Created
63 : : ************************************************************************/
64 : : #include "lwpparaproperty.hxx"
65 : : #include "lwpobjtags.hxx"
66 : : #include "lwppara.hxx"
67 : :
68 : 795 : LwpParaProperty* LwpParaProperty::ReadPropertyList(LwpObjectStream* pFile,LwpObject* Whole)
69 : : {
70 : 795 : LwpParaProperty* Prop= NULL;
71 : 795 : LwpParaProperty* NewProp= NULL;
72 : :
73 : 1212 : for(;;)
74 : : {
75 : : bool bFailure;
76 : :
77 [ + - ]: 2007 : sal_uInt32 tag = pFile->QuickReaduInt32(&bFailure);
78 : : // Keep reading properties until we hit the end tag or
79 : : // the stream ends
80 [ + - ][ + + ]: 2007 : if (bFailure || tag == TAG_ENDSUBOBJ)
81 : : break;
82 : :
83 : : // Get the length of this property
84 [ + - ]: 1212 : sal_uInt16 Len = pFile->QuickReaduInt16(&bFailure);
85 : :
86 [ + - ]: 1212 : if (bFailure)
87 : : break;
88 : :
89 : : // Create whatever kind of tag we just found
90 [ + + + + : 1212 : switch (tag)
+ + + + +
+ ]
91 : : {
92 : : case TAG_PARA_ALIGN:
93 [ + - ][ + - ]: 12 : NewProp = new LwpParaAlignProperty(pFile);
94 : 12 : break;
95 : :
96 : : case TAG_PARA_INDENT:
97 [ + - ][ + - ]: 390 : NewProp = new LwpParaIndentProperty(pFile);
98 : 390 : break;
99 : :
100 : : case TAG_PARA_SPACING:
101 [ + - ][ + - ]: 336 : NewProp = new LwpParaSpacingProperty(pFile);
102 : 336 : break;
103 : :
104 : : case TAG_PARA_BORDER:
105 [ + - ][ + - ]: 6 : NewProp = new LwpParaBorderProperty(pFile);
106 : 6 : break;
107 : :
108 : : case TAG_PARA_BACKGROUND:
109 [ + - ][ + - ]: 54 : NewProp = new LwpParaBackGroundProperty(pFile);
110 : 54 : break;
111 : :
112 : : case TAG_PARA_BREAKS:
113 [ + - ][ + - ]: 381 : NewProp = new LwpParaBreaksProperty(pFile);
114 : 381 : break;
115 : :
116 : : case TAG_PARA_BULLET:
117 [ + - ][ + - ]: 12 : NewProp = new LwpParaBulletProperty(pFile);
118 : 12 : static_cast<LwpPara*>(Whole)->SetBulletFlag(sal_True);
119 : 12 : break;
120 : :
121 : : case TAG_PARA_NUMBERING:
122 [ + - ][ + - ]: 12 : NewProp = new LwpParaNumberingProperty(pFile);
123 : 12 : break;
124 : :
125 : : case TAG_PARA_TAB:
126 [ + - ][ + - ]: 6 : NewProp = new LwpParaTabRackProperty(pFile);
127 : 6 : break;
128 : :
129 : : default:
130 [ + - ]: 3 : pFile->SeekRel(Len);
131 : 3 : NewProp = NULL;
132 : 3 : break;
133 : : }
134 : : // Stick it at the beginning of the list
135 [ + + ]: 1212 : if (NewProp)
136 : : {
137 [ + - ]: 1209 : NewProp->insert(Prop, NULL);
138 : 1209 : Prop = NewProp;
139 : : }
140 : : }
141 : 795 : return Prop;
142 : : }
143 : :
144 : 12 : LwpParaAlignProperty::LwpParaAlignProperty(LwpObjectStream* pFile)
145 : : {
146 [ + - ]: 12 : LwpObjectID align;
147 [ + - ]: 12 : align.ReadIndexed(pFile);
148 : :
149 [ + - ][ - + ]: 12 : LwpAlignmentPiece *pAlignmentPiece = dynamic_cast<LwpAlignmentPiece*>(align.obj(VO_ALIGNMENTPIECE));
150 [ + - ][ - + ]: 12 : m_pAlignment = pAlignmentPiece ? dynamic_cast<LwpAlignmentOverride*>(pAlignmentPiece->GetOverride()) : NULL;
151 : :
152 : 12 : }
153 : :
154 : 12 : LwpParaAlignProperty::~LwpParaAlignProperty(void)
155 : : {
156 [ - + ]: 24 : }
157 : :
158 : 12 : sal_uInt32 LwpParaAlignProperty::GetType(void)
159 : : {
160 : 12 : return PP_LOCAL_ALIGN;
161 : : }
162 : :
163 [ + - ]: 390 : LwpParaIndentProperty::LwpParaIndentProperty(LwpObjectStream* pFile)
164 : : {
165 [ + - ]: 390 : m_aIndentID.ReadIndexed(pFile);
166 : :
167 [ + - ][ - + ]: 390 : LwpIndentPiece *pIndentPiece = dynamic_cast<LwpIndentPiece*>(m_aIndentID.obj(VO_INDENTPIECE));
168 [ + - ][ - + ]: 390 : m_pIndent = pIndentPiece ? dynamic_cast<LwpIndentOverride*>(pIndentPiece->GetOverride()) : NULL;
169 : 390 : }
170 : :
171 : 390 : LwpParaIndentProperty::~LwpParaIndentProperty(void)
172 : : {
173 [ - + ]: 780 : }
174 : :
175 : 438 : sal_uInt32 LwpParaIndentProperty::GetType(void)
176 : : {
177 : 438 : return PP_LOCAL_INDENT;
178 : : }
179 : :
180 : 336 : LwpParaSpacingProperty::LwpParaSpacingProperty(LwpObjectStream* pFile)
181 : : {
182 [ + - ]: 336 : LwpObjectID spacing;
183 [ + - ]: 336 : spacing.ReadIndexed(pFile);
184 : :
185 [ + - ][ - + ]: 336 : LwpSpacingPiece *pSpacingPiece = dynamic_cast<LwpSpacingPiece*>(spacing.obj(VO_SPACINGPIECE));
186 [ + - ][ - + ]: 336 : m_pSpacing = pSpacingPiece ? dynamic_cast<LwpSpacingOverride*>(pSpacingPiece->GetOverride()) : NULL;
187 : 336 : }
188 : :
189 : 336 : LwpParaSpacingProperty::~LwpParaSpacingProperty(void)
190 : : {
191 [ - + ]: 672 : }
192 : :
193 : 384 : sal_uInt32 LwpParaSpacingProperty::GetType(void)
194 : : {
195 : 384 : return PP_LOCAL_SPACING;
196 : : }
197 : :
198 : : // 01/25/2004////////////////////////////////////////////////////////
199 : 6 : LwpParaBorderProperty::LwpParaBorderProperty(LwpObjectStream* pStrm) :
200 : 6 : m_pParaBorderOverride(NULL)
201 : : {
202 [ + - ]: 6 : LwpObjectID aParaBorder;
203 [ + - ]: 6 : aParaBorder.ReadIndexed(pStrm);
204 : :
205 [ + - ]: 6 : if (!aParaBorder.IsNull())
206 : : {
207 [ + - ][ - + ]: 6 : LwpParaBorderPiece *pParaBorderPiece = dynamic_cast<LwpParaBorderPiece*>(aParaBorder.obj());
208 [ + - ][ - + ]: 6 : m_pParaBorderOverride = pParaBorderPiece ? dynamic_cast<LwpParaBorderOverride*>(pParaBorderPiece->GetOverride()) : NULL;
209 : : }
210 : 6 : }
211 : :
212 : 381 : LwpParaBreaksProperty::LwpParaBreaksProperty(LwpObjectStream* pStrm) :
213 : 381 : m_pBreaks(NULL)
214 : : {
215 [ + - ]: 381 : LwpObjectID aBreaks;
216 [ + - ]: 381 : aBreaks.ReadIndexed(pStrm);
217 : :
218 [ + - ]: 381 : if (!aBreaks.IsNull())
219 : : {
220 [ + - ][ - + ]: 381 : LwpBreaksPiece *pBreaksPiece = dynamic_cast<LwpBreaksPiece*>(aBreaks.obj());
221 [ + - ][ - + ]: 381 : m_pBreaks = pBreaksPiece ? dynamic_cast<LwpBreaksOverride*>(pBreaksPiece->GetOverride()) : NULL;
222 : : }
223 : 381 : }
224 : :
225 : 12 : LwpParaBulletProperty::LwpParaBulletProperty(LwpObjectStream* pStrm) :
226 [ + - ][ + - ]: 12 : m_pBullet(new LwpBulletOverride)
227 : : {
228 [ + - ]: 12 : m_pBullet->Read(pStrm);
229 : 12 : }
230 : :
231 : 12 : LwpParaBulletProperty::~LwpParaBulletProperty()
232 : : {
233 [ + - ]: 12 : if (m_pBullet)
234 : : {
235 [ + - ][ + - ]: 12 : delete m_pBullet;
236 : : }
237 [ - + ]: 24 : }
238 : :
239 : 12 : LwpParaNumberingProperty::LwpParaNumberingProperty(LwpObjectStream * pStrm)
240 : : {
241 [ + - ]: 12 : LwpObjectID aNumberingPiece;
242 [ + - ]: 12 : aNumberingPiece.ReadIndexed(pStrm);
243 [ + - ]: 12 : if (aNumberingPiece.IsNull())
244 : : {
245 : 12 : return;
246 : : }
247 : :
248 [ + - ][ - + ]: 12 : LwpNumberingPiece *pNumberingPiece = dynamic_cast<LwpNumberingPiece*>(aNumberingPiece.obj(VO_NUMBERINGPIECE));
249 [ + - ][ - + ]: 12 : m_pNumberingOverride = pNumberingPiece ? dynamic_cast<LwpNumberingOverride*>(pNumberingPiece->GetOverride()) : NULL;
250 : : }
251 : : //end//////////////////////////////////////////////////////////////////////
252 : :
253 : 6 : LwpParaTabRackProperty::LwpParaTabRackProperty(LwpObjectStream* pFile)
254 : : {
255 [ + - ]: 6 : LwpObjectID aTabRack;
256 [ + - ]: 6 : aTabRack.ReadIndexed(pFile);
257 : :
258 [ + - ][ - + ]: 6 : LwpTabPiece *pTabPiece = dynamic_cast<LwpTabPiece*>(aTabRack.obj());
259 [ + - ][ - + ]: 6 : m_pTabOverride = pTabPiece ? dynamic_cast<LwpTabOverride*>(pTabPiece->GetOverride()) : NULL;
260 : 6 : }
261 : :
262 : 6 : LwpParaTabRackProperty::~LwpParaTabRackProperty()
263 : : {
264 [ - + ]: 12 : }
265 : :
266 : 54 : LwpParaBackGroundProperty::LwpParaBackGroundProperty(LwpObjectStream* pFile)
267 : : {
268 [ + - ]: 54 : LwpObjectID background;
269 [ + - ]: 54 : background.ReadIndexed(pFile);
270 : :
271 [ + - ][ - + ]: 54 : LwpBackgroundPiece *pBackgroundPiece = dynamic_cast<LwpBackgroundPiece*>(background.obj());
272 [ + - ][ - + ]: 54 : m_pBackground = pBackgroundPiece ? dynamic_cast<LwpBackgroundOverride*>(pBackgroundPiece->GetOverride()) : NULL;
273 : 54 : }
274 : :
275 : 54 : LwpParaBackGroundProperty::~LwpParaBackGroundProperty()
276 : : {
277 [ - + ]: 108 : }
278 : :
279 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|