update dev300-m57
[ooovba.git] / framework / inc / uielement / itemcontainer.hxx
bloba4c48ba95aa57b4fe393e2b9d7e210e61029e3fc
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: itemcontainer.hxx,v $
10 * $Revision: 1.5 $
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 ************************************************************************/
31 #ifndef __FRAMEWORK_UIELEMENT_ITEMCONTAINER_HXX_
32 #define __FRAMEWORK_UIELEMENT_ITEMCONTAINER_HXX_
34 //_________________________________________________________________________________________________________________
35 // my own includes
36 //_________________________________________________________________________________________________________________
38 #include <threadhelp/threadhelpbase.hxx>
39 #include <macros/generic.hxx>
40 #include <macros/xinterface.hxx>
41 #include <macros/xtypeprovider.hxx>
42 #include <helper/shareablemutex.hxx>
44 //_________________________________________________________________________________________________________________
45 // interface includes
46 //_________________________________________________________________________________________________________________
47 #include <com/sun/star/container/XIndexContainer.hpp>
48 #include <com/sun/star/beans/PropertyValue.hpp>
49 #include <com/sun/star/lang/XUnoTunnel.hpp>
51 //_________________________________________________________________________________________________________________
52 // other includes
53 //_________________________________________________________________________________________________________________
54 #include <rtl/ustring.hxx>
55 #include <cppuhelper/weak.hxx>
57 #include <vector>
59 namespace framework
62 class ConstItemContainer;
63 class ItemContainer : public ::com::sun::star::lang::XTypeProvider ,
64 public ::com::sun::star::container::XIndexContainer ,
65 public ::com::sun::star::lang::XUnoTunnel ,
66 public ::cppu::OWeakObject
68 friend class ConstItemContainer;
70 public:
71 ItemContainer( const ShareableMutex& );
72 ItemContainer( const ConstItemContainer& rConstItemContainer, const ShareableMutex& rMutex );
73 ItemContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rItemAccessContainer, const ShareableMutex& rMutex );
74 virtual ~ItemContainer();
76 //---------------------------------------------------------------------------------------------------------
77 // XInterface, XTypeProvider
78 //---------------------------------------------------------------------------------------------------------
79 FWK_DECLARE_XINTERFACE
80 FWK_DECLARE_XTYPEPROVIDER
82 // XUnoTunnel
83 static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
84 static ItemContainer* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
85 sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
87 // XIndexContainer
88 virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
89 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
91 virtual void SAL_CALL removeByIndex( sal_Int32 Index )
92 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
94 // XIndexReplace
95 virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
96 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
98 // XIndexAccess
99 virtual sal_Int32 SAL_CALL getCount()
100 throw (::com::sun::star::uno::RuntimeException);
102 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
103 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
105 // XElementAccess
106 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
107 throw (::com::sun::star::uno::RuntimeException)
109 return ::getCppuType((com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*)0);
112 virtual sal_Bool SAL_CALL hasElements()
113 throw (::com::sun::star::uno::RuntimeException);
115 private:
116 ItemContainer();
117 void copyItemContainer( const std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rSourceVector, const ShareableMutex& rMutex );
118 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 );
120 mutable ShareableMutex m_aShareMutex;
121 std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aItemVector;
126 #endif // #ifndef __FRAMEWORK_UIELEMENT_ITEMCONTAINER_HXX_