LCOV - code coverage report
Current view: top level - sw/inc - grfatr.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 85 86 98.8 %
Date: 2012-08-25 Functions: 66 68 97.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 13 28 46.4 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef _GRFATR_HXX
      29                 :            : #define _GRFATR_HXX
      30                 :            : 
      31                 :            : #include <hintids.hxx>      // For the WhichIds @@@ must be included first @@@
      32                 :            : #include <tools/gen.hxx>
      33                 :            : #include <svl/eitem.hxx>
      34                 :            : #include <svl/intitem.hxx>
      35                 :            : #include <svx/grfcrop.hxx>
      36                 :            : #include "swdllapi.h"
      37                 :            : #include <swatrset.hxx>     // For inlines.
      38                 :            : #include <format.hxx>       // For inlines.
      39                 :            : 
      40                 :            : /******************************************************************************
      41                 :            :  *  class SwMirrorGrf
      42                 :            :  ******************************************************************************/
      43                 :            : 
      44                 :            : enum MirrorGraph
      45                 :            : {
      46                 :            : RES_MIRROR_GRAPH_BEGIN,
      47                 :            :     RES_MIRROR_GRAPH_DONT = RES_MIRROR_GRAPH_BEGIN,
      48                 :            :     RES_MIRROR_GRAPH_VERT,
      49                 :            :     RES_MIRROR_GRAPH_HOR,
      50                 :            :     RES_MIRROR_GRAPH_BOTH,
      51                 :            : RES_MIRROR_GRAPH_END
      52                 :            : };
      53                 :            : 
      54         [ -  + ]:        202 : class SW_DLLPUBLIC SwMirrorGrf : public SfxEnumItem
      55                 :            : {
      56                 :            :     sal_Bool bGrfToggle; // Flip graphics on even pages.
      57                 :            : 
      58                 :            : public:
      59                 :         75 :     SwMirrorGrf( MirrorGraph eMiro = RES_MIRROR_GRAPH_DONT )
      60                 :         75 :         : SfxEnumItem( RES_GRFATR_MIRRORGRF, static_cast< sal_uInt16 >(eMiro) ), bGrfToggle( sal_False )
      61                 :         75 :     {}
      62                 :         28 :     SwMirrorGrf( const SwMirrorGrf &rMirrorGrf )
      63                 :         28 :         : SfxEnumItem( RES_GRFATR_MIRRORGRF, rMirrorGrf.GetValue()),
      64                 :         28 :         bGrfToggle( rMirrorGrf.IsGrfToggle() )
      65                 :         28 :     {}
      66                 :            : 
      67                 :            :     // pure virtual methods of SfxPoolItem
      68                 :            :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
      69                 :            : 
      70                 :            :     // pure virtual methods of SfxEnumItem
      71                 :            :     virtual sal_uInt16          GetValueCount() const;
      72                 :            :     virtual int             operator==( const SfxPoolItem& ) const;
      73                 :            :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
      74                 :            :                                     SfxMapUnit eCoreMetric,
      75                 :            :                                     SfxMapUnit ePresMetric,
      76                 :            :                                     String &rText,
      77                 :            :                                     const IntlWrapper*    pIntl = 0 ) const;
      78                 :            : 
      79                 :            :     virtual bool             QueryValue( com::sun::star::uno::Any& rVal,
      80                 :            :                                         sal_uInt8 nMemberId = 0 ) const;
      81                 :            :     virtual bool             PutValue( const com::sun::star::uno::Any& rVal,
      82                 :            :                                         sal_uInt8 nMemberId = 0 );
      83                 :            : 
      84                 :            :     inline SwMirrorGrf& operator=( const SwMirrorGrf& rMirrorGrf )
      85                 :            :         {
      86                 :            :             SfxEnumItem::SetValue( rMirrorGrf.GetValue() );
      87                 :            :             bGrfToggle = rMirrorGrf.IsGrfToggle();
      88                 :            :             return *this;
      89                 :            :         }
      90                 :            : 
      91                 :        180 :     inline sal_Bool IsGrfToggle() const         { return bGrfToggle; }
      92                 :          8 :     inline void SetGrfToggle( sal_Bool bNew )   { bGrfToggle = bNew; }
      93                 :            : };
      94                 :            : 
      95                 :            : 
      96                 :            : /******************************************************************************
      97                 :            :  *  class SwAttrCropGrf
      98                 :            :  ******************************************************************************/
      99                 :            : 
     100         [ -  + ]:        206 : class SW_DLLPUBLIC SwCropGrf : public SvxGrfCrop
     101                 :            : {
     102                 :            : public:
     103                 :            :     TYPEINFO();
     104                 :            :     SwCropGrf();
     105                 :            :     SwCropGrf(  sal_Int32 nLeft,    sal_Int32 nRight,
     106                 :            :                 sal_Int32 nTop,     sal_Int32 nBottom );
     107                 :            : 
     108                 :            :     // "pure virtual methods" of SfxPoolItem
     109                 :            :     virtual SfxPoolItem*        Clone( SfxItemPool *pPool = 0 ) const;
     110                 :            : };
     111                 :            : 
     112         [ -  + ]:        158 : class SwRotationGrf : public SfxUInt16Item
     113                 :            : {
     114                 :            :     Size aUnrotatedSize;
     115                 :            : public:
     116                 :         73 :     SwRotationGrf( sal_Int16 nVal = 0 )
     117                 :         73 :         : SfxUInt16Item( RES_GRFATR_ROTATION, nVal )
     118                 :         73 :     {}
     119                 :          6 :     SwRotationGrf( sal_Int16 nVal, const Size& rSz )
     120                 :          6 :         : SfxUInt16Item( RES_GRFATR_ROTATION, nVal ), aUnrotatedSize( rSz )
     121                 :          6 :     {}
     122                 :            : 
     123                 :            :     // pure virtual methods from SfxInt16Item
     124                 :            :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
     125                 :            :     virtual int             operator==( const SfxPoolItem& ) const;
     126                 :            :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
     127                 :            :                                     SfxMapUnit eCoreMetric,
     128                 :            :                                     SfxMapUnit ePresMetric,
     129                 :            :                                     String &rText,
     130                 :            :                                     const IntlWrapper* pIntl = 0 ) const;
     131                 :            :     virtual bool             QueryValue( com::sun::star::uno::Any& rVal,
     132                 :            :                                             sal_uInt8 nMemberId = 0 ) const;
     133                 :            :     virtual bool             PutValue( const com::sun::star::uno::Any& rVal,
     134                 :            :                                             sal_uInt8 nMemberId = 0 );
     135                 :            : 
     136                 :            :     void SetUnrotatedSize( const Size& rSz )        { aUnrotatedSize = rSz; }
     137                 :          0 :     const Size& GetUnrotatedSize() const            { return aUnrotatedSize; }
     138                 :            : };
     139                 :            : 
     140         [ -  + ]:        281 : class SW_DLLPUBLIC SwLuminanceGrf : public SfxInt16Item
     141                 :            : {
     142                 :            : public:
     143                 :         73 :     SwLuminanceGrf( sal_Int16 nVal = 0 )
     144                 :         73 :         : SfxInt16Item( RES_GRFATR_LUMINANCE, nVal )
     145                 :         73 :     {}
     146                 :            : 
     147                 :            :     // pure virtual methods from SfxInt16Item
     148                 :            :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
     149                 :            :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
     150                 :            :                                     SfxMapUnit eCoreMetric,
     151                 :            :                                     SfxMapUnit ePresMetric,
     152                 :            :                                     String &rText,
     153                 :            :                                     const IntlWrapper* pIntl = 0 ) const;
     154                 :            : };
     155                 :            : 
     156         [ -  + ]:        281 : class SW_DLLPUBLIC SwContrastGrf : public SfxInt16Item
     157                 :            : {
     158                 :            : public:
     159                 :         73 :     SwContrastGrf( sal_Int16 nVal = 0 )
     160                 :         73 :         : SfxInt16Item( RES_GRFATR_CONTRAST, nVal )
     161                 :         73 :     {}
     162                 :            : 
     163                 :            :     // pure virtual methods from SfxInt16Item
     164                 :            :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
     165                 :            :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
     166                 :            :                                     SfxMapUnit eCoreMetric,
     167                 :            :                                     SfxMapUnit ePresMetric,
     168                 :            :                                     String &rText,
     169                 :            :                                     const IntlWrapper* pIntl = 0 ) const;
     170                 :            : };
     171                 :            : 
     172 [ #  # ][ -  + ]:        291 : class SwChannelGrf : public SfxInt16Item
     173                 :            : {
     174                 :            : protected:
     175                 :        219 :     SwChannelGrf( sal_Int16 nVal, sal_uInt16 nWhichL )
     176                 :        219 :         : SfxInt16Item( nWhichL, nVal )
     177                 :        219 :     {}
     178                 :            : 
     179                 :            : public:
     180                 :            :     // pure virtual methods from SfxInt16Item
     181                 :            :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
     182                 :            :                                     SfxMapUnit eCoreMetric,
     183                 :            :                                     SfxMapUnit ePresMetric,
     184                 :            :                                     String &rText,
     185                 :            :                                     const IntlWrapper* pIntl = 0 ) const;
     186                 :            : };
     187                 :            : 
     188         [ -  + ]:        182 : class SwChannelRGrf : public SwChannelGrf
     189                 :            : {
     190                 :            : public:
     191                 :         73 :     SwChannelRGrf( sal_Int16 nVal = 0 )
     192                 :         73 :         : SwChannelGrf( nVal, RES_GRFATR_CHANNELR )
     193                 :         73 :     {}
     194                 :            :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
     195                 :            : };
     196         [ -  + ]:        182 : class SwChannelGGrf : public SwChannelGrf
     197                 :            : {
     198                 :            : public:
     199                 :         73 :     SwChannelGGrf( sal_Int16 nVal = 0 )
     200                 :         73 :         : SwChannelGrf( nVal, RES_GRFATR_CHANNELG )
     201                 :         73 :     {}
     202                 :            :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
     203                 :            : };
     204         [ -  + ]:        182 : class SwChannelBGrf : public SwChannelGrf
     205                 :            : {
     206                 :            : public:
     207                 :         73 :     SwChannelBGrf( sal_Int16 nVal = 0 )
     208                 :         73 :         : SwChannelGrf( nVal, RES_GRFATR_CHANNELB )
     209                 :         73 :     {}
     210                 :            :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
     211                 :            : };
     212                 :            : 
     213         [ -  + ]:        323 : class SW_DLLPUBLIC SwGammaGrf : public SfxPoolItem
     214                 :            : {
     215                 :            :     double nValue;
     216                 :            : public:
     217                 :            :     TYPEINFO();
     218                 :         73 :     SwGammaGrf() : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( 1.0 )
     219                 :         73 :     {}
     220                 :            : 
     221                 :         45 :     SwGammaGrf( const double& rVal )
     222                 :         45 :         : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( rVal )
     223                 :         45 :     {}
     224                 :            : 
     225                 :            :     inline SwGammaGrf& operator=( const SwGammaGrf& rCopy )
     226                 :            :         {
     227                 :            :             SetValue( rCopy.GetValue() );
     228                 :            :             return *this;
     229                 :            :         }
     230                 :            : 
     231                 :            :     // pure virtual methods from SfxEnumItem
     232                 :            :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
     233                 :            :     virtual int             operator==( const SfxPoolItem& ) const;
     234                 :            :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
     235                 :            :                                     SfxMapUnit eCoreMetric,
     236                 :            :                                     SfxMapUnit ePresMetric,
     237                 :            :                                     String &rText,
     238                 :            :                                     const IntlWrapper* pIntl = 0 ) const;
     239                 :            : 
     240                 :            :     virtual bool             QueryValue( com::sun::star::uno::Any& rVal,
     241                 :            :                                             sal_uInt8 nMemberId = 0 ) const;
     242                 :            :     virtual bool             PutValue( const com::sun::star::uno::Any& rVal,
     243                 :            :                                             sal_uInt8 nMemberId = 0 );
     244                 :            : 
     245                 :            : 
     246                 :        124 :     const double& GetValue() const              { return nValue; }
     247                 :            :     void SetValue( const double& rVal )         { nValue = rVal; }
     248                 :            : };
     249                 :            : 
     250         [ -  + ]:        182 : class SwInvertGrf: public SfxBoolItem
     251                 :            : {
     252                 :            : public:
     253                 :         73 :     SwInvertGrf( sal_Bool bVal = sal_False )
     254                 :         73 :         : SfxBoolItem( RES_GRFATR_INVERT, bVal )
     255                 :         73 :     {}
     256                 :            : 
     257                 :            :     // pure virtual methods from SfxInt16Item
     258                 :            :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
     259                 :            :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
     260                 :            :                                     SfxMapUnit eCoreMetric,
     261                 :            :                                     SfxMapUnit ePresMetric,
     262                 :            :                                     String &rText,
     263                 :            :                                     const IntlWrapper* pIntl = 0 ) const;
     264                 :            : };
     265                 :            : 
     266         [ -  + ]:        182 : class SwTransparencyGrf : public SfxByteItem
     267                 :            : {
     268                 :            : public:
     269                 :         73 :     SwTransparencyGrf( sal_Int8 nVal = 0 )
     270                 :         73 :         : SfxByteItem( RES_GRFATR_TRANSPARENCY, nVal )
     271                 :         73 :     {}
     272                 :            : 
     273                 :            :     // pure virtual methods from SfxInt16Item
     274                 :            :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
     275                 :            :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
     276                 :            :                                     SfxMapUnit eCoreMetric,
     277                 :            :                                     SfxMapUnit ePresMetric,
     278                 :            :                                     String &rText,
     279                 :            :                                     const IntlWrapper* pIntl = 0 ) const;
     280                 :            :     virtual bool            QueryValue( com::sun::star::uno::Any& rVal,
     281                 :            :                                         sal_uInt8 nMemberId = 0 ) const;
     282                 :            :     virtual bool            PutValue( const com::sun::star::uno::Any& rVal,
     283                 :            :                                         sal_uInt8 nMemberId = 0 );
     284                 :            : };
     285                 :            : 
     286         [ -  + ]:        182 : class SW_DLLPUBLIC SwDrawModeGrf : public SfxEnumItem
     287                 :            : {
     288                 :            : public:
     289                 :         73 :     SwDrawModeGrf( sal_uInt16 nMode = 0 )
     290                 :         73 :         : SfxEnumItem( RES_GRFATR_DRAWMODE, nMode )
     291                 :         73 :     {}
     292                 :            : 
     293                 :            :     // pure virtual methods of SfxPoolItem
     294                 :            :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
     295                 :            : 
     296                 :            :     // pure virtual methods of SfxEnumItem
     297                 :            :     virtual sal_uInt16          GetValueCount() const;
     298                 :            :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
     299                 :            :                                     SfxMapUnit eCoreMetric,
     300                 :            :                                     SfxMapUnit ePresMetric,
     301                 :            :                                     String &rText,
     302                 :            :                                     const IntlWrapper*    pIntl = 0 ) const;
     303                 :            : 
     304                 :            :     virtual bool            QueryValue( com::sun::star::uno::Any& rVal,
     305                 :            :                                         sal_uInt8 nMemberId = 0 ) const;
     306                 :            :     virtual bool            PutValue( const com::sun::star::uno::Any& rVal,
     307                 :            :                                         sal_uInt8 nMemberId = 0 );
     308                 :            : };
     309                 :            : 
     310                 :            : 
     311                 :            : 
     312                 :            : /******************************************************************************
     313                 :            :  *  Implementation of graphics attributes methods of SwAttr
     314                 :            :  ******************************************************************************/
     315                 :            : 
     316                 :         91 : inline const SwMirrorGrf &SwAttrSet::GetMirrorGrf(sal_Bool bInP) const
     317                 :         91 :     { return (const SwMirrorGrf&)Get( RES_GRFATR_MIRRORGRF,bInP); }
     318                 :         64 : inline const SwCropGrf   &SwAttrSet::GetCropGrf(sal_Bool bInP) const
     319                 :         64 :     { return (const SwCropGrf&)Get( RES_GRFATR_CROPGRF,bInP); }
     320                 :         64 : inline const SwRotationGrf &SwAttrSet::GetRotationGrf(sal_Bool bInP) const
     321                 :         64 :     { return (const SwRotationGrf&)Get( RES_GRFATR_ROTATION,bInP); }
     322                 :         64 : inline const SwLuminanceGrf &SwAttrSet::GetLuminanceGrf(sal_Bool bInP) const
     323                 :         64 :     { return (const SwLuminanceGrf&)Get( RES_GRFATR_LUMINANCE,bInP); }
     324                 :         64 : inline const SwContrastGrf &SwAttrSet::GetContrastGrf(sal_Bool bInP) const
     325                 :         64 :     { return (const SwContrastGrf&)Get( RES_GRFATR_CONTRAST,bInP); }
     326                 :         64 : inline const SwChannelRGrf &SwAttrSet::GetChannelRGrf(sal_Bool bInP) const
     327                 :         64 :     { return (const SwChannelRGrf&)Get( RES_GRFATR_CHANNELR,bInP); }
     328                 :         64 : inline const SwChannelGGrf &SwAttrSet::GetChannelGGrf(sal_Bool bInP) const
     329                 :         64 :     { return (const SwChannelGGrf&)Get( RES_GRFATR_CHANNELG,bInP); }
     330                 :         64 : inline const SwChannelBGrf &SwAttrSet::GetChannelBGrf(sal_Bool bInP) const
     331                 :         64 :     { return (const SwChannelBGrf&)Get( RES_GRFATR_CHANNELB,bInP); }
     332                 :         64 : inline const SwGammaGrf &SwAttrSet::GetGammaGrf(sal_Bool bInP) const
     333                 :         64 :     { return (const SwGammaGrf&)Get( RES_GRFATR_GAMMA,bInP); }
     334                 :         64 : inline const SwInvertGrf &SwAttrSet::GetInvertGrf(sal_Bool bInP) const
     335                 :         64 :     { return (const SwInvertGrf&)Get( RES_GRFATR_INVERT,bInP); }
     336                 :         64 : inline const SwTransparencyGrf &SwAttrSet::GetTransparencyGrf(sal_Bool bInP) const
     337                 :         64 :     { return (const SwTransparencyGrf&)Get( RES_GRFATR_TRANSPARENCY,bInP); }
     338                 :         64 : inline const SwDrawModeGrf      &SwAttrSet::GetDrawModeGrf(sal_Bool bInP) const
     339                 :         64 :     { return (const SwDrawModeGrf&)Get( RES_GRFATR_DRAWMODE,bInP); }
     340                 :            : 
     341                 :            : /******************************************************************************
     342                 :            :  *  Implementation of graphics attributes methods of SwFmt
     343                 :            :  ******************************************************************************/
     344                 :            : 
     345                 :            : inline const SwMirrorGrf &SwFmt::GetMirrorGrf(sal_Bool bInP) const
     346                 :            :     { return aSet.GetMirrorGrf(bInP); }
     347                 :            : inline const SwCropGrf   &SwFmt::GetCropGrf(sal_Bool bInP) const
     348                 :            :     { return aSet.GetCropGrf(bInP); }
     349                 :            : inline const SwRotationGrf &SwFmt::GetRotationGrf(sal_Bool bInP) const
     350                 :            :     { return aSet.GetRotationGrf(bInP); }
     351                 :            : inline const SwLuminanceGrf &SwFmt::GetLuminanceGrf(sal_Bool bInP) const
     352                 :            :     { return aSet.GetLuminanceGrf( bInP); }
     353                 :            : inline const SwContrastGrf &SwFmt::GetContrastGrf(sal_Bool bInP) const
     354                 :            :     { return aSet.GetContrastGrf( bInP); }
     355                 :            : inline const SwChannelRGrf &SwFmt::GetChannelRGrf(sal_Bool bInP) const
     356                 :            :     { return aSet.GetChannelRGrf( bInP); }
     357                 :            : inline const SwChannelGGrf &SwFmt::GetChannelGGrf(sal_Bool bInP) const
     358                 :            :     { return aSet.GetChannelGGrf( bInP); }
     359                 :            : inline const SwChannelBGrf &SwFmt::GetChannelBGrf(sal_Bool bInP) const
     360                 :            :     { return aSet.GetChannelBGrf( bInP); }
     361                 :            : inline const SwGammaGrf &SwFmt::GetGammaGrf(sal_Bool bInP) const
     362                 :            :     { return aSet.GetGammaGrf( bInP); }
     363                 :            : inline const SwInvertGrf &SwFmt::GetInvertGrf(sal_Bool bInP) const
     364                 :            :     { return aSet.GetInvertGrf( bInP); }
     365                 :            : inline const SwTransparencyGrf &SwFmt::GetTransparencyGrf(sal_Bool bInP) const
     366                 :            :     { return aSet.GetTransparencyGrf( bInP); }
     367                 :            : inline const SwDrawModeGrf &SwFmt::GetDrawModeGrf(sal_Bool bInP) const
     368                 :            :     { return aSet.GetDrawModeGrf(bInP); }
     369                 :            : 
     370                 :            : 
     371                 :            : #endif  // _GRFATR_HXX
     372                 :            : 
     373                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10