INTEGRATION: CWS jl81_SRC680 (1.14.52); FILE MERGED
2007/10/23 13:15:55 jl 1.14.52.4: #i81988# removing OSL_ENSURE 2007/10/19 15:29:14 jl 1.14.52.3: #i81988# 2007/10/19 15:04:36 jl 1.14.52.2: #i81988# 2007/10/19 13:21:55 jl 1.14.52.1: #i81988# office_is_running checks does not open pipe when runngin in soffice.bin
This commit is contained in:
parent
66b908b45c
commit
3892cb462f
1 changed files with 59 additions and 8 deletions
|
@ -4,9 +4,9 @@
|
|||
*
|
||||
* $RCSfile: dp_misc.cxx,v $
|
||||
*
|
||||
* $Revision: 1.14 $
|
||||
* $Revision: 1.15 $
|
||||
*
|
||||
* last change: $Author: rt $ $Date: 2007-07-26 08:54:46 $
|
||||
* last change: $Author: hr $ $Date: 2007-11-01 14:27:39 $
|
||||
*
|
||||
* The Contents of this file are made available subject to
|
||||
* the terms of GNU Lesser General Public License Version 2.1.
|
||||
|
@ -59,6 +59,15 @@ using namespace ::com::sun::star;
|
|||
using namespace ::com::sun::star::uno;
|
||||
using ::rtl::OUString;
|
||||
|
||||
|
||||
#define SOFFICE1 "soffice.exe"
|
||||
#define SOFFICE2 "soffice.bin"
|
||||
#define SBASE "sbase.exe"
|
||||
#define SCALC "scalc.exe"
|
||||
#define SDRAW "sdraw.exe"
|
||||
#define SIMPRESS "simpress.exe"
|
||||
#define SWRITER "swriter.exe"
|
||||
|
||||
namespace dp_misc {
|
||||
namespace {
|
||||
|
||||
|
@ -139,6 +148,16 @@ const OUString OfficePipeId::operator () ()
|
|||
return buf.makeStringAndClear();
|
||||
}
|
||||
|
||||
bool existsOfficePipe()
|
||||
{
|
||||
OUString const & pipeId = OfficePipeId::get();
|
||||
if (pipeId.getLength() == 0)
|
||||
return false;
|
||||
::osl::Security sec;
|
||||
::osl::Pipe pipe( pipeId, osl_Pipe_OPEN, sec );
|
||||
return pipe.is();
|
||||
}
|
||||
|
||||
} // anon namespace
|
||||
|
||||
//==============================================================================
|
||||
|
@ -252,12 +271,44 @@ OUString expandUnoRcUrl( OUString const & url )
|
|||
//==============================================================================
|
||||
bool office_is_running()
|
||||
{
|
||||
OUString const & pipeId = OfficePipeId::get();
|
||||
if (pipeId.getLength() == 0)
|
||||
return false;
|
||||
::osl::Security sec;
|
||||
::osl::Pipe pipe( pipeId, osl_Pipe_OPEN, sec );
|
||||
return pipe.is();
|
||||
//We need to check if we run within the office process. Then we must not use the pipe, because
|
||||
//this could cause a deadlock. This is actually a workaround for i82778
|
||||
OUString sFile;
|
||||
oslProcessError err = osl_getExecutableFile(& sFile.pData);
|
||||
bool ret = false;
|
||||
if (osl_Process_E_None == err)
|
||||
{
|
||||
sFile = sFile.copy(sFile.lastIndexOf('/') + 1);
|
||||
if (
|
||||
#if defined UNIX
|
||||
sFile.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(SOFFICE2)))
|
||||
#elif defined WNT
|
||||
//osl_getExecutableFile should deliver "soffice.bin" on windows
|
||||
//even if swriter.exe, scalc.exe etc. was started. This is a bug
|
||||
//in osl_getExecutableFile
|
||||
sFile.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(SOFFICE1)))
|
||||
|| sFile.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(SOFFICE2)))
|
||||
|| sFile.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(SBASE)))
|
||||
|| sFile.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(SCALC)))
|
||||
|| sFile.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(SDRAW)))
|
||||
|| sFile.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(SIMPRESS)))
|
||||
|| sFile.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(SWRITER)))
|
||||
#else
|
||||
#error "Unsupported platform"
|
||||
#endif
|
||||
|
||||
)
|
||||
ret = true;
|
||||
else
|
||||
ret = existsOfficePipe();
|
||||
}
|
||||
else
|
||||
{
|
||||
OSL_ENSURE(0, "NOT osl_Process_E_None ");
|
||||
//if osl_getExecutable file than we take the risk of creating a pipe
|
||||
ret = existsOfficePipe();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
Loading…
Reference in a new issue