merge the formfield patch from ooo-build
[ooovba.git] / framework / inc / uifactory / factoryconfiguration.hxx
blob7c5dd1d340d22f2f9e6f9770e9e403e459d2935b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: toolbarcontrollerfactory.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __FRAMEWORK_UIFACTORY_FACTORYCONFIGURATION_HXX_
32 #define __FRAMEWORK_UIFACTORY_FACTORYCONFIGURATION_HXX_
33 #include <threadhelp/threadhelpbase.hxx>
34 #include <macros/generic.hxx>
35 #include <macros/xinterface.hxx>
36 #include <macros/xtypeprovider.hxx>
37 #include <macros/xserviceinfo.hxx>
38 #include <stdtypes.h>
40 //_________________________________________________________________________________________________________________
41 // interface includes
42 //_________________________________________________________________________________________________________________
43 #include <com/sun/star/lang/XServiceInfo.hpp>
44 #include <com/sun/star/lang/XTypeProvider.hpp>
45 #include <com/sun/star/container/XContainerListener.hpp>
46 #include <com/sun/star/container/XNameAccess.hpp>
47 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
48 #include <com/sun/star/frame/XUIControllerRegistration.hpp>
50 //_________________________________________________________________________________________________________________
51 // other includes
52 //_________________________________________________________________________________________________________________
53 #include <cppuhelper/implbase1.hxx>
54 #include <rtl/ustring.hxx>
56 //_________________________________________________________________________________________________________________
57 // Namespace
58 //_________________________________________________________________________________________________________________
59 //
61 namespace framework
64 //*****************************************************************************************************************
65 // Configuration access class for PopupMenuControllerFactory implementation
66 //*****************************************************************************************************************
67 class ConfigurationAccess_ControllerFactory : // interfaces
68 private ThreadHelpBase,
69 public ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener>
71 public:
72 ConfigurationAccess_ControllerFactory( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot,bool _bAskValue = false );
73 virtual ~ConfigurationAccess_ControllerFactory();
75 void readConfigurationData();
76 void updateConfigurationData();
78 rtl::OUString getServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const;
79 rtl::OUString getValueFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const;
80 void addServiceToCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule, const rtl::OUString& rServiceSpecifier );
81 void removeServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule );
82 inline bool hasValue() const { return m_bAskValue; }
84 // container.XContainerListener
85 virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
86 virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
87 virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
89 // lang.XEventListener
90 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
92 private:
93 struct ControllerInfo
95 rtl::OUString m_aImplementationName;
96 rtl::OUString m_aValue;
97 ControllerInfo(const ::rtl::OUString& _aImplementationName,const ::rtl::OUString& _aValue) : m_aImplementationName(_aImplementationName),m_aValue(_aValue){}
98 ControllerInfo(){}
100 class MenuControllerMap : public std::hash_map< rtl::OUString,
101 ControllerInfo,
102 OUStringHashCode,
103 ::std::equal_to< ::rtl::OUString > >
105 inline void free()
107 MenuControllerMap().swap( *this );
111 sal_Bool impl_getElementProps( const ::com::sun::star::uno::Any& aElement, rtl::OUString& aCommand, rtl::OUString& aModule, rtl::OUString& aServiceSpecifier,rtl::OUString& aValue ) const;
113 rtl::OUString m_aPropCommand;
114 rtl::OUString m_aPropModule;
115 rtl::OUString m_aPropController;
116 rtl::OUString m_aPropValue;
117 rtl::OUString m_sRoot;
118 MenuControllerMap m_aMenuControllerMap;
119 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
120 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider;
121 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xConfigAccess;
122 sal_Bool m_bConfigAccessInitialized;
123 bool m_bAskValue;
126 } // namespace framework
127 #endif // __FRAMEWORK_UIFACTORY_FACTORYCONFIGURATION_HXX_