LCOV - code coverage report
Current view: top level - svx/source/items - e3ditem.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 20 43 46.5 %
Date: 2015-06-13 12:38:46 Functions: 11 17 64.7 %
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             : #include <com/sun/star/drawing/Direction3D.hpp>
      21             : #include <tools/stream.hxx>
      22             : 
      23             : #include <svx/e3ditem.hxx>
      24             : 
      25             : using namespace ::com::sun::star;
      26             : 
      27      128880 : TYPEINIT1_FACTORY(SvxB3DVectorItem, SfxPoolItem, new SvxB3DVectorItem);
      28             : 
      29             : 
      30             : 
      31           0 : SvxB3DVectorItem::SvxB3DVectorItem()
      32             : {
      33           0 : }
      34             : 
      35       76946 : SvxB3DVectorItem::~SvxB3DVectorItem()
      36             : {
      37       76946 : }
      38             : 
      39             : 
      40             : 
      41       38512 : SvxB3DVectorItem::SvxB3DVectorItem( sal_uInt16 _nWhich, const basegfx::B3DVector& rVal ) :
      42             :     SfxPoolItem( _nWhich ),
      43       38512 :     aVal( rVal )
      44             : {
      45       38512 : }
      46             : 
      47             : 
      48             : 
      49        1009 : SvxB3DVectorItem::SvxB3DVectorItem( const SvxB3DVectorItem& rItem ) :
      50             :     SfxPoolItem( rItem ),
      51        1009 :     aVal( rItem.aVal )
      52             : {
      53        1009 : }
      54             : 
      55             : 
      56             : 
      57         537 : bool SvxB3DVectorItem::operator==( const SfxPoolItem &rItem ) const
      58             : {
      59             :     DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
      60         537 :     return static_cast<const SvxB3DVectorItem&>(rItem).aVal == aVal;
      61             : }
      62             : 
      63             : 
      64             : 
      65        1009 : SfxPoolItem* SvxB3DVectorItem::Clone( SfxItemPool* /*pPool*/ ) const
      66             : {
      67        1009 :     return new SvxB3DVectorItem( *this );
      68             : }
      69             : 
      70             : 
      71             : 
      72           0 : SfxPoolItem* SvxB3DVectorItem::Create(SvStream &rStream, sal_uInt16 /*nVersion*/) const
      73             : {
      74           0 :     basegfx::B3DVector aStr;
      75             :     double fValue;
      76           0 :     rStream.ReadDouble( fValue ); aStr.setX(fValue);
      77           0 :     rStream.ReadDouble( fValue ); aStr.setY(fValue);
      78           0 :     rStream.ReadDouble( fValue ); aStr.setZ(fValue);
      79           0 :     return new SvxB3DVectorItem(Which(), aStr);
      80             : }
      81             : 
      82             : 
      83             : 
      84           0 : SvStream& SvxB3DVectorItem::Store(SvStream &rStream, sal_uInt16 /*nItemVersion*/) const
      85             : {
      86             : 
      87             :     // ## if (nItemVersion)
      88             :     double fValue;
      89           0 :     fValue = aVal.getX(); rStream.WriteDouble( fValue );
      90           0 :     fValue = aVal.getY(); rStream.WriteDouble( fValue );
      91           0 :     fValue = aVal.getZ(); rStream.WriteDouble( fValue );
      92             : 
      93           0 :     return rStream;
      94             : }
      95             : 
      96             : 
      97             : 
      98           0 : bool SvxB3DVectorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
      99             : {
     100           0 :     drawing::Direction3D aDirection;
     101             : 
     102             :     // Werte eintragen
     103           0 :     aDirection.DirectionX = aVal.getX();
     104           0 :     aDirection.DirectionY = aVal.getY();
     105           0 :     aDirection.DirectionZ = aVal.getZ();
     106             : 
     107           0 :     rVal <<= aDirection;
     108           0 :     return true;
     109             : }
     110             : 
     111             : 
     112             : 
     113         440 : bool SvxB3DVectorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
     114             : {
     115         440 :     drawing::Direction3D aDirection;
     116         440 :     if(!(rVal >>= aDirection))
     117           0 :         return false;
     118             : 
     119         440 :     aVal.setX(aDirection.DirectionX);
     120         440 :     aVal.setY(aDirection.DirectionY);
     121         440 :     aVal.setZ(aDirection.DirectionZ);
     122         440 :     return true;
     123             : }
     124             : 
     125             : 
     126             : 
     127           0 : sal_uInt16 SvxB3DVectorItem::GetVersion (sal_uInt16 nFileFormatVersion) const
     128             : {
     129           0 :     return (nFileFormatVersion == SOFFICE_FILEFORMAT_31) ? USHRT_MAX : 0;
     130             : }
     131             : 
     132             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11