Bump for 3.6-28
[LibreOffice.git] / ucb / source / ucp / odma / odma_main.cxx
blob4123c78ab4f5bd4bf09785f3992eea5b4ebdd33f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #ifdef WNT
31 #include <windows.h>
32 #endif
33 #include <osl/process.h>
34 #include "odma_provider.hxx"
36 #ifdef WNT
37 #define SOFFICE "soffice.exe"
38 #else
39 #define SOFFICE "soffice"
40 #endif
42 /** our main program to convert ODMAIDs to ODMA URLs
45 #if (defined UNX)
46 void main( int argc, char * argv[] )
47 #else
48 #if (defined GCC)
49 int _cdecl main( int argc, char * argv[] )
50 #else
51 void _cdecl main( int argc, char * argv[] )
52 #endif
53 #endif
55 static ::rtl::OUString sProcess(RTL_CONSTASCII_USTRINGPARAM(SOFFICE));
56 if(argc > 1)
58 ::rtl::OUString* pArguments = new ::rtl::OUString[argc-1];
59 for(int i = 0; i < argc-1; ++i)
61 pArguments[i] = ::rtl::OUString::createFromAscii(argv[i+1]);
62 if( pArguments[i].matchIgnoreAsciiCaseAsciiL(
63 RTL_CONSTASCII_STRINGPARAM(ODMA_URL_ODMAID)))
65 ::rtl::OUString sArgument
66 = ::rtl::OUString(
67 RTL_CONSTASCII_USTRINGPARAM(
68 ODMA_URL_SCHEME ODMA_URL_SHORT "/"));
69 sArgument += pArguments[i];
70 pArguments[i] = sArgument;
74 rtl_uString ** ustrArgumentList = new rtl_uString * [argc-1];
75 for (int i = 0; i < argc-1; i++)
76 ustrArgumentList[i] = pArguments[i].pData;
78 oslProcess aProcess;
80 if ( osl_Process_E_None == osl_executeProcess(
81 sProcess.pData,
82 ustrArgumentList,
83 argc-1,
84 osl_Process_DETACHED,
85 NULL,
86 NULL,
87 NULL,
89 &aProcess )
91 osl_freeProcessHandle( aProcess );
93 delete [] ustrArgumentList;
94 delete [] pArguments;
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */