24#include <com/sun/star/frame/XFrame.hpp>
25#include <com/sun/star/frame/XDesktop2.hpp>
26#include <com/sun/star/frame/XDispatchResultListener.hpp>
27#include <com/sun/star/task/XJobListener.hpp>
28#include <com/sun/star/util/XCloseListener.hpp>
31#include <osl/conditn.hxx>
42class Job final :
public ::cppu::WeakImplHelper<
43 css::task::XJobListener
44 , css::frame::XTerminateListener
45 , css::util::XCloseListener >
77 css::uno::Reference< css::uno::XComponentContext >
m_xContext;
82 css::uno::Reference< css::uno::XInterface >
m_xJob;
97 css::uno::Reference< css::frame::XFrame >
m_xFrame;
107 css::uno::Reference< css::frame::XModel >
m_xModel;
160 Job(
const css::uno::Reference< css::uno::XComponentContext >& xContext ,
161 css::uno::Reference< css::frame::XFrame > xFrame );
162 Job(
const css::uno::Reference< css::uno::XComponentContext >& xContext ,
163 css::uno::Reference< css::frame::XModel > xModel );
167 const css::uno::Reference< css::uno::XInterface >& xSourceFake );
169 void execute (
const css::uno::Sequence< css::beans::NamedValue >& lDynamicArgs );
174 css::uno::Sequence< css::beans::NamedValue >
impl_generateJobArgs (
const css::uno::Sequence< css::beans::NamedValue >& lDynamicArgs );
184 virtual void SAL_CALL
jobFinished(
const css::uno::Reference< css::task::XAsyncJob >& xJob,
185 const css::uno::Any& aResult )
override;
192 virtual void SAL_CALL
queryClosing (
const css::lang::EventObject& aEvent ,
194 virtual void SAL_CALL
notifyClosing(
const css::lang::EventObject& aEvent )
override;
197 virtual void SAL_CALL
disposing(
const css::lang::EventObject& aEvent )
override;
holds all necessary information about a job and handle it's configuration (if any exist!...
it represent a job; execute it and control its lifetime
virtual void SAL_CALL queryClosing(const css::lang::EventObject &aEvent, sal_Bool bGetsOwnership) override
virtual void SAL_CALL jobFinished(const css::uno::Reference< css::task::XAsyncJob > &xJob, const css::uno::Any &aResult) override
virtual void SAL_CALL queryTermination(const css::lang::EventObject &aEvent) override
void execute(const css::uno::Sequence< css::beans::NamedValue > &lDynamicArgs)
void impl_stopListening()
ERunState m_eRunState
indicates in which state the internal job currently exist.
virtual void SAL_CALL notifyTermination(const css::lang::EventObject &aEvent) override
void setDispatchResultFake(const css::uno::Reference< css::frame::XDispatchResultListener > &xListener, const css::uno::Reference< css::uno::XInterface > &xSourceFake)
virtual void SAL_CALL disposing(const css::lang::EventObject &aEvent) override
css::uno::Reference< css::frame::XDispatchResultListener > m_xResultListener
A job can return a dispatch result event after finishing its work.
bool m_bPendingCloseFrame
In case we got a close request from our desktop/frame/model (on which we listen) ....
bool m_bPendingCloseModel
JobData m_aJobCfg
hold all necessary information about this job.
void impl_reactForJobResult(const css::uno::Any &aResult)
void impl_startListening()
css::uno::Reference< css::frame::XFrame > m_xFrame
For some special cases we must know the environment, in which this job runs.
Job(const css::uno::Reference< css::uno::XComponentContext > &xContext, css::uno::Reference< css::frame::XFrame > xFrame)
ERunState
different possible states for the internal wrapped job.
void setJobData(const JobData &aData)
Job(const css::uno::Reference< css::uno::XComponentContext > &xContext, css::uno::Reference< css::frame::XModel > xModel)
virtual void SAL_CALL notifyClosing(const css::lang::EventObject &aEvent) override
css::uno::Reference< css::frame::XModel > m_xModel
For some special cases we must know the environment, in which this job runs.
css::uno::Reference< css::frame::XDesktop2 > m_xDesktop
We are registered at this instance to listen for office shutdown events.
css::uno::Reference< css::uno::XInterface > m_xJob
Hold the (may asynchronous) job alive.
bool m_bListenOnDesktop
Holds the state, if we are listen for desktop/frame or model closing events or not.
css::uno::Sequence< css::beans::NamedValue > impl_generateJobArgs(const css::uno::Sequence< css::beans::NamedValue > &lDynamicArgs)
::osl::Condition m_aAsyncWait
Used to wait for finishing of asynchronous started jobs.
css::uno::Reference< css::uno::XComponentContext > m_xContext
We need it to create own services on demand.
css::uno::Reference< css::uno::XInterface > m_xResultSourceFake
We can't set ourself as source of a dispatch result event ... nor our job.