Branch data Line data Source code
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 : : * LwpPara: Word Pro object for paragraph
59 : : ************************************************************************/
60 : : /*************************************************************************
61 : : * Change History
62 : : Jan 2005 Created
63 : : ************************************************************************/
64 : :
65 : :
66 : : #ifndef _LWPPARAGRAPH_HXX_
67 : : #define _LWPPARAGRAPH_HXX_
68 : :
69 : : #include <boost/scoped_ptr.hpp>
70 : :
71 : : #include "lwpfribheader.hxx"
72 : : #include "lwpobj.hxx"
73 : : #include "lwpobjstrm.hxx"
74 : :
75 : : #include <vector>
76 : : #include "lwpheader.hxx"
77 : : #include "lwpdlvlist.hxx"
78 : : #include "lwpbasetype.hxx"
79 : : #include "lwpoverride.hxx"
80 : : #include "lwpfoundry.hxx"
81 : : #include "lwplayout.hxx"
82 : : #include "lwpfrib.hxx"
83 : : #include "lwpfribptr.hxx"
84 : : #include "lwpfribtext.hxx"
85 : : #include "xfilter/xfparagraph.hxx"
86 : : #include "xfilter/xfdefs.hxx"
87 : : #include "xfilter/xfparastyle.hxx"
88 : : #include "xfilter/xfsection.hxx"
89 : :
90 : : class LwpParaProperty;
91 : : class LwpPara;
92 : : class LwpBreaksOverride;
93 : : class LwpBulletStyleMgr;
94 : : class LwpNotifyListPersistent
95 : : {
96 : : public:
97 : 276 : LwpNotifyListPersistent(){}
98 : : void Read(LwpObjectStream* pObjStrm);
99 : : protected:
100 : : LwpObjectID m_Head;
101 : : };
102 : :
103 : : class LwpForked3NotifyList
104 : : {
105 : : public:
106 : 132 : LwpForked3NotifyList(){}
107 : : protected:
108 : : LwpNotifyListPersistent m_ExtraList;
109 : : LwpNotifyListPersistent m_PersistentList;
110 : : public:
111 : 132 : LwpNotifyListPersistent* GetExtraList(){return &m_ExtraList;}
112 : : void Read(LwpObjectStream* pObjStrm);
113 : : };
114 : :
115 : : class LwpParaStyle;
116 : : class LwpTabOverride;
117 : : class LwpNumberingOverride;
118 : : class LwpSilverBullet;
119 : : class LwpPageLayout;
120 : :
121 : : struct ParaNumbering
122 : : {
123 : : LwpFribText* pPrefix;
124 : : LwpFribParaNumber* pParaNumber;
125 : : LwpFribText* pSuffix;
126 : :
127 : : sal_uInt16 nPrefixLevel;//hidelevels of prefix text frib
128 : : sal_uInt16 nNumLevel;//hidelevels of paranumber frib
129 : : sal_uInt16 nSuffixLevel;//hidelevels of suffix text frib
130 : :
131 : 327 : ParaNumbering()
132 : : {
133 : 327 : clear();
134 : 327 : }
135 : :
136 : 651 : void clear()
137 : : {
138 : 651 : pPrefix = NULL;
139 : 651 : pParaNumber = NULL;
140 : 651 : pSuffix = NULL;
141 : 651 : nPrefixLevel = 0;
142 : 651 : nNumLevel = 0;
143 : 651 : nSuffixLevel = 0;
144 : 651 : }
145 : : };
146 : :
147 : : class LwpDropcapLayout;
148 : : class LwpPara : public LwpDLVList
149 : : {
150 : : public:
151 : : LwpPara(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
152 : : ~LwpPara();
153 : : public:
154 : : void Read();
155 : : void RegisterStyle();
156 : : void Parse(IXFStream* pOutputStream);
157 : : void XFConvert(XFContentContainer* pCont);
158 : : void Release();
159 : :
160 : : LwpPara* GetParent();
161 : : LwpObjectID* GetStoryID();
162 : : LwpStory* GetStory();
163 : : LwpBreaksOverride* GetBreaks();
164 : :
165 : : LwpParaStyle* GetParaStyle();
166 : : XFParaStyle* GetXFParaStyle();
167 : : LwpIndentOverride* GetIndent();
168 : : LwpTabOverride* GetLocalTabOverride();
169 : : LwpNumberingOverride* GetParaNumbering();
170 : :
171 : : inline LwpSilverBullet* GetSilverBullet();
172 : : inline LwpObjectID GetSilverBulletID();
173 : : rtl::OUString GetBulletChar() const;
174 : : sal_uInt32 GetBulletFontID() const;
175 : : sal_uInt16 GetLevel() const;
176 : : sal_Bool GetBulletFlag() const;
177 : :
178 : : void GetParaNumber(sal_uInt16 nPosition, ParaNumbering* pParaNumbering);
179 : : LwpFribPtr* GetFribs();
180 : : double GetBelowSpacing();
181 : : LwpParaProperty* GetProperty(sal_uInt32 nPropType);
182 : : void GatherDropcapInfo();
183 : : rtl::OUString GetBulletStyleName() const;
184 : : void SetBelowSpacing(double value);
185 : : void SetBulletStyleName(const rtl::OUString& rNewName);
186 : : void SetBulletFlag(sal_Bool bFlag);
187 : : void SetIndent(LwpIndentOverride* pIndentOverride);
188 : : void SetFirstFrib(rtl::OUString Content,sal_uInt32 FontID);
189 : : OUString GetContentText(sal_Bool bAllText = sal_False);
190 : :
191 : : void SetParaDropcap(sal_Bool bFlag);
192 : : void SetDropcapLines(sal_uInt16 number);
193 : : void SetDropcapChars(sal_uInt32 chars);
194 : : void SetDropcapLayout(LwpDropcapLayout* pLayout);
195 : : sal_Bool IsHasDropcap();
196 : :
197 : : XFContentContainer* GetXFContainer();
198 : : void AddXFContent(XFContent* pCont);
199 : : void SetXFContainer(XFContentContainer* pCont);
200 : : void FindLayouts();// for register pagelayout, add by , 02/20/2005
201 : : void RegisterTabStyle(XFParaStyle* pXFParaStyle);
202 : :
203 : : LwpBulletStyleMgr* GetBulletStyleMgr();
204 : 0 : sal_uInt32 GetOrdinal(){ return m_nOrdinal;}
205 : : sal_Bool operator <(LwpPara& Other);
206 : : sal_Bool ComparePagePosition(LwpVirtualLayout* pPreLayout, LwpVirtualLayout* pNextLayout);
207 : :
208 : : sal_Bool IsInCell();
209 : :
210 : : void SetAllText(OUString sText);
211 : : OUString GetStyleName(){return m_StyleName;}
212 : :
213 : : protected:
214 : : sal_uInt32 m_nOrdinal; // Ordinal number of this paragraph
215 : : LwpObjectID m_ParaStyle; // handle of paragraph style
216 : : LwpPoint m_Hint; // Paragraph hint - width & height
217 : : LwpObjectID m_Story; // Story the paragraph is part of
218 : :
219 : : sal_uInt16 m_nFlags;
220 : : sal_uInt16 m_nLevel;
221 : : LwpFribPtr m_Fribs;
222 : : LwpParaProperty* m_pProps;
223 : : //LwpForked3NotifyList* m_NotifyList; //not saved
224 : :
225 : : rtl::OUString m_StyleName;
226 : : rtl::OUString m_ParentStyleName;//Add to support toc
227 : : LwpBreaksOverride* m_pBreaks;
228 : : rtl::OUString m_AftPageBreakName;
229 : : rtl::OUString m_BefPageBreakName;
230 : : rtl::OUString m_AftColumnBreakName;
231 : :
232 : : rtl::OUString m_BefColumnBreakName;
233 : : LwpIndentOverride* m_pIndentOverride;
234 : : rtl::OUString m_Content;//for silver bullet,get text of first frib, add by 2/1
235 : : sal_uInt32 m_FontID;//for silver bullet
236 : : rtl::OUString m_AllText;//get all text in this paragraph
237 : :
238 : : sal_Bool m_bHasBullet;
239 : : LwpObjectID m_aSilverBulletID;
240 : : LwpSilverBullet* m_pSilverBullet;
241 : : LwpBulletOverride* m_pBullOver;
242 : : boost::scoped_ptr<LwpNumberingOverride> m_pParaNumbering;
243 : : rtl::OUString m_aBulletStyleName;
244 : : sal_Bool m_bBullContinue;
245 : : //end add
246 : :
247 : : OUString m_SectionStyleName;
248 : : sal_Bool m_bHasDropcap;
249 : : sal_uInt16 m_nLines;
250 : : sal_uInt32 m_nChars;
251 : : LwpDropcapLayout* m_pDropcapLayout;
252 : : double m_BelowSpacing;
253 : :
254 : : XFContentContainer* m_pXFContainer; //Current container for VO_PARA
255 : :
256 : : rtl::OUString m_TabStyleName;
257 : : enum
258 : : {
259 : : /* bit definitions for the paragraph object flags */
260 : : DEMAND_LOAD = 0x0001, // need to demand load this para
261 : : DATA_DIRTY = 0x0002, // paragraph data is dirty
262 : : SPELLSTARTOVER = 0x0004, // need to recheck paragraph
263 : : SPELLDIRTY = 0x0008, // has misspelled word in para
264 : : SPELLCHECKING = 0x0010, // started checking paragraph
265 : : READING = 0x0020, // We're loading this para from disk
266 : : DISKCHANGED = 0x0040, // Read size different from write size
267 : : USEFLOWBREAKS = 0x0080, // Use line breaks provided by filter
268 : : VALID_LEVEL = 0x0100, // cLevel is valid
269 : : NOUSECOUNT = 0x0200, // Don't change the style's use count
270 : : CHANGED = 0x0400, // This para has been edited
271 : : SPREADBULLET = 0x0800, // Para's bullet is in edit-on-page mode
272 : : NEWBULLET = 0x1000, // Bullets should have new font behavior
273 : :
274 : : // Don't write these flags out to disk
275 : : NOWRITEFLAGS = (READING | DISKCHANGED | CHANGED),
276 : :
277 : : MAX_INDENT_LEVELS = 10
278 : : };
279 : : private:
280 : : void OverrideAlignment(LwpAlignmentOverride* base,LwpAlignmentOverride* over,XFParaStyle* pOverStyle);//add by 1-24
281 : : void OverrideIndent(LwpIndentOverride* base,LwpIndentOverride* over,XFParaStyle* pOverStyle);
282 : : void OverrideSpacing(LwpSpacingOverride* base,LwpSpacingOverride* over,XFParaStyle* pOverStyle);
283 : : void OverrideParaBorder(LwpParaProperty* pProps, XFParaStyle* pOverStyle);
284 : : void OverrideParaBreaks(LwpParaProperty* pProps, XFParaStyle* pOverStyle);
285 : :
286 : : void OverrideParaBullet(LwpParaProperty* pProps);
287 : : void OverrideParaNumbering(LwpParaProperty* pProps);
288 : : sal_Bool IsBadHintsInFile();
289 : :
290 : : sal_Bool RegisterMasterPage(XFParaStyle* pBaseStyle);
291 : : void RegisterNewSectionStyle(LwpPageLayout* pLayout);
292 : :
293 : : void ParseDropcapContent();
294 : : XFContentContainer* AddBulletList(XFContentContainer* pCont);
295 : : void AddBreakAfter(XFContentContainer* pCont);
296 : : void AddBreakBefore(XFContentContainer* pCont);
297 : : XFSection* CreateXFSection();
298 : : };
299 : :
300 : 54 : inline LwpSilverBullet* LwpPara::GetSilverBullet()
301 : : {
302 : 54 : return m_pSilverBullet;
303 : : }
304 : : inline LwpObjectID LwpPara::GetSilverBulletID()
305 : : {
306 : : return m_aSilverBulletID;
307 : : }
308 : 0 : inline rtl::OUString LwpPara::GetBulletChar() const
309 : : {
310 : 0 : return m_Content;
311 : : }
312 : 0 : inline sal_uInt32 LwpPara::GetBulletFontID() const
313 : : {
314 : 0 : return m_FontID;
315 : : }
316 : 420 : inline sal_uInt16 LwpPara::GetLevel() const
317 : : {
318 : 420 : return m_nLevel;
319 : : }
320 : : inline void LwpPara::SetBulletStyleName(const rtl::OUString& rNewName)
321 : : {
322 : : m_aBulletStyleName = rNewName;
323 : : }
324 : 12 : inline void LwpPara::SetBulletFlag(sal_Bool bFlag)
325 : : {
326 : 12 : m_bHasBullet = bFlag;
327 : 12 : }
328 : 390 : inline sal_Bool LwpPara::GetBulletFlag() const
329 : : {
330 : 390 : return m_bHasBullet;
331 : : }
332 : 405 : inline LwpFribPtr* LwpPara::GetFribs()
333 : : {
334 : 405 : return &m_Fribs;
335 : : }
336 : : inline LwpBreaksOverride* LwpPara::GetBreaks()
337 : : {
338 : : return m_pBreaks;
339 : : }
340 : 450 : inline XFContentContainer* LwpPara::GetXFContainer()
341 : : {
342 : 450 : return m_pXFContainer;
343 : : }
344 : 36 : inline rtl::OUString LwpPara::GetBulletStyleName() const
345 : : {
346 : 36 : return m_aBulletStyleName;
347 : : }
348 : 3 : inline void LwpPara::AddXFContent(XFContent* pCont)
349 : : {
350 : 3 : m_pXFContainer->Add(pCont);
351 : 3 : }
352 : 0 : inline void LwpPara::SetXFContainer(XFContentContainer* pCont)
353 : : {
354 : 0 : m_pXFContainer = pCont;
355 : 0 : }
356 : 0 : inline LwpIndentOverride* LwpPara::GetIndent()
357 : : {
358 : 0 : return m_pIndentOverride;
359 : : }
360 : 390 : inline void LwpPara::SetIndent(LwpIndentOverride* pIndentOverride)
361 : : {
362 [ + + ]: 390 : if (m_pIndentOverride)
363 [ + - ]: 303 : delete m_pIndentOverride;
364 : 390 : m_pIndentOverride = pIndentOverride;
365 : 390 : }
366 : 0 : inline LwpObjectID* LwpPara::GetStoryID()
367 : : {
368 : 0 : return &m_Story;
369 : : }
370 : 2751 : inline LwpStory* LwpPara::GetStory()
371 : : {
372 [ + - ]: 2751 : if (m_Story.obj())
373 [ + - ]: 2751 : return dynamic_cast<LwpStory*>(m_Story.obj());
374 : 2751 : return NULL;
375 : : }
376 : :
377 : : inline sal_Bool LwpPara::IsHasDropcap()
378 : : {
379 : : return m_bHasDropcap;
380 : : }
381 : 78 : inline void LwpPara::SetParaDropcap(sal_Bool bFlag)
382 : : {
383 : 78 : m_bHasDropcap = bFlag;
384 : 78 : }
385 : 0 : inline void LwpPara::SetDropcapLines(sal_uInt16 number)
386 : : {
387 : 0 : m_nLines = number;
388 : 0 : }
389 : 0 : inline void LwpPara::SetDropcapChars(sal_uInt32 chars)
390 : : {
391 : 0 : m_nChars = chars;
392 : 0 : }
393 : 0 : inline void LwpPara::SetDropcapLayout(LwpDropcapLayout* pLayout)
394 : : {
395 : 0 : m_pDropcapLayout = pLayout;
396 : 0 : }
397 : 777 : inline sal_Bool LwpPara::IsBadHintsInFile()
398 : : {
399 : 777 : return (sal_Bool) ((m_nFlags & DOC_BADFILEPARAHINTS) != 0);
400 : : }
401 : 567 : inline double LwpPara::GetBelowSpacing()
402 : : {
403 : 567 : return m_BelowSpacing;
404 : : }
405 : 291 : inline void LwpPara::SetBelowSpacing(double value)
406 : : {
407 : 291 : m_BelowSpacing = value;
408 : 291 : }
409 : : #endif
410 : :
411 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|