bump product version to 4.1.6.2
[LibreOffice.git] / framework / inc / jobs / jobdispatch.hxx
blob47f2c62b17b8b052cd4d58006cf1a1dd2e9aa945
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_JOBS_JOBDISPATCH_HXX_
21 #define __FRAMEWORK_JOBS_JOBDISPATCH_HXX_
23 #include <jobs/configaccess.hxx>
24 #include <threadhelp/threadhelpbase.hxx>
25 #include <macros/xinterface.hxx>
26 #include <macros/xtypeprovider.hxx>
27 #include <macros/xserviceinfo.hxx>
28 #include <macros/debug.hxx>
29 #include <stdtypes.h>
30 #include <general.h>
32 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 #include <com/sun/star/frame/XNotifyingDispatch.hpp>
34 #include <com/sun/star/frame/XDispatch.hpp>
35 #include <com/sun/star/frame/XStatusListener.hpp>
36 #include <com/sun/star/frame/XDispatchResultListener.hpp>
37 #include <com/sun/star/task/XJobListener.hpp>
38 #include <com/sun/star/frame/XTerminateListener.hpp>
39 #include <com/sun/star/frame/XDispatchProvider.hpp>
40 #include <com/sun/star/frame/XDesktop.hpp>
41 #include <com/sun/star/uno/XInterface.hpp>
42 #include <com/sun/star/beans/NamedValue.hpp>
43 #include <com/sun/star/frame/FeatureStateEvent.hpp>
44 #include <com/sun/star/frame/DispatchResultEvent.hpp>
45 #include <com/sun/star/lang/XInitialization.hpp>
47 #include <unotools/configpaths.hxx>
48 #include <cppuhelper/weak.hxx>
49 #include <rtl/ustring.hxx>
52 namespace framework{
55 //_______________________________________
56 /**
57 @short implements a dispatch object for jobs
58 @descr Such dispatch object will be used by the generic dispatch mechanism if
59 an URL "vnd.sun.star.job:alias=<name>" occures.
60 Then an instance of this class will be created and used.
61 This new instance will be called within his method
62 dispatch() or dispatchWithNotification() for executing the
63 real job. We do it, control the life cycle of this internal
64 wrapped job and inform any interested listener if it finish.
66 class JobDispatch : public css::lang::XTypeProvider
67 , public css::lang::XServiceInfo
68 , public css::lang::XInitialization
69 , public css::frame::XDispatchProvider
70 , public css::frame::XNotifyingDispatch // => XDispatch
71 , private ThreadHelpBase
72 , public ::cppu::OWeakObject
74 //___________________________________
75 // member
77 private:
79 /** reference to the uno service manager */
80 css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
82 /** reference to the frame, inside which this dispatch is used */
83 css::uno::Reference< css::frame::XFrame > m_xFrame;
85 /** name of module (writer, impress etc.) the frame is for */
86 OUString m_sModuleIdentifier;
88 //___________________________________
89 // native interface methods
91 public:
93 JobDispatch( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR );
94 virtual ~JobDispatch( );
96 void impl_dispatchEvent ( const OUString& sEvent ,
97 const css::uno::Sequence< css::beans::PropertyValue >& lArgs ,
98 const css::uno::Reference< css::frame::XDispatchResultListener >& xListener );
99 void impl_dispatchService( const OUString& sService ,
100 const css::uno::Sequence< css::beans::PropertyValue >& lArgs ,
101 const css::uno::Reference< css::frame::XDispatchResultListener >& xListener );
102 void impl_dispatchAlias ( const OUString& sAlias ,
103 const css::uno::Sequence< css::beans::PropertyValue >& lArgs ,
104 const css::uno::Reference< css::frame::XDispatchResultListener >& xListener );
106 //___________________________________
107 // uno interface methods
109 public:
111 // XInterface, XTypeProvider, XServiceInfo
112 FWK_DECLARE_XINTERFACE
113 FWK_DECLARE_XTYPEPROVIDER
114 DECLARE_XSERVICEINFO
116 // Xinitialization
117 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& lArguments ) throw(css::uno::Exception ,
118 css::uno::RuntimeException);
120 // XDispatchProvider
121 virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL ,
122 const OUString& sTargetFrameName ,
123 sal_Int32 nSearchFlags ) throw(css::uno::RuntimeException);
124 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);
126 // XNotifyingDispatch
127 virtual void SAL_CALL dispatchWithNotification( const css::util::URL& aURL ,
128 const css::uno::Sequence< css::beans::PropertyValue >& lArgs ,
129 const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw(css::uno::RuntimeException);
131 // XDispatch
132 virtual void SAL_CALL dispatch ( const css::util::URL& aURL ,
133 const css::uno::Sequence< css::beans::PropertyValue >& lArgs ) throw(css::uno::RuntimeException);
134 virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xListener ,
135 const css::util::URL& aURL ) throw(css::uno::RuntimeException);
136 virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener ,
137 const css::util::URL& aURL ) throw(css::uno::RuntimeException);
140 } // namespace framework
142 #endif // __FRAMEWORK_JOBS_JOBDISPATCH_HXX_
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */