xref: /AOO41X/main/framework/inc/helper/propertysetcontainer.hxx (revision f8e07b45f7e1fb69563504f404bb0b75210f0be6)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef __FRAMEWORK_HELPER_PROPERTYSETCONTAINER_HXX_
25 #define __FRAMEWORK_HELPER_PROPERTYSETCONTAINER_HXX_
26 
27 /** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble
28                with solaris headers ...
29 */
30 #include <vector>
31 #include <cppuhelper/weak.hxx>
32 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 #include <com/sun/star/container/XIndexContainer.hpp>
34 #include <com/sun/star/beans/XPropertySet.hpp>
35 #include <threadhelp/threadhelpbase.hxx>
36 #include <framework/fwedllapi.h>
37 
38 namespace framework
39 {
40 
41 class FWE_DLLPUBLIC PropertySetContainer : public com::sun::star::container::XIndexContainer    ,
42                              public ThreadHelpBase                              ,   // Struct for right initalization of mutex member! Must be first of baseclasses.
43                              public ::cppu::OWeakObject
44 {
45     public:
46         PropertySetContainer( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& );
47         virtual ~PropertySetContainer();
48 
49         // XInterface
50         virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
51             throw (::com::sun::star::uno::RuntimeException);
52         virtual void SAL_CALL acquire() throw ();
53         virtual void SAL_CALL release() throw ();
54 
55         // XIndexContainer
56         virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
57             throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
58 
59         virtual void SAL_CALL removeByIndex( sal_Int32 Index )
60             throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
61 
62         // XIndexReplace
63         virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
64             throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
65 
66         // XIndexAccess
67         virtual sal_Int32 SAL_CALL getCount()
68             throw (::com::sun::star::uno::RuntimeException);
69 
70         virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
71             throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
72 
73         // XElementAccess
getElementType()74         virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
75             throw (::com::sun::star::uno::RuntimeException)
76         {
77             return ::getCppuType((com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >*)0);
78         }
79 
80         virtual sal_Bool SAL_CALL hasElements()
81             throw (::com::sun::star::uno::RuntimeException);
82 
83     protected:
84         com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >    m_xServiceManager;
85 
86     private:
87         typedef std::vector< com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > > PropertySetVector;
88         PropertySetVector                                                               m_aPropertySetVector;
89 
90 };
91 
92 }
93 
94 #endif // __FRAMEWORK_CLASSES_PROPERTYSETCONTAINER_HXX_
95