Bump version to 4.3-4
[LibreOffice.git] / lotuswordpro / source / filter / lwppara.hxx
blobc88280a5dcfbd92bfb90b5bc830bc3c7045e294e
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 * LwpPara: Word Pro object for paragraph
59 ************************************************************************/
60 /*************************************************************************
61 * Change History
62 Jan 2005 Created
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"
71 #include "lwpobj.hxx"
72 #include "lwpobjstrm.hxx"
74 #include <vector>
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;
90 class LwpPara;
91 class LwpBreaksOverride;
92 class LwpBulletStyleMgr;
93 class LwpNotifyListPersistent
95 public:
96 LwpNotifyListPersistent(){}
97 void Read(LwpObjectStream* pObjStrm);
98 protected:
99 LwpObjectID m_Head;
102 class LwpForked3NotifyList
104 public:
105 LwpForked3NotifyList(){}
106 protected:
107 LwpNotifyListPersistent m_ExtraList;
108 LwpNotifyListPersistent m_PersistentList;
109 public:
110 LwpNotifyListPersistent* GetExtraList(){return &m_ExtraList;}
111 void Read(LwpObjectStream* pObjStrm);
114 class LwpParaStyle;
115 class LwpTabOverride;
116 class LwpNumberingOverride;
117 class LwpSilverBullet;
118 class LwpPageLayout;
120 struct ParaNumbering
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
130 ParaNumbering()
132 clear();
135 void clear()
137 pPrefix = NULL;
138 pParaNumber = NULL;
139 pSuffix = NULL;
140 nPrefixLevel = 0;
141 nNumLevel = 0;
142 nSuffixLevel = 0;
146 class LwpDropcapLayout;
147 class LwpPara : public LwpDLVList
149 public:
150 LwpPara(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
151 virtual ~LwpPara();
152 public:
153 void Read() SAL_OVERRIDE;
154 void RegisterStyle() SAL_OVERRIDE;
155 void Parse(IXFStream* pOutputStream) SAL_OVERRIDE;
156 void XFConvert(XFContentContainer* pCont) SAL_OVERRIDE;
157 void Release();
159 LwpPara* GetParent();
160 LwpObjectID* GetStoryID();
161 LwpStory* GetStory();
162 LwpBreaksOverride* GetBreaks();
164 LwpParaStyle* GetParaStyle();
165 XFParaStyle* GetXFParaStyle();
166 LwpIndentOverride* GetIndent();
167 LwpTabOverride* GetLocalTabOverride();
168 LwpNumberingOverride* GetParaNumbering();
170 inline LwpSilverBullet* GetSilverBullet();
171 inline LwpObjectID GetSilverBulletID();
172 OUString GetBulletChar() const;
173 sal_uInt32 GetBulletFontID() const;
174 sal_uInt16 GetLevel() const;
175 bool GetBulletFlag() const;
177 void GetParaNumber(sal_uInt16 nPosition, ParaNumbering* pParaNumbering);
178 LwpFribPtr* GetFribs();
179 double GetBelowSpacing();
180 LwpParaProperty* GetProperty(sal_uInt32 nPropType);
181 void GatherDropcapInfo();
182 OUString GetBulletStyleName() const;
183 void SetBelowSpacing(double value);
184 void SetBulletStyleName(const OUString& rNewName);
185 void SetBulletFlag(bool bFlag);
186 void SetIndent(LwpIndentOverride* pIndentOverride);
187 void SetFirstFrib(const OUString& Content,sal_uInt32 FontID);
188 OUString GetContentText(bool bAllText = false);
190 void SetParaDropcap(bool bFlag);
191 void SetDropcapLines(sal_uInt16 number);
192 void SetDropcapChars(sal_uInt32 chars);
193 void SetDropcapLayout(LwpDropcapLayout* pLayout);
194 bool IsHasDropcap();
196 XFContentContainer* GetXFContainer();
197 void AddXFContent(XFContent* pCont);
198 void SetXFContainer(XFContentContainer* pCont);
199 void FindLayouts();// for register pagelayout, add by , 02/20/2005
200 void RegisterTabStyle(XFParaStyle* pXFParaStyle);
202 LwpBulletStyleMgr* GetBulletStyleMgr();
203 sal_uInt32 GetOrdinal(){ return m_nOrdinal;}
204 bool operator <(LwpPara& Other);
205 bool ComparePagePosition(LwpVirtualLayout* pPreLayout, LwpVirtualLayout* pNextLayout);
207 bool IsInCell();
209 void SetAllText(const OUString& sText);
210 OUString GetStyleName(){return m_StyleName;}
212 protected:
213 sal_uInt32 m_nOrdinal; // Ordinal number of this paragraph
214 LwpObjectID m_ParaStyle; // handle of paragraph style
215 LwpPoint m_Hint; // Paragraph hint - width & height
216 LwpObjectID m_Story; // Story the paragraph is part of
218 sal_uInt16 m_nFlags;
219 sal_uInt16 m_nLevel;
220 LwpFribPtr m_Fribs;
221 LwpParaProperty* m_pProps;
222 //LwpForked3NotifyList* m_NotifyList; //not saved
224 OUString m_StyleName;
225 OUString m_ParentStyleName;//Add to support toc
226 LwpBreaksOverride* m_pBreaks;
227 OUString m_AftPageBreakName;
228 OUString m_BefPageBreakName;
229 OUString m_AftColumnBreakName;
231 OUString m_BefColumnBreakName;
232 LwpIndentOverride* m_pIndentOverride;
233 OUString m_Content;//for silver bullet,get text of first frib, add by 2/1
234 sal_uInt32 m_FontID;//for silver bullet
235 OUString m_AllText;//get all text in this paragraph
237 bool m_bHasBullet;
238 LwpObjectID m_aSilverBulletID;
239 LwpSilverBullet* m_pSilverBullet;
240 LwpBulletOverride* m_pBullOver;
241 boost::scoped_ptr<LwpNumberingOverride> m_pParaNumbering;
242 OUString m_aBulletStyleName;
243 bool m_bBullContinue;
244 //end add
246 OUString m_SectionStyleName;
247 bool m_bHasDropcap;
248 sal_uInt16 m_nLines;
249 sal_uInt32 m_nChars;
250 LwpDropcapLayout* m_pDropcapLayout;
251 double m_BelowSpacing;
253 XFContentContainer* m_pXFContainer; //Current container for VO_PARA
255 OUString m_TabStyleName;
256 enum
258 /* bit definitions for the paragraph object flags */
259 DEMAND_LOAD = 0x0001, // need to demand load this para
260 DATA_DIRTY = 0x0002, // paragraph data is dirty
261 SPELLSTARTOVER = 0x0004, // need to recheck paragraph
262 SPELLDIRTY = 0x0008, // has misspelled word in para
263 SPELLCHECKING = 0x0010, // started checking paragraph
264 READING = 0x0020, // We're loading this para from disk
265 DISKCHANGED = 0x0040, // Read size different from write size
266 USEFLOWBREAKS = 0x0080, // Use line breaks provided by filter
267 VALID_LEVEL = 0x0100, // cLevel is valid
268 NOUSECOUNT = 0x0200, // Don't change the style's use count
269 CHANGED = 0x0400, // This para has been edited
270 SPREADBULLET = 0x0800, // Para's bullet is in edit-on-page mode
271 NEWBULLET = 0x1000, // Bullets should have new font behavior
273 // Don't write these flags out to disk
274 NOWRITEFLAGS = (READING | DISKCHANGED | CHANGED),
276 MAX_INDENT_LEVELS = 10
278 private:
279 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
308 return m_Content;
310 inline sal_uInt32 LwpPara::GetBulletFontID() const
312 return m_FontID;
314 inline sal_uInt16 LwpPara::GetLevel() const
316 return m_nLevel;
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
328 return m_bHasBullet;
330 inline LwpFribPtr* LwpPara::GetFribs()
332 return &m_Fribs;
334 inline LwpBreaksOverride* LwpPara::GetBreaks()
336 return m_pBreaks;
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()
366 return &m_Story;
368 inline LwpStory* LwpPara::GetStory()
370 if (m_Story.obj())
371 return dynamic_cast<LwpStory*>(m_Story.obj());
372 return NULL;
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)
385 m_nLines = number;
387 inline void LwpPara::SetDropcapChars(sal_uInt32 chars)
389 m_nChars = 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;
403 #endif
405 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */