CWS-TOOLING: rebase CWS printerpullpages to trunk@270723 (milestone: DEV300:m46)
This commit is contained in:
parent
5bf023a42d
commit
5b16a85b74
@ -2,6 +2,7 @@ mkdir: %COMMON_DEST%\bin%_EXT%\hid
|
||||
mkdir: %_DEST%\inc%_EXT%\automation
|
||||
|
||||
#..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid
|
||||
..\util\manually_added_ids.hid %COMMON_DEST%\bin%_EXT%\hid\manually_added_ids.hid
|
||||
..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
|
||||
..\%__SRC%\lib\lib* %_DEST%\lib%_EXT%\*
|
||||
..\%__SRC%\lib\ists.lib %_DEST%\lib%_EXT%\ists.lib
|
||||
|
15
automation/util/manually_added_ids.hid
Executable file
15
automation/util/manually_added_ids.hid
Executable file
@ -0,0 +1,15 @@
|
||||
|
||||
HDE_PDF_EXPORT_DLG 33375
|
||||
|
||||
MSC_Super_ID 123456
|
||||
MSC_Super_ID2 1234567
|
||||
MSC_Super_ID3 12345678
|
||||
|
||||
HID_OPTIONS_JAVA_LIST 39997
|
||||
|
||||
PDF1TBO 867876864
|
||||
PDF2TBO 867860480
|
||||
|
||||
FontWork1TBO 40026
|
||||
FontWork2TBO 40027
|
||||
|
@ -502,7 +502,17 @@ void DocumentHolder::InPlaceDeactivate(void)
|
||||
m_xLayoutManager->setVisible(false);
|
||||
|
||||
if (NULL!=m_pIOleIPSite)
|
||||
{
|
||||
// The following workaround should let the object be stored in case of inplace editing
|
||||
// CComPtr< IOleClientSite > pClientSite;
|
||||
//
|
||||
// m_pIOleIPSite->QueryInterface(
|
||||
// IID_IOleClientSite, (void**)&pClientSite );
|
||||
// if ( pClientSite )
|
||||
// pClientSite->SaveObject();
|
||||
|
||||
m_pIOleIPSite->OnInPlaceDeactivate();
|
||||
}
|
||||
|
||||
if(m_pIOleIPFrame) m_pIOleIPFrame->Release(); m_pIOleIPFrame = 0;
|
||||
if(m_pIOleIPUIWindow) m_pIOleIPUIWindow->Release(); m_pIOleIPUIWindow = 0;
|
||||
@ -512,7 +522,9 @@ void DocumentHolder::InPlaceDeactivate(void)
|
||||
{
|
||||
LockedEmbedDocument_Impl aDocLock = m_xOleAccess->GetEmbedDocument();
|
||||
if ( aDocLock.GetEmbedDocument() )
|
||||
{
|
||||
aDocLock.GetEmbedDocument()->SaveObject();
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -159,6 +159,11 @@ STDMETHODIMP EmbedDocument_Impl::DoVerb(
|
||||
if ( m_bIsInVerbHandling )
|
||||
return OLEOBJ_S_CANNOT_DOVERB_NOW;
|
||||
|
||||
// an object can not handle any Verbs in Hands off mode
|
||||
if ( m_pMasterStorage == NULL || m_pOwnStream == NULL )
|
||||
return OLE_E_CANT_BINDTOSOURCE;
|
||||
|
||||
|
||||
BooleanGuard_Impl aGuard( m_bIsInVerbHandling );
|
||||
|
||||
if ( iVerb == OLEIVERB_PRIMARY )
|
||||
@ -260,8 +265,9 @@ STDMETHODIMP EmbedDocument_Impl::EnumVerbs( IEnumOLEVERB ** /*ppEnumOleVerb*/ )
|
||||
|
||||
STDMETHODIMP EmbedDocument_Impl::Update()
|
||||
{
|
||||
HRESULT hr = CACHE_E_NOCACHE_UPDATED;
|
||||
return hr;
|
||||
return S_OK;
|
||||
// HRESULT hr = CACHE_E_NOCACHE_UPDATED;
|
||||
// return hr;
|
||||
}
|
||||
|
||||
STDMETHODIMP EmbedDocument_Impl::IsUpToDate()
|
||||
|
@ -146,31 +146,46 @@ STDMETHODIMP_(ULONG) OleWrapperAdviseSink::Release()
|
||||
STDMETHODIMP_(void) OleWrapperAdviseSink::OnDataChange( LPFORMATETC pFetc, LPSTGMEDIUM pMedium )
|
||||
{
|
||||
if ( m_pListener )
|
||||
{
|
||||
WRITEDEBUGINFO( "OleWrapperAdviseSink::OnDataChange():" );
|
||||
m_pListener->OnDataChange( pFetc, pMedium );
|
||||
}
|
||||
}
|
||||
|
||||
STDMETHODIMP_(void) OleWrapperAdviseSink::OnViewChange( DWORD dwAspect, LONG lindex )
|
||||
{
|
||||
if ( m_pListener )
|
||||
{
|
||||
WRITEDEBUGINFO( "OleWrapperAdviseSink::OnViewChange():" );
|
||||
m_pListener->OnViewChange( dwAspect, lindex );
|
||||
}
|
||||
}
|
||||
|
||||
STDMETHODIMP_(void) OleWrapperAdviseSink::OnRename( LPMONIKER pMoniker )
|
||||
{
|
||||
if ( m_pListener )
|
||||
{
|
||||
WRITEDEBUGINFO( "OleWrapperAdviseSink::OnRename():" );
|
||||
m_pListener->OnRename( pMoniker );
|
||||
}
|
||||
}
|
||||
|
||||
STDMETHODIMP_(void) OleWrapperAdviseSink::OnSave(void)
|
||||
{
|
||||
if ( m_pListener )
|
||||
{
|
||||
WRITEDEBUGINFO( "OleWrapperAdviseSink::OnSave():" );
|
||||
m_pListener->OnSave();
|
||||
}
|
||||
}
|
||||
|
||||
STDMETHODIMP_(void) OleWrapperAdviseSink::OnClose(void)
|
||||
{
|
||||
if ( m_pListener )
|
||||
{
|
||||
WRITEDEBUGINFO( "OleWrapperAdviseSink::OnClose():" );
|
||||
m_pListener->OnClose();
|
||||
}
|
||||
|
||||
if ( m_bHandleClosed )
|
||||
m_bClosed = TRUE;
|
||||
|
@ -82,6 +82,7 @@ public:
|
||||
FORMATETC* GetFormatEtc() { return m_pFormatEtc; }
|
||||
DWORD GetAspect() { return m_nAspect; }
|
||||
ComSmart< IAdviseSink >& GetOrigAdvise() { return m_pListener; }
|
||||
void DisconnectOrigAdvise() { m_pListener = NULL; }
|
||||
|
||||
void SetClosed() { m_bClosed = TRUE; }
|
||||
void UnsetClosed() { m_bClosed = FALSE; }
|
||||
|
@ -59,29 +59,44 @@ static ULONG g_nLock = 0;
|
||||
|
||||
|
||||
namespace {
|
||||
void FillCharFromInt( int nValue, char* pBuf, int nLen )
|
||||
{
|
||||
int nInd = 0;
|
||||
while( nInd < nLen )
|
||||
{
|
||||
char nSign = ( nValue / ( 1 << ( ( nLen - nInd ) * 4 ) ) ) % 16;
|
||||
if ( nSign >= 0 && nSign <= 9 )
|
||||
pBuf[nInd] = nSign + '0';
|
||||
else if ( nSign >= 10 && nSign <= 15 )
|
||||
pBuf[nInd] = nSign - 10 + 'a';
|
||||
|
||||
nInd++;
|
||||
}
|
||||
}
|
||||
|
||||
int GetStringFromClassID( const GUID& guid, char* pBuf, int nLen )
|
||||
{
|
||||
if ( nLen < 27 )
|
||||
// is not allowed to insert
|
||||
if ( nLen < 38 )
|
||||
return 0;
|
||||
|
||||
int nResult = sprintf( pBuf,
|
||||
"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
||||
guid.Data1,
|
||||
guid.Data2,
|
||||
guid.Data3,
|
||||
guid.Data4[0],
|
||||
guid.Data4[1],
|
||||
guid.Data4[2],
|
||||
guid.Data4[3],
|
||||
guid.Data4[4],
|
||||
guid.Data4[5],
|
||||
guid.Data4[6],
|
||||
guid.Data4[7] );
|
||||
pBuf[0] = '{';
|
||||
FillCharFromInt( guid.Data1, &pBuf[1], 8 );
|
||||
pBuf[9] = '-';
|
||||
FillCharFromInt( guid.Data2, &pBuf[10], 4 );
|
||||
pBuf[14] = '-';
|
||||
FillCharFromInt( guid.Data3, &pBuf[15], 4 );
|
||||
pBuf[19] = '-';
|
||||
|
||||
if ( nResult && nResult < nLen )
|
||||
return ++nResult;
|
||||
int nInd = 0;
|
||||
for ( nInd = 0; nInd < 2 ; nInd++ )
|
||||
FillCharFromInt( guid.Data4[nInd], &pBuf[20 + 2*nInd], 2 );
|
||||
pBuf[24] = '-';
|
||||
for ( nInd = 2; nInd < 8 ; nInd++ )
|
||||
FillCharFromInt( guid.Data4[nInd], &pBuf[20 + 1 + 2*nInd], 2 );
|
||||
pBuf[37] = '}';
|
||||
|
||||
return 0;
|
||||
return 38;
|
||||
}
|
||||
|
||||
HRESULT WriteLibraryToRegistry( char* pLibrary, DWORD nLen )
|
||||
@ -90,21 +105,17 @@ namespace {
|
||||
if ( pLibrary && nLen )
|
||||
{
|
||||
HKEY hKey = NULL;
|
||||
char* pPrefix = "Software\\Classes\\CLSID\\";
|
||||
char* pPostfix = "\\InprocHandler32";
|
||||
|
||||
hRes = S_OK;
|
||||
for ( int nInd = 0; nInd < SUPPORTED_FACTORIES_NUM; nInd++ )
|
||||
{
|
||||
char pSubKey[513];
|
||||
char pCLSID[64];
|
||||
int nGuidLen = GetStringFromClassID( *guidList[nInd], pCLSID, 64 );
|
||||
char* pSubKey = "Software\\Classes\\CLSID\\.....................................\\InprocHandler32";
|
||||
|
||||
int nGuidLen = GetStringFromClassID( *guidList[nInd], &pSubKey[23], 38 );
|
||||
|
||||
BOOL bLocalSuccess = FALSE;
|
||||
if ( nGuidLen && nGuidLen < 64 )
|
||||
if ( nGuidLen && nGuidLen == 38 )
|
||||
{
|
||||
pCLSID[nGuidLen] = 0;
|
||||
sprintf( pSubKey, "%s%s%s", pPrefix, pCLSID, pPostfix );
|
||||
if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, pSubKey, &hKey ) )
|
||||
{
|
||||
if ( ERROR_SUCCESS == RegSetValueEx( hKey, "", 0, REG_SZ, (const BYTE*)pLibrary, nLen ) )
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -93,6 +93,7 @@ class InprocEmbedDocument_Impl : public InprocCountedObject_Impl
|
||||
ComSmart< IStorage > m_pStorage;
|
||||
|
||||
ComSmart< IOleClientSite > m_pClientSite;
|
||||
ComSmart< IOleContainer > m_pOleContainer;
|
||||
|
||||
ULONG m_nCallsOnStack;
|
||||
|
||||
@ -148,7 +149,7 @@ public:
|
||||
{}
|
||||
|
||||
HRESULT Init();
|
||||
void SetFileName( LPCOLESTR pszFileName );
|
||||
void SetName( LPCOLESTR pszNameFromOutside, wchar_t*& pOwnName );
|
||||
|
||||
BOOL CheckDefHandler();
|
||||
ComSmart< IUnknown >& GetDefHandler() { return m_pDefHandler; }
|
||||
|
@ -46,6 +46,8 @@ use_shl_versions=
|
||||
|
||||
LIBTARGET=NO
|
||||
USE_DEFFILE=YES
|
||||
LIBCMT=libcmt.lib
|
||||
UWINAPILIB=
|
||||
|
||||
# --- Files -------------------------------------
|
||||
|
||||
|
@ -36,8 +36,24 @@
|
||||
#ifndef _INPROCSERV_SMARTPOINTER_HXX_
|
||||
#define _INPROCSERV_SMARTPOINTER_HXX_
|
||||
|
||||
// #define OWNDEBUG
|
||||
|
||||
#ifdef OWNDEBUG
|
||||
#define WRITEDEBUGINFOINTERN( x ) WriteDebugInfo( (DWORD)this, x, sizeof( x ) )
|
||||
#define WRITEDEBUGINFO( x ) WRITEDEBUGINFOINTERN( x ":" MY_STRING_LINE "\n" )
|
||||
#define TO_STRING( x ) #x
|
||||
#define MACRO_VALUE_TO_STRING( x ) TO_STRING( x )
|
||||
#define MY_STRING_LINE MACRO_VALUE_TO_STRING( __LINE__ )
|
||||
#else
|
||||
#define WRITEDEBUGINFO( x ) void()
|
||||
#define MY_STRING_LINE
|
||||
#endif
|
||||
|
||||
|
||||
namespace inprocserv{
|
||||
|
||||
void WriteDebugInfo( DWORD pThis, char* pString, DWORD nToWrite );
|
||||
|
||||
template< class T > class ComSmart
|
||||
{
|
||||
T* m_pInterface;
|
||||
|
@ -43,9 +43,14 @@
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <comphelper/uieventslogger.hxx>
|
||||
#include <cppuhelper/implbase3.hxx>
|
||||
#include <svx/optimprove.hxx>
|
||||
#include <svx/svxdlg.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vos/mutex.hxx>
|
||||
#include <svtools/itemset.hxx>
|
||||
#include <svtools/stritem.hxx>
|
||||
#include <sfx2/app.hxx>
|
||||
#include <svx/dialogs.hrc>
|
||||
#include <sfx2/sfxsids.hrc>
|
||||
|
||||
using namespace ::com::sun::star::oooimprovement;
|
||||
using ::com::sun::star::frame::XTerminateListener;
|
||||
@ -129,11 +134,17 @@ namespace oooimprovecore
|
||||
::comphelper::ConfigurationHelper::E_READONLY) >>= help_url;
|
||||
else
|
||||
help_url = OUString::createFromAscii("http://www.openoffice.org");
|
||||
|
||||
{
|
||||
::vos::OGuard aGuard( Application::GetSolarMutex() );
|
||||
SvxImprovementDialog dlg(NULL, help_url);
|
||||
dlg.Execute();
|
||||
SfxAllItemSet aSet( SFX_APP()->GetPool() );
|
||||
aSet.Put( SfxStringItem( SID_CURRENT_URL, help_url ) );
|
||||
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
|
||||
if ( pFact )
|
||||
{
|
||||
AbstractSfxSingleTabDialog *pDlg = pFact->CreateSfxSingleTabDialog( NULL, aSet, 0, RID_SVXPAGE_IMPROVEMENT );
|
||||
pDlg->Execute();
|
||||
delete pDlg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,10 +58,12 @@ SHL1STDLIBS= \
|
||||
$(CPPUHELPERLIB) \
|
||||
$(CPPULIB) \
|
||||
$(SALLIB) \
|
||||
$(SVXLIB) \
|
||||
$(VCLLIB) \
|
||||
$(SVLLIB) \
|
||||
$(SVTOOLLIB) \
|
||||
$(SFXLIB) \
|
||||
$(TOOLSLIB) \
|
||||
$(SVXLIB) \
|
||||
$(TOOLSLIB)
|
||||
|
||||
|
||||
SHL1LIBS=$(LIB1TARGET)
|
||||
|
@ -28,236 +28,572 @@
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#include <cstdarg>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <osl/thread.h>
|
||||
#include <rtl/strbuf.hxx>
|
||||
#include "rtl/ustrbuf.hxx"
|
||||
#include "rtl/strbuf.hxx"
|
||||
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <plugin/impl.hxx>
|
||||
#include "plugin/impl.hxx"
|
||||
#include "osl/file.h"
|
||||
#include "osl/module.hxx"
|
||||
|
||||
using namespace rtl;
|
||||
using namespace std;
|
||||
using namespace com::sun::star::uno;
|
||||
using namespace com::sun::star::plugin;
|
||||
|
||||
// Unix specific implementation
|
||||
static bool CheckPlugin( const ByteString& rPath, list< PluginDescription* >& rDescriptions )
|
||||
namespace plugstringhelper
|
||||
{
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf( stderr, "Trying plugin %s ... ", rPath.GetBuffer() );
|
||||
#endif
|
||||
|
||||
xub_StrLen nPos = rPath.SearchBackward( '/' );
|
||||
if( nPos == STRING_NOTFOUND )
|
||||
rtl::OUString getString( CFStringRef i_xString )
|
||||
{
|
||||
rtl::OUStringBuffer aBuf;
|
||||
if( i_xString )
|
||||
{
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf( stderr, "no absolute path to plugin\n" );
|
||||
#endif
|
||||
return false;
|
||||
CFIndex nChars = CFStringGetLength( i_xString );
|
||||
CFRange aRange = { 0, nChars };
|
||||
aBuf.setLength( nChars );
|
||||
CFStringGetCharacters( i_xString, aRange, static_cast< UniChar* >(const_cast<sal_Unicode*>(aBuf.getStr())) );
|
||||
}
|
||||
return aBuf.makeStringAndClear();
|
||||
}
|
||||
|
||||
rtl::OUString getString( CFURLRef i_xURL )
|
||||
{
|
||||
CFStringRef xString = CFURLGetString( i_xURL );
|
||||
return getString( xString );
|
||||
}
|
||||
|
||||
CFMutableStringRef createString( const rtl::OUString& i_rString )
|
||||
{
|
||||
CFMutableStringRef xString = CFStringCreateMutable( NULL, 0 );
|
||||
if( xString )
|
||||
CFStringAppendCharacters( xString, i_rString.getStr(), i_rString.getLength() );
|
||||
return xString;
|
||||
}
|
||||
|
||||
CFURLRef createURL( const rtl::OUString& i_rString )
|
||||
{
|
||||
|
||||
CFMutableStringRef xMutableString = createString( i_rString );
|
||||
CFURLRef xURL = CFURLCreateWithString( NULL, xMutableString, NULL );
|
||||
CFRelease( xMutableString );
|
||||
return xURL;
|
||||
}
|
||||
|
||||
rtl::OUString getURLFromPath( const rtl::OUString& i_rPath )
|
||||
{
|
||||
CFMutableStringRef xMutableString = createString( i_rPath );
|
||||
CFURLRef xURL = CFURLCreateWithFileSystemPath( NULL, xMutableString, kCFURLPOSIXPathStyle, true );
|
||||
CFRelease( xMutableString );
|
||||
CFStringRef xString = CFURLGetString( xURL );
|
||||
rtl::OUString aRet = getString( xString );
|
||||
CFRelease( xURL );
|
||||
return aRet;
|
||||
}
|
||||
|
||||
CFURLRef createURLFromPath( const rtl::OUString& i_rPath )
|
||||
{
|
||||
CFMutableStringRef xMutableString = createString( i_rPath );
|
||||
CFURLRef xURL = CFURLCreateWithFileSystemPath( NULL, xMutableString, kCFURLPOSIXPathStyle, true );
|
||||
return xURL;
|
||||
}
|
||||
|
||||
rtl::OUString CFURLtoOSLURL( CFURLRef i_xURL )
|
||||
{
|
||||
// make URL absolute
|
||||
CFURLRef xAbsURL = CFURLCopyAbsoluteURL( i_xURL );
|
||||
// copy system path
|
||||
CFStringRef xSysPath = CFURLCopyFileSystemPath( xAbsURL ? xAbsURL : i_xURL, kCFURLPOSIXPathStyle );
|
||||
if( xAbsURL )
|
||||
CFRelease( xAbsURL );
|
||||
rtl::OUString aSysPath( getString( xSysPath ) );
|
||||
CFRelease( xSysPath );
|
||||
rtl::OUString aFileURL;
|
||||
osl_getFileURLFromSystemPath( aSysPath.pData, &aFileURL.pData );
|
||||
return aFileURL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
using namespace plugstringhelper;
|
||||
|
||||
static int parsePlist( CFBundleRef i_xBundle, const rtl::OUString& i_rBundleURL , list< PluginDescription* >& io_rDescriptions )
|
||||
{
|
||||
CFTypeRef xMimeDict = CFBundleGetValueForInfoDictionaryKey( i_xBundle, CFSTR("WebPluginMIMETypes"));
|
||||
int nMimetypes = 0;
|
||||
if( xMimeDict == 0 ||
|
||||
CFGetTypeID(xMimeDict) != CFDictionaryGetTypeID() ||
|
||||
(nMimetypes = CFDictionaryGetCount( static_cast<CFDictionaryRef>(xMimeDict))) <= 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ByteString aBaseName = rPath.Copy( nPos+1 );
|
||||
if( aBaseName.Equals( "libnullplugin.so" ) )
|
||||
// prepare an array of key and value refs
|
||||
std::vector< CFTypeRef > aKeys( nMimetypes, CFTypeRef(NULL) );
|
||||
std::vector< CFTypeRef > aValues( nMimetypes, CFTypeRef(NULL) );
|
||||
CFDictionaryGetKeysAndValues(static_cast<CFDictionaryRef>(xMimeDict), &aKeys[0], &aValues[0] );
|
||||
|
||||
int nAdded = 0;
|
||||
for( int i = 0; i < nMimetypes; i++ )
|
||||
{
|
||||
// get the mimetype
|
||||
CFTypeRef xKey = aKeys[i];
|
||||
if( ! xKey || CFGetTypeID(xKey) != CFStringGetTypeID() )
|
||||
continue;
|
||||
rtl::OUString aMimetype = getString( (CFStringRef)xKey );
|
||||
|
||||
// the correspoding value should be a dictionary
|
||||
CFTypeRef xDict = aValues[i];
|
||||
if( ! xDict || CFGetTypeID( xDict ) != CFDictionaryGetTypeID() )
|
||||
continue;
|
||||
|
||||
// get the extension list
|
||||
CFTypeRef xExtArray = CFDictionaryGetValue( (CFDictionaryRef)xDict, CFSTR("WebPluginExtensions" ) );
|
||||
if( !xExtArray || CFGetTypeID( xExtArray ) != CFArrayGetTypeID() )
|
||||
continue;
|
||||
|
||||
OUStringBuffer aExtBuf;
|
||||
int nExtensions = CFArrayGetCount( (CFArrayRef)xExtArray );
|
||||
for( int n = 0; n < nExtensions; n++ )
|
||||
{
|
||||
CFTypeRef xExt = CFArrayGetValueAtIndex( (CFArrayRef)xExtArray, n );
|
||||
if( xExt && CFGetTypeID( xExt ) == CFStringGetTypeID() )
|
||||
{
|
||||
if( aExtBuf.getLength() > 0 )
|
||||
aExtBuf.append( sal_Unicode(';') );
|
||||
OUString aExt( getString( (CFStringRef)xExt ) );
|
||||
if( aExt.indexOfAsciiL( "*.", 2 ) != 0 )
|
||||
aExtBuf.appendAscii( "*." );
|
||||
aExtBuf.append( aExt );
|
||||
}
|
||||
}
|
||||
|
||||
// get the description string
|
||||
CFTypeRef xDescString = CFDictionaryGetValue( (CFDictionaryRef)xDict, CFSTR("WebPluginTypeDescription" ) );
|
||||
if( !xDescString || CFGetTypeID( xDescString ) != CFStringGetTypeID() )
|
||||
continue;
|
||||
rtl::OUString aDescription = getString( (CFStringRef)xDescString );
|
||||
|
||||
PluginDescription* pNew = new PluginDescription;
|
||||
// set plugin name (path to library)
|
||||
pNew->PluginName = i_rBundleURL;
|
||||
// set mimetype
|
||||
pNew->Mimetype = aMimetype;
|
||||
// set extension line
|
||||
pNew->Extension = aExtBuf.makeStringAndClear();
|
||||
// set description
|
||||
pNew->Description= aDescription;
|
||||
|
||||
io_rDescriptions.push_back( pNew );
|
||||
nAdded++;
|
||||
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf( stderr, "don't like %s\n", aBaseName.GetBuffer() );
|
||||
fprintf( stderr,
|
||||
"Inserting from PList:\n"
|
||||
" Mimetype: %s\n"
|
||||
" Extension: %s\n"
|
||||
" Description: %s\n",
|
||||
OUStringToOString( pNew->Mimetype, RTL_TEXTENCODING_UTF8 ).getStr(),
|
||||
OUStringToOString( pNew->Extension, RTL_TEXTENCODING_UTF8 ).getStr(),
|
||||
OUStringToOString( pNew->Description, RTL_TEXTENCODING_UTF8 ).getStr()
|
||||
);
|
||||
#endif
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
struct stat aStat;
|
||||
if( stat( rPath.GetBuffer(), &aStat ) || ! S_ISREG( aStat.st_mode ) )
|
||||
{
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf( stderr, "%s is not a regular file\n", rPath.GetBuffer() );
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
return nAdded;
|
||||
}
|
||||
|
||||
static int parseMimeString( const rtl::OUString& i_rBundleURL , list< PluginDescription* >& io_rDescriptions, const char* i_pMime )
|
||||
{
|
||||
if( ! i_pMime )
|
||||
return 0;
|
||||
|
||||
rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
|
||||
|
||||
ByteString aCommand( "pluginapp.bin \"" );
|
||||
aCommand.Append( rPath );
|
||||
aCommand.Append( '"' );
|
||||
OStringBuffer aMIME;
|
||||
aMIME.append( i_pMime );
|
||||
|
||||
FILE* pResult = popen( aCommand.GetBuffer(), "r" );
|
||||
int nDescriptions = 0;
|
||||
if( pResult )
|
||||
if( aMIME.getLength() < 1 )
|
||||
return 0;
|
||||
|
||||
OString aLine = aMIME.makeStringAndClear();
|
||||
|
||||
int nAdded = 0;
|
||||
sal_Int32 nIndex = 0;
|
||||
while( nIndex != -1 )
|
||||
{
|
||||
OStringBuffer aMIME;
|
||||
char buf[256];
|
||||
while( fgets( buf, sizeof( buf ), pResult ) )
|
||||
OString aType = aLine.getToken( 0, ';', nIndex );
|
||||
|
||||
sal_Int32 nTypeIndex = 0;
|
||||
OString aMimetype = aType.getToken( 0, ':', nTypeIndex );
|
||||
OString aExtLine = aType.getToken( 0, ':', nTypeIndex );
|
||||
if( nTypeIndex < 0 ) // ensure at least three tokens
|
||||
continue;
|
||||
OString aDesc = aType.getToken( 0, ':', nTypeIndex );
|
||||
|
||||
// create extension list string
|
||||
sal_Int32 nExtIndex = 0;
|
||||
OStringBuffer aExtension;
|
||||
while( nExtIndex != -1 )
|
||||
{
|
||||
for( size_t i = 0; i < sizeof(buf) && buf[i]; ++i )
|
||||
{
|
||||
if( buf[i] == '\n' )
|
||||
buf[i] = ';';
|
||||
}
|
||||
aMIME.append( buf );
|
||||
OString aExt = aExtLine.getToken( 0, ',', nExtIndex);
|
||||
if( aExt.indexOf( "*." ) != 0 )
|
||||
aExtension.append( "*." );
|
||||
aExtension.append( aExt );
|
||||
if( nExtIndex != -1 )
|
||||
aExtension.append( ';' );
|
||||
}
|
||||
pclose( pResult );
|
||||
|
||||
if( aMIME.getLength() > 0 )
|
||||
{
|
||||
OString aLine = aMIME.makeStringAndClear();
|
||||
PluginDescription* pNew = new PluginDescription;
|
||||
// set plugin name (path to library)
|
||||
pNew->PluginName = i_rBundleURL;
|
||||
// set mimetype
|
||||
pNew->Mimetype = OStringToOUString( aMimetype, aEncoding );
|
||||
// set extension line
|
||||
pNew->Extension = OStringToOUString( aExtension.makeStringAndClear(), aEncoding );
|
||||
// set description
|
||||
pNew->Description= OStringToOUString( aDesc, aEncoding );
|
||||
io_rDescriptions.push_back( pNew );
|
||||
nAdded++;
|
||||
|
||||
sal_Int32 nIndex = 0;
|
||||
while( nIndex != -1 )
|
||||
{
|
||||
OString aType = aLine.getToken( 0, ';', nIndex );
|
||||
|
||||
sal_Int32 nTypeIndex = 0;
|
||||
OString aMimetype = aType.getToken( 0, ':', nTypeIndex );
|
||||
OString aExtLine = aType.getToken( 0, ':', nTypeIndex );
|
||||
if( nTypeIndex < 0 ) // ensure at least three tokens
|
||||
continue;
|
||||
OString aDesc = aType.getToken( 0, ':', nTypeIndex );
|
||||
|
||||
// create extension list string
|
||||
sal_Int32 nExtIndex = 0;
|
||||
OStringBuffer aExtension;
|
||||
while( nExtIndex != -1 )
|
||||
{
|
||||
OString aExt = aExtLine.getToken( 0, ',', nExtIndex);
|
||||
if( aExt.indexOf( "*." ) != 0 )
|
||||
aExtension.append( "*." );
|
||||
aExtension.append( aExt );
|
||||
if( nExtIndex != -1 )
|
||||
aExtension.append( ';' );
|
||||
}
|
||||
|
||||
PluginDescription* pNew = new PluginDescription;
|
||||
// set plugin name (path to library)
|
||||
pNew->PluginName = OStringToOUString( rPath, aEncoding );
|
||||
// set mimetype
|
||||
pNew->Mimetype = OStringToOUString( aMimetype, aEncoding );
|
||||
// set extension line
|
||||
pNew->Extension = OStringToOUString( aExtension.makeStringAndClear(), aEncoding );
|
||||
// set description
|
||||
pNew->Description= OStringToOUString( aDesc, aEncoding );
|
||||
rDescriptions.push_back( pNew );
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf( stderr, "Mimetype: %s\nExtension: %s\n"
|
||||
"Description: %s\n",
|
||||
OUStringToOString( pNew->Mimetype, aEncoding ).getStr(),
|
||||
OUStringToOString( pNew->Extension, aEncoding ).getStr(),
|
||||
OUStringToOString( pNew->Description, aEncoding ).getStr()
|
||||
);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
else
|
||||
fprintf( stderr, "result of \"%s\" contains no mimtype\n",
|
||||
aCommand.GetBuffer() );
|
||||
fprintf( stderr,
|
||||
"Inserting from mime string:\n"
|
||||
" Mimetype: %s\n"
|
||||
" Extension: %s\n"
|
||||
" Description: %s\n",
|
||||
OUStringToOString( pNew->Mimetype, aEncoding ).getStr(),
|
||||
OUStringToOString( pNew->Extension, aEncoding ).getStr(),
|
||||
OUStringToOString( pNew->Description, aEncoding ).getStr()
|
||||
);
|
||||
#endif
|
||||
}
|
||||
return nAdded;
|
||||
}
|
||||
|
||||
// this is so ugly it you want to tear your eyes out
|
||||
static rtl::OUString GetNextPluginStringFromHandle(Handle h, short *index)
|
||||
{
|
||||
char* pPascalBytes = (*h + *index);
|
||||
sal_uInt32 nLen = (unsigned char)pPascalBytes[0];
|
||||
rtl::OStringBuffer aBuf( nLen );
|
||||
aBuf.append( pPascalBytes+1, nLen );
|
||||
*index += nLen + 1;
|
||||
return rtl::OStringToOUString( aBuf.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
|
||||
}
|
||||
|
||||
static int parseMimeResource( CFBundleRef i_xBundle,
|
||||
oslModule& i_rMod,
|
||||
const rtl::OUString& i_rBundleURL,
|
||||
list< PluginDescription* >& io_rDescriptions )
|
||||
{
|
||||
int nAdded = 0;
|
||||
// just to hurt our eyes more there is an alternative mimetype function plus the possibility
|
||||
// of a resource fork. Must be a case of think different.
|
||||
#if __LP64__
|
||||
int
|
||||
#else
|
||||
SInt16
|
||||
#endif
|
||||
xRes = 0;
|
||||
BPSupportedMIMETypes aMIMETypesStrangeStruct = {kBPSupportedMIMETypesStructVers_1, NULL, NULL};
|
||||
|
||||
BP_GetSupportedMIMETypesUPP pBPGetSupp = (BP_GetSupportedMIMETypesUPP)osl_getAsciiFunctionSymbol( i_rMod, "BP_GetSupportedMIMETypes" );
|
||||
if( pBPGetSupp &&
|
||||
noErr == pBPGetSupp( &aMIMETypesStrangeStruct, 0 ) &&
|
||||
aMIMETypesStrangeStruct.typeStrings )
|
||||
{
|
||||
HLock( aMIMETypesStrangeStruct.typeStrings );
|
||||
if( aMIMETypesStrangeStruct.infoStrings ) // it's possible some plugins have infoStrings missing
|
||||
HLock( aMIMETypesStrangeStruct.infoStrings );
|
||||
}
|
||||
else // Try to get data from the resource fork
|
||||
{
|
||||
xRes = CFBundleOpenBundleResourceMap( i_xBundle );
|
||||
if( xRes > 0 )
|
||||
{
|
||||
aMIMETypesStrangeStruct.typeStrings = Get1Resource('STR#', 128);
|
||||
if( aMIMETypesStrangeStruct.typeStrings )
|
||||
{
|
||||
DetachResource( aMIMETypesStrangeStruct.typeStrings );
|
||||
HLock( aMIMETypesStrangeStruct.typeStrings );
|
||||
aMIMETypesStrangeStruct.infoStrings = Get1Resource('STR#', 127);
|
||||
if( aMIMETypesStrangeStruct.infoStrings )
|
||||
{
|
||||
DetachResource( aMIMETypesStrangeStruct.infoStrings );
|
||||
HLock( aMIMETypesStrangeStruct.infoStrings );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( aMIMETypesStrangeStruct.typeStrings && aMIMETypesStrangeStruct.infoStrings )
|
||||
{
|
||||
short nVariantCount = (**(short**)aMIMETypesStrangeStruct.typeStrings) / 2;
|
||||
// Fill in the info struct based on the data in the BPSupportedMIMETypes struct
|
||||
// this is an array of pascal string of unknown (!) encoding
|
||||
// whoever thought of this deserves a fair beating
|
||||
short mimeIndex = 2;
|
||||
short descriptionIndex = 2;
|
||||
for( int i = 0; i < nVariantCount; i++ )
|
||||
{
|
||||
rtl::OUString aMimetype = GetNextPluginStringFromHandle( aMIMETypesStrangeStruct.typeStrings, &mimeIndex );
|
||||
rtl::OUString aExtLine = GetNextPluginStringFromHandle( aMIMETypesStrangeStruct.typeStrings, &mimeIndex );
|
||||
rtl::OUString aDescription;
|
||||
if( aMIMETypesStrangeStruct.infoStrings )
|
||||
aDescription = GetNextPluginStringFromHandle( aMIMETypesStrangeStruct.infoStrings, &descriptionIndex );
|
||||
|
||||
// create extension list string
|
||||
sal_Int32 nExtIndex = 0;
|
||||
OUStringBuffer aExtension;
|
||||
while( nExtIndex != -1 )
|
||||
{
|
||||
OUString aExt = aExtLine.getToken( 0, ',', nExtIndex);
|
||||
if( aExt.indexOfAsciiL( "*.", 2 ) != 0 )
|
||||
aExtension.appendAscii( "*." );
|
||||
aExtension.append( aExt );
|
||||
if( nExtIndex != -1 )
|
||||
aExtension.append( sal_Unicode(';') );
|
||||
}
|
||||
|
||||
PluginDescription* pNew = new PluginDescription;
|
||||
// set plugin name (path to library)
|
||||
pNew->PluginName = i_rBundleURL;
|
||||
// set mimetype
|
||||
pNew->Mimetype = aMimetype;
|
||||
// set extension line
|
||||
pNew->Extension = aExtension.makeStringAndClear();
|
||||
// set description
|
||||
pNew->Description= aDescription;
|
||||
io_rDescriptions.push_back( pNew );
|
||||
nAdded++;
|
||||
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf( stderr,
|
||||
"Inserting from resource:\n"
|
||||
" Mimetype: %s\n"
|
||||
" Extension: %s\n"
|
||||
" Description: %s\n",
|
||||
OUStringToOString( pNew->Mimetype, RTL_TEXTENCODING_UTF8 ).getStr(),
|
||||
OUStringToOString( pNew->Extension, RTL_TEXTENCODING_UTF8 ).getStr(),
|
||||
OUStringToOString( pNew->Description, RTL_TEXTENCODING_UTF8 ).getStr()
|
||||
);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// clean up
|
||||
if( aMIMETypesStrangeStruct.typeStrings )
|
||||
{
|
||||
HUnlock( aMIMETypesStrangeStruct.typeStrings );
|
||||
DisposeHandle( aMIMETypesStrangeStruct.typeStrings );
|
||||
}
|
||||
if( aMIMETypesStrangeStruct.infoStrings )
|
||||
{
|
||||
HUnlock( aMIMETypesStrangeStruct.infoStrings );
|
||||
DisposeHandle( aMIMETypesStrangeStruct.infoStrings );
|
||||
}
|
||||
if( xRes )
|
||||
CFBundleCloseBundleResourceMap( i_xBundle, xRes );
|
||||
|
||||
return nAdded;
|
||||
}
|
||||
|
||||
static int getPluginDescriptions( CFBundleRef i_xBundle , list< PluginDescription* >& io_rDescriptions )
|
||||
{
|
||||
int nDescriptions = 0;
|
||||
if( ! i_xBundle )
|
||||
return nDescriptions;
|
||||
|
||||
rtl::OUString aPlugURL;
|
||||
CFURLRef xURL = CFBundleCopyBundleURL( i_xBundle );
|
||||
aPlugURL = getString( xURL );
|
||||
CFRelease( xURL );
|
||||
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
rtl::OUString aPlugName, aPlugDescription;
|
||||
CFTypeRef name = CFBundleGetValueForInfoDictionaryKey( i_xBundle, CFSTR("WebPluginName"));
|
||||
if( name && CFGetTypeID(name) == CFStringGetTypeID() )
|
||||
aPlugName = getString( static_cast<CFStringRef>(name) );
|
||||
|
||||
CFTypeRef description = CFBundleGetValueForInfoDictionaryKey( i_xBundle, CFSTR("WebPluginDescription"));
|
||||
if( description && CFGetTypeID(description) == CFStringGetTypeID() )
|
||||
aPlugDescription = getString( static_cast<CFStringRef>(description) );
|
||||
|
||||
fprintf( stderr, "URL: %s\nname: %s\ndescription: %s\n",
|
||||
rtl::OUStringToOString( aPlugURL, RTL_TEXTENCODING_UTF8 ).getStr(),
|
||||
rtl::OUStringToOString( aPlugName, RTL_TEXTENCODING_UTF8 ).getStr(),
|
||||
rtl::OUStringToOString( aPlugDescription, RTL_TEXTENCODING_UTF8 ).getStr() );
|
||||
#endif
|
||||
|
||||
|
||||
// get location of plugin library
|
||||
CFURLRef xLibURL = CFBundleCopyExecutableURL( i_xBundle );
|
||||
if( ! xLibURL )
|
||||
return 0;
|
||||
// get the file system path
|
||||
rtl::OUString aModuleURL( CFURLtoOSLURL( xLibURL ) );
|
||||
CFRelease( xLibURL );
|
||||
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf( stderr, "exec URL = %s\n", rtl::OUStringToOString( aModuleURL, RTL_TEXTENCODING_UTF8 ).getStr() );
|
||||
#endif
|
||||
|
||||
/* TODO: originally the C++ wrapper for oslModule was used here, but that led to
|
||||
mysterious crashes in the event loop (pointing to heap corruption). Why using
|
||||
the C style oslModule should fix this is completely unknown. It may be that
|
||||
we have just hidden the heap corruption a little more.
|
||||
*/
|
||||
oslModule aMod = osl_loadModule( aModuleURL.pData, SAL_LOADMODULE_DEFAULT );
|
||||
if( ! aMod )
|
||||
return 0;
|
||||
|
||||
// check for at least the init function of a plugin
|
||||
if( ! osl_getAsciiFunctionSymbol( aMod, "NP_Initialize") &&
|
||||
! osl_getAsciiFunctionSymbol( aMod, "NP_GetEntryPoints" ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ask the plist of the bundle for mimetypes
|
||||
nDescriptions = parsePlist( i_xBundle, aPlugURL, io_rDescriptions );
|
||||
if( nDescriptions )
|
||||
{
|
||||
osl_unloadModule( aMod );
|
||||
return nDescriptions;
|
||||
}
|
||||
|
||||
// resolve the symbol that might get us the mimetypes
|
||||
const char* (*pGetMimeDescription)() = (const char*(*)())osl_getAsciiFunctionSymbol( aMod, "_NP_GetMIMEDescription" );
|
||||
if( pGetMimeDescription )
|
||||
{
|
||||
const char* pMime = pGetMimeDescription();
|
||||
if( pMime )
|
||||
{
|
||||
nDescriptions = parseMimeString( aPlugURL, io_rDescriptions, pMime );
|
||||
if( nDescriptions )
|
||||
{
|
||||
osl_unloadModule( aMod );
|
||||
return nDescriptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// and as last resort check the resource of the bundle
|
||||
nDescriptions = parseMimeResource( i_xBundle, aMod, aPlugURL, io_rDescriptions );
|
||||
osl_unloadModule( aMod );
|
||||
|
||||
return nDescriptions;
|
||||
}
|
||||
|
||||
// Unix specific implementation
|
||||
static bool CheckPlugin( const rtl::OUString& rPath, list< PluginDescription* >& rDescriptions )
|
||||
{
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
else
|
||||
fprintf( stderr, "command \"%s\" failed\n", aCommand.GetBuffer() );
|
||||
fprintf( stderr, "Trying path %s ... ", rtl::OUStringToOString( rPath, RTL_TEXTENCODING_UTF8 ).getStr() );
|
||||
#endif
|
||||
CFURLRef xURL = createURL( rPath );
|
||||
|
||||
CFArrayRef xBundles = CFBundleCreateBundlesFromDirectory( NULL, xURL, CFSTR("plugin") );
|
||||
if( ! xBundles )
|
||||
return false;
|
||||
|
||||
CFIndex nBundles = CFArrayGetCount( xBundles );
|
||||
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf( stderr, "got %d bundles\n", (int)nBundles );
|
||||
#endif
|
||||
|
||||
int nDescriptions = 0;
|
||||
for( CFIndex i = 0; i < nBundles; i++ )
|
||||
{
|
||||
CFBundleRef xBundle = (CFBundleRef)CFArrayGetValueAtIndex( xBundles, i );
|
||||
nDescriptions += getPluginDescriptions( xBundle, rDescriptions );
|
||||
|
||||
CFRelease( xBundle );
|
||||
}
|
||||
CFRelease( xBundles );
|
||||
|
||||
|
||||
return nDescriptions > 0;
|
||||
}
|
||||
|
||||
static rtl::OUString FindFolderURL( FSVolumeRefNum vRefNum, OSType folderType )
|
||||
{
|
||||
rtl::OUString aRet;
|
||||
|
||||
FSRef aFSRef;
|
||||
OSErr err = FSFindFolder( vRefNum, folderType, kDontCreateFolder, &aFSRef );
|
||||
if( err == noErr )
|
||||
{
|
||||
CFURLRef xURL = CFURLCreateFromFSRef( NULL, &aFSRef );
|
||||
aRet = getString( xURL );
|
||||
CFRelease( xURL );
|
||||
}
|
||||
|
||||
return aRet;
|
||||
}
|
||||
|
||||
Sequence<PluginDescription> XPluginManager_Impl::getPluginDescriptions() throw()
|
||||
{
|
||||
static Sequence<PluginDescription> aDescriptions;
|
||||
static BOOL bHavePlugins = FALSE;
|
||||
if( ! bHavePlugins )
|
||||
{
|
||||
rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
|
||||
list<PluginDescription*> aPlugins;
|
||||
int i;
|
||||
std::list<PluginDescription*> aPlugins;
|
||||
|
||||
// unix: search for plugins in /usr/lib/netscape/plugins,
|
||||
// ~/.netscape/plugins und NPX_PLUGIN_PATH
|
||||
// additionally: search in PluginsPath
|
||||
static const char* pHome = getenv( "HOME" );
|
||||
static const char* pNPXPluginPath = getenv( "NPX_PLUGIN_PATH" );
|
||||
static const char* pNPXPluginPath = getenv( "MOZ_PLUGIN_PATH" );
|
||||
|
||||
ByteString aSearchPath( "/usr/lib/netscape/plugins" );
|
||||
if( pHome )
|
||||
{
|
||||
aSearchPath.Append( ':' );
|
||||
aSearchPath.Append( pHome );
|
||||
aSearchPath += "/.netscape/plugins";
|
||||
}
|
||||
// get directories
|
||||
std::list< rtl::OUString > aPaths;
|
||||
if( pNPXPluginPath )
|
||||
{
|
||||
aSearchPath.Append( ':' );
|
||||
aSearchPath += pNPXPluginPath;
|
||||
CFMutableStringRef xMutableString = CFStringCreateMutable( NULL, 0 );
|
||||
CFStringAppendCString( xMutableString, pNPXPluginPath, kCFStringEncodingUTF8 );
|
||||
CFURLRef xURL = CFURLCreateWithFileSystemPath( NULL, xMutableString, kCFURLPOSIXPathStyle, true );
|
||||
CFRelease( xMutableString );
|
||||
aPaths.push_back( getString( xURL ) );
|
||||
CFRelease( xURL );
|
||||
}
|
||||
|
||||
rtl::OUString aPath = FindFolderURL( kUserDomain, kInternetPlugInFolderType );
|
||||
if( aPath.getLength() )
|
||||
aPaths.push_back( aPath );
|
||||
aPath = FindFolderURL( kLocalDomain, kInternetPlugInFolderType );
|
||||
if( aPath.getLength() )
|
||||
aPaths.push_back( aPath );
|
||||
aPath = FindFolderURL( kOnAppropriateDisk, kInternetPlugInFolderType );
|
||||
if( aPath.getLength() )
|
||||
aPaths.push_back( aPath );
|
||||
|
||||
|
||||
const Sequence< ::rtl::OUString >& rPaths( PluginManager::getAdditionalSearchPaths() );
|
||||
for( i = 0; i < rPaths.getLength(); i++ )
|
||||
for( sal_Int32 i = 0; i < rPaths.getLength(); i++ )
|
||||
{
|
||||
aSearchPath += ":";
|
||||
aSearchPath += ByteString( String( rPaths.getConstArray()[i] ), aEncoding );
|
||||
aPaths.push_back( getURLFromPath( rPaths.getConstArray()[i] ) );
|
||||
}
|
||||
|
||||
|
||||
long aBuffer[ sizeof( struct dirent ) + _PC_NAME_MAX +1 ];
|
||||
int nPaths = aSearchPath.GetTokenCount( ':' );
|
||||
for( i = 0; i < nPaths; i++ )
|
||||
{
|
||||
ByteString aPath( aSearchPath.GetToken( i, ':' ) );
|
||||
if( aPath.Len() )
|
||||
{
|
||||
DIR* pDIR = opendir( aPath.GetBuffer() );
|
||||
struct dirent* pDirEnt = NULL;
|
||||
while( pDIR && ! readdir_r( pDIR, (struct dirent*)aBuffer, &pDirEnt ) && pDirEnt )
|
||||
{
|
||||
char* pBaseName = ((struct dirent*)aBuffer)->d_name;
|
||||
if( pBaseName[0] != '.' ||
|
||||
pBaseName[1] != '.' ||
|
||||
pBaseName[2] != 0 )
|
||||
{
|
||||
ByteString aFileName( aPath );
|
||||
aFileName += "/";
|
||||
aFileName += pBaseName;
|
||||
CheckPlugin( aFileName, aPlugins );
|
||||
}
|
||||
}
|
||||
if( pDIR )
|
||||
closedir( pDIR );
|
||||
}
|
||||
}
|
||||
|
||||
// try ~/.mozilla/pluginreg.dat
|
||||
ByteString aMozPluginreg( pHome );
|
||||
aMozPluginreg.Append( "/.mozilla/pluginreg.dat" );
|
||||
FILE* fp = fopen( aMozPluginreg.GetBuffer(), "r" );
|
||||
if( fp )
|
||||
for( std::list< rtl::OUString >::const_iterator it = aPaths.begin(); it != aPaths.end(); ++it )
|
||||
{
|
||||
rtl::OUString aPath( *it );
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf( stderr, "parsing %s\n", aMozPluginreg.GetBuffer() );
|
||||
fprintf( stderr, "check path %s\n", rtl::OUStringToOString( *it, RTL_TEXTENCODING_UTF8 ).getStr() );
|
||||
#endif
|
||||
char aLine[1024];
|
||||
while( fgets( aLine, sizeof( aLine ), fp ) )
|
||||
{
|
||||
int nLineLen = strlen( aLine );
|
||||
int nDotPos;
|
||||
for( nDotPos = nLineLen-1; nDotPos > 0 && aLine[nDotPos] != ':'; nDotPos-- )
|
||||
;
|
||||
if( aLine[0] == '/' && aLine[nDotPos] == ':' && aLine[nDotPos+1] == '$' )
|
||||
CheckPlugin( ByteString( aLine, nDotPos ), aPlugins );
|
||||
}
|
||||
fclose( fp );
|
||||
CheckPlugin( aPath, aPlugins );
|
||||
}
|
||||
|
||||
|
||||
// create return value
|
||||
aDescriptions = Sequence<PluginDescription>( aPlugins.size() );
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf( stderr, "found %d plugins\n", aPlugins.size() );
|
||||
fprintf( stderr, "found %d plugins\n", (int)aPlugins.size() );
|
||||
#endif
|
||||
list<PluginDescription*>::iterator iter;
|
||||
for( iter = aPlugins.begin(), i=0; iter != aPlugins.end(); ++iter ,i++ )
|
||||
sal_Int32 nPlug = 0;
|
||||
for( iter = aPlugins.begin(); iter != aPlugins.end(); ++iter )
|
||||
{
|
||||
aDescriptions.getArray()[ i ] = **iter;
|
||||
aDescriptions.getArray()[ nPlug++ ] = **iter;
|
||||
delete *iter;
|
||||
}
|
||||
aPlugins.clear();
|
||||
|
@ -36,182 +36,776 @@
|
||||
|
||||
#include <plugin/impl.hxx>
|
||||
|
||||
int MacPluginComm::nConnCounter = 0;
|
||||
extern NPNetscapeFuncs aNPNFuncs;
|
||||
|
||||
MacPluginComm::MacPluginComm(
|
||||
const String& mimetype,
|
||||
const String& library,
|
||||
NSView* aParent,
|
||||
int nDescriptor1,
|
||||
int nDescriptor2
|
||||
) :
|
||||
PluginComm( ::rtl::OUStringToOString( library, osl_getThreadTextEncoding() ) )/*,
|
||||
PluginConnector( nDescriptor2 )*/
|
||||
#include <tools/debug.hxx>
|
||||
|
||||
using namespace rtl;
|
||||
using namespace plugstringhelper;
|
||||
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
void TRACE( char const * s );
|
||||
void TRACEN( char const * s, long n );
|
||||
#else
|
||||
#define TRACE(x)
|
||||
#define TRACEN(x,n)
|
||||
#endif
|
||||
|
||||
struct FakeEventRecord : public EventRecord
|
||||
{
|
||||
//char pDesc[32];
|
||||
// char pWindow[32];
|
||||
// sprintf( pWindow, "%d", aParent );
|
||||
// sprintf( pDesc, "%d", nDescriptor1 );
|
||||
// ByteString aLib( library, osl_getThreadTextEncoding() );
|
||||
//
|
||||
// char* pArgs[5];
|
||||
// pArgs[0] = "pluginapp.bin";
|
||||
// pArgs[1] = pDesc;
|
||||
// pArgs[2] = const_cast<char*>(aLib.GetBuffer());
|
||||
// pArgs[3] = pWindow;
|
||||
// pArgs[4] = NULL;
|
||||
//
|
||||
//#if OSL_DEBUG_LEVEL > 1
|
||||
// m_nCommPID = 10;
|
||||
// fprintf( stderr, "Try to launch: %s %s %s %s, descriptors are %d, %d\n", pArgs[0], pArgs[1], pArgs[2], pArgs[3], nDescriptor1, nDescriptor2 );
|
||||
//#endif
|
||||
//
|
||||
// if( ! ( m_nCommPID = fork() ) )
|
||||
// {
|
||||
// execvp( pArgs[0], pArgs );
|
||||
// fprintf( stderr, "Error: could not exec %s\n", pArgs[0] );
|
||||
// _exit(255);
|
||||
// }
|
||||
//
|
||||
// if( m_nCommPID != -1 )
|
||||
// {
|
||||
// // wait for pluginapp.bin to start up
|
||||
// if( ! WaitForMessage( 5000 ) )
|
||||
// {
|
||||
// fprintf( stderr, "Timeout on command: %s %s %s %s\n", pArgs[0], pArgs[1], pArgs[2], pArgs[3] );
|
||||
// invalidate();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// MediatorMessage* pMessage = GetNextMessage( TRUE );
|
||||
// Respond( pMessage->m_nID,
|
||||
// "init ack",8,
|
||||
// NULL );
|
||||
// delete pMessage;
|
||||
// NPP_Initialize();
|
||||
// }
|
||||
// }
|
||||
FakeEventRecord()
|
||||
{
|
||||
memset( this, 0, sizeof(EventRecord) );
|
||||
::GetGlobalMouse( &where );
|
||||
when = ::TickCount();
|
||||
modifiers = ::GetCurrentEventKeyModifiers();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@interface OOoPluginView : NSView
|
||||
{
|
||||
XPlugin_Impl* m_pImpl;
|
||||
MacPluginComm* m_pCom;
|
||||
}
|
||||
-(id)initWithInstance: (XPlugin_Impl*)i_pImpl pluginComm: (MacPluginComm*)i_pCom frame: (NSRect)i_aRect;
|
||||
-(void)drawRect: (NSRect)i_aRect;
|
||||
-(MacOSBOOL)isOpaque;
|
||||
-(MacOSBOOL)isFlipped;
|
||||
|
||||
// NSResponder
|
||||
-(void)mouseMoved: (NSEvent*)i_pEvent;
|
||||
-(void)mouseDown: (NSEvent*)i_pEvent;
|
||||
-(void)mouseDragged: (NSEvent*)i_pEvent;
|
||||
-(void)mouseUp: (NSEvent*)i_pEvent;
|
||||
-(void)rightMouseDown: (NSEvent*)i_pEvent;
|
||||
-(void)rightMouseDragged: (NSEvent*)i_pEvent;
|
||||
-(void)rightMouseUp: (NSEvent*)i_pEvent;
|
||||
-(void)otherMouseDown: (NSEvent*)i_pEvent;
|
||||
-(void)otherMouseDragged: (NSEvent*)i_pEvent;
|
||||
-(void)otherMouseUp: (NSEvent*)i_pEvent;
|
||||
-(void)mouseEntered: (NSEvent*)i_pEvent;
|
||||
-(void)mouseExited: (NSEvent*)i_pEvent;
|
||||
@end
|
||||
|
||||
@implementation OOoPluginView
|
||||
-(id)initWithInstance: (XPlugin_Impl*)i_pImpl pluginComm: (MacPluginComm*)i_pCom frame: (NSRect) i_aRect
|
||||
{
|
||||
if( (self = [super initWithFrame: i_aRect]) )
|
||||
{
|
||||
m_pImpl = i_pImpl;
|
||||
m_pCom = i_pCom;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)drawRect: (NSRect) i_aRect
|
||||
{
|
||||
m_pCom->drawView( m_pImpl );
|
||||
}
|
||||
|
||||
-(MacOSBOOL)isOpaque
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
-(MacOSBOOL)isFlipped
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
// NSResponder
|
||||
-(void)mouseMoved: (NSEvent*)i_pEvent
|
||||
{
|
||||
FakeEventRecord aRec;
|
||||
aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent
|
||||
m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
|
||||
}
|
||||
|
||||
-(void)mouseDown: (NSEvent*)i_pEvent;
|
||||
{
|
||||
FakeEventRecord aRec;
|
||||
aRec.what = mouseDown;
|
||||
m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
|
||||
}
|
||||
|
||||
-(void)mouseDragged: (NSEvent*)i_pEvent;
|
||||
{
|
||||
FakeEventRecord aRec;
|
||||
aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent
|
||||
m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
|
||||
}
|
||||
|
||||
-(void)mouseUp: (NSEvent*)i_pEvent;
|
||||
{
|
||||
FakeEventRecord aRec;
|
||||
aRec.what = mouseUp;
|
||||
m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
|
||||
}
|
||||
|
||||
-(void)rightMouseDown: (NSEvent*)i_pEvent;
|
||||
{
|
||||
FakeEventRecord aRec;
|
||||
aRec.what = mouseDown;
|
||||
m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
|
||||
}
|
||||
|
||||
-(void)rightMouseDragged: (NSEvent*)i_pEvent;
|
||||
{
|
||||
FakeEventRecord aRec;
|
||||
aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent
|
||||
m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
|
||||
}
|
||||
|
||||
-(void)rightMouseUp: (NSEvent*)i_pEvent;
|
||||
{
|
||||
FakeEventRecord aRec;
|
||||
aRec.what = mouseUp;
|
||||
m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
|
||||
}
|
||||
|
||||
-(void)otherMouseDown: (NSEvent*)i_pEvent;
|
||||
{
|
||||
FakeEventRecord aRec;
|
||||
aRec.what = mouseDown;
|
||||
m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
|
||||
}
|
||||
|
||||
-(void)otherMouseDragged: (NSEvent*)i_pEvent;
|
||||
{
|
||||
FakeEventRecord aRec;
|
||||
aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent
|
||||
m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
|
||||
}
|
||||
|
||||
-(void)otherMouseUp: (NSEvent*)i_pEvent;
|
||||
{
|
||||
FakeEventRecord aRec;
|
||||
aRec.what = mouseUp;
|
||||
m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
|
||||
}
|
||||
|
||||
-(void)mouseEntered: (NSEvent*)i_pEvent;
|
||||
{
|
||||
FakeEventRecord aRec;
|
||||
aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent
|
||||
m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
|
||||
}
|
||||
|
||||
-(void)mouseExited: (NSEvent*)i_pEvent;
|
||||
{
|
||||
FakeEventRecord aRec;
|
||||
aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent
|
||||
m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec );
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
MacPluginComm::MacPluginComm( const rtl::OUString& i_rMimetype, const rtl::OUString& i_rBundle, NSView* i_pParent )
|
||||
: PluginComm( OUStringToOString( i_rBundle, RTL_TEXTENCODING_UTF8 ) ),
|
||||
m_xBundle( NULL ),
|
||||
m_hPlugLib( NULL ),
|
||||
m_pNullTimer( NULL )
|
||||
{
|
||||
// initialize plugin function table
|
||||
memset( &m_aNPPfuncs, 0, sizeof( m_aNPPfuncs ) );
|
||||
|
||||
// load the bundle
|
||||
CFURLRef xURL = createURL( i_rBundle );
|
||||
m_xBundle = CFBundleCreate( NULL, xURL );
|
||||
CFRelease( xURL );
|
||||
if( m_xBundle )
|
||||
{
|
||||
// ask the plugin library
|
||||
// first get its location
|
||||
CFURLRef xLibURL = CFBundleCopyExecutableURL( m_xBundle );
|
||||
if( xLibURL )
|
||||
{
|
||||
// get the file system path
|
||||
rtl::OUString aModuleURL( CFURLtoOSLURL( xLibURL ) );
|
||||
CFRelease( xLibURL );
|
||||
m_hPlugLib = osl_loadModule( aModuleURL.pData, SAL_LOADMODULE_DEFAULT );
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
if( ! m_hPlugLib )
|
||||
fprintf( stderr, "module %s could not be loaded\n", OUStringToOString( aModuleURL, RTL_TEXTENCODING_UTF8 ).getStr() );
|
||||
#endif
|
||||
}
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
else
|
||||
fprintf( stderr, "bundle %s has no exectutable URL\n", OUStringToOString( i_rBundle, RTL_TEXTENCODING_UTF8 ).getStr() );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf( stderr, "bundle %s could not be loaded\n", OUStringToOString( i_rBundle, RTL_TEXTENCODING_UTF8 ).getStr() );
|
||||
#endif
|
||||
}
|
||||
|
||||
DBG_ASSERT( m_xBundle && m_hPlugLib, "loading plugin bundle failed!" );
|
||||
|
||||
|
||||
m_aNPPfuncs.size = sizeof( m_aNPPfuncs );
|
||||
m_aNPPfuncs.version = 0;
|
||||
|
||||
|
||||
m_eCall = eNP_Initialize;
|
||||
execute();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
MacPluginComm::~MacPluginComm()
|
||||
{
|
||||
NPP_Shutdown();
|
||||
if( m_nCommPID != -1 && m_nCommPID != 0 )
|
||||
if( m_hPlugLib )
|
||||
{
|
||||
int status = 16777216;
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
pid_t nExit = waitpid( m_nCommPID, &status, WUNTRACED );
|
||||
fprintf( stderr, "child %d (plugin app child %d) exited with status %d\n", nExit, m_nCommPID, WEXITSTATUS(status) );
|
||||
#else
|
||||
waitpid( m_nCommPID, &status, WUNTRACED );
|
||||
#endif
|
||||
// NPP_Shutdown();
|
||||
NPError (*pShutdown)();
|
||||
if( retrieveFunction( "NP_Shutdown", (void**)&pShutdown ) )
|
||||
{
|
||||
NPError nErr = (*pShutdown)(); (void)nErr;
|
||||
DBG_ASSERT( nErr == NPERR_NO_ERROR, "NP_Shutdown() failed!" );
|
||||
}
|
||||
osl_unloadModule( m_hPlugLib );
|
||||
}
|
||||
if( m_xBundle )
|
||||
CFRelease( m_xBundle );
|
||||
}
|
||||
|
||||
NPError MacPluginComm::NPP_Destroy( NPP instance,
|
||||
NPSavedData** save )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
BOOL MacPluginComm::retrieveFunction( const char* i_pName, void** o_ppFunc ) const
|
||||
{
|
||||
if( ! m_hPlugLib || ! o_ppFunc )
|
||||
return FALSE;
|
||||
|
||||
*o_ppFunc = (void*)osl_getAsciiFunctionSymbol( m_hPlugLib, i_pName );
|
||||
|
||||
if( ! *o_ppFunc && m_xBundle )
|
||||
{
|
||||
rtl::OUString aName( OUString::createFromAscii( *i_pName == '_' ? i_pName+1 : i_pName ) );
|
||||
CFStringRef xName = createString( aName );
|
||||
if( xName )
|
||||
{
|
||||
*o_ppFunc = CFBundleGetFunctionPointerForName( m_xBundle, xName );
|
||||
CFRelease( xName );
|
||||
}
|
||||
}
|
||||
|
||||
return (*o_ppFunc != NULL);
|
||||
}
|
||||
|
||||
IMPL_LINK( MacPluginComm, NullTimerHdl, void*, EMPTYARG )
|
||||
{
|
||||
// note: this is a Timer handler, we are already protected by the SolarMutex
|
||||
|
||||
FakeEventRecord aRec;
|
||||
aRec.what = nullEvent;
|
||||
aRec.where.h = aRec.where.v = 20000;
|
||||
|
||||
for( std::list< XPlugin_Impl* >::iterator it = m_aNullEventClients.begin();
|
||||
it != m_aNullEventClients.end(); ++it )
|
||||
{
|
||||
SysPlugData& rPlugData( (*it)->getSysPlugData() );
|
||||
if( rPlugData.m_pPlugView ) // for safety do not dispatch null events before first NPP_SetWindow
|
||||
(*m_aNPPfuncs.event)( (*it)->getNPPInstance(), &aRec );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
NPError MacPluginComm::NPP_DestroyStream( NPP instance,
|
||||
NPStream* stream,
|
||||
NPError reason )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* MacPluginComm::NPP_GetJavaClass()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
long MacPluginComm::doIt()
|
||||
{
|
||||
long nRet = 0;
|
||||
switch( m_eCall )
|
||||
{
|
||||
case eNP_Initialize:
|
||||
{
|
||||
TRACE( "eNP_Initialize" );
|
||||
NPError (*pInit)( NPNetscapeFuncs* );
|
||||
if( retrieveFunction( "NP_Initialize", (void**)&pInit ) )
|
||||
{
|
||||
nRet = (*pInit)( &aNPNFuncs );
|
||||
|
||||
NPError nErr = NPERR_NO_ERROR;
|
||||
NPError (*pEntry)( NPPluginFuncs* );
|
||||
retrieveFunction( "NP_GetEntryPoints", (void**)&pEntry );
|
||||
nErr = (*pEntry)( &m_aNPPfuncs );
|
||||
|
||||
DBG_ASSERT( nErr == NPERR_NO_ERROR, "NP_GetEntryPoints() failed!" );
|
||||
}
|
||||
else
|
||||
{
|
||||
nRet = NPERR_GENERIC_ERROR;
|
||||
}
|
||||
DBG_ASSERT( nRet == NPERR_NO_ERROR, "### NP_Initialize() failed!" );
|
||||
}
|
||||
break;
|
||||
case eNPP_Destroy:
|
||||
if( m_aNullEventClients.empty() )
|
||||
delete m_pNullTimer, m_pNullTimer = NULL;
|
||||
|
||||
TRACE( "eNPP_Destroy" );
|
||||
nRet = (m_aNPPfuncs.destroy
|
||||
? (*m_aNPPfuncs.destroy)(
|
||||
(NPP)m_aArgs[0],
|
||||
(NPSavedData**)m_aArgs[1] )
|
||||
: NPERR_GENERIC_ERROR);
|
||||
break;
|
||||
case eNPP_DestroyStream:
|
||||
TRACE( "eNPP_DestroyStream" );
|
||||
nRet = (m_aNPPfuncs.destroystream
|
||||
? (*m_aNPPfuncs.destroystream)(
|
||||
(NPP)m_aArgs[0],
|
||||
(NPStream*)m_aArgs[1],
|
||||
(NPError)(sal_IntPtr)m_aArgs[2] )
|
||||
: NPERR_GENERIC_ERROR);
|
||||
break;
|
||||
case eNPP_New:
|
||||
TRACE( "eNPP_New" );
|
||||
nRet = (m_aNPPfuncs.newp
|
||||
? (*m_aNPPfuncs.newp)(
|
||||
(NPMIMEType)m_aArgs[0],
|
||||
(NPP)m_aArgs[1],
|
||||
(uint16)(sal_IntPtr)m_aArgs[2],
|
||||
(int16)(sal_IntPtr)m_aArgs[3],
|
||||
(char**)m_aArgs[4],
|
||||
(char**)m_aArgs[5],
|
||||
(NPSavedData*)m_aArgs[6] )
|
||||
: NPERR_GENERIC_ERROR);
|
||||
|
||||
if( ! m_pNullTimer && m_aNPPfuncs.event )
|
||||
{
|
||||
m_pNullTimer = new AutoTimer();
|
||||
m_pNullTimer->SetTimeout( 50 );
|
||||
m_pNullTimer->SetTimeoutHdl( LINK( this, MacPluginComm, NullTimerHdl ) );
|
||||
m_pNullTimer->Start();
|
||||
}
|
||||
|
||||
break;
|
||||
case eNPP_NewStream:
|
||||
TRACE( "eNPP_NewStream" );
|
||||
nRet = (m_aNPPfuncs.newstream
|
||||
? (*m_aNPPfuncs.newstream)(
|
||||
(NPP)m_aArgs[0],
|
||||
(NPMIMEType)m_aArgs[1],
|
||||
(NPStream*)m_aArgs[2],
|
||||
(NPBool)(sal_IntPtr)m_aArgs[3],
|
||||
(uint16*)m_aArgs[4] )
|
||||
: NPERR_GENERIC_ERROR);
|
||||
break;
|
||||
case eNPP_Print:
|
||||
TRACE( "eNPP_Print" );
|
||||
if (m_aNPPfuncs.print)
|
||||
(*m_aNPPfuncs.print)(
|
||||
(NPP)m_aArgs[0],
|
||||
(NPPrint*)m_aArgs[1] );
|
||||
break;
|
||||
case eNPP_SetWindow:
|
||||
{
|
||||
TRACE( "eNPP_SetWindow" );
|
||||
nRet = (m_aNPPfuncs.setwindow
|
||||
? (*m_aNPPfuncs.setwindow)(
|
||||
(NPP)m_aArgs[0],
|
||||
(NPWindow*)m_aArgs[1] )
|
||||
: NPERR_GENERIC_ERROR);
|
||||
|
||||
break;
|
||||
}
|
||||
case eNPP_HandleEvent:
|
||||
{
|
||||
TRACE( "eNPP_HandleEvent" );
|
||||
nRet = (m_aNPPfuncs.event
|
||||
? (*m_aNPPfuncs.event)(
|
||||
(NPP)m_aArgs[0],
|
||||
m_aArgs[1] )
|
||||
: NPERR_GENERIC_ERROR);
|
||||
|
||||
break;
|
||||
}
|
||||
case eNPP_StreamAsFile:
|
||||
TRACE( "eNPP_StreamAsFile" );
|
||||
if (m_aNPPfuncs.asfile)
|
||||
(*m_aNPPfuncs.asfile)(
|
||||
(NPP)m_aArgs[0],
|
||||
(NPStream*)m_aArgs[1],
|
||||
(char*)m_aArgs[2] );
|
||||
break;
|
||||
case eNPP_URLNotify:
|
||||
TRACE( "eNPP_URLNotify" );
|
||||
if (m_aNPPfuncs.urlnotify)
|
||||
(*m_aNPPfuncs.urlnotify)(
|
||||
(NPP)m_aArgs[0],
|
||||
(char*)m_aArgs[1],
|
||||
(NPReason)(sal_IntPtr)m_aArgs[2],
|
||||
m_aArgs[3] );
|
||||
break;
|
||||
case eNPP_Write:
|
||||
TRACEN( "eNPP_Write n=", (int32)m_aArgs[3] );
|
||||
nRet = (m_aNPPfuncs.write
|
||||
? (*m_aNPPfuncs.write)(
|
||||
(NPP)m_aArgs[0],
|
||||
(NPStream*)m_aArgs[1],
|
||||
(int32)m_aArgs[2],
|
||||
(int32)m_aArgs[3],
|
||||
m_aArgs[4] )
|
||||
: 0);
|
||||
break;
|
||||
case eNPP_WriteReady:
|
||||
TRACE( "eNPP_WriteReady" );
|
||||
nRet = (m_aNPPfuncs.writeready
|
||||
? (*m_aNPPfuncs.writeready)(
|
||||
(NPP)m_aArgs[0],
|
||||
(NPStream*)m_aArgs[1] )
|
||||
: 0);
|
||||
break;
|
||||
case eNPP_GetValue:
|
||||
TRACE( "eNPP_GetValue" );
|
||||
nRet = (m_aNPPfuncs.getvalue
|
||||
? (*m_aNPPfuncs.getvalue)(
|
||||
(NPP)m_aArgs[0],
|
||||
(NPPVariable)(int)m_aArgs[1],
|
||||
m_aArgs[2] )
|
||||
: NPERR_GENERIC_ERROR);
|
||||
break;
|
||||
case eNPP_SetValue:
|
||||
TRACE( "eNPP_SetValue" );
|
||||
nRet = (m_aNPPfuncs.setvalue
|
||||
? (*m_aNPPfuncs.setvalue)(
|
||||
(NPP)m_aArgs[0],
|
||||
(NPNVariable)(int)m_aArgs[1],
|
||||
m_aArgs[2] )
|
||||
: NPERR_GENERIC_ERROR);
|
||||
break;
|
||||
case eNPP_Shutdown:
|
||||
{
|
||||
TRACE( "eNPP_Shutdown" );
|
||||
NPP_ShutdownUPP pFunc;
|
||||
if (retrieveFunction( "NPP_Shutdown", (void**)&pFunc ))
|
||||
(*pFunc)();
|
||||
}
|
||||
break;
|
||||
case eNPP_Initialize:
|
||||
TRACE( "eNPP_Initialize" );
|
||||
OSL_ENSURE( false, "NPP_Initialize: not implemented!" );
|
||||
break;
|
||||
case eNPP_GetJavaClass:
|
||||
TRACE( "eNPP_GetJavaClass" );
|
||||
OSL_ENSURE( false, "NPP_GetJavaClass: not implemented!" );
|
||||
break;
|
||||
}
|
||||
return nRet;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
NPError MacPluginComm::NPP_Destroy( XPlugin_Impl* i_pImpl, NPSavedData** save )
|
||||
{
|
||||
// remove from NullEvent timer
|
||||
m_aNullEventClients.remove( i_pImpl );
|
||||
|
||||
NPError nErr = NPP_Destroy( i_pImpl->getNPPInstance(), save );
|
||||
|
||||
// release plugin view
|
||||
SysPlugData& rPlugData( i_pImpl->getSysPlugData() );
|
||||
if( rPlugData.m_pPlugView )
|
||||
{
|
||||
[rPlugData.m_pPlugView removeFromSuperview];
|
||||
[rPlugData.m_pPlugView release];
|
||||
rPlugData.m_pPlugView = nil;
|
||||
}
|
||||
|
||||
return nErr;
|
||||
}
|
||||
|
||||
|
||||
NPError MacPluginComm::NPP_Destroy( NPP instance, NPSavedData** save )
|
||||
{
|
||||
DBG_ASSERT( m_aNPPfuncs.destroy, "### NPP_Destroy(): null pointer in NPP functions table!" );
|
||||
m_eCall = eNPP_Destroy;
|
||||
m_aArgs[0] = (void*)instance;
|
||||
m_aArgs[1] = (void*)save;
|
||||
return (NPError)execute();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
NPError MacPluginComm::NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason )
|
||||
{
|
||||
DBG_ASSERT( m_aNPPfuncs.destroystream, "### NPP_DestroyStream(): null pointer in NPP functions table!" );
|
||||
m_eCall = eNPP_DestroyStream;
|
||||
m_aArgs[0] = (void*)instance;
|
||||
m_aArgs[1] = (void*)stream;
|
||||
m_aArgs[2] = (void*)reason;
|
||||
return (NPError)execute();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
NPError MacPluginComm::NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
|
||||
char* argn[], char* argv[], NPSavedData *saved )
|
||||
{
|
||||
XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
|
||||
DBG_ASSERT( pImpl, "no instance found" );
|
||||
|
||||
if( pImpl ) // sanity check
|
||||
m_aNullEventClients.push_back( pImpl );
|
||||
|
||||
DBG_ASSERT( m_aNPPfuncs.newp, "### NPP_New(): null pointer in NPP functions table!" );
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf( stderr, "NPP_New( %s. %p, %d, %d",
|
||||
pluginType, instance, (int)mode, (int)argc );
|
||||
for( int16 i = 0; i < argc; i++ )
|
||||
fprintf( stderr, "\n%s = %s", argn[i], argv[i] );
|
||||
fprintf( stderr, ", %p )\n", saved );
|
||||
#endif
|
||||
m_eCall = eNPP_New;
|
||||
m_aArgs[0] = (void*)pluginType;
|
||||
m_aArgs[1] = (void*)instance;
|
||||
m_aArgs[2] = (void*)mode;
|
||||
m_aArgs[3] = (void*)argc;
|
||||
m_aArgs[4] = (void*)argn;
|
||||
m_aArgs[5] = (void*)argv;
|
||||
m_aArgs[6] = (void*)saved;
|
||||
|
||||
return (NPError)execute();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
NPError MacPluginComm::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream,
|
||||
NPBool seekable, uint16* stype )
|
||||
{
|
||||
DBG_ASSERT( m_aNPPfuncs.newstream, "### NPP_NewStream(): null pointer in NPP functions table!" );
|
||||
m_eCall = eNPP_NewStream;
|
||||
m_aArgs[0] = (void*)instance;
|
||||
m_aArgs[1] = (void*)type;
|
||||
m_aArgs[2] = (void*)stream;
|
||||
m_aArgs[3] = (void*)seekable;
|
||||
m_aArgs[4] = (void*)stype;
|
||||
return (NPError)execute();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void MacPluginComm::NPP_Print( NPP instance, NPPrint* platformPrint )
|
||||
{
|
||||
DBG_ASSERT( m_aNPPfuncs.print, "### NPP_Print(): null pointer in NPP functions table!" );
|
||||
m_eCall = eNPP_Print;
|
||||
m_aArgs[0] = (void*)instance;
|
||||
m_aArgs[1] = (void*)platformPrint;
|
||||
execute();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
NPError MacPluginComm::NPP_SetWindow( NPP instance, NPWindow* window )
|
||||
{
|
||||
DBG_ASSERT( m_aNPPfuncs.setwindow, "### NPP_SetWindow(): null pointer in NPP functions table!" );
|
||||
m_eCall = eNPP_SetWindow;
|
||||
m_aArgs[0] = (void*)instance;
|
||||
m_aArgs[1] = (void*)window;
|
||||
return (NPError)execute();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
NPError MacPluginComm::NPP_HandleEvent( NPP instance, void* event )
|
||||
{
|
||||
DBG_ASSERT( m_aNPPfuncs.event, "### NPP_HandleEvent(): null pointer in NPP functions table!" );
|
||||
m_eCall = eNPP_HandleEvent;
|
||||
m_aArgs[0] = (void*)instance;
|
||||
m_aArgs[1] = event;
|
||||
return (NPError)execute();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void MacPluginComm::NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname )
|
||||
{
|
||||
DBG_ASSERT( m_aNPPfuncs.asfile, "### NPP_StreamAsFile(): null pointer in NPP functions table!" );
|
||||
m_eCall = eNPP_StreamAsFile;
|
||||
m_aArgs[0] = (void*)instance;
|
||||
m_aArgs[1] = (void*)stream;
|
||||
m_aArgs[2] = (void*)fname;
|
||||
execute();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void MacPluginComm::NPP_URLNotify( NPP instance, const char* url, NPReason reason, void* notifyData )
|
||||
{
|
||||
DBG_ASSERT( m_aNPPfuncs.urlnotify, "### NPP_URLNotify(): null pointer in NPP functions table!" );
|
||||
m_eCall = eNPP_URLNotify;
|
||||
m_aArgs[0] = (void*)instance;
|
||||
m_aArgs[1] = (void*)url;
|
||||
m_aArgs[2] = (void*)reason;
|
||||
m_aArgs[3] = notifyData;
|
||||
execute();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int32 MacPluginComm::NPP_Write( NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer )
|
||||
{
|
||||
DBG_ASSERT( m_aNPPfuncs.write, "### NPP_Write(): null pointer in NPP functions table!" );
|
||||
m_eCall = eNPP_Write;
|
||||
m_aArgs[0] = (void*)instance;
|
||||
m_aArgs[1] = (void*)stream;
|
||||
m_aArgs[2] = (void*)offset;
|
||||
m_aArgs[3] = (void*)len;
|
||||
m_aArgs[4] = buffer;
|
||||
return (NPError)execute();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int32 MacPluginComm::NPP_WriteReady( NPP instance, NPStream* stream )
|
||||
{
|
||||
DBG_ASSERT( m_aNPPfuncs.writeready, "### NPP_WriteReady(): null pointer in NPP functions table!" );
|
||||
m_eCall = eNPP_WriteReady;
|
||||
m_aArgs[0] = (void*)instance;
|
||||
m_aArgs[1] = (void*)stream;
|
||||
return execute();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
NPError MacPluginComm::NPP_GetValue( NPP instance, NPPVariable variable, void *ret_value )
|
||||
{
|
||||
DBG_ASSERT( m_aNPPfuncs.getvalue, "### NPP_GetValue(): null pointer in NPP functions table!" );
|
||||
m_eCall = eNPP_GetValue;
|
||||
m_aArgs[0] = (void*)instance;
|
||||
m_aArgs[1] = (void*)variable;
|
||||
m_aArgs[2] = ret_value;
|
||||
return (NPError)execute();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
NPError MacPluginComm::NPP_SetValue( NPP instance, NPNVariable variable, void *set_value )
|
||||
{
|
||||
DBG_ASSERT( m_aNPPfuncs.setvalue, "### NPP_SetValue(): null pointer in NPP functions table!" );
|
||||
m_eCall = eNPP_SetValue;
|
||||
m_aArgs[0] = (void*)instance;
|
||||
m_aArgs[1] = (void*)variable;
|
||||
m_aArgs[2] = set_value;
|
||||
return (NPError)execute();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void * MacPluginComm::NPP_GetJavaClass()
|
||||
{
|
||||
DBG_ERROR( "no java class available!" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
NPError MacPluginComm::NPP_Initialize()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
NPError MacPluginComm::NPP_New( NPMIMEType pluginType,
|
||||
NPP instance,
|
||||
uint16 mode,
|
||||
int16 argc,
|
||||
char* argn[],
|
||||
char* argv[],
|
||||
NPSavedData *saved )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
NPError MacPluginComm::NPP_NewStream( NPP instance,
|
||||
NPMIMEType type,
|
||||
NPStream* stream,
|
||||
NPBool seekable,
|
||||
uint16* stype )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MacPluginComm::NPP_Print( NPP instance,
|
||||
NPPrint* platformPrint )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NPError MacPluginComm::NPP_SetWindow( NPP instance,
|
||||
NPWindow* window )
|
||||
{
|
||||
return 0;
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void MacPluginComm::NPP_Shutdown()
|
||||
{
|
||||
|
||||
m_eCall = eNPP_Shutdown;
|
||||
execute();
|
||||
}
|
||||
|
||||
void MacPluginComm::NPP_StreamAsFile( NPP instance,
|
||||
NPStream* stream,
|
||||
const char* fname )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
NPError MacPluginComm::NPP_SetWindow( XPlugin_Impl* i_pImpl )
|
||||
{
|
||||
// update window NPWindow from view
|
||||
SysPlugData& rPlugData( i_pImpl->getSysPlugData() );
|
||||
|
||||
// update plug view
|
||||
NSRect aPlugRect = [rPlugData.m_pParentView frame];
|
||||
aPlugRect.origin.x = aPlugRect.origin.y = 0;
|
||||
if( ! rPlugData.m_pPlugView )
|
||||
{
|
||||
rPlugData.m_pPlugView = [[OOoPluginView alloc] initWithInstance: i_pImpl pluginComm: this frame: aPlugRect];
|
||||
[rPlugData.m_pParentView addSubview: rPlugData.m_pPlugView];
|
||||
}
|
||||
else
|
||||
[rPlugData.m_pPlugView setFrame: aPlugRect];
|
||||
|
||||
NPWindow* pNPWin = i_pImpl->getNPWindow();
|
||||
NSWindow* pWin = [rPlugData.m_pPlugView window];
|
||||
NSRect aWinRect = [pWin frame];
|
||||
NSRect aBounds = [rPlugData.m_pPlugView frame];
|
||||
NSRect aVisibleBounds = [rPlugData.m_pPlugView visibleRect];
|
||||
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf( stderr, "visible bounds = %d+%d+%dx%d\n",
|
||||
(int)aVisibleBounds.origin.x, (int)aVisibleBounds.origin.y,
|
||||
(int)aVisibleBounds.size.width, (int)aVisibleBounds.size.height );
|
||||
#endif
|
||||
|
||||
NSPoint aViewOrigin = [rPlugData.m_pPlugView convertPoint: NSZeroPoint toView: nil];
|
||||
// save view origin so we can notice movement of the view in drawView
|
||||
// in case of a moved view we need to reset the port/context
|
||||
rPlugData.m_aLastPlugViewOrigin = aViewOrigin;
|
||||
|
||||
// convert view origin to topdown coordinates
|
||||
aViewOrigin.y = aWinRect.size.height - aViewOrigin.y;
|
||||
|
||||
// same for clipping
|
||||
NSPoint aClipOrigin = [rPlugData.m_pPlugView convertPoint: aVisibleBounds.origin toView: nil];
|
||||
aClipOrigin.y = aWinRect.size.height - aClipOrigin.y;
|
||||
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf( stderr, "view origin: %d+%d, clip origin = %d+%d\n",
|
||||
(int)aViewOrigin.x, (int)aViewOrigin.y,
|
||||
(int)aClipOrigin.x, (int)aClipOrigin.y );
|
||||
#endif
|
||||
|
||||
pNPWin->x = aViewOrigin.x;
|
||||
pNPWin->y = aViewOrigin.y;
|
||||
pNPWin->width = aBounds.size.width;
|
||||
pNPWin->height = aBounds.size.height;
|
||||
pNPWin->clipRect.left = aClipOrigin.x;
|
||||
pNPWin->clipRect.top = aClipOrigin.y;
|
||||
pNPWin->clipRect.right = aClipOrigin.x + aVisibleBounds.size.width;
|
||||
pNPWin->clipRect.bottom = aClipOrigin.y + aVisibleBounds.size.height;
|
||||
|
||||
if( rPlugData.m_nDrawingModel == 1 )
|
||||
{
|
||||
rPlugData.m_aCGContext.window = reinterpret_cast<WindowRef>([pWin windowRef]);
|
||||
pNPWin->window = &rPlugData.m_aCGContext;
|
||||
rPlugData.m_aCGContext.context = reinterpret_cast<CGContextRef>([[pWin graphicsContext] graphicsPort]);
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf( stderr, "window is %p, context is %p\n",
|
||||
rPlugData.m_aCGContext.window, rPlugData.m_aCGContext.context );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
rPlugData.m_aNPPort.port = GetWindowPort( reinterpret_cast<WindowRef>([pWin windowRef]) );
|
||||
rPlugData.m_aNPPort.portx = aClipOrigin.x;
|
||||
rPlugData.m_aNPPort.porty = aClipOrigin.y;
|
||||
pNPWin->window = &rPlugData.m_aNPPort;
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf( stderr, "port is %p at (%d,%d)\n",
|
||||
rPlugData.m_aNPPort.port, (int)rPlugData.m_aNPPort.portx, (int)rPlugData.m_aNPPort.porty );
|
||||
#endif
|
||||
}
|
||||
|
||||
if( pNPWin->width == 0 || pNPWin->height == 0 || [rPlugData.m_pPlugView isHiddenOrHasHiddenAncestor] )
|
||||
rPlugData.m_bSetWindowOnDraw = true;
|
||||
|
||||
NPError nErr = NPP_SetWindow( i_pImpl->getNPPInstance(), i_pImpl->getNPWindow() );
|
||||
|
||||
return nErr;
|
||||
}
|
||||
|
||||
void MacPluginComm::NPP_URLNotify( NPP instance,
|
||||
const char* url,
|
||||
NPReason reason,
|
||||
void* notifyData )
|
||||
void MacPluginComm::drawView( XPlugin_Impl* i_pImpl )
|
||||
{
|
||||
SysPlugData& rPlugData( i_pImpl->getSysPlugData() );
|
||||
|
||||
}
|
||||
|
||||
int32 MacPluginComm::NPP_Write( NPP instance,
|
||||
NPStream* stream,
|
||||
int32 offset,
|
||||
int32 len,
|
||||
void* buffer )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32 MacPluginComm::NPP_WriteReady( NPP instance,
|
||||
NPStream* stream )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
char* MacPluginComm::NPP_GetMIMEDescription()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
NPError MacPluginComm::NPP_GetValue( NPP instance, NPPVariable variable, void* value )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
NPError MacPluginComm::NPP_SetValue( NPP instance,
|
||||
NPNVariable variable,
|
||||
void *value)
|
||||
{
|
||||
return 0;
|
||||
// check if the view was moved since the last SetWindow
|
||||
NSPoint aViewOrigin = [rPlugData.m_pPlugView convertPoint: NSZeroPoint toView: nil];
|
||||
if( rPlugData.m_bSetWindowOnDraw ||
|
||||
aViewOrigin.x != rPlugData.m_aLastPlugViewOrigin.x ||
|
||||
aViewOrigin.y != rPlugData.m_aLastPlugViewOrigin.y )
|
||||
{
|
||||
NPP_SetWindow( i_pImpl );
|
||||
rPlugData.m_bSetWindowOnDraw = false;
|
||||
}
|
||||
|
||||
// send a paint event
|
||||
NSWindow* pWin = [rPlugData.m_pPlugView window];
|
||||
FakeEventRecord aRec;
|
||||
aRec.what = updateEvt;
|
||||
aRec.message = (UInt32)[pWin windowRef];
|
||||
this->NPP_HandleEvent( i_pImpl->getNPPInstance(), &aRec );
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ void TRACE( char const * s )
|
||||
if (s_file)
|
||||
{
|
||||
oslThreadIdentifier t = osl_getThreadIdentifier(0);
|
||||
fprintf( s_file, "log [t_id=%d]: %s\n", t, s );
|
||||
fprintf( s_file, "log [t_id=%"SAL_PRIuUINT32"]: %s\n", t, s );
|
||||
fflush( s_file );
|
||||
}
|
||||
}
|
||||
@ -62,7 +62,7 @@ void TRACEN( char const * s, long n )
|
||||
if (s_file)
|
||||
{
|
||||
oslThreadIdentifier t = osl_getThreadIdentifier(0);
|
||||
fprintf( s_file, "log [t_id=%d]: %s%d\n", t, s, n );
|
||||
fprintf( s_file, "log [t_id=%"SAL_PRIuUINT32"]: %s%ld\n", t, s, n );
|
||||
fflush( s_file );
|
||||
}
|
||||
}
|
||||
@ -73,7 +73,7 @@ void TRACES( char const* s, char const* s2 )
|
||||
if (s_file)
|
||||
{
|
||||
oslThreadIdentifier t = osl_getThreadIdentifier(0);
|
||||
fprintf( s_file, "log [t_id=%d]: %s %s\n", t, s, s2 );
|
||||
fprintf( s_file, "log [t_id=%"SAL_PRIuUINT32"]: %s %s\n", t, s, s2 );
|
||||
fflush( s_file );
|
||||
}
|
||||
}
|
||||
@ -477,30 +477,29 @@ extern "C" {
|
||||
|
||||
const char* SAL_CALL NP_LOADDS NPN_UserAgent( NPP instance )
|
||||
{
|
||||
TRACE( "NPN_UserAgent" );
|
||||
static char* pAgent = strdup( "Mozilla" );
|
||||
static char* pAgent = strdup( "Mozilla 3.0" );
|
||||
|
||||
XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
|
||||
if( ! pImpl )
|
||||
return pAgent;
|
||||
|
||||
::rtl::OUString UserAgent;
|
||||
try
|
||||
if( pImpl )
|
||||
{
|
||||
pImpl->enterPluginCallback();
|
||||
UserAgent = pImpl->getPluginContext()->
|
||||
getUserAgent( pImpl );
|
||||
pImpl->leavePluginCallback();
|
||||
}
|
||||
catch( ::com::sun::star::plugin::PluginException& )
|
||||
{
|
||||
pImpl->leavePluginCallback();
|
||||
return pAgent;
|
||||
rtl::OUString UserAgent;
|
||||
try
|
||||
{
|
||||
pImpl->enterPluginCallback();
|
||||
UserAgent = pImpl->getPluginContext()->
|
||||
getUserAgent( pImpl );
|
||||
pImpl->leavePluginCallback();
|
||||
if( pAgent )
|
||||
free( pAgent );
|
||||
pAgent = strdup( ::rtl::OUStringToOString( UserAgent, pImpl->getTextEncoding() ).getStr() );
|
||||
}
|
||||
catch( ::com::sun::star::plugin::PluginException& )
|
||||
{
|
||||
pImpl->leavePluginCallback();
|
||||
}
|
||||
}
|
||||
|
||||
if( pAgent )
|
||||
free( pAgent );
|
||||
pAgent = strdup( ::rtl::OUStringToOString( UserAgent, pImpl->getTextEncoding() ).getStr() );
|
||||
TRACES( "NPN_UserAgent: returning", pAgent );
|
||||
|
||||
return pAgent;
|
||||
}
|
||||
@ -537,7 +536,7 @@ int32 SAL_CALL NP_LOADDS NPN_Write( NPP instance, NPStream* stream, int32 len,
|
||||
|
||||
NPError SAL_CALL NP_LOADDS NPN_GetValue( NPP instance, NPNVariable variable, void* value )
|
||||
{
|
||||
TRACE( "NPN_GetValue" );
|
||||
TRACEN( "NPN_GetValue: ", variable );
|
||||
XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
|
||||
|
||||
if( ! pImpl )
|
||||
@ -554,6 +553,14 @@ NPError SAL_CALL NP_LOADDS NPN_GetValue( NPP instance, NPNVariable variable, vo
|
||||
default:
|
||||
aResult = NPERR_INVALID_PARAM;
|
||||
break;
|
||||
#ifdef QUARTZ
|
||||
case 2000: // NPNVsupportsQuickDrawBool
|
||||
*(NPBool*)value = false;
|
||||
break;
|
||||
case 2001: // NPNVsupportsCoreGraphicsBool
|
||||
*(NPBool*)value = true;
|
||||
break;
|
||||
#endif
|
||||
case NPNVjavascriptEnabledBool:
|
||||
// no javascript
|
||||
*(NPBool*)value = false;
|
||||
@ -594,26 +601,75 @@ void SAL_CALL NP_LOADDS NPN_ReloadPlugins(NPBool /*reloadPages*/)
|
||||
}
|
||||
|
||||
|
||||
NPError SAL_CALL NP_LOADDS NPN_SetValue(NPP /*instance*/, NPPVariable /*variable*/,
|
||||
void* /*value*/)
|
||||
NPError SAL_CALL NP_LOADDS NPN_SetValue( NPP instance,
|
||||
NPPVariable variable,
|
||||
void* value )
|
||||
{
|
||||
TRACE( "NPN_SetValue" );
|
||||
return 0;
|
||||
NPError nError = NPERR_NO_ERROR;
|
||||
TRACEN( "NPN_SetValue ", variable );
|
||||
switch( variable )
|
||||
{
|
||||
#ifdef QUARTZ
|
||||
case (NPPVariable)1000: // NPNVpluginDrawingModel
|
||||
{
|
||||
int nDrawingModel = (int)value; // ugly, but that's the way we need to do it
|
||||
|
||||
TRACEN( "drawing model: ", nDrawingModel );
|
||||
|
||||
XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
|
||||
if( pImpl )
|
||||
pImpl->getSysPlugData().m_nDrawingModel = nDrawingModel;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case NPPVpluginNameString: // make the windows compiler happy, it needs at least one case statement
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#ifndef QUARTZ
|
||||
(void)instance;
|
||||
(void)value;
|
||||
#endif
|
||||
return nError;
|
||||
}
|
||||
|
||||
void SAL_CALL NP_LOADDS NPN_InvalidateRect(NPP /*instance*/, NPRect* /*invalidRect*/)
|
||||
void SAL_CALL NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect* /*invalidRect*/)
|
||||
{
|
||||
TRACE( "NPN_InvalidateRect" );
|
||||
|
||||
#ifdef QUARTZ
|
||||
NPN_ForceRedraw( instance );
|
||||
#else
|
||||
(void)instance;
|
||||
#endif
|
||||
}
|
||||
|
||||
void SAL_CALL NP_LOADDS NPN_InvalidateRegion(NPP /*instance*/, NPRegion /*invalidRegion*/)
|
||||
void SAL_CALL NP_LOADDS NPN_InvalidateRegion(NPP instance, NPRegion /*invalidRegion*/)
|
||||
{
|
||||
TRACE( "NPN_InvalidateRegion" );
|
||||
|
||||
#ifdef QUARTZ
|
||||
NPN_ForceRedraw( instance );
|
||||
#else
|
||||
(void)instance;
|
||||
#endif
|
||||
}
|
||||
|
||||
void SAL_CALL NP_LOADDS NPN_ForceRedraw(NPP /*instance*/)
|
||||
void SAL_CALL NP_LOADDS NPN_ForceRedraw(NPP instance)
|
||||
{
|
||||
TRACE( "NPN_ForceRedraw" );
|
||||
#ifdef QUARTZ
|
||||
XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
|
||||
if( pImpl )
|
||||
{
|
||||
SysPlugData& rPlugData( pImpl->getSysPlugData() );
|
||||
if( rPlugData.m_pPlugView )
|
||||
[rPlugData.m_pPlugView setNeedsDisplay: YES];
|
||||
}
|
||||
#else
|
||||
(void)instance;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -60,3 +60,14 @@ PluginComm::~PluginComm()
|
||||
aEntry.Kill();
|
||||
}
|
||||
}
|
||||
|
||||
NPError PluginComm::NPP_SetWindow( XPlugin_Impl* i_pImpl )
|
||||
{
|
||||
return NPP_SetWindow( i_pImpl->getNPPInstance(), i_pImpl->getNPWindow() );
|
||||
}
|
||||
|
||||
NPError PluginComm::NPP_Destroy( XPlugin_Impl* i_pImpl, NPSavedData** save )
|
||||
{
|
||||
return NPP_Destroy( i_pImpl->getNPPInstance(), save );
|
||||
}
|
||||
|
||||
|
@ -121,6 +121,7 @@ XPlugin_Impl::XPlugin_Impl( const uno::Reference< com::sun::star::lang::XMultiSe
|
||||
{
|
||||
memset( &m_aInstance, 0, sizeof( m_aInstance ) );
|
||||
memset( &m_aNPWindow, 0, sizeof( m_aNPWindow ) );
|
||||
memset( &m_aSysPlugData, 0, sizeof( m_aSysPlugData ) );
|
||||
|
||||
m_xModel = new PluginModel();
|
||||
uno::Reference< com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY );
|
||||
@ -139,8 +140,7 @@ void XPlugin_Impl::destroyInstance()
|
||||
destroyStreams();
|
||||
if( getPluginComm() )
|
||||
{
|
||||
getPluginComm()->NPP_Destroy( getNPPInstance(),
|
||||
&pSavedData );
|
||||
getPluginComm()->NPP_Destroy( this, &pSavedData );
|
||||
getPluginComm()->decRef();
|
||||
m_pPluginComm = NULL;
|
||||
}
|
||||
@ -218,8 +218,7 @@ IMPL_LINK( XPlugin_Impl, secondLevelDispose, XPlugin_Impl*, /*pThis*/ )
|
||||
m_aNPWindow.window = NULL;
|
||||
#ifndef UNX
|
||||
// acrobat does an unconditional XtParent on the windows widget
|
||||
getPluginComm()->
|
||||
NPP_SetWindow( getNPPInstance(), &m_aNPWindow );
|
||||
getPluginComm()->NPP_SetWindow( this );
|
||||
#endif
|
||||
destroyInstance();
|
||||
PluginControl_Impl::dispose();
|
||||
@ -520,26 +519,21 @@ void XPlugin_Impl::loadPlugin()
|
||||
{
|
||||
if( m_aDescription.PluginName.getLength() )
|
||||
{
|
||||
#ifdef UNX
|
||||
#if defined QUARTZ
|
||||
PluginComm* pComm = new MacPluginComm( m_aDescription.Mimetype,
|
||||
m_aDescription.PluginName,
|
||||
pEnvData->pView );
|
||||
#elif defined UNX
|
||||
// need a new PluginComm
|
||||
PluginComm* pComm = NULL;
|
||||
int sv[2];
|
||||
if( !socketpair( AF_UNIX, SOCK_STREAM, 0, sv ) )
|
||||
#ifdef QUARTZ
|
||||
pComm = new MacPluginComm( m_aDescription.Mimetype,
|
||||
m_aDescription.PluginName,
|
||||
pEnvData->pView,
|
||||
sv[0],
|
||||
sv[1]
|
||||
);
|
||||
#else
|
||||
pComm = new UnxPluginComm( m_aDescription.Mimetype,
|
||||
m_aDescription.PluginName,
|
||||
(XLIB_Window)pEnvData->aWindow,
|
||||
sv[0],
|
||||
sv[1]
|
||||
);
|
||||
#endif //QUARTZ
|
||||
#elif (defined WNT || defined OS2)
|
||||
PluginComm* pComm = new PluginComm_Impl( m_aDescription.Mimetype,
|
||||
m_aDescription.PluginName,
|
||||
@ -560,19 +554,13 @@ void XPlugin_Impl::loadPlugin()
|
||||
(char**)(m_nArgs ? m_pArgn : NULL),
|
||||
(char**)(m_nArgs ? m_pArgv : NULL),
|
||||
NULL );
|
||||
|
||||
#if defined( UNX ) && !defined(QUARTZ)
|
||||
#ifdef QUARTZ
|
||||
// m_aNPWindow is set up in the MacPluginComm from the view
|
||||
m_aSysPlugData.m_pParentView = pEnvData->pView;
|
||||
#elif defined( UNX )
|
||||
XSync( (Display*)pEnvData->pDisplay, False );
|
||||
#endif
|
||||
#ifdef UNX
|
||||
#if !defined(QUARTZ)
|
||||
m_aNPWindow.window = (void*)pEnvData->aWindow;
|
||||
m_aNPWindow.ws_info = NULL;
|
||||
#else
|
||||
// FIXME: this is untested and possiblz wrong
|
||||
m_aNPWindow.window = (void*)pEnvData->pView;
|
||||
m_aNPWindow.type = NPWindowTypeWindow;
|
||||
#endif //QUARTZ
|
||||
#else
|
||||
m_aNPWindow.window = (void*)pEnvData->hWnd;
|
||||
#endif
|
||||
@ -604,8 +592,7 @@ void XPlugin_Impl::loadPlugin()
|
||||
m_aNPWindow.width = aPosSize.Width ? aPosSize.Width : 600;
|
||||
m_aNPWindow.height = aPosSize.Height ? aPosSize.Height : 600;
|
||||
|
||||
aError = getPluginComm()->
|
||||
NPP_SetWindow( getNPPInstance(), &m_aNPWindow );
|
||||
aError = getPluginComm()->NPP_SetWindow( this );
|
||||
}
|
||||
|
||||
void XPlugin_Impl::destroyStreams()
|
||||
@ -768,7 +755,7 @@ sal_Bool XPlugin_Impl::provideNewStream(const OUString& mimetype,
|
||||
fprintf( stderr,
|
||||
"new stream \"%s\" of MIMEType \"%s\"\n"
|
||||
"for plugin \"%s\"\n"
|
||||
"seekable = %s, length = %d\n",
|
||||
"seekable = %s, length = %"SAL_PRIdINT32"\n",
|
||||
aURL.getStr(), aMIME.getStr(), getPluginComm()->getLibName().getStr(),
|
||||
isfile ? "true" : "false", length );
|
||||
|
||||
@ -879,7 +866,7 @@ void XPlugin_Impl::setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_,
|
||||
Guard< Mutex > aGuard( m_aMutex );
|
||||
|
||||
#if OSL_DEBUG_LEVEL > 1
|
||||
fprintf( stderr, "XPlugin_Impl::setPosSize( %d, %d, %d, %d, %d )\n",
|
||||
fprintf( stderr, "XPlugin_Impl::setPosSize( %"SAL_PRIdINT32", %"SAL_PRIdINT32", %"SAL_PRIdINT32", %"SAL_PRIdINT32", %d )\n",
|
||||
nX_, nY_, nWidth_, nHeight_, nFlags );
|
||||
#endif
|
||||
|
||||
@ -894,8 +881,8 @@ void XPlugin_Impl::setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_,
|
||||
m_aNPWindow.clipRect.right = ::sal::static_int_cast< uint16, sal_Int32 >( nWidth_ );
|
||||
m_aNPWindow.clipRect.bottom = ::sal::static_int_cast< uint16, sal_Int32 >( nHeight_ );
|
||||
|
||||
if(getPluginComm())
|
||||
getPluginComm()->NPP_SetWindow( getNPPInstance(), &m_aNPWindow );
|
||||
if( getPluginComm() )
|
||||
getPluginComm()->NPP_SetWindow( this );
|
||||
}
|
||||
|
||||
PluginDescription XPlugin_Impl::fitDescription( const OUString& rURL )
|
||||
@ -959,8 +946,7 @@ PluginStream::~PluginStream()
|
||||
m_pPlugin->getPluginComm()->NPP_DestroyStream( m_pPlugin->getNPPInstance(),
|
||||
&m_aNPStream, NPRES_DONE );
|
||||
m_pPlugin->checkListeners( m_aNPStream.url );
|
||||
m_pPlugin->getPluginComm()->NPP_SetWindow( m_pPlugin->getNPPInstance(),
|
||||
m_pPlugin->getNPWindow());
|
||||
m_pPlugin->getPluginComm()->NPP_SetWindow( m_pPlugin );
|
||||
}
|
||||
::free( (void*)m_aNPStream.url );
|
||||
}
|
||||
@ -1018,8 +1004,7 @@ PluginInputStream::~PluginInputStream()
|
||||
&m_aNPStream,
|
||||
aFileName.GetBuffer() );
|
||||
}
|
||||
m_pPlugin->getPluginComm()->NPP_SetWindow( m_pPlugin->getNPPInstance(),
|
||||
m_pPlugin->getNPWindow());
|
||||
m_pPlugin->getPluginComm()->NPP_SetWindow( m_pPlugin );
|
||||
m_pPlugin->getInputStreams().remove( this );
|
||||
}
|
||||
else
|
||||
|
@ -35,65 +35,135 @@
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <premac.h>
|
||||
#include "premac.h"
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <Security/cssmconfig.h>
|
||||
#include <postmac.h>
|
||||
#include "postmac.h"
|
||||
#undef uint32
|
||||
#include <npsdk/npapi.h>
|
||||
#include <npsdk/npupp.h>
|
||||
|
||||
#include <plugin/plcom.hxx>
|
||||
#include <premac.h>
|
||||
#define XP_MAC
|
||||
#include "npsdk/npapi.h"
|
||||
#include "npsdk/npupp.h"
|
||||
|
||||
#include "plugin/plcom.hxx"
|
||||
#include "premac.h"
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include <postmac.h>
|
||||
#include "postmac.h"
|
||||
|
||||
#include <vcl/sysdata.hxx>
|
||||
#include "vcl/sysdata.hxx"
|
||||
#include "vcl/threadex.hxx"
|
||||
#include "vcl/timer.hxx"
|
||||
#include "osl/module.h"
|
||||
|
||||
class XPlugin_Impl;
|
||||
|
||||
namespace plugstringhelper
|
||||
{
|
||||
rtl::OUString getString( CFStringRef i_xString );
|
||||
rtl::OUString getString( CFURLRef i_xURL );
|
||||
CFMutableStringRef createString( const rtl::OUString& i_rString );
|
||||
CFURLRef createURL( const rtl::OUString& i_rString );
|
||||
rtl::OUString getURLFromPath( const rtl::OUString& i_rPath );
|
||||
CFURLRef createURLFromPath( const rtl::OUString& i_rPath );
|
||||
rtl::OUString CFURLtoOSLURL( CFURLRef i_xURL );
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
class MacPluginComm : public PluginComm
|
||||
class MacPluginComm :
|
||||
public PluginComm,
|
||||
public ::vcl::SolarThreadExecutor
|
||||
|
||||
{
|
||||
private:
|
||||
static int nConnCounter;
|
||||
enum CallType {
|
||||
eNPP_Destroy,
|
||||
eNPP_DestroyStream,
|
||||
eNPP_GetJavaClass,
|
||||
eNPP_Initialize,
|
||||
eNPP_New,
|
||||
eNPP_NewStream,
|
||||
eNPP_Print,
|
||||
eNPP_SetWindow,
|
||||
eNPP_Shutdown,
|
||||
eNPP_StreamAsFile,
|
||||
eNPP_URLNotify,
|
||||
eNPP_Write,
|
||||
eNPP_WriteReady,
|
||||
eNPP_GetValue,
|
||||
eNPP_SetValue,
|
||||
eNPP_HandleEvent,
|
||||
eNP_Initialize
|
||||
};
|
||||
|
||||
pid_t m_nCommPID;
|
||||
void* m_aArgs[ 8 ];
|
||||
CallType m_eCall;
|
||||
|
||||
virtual long doIt();
|
||||
public:
|
||||
MacPluginComm( const String& mimetype,
|
||||
const String& library,
|
||||
NSView* pParent,
|
||||
int nDescriptor1,
|
||||
int nDescriptor2
|
||||
);
|
||||
virtual ~MacPluginComm();
|
||||
MacPluginComm( const rtl::OUString& rMIME, const rtl::OUString& rName, NSView* pView );
|
||||
virtual ~MacPluginComm();
|
||||
|
||||
virtual NPError NPP_Destroy( NPP instance, NPSavedData** save );
|
||||
virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream,
|
||||
NPError reason );
|
||||
virtual void* NPP_GetJavaClass();
|
||||
virtual NPError NPP_Initialize();
|
||||
virtual NPError NPP_New( NPMIMEType pluginType, NPP instance,
|
||||
uint16 mode, int16 argc,
|
||||
char* argn[], char* argv[], NPSavedData *saved );
|
||||
virtual NPError NPP_NewStream( NPP instance, NPMIMEType type,
|
||||
NPStream* stream,
|
||||
NPBool seekable, uint16* stype );
|
||||
virtual void NPP_Print( NPP instance, NPPrint* platformPrint );
|
||||
virtual NPError NPP_SetWindow( NPP instance, NPWindow* window );
|
||||
virtual void NPP_Shutdown();
|
||||
virtual void NPP_StreamAsFile( NPP instance, NPStream* stream,
|
||||
const char* fname );
|
||||
virtual void NPP_URLNotify( NPP instance, const char* url, NPReason reason,
|
||||
void* notifyData );
|
||||
virtual int32 NPP_Write( NPP instance, NPStream* stream, int32 offset,
|
||||
int32 len, void* buffer );
|
||||
virtual int32 NPP_WriteReady( NPP instance, NPStream* stream );
|
||||
virtual char* NPP_GetMIMEDescription();
|
||||
virtual NPError NPP_GetValue( NPP instance, NPPVariable variable, void* value );
|
||||
virtual NPError NPP_SetValue( NPP instance, NPNVariable variable,
|
||||
void *value);
|
||||
// FIXME:
|
||||
// this actually should be from the NP headers
|
||||
// but currently we have too old a version
|
||||
// changes this when we have updated our headers
|
||||
typedef struct NP_CGContext
|
||||
{
|
||||
CGContextRef context;
|
||||
WindowRef window;
|
||||
} NP_CGContext;
|
||||
|
||||
public:
|
||||
virtual NPError NPP_Destroy( NPP instance, NPSavedData** save );
|
||||
virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason );
|
||||
virtual void * NPP_GetJavaClass();
|
||||
virtual NPError NPP_Initialize();
|
||||
virtual NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
|
||||
char* argn[], char* argv[], NPSavedData *saved );
|
||||
virtual NPError NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream,
|
||||
NPBool seekable, uint16* stype );
|
||||
virtual void NPP_Print( NPP instance, NPPrint* platformPrint );
|
||||
virtual NPError NPP_SetWindow( NPP instance, NPWindow* window );
|
||||
virtual void NPP_Shutdown();
|
||||
virtual void NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname );
|
||||
virtual void NPP_URLNotify( NPP instance, const char* url,
|
||||
NPReason reason, void* notifyData );
|
||||
virtual int32 NPP_Write( NPP instance, NPStream* stream, int32 offset,
|
||||
int32 len, void* buffer );
|
||||
virtual int32 NPP_WriteReady( NPP instance, NPStream* stream );
|
||||
virtual NPError NPP_GetValue( NPP instance, NPPVariable variable, void *ret_value );
|
||||
virtual NPError NPP_SetValue( NPP instance, NPNVariable variable, void *ret_value );
|
||||
virtual int16 NPP_HandleEvent( NPP instance, void* event );
|
||||
|
||||
virtual NPError NPP_SetWindow( XPlugin_Impl* );
|
||||
virtual NPError NPP_Destroy( XPlugin_Impl*, NPSavedData** save );
|
||||
|
||||
void drawView( XPlugin_Impl* );
|
||||
private:
|
||||
BOOL retrieveFunction( const char* i_pName, void** i_ppFunc ) const;
|
||||
DECL_LINK( NullTimerHdl, void* );
|
||||
|
||||
private:
|
||||
CFBundleRef m_xBundle;
|
||||
oslModule m_hPlugLib;
|
||||
NPPluginFuncs m_aNPPfuncs;
|
||||
|
||||
// timer for sending nullEvents
|
||||
AutoTimer* m_pNullTimer;
|
||||
std::list< XPlugin_Impl* > m_aNullEventClients;
|
||||
};
|
||||
|
||||
struct SysPlugData
|
||||
{
|
||||
MacPluginComm::NP_CGContext m_aCGContext;
|
||||
NP_Port m_aNPPort;
|
||||
NSView* m_pParentView;
|
||||
NSView* m_pPlugView;
|
||||
int m_nDrawingModel;
|
||||
NSPoint m_aLastPlugViewOrigin;
|
||||
bool m_bSetWindowOnDraw;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -34,64 +34,73 @@
|
||||
#include <limits>
|
||||
#endif
|
||||
|
||||
#include <cppuhelper/weak.hxx>
|
||||
#include <com/sun/star/awt/Key.hpp>
|
||||
#include <com/sun/star/awt/KeyFunction.hpp>
|
||||
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
||||
#include <com/sun/star/plugin/PluginMode.hpp>
|
||||
#include <com/sun/star/plugin/PluginDescription.hpp>
|
||||
#include <com/sun/star/plugin/PluginException.hpp>
|
||||
#include <com/sun/star/plugin/PluginVariable.hpp>
|
||||
#include <com/sun/star/plugin/XPlugin.hpp>
|
||||
#include <com/sun/star/plugin/XPluginManager.hpp>
|
||||
#include <com/sun/star/plugin/XPluginContext.hpp>
|
||||
#include <com/sun/star/io/XConnectable.hpp>
|
||||
#include <com/sun/star/io/XOutputStream.hpp>
|
||||
#include <com/sun/star/io/XDataOutputStream.hpp>
|
||||
#include <com/sun/star/io/XActiveDataControl.hpp>
|
||||
#include <com/sun/star/io/XDataInputStream.hpp>
|
||||
#include <com/sun/star/io/XMarkableStream.hpp>
|
||||
#include <com/sun/star/io/XInputStream.hpp>
|
||||
#include <com/sun/star/io/XStreamListener.hpp>
|
||||
#include <com/sun/star/io/XActiveDataSink.hpp>
|
||||
#include <com/sun/star/io/XActiveDataSource.hpp>
|
||||
#include <com/sun/star/lang/XServiceName.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
||||
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
|
||||
#include <com/sun/star/awt/GradientStyle.hpp>
|
||||
#include <com/sun/star/awt/RasterOperation.hpp>
|
||||
#include <com/sun/star/awt/Gradient.hpp>
|
||||
#include <com/sun/star/awt/XGraphics.hpp>
|
||||
#include "cppuhelper/weak.hxx"
|
||||
|
||||
#include <cppuhelper/implbase3.hxx>
|
||||
#include <cppuhelper/implbase2.hxx>
|
||||
#include <cppuhelper/implbase1.hxx>
|
||||
#include "com/sun/star/awt/Key.hpp"
|
||||
#include "com/sun/star/awt/KeyFunction.hpp"
|
||||
#include "com/sun/star/beans/PropertyAttribute.hpp"
|
||||
#include "com/sun/star/plugin/PluginMode.hpp"
|
||||
#include "com/sun/star/plugin/PluginDescription.hpp"
|
||||
#include "com/sun/star/plugin/PluginException.hpp"
|
||||
#include "com/sun/star/plugin/PluginVariable.hpp"
|
||||
#include "com/sun/star/plugin/XPlugin.hpp"
|
||||
#include "com/sun/star/plugin/XPluginManager.hpp"
|
||||
#include "com/sun/star/plugin/XPluginContext.hpp"
|
||||
#include "com/sun/star/io/XConnectable.hpp"
|
||||
#include "com/sun/star/io/XOutputStream.hpp"
|
||||
#include "com/sun/star/io/XDataOutputStream.hpp"
|
||||
#include "com/sun/star/io/XActiveDataControl.hpp"
|
||||
#include "com/sun/star/io/XDataInputStream.hpp"
|
||||
#include "com/sun/star/io/XMarkableStream.hpp"
|
||||
#include "com/sun/star/io/XInputStream.hpp"
|
||||
#include "com/sun/star/io/XStreamListener.hpp"
|
||||
#include "com/sun/star/io/XActiveDataSink.hpp"
|
||||
#include "com/sun/star/io/XActiveDataSource.hpp"
|
||||
#include "com/sun/star/lang/XServiceName.hpp"
|
||||
#include "com/sun/star/lang/XServiceInfo.hpp"
|
||||
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
|
||||
#include "com/sun/star/lang/XSingleServiceFactory.hpp"
|
||||
#include "com/sun/star/awt/GradientStyle.hpp"
|
||||
#include "com/sun/star/awt/RasterOperation.hpp"
|
||||
#include "com/sun/star/awt/Gradient.hpp"
|
||||
#include "com/sun/star/awt/XGraphics.hpp"
|
||||
|
||||
#include "cppuhelper/implbase3.hxx"
|
||||
#include "cppuhelper/implbase2.hxx"
|
||||
#include "cppuhelper/implbase1.hxx"
|
||||
|
||||
#include <list>
|
||||
|
||||
#ifdef WNT
|
||||
#include <plugin/win/sysplug.hxx>
|
||||
#else
|
||||
#include <list>
|
||||
#include "plugin/win/sysplug.hxx"
|
||||
#endif
|
||||
|
||||
#ifdef OS2
|
||||
#include <plugin/os2/sysplug.hxx>
|
||||
#include "plugin/os2/sysplug.hxx"
|
||||
#endif
|
||||
|
||||
#if defined(UNX)
|
||||
#if defined(QUARTZ)
|
||||
#include <plugin/aqua/sysplug.hxx>
|
||||
#include "plugin/aqua/sysplug.hxx"
|
||||
#else
|
||||
#include <plugin/unx/sysplug.hxx>
|
||||
#include "plugin/unx/sysplug.hxx"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <vcl/sysdata.hxx>
|
||||
#include <vcl/syschild.hxx>
|
||||
#include <plugin/plctrl.hxx>
|
||||
#include <plugin/model.hxx>
|
||||
#include <tools/link.hxx>
|
||||
#include <tools/stream.hxx>
|
||||
#if ! defined (QUARTZ)
|
||||
// the QUARTZ implementation needs special instance data
|
||||
typedef int SysPlugData;
|
||||
#endif
|
||||
|
||||
#include "plugin/plctrl.hxx"
|
||||
#include "plugin/model.hxx"
|
||||
|
||||
#include "vcl/sysdata.hxx"
|
||||
#include "vcl/syschild.hxx"
|
||||
|
||||
#include "tools/link.hxx"
|
||||
#include "tools/stream.hxx"
|
||||
|
||||
|
||||
using namespace com::sun::star::uno;
|
||||
|
||||
@ -120,6 +129,7 @@ private:
|
||||
PluginComm* m_pPluginComm;
|
||||
NPP_t m_aInstance;
|
||||
NPWindow m_aNPWindow;
|
||||
SysPlugData m_aSysPlugData;
|
||||
rtl_TextEncoding m_aEncoding;
|
||||
|
||||
const char** m_pArgv;
|
||||
@ -182,6 +192,7 @@ public:
|
||||
rtl_TextEncoding getTextEncoding() { return m_aEncoding; }
|
||||
NPP getNPPInstance() { return &m_aInstance; }
|
||||
NPWindow* getNPWindow() { return &m_aNPWindow; }
|
||||
SysPlugData& getSysPlugData() { return m_aSysPlugData; }
|
||||
|
||||
void enterPluginCallback() { m_nCalledFromPlugin++; }
|
||||
void leavePluginCallback() { m_nCalledFromPlugin--; }
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include <tools/string.hxx>
|
||||
#include <list>
|
||||
|
||||
class XPlugin_Impl;
|
||||
|
||||
class PluginComm
|
||||
{
|
||||
protected:
|
||||
@ -78,6 +80,9 @@ public:
|
||||
virtual NPError NPP_GetValue( NPP instance, NPPVariable variable, void* value ) = 0;
|
||||
virtual NPError NPP_SetValue( NPP instance, NPNVariable variable,
|
||||
void *value) = 0;
|
||||
|
||||
virtual NPError NPP_SetWindow( XPlugin_Impl* );
|
||||
virtual NPError NPP_Destroy( XPlugin_Impl*, NPSavedData** save );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
);
|
||||
virtual ~UnxPluginComm();
|
||||
|
||||
using PluginComm::NPP_Destroy;
|
||||
virtual NPError NPP_Destroy( NPP instance, NPSavedData** save );
|
||||
virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream,
|
||||
NPError reason );
|
||||
@ -63,6 +64,8 @@ public:
|
||||
NPStream* stream,
|
||||
NPBool seekable, uint16* stype );
|
||||
virtual void NPP_Print( NPP instance, NPPrint* platformPrint );
|
||||
|
||||
using PluginComm::NPP_SetWindow;
|
||||
virtual NPError NPP_SetWindow( NPP instance, NPWindow* window );
|
||||
virtual void NPP_Shutdown();
|
||||
virtual void NPP_StreamAsFile( NPP instance, NPStream* stream,
|
||||
|
@ -90,6 +90,7 @@ public:
|
||||
virtual ~PluginComm_Impl();
|
||||
|
||||
public:
|
||||
using PluginComm::NPP_Destroy;
|
||||
virtual NPError NPP_Destroy( NPP instance, NPSavedData** save );
|
||||
virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason );
|
||||
virtual void * NPP_GetJavaClass();
|
||||
@ -99,6 +100,8 @@ public:
|
||||
virtual NPError NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream,
|
||||
NPBool seekable, uint16* stype );
|
||||
virtual void NPP_Print( NPP instance, NPPrint* platformPrint );
|
||||
|
||||
using PluginComm::NPP_SetWindow;
|
||||
virtual NPError NPP_SetWindow( NPP instance, NPWindow* window );
|
||||
virtual void NPP_Shutdown();
|
||||
virtual void NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname );
|
||||
|
@ -42,6 +42,11 @@ CDEFS+=-DENABLE_GTK
|
||||
PKGCONFIG_MODULES+=gtk+-2.0 gthread-2.0
|
||||
.ENDIF
|
||||
|
||||
.IF "$(GUIBASE)" == "aqua"
|
||||
CFLAGS += -I$(FRAMEWORKSHOME)/ApplicationServices.framework/Versions/Current/Frameworks/QD.framework/Headers\
|
||||
-I$(FRAMEWORKSHOME)/Carbon.framework/Versions/Current/Frameworks/HIToolbox.framework/Versions/Current/Headers
|
||||
.ENDIF
|
||||
|
||||
.IF "$(PKGCONFIG_MODULES)" != ""
|
||||
.INCLUDE : pkg_config.mk
|
||||
.ENDIF
|
||||
|
@ -85,6 +85,14 @@ public class InstallationOngoingCtrl extends PanelController {
|
||||
PackageCollector.sortPackages(installPackages, sortedPackages, "install");
|
||||
installData.setInstallPackages(sortedPackages);
|
||||
|
||||
if ( installData.isMajorUpgrade() ) {
|
||||
// PackageCollector.findOldPackages(installData);
|
||||
// Sorting for correct order of uninstallation
|
||||
Vector sortedUninstallPackages = new Vector();
|
||||
PackageCollector.sortPackages(installData.getOldPackages(), sortedUninstallPackages, "uninstall");
|
||||
installData.setOldPackages(sortedUninstallPackages);
|
||||
}
|
||||
|
||||
Installer installer = InstallerFactory.getInstance();
|
||||
installer.preInstallationOngoing();
|
||||
}
|
||||
@ -96,6 +104,7 @@ public class InstallationOngoingCtrl extends PanelController {
|
||||
InstallData installData = InstallData.getInstance();
|
||||
InstallationOngoing panel = (InstallationOngoing)getPanel();
|
||||
Vector installPackages = installData.getInstallPackages();
|
||||
Vector removePackages = installData.getOldPackages();
|
||||
private Vector installedPackages = new Vector();
|
||||
|
||||
public void run() {
|
||||
@ -110,6 +119,18 @@ public class InstallationOngoingCtrl extends PanelController {
|
||||
panel.setProgressValue(progress);
|
||||
panel.setProgressText(packageData.getPackageName());
|
||||
|
||||
// Creating an upgrade process for Solaris packages
|
||||
if ( installData.getOSType().equalsIgnoreCase("SunOS") ) {
|
||||
if ( installer.isPackageInstalled(packageData, installData) ) {
|
||||
if ( installer.isInstalledPackageOlder(packageData, installData) ) {
|
||||
packageData.setIgnoreDependsForUninstall(true);
|
||||
installer.uninstallPackage(packageData);
|
||||
} else {
|
||||
continue; // no downgrading
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
installer.installPackage(packageData);
|
||||
installedPackages.add(packageData);
|
||||
|
||||
@ -118,6 +139,13 @@ public class InstallationOngoingCtrl extends PanelController {
|
||||
}
|
||||
}
|
||||
|
||||
if ( installData.isMajorUpgrade() ) {
|
||||
for (int i = 0; i < removePackages.size(); i++) {
|
||||
PackageDescription packageData = (PackageDescription) removePackages.get(i);
|
||||
installer.uninstallPackage(packageData);
|
||||
}
|
||||
}
|
||||
|
||||
if ( installData.isAbortedInstallation() ) {
|
||||
// undoing the installation
|
||||
LogManager.setCommandsHeaderLine("Installation aborted!");
|
||||
|
@ -95,7 +95,9 @@ public class UninstallationPrologueCtrl extends PanelController {
|
||||
// adding information to installData
|
||||
data.setPackagePath((String)map.get("PackagePath"));
|
||||
data.setAdminFileNameReloc((String)map.get("AdminFileReloc"));
|
||||
data.setAdminFileNameRelocNoDepends((String)map.get("AdminFileRelocNoDepends"));
|
||||
data.setAdminFileNameNoReloc((String)map.get("AdminFileNoReloc"));
|
||||
data.setAdminFileNameNoRelocNoDepends((String)map.get("AdminFileNoRelocNoDepends"));
|
||||
data.setDatabasePath((String)map.get("DatabasePath"));
|
||||
data.setInstallDir((String)map.get("InstallationDir"));
|
||||
data.setStoredInstallationPrivileges((String)map.get("InstallationPrivileges"));
|
||||
|
@ -71,11 +71,13 @@ public class InstallData
|
||||
static private boolean olderVersionExists = false;
|
||||
static private boolean sameVersionExists = false;
|
||||
static private boolean newerVersionExists = false;
|
||||
static private boolean majorUpgrade = false;
|
||||
static private boolean isMultiLingual = false;
|
||||
static private boolean dontUpdate = false;
|
||||
static private boolean hideEula = false;
|
||||
static private boolean databaseQueried = false;
|
||||
static private boolean useRtl = false;
|
||||
static private boolean installedProductMinorSet = false;
|
||||
static private String installType; /* custom or typical installation */
|
||||
static private String osType; /* Linux, SunOS, ... */
|
||||
static private String installDir = null;
|
||||
@ -87,7 +89,9 @@ public class InstallData
|
||||
static private String packagePath = null;
|
||||
static private String packageSubdir = "packages";
|
||||
static private String adminFileNameReloc = null;
|
||||
static private String adminFileNameRelocNoDepends = null;
|
||||
static private String adminFileNameNoReloc = null;
|
||||
static private String adminFileNameNoRelocNoDepends = null;
|
||||
static private String databasePath = null;
|
||||
static private String getUidPath = null;
|
||||
static private String installationPrivileges = null;
|
||||
@ -97,6 +101,8 @@ public class InstallData
|
||||
static private String uninstallDirName = "uninstalldata";
|
||||
static private int availableDiscSpace = 0;
|
||||
static private int preselectedLanguages = 0;
|
||||
static private int productMinor = 0;
|
||||
static private int installedProductMinor = 0;
|
||||
static private File jarFilePath = null;
|
||||
static private File resourceRoot;
|
||||
static private File infoRoot;
|
||||
@ -105,6 +111,7 @@ public class InstallData
|
||||
static private PackageDescription updatePackage = null;
|
||||
static private Vector removeFiles = new Vector(); /* Files to remove, if installation is aborted */
|
||||
static private Vector installPackages = new Vector();
|
||||
static private Vector oldPackages = new Vector();
|
||||
static private Vector systemLanguages = new Vector();
|
||||
|
||||
public static InstallData getInstance()
|
||||
@ -290,6 +297,22 @@ public class InstallData
|
||||
productDir = dir;
|
||||
}
|
||||
|
||||
public int getProductMinor() {
|
||||
return productMinor;
|
||||
}
|
||||
|
||||
public void setProductMinor(int minor) {
|
||||
productMinor = minor;
|
||||
}
|
||||
|
||||
public int getInstalledProductMinor() {
|
||||
return installedProductMinor;
|
||||
}
|
||||
|
||||
public void setInstalledProductMinor(int minor) {
|
||||
installedProductMinor = minor;
|
||||
}
|
||||
|
||||
public String getInstallDirName() {
|
||||
return installDirName;
|
||||
}
|
||||
@ -389,6 +412,14 @@ public class InstallData
|
||||
adminFileNameReloc = fileName;
|
||||
}
|
||||
|
||||
public String getAdminFileNameRelocNoDepends() {
|
||||
return adminFileNameRelocNoDepends;
|
||||
}
|
||||
|
||||
public void setAdminFileNameRelocNoDepends(String fileName) {
|
||||
adminFileNameRelocNoDepends = fileName;
|
||||
}
|
||||
|
||||
public String getAdminFileNameNoReloc() {
|
||||
return adminFileNameNoReloc;
|
||||
}
|
||||
@ -397,6 +428,14 @@ public class InstallData
|
||||
adminFileNameNoReloc = fileName;
|
||||
}
|
||||
|
||||
public String getAdminFileNameNoRelocNoDepends() {
|
||||
return adminFileNameNoRelocNoDepends;
|
||||
}
|
||||
|
||||
public void setAdminFileNameNoRelocNoDepends(String fileName) {
|
||||
adminFileNameNoRelocNoDepends = fileName;
|
||||
}
|
||||
|
||||
public String getGetUidPath() {
|
||||
return getUidPath;
|
||||
}
|
||||
@ -565,6 +604,14 @@ public class InstallData
|
||||
olderVersionExists = exists;
|
||||
}
|
||||
|
||||
public boolean isMajorUpgrade() {
|
||||
return majorUpgrade;
|
||||
}
|
||||
|
||||
public void setMajorUpgrade(boolean upgrade) {
|
||||
majorUpgrade = upgrade;
|
||||
}
|
||||
|
||||
public boolean sameVersionExists() {
|
||||
return sameVersionExists;
|
||||
}
|
||||
@ -597,6 +644,14 @@ public class InstallData
|
||||
hideEula = value;
|
||||
}
|
||||
|
||||
public boolean installedProductMinorSet() {
|
||||
return installedProductMinorSet;
|
||||
}
|
||||
|
||||
public void setInstalledProductMinorSet(boolean value) {
|
||||
installedProductMinorSet = value;
|
||||
}
|
||||
|
||||
public boolean databaseQueried() {
|
||||
return databaseQueried;
|
||||
}
|
||||
@ -637,6 +692,14 @@ public class InstallData
|
||||
installPackages = packages;
|
||||
}
|
||||
|
||||
public Vector getOldPackages() {
|
||||
return oldPackages;
|
||||
}
|
||||
|
||||
public void setOldPackages(Vector packages) {
|
||||
oldPackages = packages;
|
||||
}
|
||||
|
||||
public Vector getSystemLanguages() {
|
||||
return systemLanguages;
|
||||
}
|
||||
|
@ -409,12 +409,17 @@ public class LinuxInstaller extends Installer {
|
||||
log = rpmCommand + "<br><b>Returns: " + returnValue + " Successful uninstallation</b><br>";
|
||||
LogManager.addCommandsLogfileComment(log);
|
||||
} else { // an error occured during installation
|
||||
log = rpmCommand + "<br><b>Returns: " + returnValue + " Error during uninstallation</b><br>";
|
||||
LogManager.addCommandsLogfileComment(log);
|
||||
for (int i = 0; i < returnErrorVector.size(); i++) {
|
||||
LogManager.addCommandsLogfileComment((String)returnErrorVector.get(i));
|
||||
if ( packageData.uninstallCanFail() ) {
|
||||
log = rpmCommand + "<br><b>Returns: " + returnValue + " Problem during uninstallation. Can be ignored.</b><br>";
|
||||
LogManager.addCommandsLogfileComment(log);
|
||||
} else {
|
||||
log = rpmCommand + "<br><b>Returns: " + returnValue + " Error during uninstallation</b><br>";
|
||||
LogManager.addCommandsLogfileComment(log);
|
||||
for (int i = 0; i < returnErrorVector.size(); i++) {
|
||||
LogManager.addCommandsLogfileComment((String)returnErrorVector.get(i));
|
||||
}
|
||||
data.setIsErrorInstallation(true);
|
||||
}
|
||||
data.setIsErrorInstallation(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -538,7 +543,8 @@ public class LinuxInstaller extends Installer {
|
||||
String onePackage = (String)returnVector.get(i);
|
||||
int pos1 = onePackage.lastIndexOf("-");
|
||||
int pos2 = onePackage.substring(0, pos1).lastIndexOf("-");
|
||||
map.put(onePackage.substring(0, pos2), value);
|
||||
String key = onePackage.substring(0, pos2);
|
||||
map.put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -667,6 +673,12 @@ public class LinuxInstaller extends Installer {
|
||||
log = rpmCommand + "<br><b>Returns: " + version + "</b><br>";
|
||||
LogManager.addCommandsLogfileComment(log);
|
||||
|
||||
if ( ! installData.installedProductMinorSet() ) {
|
||||
int productMinor = helper.getInstalledMinor(version);
|
||||
installData.setInstalledProductMinor(productMinor);
|
||||
installData.setInstalledProductMinorSet(true);
|
||||
}
|
||||
|
||||
if (useLocalDatabase) {
|
||||
rpmCommand = "rpm" + " " + databaseString + " " + databasePath + " -q --queryformat %{RELEASE}\\n " + packageName;
|
||||
rpmCommandArray[5] = "%{RELEASE}\\n";
|
||||
|
@ -81,8 +81,11 @@ public class SolarisInstaller extends Installer {
|
||||
|
||||
if ( data.isInstallationMode()) {
|
||||
boolean makeRelocatableAdminFile = true;
|
||||
helper.createAdminFile(makeRelocatableAdminFile);
|
||||
helper.createAdminFile(! makeRelocatableAdminFile);
|
||||
boolean removeDepends = true;
|
||||
helper.createAdminFile(makeRelocatableAdminFile, removeDepends);
|
||||
helper.createAdminFile(makeRelocatableAdminFile, ! removeDepends);
|
||||
helper.createAdminFile(! makeRelocatableAdminFile, removeDepends);
|
||||
helper.createAdminFile(! makeRelocatableAdminFile, ! removeDepends);
|
||||
}
|
||||
|
||||
if ( data.isUserInstallation() ) {
|
||||
@ -259,9 +262,17 @@ public class SolarisInstaller extends Installer {
|
||||
|
||||
// is package relocatable or not?
|
||||
if ( packageData.isRelocatable() ) {
|
||||
adminFileName = data.getAdminFileNameReloc();
|
||||
if ( packageData.ignoreDependsForUninstall() ) { // Force removal of older packages during installation
|
||||
adminFileName = data.getAdminFileNameRelocNoDepends();
|
||||
} else {
|
||||
adminFileName = data.getAdminFileNameReloc();
|
||||
}
|
||||
} else {
|
||||
adminFileName = data.getAdminFileNameNoReloc();
|
||||
if ( packageData.ignoreDependsForUninstall() ) { // Force removal of older packages during installation
|
||||
adminFileName = data.getAdminFileNameNoRelocNoDepends();
|
||||
} else {
|
||||
adminFileName = data.getAdminFileNameNoReloc();
|
||||
}
|
||||
}
|
||||
|
||||
String pkgCommand = "";
|
||||
@ -300,16 +311,20 @@ public class SolarisInstaller extends Installer {
|
||||
log = pkgCommand + "<br><b>Returns: " + returnValue + " Successful uninstallation</b><br>";
|
||||
LogManager.addCommandsLogfileComment(log);
|
||||
} else { // an error occured during installation
|
||||
log = pkgCommand + "<br><b>Returns: " + returnValue + " Error during uninstallation</b><br>";
|
||||
LogManager.addCommandsLogfileComment(log);
|
||||
System.err.println("Error during uninstallation:");
|
||||
for (int i = 0; i < returnErrorVector.size(); i++) {
|
||||
LogManager.addCommandsLogfileComment((String)returnErrorVector.get(i));
|
||||
System.err.println(returnErrorVector.get(i));
|
||||
if ( packageData.uninstallCanFail() ) {
|
||||
log = pkgCommand + "<br><b>Returns: " + returnValue + " Problem during uninstallation. Can be ignored.</b><br>";
|
||||
LogManager.addCommandsLogfileComment(log);
|
||||
} else {
|
||||
log = pkgCommand + "<br><b>Returns: " + returnValue + " Error during uninstallation</b><br>";
|
||||
LogManager.addCommandsLogfileComment(log);
|
||||
System.err.println("Error during uninstallation:");
|
||||
for (int i = 0; i < returnErrorVector.size(); i++) {
|
||||
LogManager.addCommandsLogfileComment((String)returnErrorVector.get(i));
|
||||
System.err.println(returnErrorVector.get(i));
|
||||
}
|
||||
data.setIsErrorInstallation(true);
|
||||
}
|
||||
data.setIsErrorInstallation(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isPackageNameInstalledClassic(String packageName, InstallData installData) {
|
||||
@ -402,7 +417,8 @@ public class SolarisInstaller extends Installer {
|
||||
for (int i = 0; i < returnVector.size(); i++) {
|
||||
String onePackage = (String)returnVector.get(i);
|
||||
int pos1 = onePackage.indexOf(" ");
|
||||
map.put(onePackage.substring(0, pos1), value);
|
||||
String key = onePackage.substring(0, pos1);
|
||||
map.put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -522,6 +538,12 @@ public class SolarisInstaller extends Installer {
|
||||
String installedPackageVersion = helper.getVersionString(returnVector);
|
||||
String newPackageVersion = packageData.getPkgVersion();
|
||||
|
||||
if ( ! installData.installedProductMinorSet() ) {
|
||||
int productMinor = helper.getInstalledMinor(installedPackageVersion);
|
||||
installData.setInstalledProductMinor(productMinor);
|
||||
installData.setInstalledProductMinorSet(true);
|
||||
}
|
||||
|
||||
if (( installedPackageVersion != null ) && ( newPackageVersion != null )) {
|
||||
if ( checkIfInstalledIsOlder ) {
|
||||
firstPackageIsOlder = helper.comparePackageVersions(installedPackageVersion, newPackageVersion);
|
||||
|
@ -241,6 +241,23 @@ import java.util.Vector;public class LinuxHelper {
|
||||
return hashRpm;
|
||||
}
|
||||
|
||||
public int getInstalledMinor(String version) {
|
||||
|
||||
int minor = 0;
|
||||
int pos = version.indexOf(".");
|
||||
if ( pos > -1 ) {
|
||||
String reduced = version.substring(pos + 1, version.length());
|
||||
|
||||
pos = reduced.indexOf(".");
|
||||
if ( pos > -1 ) {
|
||||
reduced = reduced.substring(0, pos);
|
||||
minor = Integer.parseInt(reduced);
|
||||
}
|
||||
}
|
||||
|
||||
return minor;
|
||||
}
|
||||
|
||||
private boolean compareTwoRpms(HashMap hash1, HashMap hash2) {
|
||||
boolean hash1IsOlder = false;
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class SolarisHelper {
|
||||
}
|
||||
}
|
||||
|
||||
private Vector getAdminFileContent(boolean relocatable) {
|
||||
private Vector getAdminFileContent(boolean relocatable, boolean rdepends) {
|
||||
|
||||
Vector adminFile = new Vector();
|
||||
InstallData data = InstallData.getInstance();
|
||||
@ -151,6 +151,7 @@ public class SolarisHelper {
|
||||
|
||||
// String rdependLine = "rdepend=nocheck";
|
||||
String rdependLine = "rdepend=quit";
|
||||
if ( ! rdepends ) { rdependLine = "rdepend=nocheck"; }
|
||||
if ( data.isUserInstallation() ) { rdependLine = "rdepend=nocheck"; }
|
||||
adminFile.add(rdependLine);
|
||||
|
||||
@ -268,25 +269,41 @@ public class SolarisHelper {
|
||||
return databasePath;
|
||||
}
|
||||
|
||||
public void createAdminFile(boolean relocatable) {
|
||||
public void createAdminFile(boolean relocatable, boolean rdepends) {
|
||||
InstallData data = InstallData.getInstance();
|
||||
Vector removeFiles = data.getRemoveFiles();
|
||||
String adminFileName = "";
|
||||
|
||||
if ( relocatable ) {
|
||||
adminFileName = "adminFileReloc";
|
||||
if ( rdepends ) {
|
||||
adminFileName = "adminFileReloc";
|
||||
} else {
|
||||
adminFileName = "adminFileRelocNoDepends";
|
||||
}
|
||||
} else {
|
||||
adminFileName = "adminFileNoReloc";
|
||||
if ( rdepends ) {
|
||||
adminFileName = "adminFileNoReloc";
|
||||
} else {
|
||||
adminFileName = "adminFileNoRelocNoDepends";
|
||||
}
|
||||
}
|
||||
|
||||
Vector fileContent = getAdminFileContent(relocatable);
|
||||
Vector fileContent = getAdminFileContent(relocatable, rdepends);
|
||||
File adminFile = new File(data.getInstallDir(), adminFileName);
|
||||
String completeAdminFileName = adminFile.getPath();
|
||||
|
||||
if ( relocatable ) {
|
||||
data.setAdminFileNameReloc(completeAdminFileName);
|
||||
if ( rdepends ) {
|
||||
data.setAdminFileNameReloc(completeAdminFileName);
|
||||
} else {
|
||||
data.setAdminFileNameRelocNoDepends(completeAdminFileName);
|
||||
}
|
||||
} else {
|
||||
data.setAdminFileNameNoReloc(completeAdminFileName);
|
||||
if ( rdepends ) {
|
||||
data.setAdminFileNameNoReloc(completeAdminFileName);
|
||||
} else {
|
||||
data.setAdminFileNameNoRelocNoDepends(completeAdminFileName);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! adminFile.exists() ) {
|
||||
@ -331,6 +348,24 @@ public class SolarisHelper {
|
||||
return versionString;
|
||||
}
|
||||
|
||||
public int getInstalledMinor(String version) {
|
||||
|
||||
int minor = 0;
|
||||
|
||||
int pos = version.indexOf(".");
|
||||
if ( pos > -1 ) {
|
||||
String reduced = version.substring(pos + 1, version.length());
|
||||
|
||||
pos = reduced.indexOf(".");
|
||||
if ( pos > -1 ) {
|
||||
reduced = reduced.substring(0, pos);
|
||||
minor = Integer.parseInt(reduced);
|
||||
}
|
||||
}
|
||||
|
||||
return minor;
|
||||
}
|
||||
|
||||
public boolean comparePackageVersions(String firstPackageVersion, String secondPackageVersion) {
|
||||
// Analyzing strings: version, 2.0.0,REV=106.2005.05.26
|
||||
|
||||
|
@ -103,9 +103,12 @@ public class PackageDescription implements TreeNode {
|
||||
private boolean isApplicationPackage = false;
|
||||
private boolean isJavaPackage = false;
|
||||
private boolean installCanFail = false;
|
||||
private boolean uninstallCanFail = false;
|
||||
private boolean forceIntoUpdate = false;
|
||||
private boolean useForce = false;
|
||||
private boolean isNewInstalled = false;
|
||||
private boolean wasAlreadyInstalled = false;
|
||||
private boolean ignoreDependsForUninstall = false;
|
||||
|
||||
/* Saving the default selection state. This is necessary, if the user chooses
|
||||
* the custom installation type, makes changes, and then changes into
|
||||
@ -118,6 +121,8 @@ public class PackageDescription implements TreeNode {
|
||||
private int customSelectionState = DONT_KNOW; // Saving settings for custom installation
|
||||
private int startSelectionState = DONT_KNOW; // Saving settings at start of installation
|
||||
|
||||
public PackageDescription() {}
|
||||
|
||||
/**
|
||||
* construct only with package information to wrap
|
||||
*/
|
||||
@ -143,6 +148,10 @@ public class PackageDescription implements TreeNode {
|
||||
return dpyName;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
dpyName = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return dpyDescription;
|
||||
}
|
||||
@ -163,6 +172,10 @@ public class PackageDescription implements TreeNode {
|
||||
return pkgOrder;
|
||||
}
|
||||
|
||||
public void setOrder(int order) {
|
||||
pkgOrder = order;
|
||||
}
|
||||
|
||||
// public int getAccumulatedSize() {
|
||||
// int size = getSize();
|
||||
//
|
||||
@ -215,6 +228,18 @@ public class PackageDescription implements TreeNode {
|
||||
return installCanFail;
|
||||
}
|
||||
|
||||
public boolean uninstallCanFail() {
|
||||
return uninstallCanFail;
|
||||
}
|
||||
|
||||
public void setUninstallCanFail(boolean canFail) {
|
||||
uninstallCanFail = canFail;
|
||||
}
|
||||
|
||||
public boolean forceIntoUpdate() {
|
||||
return forceIntoUpdate;
|
||||
}
|
||||
|
||||
public boolean useForce() {
|
||||
return useForce;
|
||||
}
|
||||
@ -235,6 +260,14 @@ public class PackageDescription implements TreeNode {
|
||||
return wasAlreadyInstalled;
|
||||
}
|
||||
|
||||
public void setIgnoreDependsForUninstall(boolean ignore) {
|
||||
ignoreDependsForUninstall = ignore;
|
||||
}
|
||||
|
||||
public boolean ignoreDependsForUninstall() {
|
||||
return ignoreDependsForUninstall;
|
||||
}
|
||||
|
||||
public boolean isDefault() {
|
||||
return isDefault;
|
||||
}
|
||||
@ -247,10 +280,19 @@ public class PackageDescription implements TreeNode {
|
||||
return isRelocatable;
|
||||
}
|
||||
|
||||
public void setIsRelocatable(boolean relocatable) {
|
||||
isRelocatable = relocatable;
|
||||
}
|
||||
|
||||
public String getPackageName() {
|
||||
return pkgFileName;
|
||||
}
|
||||
|
||||
public void setPackageName(String name) {
|
||||
pkgFileName = name;
|
||||
}
|
||||
|
||||
|
||||
public String getFullPackageName() {
|
||||
return pkgFullName;
|
||||
}
|
||||
@ -468,6 +510,12 @@ public class PackageDescription implements TreeNode {
|
||||
installCanFail = Parser.parseBoolean(installCanFailValue);
|
||||
}
|
||||
|
||||
subSection = section.getElement("forceintoupdate");
|
||||
if (subSection != null) {
|
||||
String forceIntoUpdateValue = subSection.getValue();
|
||||
forceIntoUpdate = Parser.parseBoolean(forceIntoUpdateValue);
|
||||
}
|
||||
|
||||
subSection = section.getElement("useforce");
|
||||
if (subSection != null) {
|
||||
String useForceValue = subSection.getValue();
|
||||
|
@ -239,7 +239,17 @@ public class ProductDescription {
|
||||
installData.setDontUpdate(dontupdate);
|
||||
}
|
||||
|
||||
section = data.getElement("hideeula");
|
||||
/* check for the Product Minor of this installation set */
|
||||
section = data.getElement("productminor");
|
||||
if (section != null) {
|
||||
String value = section.getValue();
|
||||
if (value != null) {
|
||||
int intValue = Integer.parseInt(value);
|
||||
installData.setProductMinor(intValue);
|
||||
}
|
||||
}
|
||||
|
||||
section = data.getElement("hideeula");
|
||||
if (section != null) {
|
||||
String value = section.getValue();
|
||||
if ((value != null) && (! value.equals(""))) {
|
||||
|
@ -179,7 +179,9 @@ public class Dumper {
|
||||
InstallData data = InstallData.getInstance();
|
||||
System.err.println("PackagePath: " + data.getPackagePath());
|
||||
System.err.println("AdminFileReloc: " + data.getAdminFileNameReloc());
|
||||
System.err.println("AdminFileRelocNoDepends: " + data.getAdminFileNameRelocNoDepends());
|
||||
System.err.println("AdminFileNoReloc: " + data.getAdminFileNameNoReloc());
|
||||
System.err.println("AdminFileNoRelocNoDepends: " + data.getAdminFileNameNoRelocNoDepends());
|
||||
System.err.println("DatabasePath: " + data.getDatabasePath());
|
||||
System.err.println("InstallDir: " + data.getInstallDir());
|
||||
System.err.println("Original privileges: " + data.getStoredInstallationPrivileges());
|
||||
|
@ -158,6 +158,15 @@ public class InfoDir {
|
||||
sourceFile.delete();
|
||||
}
|
||||
|
||||
if ( data.getAdminFileNameRelocNoDepends() != null ) {
|
||||
File sourceFile = new File(data.getAdminFileNameRelocNoDepends());
|
||||
String fileName = sourceFile.getName();
|
||||
File destFile = new File(dir, fileName);
|
||||
boolean success = SystemManager.copy(sourceFile.getPath(), destFile.getPath());
|
||||
data.setAdminFileNameRelocNoDepends(destFile.getPath());
|
||||
sourceFile.delete();
|
||||
}
|
||||
|
||||
if ( data.getAdminFileNameNoReloc() != null ) {
|
||||
File sourceFile = new File(data.getAdminFileNameNoReloc());
|
||||
String fileName = sourceFile.getName();
|
||||
@ -167,6 +176,14 @@ public class InfoDir {
|
||||
sourceFile.delete();
|
||||
}
|
||||
|
||||
if ( data.getAdminFileNameNoRelocNoDepends() != null ) {
|
||||
File sourceFile = new File(data.getAdminFileNameNoRelocNoDepends());
|
||||
String fileName = sourceFile.getName();
|
||||
File destFile = new File(dir, fileName);
|
||||
boolean success = SystemManager.copy(sourceFile.getPath(), destFile.getPath());
|
||||
data.setAdminFileNameNoRelocNoDepends(destFile.getPath());
|
||||
sourceFile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
static private void createInfoFile(File dir) {
|
||||
@ -180,8 +197,12 @@ public class InfoDir {
|
||||
fileContent.add(line);
|
||||
line = "AdminFileReloc=" + data.getAdminFileNameReloc();
|
||||
fileContent.add(line);
|
||||
line = "AdminFileRelocNoDepends=" + data.getAdminFileNameRelocNoDepends();
|
||||
fileContent.add(line);
|
||||
line = "AdminFileNoReloc=" + data.getAdminFileNameNoReloc();
|
||||
fileContent.add(line);
|
||||
line = "AdminFileNoRelocNoDepends=" + data.getAdminFileNameNoRelocNoDepends();
|
||||
fileContent.add(line);
|
||||
line = "InstallationDir=" + data.getInstallDir();
|
||||
fileContent.add(line);
|
||||
line = "DatabasePath=" + data.getDatabasePath();
|
||||
@ -207,10 +228,18 @@ public class InfoDir {
|
||||
SystemManager.deleteFile(new File(data.getAdminFileNameReloc()));
|
||||
}
|
||||
|
||||
if ( ! data.getAdminFileNameRelocNoDepends().equals("null") ) {
|
||||
SystemManager.deleteFile(new File(data.getAdminFileNameRelocNoDepends()));
|
||||
}
|
||||
|
||||
if ( ! data.getAdminFileNameNoReloc().equals("null") ) {
|
||||
SystemManager.deleteFile(new File(data.getAdminFileNameNoReloc()));
|
||||
}
|
||||
|
||||
if ( ! data.getAdminFileNameNoRelocNoDepends().equals("null") ) {
|
||||
SystemManager.deleteFile(new File(data.getAdminFileNameNoRelocNoDepends()));
|
||||
}
|
||||
|
||||
if ( ! data.getGetUidPath().equals("null") ) {
|
||||
SystemManager.deleteFile(new File(data.getGetUidPath()));
|
||||
}
|
||||
|
@ -98,6 +98,13 @@ public class InstallChangeCtrl {
|
||||
data.setOlderVersionExists(true);
|
||||
// All installed packages will be updated -> determining which packages are installed
|
||||
System.err.println("An older product is installed");
|
||||
// But if this is a kind of Major Upgrade with different Minor and therefore different package names,
|
||||
// it is necessary to remove the old product.
|
||||
if ( data.getProductMinor() > data.getInstalledProductMinor() )
|
||||
{
|
||||
data.setMajorUpgrade(true);
|
||||
System.err.println("Major Upgrade");
|
||||
}
|
||||
} else if ( installer.isInstallSetPackageOlder(data.getUpdatePackage(), data) ) {
|
||||
data.setNewerVersionExists(true);
|
||||
System.err.println("A newer product is installed");
|
||||
|
@ -180,10 +180,16 @@ public class ModuleCtrl {
|
||||
// System.err.println("Setting allChildrenHidden for module " + packageData.getName() );
|
||||
}
|
||||
|
||||
// System.err.println("Setting " + packageData.getName() + " to " + packageData.getSelectionState() );
|
||||
packageData.setSelectionState(state);
|
||||
// If older version exist, only modules without packages shall be updated,
|
||||
// because all packages are already determined by querying the database.
|
||||
if ( installdata.olderVersionExists() ) {
|
||||
if ( packageData.getPackageName().equals("") ) {
|
||||
packageData.setSelectionState(state);
|
||||
}
|
||||
} else {
|
||||
packageData.setSelectionState(state);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static public void setHiddenModuleSettingsInstall(PackageDescription packageData) {
|
||||
@ -409,6 +415,18 @@ public class ModuleCtrl {
|
||||
}
|
||||
}
|
||||
|
||||
static public void setForcedUpdateProductSettings(PackageDescription packageData) {
|
||||
|
||||
if ( packageData.forceIntoUpdate() ) {
|
||||
packageData.setSelectionState(PackageDescription.INSTALL);
|
||||
}
|
||||
|
||||
for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
|
||||
PackageDescription child = (PackageDescription) e.nextElement();
|
||||
setForcedUpdateProductSettings(child);
|
||||
}
|
||||
}
|
||||
|
||||
static public void setShowInUserInstallOnlyFlags(PackageDescription packageData) {
|
||||
|
||||
// This function is not needed during deinstallation, because a
|
||||
@ -721,6 +739,50 @@ public class ModuleCtrl {
|
||||
}
|
||||
} else {
|
||||
packageData.setSelectionState(PackageDescription.DONT_INSTALL);
|
||||
// Special handling for Major Upgrade
|
||||
if ( data.isMajorUpgrade() ) {
|
||||
String basis = "ooobasis3";
|
||||
if ( data.getOSType().equalsIgnoreCase("Linux") ) { basis = basis + "."; }
|
||||
String search = basis + data.getProductMinor();
|
||||
String replacestring = basis + data.getInstalledProductMinor();
|
||||
int pos = packageData.getPackageName().indexOf(search);
|
||||
if ( pos > -1 ) {
|
||||
// Check if this package is installed with a lower product minor
|
||||
// Creating new package for removal, very simple PackageDescription
|
||||
PackageDescription localPackage = new PackageDescription();
|
||||
localPackage.setUninstallCanFail(true);
|
||||
localPackage.setIsRelocatable(packageData.isRelocatable());
|
||||
String localName = packageData.getPackageName();
|
||||
localName = localName.replace(search, replacestring);
|
||||
localPackage.setPackageName(localName);
|
||||
|
||||
if ( ( packageData.getPkgRealName() != null ) && ( ! packageData.getPkgRealName().equals("") )) {
|
||||
localName = packageData.getPkgRealName();
|
||||
localName = localName.replace(search, replacestring);
|
||||
localPackage.setPkgRealName(localName);
|
||||
}
|
||||
|
||||
if (( packageData.getName() != null ) && ( ! packageData.getName().equals("") )) {
|
||||
localName = packageData.getName();
|
||||
localName = localName.replace(search, replacestring);
|
||||
localPackage.setName(localName);
|
||||
}
|
||||
|
||||
// saving also the order, needed for order of uninstallation
|
||||
localPackage.setOrder(packageData.getOrder());
|
||||
|
||||
// If the old package is installed, the new package can be installed, too,
|
||||
// and the old package can be marked for removal (with dependency check).
|
||||
if ( installer.isPackageInstalled(localPackage, data) ) {
|
||||
packageData.setSelectionState(PackageDescription.INSTALL);
|
||||
|
||||
// Collecting all installed older packages for uninstallation
|
||||
Vector oldPackages = data.getOldPackages();
|
||||
oldPackages.add(localPackage);
|
||||
data.setOldPackages(oldPackages);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -841,6 +903,13 @@ public class ModuleCtrl {
|
||||
Dumper.logModuleStates(packageData, "ChooseDirectory: After setUpdateOlderProductSettings");
|
||||
}
|
||||
|
||||
// Setting packages that are forced into update, because they did not exist in older version.
|
||||
ModuleCtrl.setForcedUpdateProductSettings(packageData);
|
||||
|
||||
if ( data.logModuleStates() ) {
|
||||
Dumper.logModuleStates(packageData, "ChooseDirectory: After setForcedUpdateProductSettings");
|
||||
}
|
||||
|
||||
// Setting required root module packages (that are new in the update product).
|
||||
ModuleCtrl.setRequiredNewCoreModules(packageData, data);
|
||||
|
||||
@ -871,6 +940,13 @@ public class ModuleCtrl {
|
||||
}
|
||||
}
|
||||
|
||||
// Setting parent module settings. Only required for displaying correct module settings before starting installation.
|
||||
ModuleCtrl.setParentDefaultModuleSettings(packageData);
|
||||
|
||||
if ( data.logModuleStates() ) {
|
||||
Dumper.logModuleStates(packageData, "ChooseDirectory: After setParentDefaultModuleSettings");
|
||||
}
|
||||
|
||||
// Collecting packages to install
|
||||
// This has to be done here, because "ChooseInstallationType" and "ChooseComponents"
|
||||
// are not called.
|
||||
@ -903,7 +979,7 @@ public class ModuleCtrl {
|
||||
Dumper.logModuleStates(packageData, "ChooseDirectory: After disableNonExistingPackages");
|
||||
}
|
||||
|
||||
// disable packages, that are not valid in user installation
|
||||
// disable packages, that are not valid in user installation
|
||||
if ( data.isUserInstallation() ) {
|
||||
ModuleCtrl.setShowInUserInstallFlags(packageData);
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
package org.openoffice.setup.Util;
|
||||
|
||||
import org.openoffice.setup.InstallData;
|
||||
import org.openoffice.setup.SetupData.PackageDescription;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Vector;
|
||||
@ -82,6 +83,62 @@ public class PackageCollector {
|
||||
}
|
||||
}
|
||||
|
||||
// Special handling for packages, that change their name, and therefore need to be uninstalled
|
||||
|
||||
// static public void findOldPackages( InstallData installData ) {
|
||||
//
|
||||
// String basis = "ooobasis3";
|
||||
// if ( installData.getOSType().equalsIgnoreCase("Linux") ) { basis = basis + "."; }
|
||||
// String search = basis + installData.getProductMinor();
|
||||
|
||||
// Vector allPackages = installData.getInstallPackages();
|
||||
// Vector oldPackages = new Vector();
|
||||
|
||||
// for (int i = 0; i < allPackages.size(); i++) {
|
||||
// PackageDescription packageData = (PackageDescription) allPackages.get(i);
|
||||
// int pos = packageData.getPackageName().indexOf(search);
|
||||
|
||||
// if ( pos > -1 ) {
|
||||
// String substring = packageData.getPackageName().substring(pos, pos + 1);
|
||||
// for (int j = 0; j < installData.getProductMinor(); j++) {
|
||||
// String replace = basis + j;
|
||||
// // Creating new package for removal, very simple PackageDescription
|
||||
// PackageDescription localPackage = new PackageDescription();
|
||||
// localPackage.setUninstallCanFail(true);
|
||||
// localPackage.setIsRelocatable(packageData.isRelocatable());
|
||||
// String localName = packageData.getPackageName();
|
||||
// localName = localName.replace(search, replace);
|
||||
// localPackage.setPackageName(localName);
|
||||
|
||||
// if ( ( packageData.getPkgRealName() != null ) && ( ! packageData.getPkgRealName().equals("") )) {
|
||||
// localName = packageData.getPkgRealName();
|
||||
// localName = localName.replace(search, replace);
|
||||
// localPackage.setPkgRealName(localName);
|
||||
// }
|
||||
|
||||
// if (( packageData.getName() != null ) && ( ! packageData.getName().equals("") )) {
|
||||
// localName = packageData.getName();
|
||||
// localName = localName.replace(search, replace);
|
||||
// localPackage.setName(localName);
|
||||
// }
|
||||
|
||||
// oldPackages.add(localPackage);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// // reverse order for uninstallation
|
||||
// int number = oldPackages.size();
|
||||
// for (int i = 0; i < number; i++) {
|
||||
// if ( i > 0 ) {
|
||||
// PackageDescription oldPackageData = (PackageDescription) oldPackages.remove(i);
|
||||
// oldPackages.add(0,oldPackageData);
|
||||
// }
|
||||
// }
|
||||
|
||||
// installData.setOldPackages(oldPackages);
|
||||
// }
|
||||
|
||||
static public void sortPackages(Vector allPackages, Vector sortedPackages, String mode) {
|
||||
for (int i = 0; i < allPackages.size(); i++) {
|
||||
boolean integrated = false;
|
||||
|
@ -83,6 +83,7 @@ public class StorageUnitTest extends ComplexTestCase
|
||||
"ExecuteTest14",
|
||||
"ExecuteTest15",
|
||||
"ExecuteTest16",
|
||||
"ExecuteTest17",
|
||||
"ExecuteRegressionTest_114358",
|
||||
"ExecuteRegressionTest_i29169",
|
||||
"ExecuteRegressionTest_i30400",
|
||||
@ -227,6 +228,12 @@ public class StorageUnitTest extends ComplexTestCase
|
||||
assure( "Test16 failed!", aTest.test() );
|
||||
}
|
||||
|
||||
public void ExecuteTest17()
|
||||
{
|
||||
StorageTest aTest = new Test17( m_xMSF, m_xStorageFactory, log );
|
||||
assure( "Test17 failed!", aTest.test() );
|
||||
}
|
||||
|
||||
|
||||
public void ExecuteRegressionTest_114358()
|
||||
{
|
||||
|
142
package/qa/storages/Test17.java
Normal file
142
package/qa/storages/Test17.java
Normal file
@ -0,0 +1,142 @@
|
||||
package complex.storages;
|
||||
|
||||
import com.sun.star.uno.XInterface;
|
||||
import com.sun.star.lang.XMultiServiceFactory;
|
||||
import com.sun.star.lang.XSingleServiceFactory;
|
||||
|
||||
import com.sun.star.bridge.XUnoUrlResolver;
|
||||
import com.sun.star.uno.UnoRuntime;
|
||||
import com.sun.star.uno.XInterface;
|
||||
import com.sun.star.io.XStream;
|
||||
import com.sun.star.io.XInputStream;
|
||||
|
||||
import com.sun.star.embed.*;
|
||||
|
||||
import share.LogWriter;
|
||||
import complex.storages.TestHelper;
|
||||
import complex.storages.StorageTest;
|
||||
|
||||
public class Test17 implements StorageTest {
|
||||
|
||||
XMultiServiceFactory m_xMSF;
|
||||
XSingleServiceFactory m_xStorageFactory;
|
||||
TestHelper m_aTestHelper;
|
||||
|
||||
public Test17( XMultiServiceFactory xMSF, XSingleServiceFactory xStorageFactory, LogWriter aLogWriter )
|
||||
{
|
||||
m_xMSF = xMSF;
|
||||
m_xStorageFactory = xStorageFactory;
|
||||
m_aTestHelper = new TestHelper( aLogWriter, "Test17: " );
|
||||
}
|
||||
|
||||
public boolean test()
|
||||
{
|
||||
try
|
||||
{
|
||||
XStream xTempFileStream = m_aTestHelper.CreateTempFileStream( m_xMSF );
|
||||
if ( xTempFileStream == null )
|
||||
return false;
|
||||
|
||||
// create storage based on the temporary stream
|
||||
Object pArgs[] = new Object[2];
|
||||
pArgs[0] = (Object) xTempFileStream;
|
||||
pArgs[1] = new Integer( ElementModes.WRITE );
|
||||
|
||||
Object oTempStorage = m_xStorageFactory.createInstanceWithArguments( pArgs );
|
||||
XStorage xTempStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oTempStorage );
|
||||
if ( xTempStorage == null )
|
||||
{
|
||||
m_aTestHelper.Error( "Can't create temporary storage representation!" );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
byte pBytes1[] = { 1, 1, 1, 1, 1 };
|
||||
String pNames[] = { "SubStream1", "SubStream2", "SubStream3", "SubStream4", "SubStream5", "SubStream6", "SubStream7" };
|
||||
|
||||
for ( int nInd = 0; nInd < pNames.length; nInd++ )
|
||||
{
|
||||
// open a new substorage
|
||||
XStorage xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage,
|
||||
"SubStorage1",
|
||||
ElementModes.WRITE );
|
||||
if ( xTempSubStorage == null )
|
||||
{
|
||||
m_aTestHelper.Error( "Can't create substorage!" );
|
||||
return false;
|
||||
}
|
||||
|
||||
// open a new substream, set "MediaType" and "Compressed" properties to it and write some bytes
|
||||
if ( !m_aTestHelper.WriteBytesToSubstream( xTempSubStorage, pNames[nInd], "MediaType1", true, pBytes1 ) )
|
||||
return false;
|
||||
|
||||
// commit substorage first
|
||||
if ( !m_aTestHelper.commitStorage( xTempSubStorage ) )
|
||||
return false;
|
||||
|
||||
// dispose used storage to free resources
|
||||
if ( !m_aTestHelper.disposeStorage( xTempSubStorage ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
// commit the root storage so the contents must be stored now
|
||||
if ( !m_aTestHelper.commitStorage( xTempStorage ) )
|
||||
return false;
|
||||
|
||||
// dispose used storage to free resources
|
||||
if ( !m_aTestHelper.disposeStorage( xTempStorage ) )
|
||||
return false;
|
||||
|
||||
|
||||
// ================================================
|
||||
// now check all the written information
|
||||
// ================================================
|
||||
|
||||
// close the output part of the temporary stream
|
||||
// the output part must present since we already wrote to the stream
|
||||
if ( !m_aTestHelper.closeOutput( xTempFileStream ) )
|
||||
return false;
|
||||
|
||||
XInputStream xTempInStream = m_aTestHelper.getInputStream( xTempFileStream );
|
||||
if ( xTempInStream == null )
|
||||
return false;
|
||||
|
||||
|
||||
// open input stream
|
||||
// since no mode is provided the result storage must be opened readonly
|
||||
Object pOneArg[] = new Object[1];
|
||||
pOneArg[0] = (Object) xTempInStream;
|
||||
|
||||
Object oResultStorage = m_xStorageFactory.createInstanceWithArguments( pOneArg );
|
||||
XStorage xResultStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oResultStorage );
|
||||
if ( xResultStorage == null )
|
||||
{
|
||||
m_aTestHelper.Error( "Can't open storage based on input stream!" );
|
||||
return false;
|
||||
}
|
||||
|
||||
// open existing substorage
|
||||
XStorage xResultSubStorage = m_aTestHelper.openSubStorage( xResultStorage,
|
||||
"SubStorage1",
|
||||
ElementModes.READ );
|
||||
if ( xResultSubStorage == null )
|
||||
{
|
||||
m_aTestHelper.Error( "Can't open existing substorage!" );
|
||||
return false;
|
||||
}
|
||||
|
||||
for ( int nInd = 0; nInd < pNames.length; nInd++ )
|
||||
if ( !m_aTestHelper.checkStream( xResultSubStorage, pNames[nInd], "MediaType1", true, pBytes1 ) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
m_aTestHelper.Error( "Exception: " + e );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ JAVAFILES =\
|
||||
Test14.java\
|
||||
Test15.java\
|
||||
Test16.java\
|
||||
Test17.java\
|
||||
RegressionTest_114358.java\
|
||||
RegressionTest_i29169.java\
|
||||
RegressionTest_i30400.java\
|
||||
|
@ -2249,52 +2249,57 @@ void SAL_CALL OWriteStream::dispose()
|
||||
throw ( uno::RuntimeException )
|
||||
{
|
||||
// should be an internal method since it can be called only from parent storage
|
||||
|
||||
::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() );
|
||||
|
||||
if ( !m_pImpl )
|
||||
throw lang::DisposedException();
|
||||
|
||||
if ( m_xOutStream.is() )
|
||||
CloseOutput_Impl();
|
||||
|
||||
if ( m_xInStream.is() )
|
||||
{
|
||||
m_xInStream->closeInput();
|
||||
m_xInStream = uno::Reference< io::XInputStream >();
|
||||
::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() );
|
||||
|
||||
if ( !m_pImpl )
|
||||
throw lang::DisposedException();
|
||||
|
||||
if ( m_xOutStream.is() )
|
||||
CloseOutput_Impl();
|
||||
|
||||
if ( m_xInStream.is() )
|
||||
{
|
||||
m_xInStream->closeInput();
|
||||
m_xInStream = uno::Reference< io::XInputStream >();
|
||||
}
|
||||
|
||||
m_pImpl->m_pAntiImpl = NULL;
|
||||
|
||||
if ( !m_bInitOnDemand )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( !m_bTransacted )
|
||||
{
|
||||
m_pImpl->Commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
// throw away all the changes
|
||||
m_pImpl->Revert();
|
||||
}
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{
|
||||
uno::Any aCaught( ::cppu::getCaughtException() );
|
||||
throw lang::WrappedTargetRuntimeException(
|
||||
::rtl::OUString::createFromAscii( "Can not commit/revert the storage!\n" ),
|
||||
uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ),
|
||||
uno::UNO_QUERY ),
|
||||
aCaught );
|
||||
}
|
||||
}
|
||||
|
||||
m_pImpl = NULL;
|
||||
}
|
||||
|
||||
// the listener might try to get rid of parent storage, and the storage would delete this object;
|
||||
// for now the listener is just notified at the end of the method to workaround the problem
|
||||
// in future a more elegant way should be found
|
||||
|
||||
lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) );
|
||||
m_pData->m_aListenersContainer.disposeAndClear( aSource );
|
||||
|
||||
m_pImpl->m_pAntiImpl = NULL;
|
||||
|
||||
if ( !m_bInitOnDemand )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( !m_bTransacted )
|
||||
{
|
||||
m_pImpl->Commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
// throw away all the changes
|
||||
m_pImpl->Revert();
|
||||
}
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
{
|
||||
uno::Any aCaught( ::cppu::getCaughtException() );
|
||||
throw lang::WrappedTargetRuntimeException(
|
||||
::rtl::OUString::createFromAscii( "Can not commit/revert the storage!\n" ),
|
||||
uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ),
|
||||
uno::UNO_QUERY ),
|
||||
aCaught );
|
||||
}
|
||||
}
|
||||
|
||||
m_pImpl = NULL;
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
|
@ -271,7 +271,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
|
||||
// it is an empty subfolder, use workaround to store it
|
||||
ZipEntry* pTempEntry = new ZipEntry();
|
||||
ZipPackageFolder::copyZipEntry ( *pTempEntry, aEntry );
|
||||
pTempEntry->nNameLen = (sal_Int16)rPath.getLength();
|
||||
pTempEntry->nNameLen = (sal_Int16)( ::rtl::OUStringToOString( rPath, RTL_TEXTENCODING_UTF8 ).getLength() );
|
||||
pTempEntry->nExtraLen = -1;
|
||||
pTempEntry->sName = rPath;
|
||||
|
||||
@ -333,7 +333,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
|
||||
|
||||
ZipPackageFolder::copyZipEntry ( *pTempEntry, pStream->aEntry );
|
||||
pTempEntry->sName = rPath + rShortName;
|
||||
pTempEntry->nNameLen = (sal_Int16)( pTempEntry->sName.getLength() );
|
||||
pTempEntry->nNameLen = (sal_Int16)( ::rtl::OUStringToOString( pTempEntry->sName, RTL_TEXTENCODING_UTF8 ).getLength() );
|
||||
|
||||
sal_Bool bToBeEncrypted = pStream->IsToBeEncrypted() && (bHaveEncryptionKey || pStream->HasOwnKey());
|
||||
sal_Bool bToBeCompressed = bToBeEncrypted ? sal_True : pStream->IsToBeCompressed();
|
||||
|
@ -30,30 +30,30 @@
|
||||
#*************************************************************************
|
||||
|
||||
# GUI String in the installer ("Java Runtime Environment (${JAVAVERSION})")
|
||||
JAVAVERSION=Java 6 Update 12
|
||||
WINDOWSJAVAVERSION=Java 6 Update 12
|
||||
JAVAVERSION=Java 6 Update 13
|
||||
WINDOWSJAVAVERSION=Java 6 Update 13
|
||||
|
||||
# Windows (scp2 and downloadtemplate.nsi)
|
||||
WINDOWSJAVAFILENAME=jre-6u12-windows-i586-p.exe
|
||||
WINDOWSJAVAREGISTRYENTRY=1.6.0_12
|
||||
WINDOWSJAVAFILENAME=jre-6u13-windows-i586-p.exe
|
||||
WINDOWSJAVAREGISTRYENTRY=1.6.0_13
|
||||
|
||||
# Linux (scp2)
|
||||
LINUXJAVAFILENAME=jre-6u12-linux-i586.rpm
|
||||
LINUXJAVAFILENAME=jre-6u13-linux-i586.rpm
|
||||
# Linux (rpmUnit.xml, rpm -qp <filename> )
|
||||
LINUXJAVANAME=jre-1.6.0_12-fcs
|
||||
LINUXJAVANAME=jre-1.6.0_13-fcs
|
||||
|
||||
# Linux-x64 (scp2)
|
||||
LINUXX64JAVAFILENAME=jre-6u12-linux-amd64.rpm
|
||||
LINUXX64JAVAFILENAME=jre-6u13-linux-amd64.rpm
|
||||
|
||||
# Solaris Sparc (scp2)
|
||||
SOLSJAVARTPACKED=SUNWj6rt_1_6_0_12_sparc.tar.gz
|
||||
SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_12_sparc.tar.gz
|
||||
SOLSJAVAMANPACKED=SUNWj6man_1_6_0_12_sparc.tar.gz
|
||||
SOLSJAVARTPACKED=SUNWj6rt_1_6_0_13_sparc.tar.gz
|
||||
SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_13_sparc.tar.gz
|
||||
SOLSJAVAMANPACKED=SUNWj6man_1_6_0_13_sparc.tar.gz
|
||||
|
||||
# Solaris x86 (scp2)
|
||||
SOLIJAVARTPACKED=SUNWj6rt_1_6_0_12_x86.tar.gz
|
||||
SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_12_x86.tar.gz
|
||||
SOLIJAVAMANPACKED=SUNWj6man_1_6_0_12_x86.tar.gz
|
||||
SOLIJAVARTPACKED=SUNWj6rt_1_6_0_13_x86.tar.gz
|
||||
SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_13_x86.tar.gz
|
||||
SOLIJAVAMANPACKED=SUNWj6man_1_6_0_13_x86.tar.gz
|
||||
|
||||
# Solaris (pkgUnit.xml, needs only to be changed in major changes)
|
||||
SOLARISJAVART=SUNWj6rt
|
||||
|
@ -30,30 +30,30 @@
|
||||
#*************************************************************************
|
||||
|
||||
# GUI String in the installer ("Java Runtime Environment (${JAVAVERSION})")
|
||||
JAVAVERSION=Java 6 Update 12
|
||||
WINDOWSJAVAVERSION=Java 6 Update 12
|
||||
JAVAVERSION=Java 6 Update 13
|
||||
WINDOWSJAVAVERSION=Java 6 Update 13
|
||||
|
||||
# Windows (scp2 and downloadtemplate.nsi)
|
||||
WINDOWSJAVAFILENAME=jre-6u12-windows-i586-p.exe
|
||||
WINDOWSJAVAREGISTRYENTRY=1.6.0_12
|
||||
WINDOWSJAVAFILENAME=jre-6u13-windows-i586-p.exe
|
||||
WINDOWSJAVAREGISTRYENTRY=1.6.0_13
|
||||
|
||||
# Linux (scp2)
|
||||
LINUXJAVAFILENAME=jre-6u12-linux-i586.rpm
|
||||
LINUXJAVAFILENAME=jre-6u13-linux-i586.rpm
|
||||
# Linux (rpmUnit.xml, rpm -qp <filename> )
|
||||
LINUXJAVANAME=jre-1.6.0_12-fcs
|
||||
LINUXJAVANAME=jre-1.6.0_13-fcs
|
||||
|
||||
# Linux-x64 (scp2)
|
||||
LINUXX64JAVAFILENAME=jre-6u12-linux-amd64.rpm
|
||||
LINUXX64JAVAFILENAME=jre-6u13-linux-amd64.rpm
|
||||
|
||||
# Solaris Sparc (scp2)
|
||||
SOLSJAVARTPACKED=SUNWj6rt_1_6_0_12_sparc.tar.gz
|
||||
SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_12_sparc.tar.gz
|
||||
SOLSJAVAMANPACKED=SUNWj6man_1_6_0_12_sparc.tar.gz
|
||||
SOLSJAVARTPACKED=SUNWj6rt_1_6_0_13_sparc.tar.gz
|
||||
SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_13_sparc.tar.gz
|
||||
SOLSJAVAMANPACKED=SUNWj6man_1_6_0_13_sparc.tar.gz
|
||||
|
||||
# Solaris x86 (scp2)
|
||||
SOLIJAVARTPACKED=SUNWj6rt_1_6_0_12_x86.tar.gz
|
||||
SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_12_x86.tar.gz
|
||||
SOLIJAVAMANPACKED=SUNWj6man_1_6_0_12_x86.tar.gz
|
||||
SOLIJAVARTPACKED=SUNWj6rt_1_6_0_13_x86.tar.gz
|
||||
SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_13_x86.tar.gz
|
||||
SOLIJAVAMANPACKED=SUNWj6man_1_6_0_13_x86.tar.gz
|
||||
|
||||
# Solaris (pkgUnit.xml, needs only to be changed in major changes)
|
||||
SOLARISJAVART=SUNWj6rt
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include <string>
|
||||
#include <queue>
|
||||
#include <stdio.h>
|
||||
#include <strsafe.h>
|
||||
|
||||
#include <systools/win32/uwinapi.h>
|
||||
|
||||
|
@ -242,7 +242,7 @@ extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle )
|
||||
return ERROR_SUCCESS;
|
||||
|
||||
std::_tstring sRenameSrc = sOfficeInstallPath + TEXT("program");
|
||||
std::_tstring sRenameDst = sOfficeInstallPath + TEXT("program_1");
|
||||
std::_tstring sRenameDst = sOfficeInstallPath + TEXT("program_test");
|
||||
|
||||
bool bSuccess = MoveFile( sRenameSrc.c_str(), sRenameDst.c_str() );
|
||||
|
||||
@ -252,6 +252,32 @@ extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle )
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD dwError = GetLastError();
|
||||
LPVOID lpMsgBuf;
|
||||
// When there is no program folder, there could be no running office
|
||||
if ( dwError == ERROR_FILE_NOT_FOUND )
|
||||
return ERROR_SUCCESS;
|
||||
// The destination folder should never exist, don't know what to do here
|
||||
if ( dwError == ERROR_ALREADY_EXISTS )
|
||||
return ERROR_SUCCESS;
|
||||
|
||||
if ( FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL,
|
||||
GetLastError(),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
||||
(LPTSTR) &lpMsgBuf,
|
||||
0,
|
||||
NULL ))
|
||||
{
|
||||
OutputDebugStringFormat( TEXT("Error Code %d: %s"), dwError, lpMsgBuf );
|
||||
LocalFree( lpMsgBuf );
|
||||
}
|
||||
else
|
||||
OutputDebugStringFormat( TEXT("Error Code %d: Unknown"), dwError );
|
||||
|
||||
MsiSetProperty( handle, TEXT("OFFICERUNS"), TEXT("1") );
|
||||
SetMsiErrorCode( MSI_ERROR_OFFICE_IS_RUNNING );
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ extern "C" UINT __stdcall RenamePrgFolder( MSIHANDLE handle )
|
||||
std::_tstring sOfficeInstallPath = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION"));
|
||||
|
||||
std::_tstring sRenameSrc = sOfficeInstallPath + TEXT("program");
|
||||
std::_tstring sRenameDst = sOfficeInstallPath + TEXT("program_1");
|
||||
std::_tstring sRenameDst = sOfficeInstallPath + TEXT("program_old");
|
||||
|
||||
// MessageBox(NULL, sRenameSrc.c_str(), "OFFICEINSTALLLOCATION", MB_OK);
|
||||
|
||||
@ -208,7 +208,7 @@ extern "C" UINT __stdcall RenamePrgFolder( MSIHANDLE handle )
|
||||
extern "C" UINT __stdcall RemovePrgFolder( MSIHANDLE handle )
|
||||
{
|
||||
std::_tstring sOfficeInstallPath = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION"));
|
||||
std::_tstring sRemoveDir = sOfficeInstallPath + TEXT("program_1");
|
||||
std::_tstring sRemoveDir = sOfficeInstallPath + TEXT("program_old");
|
||||
|
||||
// MessageBox(NULL, sRemoveDir.c_str(), "REMOVING OLD DIR", MB_OK);
|
||||
|
||||
|
@ -448,21 +448,34 @@ void SecurityEnvironment_NssImpl::updateSlots()
|
||||
if(pSlot != NULL)
|
||||
{
|
||||
RTL_LOGFILE_TRACE2( "XMLSEC: Found a slot: SlotName=%s, TokenName=%s", PK11_GetSlotName(pSlot), PK11_GetTokenName(pSlot) );
|
||||
pSymKey = PK11_KeyGen( pSlot , CKM_DES3_CBC, NULL, 128, NULL ) ;
|
||||
if( pSymKey == NULL )
|
||||
{
|
||||
PK11_FreeSlot( pSlot ) ;
|
||||
RTL_LOGFILE_TRACE( "XMLSEC: Error - pSymKey is NULL" );
|
||||
continue;
|
||||
}
|
||||
|
||||
//The following code which is commented out checks if a slot, that is a smart card for example, is
|
||||
// able to generate a symmetric key of type CKM_DES3_CBC. If this fails then this token
|
||||
// will not be used. This key is possibly used for the encryption service. However, all
|
||||
// interfaces and services used for public key signature and encryption are not published
|
||||
// and the encryption is not used in OOo. Therefore it does not do any harm to remove
|
||||
// this code, hence allowing smart cards which cannot generate this type of key.
|
||||
//
|
||||
// By doing this, the encryption may fail if a smart card is being used which does not
|
||||
// support this key generation.
|
||||
//
|
||||
pSymKey = PK11_KeyGen( pSlot , CKM_DES3_CBC, NULL, 128, NULL ) ;
|
||||
// if( pSymKey == NULL )
|
||||
// {
|
||||
// PK11_FreeSlot( pSlot ) ;
|
||||
// RTL_LOGFILE_TRACE( "XMLSEC: Error - pSymKey is NULL" );
|
||||
// continue;
|
||||
// }
|
||||
addCryptoSlot(pSlot);
|
||||
PK11_FreeSlot( pSlot ) ;
|
||||
pSlot = NULL;
|
||||
|
||||
adoptSymKey( pSymKey ) ;
|
||||
PK11_FreeSymKey( pSymKey ) ;
|
||||
pSymKey = NULL;
|
||||
if (pSymKey != NULL)
|
||||
{
|
||||
adoptSymKey( pSymKey ) ;
|
||||
PK11_FreeSymKey( pSymKey ) ;
|
||||
pSymKey = NULL;
|
||||
}
|
||||
|
||||
}// end of if(pSlot != NULL)
|
||||
}// end of for
|
||||
|
Loading…
x
Reference in New Issue
Block a user