LibreOffice Module lotuswordpro (master) 1
lwpparaproperty.cxx
Go to the documentation of this file.
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 "lwpparaproperty.hxx"
62#include <lwpobjtags.hxx>
63#include "lwppara.hxx"
64
66{
67 LwpParaProperty* NewProp= nullptr;
68
69 for(;;)
70 {
71 bool bFailure;
72
73 sal_uInt32 tag = pFile->QuickReaduInt32(&bFailure);
74 // Keep reading properties until we hit the end tag or
75 // the stream ends
76 if (bFailure || tag == TAG_ENDSUBOBJ)
77 break;
78
79 // Get the length of this property
80 sal_uInt16 Len = pFile->QuickReaduInt16(&bFailure);
81
82 if (bFailure)
83 break;
84
85 // Create whatever kind of tag we just found
86 switch (tag)
87 {
88 case TAG_PARA_ALIGN:
89 NewProp = new LwpParaAlignProperty(pFile);
90 break;
91
92 case TAG_PARA_INDENT:
93 NewProp = new LwpParaIndentProperty(pFile);
94 break;
95
97 NewProp = new LwpParaSpacingProperty(pFile);
98 break;
99
100 case TAG_PARA_BORDER:
101 NewProp = new LwpParaBorderProperty(pFile);
102 break;
103
105 NewProp = new LwpParaBackGroundProperty(pFile);
106 break;
107
108 case TAG_PARA_BREAKS:
109 NewProp = new LwpParaBreaksProperty(pFile);
110 break;
111
112 case TAG_PARA_BULLET:
113 NewProp = new LwpParaBulletProperty(pFile);
114 SetBulletFlag(true);
115 break;
116
118 NewProp = new LwpParaNumberingProperty(pFile);
119 break;
120
121 case TAG_PARA_TAB:
122 NewProp = new LwpParaTabRackProperty(pFile);
123 break;
124
125 default:
126 pFile->SeekRel(Len);
127 NewProp = nullptr;
128 break;
129 }
130 // Stick it at the beginning of the list
131 if (NewProp)
132 {
133 m_vProps.emplace(m_vProps.begin(), NewProp);
134 }
135 }
136}
137
139{
140 LwpObjectID align;
141 align.ReadIndexed(pFile);
142
143 rtl::Reference<LwpAlignmentPiece> xAlignmentPiece(dynamic_cast<LwpAlignmentPiece*>(align.obj(VO_ALIGNMENTPIECE).get()));
144 m_pAlignment = xAlignmentPiece.is() ? dynamic_cast<LwpAlignmentOverride*>(xAlignmentPiece->GetOverride()) : nullptr;
145
146}
147
149{
150}
151
153{
154 return PP_LOCAL_ALIGN;
155}
156
158{
160
161 LwpIndentPiece *pIndentPiece = dynamic_cast<LwpIndentPiece*>(m_aIndentID.obj(VO_INDENTPIECE).get());
162 m_pIndent = pIndentPiece ? dynamic_cast<LwpIndentOverride*>(pIndentPiece->GetOverride()) : nullptr;
163}
164
166{
167}
168
170{
171 return PP_LOCAL_INDENT;
172}
173
175{
176 LwpObjectID spacing;
177 spacing.ReadIndexed(pFile);
178
179 LwpSpacingPiece *pSpacingPiece = dynamic_cast<LwpSpacingPiece*>(spacing.obj(VO_SPACINGPIECE).get());
180 m_pSpacing = pSpacingPiece ? dynamic_cast<LwpSpacingOverride*>(pSpacingPiece->GetOverride()) : nullptr;
181}
182
184{
185}
186
188{
189 return PP_LOCAL_SPACING;
190}
191
192// 01/25/2004
194m_pParaBorderOverride(nullptr)
195{
196 LwpObjectID aParaBorder;
197 aParaBorder.ReadIndexed(pStrm);
198
199 if (!aParaBorder.IsNull())
200 {
201 LwpParaBorderPiece *pParaBorderPiece = dynamic_cast<LwpParaBorderPiece*>(aParaBorder.obj().get());
202 m_pParaBorderOverride = pParaBorderPiece ? dynamic_cast<LwpParaBorderOverride*>(pParaBorderPiece->GetOverride()) : nullptr;
203 }
204}
205
207m_pBreaks(nullptr)
208{
209 LwpObjectID aBreaks;
210 aBreaks.ReadIndexed(pStrm);
211
212 if (!aBreaks.IsNull())
213 {
214 LwpBreaksPiece *pBreaksPiece = dynamic_cast<LwpBreaksPiece*>(aBreaks.obj().get());
215 m_pBreaks = pBreaksPiece ? dynamic_cast<LwpBreaksOverride*>(pBreaksPiece->GetOverride()) : nullptr;
216 }
217}
218
220m_pBullet(new LwpBulletOverride)
221{
222 m_pBullet->Read(pStrm);
223}
224
226{
227}
228
230 : m_pNumberingOverride(nullptr)
231{
232 LwpObjectID aNumberingPiece;
233 aNumberingPiece.ReadIndexed(pStrm);
234 if (aNumberingPiece.IsNull())
235 {
236 return;
237 }
238
239 LwpNumberingPiece *pNumberingPiece = dynamic_cast<LwpNumberingPiece*>(aNumberingPiece.obj(VO_NUMBERINGPIECE).get());
240 m_pNumberingOverride = pNumberingPiece ? dynamic_cast<LwpNumberingOverride*>(pNumberingPiece->GetOverride()) : nullptr;
241}
242
244{
245 LwpObjectID aTabRack;
246 aTabRack.ReadIndexed(pFile);
247
248 LwpTabPiece *pTabPiece = dynamic_cast<LwpTabPiece*>(aTabRack.obj().get());
249 m_pTabOverride = pTabPiece ? dynamic_cast<LwpTabOverride*>(pTabPiece->GetOverride()) : nullptr;
250}
251
253{
254}
255
257{
258 LwpObjectID background;
259 background.ReadIndexed(pFile);
260
261 LwpBackgroundPiece *pBackgroundPiece = dynamic_cast<LwpBackgroundPiece*>(background.obj().get());
262 m_pBackground = pBackgroundPiece ? dynamic_cast<LwpBackgroundOverride*>(pBackgroundPiece->GetOverride()) : nullptr;
263}
264
266{
267}
268
269/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
object id class
Definition: lwpobjid.hxx:79
void ReadIndexed(LwpSvStream *pStrm)
@descr Read object id with indexed format from stream if index>0, lowid is get from time table per th...
Definition: lwpobjid.cxx:96
rtl::Reference< LwpObject > obj(VO_TYPE tag=VO_INVALID) const
@descr get object from object factory per the object id
Definition: lwpobjid.cxx:183
bool IsNull() const
Definition: lwpobjid.hxx:110
stream class for LwpObject body data provide stream like interface to read object data
Definition: lwpobjstrm.hxx:77
sal_uInt16 QuickReaduInt16(bool *pFailure=nullptr)
@descr Quick read sal_uInt32
Definition: lwpobjstrm.cxx:200
void SeekRel(sal_uInt16 pos)
@descr SeekRel pos in object stream/buffer
Definition: lwpobjstrm.cxx:160
sal_uInt32 QuickReaduInt32(bool *pFailure=nullptr)
@descr Quick read sal_uInt32
Definition: lwpobjstrm.cxx:189
LwpAlignmentOverride * m_pAlignment
virtual ~LwpParaAlignProperty() override
LwpParaAlignProperty(LwpObjectStream *pFile)
sal_uInt32 GetType() override
LwpBackgroundOverride * m_pBackground
virtual ~LwpParaBackGroundProperty() override
LwpParaBackGroundProperty(LwpObjectStream *pFile)
LwpParaBorderProperty(LwpObjectStream *pStrm)
LwpParaBorderOverride * m_pParaBorderOverride
LwpParaBreaksProperty(LwpObjectStream *pStrm)
LwpBreaksOverride * m_pBreaks
virtual ~LwpParaBulletProperty() override
std::unique_ptr< LwpBulletOverride > m_pBullet
LwpParaBulletProperty(LwpObjectStream *pStrm)
virtual ~LwpParaIndentProperty() override
sal_uInt32 GetType() override
LwpParaIndentProperty(LwpObjectStream *pFile)
LwpIndentOverride * m_pIndent
LwpParaNumberingProperty(LwpObjectStream *pStrm)
LwpNumberingOverride * m_pNumberingOverride
LwpSpacingOverride * m_pSpacing
virtual ~LwpParaSpacingProperty() override
LwpParaSpacingProperty(LwpObjectStream *pFile)
sal_uInt32 GetType() override
LwpParaTabRackProperty(LwpObjectStream *pStrm)
virtual ~LwpParaTabRackProperty() override
LwpTabOverride * m_pTabOverride
std::vector< std::unique_ptr< LwpParaProperty > > m_vProps
Definition: lwppara.hxx:199
void ReadPropertyList(LwpObjectStream *pFile)
void SetBulletFlag(bool bFlag)
Definition: lwppara.hxx:295
LwpOverride * GetOverride()
Definition: lwppiece.hxx:90
@ VO_ALIGNMENTPIECE
Definition: lwpdefs.hxx:105
@ VO_SPACINGPIECE
Definition: lwpdefs.hxx:107
@ VO_INDENTPIECE
Definition: lwpdefs.hxx:106
@ VO_NUMBERINGPIECE
Definition: lwpdefs.hxx:114
#define TAG_PARA_ALIGN
Definition: lwpobjtags.hxx:82
#define TAG_PARA_BACKGROUND
Definition: lwpobjtags.hxx:86
#define TAG_PARA_SPACING
Definition: lwpobjtags.hxx:84
#define TAG_PARA_TAB
Definition: lwpobjtags.hxx:90
#define TAG_PARA_INDENT
Definition: lwpobjtags.hxx:83
#define TAG_PARA_BREAKS
Definition: lwpobjtags.hxx:87
#define TAG_PARA_BORDER
Definition: lwpobjtags.hxx:85
#define TAG_PARA_BULLET
Definition: lwpobjtags.hxx:88
#define TAG_PARA_NUMBERING
Definition: lwpobjtags.hxx:89
#define TAG_ENDSUBOBJ
Definition: lwpobjtags.hxx:63
#define PP_LOCAL_INDENT
#define PP_LOCAL_SPACING
#define PP_LOCAL_ALIGN