LCOV - code coverage report
Current view: top level - svl/source/items - cntwall.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 43 0.0 %
Date: 2014-04-11 Functions: 0 17 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/debug.hxx>
      22             : #include <tools/stream.hxx>
      23             : #include <tools/vcompat.hxx>
      24             : 
      25             : #include <svl/cntwall.hxx>
      26             : 
      27             : #define CNTWALLPAPERITEM_STREAM_MAGIC   ( (sal_uInt32)0xfefefefe )
      28             : #define CNTWALLPAPERITEM_STREAM_SEEKREL (-( (long)( sizeof( sal_uInt32 ) ) ) )
      29             : 
      30           0 : TYPEINIT1( CntWallpaperItem, SfxPoolItem );
      31             : 
      32             : 
      33           0 : CntWallpaperItem::CntWallpaperItem( sal_uInt16 which )
      34           0 :     : SfxPoolItem( which ), _nColor( COL_TRANSPARENT ), _nStyle( 0 )
      35             : {
      36           0 : }
      37             : 
      38             : 
      39           0 : CntWallpaperItem::CntWallpaperItem( sal_uInt16 which, SvStream& rStream, sal_uInt16 nVersion )
      40           0 :     : SfxPoolItem( which ), _nColor( COL_TRANSPARENT ), _nStyle( 0 )
      41             : {
      42           0 :     sal_uInt32 nMagic = 0;
      43           0 :     rStream.ReadUInt32( nMagic );
      44           0 :     if ( nMagic == CNTWALLPAPERITEM_STREAM_MAGIC )
      45             :     {
      46             :         // Okay, data were stored by CntWallpaperItem.
      47             : 
      48           0 :         _aURL = readUnicodeString(rStream, nVersion >= 1);
      49             :         // !!! Color stream operators do not work - they discard any
      50             :         // transparency info !!!
      51           0 :         _nColor.Read( rStream, true );
      52           0 :         rStream.ReadUInt16( _nStyle );
      53             :     }
      54             :     else
      55             :     {
      56           0 :         rStream.SeekRel( CNTWALLPAPERITEM_STREAM_SEEKREL );
      57             : 
      58             :         // Data were stored by SfxWallpaperItem ( SO < 6.0 ). The only
      59             :         // thing we can do here is to get the URL and to position the stream.
      60             : 
      61             :         {
      62             :             // "Read" Wallpaper member - The version compat object positions
      63             :             // the stream after the wallpaper data in its dtor. We must use
      64             :             // this trick here as no VCL must be used here ( No Wallpaper
      65             :             // object allowed ).
      66           0 :             VersionCompat aCompat( rStream, STREAM_READ );
      67             :         }
      68             : 
      69             :         // Read SfxWallpaperItem's string member _aURL.
      70           0 :         _aURL = readUnicodeString(rStream, false);
      71             : 
      72             :         // "Read" SfxWallpaperItem's string member _aFilter.
      73           0 :         read_uInt16_lenPrefixed_uInt8s_ToOString(rStream);
      74             :     }
      75           0 : }
      76             : 
      77             : 
      78           0 : CntWallpaperItem::CntWallpaperItem( const CntWallpaperItem& rItem ) :
      79             :     SfxPoolItem( rItem ),
      80             :     _aURL( rItem._aURL ),
      81             :     _nColor( rItem._nColor ),
      82           0 :     _nStyle( rItem._nStyle )
      83             : {
      84           0 : }
      85             : 
      86             : 
      87           0 : CntWallpaperItem::~CntWallpaperItem()
      88             : {
      89           0 : }
      90             : 
      91             : 
      92           0 : bool CntWallpaperItem::operator==( const SfxPoolItem& rItem ) const
      93             : {
      94             :     DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
      95             : 
      96           0 :     const CntWallpaperItem& rWallItem = (const CntWallpaperItem&)rItem;
      97             : 
      98           0 :     return ( rWallItem._nStyle == _nStyle ) &&
      99           0 :         ( rWallItem._nColor == _nColor ) &&
     100           0 :         ( rWallItem._aURL == _aURL );
     101             : }
     102             : 
     103             : // virtual
     104           0 : sal_uInt16 CntWallpaperItem::GetVersion(sal_uInt16) const
     105             : {
     106           0 :     return 1; // because it uses SfxPoolItem::read/writeUnicodeString()
     107             : }
     108             : 
     109             : 
     110           0 : SfxPoolItem* CntWallpaperItem::Create( SvStream& rStream, sal_uInt16 nVersion) const
     111             : {
     112           0 :     return new CntWallpaperItem( Which(), rStream, nVersion );
     113             : }
     114             : 
     115             : 
     116           0 : SvStream& CntWallpaperItem::Store( SvStream& rStream, sal_uInt16 ) const
     117             : {
     118           0 :     rStream.WriteUInt32( CNTWALLPAPERITEM_STREAM_MAGIC );
     119           0 :     writeUnicodeString(rStream, _aURL);
     120             :     // !!! Color stream operators do not work - they discard any
     121             :     // transparency info !!!
     122             :     // ??? Why the hell Color::Write(...) isn't const ???
     123           0 :     (const_cast< CntWallpaperItem* >(this))->_nColor.Write( rStream, true );
     124           0 :     rStream.WriteUInt16( _nStyle );
     125             : 
     126           0 :     return rStream;
     127             : }
     128             : 
     129             : 
     130           0 : SfxPoolItem* CntWallpaperItem::Clone( SfxItemPool* ) const
     131             : {
     132           0 :     return new CntWallpaperItem( *this );
     133             : }
     134             : 
     135             : // virtual
     136           0 : bool CntWallpaperItem::QueryValue( com::sun::star::uno::Any&, sal_uInt8) const
     137             : {
     138             :     OSL_FAIL("Not implemented!");
     139           0 :     return false;
     140             : }
     141             : 
     142             : // virtual
     143           0 : bool CntWallpaperItem::PutValue( const com::sun::star::uno::Any&, sal_uInt8)
     144             : {
     145             :     OSL_FAIL("Not implemented!");
     146           0 :     return false;
     147             : }
     148             : 
     149             : 
     150             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10