1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #ifndef CHART_OPROPERTYSET_HXX 28*cdf0e10cSrcweir #define CHART_OPROPERTYSET_HXX 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir // helper classes 31*cdf0e10cSrcweir #include <cppuhelper/propshlp.hxx> 32*cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx> 33*cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir // interfaces and types 36*cdf0e10cSrcweir // #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ 37*cdf0e10cSrcweir // #include <com/sun/star/lang/XServiceInfo.hpp> 38*cdf0e10cSrcweir // #endif 39*cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyState.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/beans/XMultiPropertyStates.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/beans/Property.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/style/XStyleSupplier.hpp> 44*cdf0e10cSrcweir // #ifndef _COM_SUN_STAR_BEANS_XFASTPROPERTYSTATE_HPP_ 45*cdf0e10cSrcweir // #include <com/sun/star/beans/XFastPropertyState.hpp> 46*cdf0e10cSrcweir // #endif 47*cdf0e10cSrcweir #include <osl/mutex.hxx> 48*cdf0e10cSrcweir #include "charttoolsdllapi.hxx" 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir #include <memory> 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir namespace property 53*cdf0e10cSrcweir { 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir namespace impl 56*cdf0e10cSrcweir { class ImplOPropertySet; } 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir class OOO_DLLPUBLIC_CHARTTOOLS OPropertySet : 60*cdf0e10cSrcweir public ::cppu::OBroadcastHelper, 61*cdf0e10cSrcweir // includes beans::XPropertySet, XMultiPropertySet and XFastPropertySet 62*cdf0e10cSrcweir public ::cppu::OPropertySetHelper, 63*cdf0e10cSrcweir // includes uno::XWeak (and XInterface, esp. ref-counting) 64*cdf0e10cSrcweir // public virtual ::cppu::OWeakObject, 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir // public virtual ::com::sun::star::lang::XServiceInfo, 67*cdf0e10cSrcweir public ::com::sun::star::lang::XTypeProvider, 68*cdf0e10cSrcweir public ::com::sun::star::beans::XPropertyState, 69*cdf0e10cSrcweir public ::com::sun::star::beans::XMultiPropertyStates, 70*cdf0e10cSrcweir public ::com::sun::star::style::XStyleSupplier 71*cdf0e10cSrcweir // public ::com::sun::star::beans::XFastPropertyState 72*cdf0e10cSrcweir { 73*cdf0e10cSrcweir public: 74*cdf0e10cSrcweir OPropertySet( ::osl::Mutex & rMutex ); 75*cdf0e10cSrcweir virtual ~OPropertySet(); 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir protected: 78*cdf0e10cSrcweir explicit OPropertySet( const OPropertySet & rOther, ::osl::Mutex & rMutex ); 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir void SetNewValuesExplicitlyEvenIfTheyEqualDefault(); 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir /** implement this method to provide default values for all properties 83*cdf0e10cSrcweir supporting defaults. If a property does not have a default value, you 84*cdf0e10cSrcweir may throw an UnknownPropertyException. 85*cdf0e10cSrcweir */ 86*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const 87*cdf0e10cSrcweir throw(::com::sun::star::beans::UnknownPropertyException) = 0; 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir /** The InfoHelper table contains all property names and types of 90*cdf0e10cSrcweir this object. 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir @return the object that provides information for the 93*cdf0e10cSrcweir PropertySetInfo 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir @see ::cppu::OPropertySetHelper 96*cdf0e10cSrcweir */ 97*cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() = 0; 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir /** Try to convert the value <code>rValue</code> to the type required by the 101*cdf0e10cSrcweir property associated with <code>nHandle</code>. 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir Overload this method to take influence in modification of properties. 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir If the conversion changed , </sal_True> is returned and the converted value 106*cdf0e10cSrcweir is in <code>rConvertedValue</code>. The former value is contained in 107*cdf0e10cSrcweir <code>rOldValue</code>. 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir After this call returns successfully, the vetoable listeners are 110*cdf0e10cSrcweir notified. 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir @throws IllegalArgumentException, if the conversion was not successful, 113*cdf0e10cSrcweir or if there is no corresponding property to the given handle. 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir @param rConvertedValue the converted value. Only set if return is true. 116*cdf0e10cSrcweir @param rOldValue the old value. Only set if return is true. 117*cdf0e10cSrcweir @param nHandle the handle of the property. 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir @return true, if the conversion was successful and converted value 120*cdf0e10cSrcweir differs from the old value. 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir @see ::cppu::OPropertySetHelper 123*cdf0e10cSrcweir */ 124*cdf0e10cSrcweir virtual sal_Bool SAL_CALL convertFastPropertyValue 125*cdf0e10cSrcweir ( ::com::sun::star::uno::Any & rConvertedValue, 126*cdf0e10cSrcweir ::com::sun::star::uno::Any & rOldValue, 127*cdf0e10cSrcweir sal_Int32 nHandle, 128*cdf0e10cSrcweir const ::com::sun::star::uno::Any& rValue ) 129*cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir /** The same as setFastProperyValue; nHandle is always valid. 132*cdf0e10cSrcweir The changes must not be broadcasted in this method. 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir @attention 135*cdf0e10cSrcweir Although you are permitted to throw any UNO exception, only the following 136*cdf0e10cSrcweir are valid for usage: 137*cdf0e10cSrcweir -- ::com::sun::star::beans::UnknownPropertyException 138*cdf0e10cSrcweir -- ::com::sun::star::beans::PropertyVetoException 139*cdf0e10cSrcweir -- ::com::sun::star::lang::IllegalArgumentException 140*cdf0e10cSrcweir -- ::com::sun::star::lang::WrappedTargetException 141*cdf0e10cSrcweir -- ::com::sun::star::uno::RuntimeException 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir @param nHandle handle 144*cdf0e10cSrcweir @param rValue value 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir @see ::cppu::OPropertySetHelper 147*cdf0e10cSrcweir */ 148*cdf0e10cSrcweir virtual void SAL_CALL setFastPropertyValue_NoBroadcast 149*cdf0e10cSrcweir ( sal_Int32 nHandle, 150*cdf0e10cSrcweir const ::com::sun::star::uno::Any& rValue ) 151*cdf0e10cSrcweir throw (::com::sun::star::uno::Exception); 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir /** 154*cdf0e10cSrcweir The same as getFastProperyValue, but return the value through rValue and 155*cdf0e10cSrcweir nHandle is always valid. 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir @see ::cppu::OPropertySetHelper 158*cdf0e10cSrcweir */ 159*cdf0e10cSrcweir virtual void SAL_CALL getFastPropertyValue 160*cdf0e10cSrcweir ( ::com::sun::star::uno::Any& rValue, 161*cdf0e10cSrcweir sal_Int32 nHandle ) const; 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir /// make original interface function visible again 164*cdf0e10cSrcweir using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue; 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir /** implement this method in derived classes to get called when properties 167*cdf0e10cSrcweir change. 168*cdf0e10cSrcweir */ 169*cdf0e10cSrcweir virtual void firePropertyChangeEvent(); 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir /// call this when a derived component is disposed 172*cdf0e10cSrcweir virtual void disposePropertySet(); 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir // ======================================== 175*cdf0e10cSrcweir // Interfaces 176*cdf0e10cSrcweir // ======================================== 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir // ____ XInterface ____ 179*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) 180*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 181*cdf0e10cSrcweir // virtual void SAL_CALL acquire() throw (); 182*cdf0e10cSrcweir // virtual void SAL_CALL release() throw (); 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir // ____ XServiceInfo ____ 186*cdf0e10cSrcweir // virtual ::rtl::OUString SAL_CALL 187*cdf0e10cSrcweir // getImplementationName() 188*cdf0e10cSrcweir // throw (::com::sun::star::uno::RuntimeException); 189*cdf0e10cSrcweir // virtual sal_Bool SAL_CALL 190*cdf0e10cSrcweir // supportsService( const ::rtl::OUString& ServiceName ) 191*cdf0e10cSrcweir // throw (::com::sun::star::uno::RuntimeException); 192*cdf0e10cSrcweir // virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 193*cdf0e10cSrcweir // getSupportedServiceNames() 194*cdf0e10cSrcweir // throw (::com::sun::star::uno::RuntimeException); 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir // ____ XTypeProvider ____ 197*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL 198*cdf0e10cSrcweir getTypes() 199*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 200*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL 201*cdf0e10cSrcweir getImplementationId() 202*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir // ____ XPropertyState ____ 205*cdf0e10cSrcweir virtual ::com::sun::star::beans::PropertyState SAL_CALL 206*cdf0e10cSrcweir getPropertyState( const ::rtl::OUString& PropertyName ) 207*cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 208*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 209*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL 210*cdf0e10cSrcweir getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) 211*cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 212*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 213*cdf0e10cSrcweir virtual void SAL_CALL 214*cdf0e10cSrcweir setPropertyToDefault( const ::rtl::OUString& PropertyName ) 215*cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 216*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 217*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL 218*cdf0e10cSrcweir getPropertyDefault( const ::rtl::OUString& aPropertyName ) 219*cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 220*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 221*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir // ____ XMultiPropertyStates ____ 224*cdf0e10cSrcweir // Note: getPropertyStates() is already implemented in XPropertyState with the 225*cdf0e10cSrcweir // same signature 226*cdf0e10cSrcweir virtual void SAL_CALL 227*cdf0e10cSrcweir setAllPropertiesToDefault() 228*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 229*cdf0e10cSrcweir virtual void SAL_CALL 230*cdf0e10cSrcweir setPropertiesToDefault( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) 231*cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 232*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 233*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL 234*cdf0e10cSrcweir getPropertyDefaults( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) 235*cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 236*cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 237*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir // ____ XStyleSupplier ____ 240*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > SAL_CALL getStyle() 241*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 242*cdf0e10cSrcweir virtual void SAL_CALL setStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >& xStyle ) 243*cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException, 244*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir // ____ XFastPropertyState ____ 247*cdf0e10cSrcweir // virtual ::com::sun::star::beans::PropertyState SAL_CALL getFastPropertyState( sal_Int32 nHandle ) 248*cdf0e10cSrcweir // throw (::com::sun::star::beans::UnknownPropertyException, 249*cdf0e10cSrcweir // ::com::sun::star::uno::RuntimeException); 250*cdf0e10cSrcweir // virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getFastPropertyStates( const ::com::sun::star::uno::Sequence< sal_Int32 >& aHandles ) 251*cdf0e10cSrcweir // throw (::com::sun::star::beans::UnknownPropertyException, 252*cdf0e10cSrcweir // ::com::sun::star::uno::RuntimeException); 253*cdf0e10cSrcweir // virtual void SAL_CALL setFastPropertyToDefault( sal_Int32 nHandle ) 254*cdf0e10cSrcweir // throw (::com::sun::star::beans::UnknownPropertyException, 255*cdf0e10cSrcweir // ::com::sun::star::uno::RuntimeException); 256*cdf0e10cSrcweir // virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyDefault( sal_Int32 nHandle ) 257*cdf0e10cSrcweir // throw (::com::sun::star::beans::UnknownPropertyException, 258*cdf0e10cSrcweir // ::com::sun::star::lang::WrappedTargetException, 259*cdf0e10cSrcweir // ::com::sun::star::uno::RuntimeException); 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir // ____ XMultiPropertySet ____ 262*cdf0e10cSrcweir virtual void SAL_CALL setPropertyValues( 263*cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames, 264*cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) 265*cdf0e10cSrcweir throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir // ____ XFastPropertySet ____ 268*cdf0e10cSrcweir virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) 269*cdf0e10cSrcweir 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); 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir // Note: it is assumed that the base class implements setPropertyValue by 272*cdf0e10cSrcweir // using setFastPropertyValue 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir private: 275*cdf0e10cSrcweir /// reference to mutex of class deriving from here 276*cdf0e10cSrcweir ::osl::Mutex & m_rMutex; 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir /// pImpl idiom implementation 279*cdf0e10cSrcweir ::std::auto_ptr< impl::ImplOPropertySet > m_pImplProperties; 280*cdf0e10cSrcweir bool m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault; 281*cdf0e10cSrcweir }; 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir } // namespace property 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir // CHART_OPROPERTYSET_HXX 286*cdf0e10cSrcweir #endif 287