update dev300-m57
[ooovba.git] / lotuswordpro / source / filter / lwpoverride.hxx
blob61f6f7a1daf3496c9b516bf52089fa7be0c13306
1 /*************************************************************************
3 * The Contents of this file are made available subject to the terms of
4 * either of the following licenses
6 * - GNU Lesser General Public License Version 2.1
7 * - Sun Industry Standards Source License Version 1.1
9 * Sun Microsystems Inc., October, 2000
11 * GNU Lesser General Public License Version 2.1
12 * =============================================
13 * Copyright 2000 by Sun Microsystems, Inc.
14 * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License version 2.1, as published by the Free Software Foundation.
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA
31 * Sun Industry Standards Source License Version 1.1
32 * =================================================
33 * The contents of this file are subject to the Sun Industry Standards
34 * Source License Version 1.1 (the "License"); You may not use this file
35 * except in compliance with the License. You may obtain a copy of the
36 * License at http://www.openoffice.org/license.html.
38 * Software provided under this License is provided on an "AS IS" basis,
39 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
40 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
41 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
42 * See the License for the specific provisions governing your rights and
43 * obligations concerning the Software.
45 * The Initial Developer of the Original Code is: IBM Corporation
47 * Copyright: 2008 by IBM Corporation
49 * All Rights Reserved.
51 * Contributor(s): _______________________________________
54 ************************************************************************/
55 /*************************************************************************
56 * @file
57 * For LWP filter architecture prototype
58 ************************************************************************/
59 /*************************************************************************
60 * Change History
61 Jan 2005 Created
62 ************************************************************************/
64 #ifndef _LWPOVERRIDE_HXX
65 #define _LWPOVERRIDE_HXX
67 #include "lwpobjid.hxx"
68 #include "lwptools.hxx"
70 class LwpObjectStream;
72 enum STATE
74 STATE_OFF = 0,
75 STATE_ON = 1,
76 STATE_STYLE = 2
79 class LwpOverride
81 public:
82 LwpOverride() : m_nValues(0), m_nOverride(0), m_nApply(0) {};
84 virtual ~LwpOverride(){}
86 virtual void Read(LwpObjectStream* pStrm) = 0;
88 virtual void operator=(const LwpOverride& rOther);
90 void ReadCommon(LwpObjectStream* pStrm);
92 void Clear();
94 void Override(sal_uInt16 nBits, STATE eState);
96 protected:
97 sal_uInt16 m_nValues;
98 sal_uInt16 m_nOverride;
99 sal_uInt16 m_nApply;
102 /////////////////////////////////////////////////////////////////
103 class LwpTextLanguageOverride : public LwpOverride
105 public:
106 LwpTextLanguageOverride() : m_nLanguage(0) {};
108 void Read(LwpObjectStream* pStrm);
110 private:
111 sal_uInt16 m_nLanguage;
114 /////////////////////////////////////////////////////////////////
115 class LwpTextAttributeOverride : public LwpOverride
117 public:
118 LwpTextAttributeOverride() : m_nHideLevels(0), m_nBaseLineOffset(0) {};
120 void Read(LwpObjectStream* pStrm);
122 inline sal_uInt16 GetHideLevels() const;
124 sal_Bool IsHighLight();
126 private:
127 enum{
128 TAO_HIGHLIGHT = 0x08,
130 sal_uInt16 m_nHideLevels;
131 sal_uInt32 m_nBaseLineOffset;
134 inline sal_uInt16 LwpTextAttributeOverride::GetHideLevels() const
136 return m_nHideLevels;
138 /////////////////////////////////////////////////////////////////
139 class LwpKinsokuOptsOverride : public LwpOverride
141 public:
142 LwpKinsokuOptsOverride() : m_nLevels(0) {};
144 void Read(LwpObjectStream* pStrm);
146 private:
147 sal_uInt16 m_nLevels;
150 /////////////////////////////////////////////////////////////////
151 class LwpBulletOverride : public LwpOverride
153 public:
154 LwpBulletOverride() {m_bIsNull = sal_True;}
156 void Read(LwpObjectStream* pStrm);
158 inline LwpObjectID GetSilverBullet() const;
160 void operator=(const LwpOverride& rOther);
162 void Override(LwpBulletOverride* pOther);
164 inline sal_Bool IsSilverBulletOverridden();
165 inline sal_Bool IsSkipOverridden();
166 inline sal_Bool IsRightAlignedOverridden();
167 inline sal_Bool IsSkip();
168 inline sal_Bool IsRightAligned();
169 inline sal_Bool IsEditable();
172 void OverrideSilverBullet(LwpObjectID aID);
173 void OverrideSkip(sal_Bool bOver);
174 void OverrideRightAligned(sal_Bool bOver);
176 inline void RevertSilverBullet();
177 inline void RevertSkip();
178 inline void RevertRightAligned();
180 sal_Bool IsInValid(){return m_bIsNull;}
181 private:
182 enum
184 BO_SILVERBULLET = 0x01,
185 // 0x02 is free
186 BO_RIGHTALIGN = 0x04,
187 BO_EDITABLE = 0x08,
188 BO_SKIP = 0x10
191 LwpObjectID m_SilverBullet;
192 sal_Bool m_bIsNull;
194 inline LwpObjectID LwpBulletOverride::GetSilverBullet() const
196 return m_SilverBullet;
199 inline sal_Bool LwpBulletOverride::IsSilverBulletOverridden()
201 return (sal_Bool)((m_nOverride & BO_SILVERBULLET) != 0);
204 inline sal_Bool LwpBulletOverride::IsSkipOverridden()
206 return (sal_Bool)((m_nOverride & BO_SKIP) != 0);
209 inline sal_Bool LwpBulletOverride::IsRightAlignedOverridden()
211 return (sal_Bool)((m_nOverride & BO_RIGHTALIGN) != 0);
214 inline sal_Bool LwpBulletOverride::IsSkip()
216 return (sal_Bool)((m_nValues & BO_SKIP) != 0);
219 inline sal_Bool LwpBulletOverride::IsEditable()
221 return (sal_Bool)((m_nValues & BO_EDITABLE) != 0);
224 inline sal_Bool LwpBulletOverride::IsRightAligned()
226 return (sal_Bool)((m_nValues & BO_RIGHTALIGN) != 0);
229 inline void LwpBulletOverride::RevertSilverBullet()
231 LwpOverride::Override(BO_SILVERBULLET, STATE_STYLE);
234 inline void LwpBulletOverride::RevertSkip()
236 LwpOverride::Override(BO_SKIP, STATE_STYLE);
239 inline void LwpBulletOverride::RevertRightAligned()
241 LwpOverride::Override(BO_RIGHTALIGN, STATE_STYLE);
244 /////////////////////////////////////////////////////////////////
245 class LwpAlignmentOverride : public LwpOverride
247 public:
248 LwpAlignmentOverride() : m_nAlignType(ALIGN_LEFT), m_nPosition(0), m_nAlignChar(0){};
250 void Read(LwpObjectStream* pStrm);
252 enum AlignType
254 ALIGN_LEFT = 0,
255 ALIGN_RIGHT = 1,
256 ALIGN_CENTER = 2,
257 ALIGN_JUSTIFY = 3,
258 ALIGN_JUSTIFYALL = 4,
259 ALIGN_NUMERICLEFT = 5,
260 ALIGN_NUMERICRIGHT = 6,
261 ALIGN_SQUEEZE = 7
264 AlignType GetAlignType(){ return m_nAlignType; }
265 void Override(LwpAlignmentOverride* other);//add by 1-24
266 void OverrideAlignment(AlignType val);//add by 1-24
267 private:
268 enum
270 AO_TYPE = 0x01,
271 AO_POSITION = 0x02,
272 AO_CHAR = 0x04
275 AlignType m_nAlignType;
276 sal_uInt32 m_nPosition;
277 sal_uInt16 m_nAlignChar;
280 /////////////////////////////////////////////////////////////////
281 class LwpSpacingCommonOverride : public LwpOverride
283 public:
284 LwpSpacingCommonOverride() : m_nSpacingType(SPACING_NONE), m_nAmount(0), m_nMultiple(65536){};
286 void Read(LwpObjectStream* pStrm);
288 enum SpacingType
290 SPACING_DYNAMIC = 0,
291 SPACING_LEADING = 1,
292 SPACING_CUSTOM = 2,
293 SPACING_NONE = 3
296 SpacingType GetType() const {return m_nSpacingType;};
297 sal_Int32 GetAmount() const {return m_nAmount;};
298 sal_Int32 GetMultiple() const {return m_nMultiple;};
300 void Override(LwpSpacingCommonOverride* other);
301 void OverrideType(SpacingType val);
302 void OverrideAmount(sal_Int32 val);
303 void OverrideMultiple(sal_Int32 val);
305 protected:
306 enum
308 SPO_TYPE = 0x01,
309 SPO_AMOUNT = 0x02,
310 SPO_MULTIPLE= 0x04
312 SpacingType m_nSpacingType;//sal_uInt16
313 sal_Int32 m_nAmount;
314 sal_Int32 m_nMultiple;
318 /////////////////////////////////////////////////////////////////
319 class LwpSpacingOverride : public LwpOverride
321 public:
322 LwpSpacingOverride();
323 LwpSpacingOverride& operator=(LwpSpacingOverride& other);
324 virtual ~LwpSpacingOverride();
326 void Read(LwpObjectStream* pStrm);
328 void Override(LwpSpacingOverride* other);
330 LwpSpacingCommonOverride* GetSpacing(){return m_pSpacing;};
331 LwpSpacingCommonOverride* GetAboveLineSpacing(){return m_pAboveLineSpacing;};
332 LwpSpacingCommonOverride* GetAboveSpacing(){return m_pParaSpacingAbove;};
333 LwpSpacingCommonOverride* GetBelowSpacing(){return m_pParaSpacingBelow;};
334 private:
335 LwpSpacingCommonOverride* m_pSpacing;
336 LwpSpacingCommonOverride* m_pAboveLineSpacing;
337 LwpSpacingCommonOverride* m_pParaSpacingAbove;
338 LwpSpacingCommonOverride* m_pParaSpacingBelow;
341 /////////////////////////////////////////////////////////////////
342 class LwpIndentOverride : public LwpOverride
344 public:
345 LwpIndentOverride() : m_nAll(0), m_nFirst(0), m_nRest(0), m_nRight(0) {};
346 LwpIndentOverride& operator=(LwpIndentOverride& other);
347 void Read(LwpObjectStream* pStrm);
349 enum
351 RELATIVE_FIRST, RELATIVE_REST, RELATIVE_ALL
354 inline double GetFirst() const;
355 inline double GetLeft() const;
356 inline double GetRight() const;
358 sal_uInt16 GetRelative();
359 sal_Bool IsUseRelative();
360 void Override(LwpIndentOverride* other);
361 void OverrideIndentAll(sal_Int32 val);
362 void OverrideIndentFirst(sal_Int32 val);
363 void OverrideIndentRight(sal_Int32 val);
364 void OverrideIndentRest(sal_Int32 val);
365 void OverrideUseRelative(sal_Bool use);
366 void OverrideRelative(sal_uInt16 relative);
367 sal_Int32 GetMAll() const {return m_nAll;}
368 sal_Int32 GetMFirst() const {return m_nFirst;}
369 sal_Int32 GetMRest() const {return m_nRest;}
370 sal_Int32 GetMRight() const {return m_nRight;}
371 void SetMAll(sal_Int32 val){m_nAll=val;}
372 void SetMFirst(sal_Int32 val){m_nFirst=val;}
373 void SetMRest(sal_Int32 val){m_nRest=val;}
374 void SetMRight(sal_Int32 val){m_nRight=val;}
375 private:
376 enum
378 IO_ALL = 0x0001,
379 IO_FIRST = 0x0002,
380 IO_REST = 0x0004,
381 IO_RIGHT = 0x0008,
382 IO_HANGING = 0x0010,
383 IO_EQUAL = 0x0020,
384 IO_BODY = 0x0040,
385 IO_REL_ALL = 0x0080,
386 IO_REL_FIRST = 0x0100,
387 IO_REL_REST = 0x0200,
388 IO_REL_FLAGS = (IO_REL_ALL | IO_REL_FIRST | IO_REL_REST),
389 #ifdef JAPANESE_ENABLED // 96/4/8 ueda for indentation by char width
390 IO_USE_RELATIVE = 0x0400,
391 IO_CHARUNIT = 0x0800
392 #else
393 IO_USE_RELATIVE = 0x0400
394 #endif
397 sal_Int32 m_nAll;
398 sal_Int32 m_nFirst;
399 sal_Int32 m_nRest;
400 sal_Int32 m_nRight;
402 inline double LwpIndentOverride::GetFirst() const
404 return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(m_nFirst-m_nRest));
406 inline double LwpIndentOverride::GetLeft() const
408 return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(m_nAll+m_nRest));
410 inline double LwpIndentOverride::GetRight() const
412 return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(m_nRight));
415 /////////////////////////////////////////////////////////////////
416 class LwpBackgroundStuff;
417 class LwpAmikakeOverride : public LwpOverride
419 public:
420 LwpAmikakeOverride();
422 virtual ~LwpAmikakeOverride();
424 void Read(LwpObjectStream* pStrm);
425 enum
427 AMIKAKE_NONE = 0,
428 AMIKAKE_BACKGROUND = 1,
429 AMIKAKE_CHARACTER = 2
432 private:
433 LwpBackgroundStuff* m_pBackgroundStuff;
434 sal_uInt16 m_nType;
438 #endif