Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef __FRAMEWORK_UIFACTORY_FACTORYCONFIGURATION_HXX_
30 : : #define __FRAMEWORK_UIFACTORY_FACTORYCONFIGURATION_HXX_
31 : : #include <threadhelp/threadhelpbase.hxx>
32 : : #include <macros/generic.hxx>
33 : : #include <macros/xinterface.hxx>
34 : : #include <macros/xtypeprovider.hxx>
35 : : #include <macros/xserviceinfo.hxx>
36 : : #include <stdtypes.h>
37 : :
38 : : #include <com/sun/star/lang/XServiceInfo.hpp>
39 : : #include <com/sun/star/lang/XTypeProvider.hpp>
40 : : #include <com/sun/star/container/XContainerListener.hpp>
41 : : #include <com/sun/star/container/XNameAccess.hpp>
42 : : #include <com/sun/star/lang/XMultiComponentFactory.hpp>
43 : : #include <com/sun/star/frame/XUIControllerRegistration.hpp>
44 : :
45 : : #include <cppuhelper/implbase1.hxx>
46 : : #include <rtl/ustring.hxx>
47 : :
48 : : //_________________________________________________________________________________________________________________
49 : : // Namespace
50 : : //_________________________________________________________________________________________________________________
51 : :
52 : : namespace framework
53 : : {
54 : :
55 : : //*****************************************************************************************************************
56 : : // Configuration access class for PopupMenuControllerFactory implementation
57 : : //*****************************************************************************************************************
58 : : class ConfigurationAccess_ControllerFactory : // interfaces
59 : : private ThreadHelpBase,
60 : : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener>
61 : : {
62 : : public:
63 : : ConfigurationAccess_ControllerFactory( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot,bool _bAskValue = false );
64 : : virtual ~ConfigurationAccess_ControllerFactory();
65 : :
66 : : void readConfigurationData();
67 : : void updateConfigurationData();
68 : :
69 : : rtl::OUString getServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const;
70 : : rtl::OUString getValueFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const;
71 : : void addServiceToCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule, const rtl::OUString& rServiceSpecifier );
72 : : void removeServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule );
73 : 2021 : inline bool hasValue() const { return m_bAskValue; }
74 : :
75 : : // container.XContainerListener
76 : : virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
77 : : virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
78 : : virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
79 : :
80 : : // lang.XEventListener
81 : : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
82 : :
83 : : private:
84 : 16220 : struct ControllerInfo
85 : : {
86 : : rtl::OUString m_aImplementationName;
87 : : rtl::OUString m_aValue;
88 : 3244 : ControllerInfo(const ::rtl::OUString& _aImplementationName,const ::rtl::OUString& _aValue) : m_aImplementationName(_aImplementationName),m_aValue(_aValue){}
89 : 0 : ControllerInfo(){}
90 : : };
91 [ + - ]: 636 : class MenuControllerMap : public boost::unordered_map< rtl::OUString,
92 : : ControllerInfo,
93 : : OUStringHashCode,
94 : : ::std::equal_to< ::rtl::OUString > >
95 : : {
96 : : inline void free()
97 : : {
98 : : MenuControllerMap().swap( *this );
99 : : }
100 : : };
101 : :
102 : : sal_Bool impl_getElementProps( const ::com::sun::star::uno::Any& aElement, rtl::OUString& aCommand, rtl::OUString& aModule, rtl::OUString& aServiceSpecifier,rtl::OUString& aValue ) const;
103 : :
104 : : rtl::OUString m_aPropCommand;
105 : : rtl::OUString m_aPropModule;
106 : : rtl::OUString m_aPropController;
107 : : rtl::OUString m_aPropValue;
108 : : rtl::OUString m_sRoot;
109 : : MenuControllerMap m_aMenuControllerMap;
110 : : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
111 : : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider;
112 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xConfigAccess;
113 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xConfigAccessListener;
114 : : sal_Bool m_bConfigAccessInitialized;
115 : : bool m_bAskValue;
116 : : };
117 : :
118 : : } // namespace framework
119 : : #endif // __FRAMEWORK_UIFACTORY_FACTORYCONFIGURATION_HXX_
120 : :
121 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|