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

Generated by: LCOV version 1.10