update dev300-m57
[ooovba.git] / framework / inc / jobs / jobdispatch.hxx
blob8c426efa08b5d3b3f9bf54ff2e4539bfc112fc9b
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: jobdispatch.hxx,v $
10 * $Revision: 1.5 $
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_JOBS_JOBDISPATCH_HXX_
32 #define __FRAMEWORK_JOBS_JOBDISPATCH_HXX_
34 //_______________________________________
35 // my own includes
37 #include <jobs/configaccess.hxx>
38 #include <threadhelp/threadhelpbase.hxx>
39 #include <macros/xinterface.hxx>
40 #include <macros/xtypeprovider.hxx>
41 #include <macros/xserviceinfo.hxx>
42 #include <macros/debug.hxx>
43 #include <stdtypes.h>
44 #include <general.h>
46 //_______________________________________
47 // interface includes
48 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
49 #include <com/sun/star/frame/XNotifyingDispatch.hpp>
50 #include <com/sun/star/frame/XDispatch.hpp>
51 #include <com/sun/star/frame/XStatusListener.hpp>
52 #include <com/sun/star/frame/XDispatchResultListener.hpp>
53 #include <com/sun/star/task/XJobListener.hpp>
54 #include <com/sun/star/frame/XTerminateListener.hpp>
55 #include <com/sun/star/frame/XDispatchProvider.hpp>
56 #include <com/sun/star/frame/XDesktop.hpp>
57 #include <com/sun/star/uno/XInterface.hpp>
58 #include <com/sun/star/beans/NamedValue.hpp>
59 #include <com/sun/star/frame/FeatureStateEvent.hpp>
60 #include <com/sun/star/frame/DispatchResultEvent.hpp>
61 #include <com/sun/star/lang/XInitialization.hpp>
63 //_______________________________________
64 // other includes
65 #include <unotools/configpathes.hxx>
66 #include <cppuhelper/weak.hxx>
67 #include <rtl/ustring.hxx>
69 //_______________________________________
70 // namespace
72 namespace framework{
74 //_______________________________________
75 // public const
77 //_______________________________________
78 /**
79 @short implements a dispatch object for jobs
80 @descr Such dispatch object will be used by the generic dispatch mechanism if
81 an URL "vnd.sun.star.job:alias=<name>" occures.
82 Then an instance of this class will be created and used.
83 This new instance will be called within his method
84 dispatch() or dispatchWithNotification() for executing the
85 real job. We do it, control the life cycle of this internal
86 wrapped job and inform any interested listener if it finish.
88 class JobDispatch : public css::lang::XTypeProvider
89 , public css::lang::XServiceInfo
90 , public css::lang::XInitialization
91 , public css::frame::XDispatchProvider
92 , public css::frame::XNotifyingDispatch // => XDispatch
93 , private ThreadHelpBase
94 , public ::cppu::OWeakObject
96 //___________________________________
97 // member
99 private:
101 /** reference to the uno service manager */
102 css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
104 /** reference to the frame, inside which this dispatch is used */
105 css::uno::Reference< css::frame::XFrame > m_xFrame;
107 //___________________________________
108 // native interface methods
110 public:
112 JobDispatch( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR );
113 virtual ~JobDispatch( );
115 void impl_dispatchEvent ( const ::rtl::OUString& sEvent ,
116 const css::uno::Sequence< css::beans::PropertyValue >& lArgs ,
117 const css::uno::Reference< css::frame::XDispatchResultListener >& xListener );
118 void impl_dispatchService( const ::rtl::OUString& sService ,
119 const css::uno::Sequence< css::beans::PropertyValue >& lArgs ,
120 const css::uno::Reference< css::frame::XDispatchResultListener >& xListener );
121 void impl_dispatchAlias ( const ::rtl::OUString& sAlias ,
122 const css::uno::Sequence< css::beans::PropertyValue >& lArgs ,
123 const css::uno::Reference< css::frame::XDispatchResultListener >& xListener );
125 //___________________________________
126 // uno interface methods
128 public:
130 // XInterface, XTypeProvider, XServiceInfo
131 FWK_DECLARE_XINTERFACE
132 FWK_DECLARE_XTYPEPROVIDER
133 DECLARE_XSERVICEINFO
135 // Xinitialization
136 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& lArguments ) throw(css::uno::Exception ,
137 css::uno::RuntimeException);
139 // XDispatchProvider
140 virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL ,
141 const ::rtl::OUString& sTargetFrameName ,
142 sal_Int32 nSearchFlags ) throw(css::uno::RuntimeException);
143 virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor ) throw(css::uno::RuntimeException);
145 // XNotifyingDispatch
146 virtual void SAL_CALL dispatchWithNotification( const css::util::URL& aURL ,
147 const css::uno::Sequence< css::beans::PropertyValue >& lArgs ,
148 const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw(css::uno::RuntimeException);
150 // XDispatch
151 virtual void SAL_CALL dispatch ( const css::util::URL& aURL ,
152 const css::uno::Sequence< css::beans::PropertyValue >& lArgs ) throw(css::uno::RuntimeException);
153 virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xListener ,
154 const css::util::URL& aURL ) throw(css::uno::RuntimeException);
155 virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener ,
156 const css::util::URL& aURL ) throw(css::uno::RuntimeException);
159 } // namespace framework
161 #endif // __FRAMEWORK_JOBS_JOBDISPATCH_HXX_