16da5f311SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
36da5f311SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
46da5f311SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
56da5f311SAndrew Rist  * distributed with this work for additional information
66da5f311SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
76da5f311SAndrew Rist  * to you under the Apache License, Version 2.0 (the
86da5f311SAndrew Rist  * "License"); you may not use this file except in compliance
96da5f311SAndrew Rist  * with the License.  You may obtain a copy of the License at
106da5f311SAndrew Rist  *
116da5f311SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
126da5f311SAndrew Rist  *
136da5f311SAndrew Rist  * Unless required by applicable law or agreed to in writing,
146da5f311SAndrew Rist  * software distributed under the License is distributed on an
156da5f311SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
166da5f311SAndrew Rist  * KIND, either express or implied.  See the License for the
176da5f311SAndrew Rist  * specific language governing permissions and limitations
186da5f311SAndrew Rist  * under the License.
196da5f311SAndrew Rist  *
206da5f311SAndrew Rist  *************************************************************/
216da5f311SAndrew Rist 
226da5f311SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX
25cdf0e10cSrcweir #define INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX \
26cdf0e10cSrcweir     INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include "sal/config.h"
29cdf0e10cSrcweir #include "com/sun/star/beans/PropertyVetoException.hpp"
30cdf0e10cSrcweir #include "com/sun/star/beans/UnknownPropertyException.hpp"
31cdf0e10cSrcweir #include "com/sun/star/beans/XFastPropertySet.hpp"
32cdf0e10cSrcweir #include "com/sun/star/beans/XPropertyAccess.hpp"
33cdf0e10cSrcweir #include "com/sun/star/beans/XPropertySet.hpp"
34cdf0e10cSrcweir #include "com/sun/star/lang/IllegalArgumentException.hpp"
35cdf0e10cSrcweir #include "com/sun/star/lang/WrappedTargetException.hpp"
36cdf0e10cSrcweir #include "com/sun/star/uno/Reference.hxx"
37cdf0e10cSrcweir #include "com/sun/star/uno/RuntimeException.hpp"
38cdf0e10cSrcweir #include "com/sun/star/uno/Sequence.hxx"
39cdf0e10cSrcweir #include "sal/types.h"
40cdf0e10cSrcweir 
41cdf0e10cSrcweir /// @HTML
42cdf0e10cSrcweir 
43cdf0e10cSrcweir namespace com { namespace sun { namespace star {
44cdf0e10cSrcweir     namespace beans {
45cdf0e10cSrcweir         class XPropertyChangeListener;
46cdf0e10cSrcweir         class XPropertySetInfo;
47cdf0e10cSrcweir         class XVetoableChangeListener;
48cdf0e10cSrcweir         struct PropertyValue;
49cdf0e10cSrcweir     }
50cdf0e10cSrcweir     namespace uno {
51cdf0e10cSrcweir         class Any;
52cdf0e10cSrcweir         class Type;
53cdf0e10cSrcweir         class XComponentContext;
54cdf0e10cSrcweir     }
55cdf0e10cSrcweir } } }
56cdf0e10cSrcweir namespace rtl { class OUString; }
57cdf0e10cSrcweir 
58cdf0e10cSrcweir namespace cppu {
59cdf0e10cSrcweir 
60cdf0e10cSrcweir template< typename T > class PropertySetMixin;
61cdf0e10cSrcweir 
62cdf0e10cSrcweir // Suppress warnings about virtual functions but non-virtual destructor:
63cdf0e10cSrcweir #if defined _MSC_VER
64cdf0e10cSrcweir #pragma warning(push)
65cdf0e10cSrcweir #pragma warning(disable: 4265)
66cdf0e10cSrcweir #endif
67cdf0e10cSrcweir 
68cdf0e10cSrcweir /**
69cdf0e10cSrcweir    @short A helper base class for <code>cppu::PropertySetMixin</code>.
70cdf0e10cSrcweir 
71cdf0e10cSrcweir    @descr See the documentation of <code>cppu::PropertySetMixin</code> for
72cdf0e10cSrcweir    further details.
73cdf0e10cSrcweir 
74cdf0e10cSrcweir    @descr That <code>cppu::PropertySetMixin</code> is derived from this
75cdf0e10cSrcweir    base class should be considered an implementation detail.  The functionality
76cdf0e10cSrcweir    of <code>cppu::PropertySetMixin</code> that is inherited from this base
77cdf0e10cSrcweir    class and is visible to subclasses of
78cdf0e10cSrcweir    <code>cppu::PropertySetMixin</code> should be treated by such
79cdf0e10cSrcweir    subclasses as being provided by <code>cppu::PropertySetMixin</code>
80cdf0e10cSrcweir    directly (e.g., in such subclasses, use
81cdf0e10cSrcweir    &ldquo;<code>PropertySetMixin::Implements</code>&rdquo; instead of
82cdf0e10cSrcweir    &ldquo;<code>PropertySetMixinImpl::Implements</code>&rdquo;).
83cdf0e10cSrcweir 
84cdf0e10cSrcweir    @since UDK 3.2.1
85cdf0e10cSrcweir */
86cdf0e10cSrcweir class PropertySetMixinImpl:
87cdf0e10cSrcweir     public com::sun::star::beans::XPropertySet,
88cdf0e10cSrcweir     public com::sun::star::beans::XFastPropertySet,
89cdf0e10cSrcweir     public com::sun::star::beans::XPropertyAccess
90cdf0e10cSrcweir {
91cdf0e10cSrcweir protected:
92cdf0e10cSrcweir     /**
93cdf0e10cSrcweir        @short Flags used by subclasses of
94cdf0e10cSrcweir        <code>cppu::PropertySetMixin</code> to specify what UNO interface
95cdf0e10cSrcweir        types shall be supported.
96cdf0e10cSrcweir     */
97cdf0e10cSrcweir     enum Implements {
98cdf0e10cSrcweir         /**
99cdf0e10cSrcweir            @short Flag specifying that the UNO interface type
100cdf0e10cSrcweir            <code>com::sun::star::beans::XPropertySet</code> shall be supported.
101cdf0e10cSrcweir         */
102cdf0e10cSrcweir         IMPLEMENTS_PROPERTY_SET = 1,
103cdf0e10cSrcweir 
104cdf0e10cSrcweir         /**
105cdf0e10cSrcweir            @short Flag specifying that the UNO interface type
106cdf0e10cSrcweir            <code>com::sun::star::beans::XFastPropertySet</code> shall be
107cdf0e10cSrcweir            supported.
108cdf0e10cSrcweir         */
109cdf0e10cSrcweir         IMPLEMENTS_FAST_PROPERTY_SET = 2,
110cdf0e10cSrcweir 
111cdf0e10cSrcweir         /**
112cdf0e10cSrcweir            @short Flag specifying that the UNO interface type
113cdf0e10cSrcweir            <code>com::sun::star::beans::XPropertyAccess</code> shall be
114cdf0e10cSrcweir            supported.
115cdf0e10cSrcweir         */
116cdf0e10cSrcweir         IMPLEMENTS_PROPERTY_ACCESS = 4
117cdf0e10cSrcweir     };
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     /**
120cdf0e10cSrcweir        @short A class used by subclasses of
121cdf0e10cSrcweir        <code>cppu::PropertySetMixin</code> when implementing UNO interface
122cdf0e10cSrcweir        type attribute setter functions.
123cdf0e10cSrcweir 
124cdf0e10cSrcweir        @descr This class is not thread safe; that is, the constructor,
125cdf0e10cSrcweir        <code>notify</code>, and the destructor must be called from the same
126cdf0e10cSrcweir        thread.
127cdf0e10cSrcweir 
128cdf0e10cSrcweir        @descr See <code>cppu::PropertySetMixinImpl::prepareSet</code> for
129cdf0e10cSrcweir        further details.
130cdf0e10cSrcweir     */
131cdf0e10cSrcweir     class BoundListeners {
132cdf0e10cSrcweir     public:
133cdf0e10cSrcweir         /**
134cdf0e10cSrcweir            @short The constructor.
135cdf0e10cSrcweir 
136cdf0e10cSrcweir            @descr May throw <code>std::bad_alloc</code>.
137cdf0e10cSrcweir         */
138cdf0e10cSrcweir         BoundListeners();
139cdf0e10cSrcweir 
140cdf0e10cSrcweir         /**
141cdf0e10cSrcweir            @short The destructor.
142cdf0e10cSrcweir 
143cdf0e10cSrcweir            @descr Does not throw.
144cdf0e10cSrcweir         */
145cdf0e10cSrcweir         ~BoundListeners();
146cdf0e10cSrcweir 
147cdf0e10cSrcweir         /**
148cdf0e10cSrcweir            @short Notifies any
149cdf0e10cSrcweir            <code>com::sun::star::beans::XPropertyChangeListener</code>s.
150cdf0e10cSrcweir 
151cdf0e10cSrcweir            @descr May throw <code>com::sun::star::uno::RuntimeException</code>
152cdf0e10cSrcweir            and <code>std::bad_alloc</code>.
153cdf0e10cSrcweir 
154cdf0e10cSrcweir            @descr See <code>cppu::PropertySetMixinImpl::prepareSet</code>
155cdf0e10cSrcweir            for further details.
156cdf0e10cSrcweir          */
157cdf0e10cSrcweir         void notify() const;
158cdf0e10cSrcweir 
159cdf0e10cSrcweir     private:
160*88ca1099SHerbert Dürr         BoundListeners( const BoundListeners&); // not defined
161*88ca1099SHerbert Dürr         void operator=( const BoundListeners&); // not defined
162cdf0e10cSrcweir 
163cdf0e10cSrcweir         class Impl;
164cdf0e10cSrcweir         Impl * m_impl;
165cdf0e10cSrcweir 
166cdf0e10cSrcweir         friend class PropertySetMixinImpl;
167cdf0e10cSrcweir     };
168cdf0e10cSrcweir 
169cdf0e10cSrcweir     /**
170cdf0e10cSrcweir        @short A function used by subclasses of
171cdf0e10cSrcweir        <code>cppu::PropertySetMixin</code> when implementing UNO interface
172cdf0e10cSrcweir        type attribute setter functions.
173cdf0e10cSrcweir 
174cdf0e10cSrcweir        @descr First, this function checks whether this instance has already been
175cdf0e10cSrcweir        disposed (see <code>cppu::PropertySetMixinImpl::dispose</code>),
176cdf0e10cSrcweir        and throws a <code>com::sun::star::lang::DisposedException</code> if
177cdf0e10cSrcweir        applicable.  For a constrained attribute (whose setter can explicitly
178cdf0e10cSrcweir        raise <code>com::sun::star::beans::PropertyVetoException</code>), this
179cdf0e10cSrcweir        function notifies any
180cdf0e10cSrcweir        <code>com::sun::star::beans::XVetoableChangeListener</code>s.  For a
181cdf0e10cSrcweir        bound attribute, this function modifies the passed-in
182cdf0e10cSrcweir        <code>boundListeners</code> so that it can afterwards be used to notify
183cdf0e10cSrcweir        any <code>com::sun::star::beans::XPropertyChangeListener</code>s.  This
184cdf0e10cSrcweir        function should be called before storing the new attribute value, and
185cdf0e10cSrcweir        <code>boundListeners->notify()</code> should be called exactly once after
186cdf0e10cSrcweir        storing the new attribute value (in case the attribute is bound;
187cdf0e10cSrcweir        otherwise, calling <code>boundListeners->notify()</code> is ignored).
188cdf0e10cSrcweir        Furthermore, <code>boundListeners->notify()</code> and this function have
189cdf0e10cSrcweir        to be called from the same thread.
190cdf0e10cSrcweir 
191cdf0e10cSrcweir        @descr May throw
192cdf0e10cSrcweir        <code>com::sun::star::beans::PropertyVetoException</code>,
193cdf0e10cSrcweir        <code>com::sun::star::uno::RuntimeException</code> (and
194cdf0e10cSrcweir        <code>com::sun::star::lang::DisposedException</code> in particular), and
195cdf0e10cSrcweir        <code>std::bad_alloc</code>.
196cdf0e10cSrcweir 
197cdf0e10cSrcweir        @param propertyName  the name of the property (which is the same as the
198cdf0e10cSrcweir        name of the attribute that is going to be set)
199cdf0e10cSrcweir 
200cdf0e10cSrcweir        @param oldValue the property value corresponding to the old attribute
201cdf0e10cSrcweir        value.  This is only used as
202cdf0e10cSrcweir        <code>com::sun::star::beans::PropertyChangeEvent::OldValue</code>, which
203cdf0e10cSrcweir        is rather useless, anyway (see &ldquo;Using the Observer Pattern&rdquo;
204cdf0e10cSrcweir        in <a href="http://tools.openoffice.org/CodingGuidelines.sxw">
205cdf0e10cSrcweir        <cite>OpenOffice.org Coding Guidelines</cite></a>).  If the attribute
206cdf0e10cSrcweir        that is going to be set is neither bound nor constrained, or if
207cdf0e10cSrcweir        <code>com::sun::star::beans::PropertyChangeEvent::OldValue</code> should
208cdf0e10cSrcweir        not be set, a <code>VOID</code> <code>Any</code> can be used instead.
209cdf0e10cSrcweir 
210cdf0e10cSrcweir        @param newValue the property value corresponding to the new
211cdf0e10cSrcweir        attribute value.  This is only used as
212cdf0e10cSrcweir        <code>com::sun::star::beans::PropertyChangeEvent::NewValue</code>, which
213cdf0e10cSrcweir        is rather useless, anyway (see &ldquo;Using the Observer Pattern&rdquo;
214cdf0e10cSrcweir        in <a href="http://tools.openoffice.org/CodingGuidelines.sxw">
215cdf0e10cSrcweir        <cite>OpenOffice.org Coding Guidelines</cite></a>), <em>unless</em> the
216cdf0e10cSrcweir        attribute that is going to be set is constrained.  If the attribute
217cdf0e10cSrcweir        that is going to be set is neither bound nor constrained, or if it is
218cdf0e10cSrcweir        only bound but
219cdf0e10cSrcweir        <code>com::sun::star::beans::PropertyChangeEvent::NewValue</code> should
220cdf0e10cSrcweir        not be set, a <code>VOID</code> <code>Any</code> can be used instead.
221cdf0e10cSrcweir 
222cdf0e10cSrcweir        @param boundListeners  a pointer to a fresh
223cdf0e10cSrcweir        <code>cppu::PropertySetMixinImpl::BoundListeners</code> instance
224cdf0e10cSrcweir        (which has not been passed to this function before, and on which
225cdf0e10cSrcweir        <code>notify</code> has not yet been called); may only be null if the
226cdf0e10cSrcweir        attribute that is going to be set is not bound
227cdf0e10cSrcweir     */
228cdf0e10cSrcweir     void prepareSet(
229cdf0e10cSrcweir         rtl::OUString const & propertyName,
230cdf0e10cSrcweir         com::sun::star::uno::Any const & oldValue,
231cdf0e10cSrcweir         com::sun::star::uno::Any const & newValue,
232cdf0e10cSrcweir         BoundListeners * boundListeners);
233cdf0e10cSrcweir 
234cdf0e10cSrcweir     /**
235cdf0e10cSrcweir        @short Mark this instance as being disposed.
236cdf0e10cSrcweir 
237cdf0e10cSrcweir        @descr See <code>com::sun::star::lang::XComponent</code> for the general
238cdf0e10cSrcweir        concept of disposing UNO objects.  On the first call to this function,
239cdf0e10cSrcweir        all registered listeners
240cdf0e10cSrcweir        (<code>com::sun::star::beans::XPropertyChangeListener</code>s and
241cdf0e10cSrcweir        <code>com::sun::star::beans::XVetoableChangeListener</code>s) are
242cdf0e10cSrcweir        notified of the disposing source.  Any subsequent calls to this function
243cdf0e10cSrcweir        are ignored.
244cdf0e10cSrcweir 
245cdf0e10cSrcweir        @descr May throw <code>com::sun::star::uno::RuntimeException</code> and
246cdf0e10cSrcweir        <code>std::bad_alloc</code>.
247cdf0e10cSrcweir      */
248cdf0e10cSrcweir     void dispose();
249cdf0e10cSrcweir 
250cdf0e10cSrcweir     /**
251cdf0e10cSrcweir        @short A function used by subclasses of
252cdf0e10cSrcweir        <code>cppu::PropertySetMixin</code> when implementing
253cdf0e10cSrcweir        <code>com::sun::star::uno::XInterface::queryInterface</code>.
254cdf0e10cSrcweir 
255cdf0e10cSrcweir        @descr This function checks for support of any of the UNO interface types
256cdf0e10cSrcweir        specified in the call of the <code>cppu::PropertySetMixin</code>
257cdf0e10cSrcweir        constructor.  It does not check for any other UNO interface types (not
258cdf0e10cSrcweir        even for <code>com::sun::star::uno::XInterface</code>), and should not
259cdf0e10cSrcweir        be used directly as the implementation of
260cdf0e10cSrcweir        <code>com::sun::star::uno::XInterface::queryInterface</code> of this UNO
261cdf0e10cSrcweir        object.
262cdf0e10cSrcweir     */
263cdf0e10cSrcweir     virtual com::sun::star::uno::Any SAL_CALL queryInterface(
264cdf0e10cSrcweir         com::sun::star::uno::Type const & type)
265cdf0e10cSrcweir         throw (com::sun::star::uno::RuntimeException);
266cdf0e10cSrcweir 
267cdf0e10cSrcweir     // @see com::sun::star::beans::XPropertySet::getPropertySetInfo
268cdf0e10cSrcweir     virtual
269cdf0e10cSrcweir     com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >
270cdf0e10cSrcweir     SAL_CALL getPropertySetInfo() throw (com::sun::star::uno::RuntimeException);
271cdf0e10cSrcweir 
272cdf0e10cSrcweir     // @see com::sun::star::beans::XPropertySet::setPropertyValue
273cdf0e10cSrcweir     virtual void SAL_CALL setPropertyValue(
274cdf0e10cSrcweir         rtl::OUString const & propertyName,
275cdf0e10cSrcweir         com::sun::star::uno::Any const & value)
276cdf0e10cSrcweir         throw (
277cdf0e10cSrcweir             com::sun::star::beans::UnknownPropertyException,
278cdf0e10cSrcweir             com::sun::star::beans::PropertyVetoException,
279cdf0e10cSrcweir             com::sun::star::lang::IllegalArgumentException,
280cdf0e10cSrcweir             com::sun::star::lang::WrappedTargetException,
281cdf0e10cSrcweir             com::sun::star::uno::RuntimeException);
282cdf0e10cSrcweir 
283cdf0e10cSrcweir     // @see com::sun::star::beans::XPropertySet::getPropertyValue
284cdf0e10cSrcweir     virtual com::sun::star::uno::Any SAL_CALL getPropertyValue(
285cdf0e10cSrcweir         rtl::OUString const & propertyName)
286cdf0e10cSrcweir         throw (
287cdf0e10cSrcweir             com::sun::star::beans::UnknownPropertyException,
288cdf0e10cSrcweir             com::sun::star::lang::WrappedTargetException,
289cdf0e10cSrcweir             com::sun::star::uno::RuntimeException);
290cdf0e10cSrcweir 
291cdf0e10cSrcweir     /**
292cdf0e10cSrcweir        @short Adds a
293cdf0e10cSrcweir        <code>com::sun::star::beans::XPropertyChangeListener</code>.
294cdf0e10cSrcweir 
295cdf0e10cSrcweir        @descr If a listener is added more than once, it will receive all
296cdf0e10cSrcweir        relevant notifications multiple times.
297cdf0e10cSrcweir 
298cdf0e10cSrcweir        @see com::sun::star::beans::XPropertySet::addPropertyChangeListener
299cdf0e10cSrcweir     */
300cdf0e10cSrcweir     virtual void SAL_CALL addPropertyChangeListener(
301cdf0e10cSrcweir         rtl::OUString const & propertyName,
302cdf0e10cSrcweir         com::sun::star::uno::Reference<
303cdf0e10cSrcweir         com::sun::star::beans::XPropertyChangeListener > const & listener)
304cdf0e10cSrcweir         throw (
305cdf0e10cSrcweir             com::sun::star::beans::UnknownPropertyException,
306cdf0e10cSrcweir             com::sun::star::lang::WrappedTargetException,
307cdf0e10cSrcweir             com::sun::star::uno::RuntimeException);
308cdf0e10cSrcweir 
309cdf0e10cSrcweir     // @see com::sun::star::beans::XPropertySet::removePropertyChangeListener
310cdf0e10cSrcweir     virtual void SAL_CALL removePropertyChangeListener(
311cdf0e10cSrcweir         rtl::OUString const & propertyName,
312cdf0e10cSrcweir         com::sun::star::uno::Reference<
313cdf0e10cSrcweir         com::sun::star::beans::XPropertyChangeListener > const & listener)
314cdf0e10cSrcweir         throw (
315cdf0e10cSrcweir             com::sun::star::beans::UnknownPropertyException,
316cdf0e10cSrcweir             com::sun::star::lang::WrappedTargetException,
317cdf0e10cSrcweir             com::sun::star::uno::RuntimeException);
318cdf0e10cSrcweir 
319cdf0e10cSrcweir     /**
320cdf0e10cSrcweir        @short Adds a
321cdf0e10cSrcweir        <code>com::sun::star::beans::XVetoableChangeListener</code>.
322cdf0e10cSrcweir 
323cdf0e10cSrcweir        @descr If a listener is added more than once, it will receive all
324cdf0e10cSrcweir        relevant notifications multiple times.
325cdf0e10cSrcweir 
326cdf0e10cSrcweir        @see com::sun::star::beans::XPropertySet::addVetoableChangeListener
327cdf0e10cSrcweir     */
328cdf0e10cSrcweir     virtual void SAL_CALL addVetoableChangeListener(
329cdf0e10cSrcweir         rtl::OUString const & propertyName,
330cdf0e10cSrcweir         com::sun::star::uno::Reference<
331cdf0e10cSrcweir         com::sun::star::beans::XVetoableChangeListener > const & listener)
332cdf0e10cSrcweir         throw (
333cdf0e10cSrcweir             com::sun::star::beans::UnknownPropertyException,
334cdf0e10cSrcweir             com::sun::star::lang::WrappedTargetException,
335cdf0e10cSrcweir             com::sun::star::uno::RuntimeException);
336cdf0e10cSrcweir 
337cdf0e10cSrcweir     // @see com::sun::star::beans::XPropertySet::removeVetoableChangeListener
338cdf0e10cSrcweir     virtual void SAL_CALL removeVetoableChangeListener(
339cdf0e10cSrcweir         rtl::OUString const & propertyName,
340cdf0e10cSrcweir         com::sun::star::uno::Reference<
341cdf0e10cSrcweir         com::sun::star::beans::XVetoableChangeListener > const & listener)
342cdf0e10cSrcweir         throw (
343cdf0e10cSrcweir             com::sun::star::beans::UnknownPropertyException,
344cdf0e10cSrcweir             com::sun::star::lang::WrappedTargetException,
345cdf0e10cSrcweir             com::sun::star::uno::RuntimeException);
346cdf0e10cSrcweir 
347cdf0e10cSrcweir     // @see com::sun::star::beans::XFastPropertySet::setFastPropertyValue
348cdf0e10cSrcweir     virtual void SAL_CALL setFastPropertyValue(
349cdf0e10cSrcweir         sal_Int32 handle, com::sun::star::uno::Any const & value)
350cdf0e10cSrcweir         throw (
351cdf0e10cSrcweir             com::sun::star::beans::UnknownPropertyException,
352cdf0e10cSrcweir             com::sun::star::beans::PropertyVetoException,
353cdf0e10cSrcweir             com::sun::star::lang::IllegalArgumentException,
354cdf0e10cSrcweir             com::sun::star::lang::WrappedTargetException,
355cdf0e10cSrcweir             com::sun::star::uno::RuntimeException);
356cdf0e10cSrcweir 
357cdf0e10cSrcweir     // @see com::sun::star::beans::XFastPropertySet::getFastPropertyValue
358cdf0e10cSrcweir     virtual com::sun::star::uno::Any SAL_CALL getFastPropertyValue(
359cdf0e10cSrcweir         sal_Int32 handle)
360cdf0e10cSrcweir         throw (
361cdf0e10cSrcweir             com::sun::star::beans::UnknownPropertyException,
362cdf0e10cSrcweir             com::sun::star::lang::WrappedTargetException,
363cdf0e10cSrcweir             com::sun::star::uno::RuntimeException);
364cdf0e10cSrcweir 
365cdf0e10cSrcweir     // @see com::sun::star::beans::XPropertyAccess::getPropertyValues
366cdf0e10cSrcweir     virtual
367cdf0e10cSrcweir     com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
368cdf0e10cSrcweir     SAL_CALL getPropertyValues() throw (com::sun::star::uno::RuntimeException);
369cdf0e10cSrcweir 
370cdf0e10cSrcweir     // @see com::sun::star::beans::XPropertyAccess::setPropertyValues
371cdf0e10cSrcweir     virtual void SAL_CALL setPropertyValues(
372cdf0e10cSrcweir         com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
373cdf0e10cSrcweir         const & props)
374cdf0e10cSrcweir         throw (
375cdf0e10cSrcweir             com::sun::star::beans::UnknownPropertyException,
376cdf0e10cSrcweir             com::sun::star::beans::PropertyVetoException,
377cdf0e10cSrcweir             com::sun::star::lang::IllegalArgumentException,
378cdf0e10cSrcweir             com::sun::star::lang::WrappedTargetException,
379cdf0e10cSrcweir             com::sun::star::uno::RuntimeException);
380cdf0e10cSrcweir 
381cdf0e10cSrcweir private:
382*88ca1099SHerbert Dürr     PropertySetMixinImpl( const PropertySetMixinImpl&); // not defined
383*88ca1099SHerbert Dürr     void operator=( const PropertySetMixinImpl&); // not defined
384cdf0e10cSrcweir 
385cdf0e10cSrcweir     PropertySetMixinImpl(
386cdf0e10cSrcweir         com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
387cdf0e10cSrcweir         const & context,
388cdf0e10cSrcweir         Implements implements,
389cdf0e10cSrcweir         com::sun::star::uno::Sequence< rtl::OUString > const & absentOptional,
390cdf0e10cSrcweir         com::sun::star::uno::Type const & type);
391cdf0e10cSrcweir 
392cdf0e10cSrcweir     class Impl;
393cdf0e10cSrcweir     Impl * m_impl;
394cdf0e10cSrcweir 
395cdf0e10cSrcweir     friend class Impl;
396cdf0e10cSrcweir     template< typename T > friend class PropertySetMixin;
397cdf0e10cSrcweir 
398cdf0e10cSrcweir     ~PropertySetMixinImpl();
399cdf0e10cSrcweir 
400cdf0e10cSrcweir     void checkUnknown(rtl::OUString const & propertyName);
401cdf0e10cSrcweir };
402cdf0e10cSrcweir 
403cdf0e10cSrcweir /**
404cdf0e10cSrcweir    @short A helper mixin to implement certain UNO interfaces related to property
405cdf0e10cSrcweir    set handling on top of the attributes of a given UNO interface type.
406cdf0e10cSrcweir 
407cdf0e10cSrcweir    @descr The UNO interface type is specified by the type parameter
408cdf0e10cSrcweir    <code>T</code> (which must correspond to a UNO interface type).
409cdf0e10cSrcweir 
410cdf0e10cSrcweir    @descr No specializations of this class template should be added by client
411cdf0e10cSrcweir    code.
412cdf0e10cSrcweir 
413cdf0e10cSrcweir    @since UDK 3.2.1
414cdf0e10cSrcweir */
415cdf0e10cSrcweir template< typename T > class PropertySetMixin: public PropertySetMixinImpl {
416cdf0e10cSrcweir protected:
417cdf0e10cSrcweir     /**
418cdf0e10cSrcweir        @short The constructor.
419cdf0e10cSrcweir 
420cdf0e10cSrcweir        @descr May throw <code>com::sun::star::uno::RuntimeException</code> and
421cdf0e10cSrcweir        <code>std::bad_alloc</code>.
422cdf0e10cSrcweir 
423cdf0e10cSrcweir        @param context  the component context used by this class template; must
424cdf0e10cSrcweir        not be null, and must supply the service
425cdf0e10cSrcweir        <code>com.sun.star.reflection.CoreReflection</code> and the singleton
426cdf0e10cSrcweir        <code>com.sun.star.reflection.theTypeDescriptionManager</code>
427cdf0e10cSrcweir 
428cdf0e10cSrcweir        @param implements  a combination of zero or more flags specifying what
429cdf0e10cSrcweir        UNO interface types shall be supported
430cdf0e10cSrcweir 
431cdf0e10cSrcweir        @param absentOptional  a list of optional properties that are not
432cdf0e10cSrcweir        present, and should thus not be visible via
433cdf0e10cSrcweir        <code>com::sun::star::beans::XPropertySet::getPropertySetInfo</code>,
434cdf0e10cSrcweir        <code>com::sun::star::beans::XPropertySet::addPropertyChangeListener<!--
435cdf0e10cSrcweir        --></code>, <code>com::sun::star::beans::XPropertySet::<!--
436cdf0e10cSrcweir        -->removePropertyChangeListener</code>,
437cdf0e10cSrcweir        <code>com::sun::star::beans::XPropertySet::addVetoableChangeListener<!--
438cdf0e10cSrcweir        --></code>, and <code>com::sun::star::beans::XPropertySet::<!--
439cdf0e10cSrcweir        -->removeVetoableChangeListener</code>.  For consistency reasons, the
440cdf0e10cSrcweir        given <code>absentOptional</code> should only contain the names of
441cdf0e10cSrcweir        attributes that represent optional properties that are not present (that
442cdf0e10cSrcweir        is, the attribute getters and setters always throw a
443cdf0e10cSrcweir        <code>com::sun::star::beans::UnknownPropertyException</code>), and should
444cdf0e10cSrcweir        contain each such name only once.  If an optional property is not present
445cdf0e10cSrcweir        (that is, the corresponding attribute getter and setter always throw a
446cdf0e10cSrcweir        <code>com::sun::star::beans::UnknownPropertyException</code>) but is not
447cdf0e10cSrcweir        contained in the given <code>absentOptional</code>, then it will be
448cdf0e10cSrcweir        visible via
449cdf0e10cSrcweir        <code>com::sun::star::beans::XPropertySet::getPropertySetInfo</code> as a
450cdf0e10cSrcweir        <code>com::sun::star::beans::Property</code> with a set
451cdf0e10cSrcweir        <code>com::sun::star::beans::PropertyAttribute::OPTIONAL</code>.  If the
452cdf0e10cSrcweir        given <code>implements</code> specifies that
453cdf0e10cSrcweir        <code>com::sun::star::beans::XPropertySet</code> is not supported, then
454cdf0e10cSrcweir        the given <code>absentOptional</code> is effectively ignored and can be
455cdf0e10cSrcweir        empty.
456cdf0e10cSrcweir     */
PropertySetMixin(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const & context,Implements implements,com::sun::star::uno::Sequence<rtl::OUString> const & absentOptional)457cdf0e10cSrcweir     PropertySetMixin(
458cdf0e10cSrcweir         com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
459cdf0e10cSrcweir         const & context,
460cdf0e10cSrcweir         Implements implements,
461cdf0e10cSrcweir         com::sun::star::uno::Sequence< rtl::OUString > const & absentOptional):
462cdf0e10cSrcweir         PropertySetMixinImpl(
463cdf0e10cSrcweir             context, implements, absentOptional, T::static_type())
464cdf0e10cSrcweir     {}
465cdf0e10cSrcweir 
466cdf0e10cSrcweir     /**
467cdf0e10cSrcweir        @short The destructor.
468cdf0e10cSrcweir 
469cdf0e10cSrcweir        @descr Does not throw.
470cdf0e10cSrcweir     */
~PropertySetMixin()471cdf0e10cSrcweir     ~PropertySetMixin() {}
472cdf0e10cSrcweir 
473cdf0e10cSrcweir private:
474*88ca1099SHerbert Dürr     PropertySetMixin( const PropertySetMixin&); // not defined
475*88ca1099SHerbert Dürr     void operator=( const PropertySetMixin&); // not defined
476cdf0e10cSrcweir };
477cdf0e10cSrcweir 
478cdf0e10cSrcweir #if defined _MSC_VER
479cdf0e10cSrcweir #pragma warning(pop)
480cdf0e10cSrcweir #endif
481cdf0e10cSrcweir 
482cdf0e10cSrcweir }
483cdf0e10cSrcweir 
484cdf0e10cSrcweir #endif
485