1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: propacc.hxx,v $
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 ************************************************************************/
30 #ifndef _SFX_PROPBAG_HXX
31 #define _SFX_PROPBAG_HXX
33 #include <svtools/svarray.hxx>
34 #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HXX_
35 #include <com/sun/star/beans/PropertyValue.hpp>
37 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HXX_
38 #include <com/sun/star/beans/XPropertySet.hpp>
40 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HXX_
41 #include <com/sun/star/beans/XPropertySetInfo.hpp>
43 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HXX_
44 #include <com/sun/star/beans/XPropertyAccess.hpp>
46 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYCONTAINER_HXX_
47 #include <com/sun/star/beans/XPropertyContainer.hpp>
49 #include <cppuhelper/implbase1.hxx>
50 #include <cppuhelper/implbase2.hxx>
52 #define NS_BEANS ::com::sun::star::beans
53 #define NS_LANG ::com::sun::star::lang
54 #define NS_UNO ::com::sun::star::uno
56 typedef NS_BEANS::PropertyValue
* SbPropertyValuePtr
;
57 SV_DECL_PTRARR( SbPropertyValueArr_Impl
, SbPropertyValuePtr
, 4, 4 )
59 typedef ::cppu::WeakImplHelper2
< NS_BEANS::XPropertySet
,
60 NS_BEANS::XPropertyAccess
> SbPropertyValuesHelper
;
63 //==========================================================================
65 class SbPropertyValues
: public SbPropertyValuesHelper
67 SbPropertyValueArr_Impl _aPropVals
;
68 NS_UNO::Reference
< ::com::sun::star::beans::XPropertySetInfo
> _xInfo
;
71 INT32
GetIndex_Impl( const ::rtl::OUString
&rPropName
) const;
75 virtual ~SbPropertyValues();
78 virtual NS_UNO::Reference
< NS_BEANS::XPropertySetInfo
> SAL_CALL
79 getPropertySetInfo(void) throw( NS_UNO::RuntimeException
);
80 virtual void SAL_CALL
setPropertyValue(
81 const ::rtl::OUString
& aPropertyName
,
82 const NS_UNO::Any
& aValue
)
83 throw (::com::sun::star::beans::UnknownPropertyException
,
84 ::com::sun::star::beans::PropertyVetoException
,
85 ::com::sun::star::lang::IllegalArgumentException
,
86 ::com::sun::star::lang::WrappedTargetException
,
87 ::com::sun::star::uno::RuntimeException
);
88 virtual NS_UNO::Any SAL_CALL
getPropertyValue( const ::rtl::OUString
& PropertyName
)
89 throw( NS_BEANS::UnknownPropertyException
,
90 NS_LANG::WrappedTargetException
,
91 NS_UNO::RuntimeException
);
92 virtual void SAL_CALL
addPropertyChangeListener(
93 const ::rtl::OUString
& aPropertyName
,
94 const NS_UNO::Reference
< NS_BEANS::XPropertyChangeListener
>& )
96 virtual void SAL_CALL
removePropertyChangeListener(
97 const ::rtl::OUString
& aPropertyName
,
98 const NS_UNO::Reference
< NS_BEANS::XPropertyChangeListener
>& )
100 virtual void SAL_CALL
addVetoableChangeListener(
101 const ::rtl::OUString
& aPropertyName
,
102 const NS_UNO::Reference
< NS_BEANS::XVetoableChangeListener
>& )
104 virtual void SAL_CALL
removeVetoableChangeListener(
105 const ::rtl::OUString
& aPropertyName
,
106 const NS_UNO::Reference
< NS_BEANS::XVetoableChangeListener
>& )
110 virtual NS_UNO::Sequence
< NS_BEANS::PropertyValue
> SAL_CALL
getPropertyValues(void) throw (::com::sun::star::uno::RuntimeException
);
111 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
);
114 //==========================================================================
116 typedef ::cppu::WeakImplHelper1
< NS_BEANS::XPropertySetInfo
> SbPropertySetInfoHelper
;
118 // AB 20.3.2000 Help Class for XPropertySetInfo implementation
119 class PropertySetInfoImpl
121 friend class SbPropertySetInfo
;
122 friend class SbPropertyContainer
;
124 NS_UNO::Sequence
< NS_BEANS::Property
> _aProps
;
126 sal_Int32
GetIndex_Impl( const ::rtl::OUString
&rPropName
) const;
129 PropertySetInfoImpl();
130 PropertySetInfoImpl( NS_UNO::Sequence
< NS_BEANS::Property
>& rProps
);
133 NS_UNO::Sequence
< NS_BEANS::Property
> SAL_CALL
getProperties(void) throw ();
134 NS_BEANS::Property SAL_CALL
getPropertyByName(const ::rtl::OUString
& Name
)
135 throw( NS_UNO::RuntimeException
);
136 sal_Bool SAL_CALL
hasPropertyByName(const ::rtl::OUString
& Name
)
137 throw ( NS_UNO::RuntimeException
);
140 class SbPropertySetInfo
: public SbPropertySetInfoHelper
142 PropertySetInfoImpl aImpl
;
146 SbPropertySetInfo( const SbPropertyValueArr_Impl
&rPropVals
);
147 virtual ~SbPropertySetInfo();
150 virtual NS_UNO::Sequence
< NS_BEANS::Property
> SAL_CALL
getProperties(void)
151 throw( NS_UNO::RuntimeException
);
152 virtual NS_BEANS::Property SAL_CALL
getPropertyByName(const ::rtl::OUString
& Name
)
153 throw( NS_UNO::RuntimeException
);
154 virtual sal_Bool SAL_CALL
hasPropertyByName(const ::rtl::OUString
& Name
)
155 throw( NS_UNO::RuntimeException
);
158 //==========================================================================
160 typedef ::cppu::WeakImplHelper2
< NS_BEANS::XPropertySetInfo
, NS_BEANS::XPropertyContainer
> SbPropertyContainerHelper
;
162 class SbPropertyContainer
: public SbPropertyContainerHelper
164 PropertySetInfoImpl aImpl
;
167 SbPropertyContainer();
168 virtual ~SbPropertyContainer();
170 // XPropertyContainer
171 virtual void SAL_CALL
addProperty( const ::rtl::OUString
& Name
,
173 const NS_UNO::Any
& DefaultValue
)
174 throw( NS_BEANS::PropertyExistException
, NS_BEANS::IllegalTypeException
,
175 NS_LANG::IllegalArgumentException
, NS_UNO::RuntimeException
);
176 virtual void SAL_CALL
removeProperty(const ::rtl::OUString
& Name
)
177 throw( NS_BEANS::UnknownPropertyException
, NS_UNO::RuntimeException
);
180 virtual NS_UNO::Sequence
< NS_BEANS::Property
> SAL_CALL
getProperties(void) throw();
181 virtual NS_BEANS::Property SAL_CALL
getPropertyByName(const ::rtl::OUString
& Name
)
182 throw( NS_UNO::RuntimeException
);
183 virtual sal_Bool SAL_CALL
hasPropertyByName(const ::rtl::OUString
& Name
)
184 throw( NS_UNO::RuntimeException
);
187 virtual NS_UNO::Sequence
< NS_BEANS::PropertyValue
> SAL_CALL
getPropertyValues(void);
188 virtual void SAL_CALL
setPropertyValues(const NS_UNO::Sequence
< NS_BEANS::PropertyValue
>& PropertyValues_
);
191 //=========================================================================
196 void RTL_Impl_CreatePropertySet( StarBASIC
* pBasic
, SbxArray
& rPar
, BOOL bWrite
);