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>
29 #include <rtl/ustring.hxx>
30 #include <cppuhelper/basemutex.hxx>
31 #include <cppuhelper/implbase.hxx>
32 #include <cppuhelper/propshlp.hxx>
38 class ConstItemContainer
;
40 typedef ::cppu::WeakImplHelper
<
41 css::container::XIndexContainer
,
42 css::lang::XSingleComponentFactory
> RootItemContainer_BASE
;
44 class RootItemContainer final
: private cppu::BaseMutex
,
45 public ::cppu::OBroadcastHelper
,
46 public ::cppu::OPropertySetHelper
,
47 public RootItemContainer_BASE
49 friend class ConstItemContainer
;
53 RootItemContainer( const css::uno::Reference
< css::container::XIndexAccess
>& rItemAccessContainer
);
54 virtual ~RootItemContainer() override
;
57 virtual void SAL_CALL
acquire() noexcept override
58 { OWeakObject::acquire(); }
59 virtual void SAL_CALL
release() noexcept override
60 { OWeakObject::release(); }
61 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& type
) override
;
64 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes( ) override
;
67 virtual void SAL_CALL
insertByIndex( sal_Int32 Index
, const css::uno::Any
& Element
) override
;
69 virtual void SAL_CALL
removeByIndex( sal_Int32 Index
) override
;
72 virtual void SAL_CALL
replaceByIndex( sal_Int32 Index
, const css::uno::Any
& Element
) override
;
75 virtual sal_Int32 SAL_CALL
getCount() override
;
77 virtual css::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) override
;
80 virtual css::uno::Type SAL_CALL
getElementType() override
82 return cppu::UnoType
<css::uno::Sequence
< css::beans::PropertyValue
>>::get();
85 virtual sal_Bool SAL_CALL
hasElements() override
;
87 // XSingleComponentFactory
88 virtual css::uno::Reference
< css::uno::XInterface
> SAL_CALL
createInstanceWithContext( const css::uno::Reference
< css::uno::XComponentContext
>& Context
) override
;
89 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
;
93 virtual sal_Bool SAL_CALL
convertFastPropertyValue ( css::uno::Any
& aConvertedValue
,
94 css::uno::Any
& aOldValue
,
96 const css::uno::Any
& aValue
) override
;
97 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast( sal_Int32 nHandle
,
98 const css::uno::Any
& aValue
) override
;
99 using cppu::OPropertySetHelper::getFastPropertyValue
;
100 virtual void SAL_CALL
getFastPropertyValue( css::uno::Any
& aValue
,
101 sal_Int32 nHandle
) const override
;
102 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
;
103 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() override
;
105 static css::uno::Sequence
< css::beans::Property
> impl_getStaticPropertyDescriptor();
107 RootItemContainer
& operator=( const RootItemContainer
& ) = delete;
108 RootItemContainer( const RootItemContainer
& ) = delete;
110 css::uno::Reference
< css::container::XIndexAccess
> deepCopyContainer( const css::uno::Reference
< css::container::XIndexAccess
>& rSubContainer
);
112 mutable ShareableMutex m_aShareMutex
;
113 std::vector
< css::uno::Sequence
< css::beans::PropertyValue
> > m_aItemVector
;
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */