1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski *
3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file
5*b1cdbd2cSJim Jagielski * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file
7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski *
11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski *
13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the
17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski * under the License.
19*b1cdbd2cSJim Jagielski *
20*b1cdbd2cSJim Jagielski *************************************************************/
21*b1cdbd2cSJim Jagielski
22*b1cdbd2cSJim Jagielski
23*b1cdbd2cSJim Jagielski
24*b1cdbd2cSJim Jagielski // MARKER(update_precomp.py): autogen include statement, do not remove
25*b1cdbd2cSJim Jagielski #include "precompiled_shell.hxx"
26*b1cdbd2cSJim Jagielski #include <osl/diagnose.h>
27*b1cdbd2cSJim Jagielski #include <osl/thread.h>
28*b1cdbd2cSJim Jagielski #include <osl/process.h>
29*b1cdbd2cSJim Jagielski #include <osl/file.hxx>
30*b1cdbd2cSJim Jagielski #include <rtl/ustrbuf.hxx>
31*b1cdbd2cSJim Jagielski
32*b1cdbd2cSJim Jagielski #ifndef _RTL_URI_H_
33*b1cdbd2cSJim Jagielski #include <rtl/uri.hxx>
34*b1cdbd2cSJim Jagielski #endif
35*b1cdbd2cSJim Jagielski #include "shellexec.hxx"
36*b1cdbd2cSJim Jagielski #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
37*b1cdbd2cSJim Jagielski
38*b1cdbd2cSJim Jagielski #include <com/sun/star/util/XMacroExpander.hpp>
39*b1cdbd2cSJim Jagielski #include <com/sun/star/uri/XExternalUriReferenceTranslator.hpp>
40*b1cdbd2cSJim Jagielski #include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp>
41*b1cdbd2cSJim Jagielski
42*b1cdbd2cSJim Jagielski #include "uno/current_context.hxx"
43*b1cdbd2cSJim Jagielski
44*b1cdbd2cSJim Jagielski #include <string.h>
45*b1cdbd2cSJim Jagielski #include <errno.h>
46*b1cdbd2cSJim Jagielski #include <unistd.h>
47*b1cdbd2cSJim Jagielski #ifdef OS2
48*b1cdbd2cSJim Jagielski #include <process.h>
49*b1cdbd2cSJim Jagielski #endif
50*b1cdbd2cSJim Jagielski
51*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------
52*b1cdbd2cSJim Jagielski // namespace directives
53*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------
54*b1cdbd2cSJim Jagielski
55*b1cdbd2cSJim Jagielski using com::sun::star::system::XSystemShellExecute;
56*b1cdbd2cSJim Jagielski using com::sun::star::system::SystemShellExecuteException;
57*b1cdbd2cSJim Jagielski
58*b1cdbd2cSJim Jagielski using rtl::OString;
59*b1cdbd2cSJim Jagielski using rtl::OUString;
60*b1cdbd2cSJim Jagielski using rtl::OStringBuffer;
61*b1cdbd2cSJim Jagielski using rtl::OUStringBuffer;
62*b1cdbd2cSJim Jagielski using osl::FileBase;
63*b1cdbd2cSJim Jagielski
64*b1cdbd2cSJim Jagielski using namespace ::com::sun::star::uno;
65*b1cdbd2cSJim Jagielski using namespace ::com::sun::star::lang;
66*b1cdbd2cSJim Jagielski using namespace ::com::sun::star::system::SystemShellExecuteFlags;
67*b1cdbd2cSJim Jagielski using namespace cppu;
68*b1cdbd2cSJim Jagielski
69*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------
70*b1cdbd2cSJim Jagielski // defines
71*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------
72*b1cdbd2cSJim Jagielski
73*b1cdbd2cSJim Jagielski #define SHELLEXEC_IMPL_NAME "com.sun.star.comp.system.SystemShellExecute2"
74*b1cdbd2cSJim Jagielski
75*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------
76*b1cdbd2cSJim Jagielski // helper functions
77*b1cdbd2cSJim Jagielski //------------------------------------------------------------------------
78*b1cdbd2cSJim Jagielski
79*b1cdbd2cSJim Jagielski namespace // private
80*b1cdbd2cSJim Jagielski {
ShellExec_getSupportedServiceNames()81*b1cdbd2cSJim Jagielski Sequence< OUString > SAL_CALL ShellExec_getSupportedServiceNames()
82*b1cdbd2cSJim Jagielski {
83*b1cdbd2cSJim Jagielski Sequence< OUString > aRet(1);
84*b1cdbd2cSJim Jagielski aRet[0] = OUString::createFromAscii("com.sun.star.sys.shell.SystemShellExecute");
85*b1cdbd2cSJim Jagielski return aRet;
86*b1cdbd2cSJim Jagielski }
87*b1cdbd2cSJim Jagielski }
88*b1cdbd2cSJim Jagielski
escapeForShell(rtl::OStringBuffer & rBuffer,const rtl::OString & rURL)89*b1cdbd2cSJim Jagielski void escapeForShell( rtl::OStringBuffer & rBuffer, const rtl::OString & rURL)
90*b1cdbd2cSJim Jagielski {
91*b1cdbd2cSJim Jagielski sal_Int32 nmax = rURL.getLength();
92*b1cdbd2cSJim Jagielski for(sal_Int32 n=0; n < nmax; ++n)
93*b1cdbd2cSJim Jagielski {
94*b1cdbd2cSJim Jagielski // escape every non alpha numeric characters (excluding a few "known good") by prepending a '\'
95*b1cdbd2cSJim Jagielski sal_Char c = rURL[n];
96*b1cdbd2cSJim Jagielski #ifndef OS2 // YD shell does not support escaped chars
97*b1cdbd2cSJim Jagielski if( ( c < 'A' || c > 'Z' ) && ( c < 'a' || c > 'z' ) && ( c < '0' || c > '9' ) && c != '/' && c != '.' )
98*b1cdbd2cSJim Jagielski rBuffer.append( '\\' );
99*b1cdbd2cSJim Jagielski #endif
100*b1cdbd2cSJim Jagielski
101*b1cdbd2cSJim Jagielski rBuffer.append( c );
102*b1cdbd2cSJim Jagielski }
103*b1cdbd2cSJim Jagielski }
104*b1cdbd2cSJim Jagielski
105*b1cdbd2cSJim Jagielski //-----------------------------------------------------------------------------------------
106*b1cdbd2cSJim Jagielski //
107*b1cdbd2cSJim Jagielski //-----------------------------------------------------------------------------------------
108*b1cdbd2cSJim Jagielski
ShellExec(const Reference<XComponentContext> & xContext)109*b1cdbd2cSJim Jagielski ShellExec::ShellExec( const Reference< XComponentContext >& xContext ) :
110*b1cdbd2cSJim Jagielski WeakImplHelper2< XSystemShellExecute, XServiceInfo >(),
111*b1cdbd2cSJim Jagielski m_xContext(xContext)
112*b1cdbd2cSJim Jagielski {
113*b1cdbd2cSJim Jagielski try {
114*b1cdbd2cSJim Jagielski Reference< XCurrentContext > xCurrentContext(getCurrentContext());
115*b1cdbd2cSJim Jagielski
116*b1cdbd2cSJim Jagielski if (xCurrentContext.is())
117*b1cdbd2cSJim Jagielski {
118*b1cdbd2cSJim Jagielski Any aValue = xCurrentContext->getValueByName(
119*b1cdbd2cSJim Jagielski OUString( RTL_CONSTASCII_USTRINGPARAM( "system.desktop-environment" ) ) );
120*b1cdbd2cSJim Jagielski
121*b1cdbd2cSJim Jagielski OUString aDesktopEnvironment;
122*b1cdbd2cSJim Jagielski if (aValue >>= aDesktopEnvironment)
123*b1cdbd2cSJim Jagielski {
124*b1cdbd2cSJim Jagielski m_aDesktopEnvironment = OUStringToOString(aDesktopEnvironment, RTL_TEXTENCODING_ASCII_US);
125*b1cdbd2cSJim Jagielski }
126*b1cdbd2cSJim Jagielski }
127*b1cdbd2cSJim Jagielski } catch (RuntimeException e) {
128*b1cdbd2cSJim Jagielski }
129*b1cdbd2cSJim Jagielski }
130*b1cdbd2cSJim Jagielski
131*b1cdbd2cSJim Jagielski //-------------------------------------------------
132*b1cdbd2cSJim Jagielski //
133*b1cdbd2cSJim Jagielski //-------------------------------------------------
134*b1cdbd2cSJim Jagielski
execute(const OUString & aCommand,const OUString & aParameter,sal_Int32 nFlags)135*b1cdbd2cSJim Jagielski void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aParameter, sal_Int32 nFlags )
136*b1cdbd2cSJim Jagielski throw (IllegalArgumentException, SystemShellExecuteException, RuntimeException)
137*b1cdbd2cSJim Jagielski {
138*b1cdbd2cSJim Jagielski OStringBuffer aBuffer, aLaunchBuffer;
139*b1cdbd2cSJim Jagielski
140*b1cdbd2cSJim Jagielski // DESKTOP_LAUNCH, see http://freedesktop.org/pipermail/xdg/2004-August/004489.html
141*b1cdbd2cSJim Jagielski static const char *pDesktopLaunch = getenv( "DESKTOP_LAUNCH" );
142*b1cdbd2cSJim Jagielski
143*b1cdbd2cSJim Jagielski // Check wether aCommand contains a document url or not
144*b1cdbd2cSJim Jagielski sal_Int32 nIndex = aCommand.indexOf( OUString( RTL_CONSTASCII_USTRINGPARAM(":/") ) );
145*b1cdbd2cSJim Jagielski
146*b1cdbd2cSJim Jagielski if( nIndex > 0 || 0 == aCommand.compareToAscii("mailto:", 7) )
147*b1cdbd2cSJim Jagielski {
148*b1cdbd2cSJim Jagielski // It seems to be a url ..
149*b1cdbd2cSJim Jagielski // We need to re-encode file urls because osl_getFileURLFromSystemPath converts
150*b1cdbd2cSJim Jagielski // to UTF-8 before encoding non ascii characters, which is not what other apps
151*b1cdbd2cSJim Jagielski // expect.
152*b1cdbd2cSJim Jagielski OUString aURL(
153*b1cdbd2cSJim Jagielski com::sun::star::uri::ExternalUriReferenceTranslator::create(
154*b1cdbd2cSJim Jagielski m_xContext)->translateToExternal(aCommand));
155*b1cdbd2cSJim Jagielski if ( aURL.getLength() == 0 && aCommand.getLength() != 0 )
156*b1cdbd2cSJim Jagielski {
157*b1cdbd2cSJim Jagielski throw RuntimeException(
158*b1cdbd2cSJim Jagielski (OUString(
159*b1cdbd2cSJim Jagielski RTL_CONSTASCII_USTRINGPARAM(
160*b1cdbd2cSJim Jagielski "Cannot translate URI reference to external format: "))
161*b1cdbd2cSJim Jagielski + aCommand),
162*b1cdbd2cSJim Jagielski static_cast< cppu::OWeakObject * >(this));
163*b1cdbd2cSJim Jagielski }
164*b1cdbd2cSJim Jagielski
165*b1cdbd2cSJim Jagielski #ifdef MACOSX
166*b1cdbd2cSJim Jagielski aBuffer.append("open");
167*b1cdbd2cSJim Jagielski #else
168*b1cdbd2cSJim Jagielski // The url launchers are expected to be in the $OOO_BASE_DIR/program
169*b1cdbd2cSJim Jagielski // directory:
170*b1cdbd2cSJim Jagielski com::sun::star::uno::Reference< com::sun::star::util::XMacroExpander >
171*b1cdbd2cSJim Jagielski exp;
172*b1cdbd2cSJim Jagielski if (!(m_xContext->getValueByName(
173*b1cdbd2cSJim Jagielski rtl::OUString(
174*b1cdbd2cSJim Jagielski RTL_CONSTASCII_USTRINGPARAM(
175*b1cdbd2cSJim Jagielski "/singletons/com.sun.star.util.theMacroExpander")))
176*b1cdbd2cSJim Jagielski >>= exp)
177*b1cdbd2cSJim Jagielski || !exp.is())
178*b1cdbd2cSJim Jagielski {
179*b1cdbd2cSJim Jagielski throw SystemShellExecuteException(
180*b1cdbd2cSJim Jagielski rtl::OUString(
181*b1cdbd2cSJim Jagielski RTL_CONSTASCII_USTRINGPARAM(
182*b1cdbd2cSJim Jagielski "component context fails to supply singleton"
183*b1cdbd2cSJim Jagielski " com.sun.star.util.theMacroExpander of type"
184*b1cdbd2cSJim Jagielski " com.sun.star.util.XMacroExpander")),
185*b1cdbd2cSJim Jagielski static_cast< XSystemShellExecute * >(this), ENOENT);
186*b1cdbd2cSJim Jagielski }
187*b1cdbd2cSJim Jagielski OUString aProgramURL;
188*b1cdbd2cSJim Jagielski try {
189*b1cdbd2cSJim Jagielski aProgramURL = exp->expandMacros(
190*b1cdbd2cSJim Jagielski rtl::OUString(
191*b1cdbd2cSJim Jagielski RTL_CONSTASCII_USTRINGPARAM("$OOO_BASE_DIR/program/")));
192*b1cdbd2cSJim Jagielski } catch (com::sun::star::lang::IllegalArgumentException &)
193*b1cdbd2cSJim Jagielski {
194*b1cdbd2cSJim Jagielski throw SystemShellExecuteException(
195*b1cdbd2cSJim Jagielski OUString(RTL_CONSTASCII_USTRINGPARAM("Could not expand $OOO_BASE_DIR path")),
196*b1cdbd2cSJim Jagielski static_cast < XSystemShellExecute * > (this), ENOENT );
197*b1cdbd2cSJim Jagielski }
198*b1cdbd2cSJim Jagielski
199*b1cdbd2cSJim Jagielski OUString aProgram;
200*b1cdbd2cSJim Jagielski if ( FileBase::E_None != FileBase::getSystemPathFromFileURL(aProgramURL, aProgram))
201*b1cdbd2cSJim Jagielski {
202*b1cdbd2cSJim Jagielski throw SystemShellExecuteException(
203*b1cdbd2cSJim Jagielski OUString(RTL_CONSTASCII_USTRINGPARAM("Cound not convert executable path")),
204*b1cdbd2cSJim Jagielski static_cast < XSystemShellExecute * > (this), ENOENT );
205*b1cdbd2cSJim Jagielski }
206*b1cdbd2cSJim Jagielski
207*b1cdbd2cSJim Jagielski #ifdef OS2
208*b1cdbd2cSJim Jagielski OStringBuffer aProg = OUStringToOString(aProgram, osl_getThreadTextEncoding());
209*b1cdbd2cSJim Jagielski aProg.append("open-url.exe");
210*b1cdbd2cSJim Jagielski OString aUrl = OUStringToOString(aURL, osl_getThreadTextEncoding());
211*b1cdbd2cSJim Jagielski if ( -1 == spawnl(P_NOWAIT, aProg.getStr(), aProg.getStr(), aUrl.getStr() , NULL) )
212*b1cdbd2cSJim Jagielski {
213*b1cdbd2cSJim Jagielski int nerr = errno;
214*b1cdbd2cSJim Jagielski throw SystemShellExecuteException(OUString::createFromAscii( strerror( nerr ) ),
215*b1cdbd2cSJim Jagielski static_cast < XSystemShellExecute * > (this), nerr );
216*b1cdbd2cSJim Jagielski }
217*b1cdbd2cSJim Jagielski return;
218*b1cdbd2cSJim Jagielski #endif
219*b1cdbd2cSJim Jagielski
220*b1cdbd2cSJim Jagielski OString aTmp = OUStringToOString(aProgram, osl_getThreadTextEncoding());
221*b1cdbd2cSJim Jagielski escapeForShell(aBuffer, aTmp);
222*b1cdbd2cSJim Jagielski
223*b1cdbd2cSJim Jagielski #ifdef SOLARIS
224*b1cdbd2cSJim Jagielski if ( m_aDesktopEnvironment.getLength() == 0 )
225*b1cdbd2cSJim Jagielski m_aDesktopEnvironment = OString("GNOME");
226*b1cdbd2cSJim Jagielski #endif
227*b1cdbd2cSJim Jagielski
228*b1cdbd2cSJim Jagielski // Respect the desktop environment - if there is an executable named
229*b1cdbd2cSJim Jagielski // <desktop-environement-is>-open-url, pass the url to this one instead
230*b1cdbd2cSJim Jagielski // of the default "open-url" script.
231*b1cdbd2cSJim Jagielski if ( m_aDesktopEnvironment.getLength() > 0 )
232*b1cdbd2cSJim Jagielski {
233*b1cdbd2cSJim Jagielski OString aDesktopEnvironment(m_aDesktopEnvironment.toAsciiLowerCase());
234*b1cdbd2cSJim Jagielski OStringBuffer aCopy(aTmp);
235*b1cdbd2cSJim Jagielski
236*b1cdbd2cSJim Jagielski aCopy.append(aDesktopEnvironment);
237*b1cdbd2cSJim Jagielski aCopy.append("-open-url");
238*b1cdbd2cSJim Jagielski
239*b1cdbd2cSJim Jagielski if ( 0 == access( aCopy.getStr(), X_OK) )
240*b1cdbd2cSJim Jagielski {
241*b1cdbd2cSJim Jagielski aBuffer.append(aDesktopEnvironment);
242*b1cdbd2cSJim Jagielski aBuffer.append("-");
243*b1cdbd2cSJim Jagielski
244*b1cdbd2cSJim Jagielski /* CDE requires file urls to be decoded */
245*b1cdbd2cSJim Jagielski if ( m_aDesktopEnvironment.equals("CDE") && 0 == aURL.compareToAscii("file://", 7) )
246*b1cdbd2cSJim Jagielski {
247*b1cdbd2cSJim Jagielski aURL = rtl::Uri::decode(aURL, rtl_UriDecodeWithCharset, osl_getThreadTextEncoding());
248*b1cdbd2cSJim Jagielski }
249*b1cdbd2cSJim Jagielski }
250*b1cdbd2cSJim Jagielski }
251*b1cdbd2cSJim Jagielski
252*b1cdbd2cSJim Jagielski aBuffer.append("open-url");
253*b1cdbd2cSJim Jagielski #endif
254*b1cdbd2cSJim Jagielski aBuffer.append(" ");
255*b1cdbd2cSJim Jagielski escapeForShell(aBuffer, OUStringToOString(aURL, osl_getThreadTextEncoding()));
256*b1cdbd2cSJim Jagielski
257*b1cdbd2cSJim Jagielski if ( pDesktopLaunch && *pDesktopLaunch )
258*b1cdbd2cSJim Jagielski {
259*b1cdbd2cSJim Jagielski aLaunchBuffer.append( pDesktopLaunch );
260*b1cdbd2cSJim Jagielski aLaunchBuffer.append(" ");
261*b1cdbd2cSJim Jagielski escapeForShell(aLaunchBuffer, OUStringToOString(aURL, osl_getThreadTextEncoding()));
262*b1cdbd2cSJim Jagielski }
263*b1cdbd2cSJim Jagielski } else {
264*b1cdbd2cSJim Jagielski escapeForShell(aBuffer, OUStringToOString(aCommand, osl_getThreadTextEncoding()));
265*b1cdbd2cSJim Jagielski aBuffer.append(" ");
266*b1cdbd2cSJim Jagielski if( nFlags != 42 )
267*b1cdbd2cSJim Jagielski escapeForShell(aBuffer, OUStringToOString(aParameter, osl_getThreadTextEncoding()));
268*b1cdbd2cSJim Jagielski else
269*b1cdbd2cSJim Jagielski aBuffer.append(OUStringToOString(aParameter, osl_getThreadTextEncoding()));
270*b1cdbd2cSJim Jagielski }
271*b1cdbd2cSJim Jagielski
272*b1cdbd2cSJim Jagielski // Prefer DESKTOP_LAUNCH when available
273*b1cdbd2cSJim Jagielski if ( aLaunchBuffer.getLength() > 0 )
274*b1cdbd2cSJim Jagielski {
275*b1cdbd2cSJim Jagielski FILE *pLaunch = popen( aLaunchBuffer.makeStringAndClear().getStr(), "w" );
276*b1cdbd2cSJim Jagielski if ( pLaunch != NULL )
277*b1cdbd2cSJim Jagielski {
278*b1cdbd2cSJim Jagielski if ( 0 == pclose( pLaunch ) )
279*b1cdbd2cSJim Jagielski return;
280*b1cdbd2cSJim Jagielski }
281*b1cdbd2cSJim Jagielski // Failed, do not try DESKTOP_LAUNCH any more
282*b1cdbd2cSJim Jagielski pDesktopLaunch = NULL;
283*b1cdbd2cSJim Jagielski }
284*b1cdbd2cSJim Jagielski
285*b1cdbd2cSJim Jagielski OString cmd = aBuffer.makeStringAndClear();
286*b1cdbd2cSJim Jagielski if ( 0 != pclose(popen(cmd.getStr(), "w")) )
287*b1cdbd2cSJim Jagielski {
288*b1cdbd2cSJim Jagielski int nerr = errno;
289*b1cdbd2cSJim Jagielski throw SystemShellExecuteException(OUString::createFromAscii( strerror( nerr ) ),
290*b1cdbd2cSJim Jagielski static_cast < XSystemShellExecute * > (this), nerr );
291*b1cdbd2cSJim Jagielski }
292*b1cdbd2cSJim Jagielski }
293*b1cdbd2cSJim Jagielski
294*b1cdbd2cSJim Jagielski
295*b1cdbd2cSJim Jagielski // -------------------------------------------------
296*b1cdbd2cSJim Jagielski // XServiceInfo
297*b1cdbd2cSJim Jagielski // -------------------------------------------------
298*b1cdbd2cSJim Jagielski
getImplementationName()299*b1cdbd2cSJim Jagielski OUString SAL_CALL ShellExec::getImplementationName( )
300*b1cdbd2cSJim Jagielski throw( RuntimeException )
301*b1cdbd2cSJim Jagielski {
302*b1cdbd2cSJim Jagielski return OUString::createFromAscii( SHELLEXEC_IMPL_NAME );
303*b1cdbd2cSJim Jagielski }
304*b1cdbd2cSJim Jagielski
305*b1cdbd2cSJim Jagielski // -------------------------------------------------
306*b1cdbd2cSJim Jagielski // XServiceInfo
307*b1cdbd2cSJim Jagielski // -------------------------------------------------
308*b1cdbd2cSJim Jagielski
supportsService(const OUString & ServiceName)309*b1cdbd2cSJim Jagielski sal_Bool SAL_CALL ShellExec::supportsService( const OUString& ServiceName )
310*b1cdbd2cSJim Jagielski throw( RuntimeException )
311*b1cdbd2cSJim Jagielski {
312*b1cdbd2cSJim Jagielski Sequence < OUString > SupportedServicesNames = ShellExec_getSupportedServiceNames();
313*b1cdbd2cSJim Jagielski
314*b1cdbd2cSJim Jagielski for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
315*b1cdbd2cSJim Jagielski if (SupportedServicesNames[n].compareTo(ServiceName) == 0)
316*b1cdbd2cSJim Jagielski return sal_True;
317*b1cdbd2cSJim Jagielski
318*b1cdbd2cSJim Jagielski return sal_False;
319*b1cdbd2cSJim Jagielski }
320*b1cdbd2cSJim Jagielski
321*b1cdbd2cSJim Jagielski // -------------------------------------------------
322*b1cdbd2cSJim Jagielski // XServiceInfo
323*b1cdbd2cSJim Jagielski // -------------------------------------------------
324*b1cdbd2cSJim Jagielski
getSupportedServiceNames()325*b1cdbd2cSJim Jagielski Sequence< OUString > SAL_CALL ShellExec::getSupportedServiceNames( )
326*b1cdbd2cSJim Jagielski throw( RuntimeException )
327*b1cdbd2cSJim Jagielski {
328*b1cdbd2cSJim Jagielski return ShellExec_getSupportedServiceNames();
329*b1cdbd2cSJim Jagielski }
330*b1cdbd2cSJim Jagielski
331