LibreOffice Module lotuswordpro (master) 1
lwpoverride.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 * For LWP filter architecture prototype
59 ************************************************************************/
60
61#ifndef INCLUDED_LOTUSWORDPRO_INC_LWPOVERRIDE_HXX
62#define INCLUDED_LOTUSWORDPRO_INC_LWPOVERRIDE_HXX
63
64#include "lwpobjid.hxx"
65#include "lwptools.hxx"
66#include <o3tl/safeint.hxx>
67#include <memory>
68
69class LwpObjectStream;
70
72{
75 STATE_STYLE = 2
76};
77
79{
80public:
82
83 virtual ~LwpOverride(){}
84
85 virtual LwpOverride* clone() const = 0;
86
87 virtual void Read(LwpObjectStream* pStrm) = 0;
88
89 void ReadCommon(LwpObjectStream* pStrm);
90
91 void Clear();
92
93 void Override(sal_uInt16 nBits, STATE eState);
94
95protected:
96 explicit LwpOverride(LwpOverride const& rOther);
97
98private:
99 LwpOverride& operator=(LwpOverride const& rOther) = delete;
100
101protected:
102 sal_uInt16 m_nValues;
103 sal_uInt16 m_nOverride;
104 sal_uInt16 m_nApply;
105};
106
108{
109public:
111
112 virtual LwpTextLanguageOverride* clone() const override;
113
114 void Read(LwpObjectStream* pStrm) override;
115
116private:
119
120 sal_uInt16 m_nLanguage;
121};
122
124{
125public:
127
128 virtual LwpTextAttributeOverride* clone() const override;
129
130 void Read(LwpObjectStream* pStrm) override;
131
132 inline sal_uInt16 GetHideLevels() const;
133
134 bool IsHighlight() const;
135
136private:
139
140 enum{
142 };
143 sal_uInt16 m_nHideLevels;
145};
146
148{
149 return m_nHideLevels;
150}
151
153{
154public:
156
157 virtual LwpKinsokuOptsOverride* clone() const override;
158
159 void Read(LwpObjectStream* pStrm) override;
160
161private:
164
165 sal_uInt16 m_nLevels;
166};
167
168class LwpBulletOverride final : public LwpOverride
169{
170public:
172
173 virtual LwpBulletOverride* clone() const override;
174
175 void Read(LwpObjectStream* pStrm) override;
176
177 inline const LwpObjectID& GetSilverBullet() const;
178
179 void Override(LwpBulletOverride* pOther);
180
181 inline bool IsSilverBulletOverridden() const;
182 inline bool IsSkipOverridden() const;
183 inline bool IsRightAlignedOverridden() const;
184 inline bool IsSkip() const;
185 inline bool IsRightAligned() const;
186 inline bool IsEditable() const;
187
189 void OverrideSkip(bool bOver);
190 void OverrideRightAligned(bool bOver);
191
192 inline void RevertSilverBullet();
193 inline void RevertSkip();
194 inline void RevertRightAligned();
195
196 bool IsInValid() const {return m_bIsNull;}
197
198private:
201
202 enum
203 {
205 // 0x02 is free
208 BO_SKIP = 0x10
209 };
210
213};
214
216{
217 return m_SilverBullet;
218}
219
221{
222 return ((m_nOverride & BO_SILVERBULLET) != 0);
223}
224
226{
227 return ((m_nOverride & BO_SKIP) != 0);
228}
229
231{
232 return ((m_nOverride & BO_RIGHTALIGN) != 0);
233}
234
235inline bool LwpBulletOverride::IsSkip() const
236{
237 return ((m_nValues & BO_SKIP) != 0);
238}
239
241{
242 return ((m_nValues & BO_EDITABLE) != 0);
243}
244
246{
247 return ((m_nValues & BO_RIGHTALIGN) != 0);
248}
249
251{
253}
254
256{
258}
259
261{
263}
264
266{
267public:
269
270 virtual LwpAlignmentOverride* clone() const override;
271
272 void Read(LwpObjectStream* pStrm) override;
273
275 {
283 ALIGN_SQUEEZE = 7
284 };
285
287 void Override(LwpAlignmentOverride* other);
289
290private:
293
294 enum
295 {
296 AO_TYPE = 0x01,
298 AO_CHAR = 0x04
299 };
300
302 sal_uInt32 m_nPosition;
303 sal_uInt16 m_nAlignChar;
304};
305
307{
308public:
310
311 virtual LwpSpacingCommonOverride* clone() const override;
312
313 void Read(LwpObjectStream* pStrm) override;
314
316 {
320 SPACING_NONE = 3
321 };
322
324 sal_Int32 GetAmount() const {return m_nAmount;}
325 sal_Int32 GetMultiple() const {return m_nMultiple;}
326
328 void OverrideType(SpacingType val);
329 void OverrideAmount(sal_Int32 val);
330 void OverrideMultiple(sal_Int32 val);
331
332private:
335
336 enum
337 {
338 SPO_TYPE = 0x01,
340 SPO_MULTIPLE= 0x04
341 };
343 sal_Int32 m_nAmount;
344 sal_Int32 m_nMultiple;
345};
346
347class LwpSpacingOverride final : public LwpOverride
348{
349public:
351 virtual ~LwpSpacingOverride() override;
352
353 virtual LwpSpacingOverride* clone() const override;
354
355 void Read(LwpObjectStream* pStrm) override;
356
357 void Override(LwpSpacingOverride* other);
358
363
364private:
367
368 std::unique_ptr<LwpSpacingCommonOverride> m_pSpacing;
369 std::unique_ptr<LwpSpacingCommonOverride> m_pAboveLineSpacing;
370 std::unique_ptr<LwpSpacingCommonOverride> m_pParaSpacingAbove;
371 std::unique_ptr<LwpSpacingCommonOverride> m_pParaSpacingBelow;
372};
373
374class LwpIndentOverride final : public LwpOverride
375{
376public:
378
379 virtual LwpIndentOverride* clone() const override;
380
381 void Read(LwpObjectStream* pStrm) override;
382
383 enum
384 {
386 };
387
388 inline double GetFirst() const;
389 inline double GetLeft() const;
390 inline double GetRight() const;
391
392 sal_uInt16 GetRelative() const;
393 bool IsUseRelative() const;
394 void Override(LwpIndentOverride* other);
395 void OverrideIndentAll(sal_Int32 val);
396 void OverrideIndentFirst(sal_Int32 val);
397 void OverrideIndentRight(sal_Int32 val);
398 void OverrideIndentRest(sal_Int32 val);
399 void OverrideUseRelative(bool use);
400 void OverrideRelative(sal_uInt16 relative);
401 sal_Int32 GetMAll() const {return m_nAll;}
402 sal_Int32 GetMFirst() const {return m_nFirst;}
403 sal_Int32 GetMRest() const {return m_nRest;}
404 sal_Int32 GetMRight() const {return m_nRight;}
405 void SetMAll(sal_Int32 val){m_nAll=val;}
406 void SetMFirst(sal_Int32 val){m_nFirst=val;}
407 void SetMRest(sal_Int32 val){m_nRest=val;}
408 void SetMRight(sal_Int32 val){m_nRight=val;}
409
410private:
413
414 enum
415 {
416 IO_ALL = 0x0001,
417 IO_FIRST = 0x0002,
418 IO_REST = 0x0004,
419 IO_RIGHT = 0x0008,
420 IO_HANGING = 0x0010,
421 IO_EQUAL = 0x0020,
422 IO_BODY = 0x0040,
423 IO_REL_ALL = 0x0080,
424 IO_REL_FIRST = 0x0100,
425 IO_REL_REST = 0x0200,
427 IO_USE_RELATIVE = 0x0400
428 };
429
430 sal_Int32 m_nAll;
431 sal_Int32 m_nFirst;
432 sal_Int32 m_nRest;
433 sal_Int32 m_nRight;
434};
435
436inline double LwpIndentOverride::GetFirst() const
437{
438 sal_Int32 nRes;
440 throw std::range_error("bad len");
442}
443inline double LwpIndentOverride::GetLeft() const
444{
445 sal_Int32 nRes;
446 if (o3tl::checked_add(m_nAll, m_nRest, nRes))
447 throw std::range_error("bad len");
449}
450inline double LwpIndentOverride::GetRight() const
451{
453}
454
456class LwpAmikakeOverride final : public LwpOverride
457{
458public:
460
461 virtual ~LwpAmikakeOverride() override;
462
463 virtual LwpAmikakeOverride* clone() const override;
464
465 void Read(LwpObjectStream* pStrm) override;
466 enum
467 {
471 };
472
473private:
476
477 std::unique_ptr<LwpBackgroundStuff> m_pBackgroundStuff;
478 sal_uInt16 m_nType;
479};
480
481#endif
482
483/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void OverrideAlignment(AlignType val)
LwpAlignmentOverride & operator=(LwpAlignmentOverride const &rOther)=delete
void Override(LwpAlignmentOverride *other)
virtual LwpAlignmentOverride * clone() const override
void Read(LwpObjectStream *pStrm) override
AlignType GetAlignType() const
virtual LwpAmikakeOverride * clone() const override
virtual ~LwpAmikakeOverride() override
LwpAmikakeOverride & operator=(LwpAmikakeOverride const &rOther)=delete
void Read(LwpObjectStream *pStrm) override
std::unique_ptr< LwpBackgroundStuff > m_pBackgroundStuff
virtual LwpBulletOverride * clone() const override
bool IsRightAlignedOverridden() const
LwpObjectID m_SilverBullet
void OverrideSkip(bool bOver)
LwpBulletOverride & operator=(LwpBulletOverride const &rOther)=delete
bool IsSilverBulletOverridden() const
const LwpObjectID & GetSilverBullet() const
bool IsInValid() const
void OverrideSilverBullet(LwpObjectID aID)
bool IsSkipOverridden() const
void Read(LwpObjectStream *pStrm) override
bool IsEditable() const
bool IsRightAligned() const
void OverrideRightAligned(bool bOver)
void Override(LwpBulletOverride *pOther)
bool IsSkip() const
double GetFirst() const
void Override(LwpIndentOverride *other)
void SetMAll(sal_Int32 val)
sal_Int32 GetMFirst() const
void OverrideUseRelative(bool use)
virtual LwpIndentOverride * clone() const override
void OverrideIndentFirst(sal_Int32 val)
void OverrideIndentRight(sal_Int32 val)
LwpIndentOverride & operator=(LwpIndentOverride const &rOther)=delete
sal_Int32 GetMAll() const
void OverrideIndentAll(sal_Int32 val)
bool IsUseRelative() const
sal_Int32 GetMRight() const
void SetMRest(sal_Int32 val)
double GetLeft() const
double GetRight() const
void SetMRight(sal_Int32 val)
sal_uInt16 GetRelative() const
void Read(LwpObjectStream *pStrm) override
void OverrideRelative(sal_uInt16 relative)
void SetMFirst(sal_Int32 val)
void OverrideIndentRest(sal_Int32 val)
sal_Int32 GetMRest() const
virtual LwpKinsokuOptsOverride * clone() const override
LwpKinsokuOptsOverride & operator=(LwpKinsokuOptsOverride const &rOther)=delete
void Read(LwpObjectStream *pStrm) override
object id class
Definition: lwpobjid.hxx:79
stream class for LwpObject body data provide stream like interface to read object data
Definition: lwpobjstrm.hxx:77
void Override(sal_uInt16 nBits, STATE eState)
Definition: lwpoverride.cxx:92
void ReadCommon(LwpObjectStream *pStrm)
Definition: lwpoverride.cxx:77
sal_uInt16 m_nApply
virtual ~LwpOverride()
Definition: lwpoverride.hxx:83
LwpOverride & operator=(LwpOverride const &rOther)=delete
sal_uInt16 m_nValues
void Clear()
Definition: lwpoverride.cxx:85
virtual void Read(LwpObjectStream *pStrm)=0
sal_uInt16 m_nOverride
virtual LwpOverride * clone() const =0
void Override(LwpSpacingCommonOverride *other)
LwpSpacingCommonOverride & operator=(LwpSpacingCommonOverride const &rOther)=delete
SpacingType GetType() const
sal_Int32 GetMultiple() const
sal_Int32 GetAmount() const
void OverrideAmount(sal_Int32 val)
void Read(LwpObjectStream *pStrm) override
void OverrideMultiple(sal_Int32 val)
void OverrideType(SpacingType val)
virtual LwpSpacingCommonOverride * clone() const override
LwpSpacingOverride & operator=(LwpSpacingOverride const &rOther)=delete
void Read(LwpObjectStream *pStrm) override
virtual LwpSpacingOverride * clone() const override
void Override(LwpSpacingOverride *other)
std::unique_ptr< LwpSpacingCommonOverride > m_pAboveLineSpacing
LwpSpacingCommonOverride * GetSpacing()
virtual ~LwpSpacingOverride() override
LwpSpacingCommonOverride * GetAboveLineSpacing()
std::unique_ptr< LwpSpacingCommonOverride > m_pParaSpacingAbove
std::unique_ptr< LwpSpacingCommonOverride > m_pParaSpacingBelow
LwpSpacingCommonOverride * GetAboveSpacing()
LwpSpacingCommonOverride * GetBelowSpacing()
std::unique_ptr< LwpSpacingCommonOverride > m_pSpacing
sal_uInt16 GetHideLevels() const
void Read(LwpObjectStream *pStrm) override
LwpTextAttributeOverride & operator=(LwpTextAttributeOverride const &rOther)=delete
virtual LwpTextAttributeOverride * clone() const override
LwpTextLanguageOverride & operator=(LwpTextLanguageOverride const &rOther)=delete
virtual LwpTextLanguageOverride * clone() const override
void Read(LwpObjectStream *pStrm) override
static double ConvertToMetric(double fInch)
Definition: lwptools.hxx:113
static double ConvertFromUnits(sal_Int32 nUnits)
Definition: lwptools.hxx:109
STATE
Definition: lwpoverride.hxx:72
@ STATE_ON
Definition: lwpoverride.hxx:74
@ STATE_OFF
Definition: lwpoverride.hxx:73
@ STATE_STYLE
Definition: lwpoverride.hxx:75
std::enable_if< std::is_signed< T >::value, bool >::type checked_add(T a, T b, T &result)
std::enable_if< std::is_signed< T >::value, bool >::type checked_sub(T a, T b, T &result)
SpacingType