INTEGRATION: CWS sb87 (1.30.28); FILE MERGED
2008/04/24 13:02:20 sb 1.30.28.2: RESYNC: (1.30-1.31); FILE MERGED 2008/04/24 11:49:16 sb 1.30.28.1: #i88687# in cppu::bootstrap, use new cppuhelper_detail_findSofficePath to locate soffice and bootstrap into its UNO environment
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
* OpenOffice.org - a multi-platform office productivity suite
|
* OpenOffice.org - a multi-platform office productivity suite
|
||||||
*
|
*
|
||||||
* $RCSfile: bootstrap.cxx,v $
|
* $RCSfile: bootstrap.cxx,v $
|
||||||
* $Revision: 1.32 $
|
* $Revision: 1.33 $
|
||||||
*
|
*
|
||||||
* This file is part of OpenOffice.org.
|
* This file is part of OpenOffice.org.
|
||||||
*
|
*
|
||||||
@@ -53,6 +53,7 @@
|
|||||||
#include "cppuhelper/bootstrap.hxx"
|
#include "cppuhelper/bootstrap.hxx"
|
||||||
#include "cppuhelper/component_context.hxx"
|
#include "cppuhelper/component_context.hxx"
|
||||||
#include "cppuhelper/access_control.hxx"
|
#include "cppuhelper/access_control.hxx"
|
||||||
|
#include "cppuhelper/findsofficepath.h"
|
||||||
|
|
||||||
#include "com/sun/star/uno/XComponentContext.hpp"
|
#include "com/sun/star/uno/XComponentContext.hpp"
|
||||||
#include "com/sun/star/uno/XCurrentContext.hpp"
|
#include "com/sun/star/uno/XCurrentContext.hpp"
|
||||||
@@ -508,15 +509,45 @@ Reference< XComponentContext > SAL_CALL bootstrap()
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
char const * p1 = cppuhelper_detail_findSofficePath();
|
||||||
|
if (p1 == NULL) {
|
||||||
|
throw BootstrapException(
|
||||||
|
OUSTR("no soffice installation found!"));
|
||||||
|
}
|
||||||
|
rtl::OUString p2;
|
||||||
|
if (!rtl_convertStringToUString(
|
||||||
|
&p2.pData, p1, strlen(p1), osl_getThreadTextEncoding(),
|
||||||
|
(RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
|
||||||
|
RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
|
||||||
|
RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
|
||||||
|
{
|
||||||
|
throw BootstrapException(
|
||||||
|
OUSTR("bad characters in soffice installation path!"));
|
||||||
|
}
|
||||||
|
OUString path;
|
||||||
|
if (osl::FileBase::getFileURLFromSystemPath(p2, path) !=
|
||||||
|
osl::FileBase::E_None)
|
||||||
|
{
|
||||||
|
throw BootstrapException(
|
||||||
|
OUSTR("cannot convert soffice installation path to URL!"));
|
||||||
|
}
|
||||||
|
if (path.getLength() > 0 && path[path.getLength() - 1] != '/') {
|
||||||
|
path += OUSTR("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
OUString uri;
|
||||||
|
if (!Bootstrap::get(OUSTR("URE_BOOTSTRAP"), uri)) {
|
||||||
|
Bootstrap::set(
|
||||||
|
OUSTR("URE_BOOTSTRAP"),
|
||||||
|
Bootstrap::encode(path + OUSTR(SAL_CONFIGFILE("fundamental"))));
|
||||||
|
}
|
||||||
|
|
||||||
// create default local component context
|
// create default local component context
|
||||||
Reference< XComponentContext > xLocalContext(
|
Reference< XComponentContext > xLocalContext(
|
||||||
defaultBootstrap_InitialComponentContext() );
|
defaultBootstrap_InitialComponentContext() );
|
||||||
if ( !xLocalContext.is() )
|
if ( !xLocalContext.is() )
|
||||||
throw BootstrapException( OUSTR( "no local component context!" ) );
|
throw BootstrapException( OUSTR( "no local component context!" ) );
|
||||||
|
|
||||||
// URL to office executable
|
|
||||||
OUString sOfficeURL( get_this_libpath() + OUSTR( "/soffice" ) );
|
|
||||||
|
|
||||||
// create a random pipe name
|
// create a random pipe name
|
||||||
rtlRandomPool hPool = rtl_random_createPool();
|
rtlRandomPool hPool = rtl_random_createPool();
|
||||||
if ( hPool == 0 )
|
if ( hPool == 0 )
|
||||||
@@ -560,7 +591,7 @@ Reference< XComponentContext > SAL_CALL bootstrap()
|
|||||||
// start office process
|
// start office process
|
||||||
oslProcess hProcess = 0;
|
oslProcess hProcess = 0;
|
||||||
oslProcessError rc = osl_executeProcess(
|
oslProcessError rc = osl_executeProcess(
|
||||||
sOfficeURL.pData, ar_args, ARLEN( ar_args ),
|
(path + OUSTR("soffice")).pData, ar_args, ARLEN( ar_args ),
|
||||||
osl_Process_DETACHED,
|
osl_Process_DETACHED,
|
||||||
sec.getHandle(),
|
sec.getHandle(),
|
||||||
0, // => current working dir
|
0, // => current working dir
|
||||||
|
Reference in New Issue
Block a user