fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / lotuswordpro / source / filter / lwpparaproperty.cxx
blob3dc427f0194040ec5285b3f866511b837f819bc5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
10 * Sun Microsystems Inc., October, 2000
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
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.
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.
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
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.
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.
46 * The Initial Developer of the Original Code is: IBM Corporation
48 * Copyright: 2008 by IBM Corporation
50 * All Rights Reserved.
52 * Contributor(s): _______________________________________
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"
68 LwpParaProperty* LwpParaProperty::ReadPropertyList(LwpObjectStream* pFile,rtl::Reference<LwpObject> const & Whole)
70 LwpParaProperty* Prop= NULL;
71 LwpParaProperty* NewProp= NULL;
73 for(;;)
75 bool bFailure;
77 sal_uInt32 tag = pFile->QuickReaduInt32(&bFailure);
78 // Keep reading properties until we hit the end tag or
79 // the stream ends
80 if (bFailure || tag == TAG_ENDSUBOBJ)
81 break;
83 // Get the length of this property
84 sal_uInt16 Len = pFile->QuickReaduInt16(&bFailure);
86 if (bFailure)
87 break;
89 // Create whatever kind of tag we just found
90 switch (tag)
92 case TAG_PARA_ALIGN:
93 NewProp = new LwpParaAlignProperty(pFile);
94 break;
96 case TAG_PARA_INDENT:
97 NewProp = new LwpParaIndentProperty(pFile);
98 break;
100 case TAG_PARA_SPACING:
101 NewProp = new LwpParaSpacingProperty(pFile);
102 break;
104 case TAG_PARA_BORDER:
105 NewProp = new LwpParaBorderProperty(pFile);
106 break;
108 case TAG_PARA_BACKGROUND:
109 NewProp = new LwpParaBackGroundProperty(pFile);
110 break;
112 case TAG_PARA_BREAKS:
113 NewProp = new LwpParaBreaksProperty(pFile);
114 break;
116 case TAG_PARA_BULLET:
117 NewProp = new LwpParaBulletProperty(pFile);
118 static_cast<LwpPara*>(Whole.get())->SetBulletFlag(true);
119 break;
121 case TAG_PARA_NUMBERING:
122 NewProp = new LwpParaNumberingProperty(pFile);
123 break;
125 case TAG_PARA_TAB:
126 NewProp = new LwpParaTabRackProperty(pFile);
127 break;
129 default:
130 pFile->SeekRel(Len);
131 NewProp = NULL;
132 break;
134 // Stick it at the beginning of the list
135 if (NewProp)
137 NewProp->insert(Prop, NULL);
138 Prop = NewProp;
141 return Prop;
144 LwpParaAlignProperty::LwpParaAlignProperty(LwpObjectStream* pFile)
146 LwpObjectID align;
147 align.ReadIndexed(pFile);
149 LwpAlignmentPiece *pAlignmentPiece = dynamic_cast<LwpAlignmentPiece*>(align.obj(VO_ALIGNMENTPIECE).get());
150 m_pAlignment = pAlignmentPiece ? dynamic_cast<LwpAlignmentOverride*>(pAlignmentPiece->GetOverride()) : NULL;
154 LwpParaAlignProperty::~LwpParaAlignProperty()
158 sal_uInt32 LwpParaAlignProperty::GetType()
160 return PP_LOCAL_ALIGN;
163 LwpParaIndentProperty::LwpParaIndentProperty(LwpObjectStream* pFile)
165 m_aIndentID.ReadIndexed(pFile);
167 LwpIndentPiece *pIndentPiece = dynamic_cast<LwpIndentPiece*>(m_aIndentID.obj(VO_INDENTPIECE).get());
168 m_pIndent = pIndentPiece ? dynamic_cast<LwpIndentOverride*>(pIndentPiece->GetOverride()) : NULL;
171 LwpParaIndentProperty::~LwpParaIndentProperty()
175 sal_uInt32 LwpParaIndentProperty::GetType()
177 return PP_LOCAL_INDENT;
180 LwpParaSpacingProperty::LwpParaSpacingProperty(LwpObjectStream* pFile)
182 LwpObjectID spacing;
183 spacing.ReadIndexed(pFile);
185 LwpSpacingPiece *pSpacingPiece = dynamic_cast<LwpSpacingPiece*>(spacing.obj(VO_SPACINGPIECE).get());
186 m_pSpacing = pSpacingPiece ? dynamic_cast<LwpSpacingOverride*>(pSpacingPiece->GetOverride()) : NULL;
189 LwpParaSpacingProperty::~LwpParaSpacingProperty()
193 sal_uInt32 LwpParaSpacingProperty::GetType()
195 return PP_LOCAL_SPACING;
198 // 01/25/2004
199 LwpParaBorderProperty::LwpParaBorderProperty(LwpObjectStream* pStrm) :
200 m_pParaBorderOverride(NULL)
202 LwpObjectID aParaBorder;
203 aParaBorder.ReadIndexed(pStrm);
205 if (!aParaBorder.IsNull())
207 LwpParaBorderPiece *pParaBorderPiece = dynamic_cast<LwpParaBorderPiece*>(aParaBorder.obj().get());
208 m_pParaBorderOverride = pParaBorderPiece ? dynamic_cast<LwpParaBorderOverride*>(pParaBorderPiece->GetOverride()) : NULL;
212 LwpParaBreaksProperty::LwpParaBreaksProperty(LwpObjectStream* pStrm) :
213 m_pBreaks(NULL)
215 LwpObjectID aBreaks;
216 aBreaks.ReadIndexed(pStrm);
218 if (!aBreaks.IsNull())
220 LwpBreaksPiece *pBreaksPiece = dynamic_cast<LwpBreaksPiece*>(aBreaks.obj().get());
221 m_pBreaks = pBreaksPiece ? dynamic_cast<LwpBreaksOverride*>(pBreaksPiece->GetOverride()) : NULL;
225 LwpParaBulletProperty::LwpParaBulletProperty(LwpObjectStream* pStrm) :
226 m_pBullet(new LwpBulletOverride)
228 m_pBullet->Read(pStrm);
231 LwpParaBulletProperty::~LwpParaBulletProperty()
233 delete m_pBullet;
236 LwpParaNumberingProperty::LwpParaNumberingProperty(LwpObjectStream * pStrm)
237 : m_pNumberingOverride(NULL)
239 LwpObjectID aNumberingPiece;
240 aNumberingPiece.ReadIndexed(pStrm);
241 if (aNumberingPiece.IsNull())
243 return;
246 LwpNumberingPiece *pNumberingPiece = dynamic_cast<LwpNumberingPiece*>(aNumberingPiece.obj(VO_NUMBERINGPIECE).get());
247 m_pNumberingOverride = pNumberingPiece ? dynamic_cast<LwpNumberingOverride*>(pNumberingPiece->GetOverride()) : NULL;
249 //end
251 LwpParaTabRackProperty::LwpParaTabRackProperty(LwpObjectStream* pFile)
253 LwpObjectID aTabRack;
254 aTabRack.ReadIndexed(pFile);
256 LwpTabPiece *pTabPiece = dynamic_cast<LwpTabPiece*>(aTabRack.obj().get());
257 m_pTabOverride = pTabPiece ? dynamic_cast<LwpTabOverride*>(pTabPiece->GetOverride()) : NULL;
260 LwpParaTabRackProperty::~LwpParaTabRackProperty()
264 LwpParaBackGroundProperty::LwpParaBackGroundProperty(LwpObjectStream* pFile)
266 LwpObjectID background;
267 background.ReadIndexed(pFile);
269 LwpBackgroundPiece *pBackgroundPiece = dynamic_cast<LwpBackgroundPiece*>(background.obj().get());
270 m_pBackground = pBackgroundPiece ? dynamic_cast<LwpBackgroundOverride*>(pBackgroundPiece->GetOverride()) : NULL;
273 LwpParaBackGroundProperty::~LwpParaBackGroundProperty()
277 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */