merge the formfield patch from ooo-build
[ooovba.git] / configmgr / source / inc / propertysethelper.hxx
blob201e12032068bcab9ae16c9b958308101ec054d1
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: propertysethelper.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef CONFIGMGR_MISC_PROPERTYSETHELPER_HXX
32 #define CONFIGMGR_MISC_PROPERTYSETHELPER_HXX
34 #include <cppuhelper/propshlp.hxx>
35 #include <cppuhelper/weak.hxx>
37 //..........................................................................
38 namespace configmgr {
39 namespace apihelper {
40 //..........................................................................
41 namespace uno = com::sun::star::uno;
42 namespace lang = com::sun::star::lang;
43 namespace beans = com::sun::star::beans;
44 //..........................................................................
45 class BroadcasterBase
47 osl::Mutex m_aMutex;
48 cppu::OBroadcastHelper m_aBroadcastHelper;
50 protected:
51 BroadcasterBase() : m_aMutex(), m_aBroadcastHelper(m_aMutex) {}
52 ~BroadcasterBase() {}
54 osl::Mutex & getBroadcastMutex() { return m_aMutex; }
55 cppu::OBroadcastHelper & getBroadcastHelper() { return m_aBroadcastHelper; }
58 //..........................................................................
60 class PropertySetHelper : protected BroadcasterBase // must be first
61 , public cppu::OWeakObject
62 , public cppu::OPropertySetHelper // not copyable
64 public:
65 PropertySetHelper();
66 ~PropertySetHelper();
68 // XInterface
69 virtual uno::Any SAL_CALL queryInterface( uno::Type const & rType ) throw (uno::RuntimeException);
70 virtual void SAL_CALL acquire() throw ();
71 virtual void SAL_CALL release() throw ();
72 // XTypeProvider
73 virtual uno::Sequence< uno::Type > SAL_CALL getTypes() throw (uno::RuntimeException);
75 // to be provided by derived classes
76 // virtual uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (uno::RuntimeException) = 0;
78 // XPropertySet
79 virtual uno::Reference< beans::XPropertySetInfo > SAL_CALL
80 getPropertySetInfo( ) throw (uno::RuntimeException);
83 protected:
84 // new methods still to be overridden
85 virtual cppu::IPropertyArrayHelper * SAL_CALL newInfoHelper() = 0;
87 // cppu::OPropertySetHelper interface
88 #if 0 // these methods still must be overridden
89 virtual cppu::IPropertyArrayHelper * SAL_CALL newInfoHelper() = 0;
91 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno::Any& rValue )
92 throw (uno::Exception) = 0;
94 virtual void SAL_CALL getFastPropertyValue( uno::Any& rValue, sal_Int32 nHandle ) const = 0;
95 #endif
96 virtual cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
98 // default implementation: does not do any conversion
99 virtual sal_Bool SAL_CALL convertFastPropertyValue(
100 uno::Any & rConvertedValue, uno::Any & rOldValue,
101 sal_Int32 nHandle, const uno::Any& rValue )
102 throw (lang::IllegalArgumentException);
103 private:
104 cppu::IPropertyArrayHelper * m_pHelper;
106 //..........................................................................
107 } // namespace apihelper
108 } // namespace configmgr
109 //..........................................................................
111 #endif