Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / lotuswordpro / source / filter / lwpoverride.hxx
blob0eac133cf287243935286e7f2357d0e5b32b0ff2
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,
29 * MA 02111-1307 USA
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 /*************************************************************************
57 * @file
58 * For LWP filter architecture prototype
59 ************************************************************************/
61 #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPOVERRIDE_HXX
62 #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_LWPOVERRIDE_HXX
64 #include "lwpobjid.hxx"
65 #include "lwptools.hxx"
67 class LwpObjectStream;
69 enum STATE
71 STATE_OFF = 0,
72 STATE_ON = 1,
73 STATE_STYLE = 2
76 class LwpOverride
78 public:
79 LwpOverride() : m_nValues(0), m_nOverride(0), m_nApply(0) {}
81 virtual ~LwpOverride(){}
83 virtual LwpOverride* clone() const = 0;
85 virtual void Read(LwpObjectStream* pStrm) = 0;
87 void ReadCommon(LwpObjectStream* pStrm);
89 void Clear();
91 void Override(sal_uInt16 nBits, STATE eState);
93 protected:
94 explicit LwpOverride(LwpOverride const& rOther);
96 private:
97 LwpOverride& operator=(LwpOverride const& rOther) = delete;
99 protected:
100 sal_uInt16 m_nValues;
101 sal_uInt16 m_nOverride;
102 sal_uInt16 m_nApply;
105 class LwpTextLanguageOverride : public LwpOverride
107 public:
108 LwpTextLanguageOverride() : m_nLanguage(0) {}
110 virtual LwpTextLanguageOverride* clone() const override;
112 void Read(LwpObjectStream* pStrm) override;
114 protected:
115 LwpTextLanguageOverride(LwpTextLanguageOverride const& rOther);
117 private:
118 LwpTextLanguageOverride& operator=(LwpTextLanguageOverride const& rOther) = delete;
120 private:
121 sal_uInt16 m_nLanguage;
124 class LwpTextAttributeOverride : public LwpOverride
126 public:
127 LwpTextAttributeOverride() : m_nHideLevels(0), m_nBaseLineOffset(0) {}
129 virtual LwpTextAttributeOverride* clone() const override;
131 void Read(LwpObjectStream* pStrm) override;
133 inline sal_uInt16 GetHideLevels() const;
135 bool IsHighlight();
137 protected:
138 LwpTextAttributeOverride(LwpTextAttributeOverride const& rOther);
140 private:
141 LwpTextAttributeOverride& operator=(LwpTextAttributeOverride const& rOther) = delete;
143 private:
144 enum{
145 TAO_HIGHLIGHT = 0x08,
147 sal_uInt16 m_nHideLevels;
148 sal_uInt32 m_nBaseLineOffset;
151 inline sal_uInt16 LwpTextAttributeOverride::GetHideLevels() const
153 return m_nHideLevels;
156 class LwpKinsokuOptsOverride : public LwpOverride
158 public:
159 LwpKinsokuOptsOverride() : m_nLevels(0) {}
161 virtual LwpKinsokuOptsOverride* clone() const override;
163 void Read(LwpObjectStream* pStrm) override;
165 protected:
166 LwpKinsokuOptsOverride(LwpKinsokuOptsOverride const& rOther);
168 private:
169 LwpKinsokuOptsOverride& operator=(LwpKinsokuOptsOverride const& rOther) = delete;
171 private:
172 sal_uInt16 m_nLevels;
175 class LwpBulletOverride : public LwpOverride
177 public:
178 LwpBulletOverride() {m_bIsNull = true;}
180 virtual LwpBulletOverride* clone() const override;
182 void Read(LwpObjectStream* pStrm) override;
184 inline const LwpObjectID& GetSilverBullet() const;
186 void Override(LwpBulletOverride* pOther);
188 inline bool IsSilverBulletOverridden();
189 inline bool IsSkipOverridden();
190 inline bool IsRightAlignedOverridden();
191 inline bool IsSkip();
192 inline bool IsRightAligned();
193 inline bool IsEditable();
195 void OverrideSilverBullet(LwpObjectID aID);
196 void OverrideSkip(bool bOver);
197 void OverrideRightAligned(bool bOver);
199 inline void RevertSilverBullet();
200 inline void RevertSkip();
201 inline void RevertRightAligned();
203 bool IsInValid(){return m_bIsNull;}
205 protected:
206 LwpBulletOverride(LwpBulletOverride const& rOther);
208 private:
209 LwpBulletOverride& operator=(LwpBulletOverride const& rOther) = delete;
211 private:
212 enum
214 BO_SILVERBULLET = 0x01,
215 // 0x02 is free
216 BO_RIGHTALIGN = 0x04,
217 BO_EDITABLE = 0x08,
218 BO_SKIP = 0x10
221 LwpObjectID m_SilverBullet;
222 bool m_bIsNull;
225 inline const LwpObjectID& LwpBulletOverride::GetSilverBullet() const
227 return m_SilverBullet;
230 inline bool LwpBulletOverride::IsSilverBulletOverridden()
232 return ((m_nOverride & BO_SILVERBULLET) != 0);
235 inline bool LwpBulletOverride::IsSkipOverridden()
237 return ((m_nOverride & BO_SKIP) != 0);
240 inline bool LwpBulletOverride::IsRightAlignedOverridden()
242 return ((m_nOverride & BO_RIGHTALIGN) != 0);
245 inline bool LwpBulletOverride::IsSkip()
247 return ((m_nValues & BO_SKIP) != 0);
250 inline bool LwpBulletOverride::IsEditable()
252 return ((m_nValues & BO_EDITABLE) != 0);
255 inline bool LwpBulletOverride::IsRightAligned()
257 return ((m_nValues & BO_RIGHTALIGN) != 0);
260 inline void LwpBulletOverride::RevertSilverBullet()
262 LwpOverride::Override(BO_SILVERBULLET, STATE_STYLE);
265 inline void LwpBulletOverride::RevertSkip()
267 LwpOverride::Override(BO_SKIP, STATE_STYLE);
270 inline void LwpBulletOverride::RevertRightAligned()
272 LwpOverride::Override(BO_RIGHTALIGN, STATE_STYLE);
275 class LwpAlignmentOverride : public LwpOverride
277 public:
278 LwpAlignmentOverride() : m_nAlignType(ALIGN_LEFT), m_nPosition(0), m_nAlignChar(0){}
280 virtual LwpAlignmentOverride* clone() const override;
282 void Read(LwpObjectStream* pStrm) override;
284 enum AlignType
286 ALIGN_LEFT = 0,
287 ALIGN_RIGHT = 1,
288 ALIGN_CENTER = 2,
289 ALIGN_JUSTIFY = 3,
290 ALIGN_JUSTIFYALL = 4,
291 ALIGN_NUMERICLEFT = 5,
292 ALIGN_NUMERICRIGHT = 6,
293 ALIGN_SQUEEZE = 7
296 AlignType GetAlignType(){ return m_nAlignType; }
297 void Override(LwpAlignmentOverride* other);
298 void OverrideAlignment(AlignType val);
300 protected:
301 LwpAlignmentOverride(LwpAlignmentOverride const& rOther);
303 private:
304 LwpAlignmentOverride& operator=(LwpAlignmentOverride const& rOther) = delete;
306 private:
307 enum
309 AO_TYPE = 0x01,
310 AO_POSITION = 0x02,
311 AO_CHAR = 0x04
314 AlignType m_nAlignType;
315 sal_uInt32 m_nPosition;
316 sal_uInt16 m_nAlignChar;
319 class LwpSpacingCommonOverride : public LwpOverride
321 public:
322 LwpSpacingCommonOverride() : m_nSpacingType(SPACING_NONE), m_nAmount(0), m_nMultiple(65536){}
324 virtual LwpSpacingCommonOverride* clone() const override;
326 void Read(LwpObjectStream* pStrm) override;
328 enum SpacingType
330 SPACING_DYNAMIC = 0,
331 SPACING_LEADING = 1,
332 SPACING_CUSTOM = 2,
333 SPACING_NONE = 3
336 SpacingType GetType() const {return m_nSpacingType;}
337 sal_Int32 GetAmount() const {return m_nAmount;}
338 sal_Int32 GetMultiple() const {return m_nMultiple;}
340 void Override(LwpSpacingCommonOverride* other);
341 void OverrideType(SpacingType val);
342 void OverrideAmount(sal_Int32 val);
343 void OverrideMultiple(sal_Int32 val);
345 protected:
346 LwpSpacingCommonOverride(LwpSpacingCommonOverride const& rOther);
348 private:
349 LwpSpacingCommonOverride& operator=(LwpSpacingCommonOverride const& rOther) = delete;
351 protected:
352 enum
354 SPO_TYPE = 0x01,
355 SPO_AMOUNT = 0x02,
356 SPO_MULTIPLE= 0x04
358 SpacingType m_nSpacingType;//sal_uInt16
359 sal_Int32 m_nAmount;
360 sal_Int32 m_nMultiple;
363 class LwpSpacingOverride : public LwpOverride
365 public:
366 LwpSpacingOverride();
367 virtual ~LwpSpacingOverride();
369 virtual LwpSpacingOverride* clone() const override;
371 void Read(LwpObjectStream* pStrm) override;
373 void Override(LwpSpacingOverride* other);
375 LwpSpacingCommonOverride* GetSpacing(){return m_pSpacing;}
376 LwpSpacingCommonOverride* GetAboveLineSpacing(){return m_pAboveLineSpacing;}
377 LwpSpacingCommonOverride* GetAboveSpacing(){return m_pParaSpacingAbove;}
378 LwpSpacingCommonOverride* GetBelowSpacing(){return m_pParaSpacingBelow;}
380 protected:
381 LwpSpacingOverride(LwpSpacingOverride const& rOther);
383 private:
384 LwpSpacingOverride& operator=(LwpSpacingOverride const& rOther) = delete;
386 private:
387 LwpSpacingCommonOverride* m_pSpacing;
388 LwpSpacingCommonOverride* m_pAboveLineSpacing;
389 LwpSpacingCommonOverride* m_pParaSpacingAbove;
390 LwpSpacingCommonOverride* m_pParaSpacingBelow;
393 class LwpIndentOverride : public LwpOverride
395 public:
396 LwpIndentOverride() : m_nAll(0), m_nFirst(0), m_nRest(0), m_nRight(0) {}
398 virtual LwpIndentOverride* clone() const override;
400 void Read(LwpObjectStream* pStrm) override;
402 enum
404 RELATIVE_FIRST, RELATIVE_REST, RELATIVE_ALL
407 inline double GetFirst() const;
408 inline double GetLeft() const;
409 inline double GetRight() const;
411 sal_uInt16 GetRelative();
412 bool IsUseRelative();
413 void Override(LwpIndentOverride* other);
414 void OverrideIndentAll(sal_Int32 val);
415 void OverrideIndentFirst(sal_Int32 val);
416 void OverrideIndentRight(sal_Int32 val);
417 void OverrideIndentRest(sal_Int32 val);
418 void OverrideUseRelative(bool use);
419 void OverrideRelative(sal_uInt16 relative);
420 sal_Int32 GetMAll() const {return m_nAll;}
421 sal_Int32 GetMFirst() const {return m_nFirst;}
422 sal_Int32 GetMRest() const {return m_nRest;}
423 sal_Int32 GetMRight() const {return m_nRight;}
424 void SetMAll(sal_Int32 val){m_nAll=val;}
425 void SetMFirst(sal_Int32 val){m_nFirst=val;}
426 void SetMRest(sal_Int32 val){m_nRest=val;}
427 void SetMRight(sal_Int32 val){m_nRight=val;}
429 protected:
430 LwpIndentOverride(LwpIndentOverride const& rOther);
432 private:
433 LwpIndentOverride& operator=(LwpIndentOverride const& rOther) = delete;
435 private:
436 enum
438 IO_ALL = 0x0001,
439 IO_FIRST = 0x0002,
440 IO_REST = 0x0004,
441 IO_RIGHT = 0x0008,
442 IO_HANGING = 0x0010,
443 IO_EQUAL = 0x0020,
444 IO_BODY = 0x0040,
445 IO_REL_ALL = 0x0080,
446 IO_REL_FIRST = 0x0100,
447 IO_REL_REST = 0x0200,
448 IO_REL_FLAGS = (IO_REL_ALL | IO_REL_FIRST | IO_REL_REST),
449 IO_USE_RELATIVE = 0x0400
452 sal_Int32 m_nAll;
453 sal_Int32 m_nFirst;
454 sal_Int32 m_nRest;
455 sal_Int32 m_nRight;
458 inline double LwpIndentOverride::GetFirst() const
460 return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(m_nFirst-m_nRest));
462 inline double LwpIndentOverride::GetLeft() const
464 return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(m_nAll+m_nRest));
466 inline double LwpIndentOverride::GetRight() const
468 return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(m_nRight));
471 class LwpBackgroundStuff;
472 class LwpAmikakeOverride : public LwpOverride
474 public:
475 LwpAmikakeOverride();
477 virtual ~LwpAmikakeOverride();
479 virtual LwpAmikakeOverride* clone() const override;
481 void Read(LwpObjectStream* pStrm) override;
482 enum
484 AMIKAKE_NONE = 0,
485 AMIKAKE_BACKGROUND = 1,
486 AMIKAKE_CHARACTER = 2
489 protected:
490 LwpAmikakeOverride(LwpAmikakeOverride const& rOther);
492 private:
493 LwpAmikakeOverride& operator=(LwpAmikakeOverride const& rOther) = delete;
495 private:
496 LwpBackgroundStuff* m_pBackgroundStuff;
497 sal_uInt16 m_nType;
501 #endif
503 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */