update dev300-m57
[ooovba.git] / lotuswordpro / source / filter / lwpparaproperty.cxx
blobd0fc202f92c6cbead1dc1c5ff363386f444b94e0
1 /*************************************************************************
3 * The Contents of this file are made available subject to the terms of
4 * either of the following licenses
6 * - GNU Lesser General Public License Version 2.1
7 * - Sun Industry Standards Source License Version 1.1
9 * Sun Microsystems Inc., October, 2000
11 * GNU Lesser General Public License Version 2.1
12 * =============================================
13 * Copyright 2000 by Sun Microsystems, Inc.
14 * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License version 2.1, as published by the Free Software Foundation.
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA
31 * Sun Industry Standards Source License Version 1.1
32 * =================================================
33 * The contents of this file are subject to the Sun Industry Standards
34 * Source License Version 1.1 (the "License"); You may not use this file
35 * except in compliance with the License. You may obtain a copy of the
36 * License at http://www.openoffice.org/license.html.
38 * Software provided under this License is provided on an "AS IS" basis,
39 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
40 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
41 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
42 * See the License for the specific provisions governing your rights and
43 * obligations concerning the Software.
45 * The Initial Developer of the Original Code is: IBM Corporation
47 * Copyright: 2008 by IBM Corporation
49 * All Rights Reserved.
51 * Contributor(s): _______________________________________
54 ************************************************************************/
55 /*************************************************************************
56 * @file
57 * For LWP filter architecture prototype
58 ************************************************************************/
59 /*************************************************************************
60 * Change History
61 Jan 2005 Created
62 ************************************************************************/
63 #include "lwpparaproperty.hxx"
64 #include "lwpobjtags.hxx"
65 #include "lwppara.hxx"
67 LwpParaProperty* LwpParaProperty::ReadPropertyList(LwpObjectStream* pFile,LwpObject* Whole)
69 sal_uInt32 tag;
70 LwpParaProperty* Prop= NULL;
71 LwpParaProperty* NewProp= NULL;
72 sal_uInt16 Len;
74 for(;;)
76 pFile->QuickRead(&tag,sizeof(sal_uInt32));
77 // Keep reading properties until we hit the end tag
78 if (tag == TAG_ENDSUBOBJ)
79 break;
81 // Get the length of this property
82 pFile->QuickRead(&Len,sizeof(sal_uInt16));
84 // Create whatever kind of tag we just found
85 switch (tag)
87 case TAG_PARA_ALIGN:
88 NewProp = new LwpParaAlignProperty(pFile);
89 break;
91 case TAG_PARA_INDENT:
92 NewProp = new LwpParaIndentProperty(pFile);
93 break;
95 case TAG_PARA_SPACING:
96 NewProp = new LwpParaSpacingProperty(pFile);
97 break;
99 case TAG_PARA_BORDER:
100 NewProp = new LwpParaBorderProperty(pFile);
101 break;
103 case TAG_PARA_BACKGROUND:
104 NewProp = new LwpParaBackGroundProperty(pFile);
105 break;
107 case TAG_PARA_BREAKS:
108 NewProp = new LwpParaBreaksProperty(pFile);
109 break;
111 case TAG_PARA_BULLET:
112 NewProp = new LwpParaBulletProperty(pFile);
113 static_cast<LwpPara*>(Whole)->SetBulletFlag(sal_True);
114 break;
116 case TAG_PARA_NUMBERING:
117 NewProp = new LwpParaNumberingProperty(pFile);
118 break;
120 case TAG_PARA_TAB:
121 NewProp = new LwpParaTabRackProperty(pFile);
122 break;
124 #ifdef KINSOKU
125 case TAG_PARA_KINSOKU:
126 NewProp = new CParaKinsokuProperty(pFile);
127 break;
128 #endif
130 case TAG_PARA_PROPLIST:
131 NewProp = new CParaPropListProperty(pFile,Whole);
132 break;
134 case TAG_PARA_SHOW:
135 case TAG_PARA_HIDE:
136 // Ignore these properties
137 */ default:
138 pFile->SeekRel(Len);
139 NewProp = NULL;
140 break;
142 // Stick it at the beginning of the list
143 if (NewProp)
145 NewProp->insert(Prop, NULL);
146 Prop = NewProp;
149 return Prop;
152 LwpParaAlignProperty::LwpParaAlignProperty(LwpObjectStream* pFile)
154 // pFile->SeekRel(3);
155 LwpObjectID align;
156 align.ReadIndexed(pFile);
157 m_pAlignment =static_cast<LwpAlignmentOverride*>
158 (static_cast<LwpAlignmentPiece*>(align.obj(VO_ALIGNMENTPIECE))->GetOverride());
159 /* if(pFile->GetFileRevision() < 0x000b)
161 CAlignmentPieceGuts guts;
162 CAlignmentPiece::QuickReadGuts(pFile, &guts);
163 cAlignment = GetPieceManager()->GetAlignmentPiece(&guts);
165 else
167 LwpFoundry* OldFoundry = pFile->GetFoundry();
168 pFile->SetFoundry(GetPieceManager()->GetFoundry());
169 cAlignment.QuickRead(pFile);
170 pFile->SetFoundry(OldFoundry);
171 } */
174 LwpParaAlignProperty::~LwpParaAlignProperty(void)
178 sal_uInt32 LwpParaAlignProperty::GetType(void)
180 return PP_LOCAL_ALIGN;
183 LwpParaIndentProperty::LwpParaIndentProperty(LwpObjectStream* pFile)
185 // LwpObjectID indent;
186 m_aIndentID.ReadIndexed(pFile);
187 m_pIndent = static_cast<LwpIndentOverride*>
188 (static_cast<LwpIndentPiece*>(m_aIndentID.obj(VO_INDENTPIECE))->GetOverride());
191 LwpParaIndentProperty::~LwpParaIndentProperty(void)
195 sal_uInt32 LwpParaIndentProperty::GetType(void)
197 return PP_LOCAL_INDENT;
200 LwpParaSpacingProperty::LwpParaSpacingProperty(LwpObjectStream* pFile)
202 LwpObjectID spacing;
203 spacing.ReadIndexed(pFile);
204 m_pSpacing = static_cast<LwpSpacingOverride*>
205 (static_cast<LwpSpacingPiece*>(spacing.obj(VO_SPACINGPIECE))->GetOverride());
208 LwpParaSpacingProperty::~LwpParaSpacingProperty(void)
212 sal_uInt32 LwpParaSpacingProperty::GetType(void)
214 return PP_LOCAL_SPACING;
217 // 01/25/2004////////////////////////////////////////////////////////
218 LwpParaBorderProperty::LwpParaBorderProperty(LwpObjectStream* pStrm) :
219 m_pParaBorderOverride(NULL)
221 LwpObjectID aParaBorder;
222 aParaBorder.ReadIndexed(pStrm);
224 if (!aParaBorder.IsNull())
226 m_pParaBorderOverride = static_cast<LwpParaBorderOverride*>
227 (static_cast<LwpParaBorderPiece*>(aParaBorder.obj())->GetOverride());
231 LwpParaBreaksProperty::LwpParaBreaksProperty(LwpObjectStream* pStrm) :
232 m_pBreaks(NULL)
234 LwpObjectID aBreaks;
235 aBreaks.ReadIndexed(pStrm);
237 if (!aBreaks.IsNull())
239 m_pBreaks = static_cast<LwpBreaksOverride*>
240 (static_cast<LwpBreaksPiece*>(aBreaks.obj())->GetOverride());
244 LwpParaBulletProperty::LwpParaBulletProperty(LwpObjectStream* pStrm) :
245 m_pBullet(new LwpBulletOverride)
247 m_pBullet->Read(pStrm);
250 LwpParaBulletProperty::~LwpParaBulletProperty()
252 if (m_pBullet)
254 delete m_pBullet;
258 LwpParaNumberingProperty::LwpParaNumberingProperty(LwpObjectStream * pStrm)
260 LwpObjectID aNumberingPiece;
261 aNumberingPiece.ReadIndexed(pStrm);
262 if (aNumberingPiece.IsNull())
264 return;
267 m_pNumberingOverride = static_cast<LwpNumberingOverride*>
268 (static_cast<LwpNumberingPiece*>(aNumberingPiece.obj(VO_NUMBERINGPIECE))->GetOverride());
271 //end//////////////////////////////////////////////////////////////////////
273 LwpParaTabRackProperty::LwpParaTabRackProperty(LwpObjectStream* pFile)
275 LwpObjectID aTabRack;
276 aTabRack.ReadIndexed(pFile);
277 m_pTabOverride =static_cast<LwpTabOverride*>(static_cast<LwpTabPiece*>(aTabRack.obj())->GetOverride());
280 LwpParaTabRackProperty::~LwpParaTabRackProperty()
284 LwpParaBackGroundProperty::LwpParaBackGroundProperty(LwpObjectStream* pFile)
286 LwpObjectID background;
287 background.ReadIndexed(pFile);
288 m_pBackground = static_cast<LwpBackgroundOverride*>(
289 static_cast<LwpBackgroundPiece*>(background.obj())->GetOverride());
292 LwpParaBackGroundProperty::~LwpParaBackGroundProperty()