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 .
20 #ifndef INCLUDED_FRAMEWORK_INC_UIFACTORY_CONFIGURATIONACCESSFACTORYMANAGER_HXX
21 #define INCLUDED_FRAMEWORK_INC_UIFACTORY_CONFIGURATIONACCESSFACTORYMANAGER_HXX
23 #include <sal/config.h>
25 #include <com/sun/star/beans/PropertyValue.hpp>
26 #include <com/sun/star/container/XContainerListener.hpp>
27 #include <com/sun/star/container/XNameAccess.hpp>
28 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29 #include <com/sun/star/uno/XComponentContext.hpp>
31 #include <cppuhelper/implbase1.hxx>
32 #include <rtl/ustring.hxx>
34 #include <unordered_map>
38 class ConfigurationAccess_FactoryManager
: public ::cppu::WeakImplHelper1
< ::com::sun::star::container::XContainerListener
>
41 ConfigurationAccess_FactoryManager( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
, const OUString
& _sRoot
);
42 virtual ~ConfigurationAccess_FactoryManager();
44 void readConfigurationData();
46 OUString
getFactorySpecifierFromTypeNameModule( const OUString
& rType
, const OUString
& rName
, const OUString
& rModule
) const;
47 void addFactorySpecifierToTypeNameModule( const OUString
& rType
, const OUString
& rName
, const OUString
& rModule
, const OUString
& aServiceSpecifier
);
48 void removeFactorySpecifierFromTypeNameModule( const OUString
& rType
, const OUString
& rName
, const OUString
& rModule
);
49 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> > getFactoriesDescription() const;
51 // container.XContainerListener
52 virtual void SAL_CALL
elementInserted( const ::com::sun::star::container::ContainerEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
53 virtual void SAL_CALL
elementRemoved( const ::com::sun::star::container::ContainerEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
54 virtual void SAL_CALL
elementReplaced( const ::com::sun::star::container::ContainerEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
56 // lang.XEventListener
57 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
60 class FactoryManagerMap
: public std::unordered_map
<OUString
,
63 std::equal_to
< OUString
> >
67 FactoryManagerMap().swap( *this );// get rid of reserved capacity
71 bool impl_getElementProps( const ::com::sun::star::uno::Any
& rElement
, OUString
& rType
, OUString
& rName
, OUString
& rModule
, OUString
& rServiceSpecifier
) const;
73 mutable osl::Mutex m_aMutex
;
76 OUString m_aPropModule
;
77 OUString m_aPropFactory
;
79 FactoryManagerMap m_aFactoryManagerMap
;
80 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> m_xConfigProvider
;
81 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> m_xConfigAccess
;
82 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XContainerListener
> m_xConfigListener
;
83 bool m_bConfigAccessInitialized
;
86 } // namespace framework
88 #endif // INCLUDED_FRAMEWORK_INC_UIFACTORY_CONFIGURATIONACCESSFACTORYMANAGER_HXX
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */