1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 25 // MARKER(update_precomp.py): autogen include statement, do not remove 26 #include "precompiled_ucb.hxx" 27 #include <osl/process.h> 28 #include "odma_provider.hxx" 29 30 #ifdef WNT 31 #define SOFFICE "soffice.exe" 32 #else 33 #define SOFFICE "soffice" 34 #endif 35 36 /** our main program to convert ODMAIDs to ODMA URLs 37 */ 38 39 #if (defined UNX) || (defined OS2) 40 void main( int argc, char * argv[] ) 41 #else 42 void _cdecl main( int argc, char * argv[] ) 43 #endif 44 { 45 static ::rtl::OUString sProcess(RTL_CONSTASCII_USTRINGPARAM(SOFFICE)); 46 if(argc > 1) 47 { 48 ::rtl::OUString* pArguments = new ::rtl::OUString[argc-1]; 49 for(int i = 0; i < argc-1; ++i) 50 { 51 pArguments[i] = ::rtl::OUString::createFromAscii(argv[i+1]); 52 if( pArguments[i].matchIgnoreAsciiCaseAsciiL( 53 RTL_CONSTASCII_STRINGPARAM(ODMA_URL_ODMAID))) 54 { 55 ::rtl::OUString sArgument 56 = ::rtl::OUString( 57 RTL_CONSTASCII_USTRINGPARAM( 58 ODMA_URL_SCHEME ODMA_URL_SHORT "/")); 59 sArgument += pArguments[i]; 60 pArguments[i] = sArgument; 61 } 62 } 63 64 rtl_uString ** ustrArgumentList = new rtl_uString * [argc-1]; 65 for (int i = 0; i < argc-1; i++) 66 ustrArgumentList[i] = pArguments[i].pData; 67 68 oslProcess aProcess; 69 70 if ( osl_Process_E_None == osl_executeProcess( 71 sProcess.pData, 72 ustrArgumentList, 73 argc-1, 74 osl_Process_DETACHED, 75 NULL, 76 NULL, 77 NULL, 78 0, 79 &aProcess ) 80 ) 81 osl_freeProcessHandle( aProcess ); 82 83 delete [] ustrArgumentList; 84 delete [] pArguments; 85 } 86 } 87 88