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 
42cdf0e10cSrcweir //_________________________________________________________________________________________________________________
43cdf0e10cSrcweir //	other includes
44cdf0e10cSrcweir //_________________________________________________________________________________________________________________
45cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
46cdf0e10cSrcweir #include <rtl/ustring.hxx>
47cdf0e10cSrcweir 
48cdf0e10cSrcweir //_________________________________________________________________________________________________________________
49cdf0e10cSrcweir //	Namespace
50cdf0e10cSrcweir //_________________________________________________________________________________________________________________
51cdf0e10cSrcweir //
52cdf0e10cSrcweir 
53cdf0e10cSrcweir namespace framework
54cdf0e10cSrcweir {
55cdf0e10cSrcweir 
56cdf0e10cSrcweir //*****************************************************************************************************************
57cdf0e10cSrcweir //	Configuration access class for PopupMenuControllerFactory implementation
58cdf0e10cSrcweir //*****************************************************************************************************************
59cdf0e10cSrcweir class ConfigurationAccess_ControllerFactory : // interfaces
60cdf0e10cSrcweir                                                     private ThreadHelpBase,
61cdf0e10cSrcweir                                                     public  ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener>
62cdf0e10cSrcweir {
63cdf0e10cSrcweir public:
64cdf0e10cSrcweir                     ConfigurationAccess_ControllerFactory( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot,bool _bAskValue = false );
65cdf0e10cSrcweir     virtual       ~ConfigurationAccess_ControllerFactory();
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     void          readConfigurationData();
68cdf0e10cSrcweir     void          updateConfigurationData();
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     rtl::OUString getServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const;
71cdf0e10cSrcweir     rtl::OUString getValueFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule ) const;
72cdf0e10cSrcweir     void          addServiceToCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule, const rtl::OUString& rServiceSpecifier );
73cdf0e10cSrcweir     void          removeServiceFromCommandModule( const rtl::OUString& rCommandURL, const rtl::OUString& rModule );
hasValue() const74cdf0e10cSrcweir     inline bool   hasValue() const { return m_bAskValue; }
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     // container.XContainerListener
77cdf0e10cSrcweir     virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
78cdf0e10cSrcweir     virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
79cdf0e10cSrcweir     virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     // lang.XEventListener
82cdf0e10cSrcweir     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
83cdf0e10cSrcweir 
84cdf0e10cSrcweir private:
85cdf0e10cSrcweir     struct ControllerInfo
86cdf0e10cSrcweir     {
87cdf0e10cSrcweir         rtl::OUString m_aImplementationName;
88cdf0e10cSrcweir         rtl::OUString m_aValue;
ControllerInfoframework::ConfigurationAccess_ControllerFactory::ControllerInfo89cdf0e10cSrcweir         ControllerInfo(const ::rtl::OUString& _aImplementationName,const ::rtl::OUString& _aValue) : m_aImplementationName(_aImplementationName),m_aValue(_aValue){}
ControllerInfoframework::ConfigurationAccess_ControllerFactory::ControllerInfo90cdf0e10cSrcweir         ControllerInfo(){}
91cdf0e10cSrcweir     };
92cdf0e10cSrcweir     class MenuControllerMap : public std::hash_map< rtl::OUString,
93cdf0e10cSrcweir                                                          ControllerInfo,
94*5758ad8cSAriel Constenla-Haile                                                          rtl::OUStringHash,
95cdf0e10cSrcweir                                                          ::std::equal_to< ::rtl::OUString > >
96cdf0e10cSrcweir     {
free()97cdf0e10cSrcweir         inline void free()
98cdf0e10cSrcweir         {
99cdf0e10cSrcweir             MenuControllerMap().swap( *this );
100cdf0e10cSrcweir         }
101cdf0e10cSrcweir     };
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     sal_Bool impl_getElementProps( const ::com::sun::star::uno::Any& aElement, rtl::OUString& aCommand, rtl::OUString& aModule, rtl::OUString& aServiceSpecifier,rtl::OUString& aValue ) const;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     rtl::OUString                     m_aPropCommand;
106cdf0e10cSrcweir     rtl::OUString                     m_aPropModule;
107cdf0e10cSrcweir     rtl::OUString                     m_aPropController;
108cdf0e10cSrcweir     rtl::OUString                     m_aPropValue;
109cdf0e10cSrcweir     rtl::OUString                     m_sRoot;
110cdf0e10cSrcweir     MenuControllerMap                 m_aMenuControllerMap;
111cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >    m_xServiceManager;
112cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >    m_xConfigProvider;
113cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >        m_xConfigAccess;
114cdf0e10cSrcweir     sal_Bool                          m_bConfigAccessInitialized;
115cdf0e10cSrcweir     bool                              m_bAskValue;
116cdf0e10cSrcweir };
117cdf0e10cSrcweir 
118cdf0e10cSrcweir } // namespace framework
119cdf0e10cSrcweir #endif // __FRAMEWORK_UIFACTORY_FACTORYCONFIGURATION_HXX_
120