xref: /trunk/main/framework/inc/uielement/constitemcontainer.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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_UIELEMENT_CONSTITEMCONTAINER_HXX_
25 #define __FRAMEWORK_UIELEMENT_CONSTITEMCONTAINER_HXX_
26 
27 //_________________________________________________________________________________________________________________
28 //  my own includes
29 //_________________________________________________________________________________________________________________
30 
31 #include <threadhelp/threadhelpbase.hxx>
32 #include <macros/generic.hxx>
33 #include <macros/xinterface.hxx>
34 #include <macros/xtypeprovider.hxx>
35 
36 //_________________________________________________________________________________________________________________
37 //  interface includes
38 //_________________________________________________________________________________________________________________
39 #include <com/sun/star/container/XIndexContainer.hpp>
40 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
41 #include <com/sun/star/beans/PropertyValue.hpp>
42 #include <com/sun/star/beans/XPropertySet.hpp>
43 #include <com/sun/star/beans/XFastPropertySet.hpp>
44 #include <com/sun/star/lang/XTypeProvider.hpp>
45 #include <com/sun/star/lang/XUnoTunnel.hpp>
46 
47 //_________________________________________________________________________________________________________________
48 //  other includes
49 //_________________________________________________________________________________________________________________
50 #include <rtl/ustring.hxx>
51 #include <cppuhelper/weak.hxx>
52 #include <cppuhelper/propshlp.hxx>
53 
54 #include <vector>
55 #include <fwidllapi.h>
56 
57 namespace framework
58 {
59 
60 class RootItemContainer;
61 class ItemContainer;
62 class FWI_DLLPUBLIC ConstItemContainer :    public ::com::sun::star::lang::XTypeProvider    ,
63                             public com::sun::star::container::XIndexAccess  ,
64                             public ::com::sun::star::lang::XUnoTunnel       ,
65                             public ::com::sun::star::beans::XFastPropertySet,
66                             public ::com::sun::star::beans::XPropertySet    ,
67                             public ::cppu::OWeakObject
68 {
69     friend class RootItemContainer;
70     friend class ItemContainer;
71 
72     public:
73         ConstItemContainer();
74         ConstItemContainer( const ItemContainer& rtemContainer );
75         ConstItemContainer( const RootItemContainer& rRootItemContainer, sal_Bool bFastCopy = sal_False );
76         ConstItemContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rSourceContainer, sal_Bool bFastCopy = sal_False );
77         virtual ~ConstItemContainer();
78 
79         //---------------------------------------------------------------------------------------------------------
80         //  XInterface, XTypeProvider
81         //---------------------------------------------------------------------------------------------------------
82         FWK_DECLARE_XINTERFACE
83         FWK_DECLARE_XTYPEPROVIDER
84 
85         // XUnoTunnel
86         static const ::com::sun::star::uno::Sequence< sal_Int8 >&   GetUnoTunnelId() throw();
87         static ConstItemContainer*                                  GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
88         sal_Int64                                                   SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier );
89 
90         // XIndexAccess
91         virtual sal_Int32 SAL_CALL getCount();
92 
93         virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index );
94 
95         // XElementAccess
getElementType()96         virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
97         {
98             return ::getCppuType((com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*)0);
99         }
100 
101         virtual sal_Bool SAL_CALL hasElements();
102 
103         // XPropertySet
104         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  );
105         virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue );
106         virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName );
107         virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener );
108         virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener );
109         virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener );
110         virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener );
111 
112         // XFastPropertySet
113         virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue );
114         virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle );
115 
116     private:
117         ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
118         const com::sun::star::uno::Sequence< com::sun::star::beans::Property > impl_getStaticPropertyDescriptor();
119         static ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > SAL_CALL createPropertySetInfo( ::cppu::IPropertyArrayHelper & rProperties ) SAL_THROW( () );
120 
121         void copyItemContainer( const std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rSourceVector );
122         com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > deepCopyContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rSubContainer );
123 
124         std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aItemVector;
125         rtl::OUString                                                                        m_aUIName;
126 };
127 
128 }
129 
130 #endif // #ifndef __FRAMEWORK_UIELEMENT_CONSTITEMCONTAINER_HXX_
131