1f8e07b45SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3f8e07b45SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4f8e07b45SAndrew Rist * or more contributor license agreements. See the NOTICE file 5f8e07b45SAndrew Rist * distributed with this work for additional information 6f8e07b45SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7f8e07b45SAndrew Rist * to you under the Apache License, Version 2.0 (the 8f8e07b45SAndrew Rist * "License"); you may not use this file except in compliance 9f8e07b45SAndrew Rist * with the License. You may obtain a copy of the License at 10f8e07b45SAndrew Rist * 11f8e07b45SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12f8e07b45SAndrew Rist * 13f8e07b45SAndrew Rist * Unless required by applicable law or agreed to in writing, 14f8e07b45SAndrew Rist * software distributed under the License is distributed on an 15f8e07b45SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16f8e07b45SAndrew Rist * KIND, either express or implied. See the License for the 17f8e07b45SAndrew Rist * specific language governing permissions and limitations 18f8e07b45SAndrew Rist * under the License. 19f8e07b45SAndrew Rist * 20f8e07b45SAndrew Rist *************************************************************/ 21f8e07b45SAndrew Rist 22f8e07b45SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef __FRAMEWORK_UIFACTORY_FACTORYCONFIGURATION_HXX_ 25cdf0e10cSrcweir #define __FRAMEWORK_UIFACTORY_FACTORYCONFIGURATION_HXX_ 26cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx> 27cdf0e10cSrcweir #include <macros/generic.hxx> 28cdf0e10cSrcweir #include <macros/xinterface.hxx> 29cdf0e10cSrcweir #include <macros/xtypeprovider.hxx> 30cdf0e10cSrcweir #include <macros/xserviceinfo.hxx> 31cdf0e10cSrcweir #include <stdtypes.h> 32cdf0e10cSrcweir 33cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 34cdf0e10cSrcweir // interface includes 35cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 36cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 37cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp> 38cdf0e10cSrcweir #include <com/sun/star/container/XContainerListener.hpp> 39cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 40cdf0e10cSrcweir #include <com/sun/star/lang/XMultiComponentFactory.hpp> 41cdf0e10cSrcweir #include <com/sun/star/frame/XUIControllerRegistration.hpp> 42cdf0e10cSrcweir 43cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 44cdf0e10cSrcweir // other includes 45cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 46cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 47cdf0e10cSrcweir #include <rtl/ustring.hxx> 48cdf0e10cSrcweir 49cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 50cdf0e10cSrcweir // Namespace 51cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 52cdf0e10cSrcweir // 53cdf0e10cSrcweir 54cdf0e10cSrcweir namespace framework 55cdf0e10cSrcweir { 56cdf0e10cSrcweir 57cdf0e10cSrcweir //***************************************************************************************************************** 58cdf0e10cSrcweir // Configuration access class for PopupMenuControllerFactory implementation 59cdf0e10cSrcweir //***************************************************************************************************************** 60cdf0e10cSrcweir class ConfigurationAccess_ControllerFactory : // interfaces 61cdf0e10cSrcweir private ThreadHelpBase, 62cdf0e10cSrcweir public ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener> 63cdf0e10cSrcweir { 64cdf0e10cSrcweir public: 65cdf0e10cSrcweir ConfigurationAccess_ControllerFactory( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot,bool _bAskValue = false ); 66cdf0e10cSrcweir virtual ~ConfigurationAccess_ControllerFactory(); 67cdf0e10cSrcweir 68cdf0e10cSrcweir void readConfigurationData(); 69cdf0e10cSrcweir void updateConfigurationData(); 70cdf0e10cSrcweir 71cdf0e10cSrcweir rtl::OUString getServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const; 72cdf0e10cSrcweir rtl::OUString getValueFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const; 73cdf0e10cSrcweir void addServiceToCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule, const rtl::OUString& rServiceSpecifier ); 74cdf0e10cSrcweir void removeServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ); 75cdf0e10cSrcweir inline bool hasValue() const { return m_bAskValue; } 76cdf0e10cSrcweir 77cdf0e10cSrcweir // container.XContainerListener 78cdf0e10cSrcweir virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); 79cdf0e10cSrcweir virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); 80cdf0e10cSrcweir virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException); 81cdf0e10cSrcweir 82cdf0e10cSrcweir // lang.XEventListener 83cdf0e10cSrcweir virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); 84cdf0e10cSrcweir 85cdf0e10cSrcweir private: 86cdf0e10cSrcweir struct ControllerInfo 87cdf0e10cSrcweir { 88cdf0e10cSrcweir rtl::OUString m_aImplementationName; 89cdf0e10cSrcweir rtl::OUString m_aValue; 90cdf0e10cSrcweir ControllerInfo(const ::rtl::OUString& _aImplementationName,const ::rtl::OUString& _aValue) : m_aImplementationName(_aImplementationName),m_aValue(_aValue){} 91cdf0e10cSrcweir ControllerInfo(){} 92cdf0e10cSrcweir }; 93cdf0e10cSrcweir class MenuControllerMap : public std::hash_map< rtl::OUString, 94cdf0e10cSrcweir ControllerInfo, 95*5758ad8cSAriel Constenla-Haile rtl::OUStringHash, 96cdf0e10cSrcweir ::std::equal_to< ::rtl::OUString > > 97cdf0e10cSrcweir { 98cdf0e10cSrcweir inline void free() 99cdf0e10cSrcweir { 100cdf0e10cSrcweir MenuControllerMap().swap( *this ); 101cdf0e10cSrcweir } 102cdf0e10cSrcweir }; 103cdf0e10cSrcweir 104cdf0e10cSrcweir sal_Bool impl_getElementProps( const ::com::sun::star::uno::Any& aElement, rtl::OUString& aCommand, rtl::OUString& aModule, rtl::OUString& aServiceSpecifier,rtl::OUString& aValue ) const; 105cdf0e10cSrcweir 106cdf0e10cSrcweir rtl::OUString m_aPropCommand; 107cdf0e10cSrcweir rtl::OUString m_aPropModule; 108cdf0e10cSrcweir rtl::OUString m_aPropController; 109cdf0e10cSrcweir rtl::OUString m_aPropValue; 110cdf0e10cSrcweir rtl::OUString m_sRoot; 111cdf0e10cSrcweir MenuControllerMap m_aMenuControllerMap; 112cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; 113cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider; 114cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xConfigAccess; 115cdf0e10cSrcweir sal_Bool m_bConfigAccessInitialized; 116cdf0e10cSrcweir bool m_bAskValue; 117cdf0e10cSrcweir }; 118cdf0e10cSrcweir 119cdf0e10cSrcweir } // namespace framework 120cdf0e10cSrcweir #endif // __FRAMEWORK_UIFACTORY_FACTORYCONFIGURATION_HXX_ 121