LCOV - code coverage report
Current view: top level - svtools/source/graphic - grfattr.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 32 21.9 %
Date: 2012-08-25 Functions: 3 5 60.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 15 108 13.9 %

           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                 :            : 
      29                 :            : 
      30                 :            : #include <tools/vcompat.hxx>
      31                 :            : #include <svtools/grfmgr.hxx>
      32                 :            : 
      33                 :            : // ---------------
      34                 :            : // - GraphicAttr -
      35                 :            : // ---------------
      36                 :            : 
      37                 :      45834 : GraphicAttr::GraphicAttr() :
      38                 :            :     mfGamma         ( 1.0 ),
      39                 :            :     mnMirrFlags     ( 0 ),
      40                 :            :     mnLeftCrop      ( 0 ),
      41                 :            :     mnTopCrop       ( 0 ),
      42                 :            :     mnRightCrop     ( 0 ),
      43                 :            :     mnBottomCrop    ( 0 ),
      44                 :            :     mnRotate10      ( 0 ),
      45                 :            :     mnContPercent   ( 0 ),
      46                 :            :     mnLumPercent    ( 0 ),
      47                 :            :     mnRPercent      ( 0 ),
      48                 :            :     mnGPercent      ( 0 ),
      49                 :            :     mnBPercent      ( 0 ),
      50                 :            :     mbInvert        ( sal_False ),
      51                 :            :     mcTransparency  ( 0 ),
      52                 :      45834 :     meDrawMode      ( GRAPHICDRAWMODE_STANDARD )
      53                 :            : {
      54                 :      45834 : }
      55                 :            : 
      56                 :            : // ------------------------------------------------------------------------
      57                 :            : 
      58                 :      82196 : GraphicAttr::~GraphicAttr()
      59                 :            : {
      60                 :      82196 : }
      61                 :            : 
      62                 :            : // ------------------------------------------------------------------------
      63                 :            : 
      64                 :         63 : sal_Bool GraphicAttr::operator==( const GraphicAttr& rAttr ) const
      65                 :            : {
      66                 :            :     return( ( mfGamma == rAttr.mfGamma ) &&
      67                 :            :             ( mnMirrFlags == rAttr.mnMirrFlags ) &&
      68                 :            :             ( mnLeftCrop == rAttr.mnLeftCrop ) &&
      69                 :            :             ( mnTopCrop == rAttr.mnTopCrop ) &&
      70                 :            :             ( mnRightCrop == rAttr.mnRightCrop ) &&
      71                 :            :             ( mnBottomCrop == rAttr.mnBottomCrop ) &&
      72                 :            :             ( mnRotate10 == rAttr.mnRotate10 ) &&
      73                 :            :             ( mnContPercent == rAttr.mnContPercent ) &&
      74                 :            :             ( mnLumPercent == rAttr.mnLumPercent ) &&
      75                 :            :             ( mnRPercent == rAttr.mnRPercent ) &&
      76                 :            :             ( mnGPercent == rAttr.mnGPercent ) &&
      77                 :            :             ( mnBPercent == rAttr.mnBPercent ) &&
      78                 :            :             ( mbInvert == rAttr.mbInvert ) &&
      79                 :            :             ( mcTransparency == rAttr.mcTransparency ) &&
      80 [ +  - ][ +  - ]:         63 :             ( meDrawMode == rAttr.meDrawMode ) );
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
      81                 :            : }
      82                 :            : 
      83                 :            : // ------------------------------------------------------------------------
      84                 :            : 
      85                 :          0 : SvStream& operator>>( SvStream& rIStm, GraphicAttr& rAttr )
      86                 :            : {
      87         [ #  # ]:          0 :     VersionCompat   aCompat( rIStm, STREAM_READ );
      88                 :            :     sal_uInt32      nTmp32;
      89                 :            :     sal_uInt16          nTmp16;
      90                 :            : 
      91 [ #  # ][ #  # ]:          0 :     rIStm >> nTmp32 >> nTmp32 >> rAttr.mfGamma >> rAttr.mnMirrFlags >> rAttr.mnRotate10;
         [ #  # ][ #  # ]
                 [ #  # ]
      92 [ #  # ][ #  # ]:          0 :     rIStm >> rAttr.mnContPercent >> rAttr.mnLumPercent >> rAttr.mnRPercent >> rAttr.mnGPercent >> rAttr.mnBPercent;
         [ #  # ][ #  # ]
                 [ #  # ]
      93 [ #  # ][ #  # ]:          0 :     rIStm >> rAttr.mbInvert >> rAttr.mcTransparency >> nTmp16;
                 [ #  # ]
      94                 :          0 :     rAttr.meDrawMode = (GraphicDrawMode) nTmp16;
      95                 :            : 
      96         [ #  # ]:          0 :     if( aCompat.GetVersion() >= 2 )
      97                 :            :     {
      98                 :            :         //#fdo39428 SvStream no longer supports operator>>(long&)
      99                 :          0 :         sal_Int32 nTmpL(0), nTmpT(0), nTmpR(0), nTmpB(0);
     100 [ #  # ][ #  # ]:          0 :         rIStm >> nTmpL >> nTmpT >> nTmpR >> nTmpB;
         [ #  # ][ #  # ]
     101                 :          0 :         rAttr.mnLeftCrop = nTmpL;
     102                 :          0 :         rAttr.mnTopCrop = nTmpT;
     103                 :          0 :         rAttr.mnRightCrop = nTmpR;
     104                 :          0 :         rAttr.mnBottomCrop = nTmpB;
     105                 :            :     }
     106                 :            : 
     107         [ #  # ]:          0 :     return rIStm;
     108                 :            : }
     109                 :            : 
     110                 :            : // ------------------------------------------------------------------------
     111                 :            : 
     112                 :          0 : SvStream& operator<<( SvStream& rOStm, const GraphicAttr& rAttr )
     113                 :            : {
     114         [ #  # ]:          0 :     VersionCompat       aCompat( rOStm, STREAM_WRITE, 2 );
     115                 :          0 :     const sal_uInt32    nTmp32 = 0;
     116                 :            : 
     117 [ #  # ][ #  # ]:          0 :     rOStm << nTmp32 << nTmp32 << rAttr.mfGamma << rAttr.mnMirrFlags << rAttr.mnRotate10;
         [ #  # ][ #  # ]
                 [ #  # ]
     118 [ #  # ][ #  # ]:          0 :     rOStm << rAttr.mnContPercent << rAttr.mnLumPercent << rAttr.mnRPercent << rAttr.mnGPercent << rAttr.mnBPercent;
         [ #  # ][ #  # ]
                 [ #  # ]
     119 [ #  # ][ #  # ]:          0 :     rOStm << rAttr.mbInvert << rAttr.mcTransparency << (sal_uInt16) rAttr.meDrawMode;
                 [ #  # ]
     120                 :            :     //#fdo39428 SvStream no longer supports operator<<(long)
     121         [ #  # ]:          0 :     rOStm << sal::static_int_cast<sal_Int32>(rAttr.mnLeftCrop)
     122         [ #  # ]:          0 :           << sal::static_int_cast<sal_Int32>(rAttr.mnTopCrop)
     123         [ #  # ]:          0 :           << sal::static_int_cast<sal_Int32>(rAttr.mnRightCrop)
     124         [ #  # ]:          0 :           << sal::static_int_cast<sal_Int32>(rAttr.mnBottomCrop);
     125                 :            : 
     126         [ #  # ]:          0 :     return rOStm;
     127                 :            : }
     128                 :            : 
     129                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10