LCOV - code coverage report
Current view: top level - sw/inc - grfatr.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 86 86 100.0 %
Date: 2014-04-11 Functions: 67 68 98.5 %
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             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef INCLUDED_SW_INC_GRFATR_HXX
      20             : #define INCLUDED_SW_INC_GRFATR_HXX
      21             : 
      22             : #include <hintids.hxx>
      23             : #include <tools/gen.hxx>
      24             : #include <svl/eitem.hxx>
      25             : #include <svl/intitem.hxx>
      26             : #include <svx/grfcrop.hxx>
      27             : #include "swdllapi.h"
      28             : #include <swatrset.hxx>
      29             : #include <format.hxx>
      30             : 
      31             : /******************************************************************************
      32             :  *  class SwMirrorGrf
      33             :  ******************************************************************************/
      34             : 
      35             : enum MirrorGraph
      36             : {
      37             : RES_MIRROR_GRAPH_BEGIN,
      38             :     RES_MIRROR_GRAPH_DONT = RES_MIRROR_GRAPH_BEGIN,
      39             :     RES_MIRROR_GRAPH_VERT,
      40             :     RES_MIRROR_GRAPH_HOR,
      41             :     RES_MIRROR_GRAPH_BOTH,
      42             : RES_MIRROR_GRAPH_END
      43             : };
      44             : 
      45         145 : class SW_DLLPUBLIC SwMirrorGrf : public SfxEnumItem
      46             : {
      47             :     sal_Bool bGrfToggle; // Flip graphics on even pages.
      48             : 
      49             : public:
      50          38 :     SwMirrorGrf( MirrorGraph eMiro = RES_MIRROR_GRAPH_DONT )
      51          38 :         : SfxEnumItem( RES_GRFATR_MIRRORGRF, static_cast< sal_uInt16 >(eMiro) ), bGrfToggle( sal_False )
      52          38 :     {}
      53          41 :     SwMirrorGrf( const SwMirrorGrf &rMirrorGrf )
      54          41 :         : SfxEnumItem( RES_GRFATR_MIRRORGRF, rMirrorGrf.GetValue()),
      55          41 :         bGrfToggle( rMirrorGrf.IsGrfToggle() )
      56          41 :     {}
      57             : 
      58             :     // pure virtual methods of SfxPoolItem
      59             :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
      60             : 
      61             :     // pure virtual methods of SfxEnumItem
      62             :     virtual sal_uInt16          GetValueCount() const SAL_OVERRIDE;
      63             :     virtual bool            operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
      64             :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
      65             :                                     SfxMapUnit eCoreMetric,
      66             :                                     SfxMapUnit ePresMetric,
      67             :                                     OUString &rText,
      68             :                                     const IntlWrapper*    pIntl = 0 ) const SAL_OVERRIDE;
      69             : 
      70             :     virtual bool             QueryValue( com::sun::star::uno::Any& rVal,
      71             :                                         sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
      72             :     virtual bool             PutValue( const com::sun::star::uno::Any& rVal,
      73             :                                         sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
      74             : 
      75             :     inline SwMirrorGrf& operator=( const SwMirrorGrf& rMirrorGrf )
      76             :         {
      77             :             SfxEnumItem::SetValue( rMirrorGrf.GetValue() );
      78             :             bGrfToggle = rMirrorGrf.IsGrfToggle();
      79             :             return *this;
      80             :         }
      81             : 
      82         186 :     inline sal_Bool IsGrfToggle() const         { return bGrfToggle; }
      83          26 :     inline void SetGrfToggle( sal_Bool bNew )   { bGrfToggle = bNew; }
      84             : };
      85             : 
      86             : /******************************************************************************
      87             :  *  class SwAttrCropGrf
      88             :  ******************************************************************************/
      89             : 
      90        1223 : class SW_DLLPUBLIC SwCropGrf : public SvxGrfCrop
      91             : {
      92             : public:
      93             :     TYPEINFO_OVERRIDE();
      94             :     SwCropGrf();
      95             :     SwCropGrf(  sal_Int32 nLeft,    sal_Int32 nRight,
      96             :                 sal_Int32 nTop,     sal_Int32 nBottom );
      97             : 
      98             :     // "pure virtual methods" of SfxPoolItem
      99             :     virtual SfxPoolItem*        Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     100             : };
     101             : 
     102         420 : class SwRotationGrf : public SfxUInt16Item
     103             : {
     104             :     Size aUnrotatedSize;
     105             : public:
     106          37 :     SwRotationGrf( sal_Int16 nVal = 0 )
     107          37 :         : SfxUInt16Item( RES_GRFATR_ROTATION, nVal )
     108          37 :     {}
     109         173 :     SwRotationGrf( sal_Int16 nVal, const Size& rSz )
     110         173 :         : SfxUInt16Item( RES_GRFATR_ROTATION, nVal ), aUnrotatedSize( rSz )
     111         173 :     {}
     112             : 
     113             :     // pure virtual methods from SfxInt16Item
     114             :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     115             :     virtual bool            operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
     116             :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
     117             :                                     SfxMapUnit eCoreMetric,
     118             :                                     SfxMapUnit ePresMetric,
     119             :                                     OUString &rText,
     120             :                                     const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
     121             :     virtual bool             QueryValue( com::sun::star::uno::Any& rVal,
     122             :                                             sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
     123             :     virtual bool             PutValue( const com::sun::star::uno::Any& rVal,
     124             :                                             sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
     125             : 
     126             :     void SetUnrotatedSize( const Size& rSz )        { aUnrotatedSize = rSz; }
     127         464 :     const Size& GetUnrotatedSize() const            { return aUnrotatedSize; }
     128             : };
     129             : 
     130         374 : class SW_DLLPUBLIC SwLuminanceGrf : public SfxInt16Item
     131             : {
     132             : public:
     133          37 :     SwLuminanceGrf( sal_Int16 nVal = 0 )
     134          37 :         : SfxInt16Item( RES_GRFATR_LUMINANCE, nVal )
     135          37 :     {}
     136             : 
     137             :     // pure virtual methods from SfxInt16Item
     138             :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     139             :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
     140             :                                     SfxMapUnit eCoreMetric,
     141             :                                     SfxMapUnit ePresMetric,
     142             :                                     OUString &rText,
     143             :                                     const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
     144             : };
     145             : 
     146         374 : class SW_DLLPUBLIC SwContrastGrf : public SfxInt16Item
     147             : {
     148             : public:
     149          37 :     SwContrastGrf( sal_Int16 nVal = 0 )
     150          37 :         : SfxInt16Item( RES_GRFATR_CONTRAST, nVal )
     151          37 :     {}
     152             : 
     153             :     // pure virtual methods from SfxInt16Item
     154             :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     155             :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
     156             :                                     SfxMapUnit eCoreMetric,
     157             :                                     SfxMapUnit ePresMetric,
     158             :                                     OUString &rText,
     159             :                                     const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
     160             : };
     161             : 
     162         309 : class SwChannelGrf : public SfxInt16Item
     163             : {
     164             : protected:
     165         111 :     SwChannelGrf( sal_Int16 nVal, sal_uInt16 nWhichL )
     166         111 :         : SfxInt16Item( nWhichL, nVal )
     167         111 :     {}
     168             : 
     169             : public:
     170             :     // pure virtual methods from SfxInt16Item
     171             :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
     172             :                                     SfxMapUnit eCoreMetric,
     173             :                                     SfxMapUnit ePresMetric,
     174             :                                     OUString &rText,
     175             :                                     const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
     176             : };
     177             : 
     178         173 : class SwChannelRGrf : public SwChannelGrf
     179             : {
     180             : public:
     181          37 :     SwChannelRGrf( sal_Int16 nVal = 0 )
     182          37 :         : SwChannelGrf( nVal, RES_GRFATR_CHANNELR )
     183          37 :     {}
     184             :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     185             : };
     186         173 : class SwChannelGGrf : public SwChannelGrf
     187             : {
     188             : public:
     189          37 :     SwChannelGGrf( sal_Int16 nVal = 0 )
     190          37 :         : SwChannelGrf( nVal, RES_GRFATR_CHANNELG )
     191          37 :     {}
     192             :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     193             : };
     194         173 : class SwChannelBGrf : public SwChannelGrf
     195             : {
     196             : public:
     197          37 :     SwChannelBGrf( sal_Int16 nVal = 0 )
     198          37 :         : SwChannelGrf( nVal, RES_GRFATR_CHANNELB )
     199          37 :     {}
     200             :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     201             : };
     202             : 
     203         231 : class SW_DLLPUBLIC SwGammaGrf : public SfxPoolItem
     204             : {
     205             :     double nValue;
     206             : public:
     207             :     TYPEINFO_OVERRIDE();
     208          37 :     SwGammaGrf() : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( 1.0 )
     209          37 :     {}
     210             : 
     211          10 :     SwGammaGrf( const double& rVal )
     212          10 :         : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( rVal )
     213          10 :     {}
     214             : 
     215             :     inline SwGammaGrf& operator=( const SwGammaGrf& rCopy )
     216             :         {
     217             :             SetValue( rCopy.GetValue() );
     218             :             return *this;
     219             :         }
     220             : 
     221             :     // pure virtual methods from SfxEnumItem
     222             :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     223             :     virtual bool            operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
     224             :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
     225             :                                     SfxMapUnit eCoreMetric,
     226             :                                     SfxMapUnit ePresMetric,
     227             :                                     OUString &rText,
     228             :                                     const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
     229             : 
     230             :     virtual bool             QueryValue( com::sun::star::uno::Any& rVal,
     231             :                                             sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
     232             :     virtual bool             PutValue( const com::sun::star::uno::Any& rVal,
     233             :                                             sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
     234             : 
     235          89 :     const double& GetValue() const              { return nValue; }
     236             :     void SetValue( const double& rVal )         { nValue = rVal; }
     237             : };
     238             : 
     239         173 : class SwInvertGrf: public SfxBoolItem
     240             : {
     241             : public:
     242          37 :     SwInvertGrf( sal_Bool bVal = sal_False )
     243          37 :         : SfxBoolItem( RES_GRFATR_INVERT, bVal )
     244          37 :     {}
     245             : 
     246             :     // pure virtual methods from SfxInt16Item
     247             :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     248             :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
     249             :                                     SfxMapUnit eCoreMetric,
     250             :                                     SfxMapUnit ePresMetric,
     251             :                                     OUString &rText,
     252             :                                     const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
     253             : };
     254             : 
     255         173 : class SwTransparencyGrf : public SfxByteItem
     256             : {
     257             : public:
     258          37 :     SwTransparencyGrf( sal_Int8 nVal = 0 )
     259          37 :         : SfxByteItem( RES_GRFATR_TRANSPARENCY, nVal )
     260          37 :     {}
     261             : 
     262             :     // pure virtual methods from SfxInt16Item
     263             :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     264             :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
     265             :                                     SfxMapUnit eCoreMetric,
     266             :                                     SfxMapUnit ePresMetric,
     267             :                                     OUString &rText,
     268             :                                     const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
     269             :     virtual bool            QueryValue( com::sun::star::uno::Any& rVal,
     270             :                                         sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
     271             :     virtual bool            PutValue( const com::sun::star::uno::Any& rVal,
     272             :                                         sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
     273             : };
     274             : 
     275         173 : class SW_DLLPUBLIC SwDrawModeGrf : public SfxEnumItem
     276             : {
     277             : public:
     278          37 :     SwDrawModeGrf( sal_uInt16 nMode = 0 )
     279          37 :         : SfxEnumItem( RES_GRFATR_DRAWMODE, nMode )
     280          37 :     {}
     281             : 
     282             :     // pure virtual methods of SfxPoolItem
     283             :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     284             : 
     285             :     // pure virtual methods of SfxEnumItem
     286             :     virtual sal_uInt16          GetValueCount() const SAL_OVERRIDE;
     287             :     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
     288             :                                     SfxMapUnit eCoreMetric,
     289             :                                     SfxMapUnit ePresMetric,
     290             :                                     OUString &rText,
     291             :                                     const IntlWrapper*    pIntl = 0 ) const SAL_OVERRIDE;
     292             : 
     293             :     virtual bool            QueryValue( com::sun::star::uno::Any& rVal,
     294             :                                         sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
     295             :     virtual bool            PutValue( const com::sun::star::uno::Any& rVal,
     296             :                                         sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
     297             : };
     298             : 
     299             : /******************************************************************************
     300             :  *  Implementation of graphics attributes methods of SwAttr
     301             :  ******************************************************************************/
     302             : 
     303          90 : inline const SwMirrorGrf &SwAttrSet::GetMirrorGrf(sal_Bool bInP) const
     304          90 :     { return (const SwMirrorGrf&)Get( RES_GRFATR_MIRRORGRF,bInP); }
     305          76 : inline const SwCropGrf   &SwAttrSet::GetCropGrf(sal_Bool bInP) const
     306          76 :     { return (const SwCropGrf&)Get( RES_GRFATR_CROPGRF,bInP); }
     307          76 : inline const SwRotationGrf &SwAttrSet::GetRotationGrf(sal_Bool bInP) const
     308          76 :     { return (const SwRotationGrf&)Get( RES_GRFATR_ROTATION,bInP); }
     309          76 : inline const SwLuminanceGrf &SwAttrSet::GetLuminanceGrf(sal_Bool bInP) const
     310          76 :     { return (const SwLuminanceGrf&)Get( RES_GRFATR_LUMINANCE,bInP); }
     311          76 : inline const SwContrastGrf &SwAttrSet::GetContrastGrf(sal_Bool bInP) const
     312          76 :     { return (const SwContrastGrf&)Get( RES_GRFATR_CONTRAST,bInP); }
     313          76 : inline const SwChannelRGrf &SwAttrSet::GetChannelRGrf(sal_Bool bInP) const
     314          76 :     { return (const SwChannelRGrf&)Get( RES_GRFATR_CHANNELR,bInP); }
     315          76 : inline const SwChannelGGrf &SwAttrSet::GetChannelGGrf(sal_Bool bInP) const
     316          76 :     { return (const SwChannelGGrf&)Get( RES_GRFATR_CHANNELG,bInP); }
     317          76 : inline const SwChannelBGrf &SwAttrSet::GetChannelBGrf(sal_Bool bInP) const
     318          76 :     { return (const SwChannelBGrf&)Get( RES_GRFATR_CHANNELB,bInP); }
     319          76 : inline const SwGammaGrf &SwAttrSet::GetGammaGrf(sal_Bool bInP) const
     320          76 :     { return (const SwGammaGrf&)Get( RES_GRFATR_GAMMA,bInP); }
     321          76 : inline const SwInvertGrf &SwAttrSet::GetInvertGrf(sal_Bool bInP) const
     322          76 :     { return (const SwInvertGrf&)Get( RES_GRFATR_INVERT,bInP); }
     323          78 : inline const SwTransparencyGrf &SwAttrSet::GetTransparencyGrf(sal_Bool bInP) const
     324          78 :     { return (const SwTransparencyGrf&)Get( RES_GRFATR_TRANSPARENCY,bInP); }
     325          76 : inline const SwDrawModeGrf      &SwAttrSet::GetDrawModeGrf(sal_Bool bInP) const
     326          76 :     { return (const SwDrawModeGrf&)Get( RES_GRFATR_DRAWMODE,bInP); }
     327             : 
     328             : /******************************************************************************
     329             :  *  Implementation of graphics attributes methods of SwFmt
     330             :  ******************************************************************************/
     331             : 
     332             : inline const SwMirrorGrf &SwFmt::GetMirrorGrf(sal_Bool bInP) const
     333             :     { return aSet.GetMirrorGrf(bInP); }
     334             : inline const SwCropGrf   &SwFmt::GetCropGrf(sal_Bool bInP) const
     335             :     { return aSet.GetCropGrf(bInP); }
     336             : inline const SwRotationGrf &SwFmt::GetRotationGrf(sal_Bool bInP) const
     337             :     { return aSet.GetRotationGrf(bInP); }
     338             : inline const SwLuminanceGrf &SwFmt::GetLuminanceGrf(sal_Bool bInP) const
     339             :     { return aSet.GetLuminanceGrf( bInP); }
     340             : inline const SwContrastGrf &SwFmt::GetContrastGrf(sal_Bool bInP) const
     341             :     { return aSet.GetContrastGrf( bInP); }
     342             : inline const SwChannelRGrf &SwFmt::GetChannelRGrf(sal_Bool bInP) const
     343             :     { return aSet.GetChannelRGrf( bInP); }
     344             : inline const SwChannelGGrf &SwFmt::GetChannelGGrf(sal_Bool bInP) const
     345             :     { return aSet.GetChannelGGrf( bInP); }
     346             : inline const SwChannelBGrf &SwFmt::GetChannelBGrf(sal_Bool bInP) const
     347             :     { return aSet.GetChannelBGrf( bInP); }
     348             : inline const SwGammaGrf &SwFmt::GetGammaGrf(sal_Bool bInP) const
     349             :     { return aSet.GetGammaGrf( bInP); }
     350             : inline const SwInvertGrf &SwFmt::GetInvertGrf(sal_Bool bInP) const
     351             :     { return aSet.GetInvertGrf( bInP); }
     352             : inline const SwTransparencyGrf &SwFmt::GetTransparencyGrf(sal_Bool bInP) const
     353             :     { return aSet.GetTransparencyGrf( bInP); }
     354             : inline const SwDrawModeGrf &SwFmt::GetDrawModeGrf(sal_Bool bInP) const
     355             :     { return aSet.GetDrawModeGrf(bInP); }
     356             : 
     357             : #endif // INCLUDED_SW_INC_GRFATR_HXX
     358             : 
     359             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10