bump product version to 4.1.6.2
[LibreOffice.git] / chart2 / source / inc / OPropertySet.hxx
blobcc226a5031bd9cd0cefd9e1845031322db97bc6d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef CHART_OPROPERTYSET_HXX
20 #define CHART_OPROPERTYSET_HXX
22 // helper classes
23 #include <cppuhelper/propshlp.hxx>
24 #include <cppuhelper/interfacecontainer.hxx>
25 #include <cppuhelper/weak.hxx>
27 // interfaces and types
28 #include <com/sun/star/lang/XTypeProvider.hpp>
29 #include <com/sun/star/beans/XPropertyState.hpp>
30 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
31 #include <com/sun/star/beans/Property.hpp>
32 #include <com/sun/star/style/XStyleSupplier.hpp>
33 #include <osl/mutex.hxx>
34 #include "charttoolsdllapi.hxx"
36 #include <memory>
38 namespace property
41 namespace impl
42 { class ImplOPropertySet; }
45 class OOO_DLLPUBLIC_CHARTTOOLS OPropertySet :
46 public ::cppu::OBroadcastHelper,
47 // includes beans::XPropertySet, XMultiPropertySet and XFastPropertySet
48 public ::cppu::OPropertySetHelper,
49 // includes uno::XWeak (and XInterface, esp. ref-counting)
51 public ::com::sun::star::lang::XTypeProvider,
52 public ::com::sun::star::beans::XPropertyState,
53 public ::com::sun::star::beans::XMultiPropertyStates,
54 public ::com::sun::star::style::XStyleSupplier
56 public:
57 OPropertySet( ::osl::Mutex & rMutex );
58 virtual ~OPropertySet();
60 protected:
61 explicit OPropertySet( const OPropertySet & rOther, ::osl::Mutex & rMutex );
63 void SetNewValuesExplicitlyEvenIfTheyEqualDefault();
65 /** implement this method to provide default values for all properties
66 supporting defaults. If a property does not have a default value, you
67 may throw an UnknownPropertyException.
69 virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
70 throw(::com::sun::star::beans::UnknownPropertyException) = 0;
72 /** The InfoHelper table contains all property names and types of
73 this object.
75 @return the object that provides information for the
76 PropertySetInfo
78 @see ::cppu::OPropertySetHelper
80 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() = 0;
83 /** Try to convert the value <code>rValue</code> to the type required by the
84 property associated with <code>nHandle</code>.
86 Overload this method to take influence in modification of properties.
88 If the conversion changed , </sal_True> is returned and the converted value
89 is in <code>rConvertedValue</code>. The former value is contained in
90 <code>rOldValue</code>.
92 After this call returns successfully, the vetoable listeners are
93 notified.
95 @throws IllegalArgumentException, if the conversion was not successful,
96 or if there is no corresponding property to the given handle.
98 @param rConvertedValue the converted value. Only set if return is true.
99 @param rOldValue the old value. Only set if return is true.
100 @param nHandle the handle of the property.
102 @return true, if the conversion was successful and converted value
103 differs from the old value.
105 @see ::cppu::OPropertySetHelper
107 virtual sal_Bool SAL_CALL convertFastPropertyValue
108 ( ::com::sun::star::uno::Any & rConvertedValue,
109 ::com::sun::star::uno::Any & rOldValue,
110 sal_Int32 nHandle,
111 const ::com::sun::star::uno::Any& rValue )
112 throw (::com::sun::star::lang::IllegalArgumentException);
114 /** The same as setFastProperyValue; nHandle is always valid.
115 The changes must not be broadcasted in this method.
117 @attention
118 Although you are permitted to throw any UNO exception, only the following
119 are valid for usage:
120 -- ::com::sun::star::beans::UnknownPropertyException
121 -- ::com::sun::star::beans::PropertyVetoException
122 -- ::com::sun::star::lang::IllegalArgumentException
123 -- ::com::sun::star::lang::WrappedTargetException
124 -- ::com::sun::star::uno::RuntimeException
126 @param nHandle handle
127 @param rValue value
129 @see ::cppu::OPropertySetHelper
131 virtual void SAL_CALL setFastPropertyValue_NoBroadcast
132 ( sal_Int32 nHandle,
133 const ::com::sun::star::uno::Any& rValue )
134 throw (::com::sun::star::uno::Exception);
137 The same as getFastProperyValue, but return the value through rValue and
138 nHandle is always valid.
140 @see ::cppu::OPropertySetHelper
142 virtual void SAL_CALL getFastPropertyValue
143 ( ::com::sun::star::uno::Any& rValue,
144 sal_Int32 nHandle ) const;
146 /// make original interface function visible again
147 using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue;
149 /** implement this method in derived classes to get called when properties
150 change.
152 virtual void firePropertyChangeEvent();
154 /// call this when a derived component is disposed
155 virtual void disposePropertySet();
157 // ========================================
158 // Interfaces
159 // ========================================
161 // ____ XInterface ____
162 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
163 throw (::com::sun::star::uno::RuntimeException);
165 // ____ XTypeProvider ____
166 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL
167 getTypes()
168 throw (::com::sun::star::uno::RuntimeException);
169 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
170 getImplementationId()
171 throw (::com::sun::star::uno::RuntimeException);
173 // ____ XPropertyState ____
174 virtual ::com::sun::star::beans::PropertyState SAL_CALL
175 getPropertyState( const OUString& PropertyName )
176 throw (::com::sun::star::beans::UnknownPropertyException,
177 ::com::sun::star::uno::RuntimeException);
178 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL
179 getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName )
180 throw (::com::sun::star::beans::UnknownPropertyException,
181 ::com::sun::star::uno::RuntimeException);
182 virtual void SAL_CALL
183 setPropertyToDefault( const OUString& PropertyName )
184 throw (::com::sun::star::beans::UnknownPropertyException,
185 ::com::sun::star::uno::RuntimeException);
186 virtual ::com::sun::star::uno::Any SAL_CALL
187 getPropertyDefault( const OUString& aPropertyName )
188 throw (::com::sun::star::beans::UnknownPropertyException,
189 ::com::sun::star::lang::WrappedTargetException,
190 ::com::sun::star::uno::RuntimeException);
192 // ____ XMultiPropertyStates ____
193 // Note: getPropertyStates() is already implemented in XPropertyState with the
194 // same signature
195 virtual void SAL_CALL
196 setAllPropertiesToDefault()
197 throw (::com::sun::star::uno::RuntimeException);
198 virtual void SAL_CALL
199 setPropertiesToDefault( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames )
200 throw (::com::sun::star::beans::UnknownPropertyException,
201 ::com::sun::star::uno::RuntimeException);
202 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL
203 getPropertyDefaults( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames )
204 throw (::com::sun::star::beans::UnknownPropertyException,
205 ::com::sun::star::lang::WrappedTargetException,
206 ::com::sun::star::uno::RuntimeException);
208 // ____ XStyleSupplier ____
209 virtual ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > SAL_CALL getStyle()
210 throw (::com::sun::star::uno::RuntimeException);
211 virtual void SAL_CALL setStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >& xStyle )
212 throw (::com::sun::star::lang::IllegalArgumentException,
213 ::com::sun::star::uno::RuntimeException);
215 // ____ XMultiPropertySet ____
216 virtual void SAL_CALL setPropertyValues(
217 const ::com::sun::star::uno::Sequence< OUString >& PropertyNames,
218 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values )
219 throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
221 // ____ XFastPropertySet ____
222 virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
223 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);
225 // Note: it is assumed that the base class implements setPropertyValue by
226 // using setFastPropertyValue
228 private:
229 /// reference to mutex of class deriving from here
230 ::osl::Mutex & m_rMutex;
232 /// pImpl idiom implementation
233 ::std::auto_ptr< impl::ImplOPropertySet > m_pImplProperties;
234 bool m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault;
237 } // namespace property
239 // CHART_OPROPERTYSET_HXX
240 #endif
242 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */