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