update dev300-m57
[ooovba.git] / lotuswordpro / source / filter / lwppara.hxx
blob6e5d6421eed7a7a7206a2b47f7ce3468860b4421
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 * LwpPara: Word Pro object for paragraph
58 ************************************************************************/
59 /*************************************************************************
60 * Change History
61 Jan 2005 Created
62 ************************************************************************/
65 #ifndef _LWPPARAGRAPH_HXX_
66 #define _LWPPARAGRAPH_HXX_
67 #include "lwpfribheader.hxx"
68 #include "lwpobj.hxx"
69 #include "lwpobjstrm.hxx"
71 #include <vector>
72 #include "lwpheader.hxx"
73 #include "lwpdlvlist.hxx"
74 #include "lwpbasetype.hxx"
75 #include "lwpoverride.hxx"
76 #include "lwpfoundry.hxx"
77 #include "lwplayout.hxx"
78 #include "lwpfrib.hxx"
79 #include "lwpfribptr.hxx"
80 #include "lwpfribtext.hxx"
81 #include "xfilter/xfparagraph.hxx"
82 #include "xfilter/xfdefs.hxx"
83 #include "xfilter/xfparastyle.hxx"
84 #include "xfilter/xfsection.hxx"
86 class LwpParaProperty;
87 class LwpPara;
88 class LwpBreaksOverride;
89 class LwpBulletStyleMgr;
90 class LwpNotifyListPersistent
92 public:
93 LwpNotifyListPersistent(){};
94 void Read(LwpObjectStream* pObjStrm);
95 protected:
96 LwpObjectID m_Head;
99 class LwpForked3NotifyList
101 public:
102 LwpForked3NotifyList(){};
103 protected:
104 LwpNotifyListPersistent m_ExtraList;
105 LwpNotifyListPersistent m_PersistentList;
106 public:
107 LwpNotifyListPersistent* GetExtraList(){return &m_ExtraList;}
108 void Read(LwpObjectStream* pObjStrm);
111 class LwpParaStyle;
112 class LwpTabOverride;
113 class LwpNumberingOverride;
114 class LwpSilverBullet;
115 class LwpPageLayout;
117 struct ParaNumbering
119 LwpFribText* pPrefix;
120 LwpFribParaNumber* pParaNumber;
121 LwpFribText* pSuffix;
123 sal_uInt16 nPrefixLevel;//hidelevels of prefix text frib
124 sal_uInt16 nNumLevel;//hidelevels of paranumber frib
125 sal_uInt16 nSuffixLevel;//hidelevels of suffix text frib
127 ParaNumbering()
129 clear();
132 void clear()
134 pPrefix = NULL;
135 pParaNumber = NULL;
136 pSuffix = NULL;
137 nPrefixLevel = 0;
138 nNumLevel = 0;
139 nSuffixLevel = 0;
143 class LwpDropcapLayout;
144 class LwpCellLayout;
145 class LwpPara : public LwpDLVList
147 public:
148 LwpPara(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
149 ~LwpPara();
150 public:
151 void Read();
152 void RegisterStyle();
153 void Parse(IXFStream* pOutputStream);
154 void XFConvert(XFContentContainer* pCont);
155 void Release();
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 rtl::OUString GetBulletChar() const;
171 sal_uInt32 GetBulletFontID() const;
172 sal_uInt16 GetLevel() const;
173 sal_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 rtl::OUString GetBulletStyleName() const;
181 void SetBelowSpacing(double value);
182 void SetBulletStyleName(const rtl::OUString& rNewName);
183 void SetBulletFlag(sal_Bool bFlag);
184 void SetIndent(LwpIndentOverride* pIndentOverride);
185 void SetFirstFrib(rtl::OUString Content,sal_uInt32 FontID);
186 OUString GetContentText(sal_Bool bAllText = sal_False);
188 void SetParaDropcap(sal_Bool bFlag);
189 void SetDropcapLines(sal_uInt16 number);
190 void SetDropcapChars(sal_uInt32 chars);
191 void SetDropcapLayout(LwpDropcapLayout* pLayout);
192 sal_Bool IsHasDropcap();
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 // add by 04/13/2005
201 LwpVirtualLayout* GetLayoutWithMyStory();
202 LwpBulletStyleMgr* GetBulletStyleMgr();
203 sal_uInt32 GetOrdinal(){ return m_nOrdinal;};
204 sal_Bool operator <(LwpPara& Other);
205 sal_Bool ComparePagePosition(LwpVirtualLayout* pPreLayout, LwpVirtualLayout* pNextLayout);
206 // rtl::OUString RegisterBulletStyle();
207 // end add
209 sal_Bool IsNumberRight();
210 sal_Bool IsInCell();
212 void SetAllText(OUString sText);
213 OUString GetStyleName(){return m_StyleName;}
215 protected:
216 sal_uInt32 m_nOrdinal; // Ordinal number of this paragraph
217 LwpObjectID m_ParaStyle; // handle of paragraph style
218 LwpPoint m_Hint; // Paragraph hint - width & height
219 LwpObjectID m_Story; // Story the paragraph is part of
221 sal_uInt16 m_nFlags;
222 sal_uInt16 m_nLevel;
223 LwpFribPtr m_Fribs;
224 LwpParaProperty* m_pProps;
225 //LwpForked3NotifyList* m_NotifyList; //not saved
227 rtl::OUString m_StyleName;
228 rtl::OUString m_ParentStyleName;//Add by ,to support toc,2005/12/13
229 LwpBreaksOverride* m_pBreaks;
230 rtl::OUString m_AftPageBreakName;
231 rtl::OUString m_BefPageBreakName;
232 rtl::OUString m_AftColumnBreakName;
234 rtl::OUString m_BefColumnBreakName;
235 LwpIndentOverride* m_pIndentOverride;
236 rtl::OUString m_Content;//for silver bullet,get text of first frib, add by 2/1
237 sal_uInt32 m_FontID;//for silver bullet, add by 2/1
238 rtl::OUString m_AllText;//get all text in this paragraph
240 //add by
241 sal_Bool m_bHasBullet;
242 LwpObjectID m_aSilverBulletID;
243 LwpSilverBullet* m_pSilverBullet;
244 LwpBulletOverride* m_pBullOver;
245 // LwpNumberingOverride* m_pParaNumbering;
246 LwpNumberingOverride m_aParaNumbering;
247 rtl::OUString m_aBulletStyleName;
248 sal_Bool m_bBullContinue;
249 //end add
251 OUString m_SectionStyleName;
252 sal_Bool m_bHasDropcap;
253 sal_uInt16 m_nLines;
254 sal_uInt32 m_nChars;
255 LwpDropcapLayout* m_pDropcapLayout;
256 double m_BelowSpacing;
258 XFContentContainer* m_pXFContainer; //Current container for VO_PARA
260 rtl::OUString m_TabStyleName;
261 enum
263 /* bit definitions for the paragraph object flags */
264 DEMAND_LOAD = 0x0001, // need to demand load this para
265 DATA_DIRTY = 0x0002, // paragraph data is dirty
266 SPELLSTARTOVER = 0x0004, // need to recheck paragraph
267 SPELLDIRTY = 0x0008, // has misspelled word in para
268 SPELLCHECKING = 0x0010, // started checking paragraph
269 READING = 0x0020, // We're loading this para from disk
270 DISKCHANGED = 0x0040, // Read size different from write size
271 USEFLOWBREAKS = 0x0080, // Use line breaks provided by filter
272 VALID_LEVEL = 0x0100, // cLevel is valid
273 NOUSECOUNT = 0x0200, // Don't change the style's use count
274 CHANGED = 0x0400, // This para has been edited
275 SPREADBULLET = 0x0800, // Para's bullet is in edit-on-page mode
276 NEWBULLET = 0x1000, // Bullets should have new font behavior
278 // Don't write these flags out to disk
279 NOWRITEFLAGS = (READING | DISKCHANGED | CHANGED),
281 MAX_INDENT_LEVELS = 10
283 private:
284 void OverrideAlignment(LwpAlignmentOverride* base,LwpAlignmentOverride* over,XFParaStyle* pOverStyle);//add by 1-24
285 void OverrideIndent(LwpIndentOverride* base,LwpIndentOverride* over,XFParaStyle* pOverStyle);
286 void OverrideSpacing(LwpSpacingOverride* base,LwpSpacingOverride* over,XFParaStyle* pOverStyle);
287 void OverrideParaBorder(LwpParaProperty* pProps, XFParaStyle* pOverStyle);
288 void OverrideParaBreaks(LwpParaProperty* pProps, XFParaStyle* pOverStyle);
290 void OverrideParaBullet(LwpParaProperty* pProps);
291 void OverrideParaNumbering(LwpParaProperty* pProps);
292 void OverrideTab(LwpTabOverride* base,LwpTabOverride* over,XFParaStyle* pOverStyle);
293 BOOL IsBadHintsInFile();
295 //void OutPutSectionTail(IXFStream* pOutputStream);
296 //void OutPutBulletTail(LwpBulletStyleMgr* pBulletStyleMgr,IXFStream* pOutputStream);
298 sal_Bool RegisterMasterPage(XFParaStyle* pBaseStyle);
299 void RegisterNewSectionStyle(LwpPageLayout* pLayout);
301 void ParseDropcapContent();
302 XFContentContainer* AddBulletList(XFContentContainer* pCont);
303 void AddBreakAfter(XFContentContainer* pCont);
304 void AddBreakBefore(XFContentContainer* pCont);
305 XFSection* CreateXFSection();
308 sal_Bool IsNeedTabForTOC();
309 void AddTabStyleForTOC();
310 void AddTabStopForTOC();
311 maybe useful for futer version */
314 inline LwpSilverBullet* LwpPara::GetSilverBullet()
316 return m_pSilverBullet;
318 inline LwpObjectID LwpPara::GetSilverBulletID()
320 return m_aSilverBulletID;
322 inline rtl::OUString LwpPara::GetBulletChar() const
324 return m_Content;
326 inline sal_uInt32 LwpPara::GetBulletFontID() const
328 return m_FontID;
330 inline sal_uInt16 LwpPara::GetLevel() const
332 return m_nLevel;
334 inline void LwpPara::SetBulletStyleName(const rtl::OUString& rNewName)
336 m_aBulletStyleName = rNewName;
338 inline void LwpPara::SetBulletFlag(sal_Bool bFlag)
340 m_bHasBullet = bFlag;
342 inline sal_Bool LwpPara::GetBulletFlag() const
344 return m_bHasBullet;
346 inline LwpFribPtr* LwpPara::GetFribs()
348 return &m_Fribs;
350 inline LwpBreaksOverride* LwpPara::GetBreaks()
352 return m_pBreaks;
354 inline XFContentContainer* LwpPara::GetXFContainer()
356 return m_pXFContainer;
358 inline rtl::OUString LwpPara::GetBulletStyleName() const
360 return m_aBulletStyleName;
362 inline void LwpPara::AddXFContent(XFContent* pCont)
364 m_pXFContainer->Add(pCont);
366 inline void LwpPara::SetXFContainer(XFContentContainer* pCont)
368 m_pXFContainer = pCont;
370 inline LwpIndentOverride* LwpPara::GetIndent()
372 return m_pIndentOverride;
374 inline void LwpPara::SetIndent(LwpIndentOverride* pIndentOverride)
376 if (m_pIndentOverride)
377 delete m_pIndentOverride;
378 m_pIndentOverride = pIndentOverride;
380 inline LwpObjectID* LwpPara::GetStoryID()
382 return &m_Story;
384 inline LwpStory* LwpPara::GetStory()
386 if (m_Story.obj())
387 return static_cast<LwpStory*>(m_Story.obj());
388 return NULL;
391 inline sal_Bool LwpPara::IsHasDropcap()
393 return m_bHasDropcap;
395 inline void LwpPara::SetParaDropcap(sal_Bool bFlag)
397 m_bHasDropcap = bFlag;
399 inline void LwpPara::SetDropcapLines(sal_uInt16 number)
401 m_nLines = number;
403 inline void LwpPara::SetDropcapChars(sal_uInt32 chars)
405 m_nChars = chars;
407 inline void LwpPara::SetDropcapLayout(LwpDropcapLayout* pLayout)
409 m_pDropcapLayout = pLayout;
411 inline BOOL LwpPara::IsBadHintsInFile()
413 return (BOOL) ((m_nFlags & DOC_BADFILEPARAHINTS) != 0);
415 inline double LwpPara::GetBelowSpacing()
417 return m_BelowSpacing;
419 inline void LwpPara::SetBelowSpacing(double value)
421 m_BelowSpacing = value;
423 #endif