LCOV - code coverage report
Current view: top level - libreoffice/svtools/source/graphic - grfattr.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 32 21.9 %
Date: 2012-12-27 Functions: 3 5 60.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        1392 : 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        ( sal_False ),
      42             :     mcTransparency  ( 0 ),
      43        1392 :     meDrawMode      ( GRAPHICDRAWMODE_STANDARD )
      44             : {
      45        1392 : }
      46             : 
      47             : // ------------------------------------------------------------------------
      48             : 
      49        1356 : GraphicAttr::~GraphicAttr()
      50             : {
      51        1356 : }
      52             : 
      53             : // ------------------------------------------------------------------------
      54             : 
      55          55 : sal_Bool GraphicAttr::operator==( const GraphicAttr& rAttr ) const
      56             : {
      57             :     return( ( mfGamma == rAttr.mfGamma ) &&
      58             :             ( mnMirrFlags == rAttr.mnMirrFlags ) &&
      59             :             ( mnLeftCrop == rAttr.mnLeftCrop ) &&
      60             :             ( mnTopCrop == rAttr.mnTopCrop ) &&
      61             :             ( mnRightCrop == rAttr.mnRightCrop ) &&
      62             :             ( mnBottomCrop == rAttr.mnBottomCrop ) &&
      63             :             ( mnRotate10 == rAttr.mnRotate10 ) &&
      64             :             ( mnContPercent == rAttr.mnContPercent ) &&
      65             :             ( mnLumPercent == rAttr.mnLumPercent ) &&
      66             :             ( mnRPercent == rAttr.mnRPercent ) &&
      67             :             ( mnGPercent == rAttr.mnGPercent ) &&
      68             :             ( mnBPercent == rAttr.mnBPercent ) &&
      69             :             ( mbInvert == rAttr.mbInvert ) &&
      70             :             ( mcTransparency == rAttr.mcTransparency ) &&
      71          55 :             ( meDrawMode == rAttr.meDrawMode ) );
      72             : }
      73             : 
      74             : // ------------------------------------------------------------------------
      75             : 
      76           0 : SvStream& operator>>( SvStream& rIStm, GraphicAttr& rAttr )
      77             : {
      78           0 :     VersionCompat   aCompat( rIStm, STREAM_READ );
      79             :     sal_uInt32      nTmp32;
      80             :     sal_uInt16          nTmp16;
      81             : 
      82           0 :     rIStm >> nTmp32 >> nTmp32 >> rAttr.mfGamma >> rAttr.mnMirrFlags >> rAttr.mnRotate10;
      83           0 :     rIStm >> rAttr.mnContPercent >> rAttr.mnLumPercent >> rAttr.mnRPercent >> rAttr.mnGPercent >> rAttr.mnBPercent;
      84           0 :     rIStm >> rAttr.mbInvert >> rAttr.mcTransparency >> 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 >> nTmpL >> nTmpT >> nTmpR >> 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& operator<<( 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 << nTmp32 << nTmp32 << rAttr.mfGamma << rAttr.mnMirrFlags << rAttr.mnRotate10;
     109           0 :     rOStm << rAttr.mnContPercent << rAttr.mnLumPercent << rAttr.mnRPercent << rAttr.mnGPercent << rAttr.mnBPercent;
     110           0 :     rOStm << rAttr.mbInvert << rAttr.mcTransparency << (sal_uInt16) rAttr.meDrawMode;
     111             :     //#fdo39428 SvStream no longer supports operator<<(long)
     112           0 :     rOStm << sal::static_int_cast<sal_Int32>(rAttr.mnLeftCrop)
     113           0 :           << sal::static_int_cast<sal_Int32>(rAttr.mnTopCrop)
     114           0 :           << sal::static_int_cast<sal_Int32>(rAttr.mnRightCrop)
     115           0 :           << sal::static_int_cast<sal_Int32>(rAttr.mnBottomCrop);
     116             : 
     117           0 :     return rOStm;
     118             : }
     119             : 
     120             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10