Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / svx / inc / shapecollection.hxx
blob67610f056763ab335cfac507e6704523b9ba3791
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 .
19 #pragma once
21 #include <cppuhelper/implbase3.hxx>
22 #include <comphelper/interfacecontainer4.hxx>
23 #include <com/sun/star/drawing/XShapes.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/uno/XComponentContext.hpp>
26 #include <com/sun/star/lang/XComponent.hpp>
27 #include <mutex>
28 #include <vector>
30 class SvxShapeCollection
31 : public cppu::WeakAggImplHelper3<css::drawing::XShapes, css::lang::XServiceInfo,
32 css::lang::XComponent>
34 private:
35 std::mutex m_aMutex;
36 std::vector<css::uno::Reference<css::drawing::XShape>> maShapeContainer;
37 comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> maEventListeners;
38 bool bDisposed = false;
39 bool bInDispose = false;
41 public:
42 SvxShapeCollection() noexcept;
44 // XInterface
45 virtual void SAL_CALL release() noexcept override;
47 // XComponent
48 virtual void SAL_CALL dispose() override;
49 virtual void SAL_CALL
50 addEventListener(const css::uno::Reference<css::lang::XEventListener>& aListener) override;
51 virtual void SAL_CALL
52 removeEventListener(const css::uno::Reference<css::lang::XEventListener>& aListener) override;
54 // XIndexAccess
55 virtual sal_Int32 SAL_CALL getCount() override;
56 virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override;
58 // XElementAccess
59 virtual css::uno::Type SAL_CALL getElementType() override;
60 virtual sal_Bool SAL_CALL hasElements() override;
62 // XShapes
63 virtual void SAL_CALL add(const css::uno::Reference<css::drawing::XShape>& xShape) override;
64 virtual void SAL_CALL remove(const css::uno::Reference<css::drawing::XShape>& xShape) override;
66 // XServiceInfo
67 virtual OUString SAL_CALL getImplementationName() override;
68 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
69 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
71 void getAllShapes(std::vector<css::uno::Reference<css::drawing::XShape>>& rShapes) const;
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */