LCOV - code coverage report
Current view: top level - include/toolkit/controls - unocontrolmodel.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 2 0.0 %
Date: 2014-04-14 Functions: 0 3 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_TOOLKIT_CONTROLS_UNOCONTROLMODEL_HXX
      21             : #define INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLMODEL_HXX
      22             : 
      23             : #include <com/sun/star/awt/XControlModel.hpp>
      24             : #include <com/sun/star/lang/XComponent.hpp>
      25             : #include <com/sun/star/lang/XServiceInfo.hpp>
      26             : #include <com/sun/star/beans/XPropertyState.hpp>
      27             : #include <com/sun/star/io/XPersistObject.hpp>
      28             : #include <com/sun/star/lang/XTypeProvider.hpp>
      29             : #include <com/sun/star/lang/XUnoTunnel.hpp>
      30             : #include <com/sun/star/util/XCloneable.hpp>
      31             : #include <com/sun/star/uno/XComponentContext.hpp>
      32             : #include <cppuhelper/weakagg.hxx>
      33             : #include <osl/mutex.hxx>
      34             : 
      35             : #include <toolkit/helper/mutexandbroadcasthelper.hxx>
      36             : #include <toolkit/helper/listenermultiplexer.hxx>
      37             : 
      38             : #include <cppuhelper/propshlp.hxx>
      39             : #include <cppuhelper/interfacecontainer.hxx>
      40             : #include <cppuhelper/implbase7.hxx>
      41             : #include <comphelper/uno3.hxx>
      42             : 
      43             : #include <list>
      44             : #include <map>
      45             : 
      46             : typedef std::map<sal_uInt16, ::com::sun::star::uno::Any> ImplPropertyTable;
      47             : 
      48             : 
      49             : //  class UnoControlModel
      50             : 
      51             : 
      52             : typedef ::cppu::WeakAggImplHelper7  <   ::com::sun::star::awt::XControlModel
      53             :                                     ,   ::com::sun::star::beans::XPropertyState
      54             :                                     ,   ::com::sun::star::io::XPersistObject
      55             :                                     ,   ::com::sun::star::lang::XComponent
      56             :                                     ,   ::com::sun::star::lang::XServiceInfo
      57             :                                     ,   ::com::sun::star::lang::XUnoTunnel
      58             :                                     ,   ::com::sun::star::util::XCloneable
      59             :                                     >   UnoControlModel_Base;
      60             : 
      61           0 : class TOOLKIT_DLLPUBLIC UnoControlModel :public UnoControlModel_Base
      62             :                                         ,public MutexAndBroadcastHelper
      63             :                                         ,public ::cppu::OPropertySetHelper
      64             : {
      65             : private:
      66             :     ImplPropertyTable                       maData;
      67             :     EventListenerMultiplexer                maDisposeListeners;
      68             : 
      69             : protected:
      70             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
      71             : 
      72             : protected:
      73             :     void                                        ImplRegisterProperty( sal_uInt16 nPropType );
      74             :     void                                        ImplRegisterProperties( const std::list< sal_uInt16 > &rIds );
      75             :     void                                        ImplRegisterProperty( sal_uInt16 nPropId, const ::com::sun::star::uno::Any& rDefault );
      76             :     ::com::sun::star::uno::Sequence<sal_Int32>  ImplGetPropertyIds() const;
      77             :     virtual ::com::sun::star::uno::Any          ImplGetDefaultValue( sal_uInt16 nPropId ) const;
      78             :     bool                                    ImplHasProperty( sal_uInt16 nPropId ) const;
      79             : 
      80             :     /** called before setting multiple properties, allows to care for property dependencies
      81             : 
      82             :         <p>When multiple property values are set (e.g. XPropertySet::setPropertyValues), it may happen that some
      83             :         of them are dependent. For this, derivees which know such dependencies can affect the order in which
      84             :         the properties are internally really set.</p>
      85             :     */
      86             :     virtual void ImplNormalizePropertySequence(
      87             :                     const sal_Int32                 _nCount,        /// the number of entries in the arrays
      88             :                     sal_Int32*                      _pHandles,      /// the handles of the properties to set
      89             :                     ::com::sun::star::uno::Any*     _pValues,       /// the values of the properties to set
      90             :                     sal_Int32*                      _pValidHandles  /// pointer to the valid handles, allowed to be adjusted
      91             :                 )   const SAL_THROW(());
      92             : 
      93             :     /// ensures that two property values in a sequence have a certain order
      94             :     void    ImplEnsureHandleOrder(
      95             :                 const sal_Int32 _nCount,                /// number of entries in the array
      96             :                 sal_Int32* _pHandles,                   /// pointer to the handles
      97             :                 ::com::sun::star::uno::Any* _pValues,   /// pointer to the values
      98             :                 sal_Int32 _nFirstHandle,                /// first handle, which should precede _nSecondHandle in the sequence
      99             :                 sal_Int32 _nSecondHandle                /// second handle, which should supersede _nFirstHandle in the sequence
     100             :             ) const;
     101             : 
     102             : protected:
     103             : #ifdef _MSC_VER
     104             :     UnoControlModel() //do not use! needed by MSVC at compile time to satisfy WeakAggImplHelper7
     105             :         : UnoControlModel_Base()
     106             :         , MutexAndBroadcastHelper()
     107             :         , OPropertySetHelper( BrdcstHelper )
     108             :         , maDisposeListeners( *this )
     109             :         , m_xContext( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
     110             :     {
     111             :         assert(false);
     112             :     }
     113             : #endif
     114             : 
     115             : public:
     116             :                 UnoControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
     117             :                 UnoControlModel( const UnoControlModel& rModel );
     118             : 
     119             :     virtual UnoControlModel*    Clone() const = 0;
     120             : 
     121             :     // ::com::sun::star::uno::XInterface
     122           0 :     ::com::sun::star::uno::Any  SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { return OWeakAggObject::queryInterface(rType); }
     123             :     void                        SAL_CALL acquire() throw() SAL_OVERRIDE;
     124             :     void                        SAL_CALL release() throw() SAL_OVERRIDE;
     125             : 
     126             :     // ::com::sun::star::uno::XAggregation
     127             :     ::com::sun::star::uno::Any  SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     128             : 
     129             :     // ::com::sun::star::lang::XUnoTunnel
     130             :     static const ::com::sun::star::uno::Sequence< sal_Int8 >&   GetUnoTunnelId() throw();
     131             :     sal_Int64                                                   SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     132             : 
     133             :     // ::com::sun::star::util::XCloneable
     134             :     ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     135             : 
     136             :     // ::com::sun::star::lang::XTypeProvider
     137             :     DECLARE_XTYPEPROVIDER()
     138             : 
     139             :     // ::com::sun::star::lang::XComponent
     140             :     void SAL_CALL dispose(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     141             :     void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     142             :     void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     143             : 
     144             :     // ::com::sun::star::beans::XPropertyState
     145             :     ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     146             :     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     147             :     void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     148             :     ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     149             : 
     150             :     // ::com::sun::star::io::XPersistObject
     151             :     OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     152             :     void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     153             :     void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     154             : 
     155             :     // ::com::sun::star::lang::XServiceInfo
     156             :     OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     157             :     sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     158             :     ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     159             : 
     160             :     // ::cppu::OPropertySetHelper
     161             :     ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE = 0;
     162             :     sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
     163             :     void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
     164             :     using cppu::OPropertySetHelper::getFastPropertyValue;
     165             :     void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const SAL_OVERRIDE;
     166             : 
     167             :     // setValue-Methoden ueberladen, um die Einzelproperties des FontDescriptors abzufangen
     168             :     // ::com::sun::star::beans::XPropertySet
     169             :     void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) 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, std::exception) SAL_OVERRIDE;
     170             :     // ::com::sun::star::beans::XFastPropertySet
     171             :     void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue ) 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, std::exception) SAL_OVERRIDE;
     172             :     // ::com::sun::star::beans::XMultiPropertySet
     173             :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     174             :     void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& PropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     175             : };
     176             : 
     177             : #define UNO_CONTROL_MODEL_REGISTER_PROPERTIES(a) \
     178             :     do { \
     179             :         std::list< sal_uInt16 > aIds; \
     180             :         a::ImplGetPropertyIds( aIds ); \
     181             :         ImplRegisterProperties( aIds ); \
     182             :     } while (false)
     183             : 
     184             : #endif // INCLUDED_TOOLKIT_CONTROLS_UNOCONTROLMODEL_HXX
     185             : 
     186             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10