LibreOffice Module framework (master) 1
shelljob.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
23
24#include <com/sun/star/task/XJob.hpp>
25#include <com/sun/star/lang/XServiceInfo.hpp>
26#include <com/sun/star/uno/XComponentContext.hpp>
27
28namespace framework{
29
39class ShellJob final : public ::cppu::WeakImplHelper< css::lang::XServiceInfo,css::task::XJob >
40{
41
42 // member
43 private:
44
46 css::uno::Reference< css::uno::XComponentContext > m_xContext;
47
48 // native interface
49 public:
50
57 ShellJob(css::uno::Reference< css::uno::XComponentContext > xContext);
58
65 virtual ~ShellJob() override;
66
67 // uno interface
68 public:
69
70 /* interface XServiceInfo */
71 virtual OUString SAL_CALL getImplementationName() override;
72 virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override;
73 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
74
75 // css.task.XJob
76 virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments) override;
77
78 // helper
79 private:
80
86 static css::uno::Any impl_generateAnswer4Deactivation();
87
101 OUString impl_substituteCommandVariables(const OUString& sCommand);
102
118 bool impl_execute(const OUString& sCommand ,
119 const css::uno::Sequence< OUString >& lArguments ,
120 bool bCheckExitCode);
121};
122
123} // namespace framework
124
125/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
implements a job component which can be used to execute system shell commands.
Definition: shelljob.hxx:40
css::uno::Reference< css::uno::XComponentContext > m_xContext
reference to a uno service manager.
Definition: shelljob.hxx:46
ShellJob(css::uno::Reference< css::uno::XComponentContext > xContext)
create new instance of this class.
Definition: shelljob.cxx:59
OUString impl_substituteCommandVariables(const OUString &sCommand)
substitute all might existing placeholder variables within the configured command.
Definition: shelljob.cxx:109
virtual ~ShellJob() override
does nothing real ...
Definition: shelljob.cxx:64
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
Definition: shelljob.cxx:48
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: shelljob.cxx:53
bool impl_execute(const OUString &sCommand, const css::uno::Sequence< OUString > &lArguments, bool bCheckExitCode)
executes the command.
Definition: shelljob.cxx:125
static css::uno::Any impl_generateAnswer4Deactivation()
generate a return value for method execute() which will force deactivation of this job for further re...
Definition: shelljob.cxx:103
virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue > &lArguments) override
Definition: shelljob.cxx:68
virtual OUString SAL_CALL getImplementationName() override
Definition: shelljob.cxx:43
unsigned char sal_Bool