LCOV - code coverage report
Current view: top level - chart2/source/controller/chartapiwrapper - WrappedCharacterHeightProperty.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 43 55 78.2 %
Date: 2014-04-11 Functions: 15 19 78.9 %
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 "WrappedCharacterHeightProperty.hxx"
      21             : #include "macros.hxx"
      22             : #include "RelativeSizeHelper.hxx"
      23             : #include "ReferenceSizePropertyProvider.hxx"
      24             : 
      25             : using namespace ::com::sun::star;
      26             : using ::com::sun::star::uno::Reference;
      27             : using ::com::sun::star::uno::Any;
      28             : 
      29             : namespace chart
      30             : {
      31             : namespace wrapper
      32             : {
      33        7386 : WrappedCharacterHeightProperty_Base::WrappedCharacterHeightProperty_Base(
      34             :                             const OUString& rOuterEqualsInnerName
      35             :                             , ReferenceSizePropertyProvider* pRefSizePropProvider )
      36             :                             : WrappedProperty( rOuterEqualsInnerName, rOuterEqualsInnerName )
      37        7386 :                            , m_pRefSizePropProvider( pRefSizePropProvider )
      38             : {
      39        7386 : }
      40        7359 : WrappedCharacterHeightProperty_Base::~WrappedCharacterHeightProperty_Base()
      41             : {
      42        7359 : }
      43             : 
      44        2462 : void WrappedCharacterHeightProperty::addWrappedProperties( std::vector< WrappedProperty* >& rList
      45             :             , ReferenceSizePropertyProvider* pRefSizePropProvider  )
      46             : {
      47        2462 :     rList.push_back( new WrappedCharacterHeightProperty( pRefSizePropProvider ) );
      48        2462 :     rList.push_back( new WrappedAsianCharacterHeightProperty( pRefSizePropProvider ) );
      49        2462 :     rList.push_back( new WrappedComplexCharacterHeightProperty( pRefSizePropProvider ) );
      50        2462 : }
      51             : 
      52        1585 : void WrappedCharacterHeightProperty_Base::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
      53             :                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
      54             : {
      55        1585 :     if(xInnerPropertySet.is())
      56             :     {
      57        1585 :         if( m_pRefSizePropProvider )
      58        1585 :             m_pRefSizePropProvider->updateReferenceSize();
      59        1585 :         xInnerPropertySet->setPropertyValue( m_aInnerName, rOuterValue );
      60             :     }
      61        1585 : }
      62             : 
      63       11368 : Any WrappedCharacterHeightProperty_Base::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
      64             :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
      65             : {
      66       11368 :     Any aRet;
      67       11368 :     if( xInnerPropertySet.is() )
      68             :     {
      69       11368 :         aRet = xInnerPropertySet->getPropertyValue( m_aInnerName );
      70       11368 :         float fHeight = 0;
      71       11368 :         if( aRet >>= fHeight )
      72             :         {
      73       11368 :             if( m_pRefSizePropProvider )
      74             :             {
      75       11368 :                 awt::Size aReferenceSize;
      76       11368 :                 if( m_pRefSizePropProvider->getReferenceSize() >>= aReferenceSize )
      77             :                 {
      78           0 :                     awt::Size aCurrentSize = m_pRefSizePropProvider->getCurrentSizeForReference();
      79           0 :                     aRet <<= static_cast< float >(
      80           0 :                             RelativeSizeHelper::calculate( fHeight, aReferenceSize, aCurrentSize ));
      81             :                 }
      82             :             }
      83             :         }
      84             :     }
      85       11368 :     return aRet;
      86             : }
      87             : 
      88           0 : Any WrappedCharacterHeightProperty_Base::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
      89             :                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
      90             : {
      91           0 :     Any aRet;
      92           0 :     if( xInnerPropertyState.is() )
      93             :     {
      94           0 :         aRet = xInnerPropertyState->getPropertyDefault( m_aInnerName );
      95             :     }
      96           0 :     return aRet;
      97             : }
      98             : 
      99        7026 : beans::PropertyState WrappedCharacterHeightProperty_Base::getPropertyState( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
     100             :                         throw (beans::UnknownPropertyException, uno::RuntimeException)
     101             : {
     102        7026 :     return beans::PropertyState_DIRECT_VALUE;
     103             : }
     104             : 
     105           0 : Any WrappedCharacterHeightProperty_Base::convertInnerToOuterValue( const Any& rInnerValue ) const
     106             : {
     107             :     OSL_FAIL("should not be used: WrappedCharacterHeightProperty_Base::convertInnerToOuterValue - check if you miss data");
     108           0 :     return rInnerValue;
     109             : }
     110           0 : Any WrappedCharacterHeightProperty_Base::convertOuterToInnerValue( const Any& rOuterValue ) const
     111             : {
     112             :     OSL_FAIL("should not be used: WrappedCharacterHeightProperty_Base::convertOuterToInnerValue - check if you miss data");
     113           0 :     return rOuterValue;
     114             : }
     115             : 
     116        2462 : WrappedCharacterHeightProperty::WrappedCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider )
     117        2462 :         : WrappedCharacterHeightProperty_Base( "CharHeight", pRefSizePropProvider )
     118             : {
     119        2462 : }
     120        4906 : WrappedCharacterHeightProperty::~WrappedCharacterHeightProperty()
     121             : {
     122        4906 : }
     123             : 
     124        2462 : WrappedAsianCharacterHeightProperty::WrappedAsianCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider )
     125        2462 :         : WrappedCharacterHeightProperty_Base( "CharHeightAsian", pRefSizePropProvider )
     126             : {
     127        2462 : }
     128        4906 : WrappedAsianCharacterHeightProperty::~WrappedAsianCharacterHeightProperty()
     129             : {
     130        4906 : }
     131             : 
     132        2462 : WrappedComplexCharacterHeightProperty::WrappedComplexCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider )
     133        2462 :         : WrappedCharacterHeightProperty_Base( "CharHeightComplex", pRefSizePropProvider )
     134             : {
     135        2462 : }
     136        4906 : WrappedComplexCharacterHeightProperty::~WrappedComplexCharacterHeightProperty()
     137             : {
     138        4906 : }
     139             : 
     140             : } //namespace wrapper
     141             : } //namespace chart
     142             : 
     143             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10