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

Generated by: LCOV version 1.11