summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-01-09 20:41:58 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2014-01-10 16:29:24 +0100
commit8a52d5b1b3560af571ee6d669861f93d2c1005d1 (patch)
tree63673b8b1e5849f45854088a0e8029cc843ebc3c
parentd3e9334333080e75de95977c0594b35a1d3da5b4 (diff)
fwk: Use constructor feature for JobExecutor.
Change-Id: I5087320137dc17f27a382d564a59cec68f1a4f95
-rw-r--r--framework/inc/jobs/jobexecutor.hxx115
-rw-r--r--framework/source/jobs/jobexecutor.cxx88
-rw-r--r--framework/source/register/registerservices.cxx2
-rw-r--r--framework/util/fwk.component3
4 files changed, 85 insertions, 123 deletions
diff --git a/framework/inc/jobs/jobexecutor.hxx b/framework/inc/jobs/jobexecutor.hxx
deleted file mode 100644
index d4ed3c3b750a..000000000000
--- a/framework/inc/jobs/jobexecutor.hxx
+++ /dev/null
@@ -1,115 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_FRAMEWORK_INC_JOBS_JOBEXECUTOR_HXX
-#define INCLUDED_FRAMEWORK_INC_JOBS_JOBEXECUTOR_HXX
-
-#include <jobs/configaccess.hxx>
-#include <threadhelp/threadhelpbase.hxx>
-#include <macros/xinterface.hxx>
-#include <macros/xtypeprovider.hxx>
-#include <macros/xserviceinfo.hxx>
-#include <stdtypes.h>
-#include <general.h>
-
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/task/XJobExecutor.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/container/XContainerListener.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/document/XEventListener.hpp>
-#include <com/sun/star/frame/XModuleManager2.hpp>
-
-#include <cppuhelper/implbase4.hxx>
-#include <rtl/ustring.hxx>
-
-
-namespace framework{
-
-
-//_______________________________________
-/**
- @short implements a job executor, which can be triggered from any code
- @descr It uses the given trigger event to locate any registered job service
- inside the configuration and execute it. Of course it controls the
- liftime of such jobs too.
- */
-class JobExecutor : private ThreadHelpBase
- , public ::cppu::WeakImplHelper4<
- css::lang::XServiceInfo
- , css::task::XJobExecutor
- , css::container::XContainerListener // => lang.XEventListener
- , css::document::XEventListener >
-{
- //___________________________________
- // member
-
- private:
-
- /** reference to the uno service manager */
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
-
- /** reference to the module info service */
- css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager;
-
- /** cached list of all registered event names of cfg for call optimization. */
- OUStringList m_lEvents;
-
- /** we listen at the configuration for changes at the event list. */
- ConfigAccess m_aConfig;
-
- /** helper to allow us listen to the configuration without a cyclic dependency */
- com::sun::star::uno::Reference<com::sun::star::container::XContainerListener> m_xConfigListener;
-
- //___________________________________
- // native interface methods
-
- public:
-
- JobExecutor( const css::uno::Reference< css::uno::XComponentContext >& xContext );
- virtual ~JobExecutor( );
-
- //___________________________________
- // uno interface methods
-
- public:
-
- // XInterface, XTypeProvider, XServiceInfo
- DECLARE_XSERVICEINFO
-
- // task.XJobExecutor
- virtual void SAL_CALL trigger( const OUString& sEvent ) throw(css::uno::RuntimeException);
-
- // document.XEventListener
- virtual void SAL_CALL notifyEvent( const css::document::EventObject& aEvent ) throw(css::uno::RuntimeException);
-
- // container.XContainerListener
- virtual void SAL_CALL elementInserted( const css::container::ContainerEvent& aEvent ) throw(css::uno::RuntimeException);
- virtual void SAL_CALL elementRemoved ( const css::container::ContainerEvent& aEvent ) throw(css::uno::RuntimeException);
- virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& aEvent ) throw(css::uno::RuntimeException);
-
- // lang.XEventListener
- virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw(css::uno::RuntimeException);
-};
-
-} // namespace framework
-
-#endif // INCLUDED_FRAMEWORK_INC_JOBS_JOBEXECUTOR_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/jobs/jobexecutor.cxx b/framework/source/jobs/jobexecutor.cxx
index dd98699fa94b..6445e235205b 100644
--- a/framework/source/jobs/jobexecutor.cxx
+++ b/framework/source/jobs/jobexecutor.cxx
@@ -17,16 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <jobs/jobexecutor.hxx>
#include <jobs/job.hxx>
#include <jobs/joburl.hxx>
-
+#include <jobs/configaccess.hxx>
+#include <macros/xserviceinfo.hxx>
#include <classes/converter.hxx>
#include <threadhelp/transactionguard.hxx>
+#include <threadhelp/threadhelpbase.hxx>
#include <threadhelp/readguard.hxx>
#include <threadhelp/writeguard.hxx>
#include <general.h>
#include <services.h>
+#include <stdtypes.h>
#include "helper/mischelper.hxx"
@@ -34,13 +36,78 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XContainer.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
-
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/task/XJobExecutor.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/frame/XModuleManager2.hpp>
+
+#include <cppuhelper/implbase4.hxx>
#include <unotools/configpaths.hxx>
+#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
#include <vcl/svapp.hxx>
+using namespace framework;
+
+namespace {
+
+/**
+ @short implements a job executor, which can be triggered from any code
+ @descr It uses the given trigger event to locate any registered job service
+ inside the configuration and execute it. Of course it controls the
+ liftime of such jobs too.
+ */
+class JobExecutor : private ThreadHelpBase
+ , public ::cppu::WeakImplHelper4<
+ css::lang::XServiceInfo
+ , css::task::XJobExecutor
+ , css::container::XContainerListener // => lang.XEventListener
+ , css::document::XEventListener >
+{
+private:
+
+ /** reference to the uno service manager */
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+ /** reference to the module info service */
+ css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager;
+
+ /** cached list of all registered event names of cfg for call optimization. */
+ OUStringList m_lEvents;
+
+ /** we listen at the configuration for changes at the event list. */
+ ConfigAccess m_aConfig;
+
+ /** helper to allow us listen to the configuration without a cyclic dependency */
+ com::sun::star::uno::Reference<com::sun::star::container::XContainerListener> m_xConfigListener;
-namespace framework{
+public:
+
+ JobExecutor( const css::uno::Reference< css::uno::XComponentContext >& xContext );
+ virtual ~JobExecutor( );
+
+public:
+
+ // XInterface, XTypeProvider, XServiceInfo
+ DECLARE_XSERVICEINFO
+
+ // task.XJobExecutor
+ virtual void SAL_CALL trigger( const OUString& sEvent ) throw(css::uno::RuntimeException);
+
+ // document.XEventListener
+ virtual void SAL_CALL notifyEvent( const css::document::EventObject& aEvent ) throw(css::uno::RuntimeException);
+
+ // container.XContainerListener
+ virtual void SAL_CALL elementInserted( const css::container::ContainerEvent& aEvent ) throw(css::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved ( const css::container::ContainerEvent& aEvent ) throw(css::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& aEvent ) throw(css::uno::RuntimeException);
+
+ // lang.XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw(css::uno::RuntimeException);
+};
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2( JobExecutor ,
::cppu::OWeakObject ,
@@ -329,6 +396,17 @@ void SAL_CALL JobExecutor::disposing( const css::lang::EventObject& aEvent ) thr
/* } SAFE */
}
-} // namespace framework
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_framework_JobExecutor_get_implementation(
+ css::uno::XComponentContext * context,
+ uno_Sequence * arguments)
+{
+ assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
+ rtl::Reference<JobExecutor> x(new JobExecutor(context));
+ x->acquire();
+ return static_cast<cppu::OWeakObject *>(x.get());
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx
index 6bf2e474f08a..5bba469ab72d 100644
--- a/framework/source/register/registerservices.cxx
+++ b/framework/source/register/registerservices.cxx
@@ -35,7 +35,6 @@
=================================================================================================================*/
#include <services/desktop.hxx>
#include <services/frame.hxx>
-#include <jobs/jobexecutor.hxx>
#include <uielement/controlmenucontroller.hxx>
#include <accelerators/globalacceleratorconfiguration.hxx>
#include <accelerators/documentacceleratorconfiguration.hxx>
@@ -48,7 +47,6 @@
COMPONENTGETFACTORY ( fwk,
IFFACTORY( ::framework::Desktop ) else
IFFACTORY( ::framework::Frame ) else
- IFFACTORY( ::framework::JobExecutor ) else
IFFACTORY( ::framework::ControlMenuController ) else
IFFACTORY( ::framework::GlobalAcceleratorConfiguration ) else
IFFACTORY( ::framework::DocumentAcceleratorConfiguration ) else
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index f5321657b80f..a0399546ebbd 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -51,7 +51,8 @@
<implementation name="com.sun.star.comp.framework.ImageManager">
<service name="com.sun.star.ui.ImageManager"/>
</implementation>
- <implementation name="com.sun.star.comp.framework.JobExecutor">
+ <implementation name="com.sun.star.comp.framework.JobExecutor"
+ constructor="com_sun_star_comp_framework_JobExecutor_get_implementation">
<service name="com.sun.star.task.JobExecutor"/>
</implementation>
<implementation name="com.sun.star.comp.framework.LangSelectionStatusbarController"