Update git submodules
[LibreOffice.git] / framework / inc / uielement / itemcontainer.hxx
blobb15514f666489056801d7fd249417051e31e370f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #pragma once
22 #include <helper/shareablemutex.hxx>
24 #include <com/sun/star/container/XIndexContainer.hpp>
25 #include <com/sun/star/beans/PropertyValue.hpp>
27 #include <cppuhelper/implbase.hxx>
29 #include <vector>
31 namespace framework
33 class ConstItemContainer;
34 class ItemContainer final : public ::cppu::WeakImplHelper< css::container::XIndexContainer>
36 friend class ConstItemContainer;
38 public:
39 ItemContainer( const ShareableMutex& );
40 ItemContainer( const ConstItemContainer& rConstItemContainer, const ShareableMutex& rMutex );
41 ItemContainer( const css::uno::Reference< css::container::XIndexAccess >& rItemAccessContainer, const ShareableMutex& rMutex );
42 virtual ~ItemContainer() override;
44 // XInterface, XTypeProvider
46 // XIndexContainer
47 virtual void SAL_CALL insertByIndex( sal_Int32 Index, const css::uno::Any& Element ) override;
49 virtual void SAL_CALL removeByIndex( sal_Int32 Index ) override;
51 // XIndexReplace
52 virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const css::uno::Any& Element ) override;
54 // XIndexAccess
55 virtual sal_Int32 SAL_CALL getCount() override;
57 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
59 // XElementAccess
60 virtual css::uno::Type SAL_CALL getElementType() override
62 return cppu::UnoType<css::uno::Sequence< css::beans::PropertyValue >>::get();
65 virtual sal_Bool SAL_CALL hasElements() override;
67 private:
68 void copyItemContainer( const std::vector< css::uno::Sequence< css::beans::PropertyValue > >& rSourceVector, const ShareableMutex& rMutex );
69 static css::uno::Reference< css::container::XIndexAccess > deepCopyContainer( const css::uno::Reference< css::container::XIndexAccess >& rSubContainer, const ShareableMutex& rMutex );
71 mutable ShareableMutex m_aShareMutex;
72 std::vector< css::uno::Sequence< css::beans::PropertyValue > > m_aItemVector;
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */