LibreOffice Module framework (master) 1
configurationaccessfactorymanager.hxx
Go to the documentation of this file.
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 <sal/config.h>
23
24#include <com/sun/star/beans/PropertyValue.hpp>
25#include <com/sun/star/container/XContainerListener.hpp>
26#include <com/sun/star/container/XNameAccess.hpp>
27#include <com/sun/star/lang/XMultiServiceFactory.hpp>
28#include <com/sun/star/uno/XComponentContext.hpp>
29
31#include <rtl/ustring.hxx>
32
33#include <mutex>
34#include <string_view>
35#include <unordered_map>
36
37namespace framework {
38
39class ConfigurationAccess_FactoryManager final : public ::cppu::WeakImplHelper< css::container::XContainerListener>
40{
41 public:
42 ConfigurationAccess_FactoryManager( const css::uno::Reference< css::uno::XComponentContext>& rxContext, OUString _sRoot );
43 virtual ~ConfigurationAccess_FactoryManager() override;
44
46
47 OUString getFactorySpecifierFromTypeNameModule( std::u16string_view rType, std::u16string_view rName, std::u16string_view rModule ) const;
48 void addFactorySpecifierToTypeNameModule( std::u16string_view rType, std::u16string_view rName, std::u16string_view rModule, const OUString& aServiceSpecifier );
49 void removeFactorySpecifierFromTypeNameModule( std::u16string_view rType, std::u16string_view rName, std::u16string_view rModule );
50 css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > getFactoriesDescription() const;
51
52 // container.XContainerListener
53 virtual void SAL_CALL elementInserted( const css::container::ContainerEvent& Event ) override;
54 virtual void SAL_CALL elementRemoved( const css::container::ContainerEvent& Event ) override;
55 virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) override;
56
57 // lang.XEventListener
58 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
59
60 private:
61 class FactoryManagerMap : public std::unordered_map<OUString,
62 OUString>
63 {
64 };
65
66 bool impl_getElementProps( const css::uno::Any& rElement, OUString& rType, OUString& rName, OUString& rModule, OUString& rServiceSpecifier ) const;
67
68 mutable std::mutex m_aMutex;
69 OUString m_aPropType;
70 OUString m_aPropName;
71 OUString m_aPropModule;
73 OUString m_sRoot;
75 css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvider;
76 css::uno::Reference< css::container::XNameAccess > m_xConfigAccess;
77 css::uno::Reference< css::container::XContainerListener > m_xConfigListener;
79};
80
81} // namespace framework
82
83/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ConfigurationAccess_FactoryManager(const css::uno::Reference< css::uno::XComponentContext > &rxContext, OUString _sRoot)
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent &Event) override
virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent &Event) override
css::uno::Reference< css::container::XContainerListener > m_xConfigListener
css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > getFactoriesDescription() const
css::uno::Reference< css::container::XNameAccess > m_xConfigAccess
void removeFactorySpecifierFromTypeNameModule(std::u16string_view rType, std::u16string_view rName, std::u16string_view rModule)
OUString getFactorySpecifierFromTypeNameModule(std::u16string_view rType, std::u16string_view rName, std::u16string_view rModule) const
virtual void SAL_CALL elementInserted(const css::container::ContainerEvent &Event) override
bool impl_getElementProps(const css::uno::Any &rElement, OUString &rType, OUString &rName, OUString &rModule, OUString &rServiceSpecifier) const
css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvider
void addFactorySpecifierToTypeNameModule(std::u16string_view rType, std::u16string_view rName, std::u16string_view rModule, const OUString &aServiceSpecifier)