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 : #ifndef _LWPPARAGRAPH_HXX_
66 : #define _LWPPARAGRAPH_HXX_
67 :
68 : #include <boost/scoped_ptr.hpp>
69 :
70 : #include "lwpfribheader.hxx"
71 : #include "lwpobj.hxx"
72 : #include "lwpobjstrm.hxx"
73 :
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"
88 :
89 : class LwpParaProperty;
90 : class LwpPara;
91 : class LwpBreaksOverride;
92 : class LwpBulletStyleMgr;
93 : class LwpNotifyListPersistent
94 : {
95 : public:
96 0 : LwpNotifyListPersistent(){}
97 : void Read(LwpObjectStream* pObjStrm);
98 : protected:
99 : LwpObjectID m_Head;
100 : };
101 :
102 : class LwpForked3NotifyList
103 : {
104 : public:
105 0 : LwpForked3NotifyList(){}
106 : protected:
107 : LwpNotifyListPersistent m_ExtraList;
108 : LwpNotifyListPersistent m_PersistentList;
109 : public:
110 0 : LwpNotifyListPersistent* GetExtraList(){return &m_ExtraList;}
111 : void Read(LwpObjectStream* pObjStrm);
112 : };
113 :
114 : class LwpParaStyle;
115 : class LwpTabOverride;
116 : class LwpNumberingOverride;
117 : class LwpSilverBullet;
118 : class LwpPageLayout;
119 :
120 : struct ParaNumbering
121 : {
122 : LwpFribText* pPrefix;
123 : LwpFribParaNumber* pParaNumber;
124 : LwpFribText* pSuffix;
125 :
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
129 :
130 0 : ParaNumbering()
131 : {
132 0 : clear();
133 0 : }
134 :
135 0 : void clear()
136 : {
137 0 : pPrefix = NULL;
138 0 : pParaNumber = NULL;
139 0 : pSuffix = NULL;
140 0 : nPrefixLevel = 0;
141 0 : nNumLevel = 0;
142 0 : nSuffixLevel = 0;
143 0 : }
144 : };
145 :
146 : class LwpDropcapLayout;
147 : class LwpPara : public LwpDLVList
148 : {
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();
158 :
159 : LwpPara* GetParent();
160 : LwpObjectID* GetStoryID();
161 : LwpStory* GetStory();
162 : LwpBreaksOverride* GetBreaks();
163 :
164 : LwpParaStyle* GetParaStyle();
165 : XFParaStyle* GetXFParaStyle();
166 : LwpIndentOverride* GetIndent();
167 : LwpTabOverride* GetLocalTabOverride();
168 : LwpNumberingOverride* GetParaNumbering();
169 :
170 : inline LwpSilverBullet* GetSilverBullet();
171 : inline LwpObjectID GetSilverBulletID();
172 : OUString GetBulletChar() const;
173 : sal_uInt32 GetBulletFontID() const;
174 : sal_uInt16 GetLevel() const;
175 : sal_Bool GetBulletFlag() const;
176 :
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(sal_Bool bFlag);
186 : void SetIndent(LwpIndentOverride* pIndentOverride);
187 : void SetFirstFrib(const OUString& Content,sal_uInt32 FontID);
188 : OUString GetContentText(sal_Bool bAllText = sal_False);
189 :
190 : void SetParaDropcap(sal_Bool bFlag);
191 : void SetDropcapLines(sal_uInt16 number);
192 : void SetDropcapChars(sal_uInt32 chars);
193 : void SetDropcapLayout(LwpDropcapLayout* pLayout);
194 : sal_Bool IsHasDropcap();
195 :
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);
201 :
202 : LwpBulletStyleMgr* GetBulletStyleMgr();
203 0 : sal_uInt32 GetOrdinal(){ return m_nOrdinal;}
204 : sal_Bool operator <(LwpPara& Other);
205 : sal_Bool ComparePagePosition(LwpVirtualLayout* pPreLayout, LwpVirtualLayout* pNextLayout);
206 :
207 : sal_Bool IsInCell();
208 :
209 : void SetAllText(const OUString& sText);
210 : OUString GetStyleName(){return m_StyleName;}
211 :
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
217 :
218 : sal_uInt16 m_nFlags;
219 : sal_uInt16 m_nLevel;
220 : LwpFribPtr m_Fribs;
221 : LwpParaProperty* m_pProps;
222 : //LwpForked3NotifyList* m_NotifyList; //not saved
223 :
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;
230 :
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
236 :
237 : sal_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 : sal_Bool m_bBullContinue;
244 : //end add
245 :
246 : OUString m_SectionStyleName;
247 : sal_Bool m_bHasDropcap;
248 : sal_uInt16 m_nLines;
249 : sal_uInt32 m_nChars;
250 : LwpDropcapLayout* m_pDropcapLayout;
251 : double m_BelowSpacing;
252 :
253 : XFContentContainer* m_pXFContainer; //Current container for VO_PARA
254 :
255 : OUString m_TabStyleName;
256 : enum
257 : {
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
272 :
273 : // Don't write these flags out to disk
274 : NOWRITEFLAGS = (READING | DISKCHANGED | CHANGED),
275 :
276 : MAX_INDENT_LEVELS = 10
277 : };
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);
284 :
285 : void OverrideParaBullet(LwpParaProperty* pProps);
286 : void OverrideParaNumbering(LwpParaProperty* pProps);
287 :
288 : sal_Bool RegisterMasterPage(XFParaStyle* pBaseStyle);
289 : void RegisterNewSectionStyle(LwpPageLayout* pLayout);
290 :
291 : void ParseDropcapContent();
292 : XFContentContainer* AddBulletList(XFContentContainer* pCont);
293 : void AddBreakAfter(XFContentContainer* pCont);
294 : void AddBreakBefore(XFContentContainer* pCont);
295 : XFSection* CreateXFSection();
296 : };
297 :
298 0 : inline LwpSilverBullet* LwpPara::GetSilverBullet()
299 : {
300 0 : return m_pSilverBullet;
301 : }
302 : inline LwpObjectID LwpPara::GetSilverBulletID()
303 : {
304 : return m_aSilverBulletID;
305 : }
306 0 : inline OUString LwpPara::GetBulletChar() const
307 : {
308 0 : return m_Content;
309 : }
310 0 : inline sal_uInt32 LwpPara::GetBulletFontID() const
311 : {
312 0 : return m_FontID;
313 : }
314 0 : inline sal_uInt16 LwpPara::GetLevel() const
315 : {
316 0 : return m_nLevel;
317 : }
318 : inline void LwpPara::SetBulletStyleName(const OUString& rNewName)
319 : {
320 : m_aBulletStyleName = rNewName;
321 : }
322 0 : inline void LwpPara::SetBulletFlag(sal_Bool bFlag)
323 : {
324 0 : m_bHasBullet = bFlag;
325 0 : }
326 0 : inline sal_Bool LwpPara::GetBulletFlag() const
327 : {
328 0 : return m_bHasBullet;
329 : }
330 0 : inline LwpFribPtr* LwpPara::GetFribs()
331 : {
332 0 : return &m_Fribs;
333 : }
334 : inline LwpBreaksOverride* LwpPara::GetBreaks()
335 : {
336 : return m_pBreaks;
337 : }
338 0 : inline XFContentContainer* LwpPara::GetXFContainer()
339 : {
340 0 : return m_pXFContainer;
341 : }
342 0 : inline OUString LwpPara::GetBulletStyleName() const
343 : {
344 0 : return m_aBulletStyleName;
345 : }
346 0 : inline void LwpPara::AddXFContent(XFContent* pCont)
347 : {
348 0 : m_pXFContainer->Add(pCont);
349 0 : }
350 0 : inline void LwpPara::SetXFContainer(XFContentContainer* pCont)
351 : {
352 0 : m_pXFContainer = pCont;
353 0 : }
354 0 : inline LwpIndentOverride* LwpPara::GetIndent()
355 : {
356 0 : return m_pIndentOverride;
357 : }
358 0 : inline void LwpPara::SetIndent(LwpIndentOverride* pIndentOverride)
359 : {
360 0 : if (m_pIndentOverride)
361 0 : delete m_pIndentOverride;
362 0 : m_pIndentOverride = pIndentOverride;
363 0 : }
364 0 : inline LwpObjectID* LwpPara::GetStoryID()
365 : {
366 0 : return &m_Story;
367 : }
368 0 : inline LwpStory* LwpPara::GetStory()
369 : {
370 0 : if (m_Story.obj())
371 0 : return dynamic_cast<LwpStory*>(m_Story.obj());
372 0 : return NULL;
373 : }
374 :
375 : inline sal_Bool LwpPara::IsHasDropcap()
376 : {
377 : return m_bHasDropcap;
378 : }
379 0 : inline void LwpPara::SetParaDropcap(sal_Bool bFlag)
380 : {
381 0 : m_bHasDropcap = bFlag;
382 0 : }
383 0 : inline void LwpPara::SetDropcapLines(sal_uInt16 number)
384 : {
385 0 : m_nLines = number;
386 0 : }
387 0 : inline void LwpPara::SetDropcapChars(sal_uInt32 chars)
388 : {
389 0 : m_nChars = chars;
390 0 : }
391 0 : inline void LwpPara::SetDropcapLayout(LwpDropcapLayout* pLayout)
392 : {
393 0 : m_pDropcapLayout = pLayout;
394 0 : }
395 0 : inline double LwpPara::GetBelowSpacing()
396 : {
397 0 : return m_BelowSpacing;
398 : }
399 0 : inline void LwpPara::SetBelowSpacing(double value)
400 : {
401 0 : m_BelowSpacing = value;
402 0 : }
403 : #endif
404 :
405 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|