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

Generated by: LCOV version 1.10