fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / framework / inc / jobs / shelljob.hxx
blob2412edcecb7fed99637626de7964ac7bb46fcdc4
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 INCLUDED_FRAMEWORK_INC_JOBS_SHELLJOB_HXX
21 #define INCLUDED_FRAMEWORK_INC_JOBS_SHELLJOB_HXX
23 #include <macros/xinterface.hxx>
24 #include <macros/xtypeprovider.hxx>
25 #include <macros/xserviceinfo.hxx>
27 #include <cppuhelper/implbase2.hxx>
29 #include <com/sun/star/frame/XFrame.hpp>
30 #include <com/sun/star/task/XJob.hpp>
31 #include <com/sun/star/lang/XEventListener.hpp>
32 #include <com/sun/star/container/XNameAccess.hpp>
33 #include <com/sun/star/frame/XModuleManager.hpp>
35 namespace framework{
37 /** @short implements a job component which can be used
38 to execute system shell commands.
40 @descr Because the job will be implemented generic
41 it can be bound to any event where jobs can be
42 registered for. Further there is a generic
43 way to configure the shell command and it's list
44 of arguments.
46 @author as96863
48 class ShellJob : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo,::com::sun::star::task::XJob >
51 // member
52 private:
54 /** @short reference to an uno service manager. */
55 css::uno::Reference< css::uno::XComponentContext > m_xContext;
57 // native interface
58 public:
60 /** @short create new instance of this class.
62 @param xContext
63 reference to the uno service manager, which created this instance.
64 Can be used later to create own needed uno resources on demand.
66 ShellJob(const css::uno::Reference< css::uno::XComponentContext >& xContext);
68 /** @short does nothing real ...
70 @descr But it should exists as virtual function,
71 so this class can't make trouble
72 related to inline/symbols etcpp.!
74 virtual ~ShellJob();
76 // uno interface
77 public:
79 // css.lang.XServiceInfo
80 DECLARE_XSERVICEINFO
82 // css.task.XJob
83 virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments)
84 throw(css::lang::IllegalArgumentException,
85 css::uno::Exception ,
86 css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
88 // helper
89 private:
91 /** generate a return value for method execute()
92 which will force deactivation of this job for further requests.
94 @return an Any following the job protocol for deactivation.
96 static css::uno::Any impl_generateAnswer4Deactivation();
98 /** substitute all might existing placeholder variables
99 within the configured command.
101 The command is part of the job configuration.
102 These will make changes more easy (no code changes required).
103 Further the command can use placeholder as they are supported
104 by the global substitution service (e.g. $(prog) etcpp)
106 @param sCommand
107 the command containing placeholder variables.
109 @return the substituted command.
111 OUString impl_substituteCommandVariables(const OUString& sCommand);
113 /** executes the command.
115 @param sCommand
116 the absolute command as URL or system path (without any argument !).
118 @param lArguments
119 the complete list of arguments configured for these job.
121 @param bCheckExitCode
122 bind the execution result to the exit code of the started process.
123 If it's set to false we return false only in case executable couldnt be found
124 or couldnt be started.
126 @return sal_True if command was executed successfully; sal_False otherwise.
128 bool impl_execute(const OUString& sCommand ,
129 const css::uno::Sequence< OUString >& lArguments ,
130 bool bCheckExitCode);
133 } // namespace framework
135 #endif // INCLUDED_FRAMEWORK_INC_JOBS_SHELLJOB_HXX
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */