LCOV - code coverage report
Current view: top level - xmloff/source/chart - ColorPropertySet.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 47 0.0 %
Date: 2014-11-03 Functions: 0 20 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             : #include "ColorPropertySet.hxx"
      21             : 
      22             : #include <cppuhelper/implbase1.hxx>
      23             : 
      24             : using namespace ::com::sun::star;
      25             : using namespace ::com::sun::star::beans;
      26             : 
      27             : using ::com::sun::star::uno::Reference;
      28             : using ::com::sun::star::uno::Sequence;
      29             : using ::com::sun::star::uno::RuntimeException;
      30             : 
      31             : namespace
      32             : {
      33           0 : class lcl_ColorPropertySetInfo : public ::cppu::WeakImplHelper1<
      34             :         XPropertySetInfo  >
      35             : {
      36             : public:
      37             :     lcl_ColorPropertySetInfo( bool bFillColor );
      38             : 
      39             : protected:
      40             :     // ____ XPropertySetInfo ____
      41             :     virtual Sequence< Property > SAL_CALL getProperties()                throw (RuntimeException, std::exception) SAL_OVERRIDE;
      42             :     virtual Property SAL_CALL getPropertyByName( const OUString& aName ) throw (UnknownPropertyException, RuntimeException, std::exception) SAL_OVERRIDE;
      43             :     virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name )  throw (RuntimeException, std::exception) SAL_OVERRIDE;
      44             : 
      45             : private:
      46             :     OUString m_aColorPropName;
      47             :     Property m_aColorProp;
      48             : };
      49             : 
      50           0 : lcl_ColorPropertySetInfo::lcl_ColorPropertySetInfo( bool bFillColor ) :
      51             :         // note: length of FillColor and LineColor is 9
      52             :         m_aColorPropName( (bFillColor ? "FillColor" : "LineColor"), 9, RTL_TEXTENCODING_ASCII_US ),
      53             :         m_aColorProp( m_aColorPropName, -1,
      54           0 :                       cppu::UnoType<sal_Int32>::get(), 0)
      55           0 : {}
      56             : 
      57           0 : Sequence< Property > SAL_CALL lcl_ColorPropertySetInfo::getProperties()
      58             :     throw (RuntimeException, std::exception)
      59             : {
      60             : 
      61           0 :     return Sequence< Property >( & m_aColorProp, 1 );
      62             : }
      63             : 
      64           0 : Property SAL_CALL lcl_ColorPropertySetInfo::getPropertyByName( const OUString& aName )
      65             :     throw (UnknownPropertyException, RuntimeException, std::exception)
      66             : {
      67           0 :     if( aName.equals( m_aColorPropName ))
      68           0 :         return m_aColorProp;
      69           0 :     throw UnknownPropertyException( m_aColorPropName, static_cast< uno::XWeak * >( this ));
      70             : }
      71             : 
      72           0 : sal_Bool SAL_CALL lcl_ColorPropertySetInfo::hasPropertyByName( const OUString& Name )
      73             :     throw (RuntimeException, std::exception)
      74             : {
      75           0 :     return Name.equals( m_aColorPropName );
      76             : }
      77             : 
      78             : } // anonymous namespace
      79             : 
      80             : namespace xmloff
      81             : {
      82             : namespace chart
      83             : {
      84             : 
      85           0 : ColorPropertySet::ColorPropertySet( sal_Int32 nColor, bool bFillColor /* = true */ ) :
      86             :         // note: length of FillColor and LineColor is 9
      87             :         m_aColorPropName( (bFillColor ? "FillColor" : "LineColor"), 9, RTL_TEXTENCODING_ASCII_US ),
      88             :         m_nColor( nColor ),
      89             :         m_bIsFillColor( bFillColor ),
      90           0 :         m_nDefaultColor( 0x0099ccff )  // blue 8
      91           0 : {}
      92             : 
      93           0 : ColorPropertySet::~ColorPropertySet()
      94           0 : {}
      95             : 
      96             : // ____ XPropertySet ____
      97             : 
      98           0 : Reference< XPropertySetInfo > SAL_CALL ColorPropertySet::getPropertySetInfo()
      99             :     throw (uno::RuntimeException, std::exception)
     100             : {
     101           0 :     if( ! m_xInfo.is())
     102           0 :         m_xInfo.set( new lcl_ColorPropertySetInfo( m_bIsFillColor ));
     103             : 
     104           0 :     return m_xInfo;
     105             : }
     106             : 
     107           0 : void SAL_CALL ColorPropertySet::setPropertyValue( const OUString& /* aPropertyName */, const uno::Any& aValue )
     108             :     throw (UnknownPropertyException,
     109             :            PropertyVetoException,
     110             :            lang::IllegalArgumentException,
     111             :            lang::WrappedTargetException,
     112             :            uno::RuntimeException, std::exception)
     113             : {
     114           0 :     aValue >>= m_nColor;
     115           0 : }
     116             : 
     117           0 : uno::Any SAL_CALL ColorPropertySet::getPropertyValue( const OUString& /* PropertyName */ )
     118             :     throw (UnknownPropertyException,
     119             :            lang::WrappedTargetException,
     120             :            uno::RuntimeException, std::exception)
     121             : {
     122           0 :     return uno::makeAny( m_nColor );
     123             : }
     124             : 
     125           0 : void SAL_CALL ColorPropertySet::addPropertyChangeListener( const OUString& /* aPropertyName */, const Reference< XPropertyChangeListener >& /* xListener */ )
     126             :     throw (UnknownPropertyException,
     127             :            lang::WrappedTargetException,
     128             :            uno::RuntimeException, std::exception)
     129             : {
     130             :     OSL_FAIL( "Not Implemented" );
     131           0 :     return;
     132             : }
     133             : 
     134           0 : void SAL_CALL ColorPropertySet::removePropertyChangeListener( const OUString& /* aPropertyName */, const Reference< XPropertyChangeListener >& /* aListener */ )
     135             :     throw (UnknownPropertyException,
     136             :            lang::WrappedTargetException,
     137             :            uno::RuntimeException, std::exception)
     138             : {
     139             :     OSL_FAIL( "Not Implemented" );
     140           0 :     return;
     141             : }
     142             : 
     143           0 : void SAL_CALL ColorPropertySet::addVetoableChangeListener( const OUString& /* PropertyName */, const Reference< XVetoableChangeListener >& /* aListener */ )
     144             :     throw (UnknownPropertyException,
     145             :            lang::WrappedTargetException,
     146             :            uno::RuntimeException, std::exception)
     147             : {
     148             :     OSL_FAIL( "Not Implemented" );
     149           0 :     return;
     150             : }
     151             : 
     152           0 : void SAL_CALL ColorPropertySet::removeVetoableChangeListener( const OUString& /* PropertyName */, const Reference< XVetoableChangeListener >& /* aListener */ )
     153             :     throw (UnknownPropertyException,
     154             :            lang::WrappedTargetException,
     155             :            uno::RuntimeException, std::exception)
     156             : {
     157             :     OSL_FAIL( "Not Implemented" );
     158           0 :     return;
     159             : }
     160             : 
     161             : // ____ XPropertyState ____
     162             : 
     163           0 : PropertyState SAL_CALL ColorPropertySet::getPropertyState( const OUString& /* PropertyName */ )
     164             :     throw (UnknownPropertyException,
     165             :            uno::RuntimeException, std::exception)
     166             : {
     167           0 :     return PropertyState_DIRECT_VALUE;
     168             : }
     169             : 
     170           0 : Sequence< PropertyState > SAL_CALL ColorPropertySet::getPropertyStates( const Sequence< OUString >& /* aPropertyName */ )
     171             :     throw (UnknownPropertyException,
     172             :            uno::RuntimeException, std::exception)
     173             : {
     174           0 :     PropertyState aState = PropertyState_DIRECT_VALUE;
     175           0 :     return Sequence< PropertyState >( & aState, 1 );
     176             : }
     177             : 
     178           0 : void SAL_CALL ColorPropertySet::setPropertyToDefault( const OUString& PropertyName )
     179             :     throw (UnknownPropertyException,
     180             :            uno::RuntimeException, std::exception)
     181             : {
     182           0 :     if( PropertyName.equals( m_aColorPropName ))
     183           0 :         m_nColor = m_nDefaultColor;
     184           0 : }
     185             : 
     186           0 : uno::Any SAL_CALL ColorPropertySet::getPropertyDefault( const OUString& aPropertyName )
     187             :     throw (UnknownPropertyException,
     188             :            lang::WrappedTargetException,
     189             :            uno::RuntimeException, std::exception)
     190             : {
     191           0 :     if( aPropertyName.equals( m_aColorPropName ))
     192           0 :         return uno::makeAny( m_nDefaultColor );
     193           0 :     return uno::Any();
     194             : }
     195             : 
     196             : } //  namespace chart
     197             : } //  namespace xmloff
     198             : 
     199             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10