/src/libreoffice/framework/inc/uielement/itemcontainer.hxx
Line | Count | Source |
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 | | #pragma once |
21 | | |
22 | | #include <helper/shareablemutex.hxx> |
23 | | |
24 | | #include <com/sun/star/container/XIndexContainer.hpp> |
25 | | #include <com/sun/star/beans/PropertyValue.hpp> |
26 | | |
27 | | #include <cppuhelper/implbase.hxx> |
28 | | #include <rtl/ref.hxx> |
29 | | |
30 | | #include <vector> |
31 | | |
32 | | namespace framework |
33 | | { |
34 | | class ConstItemContainer; |
35 | | class ItemContainer final : public ::cppu::WeakImplHelper< css::container::XIndexContainer> |
36 | | { |
37 | | friend class ConstItemContainer; |
38 | | |
39 | | public: |
40 | | ItemContainer( const ShareableMutex& ); |
41 | | ItemContainer( const ConstItemContainer& rConstItemContainer, const ShareableMutex& rMutex ); |
42 | | ItemContainer( const css::uno::Reference< css::container::XIndexAccess >& rItemAccessContainer, const ShareableMutex& rMutex ); |
43 | | virtual ~ItemContainer() override; |
44 | | |
45 | | // XInterface, XTypeProvider |
46 | | |
47 | | // XIndexContainer |
48 | | virtual void SAL_CALL insertByIndex( sal_Int32 Index, const css::uno::Any& Element ) override; |
49 | | |
50 | | virtual void SAL_CALL removeByIndex( sal_Int32 Index ) override; |
51 | | |
52 | | // XIndexReplace |
53 | | virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const css::uno::Any& Element ) override; |
54 | | |
55 | | // XIndexAccess |
56 | | virtual sal_Int32 SAL_CALL getCount() override; |
57 | | |
58 | | virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; |
59 | | |
60 | | // XElementAccess |
61 | | virtual css::uno::Type SAL_CALL getElementType() override |
62 | 0 | { |
63 | 0 | return cppu::UnoType<css::uno::Sequence< css::beans::PropertyValue >>::get(); |
64 | 0 | } |
65 | | |
66 | | virtual sal_Bool SAL_CALL hasElements() override; |
67 | | |
68 | | private: |
69 | | void copyItemContainer( const std::vector< css::uno::Sequence< css::beans::PropertyValue > >& rSourceVector, const ShareableMutex& rMutex ); |
70 | | static rtl::Reference< ItemContainer > deepCopyContainer( const css::uno::Reference< css::container::XIndexAccess >& rSubContainer, const ShareableMutex& rMutex ); |
71 | | |
72 | | mutable ShareableMutex m_aShareMutex; |
73 | | std::vector< css::uno::Sequence< css::beans::PropertyValue > > m_aItemVector; |
74 | | }; |
75 | | |
76 | | } |
77 | | |
78 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |