merge the formfield patch from ooo-build
[ooovba.git] / framework / inc / dispatch / startmoduledispatcher.hxx
blob4d084f9f2b2b63a555e493609bab2fe288eec9f8
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: closedispatcher.hxx,v $
10 * $Revision: 1.14 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __FRAMEWORK_DISPATCH_STARTMODULEDISPATCHER_HXX_
32 #define __FRAMEWORK_DISPATCH_STARTMODULEDISPATCHER_HXX_
34 //_______________________________________________
35 // my own includes
37 #include <threadhelp/threadhelpbase.hxx>
38 #include <macros/xinterface.hxx>
39 #include <macros/xtypeprovider.hxx>
40 #include <macros/debug.hxx>
41 #include <macros/generic.hxx>
42 #include <stdtypes.h>
43 #include <general.h>
45 //_______________________________________________
46 // interface includes
47 #include <com/sun/star/lang/XTypeProvider.hpp>
48 #include <com/sun/star/frame/XFrame.hpp>
49 #include <com/sun/star/frame/XStatusListener.hpp>
50 #include <com/sun/star/frame/XNotifyingDispatch.hpp>
51 #include <com/sun/star/frame/XDispatchInformationProvider.hpp>
52 #include <com/sun/star/util/URL.hpp>
53 #include <com/sun/star/frame/XDispatchResultListener.hpp>
54 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
55 #include <com/sun/star/frame/DispatchResultState.hpp>
57 //_______________________________________________
58 // other includes
59 #include <cppuhelper/weak.hxx>
60 #include <vcl/evntpost.hxx>
62 //_______________________________________________
63 // namespace
65 namespace framework{
67 //-----------------------------------------------
68 /**
69 @short helper to handle all URLs related to the StartModule
71 class StartModuleDispatcher : public css::lang::XTypeProvider
72 , public css::frame::XNotifyingDispatch // => XDispatch
73 , public css::frame::XDispatchInformationProvider
74 // baseclasses ... order is neccessary for right initialization!
75 , private ThreadHelpBase
76 , public ::cppu::OWeakObject
78 //-------------------------------------------
79 // member
81 private:
83 //---------------------------------------
84 /** @short reference to an uno service manager,
85 which can be used to create own needed
86 uno resources. */
87 css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
89 //---------------------------------------
90 /** @short our "context" frame. */
91 css::uno::WeakReference< css::frame::XFrame > m_xOwner;
93 //---------------------------------------
94 /** @short the original queryDispatch() target. */
95 ::rtl::OUString m_sDispatchTarget;
97 //---------------------------------------
98 /** @short list of registered status listener */
99 ListenerHash m_lStatusListener;
101 //-------------------------------------------
102 // native interface
104 public:
106 //---------------------------------------
107 /** @short connect a new StartModuleDispatcher instance to its "owner frame".
109 @descr Such "owner frame" is used as context for all related operations.
111 @param xSMGR
112 an uno service manager, which is needed to create uno resource
113 internaly.
115 @param xFrame
116 the frame where the corresponding dispatch was started.
118 @param sTarget
119 the original target information used for the related queryDispatch() call.
121 StartModuleDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
122 const css::uno::Reference< css::frame::XFrame >& xFrame ,
123 const ::rtl::OUString& sTarget);
125 //---------------------------------------
126 /** @short does nothing real. */
127 virtual ~StartModuleDispatcher();
129 //-------------------------------------------
130 // uno interface
132 public:
134 //---------------------------------------
135 FWK_DECLARE_XINTERFACE
136 FWK_DECLARE_XTYPEPROVIDER
138 //---------------------------------------
139 // XNotifyingDispatch
140 virtual void SAL_CALL dispatchWithNotification( const css::util::URL& aURL ,
141 const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
142 const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw(css::uno::RuntimeException);
144 //---------------------------------------
145 // XDispatch
146 virtual void SAL_CALL dispatch ( const css::util::URL& aURL ,
147 const css::uno::Sequence< css::beans::PropertyValue >& lArguments) throw(css::uno::RuntimeException);
148 virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xListener ,
149 const css::util::URL& aURL ) throw(css::uno::RuntimeException);
150 virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener ,
151 const css::util::URL& aURL ) throw(css::uno::RuntimeException);
153 //---------------------------------------
154 // XDispatchInformationProvider
155 virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups ( ) throw (css::uno::RuntimeException);
156 virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( sal_Int16 nCommandGroup ) throw (css::uno::RuntimeException);
158 //-------------------------------------------
159 // internal helper
161 private:
163 //---------------------------------------
164 /** @short check if StartModule can be shown.
166 ::sal_Bool implts_isBackingModePossible();
168 //---------------------------------------
169 /** @short open the special BackingComponent (now StartModule)
171 @return [bool]
172 TRUE if operation was successfully.
174 ::sal_Bool implts_establishBackingMode();
176 //---------------------------------------
177 /** @short notify a DispatchResultListener.
179 @descr We check the listener reference before we use it.
180 So this method can be called everytimes!
182 @parama xListener
183 the listener, which should be notified.
184 Can be null!
186 @param nState
187 directly used as css::frame::DispatchResultState value.
189 @param aResult
190 not used yet realy ...
192 void implts_notifyResultListener(const css::uno::Reference< css::frame::XDispatchResultListener >& xListener,
193 sal_Int16 nState ,
194 const css::uno::Any& aResult );
196 }; // class StartModuleDispatcher
198 } // namespace framework
200 #endif // #ifndef __FRAMEWORK_DISPATCH_STARTMODULEDISPATCHER_HXX_