1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef __FRAMEWORK_HELPER_PROPERTYSETCONTAINER_HXX_
29 #define __FRAMEWORK_HELPER_PROPERTYSETCONTAINER_HXX_
30 
31 /** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble
32                with solaris headers ...
33 */
34 #include <vector>
35 #include <cppuhelper/weak.hxx>
36 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
37 #include <com/sun/star/container/XIndexContainer.hpp>
38 #include <com/sun/star/beans/XPropertySet.hpp>
39 #include <threadhelp/threadhelpbase.hxx>
40 #include <framework/fwedllapi.h>
41 
42 namespace framework
43 {
44 
45 class FWE_DLLPUBLIC PropertySetContainer : public com::sun::star::container::XIndexContainer	,
46 							 public ThreadHelpBase								,	// Struct for right initalization of mutex member! Must be first of baseclasses.
47 							 public ::cppu::OWeakObject
48 {
49 	public:
50 		PropertySetContainer( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& );
51 		virtual ~PropertySetContainer();
52 
53 		// XInterface
54 		virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
55 			throw (::com::sun::star::uno::RuntimeException);
56 		virtual void SAL_CALL acquire() throw ();
57 		virtual void SAL_CALL release() throw ();
58 
59 		// XIndexContainer
60 		virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
61 			throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
62 
63 		virtual void SAL_CALL removeByIndex( sal_Int32 Index )
64 			throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
65 
66 		// XIndexReplace
67 		virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
68 			throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
69 
70 		// XIndexAccess
71 		virtual sal_Int32 SAL_CALL getCount()
72 			throw (::com::sun::star::uno::RuntimeException);
73 
74 		virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
75 			throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
76 
77 		// XElementAccess
78 		virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
79 			throw (::com::sun::star::uno::RuntimeException)
80 		{
81 			return ::getCppuType((com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >*)0);
82 		}
83 
84 		virtual sal_Bool SAL_CALL hasElements()
85 			throw (::com::sun::star::uno::RuntimeException);
86 
87 	protected:
88 		com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >	m_xServiceManager;
89 
90 	private:
91 		typedef std::vector< com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > > PropertySetVector;
92 		PropertySetVector																m_aPropertySetVector;
93 
94 };
95 
96 }
97 
98 #endif // __FRAMEWORK_CLASSES_PROPERTYSETCONTAINER_HXX_
99