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 
23 
24 #ifndef __FRAMEWORK_DISPATCH_DISPATCHINFORMATIONPROVIDER_HXX_
25 #define __FRAMEWORK_DISPATCH_DISPATCHINFORMATIONPROVIDER_HXX_
26 
27 //_________________________________________________________________________________________________________________
28 //	my own includes
29 //_________________________________________________________________________________________________________________
30 
31 #include <threadhelp/threadhelpbase.hxx>
32 #include <macros/generic.hxx>
33 #include <macros/debug.hxx>
34 #include <macros/xinterface.hxx>
35 #include <general.h>
36 
37 //_________________________________________________________________________________________________________________
38 //	interface includes
39 //_________________________________________________________________________________________________________________
40 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
41 #include <com/sun/star/frame/XFrame.hpp>
42 #include <com/sun/star/frame/XDispatchInformationProvider.hpp>
43 
44 //_________________________________________________________________________________________________________________
45 //	other includes
46 //_________________________________________________________________________________________________________________
47 #include <cppuhelper/weakref.hxx>
48 #include <rtl/ustring.hxx>
49 #include <cppuhelper/weak.hxx>
50 #include <vcl/svapp.hxx>
51 
52 //_________________________________________________________________________________________________________________
53 //	namespace
54 //_________________________________________________________________________________________________________________
55 
56 namespace framework{
57 
58 //_________________________________________________________________________________________________________________
59 //	exported const
60 //_________________________________________________________________________________________________________________
61 
62 //_________________________________________________________________________________________________________________
63 //	exported definitions
64 //_________________________________________________________________________________________________________________
65 
66 /*-************************************************************************************************************//**
67     @short          a helper to merge dispatch informations of different sources together.
68 *//*-*************************************************************************************************************/
69 class DispatchInformationProvider : public  css::frame::XDispatchInformationProvider
70                                   , private ThreadHelpBase
71                                   , public  ::cppu::OWeakObject
72 {
73     //_______________________
74     // member
75     private:
76 
77         css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
78         css::uno::WeakReference< css::frame::XFrame > m_xFrame;
79 
80     //_______________________
81     // interface
82 	public:
83 
84         DispatchInformationProvider(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
85                                     const css::uno::Reference< css::frame::XFrame >&              xFrame);
86 
87         virtual ~DispatchInformationProvider();
88 
89         FWK_DECLARE_XINTERFACE
90 
91         virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups()
92             throw (css::uno::RuntimeException);
93 
94         virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation(sal_Int16 nCommandGroup)
95             throw (css::uno::RuntimeException);
96 
97     //_______________________
98     // helper
99 	private:
100 
101         css::uno::Sequence< css::uno::Reference< css::frame::XDispatchInformationProvider > > implts_getAllSubProvider();
102 
103 }; // class DispatchInformationProvider
104 
105 } // namespace framework
106 
107 #endif // #ifndef __FRAMEWORK_DISPATCH_DISPATCHINFORMATIONPROVIDER_HXX_
108