Bump for 3.6-28
[LibreOffice.git] / chart2 / source / inc / OPropertySet.hxx
blob703543a1124b7d49658539bd0fc17eb584b2d967
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef CHART_OPROPERTYSET_HXX
29 #define CHART_OPROPERTYSET_HXX
31 // helper classes
32 #include <cppuhelper/propshlp.hxx>
33 #include <cppuhelper/interfacecontainer.hxx>
34 #include <cppuhelper/weak.hxx>
36 // interfaces and types
37 #include <com/sun/star/lang/XTypeProvider.hpp>
38 #include <com/sun/star/beans/XPropertyState.hpp>
39 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
40 #include <com/sun/star/beans/Property.hpp>
41 #include <com/sun/star/style/XStyleSupplier.hpp>
42 #include <osl/mutex.hxx>
43 #include "charttoolsdllapi.hxx"
45 #include <memory>
47 namespace property
50 namespace impl
51 { class ImplOPropertySet; }
54 class OOO_DLLPUBLIC_CHARTTOOLS OPropertySet :
55 public ::cppu::OBroadcastHelper,
56 // includes beans::XPropertySet, XMultiPropertySet and XFastPropertySet
57 public ::cppu::OPropertySetHelper,
58 // includes uno::XWeak (and XInterface, esp. ref-counting)
60 public ::com::sun::star::lang::XTypeProvider,
61 public ::com::sun::star::beans::XPropertyState,
62 public ::com::sun::star::beans::XMultiPropertyStates,
63 public ::com::sun::star::style::XStyleSupplier
65 public:
66 OPropertySet( ::osl::Mutex & rMutex );
67 virtual ~OPropertySet();
69 protected:
70 explicit OPropertySet( const OPropertySet & rOther, ::osl::Mutex & rMutex );
72 void SetNewValuesExplicitlyEvenIfTheyEqualDefault();
74 /** implement this method to provide default values for all properties
75 supporting defaults. If a property does not have a default value, you
76 may throw an UnknownPropertyException.
78 virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
79 throw(::com::sun::star::beans::UnknownPropertyException) = 0;
81 /** The InfoHelper table contains all property names and types of
82 this object.
84 @return the object that provides information for the
85 PropertySetInfo
87 @see ::cppu::OPropertySetHelper
89 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() = 0;
92 /** Try to convert the value <code>rValue</code> to the type required by the
93 property associated with <code>nHandle</code>.
95 Overload this method to take influence in modification of properties.
97 If the conversion changed , </sal_True> is returned and the converted value
98 is in <code>rConvertedValue</code>. The former value is contained in
99 <code>rOldValue</code>.
101 After this call returns successfully, the vetoable listeners are
102 notified.
104 @throws IllegalArgumentException, if the conversion was not successful,
105 or if there is no corresponding property to the given handle.
107 @param rConvertedValue the converted value. Only set if return is true.
108 @param rOldValue the old value. Only set if return is true.
109 @param nHandle the handle of the property.
111 @return true, if the conversion was successful and converted value
112 differs from the old value.
114 @see ::cppu::OPropertySetHelper
116 virtual sal_Bool SAL_CALL convertFastPropertyValue
117 ( ::com::sun::star::uno::Any & rConvertedValue,
118 ::com::sun::star::uno::Any & rOldValue,
119 sal_Int32 nHandle,
120 const ::com::sun::star::uno::Any& rValue )
121 throw (::com::sun::star::lang::IllegalArgumentException);
123 /** The same as setFastProperyValue; nHandle is always valid.
124 The changes must not be broadcasted in this method.
126 @attention
127 Although you are permitted to throw any UNO exception, only the following
128 are valid for usage:
129 -- ::com::sun::star::beans::UnknownPropertyException
130 -- ::com::sun::star::beans::PropertyVetoException
131 -- ::com::sun::star::lang::IllegalArgumentException
132 -- ::com::sun::star::lang::WrappedTargetException
133 -- ::com::sun::star::uno::RuntimeException
135 @param nHandle handle
136 @param rValue value
138 @see ::cppu::OPropertySetHelper
140 virtual void SAL_CALL setFastPropertyValue_NoBroadcast
141 ( sal_Int32 nHandle,
142 const ::com::sun::star::uno::Any& rValue )
143 throw (::com::sun::star::uno::Exception);
146 The same as getFastProperyValue, but return the value through rValue and
147 nHandle is always valid.
149 @see ::cppu::OPropertySetHelper
151 virtual void SAL_CALL getFastPropertyValue
152 ( ::com::sun::star::uno::Any& rValue,
153 sal_Int32 nHandle ) const;
155 /// make original interface function visible again
156 using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue;
158 /** implement this method in derived classes to get called when properties
159 change.
161 virtual void firePropertyChangeEvent();
163 /// call this when a derived component is disposed
164 virtual void disposePropertySet();
166 // ========================================
167 // Interfaces
168 // ========================================
170 // ____ XInterface ____
171 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
172 throw (::com::sun::star::uno::RuntimeException);
174 // ____ XTypeProvider ____
175 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL
176 getTypes()
177 throw (::com::sun::star::uno::RuntimeException);
178 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
179 getImplementationId()
180 throw (::com::sun::star::uno::RuntimeException);
182 // ____ XPropertyState ____
183 virtual ::com::sun::star::beans::PropertyState SAL_CALL
184 getPropertyState( const ::rtl::OUString& PropertyName )
185 throw (::com::sun::star::beans::UnknownPropertyException,
186 ::com::sun::star::uno::RuntimeException);
187 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL
188 getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName )
189 throw (::com::sun::star::beans::UnknownPropertyException,
190 ::com::sun::star::uno::RuntimeException);
191 virtual void SAL_CALL
192 setPropertyToDefault( const ::rtl::OUString& PropertyName )
193 throw (::com::sun::star::beans::UnknownPropertyException,
194 ::com::sun::star::uno::RuntimeException);
195 virtual ::com::sun::star::uno::Any SAL_CALL
196 getPropertyDefault( const ::rtl::OUString& aPropertyName )
197 throw (::com::sun::star::beans::UnknownPropertyException,
198 ::com::sun::star::lang::WrappedTargetException,
199 ::com::sun::star::uno::RuntimeException);
201 // ____ XMultiPropertyStates ____
202 // Note: getPropertyStates() is already implemented in XPropertyState with the
203 // same signature
204 virtual void SAL_CALL
205 setAllPropertiesToDefault()
206 throw (::com::sun::star::uno::RuntimeException);
207 virtual void SAL_CALL
208 setPropertiesToDefault( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames )
209 throw (::com::sun::star::beans::UnknownPropertyException,
210 ::com::sun::star::uno::RuntimeException);
211 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL
212 getPropertyDefaults( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames )
213 throw (::com::sun::star::beans::UnknownPropertyException,
214 ::com::sun::star::lang::WrappedTargetException,
215 ::com::sun::star::uno::RuntimeException);
217 // ____ XStyleSupplier ____
218 virtual ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > SAL_CALL getStyle()
219 throw (::com::sun::star::uno::RuntimeException);
220 virtual void SAL_CALL setStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >& xStyle )
221 throw (::com::sun::star::lang::IllegalArgumentException,
222 ::com::sun::star::uno::RuntimeException);
224 // ____ XMultiPropertySet ____
225 virtual void SAL_CALL setPropertyValues(
226 const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
227 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values )
228 throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
230 // ____ XFastPropertySet ____
231 virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
232 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);
234 // Note: it is assumed that the base class implements setPropertyValue by
235 // using setFastPropertyValue
237 private:
238 /// reference to mutex of class deriving from here
239 ::osl::Mutex & m_rMutex;
241 /// pImpl idiom implementation
242 ::std::auto_ptr< impl::ImplOPropertySet > m_pImplProperties;
243 bool m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault;
246 } // namespace property
248 // CHART_OPROPERTYSET_HXX
249 #endif
251 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */