xref: /trunk/main/framework/inc/uielement/itemcontainer.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_ITEMCONTAINER_HXX_
25 #define __FRAMEWORK_UIELEMENT_ITEMCONTAINER_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 #include <helper/shareablemutex.hxx>
36 
37 //_________________________________________________________________________________________________________________
38 //  interface includes
39 //_________________________________________________________________________________________________________________
40 #include <com/sun/star/container/XIndexContainer.hpp>
41 #include <com/sun/star/beans/PropertyValue.hpp>
42 #include <com/sun/star/lang/XUnoTunnel.hpp>
43 
44 //_________________________________________________________________________________________________________________
45 //  other includes
46 //_________________________________________________________________________________________________________________
47 #include <rtl/ustring.hxx>
48 #include <cppuhelper/implbase1.hxx>
49 
50 #include <vector>
51 #include <fwidllapi.h>
52 
53 namespace framework
54 {
55 class ConstItemContainer;
56 class FWI_DLLPUBLIC ItemContainer :   public ::cppu::WeakImplHelper1< ::com::sun::star::container::XIndexContainer>
57 {
58     friend class ConstItemContainer;
59 
60     public:
61         ItemContainer( const ShareableMutex& );
62         ItemContainer( const ConstItemContainer& rConstItemContainer, const ShareableMutex& rMutex );
63         ItemContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rItemAccessContainer, const ShareableMutex& rMutex );
64         virtual ~ItemContainer();
65 
66         //---------------------------------------------------------------------------------------------------------
67         //  XInterface, XTypeProvider
68         //---------------------------------------------------------------------------------------------------------
69         // XUnoTunnel
70         static const ::com::sun::star::uno::Sequence< sal_Int8 >&   GetUnoTunnelId() throw();
71         static ItemContainer*                                       GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
72         sal_Int64                                                   SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier );
73 
74         // XIndexContainer
75         virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element );
76 
77         virtual void SAL_CALL removeByIndex( sal_Int32 Index );
78 
79         // XIndexReplace
80         virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element );
81 
82         // XIndexAccess
83         virtual sal_Int32 SAL_CALL getCount();
84 
85         virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index );
86 
87         // XElementAccess
getElementType()88         virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
89         {
90             return ::getCppuType((com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*)0);
91         }
92 
93         virtual sal_Bool SAL_CALL hasElements();
94 
95     private:
96         ItemContainer();
97         void copyItemContainer( const std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rSourceVector, const ShareableMutex& rMutex );
98         com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > deepCopyContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rSubContainer, const ShareableMutex& rMutex );
99 
100         mutable ShareableMutex                                                               m_aShareMutex;
101         std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aItemVector;
102 };
103 
104 }
105 
106 #endif // #ifndef __FRAMEWORK_UIELEMENT_ITEMCONTAINER_HXX_
107