LibreOffice Module lotuswordpro (master) 1
lwppara.hxx
Go to the documentation of this file.
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#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPARA_HXX
62#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPPARA_HXX
63
64#include <memory>
65#include <config_lgpl.h>
66
67#include <lwpobj.hxx>
68#include <lwpobjstrm.hxx>
69
70#include <string_view>
71#include <vector>
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"
80#include <xfilter/xfsection.hxx>
81
82class LwpParaProperty;
83class LwpPara;
86
88{
89public:
91 void Read(LwpObjectStream* pObjStrm);
92private:
94};
95
97{
98public:
101 void Read(LwpObjectStream* pObjStrm);
102private:
105};
106
107class LwpParaStyle;
108class LwpTabOverride;
110class LwpSilverBullet;
111class LwpPageLayout;
112
114{
118
119 sal_uInt16 nNumLevel;//hidelevels of paranumber frib
120
122 {
123 clear();
124 }
125
126 void clear()
127 {
128 pPrefix = nullptr;
129 pParaNumber = nullptr;
130 pSuffix = nullptr;
131 nNumLevel = 0;
132 }
133};
134
135class LwpDropcapLayout;
136class LwpPara : public LwpDLVList
137{
138public:
139 LwpPara(LwpObjectHeader const & objHdr, LwpSvStream* pStrm);
140
141 void Read() override;
142 void RegisterStyle() override;
143 void Parse(IXFStream* pOutputStream) override;
144 void XFConvert(XFContentContainer* pCont) override;
145
149
155
157 const OUString& GetBulletChar() const;
158 sal_uInt32 GetBulletFontID() const;
159 sal_uInt16 GetLevel() const;
160 bool GetBulletFlag() const;
161
162 void GetParaNumber(sal_uInt16 nPosition, ParaNumbering* pParaNumbering);
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);
173
174 void SetParaDropcap(bool bFlag);
175 void SetDropcapLayout(LwpDropcapLayout* pLayout);
176
178 void AddXFContent(XFContent* pCont);
180 void RegisterTabStyle(XFParaStyle* pXFParaStyle);
181
183 bool operator <(LwpPara const & Other);
184 bool ComparePagePosition(LwpVirtualLayout const * pPreLayout, LwpVirtualLayout const * pNextLayout);
185
186 bool IsInCell();
187
188 void SetAllText(std::u16string_view sText);
189
190private:
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
195
196 sal_uInt16 m_nFlags;
197 sal_uInt16 m_nLevel;
199 std::vector< std::unique_ptr<LwpParaProperty> > m_vProps;
200 //LwpForked3NotifyList* m_NotifyList; //not saved
201
202 OUString m_StyleName;
203 OUString m_ParentStyleName;//Add to support toc
204 std::unique_ptr<LwpBreaksOverride> m_pBreaks;
208
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
214
218 std::unique_ptr<LwpBulletOverride> m_xBullOver;
219 std::unique_ptr<LwpNumberingOverride> m_xParaNumbering;
222 //end add
223
226 sal_uInt16 m_nLines;
227 sal_uInt32 m_nChars;
230
231 rtl::Reference<XFContentContainer> m_xXFContainer; //Current container for VO_PARA
232
233 enum
234 {
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
249
250 // Don't write these flags out to disk
252
254 };
255private:
256 virtual ~LwpPara() override;
257
258 static void OverrideAlignment(LwpAlignmentOverride* base,LwpAlignmentOverride* over,XFParaStyle* pOverStyle);
261 void OverrideParaBorder(LwpParaProperty* pProps, XFParaStyle* pOverStyle);
262 void OverrideParaBreaks(LwpParaProperty* pProps, XFParaStyle* pOverStyle);
263
265 void OverrideParaNumbering(LwpParaProperty const * pProps);
266
267 void RegisterMasterPage(XFParaStyle const * pBaseStyle);
269
270 void ParseDropcapContent();
275
277};
278
280{
281 return m_pSilverBullet;
282}
283inline const OUString& LwpPara::GetBulletChar() const
284{
285 return m_Content;
286}
287inline sal_uInt32 LwpPara::GetBulletFontID() const
288{
289 return m_FontID;
290}
291inline sal_uInt16 LwpPara::GetLevel() const
292{
293 return m_nLevel;
294}
295inline void LwpPara::SetBulletFlag(bool bFlag)
296{
297 m_bHasBullet = bFlag;
298}
299inline bool LwpPara::GetBulletFlag() const
300{
301 return m_bHasBullet;
302}
304{
305 return m_Fribs;
306}
308{
309 return m_xXFContainer.get();
310}
311inline const OUString& LwpPara::GetBulletStyleName() const
312{
313 return m_aBulletStyleName;
314}
316{
317 if (!m_xXFContainer)
318 throw std::runtime_error("paragraph lacks container");
319 m_xXFContainer->Add(pCont);
320}
322{
323 m_xXFContainer.set(pCont);
324}
326{
327 return m_pIndentOverride.get();
328}
329inline void LwpPara::SetIndent(LwpIndentOverride* pIndentOverride)
330{
331 m_pIndentOverride.reset( pIndentOverride );
332}
334{
335 return m_Story;
336}
338{
339 if (m_Story.obj().is())
340 return dynamic_cast<LwpStory*>(m_Story.obj().get());
341 return nullptr;
342}
343inline void LwpPara::SetParaDropcap(bool bFlag)
344{
345 m_bHasDropcap = bFlag;
346}
348{
349 m_pDropcapLayout = pLayout;
350}
351inline double LwpPara::GetBelowSpacing() const
352{
353 return m_BelowSpacing;
354}
355inline void LwpPara::SetBelowSpacing(double value)
356{
358}
359#endif
360
361/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Stream wrapper for sax writer.
Definition: ixfstream.hxx:72
Double Linked Virtual List.
Definition: lwpdlvlist.hxx:72
void Read(LwpObjectStream *pObjStrm)
Definition: lwppara.cxx:837
LwpNotifyListPersistent m_ExtraList
Definition: lwppara.hxx:103
LwpNotifyListPersistent & GetExtraList()
Definition: lwppara.hxx:100
LwpNotifyListPersistent m_PersistentList
Definition: lwppara.hxx:104
void Read(LwpObjectStream *pObjStrm)
Definition: lwppara.cxx:842
LwpObjectID m_Head
Definition: lwppara.hxx:93
Base class of all Lwp VO objects.
Definition: lwpobjhdr.hxx:71
object id class
Definition: lwpobjid.hxx:79
rtl::Reference< LwpObject > obj(VO_TYPE tag=VO_INVALID) const
@descr get object from object factory per the object id
Definition: lwpobjid.cxx:183
stream class for LwpObject body data provide stream like interface to read object data
Definition: lwpobjstrm.hxx:77
void SetAllText(std::u16string_view sText)
set text of paragraph
Definition: lwppara1.cxx:102
sal_uInt16 GetLevel() const
Definition: lwppara.hxx:291
OUString m_BefColumnBreakName
Definition: lwppara.hxx:209
void SetIndent(LwpIndentOverride *pIndentOverride)
Definition: lwppara.hxx:329
bool ComparePagePosition(LwpVirtualLayout const *pPreLayout, LwpVirtualLayout const *pNextLayout)
@descr: If the two layouts in the same para, compare which layout is earlied according to frib order
Definition: lwppara1.cxx:555
@ DISKCHANGED
Definition: lwppara.hxx:242
@ MAX_INDENT_LEVELS
Definition: lwppara.hxx:253
@ VALID_LEVEL
Definition: lwppara.hxx:244
@ NEWBULLET
Definition: lwppara.hxx:248
@ SPELLDIRTY
Definition: lwppara.hxx:239
@ DEMAND_LOAD
Definition: lwppara.hxx:236
@ CHANGED
Definition: lwppara.hxx:246
@ READING
Definition: lwppara.hxx:241
@ DATA_DIRTY
Definition: lwppara.hxx:237
@ USEFLOWBREAKS
Definition: lwppara.hxx:243
@ SPREADBULLET
Definition: lwppara.hxx:247
@ NOWRITEFLAGS
Definition: lwppara.hxx:251
@ SPELLCHECKING
Definition: lwppara.hxx:240
@ SPELLSTARTOVER
Definition: lwppara.hxx:238
@ NOUSECOUNT
Definition: lwppara.hxx:245
OUString m_StyleName
Definition: lwppara.hxx:202
OUString m_AftColumnBreakName
Definition: lwppara.hxx:207
OUString m_SectionStyleName
Definition: lwppara.hxx:224
void GatherDropcapInfo()
get drop cap info
Definition: lwppara1.cxx:126
rtl::Reference< XFSection > CreateXFSection()
Definition: lwppara.cxx:697
void OverrideIndent(LwpIndentOverride *base, LwpIndentOverride *over, XFParaStyle *pOverStyle)
override indent attribute
Definition: lwppara1.cxx:276
void SetBelowSpacing(double value)
Definition: lwppara.hxx:355
sal_uInt16 m_nFlags
Definition: lwppara.hxx:196
virtual ~LwpPara() override
Definition: lwppara.cxx:103
sal_uInt32 GetBulletFontID() const
Definition: lwppara.hxx:287
const OUString & GetBulletStyleName() const
Definition: lwppara.hxx:311
void SetFirstFrib(const OUString &Content, sal_uInt32 FontID)
set first frib content
Definition: lwppara1.cxx:110
OUString m_AllText
Definition: lwppara.hxx:213
void RegisterNewSectionStyle(LwpPageLayout *pLayout)
Definition: lwppara.cxx:682
LwpDropcapLayout * m_pDropcapLayout
Definition: lwppara.hxx:228
OUString m_aBulletStyleName
Definition: lwppara.hxx:220
double GetBelowSpacing() const
Definition: lwppara.hxx:351
sal_uInt32 m_nChars
Definition: lwppara.hxx:227
std::unique_ptr< LwpBulletOverride > m_xBullOver
Definition: lwppara.hxx:218
void OverrideParaBorder(LwpParaProperty *pProps, XFParaStyle *pOverStyle)
: Override paraborder style.
Definition: lwppara1.cxx:317
void RegisterStyle() override
register paragraph style
Definition: lwppara.cxx:273
bool IsInCell()
check paragraph in cell or not
Definition: lwppara1.cxx:564
std::unique_ptr< LwpBreaksOverride > m_pBreaks
Definition: lwppara.hxx:204
std::vector< std::unique_ptr< LwpParaProperty > > m_vProps
Definition: lwppara.hxx:199
OUString m_BefPageBreakName
Definition: lwppara.hxx:206
LwpFribPtr & GetFribs()
Definition: lwppara.hxx:303
rtl::Reference< XFContentContainer > AddBulletList(XFContentContainer *pCont)
Definition: lwppara.cxx:803
bool m_bBullContinue
Definition: lwppara.hxx:221
void OverrideParaBreaks(LwpParaProperty *pProps, XFParaStyle *pOverStyle)
: Override parabreaks style.
Definition: lwppara1.cxx:349
bool m_bHasBullet
Definition: lwppara.hxx:215
void XFConvert(XFContentContainer *pCont) override
@descr default XFConvert function pCont is the XFContentContainer for the object conversion
Definition: lwppara.cxx:191
bool GetBulletFlag() const
Definition: lwppara.hxx:299
void AddXFContent(XFContent *pCont)
Definition: lwppara.hxx:315
LwpStory * GetStory()
Definition: lwppara.hxx:337
std::unique_ptr< LwpNumberingOverride > m_xParaNumbering
Definition: lwppara.hxx:219
void OverrideParaBullet(LwpParaProperty *pProps)
: Override bullet styles.
Definition: lwppara1.cxx:414
LwpPara * GetParent()
get parent paragraph
Definition: lwppara1.cxx:134
LwpFribPtr m_Fribs
Definition: lwppara.hxx:198
void ReadPropertyList(LwpObjectStream *pFile)
void AddBreakBefore(XFContentContainer *pCont)
add paragraph break attribute
Definition: lwppara.cxx:757
bool operator<(LwpPara const &Other)
@descr: Determined which para is earlier in position
Definition: lwppara1.cxx:546
OUString m_ParentStyleName
Definition: lwppara.hxx:203
LwpObjectID m_ParaStyle
Definition: lwppara.hxx:192
LwpNumberingOverride * GetParaNumbering()
Definition: lwppara.cxx:832
LwpSilverBullet * m_pSilverBullet
Definition: lwppara.hxx:217
sal_uInt16 m_nLines
Definition: lwppara.hxx:226
LwpBulletStyleMgr * GetBulletStyleMgr()
Definition: lwppara.cxx:793
LwpParaStyle * GetParaStyle()
: Get parastyle object according to the objID.
Definition: lwppara1.cxx:307
rtl::Reference< XFContentContainer > m_xXFContainer
Definition: lwppara.hxx:231
std::unique_ptr< LwpIndentOverride > m_pIndentOverride
Definition: lwppara.hxx:210
LwpSilverBullet * GetSilverBullet()
Definition: lwppara.hxx:279
sal_uInt16 m_nLevel
Definition: lwppara.hxx:197
sal_uInt32 m_FontID
Definition: lwppara.hxx:212
static void OverrideAlignment(LwpAlignmentOverride *base, LwpAlignmentOverride *over, XFParaStyle *pOverStyle)
override alignment
Definition: lwppara1.cxx:263
void Read() override
@descr Read LwpDLVList data from object stream
Definition: lwppara.cxx:107
void SetBulletFlag(bool bFlag)
Definition: lwppara.hxx:295
double m_BelowSpacing
Definition: lwppara.hxx:229
OUString const & GetContentText(bool bAllText=false)
get text of paragraph
Definition: lwppara1.cxx:86
sal_uInt32 m_nOrdinal
Definition: lwppara.hxx:191
void Parse(IXFStream *pOutputStream) override
@descr default parse function
Definition: lwppara.cxx:180
void RegisterTabStyle(XFParaStyle *pXFParaStyle)
Definition: lwppara.cxx:708
void SetXFContainer(XFContentContainer *pCont)
Definition: lwppara.hxx:321
OUString m_AftPageBreakName
Definition: lwppara.hxx:205
void AddBreakAfter(XFContentContainer *pCont)
Definition: lwppara.cxx:775
LwpTabOverride * GetLocalTabOverride()
Definition: lwppara1.cxx:532
LwpParaProperty * GetProperty(sal_uInt32 nPropType)
Definition: lwppara1.cxx:519
const OUString & GetBulletChar() const
Definition: lwppara.hxx:283
LwpObjectID m_Story
Definition: lwppara.hxx:194
void SetParaDropcap(bool bFlag)
Definition: lwppara.hxx:343
void OverrideParaNumbering(LwpParaProperty const *pProps)
: Override paranumbering properties.
Definition: lwppara1.cxx:480
LwpObjectID & GetStoryID()
Definition: lwppara.hxx:333
OUString m_Content
Definition: lwppara.hxx:211
void ParseDropcapContent()
parse dropcap text
Definition: lwppara.cxx:743
LwpObjectID m_aSilverBulletID
Definition: lwppara.hxx:216
XFContentContainer * GetXFContainer()
Definition: lwppara.hxx:307
bool m_bHasDropcap
Definition: lwppara.hxx:225
XFParaStyle * GetXFParaStyle()
get paragraph xfstyle
Definition: lwppara1.cxx:118
LwpPoint m_Hint
Definition: lwppara.hxx:193
LwpPara(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
Definition: lwppara.cxx:84
void OverrideSpacing(LwpSpacingOverride *base, LwpSpacingOverride *over, XFParaStyle *pOverStyle)
override spacing
Definition: lwppara1.cxx:291
void SetDropcapLayout(LwpDropcapLayout *pLayout)
Definition: lwppara.hxx:347
LwpIndentOverride * GetIndent()
Definition: lwppara.hxx:325
void GetParaNumber(sal_uInt16 nPosition, ParaNumbering *pParaNumbering)
: Offer prefix, paranumber and suffix according to position.
Definition: lwppara1.cxx:164
void RegisterMasterPage(XFParaStyle const *pBaseStyle)
Definition: lwppara.cxx:245
point class
encapsulate XInputStream to provide SvStream like interfaces
Definition: lwpsvstream.hxx:69
A container for content.
@descr Base class for all content object.
Definition: xfcontent.hxx:80
Style object for aragraph.
Definition: xfparastyle.hxx:93
Any value
Base class of all Lwp VO objects.
sal_uInt16 nNumLevel
Definition: lwppara.hxx:119
void clear()
Definition: lwppara.hxx:126
LwpFribParaNumber * pParaNumber
Definition: lwppara.hxx:116
LwpFribText * pPrefix
Definition: lwppara.hxx:115
LwpFribText * pSuffix
Definition: lwppara.hxx:117