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