1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 29 // MARKER(update_precomp.py): autogen include statement, do not remove 30 #include "precompiled_ucb.hxx" 31 #include <osl/process.h> 32 #include "odma_provider.hxx" 33 34 #ifdef WNT 35 #define SOFFICE "soffice.exe" 36 #else 37 #define SOFFICE "soffice" 38 #endif 39 40 /** our main program to convert ODMAIDs to ODMA URLs 41 */ 42 43 #if (defined UNX) || (defined OS2) 44 void main( int argc, char * argv[] ) 45 #else 46 void _cdecl main( int argc, char * argv[] ) 47 #endif 48 { 49 static ::rtl::OUString sProcess(RTL_CONSTASCII_USTRINGPARAM(SOFFICE)); 50 if(argc > 1) 51 { 52 ::rtl::OUString* pArguments = new ::rtl::OUString[argc-1]; 53 for(int i = 0; i < argc-1; ++i) 54 { 55 pArguments[i] = ::rtl::OUString::createFromAscii(argv[i+1]); 56 if( pArguments[i].matchIgnoreAsciiCaseAsciiL( 57 RTL_CONSTASCII_STRINGPARAM(ODMA_URL_ODMAID))) 58 { 59 ::rtl::OUString sArgument 60 = ::rtl::OUString( 61 RTL_CONSTASCII_USTRINGPARAM( 62 ODMA_URL_SCHEME ODMA_URL_SHORT "/")); 63 sArgument += pArguments[i]; 64 pArguments[i] = sArgument; 65 } 66 } 67 68 rtl_uString ** ustrArgumentList = new rtl_uString * [argc-1]; 69 for (int i = 0; i < argc-1; i++) 70 ustrArgumentList[i] = pArguments[i].pData; 71 72 oslProcess aProcess; 73 74 if ( osl_Process_E_None == osl_executeProcess( 75 sProcess.pData, 76 ustrArgumentList, 77 argc-1, 78 osl_Process_DETACHED, 79 NULL, 80 NULL, 81 NULL, 82 0, 83 &aProcess ) 84 ) 85 osl_freeProcessHandle( aProcess ); 86 87 delete [] ustrArgumentList; 88 delete [] pArguments; 89 } 90 } 91 92