/src/libreoffice/framework/inc/uielement/rootitemcontainer.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/container/XIndexAccess.hpp> |
26 | | #include <com/sun/star/lang/XSingleComponentFactory.hpp> |
27 | | #include <com/sun/star/beans/PropertyValue.hpp> |
28 | | |
29 | | #include <rtl/ustring.hxx> |
30 | | #include <rtl/ref.hxx> |
31 | | #include <cppuhelper/basemutex.hxx> |
32 | | #include <cppuhelper/implbase.hxx> |
33 | | #include <cppuhelper/propshlp.hxx> |
34 | | |
35 | | #include <vector> |
36 | | |
37 | | namespace framework |
38 | | { |
39 | | class ConstItemContainer; |
40 | | class ItemContainer; |
41 | | |
42 | | typedef ::cppu::WeakImplHelper< |
43 | | css::container::XIndexContainer, |
44 | | css::lang::XSingleComponentFactory > RootItemContainer_BASE; |
45 | | |
46 | | class RootItemContainer final : private cppu::BaseMutex, |
47 | | public ::cppu::OBroadcastHelper , |
48 | | public ::cppu::OPropertySetHelper , |
49 | | public RootItemContainer_BASE |
50 | | { |
51 | | friend class ConstItemContainer; |
52 | | |
53 | | public: |
54 | | RootItemContainer(); |
55 | | RootItemContainer( const css::uno::Reference< css::container::XIndexAccess >& rItemAccessContainer ); |
56 | | virtual ~RootItemContainer() override; |
57 | | |
58 | | // XInterface |
59 | | virtual void SAL_CALL acquire() noexcept override |
60 | 0 | { OWeakObject::acquire(); } |
61 | | virtual void SAL_CALL release() noexcept override |
62 | 0 | { OWeakObject::release(); } |
63 | | virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& type) override; |
64 | | |
65 | | // XTypeProvider |
66 | | virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; |
67 | | |
68 | | // XIndexContainer |
69 | | virtual void SAL_CALL insertByIndex( sal_Int32 Index, const css::uno::Any& Element ) override; |
70 | | |
71 | | virtual void SAL_CALL removeByIndex( sal_Int32 Index ) override; |
72 | | |
73 | | // XIndexReplace |
74 | | virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const css::uno::Any& Element ) override; |
75 | | |
76 | | // XIndexAccess |
77 | | virtual sal_Int32 SAL_CALL getCount() override; |
78 | | |
79 | | virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; |
80 | | |
81 | | // XElementAccess |
82 | | virtual css::uno::Type SAL_CALL getElementType() override |
83 | 0 | { |
84 | 0 | return cppu::UnoType<css::uno::Sequence< css::beans::PropertyValue >>::get(); |
85 | 0 | } |
86 | | |
87 | | virtual sal_Bool SAL_CALL hasElements() override; |
88 | | |
89 | | // XSingleComponentFactory |
90 | | virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithContext( const css::uno::Reference< css::uno::XComponentContext >& Context ) override; |
91 | | virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const css::uno::Sequence< css::uno::Any >& Arguments, const css::uno::Reference< css::uno::XComponentContext >& Context ) override; |
92 | | |
93 | | private: |
94 | | // OPropertySetHelper |
95 | | virtual sal_Bool SAL_CALL convertFastPropertyValue ( css::uno::Any& aConvertedValue , |
96 | | css::uno::Any& aOldValue , |
97 | | sal_Int32 nHandle , |
98 | | const css::uno::Any& aValue ) override; |
99 | | virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , |
100 | | const css::uno::Any& aValue ) override; |
101 | | using cppu::OPropertySetHelper::getFastPropertyValue; |
102 | | virtual void SAL_CALL getFastPropertyValue( css::uno::Any& aValue , |
103 | | sal_Int32 nHandle ) const override; |
104 | | virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; |
105 | | virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override; |
106 | | |
107 | | static css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor(); |
108 | | |
109 | | RootItemContainer& operator=( const RootItemContainer& ) = delete; |
110 | | RootItemContainer( const RootItemContainer& ) = delete; |
111 | | |
112 | | rtl::Reference< ItemContainer > deepCopyContainer( const css::uno::Reference< css::container::XIndexAccess >& rSubContainer ); |
113 | | |
114 | | mutable ShareableMutex m_aShareMutex; |
115 | | std::vector< css::uno::Sequence< css::beans::PropertyValue > > m_aItemVector; |
116 | | OUString m_aUIName; |
117 | | }; |
118 | | |
119 | | } |
120 | | |
121 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |