1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_CHART2_SOURCE_INC_OPROPERTYSET_HXX
20 #define INCLUDED_CHART2_SOURCE_INC_OPROPERTYSET_HXX
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 <boost/scoped_ptr.hpp>
42 { class ImplOPropertySet
; }
44 class OOO_DLLPUBLIC_CHARTTOOLS OPropertySet
:
45 public ::cppu::OBroadcastHelper
,
46 // includes beans::XPropertySet, XMultiPropertySet and XFastPropertySet
47 public ::cppu::OPropertySetHelper
,
48 // includes uno::XWeak (and XInterface, esp. ref-counting)
50 public ::com::sun::star::lang::XTypeProvider
,
51 public ::com::sun::star::beans::XPropertyState
,
52 public ::com::sun::star::beans::XMultiPropertyStates
,
53 public ::com::sun::star::style::XStyleSupplier
56 OPropertySet( ::osl::Mutex
& rMutex
);
57 virtual ~OPropertySet();
60 explicit OPropertySet( const OPropertySet
& rOther
, ::osl::Mutex
& rMutex
);
62 void SetNewValuesExplicitlyEvenIfTheyEqualDefault();
64 /** implement this method to provide default values for all properties
65 supporting defaults. If a property does not have a default value, you
66 may throw an UnknownPropertyException.
68 virtual ::com::sun::star::uno::Any
GetDefaultValue( sal_Int32 nHandle
) const
69 throw (css::beans::UnknownPropertyException
,
70 css::uno::RuntimeException
) = 0;
72 /** The InfoHelper table contains all property names and types of
75 @return the object that provides information for the
78 @see ::cppu::OPropertySetHelper
80 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() SAL_OVERRIDE
= 0;
82 /** Try to convert the value <code>rValue</code> to the type required by the
83 property associated with <code>nHandle</code>.
85 Override this method to take influence in modification of properties.
87 If the conversion changed , </sal_True> is returned and the converted value
88 is in <code>rConvertedValue</code>. The former value is contained in
89 <code>rOldValue</code>.
91 After this call returns successfully, the vetoable listeners are
94 @throws IllegalArgumentException, if the conversion was not successful,
95 or if there is no corresponding property to the given handle.
97 @param rConvertedValue the converted value. Only set if return is true.
98 @param rOldValue the old value. Only set if return is true.
99 @param nHandle the handle of the property.
101 @return true, if the conversion was successful and converted value
102 differs from the old value.
104 @see ::cppu::OPropertySetHelper
106 virtual sal_Bool SAL_CALL convertFastPropertyValue
107 ( ::com::sun::star::uno::Any
& rConvertedValue
,
108 ::com::sun::star::uno::Any
& rOldValue
,
110 const ::com::sun::star::uno::Any
& rValue
)
111 throw (::com::sun::star::lang::IllegalArgumentException
) SAL_OVERRIDE
;
113 /** The same as setFastProperyValue; nHandle is always valid.
114 The changes must not be broadcasted in this method.
117 Although you are permitted to throw any UNO exception, only the following
119 -- ::com::sun::star::beans::UnknownPropertyException
120 -- ::com::sun::star::beans::PropertyVetoException
121 -- ::com::sun::star::lang::IllegalArgumentException
122 -- ::com::sun::star::lang::WrappedTargetException
123 -- ::com::sun::star::uno::RuntimeException
125 @param nHandle handle
128 @see ::cppu::OPropertySetHelper
130 virtual void SAL_CALL setFastPropertyValue_NoBroadcast
132 const ::com::sun::star::uno::Any
& rValue
)
133 throw (::com::sun::star::uno::Exception
, std::exception
) SAL_OVERRIDE
;
136 The same as getFastProperyValue, but return the value through rValue and
137 nHandle is always valid.
139 @see ::cppu::OPropertySetHelper
141 virtual void SAL_CALL getFastPropertyValue
142 ( ::com::sun::star::uno::Any
& rValue
,
143 sal_Int32 nHandle
) const SAL_OVERRIDE
;
145 /// make original interface function visible again
146 using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue
;
148 /** implement this method in derived classes to get called when properties
151 virtual void firePropertyChangeEvent();
155 // ____ XInterface ____
156 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& aType
)
157 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
159 // ____ XTypeProvider ____
160 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
162 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
163 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
164 getImplementationId()
165 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
167 // ____ XPropertyState ____
168 virtual ::com::sun::star::beans::PropertyState SAL_CALL
169 getPropertyState( const OUString
& PropertyName
)
170 throw (::com::sun::star::beans::UnknownPropertyException
,
171 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
172 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyState
> SAL_CALL
173 getPropertyStates( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyName
)
174 throw (::com::sun::star::beans::UnknownPropertyException
,
175 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
176 virtual void SAL_CALL
177 setPropertyToDefault( const OUString
& PropertyName
)
178 throw (::com::sun::star::beans::UnknownPropertyException
,
179 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
180 virtual ::com::sun::star::uno::Any SAL_CALL
181 getPropertyDefault( const OUString
& aPropertyName
)
182 throw (::com::sun::star::beans::UnknownPropertyException
,
183 ::com::sun::star::lang::WrappedTargetException
,
184 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
186 // ____ XMultiPropertyStates ____
187 // Note: getPropertyStates() is already implemented in XPropertyState with the
189 virtual void SAL_CALL
190 setAllPropertiesToDefault()
191 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
192 virtual void SAL_CALL
193 setPropertiesToDefault( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
)
194 throw (::com::sun::star::beans::UnknownPropertyException
,
195 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
196 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> SAL_CALL
197 getPropertyDefaults( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
)
198 throw (::com::sun::star::beans::UnknownPropertyException
,
199 ::com::sun::star::lang::WrappedTargetException
,
200 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
202 // ____ XStyleSupplier ____
203 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::style::XStyle
> SAL_CALL
getStyle()
204 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
205 virtual void SAL_CALL
setStyle( const ::com::sun::star::uno::Reference
< ::com::sun::star::style::XStyle
>& xStyle
)
206 throw (::com::sun::star::lang::IllegalArgumentException
,
207 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
209 // ____ XMultiPropertySet ____
210 virtual void SAL_CALL
setPropertyValues(
211 const ::com::sun::star::uno::Sequence
< OUString
>& PropertyNames
,
212 const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& Values
)
213 throw(::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
215 // ____ XFastPropertySet ____
216 virtual void SAL_CALL
setFastPropertyValue( sal_Int32 nHandle
, const ::com::sun::star::uno::Any
& rValue
)
217 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
, std::exception
) SAL_OVERRIDE
;
219 // Note: it is assumed that the base class implements setPropertyValue by
220 // using setFastPropertyValue
223 /// reference to mutex of class deriving from here
224 ::osl::Mutex
& m_rMutex
;
226 /// pImpl idiom implementation
227 boost::scoped_ptr
< impl::ImplOPropertySet
> m_pImplProperties
;
228 bool m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault
;
231 } // namespace property
233 // INCLUDED_CHART2_SOURCE_INC_OPROPERTYSET_HXX
236 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */