LCOV - code coverage report
Current view: top level - chart2/source/controller/chartapiwrapper - WrappedSceneProperty.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 34 37 91.9 %
Date: 2014-04-11 Functions: 6 7 85.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 "WrappedSceneProperty.hxx"
      21             : #include "macros.hxx"
      22             : #include "DiagramHelper.hxx"
      23             : #include "servicenames_charttypes.hxx"
      24             : #include "BaseGFXHelper.hxx"
      25             : 
      26             : using namespace ::com::sun::star;
      27             : using ::com::sun::star::uno::Any;
      28             : using ::com::sun::star::uno::Reference;
      29             : using ::com::sun::star::uno::Sequence;
      30             : 
      31             : namespace chart
      32             : {
      33             : namespace wrapper
      34             : {
      35             : 
      36         204 : void WrappedSceneProperty::addWrappedProperties( std::vector< WrappedProperty* >& rList
      37             :                 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
      38             : {
      39         204 :     rList.push_back( new WrappedD3DTransformMatrixProperty( spChart2ModelContact ) );
      40         204 : }
      41             : 
      42         204 : WrappedD3DTransformMatrixProperty::WrappedD3DTransformMatrixProperty(
      43             :             ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
      44             :             : WrappedProperty("D3DTransformMatrix","D3DTransformMatrix")
      45         204 :             , m_spChart2ModelContact( spChart2ModelContact )
      46             : {
      47         204 : }
      48             : 
      49         396 : WrappedD3DTransformMatrixProperty::~WrappedD3DTransformMatrixProperty()
      50             : {
      51         396 : }
      52             : 
      53          27 : void WrappedD3DTransformMatrixProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
      54             :                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
      55             : {
      56          27 :     if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact->getChart2Diagram() ) )
      57             :     {
      58           4 :         drawing::HomogenMatrix aHM;
      59           4 :         if( rOuterValue >>= aHM )
      60             :         {
      61             :             ::basegfx::B3DTuple aRotation( BaseGFXHelper::GetRotationFromMatrix(
      62           4 :                 BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHM ) ) );
      63             : 
      64           8 :             ::basegfx::B3DHomMatrix aMatrix;
      65           4 :             aMatrix.rotate( aRotation.getX(), aRotation.getY(), aRotation.getZ() );
      66           8 :             ::basegfx::B3DHomMatrix aObjectMatrix;
      67           8 :             ::basegfx::B3DHomMatrix aNewMatrix = aMatrix*aObjectMatrix;
      68             : 
      69           4 :             aHM = BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aNewMatrix);
      70             : 
      71           4 :             WrappedProperty::setPropertyValue( uno::makeAny(aHM), xInnerPropertySet );
      72          35 :             return;
      73             :         }
      74             :     }
      75             : 
      76          23 :     WrappedProperty::setPropertyValue( rOuterValue, xInnerPropertySet );
      77             : }
      78             : 
      79          87 : Any WrappedD3DTransformMatrixProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
      80             :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
      81             : {
      82          87 :     if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact->getChart2Diagram() ) )
      83             :     {
      84          18 :         uno::Any aAMatrix( WrappedProperty::getPropertyValue( xInnerPropertySet ) );
      85          18 :         drawing::HomogenMatrix aHM;
      86          18 :         if( aAMatrix >>= aHM )
      87             :         {
      88             :             ::basegfx::B3DTuple aRotation( BaseGFXHelper::GetRotationFromMatrix(
      89          18 :                 BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHM ) ) );
      90             : 
      91          36 :             ::basegfx::B3DHomMatrix aMatrix;
      92          18 :             aMatrix.rotate( aRotation.getX(), aRotation.getY(), aRotation.getZ() );
      93          36 :             ::basegfx::B3DHomMatrix aObjectMatrix;
      94          36 :             ::basegfx::B3DHomMatrix aNewMatrix = aMatrix*aObjectMatrix;
      95             : 
      96          18 :             aHM = BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aNewMatrix);
      97             : 
      98          36 :             return uno::makeAny(aHM);
      99           0 :         }
     100             :     }
     101             : 
     102          69 :     return WrappedProperty::getPropertyValue( xInnerPropertySet );
     103             : }
     104             : 
     105           0 : Any WrappedD3DTransformMatrixProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
     106             :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     107             : {
     108           0 :     return WrappedProperty::getPropertyDefault( xInnerPropertyState );
     109             : }
     110             : 
     111             : } //namespace wrapper
     112             : } //namespace chart
     113             : 
     114             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10