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

Generated by: LCOV version 1.10