LCOV - code coverage report
Current view: top level - extensions/source/propctrlr - propertycomposer.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 10 0.0 %
Date: 2014-11-03 Functions: 0 5 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             : #ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX
      21             : #define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX
      22             : 
      23             : #include "pcrcommon.hxx"
      24             : #include "composeduiupdate.hxx"
      25             : #include "formbrowsertools.hxx"
      26             : 
      27             : #include <com/sun/star/beans/XPropertySet.hpp>
      28             : #include <com/sun/star/inspection/XPropertyHandler.hpp>
      29             : #include <com/sun/star/lang/DisposedException.hpp>
      30             : #include <com/sun/star/beans/UnknownPropertyException.hpp>
      31             : #include <com/sun/star/beans/PropertyVetoException.hpp>
      32             : #include <cppuhelper/compbase2.hxx>
      33             : #include <comphelper/broadcasthelper.hxx>
      34             : #include <comphelper/listenernotification.hxx>
      35             : 
      36             : #include <vector>
      37             : #include <set>
      38             : 
      39             : 
      40             : namespace pcr
      41             : {
      42             : 
      43             : 
      44             : 
      45             :     //= PropertyComposer
      46             : 
      47             :     typedef ::cppu::WeakComponentImplHelper2    <   ::com::sun::star::inspection::XPropertyHandler
      48             :                                                 ,   ::com::sun::star::beans::XPropertyChangeListener
      49             :                                                 >   PropertyComposer_Base;
      50             :     /** implements an <type>XPropertyHandler</type> which composes it's information
      51             :         from a set of other property handlers
      52             :     */
      53           0 :     class PropertyComposer  :public PropertyComposer_Base
      54             :                             ,public ::comphelper::OBaseMutex
      55             :                             ,public IPropertyExistenceCheck
      56             :     {
      57             :     public:
      58             :         typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > >
      59             :                                                             HandlerArray;
      60             : 
      61             :     private:
      62             :         HandlerArray                                    m_aSlaveHandlers;
      63             :         ::std::unique_ptr< ComposedPropertyUIUpdate >   m_pUIRequestComposer;
      64             :         PropertyChangeListeners                         m_aPropertyListeners;
      65             :         bool                                            m_bSupportedPropertiesAreKnown;
      66             :         PropertyBag                                     m_aSupportedProperties;
      67             : 
      68             :     public:
      69             :         /** constructs an <type>XPropertyHandler</type> which composes it's information from a set
      70             :             of other property handlers
      71             : 
      72             :             @param _rSlaveHandlers
      73             :                 the set of slave handlers to invoke. Must not be <NULL/>
      74             :         */
      75             :         PropertyComposer( const ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > >& _rSlaveHandlers );
      76             : 
      77             :     public:
      78             :         // XPropertyHandler overridables
      79             :         virtual void                                SAL_CALL inspect( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIntrospectee ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      80             :         virtual ::com::sun::star::uno::Any          SAL_CALL getPropertyValue( const OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      81             :         virtual void                                SAL_CALL setPropertyValue( const OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::PropertyVetoException, std::exception) SAL_OVERRIDE;
      82             :         virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue( const OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rControlValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      83             :         virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue( const OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rPropertyValue, const ::com::sun::star::uno::Type& _rControlValueType ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      84             :         virtual ::com::sun::star::beans::PropertyState
      85             :                                                     SAL_CALL getPropertyState( const OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      86             :         virtual void                                SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      87             :         virtual void                                SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      88             :         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >
      89             :                                                     SAL_CALL getSupportedProperties() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      90             :         virtual ::com::sun::star::uno::Sequence< OUString >
      91             :                                                     SAL_CALL getSupersededProperties( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      92             :         virtual ::com::sun::star::uno::Sequence< OUString >
      93             :                                                     SAL_CALL getActuatingProperties( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      94             :         virtual ::com::sun::star::inspection::LineDescriptor
      95             :                                                     SAL_CALL describePropertyLine( const OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      96             :         virtual sal_Bool                          SAL_CALL isComposable( const OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      97             :         virtual ::com::sun::star::inspection::InteractiveSelectionResult
      98             :                                                     SAL_CALL onInteractivePropertySelection( const OUString& _rPropertyName, sal_Bool _bPrimary, ::com::sun::star::uno::Any& _rData, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      99             :         virtual void                                SAL_CALL actuatingPropertyChanged( const OUString& _rActuatingPropertyName, const ::com::sun::star::uno::Any& _rNewValue, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     100             :         virtual sal_Bool                            SAL_CALL suspend( sal_Bool _bSuspend ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     101             : 
     102             :         // XComponent
     103             :         DECLARE_XCOMPONENT()
     104             :         virtual void                                SAL_CALL disposing() SAL_OVERRIDE;
     105             : 
     106             :         // XPropertyChangeListener
     107             :         virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     108             : 
     109             :         // XEventListener
     110             :         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     111             : 
     112             :         // IPropertyExistenceCheck
     113             :         virtual bool SAL_CALL hasPropertyByName( const OUString& _rName ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
     114             : 
     115             :     private:
     116             :         /** ensures that m_pUIRequestComposer exists
     117             :         */
     118             :         void    impl_ensureUIRequestComposer( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI );
     119             : 
     120             :         /** checks whether a given property exists in <member>m_aSupportedProperties</member>
     121             :         */
     122           0 :         bool    impl_isSupportedProperty_nothrow( const OUString& _rPropertyName )
     123             :         {
     124           0 :             ::com::sun::star::beans::Property aDummy; aDummy.Name = _rPropertyName;
     125           0 :             return m_aSupportedProperties.find( aDummy ) != m_aSupportedProperties.end();
     126             :         }
     127             : 
     128             :     private:
     129             :         class MethodGuard;
     130             :         friend class MethodGuard;
     131           0 :         class MethodGuard : public ::osl::MutexGuard
     132             :         {
     133             :         public:
     134           0 :             MethodGuard( PropertyComposer& _rInstance )
     135           0 :                 : ::osl::MutexGuard( _rInstance.m_aMutex )
     136             :             {
     137           0 :                 if ( _rInstance.m_aSlaveHandlers.empty() )
     138           0 :                     throw ::com::sun::star::lang::DisposedException( OUString(), *(&_rInstance) );
     139           0 :             }
     140             :         };
     141             :     };
     142             : 
     143             : 
     144             : } // namespace pcr
     145             : 
     146             : 
     147             : #endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX
     148             : 
     149             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10