LCOV - code coverage report
Current view: top level - sw/inc - grfatr.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 86 86 100.0 %
Date: 2014-11-03 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             : enum MirrorGraph
      32             : {
      33             : RES_MIRROR_GRAPH_BEGIN,
      34             :     RES_MIRROR_GRAPH_DONT = RES_MIRROR_GRAPH_BEGIN,
      35             :     RES_MIRROR_GRAPH_VERT,
      36             :     RES_MIRROR_GRAPH_HOR,
      37             :     RES_MIRROR_GRAPH_BOTH,
      38             : RES_MIRROR_GRAPH_END
      39             : };
      40             : 
      41         388 : class SW_DLLPUBLIC SwMirrorGrf : public SfxEnumItem
      42             : {
      43             :     bool bGrfToggle; // Flip graphics on even pages.
      44             : 
      45             : public:
      46          92 :     SwMirrorGrf( MirrorGraph eMiro = RES_MIRROR_GRAPH_DONT )
      47          92 :         : SfxEnumItem( RES_GRFATR_MIRRORGRF, static_cast< sal_uInt16 >(eMiro) ), bGrfToggle( false )
      48          92 :     {}
      49         124 :     SwMirrorGrf( const SwMirrorGrf &rMirrorGrf )
      50         124 :         : SfxEnumItem( RES_GRFATR_MIRRORGRF, rMirrorGrf.GetValue()),
      51         124 :         bGrfToggle( rMirrorGrf.IsGrfToggle() )
      52         124 :     {}
      53             : 
      54             :     // pure virtual methods of SfxPoolItem
      55             :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
      56             : 
      57             :     // pure virtual methods of SfxEnumItem
      58             :     virtual sal_uInt16          GetValueCount() const SAL_OVERRIDE;
      59             :     virtual bool            operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
      60             :     virtual bool GetPresentation( SfxItemPresentation ePres,
      61             :                                     SfxMapUnit eCoreMetric,
      62             :                                     SfxMapUnit ePresMetric,
      63             :                                     OUString &rText,
      64             :                                     const IntlWrapper*    pIntl = 0 ) const SAL_OVERRIDE;
      65             : 
      66             :     virtual bool             QueryValue( com::sun::star::uno::Any& rVal,
      67             :                                         sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
      68             :     virtual bool             PutValue( const com::sun::star::uno::Any& rVal,
      69             :                                         sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
      70             : 
      71             :     inline SwMirrorGrf& operator=( const SwMirrorGrf& rMirrorGrf )
      72             :         {
      73             :             SfxEnumItem::SetValue( rMirrorGrf.GetValue() );
      74             :             bGrfToggle = rMirrorGrf.IsGrfToggle();
      75             :             return *this;
      76             :         }
      77             : 
      78         578 :     inline bool IsGrfToggle() const         { return bGrfToggle; }
      79          88 :     inline void SetGrfToggle( bool bNew )   { bGrfToggle = bNew; }
      80             : };
      81             : 
      82        3642 : class SW_DLLPUBLIC SwCropGrf : public SvxGrfCrop
      83             : {
      84             : public:
      85             :     TYPEINFO_OVERRIDE();
      86             :     SwCropGrf();
      87             :     SwCropGrf(  sal_Int32 nLeft,    sal_Int32 nRight,
      88             :                 sal_Int32 nTop,     sal_Int32 nBottom );
      89             : 
      90             :     // "pure virtual methods" of SfxPoolItem
      91             :     virtual SfxPoolItem*        Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
      92             : };
      93             : 
      94         980 : class SwRotationGrf : public SfxUInt16Item
      95             : {
      96             :     Size aUnrotatedSize;
      97             : public:
      98          90 :     SwRotationGrf( sal_Int16 nVal = 0 )
      99          90 :         : SfxUInt16Item( RES_GRFATR_ROTATION, nVal )
     100          90 :     {}
     101         400 :     SwRotationGrf( sal_Int16 nVal, const Size& rSz )
     102         400 :         : SfxUInt16Item( RES_GRFATR_ROTATION, nVal ), aUnrotatedSize( rSz )
     103         400 :     {}
     104             : 
     105             :     // pure virtual methods from SfxInt16Item
     106             :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     107             :     virtual bool            operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
     108             :     virtual bool GetPresentation( SfxItemPresentation ePres,
     109             :                                     SfxMapUnit eCoreMetric,
     110             :                                     SfxMapUnit ePresMetric,
     111             :                                     OUString &rText,
     112             :                                     const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
     113             :     virtual bool             QueryValue( com::sun::star::uno::Any& rVal,
     114             :                                             sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
     115             :     virtual bool             PutValue( const com::sun::star::uno::Any& rVal,
     116             :                                             sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
     117             : 
     118             :     void SetUnrotatedSize( const Size& rSz )        { aUnrotatedSize = rSz; }
     119        1024 :     const Size& GetUnrotatedSize() const            { return aUnrotatedSize; }
     120             : };
     121             : 
     122        1608 : class SW_DLLPUBLIC SwLuminanceGrf : public SfxInt16Item
     123             : {
     124             : public:
     125          90 :     SwLuminanceGrf( sal_Int16 nVal = 0 )
     126          90 :         : SfxInt16Item( RES_GRFATR_LUMINANCE, nVal )
     127          90 :     {}
     128             : 
     129             :     // pure virtual methods from SfxInt16Item
     130             :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     131             :     virtual bool GetPresentation( SfxItemPresentation ePres,
     132             :                                     SfxMapUnit eCoreMetric,
     133             :                                     SfxMapUnit ePresMetric,
     134             :                                     OUString &rText,
     135             :                                     const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
     136             : };
     137             : 
     138        1608 : class SW_DLLPUBLIC SwContrastGrf : public SfxInt16Item
     139             : {
     140             : public:
     141          90 :     SwContrastGrf( sal_Int16 nVal = 0 )
     142          90 :         : SfxInt16Item( RES_GRFATR_CONTRAST, nVal )
     143          90 :     {}
     144             : 
     145             :     // pure virtual methods from SfxInt16Item
     146             :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     147             :     virtual bool GetPresentation( SfxItemPresentation ePres,
     148             :                                     SfxMapUnit eCoreMetric,
     149             :                                     SfxMapUnit ePresMetric,
     150             :                                     OUString &rText,
     151             :                                     const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
     152             : };
     153             : 
     154         918 : class SwChannelGrf : public SfxInt16Item
     155             : {
     156             : protected:
     157         270 :     SwChannelGrf( sal_Int16 nVal, sal_uInt16 nWhichL )
     158         270 :         : SfxInt16Item( nWhichL, nVal )
     159         270 :     {}
     160             : 
     161             : public:
     162             :     // pure virtual methods from SfxInt16Item
     163             :     virtual bool GetPresentation( SfxItemPresentation ePres,
     164             :                                     SfxMapUnit eCoreMetric,
     165             :                                     SfxMapUnit ePresMetric,
     166             :                                     OUString &rText,
     167             :                                     const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
     168             : };
     169             : 
     170         504 : class SwChannelRGrf : public SwChannelGrf
     171             : {
     172             : public:
     173          90 :     SwChannelRGrf( sal_Int16 nVal = 0 )
     174          90 :         : SwChannelGrf( nVal, RES_GRFATR_CHANNELR )
     175          90 :     {}
     176             :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     177             : };
     178         504 : class SwChannelGGrf : public SwChannelGrf
     179             : {
     180             : public:
     181          90 :     SwChannelGGrf( sal_Int16 nVal = 0 )
     182          90 :         : SwChannelGrf( nVal, RES_GRFATR_CHANNELG )
     183          90 :     {}
     184             :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     185             : };
     186         504 : class SwChannelBGrf : public SwChannelGrf
     187             : {
     188             : public:
     189          90 :     SwChannelBGrf( sal_Int16 nVal = 0 )
     190          90 :         : SwChannelGrf( nVal, RES_GRFATR_CHANNELB )
     191          90 :     {}
     192             :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     193             : };
     194             : 
     195         714 : class SW_DLLPUBLIC SwGammaGrf : public SfxPoolItem
     196             : {
     197             :     double nValue;
     198             : public:
     199             :     TYPEINFO_OVERRIDE();
     200          90 :     SwGammaGrf() : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( 1.0 )
     201          90 :     {}
     202             : 
     203          36 :     SwGammaGrf( const double& rVal )
     204          36 :         : SfxPoolItem( RES_GRFATR_GAMMA ), nValue( rVal )
     205          36 :     {}
     206             : 
     207             :     inline SwGammaGrf& operator=( const SwGammaGrf& rCopy )
     208             :         {
     209             :             SetValue( rCopy.GetValue() );
     210             :             return *this;
     211             :         }
     212             : 
     213             :     // pure virtual methods from SfxEnumItem
     214             :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     215             :     virtual bool            operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
     216             :     virtual bool GetPresentation( SfxItemPresentation ePres,
     217             :                                     SfxMapUnit eCoreMetric,
     218             :                                     SfxMapUnit ePresMetric,
     219             :                                     OUString &rText,
     220             :                                     const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
     221             : 
     222             :     virtual bool             QueryValue( com::sun::star::uno::Any& rVal,
     223             :                                             sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
     224             :     virtual bool             PutValue( const com::sun::star::uno::Any& rVal,
     225             :                                             sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
     226             : 
     227         270 :     const double& GetValue() const              { return nValue; }
     228             :     void SetValue( const double& rVal )         { nValue = rVal; }
     229             : };
     230             : 
     231         504 : class SwInvertGrf: public SfxBoolItem
     232             : {
     233             : public:
     234          90 :     SwInvertGrf( bool bVal = false )
     235          90 :         : SfxBoolItem( RES_GRFATR_INVERT, bVal )
     236          90 :     {}
     237             : 
     238             :     // pure virtual methods from SfxInt16Item
     239             :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     240             :     virtual bool GetPresentation( SfxItemPresentation ePres,
     241             :                                     SfxMapUnit eCoreMetric,
     242             :                                     SfxMapUnit ePresMetric,
     243             :                                     OUString &rText,
     244             :                                     const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
     245             : };
     246             : 
     247         504 : class SwTransparencyGrf : public SfxByteItem
     248             : {
     249             : public:
     250          90 :     SwTransparencyGrf( sal_Int8 nVal = 0 )
     251          90 :         : SfxByteItem( RES_GRFATR_TRANSPARENCY, nVal )
     252          90 :     {}
     253             : 
     254             :     // pure virtual methods from SfxInt16Item
     255             :     virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     256             :     virtual bool GetPresentation( SfxItemPresentation ePres,
     257             :                                     SfxMapUnit eCoreMetric,
     258             :                                     SfxMapUnit ePresMetric,
     259             :                                     OUString &rText,
     260             :                                     const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
     261             :     virtual bool            QueryValue( com::sun::star::uno::Any& rVal,
     262             :                                         sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
     263             :     virtual bool            PutValue( const com::sun::star::uno::Any& rVal,
     264             :                                         sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
     265             : };
     266             : 
     267         522 : class SW_DLLPUBLIC SwDrawModeGrf : public SfxEnumItem
     268             : {
     269             : public:
     270          90 :     SwDrawModeGrf( sal_uInt16 nMode = 0 )
     271          90 :         : SfxEnumItem( RES_GRFATR_DRAWMODE, nMode )
     272          90 :     {}
     273             : 
     274             :     // pure virtual methods of SfxPoolItem
     275             :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     276             : 
     277             :     // pure virtual methods of SfxEnumItem
     278             :     virtual sal_uInt16          GetValueCount() const SAL_OVERRIDE;
     279             :     virtual bool GetPresentation( SfxItemPresentation ePres,
     280             :                                     SfxMapUnit eCoreMetric,
     281             :                                     SfxMapUnit ePresMetric,
     282             :                                     OUString &rText,
     283             :                                     const IntlWrapper*    pIntl = 0 ) const SAL_OVERRIDE;
     284             : 
     285             :     virtual bool            QueryValue( com::sun::star::uno::Any& rVal,
     286             :                                         sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
     287             :     virtual bool            PutValue( const com::sun::star::uno::Any& rVal,
     288             :                                         sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
     289             : };
     290             : 
     291             : // Implementation of graphics attributes methods of SwAttr
     292         246 : inline const SwMirrorGrf &SwAttrSet::GetMirrorGrf(bool bInP) const
     293         246 :     { return (const SwMirrorGrf&)Get( RES_GRFATR_MIRRORGRF,bInP); }
     294         202 : inline const SwCropGrf   &SwAttrSet::GetCropGrf(bool bInP) const
     295         202 :     { return (const SwCropGrf&)Get( RES_GRFATR_CROPGRF,bInP); }
     296         190 : inline const SwRotationGrf &SwAttrSet::GetRotationGrf(bool bInP) const
     297         190 :     { return (const SwRotationGrf&)Get( RES_GRFATR_ROTATION,bInP); }
     298         190 : inline const SwLuminanceGrf &SwAttrSet::GetLuminanceGrf(bool bInP) const
     299         190 :     { return (const SwLuminanceGrf&)Get( RES_GRFATR_LUMINANCE,bInP); }
     300         190 : inline const SwContrastGrf &SwAttrSet::GetContrastGrf(bool bInP) const
     301         190 :     { return (const SwContrastGrf&)Get( RES_GRFATR_CONTRAST,bInP); }
     302         190 : inline const SwChannelRGrf &SwAttrSet::GetChannelRGrf(bool bInP) const
     303         190 :     { return (const SwChannelRGrf&)Get( RES_GRFATR_CHANNELR,bInP); }
     304         190 : inline const SwChannelGGrf &SwAttrSet::GetChannelGGrf(bool bInP) const
     305         190 :     { return (const SwChannelGGrf&)Get( RES_GRFATR_CHANNELG,bInP); }
     306         190 : inline const SwChannelBGrf &SwAttrSet::GetChannelBGrf(bool bInP) const
     307         190 :     { return (const SwChannelBGrf&)Get( RES_GRFATR_CHANNELB,bInP); }
     308         190 : inline const SwGammaGrf &SwAttrSet::GetGammaGrf(bool bInP) const
     309         190 :     { return (const SwGammaGrf&)Get( RES_GRFATR_GAMMA,bInP); }
     310         190 : inline const SwInvertGrf &SwAttrSet::GetInvertGrf(bool bInP) const
     311         190 :     { return (const SwInvertGrf&)Get( RES_GRFATR_INVERT,bInP); }
     312         232 : inline const SwTransparencyGrf &SwAttrSet::GetTransparencyGrf(bool bInP) const
     313         232 :     { return (const SwTransparencyGrf&)Get( RES_GRFATR_TRANSPARENCY,bInP); }
     314         190 : inline const SwDrawModeGrf      &SwAttrSet::GetDrawModeGrf(bool bInP) const
     315         190 :     { return (const SwDrawModeGrf&)Get( RES_GRFATR_DRAWMODE,bInP); }
     316             : 
     317             : // Implementation of graphics attributes methods of SwFmt
     318             : inline const SwMirrorGrf &SwFmt::GetMirrorGrf(bool bInP) const
     319             :     { return aSet.GetMirrorGrf(bInP); }
     320             : inline const SwCropGrf   &SwFmt::GetCropGrf(bool bInP) const
     321             :     { return aSet.GetCropGrf(bInP); }
     322             : inline const SwRotationGrf &SwFmt::GetRotationGrf(bool bInP) const
     323             :     { return aSet.GetRotationGrf(bInP); }
     324             : inline const SwLuminanceGrf &SwFmt::GetLuminanceGrf(bool bInP) const
     325             :     { return aSet.GetLuminanceGrf( bInP); }
     326             : inline const SwContrastGrf &SwFmt::GetContrastGrf(bool bInP) const
     327             :     { return aSet.GetContrastGrf( bInP); }
     328             : inline const SwChannelRGrf &SwFmt::GetChannelRGrf(bool bInP) const
     329             :     { return aSet.GetChannelRGrf( bInP); }
     330             : inline const SwChannelGGrf &SwFmt::GetChannelGGrf(bool bInP) const
     331             :     { return aSet.GetChannelGGrf( bInP); }
     332             : inline const SwChannelBGrf &SwFmt::GetChannelBGrf(bool bInP) const
     333             :     { return aSet.GetChannelBGrf( bInP); }
     334             : inline const SwGammaGrf &SwFmt::GetGammaGrf(bool bInP) const
     335             :     { return aSet.GetGammaGrf( bInP); }
     336             : inline const SwInvertGrf &SwFmt::GetInvertGrf(bool bInP) const
     337             :     { return aSet.GetInvertGrf( bInP); }
     338             : inline const SwTransparencyGrf &SwFmt::GetTransparencyGrf(bool bInP) const
     339             :     { return aSet.GetTransparencyGrf( bInP); }
     340             : inline const SwDrawModeGrf &SwFmt::GetDrawModeGrf(bool bInP) const
     341             :     { return aSet.GetDrawModeGrf(bInP); }
     342             : 
     343             : #endif // INCLUDED_SW_INC_GRFATR_HXX
     344             : 
     345             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10