summaryrefslogtreecommitdiff
path: root/lotuswordpro/source/filter/lwppara.hxx
blob: 5fb164c129433d59443e7beed728e4b8ca030184 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: IBM Corporation
 *
 *  Copyright: 2008 by IBM Corporation
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/
/*************************************************************************
 * @file
 *  LwpPara: Word Pro object for paragraph
 ************************************************************************/
/*************************************************************************
 * Change History
 Jan 2005           Created
 ************************************************************************/

#ifndef _LWPPARAGRAPH_HXX_
#define _LWPPARAGRAPH_HXX_

#include <boost/scoped_ptr.hpp>

#include "lwpfribheader.hxx"
#include "lwpobj.hxx"
#include "lwpobjstrm.hxx"

#include <vector>
#include "lwpheader.hxx"
#include "lwpdlvlist.hxx"
#include "lwpbasetype.hxx"
#include "lwpoverride.hxx"
#include "lwpfoundry.hxx"
#include "lwplayout.hxx"
#include "lwpfrib.hxx"
#include "lwpfribptr.hxx"
#include "lwpfribtext.hxx"
#include "xfilter/xfparagraph.hxx"
#include "xfilter/xfdefs.hxx"
#include "xfilter/xfparastyle.hxx"
#include "xfilter/xfsection.hxx"

class LwpParaProperty;
class LwpPara;
class LwpBreaksOverride;
class LwpBulletStyleMgr;
class LwpNotifyListPersistent
{
public:
    LwpNotifyListPersistent(){}
    void Read(LwpObjectStream* pObjStrm);
protected:
    LwpObjectID m_Head;
};

class LwpForked3NotifyList
{
public:
    LwpForked3NotifyList(){}
protected:
    LwpNotifyListPersistent m_ExtraList;
    LwpNotifyListPersistent m_PersistentList;
public:
    LwpNotifyListPersistent* GetExtraList(){return &m_ExtraList;}
    void Read(LwpObjectStream* pObjStrm);
};

class LwpParaStyle;
class LwpTabOverride;
class LwpNumberingOverride;
class LwpSilverBullet;
class LwpPageLayout;

struct ParaNumbering
{
    LwpFribText* pPrefix;
    LwpFribParaNumber* pParaNumber;
    LwpFribText* pSuffix;

    sal_uInt16 nPrefixLevel;//hidelevels of prefix text frib
    sal_uInt16 nNumLevel;//hidelevels of paranumber frib
    sal_uInt16 nSuffixLevel;//hidelevels of suffix text frib

    ParaNumbering()
    {
        clear();
    }

    void clear()
    {
        pPrefix = NULL;
        pParaNumber = NULL;
        pSuffix = NULL;
        nPrefixLevel = 0;
        nNumLevel = 0;
        nSuffixLevel = 0;
    }
};

