Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef __FRAMEWORK_UIELEMENT_ITEMCONTAINER_HXX_
30 : : #define __FRAMEWORK_UIELEMENT_ITEMCONTAINER_HXX_
31 : :
32 : : #include <threadhelp/threadhelpbase.hxx>
33 : : #include <macros/generic.hxx>
34 : : #include <macros/xinterface.hxx>
35 : : #include <macros/xtypeprovider.hxx>
36 : : #include <helper/shareablemutex.hxx>
37 : :
38 : : #include <com/sun/star/container/XIndexContainer.hpp>
39 : : #include <com/sun/star/beans/PropertyValue.hpp>
40 : : #include <com/sun/star/lang/XUnoTunnel.hpp>
41 : :
42 : : #include <rtl/ustring.hxx>
43 : : #include <cppuhelper/implbase1.hxx>
44 : :
45 : : #include <vector>
46 : : #include <fwidllapi.h>
47 : :
48 : : namespace framework
49 : : {
50 : : class ConstItemContainer;
51 : : class FWI_DLLPUBLIC ItemContainer : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XIndexContainer>
52 : : {
53 : : friend class ConstItemContainer;
54 : :
55 : : public:
56 : : ItemContainer( const ShareableMutex& );
57 : : ItemContainer( const ConstItemContainer& rConstItemContainer, const ShareableMutex& rMutex );
58 : : ItemContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rItemAccessContainer, const ShareableMutex& rMutex );
59 : : virtual ~ItemContainer();
60 : :
61 : : //---------------------------------------------------------------------------------------------------------
62 : : // XInterface, XTypeProvider
63 : : //---------------------------------------------------------------------------------------------------------
64 : : // XUnoTunnel
65 : : static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
66 : : static ItemContainer* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
67 : :
68 : : // XIndexContainer
69 : : virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
70 : : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
71 : :
72 : : virtual void SAL_CALL removeByIndex( sal_Int32 Index )
73 : : throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
74 : :
75 : : // XIndexReplace
76 : : virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
77 : : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
78 : :
79 : : // XIndexAccess
80 : : virtual sal_Int32 SAL_CALL getCount()
81 : : throw (::com::sun::star::uno::RuntimeException);
82 : :
83 : : virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
84 : : throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
85 : :
86 : : // XElementAccess
87 : 0 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
88 : : throw (::com::sun::star::uno::RuntimeException)
89 : : {
90 : 0 : return ::getCppuType((com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*)0);
91 : : }
92 : :
93 : : virtual sal_Bool SAL_CALL hasElements()
94 : : throw (::com::sun::star::uno::RuntimeException);
95 : :
96 : : private:
97 : : ItemContainer();
98 : : void copyItemContainer( const std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rSourceVector, const ShareableMutex& rMutex );
99 : : 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 );
100 : :
101 : : mutable ShareableMutex m_aShareMutex;
102 : : std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aItemVector;
103 : : };
104 : :
105 : : }
106 : :
107 : : #endif // #ifndef __FRAMEWORK_UIELEMENT_ITEMCONTAINER_HXX_
108 : :
109 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|