1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
10 * Sun Microsystems Inc., October, 2000
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
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.
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.
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,
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.
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.
46 * The Initial Developer of the Original Code is: IBM Corporation
48 * Copyright: 2008 by IBM Corporation
50 * All Rights Reserved.
52 * Contributor(s): _______________________________________
55 ************************************************************************/
56 /*************************************************************************
58 * LwpPara: Word Pro object for paragraph
59 ************************************************************************/
61 #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPARA_HXX
62 #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPARA_HXX
65 #include <config_lgpl.h>
68 #include <lwpobjstrm.hxx>
70 #include <string_view>
72 #include "lwpdlvlist.hxx"
73 #include <lwpbasetype.hxx>
74 #include <lwpoverride.hxx>
75 #include <lwpfoundry.hxx>
76 #include "lwplayout.hxx"
77 #include "lwpfribptr.hxx"
78 #include "lwpfribtext.hxx"
79 #include <xfilter/xfparastyle.hxx>
80 #include <xfilter/xfsection.hxx>
82 class LwpParaProperty
;
84 class LwpBreaksOverride
;
85 class LwpBulletStyleMgr
;
87 class LwpNotifyListPersistent final
90 LwpNotifyListPersistent(){}
91 void Read(LwpObjectStream
* pObjStrm
);
96 class LwpForked3NotifyList final
99 LwpForked3NotifyList(){}
100 LwpNotifyListPersistent
& GetExtraList() { return m_ExtraList
; }
101 void Read(LwpObjectStream
* pObjStrm
);
103 LwpNotifyListPersistent m_ExtraList
;
104 LwpNotifyListPersistent m_PersistentList
;
108 class LwpTabOverride
;
109 class LwpNumberingOverride
;
110 class LwpSilverBullet
;
115 LwpFribText
* pPrefix
;
116 LwpFribParaNumber
* pParaNumber
;
117 LwpFribText
* pSuffix
;
119 sal_uInt16 nNumLevel
;//hidelevels of paranumber frib
129 pParaNumber
= nullptr;
135 class LwpDropcapLayout
;
136 class LwpPara
: public LwpDLVList
139 LwpPara(LwpObjectHeader
const & objHdr
, LwpSvStream
* pStrm
);
141 void Read() override
;
142 void RegisterStyle() override
;
143 void Parse(IXFStream
* pOutputStream
) override
;
144 void XFConvert(XFContentContainer
* pCont
) override
;
146 LwpPara
* GetParent();
147 LwpObjectID
& GetStoryID();
148 LwpStory
* GetStory();
150 LwpParaStyle
* GetParaStyle();
151 XFParaStyle
* GetXFParaStyle();
152 LwpIndentOverride
* GetIndent();
153 LwpTabOverride
* GetLocalTabOverride();
154 LwpNumberingOverride
* GetParaNumbering();
156 inline LwpSilverBullet
* GetSilverBullet();
157 const OUString
& GetBulletChar() const;
158 sal_uInt32
GetBulletFontID() const;
159 sal_uInt16
GetLevel() const;
160 bool GetBulletFlag() const;
162 void GetParaNumber(sal_uInt16 nPosition
, ParaNumbering
* pParaNumbering
);
163 LwpFribPtr
& GetFribs();
164 double GetBelowSpacing() const;
165 LwpParaProperty
* GetProperty(sal_uInt32 nPropType
);
166 void GatherDropcapInfo();
167 const OUString
& GetBulletStyleName() const;
168 void SetBelowSpacing(double value
);
169 void SetBulletFlag(bool bFlag
);
170 void SetIndent(LwpIndentOverride
* pIndentOverride
);
171 void SetFirstFrib(const OUString
& Content
,sal_uInt32 FontID
);
172 OUString
const & GetContentText(bool bAllText
= false);
174 void SetParaDropcap(bool bFlag
);
175 void SetDropcapLayout(LwpDropcapLayout
* pLayout
);
177 XFContentContainer
* GetXFContainer();
178 void AddXFContent(XFContent
* pCont
);
179 void SetXFContainer(XFContentContainer
* pCont
);
180 void RegisterTabStyle(XFParaStyle
* pXFParaStyle
);
182 LwpBulletStyleMgr
* GetBulletStyleMgr();
183 bool operator <(LwpPara
const & Other
);
184 bool ComparePagePosition(LwpVirtualLayout
const * pPreLayout
, LwpVirtualLayout
const * pNextLayout
);
188 void SetAllText(std::u16string_view sText
);
191 sal_uInt32 m_nOrdinal
; // Ordinal number of this paragraph
192 LwpObjectID m_ParaStyle
; // handle of paragraph style
193 LwpPoint m_Hint
; // Paragraph hint - width & height
194 LwpObjectID m_Story
; // Story the paragraph is part of
199 std::vector
< std::unique_ptr
<LwpParaProperty
> > m_vProps
;
200 //LwpForked3NotifyList* m_NotifyList; //not saved
202 OUString m_StyleName
;
203 OUString m_ParentStyleName
;//Add to support toc
204 std::unique_ptr
<LwpBreaksOverride
> m_pBreaks
;
205 OUString m_AftPageBreakName
;
206 OUString m_BefPageBreakName
;
207 OUString m_AftColumnBreakName
;
209 OUString m_BefColumnBreakName
;
210 std::unique_ptr
<LwpIndentOverride
> m_pIndentOverride
;
211 OUString m_Content
;//for silver bullet,get text of first frib
212 sal_uInt32 m_FontID
;//for silver bullet
213 OUString m_AllText
;//get all text in this paragraph
216 LwpObjectID m_aSilverBulletID
;
217 LwpSilverBullet
* m_pSilverBullet
;
218 std::unique_ptr
<LwpBulletOverride
> m_xBullOver
;
219 std::unique_ptr
<LwpNumberingOverride
> m_xParaNumbering
;
220 OUString m_aBulletStyleName
;
221 bool m_bBullContinue
;
224 OUString m_SectionStyleName
;
228 LwpDropcapLayout
* m_pDropcapLayout
;
229 double m_BelowSpacing
;
231 rtl::Reference
<XFContentContainer
> m_xXFContainer
; //Current container for VO_PARA
235 /* bit definitions for the paragraph object flags */
236 DEMAND_LOAD
= 0x0001, // need to demand load this para
237 DATA_DIRTY
= 0x0002, // paragraph data is dirty
238 SPELLSTARTOVER
= 0x0004, // need to recheck paragraph
239 SPELLDIRTY
= 0x0008, // has misspelled word in para
240 SPELLCHECKING
= 0x0010, // started checking paragraph
241 READING
= 0x0020, // We're loading this para from disk
242 DISKCHANGED
= 0x0040, // Read size different from write size
243 USEFLOWBREAKS
= 0x0080, // Use line breaks provided by filter
244 VALID_LEVEL
= 0x0100, // cLevel is valid
245 NOUSECOUNT
= 0x0200, // Don't change the style's use count
246 CHANGED
= 0x0400, // This para has been edited
247 SPREADBULLET
= 0x0800, // Para's bullet is in edit-on-page mode
248 NEWBULLET
= 0x1000, // Bullets should have new font behavior
250 // Don't write these flags out to disk
251 NOWRITEFLAGS
= (READING
| DISKCHANGED
| CHANGED
),
253 MAX_INDENT_LEVELS
= 10
256 virtual ~LwpPara() override
;
258 static void OverrideAlignment(LwpAlignmentOverride
* base
,LwpAlignmentOverride
* over
,XFParaStyle
* pOverStyle
);
259 void OverrideIndent(LwpIndentOverride
* base
,LwpIndentOverride
* over
,XFParaStyle
* pOverStyle
);
260 void OverrideSpacing(LwpSpacingOverride
* base
,LwpSpacingOverride
* over
,XFParaStyle
* pOverStyle
);
261 void OverrideParaBorder(LwpParaProperty
* pProps
, XFParaStyle
* pOverStyle
);
262 void OverrideParaBreaks(LwpParaProperty
* pProps
, XFParaStyle
* pOverStyle
);
264 void OverrideParaBullet(LwpParaProperty
* pProps
);
265 void OverrideParaNumbering(LwpParaProperty
const * pProps
);
267 void RegisterMasterPage(XFParaStyle
const * pBaseStyle
);
268 void RegisterNewSectionStyle(LwpPageLayout
* pLayout
);
270 void ParseDropcapContent();
271 rtl::Reference
<XFContentContainer
> AddBulletList(XFContentContainer
* pCont
);
272 void AddBreakAfter(XFContentContainer
* pCont
);
273 void AddBreakBefore(XFContentContainer
* pCont
);
274 rtl::Reference
<XFSection
> CreateXFSection();
276 void ReadPropertyList(LwpObjectStream
* pFile
);
279 inline LwpSilverBullet
* LwpPara::GetSilverBullet()
281 return m_pSilverBullet
;
283 inline const OUString
& LwpPara::GetBulletChar() const
287 inline sal_uInt32
LwpPara::GetBulletFontID() const
291 inline sal_uInt16
LwpPara::GetLevel() const
295 inline void LwpPara::SetBulletFlag(bool bFlag
)
297 m_bHasBullet
= bFlag
;
299 inline bool LwpPara::GetBulletFlag() const
303 inline LwpFribPtr
& LwpPara::GetFribs()
307 inline XFContentContainer
* LwpPara::GetXFContainer()
309 return m_xXFContainer
.get();
311 inline const OUString
& LwpPara::GetBulletStyleName() const
313 return m_aBulletStyleName
;
315 inline void LwpPara::AddXFContent(XFContent
* pCont
)
318 throw std::runtime_error("paragraph lacks container");
319 m_xXFContainer
->Add(pCont
);
321 inline void LwpPara::SetXFContainer(XFContentContainer
* pCont
)
323 m_xXFContainer
.set(pCont
);
325 inline LwpIndentOverride
* LwpPara::GetIndent()
327 return m_pIndentOverride
.get();
329 inline void LwpPara::SetIndent(LwpIndentOverride
* pIndentOverride
)
331 m_pIndentOverride
.reset( pIndentOverride
);
333 inline LwpObjectID
& LwpPara::GetStoryID()
337 inline LwpStory
* LwpPara::GetStory()
339 if (m_Story
.obj().is())
340 return dynamic_cast<LwpStory
*>(m_Story
.obj().get());
343 inline void LwpPara::SetParaDropcap(bool bFlag
)
345 m_bHasDropcap
= bFlag
;
347 inline void LwpPara::SetDropcapLayout(LwpDropcapLayout
* pLayout
)
349 m_pDropcapLayout
= pLayout
;
351 inline double LwpPara::GetBelowSpacing() const
353 return m_BelowSpacing
;
355 inline void LwpPara::SetBelowSpacing(double value
)
357 m_BelowSpacing
= value
;
361 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */