1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef CHART_WRAPPEDPROPERTYSET_HXX 28 #define CHART_WRAPPEDPROPERTYSET_HXX 29 30 #include "WrappedProperty.hxx" 31 #include "MutexContainer.hxx" 32 #include "charttoolsdllapi.hxx" 33 #include <com/sun/star/beans/XMultiPropertySet.hpp> 34 #include <com/sun/star/beans/XMultiPropertyStates.hpp> 35 #include <com/sun/star/beans/XPropertySet.hpp> 36 #include <com/sun/star/beans/XPropertyState.hpp> 37 #include <com/sun/star/beans/Property.hpp> 38 #include <cppuhelper/implbase4.hxx> 39 40 // header for class OPropertyArrayHelper 41 #include <cppuhelper/propshlp.hxx> 42 43 // header for class OMultiTypeInterfaceContainerHelperInt32 44 #include <cppuhelper/propshlp.hxx> 45 46 #include <vector> 47 48 //............................................................................. 49 namespace chart 50 { 51 //............................................................................. 52 53 class OOO_DLLPUBLIC_CHARTTOOLS WrappedPropertySet : 54 public MutexContainer 55 , public ::cppu::WeakImplHelper4 56 < ::com::sun::star::beans::XPropertySet 57 , ::com::sun::star::beans::XMultiPropertySet 58 , ::com::sun::star::beans::XPropertyState 59 , ::com::sun::star::beans::XMultiPropertyStates 60 // ,::com::sun::star::uno::XWeak // implemented by WeakImplHelper(optional interface) 61 // ,::com::sun::star::uno::XInterface // implemented by WeakImplHelper 62 // ,::com::sun::star::lang::XTypeProvider // implemented by WeakImplHelper 63 > 64 { 65 public: 66 WrappedPropertySet(); 67 virtual ~WrappedPropertySet(); 68 69 void clearWrappedPropertySet(); 70 71 public: 72 //XPropertySet 73 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException); 74 75 virtual void SAL_CALL setPropertyValue( const ::rtl::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); 76 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 77 78 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 79 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 80 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 81 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 82 83 //XMultiPropertySet 84 //getPropertySetInfo() already declared in XPropertySet 85 virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 86 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException); 87 virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 88 virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 89 virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 90 91 //XPropertyState 92 virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); 93 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); 94 virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); 95 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 96 97 //XMultiPropertyStates 98 //getPropertyStates() already declared in XPropertyState 99 virtual void SAL_CALL setAllPropertiesToDefault( ) throw (::com::sun::star::uno::RuntimeException); 100 virtual void SAL_CALL setPropertiesToDefault( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); 101 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyDefaults( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 102 103 protected: //methods 104 /** give all the properties that should be visible to the outer side 105 */ 106 virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence()=0; 107 /** give a list of all properties that need a special treatment; 108 properties that are not in this list will be wrapped identical. 109 The base class 'WrappedPropertySet' will take ownership on the contained pointer. 110 It is not allowed to have duplicate entries in this list. 111 */ 112 virtual const std::vector< WrappedProperty* > createWrappedProperties()=0; 113 114 virtual ::com::sun::star::uno::Reference< 115 ::com::sun::star::beans::XPropertySet > getInnerPropertySet() = 0; 116 SAL_DLLPRIVATE ::com::sun::star::uno::Reference< 117 ::com::sun::star::beans::XPropertyState > getInnerPropertyState(); 118 119 ::cppu::IPropertyArrayHelper& getInfoHelper(); 120 SAL_DLLPRIVATE tWrappedPropertyMap& getWrappedPropertyMap(); 121 122 const WrappedProperty* getWrappedProperty( const ::rtl::OUString& rOuterName ); 123 const WrappedProperty* getWrappedProperty( sal_Int32 nHandle ); 124 125 protected: //member 126 ::com::sun::star::uno::Reference< 127 ::com::sun::star::beans::XPropertySetInfo > m_xInfo;//outer PropertySetInfo 128 129 ::cppu::OPropertyArrayHelper* m_pPropertyArrayHelper;//holds all possible outer properties 130 131 tWrappedPropertyMap* m_pWrappedPropertyMap;//holds all wrapped properties (containing the special mapping from inner to outer properties) 132 133 //Container for the XProperyChangedListener. The listeners are inserted by handle. 134 //OMultiTypeInterfaceContainerHelperInt32 m_aBoundListenerContainer; 135 136 //Container for the XPropertyVetoableListener. The listeners are inserted by handle. 137 //OMultiTypeInterfaceContainerHelperInt32 m_aVetoableListenerContainer; 138 }; 139 140 //............................................................................. 141 } //namespace chart 142 //............................................................................. 143 144 // CHART_WRAPPEDPROPERTYSET_HXX 145 #endif 146