update dev300-m58
[ooovba.git] / framework / inc / jobs / jobexecutor.hxx
blob98d5e292302dd7b7b405ad0c92a43a315cb4d44e
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: jobexecutor.hxx,v $
10 * $Revision: 1.6 $
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_JOBEXECUTOR_HXX_
32 #define __FRAMEWORK_JOBS_JOBEXECUTOR_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/task/XJobExecutor.hpp>
50 #include <com/sun/star/lang/XComponent.hpp>
51 #include <com/sun/star/container/XContainerListener.hpp>
52 #include <com/sun/star/lang/XEventListener.hpp>
53 #include <com/sun/star/document/XEventListener.hpp>
55 //_______________________________________
56 // other includes
57 #include <cppuhelper/weak.hxx>
58 #include <rtl/ustring.hxx>
60 //_______________________________________
61 // namespace
63 namespace framework{
65 //_______________________________________
66 // public const
68 //_______________________________________
69 /**
70 @short implements a job executor, which can be triggered from any code
71 @descr It uses the given trigger event to locate any registered job service
72 inside the configuration and execute it. Of course it controls the
73 liftime of such jobs too.
75 class JobExecutor : public css::lang::XTypeProvider
76 , public css::lang::XServiceInfo
77 , public css::task::XJobExecutor
78 , public css::container::XContainerListener // => lang.XEventListener
79 , public css::document::XEventListener
80 , private ThreadHelpBase
81 , public ::cppu::OWeakObject
83 //___________________________________
84 // member
86 private:
88 /** reference to the uno service manager */
89 css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
91 /** cached list of all registered event names of cfg for call optimization. */
92 OUStringList m_lEvents;
94 /** we listen at the configuration for changes at the event list. */
95 ConfigAccess m_aConfig;
97 //___________________________________
98 // native interface methods
100 public:
102 JobExecutor( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR );
103 virtual ~JobExecutor( );
105 //___________________________________
106 // uno interface methods
108 public:
110 // XInterface, XTypeProvider, XServiceInfo
111 FWK_DECLARE_XINTERFACE
112 FWK_DECLARE_XTYPEPROVIDER
113 DECLARE_XSERVICEINFO
115 // task.XJobExecutor
116 virtual void SAL_CALL trigger( const ::rtl::OUString& sEvent ) throw(css::uno::RuntimeException);
118 // document.XEventListener
119 virtual void SAL_CALL notifyEvent( const css::document::EventObject& aEvent ) throw(css::uno::RuntimeException);
121 // container.XContainerListener
122 virtual void SAL_CALL elementInserted( const css::container::ContainerEvent& aEvent ) throw(css::uno::RuntimeException);
123 virtual void SAL_CALL elementRemoved ( const css::container::ContainerEvent& aEvent ) throw(css::uno::RuntimeException);
124 virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& aEvent ) throw(css::uno::RuntimeException);
126 // lang.XEventListener
127 virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw(css::uno::RuntimeException);
130 } // namespace framework
132 #endif // __FRAMEWORK_JOBS_JOBEXECUTOR_HXX_