LCOV - code coverage report
Current view: top level - svtools/source/graphic - grfattr.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 48 0.0 %
Date: 2014-04-14 Functions: 0 5 0.0 %
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             : 
      20             : 
      21             : #include <tools/vcompat.hxx>
      22             : #include <svtools/grfmgr.hxx>
      23             : 
      24             : 
      25             : // - GraphicAttr -
      26             : 
      27             : 
      28           0 : GraphicAttr::GraphicAttr() :
      29             :     mfGamma         ( 1.0 ),
      30             :     mnMirrFlags     ( 0 ),
      31             :     mnLeftCrop      ( 0 ),
      32             :     mnTopCrop       ( 0 ),
      33             :     mnRightCrop     ( 0 ),
      34             :     mnBottomCrop    ( 0 ),
      35             :     mnRotate10      ( 0 ),
      36             :     mnContPercent   ( 0 ),
      37             :     mnLumPercent    ( 0 ),
      38             :     mnRPercent      ( 0 ),
      39             :     mnGPercent      ( 0 ),
      40             :     mnBPercent      ( 0 ),
      41             :     mbInvert        ( false ),
      42             :     mcTransparency  ( 0 ),
      43           0 :     meDrawMode      ( GRAPHICDRAWMODE_STANDARD )
      44             : {
      45           0 : }
      46             : 
      47             : 
      48             : 
      49           0 : GraphicAttr::~GraphicAttr()
      50             : {
      51           0 : }
      52             : 
      53             : 
      54             : 
      55           0 : bool GraphicAttr::operator==( const GraphicAttr& rAttr ) const
      56             : {
      57           0 :     return( ( mfGamma == rAttr.mfGamma ) &&
      58           0 :             ( mnMirrFlags == rAttr.mnMirrFlags ) &&
      59           0 :             ( mnLeftCrop == rAttr.mnLeftCrop ) &&
      60           0 :             ( mnTopCrop == rAttr.mnTopCrop ) &&
      61           0 :             ( mnRightCrop == rAttr.mnRightCrop ) &&
      62           0 :             ( mnBottomCrop == rAttr.mnBottomCrop ) &&
      63           0 :             ( mnRotate10 == rAttr.mnRotate10 ) &&
      64           0 :             ( mnContPercent == rAttr.mnContPercent ) &&
      65           0 :             ( mnLumPercent == rAttr.mnLumPercent ) &&
      66           0 :             ( mnRPercent == rAttr.mnRPercent ) &&
      67           0 :             ( mnGPercent == rAttr.mnGPercent ) &&
      68           0 :             ( mnBPercent == rAttr.mnBPercent ) &&
      69           0 :             ( mbInvert == rAttr.mbInvert ) &&
      70           0 :             ( mcTransparency == rAttr.mcTransparency ) &&
      71           0 :             ( meDrawMode == rAttr.meDrawMode ) );
      72             : }
      73             : 
      74             : 
      75             : 
      76           0 : SvStream& ReadGraphicAttr( SvStream& rIStm, GraphicAttr& rAttr )
      77             : {
      78           0 :     VersionCompat   aCompat( rIStm, STREAM_READ );
      79             :     sal_uInt32      nTmp32;
      80             :     sal_uInt16          nTmp16;
      81             : 
      82           0 :     rIStm.ReadUInt32( nTmp32 ).ReadUInt32( nTmp32 ).ReadDouble( rAttr.mfGamma ).ReadUInt32( rAttr.mnMirrFlags ).ReadUInt16( rAttr.mnRotate10 );
      83           0 :     rIStm.ReadInt16( rAttr.mnContPercent ).ReadInt16( rAttr.mnLumPercent ).ReadInt16( rAttr.mnRPercent ).ReadInt16( rAttr.mnGPercent ).ReadInt16( rAttr.mnBPercent );
      84           0 :     rIStm.ReadCharAsBool( rAttr.mbInvert ).ReadUChar( rAttr.mcTransparency ).ReadUInt16( nTmp16 );
      85           0 :     rAttr.meDrawMode = (GraphicDrawMode) nTmp16;
      86             : 
      87           0 :     if( aCompat.GetVersion() >= 2 )
      88             :     {
      89             :         //#fdo39428 SvStream no longer supports operator>>(long&)
      90           0 :         sal_Int32 nTmpL(0), nTmpT(0), nTmpR(0), nTmpB(0);
      91           0 :         rIStm.ReadInt32( nTmpL ).ReadInt32( nTmpT ).ReadInt32( nTmpR ).ReadInt32( nTmpB );
      92           0 :         rAttr.mnLeftCrop = nTmpL;
      93           0 :         rAttr.mnTopCrop = nTmpT;
      94           0 :         rAttr.mnRightCrop = nTmpR;
      95           0 :         rAttr.mnBottomCrop = nTmpB;
      96             :     }
      97             : 
      98           0 :     return rIStm;
      99             : }
     100             : 
     101             : 
     102             : 
     103           0 : SvStream& WriteGraphicAttr( SvStream& rOStm, const GraphicAttr& rAttr )
     104             : {
     105           0 :     VersionCompat       aCompat( rOStm, STREAM_WRITE, 2 );
     106           0 :     const sal_uInt32    nTmp32 = 0;
     107             : 
     108           0 :     rOStm.WriteUInt32( nTmp32 ).WriteUInt32( nTmp32 );
     109           0 :     rOStm.WriteDouble( rAttr.mfGamma );
     110           0 :     rOStm.WriteUInt32( rAttr.mnMirrFlags ).WriteUInt16( rAttr.mnRotate10 );
     111           0 :     rOStm.WriteInt16( rAttr.mnContPercent ).WriteInt16( rAttr.mnLumPercent ).WriteInt16( rAttr.mnRPercent ).WriteInt16( rAttr.mnGPercent ).WriteInt16( rAttr.mnBPercent );
     112           0 :     rOStm.WriteUChar( rAttr.mbInvert ).WriteUChar( rAttr.mcTransparency ).WriteUInt16( (sal_uInt16) rAttr.meDrawMode );
     113             :     //#fdo39428 SvStream no longer supports operator<<(long)
     114           0 :     rOStm.WriteInt32( sal::static_int_cast<sal_Int32>(rAttr.mnLeftCrop) )
     115           0 :          .WriteInt32( sal::static_int_cast<sal_Int32>(rAttr.mnTopCrop) )
     116           0 :          .WriteInt32( sal::static_int_cast<sal_Int32>(rAttr.mnRightCrop) )
     117           0 :          .WriteInt32( sal::static_int_cast<sal_Int32>(rAttr.mnBottomCrop) );
     118             : 
     119           0 :     return rOStm;
     120             : }
     121             : 
     122             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10