xref: /AOO41X/main/basic/source/inc/propacc.hxx (revision 234bd5c559aaf7abbd02d045859137b774cd8b34)
1*234bd5c5SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*234bd5c5SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*234bd5c5SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*234bd5c5SAndrew Rist  * distributed with this work for additional information
6*234bd5c5SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*234bd5c5SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*234bd5c5SAndrew Rist  * "License"); you may not use this file except in compliance
9*234bd5c5SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*234bd5c5SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*234bd5c5SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*234bd5c5SAndrew Rist  * software distributed under the License is distributed on an
15*234bd5c5SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*234bd5c5SAndrew Rist  * KIND, either express or implied.  See the License for the
17*234bd5c5SAndrew Rist  * specific language governing permissions and limitations
18*234bd5c5SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*234bd5c5SAndrew Rist  *************************************************************/
21*234bd5c5SAndrew Rist 
22*234bd5c5SAndrew Rist 
23cdf0e10cSrcweir #ifndef _SFX_PROPBAG_HXX
24cdf0e10cSrcweir #define _SFX_PROPBAG_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <svl/svarray.hxx>
27cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HXX_
28cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HXX_
31cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HXX_
34cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySetInfo.hpp>
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HXX_
37cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyAccess.hpp>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYCONTAINER_HXX_
40cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyContainer.hpp>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
43cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
44cdf0e10cSrcweir 
45cdf0e10cSrcweir #define NS_BEANS	::com::sun::star::beans
46cdf0e10cSrcweir #define NS_LANG		::com::sun::star::lang
47cdf0e10cSrcweir #define NS_UNO		::com::sun::star::uno
48cdf0e10cSrcweir 
49cdf0e10cSrcweir typedef NS_BEANS::PropertyValue* SbPropertyValuePtr;
50cdf0e10cSrcweir SV_DECL_PTRARR( SbPropertyValueArr_Impl, SbPropertyValuePtr, 4, 4 )
51cdf0e10cSrcweir 
52cdf0e10cSrcweir typedef ::cppu::WeakImplHelper2< NS_BEANS::XPropertySet,
53cdf0e10cSrcweir 								 NS_BEANS::XPropertyAccess > SbPropertyValuesHelper;
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 
56cdf0e10cSrcweir //==========================================================================
57cdf0e10cSrcweir 
58cdf0e10cSrcweir class SbPropertyValues: 	public SbPropertyValuesHelper
59cdf0e10cSrcweir {
60cdf0e10cSrcweir 	SbPropertyValueArr_Impl	_aPropVals;
61cdf0e10cSrcweir 	NS_UNO::Reference< ::com::sun::star::beans::XPropertySetInfo > _xInfo;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir private:
64cdf0e10cSrcweir 	sal_Int32 					GetIndex_Impl( const ::rtl::OUString &rPropName ) const;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir public:
67cdf0e10cSrcweir 							SbPropertyValues();
68cdf0e10cSrcweir 	virtual					~SbPropertyValues();
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	// XPropertySet
71cdf0e10cSrcweir 	virtual NS_UNO::Reference< NS_BEANS::XPropertySetInfo > SAL_CALL
72cdf0e10cSrcweir 		getPropertySetInfo(void) throw( NS_UNO::RuntimeException );
73cdf0e10cSrcweir 	virtual void SAL_CALL	setPropertyValue(
74cdf0e10cSrcweir 								const ::rtl::OUString& aPropertyName,
75cdf0e10cSrcweir 								const NS_UNO::Any& aValue)
76cdf0e10cSrcweir                                 throw (::com::sun::star::beans::UnknownPropertyException,
77cdf0e10cSrcweir                                 ::com::sun::star::beans::PropertyVetoException,
78cdf0e10cSrcweir                                 ::com::sun::star::lang::IllegalArgumentException,
79cdf0e10cSrcweir                                 ::com::sun::star::lang::WrappedTargetException,
80cdf0e10cSrcweir                                 ::com::sun::star::uno::RuntimeException);
81cdf0e10cSrcweir     virtual NS_UNO::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName )
82cdf0e10cSrcweir 		throw(	NS_BEANS::UnknownPropertyException,
83cdf0e10cSrcweir 				NS_LANG::WrappedTargetException,
84cdf0e10cSrcweir 				NS_UNO::RuntimeException);
85cdf0e10cSrcweir 	virtual void SAL_CALL	addPropertyChangeListener(
86cdf0e10cSrcweir 								const ::rtl::OUString& aPropertyName,
87cdf0e10cSrcweir 								const NS_UNO::Reference< NS_BEANS::XPropertyChangeListener >& )
88cdf0e10cSrcweir                                 throw ();
89cdf0e10cSrcweir 	virtual void SAL_CALL	removePropertyChangeListener(
90cdf0e10cSrcweir 								const ::rtl::OUString& aPropertyName,
91cdf0e10cSrcweir 								const NS_UNO::Reference< NS_BEANS::XPropertyChangeListener >& )
92cdf0e10cSrcweir                                 throw ();
93cdf0e10cSrcweir 	virtual void SAL_CALL	addVetoableChangeListener(
94cdf0e10cSrcweir 								const ::rtl::OUString& aPropertyName,
95cdf0e10cSrcweir 								const NS_UNO::Reference< NS_BEANS::XVetoableChangeListener >& )
96cdf0e10cSrcweir                                 throw ();
97cdf0e10cSrcweir 	virtual void SAL_CALL	removeVetoableChangeListener(
98cdf0e10cSrcweir 								const ::rtl::OUString& aPropertyName,
99cdf0e10cSrcweir 								const NS_UNO::Reference< NS_BEANS::XVetoableChangeListener >& )
100cdf0e10cSrcweir                                 throw ();
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 	// XPropertyAccess
103cdf0e10cSrcweir 	virtual NS_UNO::Sequence< NS_BEANS::PropertyValue > SAL_CALL getPropertyValues(void) throw (::com::sun::star::uno::RuntimeException);
104cdf0e10cSrcweir 	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);
105cdf0e10cSrcweir };
106cdf0e10cSrcweir 
107cdf0e10cSrcweir //==========================================================================
108cdf0e10cSrcweir 
109cdf0e10cSrcweir typedef ::cppu::WeakImplHelper1< NS_BEANS::XPropertySetInfo > SbPropertySetInfoHelper;
110cdf0e10cSrcweir 
111cdf0e10cSrcweir // AB 20.3.2000 Help Class for XPropertySetInfo implementation
112cdf0e10cSrcweir class PropertySetInfoImpl
113cdf0e10cSrcweir {
114cdf0e10cSrcweir 	friend class SbPropertySetInfo;
115cdf0e10cSrcweir 	friend class SbPropertyContainer;
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	NS_UNO::Sequence< NS_BEANS::Property > _aProps;
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	sal_Int32 GetIndex_Impl( const ::rtl::OUString &rPropName ) const;
120cdf0e10cSrcweir 
121cdf0e10cSrcweir public:
122cdf0e10cSrcweir 	PropertySetInfoImpl();
123cdf0e10cSrcweir 	PropertySetInfoImpl( NS_UNO::Sequence< NS_BEANS::Property >& rProps );
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 	// XPropertySetInfo
126cdf0e10cSrcweir 	NS_UNO::Sequence< NS_BEANS::Property > SAL_CALL getProperties(void) throw ();
127cdf0e10cSrcweir 	NS_BEANS::Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name)
128cdf0e10cSrcweir 		throw( NS_UNO::RuntimeException );
129cdf0e10cSrcweir 	sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name)
130cdf0e10cSrcweir 		throw ( NS_UNO::RuntimeException );
131cdf0e10cSrcweir };
132cdf0e10cSrcweir 
133cdf0e10cSrcweir class SbPropertySetInfo: 	public SbPropertySetInfoHelper
134cdf0e10cSrcweir {
135cdf0e10cSrcweir 	PropertySetInfoImpl aImpl;
136cdf0e10cSrcweir 
137cdf0e10cSrcweir public:
138cdf0e10cSrcweir 							SbPropertySetInfo();
139cdf0e10cSrcweir 							SbPropertySetInfo( const SbPropertyValueArr_Impl &rPropVals );
140cdf0e10cSrcweir 	virtual					~SbPropertySetInfo();
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 	// XPropertySetInfo
143cdf0e10cSrcweir 	virtual NS_UNO::Sequence< NS_BEANS::Property > SAL_CALL getProperties(void)
144cdf0e10cSrcweir 		throw( NS_UNO::RuntimeException );
145cdf0e10cSrcweir 	virtual NS_BEANS::Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name)
146cdf0e10cSrcweir 		throw( NS_UNO::RuntimeException );
147cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name)
148cdf0e10cSrcweir 		throw( NS_UNO::RuntimeException );
149cdf0e10cSrcweir };
150cdf0e10cSrcweir 
151cdf0e10cSrcweir //==========================================================================
152cdf0e10cSrcweir 
153cdf0e10cSrcweir typedef ::cppu::WeakImplHelper2< NS_BEANS::XPropertySetInfo, NS_BEANS::XPropertyContainer > SbPropertyContainerHelper;
154cdf0e10cSrcweir 
155cdf0e10cSrcweir class SbPropertyContainer: public SbPropertyContainerHelper
156cdf0e10cSrcweir {
157cdf0e10cSrcweir 	PropertySetInfoImpl aImpl;
158cdf0e10cSrcweir 
159cdf0e10cSrcweir public:
160cdf0e10cSrcweir 							SbPropertyContainer();
161cdf0e10cSrcweir 	virtual					~SbPropertyContainer();
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 	// XPropertyContainer
164cdf0e10cSrcweir     virtual void SAL_CALL addProperty(	const ::rtl::OUString& Name,
165cdf0e10cSrcweir 										sal_Int16 Attributes,
166cdf0e10cSrcweir 										const NS_UNO::Any& DefaultValue)
167cdf0e10cSrcweir 		throw(  NS_BEANS::PropertyExistException, NS_BEANS::IllegalTypeException,
168cdf0e10cSrcweir 				NS_LANG::IllegalArgumentException, NS_UNO::RuntimeException );
169cdf0e10cSrcweir     virtual void SAL_CALL removeProperty(const ::rtl::OUString& Name)
170cdf0e10cSrcweir 		throw( NS_BEANS::UnknownPropertyException, NS_UNO::RuntimeException );
171cdf0e10cSrcweir 
172cdf0e10cSrcweir 	// XPropertySetInfo
173cdf0e10cSrcweir 	virtual NS_UNO::Sequence< NS_BEANS::Property > SAL_CALL getProperties(void) throw();
174cdf0e10cSrcweir 	virtual NS_BEANS::Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name)
175cdf0e10cSrcweir 		throw( NS_UNO::RuntimeException );
176cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name)
177cdf0e10cSrcweir 		throw( NS_UNO::RuntimeException );
178cdf0e10cSrcweir 
179cdf0e10cSrcweir 	// XPropertyAccess
180cdf0e10cSrcweir 	virtual NS_UNO::Sequence< NS_BEANS::PropertyValue > SAL_CALL getPropertyValues(void);
181cdf0e10cSrcweir 	virtual void SAL_CALL setPropertyValues(const NS_UNO::Sequence< NS_BEANS::PropertyValue >& PropertyValues_);
182cdf0e10cSrcweir };
183cdf0e10cSrcweir 
184cdf0e10cSrcweir //=========================================================================
185cdf0e10cSrcweir 
186cdf0e10cSrcweir class StarBASIC;
187cdf0e10cSrcweir class SbxArray;
188cdf0e10cSrcweir 
189cdf0e10cSrcweir void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite );
190cdf0e10cSrcweir 
191cdf0e10cSrcweir 
192cdf0e10cSrcweir #undef NS_BEANS
193cdf0e10cSrcweir #undef NS_LANG
194cdf0e10cSrcweir #undef NS_UNO
195cdf0e10cSrcweir 
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 
198cdf0e10cSrcweir #endif
199cdf0e10cSrcweir 
200