Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_ITEMCONTAINER_HXX
21 : #define INCLUDED_FRAMEWORK_INC_UIELEMENT_ITEMCONTAINER_HXX
22 :
23 : #include <macros/generic.hxx>
24 : #include <macros/xinterface.hxx>
25 : #include <macros/xtypeprovider.hxx>
26 : #include <helper/shareablemutex.hxx>
27 :
28 : #include <com/sun/star/container/XIndexContainer.hpp>
29 : #include <com/sun/star/beans/PropertyValue.hpp>
30 : #include <com/sun/star/lang/XUnoTunnel.hpp>
31 :
32 : #include <rtl/ustring.hxx>
33 : #include <cppuhelper/implbase1.hxx>
34 :
35 : #include <vector>
36 : #include <fwidllapi.h>
37 :
38 : namespace framework
39 : {
40 : class ConstItemContainer;
41 : class FWI_DLLPUBLIC ItemContainer : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XIndexContainer>
42 : {
43 : friend class ConstItemContainer;
44 :
45 : public:
46 : ItemContainer( const ShareableMutex& );
47 : ItemContainer( const ConstItemContainer& rConstItemContainer, const ShareableMutex& rMutex );
48 : ItemContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rItemAccessContainer, const ShareableMutex& rMutex );
49 : virtual ~ItemContainer();
50 :
51 : // XInterface, XTypeProvider
52 :
53 : // XUnoTunnel
54 : static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
55 : static ItemContainer* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
56 :
57 : // XIndexContainer
58 : virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
59 : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
60 :
61 : virtual void SAL_CALL removeByIndex( sal_Int32 Index )
62 : throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
63 :
64 : // XIndexReplace
65 : virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
66 : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
67 :
68 : // XIndexAccess
69 : virtual sal_Int32 SAL_CALL getCount()
70 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
71 :
72 : virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
73 : throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
74 :
75 : // XElementAccess
76 0 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
77 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
78 : {
79 0 : return ::getCppuType((com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*)0);
80 : }
81 :
82 : virtual sal_Bool SAL_CALL hasElements()
83 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 :
85 : private:
86 : ItemContainer();
87 : void copyItemContainer( const std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rSourceVector, const ShareableMutex& rMutex );
88 : 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 );
89 :
90 : mutable ShareableMutex m_aShareMutex;
91 : std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aItemVector;
92 : };
93 :
94 : }
95 :
96 : #endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_ITEMCONTAINER_HXX
97 :
98 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|