Line data Source code
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 : #ifndef INCLUDED_FRAMEWORK_INC_UIFACTORY_UIELEMENTFACTORYMANAGER_HXX
21 : #define INCLUDED_FRAMEWORK_INC_UIFACTORY_UIELEMENTFACTORYMANAGER_HXX
22 :
23 : #include <sal/config.h>
24 :
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/uno/XComponentContext.hpp>
29 :
30 : #include <cppuhelper/implbase1.hxx>
31 : #include <rtl/ustring.hxx>
32 :
33 : #include <boost/unordered_map.hpp>
34 :
35 : namespace framework {
36 :
37 : class ConfigurationAccess_FactoryManager : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener>
38 : {
39 : public:
40 : ConfigurationAccess_FactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& rxContext, const OUString& _sRoot );
41 : virtual ~ConfigurationAccess_FactoryManager();
42 :
43 : void readConfigurationData();
44 :
45 : OUString getFactorySpecifierFromTypeNameModule( const OUString& rType, const OUString& rName, const OUString& rModule ) const;
46 : void addFactorySpecifierToTypeNameModule( const OUString& rType, const OUString& rName, const OUString& rModule, const OUString& aServiceSpecifier );
47 : void removeFactorySpecifierFromTypeNameModule( const OUString& rType, const OUString& rName, const OUString& rModule );
48 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > getFactoriesDescription() const;
49 :
50 : // container.XContainerListener
51 : virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
52 : virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
53 : virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
54 :
55 : // lang.XEventListener
56 : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
57 :
58 : private:
59 0 : class FactoryManagerMap : public boost::unordered_map< OUString,
60 : OUString,
61 : OUStringHash,
62 : ::std::equal_to< OUString > >
63 : {
64 : inline void free()
65 : {
66 : FactoryManagerMap().swap( *this );
67 : }
68 : };
69 :
70 : bool impl_getElementProps( const ::com::sun::star::uno::Any& rElement, OUString& rType, OUString& rName, OUString& rModule, OUString& rServiceSpecifier ) const;
71 :
72 : mutable osl::Mutex m_aMutex;
73 : OUString m_aPropType;
74 : OUString m_aPropName;
75 : OUString m_aPropModule;
76 : OUString m_aPropFactory;
77 : OUString m_sRoot;
78 : FactoryManagerMap m_aFactoryManagerMap;
79 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider;
80 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xConfigAccess;
81 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xConfigListener;
82 : bool m_bConfigAccessInitialized;
83 : };
84 :
85 : } // namespace framework
86 :
87 : #endif // INCLUDED_FRAMEWORK_INC_UIFACTORY_UIELEMENTFACTORYMANAGER_HXX
88 :
89 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|