1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef __FRAMEWORK_DISPATCH_STARTMODULEDISPATCHER_HXX_
21 #define __FRAMEWORK_DISPATCH_STARTMODULEDISPATCHER_HXX_
23 #include <threadhelp/threadhelpbase.hxx>
24 #include <macros/xinterface.hxx>
25 #include <macros/xtypeprovider.hxx>
26 #include <macros/debug.hxx>
27 #include <macros/generic.hxx>
31 #include <com/sun/star/lang/XTypeProvider.hpp>
32 #include <com/sun/star/frame/XFrame.hpp>
33 #include <com/sun/star/frame/XStatusListener.hpp>
34 #include <com/sun/star/frame/XNotifyingDispatch.hpp>
35 #include <com/sun/star/frame/XDispatchInformationProvider.hpp>
36 #include <com/sun/star/util/URL.hpp>
37 #include <com/sun/star/frame/XDispatchResultListener.hpp>
38 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
39 #include <com/sun/star/uno/XComponentContext.hpp>
40 #include <com/sun/star/frame/DispatchResultState.hpp>
42 #include <cppuhelper/weak.hxx>
43 #include <vcl/evntpost.hxx>
48 //-----------------------------------------------
50 @short helper to handle all URLs related to the StartModule
52 class StartModuleDispatcher
: public css::lang::XTypeProvider
53 , public css::frame::XNotifyingDispatch
// => XDispatch
54 , public css::frame::XDispatchInformationProvider
55 // baseclasses ... order is necessary for right initialization!
56 , private ThreadHelpBase
57 , public ::cppu::OWeakObject
59 //-------------------------------------------
64 //---------------------------------------
65 /** @short reference to an uno service manager,
66 which can be used to create own needed
68 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
70 //---------------------------------------
71 /** @short our "context" frame. */
72 css::uno::WeakReference
< css::frame::XFrame
> m_xOwner
;
74 //---------------------------------------
75 /** @short the original queryDispatch() target. */
76 OUString m_sDispatchTarget
;
78 //---------------------------------------
79 /** @short list of registered status listener */
80 ListenerHash m_lStatusListener
;
82 //-------------------------------------------
87 //---------------------------------------
88 /** @short connect a new StartModuleDispatcher instance to its "owner frame".
90 @descr Such "owner frame" is used as context for all related operations.
93 an UNO service manager, which is needed to create UNO resource
97 the frame where the corresponding dispatch was started.
100 the original target information used for the related queryDispatch() call.
102 StartModuleDispatcher(const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
103 const css::uno::Reference
< css::frame::XFrame
>& xFrame
,
104 const OUString
& sTarget
);
106 //---------------------------------------
107 /** @short does nothing real. */
108 virtual ~StartModuleDispatcher();
110 //-------------------------------------------
115 //---------------------------------------
116 FWK_DECLARE_XINTERFACE
117 FWK_DECLARE_XTYPEPROVIDER
119 //---------------------------------------
120 // XNotifyingDispatch
121 virtual void SAL_CALL
dispatchWithNotification( const css::util::URL
& aURL
,
122 const css::uno::Sequence
< css::beans::PropertyValue
>& lArguments
,
123 const css::uno::Reference
< css::frame::XDispatchResultListener
>& xListener
) throw(css::uno::RuntimeException
);
125 //---------------------------------------
127 virtual void SAL_CALL
dispatch ( const css::util::URL
& aURL
,
128 const css::uno::Sequence
< css::beans::PropertyValue
>& lArguments
) throw(css::uno::RuntimeException
);
129 virtual void SAL_CALL
addStatusListener ( const css::uno::Reference
< css::frame::XStatusListener
>& xListener
,
130 const css::util::URL
& aURL
) throw(css::uno::RuntimeException
);
131 virtual void SAL_CALL
removeStatusListener( const css::uno::Reference
< css::frame::XStatusListener
>& xListener
,
132 const css::util::URL
& aURL
) throw(css::uno::RuntimeException
);
134 //---------------------------------------
135 // XDispatchInformationProvider
136 virtual css::uno::Sequence
< sal_Int16
> SAL_CALL
getSupportedCommandGroups ( ) throw (css::uno::RuntimeException
);
137 virtual css::uno::Sequence
< css::frame::DispatchInformation
> SAL_CALL
getConfigurableDispatchInformation( sal_Int16 nCommandGroup
) throw (css::uno::RuntimeException
);
139 //-------------------------------------------
144 //---------------------------------------
145 /** @short check if StartModule can be shown.
147 ::sal_Bool
implts_isBackingModePossible();
149 //---------------------------------------
150 /** @short open the special BackingComponent (now StartModule)
153 sal_True if operation was successfully.
155 ::sal_Bool
implts_establishBackingMode();
157 //---------------------------------------
158 /** @short notify a DispatchResultListener.
160 @descr We check the listener reference before we use it.
161 So this method can be called everytimes!
164 the listener, which should be notified.
168 directly used as css::frame::DispatchResultState value.
171 not used yet realy ...
173 void implts_notifyResultListener(const css::uno::Reference
< css::frame::XDispatchResultListener
>& xListener
,
175 const css::uno::Any
& aResult
);
177 }; // class StartModuleDispatcher
179 } // namespace framework
181 #endif // #ifndef __FRAMEWORK_DISPATCH_STARTMODULEDISPATCHER_HXX_
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */