summaryrefslogtreecommitdiff
path: root/extensions/source/plugin
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 15:18:56 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 15:18:56 +0000
commit95117e7fefa9ae82431dcdffd1e58495730f6f54 (patch)
tree158386e9f19cda5c69023d678c4d3313435a206d /extensions/source/plugin
initial import
Diffstat (limited to 'extensions/source/plugin')
-rw-r--r--extensions/source/plugin/base/context.cxx364
-rw-r--r--extensions/source/plugin/base/evtlstnr.cxx95
-rw-r--r--extensions/source/plugin/base/makefile.mk159
-rw-r--r--extensions/source/plugin/base/manager.cxx316
-rw-r--r--extensions/source/plugin/base/multiplx.cxx391
-rw-r--r--extensions/source/plugin/base/nfuncs.cxx576
-rw-r--r--extensions/source/plugin/base/plcom.cxx90
-rw-r--r--extensions/source/plugin/base/plctrl.cxx373
-rw-r--r--extensions/source/plugin/base/plmodel.cxx243
-rw-r--r--extensions/source/plugin/base/service.cxx206
-rw-r--r--extensions/source/plugin/base/xplugin.cxx888
-rw-r--r--extensions/source/plugin/inc/plugin/impl.hxx478
-rw-r--r--extensions/source/plugin/inc/plugin/model.hxx187
-rw-r--r--extensions/source/plugin/inc/plugin/multiplx.hxx249
-rw-r--r--extensions/source/plugin/inc/plugin/plcom.hxx114
-rw-r--r--extensions/source/plugin/inc/plugin/plctrl.hxx276
-rw-r--r--extensions/source/plugin/inc/plugin/unx/sysplug.hxx111
-rw-r--r--extensions/source/plugin/inc/plugin/win/sysplug.hxx139
-rw-r--r--extensions/source/plugin/unx/makefile.mk84
-rw-r--r--extensions/source/plugin/unx/sysplug.cxx269
-rw-r--r--extensions/source/plugin/unx/unxmgr.cxx197
-rw-r--r--extensions/source/plugin/util/makefile.mk125
-rw-r--r--extensions/source/plugin/util/makefile.pmk69
-rw-r--r--extensions/source/plugin/win/makefile.mk96
-rw-r--r--extensions/source/plugin/win/sysplug.cxx300
-rw-r--r--extensions/source/plugin/win/winmgr.cxx392
26 files changed, 6787 insertions, 0 deletions
diff --git a/extensions/source/plugin/base/context.cxx b/extensions/source/plugin/base/context.cxx
new file mode 100644
index 000000000000..0ad3c7c1baed
--- /dev/null
+++ b/extensions/source/plugin/base/context.cxx
@@ -0,0 +1,364 @@
+/*************************************************************************
+ *
+ * $RCSfile: context.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+#include <plugin/impl.hxx>
+
+#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAGS_HPP_
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#endif
+#include <tools/fsys.hxx>
+#include <tools/urlobj.hxx>
+
+#include <cppuhelper/implbase1.hxx>
+
+namespace ext_plug {
+
+class FileSink : public ::cppu::WeakAggImplHelper1< ::com::sun::star::io::XOutputStream >
+{
+private:
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ FILE* fp;
+ Reference< ::com::sun::star::plugin::XPlugin > m_xPlugin;
+ ::rtl::OUString m_aMIMEType;
+ ::rtl::OUString m_aTarget;
+ ::rtl::OUString m_aFileName;
+
+public:
+ FileSink( const Reference< ::com::sun::star::lang::XMultiServiceFactory > &,
+ const Reference< ::com::sun::star::plugin::XPlugin > & plugin,
+ const ::rtl::OUString& mimetype,
+ const ::rtl::OUString& target,
+ const Reference< ::com::sun::star::io::XActiveDataSource > & source );
+ virtual ~FileSink();
+
+ // ::com::sun::star::io::XOutputStream
+ virtual void SAL_CALL writeBytes( const Sequence<sal_Int8>& );
+ virtual void SAL_CALL flush();
+ virtual void SAL_CALL closeOutput();
+};
+
+}
+using namespace ext_plug;
+
+class XPluginContext_Impl : public ::cppu::WeakAggImplHelper1< ::com::sun::star::plugin::XPluginContext >
+{
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ rtl_TextEncoding m_aEncoding;
+public:
+
+ XPluginContext_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
+ virtual ~XPluginContext_Impl();
+
+
+ virtual ::rtl::OUString SAL_CALL getValue(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, ::com::sun::star::plugin::PluginVariable variable) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
+ virtual void SAL_CALL getURLNotify(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Reference< ::com::sun::star::lang::XEventListener > & listener) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
+ virtual void SAL_CALL getURL(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
+ virtual void SAL_CALL postURLNotify(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file, const Reference< ::com::sun::star::lang::XEventListener > & listener) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
+ virtual void SAL_CALL postURL(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
+ virtual void SAL_CALL newStream(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& mimetype, const ::rtl::OUString& target, const Reference< ::com::sun::star::io::XActiveDataSource > & source) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
+ virtual void SAL_CALL displayStatusText(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& message) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getUserAgent(const Reference< ::com::sun::star::plugin::XPlugin > & plugin) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
+};
+
+Reference< ::com::sun::star::plugin::XPluginContext > XPluginManager_Impl::createPluginContext()
+{
+ return new XPluginContext_Impl( m_xSMgr );
+}
+
+XPluginContext_Impl::XPluginContext_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr )
+ : m_xSMgr( rSMgr ),
+ m_aEncoding( gsl_getSystemTextEncoding() )
+{
+}
+
+XPluginContext_Impl::~XPluginContext_Impl()
+{
+}
+
+::rtl::OUString XPluginContext_Impl::getValue( const Reference< ::com::sun::star::plugin::XPlugin > & plugin, ::com::sun::star::plugin::PluginVariable variable )
+ throw( ::com::sun::star::plugin::PluginException, RuntimeException )
+{
+ return ::rtl::OUString();
+}
+
+
+void XPluginContext_Impl::getURL(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target) throw( ::com::sun::star::plugin::PluginException, RuntimeException )
+{
+ Reference< XInterface > xInst = m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) );
+ if( ! xInst.is() )
+ return;
+
+ if( ! target.len() )
+ {
+ INetURLObject aURL;
+ aURL.SetSmartProtocol( INET_PROT_FILE );
+ aURL.SetSmartURL( ::rtl::OUStringToOString( url, m_aEncoding ) );
+
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > xFact( m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.DataSourceFactory" ) ), UNO_QUERY );
+ if ( xFact.is() )
+ {
+ Sequence < Any > aArgs(1);
+ ::rtl::OUString aUURL( aURL.GetMainURL() );
+ aArgs.getArray()[0] <<= aUURL;
+ ::rtl::OUString aProt( INetURLObject::GetScheme( aURL.GetProtocol() ) );
+ Reference< ::com::sun::star::io::XActiveDataSource > aSource( xFact->createInstanceWithArguments( aProt, aArgs ), UNO_QUERY );
+ if ( aSource.is() )
+ {
+ // the mimetype cannot be specified
+ plugin->provideNewStream( ::rtl::OUString(),
+ aSource,
+ aUURL,
+ 0, 0, sal_False );
+ }
+ }
+ return;
+ }
+
+ Reference< ::com::sun::star::frame::XComponentLoader > xLoader( xInst, UNO_QUERY );
+ XPlugin_Impl* pPlugin = XPluginManager_Impl::getPluginImplementation( plugin );
+
+ if( xLoader.is() && pPlugin )
+ {
+ ::com::sun::star::beans::PropertyValue aValue;
+ aValue.Name = ::rtl::OUString::createFromAscii( "Referer" );
+ aValue.Value <<= pPlugin->getRefererURL();
+
+ Sequence< ::com::sun::star::beans::PropertyValue > aArgs( &aValue, 1 );
+ Reference< ::com::sun::star::lang::XComponent > xComp =
+ xLoader->loadComponentFromURL(
+ url,
+ target,
+ ::com::sun::star::frame::FrameSearchFlag::PARENT |
+ ::com::sun::star::frame::FrameSearchFlag::SELF |
+ ::com::sun::star::frame::FrameSearchFlag::CHILDREN |
+ ::com::sun::star::frame::FrameSearchFlag::SIBLINGS |
+ ::com::sun::star::frame::FrameSearchFlag::TASKS |
+ ::com::sun::star::frame::FrameSearchFlag::CREATE,
+ aArgs
+ );
+ }
+}
+
+void XPluginContext_Impl::getURLNotify(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Reference< ::com::sun::star::lang::XEventListener > & listener )
+ throw( ::com::sun::star::plugin::PluginException, RuntimeException )
+{
+ getURL( plugin, url, target );
+ if( listener.is() )
+ listener->disposing( ::com::sun::star::lang::EventObject() );
+}
+
+::rtl::OUString XPluginContext_Impl::getUserAgent(const Reference< ::com::sun::star::plugin::XPlugin > & plugin)
+ throw( ::com::sun::star::plugin::PluginException, RuntimeException )
+{
+ return ::rtl::OUString::createFromAscii( "Mozilla 3.0" );
+}
+
+void XPluginContext_Impl::displayStatusText(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& message)
+ throw( ::com::sun::star::plugin::PluginException, RuntimeException )
+{
+}
+
+void XPluginContext_Impl::postURL(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file)
+ throw( ::com::sun::star::plugin::PluginException, RuntimeException )
+{
+ Sequence< sal_Int8 > aBuf;
+
+ if( file )
+ {
+ String aFileName( (char*)buf.getConstArray(), m_aEncoding );
+ INetURLObject aFilePath( aFileName );
+ aFileName = aFilePath.PathToFileName();
+ SvFileStream aStream( aFileName, STREAM_READ );
+ if( aStream.IsOpen() )
+ {
+ int nBytes = 0;
+ aStream.Seek( STREAM_SEEK_TO_END );
+ aBuf = Sequence<sal_Int8>( nBytes = aStream.Tell() );
+ aStream.Seek( STREAM_SEEK_TO_BEGIN );
+ aStream.Read( aBuf.getArray(), nBytes );
+ aStream.Close();
+ DirEntry( aFileName ).Kill();
+ }
+ }
+
+ Reference< XInterface > xInst = m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) );
+ if( ! xInst.is() )
+ return ;
+
+ Reference< ::com::sun::star::frame::XComponentLoader > xLoader( xInst, UNO_QUERY );
+ XPlugin_Impl* pPlugin = XPluginManager_Impl::getPluginImplementation( plugin );
+ if( xLoader.is() && pPlugin )
+ {
+ ::com::sun::star::beans::PropertyValue aValues[2];
+ aValues[0].Name = ::rtl::OUString::createFromAscii( "Referer" );
+ aValues[0].Value <<= pPlugin->getRefererURL();
+
+ aValues[1].Name = ::rtl::OUString::createFromAscii( "PostString" );
+ aValues[1].Value <<= ::rtl::OStringToOUString( (char*)( file ? aBuf : buf ).getConstArray(), m_aEncoding );
+ Sequence< ::com::sun::star::beans::PropertyValue > aArgs( aValues, 2 );
+ Reference< ::com::sun::star::lang::XComponent > xComp =
+ xLoader->loadComponentFromURL(
+ url,
+ target,
+ ::com::sun::star::frame::FrameSearchFlag::PARENT |
+ ::com::sun::star::frame::FrameSearchFlag::SELF |
+ ::com::sun::star::frame::FrameSearchFlag::CHILDREN |
+ ::com::sun::star::frame::FrameSearchFlag::SIBLINGS |
+ ::com::sun::star::frame::FrameSearchFlag::TASKS |
+ ::com::sun::star::frame::FrameSearchFlag::CREATE,
+ aArgs
+ );
+ }
+}
+
+void XPluginContext_Impl::postURLNotify(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file, const Reference< ::com::sun::star::lang::XEventListener > & listener )
+ throw( ::com::sun::star::plugin::PluginException, RuntimeException )
+{
+ postURL( plugin, url, target, buf, file );
+ if( listener.is() )
+ listener->disposing( ::com::sun::star::lang::EventObject() );
+}
+
+void XPluginContext_Impl::newStream( const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& mimetype, const ::rtl::OUString& target, const Reference< ::com::sun::star::io::XActiveDataSource > & source )
+ throw( ::com::sun::star::plugin::PluginException, RuntimeException )
+{
+ FileSink* pNewSink = new FileSink( m_xSMgr, plugin, mimetype, target, source );
+ pNewSink->acquire();
+}
+
+
+
+FileSink::FileSink( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr, const Reference< ::com::sun::star::plugin::XPlugin > & plugin,
+ const ::rtl::OUString& mimetype,
+ const ::rtl::OUString& target, const Reference< ::com::sun::star::io::XActiveDataSource > & source ) :
+ m_xSMgr( rSMgr ),
+ m_aMIMEType( mimetype ),
+ m_aTarget( target ),
+ m_xPlugin( plugin )
+{
+ DirEntry aEntry;
+ m_aFileName = aEntry.TempName().GetFull();
+ ::rtl::OString aFile = ::rtl::OUStringToOString( m_aFileName, gsl_getSystemTextEncoding() );
+ fp = fopen( aFile.getStr() , "wb" );
+
+ Reference< ::com::sun::star::io::XActiveDataControl > xControl( source, UNO_QUERY );
+
+ source->setOutputStream( Reference< ::com::sun::star::io::XOutputStream > ( this ) );
+ if( xControl.is() )
+ xControl->start();
+}
+
+FileSink::~FileSink()
+{
+ DirEntry aEntry( m_aFileName );
+ aEntry.Kill();
+}
+
+void FileSink::closeOutput()
+{
+ if( fp )
+ fclose( fp );
+
+ Reference< XInterface > xInst = m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) );
+ Reference< ::com::sun::star::frame::XComponentLoader > xLoader( xInst, UNO_QUERY );
+ XPlugin_Impl* pPlugin = XPluginManager_Impl::getPluginImplementation( m_xPlugin );
+
+ if( xLoader.is() && pPlugin )
+ {
+ ::com::sun::star::beans::PropertyValue aValue;
+ aValue.Name = ::rtl::OUString::createFromAscii( "Referer" );
+ aValue.Value <<= pPlugin->getRefererURL();
+
+ Sequence< ::com::sun::star::beans::PropertyValue > aArgs( &aValue, 1 );
+ Reference< ::com::sun::star::lang::XComponent > xComp =
+ xLoader->loadComponentFromURL(
+ m_aFileName,
+ m_aTarget,
+ ::com::sun::star::frame::FrameSearchFlag::PARENT |
+ ::com::sun::star::frame::FrameSearchFlag::SELF |
+ ::com::sun::star::frame::FrameSearchFlag::CHILDREN |
+ ::com::sun::star::frame::FrameSearchFlag::SIBLINGS |
+ ::com::sun::star::frame::FrameSearchFlag::TASKS |
+ ::com::sun::star::frame::FrameSearchFlag::CREATE,
+ aArgs
+ );
+ }
+ release();
+}
+
+void FileSink::writeBytes( const Sequence<sal_Int8>& Buffer )
+{
+ if( fp )
+ fwrite( Buffer.getConstArray(), 1, Buffer.getLength(), fp );
+}
+
+void FileSink::flush()
+{
+ if( fp )
+ fflush( fp );
+}
diff --git a/extensions/source/plugin/base/evtlstnr.cxx b/extensions/source/plugin/base/evtlstnr.cxx
new file mode 100644
index 000000000000..0579e7c09105
--- /dev/null
+++ b/extensions/source/plugin/base/evtlstnr.cxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * $RCSfile: evtlstnr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+#include <plugin/impl.hxx>
+
+PluginEventListener::PluginEventListener( XPlugin_Impl* pPlugin,
+ const char* url,
+ const char* normurl,
+ void* notifyData ) :
+ m_pPlugin( pPlugin ),
+ m_xPlugin( pPlugin ),
+ m_pUrl( strdup( url ) ),
+ m_pNormalizedUrl( strdup( normurl ) ),
+ m_pNotifyData( notifyData )
+{
+}
+
+PluginEventListener::~PluginEventListener()
+{
+ if( m_pUrl )
+ free( m_pUrl );
+ if( m_pNormalizedUrl )
+ free( m_pNormalizedUrl );
+}
+
+void PluginEventListener::disposing( const ::com::sun::star::lang::EventObject& rEvt )
+{
+ m_pPlugin->getPluginComm()->
+ NPP_URLNotify( m_pPlugin->getNPPInstance(),
+ m_pUrl,
+ NPRES_DONE,
+ m_pNotifyData );
+}
diff --git a/extensions/source/plugin/base/makefile.mk b/extensions/source/plugin/base/makefile.mk
new file mode 100644
index 000000000000..56d73938ec1c
--- /dev/null
+++ b/extensions/source/plugin/base/makefile.mk
@@ -0,0 +1,159 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..$/..
+
+PRJNAME=plugin
+TARGET=plbase
+ENABLE_EXCEPTIONS=TRUE
+
+.INCLUDE : ..$/util$/makefile.pmk
+
+# --- Types -------------------------------------
+
+UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+
+UNOUCROUT=$(OUT)$/inc$/$(PRJNAME)
+INCPRE+=$(UNOUCROUT)
+
+# --- Types -------------------------------------
+
+UNOTYPES=\
+ com.sun.star.awt.PosSize \
+ com.sun.star.awt.MouseButton \
+ com.sun.star.awt.FocusChangeReason \
+ com.sun.star.awt.KeyFunction \
+ com.sun.star.awt.Key \
+ com.sun.star.awt.KeyModifier \
+ com.sun.star.awt.KeyGroup \
+ com.sun.star.awt.XAdjustmentListener \
+ com.sun.star.awt.XActionListener \
+ com.sun.star.awt.XTextListener \
+ com.sun.star.awt.XSpinListener \
+ com.sun.star.awt.XItemListener \
+ com.sun.star.awt.XVclContainerListener \
+ com.sun.star.awt.XVclContainerPeer \
+ com.sun.star.awt.XVclContainer \
+ com.sun.star.awt.XVclWindowPeer \
+ com.sun.star.awt.VclWindowPeerAttribute \
+ com.sun.star.awt.XActivateListener \
+ com.sun.star.awt.XTopWindowListener \
+ com.sun.star.awt.XKeyListener \
+ com.sun.star.awt.XTopWindow \
+ com.sun.star.awt.XControl \
+ com.sun.star.awt.XControlModel \
+ com.sun.star.awt.XUnoControlContainer \
+ com.sun.star.beans.PropertyValues \
+ com.sun.star.beans.PropertyAttribute \
+ com.sun.star.beans.XPropertySet \
+ com.sun.star.beans.XMultiPropertySet \
+ com.sun.star.beans.XFastPropertySet \
+ com.sun.star.beans.XPropertyState \
+ com.sun.star.beans.XPropertyAccess \
+ com.sun.star.beans.XPropertyContainer \
+ com.sun.star.beans.XPropertyChangeListener \
+ com.sun.star.beans.XPropertyStateChangeListener \
+ com.sun.star.plugin.PluginMode \
+ com.sun.star.plugin.XPluginManager \
+ com.sun.star.io.XConnectable \
+ com.sun.star.io.XActiveDataSource \
+ com.sun.star.io.XActiveDataSink \
+ com.sun.star.io.XActiveDataControl \
+ com.sun.star.io.XDataOutputStream \
+ com.sun.star.io.XDataInputStream \
+ com.sun.star.io.XObjectInputStream \
+ com.sun.star.io.XMarkableStream \
+ com.sun.star.lang.XServiceName \
+ com.sun.star.lang.XServiceInfo \
+ com.sun.star.lang.XTypeProvider \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.lang.XSingleServiceFactory \
+ com.sun.star.registry.XRegistryKey \
+ com.sun.star.loader.XImplementationLoader \
+ com.sun.star.container.XSet \
+ com.sun.star.container.XNameAccess \
+ com.sun.star.container.XIndexAccess \
+ com.sun.star.frame.XComponentLoader \
+ com.sun.star.frame.FrameSearchFlag \
+ com.sun.star.uno.TypeClass \
+ com.sun.star.uno.XAggregation \
+ com.sun.star.uno.XWeak
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/plctrl.obj \
+ $(SLO)$/service.obj \
+ $(SLO)$/xplugin.obj \
+ $(SLO)$/nfuncs.obj \
+ $(SLO)$/manager.obj \
+ $(SLO)$/context.obj \
+ $(SLO)$/evtlstnr.obj \
+ $(SLO)$/plcom.obj \
+ $(SLO)$/multiplx.obj \
+ $(SLO)$/plmodel.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : ..$/util$/target.pmk
diff --git a/extensions/source/plugin/base/manager.cxx b/extensions/source/plugin/base/manager.cxx
new file mode 100644
index 000000000000..1a6b14887759
--- /dev/null
+++ b/extensions/source/plugin/base/manager.cxx
@@ -0,0 +1,316 @@
+/*************************************************************************
+ *
+ * $RCSfile: manager.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+#include <plugin/impl.hxx>
+#include <osl/mutex.hxx>
+#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATION_HPP_
+#include <com/sun/star/container/XEnumeration.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XELEMENTACCESS_HPP_
+#include <com/sun/star/container/XElementAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
+#include <com/sun/star/container/XIndexAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LOADER_XIMPLEMENTATIONLOADER_HPP_
+#include <com/sun/star/loader/XImplementationLoader.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LOADER_CANNOTACTIVATEFACTORYEXCEPTION_HPP_
+#include <com/sun/star/loader/CannotActivateFactoryException.hpp>
+#endif
+
+PluginManager* PluginManager::pManager = NULL;
+
+PluginManager& PluginManager::get()
+{
+ if( ! pManager )
+ pManager = new PluginManager();
+ return *pManager;
+}
+
+void PluginManager::setServiceFactory( const Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
+{
+ PluginManager& rManager = get();
+ if( ! rManager.m_xSMgr.is() )
+ rManager.m_xSMgr = xFactory;
+}
+
+PluginManager::PluginManager()
+{
+}
+
+PluginManager::~PluginManager()
+{
+}
+
+const Sequence< ::rtl::OUString >& PluginManager::getAdditionalSearchPaths()
+{
+ static Sequence< ::rtl::OUString > aPaths;
+
+ if( ! aPaths.getLength() )
+ {
+ Reference< XInterface > xInst = get().m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Settings" ) );
+ Reference< ::com::sun::star::container::XNameAccess > xAccess( xInst, UNO_QUERY );
+ if( xAccess.is() )
+ {
+ Any aValue = xAccess->getByName( ::rtl::OUString::createFromAscii( "PathSettings" ) );
+ Reference< ::com::sun::star::beans::XPropertySet > xProp;
+ if( aValue.hasValue() )
+ aValue >>= xProp;
+ if( xProp.is() )
+ {
+ aValue = xProp->getPropertyValue( ::rtl::OUString::createFromAscii( "Plugins" ) );
+ if( aValue.getValueType().getTypeClass() == TypeClass_STRING )
+
+ {
+ ::rtl::OUString sValue;
+ aValue >>= sValue;
+ sal_Int32 nTokens = sValue.getTokenCount();
+ aPaths = Sequence< ::rtl::OUString >( nTokens );
+ while( nTokens-- )
+ aPaths.getArray()[nTokens] = sValue.getToken( nTokens );
+ }
+ else if( aValue.getValueType().equals( ::getCppuType( (Sequence< ::rtl::OUString >*)0 ) ) )
+
+ {
+ Sequence< ::rtl::OUString > aArr;
+ aValue >>= aArr;
+ sal_Int32 nGlobalTokens = 0;
+ int i = 0;
+ for( i = 0; i < aArr.getLength(); i++ )
+ nGlobalTokens += aArr.getConstArray()[i].getTokenCount();
+ aPaths = Sequence< ::rtl::OUString >( nGlobalTokens );
+ for( i = aArr.getLength()-1; i >= 0; i-- )
+ {
+ sal_Int32 nTokens = aArr.getConstArray()[i].getTokenCount();
+ while( nTokens-- )
+ aPaths.getArray()[--nGlobalTokens] =
+ aArr.getConstArray()[i].getToken( nTokens );
+ }
+ }
+ }
+ }
+ }
+
+ return aPaths;
+}
+
+//==================================================================================================
+Reference< XInterface > SAL_CALL PluginManager_CreateInstance( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ) throw( Exception )
+{
+ Reference< XInterface > xService = *new XPluginManager_Impl( rSMgr );
+ return xService;
+}
+
+// ::com::sun::star::lang::XServiceInfo
+::rtl::OUString XPluginManager_Impl::getImplementationName() throw( )
+
+{
+ return getImplementationName_Static();
+
+}
+
+// ::com::sun::star::lang::XServiceInfo
+sal_Bool XPluginManager_Impl::supportsService(const ::rtl::OUString& ServiceName) throw( )
+{
+ Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
+ const ::rtl::OUString * pArray = aSNL.getConstArray();
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return sal_True;
+ return sal_False;
+}
+
+// ::com::sun::star::lang::XServiceInfo
+Sequence< ::rtl::OUString > XPluginManager_Impl::getSupportedServiceNames(void) throw( )
+{
+ return getSupportedServiceNames_Static();
+}
+
+// XPluginManager_Impl
+Sequence< ::rtl::OUString > XPluginManager_Impl::getSupportedServiceNames_Static(void) throw( )
+{
+ Sequence< ::rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[0] = ::rtl::OUString::createFromAscii( "com.sun.star.plugin.PluginManager" );
+ return aSNS;
+}
+
+XPluginManager_Impl::XPluginManager_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr )
+: m_xSMgr( rSMgr )
+{
+ PluginManager::setServiceFactory( rSMgr );
+}
+
+XPluginManager_Impl::~XPluginManager_Impl()
+{
+}
+
+XPlugin_Impl* XPluginManager_Impl::getXPluginFromNPP( NPP instance )
+{
+ ::std::list<XPlugin_Impl*>::iterator iter;
+ for( iter = PluginManager::get().getPlugins().begin();
+ iter != PluginManager::get().getPlugins().end(); ++iter )
+ {
+ if( (*iter)->getNPPInstance() == instance )
+ return *iter;
+ }
+
+ return NULL;
+}
+
+XPlugin_Impl* XPluginManager_Impl::getPluginImplementation( const Reference< ::com::sun::star::plugin::XPlugin >& plugin )
+{
+ ::std::list<XPlugin_Impl*>::iterator iter;
+ for( iter = PluginManager::get().getPlugins().begin();
+ iter != PluginManager::get().getPlugins().end(); ++iter )
+ {
+ if( plugin == Reference< ::com::sun::star::plugin::XPlugin >((*iter)) )
+ return *iter;
+ }
+
+ return NULL;
+}
+
+XPlugin_Impl* XPluginManager_Impl::getFirstXPlugin()
+{
+ if( PluginManager::get().getPlugins().begin() == PluginManager::get().getPlugins().end() )
+ return NULL;
+
+ return *PluginManager::get().getPlugins().begin();
+}
+
+Reference< ::com::sun::star::plugin::XPlugin > XPluginManager_Impl::createPlugin( const Reference< ::com::sun::star::plugin::XPluginContext >& acontext, INT16 mode, const Sequence< ::rtl::OUString >& argn, const Sequence< ::rtl::OUString >& argv, const ::com::sun::star::plugin::PluginDescription& plugintype)
+ throw( RuntimeException,::com::sun::star::plugin::PluginException )
+{
+ XPlugin_Impl* pImpl = new XPlugin_Impl( m_xSMgr );
+ pImpl->setPluginContext( acontext );
+
+ PluginManager::get().getPlugins().push_back( pImpl );
+
+ pImpl->initInstance( plugintype,
+ argn,
+ argv,
+ mode );
+
+ return pImpl;
+}
+
+Reference< ::com::sun::star::plugin::XPlugin > XPluginManager_Impl::createPluginFromURL( const Reference< ::com::sun::star::plugin::XPluginContext > & acontext, sal_Int16 mode, const Sequence< ::rtl::OUString >& argn, const Sequence< ::rtl::OUString >& argv, const Reference< ::com::sun::star::awt::XToolkit > & toolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & parent, const ::rtl::OUString& url )
+{
+ XPlugin_Impl* pImpl = new XPlugin_Impl( m_xSMgr );
+ Reference< ::com::sun::star::plugin::XPlugin > xRef = pImpl; // festhalten...
+
+ pImpl->setPluginContext( acontext );
+
+ PluginManager::get().getPlugins().push_back( pImpl );
+
+ int nDescr = -1;
+ Sequence< ::com::sun::star::plugin::PluginDescription > aDescrs = getPluginDescriptions();
+ const ::com::sun::star::plugin::PluginDescription* pDescrs = aDescrs.getConstArray();
+
+ int nPos = url.lastIndexOf( (sal_Unicode)'.' );
+ if( nPos != -1 )
+ {
+ ::rtl::OUString aExt = url.copy( nPos ).toLowerCase();
+ for( int i = 0; i < aDescrs.getLength(); i++ )
+ {
+ if( pDescrs[ i ].Extension.equalsIgnoreCase( aExt ) != STRING_NOTFOUND )
+ {
+ nDescr = i;
+ break;
+ }
+ }
+ }
+
+ pImpl->initInstance( (nDescr != -1) ? pDescrs[ nDescr ] : ::com::sun::star::plugin::PluginDescription(),
+ argn,
+ argv,
+ mode );
+
+ pImpl->createPeer( toolkit, parent );
+
+ Reference< ::com::sun::star::beans::XPropertySet > xProperty( pImpl->getModel(), UNO_QUERY );
+ if( xProperty.is() )
+ {
+ Any aAny;
+ aAny <<= url;
+ xProperty->setPropertyValue( ::rtl::OUString::createFromAscii( "URL" ), aAny );
+ }
+
+ if( ! pImpl->getPluginComm() )
+ {
+ pImpl->dispose();
+ xRef = NULL;
+ }
+
+ return xRef;
+}
+
diff --git a/extensions/source/plugin/base/multiplx.cxx b/extensions/source/plugin/base/multiplx.cxx
new file mode 100644
index 000000000000..d2ba82df78d7
--- /dev/null
+++ b/extensions/source/plugin/base/multiplx.cxx
@@ -0,0 +1,391 @@
+/*************************************************************************
+ *
+ * $RCSfile: multiplx.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <vos/diagnose.hxx>
+#include <plugin/multiplx.hxx>
+
+// ---------------------------------------------------------------------
+// class MRCListenerMultiplexerHelper
+// ---------------------------------------------------------------------
+MRCListenerMultiplexerHelper::MRCListenerMultiplexerHelper
+(
+ const Reference< ::com::sun::star::awt::XWindow > & rControl
+ , const Reference< ::com::sun::star::awt::XWindow > & rPeer
+)
+ : aListenerHolder( aMutex )
+ , xPeer( rPeer )
+ , xControl( Reference< ::com::sun::star::awt::XControl >( rControl, UNO_QUERY ) )
+{
+}
+
+
+void MRCListenerMultiplexerHelper::setPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer )
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( aMutex );
+ if( xPeer != rPeer )
+ {
+ if( xPeer.is() )
+ {
+ // get all uiks from the listener added to the peer
+ Sequence<Type> aContainedTypes = aListenerHolder.getContainedTypes();
+ const Type* pArray = aContainedTypes.getConstArray();
+ sal_Int32 nCount = aContainedTypes.getLength();
+ // loop over all listener types and remove the listeners from the peer
+ for( sal_Int32 i = 0; i < nCount; i++ )
+ unadviseFromPeer( xPeer, pArray[i] );
+ }
+ xPeer = rPeer;
+ if( xPeer.is() )
+ {
+ // get all uiks from the listener added to the peer
+ Sequence<Type> aContainedTypes = aListenerHolder.getContainedTypes();
+ const Type * pArray = aContainedTypes.getConstArray();
+ sal_Int32 nCount = aContainedTypes.getLength();
+ // loop over all listener types and add the listeners to the peer
+ for( sal_Int32 i = 0; i < nCount; i++ )
+ adviseToPeer( xPeer, pArray[i] );
+ }
+ }
+}
+
+// MRCListenerMultiplexerHelper
+void MRCListenerMultiplexerHelper::disposeAndClear()
+{
+ ::com::sun::star::lang::EventObject aEvt;
+ aEvt.Source = xControl;
+ aListenerHolder.disposeAndClear( aEvt );
+}
+
+// MRCListenerMultiplexerHelper
+void MRCListenerMultiplexerHelper::adviseToPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer, const Type & type )
+{
+ // add a listener to the source (peer)
+ if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XWindowListener >*)0) )
+ rPeer->addWindowListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XKeyListener >*)0) )
+ rPeer->addKeyListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0) )
+ rPeer->addFocusListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XMouseListener >*)0) )
+ rPeer->addMouseListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XMouseMotionListener >*)0) )
+ rPeer->addMouseMotionListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XPaintListener >*)0) )
+ rPeer->addPaintListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XTopWindowListener >*)0) )
+ {
+ Reference< ::com::sun::star::awt::XTopWindow > xTop( rPeer, UNO_QUERY );
+ if( xTop.is() )
+ xTop->addTopWindowListener( this );
+ }
+ else
+ {
+ VOS_ENSHURE( sal_False, "unknown listener" );
+ }
+}
+
+// MRCListenerMultiplexerHelper
+void MRCListenerMultiplexerHelper::unadviseFromPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer, const Type & type )
+{
+ // the last listener is removed, remove the listener from the source (peer)
+ if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XWindowListener >*)0) )
+ rPeer->removeWindowListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XKeyListener >*)0) )
+ rPeer->removeKeyListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0) )
+ rPeer->removeFocusListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XMouseListener >*)0) )
+ rPeer->removeMouseListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XMouseMotionListener >*)0) )
+ rPeer->removeMouseMotionListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XPaintListener >*)0) )
+ rPeer->removePaintListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XTopWindowListener >*)0) )
+ {
+ Reference< ::com::sun::star::awt::XTopWindow > xTop( rPeer, UNO_QUERY );
+ if( xTop.is() )
+ xTop->removeTopWindowListener( this );
+ }
+ else
+ {
+ VOS_ENSHURE( sal_False, "unknown listener" );
+ }
+}
+
+// MRCListenerMultiplexerHelper
+void MRCListenerMultiplexerHelper::advise( const Type & type, const Reference< XInterface > & listener)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( aMutex );
+ if( 1 == aListenerHolder.addInterface( type, listener ) )
+ {
+ // the first listener is added
+ if( xPeer.is() )
+ adviseToPeer( xPeer, type );
+ }
+}
+
+// MRCListenerMultiplexerHelper
+void MRCListenerMultiplexerHelper::unadvise(const Type & type, const Reference< XInterface > & listener)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( aMutex );
+ ::cppu::OInterfaceContainerHelper * pCont = aListenerHolder.getContainer( type );
+ if( pCont )
+ {
+ if( 0 == pCont->removeInterface( listener ) && xPeer.is() )
+ // the last listener is removed
+ unadviseFromPeer( xPeer, type );
+ }
+}
+
+// ::com::sun::star::lang::XEventListener
+void MRCListenerMultiplexerHelper::disposing(const ::com::sun::star::lang::EventObject& )
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( aMutex );
+ // peer is disposed, clear the reference
+ xPeer = Reference< ::com::sun::star::awt::XWindow > ();
+}
+
+#define MULTIPLEX( InterfaceName, MethodName, EventName ) \
+::cppu::OInterfaceContainerHelper * pCont; \
+pCont = aListenerHolder.getContainer( ::getCppuType((const Reference< InterfaceName >*)0) ); \
+if( pCont ) \
+{ \
+ ::cppu::OInterfaceIteratorHelper aIt( *pCont ); \
+ EventName aEvt = e; \
+ /* Remark: The control is the event source not the peer. We must change */ \
+ /* the source of the event */ \
+ aEvt.Source = xControl;\
+ /*.is the control not destroyed */ \
+ if( aEvt.Source.is() ) \
+ { \
+ if( aIt.hasMoreElements() ) \
+ { \
+ InterfaceName * pListener = (InterfaceName *)aIt.next(); \
+ try \
+ { \
+ pListener->MethodName( aEvt ); \
+ } \
+ catch( RuntimeException& ) \
+ { \
+ /* ignore all usr system exceptions from the listener */ \
+ } \
+ } \
+ } \
+}
+
+// ::com::sun::star::awt::XFocusListener
+void MRCListenerMultiplexerHelper::focusGained(const ::com::sun::star::awt::FocusEvent& e)
+{
+/*
+ OInterfaceContainerHelper * pCont = aListenerHolder.getContainer( ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0) );
+ if( pCont )
+ {
+ OInterfaceIteratorHelper aIt( *pCont );
+ ::com::sun::star::awt::FocusEvent aEvt = e;
+ // Reamark: The control is the event source not the peer. We must change
+ // the source of the event
+ xControl.queryHardRef( ((XInterface*)NULL)->getSmartUik(), aEvt.Source );
+ //.is the control not destroyed
+ if( aEvt.Source.is() )
+ {
+ if( aIt.hasMoreElements() )
+ {
+ ::com::sun::star::awt::XFocusListener * pListener = (::com::sun::star::awt::XFocusListener *)aIt.next();
+ TRY
+ {
+ pListener->focusGained( aEvt );
+ }
+ CATCH( RuntimeException, e )
+ {
+ // ignore all usr system exceptions from the listener
+ }
+ END_CATCH;
+ }
+ }
+ }
+*/
+ MULTIPLEX( ::com::sun::star::awt::XFocusListener, focusGained, ::com::sun::star::awt::FocusEvent )
+}
+
+// ::com::sun::star::awt::XFocusListener
+void MRCListenerMultiplexerHelper::focusLost(const ::com::sun::star::awt::FocusEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XFocusListener, focusLost, ::com::sun::star::awt::FocusEvent )
+}
+
+// ::com::sun::star::awt::XWindowListener
+void MRCListenerMultiplexerHelper::windowResized(const ::com::sun::star::awt::WindowEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XWindowListener, windowResized, ::com::sun::star::awt::WindowEvent )
+}
+
+// ::com::sun::star::awt::XWindowListener
+void MRCListenerMultiplexerHelper::windowMoved(const ::com::sun::star::awt::WindowEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XWindowListener, windowMoved, ::com::sun::star::awt::WindowEvent )
+}
+
+// ::com::sun::star::awt::XWindowListener
+void MRCListenerMultiplexerHelper::windowShown(const ::com::sun::star::lang::EventObject& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XWindowListener, windowShown, ::com::sun::star::lang::EventObject )
+}
+
+// ::com::sun::star::awt::XWindowListener
+void MRCListenerMultiplexerHelper::windowHidden(const ::com::sun::star::lang::EventObject& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XWindowListener, windowHidden, ::com::sun::star::lang::EventObject )
+}
+
+// ::com::sun::star::awt::XKeyListener
+void MRCListenerMultiplexerHelper::keyPressed(const ::com::sun::star::awt::KeyEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XKeyListener, keyPressed, ::com::sun::star::awt::KeyEvent )
+}
+
+// ::com::sun::star::awt::XKeyListener
+void MRCListenerMultiplexerHelper::keyReleased(const ::com::sun::star::awt::KeyEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XKeyListener, keyReleased, ::com::sun::star::awt::KeyEvent )
+}
+
+// ::com::sun::star::awt::XMouseListener
+void MRCListenerMultiplexerHelper::mousePressed(const ::com::sun::star::awt::MouseEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XMouseListener, mousePressed, ::com::sun::star::awt::MouseEvent )
+}
+
+// ::com::sun::star::awt::XMouseListener
+void MRCListenerMultiplexerHelper::mouseReleased(const ::com::sun::star::awt::MouseEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XMouseListener, mouseReleased, ::com::sun::star::awt::MouseEvent )
+}
+
+// ::com::sun::star::awt::XMouseListener
+void MRCListenerMultiplexerHelper::mouseEntered(const ::com::sun::star::awt::MouseEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XMouseListener, mouseEntered, ::com::sun::star::awt::MouseEvent )
+}
+
+// ::com::sun::star::awt::XMouseListener
+void MRCListenerMultiplexerHelper::mouseExited(const ::com::sun::star::awt::MouseEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XMouseListener, mouseExited, ::com::sun::star::awt::MouseEvent )
+}
+
+// ::com::sun::star::awt::XMouseMotionListener
+void MRCListenerMultiplexerHelper::mouseDragged(const ::com::sun::star::awt::MouseEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XMouseMotionListener, mouseDragged, ::com::sun::star::awt::MouseEvent )
+}
+
+// ::com::sun::star::awt::XMouseMotionListener
+void MRCListenerMultiplexerHelper::mouseMoved(const ::com::sun::star::awt::MouseEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XMouseMotionListener, mouseMoved, ::com::sun::star::awt::MouseEvent )
+}
+
+// ::com::sun::star::awt::XPaintListener
+void MRCListenerMultiplexerHelper::windowPaint(const ::com::sun::star::awt::PaintEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XPaintListener, windowPaint, ::com::sun::star::awt::PaintEvent )
+}
+
+// ::com::sun::star::awt::XTopWindowListener
+void MRCListenerMultiplexerHelper::windowOpened(const ::com::sun::star::lang::EventObject& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowOpened, ::com::sun::star::lang::EventObject )
+}
+
+// ::com::sun::star::awt::XTopWindowListener
+void MRCListenerMultiplexerHelper::windowClosing( const ::com::sun::star::lang::EventObject& e )
+{
+ MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowClosing, ::com::sun::star::lang::EventObject )
+}
+
+// ::com::sun::star::awt::XTopWindowListener
+void MRCListenerMultiplexerHelper::windowClosed( const ::com::sun::star::lang::EventObject& e )
+{
+ MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowClosed, ::com::sun::star::lang::EventObject )
+}
+
+// ::com::sun::star::awt::XTopWindowListener
+void MRCListenerMultiplexerHelper::windowMinimized( const ::com::sun::star::lang::EventObject& e )
+{
+ MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowMinimized, ::com::sun::star::lang::EventObject )
+}
+
+// ::com::sun::star::awt::XTopWindowListener
+void MRCListenerMultiplexerHelper::windowNormalized( const ::com::sun::star::lang::EventObject& e )
+{
+ MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowNormalized, ::com::sun::star::lang::EventObject )
+}
+
+// ::com::sun::star::awt::XTopWindowListener
+void MRCListenerMultiplexerHelper::windowActivated( const ::com::sun::star::lang::EventObject& e )
+{
+ MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowActivated, ::com::sun::star::lang::EventObject )
+}
+
+// ::com::sun::star::awt::XTopWindowListener
+void MRCListenerMultiplexerHelper::windowDeactivated( const ::com::sun::star::lang::EventObject& e )
+{
+ MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowDeactivated, ::com::sun::star::lang::EventObject )
+}
diff --git a/extensions/source/plugin/base/nfuncs.cxx b/extensions/source/plugin/base/nfuncs.cxx
new file mode 100644
index 000000000000..b90c002e82b9
--- /dev/null
+++ b/extensions/source/plugin/base/nfuncs.cxx
@@ -0,0 +1,576 @@
+/*************************************************************************
+ *
+ * $RCSfile: nfuncs.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+#include <stl/list>
+
+#ifdef USE_NAMESPACE
+using namespace std;
+#endif
+
+
+#include <plugin/impl.hxx>
+
+// #define TRACE(x) DBG_ERROR( (x) )
+#define TRACE(x)
+
+
+NPNetscapeFuncs aNPNFuncs =
+{
+ sizeof( NPNetscapeFuncs ),
+ (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR,
+ NPN_GetURL,
+ NPN_PostURL,
+ NPN_RequestRead,
+ NPN_NewStream,
+ NPN_Write,
+ NPN_DestroyStream,
+ NPN_Status,
+ NPN_UserAgent,
+ NPN_MemAlloc,
+ NPN_MemFree,
+ NPN_MemFlush,
+ NPN_ReloadPlugins,
+ NPN_GetJavaEnv,
+ NPN_GetJavaPeer,
+ NPN_GetURLNotify,
+ NPN_PostURLNotify,
+ NPN_GetValue,
+ NPN_SetValue,
+ NPN_InvalidateRect,
+ NPN_InvalidateRegion,
+ NPN_ForceRedraw
+};
+
+static ::rtl::OString normalizeURL( XPlugin_Impl* plugin, const ::rtl::OString& url )
+{
+ ::rtl::OString aLoadURL;
+ if( url.indexOf( ":/" ) == -1 )
+ {
+ aLoadURL = ::rtl::OUStringToOString( plugin->getCreationURL(), plugin->getTextEncoding() );
+ int nPos;
+ if( ( nPos = aLoadURL.indexOf( "://" ) ) != -1 )
+ {
+ if( url.getLength() && url.getStr()[ 0 ] == '/' || url.indexOf( '/' ) != -1 )
+ {
+ // this means same server but new path
+ nPos = aLoadURL.indexOf( '/', nPos+3 );
+
+ if( nPos != -1 )
+ aLoadURL = aLoadURL.copy( 0, url.getStr()[0] == '/' ? nPos : nPos+1 );
+ }
+ else
+ {
+ // same server but new file
+ nPos = aLoadURL.lastIndexOf( '/' );
+ aLoadURL = aLoadURL.copy( 0, nPos+1 );
+ }
+ aLoadURL += url;
+ }
+ else
+ aLoadURL = url;
+ }
+ else
+ aLoadURL = url;
+
+ return aLoadURL;
+}
+
+
+extern "C" {
+
+ void* SAL_CALL NP_LOADDS NPN_MemAlloc( uint32 nBytes )
+ {
+ TRACE( "NPN_MemAlloc" );
+ void* pMem = malloc( nBytes );
+ return pMem;
+ }
+
+ void SAL_CALL NP_LOADDS NPN_MemFree( void* pMem )
+ {
+ TRACE( "NPN_MemFree" );
+ free( pMem );
+ }
+
+ uint32 SAL_CALL NP_LOADDS NPN_MemFlush( uint32 nSize )
+ {
+ TRACE( "NPN_MemFlush" );
+ return 0;
+ }
+
+ NPError SAL_CALL NP_LOADDS NPN_DestroyStream( NPP instance, NPStream* stream, NPError reason )
+ {
+ TRACE( "NPN_DestroyStream" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( ! pImpl )
+ return NPERR_INVALID_INSTANCE_ERROR;
+
+ PluginStream* pStream = pImpl->getStreamFromNPStream( stream );
+ if( pStream )
+ delete pStream;
+
+ return NPERR_NO_ERROR;
+ }
+
+ const JRIEnvInterface** SAL_CALL NP_LOADDS NPN_GetJavaEnv()
+ {
+ TRACE( "NPN_GetJavaEnv" );
+ // no java in this program
+ return NULL;
+ }
+
+ void* SAL_CALL NP_LOADDS NPN_GetJavaPeer( NPP instance )
+ {
+ TRACE( "NPN_GetJavaPeer" );
+ return NULL;
+ }
+
+ NPError SAL_CALL NP_LOADDS NPN_GetURL( NPP instance, const char* url, const char* window )
+ {
+ TRACE( "NPN_GetURL" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( ! pImpl )
+ return NPERR_INVALID_INSTANCE_ERROR;
+
+ ::rtl::OString aLoadURL = normalizeURL( pImpl, url );
+ try
+ {
+ pImpl->enterPluginCallback();
+ pImpl->getPluginContext()->
+ getURL( pImpl,
+ ::rtl::OStringToOUString( aLoadURL, pImpl->getTextEncoding() ),
+ ::rtl::OStringToOUString( window, pImpl->getTextEncoding() )
+ );
+ pImpl->leavePluginCallback();
+ }
+ catch( ::com::sun::star::plugin::PluginException& e )
+ {
+ pImpl->leavePluginCallback();
+ return e.ErrorCode;
+ }
+
+ return NPERR_NO_ERROR;
+ }
+
+ NPError SAL_CALL NP_LOADDS NPN_GetURLNotify( NPP instance, const char* url, const char* target,
+ void* notifyData )
+ {
+ TRACE( "NPN_GetURLNotify" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( ! pImpl )
+ return NPERR_INVALID_INSTANCE_ERROR;
+
+ ::rtl::OString aLoadURL = normalizeURL( pImpl, url );
+ PluginEventListener* pListener =
+ new PluginEventListener( pImpl, url, aLoadURL.getStr(), notifyData );
+ if( ! target || ! *target )
+ {
+ // stream will be fed back to plugin,
+ // notify immediately after destruction of stream
+ pImpl->addPluginEventListener( pListener );
+ pListener = NULL;
+ }
+
+ try
+ {
+ pImpl->enterPluginCallback();
+ pImpl->getPluginContext()->
+ getURLNotify( pImpl,
+ ::rtl::OStringToOUString( aLoadURL, pImpl->getTextEncoding() ),
+ ::rtl::OStringToOUString( target, pImpl->getTextEncoding() ),
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > ( pListener ) );
+ pImpl->leavePluginCallback();
+ }
+ catch( ::com::sun::star::plugin::PluginException& e )
+ {
+ pImpl->leavePluginCallback();
+ return e.ErrorCode;
+ }
+
+ return NPERR_NO_ERROR;
+ }
+
+ NPError SAL_CALL NP_LOADDS NPN_NewStream( NPP instance, NPMIMEType type, const char* target,
+ NPStream** stream )
+ // stream is a return value
+ {
+ TRACE( "NPN_NewStream" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( ! pImpl )
+ return NPERR_INVALID_INSTANCE_ERROR;
+
+ PluginOutputStream* pStream = new PluginOutputStream( pImpl,
+ "", 0, 0 );
+ *stream = pStream->getStream();
+
+ try
+ {
+ pImpl->enterPluginCallback();
+ pImpl->getPluginContext()->
+ newStream(
+ pImpl,
+ ::rtl::OStringToOUString( type, pImpl->getTextEncoding () ),
+ ::rtl::OStringToOUString( target, pImpl->getTextEncoding() ),
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XActiveDataSource > ( pStream->getOutputStream(), UNO_QUERY )
+ );
+ pImpl->leavePluginCallback();
+ }
+ catch( ::com::sun::star::plugin::PluginException& e )
+ {
+ pImpl->leavePluginCallback();
+ return e.ErrorCode;
+ }
+
+ return NPERR_NO_ERROR;
+ }
+
+ NPError SAL_CALL NP_LOADDS NPN_PostURLNotify( NPP instance, const char* url, const char* target, uint32 len, const char* buf, NPBool file, void* notifyData )
+ {
+ TRACE( "NPN_PostURLNotify" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( ! pImpl )
+ return NPERR_INVALID_INSTANCE_ERROR;
+
+ ::com::sun::star::uno::Sequence<sal_Int8> Bytes( (sal_Int8*)buf, len );
+
+ ::rtl::OString aPostURL = normalizeURL( pImpl, url );
+ PluginEventListener* pListener =
+ new PluginEventListener( pImpl, url, aPostURL.getStr(), notifyData );
+
+ if( ! target || ! *target )
+ {
+ // stream will be fed back to plugin,
+ // notify immediately after destruction of stream
+ pImpl->addPluginEventListener( pListener );
+ pListener = NULL;
+ }
+
+ try
+ {
+ pImpl->enterPluginCallback();
+ pImpl->getPluginContext()->
+ postURLNotify( pImpl,
+ ::rtl::OStringToOUString( aPostURL, pImpl->getTextEncoding() ),
+ ::rtl::OStringToOUString( target, pImpl->getTextEncoding() ),
+ Bytes,
+ file,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > ( pListener ) );
+ pImpl->leavePluginCallback();
+ }
+ catch( ::com::sun::star::plugin::PluginException& e )
+ {
+ pImpl->leavePluginCallback();
+ return e.ErrorCode;
+ }
+
+ return NPERR_NO_ERROR;
+ }
+
+ NPError SAL_CALL NP_LOADDS NPN_PostURL( NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file )
+ {
+ TRACE( "NPN_PostURL" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( ! pImpl )
+ return NPERR_INVALID_INSTANCE_ERROR;
+
+ ::com::sun::star::uno::Sequence<sal_Int8> Bytes( (sal_Int8*)buf, len );
+ ::rtl::OString aPostURL = normalizeURL( pImpl, url );
+ try
+ {
+ pImpl->enterPluginCallback();
+ pImpl->getPluginContext()->
+ postURL( pImpl,
+ ::rtl::OStringToOUString( aPostURL, pImpl->getTextEncoding() ),
+ ::rtl::OStringToOUString( window, pImpl->getTextEncoding () ),
+ Bytes,
+ file );
+ pImpl->leavePluginCallback();
+ }
+ catch( ::com::sun::star::plugin::PluginException& e )
+ {
+ pImpl->leavePluginCallback();
+ return e.ErrorCode;
+ }
+
+ return NPERR_NO_ERROR;
+ }
+
+ NPError SAL_CALL NP_LOADDS NPN_RequestRead( NPStream* stream, NPByteRange* rangeList )
+ {
+ TRACE( "NPN_RequestRead" );
+ if( ! rangeList )
+ return NPERR_NO_ERROR;
+
+ ::std::list<XPlugin_Impl*>& rList = PluginManager::get().getPlugins();
+ ::std::list<XPlugin_Impl*>::iterator iter;
+ XPlugin_Impl* pPlugin = NULL;
+ PluginStream* pStream = NULL;
+ for( iter = rList.begin(); iter!= rList.end(); ++iter )
+ if( ( pStream = (*iter)->getStreamFromNPStream( stream ) ) )
+ {
+ pPlugin = *iter;
+ break;
+ }
+ if( ! pPlugin )
+ return NPERR_INVALID_INSTANCE_ERROR;
+ if( ! pStream || pStream->getStreamType() != InputStream )
+ return NPERR_FILE_NOT_FOUND;
+
+ PluginInputStream* pInputStream = (PluginInputStream*)pStream;
+ sal_Int8* pBytes = NULL;
+ int nBytes = 0;
+ pPlugin->enterPluginCallback();
+ while( rangeList )
+ {
+ if( pBytes && nBytes < rangeList->length )
+ {
+ delete pBytes;
+ pBytes = NULL;
+ }
+ if( ! pBytes )
+ pBytes = new sal_Int8[ nBytes = rangeList->length ];
+ int nRead =
+ pInputStream->read( rangeList->offset, pBytes, rangeList->length );
+ int nPos = 0;
+ int nNow;
+ do
+ {
+ nNow = pPlugin->getPluginComm()->
+ NPP_WriteReady( pPlugin->getNPPInstance(),
+ stream );
+ pPlugin->getPluginComm()->
+ NPP_Write( pPlugin->getNPPInstance(),
+ stream,
+ rangeList->offset + nPos,
+ nNow,
+ pBytes+nPos );
+ nPos += nNow;
+ nRead -= nNow;
+ } while( nRead > 0 && nNow );
+ rangeList = rangeList->next;
+ }
+ pPlugin->leavePluginCallback();
+
+ return NPERR_NO_ERROR;
+ }
+
+ void SAL_CALL NP_LOADDS NPN_Status( NPP instance, const char* message )
+ {
+ TRACE( "NPN_Status" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( ! pImpl )
+ return;
+
+ try
+ {
+ pImpl->enterPluginCallback();
+ pImpl->getPluginContext()->
+ displayStatusText( pImpl, ::rtl::OStringToOUString( message, pImpl->getTextEncoding() ) );
+ pImpl->leavePluginCallback();
+ }
+ catch( ::com::sun::star::plugin::PluginException& )
+ {
+ pImpl->leavePluginCallback();
+ return;
+ }
+ }
+
+ const char* SAL_CALL NP_LOADDS NPN_UserAgent( NPP instance )
+ {
+ TRACE( "NPN_UserAgent" );
+ static char* pAgent = strdup( "Mozilla" );
+
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( ! pImpl )
+ return pAgent;
+
+ ::rtl::OUString UserAgent;
+ try
+ {
+ pImpl->enterPluginCallback();
+ UserAgent = pImpl->getPluginContext()->
+ getUserAgent( pImpl );
+ pImpl->leavePluginCallback();
+ }
+ catch( ::com::sun::star::plugin::PluginException& )
+ {
+ pImpl->leavePluginCallback();
+ return pAgent;
+ }
+
+ if( pAgent )
+ free( pAgent );
+ pAgent = strdup( ::rtl::OUStringToOString( UserAgent, pImpl->getTextEncoding() ).getStr() );
+
+ return pAgent;
+ }
+
+void SAL_CALL NP_LOADDS NPN_Version( int* major, int* minor, int* net_major, int* net_minor )
+{
+ TRACE( "NPN_Version" );
+ *major = 4;
+ *minor = 0;
+ *net_major = 4;
+ *net_minor = 5;
+}
+
+int32 SAL_CALL NP_LOADDS NPN_Write( NPP instance, NPStream* stream, int32 len,
+ void* buffer )
+{
+ TRACE( "NPN_Write" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( ! pImpl )
+ return 0;
+
+ PluginStream* pStream = pImpl->getStreamFromNPStream( stream );
+ if( ! pStream || pStream->getStreamType() != OutputStream )
+ return 0;
+
+ pImpl->enterPluginCallback();
+ ::com::sun::star::uno::Sequence<sal_Int8> Bytes( (sal_Int8*)buffer, len );
+ ((PluginOutputStream*)pStream)->getOutputStream()->writeBytes( Bytes );
+ pImpl->leavePluginCallback();
+
+ return len;
+}
+
+
+NPError SAL_CALL NP_LOADDS NPN_GetValue( NPP instance, NPNVariable variable, void* value )
+{
+ TRACE( "NPN_GetValue" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+
+#ifdef UNX
+ // some special unix variables
+ XPlugin_Impl* pInstance = pImpl ? pImpl : XPluginManager_Impl::getFirstXPlugin();
+ if( ! pInstance )
+ return NULL;
+
+ switch( variable )
+ {
+ case NPNVxDisplay:
+ *((Display**)value) = pInstance->getAppDisplay();
+#ifdef DEBUG
+ fprintf( stderr, "NPN_GetValue of display\n" );
+#endif
+ return NPERR_NO_ERROR;
+ break;
+ case NPNVxtAppContext:
+ *((XtAppContext*)value) = pInstance->getAppContext();
+#ifdef DEBUG
+ fprintf( stderr, "NPN_GetValue of application context\n" );
+#endif
+ return NPERR_NO_ERROR;
+ }
+#endif
+
+ if( ! pImpl )
+ return 0;
+
+ ::rtl::OUString aValue;
+ try
+ {
+ pImpl->enterPluginCallback();
+ aValue = pImpl->getPluginContext()->
+ getValue( pImpl, (::com::sun::star::plugin::PluginVariable)variable );
+ pImpl->leavePluginCallback();
+ }
+ catch( ::com::sun::star::plugin::PluginException& e )
+ {
+ pImpl->leavePluginCallback();
+ return e.ErrorCode;
+ }
+
+ return NPERR_NO_ERROR;
+}
+
+void SAL_CALL NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages)
+{
+ TRACE( "NPN_ReloadPlugins" );
+}
+
+
+NPError SAL_CALL NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable,
+ void *value)
+{
+ TRACE( "NPN_SetValue" );
+ return 0;
+}
+
+void SAL_CALL NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect)
+{
+ TRACE( "NPN_InvalidateRect" );
+}
+
+void SAL_CALL NP_LOADDS NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion)
+{
+ TRACE( "NPN_InvalidateRegion" );
+}
+
+void SAL_CALL NP_LOADDS NPN_ForceRedraw(NPP instance)
+{
+ TRACE( "NPN_ForceRedraw" );
+}
+
+}
diff --git a/extensions/source/plugin/base/plcom.cxx b/extensions/source/plugin/base/plcom.cxx
new file mode 100644
index 000000000000..98a16023737e
--- /dev/null
+++ b/extensions/source/plugin/base/plcom.cxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * $RCSfile: plcom.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef SOLARIS
+#include <limits>
+#endif
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+#include <tools/fsys.hxx>
+#include <plugin/impl.hxx>
+
+PluginComm::PluginComm( const ::rtl::OString& rLibName ) :
+ m_nRefCount( 0 ),
+ m_aLibName( rLibName )
+{
+ PluginManager::get().getPluginComms().push_back( this );
+}
+
+PluginComm::~PluginComm()
+{
+ PluginManager::get().getPluginComms().remove( this );
+ while( m_aFilesToDelete.size() )
+ {
+ String aFile = m_aFilesToDelete.front();
+ m_aFilesToDelete.pop_front();
+ DirEntry aEntry( aFile );
+ aEntry.Kill();
+ }
+}
diff --git a/extensions/source/plugin/base/plctrl.cxx b/extensions/source/plugin/base/plctrl.cxx
new file mode 100644
index 000000000000..e65c47570e9b
--- /dev/null
+++ b/extensions/source/plugin/base/plctrl.cxx
@@ -0,0 +1,373 @@
+/*************************************************************************
+ *
+ * $RCSfile: plctrl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _COM_SUN_STAR_AWT_XADJUSTMENTLISTENER_HPP_
+#include <com/sun/star/awt/XAdjustmentListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XACTIONLISTENER_HPP_
+#include <com/sun/star/awt/XActionListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTEXTLISTENER_HPP_
+#include <com/sun/star/awt/XTextListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XSPINLISTENER_HPP_
+#include <com/sun/star/awt/XSpinListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XITEMLISTENER_HPP_
+#include <com/sun/star/awt/XItemListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERLISTENER_HPP_
+#include <com/sun/star/awt/XVclContainerListener.hpp>
+#endif
+
+#include <plugin/plctrl.hxx>
+#include <vcl/syschild.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+
+//--------------------------------------------------------------------------------------------------
+PluginControl_Impl::PluginControl_Impl() :
+ _pMultiplexer( NULL )
+ , _bVisible( sal_False )
+ , _bInDesignMode( sal_False )
+ , _bEnable( sal_True )
+ , _nX( 0 )
+ , _nY( 0 )
+ , _nWidth( 100 )
+ , _nHeight( 100 )
+ , _nFlags( WINDOW_POSSIZE_ALL )
+{
+}
+
+//--------------------------------------------------------------------------------------------------
+PluginControl_Impl::~PluginControl_Impl()
+{
+}
+
+MRCListenerMultiplexerHelper* PluginControl_Impl::getMultiplexer()
+{
+ if( ! _pMultiplexer )
+ _pMultiplexer = new MRCListenerMultiplexerHelper( this, _xPeerWindow );
+ return _pMultiplexer;
+}
+//==================================================================================================
+Reference< XInterface > PluginControl_Impl_NewInstance()
+{
+ return (::cppu::OWeakObject*)new PluginControl_Impl();
+}
+
+//--------------------------------------------------------------------------------------------------
+
+void PluginControl_Impl::addEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l )
+ throw( RuntimeException )
+{
+ _aDisposeListeners.push_back( l );
+}
+
+//---- ::com::sun::star::lang::XComponent ----------------------------------------------------------------------------------
+void PluginControl_Impl::removeEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l )
+ throw( RuntimeException )
+{
+ _aDisposeListeners.remove( l );
+}
+
+//---- ::com::sun::star::lang::XComponent ----------------------------------------------------------------------------------
+void PluginControl_Impl::dispose(void)
+ throw( RuntimeException )
+{
+ // send disposing events
+ ::com::sun::star::lang::EventObject aEvt;
+ if( getMultiplexer() )
+ getMultiplexer()->disposeAndClear();
+
+ // release context
+ _xContext = Reference< XInterface > ();
+ releasePeer();
+}
+
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, sal_Int32 nHeight_, sal_Int16 nFlags )
+ throw( RuntimeException )
+{
+ _nX = nX_ >=0 ? nX_ : 0;
+ _nY = nY_ >=0 ? nY_ : 0;
+ _nWidth = nWidth_ >=0 ? nWidth_ : 0;
+ _nHeight = nHeight_ >=0 ? nHeight_ : 0;
+ _nFlags = nFlags;
+
+ if (_xPeerWindow.is())
+ _xPeerWindow->setPosSize( _nX, _nY, _nWidth, _nHeight, nFlags );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+::com::sun::star::awt::Rectangle PluginControl_Impl::getPosSize(void)
+ throw( RuntimeException )
+{
+ return _xPeerWindow->getPosSize();
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::setVisible( sal_Bool bVisible )
+ throw( RuntimeException )
+{
+ _bVisible = bVisible;
+ if (_xPeerWindow.is())
+ _xPeerWindow->setVisible( _bVisible && !_bInDesignMode );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::setEnable( sal_Bool bEnable )
+ throw( RuntimeException )
+{
+ _bEnable = bEnable;
+ if (_xPeerWindow.is())
+ _xPeerWindow->setEnable( _bEnable );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::setFocus(void) throw( RuntimeException )
+{
+ if (_xPeerWindow.is())
+ _xPeerWindow->setFocus();
+}
+
+
+//--------------------------------------------------------------------------------------------------
+void PluginControl_Impl::releasePeer()
+{
+ if (_xPeer.is())
+ {
+ _xParentWindow->removeFocusListener( this );
+ _xPeerWindow->dispose();
+ _pSysChild = NULL;
+ _xPeerWindow = Reference< ::com::sun::star::awt::XWindow > ();
+ _xPeer = Reference< ::com::sun::star::awt::XWindowPeer > ();
+ getMultiplexer()->setPeer( Reference< ::com::sun::star::awt::XWindow > () );
+ }
+}
+
+//---- ::com::sun::star::awt::XControl ------------------------------------------------------------------------------------
+void PluginControl_Impl::createPeer( const Reference< ::com::sun::star::awt::XToolkit > & xToolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & xParentPeer )
+ throw( RuntimeException )
+{
+ if (_xPeer.is())
+ {
+ DBG_ERROR( "### Peer is already set!" );
+ return;
+ }
+
+ _xParentPeer = xParentPeer;
+ _xParentWindow = Reference< ::com::sun::star::awt::XWindow > ( xParentPeer, UNO_QUERY );
+ DBG_ASSERT( _xParentWindow.is(), "### no parent peer window!" );
+
+ Window* pImpl = VCLUnoHelper::GetWindow( xParentPeer );
+ if (pImpl)
+ {
+ _pSysChild = new SystemChildWindow( pImpl, WB_CLIPCHILDREN );
+// _pSysChild->Show();
+ if (pImpl->HasFocus())
+ _pSysChild->GrabFocus();
+
+ // get peer
+ _xPeer = Reference< ::com::sun::star::awt::XWindowPeer > ( _pSysChild->GetComponentInterface() );
+ _xPeerWindow = Reference< ::com::sun::star::awt::XWindow > ( _xPeer, UNO_QUERY );
+ // !_BOTH_ MUST BE VALID!
+ DBG_ASSERT( (_xPeer.is() && _xPeerWindow.is()), "### no peer!" );
+
+ _xParentWindow->addFocusListener( this );
+ _xPeerWindow->setPosSize( _nX, _nY, _nWidth, _nHeight, _nFlags );
+ _xPeerWindow->setEnable( _bEnable );
+ _xPeerWindow->setVisible( _bVisible && !_bInDesignMode );
+ }
+ else
+ {
+ DBG_ERROR( "### cannot get implementation of parent peer!" );
+ }
+
+ getMultiplexer()->setPeer( _xPeerWindow );
+}
+
+//---- ::com::sun::star::awt::XControl ------------------------------------------------------------------------------------
+void PluginControl_Impl::setDesignMode( sal_Bool bOn )
+ throw( RuntimeException )
+{
+ _bInDesignMode = bOn;
+ if (_xPeerWindow.is())
+ _xPeerWindow->setVisible( _bVisible && !_bInDesignMode );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::addPaintListener( const Reference< ::com::sun::star::awt::XPaintListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XPaintListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::removePaintListener( const Reference< ::com::sun::star::awt::XPaintListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XPaintListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::addWindowListener( const Reference< ::com::sun::star::awt::XWindowListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XWindowListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::removeWindowListener( const Reference< ::com::sun::star::awt::XWindowListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XWindowListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::addFocusListener( const Reference< ::com::sun::star::awt::XFocusListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::removeFocusListener( const Reference< ::com::sun::star::awt::XFocusListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::addKeyListener( const Reference< ::com::sun::star::awt::XKeyListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XKeyListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::removeKeyListener( const Reference< ::com::sun::star::awt::XKeyListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XKeyListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::addMouseListener( const Reference< ::com::sun::star::awt::XMouseListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XMouseListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::removeMouseListener( const Reference< ::com::sun::star::awt::XMouseListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XMouseListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::addMouseMotionListener( const Reference< ::com::sun::star::awt::XMouseMotionListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XMouseMotionListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::removeMouseMotionListener( const Reference< ::com::sun::star::awt::XMouseMotionListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XMouseMotionListener >*)0), l );
+}
+
+
+//---- ::com::sun::star::awt::XView ---------------------------------------------------------------------------------------
+void PluginControl_Impl::draw( sal_Int32 x, sal_Int32 y )
+ throw( RuntimeException )
+{
+ // has to be done by further implementation of control
+}
+
+//---- ::com::sun::star::awt::XView ---------------------------------------------------------------------------------------
+void PluginControl_Impl::setZoom( float ZoomX, float ZoomY )
+ throw( RuntimeException )
+{
+ // has to be done by further implementation of control
+}
+
+//---- ::com::sun::star::lang::XEventListener ------------------------------------------------------------------------------
+void PluginControl_Impl::disposing( const ::com::sun::star::lang::EventObject & rSource )
+ throw( RuntimeException )
+{
+}
+//---- ::com::sun::star::awt::XFocusListener ------------------------------------------------------------------------------
+void PluginControl_Impl::focusGained( const ::com::sun::star::awt::FocusEvent & rEvt )
+ throw( RuntimeException )
+{
+ if (_xPeerWindow.is())
+ _xPeerWindow->setFocus();
+}
+//---- ::com::sun::star::awt::XFocusListener ------------------------------------------------------------------------------
+void PluginControl_Impl::focusLost( const ::com::sun::star::awt::FocusEvent & rEvt )
+ throw( RuntimeException )
+{
+}
+
diff --git a/extensions/source/plugin/base/plmodel.cxx b/extensions/source/plugin/base/plmodel.cxx
new file mode 100644
index 000000000000..702699f36ad1
--- /dev/null
+++ b/extensions/source/plugin/base/plmodel.cxx
@@ -0,0 +1,243 @@
+/*************************************************************************
+ *
+ * $RCSfile: plmodel.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <plugin/model.hxx>
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+
+using namespace com::sun::star::uno;
+
+//==================================================================================================
+Reference< XInterface > SAL_CALL PluginModel_CreateInstance( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & ) throw( Exception )
+{
+ Reference< XInterface > xService = *new PluginModel();
+ return xService;
+}
+
+Any PluginModel::queryAggregation( const Type& type )
+{
+ Any aRet( ::cppu::queryInterface( type,
+ static_cast< ::com::sun::star::lang::XComponent* >(this),
+ static_cast< ::com::sun::star::io::XPersistObject* >(this ),
+ static_cast< ::com::sun::star::awt::XControlModel* >(this),
+ static_cast< ::com::sun::star::beans::XPropertySet* >(this),
+ static_cast< ::com::sun::star::beans::XMultiPropertySet* >(this),
+ static_cast< ::com::sun::star::beans::XFastPropertySet* >(this)
+ ) );
+ return aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( type );
+}
+
+
+// ::com::sun::star::lang::XServiceInfo
+::rtl::OUString PluginModel::getImplementationName() throw( )
+
+{
+ return getImplementationName_Static();
+}
+
+// ::com::sun::star::lang::XServiceInfo
+sal_Bool PluginModel::supportsService(const ::rtl::OUString& ServiceName) throw( )
+{
+ Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
+ const ::rtl::OUString * pArray = aSNL.getConstArray();
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return sal_True;
+ return sal_False;
+}
+
+// ::com::sun::star::lang::XServiceInfo
+Sequence< ::rtl::OUString > PluginModel::getSupportedServiceNames(void) throw( )
+{
+ return getSupportedServiceNames_Static();
+}
+
+// XPluginManager_Impl
+Sequence< ::rtl::OUString > PluginModel::getSupportedServiceNames_Static(void) throw( )
+{
+ Sequence< ::rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[0] = ::rtl::OUString::createFromAscii( "com.sun.star.plugin.PluginModel" );
+ return aSNS;
+}
+
+
+static char* aCreationURL = "URL";
+
+static ::osl::Mutex aPropertyMutex;
+
+static ::com::sun::star::beans::Property aProps[] =
+{
+ ::com::sun::star::beans::Property(
+ ::rtl::OUString::createFromAscii( aCreationURL ),
+ -1,
+ ::getCppuType((const ::rtl::OUString*)0),
+ ::com::sun::star::beans::PropertyAttribute::BOUND )
+};
+
+PluginModel::PluginModel() :
+ BroadcasterHelperHolder( aPropertyMutex ),
+ OPropertySetHelper( m_aHelper ),
+ OPropertyArrayHelper( aProps, 1 )
+{
+}
+
+PluginModel::PluginModel(const ::rtl::OUString& rURL) :
+ BroadcasterHelperHolder( aPropertyMutex ),
+ OPropertySetHelper( m_aHelper ),
+ OPropertyArrayHelper( aProps, 1 ),
+ m_aCreationURL( rURL )
+{
+}
+
+PluginModel::~PluginModel()
+{
+}
+
+Reference< ::com::sun::star::beans::XPropertySetInfo > PluginModel::getPropertySetInfo()
+{
+ static Reference< ::com::sun::star::beans::XPropertySetInfo > aInfo =
+ createPropertySetInfo( *this );
+ return aInfo;
+}
+
+::cppu::IPropertyArrayHelper& PluginModel::getInfoHelper()
+{
+ return *this;
+}
+
+sal_Bool PluginModel::convertFastPropertyValue( Any & rConvertedValue,
+ Any & rOldValue,
+ sal_Int32 nHandle,
+ const Any& rValue )
+{
+ if( rValue.getValueTypeClass() == typelib_TypeClass_STRING )
+
+ {
+ rConvertedValue = rValue;
+ rOldValue <<= m_aCreationURL;
+ return sal_True;
+ }
+ return sal_False;
+}
+
+void PluginModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle,
+ const Any& rValue )
+ throw( ::com::sun::star::lang::IllegalArgumentException )
+{
+ if( rValue.getValueTypeClass() == typelib_TypeClass_STRING )
+
+ {
+ rValue >>= m_aCreationURL;
+ }
+ else
+ throw ::com::sun::star::lang::IllegalArgumentException();
+}
+
+void PluginModel::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
+{
+ rValue <<= m_aCreationURL;
+}
+
+//---- ::com::sun::star::lang::XComponent ----------------------------------------------------------------------------------
+void PluginModel::addEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l )
+{
+ m_aDisposeListeners.push_back( l );
+}
+
+//---- ::com::sun::star::lang::XComponent ----------------------------------------------------------------------------------
+void PluginModel::removeEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l )
+{
+ m_aDisposeListeners.remove( l );
+}
+
+//---- ::com::sun::star::lang::XComponent ----------------------------------------------------------------------------------
+void PluginModel::dispose(void)
+{
+ // send disposing events
+ ::com::sun::star::lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ ::std::list< Reference< ::com::sun::star::lang::XEventListener > > aLocalListeners = m_aDisposeListeners;
+ for( ::std::list< Reference< ::com::sun::star::lang::XEventListener > >::iterator it = aLocalListeners.begin();
+ it != aLocalListeners.end(); ++it )
+ (*it)->disposing( aEvt );
+
+ m_aDisposeListeners.clear();
+
+ disposing();
+}
+
+
+// ::com::sun::star::io::XPersistObject
+::rtl::OUString PluginModel::getServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.plugin.PluginModel" );
+}
+
+void PluginModel::write(const Reference< ::com::sun::star::io::XObjectOutputStream > & OutStream)
+{
+ OutStream->writeUTF( m_aCreationURL );
+}
+
+void PluginModel::read(const Reference< ::com::sun::star::io::XObjectInputStream > & InStream)
+{
+ m_aCreationURL = InStream->readUTF();
+}
diff --git a/extensions/source/plugin/base/service.cxx b/extensions/source/plugin/base/service.cxx
new file mode 100644
index 000000000000..09049a332690
--- /dev/null
+++ b/extensions/source/plugin/base/service.cxx
@@ -0,0 +1,206 @@
+/*************************************************************************
+ *
+ * $RCSfile: service.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+#include <plugin/impl.hxx>
+#include <tools/debug.hxx>
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XSET_HPP_
+#include <com/sun/star/container/XSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#endif
+
+#include <uno/dispatcher.h> // declaration of generic uno interface
+#include <uno/mapping.hxx> // mapping stuff
+
+#include <cppuhelper/factory.hxx>
+
+using namespace cppu;
+
+//==================================================================================================
+void registerPluginService( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMgr )
+{
+ if (! xMgr.is())
+ return;
+
+ Reference< ::com::sun::star::container::XSet > xReg( xMgr, UNO_QUERY );
+ if(xReg.is())
+ {
+ Any aAny;
+ Reference< ::com::sun::star::lang::XSingleServiceFactory > xF;
+ xF = createSingleFactory( xMgr, PluginModel::getImplementationName_Static(),
+
+ PluginModel_CreateInstance,
+ PluginModel::getSupportedServiceNames_Static() );
+ aAny <<= xF;
+ xReg->insert( aAny );
+ xF = createSingleFactory( xMgr, XPluginManager_Impl::getImplementationName_Static(),
+
+ PluginManager_CreateInstance,
+ XPluginManager_Impl::getSupportedServiceNames_Static() );
+ aAny <<= xF;
+ xReg->insert( aAny );
+ }
+}
+
+extern "C" {
+ void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char** ppEnvTypeName,
+ uno_Environment** ppEnv )
+ {
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+ }
+
+ sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pXUnoKey )
+ {
+ if( pXUnoKey )
+ {
+ try
+ {
+ Reference< ::com::sun::star::registry::XRegistryKey > xKey( reinterpret_cast< ::com::sun::star::registry::XRegistryKey* >( pXUnoKey ) );
+
+ ::rtl::OUString aImplName = ::rtl::OUString::createFromAscii( "/" );
+ aImplName += XPluginManager_Impl::getImplementationName_Static();
+ aImplName += ::rtl::OUString::createFromAscii( "/UNO/SERVICES/com.sun.star.plugin.PluginManager" );
+ xKey->createKey( aImplName );
+
+ aImplName = ::rtl::OUString::createFromAscii( "/" );
+ aImplName += PluginModel::getImplementationName_Static();
+ aImplName += ::rtl::OUString::createFromAscii( "/UNO/SERVICES/com.sun.star.plugin.PluginModel" );
+ xKey->createKey( aImplName );
+
+ return sal_True;
+ }
+ catch( ::com::sun::star::registry::InvalidRegistryException& )
+ {
+ }
+ }
+ return sal_False;
+ }
+
+ void* SAL_CALL component_getFactory(
+ const sal_Char* pImplementationName,
+ void* pXUnoSMgr,
+ void* pXUnoKey
+ )
+ {
+ void* pRet = 0;
+
+ ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplementationName ) );
+
+ if( pXUnoSMgr )
+ {
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > xMgr(
+ reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pXUnoSMgr )
+ );
+ Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory;
+ if( aImplName.equals( XPluginManager_Impl::getImplementationName_Static() ) )
+ {
+ xFactory = ::cppu::createSingleFactory(
+ xMgr, aImplName, PluginManager_CreateInstance,
+ XPluginManager_Impl::getSupportedServiceNames_Static() );
+ }
+ else if( aImplName.equals( PluginModel::getImplementationName_Static() ) )
+ {
+ xFactory = ::cppu::createSingleFactory(
+ xMgr, aImplName, PluginModel_CreateInstance,
+ PluginModel::getSupportedServiceNames_Static() );
+ }
+ if( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+ return pRet;
+ }
+
+/** special registration procedure for the staroffice player */
+ void SAL_CALL exService_getSmartFactory( const sal_Char* implementationName, const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr, Reference< ::com::sun::star::lang::XSingleServiceFactory > & xFactory )
+ {
+ ::rtl::OUString aImplementationName( ::rtl::OUString::createFromAscii(implementationName));
+
+ if (aImplementationName == PluginModel::getImplementationName_Static() )
+
+ {
+ xFactory = createSingleFactory( rSMgr, aImplementationName,
+ PluginModel_CreateInstance,
+ PluginModel::getSupportedServiceNames_Static() );
+ }
+ else if (aImplementationName == XPluginManager_Impl::getImplementationName_Static() )
+
+ {
+ xFactory = createSingleFactory( rSMgr, aImplementationName,
+ PluginManager_CreateInstance,
+ XPluginManager_Impl::getSupportedServiceNames_Static() );
+ }
+ }
+} /* extern "C" */
diff --git a/extensions/source/plugin/base/xplugin.cxx b/extensions/source/plugin/base/xplugin.cxx
new file mode 100644
index 000000000000..b8692b7c656f
--- /dev/null
+++ b/extensions/source/plugin/base/xplugin.cxx
@@ -0,0 +1,888 @@
+/*************************************************************************
+ *
+ * $RCSfile: xplugin.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string> // workaround for SUNPRO workshop include conflicts
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LOADER_XIMPLEMENTATIONLOADER_HPP_
+#include <com/sun/star/loader/XImplementationLoader.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LOADER_CANNOTACTIVATEFACTORYEXCEPTION_HPP_
+#include <com/sun/star/loader/CannotActivateFactoryException.hpp>
+#endif
+
+#include <plugin/impl.hxx>
+#include <tools/fsys.hxx>
+
+#include <tools/urlobj.hxx>
+#include <tools/string.hxx>
+#include <vcl/svapp.hxx>
+#include <vos/timer.hxx>
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+class PluginDisposer : public ::vos::OTimer
+{
+private:
+ XPlugin_Impl* m_pPlugin;
+
+ virtual void SAL_CALL onShot();
+public:
+ PluginDisposer( XPlugin_Impl* pPlugin ) :
+ OTimer( ::vos::TTimeValue( 2, 0 ),
+ ::vos::TTimeValue( 2, 0 ) ),
+ m_pPlugin( pPlugin )
+ { start(); }
+ ~PluginDisposer() {}
+};
+
+void PluginDisposer::onShot()
+{
+ if( m_pPlugin )
+ {
+ if( m_pPlugin->isDisposable() )
+ {
+ sal_uInt32 nEvent;
+ Application::PostUserEvent( nEvent, LINK( m_pPlugin, XPlugin_Impl, secondLevelDispose ), (void*)m_pPlugin );
+ }
+ }
+ else
+ release();
+}
+
+//==================================================================================================
+
+//==================================================================================================
+// const Reference< ::com::sun::star::reflection::XIdlClass > & XPlugin_Impl::staticGetIdlClass()
+// {
+// static Reference< ::com::sun::star::reflection::XIdlClass > aClass = createStandardClass( L"Plugin",
+// OWeakAggObject::getStaticIdlClass(), 6,
+// ::getCppuType((const ::com::sun::star::awt::XControl*)0),
+// ::getCppuType((const ::com::sun::star::awt::XControlModel*)0),
+// ::getCppuType((const ::com::sun::star::awt::XWindow*)0),
+// ::getCppuType((const ::com::sun::star::lang::XComponent*)0),
+// ::getCppuType((const ::com::sun::star::awt::XView*)0),
+// ::getCppuType((const ::com::sun::star::plugin::XPlugin*)0) );
+// return aClass;
+// }
+
+Any XPlugin_Impl::queryInterface( const Type& type )
+
+{
+ return OWeakAggObject::queryInterface( type );
+}
+
+Any XPlugin_Impl::queryAggregation( const Type& type )
+{
+ Any aRet( ::cppu::queryInterface( type, static_cast< ::com::sun::star::plugin::XPlugin* >(this) ) );
+ if( ! aRet.hasValue() )
+ aRet = PluginControl_Impl::queryAggregation( type );
+ return aRet;
+}
+
+
+XPlugin_Impl::XPlugin_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr) :
+ m_xSMgr( rSMgr ),
+ PluginControl_Impl(),
+ m_pPluginComm( NULL ),
+ m_pArgn( NULL ),
+ m_pArgv( NULL ),
+ m_nArgs( 0 ),
+ m_aPluginMode( NP_FULL ),
+ m_nProvidingState( PROVIDING_NONE ),
+ m_nCalledFromPlugin( 0 ),
+ m_pDisposer( NULL ),
+ m_bIsDisposed( sal_False ),
+ m_aEncoding( gsl_getSystemTextEncoding() )
+{
+ memset( &m_aInstance, 0, sizeof( m_aInstance ) );
+ memset( &m_aNPWindow, 0, sizeof( m_aNPWindow ) );
+#ifdef UNX
+ m_aAppContext = NULL;
+ m_pDisplay = NULL;
+ memset( &m_aWSInfo, 0, sizeof( m_aWSInfo ) );
+#endif
+
+ m_xModel = new PluginModel();
+ Reference< ::com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY );
+ xPS->addPropertyChangeListener( ::rtl::OUString(), this );
+
+ ::osl::Guard< ::osl::Mutex > aGuard( PluginManager::get().getPluginMutex() );
+ PluginManager::get().getPlugins().push_back( this );
+}
+
+void XPlugin_Impl::destroyInstance()
+{
+ NPSavedData* pSavedData = NULL;
+
+ destroyStreams();
+ if( getPluginComm() )
+ {
+ getPluginComm()->NPP_Destroy( getNPPInstance(),
+ &pSavedData );
+ getPluginComm()->decRef();
+ m_pPluginComm = NULL;
+ }
+
+ if( m_nArgs > 0 )
+ {
+ for( ; m_nArgs--; )
+ {
+ free( (void*)m_pArgn[m_nArgs] );
+ free( (void*)m_pArgv[m_nArgs] );
+ }
+ delete m_pArgn;
+ delete m_pArgv;
+ }
+ while( m_aPEventListeners.size() )
+ {
+ delete *m_aPEventListeners.begin();
+ m_aPEventListeners.pop_front();
+ }
+}
+
+XPlugin_Impl::~XPlugin_Impl()
+{
+ destroyInstance();
+}
+
+void XPlugin_Impl::checkListeners( const char* normalizedURL )
+{
+ if( ! normalizedURL )
+ return;
+
+ ::std::list<PluginEventListener*>::iterator iter;
+ for( iter = m_aPEventListeners.begin();
+ iter != m_aPEventListeners.end();
+ ++iter )
+ {
+ if( ! strcmp( normalizedURL, (*iter)->getURL() ) ||
+ ! strcmp( normalizedURL, (*iter)->getNormalizedURL() ) )
+ {
+ (*iter)->disposing( ::com::sun::star::lang::EventObject() );
+ delete *iter;
+ m_aPEventListeners.remove( *iter );
+ return;
+ }
+ }
+}
+
+IMPL_LINK( XPlugin_Impl, secondLevelDispose, XPlugin_Impl*, pThis )
+{
+ // may have become undisposable between PostUserEvent and here
+ // or may have disposed and receive a second UserEvent
+ ::std::list<XPlugin_Impl*>& rList = PluginManager::get().getPlugins();
+ ::std::list<XPlugin_Impl*>::iterator iter;
+
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( PluginManager::get().getPluginMutex() );
+ for( iter = rList.begin(); iter != rList.end(); ++iter )
+ {
+ if( *iter == this )
+ break;
+ }
+ if( iter == rList.end() || ! isDisposable() )
+ return 0;
+ }
+
+ if (m_pDisposer)
+ {
+ m_pDisposer->release();
+ m_pDisposer = NULL;
+ }
+
+ Reference< ::com::sun::star::plugin::XPlugin > xProtection( this );
+ Reference< ::com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY );
+ xPS->removePropertyChangeListener( ::rtl::OUString(), this );
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( PluginManager::get().getPluginMutex() );
+ rList.remove( this );
+ }
+ m_aNPWindow.window = NULL;
+#ifndef UNX
+ // acrobat does an unconditional XtParent on the windows widget
+ getPluginComm()->
+ NPP_SetWindow( getNPPInstance(), &m_aNPWindow );
+#endif
+ destroyInstance();
+ PluginControl_Impl::dispose();
+ return 0;
+}
+
+void XPlugin_Impl::dispose()
+{
+ if (m_bIsDisposed || !getPluginComm())
+ return;
+ m_bIsDisposed = sal_True;
+
+ if( isDisposable() )
+ secondLevelDispose( this );
+ else
+ {
+ m_pDisposer = new PluginDisposer( this );
+ m_pDisposer->acquire();
+ }
+}
+
+void XPlugin_Impl::initInstance( const ::com::sun::star::plugin::PluginDescription& rDescription,
+ const Sequence< ::rtl::OUString >& argn,
+ const Sequence< ::rtl::OUString >& argv,
+ sal_Int16 mode )
+{
+ m_aDescription = rDescription;
+
+ // #69333# special for pdf
+ m_aPluginMode = mode;
+ if( m_aDescription.Mimetype.compareToAscii( "application/pdf" ) )
+ m_aPluginMode = ::com::sun::star::plugin::PluginMode::FULL;
+
+ m_nArgs = argn.getLength();
+ m_pArgn = new const char*[m_nArgs];
+ m_pArgv = new const char*[m_nArgs];
+ const ::rtl::OUString* pUArgn = argn.getConstArray();
+ const ::rtl::OUString* pUArgv = argv.getConstArray();
+ for( int i = 0; i < m_nArgs; i++ )
+ {
+ m_pArgn[i] = strdup(
+ ::rtl::OUStringToOString( pUArgn[i], m_aEncoding ).getStr()
+ );
+ m_pArgv[i] = strdup(
+ ::rtl::OUStringToOString( pUArgv[i], m_aEncoding ).getStr()
+ );
+ }
+}
+
+void XPlugin_Impl::modelChanged()
+{
+ m_nProvidingState = PROVIDING_MODEL_UPDATE;
+
+ // empty description is only set when created by createPluginFromURL
+ if( m_aDescription.Mimetype.getLength() )
+ destroyInstance();
+
+ Reference< ::com::sun::star::plugin::XPluginManager > xPMgr( m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.plugin.PluginManager" ) ), UNO_QUERY );
+ if( !xPMgr.is() )
+ {
+ m_nProvidingState = PROVIDING_NONE;
+ return;
+ }
+
+ int nDescr = -1;
+ Sequence< ::com::sun::star::plugin::PluginDescription > aDescrs = xPMgr->getPluginDescriptions();
+ const ::com::sun::star::plugin::PluginDescription* pDescrs = aDescrs.getConstArray();
+
+ ::rtl::OUString aURL = getCreationURL();
+ int nPos = aURL.lastIndexOf( (sal_Unicode)'.' );
+ ::rtl::OUString aExt = aURL.copy( nPos ).toLowerCase();
+ if( nPos != -1 )
+ {
+ for( int i = 0; i < aDescrs.getLength(); i++ )
+ {
+ ::rtl::OUString aThisExt = pDescrs[ i ].Extension.toLowerCase();
+ if( aThisExt.indexOf( aExt ) != -1 )
+ {
+ nDescr = i;
+ break;
+ }
+ }
+ }
+
+ if( nDescr != -1 )
+ {
+ INetURLObject aURL;
+ aURL.SetSmartProtocol( INET_PROT_FILE );
+ aURL.SetSmartURL( ::rtl::OUStringToOString( getCreationURL(), m_aEncoding ) );
+
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > xFact( m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.DataSourceFactory" ) ), UNO_QUERY );
+ if ( xFact.is() )
+ {
+ Sequence < Any > aArgs(1);
+ aArgs.getArray()[0] <<= ::rtl::OUString( aURL.GetMainURL() );
+ ::rtl::OUString aProt( INetURLObject::GetScheme( aURL.GetProtocol() ) );
+ Reference< ::com::sun::star::io::XActiveDataSource > xSource( xFact->createInstanceWithArguments( aProt, aArgs ), UNO_QUERY );
+ if ( xSource.is() )
+ {
+ m_aDescription = pDescrs[ nDescr ];
+ provideNewStream( m_aDescription.Mimetype,
+ xSource,
+ getRefererURL(),
+ 0, 0, sal_False );
+ }
+ }
+ }
+ m_nProvidingState = PROVIDING_NONE;
+}
+
+::rtl::OUString XPlugin_Impl::getCreationURL()
+{
+ ::rtl::OUString aRet;
+ Reference< ::com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY );
+ if( xPS.is() )
+ {
+ Any aValue = xPS->getPropertyValue( ::rtl::OUString::createFromAscii( "URL" ) );
+ aValue >>= aRet;
+ }
+ return aRet;
+}
+
+
+sal_Bool XPlugin_Impl::setModel( const Reference< ::com::sun::star::awt::XControlModel > & Model )
+ throw( RuntimeException )
+{
+ Reference< ::com::sun::star::beans::XPropertySet > xPS( Model, UNO_QUERY );
+ if( ! xPS.is() )
+ return sal_False;
+
+ if( getCreationURL().getLength() )
+ {
+ m_xModel = Model;
+ modelChanged();
+ xPS->addPropertyChangeListener( ::rtl::OUString(), this );
+ return sal_True;
+ }
+ return sal_False;
+}
+
+void XPlugin_Impl::createPeer( const Reference< ::com::sun::star::awt::XToolkit > & xToolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & Parent )
+ throw( RuntimeException )
+{
+ if( ! _xPeer.is() )
+ {
+ if( ! Parent.is() )
+ throw RuntimeException();
+ PluginControl_Impl::createPeer( xToolkit, Parent );
+ }
+}
+
+void XPlugin_Impl::loadPlugin()
+{
+ ::std::list<PluginComm*>::iterator iter;
+ for( iter = PluginManager::get().getPluginComms().begin();
+ iter != PluginManager::get().getPluginComms().end(); ++iter )
+ {
+ if( ::rtl::OStringToOUString( (*iter)->getLibName(), m_aEncoding ) == m_aDescription.PluginName )
+ {
+ setPluginComm( *iter );
+ break;
+ }
+ }
+ const SystemEnvData* pEnvData = getSysChildSysData();
+#ifdef UNX
+ XSync( (Display*)pEnvData->pDisplay, False );
+#endif
+ if( ! getPluginComm() )
+ {
+#ifdef UNX
+ m_pDisplay = (Display*)pEnvData->pDisplay;
+ m_aAppContext = (XtAppContext)pEnvData->pAppContext;
+ // need a new PluginComm
+ PluginComm* pComm = new UnxPluginComm( ::rtl::OUStringToOString( m_aDescription.PluginName, gsl_getSystemTextEncoding() ) );
+#elif (defined WNT || defined OS2)
+ PluginComm* pComm = new PluginComm_Impl( m_aDescription.Mimetype,
+ m_aDescription.PluginName,
+ (HWND)pEnvData->hWnd );
+#endif
+ setPluginComm( pComm );
+ }
+
+ NPError aError = getPluginComm()->
+ NPP_New( (char*)::rtl::OUStringToOString( m_aDescription.Mimetype,
+ m_aEncoding).getStr(),
+ getNPPInstance(),
+ m_aPluginMode,
+ m_nArgs,
+ (char**)(m_nArgs ? m_pArgn : NULL),
+ (char**)(m_nArgs ? m_pArgv : NULL),
+ NULL );
+
+#ifdef UNX
+ XSync( (Display*)pEnvData->pDisplay, False );
+#endif
+#ifdef UNX
+ m_aNPWindow.window = (void*)pEnvData->aWindow;
+ m_aNPWindow.ws_info = &m_aWSInfo;
+
+ m_aWSInfo.type = NP_SETWINDOW;
+ m_aWSInfo.display = (Display*)pEnvData->pDisplay;
+ m_aWSInfo.visual = (Visual*)pEnvData->pVisual;
+ m_aWSInfo.colormap = (Colormap)pEnvData->aColormap;
+ m_aWSInfo.depth = pEnvData->nDepth;
+#else
+ m_aNPWindow.window = (void*)pEnvData->hWnd;
+#endif
+ ::com::sun::star::awt::Rectangle aPosSize = getPosSize();
+
+ m_aNPWindow.clipRect.top = 0;
+ m_aNPWindow.clipRect.left = 0;
+ m_aNPWindow.clipRect.bottom = 0;
+ m_aNPWindow.clipRect.right = 0;
+ m_aNPWindow.type = NPWindowTypeWindow;
+
+ m_aNPWindow.x = aPosSize.X;
+ m_aNPWindow.y = aPosSize.Y;
+ m_aNPWindow.width = aPosSize.Width ? aPosSize.Width : 600;
+ m_aNPWindow.height = aPosSize.Height ? aPosSize.Height : 600;
+
+ aError = getPluginComm()->
+ NPP_SetWindow( getNPPInstance(), &m_aNPWindow );
+}
+
+void XPlugin_Impl::destroyStreams()
+{
+ // streams remove themselves from this list when deleted
+ while( m_aOutputStreams.size() )
+ delete *m_aOutputStreams.begin();
+
+ // input streams are XOutputStreams, they cannot be simply deleted
+ ::std::list<PluginInputStream*> aLocalList( m_aInputStreams );
+ for( ::std::list<PluginInputStream*>::iterator it = aLocalList.begin();
+ it != aLocalList.end(); ++it )
+ (*it)->setMode( -1 );
+}
+
+PluginStream* XPlugin_Impl::getStreamFromNPStream( NPStream* stream )
+{
+ ::std::list<PluginInputStream*>::iterator iter;
+ for( iter = m_aInputStreams.begin(); iter != m_aInputStreams.end(); ++iter )
+ if( (*iter)->getStream() == stream )
+ return *iter;
+
+ ::std::list<PluginOutputStream*>::iterator iter2;
+ for( iter2 = m_aOutputStreams.begin(); iter2 != m_aOutputStreams.end(); ++iter2 )
+ if( (*iter2)->getStream() == stream )
+ return *iter2;
+
+ return NULL;
+}
+
+sal_Bool XPlugin_Impl::provideNewStream(const ::rtl::OUString& mimetype,
+ const Reference< ::com::sun::star::io::XActiveDataSource > & stream,
+ const ::rtl::OUString& url, sal_Int32 length,
+ sal_Int32 lastmodified, sal_Bool isfile)
+
+{
+ if( m_nProvidingState == PROVIDING_NONE )
+ {
+ m_nProvidingState = PROVIDING_NOW;
+ Any aAny;
+ aAny <<= url;
+ Reference< ::com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY );
+ xPS->setPropertyValue( ::rtl::OUString::createFromAscii( "URL" ), aAny );
+ }
+
+ m_nProvidingState = PROVIDING_NOW;
+ if( ! m_pPluginComm )
+ loadPlugin();
+
+ ::rtl::OString aMIME;
+ if( mimetype.len() )
+ aMIME = ::rtl::OUStringToOString( mimetype, m_aEncoding );
+ else
+ // Notnagel
+ aMIME = ::rtl::OUStringToOString( m_aDescription.Mimetype, m_aEncoding );
+
+ ::rtl::OString aURL = ::rtl::OUStringToOString( url, m_aEncoding );
+
+ // check wether there is a notifylistener for this stream
+ // this means that the strema is created from the plugin
+ // via NPN_GetURLNotify or NPN_PostURLNotify
+ ::std::list<PluginEventListener*>::iterator iter;
+ for( iter = m_aPEventListeners.begin();
+ iter != m_aPEventListeners.end();
+ ++iter )
+ {
+ if( (*iter)->getNormalizedURL() == aURL )
+ {
+ aURL = (*iter)->getURL();
+ break;
+ }
+ }
+
+ if( iter == m_aPEventListeners.end() )
+ {
+ // e.g. plugger.so does not like file:///
+ if( ! aURL.compareTo( "file://", 7 ) )
+ {
+ INetURLObject aPath( url );
+ aURL = ::rtl::OUStringToOString( aPath.PathToFileName(), m_aEncoding );
+ }
+ }
+
+ PluginInputStream* pStream = new PluginInputStream( this, aURL.getStr(),
+ length, lastmodified );
+ Reference< ::com::sun::star::io::XOutputStream > xNewStream( pStream );
+
+ if( iter != m_aPEventListeners.end() )
+ pStream->getStream()->notifyData = (*iter)->getNotifyData();
+
+ uint16 stype = 0;
+
+ // sal_False in the following statement should logically be isfile
+ // but e.g. the acrobat reader plugin does not WANT a file
+ // NP_ASFILE or NP_ASFILEONLY if the new stream is seekable
+ // the reason for this behaviour is unknown
+#ifdef DEBUG
+ fprintf( stderr, "new stream \"%s\" of MIMEType \"%s\"\nfor plugin \"%s\"\n", aURL.getStr(), aMIME.getStr(), getPluginComm()->getLibName().getStr() );
+
+#endif
+ if( ! m_pPluginComm->NPP_NewStream( &m_aInstance, (char*)aMIME.getStr(),
+ pStream->getStream(), sal_False,
+ &stype ) )
+ {
+ getPluginComm()->NPP_SetWindow( getNPPInstance(), &m_aNPWindow );
+#ifdef DEBUG
+ char* pType;
+ switch( stype )
+ {
+ case NP_NORMAL: pType = "NP_NORMAL";break;
+ case NP_SEEK: pType = "NP_SEEK";break;
+ case NP_ASFILE: pType = "NP_ASFILE";break;
+ case NP_ASFILEONLY: pType = "NP_ASFILEONLY";break;
+ default: pType = "unknown!!!";
+ }
+ fprintf( stderr, "Plugin wants it in Mode %s\n", pType );
+#endif
+ if( isfile && stype == NP_ASFILEONLY )
+ {
+ m_pPluginComm->
+ NPP_StreamAsFile( &m_aInstance,
+ pStream->getStream(),
+ pStream->getStream()->url );
+ m_nProvidingState = PROVIDING_NONE;
+ return sal_True;
+ }
+
+ if( ! stream.is() )
+ {
+ m_pPluginComm->
+ NPP_DestroyStream( &m_aInstance,
+ pStream->getStream(),
+ NPRES_NETWORK_ERR );
+ m_nProvidingState = PROVIDING_NONE;
+ throw RuntimeException();
+ }
+ pStream->setMode( stype );
+ Reference< ::com::sun::star::io::XConnectable > xConnectable( stream, UNO_QUERY );
+ pStream->setPredecessor( xConnectable );
+ if( xConnectable.is() )
+ {
+ xConnectable->setSuccessor( static_cast< ::com::sun::star::io::XConnectable* >(pStream) );
+ while( xConnectable->getPredecessor().is() )
+ xConnectable = xConnectable->getPredecessor();
+ }
+ stream->setOutputStream( xNewStream );
+ pStream->setSource( stream );
+ Reference< ::com::sun::star::io::XActiveDataControl > xController;
+ if( xConnectable.is() )
+ xController = Reference< ::com::sun::star::io::XActiveDataControl >( xConnectable, UNO_QUERY );
+ else
+ xController = Reference< ::com::sun::star::io::XActiveDataControl >( stream, UNO_QUERY );
+
+ if( xController.is() )
+ xController->start();
+ }
+
+ m_nProvidingState = PROVIDING_NONE;
+
+ return sal_False;
+}
+
+void XPlugin_Impl::disposing( const ::com::sun::star::lang::EventObject& rSource )
+{
+}
+
+void XPlugin_Impl::propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvent )
+{
+ if( ! rEvent.PropertyName.compareToAscii( "URL" ) )
+ {
+ ::rtl::OUString aStr;
+ rEvent.NewValue >>= aStr;
+ if( m_nProvidingState == PROVIDING_NONE )
+ {
+ if( aStr != m_aURL )
+ {
+ m_aURL = aStr;
+ modelChanged();
+ }
+ }
+ }
+}
+
+void XPlugin_Impl::setPluginContext( const Reference< ::com::sun::star::plugin::XPluginContext > & rContext )
+{
+ m_rBrowserContext = rContext;
+}
+
+void XPlugin_Impl::setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, sal_Int32 nHeight_, sal_Int16 nFlags )
+ throw( RuntimeException )
+{
+#ifdef DEBUG
+ fprintf( stderr, "XPlugin_Impl::setPosSize( %d, %d, %d, %d, %d )\n",
+ nX_, nY_, nWidth_, nHeight_, nFlags );
+#endif
+
+ PluginControl_Impl::setPosSize(nX_, nY_, nWidth_, nHeight_, nFlags);
+ m_aNPWindow.x = nX_;
+ m_aNPWindow.y = nY_;
+ m_aNPWindow.width = nWidth_;
+ m_aNPWindow.height = nHeight_;
+
+ if(getPluginComm())
+ getPluginComm()->NPP_SetWindow( getNPPInstance(), &m_aNPWindow );
+}
+
+PluginStream::PluginStream( XPlugin_Impl* pPlugin,
+ const char* url, sal_uInt32 len, sal_uInt32 lastmod ) :
+ m_pPlugin( pPlugin )
+{
+ memset( &m_aNPStream, 0, sizeof( m_aNPStream ) );
+ m_aNPStream.url = strdup( url );
+ m_aNPStream.end = len;
+ m_aNPStream.lastmodified = lastmod;
+}
+
+PluginStream::~PluginStream()
+{
+ if( m_pPlugin && m_pPlugin->getPluginComm() )
+ {
+ 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());
+ }
+ ::free( (void*)m_aNPStream.url );
+}
+
+PluginInputStream::PluginInputStream( XPlugin_Impl* pPlugin,
+ const char* url,
+ sal_uInt32 len,
+ sal_uInt32 lastmod ) :
+ PluginStream( pPlugin, url, len, lastmod ),
+ m_nMode( NP_NORMAL ),
+ m_nWritePos( 0 )
+{
+ m_pPlugin->getInputStreams().push_back( this );
+ DirEntry aEntry;
+ aEntry = aEntry.TempName();
+
+ // set correct extension, some plugins need that
+ DirEntry aName( String( m_aNPStream.url, m_pPlugin->getTextEncoding() ) );
+ String aExtension = aName.GetExtension();
+ if( aExtension.Len() )
+ aEntry.SetExtension( aExtension );
+ m_aFileStream.Open( aEntry.GetFull(), STREAM_READ | STREAM_WRITE );
+ if( ! m_aFileStream.IsOpen() )
+ {
+ // #74808# might be that the extension scrambled the whole filename
+ aEntry = aEntry.TempName();
+ m_aFileStream.Open( aEntry.GetFull(), STREAM_READ | STREAM_WRITE );
+ }
+}
+
+PluginInputStream::~PluginInputStream()
+{
+ String aFile( m_aFileStream.GetFileName() );
+ m_aFileStream.Close();
+ if( m_pPlugin )
+ {
+ ByteString aFileName( aFile, m_pPlugin->getTextEncoding() );
+ if( m_pPlugin->getPluginComm() && m_nMode != -1 )
+ // mode -1 means either an error occured,
+ // or the plugin is already disposing
+ {
+ m_pPlugin->getPluginComm()->addFileToDelete( aFile );
+ if( m_nMode == NP_ASFILE )
+ {
+ m_pPlugin->getPluginComm()->
+ NPP_StreamAsFile( m_pPlugin->getNPPInstance(),
+ &m_aNPStream,
+ aFileName.GetBuffer() );
+ }
+ m_pPlugin->getPluginComm()->NPP_SetWindow( m_pPlugin->getNPPInstance(), m_pPlugin->getNPWindow());
+ m_pPlugin->getInputStreams().remove( this );
+ }
+ else
+ DirEntry( m_aFileStream.GetFileName() ).Kill();
+ }
+ else
+ DirEntry( m_aFileStream.GetFileName() ).Kill();
+}
+
+PluginStreamType PluginInputStream::getStreamType()
+{
+ return InputStream;
+}
+
+void PluginInputStream::setMode( sal_uInt32 nMode )
+{
+ m_nMode = nMode;
+
+ // invalidation by plugin
+ if( m_nMode == -1 && m_pPlugin )
+ {
+ m_pPlugin->getInputStreams().remove( this );
+ m_pPlugin = NULL;
+ }
+}
+
+void PluginInputStream::writeBytes( const Sequence<sal_Int8>& Buffer )
+{
+ if( m_nMode == -1 )
+ return;
+
+ m_aFileStream.Seek( STREAM_SEEK_TO_END );
+ m_aFileStream.Write( Buffer.getConstArray(), Buffer.getLength() );
+
+ int nPos = m_aFileStream.Tell();
+ int nBytes = 0;
+ while( m_nMode != NP_SEEK && m_nMode != NP_ASFILEONLY &&
+ ( nBytes = m_pPlugin->getPluginComm()->
+ NPP_WriteReady( m_pPlugin->getNPPInstance(),
+ &m_aNPStream ) ) > 0 &&
+ m_nWritePos < nPos )
+ {
+ nBytes = nBytes > nPos - m_nWritePos ? nPos - m_nWritePos : nBytes;
+
+ char* pBuffer = new char[ nBytes ];
+ m_aFileStream.Seek( m_nWritePos );
+ nBytes = m_aFileStream.Read( pBuffer, nBytes );
+
+ int nBytesRead = 0;
+ try
+ {
+ nBytesRead = m_pPlugin->getPluginComm()->
+ NPP_Write( m_pPlugin->getNPPInstance(),
+ &m_aNPStream,
+ m_nWritePos,
+ nBytes,
+ pBuffer );
+ delete pBuffer;
+ }
+ catch( ... )
+ {
+ delete pBuffer;
+ return;
+ }
+
+ if( nBytesRead < 0 )
+ {
+ m_nMode = -1;
+ return;
+ }
+
+ m_nWritePos += nBytesRead;
+ }
+
+ m_pPlugin->getPluginComm()->
+ NPP_SetWindow( m_pPlugin->getNPPInstance(),
+ m_pPlugin->getNPWindow());
+}
+
+void PluginInputStream::closeOutput()
+{
+ flush();
+ m_xSource = Reference< ::com::sun::star::io::XActiveDataSource >();
+}
+
+sal_uInt32 PluginInputStream::read( sal_uInt32 offset, sal_Int8* buffer, sal_uInt32 size )
+{
+ if( m_nMode != NP_SEEK )
+ return 0;
+
+ m_aFileStream.Seek( offset );
+ int nBytes = m_aFileStream.Read( buffer, size );
+
+ return nBytes;
+}
+
+void PluginInputStream::flush(void)
+{
+}
+
+PluginOutputStream::PluginOutputStream( XPlugin_Impl* pPlugin,
+ const char* url,
+ sal_uInt32 len,
+ sal_uInt32 lastmod ) :
+ PluginStream( pPlugin, url, len, lastmod ),
+ m_xStream( pPlugin->getServiceManager()->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.io.DataOutputStream" ) ), UNO_QUERY )
+{
+ m_pPlugin->getOutputStreams().push_back( this );
+}
+
+PluginOutputStream::~PluginOutputStream()
+{
+ m_pPlugin->getOutputStreams().remove( this );
+}
+
+PluginStreamType PluginOutputStream::getStreamType()
+{
+ return OutputStream;
+}
+
diff --git a/extensions/source/plugin/inc/plugin/impl.hxx b/extensions/source/plugin/inc/plugin/impl.hxx
new file mode 100644
index 000000000000..8027c0ec9e2e
--- /dev/null
+++ b/extensions/source/plugin/inc/plugin/impl.hxx
@@ -0,0 +1,478 @@
+/*************************************************************************
+ *
+ * $RCSfile: impl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef __PLUGIN_SOURCE_MGR_IMPL_HXX
+#define __PLUGIN_SOURCE_MGR_IMPL_HXX
+
+#ifdef SOLARIS
+#include <limits>
+#endif
+
+#include <cppuhelper/weak.hxx>
+
+#ifndef _COM_SUN_STAR_AWT_KEY_HPP_
+#include <com/sun/star/awt/Key.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEYFUNCTION_HPP_
+#include <com/sun/star/awt/KeyFunction.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PLUGIN_PLUGINMODE_HPP_
+#include <com/sun/star/plugin/PluginMode.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PLUGIN_PLUGINDESCRIPTION_HPP_
+#include <com/sun/star/plugin/PluginDescription.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PLUGIN_PLUGINEXCEPTION_HPP_
+#include <com/sun/star/plugin/PluginException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PLUGIN_PLUGINVARIABLE_HPP_
+#include <com/sun/star/plugin/PluginVariable.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PLUGIN_XPLUGIN_HPP_
+#include <com/sun/star/plugin/XPlugin.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PLUGIN_XPLUGINMANAGER_HPP_
+#include <com/sun/star/plugin/XPluginManager.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PLUGIN_XPLUGINCONTEXT_HPP_
+#include <com/sun/star/plugin/XPluginContext.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XCONNECTABLE_HPP_
+#include <com/sun/star/io/XConnectable.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_
+#include <com/sun/star/io/XOutputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XDATAOUTPUTSTREAM_HPP_
+#include <com/sun/star/io/XDataOutputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XACTIVEDATACONTROL_HPP_
+#include <com/sun/star/io/XActiveDataControl.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XDATAINPUTSTREAM_HPP_
+#include <com/sun/star/io/XDataInputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XMARKABLESTREAM_HPP_
+#include <com/sun/star/io/XMarkableStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
+#include <com/sun/star/io/XInputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XSTREAMLISTENER_HPP_
+#include <com/sun/star/io/XStreamListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HPP_
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HPP_
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_
+#include <com/sun/star/lang/XServiceName.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_GRADIENTSTYLE_HPP_
+#include <com/sun/star/awt/GradientStyle.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_RASTEROPERATION_HPP_
+#include <com/sun/star/awt/RasterOperation.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_GRADIENT_HPP_
+#include <com/sun/star/awt/Gradient.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XGRAPHICS_HPP_
+#include <com/sun/star/awt/XGraphics.hpp>
+#endif
+
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+#ifdef WNT
+#include <plugin/win/sysplug.hxx>
+#else
+#include <list>
+#endif
+
+#ifdef OS2
+#include <plugin/os2/sysplug.hxx>
+#endif
+
+#ifdef UNX
+#include <plugin/unx/sysplug.hxx>
+#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>
+
+using namespace com::sun::star::uno;
+
+#define PROVIDING_NONE 0
+#define PROVIDING_NOW 1
+#define PROVIDING_MODEL_UPDATE 2
+
+class PluginStream;
+class PluginInputStream;
+class PluginOutputStream;
+class XPlugin_Impl;
+class PluginDisposer;
+class PluginEventListener;
+
+class XPlugin_Impl : public ::com::sun::star::plugin::XPlugin,
+ public PluginControl_Impl,
+ public ::com::sun::star::beans::XPropertyChangeListener
+{
+private:
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ Reference< ::com::sun::star::plugin::XPluginContext > m_rBrowserContext;
+
+ PluginComm* m_pPluginComm;
+ NPP_t m_aInstance;
+ NPWindow m_aNPWindow;
+ rtl_TextEncoding m_aEncoding;
+#ifdef UNX
+ NPSetWindowCallbackStruct m_aWSInfo;
+ Display* m_pDisplay;
+ XtAppContext m_aAppContext;
+#endif
+
+ const char** m_pArgv;
+ const char** m_pArgn;
+ int m_nArgs;
+
+ Reference< ::com::sun::star::awt::XControlModel > m_xModel;
+
+ ::com::sun::star::plugin::PluginDescription m_aDescription;
+ sal_Int16 m_aPluginMode;
+
+ int m_nProvidingState;
+ int m_nCalledFromPlugin;
+ PluginDisposer* m_pDisposer;
+
+ ::std::list<PluginInputStream*> m_aInputStreams;
+ ::std::list<PluginOutputStream*> m_aOutputStreams;
+ ::std::list<PluginEventListener*> m_aPEventListeners;
+ ::rtl::OUString m_aURL;
+
+ sal_Bool m_bIsDisposed;
+
+ void init( const ::com::sun::star::plugin::PluginDescription& rDescription );
+ void loadPlugin();
+ void destroyInstance();
+ void modelChanged();
+
+public:
+ XPlugin_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr );
+ virtual ~XPlugin_Impl();
+
+ void destroyStreams();
+
+ ::std::list<PluginInputStream*>& getInputStreams() { return m_aInputStreams; }
+ ::std::list<PluginOutputStream*>& getOutputStreams() { return m_aOutputStreams; }
+ PluginComm* getPluginComm() { return m_pPluginComm; }
+ void setPluginComm( PluginComm* comm )
+ {
+ if( ! m_pPluginComm )
+ {
+ m_pPluginComm = comm;
+ m_pPluginComm->addRef();
+ }
+ }
+#ifdef UNX
+ Display* getAppDisplay() { return m_pDisplay; }
+ XtAppContext getAppContext() { return m_aAppContext; }
+#endif
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > getServiceManager() { return m_xSMgr; }
+ rtl_TextEncoding getTextEncoding() { return m_aEncoding; }
+ NPP getNPPInstance() { return &m_aInstance; }
+ NPWindow* getNPWindow() { return &m_aNPWindow; }
+
+ void enterPluginCallback() { m_nCalledFromPlugin++; }
+ void leavePluginCallback() { m_nCalledFromPlugin--; }
+ sal_Bool isDisposable() { return m_nCalledFromPlugin < 1 ? sal_True : sal_False; }
+ DECL_LINK( secondLevelDispose, XPlugin_Impl* );
+
+ void addPluginEventListener( PluginEventListener* pListener )
+ { m_aPEventListeners.push_back( pListener ); }
+ void checkListeners( const char* normalizedURL );
+
+ void initInstance(
+ const ::com::sun::star::plugin::PluginDescription& rDescription,
+ const Sequence< ::rtl::OUString >& argn,
+ const Sequence< ::rtl::OUString >& argv,
+ sal_Int16 mode );
+
+ const ::rtl::OUString& getRefererURL() { return m_aURL; }
+ ::rtl::OUString getCreationURL();
+
+ PluginStream* getStreamFromNPStream( NPStream* );
+
+ const SystemEnvData* getSysChildSysData()
+ { return _pSysChild->GetSystemData(); }
+
+ const Reference< ::com::sun::star::plugin::XPluginContext > & getPluginContext() const
+ { return m_rBrowserContext; }
+ void setPluginContext( const Reference< ::com::sun::star::plugin::XPluginContext > & );
+
+ void secondLevelDispose();
+
+// static const Reference< ::com::sun::star::reflection::XIdlClass > & staticGetIdlClass();
+
+ // XInterface
+ virtual Any SAL_CALL queryInterface( const Type& );
+ virtual void SAL_CALL acquire() { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() { OWeakAggObject::release(); }
+
+ // OWeakAggObject
+ virtual Any SAL_CALL queryAggregation( const Type& );
+
+ // PluginContol_Impl
+ virtual void SAL_CALL dispose();
+ virtual void SAL_CALL createPeer( const Reference< ::com::sun::star::awt::XToolkit > & xToolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & Parent) throw( RuntimeException );
+
+ virtual sal_Bool SAL_CALL setModel( const Reference< ::com::sun::star::awt::XControlModel > & Model ) throw( RuntimeException );
+ virtual Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel(void) const throw( RuntimeException )
+ { return m_xModel; }
+
+ virtual void SAL_CALL setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, sal_Int32 nHeight_, sal_Int16 nFlags ) throw( RuntimeException );
+
+ // ::com::sun::star::plugin::XPlugin
+ virtual sal_Bool SAL_CALL provideNewStream(const ::rtl::OUString& mimetype, const Reference< ::com::sun::star::io::XActiveDataSource > & stream, const ::rtl::OUString& url, sal_Int32 length, sal_Int32 lastmodified, sal_Bool isfile);
+
+ // ::com::sun::star::beans::XPropertyChangeListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rSource );
+ virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvent );
+};
+
+class PluginManager
+{
+private:
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ ::std::list<PluginComm*> m_aPluginComms;
+ ::std::list<XPlugin_Impl*> m_aAllPlugins;
+ ::osl::Mutex m_aPluginMutex;
+
+ static PluginManager* pManager;
+
+ PluginManager();
+ ~PluginManager();
+public:
+
+ static PluginManager& get();
+ static void setServiceFactory( const Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+ static const Sequence< ::rtl::OUString >& getAdditionalSearchPaths();
+
+ ::std::list<PluginComm*>& getPluginComms() { return m_aPluginComms; }
+ ::std::list<XPlugin_Impl*>& getPlugins() { return m_aAllPlugins; }
+ ::osl::Mutex& getPluginMutex() { return m_aPluginMutex; }
+};
+
+class XPluginManager_Impl :
+ public ::cppu::WeakAggImplHelper1< ::com::sun::star::plugin::XPluginManager >
+{
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+public:
+ XPluginManager_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
+ virtual ~XPluginManager_Impl();
+
+ static XPlugin_Impl* getXPluginFromNPP( NPP );
+ static XPlugin_Impl* getFirstXPlugin();
+ static XPlugin_Impl* getPluginImplementation( const Reference< ::com::sun::star::plugin::XPlugin >& plugin );
+
+ virtual Reference< ::com::sun::star::plugin::XPluginContext > SAL_CALL createPluginContext();
+
+ // has to be implemented per system
+ virtual Sequence< ::com::sun::star::plugin::PluginDescription > SAL_CALL getPluginDescriptions(void) throw( );
+
+ virtual Reference< ::com::sun::star::plugin::XPlugin > SAL_CALL createPlugin( const Reference< ::com::sun::star::plugin::XPluginContext > & acontext, sal_Int16 mode, const Sequence< ::rtl::OUString >& argn, const Sequence< ::rtl::OUString >& argv, const ::com::sun::star::plugin::PluginDescription& plugintype) throw( RuntimeException,::com::sun::star::plugin::PluginException );
+
+ virtual Reference< ::com::sun::star::plugin::XPlugin > SAL_CALL createPluginFromURL( const Reference< ::com::sun::star::plugin::XPluginContext > & acontext, sal_Int16 mode, const Sequence< ::rtl::OUString >& argn, const Sequence< ::rtl::OUString >& argv, const Reference< ::com::sun::star::awt::XToolkit > & toolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & parent, const ::rtl::OUString& url );
+
+ virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw( );
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw();
+
+ Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( );
+ static Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( );
+ static ::rtl::OUString getImplementationName_Static() throw( )
+ {
+ /** the soplayer uses this name in its source! maybe not after 5.2 */
+ return ::rtl::OUString::createFromAscii( "com.sun.star.extensions.PluginManager" );
+ }
+};
+Reference< XInterface > SAL_CALL PluginManager_CreateInstance( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & ) throw( Exception );
+
+enum PluginStreamType { InputStream, OutputStream };
+
+class PluginStream
+{
+protected:
+ XPlugin_Impl* m_pPlugin;
+ NPStream m_aNPStream;
+public:
+ PluginStream( XPlugin_Impl* pPlugin,
+ const char* url, sal_uInt32 len, sal_uInt32 lastmod );
+ virtual ~PluginStream();
+
+ NPStream* getStream() { return &m_aNPStream; }
+ XPlugin_Impl* getPlugin() { return m_pPlugin; }
+
+ virtual PluginStreamType getStreamType() = 0;
+};
+
+class PluginInputStream :
+ public PluginStream,
+ public ::cppu::WeakAggImplHelper2<
+ ::com::sun::star::io::XOutputStream,
+ ::com::sun::star::io::XConnectable
+ >
+{
+private:
+ UINT32 m_nMode;
+ UINT32 m_nWritePos;
+
+ Reference< ::com::sun::star::io::XActiveDataSource > m_xSource;
+ // hold a reference on input until closeOutput is called
+
+ Reference< ::com::sun::star::io::XConnectable > m_xPredecessor;
+ Reference< ::com::sun::star::io::XConnectable > m_xSuccessor;
+
+ SvFileStream m_aFileStream;
+public:
+ PluginInputStream( XPlugin_Impl* pPlugin,
+ const char* url, UINT32 len, UINT32 lastmod );
+
+ PluginInputStream() : PluginStream( NULL, NULL, 0, 0 ) {}
+
+ virtual ~PluginInputStream();
+
+ virtual PluginStreamType getStreamType();
+
+ void setMode( UINT32 nMode );
+ UINT32 read( UINT32 offset, sal_Int8* buffer, UINT32 size );
+ void setSource( const Reference< ::com::sun::star::io::XActiveDataSource >& xSource ) { m_xSource = xSource; }
+
+ // XOutputStream
+ virtual void SAL_CALL writeBytes( const Sequence<sal_Int8>& );
+ virtual void SAL_CALL flush();
+ virtual void SAL_CALL closeOutput();
+
+ // XConnectable
+ virtual void SAL_CALL setPredecessor( const Reference< ::com::sun::star::io::XConnectable >& xPredecessor )
+ { m_xPredecessor = xPredecessor; }
+ virtual Reference< ::com::sun::star::io::XConnectable > SAL_CALL getPredecessor()
+ { return m_xPredecessor; }
+
+ virtual void SAL_CALL setSuccessor( const Reference< ::com::sun::star::io::XConnectable >& xSuccessor )
+ { m_xSuccessor = xSuccessor; }
+ virtual Reference< ::com::sun::star::io::XConnectable > SAL_CALL getSuccessor()
+ { return m_xSuccessor; }
+};
+
+class PluginOutputStream : public PluginStream
+{
+private:
+ Reference< ::com::sun::star::io::XOutputStream > m_xStream;
+public:
+ PluginOutputStream( XPlugin_Impl* pPlugin, const char* url,
+ sal_uInt32 len, sal_uInt32 lastmod );
+ virtual ~PluginOutputStream();
+
+ virtual PluginStreamType getStreamType();
+
+ Reference< ::com::sun::star::io::XOutputStream > & getOutputStream() { return m_xStream; }
+};
+
+class PluginEventListener :
+ public ::cppu::WeakAggImplHelper1< ::com::sun::star::lang::XEventListener >
+{
+private:
+ XPlugin_Impl* m_pPlugin;
+ Reference< ::com::sun::star::plugin::XPlugin > m_xPlugin; // just to hold the plugin
+ char* m_pUrl;
+ char* m_pNormalizedUrl;
+ void* m_pNotifyData;
+public:
+ PluginEventListener( XPlugin_Impl*,
+ const char* url,
+ const char* normurl,
+ void* notifyData );
+ virtual ~PluginEventListener();
+
+ const char* getURL() { return m_pUrl; }
+ const char* getNormalizedURL() { return m_pNormalizedUrl; }
+ void* getNotifyData() { return m_pNotifyData; }
+
+ // ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source );
+};
+
+#endif
diff --git a/extensions/source/plugin/inc/plugin/model.hxx b/extensions/source/plugin/inc/plugin/model.hxx
new file mode 100644
index 000000000000..9b7c0b174f90
--- /dev/null
+++ b/extensions/source/plugin/inc/plugin/model.hxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * $RCSfile: model.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef __PLUGIN_MODEL_HXX
+#define __PLUGIN_MODEL_HXX
+
+#ifndef _COM_SUN_STAR_IO_XOBJECTINPUTSTREAM_HPP_
+#include <com/sun/star/io/XObjectInputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XPERSISTOBJECT_HPP_
+#include <com/sun/star/io/XPersistObject.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XOBJECTOUTPUTSTREAM_HPP_
+#include <com/sun/star/io/XObjectOutputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_
+#include <com/sun/star/lang/XServiceName.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_
+#include <com/sun/star/awt/XControlModel.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
+#include <com/sun/star/awt/XControl.hpp>
+#endif
+
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/weakagg.hxx>
+#include <rtl/alloc.h>
+
+#include <stl/list>
+
+using namespace com::sun::star::uno;
+
+class BroadcasterHelperHolder
+{
+protected:
+ ::cppu::OBroadcastHelper m_aHelper;
+public:
+ BroadcasterHelperHolder( ::osl::Mutex& rMutex ) :
+ m_aHelper( rMutex ) {}
+ ~BroadcasterHelperHolder() {}
+
+ ::cppu::OBroadcastHelper& getHelper() { return m_aHelper; }
+
+};
+
+class PluginModel : public BroadcasterHelperHolder,
+ public ::cppu::OPropertySetHelper,
+ public ::cppu::OPropertyArrayHelper,
+ public ::cppu::OWeakAggObject,
+ public ::com::sun::star::lang::XComponent,
+ public ::com::sun::star::io::XPersistObject,
+ public ::com::sun::star::awt::XControlModel
+{
+ private:
+ ::rtl::OUString m_aCreationURL;
+
+ ::std::list< Reference< ::com::sun::star::lang::XEventListener > >
+ m_aDisposeListeners;
+ public:
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new( size_t nSize ) throw()
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete( void * pMem ) throw()
+ { ::rtl_freeMemory( pMem ); }
+
+ PluginModel();
+ PluginModel( const ::rtl::OUString& );
+ virtual ~PluginModel();
+
+
+ const ::rtl::OUString& getCreationURL() { return m_aCreationURL; }
+
+ // XInterface
+ virtual Any SAL_CALL queryInterface( const Type& rType )
+ { return OWeakAggObject::queryInterface( rType ); }
+ virtual void SAL_CALL acquire() { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() { OWeakAggObject::release(); }
+
+ virtual Any SAL_CALL queryAggregation( const Type& );
+
+
+ // ::com::sun::star::lang::XTypeProvider
+
+ // ::com::sun::star::lang::XServiceInfo
+ ::rtl::OUString SAL_CALL getImplementationName() throw( );
+
+ sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw( );
+ Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( );
+ static Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static(void) throw( );
+ static ::rtl::OUString SAL_CALL getImplementationName_Static() throw( )
+ {
+ /** the soplayer uses this name in its source! maybe not after 5.2 */
+ return ::rtl::OUString::createFromAscii( "com.sun.star.extensions.PluginModel" );
+ }
+
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( Any & rConvertedValue,
+ Any & rOldValue,
+ sal_Int32 nHandle,
+ const Any& rValue );
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle,
+ const Any& rValue )
+ throw( ::com::sun::star::lang::IllegalArgumentException );
+ virtual void SAL_CALL getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const;
+ virtual Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo();
+
+ // ::com::sun::star::io::XPersistObject
+ virtual ::rtl::OUString SAL_CALL getServiceName();
+ virtual void SAL_CALL write(const Reference< ::com::sun::star::io::XObjectOutputStream > & OutStream);
+ virtual void SAL_CALL read(const Reference< ::com::sun::star::io::XObjectInputStream > & InStream);
+
+ // ::com::sun::star::lang::XComponent
+ virtual void SAL_CALL addEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l );
+ virtual void SAL_CALL removeEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l );
+ virtual void SAL_CALL dispose();
+};
+Reference< XInterface > SAL_CALL PluginModel_CreateInstance( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & ) throw( Exception );
+
+#endif // __PLUGIN_MODEL_HXX
diff --git a/extensions/source/plugin/inc/plugin/multiplx.hxx b/extensions/source/plugin/inc/plugin/multiplx.hxx
new file mode 100644
index 000000000000..890bbff168e3
--- /dev/null
+++ b/extensions/source/plugin/inc/plugin/multiplx.hxx
@@ -0,0 +1,249 @@
+/*************************************************************************
+ *
+ * $RCSfile: multiplx.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _MRC_MULTIPLX_HXX
+#define _MRC_MULTIPLX_HXX
+
+#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
+#include <com/sun/star/awt/XControl.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XKEYLISTENER_HPP_
+#include <com/sun/star/awt/XKeyListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XPAINTLISTENER_HPP_
+#include <com/sun/star/awt/XPaintListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEYEVENT_HPP_
+#include <com/sun/star/awt/KeyEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEYMODIFIER_HPP_
+#include <com/sun/star/awt/KeyModifier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XMOUSEMOTIONLISTENER_HPP_
+#include <com/sun/star/awt/XMouseMotionListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FOCUSEVENT_HPP_
+#include <com/sun/star/awt/FocusEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XWINDOWLISTENER_HPP_
+#include <com/sun/star/awt/XWindowListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XACTIVATELISTENER_HPP_
+#include <com/sun/star/awt/XActivateListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_MOUSEEVENT_HPP_
+#include <com/sun/star/awt/MouseEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTOPWINDOWLISTENER_HPP_
+#include <com/sun/star/awt/XTopWindowListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_PAINTEVENT_HPP_
+#include <com/sun/star/awt/PaintEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_INPUTEVENT_HPP_
+#include <com/sun/star/awt/InputEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEYGROUP_HPP_
+#include <com/sun/star/awt/KeyGroup.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEY_HPP_
+#include <com/sun/star/awt/Key.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_WINDOWEVENT_HPP_
+#include <com/sun/star/awt/WindowEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XMOUSELISTENER_HPP_
+#include <com/sun/star/awt/XMouseListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEYFUNCTION_HPP_
+#include <com/sun/star/awt/KeyFunction.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FOCUSCHANGEREASON_HPP_
+#include <com/sun/star/awt/FocusChangeReason.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_MOUSEBUTTON_HPP_
+#include <com/sun/star/awt/MouseButton.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XFOCUSLISTENER_HPP_
+#include <com/sun/star/awt/XFocusListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_
+#include <com/sun/star/awt/XTopWindow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
+#include <com/sun/star/awt/XWindow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
+#include <com/sun/star/awt/PosSize.hpp>
+#endif
+
+#include <cppuhelper/implbase7.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+using namespace com::sun::star::uno;
+
+struct MRCListenerMultiplexerHelper_Mutex
+{
+ ::osl::Mutex aMutex;
+};
+
+class MRCListenerMultiplexerHelper :
+ public MRCListenerMultiplexerHelper_Mutex,
+
+ public ::cppu::WeakAggImplHelper7<
+ ::com::sun::star::awt::XFocusListener,
+ ::com::sun::star::awt::XWindowListener,
+ ::com::sun::star::awt::XKeyListener,
+ ::com::sun::star::awt::XMouseListener,
+ ::com::sun::star::awt::XMouseMotionListener,
+ ::com::sun::star::awt::XPaintListener,
+ ::com::sun::star::awt::XTopWindowListener >
+{
+public:
+ /**
+ * Create a Multiplexer of XWindowEvents.
+ *
+ * @param rControl The control. All listeners think that this is the original
+ * broadcaster.
+ * @param rPeer The peer from which the original events are dispatched. Null is
+ * allowed.
+ */
+ MRCListenerMultiplexerHelper( const Reference< ::com::sun::star::awt::XWindow > & rControl, const Reference< ::com::sun::star::awt::XWindow > & rPeer );
+
+ /**
+ * Remove all listeners from the previous set peer and add the needed listeners to rPeer.
+ * @param rPeer The peer from which the original events are dispatched. Null is
+ * allowed.
+ */
+ void setPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer );
+
+ /**
+ * Remove all listeners and send a disposing message.
+ */
+ void disposeAndClear();
+
+ /**
+ * Add the specified listener to the source.
+ */
+ void advise( const Type& type, const Reference< XInterface > & listener);
+ /**
+ * Remove the specified listener from the source.
+ */
+ void unadvise(const Type& type, const Reference< XInterface > & listener);
+
+ // ::com::sun::star::lang::XEventListener
+ void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source);
+ // ::com::sun::star::awt::XFocusListener
+ void SAL_CALL focusGained(const ::com::sun::star::awt::FocusEvent& e);
+ void SAL_CALL focusLost(const ::com::sun::star::awt::FocusEvent& e);
+ // ::com::sun::star::awt::XWindowListener
+ void SAL_CALL windowResized(const ::com::sun::star::awt::WindowEvent& e);
+ void SAL_CALL windowMoved(const ::com::sun::star::awt::WindowEvent& e);
+ void SAL_CALL windowShown(const ::com::sun::star::lang::EventObject& e);
+ void SAL_CALL windowHidden(const ::com::sun::star::lang::EventObject& e);
+ // ::com::sun::star::awt::XKeyListener
+ void SAL_CALL keyPressed( const ::com::sun::star::awt::KeyEvent& e );
+ void SAL_CALL keyReleased( const ::com::sun::star::awt::KeyEvent& e );
+ // ::com::sun::star::awt::XMouseListener
+ void SAL_CALL mousePressed(const ::com::sun::star::awt::MouseEvent& e);
+ void SAL_CALL mouseReleased(const ::com::sun::star::awt::MouseEvent& e);
+ void SAL_CALL mouseEntered(const ::com::sun::star::awt::MouseEvent& e);
+ void SAL_CALL mouseExited(const ::com::sun::star::awt::MouseEvent& e);
+ // ::com::sun::star::awt::XMouseMotionListener
+ void SAL_CALL mouseDragged(const ::com::sun::star::awt::MouseEvent& e);
+ void SAL_CALL mouseMoved(const ::com::sun::star::awt::MouseEvent& e);
+ // ::com::sun::star::awt::XPaintListener
+ void SAL_CALL windowPaint(const ::com::sun::star::awt::PaintEvent& e);
+ // ::com::sun::star::awt::XTopWindowListener
+ void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e );
+ void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e );
+ void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e );
+ void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e );
+ void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e );
+ void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e );
+ void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e );
+protected:
+ /**
+ * Remove the listener with the uik rUik from the peer rPeer.
+ * @param rPeer the peer from which the listener is removed.
+ * @param rUik the listener uik, which specify the type of the listener.
+ */
+ void adviseToPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer, const Type & type );
+ /**
+ * Add the listener with the uik rUik to the peer rPeer.
+ * @param rPeer the peer to which the listener is added.
+ * @param rUik the listener uik, which specify the type of the listener.
+ */
+ void unadviseFromPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer, const Type & type );
+private:
+ /** The source of the events. Normally this is the peer object.*/
+ Reference< ::com::sun::star::awt::XWindow > xPeer;
+ WeakReference< ::com::sun::star::awt::XControl > xControl;
+ ::cppu::OMultiTypeInterfaceContainerHelper aListenerHolder;
+
+
+ MRCListenerMultiplexerHelper( const MRCListenerMultiplexerHelper & );
+ MRCListenerMultiplexerHelper & operator = ( const MRCListenerMultiplexerHelper & );
+};
+
+#endif // _MRC_MULTIPLX_HXX
+
+
+
diff --git a/extensions/source/plugin/inc/plugin/plcom.hxx b/extensions/source/plugin/inc/plugin/plcom.hxx
new file mode 100644
index 000000000000..7ab958255111
--- /dev/null
+++ b/extensions/source/plugin/inc/plugin/plcom.hxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * $RCSfile: plcom.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef __PLUGIN_INC_PLCOM_HXX
+#define __PLUGIN_INC_PLCOM_HXX
+
+#include <tools/string.hxx>
+#include <list>
+
+class PluginComm
+{
+protected:
+ int m_nRefCount;
+ ::rtl::OString m_aLibName;
+ std::list< String > m_aFilesToDelete;
+public:
+ PluginComm( const ::rtl::OString& rLibName );
+ virtual ~PluginComm();
+
+ int getRefCount() { return m_nRefCount; }
+ void addRef() { m_nRefCount++; }
+ void decRef() { m_nRefCount--; if( ! m_nRefCount ) delete this; }
+
+ const ::rtl::OString& getLibName() { return m_aLibName; }
+ void setLibName( const ::rtl::OString& rName ) { m_aLibName = rName; }
+
+ void addFileToDelete( const String& filename )
+ { m_aFilesToDelete.push_back( filename ); }
+
+ virtual NPError NPP_Destroy( NPP instance, NPSavedData** save ) = 0;
+ virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream,
+ NPError reason ) = 0;
+ virtual void* NPP_GetJavaClass() = 0;
+ virtual NPError NPP_Initialize() = 0;
+ virtual NPError NPP_New( NPMIMEType pluginType, NPP instance,
+ uint16 mode, int16 argc,
+ char* argn[], char* argv[],
+ NPSavedData *saved ) = 0;
+ virtual NPError NPP_NewStream( NPP instance, NPMIMEType type,
+ NPStream* stream,
+ NPBool seekable, uint16* stype ) = 0;
+ virtual void NPP_Print( NPP instance, NPPrint* platformPrint ) = 0;
+ virtual NPError NPP_SetWindow( NPP instance, NPWindow* window ) = 0;
+ virtual void NPP_Shutdown() = 0;
+ virtual void NPP_StreamAsFile( NPP instance, NPStream* stream,
+ const char* fname ) = 0;
+ virtual void NPP_URLNotify( NPP instance, const char* url,
+ NPReason reason, void* notifyData ) = 0;
+ virtual int32 NPP_Write( NPP instance, NPStream* stream, int32 offset,
+ int32 len, void* buffer ) = 0;
+ virtual int32 NPP_WriteReady( NPP instance, NPStream* stream ) = 0;
+ virtual NPError NPP_GetValue( NPP instance, NPPVariable variable, void* value ) = 0;
+ virtual NPError NPP_SetValue( NPP instance, NPNVariable variable,
+ void *value) = 0;
+};
+
+#endif
diff --git a/extensions/source/plugin/inc/plugin/plctrl.hxx b/extensions/source/plugin/inc/plugin/plctrl.hxx
new file mode 100644
index 000000000000..b94b782f29c9
--- /dev/null
+++ b/extensions/source/plugin/inc/plugin/plctrl.hxx
@@ -0,0 +1,276 @@
+/*************************************************************************
+ *
+ * $RCSfile: plctrl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef __PLCTRL_HXX
+#define __PLCTRL_HXX
+
+#include <tools/debug.hxx>
+
+#include <cppuhelper/weak.hxx>
+#include <plugin/multiplx.hxx>
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUES_HPP_
+#include <com/sun/star/beans/PropertyValues.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATE_HPP_
+#include <com/sun/star/beans/PropertyState.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HPP_
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XFASTPROPERTYSET_HPP_
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XVETOABLECHANGELISTENER_HPP_
+#include <com/sun/star/beans/XVetoableChangeListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_
+#include <com/sun/star/beans/XPropertyState.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATECHANGELISTENER_HPP_
+#include <com/sun/star/beans/XPropertyStateChangeListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTIESCHANGELISTENER_HPP_
+#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HPP_
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCONTAINER_HPP_
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATECHANGEEVENT_HPP_
+#include <com/sun/star/beans/PropertyStateChangeEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYCHANGEEVENT_HPP_
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERPEER_HPP_
+#include <com/sun/star/awt/XVclContainerPeer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLWINDOWPEER_HPP_
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_
+#include <com/sun/star/awt/XControlModel.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XUNOCONTROLCONTAINER_HPP_
+#include <com/sun/star/awt/XUnoControlContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_
+#include <com/sun/star/awt/XControlContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_VCLWINDOWPEERATTRIBUTE_HPP_
+#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINER_HPP_
+#include <com/sun/star/awt/XVclContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
+#include <com/sun/star/awt/XControl.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_
+#include <com/sun/star/awt/XTopWindow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
+#include <com/sun/star/awt/XWindow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
+#include <com/sun/star/awt/PosSize.hpp>
+#endif
+
+#include <cppuhelper/implbase5.hxx>
+
+#include <list>
+
+using namespace com::sun::star::uno;
+
+class SystemChildWindow;
+
+//==================================================================================================
+class PluginControl_Impl : public ::cppu::WeakAggImplHelper5<
+ ::com::sun::star::awt::XControl,
+ ::com::sun::star::awt::XControlModel,
+ ::com::sun::star::awt::XWindow,
+ ::com::sun::star::awt::XFocusListener,
+ ::com::sun::star::awt::XView >
+{
+public:
+ // ::com::sun::star::awt::XControl
+ virtual void SAL_CALL setContext( const Reference< XInterface > & xContext ) throw( RuntimeException )
+ { _xContext = xContext; }
+ virtual Reference< XInterface > SAL_CALL getContext() throw( RuntimeException )
+ { return _xContext; }
+
+ virtual sal_Bool SAL_CALL setModel( const Reference< ::com::sun::star::awt::XControlModel > & Model ) throw( RuntimeException )
+ { DBG_ERROR( "### setModel() illegal on plugincontrol!" ); return sal_False; }
+ virtual Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel() throw( RuntimeException )
+ { return (::com::sun::star::awt::XControlModel*)this; }
+
+ virtual Reference< ::com::sun::star::awt::XView > SAL_CALL getView() throw( RuntimeException )
+ { return (::com::sun::star::awt::XView*)this; }
+
+ virtual sal_Bool SAL_CALL isTransparent() throw( RuntimeException )
+ { return sal_False; }
+
+ virtual void SAL_CALL setDesignMode( sal_Bool bOn ) throw( RuntimeException );
+ virtual sal_Bool SAL_CALL isDesignMode() throw( RuntimeException )
+ { return _bInDesignMode; }
+
+ virtual void SAL_CALL createPeer( const Reference< ::com::sun::star::awt::XToolkit > & xToolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & Parent) throw( RuntimeException );
+ virtual Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL getPeer() throw( RuntimeException )
+ { return _xPeer; }
+
+ // ::com::sun::star::awt::XWindow
+ virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw( RuntimeException );
+ virtual void SAL_CALL setEnable( sal_Bool bEnable ) throw( RuntimeException );
+ virtual void SAL_CALL setFocus(void) throw( RuntimeException );
+
+ virtual void SAL_CALL setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, sal_Int32 nHeight_, sal_Int16 nFlags ) throw( RuntimeException );
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getPosSize(void) throw( RuntimeException );
+
+ virtual void SAL_CALL addWindowListener( const Reference< ::com::sun::star::awt::XWindowListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL removeWindowListener( const Reference< ::com::sun::star::awt::XWindowListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL addFocusListener( const Reference< ::com::sun::star::awt::XFocusListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL removeFocusListener( const Reference< ::com::sun::star::awt::XFocusListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL addKeyListener( const Reference< ::com::sun::star::awt::XKeyListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL removeKeyListener( const Reference< ::com::sun::star::awt::XKeyListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL addMouseListener( const Reference< ::com::sun::star::awt::XMouseListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL removeMouseListener( const Reference< ::com::sun::star::awt::XMouseListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL addMouseMotionListener( const Reference< ::com::sun::star::awt::XMouseMotionListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL removeMouseMotionListener( const Reference< ::com::sun::star::awt::XMouseMotionListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL addPaintListener( const Reference< ::com::sun::star::awt::XPaintListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL removePaintListener( const Reference< ::com::sun::star::awt::XPaintListener > & l ) throw( RuntimeException );
+
+ // ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject & rSource ) throw( RuntimeException );
+ // ::com::sun::star::awt::XFocusListener
+ virtual void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent & rEvt ) throw( RuntimeException );
+ virtual void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent & rEvt ) throw( RuntimeException );
+
+ // ::com::sun::star::lang::XComponent
+ virtual void SAL_CALL addEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL removeEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l ) throw( RuntimeException );
+
+ virtual void SAL_CALL dispose() throw( RuntimeException );
+
+ // ::com::sun::star::awt::XView
+ virtual sal_Bool SAL_CALL setGraphics( const Reference< ::com::sun::star::awt::XGraphics > & aDevice ) throw( RuntimeException )
+ { return sal_False; }
+ virtual Reference< ::com::sun::star::awt::XGraphics > SAL_CALL getGraphics(void) throw( RuntimeException )
+ { return Reference< ::com::sun::star::awt::XGraphics > (); }
+
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize(void) throw( RuntimeException )
+ { return ::com::sun::star::awt::Size(_nWidth, _nHeight); }
+
+ virtual void SAL_CALL draw( sal_Int32 x, sal_Int32 y ) throw( RuntimeException );
+ virtual void SAL_CALL setZoom( float ZoomX, float ZoomY ) throw( RuntimeException );
+
+public:
+ PluginControl_Impl();
+ virtual ~PluginControl_Impl();
+
+ MRCListenerMultiplexerHelper* getMultiplexer();
+
+protected:
+ void releasePeer();
+
+protected:
+ ::std::list< Reference< ::com::sun::star::lang::XEventListener > > _aDisposeListeners;
+ MRCListenerMultiplexerHelper* _pMultiplexer;
+
+ Reference< XInterface > _xContext;
+
+ sal_Int32 _nX;
+ sal_Int32 _nY;
+ sal_Int32 _nWidth;
+ sal_Int32 _nHeight;
+ sal_Int16 _nFlags;
+
+ sal_Bool _bVisible;
+ sal_Bool _bInDesignMode;
+ sal_Bool _bEnable;
+
+ SystemChildWindow* _pSysChild;
+ Reference< ::com::sun::star::awt::XWindowPeer > _xPeer;
+ Reference< ::com::sun::star::awt::XWindow > _xPeerWindow;
+
+ Reference< ::com::sun::star::awt::XWindow > _xParentWindow;
+ Reference< ::com::sun::star::awt::XWindowPeer > _xParentPeer;
+};
+
+#endif
+
+
diff --git a/extensions/source/plugin/inc/plugin/unx/sysplug.hxx b/extensions/source/plugin/inc/plugin/unx/sysplug.hxx
new file mode 100644
index 000000000000..702312950a0a
--- /dev/null
+++ b/extensions/source/plugin/inc/plugin/unx/sysplug.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: sysplug.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef __PLUGIN_INC_UNXPLUG_HXX
+#define __PLUGIN_INC_UNXPLUG_HXX
+
+#include <cstdio>
+
+#include <prex.h>
+#define XP_UNIX
+#include <npsdk/npupp.h>
+#include <npsdk/npapi.h>
+#include <postx.h>
+
+#include <plugin/plcom.hxx>
+#include <vcl/sysdata.hxx>
+
+class UnxPluginComm : public PluginComm
+{
+private:
+ void* m_pLibrary;
+ NPPluginFuncs m_aFuncs;
+ BOOL m_bInit;
+public:
+ UnxPluginComm( const ::rtl::OString& library );
+ virtual ~UnxPluginComm();
+
+ 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* value );
+ virtual NPError NPP_SetValue( NPP instance, NPNVariable variable,
+ void *value);
+};
+
+#endif
diff --git a/extensions/source/plugin/inc/plugin/win/sysplug.hxx b/extensions/source/plugin/inc/plugin/win/sysplug.hxx
new file mode 100644
index 000000000000..e1a22c3ba0ce
--- /dev/null
+++ b/extensions/source/plugin/inc/plugin/win/sysplug.hxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * $RCSfile: sysplug.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef __PLUGIN_INC_WINPLUG_HXX
+#define __PLUGIN_INC_WINPLUG_HXX
+
+#if _MSC_VER >= 1200
+#include <tools/prewin.h>
+#else
+#include <tools/presys.h>
+#endif
+#if STLPORT_VERSION < 321
+#include <list.h>
+#include <map.h>
+#include <algo.h>
+#include <function.h>
+#endif
+#include <windows.h>
+#include <tchar.h>
+#include <winbase.h>
+#if _MSC_VER >= 1200
+#include <tools/postwin.h>
+#else
+#include <tools/postsys.h>
+#endif
+#if STLPORT_VERSION >= 321
+#include <stl/list>
+#include <stl/map>
+#include <stl/algorithm>
+#endif
+
+#pragma pack( push, 8 )
+#include <npsdk/npapi.h>
+#include <npsdk/npupp.h>
+#pragma pack( pop, 8 )
+
+#include <plugin/plcom.hxx>
+
+
+//==================================================================================================
+class PluginComm_Impl
+ : public PluginComm
+{
+public:
+ PluginComm_Impl( const rtl::OUString& rMIME, const rtl::OUString& rName, HWND hWnd );
+ virtual ~PluginComm_Impl();
+
+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_alue );
+ virtual NPError NPP_SetValue( NPP instance, NPNVariable variable, void *ret_alue );
+
+private:
+ BOOL retrieveFunction( TCHAR* pName, void** ppFunc ) const;
+
+private:
+ HINSTANCE _plDLL;
+
+ NPPluginFuncs _NPPfuncs;
+};
+
+
+#endif
+
+
diff --git a/extensions/source/plugin/unx/makefile.mk b/extensions/source/plugin/unx/makefile.mk
new file mode 100644
index 000000000000..58a4c2353bc9
--- /dev/null
+++ b/extensions/source/plugin/unx/makefile.mk
@@ -0,0 +1,84 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..$/..
+
+PRJNAME=plugin
+TARGET=plunx
+TARGETTYPE=CUI
+
+.INCLUDE : ..$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES=\
+ $(SLO)$/sysplug.obj \
+ $(SLO)$/unxmgr.obj
+
+
+APP1DEF= $(MISC)$/$(TARGET).def
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : ..$/util$/target.pmk
diff --git a/extensions/source/plugin/unx/sysplug.cxx b/extensions/source/plugin/unx/sysplug.cxx
new file mode 100644
index 000000000000..fb8f7d0638de
--- /dev/null
+++ b/extensions/source/plugin/unx/sysplug.cxx
@@ -0,0 +1,269 @@
+/*************************************************************************
+ *
+ * $RCSfile: sysplug.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string> // workaround for SUNPRO workshop include conflicts
+
+#include <plugin/impl.hxx>
+
+#include <dlfcn.h>
+
+extern NPNetscapeFuncs aNPNFuncs;
+
+UnxPluginComm::UnxPluginComm( const ::rtl::OString& library ) :
+ PluginComm( library ),
+ m_pLibrary( NULL ),
+ m_bInit( FALSE )
+{
+ m_pLibrary = dlopen( library.getStr(), RTLD_NOW );
+
+ // initialize plugin function table
+ memset( &m_aFuncs, 0, sizeof( m_aFuncs ) );
+ m_aFuncs.size = sizeof( m_aFuncs );
+ m_aFuncs.version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
+
+ if( m_pLibrary )
+ {
+ NPError (*initFunc)(NPNetscapeFuncs*, NPPluginFuncs* );
+ NPError (*initPlugin)();
+
+ initFunc = (NPError(*)(NPNetscapeFuncs*,NPPluginFuncs*))dlsym( m_pLibrary, "NP_Initialize" );
+ initPlugin = (NPError(*)())dlsym( m_pLibrary, "NPP_Initialize" );
+#ifdef DEBUG
+ if( ! initFunc )
+ fprintf( stderr, "could not get Symbol NP_Initialize\n" );
+ if( ! initPlugin )
+ fprintf( stderr, "could not get Symbol NPP_Initialize\n" );
+#endif
+ if( initFunc && initPlugin )
+ {
+ NPError aErr = initFunc( &aNPNFuncs, &m_aFuncs );
+#ifdef DEBUG
+ fprintf( stderr, "NP_Initialize returns %d\n", aErr );
+#endif
+ if( aErr )
+ {
+ aErr = initPlugin();
+#ifdef DEBUG
+ fprintf( stderr, "NPP_Initialize returns %d\n", aErr );
+#endif
+ }
+
+ m_aFuncs.newp = (NPP_NewUPP)dlsym( m_pLibrary, "NPP_New" );
+ m_aFuncs.destroy = (NPP_DestroyUPP)dlsym( m_pLibrary, "NPP_Destroy" );
+ m_aFuncs.setwindow = (NPP_SetWindowUPP)dlsym( m_pLibrary, "NPP_SetWindow" );
+ m_aFuncs.newstream = (NPP_NewStreamUPP)dlsym( m_pLibrary, "NPP_NewStream" );
+ m_aFuncs.destroystream = (NPP_DestroyStreamUPP)dlsym( m_pLibrary, "NPP_DestroyStream" );
+ m_aFuncs.asfile = (NPP_StreamAsFileUPP)dlsym( m_pLibrary, "NPP_StreamAsFile" );
+ m_aFuncs.writeready = (NPP_WriteReadyUPP)dlsym( m_pLibrary, "NPP_WriteReady" );
+ m_aFuncs.write = (NPP_WriteUPP)dlsym( m_pLibrary, "NPP_Write" );
+ m_aFuncs.print = (NPP_PrintUPP)dlsym( m_pLibrary, "NPP_Print" );
+ m_aFuncs.event = NULL;
+ m_aFuncs.javaClass = NULL;
+ m_aFuncs.urlnotify = (NPP_URLNotifyUPP)dlsym( m_pLibrary, "NPP_URLNotify" );
+ m_aFuncs.getvalue =(NPP_GetValueUPP)dlsym( m_pLibrary, "NPP_GetValue" );
+ m_aFuncs.setvalue =(NPP_SetValueUPP)dlsym( m_pLibrary, "NPP_SetValue" );
+
+ m_bInit = TRUE;
+ }
+ }
+ if( ! m_bInit )
+ {
+ dlclose( m_pLibrary );
+ m_pLibrary = NULL;
+ }
+}
+
+UnxPluginComm::~UnxPluginComm()
+{
+ if( m_bInit && m_pLibrary )
+ {
+ NPP_ShutdownUPP pFunc = (NPP_ShutdownUPP)dlsym( m_pLibrary,"NPP_Shutdown");
+ if( pFunc)
+ pFunc();
+ dlclose( m_pLibrary );
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError UnxPluginComm::NPP_Destroy( NPP instance, NPSavedData** save )
+{
+ DBG_ASSERT( m_aFuncs.destroy, "### NPP_Destroy(): null pointer in NPP functions table!" );
+ return (m_aFuncs.destroy
+ ? m_aFuncs.destroy( instance, save )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError UnxPluginComm::NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason )
+{
+ DBG_ASSERT( m_aFuncs.destroystream, "### NPP_DestroyStream(): null pointer in NPP functions table!" );
+ return (m_aFuncs.destroystream
+ ? m_aFuncs.destroystream( instance, stream, reason )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError UnxPluginComm::NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
+ char* argn[], char* argv[], NPSavedData *saved )
+{
+ DBG_ASSERT( m_aFuncs.newp, "### NPP_New(): null pointer in NPP functions table!" );
+ return (m_aFuncs.newp
+ ? m_aFuncs.newp( pluginType, instance, mode, argc, argn, argv, saved )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError UnxPluginComm::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream,
+ NPBool seekable, uint16* stype )
+{
+ DBG_ASSERT( m_aFuncs.newstream, "### NPP_NewStream(): null pointer in NPP functions table!" );
+ return (m_aFuncs.newstream
+ ? m_aFuncs.newstream( instance, type, stream, seekable, stype )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+void UnxPluginComm::NPP_Print( NPP instance, NPPrint* platformPrint )
+{
+ DBG_ASSERT( m_aFuncs.print, "### NPP_Print(): null pointer in NPP functions table!" );
+ if (m_aFuncs.print)
+ m_aFuncs.print( instance, platformPrint );
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError UnxPluginComm::NPP_SetWindow( NPP instance, NPWindow* window )
+{
+ DBG_ASSERT( m_aFuncs.setwindow, "### NPP_SetWindow(): null pointer in NPP functions table!" );
+ return (m_aFuncs.setwindow
+ ? m_aFuncs.setwindow( instance, window )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+void UnxPluginComm::NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname )
+{
+ DBG_ASSERT( m_aFuncs.asfile, "### NPP_StreamAsFile(): null pointer in NPP functions table!" );
+ if (m_aFuncs.asfile)
+ m_aFuncs.asfile( instance, stream, fname );
+}
+
+//--------------------------------------------------------------------------------------------------
+void UnxPluginComm::NPP_URLNotify( NPP instance, const char* url, NPReason reason, void* notifyData )
+{
+ DBG_ASSERT( m_aFuncs.urlnotify, "### NPP_URLNotify(): null pointer in NPP functions table!" );
+ if (m_aFuncs.urlnotify)
+ m_aFuncs.urlnotify( instance, url, reason, notifyData );
+}
+
+//--------------------------------------------------------------------------------------------------
+int32 UnxPluginComm::NPP_Write( NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer )
+{
+ DBG_ASSERT( m_aFuncs.write, "### NPP_Write(): null pointer in NPP functions table!" );
+ return (m_aFuncs.write
+ ? m_aFuncs.write( instance, stream, offset, len, buffer )
+ : 0);
+}
+
+//--------------------------------------------------------------------------------------------------
+int32 UnxPluginComm::NPP_WriteReady( NPP instance, NPStream* stream )
+{
+ DBG_ASSERT( m_aFuncs.writeready, "### NPP_WriteReady(): null pointer in NPP functions table!" );
+ return (m_aFuncs.writeready
+ ? m_aFuncs.writeready( instance, stream )
+ : 0);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError UnxPluginComm::NPP_GetValue( NPP instance, NPPVariable variable, void *ret_alue )
+{
+ DBG_ASSERT( m_aFuncs.getvalue, "### NPP_GetValue(): null pointer in NPP functions table!" );
+ return (m_aFuncs.getvalue
+ ? m_aFuncs.getvalue( instance, variable, ret_alue )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError UnxPluginComm::NPP_SetValue( NPP instance, NPNVariable variable, void *ret_alue )
+{
+ DBG_ASSERT( m_aFuncs.setvalue, "### NPP_SetValue(): null pointer in NPP functions table!" );
+ return (m_aFuncs.setvalue
+ ? m_aFuncs.setvalue( instance, variable, ret_alue )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+void* UnxPluginComm::NPP_GetJavaClass()
+{
+ DBG_ERROR( "no java class available!" );
+ return 0;
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError UnxPluginComm::NPP_Initialize()
+{
+ return NPERR_NO_ERROR;
+}
+
+//--------------------------------------------------------------------------------------------------
+void UnxPluginComm::NPP_Shutdown()
+{
+}
+
diff --git a/extensions/source/plugin/unx/unxmgr.cxx b/extensions/source/plugin/unx/unxmgr.cxx
new file mode 100644
index 000000000000..cd70ecd37d27
--- /dev/null
+++ b/extensions/source/plugin/unx/unxmgr.cxx
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * $RCSfile: unxmgr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifdef SOLARIS
+#include <limits>
+#endif
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+#include <sys/stat.h>
+#include <dlfcn.h>
+
+#include <vcl/svapp.hxx>
+#include <plugin/impl.hxx>
+
+#include <dirent.h>
+
+// Unix specific implementation
+static ::com::sun::star::plugin::PluginDescription** CheckPlugin( const ByteString& rPath, int& rDescriptions )
+{
+ ::com::sun::star::plugin::PluginDescription** pRet = NULL;
+ rDescriptions = 0;
+
+ struct stat aStat;
+ if( stat( rPath.GetBuffer(), &aStat ) )
+ return NULL;
+ void *pLib = dlopen( rPath.GetBuffer(), RTLD_LAZY );
+ if( ! pLib )
+ return NULL;
+
+ char*(*pNP_GetMIMEDescription)() = (char*(*)())
+ dlsym( pLib, "NP_GetMIMEDescription" );
+ if( pNP_GetMIMEDescription )
+ {
+ ByteString aMIME = pNP_GetMIMEDescription();
+ char cTok = ';';
+ if( aMIME.GetTokenCount( ';' ) > 2 )
+ cTok = ';';
+ if( aMIME.GetTokenCount( ':' ) > 2 )
+ cTok = ':';
+ ByteString aExtension = aMIME.GetToken( 1, cTok );
+ int nExtensions = aExtension.GetTokenCount( ',' );
+ pRet = new ::com::sun::star::plugin::PluginDescription*[ nExtensions ];
+ for( int i = 0; i < nExtensions; i++ )
+ {
+ pRet[i] = new ::com::sun::star::plugin::PluginDescription;
+ pRet[i]->PluginName = String( rPath, gsl_getSystemTextEncoding() );
+ pRet[i]->Mimetype = String( aMIME.GetToken( 0, cTok ), gsl_getSystemTextEncoding() );
+ String aExt( RTL_CONSTASCII_USTRINGPARAM( "*." ) );
+ aExt += String( aExtension.GetToken( i, ',' ).EraseLeadingChars().EraseTrailingChars(), gsl_getSystemTextEncoding() );
+ pRet[i]->Extension = aExt;
+ pRet[i]->Description= String( aMIME.GetToken( 2, cTok ), gsl_getSystemTextEncoding() );
+ }
+ rDescriptions = nExtensions;
+ }
+ // some libraries register atexit handlers when loaded
+ // (e.g. g++ made libraries register global destructors)
+ // not closing them does prevent them to be called when already unloaded
+// dlclose( pLib );
+ return pRet;
+}
+
+Sequence< ::com::sun::star::plugin::PluginDescription > XPluginManager_Impl::getPluginDescriptions()
+{
+ static Sequence< ::com::sun::star::plugin::PluginDescription > aDescriptions;
+ static BOOL bHavePlugins = FALSE;
+ if( ! bHavePlugins )
+ {
+ NAMESPACE_STD(list)< ::com::sun::star::plugin::PluginDescription* > aPlugins;
+ int i;
+
+ // unix: search for plugins in /usr/lib/netscape/plugins,
+ // ~/.netscape/plugins und NPX_PLUGIN_PATH
+ // additionally: search in PluginsPath
+
+ const char* pEnv = getenv( "HOME" );
+
+ String aSearchPath( RTL_CONSTASCII_USTRINGPARAM( "/usr/lib/netscape/plugins:" ) );
+ aSearchPath += String( pEnv ? pEnv : "", gsl_getSystemTextEncoding() );
+ aSearchPath += String( RTL_CONSTASCII_USTRINGPARAM( "/.netscape/plugins:" ) );
+ pEnv = getenv( "NPX_PLUGIN_PATH" );
+ aSearchPath += String( pEnv ? pEnv : "", gsl_getSystemTextEncoding() );
+
+ const Sequence< ::rtl::OUString >& rPaths = PluginManager::getAdditionalSearchPaths();
+ for( i = 0; i < rPaths.getLength(); i++ )
+ {
+ aSearchPath += ':';
+ aSearchPath += String( rPaths.getConstArray()[i] );
+ }
+
+
+ int nPaths = aSearchPath.GetTokenCount( ':' );
+ for( i = 0; i < nPaths; i++ )
+ {
+ ByteString aPath( aSearchPath.GetToken( i, ':' ), gsl_getSystemTextEncoding() );
+ if( aPath.Len() )
+ {
+ DIR* pDIR = opendir( aPath.GetBuffer() );
+ struct dirent aEntry;
+ struct dirent* pEntry;
+
+ while( pDIR && readdir_r( pDIR, &aEntry, &pEntry ) )
+ {
+ struct stat aStat;
+ ByteString aFile( aPath );
+ aFile += '/';
+ aFile += aEntry.d_name;
+ if( ! stat( aFile.GetBuffer(), &aStat ) &&
+ S_ISREG( aStat.st_mode ) &&
+ ! strncmp( aEntry.d_name, "libnullplugin", 13 )
+ )
+ {
+ int nStructs;
+ ::com::sun::star::plugin::PluginDescription** pStructs =
+ CheckPlugin( aFile, nStructs );
+ if( pStructs )
+ {
+ for( int i = 0; i < nStructs; i++ )
+ aPlugins.push_back( pStructs[i] );
+ delete pStructs;
+ }
+ }
+ }
+ }
+ }
+ aDescriptions = Sequence< ::com::sun::star::plugin::PluginDescription >( aPlugins.size() );
+ NAMESPACE_STD(list)< ::com::sun::star::plugin::PluginDescription* >::iterator iter;
+ for( iter = aPlugins.begin(), i=0; iter != aPlugins.end(); ++iter ,i++ )
+ {
+ aDescriptions.getArray()[ i ] = **iter;
+ delete *iter;
+ }
+ aPlugins.clear();
+ bHavePlugins = TRUE;
+ }
+ return aDescriptions;
+}
+
diff --git a/extensions/source/plugin/util/makefile.mk b/extensions/source/plugin/util/makefile.mk
new file mode 100644
index 000000000000..53daf359d4ca
--- /dev/null
+++ b/extensions/source/plugin/util/makefile.mk
@@ -0,0 +1,125 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..$/..
+
+PRJNAME=extensions
+TARGET=pl
+USE_DEFFILE=TRUE
+GEN_HID=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+LIB1TARGET = $(SLB)$/plall.lib
+LIB1FILES = \
+ $(SLB)$/plbase.lib \
+ $(SHL1LINKLIB)
+
+SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
+
+.IF "$(GUI)" == "UNX"
+SHL1LINKLIB = $(SLB)$/plunx.lib
+.ENDIF
+
+.IF "$(GUI)" == "WNT"
+SHL1LINKLIB = $(SLB)$/plwin.lib
+SHL1OWNLIB = \
+ version.lib \
+ ole32.lib \
+ advapi32.lib
+.ENDIF
+
+.IF "$(GUI)" == "OS2"
+SHL1LINKLIB = $(SLB)$/plos2.lib
+.ENDIF
+
+SHL1STDLIBS=\
+ $(SHL1OWNLIB) \
+ $(VCLLIB) \
+ $(TOOLSLIB) \
+ $(TKLIB) \
+ $(VOSLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+#SHL1DEPN= $(SLB)/sfx.lib $(L)$/itools.lib $(L)$/ivcl.lib
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL1IMPLIB = i$(TARGET)
+
+SHL1LIBS = $(LIB1TARGET)
+
+
+DEF1NAME =$(SHL1TARGET)
+DEF1EXPORTFILE= exports.dxp
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+
+
diff --git a/extensions/source/plugin/util/makefile.pmk b/extensions/source/plugin/util/makefile.pmk
new file mode 100644
index 000000000000..3bec8dfc97ef
--- /dev/null
+++ b/extensions/source/plugin/util/makefile.pmk
@@ -0,0 +1,69 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.pmk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PDBTARGET=pl
+NOUNODOC=true
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+
diff --git a/extensions/source/plugin/win/makefile.mk b/extensions/source/plugin/win/makefile.mk
new file mode 100644
index 000000000000..5764e096aac4
--- /dev/null
+++ b/extensions/source/plugin/win/makefile.mk
@@ -0,0 +1,96 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=plugin
+TARGET=plwin
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+.IF "$(GUI)" == "WNT"
+
+.INCLUDE : ..$/util$/makefile.pmk
+
+# --- Types -------------------------------------
+
+UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+
+UNOUCROUT=$(OUT)$/inc$/$(PRJNAME)
+INCPRE+=$(UNOUCROUT)
+
+# --- Types -------------------------------------
+
+SLOFILES = $(SLO)$/winmgr.obj \
+ $(SLO)$/sysplug.obj
+
+#SRCFILES = app.src
+
+.ENDIF
+# ------------------------------------------------------------------
+
+
+.INCLUDE : target.mk
+.INCLUDE : ..$/util$/target.pmk
+
+
diff --git a/extensions/source/plugin/win/sysplug.cxx b/extensions/source/plugin/win/sysplug.cxx
new file mode 100644
index 000000000000..f0f2dc889aa4
--- /dev/null
+++ b/extensions/source/plugin/win/sysplug.cxx
@@ -0,0 +1,300 @@
+/*************************************************************************
+ *
+ * $RCSfile: sysplug.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <plugin/impl.hxx>
+
+#ifdef WNT
+#if _MSC_VER >= 1200
+#include <tools/prewin.h>
+#else
+#include <tools/presys.h>
+#endif
+#endif
+#if STLPORT_VERSION < 321
+#include <stl/map.h>
+#endif
+#include <windows.h>
+#include <string.h>
+#include <tchar.h>
+#include <winreg.h>
+#include <winbase.h>
+#include <objbase.h>
+#ifdef WNT
+#if _MSC_VER >= 1200
+#include <tools/postwin.h>
+#else
+#include <tools/postsys.h>
+#endif
+#endif
+#if STLPORT_VERSION >= 321
+#include <stl/list>
+#include <stl/map>
+#include <stl/algorithm>
+#endif
+
+extern NPNetscapeFuncs aNPNFuncs;
+
+#include <tools/debug.hxx>
+
+using namespace rtl;
+
+//--------------------------------------------------------------------------------------------------
+PluginComm_Impl::PluginComm_Impl( const OUString& rMIME, const OUString& rName, HWND hWnd )
+ : PluginComm( OUStringToOString( rName, RTL_TEXTENCODING_MS_1252 ) )
+{
+ // initialize plugin function table
+ memset( &_NPPfuncs, 0, sizeof( _NPPfuncs ) );
+#ifdef UNICODE
+ _plDLL = ::LoadLibrary( rName.getStr() );
+#else
+ OString aStr( OUStringToOString( rName, RTL_TEXTENCODING_MS_1252 ) );
+ _plDLL = ::LoadLibrary( aStr.getStr() );
+#endif
+ DBG_ASSERT( _plDLL, "### loading plugin dll failed!" );
+
+ NPError nErr;
+ NPError (WINAPI * pEntry)( NPPluginFuncs* );
+ if (_plDLL && retrieveFunction( _T("NP_GetEntryPoints"), (void**)&pEntry ))
+ {
+ _NPPfuncs.size = sizeof( _NPPfuncs );
+ _NPPfuncs.version = 0;
+ nErr = (*pEntry)( &_NPPfuncs );
+
+ DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NP_GetEntryPoints() failed!" );
+ DBG_ASSERT( (_NPPfuncs.version >> 8) >= NP_VERSION_MAJOR,
+ "### version failure!" );
+
+ NPError (WINAPI * pInit)( NPNetscapeFuncs* );
+ if (nErr == NPERR_NO_ERROR &&
+ (_NPPfuncs.version >> 8) >= NP_VERSION_MAJOR &&
+ (retrieveFunction( _T("NP_Initialize"), (void**)&pInit ) ||
+ retrieveFunction( _T("NP_PluginInit"), (void**)&pInit )))
+ {
+ nErr = (*pInit)( &aNPNFuncs );
+ DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NP_Initialize() failed!" );
+
+// WIN obsolete: called by NP_Initialize()
+// nErr = NPP_Initialize();
+// DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NPP_Initialize() failed!" );
+ }
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+PluginComm_Impl::~PluginComm_Impl()
+{
+ if (_plDLL)
+ {
+// NPP_Shutdown();
+
+ NPError (WINAPI * pShutdown)();
+ if (retrieveFunction( _T("NP_Shutdown"), (void**)&pShutdown ))
+ {
+ NPError nErr = (*pShutdown)();
+ DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NP_Shutdown() failed!" );
+ }
+
+ BOOL bRet = ::FreeLibrary( _plDLL );
+ DBG_ASSERT( bRet, "### unloading plugin dll failed!" );
+ _plDLL = NULL;
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+BOOL PluginComm_Impl::retrieveFunction( TCHAR* pName, void** ppFunc ) const
+{
+ if( ! _plDLL )
+ return FALSE;
+
+ *ppFunc = (void*)::GetProcAddress( _plDLL, pName );
+
+ return (*ppFunc != NULL);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError PluginComm_Impl::NPP_Destroy( NPP instance, NPSavedData** save )
+{
+ DBG_ASSERT( _NPPfuncs.destroy, "### NPP_Destroy(): null pointer in NPP functions table!" );
+ return (_NPPfuncs.destroy
+ ? (*_NPPfuncs.destroy)( instance, save )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError PluginComm_Impl::NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason )
+{
+ DBG_ASSERT( _NPPfuncs.destroystream, "### NPP_DestroyStream(): null pointer in NPP functions table!" );
+ return (_NPPfuncs.destroystream
+ ? (*_NPPfuncs.destroystream)( instance, stream, reason )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError PluginComm_Impl::NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
+ char* argn[], char* argv[], NPSavedData *saved )
+{
+ DBG_ASSERT( _NPPfuncs.newp, "### NPP_New(): null pointer in NPP functions table!" );
+ return (_NPPfuncs.newp
+ ? (*_NPPfuncs.newp)( pluginType, instance, mode, argc, argn, argv, saved )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError PluginComm_Impl::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream,
+ NPBool seekable, uint16* stype )
+{
+ DBG_ASSERT( _NPPfuncs.newstream, "### NPP_NewStream(): null pointer in NPP functions table!" );
+ return (_NPPfuncs.newstream
+ ? (*_NPPfuncs.newstream)( instance, type, stream, seekable, stype )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+void PluginComm_Impl::NPP_Print( NPP instance, NPPrint* platformPrint )
+{
+ DBG_ASSERT( _NPPfuncs.print, "### NPP_Print(): null pointer in NPP functions table!" );
+ if (_NPPfuncs.print)
+ (*_NPPfuncs.print)( instance, platformPrint );
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError PluginComm_Impl::NPP_SetWindow( NPP instance, NPWindow* window )
+{
+ DBG_ASSERT( _NPPfuncs.setwindow, "### NPP_SetWindow(): null pointer in NPP functions table!" );
+ return (_NPPfuncs.setwindow
+ ? (*_NPPfuncs.setwindow)( instance, window )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+void PluginComm_Impl::NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname )
+{
+ DBG_ASSERT( _NPPfuncs.asfile, "### NPP_StreamAsFile(): null pointer in NPP functions table!" );
+ if (_NPPfuncs.asfile)
+ (*_NPPfuncs.asfile)( instance, stream, fname );
+}
+
+//--------------------------------------------------------------------------------------------------
+void PluginComm_Impl::NPP_URLNotify( NPP instance, const char* url, NPReason reason, void* notifyData )
+{
+ DBG_ASSERT( _NPPfuncs.urlnotify, "### NPP_URLNotify(): null pointer in NPP functions table!" );
+ if (_NPPfuncs.urlnotify)
+ (*_NPPfuncs.urlnotify)( instance, url, reason, notifyData );
+}
+
+//--------------------------------------------------------------------------------------------------
+int32 PluginComm_Impl::NPP_Write( NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer )
+{
+ DBG_ASSERT( _NPPfuncs.write, "### NPP_Write(): null pointer in NPP functions table!" );
+ return (_NPPfuncs.write
+ ? (*_NPPfuncs.write)( instance, stream, offset, len, buffer )
+ : 0);
+}
+
+//--------------------------------------------------------------------------------------------------
+int32 PluginComm_Impl::NPP_WriteReady( NPP instance, NPStream* stream )
+{
+ DBG_ASSERT( _NPPfuncs.writeready, "### NPP_WriteReady(): null pointer in NPP functions table!" );
+ return (_NPPfuncs.writeready
+ ? (*_NPPfuncs.writeready)( instance, stream )
+ : 0);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError PluginComm_Impl::NPP_GetValue( NPP instance, NPPVariable variable, void *ret_alue )
+{
+ DBG_ASSERT( _NPPfuncs.getvalue, "### NPP_GetValue(): null pointer in NPP functions table!" );
+ return (_NPPfuncs.getvalue
+ ? (*_NPPfuncs.getvalue)( instance, variable, ret_alue )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError PluginComm_Impl::NPP_SetValue( NPP instance, NPNVariable variable, void *ret_alue )
+{
+ DBG_ASSERT( _NPPfuncs.setvalue, "### NPP_SetValue(): null pointer in NPP functions table!" );
+ return (_NPPfuncs.setvalue
+ ? (*_NPPfuncs.setvalue)( instance, variable, ret_alue )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+void * PluginComm_Impl::NPP_GetJavaClass()
+{
+ DBG_ERROR( "no java class available!" );
+ return 0;
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError PluginComm_Impl::NPP_Initialize()
+{
+ return NPERR_NO_ERROR;
+}
+
+//--------------------------------------------------------------------------------------------------
+void PluginComm_Impl::NPP_Shutdown()
+{
+ NPP_ShutdownUPP pFunc;
+ if (retrieveFunction( _T("NPP_Shutdown"), (void**)&pFunc ))
+ (*pFunc)();
+}
+
+
diff --git a/extensions/source/plugin/win/winmgr.cxx b/extensions/source/plugin/win/winmgr.cxx
new file mode 100644
index 000000000000..a1a2b6abf44b
--- /dev/null
+++ b/extensions/source/plugin/win/winmgr.cxx
@@ -0,0 +1,392 @@
+/*************************************************************************
+ *
+ * $RCSfile: winmgr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <vcl/svapp.hxx>
+#include <tools/fsys.hxx>
+#include <osl/mutex.hxx>
+
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <plugin/impl.hxx>
+
+#ifdef WNT
+#if _MSC_VER >= 1200
+#include <tools/prewin.h>
+#else
+#include <tools/presys.h>
+#endif
+#endif
+#include <windows.h>
+#include <string.h>
+#include <tchar.h>
+#include <winreg.h>
+#include <winbase.h>
+#include <objbase.h>
+#ifdef WNT
+#if _MSC_VER >= 1200
+#include <tools/postwin.h>
+#else
+#include <tools/postsys.h>
+#endif
+#endif
+#if STLPORT_VERSION >= 321
+#include <stl/list>
+#include <stl/map>
+#include <stl/algorithm>
+#else
+#include <stl/map.h>
+#endif
+
+using namespace rtl;
+using namespace std;
+using namespace osl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::plugin;
+
+typedef map< OString, OUString, less< OString > > PluginLocationMap;
+
+
+//__________________________________________________________________________________________________
+static void addPluginsFromPath( const TCHAR * pPluginsPath, PluginLocationMap & rPlugins )
+{
+ // append dll name pattern we are looking for
+ TCHAR arPluginsPath[MAX_PATH];
+ arPluginsPath[0] = 0;
+
+#ifdef UNICODE
+ if (::rtl_ustr_indexOfStr( pPluginsPath, L"%programfiles%" ) == 0)
+ {
+ const char * p = ::getenv( "ProgramFiles" );
+ if (p)
+ {
+ OUString aStr( OUString::createFromAscii( p ) );
+ ::lstrcpy( arPluginsPath, aStr.getStr() );
+ pPluginsPath += 14;
+ }
+ }
+#else
+ if (::rtl_str_indexOfStr( pPluginsPath, "%programfiles%" ) == 0)
+ {
+ const char * p = ::getenv( "ProgramFiles" );
+ if (p)
+ {
+ ::lstrcpy( arPluginsPath, p );
+ pPluginsPath += 14;
+ }
+ }
+#endif
+ ::lstrcat( arPluginsPath, pPluginsPath );
+ ::lstrcat( arPluginsPath, _T("\\") );
+
+ TCHAR arPluginsPattern[MAX_PATH];
+ ::lstrcpy( arPluginsPattern, arPluginsPath );
+ ::lstrcat( arPluginsPattern, _T("NP*.DLL") );
+
+ WIN32_FIND_DATA aFindData;
+ HANDLE hFind = ::FindFirstFile( arPluginsPattern, &aFindData );
+
+ while (hFind != INVALID_HANDLE_VALUE)
+ {
+#ifdef UNICODE
+ OString aStr( OUStringToOString( aFindData.cFileName, RTL_TEXTENCODING_MS_1252 ) );
+ OString aName( aStr ); // cAsE?
+#else
+ OString aName( aFindData.cFileName );
+#endif
+ aName.toLowerCase();
+
+ // no netscape default plugin anymore...
+ // and no double plugin dlls
+ if (!aName.equals( "npnul32.dll" ) && rPlugins.find( aName ) == rPlugins.end())
+ {
+ TCHAR arComplete[MAX_PATH];
+ ::lstrcpy( arComplete, arPluginsPath );
+ ::lstrcat( arComplete, aFindData.cFileName );
+
+#ifdef UNICODE
+ rPlugins[aName] = OUString( arComplete );
+#else
+ OUString aStr( OStringToOUString( arComplete, RTL_TEXTENCODING_MS_1252 ) );
+ rPlugins[aName] = OUString( aStr.getStr() );
+#endif
+ }
+
+ if (! ::FindNextFile( hFind, &aFindData ))
+ break;
+ }
+
+ if (hFind != INVALID_HANDLE_VALUE)
+ ::FindClose( hFind );
+}
+//__________________________________________________________________________________________________
+static void addPluginsFromPath( const OUString & rPath, PluginLocationMap & rPlugins )
+{
+ TCHAR arPluginsPath[MAX_PATH];
+ DWORD dwPluginsPathSize = sizeof(arPluginsPath);
+
+#ifdef UNICODE
+ ::lstrcpy( arPluginsPath, rPath.getStr() );
+#else
+ OString aStr( OUStringToOString( rPath, RTL_TEXTENCODING_MS_1252 ) );
+ ::strcpy( arPluginsPath, aStr.getStr() );
+#endif
+
+ addPluginsFromPath( arPluginsPath, rPlugins );
+}
+
+
+//__________________________________________________________________________________________________
+static void add_IE_Plugins( PluginLocationMap & rPlugins )
+{
+ HKEY hKey;
+ TCHAR arCurrent[MAX_PATH];
+ DWORD dwType, dwCurrentSize = sizeof(arCurrent);
+
+ if (::RegOpenKeyEx( HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\IE4\\SETUP"),
+ 0, KEY_READ, &hKey ) == ERROR_SUCCESS)
+ {
+ if (::RegQueryValueEx( hKey, _T("Path"), NULL, &dwType,
+ (LPBYTE)arCurrent, &dwCurrentSize ) == ERROR_SUCCESS &&
+ (dwType == REG_SZ || dwType == REG_EXPAND_SZ))
+ {
+ // add \\Plugins
+ ::lstrcat( arCurrent, _T("\\Plugins") );
+
+ addPluginsFromPath( arCurrent, rPlugins );
+ }
+ ::RegCloseKey( hKey );
+ }
+}
+
+//__________________________________________________________________________________________________
+static void add_NS_Plugins( PluginLocationMap & rPlugins )
+{
+ HKEY hKey1, hKey2;
+ TCHAR arCurrent[MAX_PATH];
+ DWORD dwType, dwCurrentSize = sizeof(arCurrent);
+
+ if (::RegOpenKeyEx( HKEY_LOCAL_MACHINE, _T("Software\\Netscape\\Netscape Navigator"),
+ 0, KEY_READ, &hKey1 ) == ERROR_SUCCESS)
+ {
+ if (::RegQueryValueEx( hKey1, _T("CurrentVersion"), NULL, &dwType,
+ (LPBYTE)arCurrent, &dwCurrentSize ) == ERROR_SUCCESS &&
+ (dwType == REG_SZ || dwType == REG_EXPAND_SZ) &&
+ ::RegOpenKeyEx( hKey1, ::lstrcat( arCurrent, _T("\\Main") ),
+ 0, KEY_READ, &hKey2 ) == ERROR_SUCCESS)
+ {
+ dwCurrentSize = sizeof(arCurrent);
+ if (::RegQueryValueEx( hKey2, _T("Plugins Directory"), NULL, &dwType,
+ (LPBYTE)arCurrent, &dwCurrentSize ) == ERROR_SUCCESS &&
+ (dwType == REG_SZ || dwType == REG_EXPAND_SZ))
+ {
+ addPluginsFromPath( arCurrent, rPlugins );
+ }
+ ::RegCloseKey( hKey2 );
+ }
+ ::RegCloseKey( hKey1 );
+ }
+}
+
+//__________________________________________________________________________________________________
+static void add_SO_Plugins( PluginLocationMap & rPlugins )
+{
+ const Sequence< OUString > & rPaths = PluginManager::getAdditionalSearchPaths();
+
+ const OUString * pPaths = rPaths.getConstArray();
+ for ( UINT32 nPos = rPaths.getLength(); nPos--; )
+ {
+ addPluginsFromPath( pPaths[nPos], rPlugins );
+ }
+}
+
+//__________________________________________________________________________________________________
+Sequence< PluginDescription > XPluginManager_Impl::getPluginDescriptions(void) throw()
+{
+ Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
+ static Sequence<PluginDescription > s_aDescriptions( 0 );
+ static s_bInit = FALSE;
+
+ if (! s_bInit)
+ {
+ // collect all distinct plugin dlls
+ PluginLocationMap aPlugins;
+ add_SO_Plugins( aPlugins );
+ add_NS_Plugins( aPlugins );
+ add_IE_Plugins( aPlugins );
+
+ // collect mime types of plugin dlls
+ for ( PluginLocationMap::iterator iPos( aPlugins.begin() );
+ iPos != aPlugins.end();
+ ++iPos )
+ {
+ TCHAR arFileName[MAX_PATH];
+ DWORD dwDummy, dwSize;
+
+ // DLL name
+ OUString aName( (*iPos).second.getStr() );
+
+#ifdef UNICODE
+ ::lstrcpy( arFileName, aName.getStr() );
+#else
+ OString aStr( OUStringToOString( aName, RTL_TEXTENCODING_MS_1252 ) );
+ ::strcpy( arFileName, aStr.getStr() );
+#endif
+ dwSize = ::GetFileVersionInfoSize( arFileName, &dwDummy );
+
+ char * pVersionData = NULL;
+ if (dwSize && (pVersionData = new char[dwSize]) &&
+ ::GetFileVersionInfo( arFileName, 0, dwSize, pVersionData ))
+ {
+ // optional comment
+ OUString aComment;
+
+ TCHAR * pInfo, * pInfo2;
+ UINT nSize;
+ if (::VerQueryValue( pVersionData, _T("\\StringFileInfo\\040904E4\\ProductName"),
+ (void**)&pInfo, &nSize ) && pInfo)
+ {
+#ifdef UNICODE
+ aComment.operator=( pInfo );
+#else
+ aComment.operator=( OStringToOUString( OString(pInfo), RTL_TEXTENCODING_MS_1252 ) );
+#endif
+ }
+
+ // mandatory mime type and file extensions
+ if (::VerQueryValue( pVersionData, _T("\\StringFileInfo\\040904E4\\MIMEType"),
+ (void**)&pInfo, &nSize ) && pInfo &&
+ ::VerQueryValue( pVersionData, _T("\\StringFileInfo\\040904E4\\FileExtents"),
+ (void**)&pInfo2, &nSize ) && pInfo2)
+ {
+#ifdef UNICODE
+ OUString aExt( pInfo2 );
+ OUString aMIME( pInfo );
+#else
+ OString aStr2( pInfo2 );
+ OString aExt( aStr2 );
+ OString aStr( pInfo );
+ OString aMIME( aStr );
+#endif
+ aMIME.trim();
+
+ USHORT nToken = aExt.getTokenCount( '|' );
+ USHORT nMToken = aMIME.getTokenCount( '|' );
+ if (nToken != nMToken)
+ {
+ DBG_ERROR( "### mime type count differ to extension count!" );
+ nToken = (nToken > nMToken ? nMToken : nToken);
+ }
+
+ UINT32 nStart = s_aDescriptions.getLength();
+ s_aDescriptions.realloc( nStart + nToken );
+ PluginDescription* pDescriptions = s_aDescriptions.getArray();
+ // for every MIME Type
+ for ( ; nToken--; )
+ {
+ PluginDescription & rDescr = pDescriptions[nStart+nToken];
+ rDescr.PluginName = aName;
+ rDescr.Description = aComment;
+ rDescr.Mimetype = OStringToOUString( aMIME.getToken( nToken, '|' ), RTL_TEXTENCODING_MS_1252 );
+
+ OUString aExtToken( OStringToOUString( aExt.getToken( nToken, '|' ), RTL_TEXTENCODING_MS_1252 ) );
+ USHORT nPos = 0, nLen = aExtToken.getLength();
+ OUString aExtensions( OUString::createFromAscii( nLen ? "*." : "*.*" ) );
+
+ for ( ; nPos < nLen; ++nPos )
+ {
+ sal_Unicode c = aExtToken[nPos];
+ switch (c)
+ {
+ case ',':
+ case ';':
+ aExtensions += OUString::createFromAscii( ";*." );
+ case ' ':
+ break;
+ case '*':
+ if (nPos < (nLen-1) && aExtToken[ nPos+1 ] == '.')
+ {
+ ++nPos;
+ break;
+ }
+ default:
+ aExtensions += OUString( &c, 1 );
+ }
+ }
+ rDescr.Extension = aExtensions;
+ }
+ }
+#if DEBUG
+ else
+ DBG_ERROR( "### cannot get MIME type or extensions!" );
+#endif
+ }
+ if (pVersionData)
+ delete[] pVersionData;
+ }
+
+ s_bInit = TRUE;
+ }
+ return s_aDescriptions;
+}
+
+