1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #ifndef __FRAMEWORK_UICONTROLLERFACTORY_HXX_
23 #define __FRAMEWORK_UICONTROLLERFACTORY_HXX_
24 
25 #include <threadhelp/threadhelpbase.hxx>
26 #include <macros/generic.hxx>
27 #include <macros/xinterface.hxx>
28 #include <macros/xtypeprovider.hxx>
29 #include <macros/xserviceinfo.hxx>
30 #include <stdtypes.h>
31 
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include <com/sun/star/lang/XTypeProvider.hpp>
34 #include <com/sun/star/frame/XUIControllerFactory.hpp>
35 
36 #include <cppuhelper/implbase2.hxx>
37 
38 namespace framework
39 {
40 
41 class ConfigurationAccess_ControllerFactory;
42 class UIControllerFactory :  protected ThreadHelpBase, // Struct for right initialization of mutex member! Must be first of baseclasses.
43                              public ::cppu::WeakImplHelper2<
44                                  com::sun::star::lang::XServiceInfo,
45                                  com::sun::star::frame::XUIControllerFactory >
46 {
47     public:
48         virtual ~UIControllerFactory();
49 
50         // XServiceInfo
51         virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException) = 0;
52         virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException) = 0;
53         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException) = 0;
54 
55         // XMultiComponentFactory
56         virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithContext( const ::rtl::OUString& aServiceSpecifier, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
57         virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
58         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames() throw (::com::sun::star::uno::RuntimeException);
59 
60         // XUIControllerRegistration
61         virtual sal_Bool SAL_CALL hasController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModuleName ) throw (::com::sun::star::uno::RuntimeException);
62         virtual void SAL_CALL registerController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModuleName, const ::rtl::OUString& aControllerImplementationName ) throw (::com::sun::star::uno::RuntimeException);
63         virtual void SAL_CALL deregisterController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModuleName ) throw (::com::sun::star::uno::RuntimeException);
64 
65     protected:
66         UIControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager, const rtl::OUString &rUINode  );
67         sal_Bool                                                                         m_bConfigRead;
68         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
69         ConfigurationAccess_ControllerFactory*                                           m_pConfigAccess;
70 };
71 
72 class PopupMenuControllerFactory :  public UIControllerFactory
73 {
74     public:
75         PopupMenuControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
76 
77         //  XInterface, XTypeProvider, XServiceInfo
78         DECLARE_XSERVICEINFO
79 };
80 
81 class ToolbarControllerFactory :  public UIControllerFactory
82 {
83     public:
84         ToolbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
85 
86         //  XInterface, XTypeProvider, XServiceInfo
87         DECLARE_XSERVICEINFO
88 };
89 
90 class StatusbarControllerFactory :  public UIControllerFactory
91 {
92     public:
93         StatusbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
94 
95         //  XInterface, XTypeProvider, XServiceInfo
96         DECLARE_XSERVICEINFO
97 };
98 
99 }
100 
101 #endif // __FRAMEWORK_UICONTROLLERFACTORY_HXX_
102