LCOV - code coverage report
Current view: top level - chart2/source/tools - WrappedDefaultProperty.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 12 20 60.0 %
Date: 2014-11-03 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        2516 : WrappedDefaultProperty::WrappedDefaultProperty(
      32             :     const OUString& rOuterName, const OUString& rInnerName,
      33             :     const uno::Any& rNewOuterDefault ) :
      34             :         WrappedProperty( rOuterName, rInnerName ),
      35        2516 :         m_aOuterDefaultValue( rNewOuterDefault )
      36        2516 : {}
      37             : 
      38        2956 : WrappedDefaultProperty::~WrappedDefaultProperty()
      39        2956 : {}
      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        6524 : beans::PropertyState WrappedDefaultProperty::getPropertyState(
      61             :     const Reference< beans::XPropertyState >& xInnerPropertyState ) const
      62             :     throw (beans::UnknownPropertyException,
      63             :            uno::RuntimeException)
      64             : {
      65        6524 :     beans::PropertyState aState = beans::PropertyState_DIRECT_VALUE;
      66             :     try
      67             :     {
      68        6524 :         Reference< beans::XPropertySet > xInnerProp( xInnerPropertyState, uno::UNO_QUERY_THROW );
      69       13048 :         uno::Any aValue = this->getPropertyValue( xInnerProp );
      70        6524 :         if( m_aOuterDefaultValue == this->convertInnerToOuterValue( aValue ))
      71        7236 :             aState = beans::PropertyState_DEFAULT_VALUE;
      72             :     }
      73           0 :     catch( const beans::UnknownPropertyException& ex )
      74             :     {
      75             :         ASSERT_EXCEPTION( ex );
      76             :     }
      77        6524 :     return aState;
      78             : }
      79             : 
      80             : } //  namespace chart
      81             : 
      82             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10