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 INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPARA_HXX
66 : #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPARA_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 92 : LwpNotifyListPersistent(){}
97 : void Read(LwpObjectStream* pObjStrm);
98 : protected:
99 : LwpObjectID m_Head;
100 : };
101 :
102 : class LwpForked3NotifyList
103 : {
104 : public:
105 44 : LwpForked3NotifyList(){}
106 : protected:
107 : LwpNotifyListPersistent m_ExtraList;
108 : LwpNotifyListPersistent m_PersistentList;
109 : public:
110 44 : 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 109 : ParaNumbering()
131 : {
132 109 : clear();
133 109 : }
134 :
135 217 : void clear()
136 : {
137 217 : pPrefix = NULL;
138 217 : pParaNumber = NULL;
139 217 : pSuffix = NULL;
140 217 : nPrefixLevel = 0;
141 217 : nNumLevel = 0;
142 217 : nSuffixLevel = 0;
143 217 : }
144 : };
145 :
146 : class LwpDropcapLayout;
147 : class LwpPara : public LwpDLVList
148 : {
149 : public:
150 : LwpPara(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
151 :
152 : void Read() SAL_OVERRIDE;
153 : void RegisterStyle() SAL_OVERRIDE;
154 : void Parse(IXFStream* pOutputStream) SAL_OVERRIDE;
155 : void XFConvert(XFContentContainer* pCont) SAL_OVERRIDE;
156 :
157 : LwpPara* GetParent();
158 : LwpObjectID& GetStoryID();
159 : LwpStory* GetStory();
160 : LwpBreaksOverride* GetBreaks();
161 :
162 : LwpParaStyle* GetParaStyle();
163 : XFParaStyle* GetXFParaStyle();
164 : LwpIndentOverride* GetIndent();
165 : LwpTabOverride* GetLocalTabOverride();
166 : LwpNumberingOverride* GetParaNumbering();
167 :
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;
174 :
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);
187 :
188 : void SetParaDropcap(bool bFlag);
189 : void SetDropcapLines(sal_uInt16 number);
190 : void SetDropcapChars(sal_uInt32 chars);
191 : void SetDropcapLayout(LwpDropcapLayout* pLayout);
192 : bool IsHasDropcap();
193 :
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);
199 :
200 : LwpBulletStyleMgr* GetBulletStyleMgr();
201 0 : sal_uInt32 GetOrdinal(){ return m_nOrdinal;}
202 : bool operator <(LwpPara& Other);
203 : bool ComparePagePosition(LwpVirtualLayout* pPreLayout, LwpVirtualLayout* pNextLayout);
204 :
205 : bool IsInCell();
206 :
207 : void SetAllText(const OUString& sText);
208 : OUString GetStyleName(){return m_StyleName;}
209 :
210 : protected:
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
215 :
216 : sal_uInt16 m_nFlags;
217 : sal_uInt16 m_nLevel;
218 : LwpFribPtr m_Fribs;
219 : LwpParaProperty* m_pProps;
220 : //LwpForked3NotifyList* m_NotifyList; //not saved
221 :
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;
228 :
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
234 :
235 : bool m_bHasBullet;
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;
242 : //end add
243 :
244 : OUString m_SectionStyleName;
245 : bool m_bHasDropcap;
246 : sal_uInt16 m_nLines;
247 : sal_uInt32 m_nChars;
248 : LwpDropcapLayout* m_pDropcapLayout;
249 : double m_BelowSpacing;
250 :
251 : XFContentContainer* m_pXFContainer; //Current container for VO_PARA
252 :
253 : OUString m_TabStyleName;
254 : enum
255 : {
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
270 :
271 : // Don't write these flags out to disk
272 : NOWRITEFLAGS = (READING | DISKCHANGED | CHANGED),
273 :
274 : MAX_INDENT_LEVELS = 10
275 : };
276 : private:
277 : virtual ~LwpPara();
278 :
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);
284 :
285 : void OverrideParaBullet(LwpParaProperty* pProps);
286 : void OverrideParaNumbering(LwpParaProperty* pProps);
287 :
288 : 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 18 : inline LwpSilverBullet* LwpPara::GetSilverBullet()
299 : {
300 18 : 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 140 : inline sal_uInt16 LwpPara::GetLevel() const
315 : {
316 140 : return m_nLevel;
317 : }
318 : inline void LwpPara::SetBulletStyleName(const OUString& rNewName)
319 : {
320 : m_aBulletStyleName = rNewName;
321 : }
322 4 : inline void LwpPara::SetBulletFlag(bool bFlag)
323 : {
324 4 : m_bHasBullet = bFlag;
325 4 : }
326 130 : inline bool LwpPara::GetBulletFlag() const
327 : {
328 130 : return m_bHasBullet;
329 : }
330 135 : inline LwpFribPtr& LwpPara::GetFribs()
331 : {
332 135 : return m_Fribs;
333 : }
334 : inline LwpBreaksOverride* LwpPara::GetBreaks()
335 : {
336 : return m_pBreaks;
337 : }
338 147 : inline XFContentContainer* LwpPara::GetXFContainer()
339 : {
340 147 : return m_pXFContainer;
341 : }
342 12 : inline OUString LwpPara::GetBulletStyleName() const
343 : {
344 12 : return m_aBulletStyleName;
345 : }
346 1 : inline void LwpPara::AddXFContent(XFContent* pCont)
347 : {
348 1 : m_pXFContainer->Add(pCont);
349 1 : }
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 130 : inline void LwpPara::SetIndent(LwpIndentOverride* pIndentOverride)
359 : {
360 130 : if (m_pIndentOverride)
361 101 : delete m_pIndentOverride;
362 130 : m_pIndentOverride = pIndentOverride;
363 130 : }
364 0 : inline LwpObjectID& LwpPara::GetStoryID()
365 : {
366 0 : return m_Story;
367 : }
368 910 : inline LwpStory* LwpPara::GetStory()
369 : {
370 910 : if (m_Story.obj().is())
371 910 : return dynamic_cast<LwpStory*>(m_Story.obj().get());
372 0 : return NULL;
373 : }
374 :
375 : inline bool LwpPara::IsHasDropcap()
376 : {
377 : return m_bHasDropcap;
378 : }
379 26 : inline void LwpPara::SetParaDropcap(bool bFlag)
380 : {
381 26 : m_bHasDropcap = bFlag;
382 26 : }
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 189 : inline double LwpPara::GetBelowSpacing()
396 : {
397 189 : return m_BelowSpacing;
398 : }
399 97 : inline void LwpPara::SetBelowSpacing(double value)
400 : {
401 97 : m_BelowSpacing = value;
402 97 : }
403 : #endif
404 :
405 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|