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

Generated by: LCOV version 1.10