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 184 : LwpNotifyListPersistent(){}
97 : void Read(LwpObjectStream* pObjStrm);
98 : protected:
99 : LwpObjectID m_Head;
100 : };
101 :
102 : class LwpForked3NotifyList
103 : {
104 : public:
105 88 : LwpForked3NotifyList(){}
106 : protected:
107 : LwpNotifyListPersistent m_ExtraList;
108 : LwpNotifyListPersistent m_PersistentList;
109 : public:
110 88 : 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 218 : ParaNumbering()
131 : {
132 218 : clear();
133 218 : }
134 :
135 434 : void clear()
136 : {
137 434 : pPrefix = NULL;
138 434 : pParaNumber = NULL;
139 434 : pSuffix = NULL;
140 434 : nPrefixLevel = 0;
141 434 : nNumLevel = 0;
142 434 : nSuffixLevel = 0;
143 434 : }
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 : void Release();
157 :
158 : LwpPara* GetParent();
159 : LwpObjectID& GetStoryID();
160 : LwpStory* GetStory();
161 : LwpBreaksOverride* GetBreaks();
162 :
163 : LwpParaStyle* GetParaStyle();
164 : XFParaStyle* GetXFParaStyle();
165 : LwpIndentOverride* GetIndent();
166 : LwpTabOverride* GetLocalTabOverride();
167 : LwpNumberingOverride* GetParaNumbering();
168 :
169 : inline LwpSilverBullet* GetSilverBullet();
170 : inline LwpObjectID GetSilverBulletID();
171 : OUString GetBulletChar() const;
172 : sal_uInt32 GetBulletFontID() const;
173 : sal_uInt16 GetLevel() const;
174 : bool GetBulletFlag() const;
175 :
176 : void GetParaNumber(sal_uInt16 nPosition, ParaNumbering* pParaNumbering);
177 : LwpFribPtr& GetFribs();
178 : double GetBelowSpacing();
179 : LwpParaProperty* GetProperty(sal_uInt32 nPropType);
180 : void GatherDropcapInfo();
181 : OUString GetBulletStyleName() const;
182 : void SetBelowSpacing(double value);
183 : void SetBulletStyleName(const OUString& rNewName);
184 : void SetBulletFlag(bool bFlag);
185 : void SetIndent(LwpIndentOverride* pIndentOverride);
186 : void SetFirstFrib(const OUString& Content,sal_uInt32 FontID);
187 : OUString GetContentText(bool bAllText = false);
188 :
189 : void SetParaDropcap(bool bFlag);
190 : void SetDropcapLines(sal_uInt16 number);
191 : void SetDropcapChars(sal_uInt32 chars);
192 : void SetDropcapLayout(LwpDropcapLayout* pLayout);
193 : bool IsHasDropcap();
194 :
195 : XFContentContainer* GetXFContainer();
196 : void AddXFContent(XFContent* pCont);
197 : void SetXFContainer(XFContentContainer* pCont);
198 : void FindLayouts();// for register pagelayout, add by , 02/20/2005
199 : void RegisterTabStyle(XFParaStyle* pXFParaStyle);
200 :
201 : LwpBulletStyleMgr* GetBulletStyleMgr();
202 0 : sal_uInt32 GetOrdinal(){ return m_nOrdinal;}
203 : bool operator <(LwpPara& Other);
204 : bool ComparePagePosition(LwpVirtualLayout* pPreLayout, LwpVirtualLayout* pNextLayout);
205 :
206 : bool IsInCell();
207 :
208 : void SetAllText(const OUString& sText);
209 : OUString GetStyleName(){return m_StyleName;}
210 :
211 : protected:
212 : sal_uInt32 m_nOrdinal; // Ordinal number of this paragraph
213 : LwpObjectID m_ParaStyle; // handle of paragraph style
214 : LwpPoint m_Hint; // Paragraph hint - width & height
215 : LwpObjectID m_Story; // Story the paragraph is part of
216 :
217 : sal_uInt16 m_nFlags;
218 : sal_uInt16 m_nLevel;
219 : LwpFribPtr m_Fribs;
220 : LwpParaProperty* m_pProps;
221 : //LwpForked3NotifyList* m_NotifyList; //not saved
222 :
223 : OUString m_StyleName;
224 : OUString m_ParentStyleName;//Add to support toc
225 : LwpBreaksOverride* m_pBreaks;
226 : OUString m_AftPageBreakName;
227 : OUString m_BefPageBreakName;
228 : OUString m_AftColumnBreakName;
229 :
230 : OUString m_BefColumnBreakName;
231 : LwpIndentOverride* m_pIndentOverride;
232 : OUString m_Content;//for silver bullet,get text of first frib, add by 2/1
233 : sal_uInt32 m_FontID;//for silver bullet
234 : OUString m_AllText;//get all text in this paragraph
235 :
236 : bool m_bHasBullet;
237 : LwpObjectID m_aSilverBulletID;
238 : LwpSilverBullet* m_pSilverBullet;
239 : LwpBulletOverride* m_pBullOver;
240 : boost::scoped_ptr<LwpNumberingOverride> m_pParaNumbering;
241 : OUString m_aBulletStyleName;
242 : bool m_bBullContinue;
243 : //end add
244 :
245 : OUString m_SectionStyleName;
246 : bool m_bHasDropcap;
247 : sal_uInt16 m_nLines;
248 : sal_uInt32 m_nChars;
249 : LwpDropcapLayout* m_pDropcapLayout;
250 : double m_BelowSpacing;
251 :
252 : XFContentContainer* m_pXFContainer; //Current container for VO_PARA
253 :
254 : OUString m_TabStyleName;
255 : enum
256 : {
257 : /* bit definitions for the paragraph object flags */
258 : DEMAND_LOAD = 0x0001, // need to demand load this para
259 : DATA_DIRTY = 0x0002, // paragraph data is dirty
260 : SPELLSTARTOVER = 0x0004, // need to recheck paragraph
261 : SPELLDIRTY = 0x0008, // has misspelled word in para
262 : SPELLCHECKING = 0x0010, // started checking paragraph
263 : READING = 0x0020, // We're loading this para from disk
264 : DISKCHANGED = 0x0040, // Read size different from write size
265 : USEFLOWBREAKS = 0x0080, // Use line breaks provided by filter
266 : VALID_LEVEL = 0x0100, // cLevel is valid
267 : NOUSECOUNT = 0x0200, // Don't change the style's use count
268 : CHANGED = 0x0400, // This para has been edited
269 : SPREADBULLET = 0x0800, // Para's bullet is in edit-on-page mode
270 : NEWBULLET = 0x1000, // Bullets should have new font behavior
271 :
272 : // Don't write these flags out to disk
273 : NOWRITEFLAGS = (READING | DISKCHANGED | CHANGED),
274 :
275 : MAX_INDENT_LEVELS = 10
276 : };
277 : private:
278 : virtual ~LwpPara();
279 :
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 :
289 : bool RegisterMasterPage(XFParaStyle* pBaseStyle);
290 : void RegisterNewSectionStyle(LwpPageLayout* pLayout);
291 :
292 : void ParseDropcapContent();
293 : XFContentContainer* AddBulletList(XFContentContainer* pCont);
294 : void AddBreakAfter(XFContentContainer* pCont);
295 : void AddBreakBefore(XFContentContainer* pCont);
296 : XFSection* CreateXFSection();
297 : };
298 :
299 36 : inline LwpSilverBullet* LwpPara::GetSilverBullet()
300 : {
301 36 : return m_pSilverBullet;
302 : }
303 : inline LwpObjectID LwpPara::GetSilverBulletID()
304 : {
305 : return m_aSilverBulletID;
306 : }
307 0 : inline OUString LwpPara::GetBulletChar() const
308 : {
309 0 : return m_Content;
310 : }
311 0 : inline sal_uInt32 LwpPara::GetBulletFontID() const
312 : {
313 0 : return m_FontID;
314 : }
315 280 : inline sal_uInt16 LwpPara::GetLevel() const
316 : {
317 280 : return m_nLevel;
318 : }
319 : inline void LwpPara::SetBulletStyleName(const OUString& rNewName)
320 : {
321 : m_aBulletStyleName = rNewName;
322 : }
323 8 : inline void LwpPara::SetBulletFlag(bool bFlag)
324 : {
325 8 : m_bHasBullet = bFlag;
326 8 : }
327 260 : inline bool LwpPara::GetBulletFlag() const
328 : {
329 260 : return m_bHasBullet;
330 : }
331 270 : inline LwpFribPtr& LwpPara::GetFribs()
332 : {
333 270 : return m_Fribs;
334 : }
335 : inline LwpBreaksOverride* LwpPara::GetBreaks()
336 : {
337 : return m_pBreaks;
338 : }
339 294 : inline XFContentContainer* LwpPara::GetXFContainer()
340 : {
341 294 : return m_pXFContainer;
342 : }
343 24 : inline OUString LwpPara::GetBulletStyleName() const
344 : {
345 24 : return m_aBulletStyleName;
346 : }
347 2 : inline void LwpPara::AddXFContent(XFContent* pCont)
348 : {
349 2 : m_pXFContainer->Add(pCont);
350 2 : }
351 0 : inline void LwpPara::SetXFContainer(XFContentContainer* pCont)
352 : {
353 0 : m_pXFContainer = pCont;
354 0 : }
355 0 : inline LwpIndentOverride* LwpPara::GetIndent()
356 : {
357 0 : return m_pIndentOverride;
358 : }
359 260 : inline void LwpPara::SetIndent(LwpIndentOverride* pIndentOverride)
360 : {
361 260 : if (m_pIndentOverride)
362 202 : delete m_pIndentOverride;
363 260 : m_pIndentOverride = pIndentOverride;
364 260 : }
365 0 : inline LwpObjectID& LwpPara::GetStoryID()
366 : {
367 0 : return m_Story;
368 : }
369 1820 : inline LwpStory* LwpPara::GetStory()
370 : {
371 1820 : if (m_Story.obj().is())
372 1820 : return dynamic_cast<LwpStory*>(m_Story.obj().get());
373 0 : return NULL;
374 : }
375 :
376 : inline bool LwpPara::IsHasDropcap()
377 : {
378 : return m_bHasDropcap;
379 : }
380 52 : inline void LwpPara::SetParaDropcap(bool bFlag)
381 : {
382 52 : m_bHasDropcap = bFlag;
383 52 : }
384 0 : inline void LwpPara::SetDropcapLines(sal_uInt16 number)
385 : {
386 0 : m_nLines = number;
387 0 : }
388 0 : inline void LwpPara::SetDropcapChars(sal_uInt32 chars)
389 : {
390 0 : m_nChars = chars;
391 0 : }
392 0 : inline void LwpPara::SetDropcapLayout(LwpDropcapLayout* pLayout)
393 : {
394 0 : m_pDropcapLayout = pLayout;
395 0 : }
396 378 : inline double LwpPara::GetBelowSpacing()
397 : {
398 378 : return m_BelowSpacing;
399 : }
400 194 : inline void LwpPara::SetBelowSpacing(double value)
401 : {
402 194 : m_BelowSpacing = value;
403 194 : }
404 : #endif
405 :
406 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|