class LwpDropcapLayout;
class LwpPara : public LwpDLVList
{
public:
    LwpPara(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
    ~LwpPara();
public:
    void Read() SAL_OVERRIDE;
    void RegisterStyle() SAL_OVERRIDE;
    void Parse(IXFStream* pOutputStream) SAL_OVERRIDE;
    void XFConvert(XFContentContainer* pCont) SAL_OVERRIDE;
    void Release();

    LwpPara* GetParent();
    LwpObjectID* GetStoryID();
    LwpStory* GetStory();
    LwpBreaksOverride* GetBreaks();

    LwpParaStyle* GetParaStyle();
    XFParaStyle* GetXFParaStyle();
    LwpIndentOverride* GetIndent();
    LwpTabOverride* GetLocalTabOverride();
    LwpNumberingOverride* GetParaNumbering();

    inline LwpSilverBullet* GetSilverBullet();
    inline LwpObjectID GetSilverBulletID();
    OUString GetBulletChar() const;
    sal_uInt32 GetBulletFontID() const;
    sal_uInt16 GetLevel() const;
    sal_Bool GetBulletFlag() const;

    void GetParaNumber(sal_uInt16 nPosition, ParaNumbering* pParaNumbering);
    LwpFribPtr* GetFribs();
    double GetBelowSpacing();
    LwpParaProperty* GetProperty(sal_uInt32 nPropType);
    void GatherDropcapInfo();
    OUString GetBulletStyleName() const;
    void SetBelowSpacing(double value);
    void SetBulletStyleName(const OUString& rNewName);
    void SetBulletFlag(sal_Bool bFlag);
    void SetIndent(LwpIndentOverride* pIndentOverride);
    void SetFirstFrib(const OUString& Content,sal_uInt32 FontID);
    OUString GetContentText(sal_Bool bAllText = sal_False);

    void SetParaDropcap(sal_Bool bFlag);
    void SetDropcapLines(sal_uInt16 number);
    void SetDropcapChars(sal_uInt32 chars);
    void SetDropcapLayout(LwpDropcapLayout* pLayout);
    sal_Bool IsHasDropcap();

    XFContentContainer* GetXFContainer();
    void AddXFContent(XFContent* pCont);
    void SetXFContainer(XFContentContainer* pCont);
    void FindLayouts();// for register pagelayout, add by , 02/20/2005
    void RegisterTabStyle(XFParaStyle* pXFParaStyle);

    LwpBulletStyleMgr* GetBulletStyleMgr();
    sal_uInt32 GetOrdinal(){ return m_nOrdinal;}
    sal_Bool operator <(LwpPara& Other);
    sal_Bool ComparePagePosition(LwpVirtualLayout* pPreLayout, LwpVirtualLayout* pNextLayout);

    sal_Bool IsInCell();

    void SetAllText(const OUString& sText);
    OUString GetStyleName(){return m_StyleName;}

protected:
    sal_uInt32  m_nOrdinal; // Ordinal number of this paragraph
    LwpObjectID m_ParaStyle;    // handle of paragraph style
    LwpPoint        m_Hint;     // Paragraph hint - width & height
    LwpObjectID m_Story;        // Story the paragraph is part of

    sal_uInt16  m_nFlags;
    sal_uInt16  m_nLevel;
    LwpFribPtr  m_Fribs;
    LwpParaProperty*  m_pProps;
    //LwpForked3NotifyList* m_NotifyList;   //not saved

    OUString m_StyleName;
    OUString m_ParentStyleName;//Add to support toc
    LwpBreaksOverride* m_pBreaks;
    OUString m_AftPageBreakName;
    OUString m_BefPageBreakName;
    OUString m_AftColumnBreakName;

    OUString m_BefColumnBreakName;
    LwpIndentOverride* m_pIndentOverride;
    OUString m_Content;//for silver bullet,get text of first frib, add by  2/1
    sal_uInt32 m_FontID;//for silver bullet
    OUString m_AllText;//get all text in this paragraph

    sal_Bool m_bHasBullet;
    LwpObjectID m_aSilverBulletID;
    LwpSilverBullet* m_pSilverBullet;
    LwpBulletOverride* m_pBullOver;
    boost::scoped_ptr<LwpNumberingOverride> m_pParaNumbering;
    OUString m_aBulletStyleName;
    sal_Bool m_bBullContinue;
    //end add

    OUString m_SectionStyleName;
    sal_Bool m_bHasDropcap;
    sal_uInt16 m_nLines;
    sal_uInt32 m_nChars;
    LwpDropcapLayout* m_pDropcapLayout;
    double m_BelowSpacing;

    XFContentContainer* m_pXFContainer; //Current container for VO_PARA

    OUString m_TabStyleName;
    enum
    {
        /* bit definitions for the paragraph object flags */
        DEMAND_LOAD     = 0x0001,   // need to demand load this para
        DATA_DIRTY      = 0x0002,   // paragraph data is dirty
        SPELLSTARTOVER  = 0x0004,   // need to recheck paragraph
        SPELLDIRTY      = 0x0008,   // has misspelled word in para
        SPELLCHECKING   = 0x0010,   // started checking paragraph
        READING         = 0x0020,   // We're loading this para from disk
        DISKCHANGED     = 0x0040,   // Read size different from write size
        USEFLOWBREAKS   = 0x0080,   // Use line breaks provided by filter
        VALID_LEVEL     = 0x0100,   // cLevel is valid
        NOUSECOUNT      = 0x0200,   // Don't change the style's use count
        CHANGED         = 0x0400,   // This para has been edited
        SPREADBULLET    = 0x0800,   // Para's bullet is in edit-on-page mode
        NEWBULLET       = 0x1000,   // Bullets should have new font behavior

        // Don't write these flags out to disk
        NOWRITEFLAGS    = (READING | DISKCHANGED | CHANGED),

        MAX_INDENT_LEVELS   = 10
    };
private:
    void OverrideAlignment(LwpAlignmentOverride* base,LwpAlignmentOverride* over,XFParaStyle* pOverStyle);//add by  1-24
    void OverrideIndent(LwpIndentOverride* base,LwpIndentOverride* over,XFParaStyle* pOverStyle);
    void OverrideSpacing(LwpSpacingOverride* base,LwpSpacingOverride* over,XFParaStyle* pOverStyle);
    void OverrideParaBorder(LwpParaProperty* pProps, XFParaStyle* pOverStyle);
    void OverrideParaBreaks(LwpParaProperty* pProps, XFParaStyle* pOverStyle);

    void OverrideParaBullet(LwpParaProperty* pProps);
    void OverrideParaNumbering(LwpParaProperty* pProps);

    sal_Bool RegisterMasterPage(XFParaStyle* pBaseStyle);
    void RegisterNewSectionStyle(LwpPageLayout* pLayout);

    void ParseDropcapContent();
    XFContentContainer* AddBulletList(XFContentContainer* pCont);
    void AddBreakAfter(XFContentContainer* pCont);
    void AddBreakBefore(XFContentContainer* pCont);
    XFSection* CreateXFSection();
};

inline LwpSilverBullet* LwpPara::GetSilverBullet()
{
    return m_pSilverBullet;
}
inline LwpObjectID LwpPara::GetSilverBulletID()
{
    return m_aSilverBulletID;
}
inline OUString LwpPara::GetBulletChar() const
{
    return m_Content;
}
inline sal_uInt32 LwpPara::GetBulletFontID() const
{
    return m_FontID;
}
inline sal_uInt16 LwpPara::GetLevel() const
{
    return m_nLevel;
}
inline void LwpPara::SetBulletStyleName(const OUString& rNewName)
{
    m_aBulletStyleName = rNewName;
}
inline void LwpPara::SetBulletFlag(sal_Bool bFlag)
{
    m_bHasBullet = bFlag;
}
inline sal_Bool LwpPara::GetBulletFlag() const
{
    return m_bHasBullet;
}
inline LwpFribPtr* LwpPara::GetFribs()
{
    return &m_Fribs;
}
inline LwpBreaksOverride* LwpPara::GetBreaks()
{
    return m_pBreaks;
}
inline XFContentContainer* LwpPara::GetXFContainer()
{
    return m_pXFContainer;
}
inline OUString LwpPara::GetBulletStyleName() const
{
    return m_aBulletStyleName;
}
inline void LwpPara::AddXFContent(XFContent* pCont)
{
    m_pXFContainer->Add(pCont);
}
inline void LwpPara::SetXFContainer(XFContentContainer* pCont)
{
    m_pXFContainer = pCont;
}
inline LwpIndentOverride* LwpPara::GetIndent()
{
    return m_pIndentOverride;
}
inline void LwpPara::SetIndent(LwpIndentOverride* pIndentOverride)
{
    if (m_pIndentOverride)
        delete m_pIndentOverride;
    m_pIndentOverride = pIndentOverride;
}
inline LwpObjectID* LwpPara::GetStoryID()
{
    return &m_Story;
}
inline LwpStory* LwpPara::GetStory()
{
    if (m_Story.obj())
        return dynamic_cast<LwpStory*>(m_Story.obj());
    return NULL;
}

inline sal_Bool LwpPara::IsHasDropcap()
{
    return m_bHasDropcap;
}
inline void LwpPara::SetParaDropcap(sal_Bool bFlag)
{
    m_bHasDropcap = bFlag;
}
inline void LwpPara::SetDropcapLines(sal_uInt16 number)
{
    m_nLines = number;
}
inline void LwpPara::SetDropcapChars(sal_uInt32 chars)
{
    m_nChars = chars;
}
inline void LwpPara::SetDropcapLayout(LwpDropcapLayout* pLayout)
{
    m_pDropcapLayout = pLayout;
}
inline double LwpPara::GetBelowSpacing()
{
    return m_BelowSpacing;
}
inline void LwpPara::SetBelowSpacing(double value)
{
    m_BelowSpacing = value;
}
#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */