LCOV - code coverage report
Current view: top level - chart2/source/controller/chartapiwrapper - WrappedSceneProperty.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 34 37 91.9 %
Date: 2015-06-13 12:38:46 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         307 : void WrappedSceneProperty::addWrappedProperties( std::vector< WrappedProperty* >& rList
      37             :                 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
      38             : {
      39         307 :     rList.push_back( new WrappedD3DTransformMatrixProperty( spChart2ModelContact ) );
      40         307 : }
      41             : 
      42         307 : WrappedD3DTransformMatrixProperty::WrappedD3DTransformMatrixProperty(
      43             :             ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
      44             :             : WrappedProperty("D3DTransformMatrix","D3DTransformMatrix")
      45         307 :             , m_spChart2ModelContact( spChart2ModelContact )
      46             : {
      47         307 : }
      48             : 
      49         614 : WrappedD3DTransformMatrixProperty::~WrappedD3DTransformMatrixProperty()
      50             : {
      51         614 : }
      52             : 
      53          14 : 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          14 :     if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact->getChart2Diagram() ) )
      57             :     {
      58           2 :         drawing::HomogenMatrix aHM;
      59           2 :         if( rOuterValue >>= aHM )
      60             :         {
      61             :             ::basegfx::B3DTuple aRotation( BaseGFXHelper::GetRotationFromMatrix(
      62           2 :                 BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHM ) ) );
      63             : 
      64           4 :             ::basegfx::B3DHomMatrix aMatrix;
      65           2 :             aMatrix.rotate( aRotation.getX(), aRotation.getY(), aRotation.getZ() );
      66           4 :             ::basegfx::B3DHomMatrix aObjectMatrix;
      67           4 :             ::basegfx::B3DHomMatrix aNewMatrix = aMatrix*aObjectMatrix;
      68             : 
      69           2 :             aHM = BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aNewMatrix);
      70             : 
      71           2 :             WrappedProperty::setPropertyValue( uno::makeAny(aHM), xInnerPropertySet );
      72          18 :             return;
      73             :         }
      74             :     }
      75             : 
      76          12 :     WrappedProperty::setPropertyValue( rOuterValue, xInnerPropertySet );
      77             : }
      78             : 
      79         102 : Any WrappedD3DTransformMatrixProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
      80             :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
      81             : {
      82         102 :     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          84 :     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.11