LCOV - code coverage report
Current view: top level - chart2/source/tools - WrappedDefaultProperty.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 12 20 60.0 %
Date: 2015-06-13 12:38:46 Functions: 4 6 66.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 "WrappedDefaultProperty.hxx"
      21             : #include "macros.hxx"
      22             : 
      23             : using namespace ::com::sun::star;
      24             : 
      25             : using ::com::sun::star::uno::Reference;
      26             : using ::com::sun::star::uno::Sequence;
      27             : 
      28             : namespace chart
      29             : {
      30             : 
      31        1111 : WrappedDefaultProperty::WrappedDefaultProperty(
      32             :     const OUString& rOuterName, const OUString& rInnerName,
      33             :     const uno::Any& rNewOuterDefault ) :
      34             :         WrappedProperty( rOuterName, rInnerName ),
      35        1111 :         m_aOuterDefaultValue( rNewOuterDefault )
      36        1111 : {}
      37             : 
      38        1312 : WrappedDefaultProperty::~WrappedDefaultProperty()
      39        1312 : {}
      40             : 
      41           0 : void WrappedDefaultProperty::setPropertyToDefault(
      42             :     const Reference< beans::XPropertyState >& xInnerPropertyState ) const
      43             :     throw (beans::UnknownPropertyException,
      44             :            uno::RuntimeException)
      45             : {
      46           0 :     Reference< beans::XPropertySet > xInnerPropSet( xInnerPropertyState, uno::UNO_QUERY );
      47           0 :     if( xInnerPropSet.is())
      48           0 :         this->setPropertyValue( m_aOuterDefaultValue, xInnerPropSet );
      49           0 : }
      50             : 
      51           0 : uno::Any WrappedDefaultProperty::getPropertyDefault(
      52             :     const Reference< beans::XPropertyState >& /* xInnerPropertyState */ ) const
      53             :     throw (beans::UnknownPropertyException,
      54             :            lang::WrappedTargetException,
      55             :            uno::RuntimeException)
      56             : {
      57           0 :     return m_aOuterDefaultValue;
      58             : }
      59             : 
      60        3262 : beans::PropertyState WrappedDefaultProperty::getPropertyState(
      61             :     const Reference< beans::XPropertyState >& xInnerPropertyState ) const
      62             :     throw (beans::UnknownPropertyException,
      63             :            uno::RuntimeException)
      64             : {
      65        3262 :     beans::PropertyState aState = beans::PropertyState_DIRECT_VALUE;
      66             :     try
      67             :     {
      68        3262 :         Reference< beans::XPropertySet > xInnerProp( xInnerPropertyState, uno::UNO_QUERY_THROW );
      69        6524 :         uno::Any aValue = this->getPropertyValue( xInnerProp );
      70        3262 :         if( m_aOuterDefaultValue == this->convertInnerToOuterValue( aValue ))
      71        3630 :             aState = beans::PropertyState_DEFAULT_VALUE;
      72             :     }
      73           0 :     catch( const beans::UnknownPropertyException& ex )
      74             :     {
      75             :         ASSERT_EXCEPTION( ex );
      76             :     }
      77        3262 :     return aState;
      78             : }
      79             : 
      80             : } //  namespace chart
      81             : 
      82             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11