LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/comphelper - MasterPropertySet.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 3 33.3 %
Date: 2013-07-09 Functions: 1 3 33.3 %
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             : #ifndef _COMPHELPER_MASTERPROPERTYSETHELPER_HXX_
      21             : #define _COMPHELPER_MASTERPROPERTYSETHELPER_HXX_
      22             : #include <com/sun/star/beans/XPropertySet.hpp>
      23             : #include <com/sun/star/beans/XPropertyState.hpp>
      24             : #include <com/sun/star/beans/XMultiPropertySet.hpp>
      25             : #include <comphelper/PropertyInfoHash.hxx>
      26             : #include "comphelper/comphelperdllapi.h"
      27             : #include "comphelper/solarmutex.hxx"
      28             : #include <map>
      29             : 
      30             : namespace comphelper
      31             : {
      32             :     class MasterPropertySetInfo;
      33             :     class ChainablePropertySet;
      34         911 :     struct SlaveData
      35             :     {
      36             :         ChainablePropertySet * mpSlave;
      37             :         ::com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > mxSlave;
      38             :         sal_Bool mbInit;
      39             :         SlaveData ( ChainablePropertySet *pSlave);
      40           0 :         inline sal_Bool IsInit () { return mbInit;}
      41           0 :         inline void SetInit ( sal_Bool bInit) { mbInit = bInit; }
      42             :     };
      43             : }
      44             : typedef std::map < sal_uInt8, comphelper::SlaveData* > SlaveMap;
      45             : 
      46             : /*
      47             :  * A MasterPropertySet implements all of the features of a ChainablePropertySet
      48             :  * (it is not inherited from ChainablePropertySet to prevent MasterPropertySets
      49             :  * being chained to each other), but also allows properties implemented in
      50             :  * other ChainablePropertySets to be included as 'native' properties in a
      51             :  * given MasterPropertySet implementation. These are registered using the
      52             :  * 'registerSlave' method, and require that the implementation of the
      53             :  * ChainablePropertySet and the implementation of the ChainablePropertySetInfo
      54             :  * both declare the implementation of the MasterPropertySet as a friend.
      55             :  */
      56             : namespace comphelper
      57             : {
      58             :     class COMPHELPER_DLLPUBLIC MasterPropertySet : public ::com::sun::star::beans::XPropertySet,
      59             :                               public ::com::sun::star::beans::XPropertyState,
      60             :                               public ::com::sun::star::beans::XMultiPropertySet
      61             :     {
      62             :     protected:
      63             :         MasterPropertySetInfo *mpInfo;
      64             :         SolarMutex* mpMutex;
      65             :         sal_uInt8 mnLastId;
      66             :         SlaveMap maSlaveMap;
      67             :         ::com::sun::star::uno::Reference < com::sun::star::beans::XPropertySetInfo > mxInfo;
      68             : 
      69             :         virtual void _preSetValues ()
      70             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
      71             :         virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const ::com::sun::star::uno::Any &rValue )
      72             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
      73             :         virtual void _postSetValues ()
      74             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
      75             : 
      76             :         virtual void _preGetValues ()
      77             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
      78             :         virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, ::com::sun::star::uno::Any & rValue )
      79             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ) = 0;
      80             :         virtual void _postGetValues ()
      81             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
      82             : 
      83             :         virtual void _preGetPropertyState ()
      84             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
      85             :         virtual void _getPropertyState( const comphelper::PropertyInfo& rInfo, ::com::sun::star::beans::PropertyState& rState )
      86             :             throw(::com::sun::star::beans::UnknownPropertyException );
      87             :         virtual void _postGetPropertyState ()
      88             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
      89             : 
      90             :         virtual void _setPropertyToDefault( const comphelper::PropertyInfo& rEntry )
      91             :             throw(::com::sun::star::beans::UnknownPropertyException );
      92             :         virtual ::com::sun::star::uno::Any _getPropertyDefault( const comphelper::PropertyInfo& rEntry )
      93             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
      94             : 
      95             :     public:
      96             :         MasterPropertySet( comphelper::MasterPropertySetInfo* pInfo, SolarMutex* pMutex = NULL )
      97             :             throw();
      98             :         virtual ~MasterPropertySet()
      99             :             throw();
     100             :         void registerSlave ( ChainablePropertySet *pNewSet )
     101             :             throw();
     102             : 
     103             :         // XPropertySet
     104             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  )
     105             :             throw(::com::sun::star::uno::RuntimeException);
     106             :         virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
     107             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     108             :         virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName )
     109             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     110             :         virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
     111             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     112             :         virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
     113             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     114             :         virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
     115             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     116             :         virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
     117             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     118             : 
     119             :         // XMultiPropertySet
     120             :         virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues )
     121             :             throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     122             :         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames )
     123             :             throw(::com::sun::star::uno::RuntimeException);
     124             :         virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
     125             :             throw(::com::sun::star::uno::RuntimeException);
     126             :         virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
     127             :             throw(::com::sun::star::uno::RuntimeException);
     128             :         virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
     129             :             throw(::com::sun::star::uno::RuntimeException);
     130             : 
     131             :         // XPropertyState
     132             :         virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName )
     133             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
     134             :         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName )
     135             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
     136             :         virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName )
     137             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
     138             :         virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName )
     139             :             throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     140             :     };
     141             : }
     142             : #endif
     143             : 
     144             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10