1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <helper/shareablemutex.hxx>
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 #include <com/sun/star/lang/XUnoTunnel.hpp>
30 #include <rtl/ustring.hxx>
31 #include <cppuhelper/basemutex.hxx>
32 #include <cppuhelper/implbase.hxx>
33 #include <cppuhelper/propshlp.hxx>
39 class ConstItemContainer
;
41 typedef ::cppu::WeakImplHelper
<
42 css::container::XIndexContainer
,
43 css::lang::XSingleComponentFactory
,
44 css::lang::XUnoTunnel
> RootItemContainer_BASE
;
46 class RootItemContainer final
: private cppu::BaseMutex
,
47 public ::cppu::OBroadcastHelper
,
48 public ::cppu::OPropertySetHelper
,
49 public RootItemContainer_BASE
51 friend class ConstItemContainer
;
55 RootItemContainer( const css::uno::Reference
< css::container::XIndexAccess
>& rItemAccessContainer
);
56 virtual ~RootItemContainer() override
;
59 virtual void SAL_CALL
acquire() noexcept override
60 { OWeakObject::acquire(); }
61 virtual void SAL_CALL
release() noexcept override
62 { OWeakObject::release(); }
63 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& type
) override
;
66 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes( ) override
;
69 static const css::uno::Sequence
< sal_Int8
>& getUnoTunnelId() noexcept
;
70 sal_Int64 SAL_CALL
getSomething( const css::uno::Sequence
< sal_Int8
>& rIdentifier
) override
;
73 virtual void SAL_CALL
insertByIndex( sal_Int32 Index
, const css::uno::Any
& Element
) override
;
75 virtual void SAL_CALL
removeByIndex( sal_Int32 Index
) override
;
78 virtual void SAL_CALL
replaceByIndex( sal_Int32 Index
, const css::uno::Any
& Element
) override
;
81 virtual sal_Int32 SAL_CALL
getCount() override
;
83 virtual css::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) override
;
86 virtual css::uno::Type SAL_CALL
getElementType() override
88 return cppu::UnoType
<css::uno::Sequence
< css::beans::PropertyValue
>>::get();
91 virtual sal_Bool SAL_CALL
hasElements() override
;
93 // XSingleComponentFactory
94 virtual css::uno::Reference
< css::uno::XInterface
> SAL_CALL
createInstanceWithContext( const css::uno::Reference
< css::uno::XComponentContext
>& Context
) override
;
95 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
;
99 virtual sal_Bool SAL_CALL
convertFastPropertyValue ( css::uno::Any
& aConvertedValue
,
100 css::uno::Any
& aOldValue
,
102 const css::uno::Any
& aValue
) override
;
103 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast( sal_Int32 nHandle
,
104 const css::uno::Any
& aValue
) override
;
105 using cppu::OPropertySetHelper::getFastPropertyValue
;
106 virtual void SAL_CALL
getFastPropertyValue( css::uno::Any
& aValue
,
107 sal_Int32 nHandle
) const override
;
108 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
;
109 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() override
;
111 static css::uno::Sequence
< css::beans::Property
> impl_getStaticPropertyDescriptor();
113 RootItemContainer
& operator=( const RootItemContainer
& ) = delete;
114 RootItemContainer( const RootItemContainer
& ) = delete;
116 css::uno::Reference
< css::container::XIndexAccess
> deepCopyContainer( const css::uno::Reference
< css::container::XIndexAccess
>& rSubContainer
);
118 mutable ShareableMutex m_aShareMutex
;
119 std::vector
< css::uno::Sequence
< css::beans::PropertyValue
> > m_aItemVector
;
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */