LCOV - code coverage report
Current view: top level - libreoffice/lotuswordpro/source/filter - lwpoverride.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 46 64 71.9 %
Date: 2012-12-27 Functions: 44 55 80.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             :  * Change History
      62             :  Jan 2005           Created
      63             :  ************************************************************************/
      64             : 
      65             : #ifndef _LWPOVERRIDE_HXX
      66             : #define _LWPOVERRIDE_HXX
      67             : 
      68             : #include "lwpobjid.hxx"
      69             : #include "lwptools.hxx"
      70             : 
      71             : class LwpObjectStream;
      72             : 
      73             : enum STATE
      74             : {
      75             :     STATE_OFF   = 0,
      76             :     STATE_ON    = 1,
      77             :     STATE_STYLE = 2
      78             : };
      79             : 
      80             : class LwpOverride
      81             : {
      82             : public:
      83        2257 :     LwpOverride() : m_nValues(0), m_nOverride(0), m_nApply(0) {}
      84             : 
      85        4022 :     virtual ~LwpOverride(){}
      86             : 
      87             :     virtual LwpOverride* clone() const = 0;
      88             : 
      89             :     virtual void Read(LwpObjectStream* pStrm) = 0;
      90             : 
      91             :     void ReadCommon(LwpObjectStream* pStrm);
      92             : 
      93             :     void Clear();
      94             : 
      95             :     void Override(sal_uInt16 nBits, STATE eState);
      96             : 
      97             : protected:
      98             :     LwpOverride(LwpOverride const& rOther);
      99             : 
     100             : private:
     101             :     LwpOverride& operator=(LwpOverride const& rOther); // not implemented
     102             : 
     103             : protected:
     104             :     sal_uInt16  m_nValues;
     105             :     sal_uInt16  m_nOverride;
     106             :     sal_uInt16  m_nApply;
     107             : };
     108             : 
     109             : /////////////////////////////////////////////////////////////////
     110         719 : class LwpTextLanguageOverride : public LwpOverride
     111             : {
     112             : public:
     113         651 :     LwpTextLanguageOverride() : m_nLanguage(0) {}
     114             : 
     115             :     virtual LwpTextLanguageOverride* clone() const;
     116             : 
     117             :     void Read(LwpObjectStream* pStrm);
     118             : 
     119             : protected:
     120             :     LwpTextLanguageOverride(LwpTextLanguageOverride const& rOther);
     121             : 
     122             : private:
     123             :     LwpTextLanguageOverride& operator=(LwpTextLanguageOverride const& rOther); // not implemented
     124             : 
     125             : private:
     126             :     sal_uInt16  m_nLanguage;
     127             : };
     128             : 
     129             : /////////////////////////////////////////////////////////////////
     130         719 : class LwpTextAttributeOverride : public LwpOverride
     131             : {
     132             : public:
     133         651 :     LwpTextAttributeOverride() : m_nHideLevels(0), m_nBaseLineOffset(0) {}
     134             : 
     135             :     virtual LwpTextAttributeOverride* clone() const;
     136             : 
     137             :     void Read(LwpObjectStream* pStrm);
     138             : 
     139             :     inline sal_uInt16 GetHideLevels() const;
     140             : 
     141             :     sal_Bool IsHighLight();
     142             : 
     143             : protected:
     144             :     LwpTextAttributeOverride(LwpTextAttributeOverride const& rOther);
     145             : 
     146             : private:
     147             :     LwpTextAttributeOverride& operator=(LwpTextAttributeOverride const& rOther); // not implemented
     148             : 
     149             : private:
     150             :     enum{
     151             :     TAO_HIGHLIGHT = 0x08,
     152             :     };
     153             :     sal_uInt16  m_nHideLevels;
     154             :     sal_uInt32  m_nBaseLineOffset;
     155             : };
     156             : 
     157         729 : inline sal_uInt16 LwpTextAttributeOverride::GetHideLevels() const
     158             : {
     159         729 :     return m_nHideLevels;
     160             : }
     161             : /////////////////////////////////////////////////////////////////
     162         136 : class LwpKinsokuOptsOverride : public LwpOverride
     163             : {
     164             : public:
     165          68 :     LwpKinsokuOptsOverride() : m_nLevels(0) {}
     166             : 
     167             :     virtual LwpKinsokuOptsOverride* clone() const;
     168             : 
     169             :     void Read(LwpObjectStream* pStrm);
     170             : 
     171             : protected:
     172             :     LwpKinsokuOptsOverride(LwpKinsokuOptsOverride const& rOther);
     173             : 
     174             : private:
     175             :     LwpKinsokuOptsOverride& operator=(LwpKinsokuOptsOverride const& rOther); // not implemented
     176             : 
     177             : private:
     178             :     sal_uInt16  m_nLevels;
     179             : };
     180             : 
     181             : /////////////////////////////////////////////////////////////////
     182         688 : class LwpBulletOverride : public LwpOverride
     183             : {
     184             : public:
     185          76 :     LwpBulletOverride() {m_bIsNull = sal_True;}
     186             : 
     187             :     virtual LwpBulletOverride* clone() const;
     188             : 
     189             :     void Read(LwpObjectStream* pStrm);
     190             : 
     191             :     inline LwpObjectID GetSilverBullet() const;
     192             : 
     193             :     void Override(LwpBulletOverride* pOther);
     194             : 
     195             :     inline sal_Bool IsSilverBulletOverridden();
     196             :     inline sal_Bool IsSkipOverridden();
     197             :     inline sal_Bool IsRightAlignedOverridden();
     198             :     inline sal_Bool IsSkip();
     199             :     inline sal_Bool IsRightAligned();
     200             :     inline sal_Bool IsEditable();
     201             : 
     202             : 
     203             :     void OverrideSilverBullet(LwpObjectID aID);
     204             :     void OverrideSkip(sal_Bool bOver);
     205             :     void OverrideRightAligned(sal_Bool bOver);
     206             : 
     207             :     inline void RevertSilverBullet();
     208             :     inline void RevertSkip();
     209             :     inline void RevertRightAligned();
     210             : 
     211          49 :     sal_Bool IsInValid(){return m_bIsNull;}
     212             : 
     213             : protected:
     214             :     LwpBulletOverride(LwpBulletOverride const& rOther);
     215             : 
     216             : private:
     217             :     LwpBulletOverride& operator=(LwpBulletOverride const& rOther); // not implemented
     218             : 
     219             : private:
     220             :     enum
     221             :     {
     222             :         BO_SILVERBULLET = 0x01,
     223             :         // 0x02 is free
     224             :         BO_RIGHTALIGN   = 0x04,
     225             :         BO_EDITABLE     = 0x08,
     226             :         BO_SKIP         = 0x10
     227             :     };
     228             : 
     229             :     LwpObjectID m_SilverBullet;
     230             :     sal_Bool m_bIsNull;
     231             : };
     232             : 
     233         269 : inline LwpObjectID LwpBulletOverride::GetSilverBullet() const
     234             : {
     235         269 :     return m_SilverBullet;
     236             : }
     237             : 
     238           4 : inline sal_Bool LwpBulletOverride::IsSilverBulletOverridden()
     239             : {
     240           4 :     return (sal_Bool)((m_nOverride & BO_SILVERBULLET) != 0);
     241             : }
     242             : 
     243           0 : inline sal_Bool LwpBulletOverride::IsSkipOverridden()
     244             : {
     245           0 :     return (sal_Bool)((m_nOverride & BO_SKIP) != 0);
     246             : }
     247             : 
     248           0 : inline sal_Bool LwpBulletOverride::IsRightAlignedOverridden()
     249             : {
     250           0 :     return (sal_Bool)((m_nOverride & BO_RIGHTALIGN) != 0);
     251             : }
     252             : 
     253          17 : inline sal_Bool LwpBulletOverride::IsSkip()
     254             : {
     255          17 :     return (sal_Bool)((m_nValues & BO_SKIP) != 0);
     256             : }
     257             : 
     258           2 : inline sal_Bool LwpBulletOverride::IsEditable()
     259             : {
     260           2 :     return (sal_Bool)((m_nValues & BO_EDITABLE) != 0);
     261             : }
     262             : 
     263           3 : inline sal_Bool LwpBulletOverride::IsRightAligned()
     264             : {
     265           3 :     return (sal_Bool)((m_nValues & BO_RIGHTALIGN) != 0);
     266             : }
     267             : 
     268           0 : inline void LwpBulletOverride::RevertSilverBullet()
     269             : {
     270           0 :     LwpOverride::Override(BO_SILVERBULLET, STATE_STYLE);
     271           0 : }
     272             : 
     273           0 : inline void LwpBulletOverride::RevertSkip()
     274             : {
     275           0 :     LwpOverride::Override(BO_SKIP, STATE_STYLE);
     276           0 : }
     277             : 
     278           0 : inline void LwpBulletOverride::RevertRightAligned()
     279             : {
     280           0 :     LwpOverride::Override(BO_RIGHTALIGN, STATE_STYLE);
     281           0 : }
     282             : 
     283             : /////////////////////////////////////////////////////////////////
     284          42 : class LwpAlignmentOverride : public LwpOverride
     285             : {
     286             : public:
     287          17 :     LwpAlignmentOverride() : m_nAlignType(ALIGN_LEFT), m_nPosition(0), m_nAlignChar(0){}
     288             : 
     289             :     virtual LwpAlignmentOverride* clone() const;
     290             : 
     291             :     void Read(LwpObjectStream* pStrm);
     292             : 
     293             :     enum AlignType
     294             :     {
     295             :         ALIGN_LEFT          = 0,
     296             :         ALIGN_RIGHT         = 1,
     297             :         ALIGN_CENTER        = 2,
     298             :         ALIGN_JUSTIFY       = 3,
     299             :         ALIGN_JUSTIFYALL    = 4,
     300             :         ALIGN_NUMERICLEFT   = 5,
     301             :         ALIGN_NUMERICRIGHT  = 6,
     302             :         ALIGN_SQUEEZE       = 7
     303             :     };
     304             : 
     305          24 :     AlignType GetAlignType(){ return m_nAlignType; }
     306             :     void Override(LwpAlignmentOverride* other);//add by  1-24
     307             :     void OverrideAlignment(AlignType val);//add by  1-24
     308             : 
     309             : protected:
     310             :     LwpAlignmentOverride(LwpAlignmentOverride const& rOther);
     311             : 
     312             : private:
     313             :     LwpAlignmentOverride& operator=(LwpAlignmentOverride const& rOther); // not implemented
     314             : 
     315             : private:
     316             :     enum
     317             :     {
     318             :         AO_TYPE     = 0x01,
     319             :         AO_POSITION = 0x02,
     320             :         AO_CHAR     = 0x04
     321             :     };
     322             : 
     323             :     AlignType   m_nAlignType;
     324             :     sal_uInt32  m_nPosition;
     325             :     sal_uInt16  m_nAlignChar;
     326             : };
     327             : 
     328             : /////////////////////////////////////////////////////////////////
     329        1104 : class LwpSpacingCommonOverride : public LwpOverride
     330             : {
     331             : public:
     332         104 :     LwpSpacingCommonOverride() : m_nSpacingType(SPACING_NONE), m_nAmount(0), m_nMultiple(65536){}
     333             : 
     334             :     virtual LwpSpacingCommonOverride* clone() const;
     335             : 
     336             :     void Read(LwpObjectStream* pStrm);
     337             : 
     338             :     enum SpacingType
     339             :     {
     340             :         SPACING_DYNAMIC = 0,
     341             :         SPACING_LEADING = 1,
     342             :         SPACING_CUSTOM  = 2,
     343             :         SPACING_NONE    = 3
     344             :     };
     345             : 
     346         417 :     SpacingType GetType() const {return m_nSpacingType;}
     347         417 :     sal_Int32 GetAmount() const {return m_nAmount;}
     348         417 :     sal_Int32 GetMultiple() const {return m_nMultiple;}
     349             : 
     350             :     void Override(LwpSpacingCommonOverride* other);
     351             :     void OverrideType(SpacingType val);
     352             :     void OverrideAmount(sal_Int32 val);
     353             :     void OverrideMultiple(sal_Int32 val);
     354             : 
     355             : protected:
     356             :     LwpSpacingCommonOverride(LwpSpacingCommonOverride const& rOther);
     357             : 
     358             : private:
     359             :     LwpSpacingCommonOverride& operator=(LwpSpacingCommonOverride const& rOther); // not implemented
     360             : 
     361             : protected:
     362             :     enum
     363             :     {
     364             :         SPO_TYPE    = 0x01,
     365             :         SPO_AMOUNT  = 0x02,
     366             :         SPO_MULTIPLE= 0x04
     367             :     };
     368             :     SpacingType m_nSpacingType;//sal_uInt16
     369             :     sal_Int32   m_nAmount;
     370             :     sal_Int32   m_nMultiple;
     371             : };
     372             : 
     373             : /////////////////////////////////////////////////////////////////
     374             : class LwpSpacingOverride : public LwpOverride
     375             : {
     376             : public:
     377             :     LwpSpacingOverride();
     378             :     virtual ~LwpSpacingOverride();
     379             : 
     380             :     virtual LwpSpacingOverride* clone() const;
     381             : 
     382             :     void Read(LwpObjectStream* pStrm);
     383             : 
     384             :     void Override(LwpSpacingOverride* other);
     385             : 
     386         251 :     LwpSpacingCommonOverride* GetSpacing(){return m_pSpacing;}
     387         112 :     LwpSpacingCommonOverride* GetAboveLineSpacing(){return m_pAboveLineSpacing;}
     388         251 :     LwpSpacingCommonOverride* GetAboveSpacing(){return m_pParaSpacingAbove;}
     389         251 :     LwpSpacingCommonOverride* GetBelowSpacing(){return m_pParaSpacingBelow;}
     390             : 
     391             : protected:
     392             :     LwpSpacingOverride(LwpSpacingOverride const& rOther);
     393             : 
     394             : private:
     395             :     LwpSpacingOverride& operator=(LwpSpacingOverride const& rOther); // not implemented
     396             : 
     397             : private:
     398             :     LwpSpacingCommonOverride*   m_pSpacing;
     399             :     LwpSpacingCommonOverride*   m_pAboveLineSpacing;
     400             :     LwpSpacingCommonOverride*   m_pParaSpacingAbove;
     401             :     LwpSpacingCommonOverride*   m_pParaSpacingBelow;
     402             : };
     403             : 
     404             : /////////////////////////////////////////////////////////////////
     405        1306 : class LwpIndentOverride : public LwpOverride
     406             : {
     407             : public:
     408         203 :     LwpIndentOverride() : m_nAll(0), m_nFirst(0), m_nRest(0), m_nRight(0) {}
     409             : 
     410             :     virtual LwpIndentOverride* clone() const;
     411             : 
     412             :     void Read(LwpObjectStream* pStrm);
     413             : 
     414             :     enum
     415             :     {
     416             :         RELATIVE_FIRST, RELATIVE_REST, RELATIVE_ALL
     417             :     };
     418             : 
     419             :     inline double GetFirst() const;
     420             :     inline double GetLeft() const;
     421             :     inline double GetRight() const;
     422             : 
     423             :     sal_uInt16 GetRelative();
     424             :     sal_Bool IsUseRelative();
     425             :     void Override(LwpIndentOverride* other);
     426             :     void OverrideIndentAll(sal_Int32 val);
     427             :     void OverrideIndentFirst(sal_Int32 val);
     428             :     void OverrideIndentRight(sal_Int32 val);
     429             :     void OverrideIndentRest(sal_Int32 val);
     430             :     void OverrideUseRelative(sal_Bool use);
     431             :     void OverrideRelative(sal_uInt16 relative);
     432           4 :     sal_Int32 GetMAll() const {return m_nAll;}
     433           0 :     sal_Int32 GetMFirst() const {return m_nFirst;}
     434           0 :     sal_Int32 GetMRest() const {return m_nRest;}
     435           0 :     sal_Int32 GetMRight() const {return m_nRight;}
     436           0 :     void SetMAll(sal_Int32 val){m_nAll=val;}
     437          41 :     void SetMFirst(sal_Int32 val){m_nFirst=val;}
     438          41 :     void SetMRest(sal_Int32 val){m_nRest=val;}
     439           0 :     void SetMRight(sal_Int32 val){m_nRight=val;}
     440             : 
     441             : protected:
     442             :     LwpIndentOverride(LwpIndentOverride const& rOther);
     443             : 
     444             : private:
     445             :     LwpIndentOverride& operator=(LwpIndentOverride const& rOther); // not implemented
     446             : 
     447             : private:
     448             :     enum
     449             :     {
     450             :         IO_ALL          = 0x0001,
     451             :         IO_FIRST        = 0x0002,
     452             :         IO_REST         = 0x0004,
     453             :         IO_RIGHT        = 0x0008,
     454             :         IO_HANGING      = 0x0010,
     455             :         IO_EQUAL        = 0x0020,
     456             :         IO_BODY         = 0x0040,
     457             :         IO_REL_ALL      = 0x0080,
     458             :         IO_REL_FIRST    = 0x0100,
     459             :         IO_REL_REST     = 0x0200,
     460             :         IO_REL_FLAGS    = (IO_REL_ALL | IO_REL_FIRST | IO_REL_REST),
     461             :         IO_USE_RELATIVE = 0x0400
     462             :     };
     463             : 
     464             :     sal_Int32   m_nAll;
     465             :     sal_Int32   m_nFirst;
     466             :     sal_Int32   m_nRest;
     467             :     sal_Int32   m_nRight;
     468             : };
     469             : 
     470         175 : inline double LwpIndentOverride::GetFirst() const
     471             : {
     472         175 :         return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(m_nFirst-m_nRest));
     473             : }
     474         175 : inline double LwpIndentOverride::GetLeft() const
     475             : {
     476         175 :         return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(m_nAll+m_nRest));
     477             : }
     478         179 : inline double LwpIndentOverride::GetRight() const
     479             : {
     480         179 :     return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(m_nRight));
     481             : }
     482             : 
     483             : /////////////////////////////////////////////////////////////////
     484             : class LwpBackgroundStuff;
     485             : class LwpAmikakeOverride : public LwpOverride
     486             : {
     487             : public:
     488             :     LwpAmikakeOverride();
     489             : 
     490             :     virtual ~LwpAmikakeOverride();
     491             : 
     492             :     virtual LwpAmikakeOverride* clone() const;
     493             : 
     494             :     void Read(LwpObjectStream* pStrm);
     495             :     enum
     496             :     {
     497             :         AMIKAKE_NONE        = 0,
     498             :         AMIKAKE_BACKGROUND  = 1,
     499             :         AMIKAKE_CHARACTER   = 2
     500             :     };
     501             : 
     502             : protected:
     503             :     LwpAmikakeOverride(LwpAmikakeOverride const& rOther);
     504             : 
     505             : private:
     506             :     LwpAmikakeOverride& operator=(LwpAmikakeOverride const& rOther); // not implemented
     507             : 
     508             : private:
     509             :     LwpBackgroundStuff* m_pBackgroundStuff;
     510             :     sal_uInt16      m_nType;
     511             : 
     512             : };
     513             : 
     514             : #endif
     515             : 
     516             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10