xref: /AOO41X/main/basic/source/inc/propacc.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #ifndef _SFX_PROPBAG_HXX
28*cdf0e10cSrcweir #define _SFX_PROPBAG_HXX
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include <svl/svarray.hxx>
31*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HXX_
32*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
33*cdf0e10cSrcweir #endif
34*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HXX_
35*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
36*cdf0e10cSrcweir #endif
37*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HXX_
38*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySetInfo.hpp>
39*cdf0e10cSrcweir #endif
40*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HXX_
41*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyAccess.hpp>
42*cdf0e10cSrcweir #endif
43*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYCONTAINER_HXX_
44*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyContainer.hpp>
45*cdf0e10cSrcweir #endif
46*cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
47*cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir #define NS_BEANS	::com::sun::star::beans
50*cdf0e10cSrcweir #define NS_LANG		::com::sun::star::lang
51*cdf0e10cSrcweir #define NS_UNO		::com::sun::star::uno
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir typedef NS_BEANS::PropertyValue* SbPropertyValuePtr;
54*cdf0e10cSrcweir SV_DECL_PTRARR( SbPropertyValueArr_Impl, SbPropertyValuePtr, 4, 4 )
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir typedef ::cppu::WeakImplHelper2< NS_BEANS::XPropertySet,
57*cdf0e10cSrcweir 								 NS_BEANS::XPropertyAccess > SbPropertyValuesHelper;
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir //==========================================================================
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir class SbPropertyValues: 	public SbPropertyValuesHelper
63*cdf0e10cSrcweir {
64*cdf0e10cSrcweir 	SbPropertyValueArr_Impl	_aPropVals;
65*cdf0e10cSrcweir 	NS_UNO::Reference< ::com::sun::star::beans::XPropertySetInfo > _xInfo;
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir private:
68*cdf0e10cSrcweir 	sal_Int32 					GetIndex_Impl( const ::rtl::OUString &rPropName ) const;
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir public:
71*cdf0e10cSrcweir 							SbPropertyValues();
72*cdf0e10cSrcweir 	virtual					~SbPropertyValues();
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir 	// XPropertySet
75*cdf0e10cSrcweir 	virtual NS_UNO::Reference< NS_BEANS::XPropertySetInfo > SAL_CALL
76*cdf0e10cSrcweir 		getPropertySetInfo(void) throw( NS_UNO::RuntimeException );
77*cdf0e10cSrcweir 	virtual void SAL_CALL	setPropertyValue(
78*cdf0e10cSrcweir 								const ::rtl::OUString& aPropertyName,
79*cdf0e10cSrcweir 								const NS_UNO::Any& aValue)
80*cdf0e10cSrcweir                                 throw (::com::sun::star::beans::UnknownPropertyException,
81*cdf0e10cSrcweir                                 ::com::sun::star::beans::PropertyVetoException,
82*cdf0e10cSrcweir                                 ::com::sun::star::lang::IllegalArgumentException,
83*cdf0e10cSrcweir                                 ::com::sun::star::lang::WrappedTargetException,
84*cdf0e10cSrcweir                                 ::com::sun::star::uno::RuntimeException);
85*cdf0e10cSrcweir     virtual NS_UNO::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName )
86*cdf0e10cSrcweir 		throw(	NS_BEANS::UnknownPropertyException,
87*cdf0e10cSrcweir 				NS_LANG::WrappedTargetException,
88*cdf0e10cSrcweir 				NS_UNO::RuntimeException);
89*cdf0e10cSrcweir 	virtual void SAL_CALL	addPropertyChangeListener(
90*cdf0e10cSrcweir 								const ::rtl::OUString& aPropertyName,
91*cdf0e10cSrcweir 								const NS_UNO::Reference< NS_BEANS::XPropertyChangeListener >& )
92*cdf0e10cSrcweir                                 throw ();
93*cdf0e10cSrcweir 	virtual void SAL_CALL	removePropertyChangeListener(
94*cdf0e10cSrcweir 								const ::rtl::OUString& aPropertyName,
95*cdf0e10cSrcweir 								const NS_UNO::Reference< NS_BEANS::XPropertyChangeListener >& )
96*cdf0e10cSrcweir                                 throw ();
97*cdf0e10cSrcweir 	virtual void SAL_CALL	addVetoableChangeListener(
98*cdf0e10cSrcweir 								const ::rtl::OUString& aPropertyName,
99*cdf0e10cSrcweir 								const NS_UNO::Reference< NS_BEANS::XVetoableChangeListener >& )
100*cdf0e10cSrcweir                                 throw ();
101*cdf0e10cSrcweir 	virtual void SAL_CALL	removeVetoableChangeListener(
102*cdf0e10cSrcweir 								const ::rtl::OUString& aPropertyName,
103*cdf0e10cSrcweir 								const NS_UNO::Reference< NS_BEANS::XVetoableChangeListener >& )
104*cdf0e10cSrcweir                                 throw ();
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir 	// XPropertyAccess
107*cdf0e10cSrcweir 	virtual NS_UNO::Sequence< NS_BEANS::PropertyValue > SAL_CALL getPropertyValues(void) throw (::com::sun::star::uno::RuntimeException);
108*cdf0e10cSrcweir 	virtual void SAL_CALL setPropertyValues(const NS_UNO::Sequence< NS_BEANS::PropertyValue >& PropertyValues_) 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);
109*cdf0e10cSrcweir };
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir //==========================================================================
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir typedef ::cppu::WeakImplHelper1< NS_BEANS::XPropertySetInfo > SbPropertySetInfoHelper;
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir // AB 20.3.2000 Help Class for XPropertySetInfo implementation
116*cdf0e10cSrcweir class PropertySetInfoImpl
117*cdf0e10cSrcweir {
118*cdf0e10cSrcweir 	friend class SbPropertySetInfo;
119*cdf0e10cSrcweir 	friend class SbPropertyContainer;
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir 	NS_UNO::Sequence< NS_BEANS::Property > _aProps;
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir 	sal_Int32 GetIndex_Impl( const ::rtl::OUString &rPropName ) const;
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir public:
126*cdf0e10cSrcweir 	PropertySetInfoImpl();
127*cdf0e10cSrcweir 	PropertySetInfoImpl( NS_UNO::Sequence< NS_BEANS::Property >& rProps );
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir 	// XPropertySetInfo
130*cdf0e10cSrcweir 	NS_UNO::Sequence< NS_BEANS::Property > SAL_CALL getProperties(void) throw ();
131*cdf0e10cSrcweir 	NS_BEANS::Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name)
132*cdf0e10cSrcweir 		throw( NS_UNO::RuntimeException );
133*cdf0e10cSrcweir 	sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name)
134*cdf0e10cSrcweir 		throw ( NS_UNO::RuntimeException );
135*cdf0e10cSrcweir };
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir class SbPropertySetInfo: 	public SbPropertySetInfoHelper
138*cdf0e10cSrcweir {
139*cdf0e10cSrcweir 	PropertySetInfoImpl aImpl;
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir public:
142*cdf0e10cSrcweir 							SbPropertySetInfo();
143*cdf0e10cSrcweir 							SbPropertySetInfo( const SbPropertyValueArr_Impl &rPropVals );
144*cdf0e10cSrcweir 	virtual					~SbPropertySetInfo();
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir 	// XPropertySetInfo
147*cdf0e10cSrcweir 	virtual NS_UNO::Sequence< NS_BEANS::Property > SAL_CALL getProperties(void)
148*cdf0e10cSrcweir 		throw( NS_UNO::RuntimeException );
149*cdf0e10cSrcweir 	virtual NS_BEANS::Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name)
150*cdf0e10cSrcweir 		throw( NS_UNO::RuntimeException );
151*cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name)
152*cdf0e10cSrcweir 		throw( NS_UNO::RuntimeException );
153*cdf0e10cSrcweir };
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir //==========================================================================
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir typedef ::cppu::WeakImplHelper2< NS_BEANS::XPropertySetInfo, NS_BEANS::XPropertyContainer > SbPropertyContainerHelper;
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir class SbPropertyContainer: public SbPropertyContainerHelper
160*cdf0e10cSrcweir {
161*cdf0e10cSrcweir 	PropertySetInfoImpl aImpl;
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir public:
164*cdf0e10cSrcweir 							SbPropertyContainer();
165*cdf0e10cSrcweir 	virtual					~SbPropertyContainer();
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir 	// XPropertyContainer
168*cdf0e10cSrcweir     virtual void SAL_CALL addProperty(	const ::rtl::OUString& Name,
169*cdf0e10cSrcweir 										sal_Int16 Attributes,
170*cdf0e10cSrcweir 										const NS_UNO::Any& DefaultValue)
171*cdf0e10cSrcweir 		throw(  NS_BEANS::PropertyExistException, NS_BEANS::IllegalTypeException,
172*cdf0e10cSrcweir 				NS_LANG::IllegalArgumentException, NS_UNO::RuntimeException );
173*cdf0e10cSrcweir     virtual void SAL_CALL removeProperty(const ::rtl::OUString& Name)
174*cdf0e10cSrcweir 		throw( NS_BEANS::UnknownPropertyException, NS_UNO::RuntimeException );
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir 	// XPropertySetInfo
177*cdf0e10cSrcweir 	virtual NS_UNO::Sequence< NS_BEANS::Property > SAL_CALL getProperties(void) throw();
178*cdf0e10cSrcweir 	virtual NS_BEANS::Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name)
179*cdf0e10cSrcweir 		throw( NS_UNO::RuntimeException );
180*cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name)
181*cdf0e10cSrcweir 		throw( NS_UNO::RuntimeException );
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir 	// XPropertyAccess
184*cdf0e10cSrcweir 	virtual NS_UNO::Sequence< NS_BEANS::PropertyValue > SAL_CALL getPropertyValues(void);
185*cdf0e10cSrcweir 	virtual void SAL_CALL setPropertyValues(const NS_UNO::Sequence< NS_BEANS::PropertyValue >& PropertyValues_);
186*cdf0e10cSrcweir };
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir //=========================================================================
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir class StarBASIC;
191*cdf0e10cSrcweir class SbxArray;
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite );
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir #undef NS_BEANS
197*cdf0e10cSrcweir #undef NS_LANG
198*cdf0e10cSrcweir #undef NS_UNO
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir #endif
203*cdf0e10cSrcweir 
204