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,
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 /*************************************************************************
58 * LwpPara: Word Pro object for paragraph
59 ************************************************************************/
60 /*************************************************************************
63 ************************************************************************/
65 #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPARA_HXX
66 #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPARA_HXX
68 #include <boost/scoped_ptr.hpp>
70 #include "lwpfribheader.hxx"
72 #include "lwpobjstrm.hxx"
75 #include "lwpheader.hxx"
76 #include "lwpdlvlist.hxx"
77 #include "lwpbasetype.hxx"
78 #include "lwpoverride.hxx"
79 #include "lwpfoundry.hxx"
80 #include "lwplayout.hxx"
81 #include "lwpfrib.hxx"
82 #include "lwpfribptr.hxx"
83 #include "lwpfribtext.hxx"
84 #include "xfilter/xfparagraph.hxx"
85 #include "xfilter/xfdefs.hxx"
86 #include "xfilter/xfparastyle.hxx"
87 #include "xfilter/xfsection.hxx"
89 class LwpParaProperty
;
91 class LwpBreaksOverride
;
92 class LwpBulletStyleMgr
;
93 class LwpNotifyListPersistent
96 LwpNotifyListPersistent(){}
97 void Read(LwpObjectStream
* pObjStrm
);
102 class LwpForked3NotifyList
105 LwpForked3NotifyList(){}
107 LwpNotifyListPersistent m_ExtraList
;
108 LwpNotifyListPersistent m_PersistentList
;
110 LwpNotifyListPersistent
& GetExtraList() { return m_ExtraList
; }
111 void Read(LwpObjectStream
* pObjStrm
);
115 class LwpTabOverride
;
116 class LwpNumberingOverride
;
117 class LwpSilverBullet
;
122 LwpFribText
* pPrefix
;
123 LwpFribParaNumber
* pParaNumber
;
124 LwpFribText
* pSuffix
;
126 sal_uInt16 nPrefixLevel
;//hidelevels of prefix text frib
127 sal_uInt16 nNumLevel
;//hidelevels of paranumber frib
128 sal_uInt16 nSuffixLevel
;//hidelevels of suffix text frib
146 class LwpDropcapLayout
;
147 class LwpPara
: public LwpDLVList
150 LwpPara(LwpObjectHeader
& objHdr
, LwpSvStream
* pStrm
);
152 void Read() SAL_OVERRIDE
;
153 void RegisterStyle() SAL_OVERRIDE
;
154 void Parse(IXFStream
* pOutputStream
) SAL_OVERRIDE
;
155 void XFConvert(XFContentContainer
* pCont
) SAL_OVERRIDE
;
157 LwpPara
* GetParent();
158 LwpObjectID
& GetStoryID();
159 LwpStory
* GetStory();
160 LwpBreaksOverride
* GetBreaks();
162 LwpParaStyle
* GetParaStyle();
163 XFParaStyle
* GetXFParaStyle();
164 LwpIndentOverride
* GetIndent();
165 LwpTabOverride
* GetLocalTabOverride();
166 LwpNumberingOverride
* GetParaNumbering();
168 inline LwpSilverBullet
* GetSilverBullet();
169 inline LwpObjectID
GetSilverBulletID();
170 OUString
GetBulletChar() const;
171 sal_uInt32
GetBulletFontID() const;
172 sal_uInt16
GetLevel() const;
173 bool GetBulletFlag() const;
175 void GetParaNumber(sal_uInt16 nPosition
, ParaNumbering
* pParaNumbering
);
176 LwpFribPtr
& GetFribs();
177 double GetBelowSpacing();
178 LwpParaProperty
* GetProperty(sal_uInt32 nPropType
);
179 void GatherDropcapInfo();
180 OUString
GetBulletStyleName() const;
181 void SetBelowSpacing(double value
);
182 void SetBulletStyleName(const OUString
& rNewName
);
183 void SetBulletFlag(bool bFlag
);
184 void SetIndent(LwpIndentOverride
* pIndentOverride
);
185 void SetFirstFrib(const OUString
& Content
,sal_uInt32 FontID
);
186 OUString
GetContentText(bool bAllText
= false);
188 void SetParaDropcap(bool bFlag
);
189 void SetDropcapLines(sal_uInt16 number
);
190 void SetDropcapChars(sal_uInt32 chars
);
191 void SetDropcapLayout(LwpDropcapLayout
* pLayout
);
194 XFContentContainer
* GetXFContainer();
195 void AddXFContent(XFContent
* pCont
);
196 void SetXFContainer(XFContentContainer
* pCont
);
197 void FindLayouts();// for register pagelayout, add by , 02/20/2005
198 void RegisterTabStyle(XFParaStyle
* pXFParaStyle
);
200 LwpBulletStyleMgr
* GetBulletStyleMgr();
201 sal_uInt32
GetOrdinal(){ return m_nOrdinal
;}
202 bool operator <(LwpPara
& Other
);
203 bool ComparePagePosition(LwpVirtualLayout
* pPreLayout
, LwpVirtualLayout
* pNextLayout
);
207 void SetAllText(const OUString
& sText
);
208 OUString
GetStyleName(){return m_StyleName
;}
211 sal_uInt32 m_nOrdinal
; // Ordinal number of this paragraph
212 LwpObjectID m_ParaStyle
; // handle of paragraph style
213 LwpPoint m_Hint
; // Paragraph hint - width & height
214 LwpObjectID m_Story
; // Story the paragraph is part of
219 LwpParaProperty
* m_pProps
;
220 //LwpForked3NotifyList* m_NotifyList; //not saved
222 OUString m_StyleName
;
223 OUString m_ParentStyleName
;//Add to support toc
224 LwpBreaksOverride
* m_pBreaks
;
225 OUString m_AftPageBreakName
;
226 OUString m_BefPageBreakName
;
227 OUString m_AftColumnBreakName
;
229 OUString m_BefColumnBreakName
;
230 LwpIndentOverride
* m_pIndentOverride
;
231 OUString m_Content
;//for silver bullet,get text of first frib, add by 2/1
232 sal_uInt32 m_FontID
;//for silver bullet
233 OUString m_AllText
;//get all text in this paragraph
236 LwpObjectID m_aSilverBulletID
;
237 LwpSilverBullet
* m_pSilverBullet
;
238 LwpBulletOverride
* m_pBullOver
;
239 boost::scoped_ptr
<LwpNumberingOverride
> m_pParaNumbering
;
240 OUString m_aBulletStyleName
;
241 bool m_bBullContinue
;
244 OUString m_SectionStyleName
;
248 LwpDropcapLayout
* m_pDropcapLayout
;
249 double m_BelowSpacing
;
251 XFContentContainer
* m_pXFContainer
; //Current container for VO_PARA
253 OUString m_TabStyleName
;
256 /* bit definitions for the paragraph object flags */
257 DEMAND_LOAD
= 0x0001, // need to demand load this para
258 DATA_DIRTY
= 0x0002, // paragraph data is dirty
259 SPELLSTARTOVER
= 0x0004, // need to recheck paragraph
260 SPELLDIRTY
= 0x0008, // has misspelled word in para
261 SPELLCHECKING
= 0x0010, // started checking paragraph
262 READING
= 0x0020, // We're loading this para from disk
263 DISKCHANGED
= 0x0040, // Read size different from write size
264 USEFLOWBREAKS
= 0x0080, // Use line breaks provided by filter
265 VALID_LEVEL
= 0x0100, // cLevel is valid
266 NOUSECOUNT
= 0x0200, // Don't change the style's use count
267 CHANGED
= 0x0400, // This para has been edited
268 SPREADBULLET
= 0x0800, // Para's bullet is in edit-on-page mode
269 NEWBULLET
= 0x1000, // Bullets should have new font behavior
271 // Don't write these flags out to disk
272 NOWRITEFLAGS
= (READING
| DISKCHANGED
| CHANGED
),
274 MAX_INDENT_LEVELS
= 10
279 static void OverrideAlignment(LwpAlignmentOverride
* base
,LwpAlignmentOverride
* over
,XFParaStyle
* pOverStyle
);//add by 1-24
280 void OverrideIndent(LwpIndentOverride
* base
,LwpIndentOverride
* over
,XFParaStyle
* pOverStyle
);
281 void OverrideSpacing(LwpSpacingOverride
* base
,LwpSpacingOverride
* over
,XFParaStyle
* pOverStyle
);
282 void OverrideParaBorder(LwpParaProperty
* pProps
, XFParaStyle
* pOverStyle
);
283 void OverrideParaBreaks(LwpParaProperty
* pProps
, XFParaStyle
* pOverStyle
);
285 void OverrideParaBullet(LwpParaProperty
* pProps
);
286 void OverrideParaNumbering(LwpParaProperty
* pProps
);
288 bool RegisterMasterPage(XFParaStyle
* pBaseStyle
);
289 void RegisterNewSectionStyle(LwpPageLayout
* pLayout
);
291 void ParseDropcapContent();
292 XFContentContainer
* AddBulletList(XFContentContainer
* pCont
);
293 void AddBreakAfter(XFContentContainer
* pCont
);
294 void AddBreakBefore(XFContentContainer
* pCont
);
295 XFSection
* CreateXFSection();
298 inline LwpSilverBullet
* LwpPara::GetSilverBullet()
300 return m_pSilverBullet
;
302 inline LwpObjectID
LwpPara::GetSilverBulletID()
304 return m_aSilverBulletID
;
306 inline OUString
LwpPara::GetBulletChar() const
310 inline sal_uInt32
LwpPara::GetBulletFontID() const
314 inline sal_uInt16
LwpPara::GetLevel() const
318 inline void LwpPara::SetBulletStyleName(const OUString
& rNewName
)
320 m_aBulletStyleName
= rNewName
;
322 inline void LwpPara::SetBulletFlag(bool bFlag
)
324 m_bHasBullet
= bFlag
;
326 inline bool LwpPara::GetBulletFlag() const
330 inline LwpFribPtr
& LwpPara::GetFribs()
334 inline LwpBreaksOverride
* LwpPara::GetBreaks()
338 inline XFContentContainer
* LwpPara::GetXFContainer()
340 return m_pXFContainer
;
342 inline OUString
LwpPara::GetBulletStyleName() const
344 return m_aBulletStyleName
;
346 inline void LwpPara::AddXFContent(XFContent
* pCont
)
348 m_pXFContainer
->Add(pCont
);
350 inline void LwpPara::SetXFContainer(XFContentContainer
* pCont
)
352 m_pXFContainer
= pCont
;
354 inline LwpIndentOverride
* LwpPara::GetIndent()
356 return m_pIndentOverride
;
358 inline void LwpPara::SetIndent(LwpIndentOverride
* pIndentOverride
)
360 if (m_pIndentOverride
)
361 delete m_pIndentOverride
;
362 m_pIndentOverride
= pIndentOverride
;
364 inline LwpObjectID
& LwpPara::GetStoryID()
368 inline LwpStory
* LwpPara::GetStory()
370 if (m_Story
.obj().is())
371 return dynamic_cast<LwpStory
*>(m_Story
.obj().get());
375 inline bool LwpPara::IsHasDropcap()
377 return m_bHasDropcap
;
379 inline void LwpPara::SetParaDropcap(bool bFlag
)
381 m_bHasDropcap
= bFlag
;
383 inline void LwpPara::SetDropcapLines(sal_uInt16 number
)
387 inline void LwpPara::SetDropcapChars(sal_uInt32 chars
)
391 inline void LwpPara::SetDropcapLayout(LwpDropcapLayout
* pLayout
)
393 m_pDropcapLayout
= pLayout
;
395 inline double LwpPara::GetBelowSpacing()
397 return m_BelowSpacing
;
399 inline void LwpPara::SetBelowSpacing(double value
)
401 m_BelowSpacing
= value
;
405 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */