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 __FRAMEWORK_UIELEMENT_ITEMCONTAINER_HXX_
21 : #define __FRAMEWORK_UIELEMENT_ITEMCONTAINER_HXX_
22 :
23 : #include <threadhelp/threadhelpbase.hxx>
24 : #include <macros/generic.hxx>
25 : #include <macros/xinterface.hxx>
26 : #include <macros/xtypeprovider.hxx>
27 : #include <helper/shareablemutex.hxx>
28 :
29 : #include <com/sun/star/container/XIndexContainer.hpp>
30 : #include <com/sun/star/beans/PropertyValue.hpp>
31 : #include <com/sun/star/lang/XUnoTunnel.hpp>
32 :
33 : #include <rtl/ustring.hxx>
34 : #include <cppuhelper/implbase1.hxx>
35 :
36 : #include <vector>
37 : #include <fwidllapi.h>
38 :
39 : namespace framework
40 : {
41 : class ConstItemContainer;
42 : class FWI_DLLPUBLIC ItemContainer : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XIndexContainer>
43 : {
44 : friend class ConstItemContainer;
45 :
46 : public:
47 : ItemContainer( const ShareableMutex& );
48 : ItemContainer( const ConstItemContainer& rConstItemContainer, const ShareableMutex& rMutex );
49 : ItemContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rItemAccessContainer, const ShareableMutex& rMutex );
50 : virtual ~ItemContainer();
51 :
52 : //---------------------------------------------------------------------------------------------------------
53 : // XInterface, XTypeProvider
54 : //---------------------------------------------------------------------------------------------------------
55 : // XUnoTunnel
56 : static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
57 : static ItemContainer* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
58 :
59 : // XIndexContainer
60 : virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
61 : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
62 :
63 : virtual void SAL_CALL removeByIndex( sal_Int32 Index )
64 : throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
65 :
66 : // XIndexReplace
67 : virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
68 : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
69 :
70 : // XIndexAccess
71 : virtual sal_Int32 SAL_CALL getCount()
72 : throw (::com::sun::star::uno::RuntimeException);
73 :
74 : virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
75 : throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
76 :
77 : // XElementAccess
78 0 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
79 : throw (::com::sun::star::uno::RuntimeException)
80 : {
81 0 : return ::getCppuType((com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*)0);
82 : }
83 :
84 : virtual sal_Bool SAL_CALL hasElements()
85 : throw (::com::sun::star::uno::RuntimeException);
86 :
87 : private:
88 : ItemContainer();
89 : void copyItemContainer( const std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rSourceVector, const ShareableMutex& rMutex );
90 : 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 );
91 :
92 : mutable ShareableMutex m_aShareMutex;
93 : std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aItemVector;
94 : };
95 :
96 : }
97 :
98 : #endif // #ifndef __FRAMEWORK_UIELEMENT_ITEMCONTAINER_HXX_
99 :
100 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|