From 4c18af27bf95b332ee2006cfc0bbf469fb1a84d4 Mon Sep 17 00:00:00 2001 From: Rene Engelhard Date: Sat, 12 Dec 2015 11:36:25 +0100 Subject: tdf#96398 kill remaining NPAPI support for plugins _inside_ LO - probably out of date - links against Gtk2 and thus causes a GTk2 dependency in core packages - the only serious usecase (Flash) is doomed anyway Change-Id: I7264ab5eb04c2f4b6c31a815e45b9818209e5ae2 Reviewed-on: https://gerrit.libreoffice.org/20658 Reviewed-by: David Ostrovsky Reviewed-by: Bryan Quigley Tested-by: Thorsten Behrens --- Repository.mk | 2 - config_host.mk.in | 3 - configure.ac | 78 -- extensions/Executable_pluginapp.bin.mk | 69 -- extensions/Library_pl.mk | 120 -- extensions/Module_extensions.mk | 17 - extensions/StaticLibrary_plugcon.mk | 61 - extensions/source/plugin/aqua/macmgr.mm | 654 ---------- extensions/source/plugin/aqua/sysplug.mm | 882 -------------- extensions/source/plugin/base/context.cxx | 345 ------ extensions/source/plugin/base/evtlstnr.cxx | 74 -- extensions/source/plugin/base/manager.cxx | 234 ---- extensions/source/plugin/base/multiplx.cxx | 333 ----- extensions/source/plugin/base/nfuncs.cxx | 644 ---------- extensions/source/plugin/base/plcom.cxx | 80 -- extensions/source/plugin/base/plctrl.cxx | 322 ----- extensions/source/plugin/base/plmodel.cxx | 204 ---- extensions/source/plugin/base/service.cxx | 95 -- extensions/source/plugin/base/xplugin.cxx | 1206 ------------------- .../source/plugin/inc/plugin/aqua/sysplug.hxx | 156 --- extensions/source/plugin/inc/plugin/impl.hxx | 437 ------- extensions/source/plugin/inc/plugin/model.hxx | 132 -- extensions/source/plugin/inc/plugin/multiplx.hxx | 169 --- extensions/source/plugin/inc/plugin/plcom.hxx | 80 -- extensions/source/plugin/inc/plugin/plctrl.hxx | 181 --- .../source/plugin/inc/plugin/unx/mediator.hxx | 147 --- .../source/plugin/inc/plugin/unx/plugcon.hxx | 206 ---- .../source/plugin/inc/plugin/unx/sysplug.hxx | 78 -- .../source/plugin/inc/plugin/win/sysplug.hxx | 130 -- extensions/source/plugin/pl.component | 37 - extensions/source/plugin/unx/mediator.cxx | 337 ------ extensions/source/plugin/unx/npnapi.cxx | 949 --------------- extensions/source/plugin/unx/nppapi.cxx | 593 --------- extensions/source/plugin/unx/npwrap.cxx | 495 -------- extensions/source/plugin/unx/npwrap.hxx | 31 - extensions/source/plugin/unx/plugcon.cxx | 281 ----- extensions/source/plugin/unx/sysplug.cxx | 152 --- extensions/source/plugin/unx/unxmgr.cxx | 313 ----- extensions/source/plugin/win/sysplug.cxx | 441 ------- extensions/source/plugin/win/winmgr.cxx | 445 ------- external/np_sdk/README | 1 - external/np_sdk/inc/LEGAL | 43 - external/np_sdk/inc/LICENSE | 567 --------- external/np_sdk/inc/npapi.h | 879 -------------- external/np_sdk/inc/npfunctions.h | 321 ----- external/np_sdk/inc/npruntime.h | 393 ------ external/np_sdk/inc/nptypes.h | 111 -- external/np_sdk/npsdk/LEGAL | 43 - external/np_sdk/npsdk/LICENSE | 567 --------- external/np_sdk/npsdk/README | 2 - external/np_sdk/npsdk/jri.h | 689 ----------- external/np_sdk/npsdk/jri_md.h | 545 --------- external/np_sdk/npsdk/jritypes.h | 232 ---- external/np_sdk/npsdk/npupp.h | 1267 -------------------- offapi/UnoApi_offapi.mk | 17 - offapi/com/sun/star/mozilla/XPluginInstance.idl | 109 -- .../sun/star/mozilla/XPluginInstanceNotifySink.idl | 49 - .../com/sun/star/mozilla/XPluginInstancePeer.idl | 132 -- .../sun/star/mozilla/XPluginInstanceSyncPeer.idl | 54 - offapi/com/sun/star/mozilla/XPluginWindowPeer.idl | 46 - offapi/com/sun/star/plugin/PluginDescription.idl | 47 - offapi/com/sun/star/plugin/PluginException.idl | 46 - offapi/com/sun/star/plugin/PluginManager.idl | 38 - offapi/com/sun/star/plugin/PluginMode.idl | 40 - offapi/com/sun/star/plugin/PluginVariable.idl | 48 - offapi/com/sun/star/plugin/XPlugin.idl | 67 -- offapi/com/sun/star/plugin/XPluginContext.idl | 177 --- offapi/com/sun/star/plugin/XPluginManager.idl | 114 -- offapi/type_reference/offapi.idl | 79 -- 69 files changed, 17936 deletions(-) delete mode 100644 extensions/Executable_pluginapp.bin.mk delete mode 100644 extensions/Library_pl.mk delete mode 100644 extensions/StaticLibrary_plugcon.mk delete mode 100644 extensions/source/plugin/aqua/macmgr.mm delete mode 100644 extensions/source/plugin/aqua/sysplug.mm delete mode 100644 extensions/source/plugin/base/context.cxx delete mode 100644 extensions/source/plugin/base/evtlstnr.cxx delete mode 100644 extensions/source/plugin/base/manager.cxx delete mode 100644 extensions/source/plugin/base/multiplx.cxx delete mode 100644 extensions/source/plugin/base/nfuncs.cxx delete mode 100644 extensions/source/plugin/base/plcom.cxx delete mode 100644 extensions/source/plugin/base/plctrl.cxx delete mode 100644 extensions/source/plugin/base/plmodel.cxx delete mode 100644 extensions/source/plugin/base/service.cxx delete mode 100644 extensions/source/plugin/base/xplugin.cxx delete mode 100644 extensions/source/plugin/inc/plugin/aqua/sysplug.hxx delete mode 100644 extensions/source/plugin/inc/plugin/impl.hxx delete mode 100644 extensions/source/plugin/inc/plugin/model.hxx delete mode 100644 extensions/source/plugin/inc/plugin/multiplx.hxx delete mode 100644 extensions/source/plugin/inc/plugin/plcom.hxx delete mode 100644 extensions/source/plugin/inc/plugin/plctrl.hxx delete mode 100644 extensions/source/plugin/inc/plugin/unx/mediator.hxx delete mode 100644 extensions/source/plugin/inc/plugin/unx/plugcon.hxx delete mode 100644 extensions/source/plugin/inc/plugin/unx/sysplug.hxx delete mode 100644 extensions/source/plugin/inc/plugin/win/sysplug.hxx delete mode 100644 extensions/source/plugin/pl.component delete mode 100644 extensions/source/plugin/unx/mediator.cxx delete mode 100644 extensions/source/plugin/unx/npnapi.cxx delete mode 100644 extensions/source/plugin/unx/nppapi.cxx delete mode 100644 extensions/source/plugin/unx/npwrap.cxx delete mode 100644 extensions/source/plugin/unx/npwrap.hxx delete mode 100644 extensions/source/plugin/unx/plugcon.cxx delete mode 100644 extensions/source/plugin/unx/sysplug.cxx delete mode 100644 extensions/source/plugin/unx/unxmgr.cxx delete mode 100644 extensions/source/plugin/win/sysplug.cxx delete mode 100644 extensions/source/plugin/win/winmgr.cxx delete mode 100644 external/np_sdk/README delete mode 100644 external/np_sdk/inc/LEGAL delete mode 100644 external/np_sdk/inc/LICENSE delete mode 100644 external/np_sdk/inc/npapi.h delete mode 100644 external/np_sdk/inc/npfunctions.h delete mode 100644 external/np_sdk/inc/npruntime.h delete mode 100644 external/np_sdk/inc/nptypes.h delete mode 100644 external/np_sdk/npsdk/LEGAL delete mode 100644 external/np_sdk/npsdk/LICENSE delete mode 100644 external/np_sdk/npsdk/README delete mode 100644 external/np_sdk/npsdk/jri.h delete mode 100644 external/np_sdk/npsdk/jri_md.h delete mode 100644 external/np_sdk/npsdk/jritypes.h delete mode 100644 external/np_sdk/npsdk/npupp.h delete mode 100644 offapi/com/sun/star/mozilla/XPluginInstance.idl delete mode 100644 offapi/com/sun/star/mozilla/XPluginInstanceNotifySink.idl delete mode 100644 offapi/com/sun/star/mozilla/XPluginInstancePeer.idl delete mode 100644 offapi/com/sun/star/mozilla/XPluginInstanceSyncPeer.idl delete mode 100644 offapi/com/sun/star/mozilla/XPluginWindowPeer.idl delete mode 100644 offapi/com/sun/star/plugin/PluginDescription.idl delete mode 100644 offapi/com/sun/star/plugin/PluginException.idl delete mode 100644 offapi/com/sun/star/plugin/PluginManager.idl delete mode 100644 offapi/com/sun/star/plugin/PluginMode.idl delete mode 100644 offapi/com/sun/star/plugin/PluginVariable.idl delete mode 100644 offapi/com/sun/star/plugin/XPlugin.idl delete mode 100644 offapi/com/sun/star/plugin/XPluginContext.idl delete mode 100644 offapi/com/sun/star/plugin/XPluginManager.idl diff --git a/Repository.mk b/Repository.mk index 5e9bb48287d1..5c468b208462 100644 --- a/Repository.mk +++ b/Repository.mk @@ -145,7 +145,6 @@ $(eval $(call gb_Helper_register_executables_for_install,OOO,writer_brand, \ $(eval $(call gb_Helper_register_executables_for_install,OOO,ooo, \ gengal \ - $(if $(filter TRUE-TRUE,$(USING_X11)-$(ENABLE_NPAPI_FROM_BROWSER)),pluginapp.bin) \ $(if $(filter WNT,$(OS)),,uri-encode) \ ui-previewer \ $(if $(filter WNT,$(OS)), \ @@ -360,7 +359,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \ $(call gb_Helper_optional,OPENCL,opencl) \ passwordcontainer \ pcr \ - $(if $(ENABLE_NPAPI_FROM_BROWSER),pl) \ pdffilter \ $(call gb_Helper_optional,SCRIPTING,protocolhandler) \ res \ diff --git a/config_host.mk.in b/config_host.mk.in index 33c26b752462..9b59af3f6014 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -151,7 +151,6 @@ export ENABLE_LWP=@ENABLE_LWP@ export ENABLE_MACOSX_SANDBOX=@ENABLE_MACOSX_SANDBOX@ export ENABLE_MEDIAWIKI=@ENABLE_MEDIAWIKI@ export ENABLE_MARIADBC=@ENABLE_MARIADBC@ -export ENABLE_NPAPI_FROM_BROWSER=@ENABLE_NPAPI_FROM_BROWSER@ export ENABLE_ONLINE_UPDATE=@ENABLE_ONLINE_UPDATE@ export ENABLE_ONLINE_UPDATE_MAR=@ENABLE_ONLINE_UPDATE_MAR@ export ENABLE_EXTENSION_UPDATE=@ENABLE_EXTENSION_UPDATE@ @@ -416,7 +415,6 @@ export NEON_CFLAGS=$(gb_SPACE)@NEON_CFLAGS@ export NEON_LIBS=$(gb_SPACE)@NEON_LIBS@ export NEON_VERSION=@NEON_VERSION@ export NM=@NM@ -export NPAPI_HEADERS_CFLAGS=$(gb_SPACE)@NPAPI_HEADERS_CFLAGS@ export NSS_CFLAGS=$(gb_SPACE)@NSS_CFLAGS@ export NSS_LIBS=$(gb_SPACE)@NSS_LIBS@ export NUMBERTEXT_EXTENSION_PACK=@NUMBERTEXT_EXTENSION_PACK@ @@ -561,7 +559,6 @@ export SYSTEM_MWAW=@SYSTEM_MWAW@ export SYSTEM_MYSQL_CPPCONN=@SYSTEM_MYSQL_CPPCONN@ export SYSTEM_MYTHES=@SYSTEM_MYTHES@ export SYSTEM_NEON=@SYSTEM_NEON@ -export SYSTEM_NPAPI_HEADERS=@SYSTEM_NPAPI_HEADERS@ export SYSTEM_NSS=@SYSTEM_NSS@ export SYSTEM_ODBC_HEADERS=@SYSTEM_ODBC_HEADERS@ export SYSTEM_ODFGEN=@SYSTEM_ODFGEN@ diff --git a/configure.ac b/configure.ac index 49198a8e8809..ecff3719f11f 100644 --- a/configure.ac +++ b/configure.ac @@ -1951,13 +1951,6 @@ AC_ARG_WITH(system-liblangtag, [Use liblangtag library already on system.]),, [with_system_liblangtag="$with_system_libs"]) -AC_ARG_WITH(system-npapi-headers, - AS_HELP_STRING([--with-system-npapi-headers], - [Use NPAPI headers provided by system instead of bundled ones. Used in - extensions/source/plugin (ENABLE_NPAPI_FROM_BROWSER=TRUE)]),, - [with_system_npapi_headers="$with_system_headers"] -) - AC_ARG_WITH(jpeg-turbo, AS_HELP_STRING([--with-jpeg-turbo], [Use internal libjpeg-turbo library.]),, @@ -8952,56 +8945,6 @@ if test $_os = WINNT -a -z "$ENABLE_RELEASE_BUILD" -a "$with_prebuilt_openssl" = BUILD_TYPE="$BUILD_TYPE PREBUILT_OPENSSL" fi -dnl =================================================================== -dnl Check for system mozilla headers -dnl =================================================================== -HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION= -AC_MSG_CHECKING([which NPAPI headers to use]) - -if test "$with_system_npapi_headers" = "yes"; then - AC_MSG_RESULT([external]) - SYSTEM_NPAPI_HEADERS=TRUE - # First try npapi-sdk: - PKG_CHECK_MODULES(NPAPI_HEADERS, npapi-sdk, [LOCATED=yes], [LOCATED=no]) - # Then go with libxul: - if test "x$LOCATED" != "xyes"; then - PKG_CHECK_MODULES(NPAPI_HEADERS, libxul, [LOCATED=yes], [LOCATED=no]) - fi - if test "x$LOCATED" != "xyes"; then - PKG_CHECK_MODULES(NPAPI_HEADERS, mozilla-plugin, [LOCATED=yes], [LOCATED=no]) - fi - # if still not found bail out - if test "x$LOCATED" != "xyes"; then - AC_MSG_ERROR([npapi.h header file not found]) - fi - - AC_LANG_PUSH([C]) - save_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS $NPAPI_HEADERS_CFLAGS" - AC_MSG_CHECKING([for NPP_GetMIMEDescription return type]) - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([[ - #define XP_UNIX - #include - const char* NPP_GetMIMEDescription(void) { return "foo"; } - ]])], - [AC_MSG_RESULT([const char*])], - [ - AC_MSG_RESULT([char*]) - HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=TRUE - ]) - CFLAGS=$save_CFLAGS - AC_LANG_POP([C]) - NPAPI_HEADERS_CFLAGS=$(printf '%s' "$NPAPI_HEADERS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g") -else - AC_MSG_RESULT([internal]) - dnl ...but will not be built/used unless ENABLE_NPAPI_FROM_BROWSER - SYSTEM_NPAPI_HEADERS= -fi -AC_SUBST(NPAPI_HEADERS_CFLAGS) -AC_SUBST(SYSTEM_NPAPI_HEADERS) -AC_SUBST(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION) - dnl =================================================================== dnl Check for system sane dnl =================================================================== @@ -9211,23 +9154,6 @@ else fi AC_SUBST(ENABLE_HARFBUZZ) -dnl =================================================================== -dnl Check for NPAPI interface to plug browser plugins into LibreOffice documents -dnl =================================================================== -AC_MSG_CHECKING([whether to plug browser plugins into LibreOffice documents]) -# Obviously no such thing on iOS or Android. Also not possible when building -# 64-bit OS X code as the plugin code uses QuickTime and Carbon. -if test "$_os" != Android -a "$_os" != iOS -a $_os != Darwin -a \ - "$with_x" != "no" -a "$enable_mpl_subset" != yes -then - AC_MSG_RESULT([yes]) - ENABLE_NPAPI_FROM_BROWSER=TRUE -else - AC_MSG_RESULT([no]) - ENABLE_NPAPI_FROM_BROWSER= -fi -AC_SUBST(ENABLE_NPAPI_FROM_BROWSER) - AC_MSG_CHECKING([whether to use X11]) dnl *************************************** dnl testing for X libraries and includes... @@ -9263,10 +9189,6 @@ if test "$USING_X11" = TRUE; then AC_CHECK_HEADERS(X11/Composite.h,[],[AC_MSG_ERROR([Xt headers not found])], [#include ]) - # ENABLE_NPAPI_FROM_BROWSER requires Xt library - AC_CHECK_LIB([Xt], [XtToolkitInitialize], [:], - [AC_MSG_ERROR(Xt library not found)]) - dnl =================================================================== dnl Check for extension headers dnl =================================================================== diff --git a/extensions/Executable_pluginapp.bin.mk b/extensions/Executable_pluginapp.bin.mk deleted file mode 100644 index 96a25cca4c4d..000000000000 --- a/extensions/Executable_pluginapp.bin.mk +++ /dev/null @@ -1,69 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# - -$(eval $(call gb_Executable_Executable,pluginapp.bin)) - -$(eval $(call gb_Executable_use_external,pluginapp.bin,npapi_headers)) - -$(eval $(call gb_Executable_set_include,pluginapp.bin,\ - $$(INCLUDE) \ - -I$(SRCDIR)/extensions/source/plugin/inc \ -)) - -$(eval $(call gb_Executable_use_sdk_api,pluginapp.bin)) - -$(eval $(call gb_Executable_add_exception_objects,pluginapp.bin,\ - extensions/source/plugin/unx/npwrap \ - extensions/source/plugin/unx/npnapi \ -)) - -$(eval $(call gb_Executable_use_static_libraries,pluginapp.bin,\ - plugcon \ -)) - -$(eval $(call gb_Executable_use_libraries,pluginapp.bin,\ - sal \ -)) - -ifeq ($(filter-out FREEBSD NETBSD OPENBSD DRAGONFLY,$(OS)),) -$(eval $(call gb_Executable_add_libs,pluginapp.bin,\ - -lXt \ - -lXext \ - -lX11 \ -)) -else ifeq ($(OS),AIX) -$(eval $(call gb_Executable_add_libs,pluginapp.bin,\ - -lXpm \ - -lXmu \ - -lXt \ - -lXext \ - -lX11 \ - -ldl \ -)) -else -$(eval $(call gb_Executable_add_libs,pluginapp.bin,\ - -lXt \ - -lXext \ - -lX11 \ - -ldl \ -)) -endif - - -ifeq ($(ENABLE_GTK),TRUE) -$(eval $(call gb_Executable_use_externals,pluginapp.bin,\ - gthread \ - gtk \ -)) - -endif - -# vim:set noet sw=4 ts=4: diff --git a/extensions/Library_pl.mk b/extensions/Library_pl.mk deleted file mode 100644 index 82a71d6bcdbe..000000000000 --- a/extensions/Library_pl.mk +++ /dev/null @@ -1,120 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# - -$(eval $(call gb_Library_Library,pl)) - -$(eval $(call gb_Library_set_componentfile,pl,extensions/source/plugin/pl)) - -$(eval $(call gb_Library_use_externals,pl,\ - boost_headers \ - npapi_headers \ -)) - -$(eval $(call gb_Library_set_include,pl,\ - $$(INCLUDE) \ - -I$(SRCDIR)/extensions/source/plugin/inc \ -)) - -$(eval $(call gb_Library_use_sdk_api,pl)) - -ifeq ($(ENABLE_JAVA),TRUE) -$(eval $(call gb_Library_add_defs,pl,\ - -DOJI \ -)) - -endif # ENABLE_JAVA=YES - -ifeq ($(OS),SOLARIS) -$(eval $(call gb_Library_add_libs,pl,\ - -lsocket \ -)) -endif # OS=SOLARIS - -ifeq ($(OS),WNT) -$(eval $(call gb_Library_use_system_win32_libs,pl,\ - advapi32 \ - ole32 \ - version \ -)) - -$(eval $(call gb_Library_add_exception_objects,pl,\ - extensions/source/plugin/win/winmgr \ - extensions/source/plugin/win/sysplug \ -)) - -else ifeq ($(OS),MACOSX) - -$(eval $(call gb_Library_add_objcxxobjects,pl,\ - extensions/source/plugin/aqua/macmgr \ - extensions/source/plugin/aqua/sysplug \ -)) - -$(eval $(call gb_Library_use_system_darwin_frameworks,pl,\ - Cocoa \ - Carbon \ - CoreFoundation \ -)) - -else - -ifeq ($(ENABLE_GTK),TRUE) -$(eval $(call gb_Library_add_defs,pl,\ - -DENABLE_GTK \ -)) - -$(eval $(call gb_Library_use_external,pl,gtk)) -endif # ENABLE_GTK=TRUE - -$(eval $(call gb_Library_add_exception_objects,pl,\ - extensions/source/plugin/unx/nppapi \ - extensions/source/plugin/unx/sysplug \ - extensions/source/plugin/unx/unxmgr \ -)) - -$(eval $(call gb_Library_use_static_libraries,pl,\ - plugcon \ -)) - -$(eval $(call gb_Library_add_libs,pl,\ - -lX11 \ -)) - -endif - -$(eval $(call gb_Library_use_libraries,pl,\ - tk \ - vcl \ - svl \ - utl \ - tl \ - comphelper \ - ucbhelper \ - cppuhelper \ - cppu \ - sal \ - salhelper \ - $(gb_UWINAPI) \ -)) - -$(eval $(call gb_Library_add_exception_objects,pl,\ - extensions/source/plugin/base/context \ - extensions/source/plugin/base/evtlstnr \ - extensions/source/plugin/base/manager \ - extensions/source/plugin/base/multiplx \ - extensions/source/plugin/base/nfuncs \ - extensions/source/plugin/base/plcom \ - extensions/source/plugin/base/plctrl \ - extensions/source/plugin/base/plmodel \ - extensions/source/plugin/base/service \ - extensions/source/plugin/base/xplugin \ -)) - -# vim:set noet sw=4 ts=4: diff --git a/extensions/Module_extensions.mk b/extensions/Module_extensions.mk index fa527f5f1364..f5a27bf301b6 100644 --- a/extensions/Module_extensions.mk +++ b/extensions/Module_extensions.mk @@ -94,23 +94,6 @@ endif # DISABLE_ATL endif # WNT -ifeq ($(ENABLE_NPAPI_FROM_BROWSER),TRUE) - -$(eval $(call gb_Module_add_targets,extensions,\ - Library_pl \ -)) - -ifneq ($(OS),WNT) -ifneq ($(OS),MACOSX) -$(eval $(call gb_Module_add_targets,extensions,\ - StaticLibrary_plugcon \ - Executable_pluginapp.bin \ -)) -endif -endif - -endif # ENABLE_NPAPI_FROM_BROWSER=TRUE - ifeq ($(OS),MACOSX) $(eval $(call gb_Module_add_targets,extensions,\ Library_OOoSpotlightImporter \ diff --git a/extensions/StaticLibrary_plugcon.mk b/extensions/StaticLibrary_plugcon.mk deleted file mode 100644 index 149e86b05925..000000000000 --- a/extensions/StaticLibrary_plugcon.mk +++ /dev/null @@ -1,61 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# - -ifeq ($(OS),WNT) -$(error only for UNX) -endif - -$(eval $(call gb_StaticLibrary_StaticLibrary,plugcon)) - -$(eval $(call gb_StaticLibrary_use_externals,plugcon,\ - boost_headers \ - npapi_headers \ -)) - -$(eval $(call gb_StaticLibrary_set_include,plugcon,\ - $$(INCLUDE) \ - -I$(SRCDIR)/extensions/source/plugin/inc \ -)) - -$(eval $(call gb_StaticLibrary_use_api,plugcon,\ - offapi \ - udkapi \ -)) - -ifeq ($(ENABLE_JAVA),TRUE) -$(eval $(call gb_StaticLibrary_add_defs,plugcon,\ - -DOJI \ -)) - -endif # ENABLE_JAVA=YES - -ifeq ($(ENABLE_GTK),TRUE) -$(eval $(call gb_StaticLibrary_add_defs,plugcon,\ - -DENABLE_GTK \ -)) - -$(eval $(call gb_StaticLibrary_use_external,plugcon,gtk)) - -# Gtk uses cairo, and if we build internal cairo, the linker could -# pick up our cairo libs before they're fully ready, causing problems -# (e.g. using our libpixman and system libcairo). Depend on cairo -# to delay build until cairo is done. -ifeq ($(SYSTEM_CAIRO),) -$(eval $(call gb_StaticLibrary_use_external,plugcon,cairo)) -endif -endif # ENABLE_GTK=TRUE - -$(eval $(call gb_StaticLibrary_add_exception_objects,plugcon,\ - extensions/source/plugin/unx/mediator \ - extensions/source/plugin/unx/plugcon \ -)) - -# vim:set noet sw=4 ts=4: - diff --git a/extensions/source/plugin/aqua/macmgr.mm b/extensions/source/plugin/aqua/macmgr.mm deleted file mode 100644 index 878571a9377e..000000000000 --- a/extensions/source/plugin/aqua/macmgr.mm +++ /dev/null @@ -1,654 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "rtl/ustrbuf.hxx" -#include "rtl/strbuf.hxx" - -#include "plugin/impl.hxx" -#include "osl/file.h" -#include "osl/module.hxx" - -using namespace std; -using namespace com::sun::star::uno; -using namespace com::sun::star::plugin; - -using ::rtl::OUString; -using ::rtl::OString; -using ::rtl::OUStringBuffer; -using ::rtl::OStringBuffer; -using ::rtl::OUStringToOString; -using ::rtl::OStringToOUString; - -namespace plugstringhelper -{ - -rtl::OUString getString( CFStringRef i_xString ) -{ - rtl::OUStringBuffer aBuf; - if( i_xString ) - { - CFIndex nChars = CFStringGetLength( i_xString ); - CFRange aRange = { 0, nChars }; - aBuf.setLength( nChars ); - CFStringGetCharacters( i_xString, aRange, static_cast< UniChar* >(const_cast(aBuf.getStr())) ); - } - return aBuf.makeStringAndClear(); -} - -rtl::OUString getString( CFURLRef i_xURL ) -{ - CFStringRef xString = CFURLGetString( i_xURL ); - return getString( xString ); -} - -CFMutableStringRef createString( const rtl::OUString& i_rString ) -{ - CFMutableStringRef xString = CFStringCreateMutable( NULL, 0 ); - if( xString ) - CFStringAppendCharacters( xString, i_rString.getStr(), i_rString.getLength() ); - return xString; -} - -CFURLRef createURL( const rtl::OUString& i_rString ) -{ - - CFMutableStringRef xMutableString = createString( i_rString ); - CFURLRef xURL = CFURLCreateWithString( NULL, xMutableString, NULL ); - CFRelease( xMutableString ); - return xURL; -} - -rtl::OUString getURLFromPath( const rtl::OUString& i_rPath ) -{ - CFMutableStringRef xMutableString = createString( i_rPath ); - CFURLRef xURL = CFURLCreateWithFileSystemPath( NULL, xMutableString, kCFURLPOSIXPathStyle, true ); - CFRelease( xMutableString ); - CFStringRef xString = CFURLGetString( xURL ); - rtl::OUString aRet = getString( xString ); - CFRelease( xURL ); - return aRet; -} - -CFURLRef createURLFromPath( const rtl::OUString& i_rPath ) -{ - CFMutableStringRef xMutableString = createString( i_rPath ); - CFURLRef xURL = CFURLCreateWithFileSystemPath( NULL, xMutableString, kCFURLPOSIXPathStyle, true ); - return xURL; -} - -rtl::OUString CFURLtoOSLURL( CFURLRef i_xURL ) -{ - // make URL absolute - CFURLRef xAbsURL = CFURLCopyAbsoluteURL( i_xURL ); - // copy system path - CFStringRef xSysPath = CFURLCopyFileSystemPath( xAbsURL ? xAbsURL : i_xURL, kCFURLPOSIXPathStyle ); - if( xAbsURL ) - CFRelease( xAbsURL ); - rtl::OUString aSysPath( getString( xSysPath ) ); - CFRelease( xSysPath ); - rtl::OUString aFileURL; - osl_getFileURLFromSystemPath( aSysPath.pData, &aFileURL.pData ); - return aFileURL; -} - -} - -using namespace plugstringhelper; - -static int parsePlist( CFBundleRef i_xBundle, const rtl::OUString& i_rBundleURL , list< PluginDescription* >& io_rDescriptions ) -{ - CFTypeRef xMimeDict = CFBundleGetValueForInfoDictionaryKey( i_xBundle, CFSTR("WebPluginMIMETypes")); - int nMimetypes = 0; - if( xMimeDict == 0 || - CFGetTypeID(xMimeDict) != CFDictionaryGetTypeID() || - (nMimetypes = CFDictionaryGetCount( static_cast(xMimeDict))) <= 0 ) - { - return 0; - } - - // prepare an array of key and value refs - std::vector< CFTypeRef > aKeys( nMimetypes, CFTypeRef(NULL) ); - std::vector< CFTypeRef > aValues( nMimetypes, CFTypeRef(NULL) ); - CFDictionaryGetKeysAndValues(static_cast(xMimeDict), &aKeys[0], &aValues[0] ); - - int nAdded = 0; - for( int i = 0; i < nMimetypes; i++ ) - { - // get the mimetype - CFTypeRef xKey = aKeys[i]; - if( ! xKey || CFGetTypeID(xKey) != CFStringGetTypeID() ) - continue; - rtl::OUString aMimetype = getString( (CFStringRef)xKey ); - - // the correspoding value should be a dictionary - CFTypeRef xDict = aValues[i]; - if( ! xDict || CFGetTypeID( xDict ) != CFDictionaryGetTypeID() ) - continue; - - // get the extension list - CFTypeRef xExtArray = CFDictionaryGetValue( (CFDictionaryRef)xDict, CFSTR("WebPluginExtensions" ) ); - if( !xExtArray || CFGetTypeID( xExtArray ) != CFArrayGetTypeID() ) - continue; - - OUStringBuffer aExtBuf; - int nExtensions = CFArrayGetCount( (CFArrayRef)xExtArray ); - for( int n = 0; n < nExtensions; n++ ) - { - CFTypeRef xExt = CFArrayGetValueAtIndex( (CFArrayRef)xExtArray, n ); - if( xExt && CFGetTypeID( xExt ) == CFStringGetTypeID() ) - { - if( aExtBuf.getLength() > 0 ) - aExtBuf.append( sal_Unicode(';') ); - OUString aExt( getString( (CFStringRef)xExt ) ); - if( aExt.indexOfAsciiL( "*.", 2 ) != 0 ) - aExtBuf.appendAscii( "*." ); - aExtBuf.append( aExt ); - } - } - - // get the description string - CFTypeRef xDescString = CFDictionaryGetValue( (CFDictionaryRef)xDict, CFSTR("WebPluginTypeDescription" ) ); - if( !xDescString || CFGetTypeID( xDescString ) != CFStringGetTypeID() ) - continue; - rtl::OUString aDescription = getString( (CFStringRef)xDescString ); - - PluginDescription* pNew = new PluginDescription; - // set plugin name (path to library) - pNew->PluginName = i_rBundleURL; - // set mimetype - pNew->Mimetype = aMimetype; - // set extension line - pNew->Extension = aExtBuf.makeStringAndClear(); - // set description - pNew->Description= aDescription; - - io_rDescriptions.push_back( pNew ); - nAdded++; - -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, - "Inserting from PList:\n" - " Mimetype: %s\n" - " Extension: %s\n" - " Description: %s\n", - OUStringToOString( pNew->Mimetype, RTL_TEXTENCODING_UTF8 ).getStr(), - OUStringToOString( pNew->Extension, RTL_TEXTENCODING_UTF8 ).getStr(), - OUStringToOString( pNew->Description, RTL_TEXTENCODING_UTF8 ).getStr() - ); -#endif - - } - - return nAdded; -} - -static int parseMimeString( const rtl::OUString& i_rBundleURL , list< PluginDescription* >& io_rDescriptions, const char* i_pMime ) -{ - if( ! i_pMime ) - return 0; - - rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); - - OStringBuffer aMIME; - aMIME.append( i_pMime ); - - if( aMIME.getLength() < 1 ) - return 0; - - OString aLine = aMIME.makeStringAndClear(); - - int nAdded = 0; - sal_Int32 nIndex = 0; - while( nIndex != -1 ) - { - OString aType = aLine.getToken( 0, ';', nIndex ); - - sal_Int32 nTypeIndex = 0; - OString aMimetype = aType.getToken( 0, ':', nTypeIndex ); - OString aExtLine = aType.getToken( 0, ':', nTypeIndex ); - if( nTypeIndex < 0 ) // ensure at least three tokens - continue; - OString aDesc = aType.getToken( 0, ':', nTypeIndex ); - - // create extension list string - sal_Int32 nExtIndex = 0; - OStringBuffer aExtension; - while( nExtIndex != -1 ) - { - OString aExt = aExtLine.getToken( 0, ',', nExtIndex); - if( aExt.indexOf( "*." ) != 0 ) - aExtension.append( "*." ); - aExtension.append( aExt ); - if( nExtIndex != -1 ) - aExtension.append( ';' ); - } - - PluginDescription* pNew = new PluginDescription; - // set plugin name (path to library) - pNew->PluginName = i_rBundleURL; - // set mimetype - pNew->Mimetype = OStringToOUString( aMimetype, aEncoding ); - // set extension line - pNew->Extension = OStringToOUString( aExtension.makeStringAndClear(), aEncoding ); - // set description - pNew->Description= OStringToOUString( aDesc, aEncoding ); - io_rDescriptions.push_back( pNew ); - nAdded++; - -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, - "Inserting from mime string:\n" - " Mimetype: %s\n" - " Extension: %s\n" - " Description: %s\n", - OUStringToOString( pNew->Mimetype, aEncoding ).getStr(), - OUStringToOString( pNew->Extension, aEncoding ).getStr(), - OUStringToOString( pNew->Description, aEncoding ).getStr() - ); -#endif - } - return nAdded; -} - -// this is so ugly it you want to tear your eyes out -static rtl::OUString GetNextPluginStringFromHandle(Handle h, short *index) -{ - char* pPascalBytes = (*h + *index); - sal_uInt32 nLen = (unsigned char)pPascalBytes[0]; - rtl::OStringBuffer aBuf( nLen ); - aBuf.append( pPascalBytes+1, nLen ); - *index += nLen + 1; - return rtl::OStringToOUString( aBuf.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ); -} - -static int parseMimeResource( CFBundleRef i_xBundle, - oslModule& i_rMod, - const rtl::OUString& i_rBundleURL, - list< PluginDescription* >& io_rDescriptions ) -{ - int nAdded = 0; - // just to hurt our eyes more there is an alternative mimetype function plus the possibility - // of a resource fork. Must be a case of think different. - #if defined __LP64__ - int - #else - SInt16 - #endif - xRes = 0; - BPSupportedMIMETypes aMIMETypesStrangeStruct = {kBPSupportedMIMETypesStructVers_1, NULL, NULL}; - - BP_GetSupportedMIMETypesUPP pBPGetSupp = (BP_GetSupportedMIMETypesUPP)osl_getAsciiFunctionSymbol( i_rMod, "BP_GetSupportedMIMETypes" ); - if( pBPGetSupp && - noErr == pBPGetSupp( &aMIMETypesStrangeStruct, 0 ) && - aMIMETypesStrangeStruct.typeStrings ) - { - HLock( aMIMETypesStrangeStruct.typeStrings ); - if( aMIMETypesStrangeStruct.infoStrings ) // it's possible some plugins have infoStrings missing - HLock( aMIMETypesStrangeStruct.infoStrings ); - } - else // Try to get data from the resource fork - { - xRes = CFBundleOpenBundleResourceMap( i_xBundle ); - if( xRes > 0 ) - { - aMIMETypesStrangeStruct.typeStrings = Get1Resource('STR#', 128); - if( aMIMETypesStrangeStruct.typeStrings ) - { - DetachResource( aMIMETypesStrangeStruct.typeStrings ); - HLock( aMIMETypesStrangeStruct.typeStrings ); - aMIMETypesStrangeStruct.infoStrings = Get1Resource('STR#', 127); - if( aMIMETypesStrangeStruct.infoStrings ) - { - DetachResource( aMIMETypesStrangeStruct.infoStrings ); - HLock( aMIMETypesStrangeStruct.infoStrings ); - } - } - } - } - - if( aMIMETypesStrangeStruct.typeStrings && aMIMETypesStrangeStruct.infoStrings ) - { - short nVariantCount = (**(short**)aMIMETypesStrangeStruct.typeStrings) / 2; - // Fill in the info struct based on the data in the BPSupportedMIMETypes struct - // this is an array of pascal string of unknown (!) encoding - // whoever thought of this deserves a fair beating - short mimeIndex = 2; - short descriptionIndex = 2; - for( int i = 0; i < nVariantCount; i++ ) - { - rtl::OUString aMimetype = GetNextPluginStringFromHandle( aMIMETypesStrangeStruct.typeStrings, &mimeIndex ); - rtl::OUString aExtLine = GetNextPluginStringFromHandle( aMIMETypesStrangeStruct.typeStrings, &mimeIndex ); - rtl::OUString aDescription; - if( aMIMETypesStrangeStruct.infoStrings ) - aDescription = GetNextPluginStringFromHandle( aMIMETypesStrangeStruct.infoStrings, &descriptionIndex ); - - // create extension list string - sal_Int32 nExtIndex = 0; - OUStringBuffer aExtension; - while( nExtIndex != -1 ) - { - OUString aExt = aExtLine.getToken( 0, ',', nExtIndex); - if( aExt.indexOfAsciiL( "*.", 2 ) != 0 ) - aExtension.appendAscii( "*." ); - aExtension.append( aExt ); - if( nExtIndex != -1 ) - aExtension.append( sal_Unicode(';') ); - } - - PluginDescription* pNew = new PluginDescription; - // set plugin name (path to library) - pNew->PluginName = i_rBundleURL; - // set mimetype - pNew->Mimetype = aMimetype; - // set extension line - pNew->Extension = aExtension.makeStringAndClear(); - // set description - pNew->Description= aDescription; - io_rDescriptions.push_back( pNew ); - nAdded++; - - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, - "Inserting from resource:\n" - " Mimetype: %s\n" - " Extension: %s\n" - " Description: %s\n", - OUStringToOString( pNew->Mimetype, RTL_TEXTENCODING_UTF8 ).getStr(), - OUStringToOString( pNew->Extension, RTL_TEXTENCODING_UTF8 ).getStr(), - OUStringToOString( pNew->Description, RTL_TEXTENCODING_UTF8 ).getStr() - ); - #endif - } - } - - - // clean up - if( aMIMETypesStrangeStruct.typeStrings ) - { - HUnlock( aMIMETypesStrangeStruct.typeStrings ); - DisposeHandle( aMIMETypesStrangeStruct.typeStrings ); - } - if( aMIMETypesStrangeStruct.infoStrings ) - { - HUnlock( aMIMETypesStrangeStruct.infoStrings ); - DisposeHandle( aMIMETypesStrangeStruct.infoStrings ); - } - if( xRes ) - CFBundleCloseBundleResourceMap( i_xBundle, xRes ); - - return nAdded; -} - -// check some known bad plugins to avoid crashes -static bool checkBlackList( CFBundleRef i_xBundle ) -{ - rtl::OUString aBundleName; - CFTypeRef bundlename = CFBundleGetValueForInfoDictionaryKey( i_xBundle, CFSTR("CFBundleName")); - if( bundlename && CFGetTypeID(bundlename) == CFStringGetTypeID() ) - aBundleName = getString( static_cast(bundlename) ); - - rtl::OUString aBundleVersion; - CFTypeRef bundleversion = CFBundleGetValueForInfoDictionaryKey( i_xBundle, CFSTR("CFBundleVersion")); - if( bundleversion && CFGetTypeID(bundleversion) == CFStringGetTypeID() ) - aBundleVersion = getString( static_cast(bundleversion) ); - - bool bReject = false; - // #i102735# VLC plugin prior to 1.0 tends to crash - if( aBundleName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "VLC Plug-in" ) ) ) - { - sal_Int32 nIndex = 0; - rtl::OUString aMajor( aBundleVersion.getToken( 0, '.', nIndex ) ); - if( aMajor.toInt32() < 1 ) - { - bReject = true; - } - } - // #i103674# Garmin Communicator Plugin crashes - else if( aBundleName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Garmin Communicator Plugin" ) ) ) - { - bReject = true; - } - - #if OSL_DEBUG_LEVEL > 1 - if( bReject ) - fprintf( stderr, "rejecting plugin \"%s\" version %s\n", - rtl::OUStringToOString( aBundleName, RTL_TEXTENCODING_UTF8 ).getStr(), - rtl::OUStringToOString( aBundleVersion, RTL_TEXTENCODING_UTF8 ).getStr() - ); - #endif - - return bReject; -} - -static int getPluginDescriptions( CFBundleRef i_xBundle , list< PluginDescription* >& io_rDescriptions ) -{ - int nDescriptions = 0; - if( ! i_xBundle ) - return nDescriptions; - - if( checkBlackList( i_xBundle ) ) - return 0; - - rtl::OUString aPlugURL; - CFURLRef xURL = CFBundleCopyBundleURL( i_xBundle ); - aPlugURL = getString( xURL ); - CFRelease( xURL ); - - #if OSL_DEBUG_LEVEL > 1 - rtl::OUString aPlugName, aPlugDescription; - CFTypeRef name = CFBundleGetValueForInfoDictionaryKey( i_xBundle, CFSTR("WebPluginName")); - if( name && CFGetTypeID(name) == CFStringGetTypeID() ) - aPlugName = getString( static_cast(name) ); - - CFTypeRef description = CFBundleGetValueForInfoDictionaryKey( i_xBundle, CFSTR("WebPluginDescription")); - if( description && CFGetTypeID(description) == CFStringGetTypeID() ) - aPlugDescription = getString( static_cast(description) ); - - fprintf( stderr, "URL: %s\nname: %s\ndescription: %s\n", - rtl::OUStringToOString( aPlugURL, RTL_TEXTENCODING_UTF8 ).getStr(), - rtl::OUStringToOString( aPlugName, RTL_TEXTENCODING_UTF8 ).getStr(), - rtl::OUStringToOString( aPlugDescription, RTL_TEXTENCODING_UTF8 ).getStr() - ); - #endif - - - // get location of plugin library - CFURLRef xLibURL = CFBundleCopyExecutableURL( i_xBundle ); - if( ! xLibURL ) - return 0; - // get the file system path - rtl::OUString aModuleURL( CFURLtoOSLURL( xLibURL ) ); - CFRelease( xLibURL ); - - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "exec URL = %s\n", rtl::OUStringToOString( aModuleURL, RTL_TEXTENCODING_UTF8 ).getStr() ); - #endif - - /* TODO: originally the C++ wrapper for oslModule was used here, but that led to - mysterious crashes in the event loop (pointing to heap corruption). Why using - the C style oslModule should fix this is completely unknown. It may be that - we have just hidden the heap corruption a little more. - */ - oslModule aMod = osl_loadModule( aModuleURL.pData, SAL_LOADMODULE_DEFAULT ); - if( ! aMod ) - return 0; - - // check for at least the init function of a plugin - if( ! osl_getAsciiFunctionSymbol( aMod, "NP_Initialize") && - ! osl_getAsciiFunctionSymbol( aMod, "NP_GetEntryPoints" ) ) - { - return 0; - } - - // ask the plist of the bundle for mimetypes - nDescriptions = parsePlist( i_xBundle, aPlugURL, io_rDescriptions ); - if( nDescriptions ) - { - osl_unloadModule( aMod ); - return nDescriptions; - } - - // resolve the symbol that might get us the mimetypes - const char* (*pGetMimeDescription)() = (const char*(*)())osl_getAsciiFunctionSymbol( aMod, "_NP_GetMIMEDescription" ); - if( pGetMimeDescription ) - { - const char* pMime = pGetMimeDescription(); - if( pMime ) - { - nDescriptions = parseMimeString( aPlugURL, io_rDescriptions, pMime ); - if( nDescriptions ) - { - osl_unloadModule( aMod ); - return nDescriptions; - } - } - } - - // and as last resort check the resource of the bundle - nDescriptions = parseMimeResource( i_xBundle, aMod, aPlugURL, io_rDescriptions ); - osl_unloadModule( aMod ); - - return nDescriptions; -} - -// Unix specific implementation -static bool CheckPlugin( const rtl::OUString& rPath, list< PluginDescription* >& rDescriptions ) -{ -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "Trying path %s ... ", rtl::OUStringToOString( rPath, RTL_TEXTENCODING_UTF8 ).getStr() ); -#endif - CFURLRef xURL = createURL( rPath ); - - CFArrayRef xBundles = CFBundleCreateBundlesFromDirectory( NULL, xURL, CFSTR("plugin") ); - if( ! xBundles ) - return false; - - CFIndex nBundles = CFArrayGetCount( xBundles ); - -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "got %d bundles\n", (int)nBundles ); -#endif - - int nDescriptions = 0; - for( CFIndex i = 0; i < nBundles; i++ ) - { - CFBundleRef xBundle = (CFBundleRef)CFArrayGetValueAtIndex( xBundles, i ); - nDescriptions += getPluginDescriptions( xBundle, rDescriptions ); - - CFRelease( xBundle ); - } - CFRelease( xBundles ); - - - return nDescriptions > 0; -} - -static rtl::OUString FindFolderURL( FSVolumeRefNum vRefNum, OSType folderType ) -{ - rtl::OUString aRet; - - FSRef aFSRef; - OSErr err = FSFindFolder( vRefNum, folderType, kDontCreateFolder, &aFSRef ); - if( err == noErr ) - { - CFURLRef xURL = CFURLCreateFromFSRef( NULL, &aFSRef ); - aRet = getString( xURL ); - CFRelease( xURL ); - } - - return aRet; -} - -Sequence XPluginManager_Impl::impl_getPluginDescriptions() throw(css::uno::RuntimeException, std::exception) -{ - static Sequence aDescriptions; - static sal_Bool bHavePlugins = sal_False; - if( ! bHavePlugins ) - { - std::list aPlugins; - - static const char* pNPXPluginPath = getenv( "MOZ_PLUGIN_PATH" ); - - // get directories - std::list< rtl::OUString > aPaths; - if( pNPXPluginPath ) - { - CFMutableStringRef xMutableString = CFStringCreateMutable( NULL, 0 ); - CFStringAppendCString( xMutableString, pNPXPluginPath, kCFStringEncodingUTF8 ); - CFURLRef xURL = CFURLCreateWithFileSystemPath( NULL, xMutableString, kCFURLPOSIXPathStyle, true ); - CFRelease( xMutableString ); - aPaths.push_back( getString( xURL ) ); - CFRelease( xURL ); - } - - rtl::OUString aPath = FindFolderURL( kUserDomain, kInternetPlugInFolderType ); - if( aPath.getLength() ) - aPaths.push_back( aPath ); - aPath = FindFolderURL( kLocalDomain, kInternetPlugInFolderType ); - if( aPath.getLength() ) - aPaths.push_back( aPath ); - aPath = FindFolderURL( kOnAppropriateDisk, kInternetPlugInFolderType ); - if( aPath.getLength() ) - aPaths.push_back( aPath ); - - - const Sequence< ::rtl::OUString >& rPaths( PluginManager::getAdditionalSearchPaths() ); - for( sal_Int32 i = 0; i < rPaths.getLength(); i++ ) - { - aPaths.push_back( getURLFromPath( rPaths.getConstArray()[i] ) ); - } - - for( std::list< rtl::OUString >::const_iterator it = aPaths.begin(); it != aPaths.end(); ++it ) - { - rtl::OUString aPath( *it ); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "check path %s\n", rtl::OUStringToOString( *it, RTL_TEXTENCODING_UTF8 ).getStr() ); -#endif - CheckPlugin( aPath, aPlugins ); - } - - - // create return value - aDescriptions = Sequence( aPlugins.size() ); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "found %d plugins\n", (int)aPlugins.size() ); -#endif - list::iterator iter; - sal_Int32 nPlug = 0; - for( iter = aPlugins.begin(); iter != aPlugins.end(); ++iter ) - { - aDescriptions.getArray()[ nPlug++ ] = **iter; - delete *iter; - } - aPlugins.clear(); - bHavePlugins = sal_True; - } - return aDescriptions; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/aqua/sysplug.mm b/extensions/source/plugin/aqua/sysplug.mm deleted file mode 100644 index a9b54a8ec2e1..000000000000 --- a/extensions/source/plugin/aqua/sysplug.mm +++ /dev/null @@ -1,882 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - -#include - -#include -#include -#include - -#include "premac.h" -#include -#include "postmac.h" - -#include - -#include - -extern NPNetscapeFuncs aNPNFuncs; - -#include - -using namespace plugstringhelper; - -using ::rtl::OUString; -using ::rtl::OUStringToOString; - -#if OSL_DEBUG_LEVEL > 1 -void TRACE( char const * s ); -void TRACEN( char const * s, long n ); -#else -#define TRACE(x) -#define TRACEN(x,n) -#endif - - -struct SysPlugData -{ - MacPluginComm::NP_CGContext m_aCGContext; - NP_Port m_aNPPort; - NSView* m_pParentView; - NSView* m_pPlugView; - int m_nDrawingModel; - NSPoint m_aLastPlugViewOrigin; - bool m_bSetWindowOnDraw; - SysPlugData() - { - memset( this, 0, sizeof(*this) ); - } -}; - -std::shared_ptr CreateSysPlugData() -{ - return std::shared_ptr(new SysPlugData); -} - -void XPlugin_Impl::SetSysPlugDataParentView(SystemEnvData const& rEnvData) -{ - m_pSysPlugData->m_pParentView = rEnvData.mpNSView; -} - -extern "C" { - -void /*SAL_CALL NP_LOADDS*/ NPN_ForceRedraw_Impl(NPP instance) -{ - TRACE( "NPN_ForceRedraw_Impl" ); - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - if( pImpl ) - { - SysPlugData& rPlugData( pImpl->getSysPlugData() ); - if( rPlugData.m_pPlugView ) - [rPlugData.m_pPlugView setNeedsDisplay: YES]; - } -} - -NPError /*SAL_CALL NP_LOADDS*/ NPN_SetValue_Impl( NPP instance, - NPPVariable variable, - void* value ) -{ - TRACE( "NPN_SetValue_Impl" ); - switch( variable ) - { - case (NPPVariable)1000: // NPNVpluginDrawingModel - { - // ugly, but that's the way we need to do it - int nDrawingModel = (int)value; - - TRACEN( "drawing model: ", nDrawingModel ); - XPlugin_Impl* pImpl = - XPluginManager_Impl::getXPluginFromNPP( instance ); - if (pImpl) - pImpl->getSysPlugData().m_nDrawingModel = nDrawingModel; - } - break; - default: - break; - } - return NPERR_NO_ERROR; -} - -} // extern "C" - -struct FakeEventRecord : public EventRecord -{ - FakeEventRecord() - { - memset( this, 0, sizeof(EventRecord) ); - ::GetGlobalMouse( &where ); - when = ::TickCount(); - modifiers = ::GetCurrentEventKeyModifiers(); - } -}; - - -@interface OOoPluginView : NSView -{ - XPlugin_Impl* m_pImpl; - MacPluginComm* m_pCom; -} --(id)initWithInstance: (XPlugin_Impl*)i_pImpl pluginComm: (MacPluginComm*)i_pCom frame: (NSRect)i_aRect; --(void)drawRect: (NSRect)i_aRect; --(BOOL)isOpaque; --(BOOL)isFlipped; - -// NSResponder --(void)mouseMoved: (NSEvent*)i_pEvent; --(void)mouseDown: (NSEvent*)i_pEvent; --(void)mouseDragged: (NSEvent*)i_pEvent; --(void)mouseUp: (NSEvent*)i_pEvent; --(void)rightMouseDown: (NSEvent*)i_pEvent; --(void)rightMouseDragged: (NSEvent*)i_pEvent; --(void)rightMouseUp: (NSEvent*)i_pEvent; --(void)otherMouseDown: (NSEvent*)i_pEvent; --(void)otherMouseDragged: (NSEvent*)i_pEvent; --(void)otherMouseUp: (NSEvent*)i_pEvent; --(void)mouseEntered: (NSEvent*)i_pEvent; --(void)mouseExited: (NSEvent*)i_pEvent; -@end - -@implementation OOoPluginView --(id)initWithInstance: (XPlugin_Impl*)i_pImpl pluginComm: (MacPluginComm*)i_pCom frame: (NSRect) i_aRect -{ - if( (self = [super initWithFrame: i_aRect]) ) - { - m_pImpl = i_pImpl; - m_pCom = i_pCom; - } - return self; -} - --(void)drawRect: (NSRect) i_aRect -{ - (void) i_aRect; // unused - m_pCom->drawView( m_pImpl ); -} - --(BOOL)isOpaque -{ - return NO; -} - --(BOOL)isFlipped -{ - return YES; -} - -// NSResponder --(void)mouseMoved: (NSEvent*)i_pEvent -{ - (void) i_pEvent; // unused - FakeEventRecord aRec; - aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent - m_pCom->NPP_HandleEvent( &m_pImpl->getNPPInstance(), &aRec ); -} - --(void)mouseDown: (NSEvent*)i_pEvent -{ - (void) i_pEvent; // unused - FakeEventRecord aRec; - aRec.what = mouseDown; - m_pCom->NPP_HandleEvent( &m_pImpl->getNPPInstance(), &aRec ); -} - --(void)mouseDragged: (NSEvent*)i_pEvent -{ - (void) i_pEvent; // unused - FakeEventRecord aRec; - aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent - m_pCom->NPP_HandleEvent( &m_pImpl->getNPPInstance(), &aRec ); -} - --(void)mouseUp: (NSEvent*)i_pEvent -{ - (void) i_pEvent; // unused - FakeEventRecord aRec; - aRec.what = mouseUp; - m_pCom->NPP_HandleEvent( &m_pImpl->getNPPInstance(), &aRec ); -} - --(void)rightMouseDown: (NSEvent*)i_pEvent -{ - (void) i_pEvent; // unused - FakeEventRecord aRec; - aRec.what = mouseDown; - m_pCom->NPP_HandleEvent( &m_pImpl->getNPPInstance(), &aRec ); -} - --(void)rightMouseDragged: (NSEvent*)i_pEvent -{ - (void) i_pEvent; // unused - FakeEventRecord aRec; - aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent - m_pCom->NPP_HandleEvent( &m_pImpl->getNPPInstance(), &aRec ); -} - --(void)rightMouseUp: (NSEvent*)i_pEvent -{ - (void) i_pEvent; // unused - FakeEventRecord aRec; - aRec.what = mouseUp; - m_pCom->NPP_HandleEvent( &m_pImpl->getNPPInstance(), &aRec ); -} - --(void)otherMouseDown: (NSEvent*)i_pEvent -{ - (void) i_pEvent; // unused - FakeEventRecord aRec; - aRec.what = mouseDown; - m_pCom->NPP_HandleEvent( &m_pImpl->getNPPInstance(), &aRec ); -} - --(void)otherMouseDragged: (NSEvent*)i_pEvent -{ - (void) i_pEvent; // unused - FakeEventRecord aRec; - aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent - m_pCom->NPP_HandleEvent( &m_pImpl->getNPPInstance(), &aRec ); -} - --(void)otherMouseUp: (NSEvent*)i_pEvent -{ - (void) i_pEvent; // unused - FakeEventRecord aRec; - aRec.what = mouseUp; - m_pCom->NPP_HandleEvent( &m_pImpl->getNPPInstance(), &aRec ); -} - --(void)mouseEntered: (NSEvent*)i_pEvent -{ - (void) i_pEvent; // unused - FakeEventRecord aRec; - aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent - m_pCom->NPP_HandleEvent( &m_pImpl->getNPPInstance(), &aRec ); -} - --(void)mouseExited: (NSEvent*)i_pEvent -{ - (void) i_pEvent; // unused - FakeEventRecord aRec; - aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent - m_pCom->NPP_HandleEvent( &m_pImpl->getNPPInstance(), &aRec ); -} - -@end - - -MacPluginComm::MacPluginComm( const rtl::OUString& i_rMimetype, const rtl::OUString& i_rBundle, NSView* i_pParent ) - : PluginComm( OUStringToOString( i_rBundle, RTL_TEXTENCODING_UTF8 ) ), - m_xBundle( NULL ), - m_hPlugLib( NULL ), - m_pNullTimer( NULL ) -{ - (void) i_rMimetype; // unused - (void) i_pParent; // unused - // initialize plugin function table - memset( &m_aNPPfuncs, 0, sizeof( m_aNPPfuncs ) ); - - // load the bundle - CFURLRef xURL = createURL( i_rBundle ); - m_xBundle = CFBundleCreate( NULL, xURL ); - CFRelease( xURL ); - if( m_xBundle ) - { - // ask the plugin library - // first get its location - CFURLRef xLibURL = CFBundleCopyExecutableURL( m_xBundle ); - if( xLibURL ) - { - // get the file system path - rtl::OUString aModuleURL( CFURLtoOSLURL( xLibURL ) ); - CFRelease( xLibURL ); - m_hPlugLib = osl_loadModule( aModuleURL.pData, SAL_LOADMODULE_DEFAULT ); - #if OSL_DEBUG_LEVEL > 1 - if( ! m_hPlugLib ) - fprintf( stderr, "module %s could not be loaded\n", OUStringToOString( aModuleURL, RTL_TEXTENCODING_UTF8 ).getStr() ); - #endif - } - #if OSL_DEBUG_LEVEL > 1 - else - fprintf( stderr, "bundle %s has no exectutable URL\n", OUStringToOString( i_rBundle, RTL_TEXTENCODING_UTF8 ).getStr() ); - #endif - } - else - { - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "bundle %s could not be loaded\n", OUStringToOString( i_rBundle, RTL_TEXTENCODING_UTF8 ).getStr() ); - #endif - } - - DBG_ASSERT( m_xBundle && m_hPlugLib, "loading plugin bundle failed!" ); - - - m_aNPPfuncs.size = sizeof( m_aNPPfuncs ); - m_aNPPfuncs.version = 0; - - - m_eCall = eNP_Initialize; - execute(); -} - - -MacPluginComm::~MacPluginComm() -{ - if( m_hPlugLib ) - { - // NPP_Shutdown(); - NPError (*pShutdown)(); - if( retrieveFunction( "NP_Shutdown", (void**)&pShutdown ) ) - { - NPError nErr = (*pShutdown)(); (void)nErr; - DBG_ASSERT( nErr == NPERR_NO_ERROR, "NP_Shutdown() failed!" ); - } - osl_unloadModule( m_hPlugLib ); - } - if( m_xBundle ) - CFRelease( m_xBundle ); -} - - -sal_Bool MacPluginComm::retrieveFunction( const char* i_pName, void** o_ppFunc ) const -{ - if( ! m_hPlugLib || ! o_ppFunc ) - return sal_False; - - *o_ppFunc = (void*)osl_getAsciiFunctionSymbol( m_hPlugLib, i_pName ); - - if( ! *o_ppFunc && m_xBundle ) - { - rtl::OUString aName( OUString::createFromAscii( *i_pName == '_' ? i_pName+1 : i_pName ) ); - CFStringRef xName = createString( aName ); - if( xName ) - { - *o_ppFunc = CFBundleGetFunctionPointerForName( m_xBundle, xName ); - CFRelease( xName ); - } - } - - return (*o_ppFunc != NULL); -} - -IMPL_LINK_NOARG_TYPED(MacPluginComm, NullTimerHdl, Timer*, void) -{ - // note: this is a Timer handler, we are already protected by the SolarMutex - - FakeEventRecord aRec; - aRec.what = nullEvent; - aRec.where.h = aRec.where.v = 20000; - - for( std::list< XPlugin_Impl* >::iterator it = m_aNullEventClients.begin(); - it != m_aNullEventClients.end(); ++it ) - { - SysPlugData& rPlugData( (*it)->getSysPlugData() ); - if( rPlugData.m_pPlugView ) // for safety do not dispatch null events before first NPP_SetWindow - (*m_aNPPfuncs.event)( &(*it)->getNPPInstance(), &aRec ); - } -} - - - -long MacPluginComm::doIt() -{ - long nRet = 0; - switch( m_eCall ) - { - case eNP_Initialize: - { - TRACE( "eNP_Initialize" ); - NPError (*pInit)( NPNetscapeFuncs* ); - if( retrieveFunction( "NP_Initialize", (void**)&pInit ) ) - { - nRet = (*pInit)( &aNPNFuncs ); - - NPError nErr = NPERR_NO_ERROR; - NPError (*pEntry)( NPPluginFuncs* ); - retrieveFunction( "NP_GetEntryPoints", (void**)&pEntry ); - nErr = (*pEntry)( &m_aNPPfuncs ); - - DBG_ASSERT( nErr == NPERR_NO_ERROR, "NP_GetEntryPoints() failed!" ); - } - else - { - nRet = NPERR_GENERIC_ERROR; - } - DBG_ASSERT( nRet == NPERR_NO_ERROR, "### NP_Initialize() failed!" ); - } - break; - case eNPP_Destroy: - if( m_aNullEventClients.empty() ) - delete m_pNullTimer, m_pNullTimer = NULL; - - TRACE( "eNPP_Destroy" ); - nRet = (m_aNPPfuncs.destroy - ? (*m_aNPPfuncs.destroy)( - (NPP)m_aArgs[0], - (NPSavedData**)m_aArgs[1] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_DestroyStream: - TRACE( "eNPP_DestroyStream" ); - nRet = (m_aNPPfuncs.destroystream - ? (*m_aNPPfuncs.destroystream)( - (NPP)m_aArgs[0], - (NPStream*)m_aArgs[1], - (NPError)(sal_IntPtr)m_aArgs[2] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_New: - TRACE( "eNPP_New" ); - nRet = (m_aNPPfuncs.newp - ? (*m_aNPPfuncs.newp)( - (NPMIMEType)m_aArgs[0], - (NPP)m_aArgs[1], - (uint16_t)(sal_IntPtr)m_aArgs[2], - (int16_t)(sal_IntPtr)m_aArgs[3], - (char**)m_aArgs[4], - (char**)m_aArgs[5], - (NPSavedData*)m_aArgs[6] ) - : NPERR_GENERIC_ERROR); - - if( ! m_pNullTimer && m_aNPPfuncs.event ) - { - m_pNullTimer = new AutoTimer(); - m_pNullTimer->SetTimeout( 50 ); - m_pNullTimer->SetTimeoutHdl( LINK( this, MacPluginComm, NullTimerHdl ) ); - m_pNullTimer->Start(); - } - - break; - case eNPP_NewStream: - TRACE( "eNPP_NewStream" ); - nRet = (m_aNPPfuncs.newstream - ? (*m_aNPPfuncs.newstream)( - (NPP)m_aArgs[0], - (NPMIMEType)m_aArgs[1], - (NPStream*)m_aArgs[2], - (NPBool)(sal_IntPtr)m_aArgs[3], - (uint16_t*)m_aArgs[4] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_Print: - TRACE( "eNPP_Print" ); - if (m_aNPPfuncs.print) - (*m_aNPPfuncs.print)( - (NPP)m_aArgs[0], - (NPPrint*)m_aArgs[1] ); - break; - case eNPP_SetWindow: - { - TRACE( "eNPP_SetWindow" ); - nRet = (m_aNPPfuncs.setwindow - ? (*m_aNPPfuncs.setwindow)( - (NPP)m_aArgs[0], - (NPWindow*)m_aArgs[1] ) - : NPERR_GENERIC_ERROR); - - break; - } - case eNPP_HandleEvent: - { - TRACE( "eNPP_HandleEvent" ); - nRet = (m_aNPPfuncs.event - ? (*m_aNPPfuncs.event)( - (NPP)m_aArgs[0], - m_aArgs[1] ) - : NPERR_GENERIC_ERROR); - - break; - } - case eNPP_StreamAsFile: - TRACE( "eNPP_StreamAsFile" ); - if (m_aNPPfuncs.asfile) - (*m_aNPPfuncs.asfile)( - (NPP)m_aArgs[0], - (NPStream*)m_aArgs[1], - (char*)m_aArgs[2] ); - break; - case eNPP_URLNotify: - TRACE( "eNPP_URLNotify" ); - if (m_aNPPfuncs.urlnotify) - (*m_aNPPfuncs.urlnotify)( - (NPP)m_aArgs[0], - (char*)m_aArgs[1], - (NPReason)(sal_IntPtr)m_aArgs[2], - m_aArgs[3] ); - break; - case eNPP_Write: - TRACEN( "eNPP_Write n=", (int32_t)m_aArgs[3] ); - nRet = (m_aNPPfuncs.write - ? (*m_aNPPfuncs.write)( - (NPP)m_aArgs[0], - (NPStream*)m_aArgs[1], - (int32_t)m_aArgs[2], - (int32_t)m_aArgs[3], - m_aArgs[4] ) - : 0); - break; - case eNPP_WriteReady: - TRACE( "eNPP_WriteReady" ); - nRet = (m_aNPPfuncs.writeready - ? (*m_aNPPfuncs.writeready)( - (NPP)m_aArgs[0], - (NPStream*)m_aArgs[1] ) - : 0); - break; - case eNPP_GetValue: - TRACE( "eNPP_GetValue" ); - nRet = (m_aNPPfuncs.getvalue - ? (*m_aNPPfuncs.getvalue)( - (NPP)m_aArgs[0], - (NPPVariable)(int)m_aArgs[1], - m_aArgs[2] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_SetValue: - TRACE( "eNPP_SetValue" ); - nRet = (m_aNPPfuncs.setvalue - ? (*m_aNPPfuncs.setvalue)( - (NPP)m_aArgs[0], - (NPNVariable)(int)m_aArgs[1], - m_aArgs[2] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_Shutdown: - { - TRACE( "eNPP_Shutdown" ); - NPP_ShutdownUPP pFunc; - if (retrieveFunction( "NPP_Shutdown", (void**)&pFunc )) - (*pFunc)(); - } - break; - case eNPP_Initialize: - TRACE( "eNPP_Initialize" ); - OSL_FAIL( "NPP_Initialize: not implemented!" ); - break; - case eNPP_GetJavaClass: - TRACE( "eNPP_GetJavaClass" ); - OSL_FAIL( "NPP_GetJavaClass: not implemented!" ); - break; - } - return nRet; -} - - -NPError MacPluginComm::NPP_Destroy( XPlugin_Impl* i_pImpl, NPSavedData** save ) -{ - // remove from NullEvent timer - m_aNullEventClients.remove( i_pImpl ); - - NPError nErr = NPP_Destroy( &i_pImpl->getNPPInstance(), save ); - - // release plugin view - SysPlugData& rPlugData( i_pImpl->getSysPlugData() ); - if( rPlugData.m_pPlugView ) - { - [rPlugData.m_pPlugView removeFromSuperview]; - [rPlugData.m_pPlugView release]; - rPlugData.m_pPlugView = nil; - } - - return nErr; -} - - -NPError MacPluginComm::NPP_Destroy( NPP instance, NPSavedData** save ) -{ - DBG_ASSERT( m_aNPPfuncs.destroy, "### NPP_Destroy(): null pointer in NPP functions table!" ); - m_eCall = eNPP_Destroy; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)save; - return (NPError)execute(); -} - - -NPError MacPluginComm::NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason ) -{ - DBG_ASSERT( m_aNPPfuncs.destroystream, "### NPP_DestroyStream(): null pointer in NPP functions table!" ); - m_eCall = eNPP_DestroyStream; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)stream; - m_aArgs[2] = (void*)(intptr_t)reason; - return (NPError)execute(); -} - - -NPError MacPluginComm::NPP_New( NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, - char* argn[], char* argv[], NPSavedData *saved ) -{ - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - DBG_ASSERT( pImpl, "no instance found" ); - - if( pImpl ) // sanity check - m_aNullEventClients.push_back( pImpl ); - - DBG_ASSERT( m_aNPPfuncs.newp, "### NPP_New(): null pointer in NPP functions table!" ); - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "NPP_New( %s. %p, %d, %d", - pluginType, instance, (int)mode, (int)argc ); - for( int16_t i = 0; i < argc; i++ ) - fprintf( stderr, "\n%s = %s", argn[i], argv[i] ); - fprintf( stderr, ", %p )\n", saved ); - #endif - m_eCall = eNPP_New; - m_aArgs[0] = (void*)pluginType; - m_aArgs[1] = (void*)instance; - m_aArgs[2] = (void*)(intptr_t)mode; - m_aArgs[3] = (void*)(intptr_t)argc; - m_aArgs[4] = (void*)argn; - m_aArgs[5] = (void*)argv; - m_aArgs[6] = (void*)saved; - - return (NPError)execute(); -} - - -NPError MacPluginComm::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream, - NPBool seekable, uint16_t* stype ) -{ - DBG_ASSERT( m_aNPPfuncs.newstream, "### NPP_NewStream(): null pointer in NPP functions table!" ); - m_eCall = eNPP_NewStream; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)type; - m_aArgs[2] = (void*)stream; - m_aArgs[3] = (void*)(intptr_t)seekable; - m_aArgs[4] = (void*)stype; - return (NPError)execute(); -} - - -void MacPluginComm::NPP_Print( NPP instance, NPPrint* platformPrint ) -{ - DBG_ASSERT( m_aNPPfuncs.print, "### NPP_Print(): null pointer in NPP functions table!" ); - m_eCall = eNPP_Print; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)platformPrint; - execute(); -} - - -NPError MacPluginComm::NPP_SetWindow( NPP instance, NPWindow* window ) -{ - DBG_ASSERT( m_aNPPfuncs.setwindow, "### NPP_SetWindow(): null pointer in NPP functions table!" ); - m_eCall = eNPP_SetWindow; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)window; - return (NPError)execute(); -} - - -NPError MacPluginComm::NPP_HandleEvent( NPP instance, void* event ) -{ - DBG_ASSERT( m_aNPPfuncs.event, "### NPP_HandleEvent(): null pointer in NPP functions table!" ); - m_eCall = eNPP_HandleEvent; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = event; - return (NPError)execute(); -} - - -void MacPluginComm::NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname ) -{ - DBG_ASSERT( m_aNPPfuncs.asfile, "### NPP_StreamAsFile(): null pointer in NPP functions table!" ); - m_eCall = eNPP_StreamAsFile; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)stream; - m_aArgs[2] = (void*)fname; - execute(); -} - - -void MacPluginComm::NPP_URLNotify( NPP instance, const char* url, NPReason reason, void* notifyData ) -{ - DBG_ASSERT( m_aNPPfuncs.urlnotify, "### NPP_URLNotify(): null pointer in NPP functions table!" ); - m_eCall = eNPP_URLNotify; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)url; - m_aArgs[2] = (void*)(intptr_t)reason; - m_aArgs[3] = notifyData; - execute(); -} - - -int32_t MacPluginComm::NPP_Write( NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer ) -{ - DBG_ASSERT( m_aNPPfuncs.write, "### NPP_Write(): null pointer in NPP functions table!" ); - m_eCall = eNPP_Write; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)stream; - m_aArgs[2] = (void*)offset; - m_aArgs[3] = (void*)len; - m_aArgs[4] = buffer; - return (NPError)execute(); -} - - -int32_t MacPluginComm::NPP_WriteReady( NPP instance, NPStream* stream ) -{ - DBG_ASSERT( m_aNPPfuncs.writeready, "### NPP_WriteReady(): null pointer in NPP functions table!" ); - m_eCall = eNPP_WriteReady; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)stream; - return execute(); -} - - -NPError MacPluginComm::NPP_GetValue( NPP instance, NPPVariable variable, void *ret_value ) -{ - DBG_ASSERT( m_aNPPfuncs.getvalue, "### NPP_GetValue(): null pointer in NPP functions table!" ); - m_eCall = eNPP_GetValue; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)variable; - m_aArgs[2] = ret_value; - return (NPError)execute(); -} - - -NPError MacPluginComm::NPP_Initialize() -{ - return NPERR_NO_ERROR; -} - - -void MacPluginComm::NPP_Shutdown() -{ - m_eCall = eNPP_Shutdown; - execute(); -} - - -NPError MacPluginComm::NPP_SetWindow( XPlugin_Impl* i_pImpl ) -{ - // update window NPWindow from view - SysPlugData& rPlugData( i_pImpl->getSysPlugData() ); - - // update plug view - NSRect aPlugRect = [rPlugData.m_pParentView frame]; - aPlugRect.origin.x = aPlugRect.origin.y = 0; - if( ! rPlugData.m_pPlugView ) - { - rPlugData.m_pPlugView = [[OOoPluginView alloc] initWithInstance: i_pImpl pluginComm: this frame: aPlugRect]; - [rPlugData.m_pParentView addSubview: rPlugData.m_pPlugView]; - } - else - [rPlugData.m_pPlugView setFrame: aPlugRect]; - - NPWindow* pNPWin = &i_pImpl->getNPWindow(); - NSWindow* pWin = [rPlugData.m_pPlugView window]; - NSRect aWinRect = [pWin frame]; - NSRect aBounds = [rPlugData.m_pPlugView frame]; - NSRect aVisibleBounds = [rPlugData.m_pPlugView visibleRect]; - - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "visible bounds = %d+%d+%dx%d\n", - (int)aVisibleBounds.origin.x, (int)aVisibleBounds.origin.y, - (int)aVisibleBounds.size.width, (int)aVisibleBounds.size.height ); - #endif - - NSPoint aViewOrigin = [rPlugData.m_pPlugView convertPoint: NSZeroPoint toView: nil]; - // save view origin so we can notice movement of the view in drawView - // in case of a moved view we need to reset the port/context - rPlugData.m_aLastPlugViewOrigin = aViewOrigin; - - // convert view origin to topdown coordinates - aViewOrigin.y = aWinRect.size.height - aViewOrigin.y; - - // same for clipping - NSPoint aClipOrigin = [rPlugData.m_pPlugView convertPoint: aVisibleBounds.origin toView: nil]; - aClipOrigin.y = aWinRect.size.height - aClipOrigin.y; - - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "view origin: %d+%d, clip origin = %d+%d\n", - (int)aViewOrigin.x, (int)aViewOrigin.y, - (int)aClipOrigin.x, (int)aClipOrigin.y ); - #endif - - pNPWin->x = aViewOrigin.x; - pNPWin->y = aViewOrigin.y; - pNPWin->width = aBounds.size.width; - pNPWin->height = aBounds.size.height; - pNPWin->clipRect.left = aClipOrigin.x; - pNPWin->clipRect.top = aClipOrigin.y; - pNPWin->clipRect.right = aClipOrigin.x + aVisibleBounds.size.width; - pNPWin->clipRect.bottom = aClipOrigin.y + aVisibleBounds.size.height; - - if( rPlugData.m_nDrawingModel == 1 ) - { - rPlugData.m_aCGContext.window = reinterpret_cast([pWin windowRef]); - pNPWin->window = &rPlugData.m_aCGContext; - rPlugData.m_aCGContext.context = reinterpret_cast([[pWin graphicsContext] graphicsPort]); - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "window is %p, context is %p\n", - rPlugData.m_aCGContext.window, rPlugData.m_aCGContext.context ); - #endif - } - else - { - rPlugData.m_aNPPort.port = GetWindowPort( reinterpret_cast([pWin windowRef]) ); - rPlugData.m_aNPPort.portx = aClipOrigin.x; - rPlugData.m_aNPPort.porty = aClipOrigin.y; - pNPWin->window = &rPlugData.m_aNPPort; - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "port is %p at (%d,%d)\n", - rPlugData.m_aNPPort.port, (int)rPlugData.m_aNPPort.portx, (int)rPlugData.m_aNPPort.porty ); - #endif - } - - if( pNPWin->width == 0 || pNPWin->height == 0 || [rPlugData.m_pPlugView isHiddenOrHasHiddenAncestor] ) - rPlugData.m_bSetWindowOnDraw = true; - - NPError nErr = NPP_SetWindow( &i_pImpl->getNPPInstance(), &i_pImpl->getNPWindow() ); - - return nErr; -} - -void MacPluginComm::drawView( XPlugin_Impl* i_pImpl ) -{ - SysPlugData& rPlugData( i_pImpl->getSysPlugData() ); - - // check if the view was moved since the last SetWindow - NSPoint aViewOrigin = [rPlugData.m_pPlugView convertPoint: NSZeroPoint toView: nil]; - if( rPlugData.m_bSetWindowOnDraw || - aViewOrigin.x != rPlugData.m_aLastPlugViewOrigin.x || - aViewOrigin.y != rPlugData.m_aLastPlugViewOrigin.y ) - { - NPP_SetWindow( i_pImpl ); - rPlugData.m_bSetWindowOnDraw = false; - } - - // send a paint event - NSWindow* pWin = [rPlugData.m_pPlugView window]; - FakeEventRecord aRec; - aRec.what = updateEvt; - aRec.message = (uint32_t)[pWin windowRef]; - this->NPP_HandleEvent( &i_pImpl->getNPPInstance(), &aRec ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/context.cxx b/extensions/source/plugin/base/context.cxx deleted file mode 100644 index 478562aa7035..000000000000 --- a/extensions/source/plugin/base/context.cxx +++ /dev/null @@ -1,345 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#ifdef WNT -#include -#include -#endif - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace com::sun::star::io; -using namespace com::sun::star::frame; - -namespace ext_plug { - -class FileSink : public ::cppu::WeakAggImplHelper1< css::io::XOutputStream > -{ -private: - Reference< css::uno::XComponentContext > m_xContext; - FILE* fp; - Reference< css::plugin::XPlugin > m_xPlugin; - OUString m_aTarget; - OUString m_aFileName; - -public: - FileSink( const Reference< css::uno::XComponentContext > &, - const Reference< css::plugin::XPlugin > & plugin, - const OUString& target, - const Reference< css::io::XActiveDataSource > & source ); - virtual ~FileSink(); - - // css::io::XOutputStream - virtual void SAL_CALL writeBytes( const Sequence& ) throw(std::exception) override; - virtual void SAL_CALL flush() throw(std::exception) override; - virtual void SAL_CALL closeOutput() throw (RuntimeException, std::exception) override; -}; - -} -using namespace ext_plug; - -class XPluginContext_Impl : public ::cppu::WeakAggImplHelper1< css::plugin::XPluginContext > -{ - Reference< css::uno::XComponentContext > m_xContext; - rtl_TextEncoding m_aEncoding; -public: - - XPluginContext_Impl( const Reference< css::uno::XComponentContext > & ); - virtual ~XPluginContext_Impl(); - - - virtual OUString SAL_CALL getValue(const Reference< css::plugin::XPlugin > & plugin, css::plugin::PluginVariable variable) throw( css::plugin::PluginException, RuntimeException, std::exception ) override; - virtual void SAL_CALL getURLNotify(const Reference< css::plugin::XPlugin > & plugin, const OUString& url, const OUString& target, const Reference< css::lang::XEventListener > & listener) throw( css::plugin::PluginException, RuntimeException, std::exception ) override; - virtual void SAL_CALL getURL(const Reference< css::plugin::XPlugin > & plugin, const OUString& url, const OUString& target) throw( css::plugin::PluginException, RuntimeException, std::exception ) override; - virtual void SAL_CALL postURLNotify(const Reference< css::plugin::XPlugin > & plugin, const OUString& url, const OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file, const Reference< css::lang::XEventListener > & listener) throw( css::plugin::PluginException, RuntimeException, std::exception ) override; - virtual void SAL_CALL postURL(const Reference< css::plugin::XPlugin > & plugin, const OUString& url, const OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file) throw( css::plugin::PluginException, RuntimeException, std::exception ) override; - virtual void SAL_CALL newStream(const Reference< css::plugin::XPlugin > & plugin, const OUString& mimetype, const OUString& target, const Reference< css::io::XActiveDataSource > & source) throw( css::plugin::PluginException, RuntimeException, std::exception ) override; - virtual void SAL_CALL displayStatusText(const Reference< css::plugin::XPlugin > & plugin, const OUString& message) throw( css::plugin::PluginException, RuntimeException, std::exception ) override; - virtual OUString SAL_CALL getUserAgent(const Reference< css::plugin::XPlugin > & plugin) throw( css::plugin::PluginException, RuntimeException, std::exception ) override; -}; - -Reference< css::plugin::XPluginContext > XPluginManager_Impl::createPluginContext() throw(std::exception) -{ - return new XPluginContext_Impl( m_xContext ); -} - -XPluginContext_Impl::XPluginContext_Impl( const Reference< css::uno::XComponentContext > & rxContext ) - : m_xContext( rxContext ), - m_aEncoding( osl_getThreadTextEncoding() ) -{ -} - -XPluginContext_Impl::~XPluginContext_Impl() -{ -} - -OUString XPluginContext_Impl::getValue( const Reference< css::plugin::XPlugin > & /*plugin*/, css::plugin::PluginVariable /*variable*/ ) - throw( css::plugin::PluginException, RuntimeException, std::exception ) -{ - return OUString(); -} - - -void XPluginContext_Impl::getURL(const Reference< css::plugin::XPlugin > & plugin, const OUString& url, const OUString& target) throw( css::plugin::PluginException, RuntimeException, std::exception ) -{ - Reference< XDesktop2 > xDesktop = Desktop::create(m_xContext); - - if( target.isEmpty() ) - { - INetURLObject aURL; - aURL.SetSmartProtocol( INetProtocol::File ); - aURL.SetSmartURL( url ); - - OUString aUrl = aURL.GetMainURL(INetURLObject::DECODE_TO_IURI); - // the mimetype cannot be specified - plugin->provideNewStream( OUString(), - Reference< XActiveDataSource >(), - aUrl, - 0, 0, comphelper::isFileUrl(aUrl) ); - return; - } - - XPlugin_Impl* pPlugin = XPluginManager_Impl::getPluginImplementation( plugin ); - - if( pPlugin ) - { - try - { - css::beans::PropertyValue aValue; - aValue.Name = "Referer"; - aValue.Value <<= pPlugin->getRefererURL(); - - Sequence< css::beans::PropertyValue > aArgs( &aValue, 1 ); - Reference< css::lang::XComponent > xComp = - xDesktop->loadComponentFromURL( - url, - target, - css::frame::FrameSearchFlag::PARENT | - css::frame::FrameSearchFlag::SELF | - css::frame::FrameSearchFlag::CHILDREN | - css::frame::FrameSearchFlag::SIBLINGS | - css::frame::FrameSearchFlag::TASKS | - css::frame::FrameSearchFlag::CREATE, - aArgs - ); - } - catch(...) - { - throw css::plugin::PluginException(); - } - } -} - -void XPluginContext_Impl::getURLNotify(const Reference< css::plugin::XPlugin > & plugin, const OUString& url, const OUString& target, const Reference< css::lang::XEventListener > & listener ) - throw( css::plugin::PluginException, RuntimeException, std::exception ) -{ - getURL( plugin, url, target ); - if( listener.is() ) - listener->disposing( css::lang::EventObject() ); -} - -OUString XPluginContext_Impl::getUserAgent(const Reference< css::plugin::XPlugin > & /*plugin*/) - throw( css::plugin::PluginException, RuntimeException, std::exception ) -{ - return OUString("Mozilla 3.0"); -} - -void XPluginContext_Impl::displayStatusText(const Reference< css::plugin::XPlugin > & /*plugin*/, const OUString& /*message*/) - throw( css::plugin::PluginException, RuntimeException, std::exception ) -{ -} - -void XPluginContext_Impl::postURL(const Reference< css::plugin::XPlugin > & plugin, const OUString& url, const OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file) - throw( css::plugin::PluginException, RuntimeException, std::exception ) -{ - Sequence< sal_Int8 > aBuf; - - if( file ) - { - OUString aFileName( reinterpret_cast(buf.getConstArray()), strlen(reinterpret_cast(buf.getConstArray())), m_aEncoding ); - INetURLObject aFilePath( aFileName ); - aFileName = aFilePath.PathToFileName(); - SvFileStream aStream( aFileName, StreamMode::READ ); - if( aStream.IsOpen() ) - { - sal_Int64 const nBytes = aStream.remainingSize(); - aBuf = Sequence( nBytes ); - aStream.Read( aBuf.getArray(), nBytes ); - aStream.Close(); - osl::FileBase::getFileURLFromSystemPath( aFileName, aFileName ); - osl::File::remove( aFileName ); - } - } - - Reference< XDesktop2 > xDesktop = Desktop::create(m_xContext); - - XPlugin_Impl* pPlugin = XPluginManager_Impl::getPluginImplementation( plugin ); - if( pPlugin ) - { - try - { - css::beans::PropertyValue aValues[2]; - aValues[0].Name = "Referer"; - aValues[0].Value <<= pPlugin->getRefererURL(); - - aValues[1].Name = "PostString"; - aValues[1].Value <<= OStringToOUString( reinterpret_cast(( file ? aBuf : buf ).getConstArray()), m_aEncoding ); - Sequence< css::beans::PropertyValue > aArgs( aValues, 2 ); - Reference< css::lang::XComponent > xComp = - xDesktop->loadComponentFromURL( - url, - target, - css::frame::FrameSearchFlag::PARENT | - css::frame::FrameSearchFlag::SELF | - css::frame::FrameSearchFlag::CHILDREN | - css::frame::FrameSearchFlag::SIBLINGS | - css::frame::FrameSearchFlag::TASKS | - css::frame::FrameSearchFlag::CREATE, - aArgs - ); - } - catch( ... ) - { - throw css::plugin::PluginException(); - } - } -} - -void XPluginContext_Impl::postURLNotify(const Reference< css::plugin::XPlugin > & plugin, const OUString& url, const OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file, const Reference< css::lang::XEventListener > & listener ) - throw( css::plugin::PluginException, RuntimeException, std::exception ) -{ - postURL( plugin, url, target, buf, file ); - if( listener.is() ) - listener->disposing( css::lang::EventObject() ); -} - -void XPluginContext_Impl::newStream( const Reference< css::plugin::XPlugin > & plugin, const OUString&, const OUString& target, const Reference< css::io::XActiveDataSource > & source ) - throw( css::plugin::PluginException, RuntimeException, std::exception ) -{ - FileSink* pNewSink = new FileSink( m_xContext, plugin, target, source ); - pNewSink->acquire(); -} - - - -FileSink::FileSink( const Reference< css::uno::XComponentContext > & rxContext, const Reference< css::plugin::XPlugin > & plugin, - const OUString& target, const Reference< css::io::XActiveDataSource > & source ) : - m_xContext( rxContext ), - m_xPlugin( plugin ), - m_aTarget( target ) -{ - osl::FileBase::createTempFile( nullptr, nullptr, &m_aFileName ); - OString aFile = OUStringToOString( m_aFileName, osl_getThreadTextEncoding() ); - fp = fopen( aFile.getStr() , "wb" ); - - Reference< css::io::XActiveDataControl > xControl( source, UNO_QUERY ); - - source->setOutputStream( Reference< css::io::XOutputStream > ( this ) ); - if( xControl.is() ) - xControl->start(); -} - -FileSink::~FileSink() -{ - osl::File::remove( m_aFileName ); -} - -void FileSink::closeOutput() throw (RuntimeException, std::exception) -{ - if( fp ) - fclose( fp ); - - Reference< XDesktop2 > xDesktop = Desktop::create(m_xContext); - XPlugin_Impl* pPlugin = XPluginManager_Impl::getPluginImplementation( m_xPlugin ); - - if( pPlugin ) - { - try - { - css::beans::PropertyValue aValue; - aValue.Name = "Referer"; - aValue.Value <<= pPlugin->getRefererURL(); - - Sequence< css::beans::PropertyValue > aArgs( &aValue, 1 ); - Reference< css::lang::XComponent > xComp = - xDesktop->loadComponentFromURL( - m_aFileName, - m_aTarget, - css::frame::FrameSearchFlag::PARENT | - css::frame::FrameSearchFlag::SELF | - css::frame::FrameSearchFlag::CHILDREN | - css::frame::FrameSearchFlag::SIBLINGS | - css::frame::FrameSearchFlag::TASKS | - css::frame::FrameSearchFlag::CREATE, - aArgs - ); - } - catch( ... ) - { - } - } - release(); -} - -void FileSink::writeBytes( const Sequence& Buffer ) throw(std::exception) -{ - if( fp ) - { - size_t nItems = Buffer.getLength(); - bool bSuccess = (fwrite(Buffer.getConstArray(), 1, nItems, fp) == nItems); - SAL_WARN_IF( !bSuccess, "extensions.plugin", "short write"); - } -} - -void FileSink::flush() throw(std::exception) -{ - if( fp ) - fflush( fp ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/evtlstnr.cxx b/extensions/source/plugin/base/evtlstnr.cxx deleted file mode 100644 index ef865fdf6d04..000000000000 --- a/extensions/source/plugin/base/evtlstnr.cxx +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#ifdef WNT -#include -#include -#endif - -#include - -#include - -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 css::lang::EventObject& /*rEvt*/ ) throw(std::exception) -{ - m_pPlugin->getPluginComm()-> - NPP_URLNotify( &m_pPlugin->getNPPInstance(), - m_pUrl, - NPRES_DONE, - m_pNotifyData ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/manager.cxx b/extensions/source/plugin/base/manager.cxx deleted file mode 100644 index 21e354242acb..000000000000 --- a/extensions/source/plugin/base/manager.cxx +++ /dev/null @@ -1,234 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#ifdef WNT -#include -#include -#endif - -#include - -#include -#include -#include - -#include "plugin/impl.hxx" - -#include "osl/mutex.hxx" -#include "unotools/pathoptions.hxx" -#include "vcl/configsettings.hxx" - -#include "com/sun/star/container/XEnumerationAccess.hpp" -#include "com/sun/star/container/XNameAccess.hpp" -#include "com/sun/star/container/XEnumeration.hpp" -#include "com/sun/star/container/XElementAccess.hpp" -#include "com/sun/star/container/XIndexAccess.hpp" -#include "com/sun/star/loader/XImplementationLoader.hpp" - -#include - -PluginManager* PluginManager::pManager = nullptr; - -PluginManager& PluginManager::get() -{ - if( ! pManager ) - pManager = new PluginManager(); - return *pManager; -} - -void PluginManager::setServiceFactory( const Reference< css::lang::XMultiServiceFactory >& xFactory ) -{ - PluginManager& rManager = get(); - if( ! rManager.m_xSMgr.is() ) - rManager.m_xSMgr = xFactory; -} - -PluginManager::PluginManager() -{ -} - -const Sequence< OUString >& PluginManager::getAdditionalSearchPaths() -{ - static Sequence< OUString > aPaths; - - if( ! aPaths.getLength() ) - { - SvtPathOptions aOptions; - OUString aPluginPath( aOptions.GetPluginPath() ); - if( !aPluginPath.isEmpty() ) - { - sal_Int32 nPaths = comphelper::string::getTokenCount(aPluginPath, ';'); - aPaths.realloc( nPaths ); - for( sal_Int32 i = 0; i < nPaths; i++ ) - aPaths.getArray()[i] = aPluginPath.getToken(i, ';'); - } - } - - return aPaths; -} - - -Reference< XInterface > SAL_CALL PluginManager_CreateInstance( const Reference< css::lang::XMultiServiceFactory > & rSMgr ) throw( Exception ) -{ - Reference< XInterface > xService = *new XPluginManager_Impl( comphelper::getComponentContext(rSMgr) ); - return xService; -} - -// css::lang::XServiceInfo -OUString XPluginManager_Impl::getImplementationName() throw( ) - -{ - return getImplementationName_Static(); - -} - -// css::lang::XServiceInfo -sal_Bool XPluginManager_Impl::supportsService(const OUString& ServiceName) throw( ) -{ - return cppu::supportsService(this, ServiceName); -} - -// css::lang::XServiceInfo -Sequence< OUString > XPluginManager_Impl::getSupportedServiceNames() throw( ) -{ - return getSupportedServiceNames_Static(); -} - -// XPluginManager_Impl -Sequence< OUString > XPluginManager_Impl::getSupportedServiceNames_Static() throw( ) -{ - Sequence aSNS { "com.sun.star.plugin.PluginManager" }; - return aSNS; -} - -XPluginManager_Impl::XPluginManager_Impl( const Reference< css::uno::XComponentContext > & rxContext ) -: m_xContext( rxContext ) -{ - PluginManager::setServiceFactory( Reference< css::lang::XMultiServiceFactory>(rxContext->getServiceManager(), UNO_QUERY_THROW) ); -} - -XPluginManager_Impl::~XPluginManager_Impl() -{ -} - -XPlugin_Impl* XPluginManager_Impl::getXPluginFromNPP( NPP instance ) -{ - ::std::list::iterator iter; - for( iter = PluginManager::get().getPlugins().begin(); - iter != PluginManager::get().getPlugins().end(); ++iter ) - { - if( &(*iter)->getNPPInstance() == instance ) - return *iter; - } - - return nullptr; -} - -XPlugin_Impl* XPluginManager_Impl::getPluginImplementation( const Reference< css::plugin::XPlugin >& plugin ) -{ - ::std::list::iterator iter; - for( iter = PluginManager::get().getPlugins().begin(); - iter != PluginManager::get().getPlugins().end(); ++iter ) - { - if( plugin == Reference< css::plugin::XPlugin >((*iter)) ) - return *iter; - } - - return nullptr; -} - -Sequence XPluginManager_Impl::getPluginDescriptions() - throw (RuntimeException, std::exception) -{ - Sequence aRet; - - vcl::SettingsConfigItem* pCfg = vcl::SettingsConfigItem::get(); - OUString aVal( pCfg->getValue( "BrowserPlugins", - "Disabled" ) ); - if( ! aVal.toBoolean() ) - { - aRet = impl_getPluginDescriptions(); - } - return aRet; -} - -Reference< css::plugin::XPlugin > XPluginManager_Impl::createPlugin( const Reference< css::plugin::XPluginContext >& acontext, sal_Int16 mode, const Sequence< OUString >& argn, const Sequence< OUString >& argv, const css::plugin::PluginDescription& plugintype) - throw( RuntimeException,css::plugin::PluginException, std::exception ) -{ - XPlugin_Impl* pImpl = new XPlugin_Impl( Reference< css::lang::XMultiServiceFactory>(m_xContext->getServiceManager(), UNO_QUERY_THROW) ); - pImpl->setPluginContext( acontext ); - - PluginManager::get().getPlugins().push_back( pImpl ); - - pImpl->initInstance( plugintype, - argn, - argv, - mode ); - - return pImpl; -} - -Reference< css::plugin::XPlugin > XPluginManager_Impl::createPluginFromURL( const Reference< css::plugin::XPluginContext > & acontext, sal_Int16 mode, const Sequence< OUString >& argn, const Sequence< OUString >& argv, const Reference< css::awt::XToolkit > & toolkit, const Reference< css::awt::XWindowPeer > & parent, const OUString& url ) throw (RuntimeException, std::exception) -{ - XPlugin_Impl* pImpl = new XPlugin_Impl( Reference< css::lang::XMultiServiceFactory>(m_xContext->getServiceManager(), UNO_QUERY_THROW) ); - Reference< css::plugin::XPlugin > xRef = pImpl; - - pImpl->setPluginContext( acontext ); - - PluginManager::get().getPlugins().push_back( pImpl ); - - - pImpl->initInstance( url, - argn, - argv, - mode ); - - pImpl->createPeer( toolkit, parent ); - - pImpl->provideNewStream( pImpl->getDescription().Mimetype, - Reference< css::io::XActiveDataSource >(), - url, - 0, 0, comphelper::isFileUrl(url) ); - - if( ! pImpl->getPluginComm() ) - { - pImpl->dispose(); - xRef = nullptr; - } - - return xRef; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/multiplx.cxx b/extensions/source/plugin/base/multiplx.cxx deleted file mode 100644 index faf41001285d..000000000000 --- a/extensions/source/plugin/base/multiplx.cxx +++ /dev/null @@ -1,333 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include - - -// class MRCListenerMultiplexerHelper - -MRCListenerMultiplexerHelper::MRCListenerMultiplexerHelper -( - const Reference< css::awt::XWindow > & rControl - , const Reference< css::awt::XWindow > & rPeer -) - : xPeer( rPeer ) - , xControl( Reference< css::awt::XControl >( rControl, UNO_QUERY ) ) - , aListenerHolder( aMutex ) -{ -} - - -void MRCListenerMultiplexerHelper::setPeer( const Reference< css::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 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 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() -{ - css::lang::EventObject aEvt; - aEvt.Source = xControl; - aListenerHolder.disposeAndClear( aEvt ); -} - -// MRCListenerMultiplexerHelper -void MRCListenerMultiplexerHelper::adviseToPeer( const Reference< css::awt::XWindow > & rPeer, const Type & type ) -{ - // add a listener to the source (peer) - if( type == cppu::UnoType::get()) - rPeer->addWindowListener( this ); - else if( type == cppu::UnoType::get()) - rPeer->addKeyListener( this ); - else if( type == cppu::UnoType::get()) - rPeer->addFocusListener( this ); - else if( type == cppu::UnoType::get()) - rPeer->addMouseListener( this ); - else if( type == cppu::UnoType::get()) - rPeer->addMouseMotionListener( this ); - else if( type == cppu::UnoType::get()) - rPeer->addPaintListener( this ); - else if( type == cppu::UnoType::get()) - { - Reference< css::awt::XTopWindow > xTop( rPeer, UNO_QUERY ); - if( xTop.is() ) - xTop->addTopWindowListener( this ); - } - else - { - OSL_FAIL( "unknown listener" ); - } -} - -// MRCListenerMultiplexerHelper -void MRCListenerMultiplexerHelper::unadviseFromPeer( const Reference< css::awt::XWindow > & rPeer, const Type & type ) -{ - // the last listener is removed, remove the listener from the source (peer) - if( type == cppu::UnoType::get()) - rPeer->removeWindowListener( this ); - else if( type == cppu::UnoType::get()) - rPeer->removeKeyListener( this ); - else if( type == cppu::UnoType::get()) - rPeer->removeFocusListener( this ); - else if( type == cppu::UnoType::get()) - rPeer->removeMouseListener( this ); - else if( type == cppu::UnoType::get()) - rPeer->removeMouseMotionListener( this ); - else if( type == cppu::UnoType::get()) - rPeer->removePaintListener( this ); - else if( type == cppu::UnoType::get()) - { - Reference< css::awt::XTopWindow > xTop( rPeer, UNO_QUERY ); - if( xTop.is() ) - xTop->removeTopWindowListener( this ); - } - else - { - OSL_FAIL( "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 ); - } -} - -// css::lang::XEventListener -void MRCListenerMultiplexerHelper::disposing(const css::lang::EventObject& ) throw(std::exception) -{ - ::osl::Guard< ::osl::Mutex > aGuard( aMutex ); - // peer is disposed, clear the reference - xPeer.clear(); -} - -#define MULTIPLEX( InterfaceName, MethodName, EventName ) \ -::cppu::OInterfaceContainerHelper * pCont; \ -pCont = aListenerHolder.getContainer( cppu::UnoType< InterfaceName >::get()); \ -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 = static_cast(aIt.next()); \ - try \ - { \ - pListener->MethodName( aEvt ); \ - } \ - catch(const RuntimeException&) \ - { \ - /* ignore all usr system exceptions from the listener */ \ - } \ - } \ - } \ -} - -// css::awt::XFocusListener -void MRCListenerMultiplexerHelper::focusGained(const css::awt::FocusEvent& e) throw(std::exception) -{ - MULTIPLEX( css::awt::XFocusListener, focusGained, css::awt::FocusEvent ) -} - -// css::awt::XFocusListener -void MRCListenerMultiplexerHelper::focusLost(const css::awt::FocusEvent& e) throw(std::exception) -{ - MULTIPLEX( css::awt::XFocusListener, focusLost, css::awt::FocusEvent ) -} - -// css::awt::XWindowListener -void MRCListenerMultiplexerHelper::windowResized(const css::awt::WindowEvent& e) throw(std::exception) -{ - MULTIPLEX( css::awt::XWindowListener, windowResized, css::awt::WindowEvent ) -} - -// css::awt::XWindowListener -void MRCListenerMultiplexerHelper::windowMoved(const css::awt::WindowEvent& e) throw(std::exception) -{ - MULTIPLEX( css::awt::XWindowListener, windowMoved, css::awt::WindowEvent ) -} - -// css::awt::XWindowListener -void MRCListenerMultiplexerHelper::windowShown(const css::lang::EventObject& e) throw(std::exception) -{ - MULTIPLEX( css::awt::XWindowListener, windowShown, css::lang::EventObject ) -} - -// css::awt::XWindowListener -void MRCListenerMultiplexerHelper::windowHidden(const css::lang::EventObject& e) throw(std::exception) -{ - MULTIPLEX( css::awt::XWindowListener, windowHidden, css::lang::EventObject ) -} - -// css::awt::XKeyListener -void MRCListenerMultiplexerHelper::keyPressed(const css::awt::KeyEvent& e) throw(std::exception) -{ - MULTIPLEX( css::awt::XKeyListener, keyPressed, css::awt::KeyEvent ) -} - -// css::awt::XKeyListener -void MRCListenerMultiplexerHelper::keyReleased(const css::awt::KeyEvent& e) throw(std::exception) -{ - MULTIPLEX( css::awt::XKeyListener, keyReleased, css::awt::KeyEvent ) -} - -// css::awt::XMouseListener -void MRCListenerMultiplexerHelper::mousePressed(const css::awt::MouseEvent& e) throw(std::exception) -{ - MULTIPLEX( css::awt::XMouseListener, mousePressed, css::awt::MouseEvent ) -} - -// css::awt::XMouseListener -void MRCListenerMultiplexerHelper::mouseReleased(const css::awt::MouseEvent& e) throw(std::exception) -{ - MULTIPLEX( css::awt::XMouseListener, mouseReleased, css::awt::MouseEvent ) -} - -// css::awt::XMouseListener -void MRCListenerMultiplexerHelper::mouseEntered(const css::awt::MouseEvent& e) throw(std::exception) -{ - MULTIPLEX( css::awt::XMouseListener, mouseEntered, css::awt::MouseEvent ) -} - -// css::awt::XMouseListener -void MRCListenerMultiplexerHelper::mouseExited(const css::awt::MouseEvent& e) throw(std::exception) -{ - MULTIPLEX( css::awt::XMouseListener, mouseExited, css::awt::MouseEvent ) -} - -// css::awt::XMouseMotionListener -void MRCListenerMultiplexerHelper::mouseDragged(const css::awt::MouseEvent& e) throw(std::exception) -{ - MULTIPLEX( css::awt::XMouseMotionListener, mouseDragged, css::awt::MouseEvent ) -} - -// css::awt::XMouseMotionListener -void MRCListenerMultiplexerHelper::mouseMoved(const css::awt::MouseEvent& e) throw(std::exception) -{ - MULTIPLEX( css::awt::XMouseMotionListener, mouseMoved, css::awt::MouseEvent ) -} - -// css::awt::XPaintListener -void MRCListenerMultiplexerHelper::windowPaint(const css::awt::PaintEvent& e) throw(std::exception) -{ - MULTIPLEX( css::awt::XPaintListener, windowPaint, css::awt::PaintEvent ) -} - -// css::awt::XTopWindowListener -void MRCListenerMultiplexerHelper::windowOpened(const css::lang::EventObject& e) throw(std::exception) -{ - MULTIPLEX( css::awt::XTopWindowListener, windowOpened, css::lang::EventObject ) -} - -// css::awt::XTopWindowListener -void MRCListenerMultiplexerHelper::windowClosing( const css::lang::EventObject& e ) throw(std::exception) -{ - MULTIPLEX( css::awt::XTopWindowListener, windowClosing, css::lang::EventObject ) -} - -// css::awt::XTopWindowListener -void MRCListenerMultiplexerHelper::windowClosed( const css::lang::EventObject& e ) throw(std::exception) -{ - MULTIPLEX( css::awt::XTopWindowListener, windowClosed, css::lang::EventObject ) -} - -// css::awt::XTopWindowListener -void MRCListenerMultiplexerHelper::windowMinimized( const css::lang::EventObject& e ) throw(std::exception) -{ - MULTIPLEX( css::awt::XTopWindowListener, windowMinimized, css::lang::EventObject ) -} - -// css::awt::XTopWindowListener -void MRCListenerMultiplexerHelper::windowNormalized( const css::lang::EventObject& e ) throw(std::exception) -{ - MULTIPLEX( css::awt::XTopWindowListener, windowNormalized, css::lang::EventObject ) -} - -// css::awt::XTopWindowListener -void MRCListenerMultiplexerHelper::windowActivated( const css::lang::EventObject& e ) throw(std::exception) -{ - MULTIPLEX( css::awt::XTopWindowListener, windowActivated, css::lang::EventObject ) -} - -// css::awt::XTopWindowListener -void MRCListenerMultiplexerHelper::windowDeactivated( const css::lang::EventObject& e ) throw(std::exception) -{ - MULTIPLEX( css::awt::XTopWindowListener, windowDeactivated, css::lang::EventObject ) -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/nfuncs.cxx b/extensions/source/plugin/base/nfuncs.cxx deleted file mode 100644 index 21dbb45324dd..000000000000 --- a/extensions/source/plugin/base/nfuncs.cxx +++ /dev/null @@ -1,644 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#ifdef WNT -#include -#include -#endif - -#include -#include - -#include -#include -#include - -#if OSL_DEBUG_LEVEL > 1 -#include -#include -#include -static FILE * s_file = 0; -void TRACE( char const * s ) -{ - if (! s_file) - s_file = stderr; - if (s_file) - { - oslThreadIdentifier t = osl::Thread::getCurrentIdentifier(); - fprintf( s_file, "log [t_id=%" SAL_PRIuUINT32 "]: %s\n", t, s ); - fflush( s_file ); - } -} -void TRACEN( char const * s, long n ) -{ - if (! s_file) - s_file = stderr; - if (s_file) - { - oslThreadIdentifier t = osl::Thread::getCurrentIdentifier(); - fprintf( s_file, "log [t_id=%" SAL_PRIuUINT32 "]: %s%ld\n", t, s, n ); - fflush( s_file ); - } -} -void TRACES( char const* s, char const* s2 ) -{ - if (! s_file) - s_file = stderr; - if (s_file) - { - oslThreadIdentifier t = osl::Thread::getCurrentIdentifier(); - fprintf( s_file, "log [t_id=%" SAL_PRIuUINT32 "]: %s %s\n", t, s, s2 ); - fflush( s_file ); - } -} -#else -#define TRACE(x) -#define TRACEN(x,n) -#define TRACES(x,s) -#endif - -using namespace com::sun::star::lang; - - -// Move deprecated functions which no longer appear in npapi.h before -// their use to avoid errors that they're undeclared at point of use -extern "C" -{ - const JRIEnvInterface** SAL_CALL NP_LOADDS NPN_GetJavaEnv() - { - TRACE( "NPN_GetJavaEnv" ); - // no java in this program - return nullptr; - } - - jref SAL_CALL NP_LOADDS NPN_GetJavaPeer( NPP /*instance*/ ) - { - TRACE( "NPN_GetJavaPeer" ); - return nullptr; - } -} - -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 OString normalizeURL( XPlugin_Impl* plugin, const OString& url ) -{ - OString aLoadURL; - if( url.indexOf( ':' ) == -1 ) - { - aLoadURL = OUStringToOString( plugin->getCreationURL(), plugin->getTextEncoding() ); - int nPos; - if( ( nPos = aLoadURL.indexOf( "://" ) ) != -1 ) - { - if( url.indexOf( '/' ) != -1 ) - { - // this means same server but new path - nPos = aLoadURL.indexOf( '/', nPos+3 ); - - if( nPos != -1 ) - aLoadURL = aLoadURL.copy( 0, url.startsWith("/") ? nPos : nPos+1 ); - } - else - { - // same server but new file - nPos = aLoadURL.lastIndexOf( '/' ); - aLoadURL = aLoadURL.copy( 0, nPos+1 ); - } - aLoadURL += url; - } - else - aLoadURL = url; - } - else if( url.indexOf( ":/" ) != -1 ) - aLoadURL = url; - - return aLoadURL; -} - -struct AsynchronousGetURL -{ - OUString aUrl; - OUString aTarget; - Reference< XEventListener > xListener; - - DECL_LINK_TYPED( getURL, void*, void ); -}; - -IMPL_LINK_TYPED( AsynchronousGetURL, getURL, void*, p, void ) -{ - XPlugin_Impl* pImpl = static_cast(p); - try - { - pImpl->enterPluginCallback(); - if( xListener.is() ) - pImpl->getPluginContext()-> - getURLNotify( pImpl, - aUrl, - aTarget, - xListener ); - else - pImpl->getPluginContext()-> - getURL( pImpl, - aUrl, - aTarget ); - } - catch(const css::plugin::PluginException&) - { - } - pImpl->leavePluginCallback(); - delete this; -} - - -extern "C" { - - void* SAL_CALL NP_LOADDS NPN_MemAlloc( uint32_t 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_t SAL_CALL NP_LOADDS NPN_MemFlush( uint32_t /*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 ) - { - if( pStream->getStreamType() == InputStream ) - static_cast(pStream)->releaseSelf(); - else - delete pStream; - } - - return NPERR_NO_ERROR; - } - - NPError SAL_CALL NP_LOADDS NPN_GetURL( NPP instance, const char* url, const char* window ) - { - TRACES( "NPN_GetURL", url ); - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - if( ! pImpl ) - return NPERR_INVALID_INSTANCE_ERROR; - - AsynchronousGetURL* pAsync = new AsynchronousGetURL(); - - OString aLoadURL = normalizeURL( pImpl, url ); - TRACES( "NPN_GetURL", aLoadURL.getStr() ); - pAsync->aUrl = OStringToOUString( aLoadURL, pImpl->getTextEncoding() ); - pAsync->aTarget = OStringToOUString( window, pImpl->getTextEncoding() ); - pImpl->setLastGetUrl( aLoadURL ); - Application::PostUserEvent( LINK( pAsync, AsynchronousGetURL, getURL ), pImpl ); - return NPERR_NO_ERROR; - } - - NPError SAL_CALL NP_LOADDS NPN_GetURLNotify( NPP instance, const char* url, const char* target, - void* notifyData ) - { - TRACES( "NPN_GetURLNotify", url ); - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - if( ! pImpl ) - return NPERR_INVALID_INSTANCE_ERROR; - - OString aLoadURL = normalizeURL( pImpl, url ); - if( aLoadURL.isEmpty() ) - return NPERR_INVALID_URL; - - AsynchronousGetURL* pAsync = new AsynchronousGetURL(); - 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 = nullptr; - } - pAsync->aUrl = OStringToOUString( aLoadURL, pImpl->getTextEncoding() ); - pAsync->aTarget = OStringToOUString( target, pImpl->getTextEncoding() ); - pAsync->xListener = pListener; - pImpl->setLastGetUrl( aLoadURL ); - Application::PostUserEvent( LINK( pAsync, AsynchronousGetURL, getURL ), pImpl ); - - 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, - OStringToOUString( type, pImpl->getTextEncoding () ), - OStringToOUString( target, pImpl->getTextEncoding() ), - css::uno::Reference< css::io::XActiveDataSource > ( pStream->getOutputStream(), UNO_QUERY ) - ); - pImpl->leavePluginCallback(); - } - catch( const css::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_t 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; - - css::uno::Sequence Bytes( reinterpret_cast(buf), len ); - - 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 = nullptr; - } - - try - { - pImpl->enterPluginCallback(); - pImpl->getPluginContext()-> - postURLNotify( pImpl, - OStringToOUString( aPostURL, pImpl->getTextEncoding() ), - OStringToOUString( target, pImpl->getTextEncoding() ), - Bytes, - file, - css::uno::Reference< css::lang::XEventListener > ( pListener ) ); - pImpl->leavePluginCallback(); - } - catch( const css::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_t len, const char* buf, NPBool file ) - { - TRACE( "NPN_PostURL" ); - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - if( ! pImpl ) - return NPERR_INVALID_INSTANCE_ERROR; - - css::uno::Sequence Bytes( reinterpret_cast(buf), len ); - OString aPostURL = normalizeURL( pImpl, url ); - try - { - pImpl->enterPluginCallback(); - pImpl->getPluginContext()-> - postURL( pImpl, - OStringToOUString( aPostURL, pImpl->getTextEncoding() ), - OStringToOUString( window, pImpl->getTextEncoding () ), - Bytes, - file ); - pImpl->leavePluginCallback(); - } - catch( const css::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& rList = PluginManager::get().getPlugins(); - ::std::list::iterator iter; - XPlugin_Impl* pPlugin = nullptr; - PluginStream* pStream = nullptr; - for( iter = rList.begin(); iter!= rList.end(); ++iter ) - { - pStream = (*iter)->getStreamFromNPStream( stream ); - if( pStream ) - { - pPlugin = *iter; - break; - } - } - if( ! pPlugin ) - return NPERR_INVALID_INSTANCE_ERROR; - if( ! pStream || pStream->getStreamType() != InputStream ) - return NPERR_FILE_NOT_FOUND; - - PluginInputStream* pInputStream = static_cast(pStream); - std::unique_ptr pBytes; - int nBytes = 0; - pPlugin->enterPluginCallback(); - while( rangeList ) - { - if( pBytes && nBytes < (int)rangeList->length ) - pBytes.reset(); - if( ! pBytes ) { - nBytes = rangeList->length; - pBytes.reset(new sal_Int8[ nBytes ]); - } - int nRead = - pInputStream->read( rangeList->offset, pBytes.get(), rangeList->length ); - int nPos = 0; - int nNow; - do - { - nNow = pPlugin->getPluginComm()-> - NPP_WriteReady( &pPlugin->getNPPInstance(), - stream ); - nNow = pPlugin->getPluginComm()-> - NPP_Write( &pPlugin->getNPPInstance(), - stream, - rangeList->offset + nPos, - nNow, - pBytes.get()+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, OStringToOUString( message, pImpl->getTextEncoding() ) ); - pImpl->leavePluginCallback(); - } - catch( const css::plugin::PluginException& ) - { - pImpl->leavePluginCallback(); - return; - } - } - - const char* SAL_CALL NP_LOADDS NPN_UserAgent( NPP instance ) - { - static char* pAgent = strdup( "Mozilla 3.0" ); - - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - if( pImpl ) - { - OUString UserAgent; - try - { - pImpl->enterPluginCallback(); - UserAgent = pImpl->getPluginContext()-> - getUserAgent( pImpl ); - pImpl->leavePluginCallback(); - if( pAgent ) - free( pAgent ); - pAgent = strdup( OUStringToOString( UserAgent, pImpl->getTextEncoding() ).getStr() ); - } - catch( const css::plugin::PluginException& ) - { - pImpl->leavePluginCallback(); - } - } - - TRACES( "NPN_UserAgent: returning", pAgent ); - - 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_t SAL_CALL NP_LOADDS NPN_Write( NPP instance, NPStream* stream, int32_t 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(); - css::uno::Sequence Bytes( static_cast(buffer), len ); - static_cast(pStream)->getOutputStream()->writeBytes( Bytes ); - pImpl->leavePluginCallback(); - - return len; -} - - -NPError SAL_CALL NP_LOADDS NPN_GetValue( NPP instance, NPNVariable variable, void* value ) -{ - TRACEN( "NPN_GetValue: ", variable ); - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - - if( ! pImpl ) - return 0; - - NPError aResult( NPERR_NO_ERROR ); - - switch( variable ) - { - case NPNVxDisplay: - // Unix only, handled in sysdep part - case NPNVxtAppContext: - // Unix only, handled in sysdep part - default: - aResult = NPERR_INVALID_PARAM; - break; - #ifdef MACOSX - case 2000: // NPNVsupportsQuickDrawBool - *(NPBool*)value = false; - break; - case 2001: // NPNVsupportsCoreGraphicsBool - *(NPBool*)value = true; - break; - #endif - case NPNVjavascriptEnabledBool: - // no javascript - *static_cast(value) = false; - break; - case NPNVasdEnabledBool: - // no SmartUpdate - *static_cast(value) = false; - break; - case NPNVisOfflineBool: - // no offline browsing - *static_cast(value) = false; - break; - } - - return aResult; -} - -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 ) -{ - NPError nError = NPERR_NO_ERROR; - TRACEN( "NPN_SetValue ", variable ); - #ifdef MACOSX - NPN_SetValue_Impl(instance, variable, value); - #else - (void)instance; - (void)variable; - (void)value; - #endif - return nError; -} - -void SAL_CALL NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect* /*invalidRect*/) -{ - TRACE( "NPN_InvalidateRect" ); - - #ifdef MACOSX - NPN_ForceRedraw( instance ); - #else - (void)instance; - #endif -} - -void SAL_CALL NP_LOADDS NPN_InvalidateRegion(NPP instance, NPRegion /*invalidRegion*/) -{ - TRACE( "NPN_InvalidateRegion" ); - - #ifdef MACOSX - NPN_ForceRedraw( instance ); - #else - (void)instance; - #endif -} - -void SAL_CALL NP_LOADDS NPN_ForceRedraw(NPP instance) -{ - TRACE( "NPN_ForceRedraw" ); - #ifdef MACOSX - NPN_ForceRedraw_Impl(instance); - #else - (void)instance; - #endif -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/plcom.cxx b/extensions/source/plugin/base/plcom.cxx deleted file mode 100644 index c5c620624488..000000000000 --- a/extensions/source/plugin/base/plcom.cxx +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#ifdef WNT -#include -#include -#endif - -#ifdef SOLARIS -#include -#endif - -#include - -#include -#include - -PluginComm::PluginComm( const OString& rLibName, bool bReusable ) : - m_nRefCount( 0 ), - m_aLibName( rLibName ) -{ - if( bReusable ) - PluginManager::get().getPluginComms().push_back( this ); -} - -PluginComm::~PluginComm() -{ - PluginManager::get().getPluginComms().remove( this ); - while( m_aFilesToDelete.size() ) - { - OUString aFile( m_aFilesToDelete.front() ); - m_aFilesToDelete.pop_front(); - osl::FileBase::getFileURLFromSystemPath( aFile, aFile ); - osl::File::remove( aFile ); - } -} - -NPError PluginComm::NPP_SetWindow( XPlugin_Impl* i_pImpl ) -{ - return NPP_SetWindow( &i_pImpl->getNPPInstance(), &i_pImpl->getNPWindow() ); -} - -NPError PluginComm::NPP_Destroy( XPlugin_Impl* i_pImpl, NPSavedData** save ) -{ - return NPP_Destroy( &i_pImpl->getNPPInstance(), save ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/plctrl.cxx b/extensions/source/plugin/base/plctrl.cxx deleted file mode 100644 index 918715599d4f..000000000000 --- a/extensions/source/plugin/base/plctrl.cxx +++ /dev/null @@ -1,322 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -PluginControl_Impl::PluginControl_Impl() - : _pMultiplexer( nullptr ) - , _nX( 0 ) - , _nY( 0 ) - , _nWidth( 100 ) - , _nHeight( 100 ) - , _nFlags( css::awt::PosSize::POSSIZE ) - , _bVisible(false) - , _bInDesignMode(false) - , _bEnable(true) - , _pSysChild(nullptr) -{ -} - -PluginControl_Impl::~PluginControl_Impl() -{ -} - -MRCListenerMultiplexerHelper* PluginControl_Impl::getMultiplexer() -{ - if( ! _pMultiplexer ) - _pMultiplexer = new MRCListenerMultiplexerHelper( this, _xPeerWindow ); - return _pMultiplexer; -} - - -void PluginControl_Impl::addEventListener( const Reference< css::lang::XEventListener > & l ) - throw( RuntimeException, std::exception ) -{ - _aDisposeListeners.push_back( l ); -} - -//---- css::lang::XComponent ---------------------------------------------------------------------------------- -void PluginControl_Impl::removeEventListener( const Reference< css::lang::XEventListener > & l ) - throw( RuntimeException, std::exception ) -{ - _aDisposeListeners.remove( l ); -} - -//---- css::lang::XComponent ---------------------------------------------------------------------------------- -void PluginControl_Impl::dispose() - throw( RuntimeException, std::exception ) -{ - // send disposing events - css::lang::EventObject aEvt; - if( getMultiplexer() ) - getMultiplexer()->disposeAndClear(); - - // release context - _xContext.clear(); - releasePeer(); -} - - -//---- css::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, sal_Int32 nHeight_, sal_Int16 nFlags ) - throw( RuntimeException, std::exception ) -{ - _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 ); -} - -//---- css::awt::XWindow ------------------------------------------------------------------------------------- -css::awt::Rectangle PluginControl_Impl::getPosSize() - throw( RuntimeException, std::exception ) -{ - return _xPeerWindow->getPosSize(); -} - -//---- css::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::setVisible( sal_Bool bVisible ) - throw( RuntimeException, std::exception ) -{ - _bVisible = bVisible; - if (_xPeerWindow.is()) - _xPeerWindow->setVisible( _bVisible && !_bInDesignMode ); -} - -//---- css::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::setEnable( sal_Bool bEnable ) - throw( RuntimeException, std::exception ) -{ - _bEnable = bEnable; - if (_xPeerWindow.is()) - _xPeerWindow->setEnable( _bEnable ); -} - -//---- css::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::setFocus() throw( RuntimeException, std::exception ) -{ - if (_xPeerWindow.is()) - _xPeerWindow->setFocus(); -} - - - -void PluginControl_Impl::releasePeer() -{ - if (_xPeer.is()) - { - _xParentWindow->removeFocusListener( this ); - _xPeerWindow->dispose(); - _pSysChild = nullptr; - _xPeerWindow.clear(); - _xPeer.clear(); - getMultiplexer()->setPeer( Reference< css::awt::XWindow > () ); - } -} - -//---- css::awt::XControl ------------------------------------------------------------------------------------ -void PluginControl_Impl::createPeer( const Reference< css::awt::XToolkit > & /*xToolkit*/, const Reference< css::awt::XWindowPeer > & xParentPeer ) - throw( RuntimeException, std::exception ) -{ - if (_xPeer.is()) - { - OSL_FAIL( "### Peer is already set!" ); - return; - } - - _xParentPeer = xParentPeer; - _xParentWindow.set( xParentPeer, UNO_QUERY ); - DBG_ASSERT( _xParentWindow.is(), "### no parent peer window!" ); - - vcl::Window* pImpl = VCLUnoHelper::GetWindow( xParentPeer ); - if (pImpl) - { - _pSysChild = VclPtr::Create( pImpl, WB_CLIPCHILDREN ); - if (pImpl->HasFocus()) - _pSysChild->GrabFocus(); - - // get peer - _xPeer.set( _pSysChild->GetComponentInterface() ); - _xPeerWindow.set( _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 - { - OSL_FAIL( "### cannot get implementation of parent peer!" ); - } - - getMultiplexer()->setPeer( _xPeerWindow ); -} - -//---- css::awt::XControl ------------------------------------------------------------------------------------ -void PluginControl_Impl::setDesignMode( sal_Bool bOn ) - throw( RuntimeException, std::exception ) -{ - _bInDesignMode = bOn; - if (_xPeerWindow.is()) - _xPeerWindow->setVisible( _bVisible && !_bInDesignMode ); -} - -//---- css::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::addPaintListener( const Reference< css::awt::XPaintListener > & l ) - throw( RuntimeException, std::exception ) -{ - getMultiplexer()->advise( cppu::UnoType::get(), l ); -} - -//---- css::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::removePaintListener( const Reference< css::awt::XPaintListener > & l ) - throw( RuntimeException, std::exception ) -{ - getMultiplexer()->unadvise( cppu::UnoType::get(), l ); -} - -//---- css::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::addWindowListener( const Reference< css::awt::XWindowListener > & l ) - throw( RuntimeException, std::exception ) -{ - getMultiplexer()->advise( cppu::UnoType::get(), l ); -} - -//---- css::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::removeWindowListener( const Reference< css::awt::XWindowListener > & l ) - throw( RuntimeException, std::exception ) -{ - getMultiplexer()->unadvise( cppu::UnoType::get(), l ); -} - -//---- css::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::addFocusListener( const Reference< css::awt::XFocusListener > & l ) - throw( RuntimeException, std::exception ) -{ - getMultiplexer()->advise( cppu::UnoType::get(), l ); -} - -//---- css::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::removeFocusListener( const Reference< css::awt::XFocusListener > & l ) - throw( RuntimeException, std::exception ) -{ - getMultiplexer()->unadvise( cppu::UnoType::get(), l ); -} - -//---- css::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::addKeyListener( const Reference< css::awt::XKeyListener > & l ) - throw( RuntimeException, std::exception ) -{ - getMultiplexer()->advise( cppu::UnoType::get(), l ); -} - -//---- css::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::removeKeyListener( const Reference< css::awt::XKeyListener > & l ) - throw( RuntimeException, std::exception ) -{ - getMultiplexer()->unadvise( cppu::UnoType::get(), l ); -} - -//---- css::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::addMouseListener( const Reference< css::awt::XMouseListener > & l ) - throw( RuntimeException, std::exception ) -{ - getMultiplexer()->advise( cppu::UnoType::get(), l ); -} - -//---- css::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::removeMouseListener( const Reference< css::awt::XMouseListener > & l ) - throw( RuntimeException, std::exception ) -{ - getMultiplexer()->unadvise( cppu::UnoType::get(), l ); -} - -//---- css::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::addMouseMotionListener( const Reference< css::awt::XMouseMotionListener > & l ) - throw( RuntimeException, std::exception ) -{ - getMultiplexer()->advise( cppu::UnoType::get(), l ); -} - -//---- css::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::removeMouseMotionListener( const Reference< css::awt::XMouseMotionListener > & l ) - throw( RuntimeException, std::exception ) -{ - getMultiplexer()->unadvise( cppu::UnoType::get(), l ); -} - - -//---- css::awt::XView --------------------------------------------------------------------------------------- -void PluginControl_Impl::draw( sal_Int32 /*x*/, sal_Int32 /*y*/ ) - throw( RuntimeException, std::exception ) -{ - // has to be done by further implementation of control -} - -//---- css::awt::XView --------------------------------------------------------------------------------------- -void PluginControl_Impl::setZoom( float /*ZoomX*/, float /*ZoomY*/ ) - throw( RuntimeException, std::exception ) -{ - // has to be done by further implementation of control -} - -//---- css::lang::XEventListener ------------------------------------------------------------------------------ -void PluginControl_Impl::disposing( const css::lang::EventObject & /*rSource*/ ) - throw( RuntimeException, std::exception ) -{ -} -//---- css::awt::XFocusListener ------------------------------------------------------------------------------ -void PluginControl_Impl::focusGained( const css::awt::FocusEvent & /*rEvt*/ ) - throw( RuntimeException, std::exception ) -{ - if (_xPeerWindow.is()) - _xPeerWindow->setFocus(); -} -//---- css::awt::XFocusListener ------------------------------------------------------------------------------ -void PluginControl_Impl::focusLost( const css::awt::FocusEvent & /*rEvt*/ ) - throw( RuntimeException, std::exception ) -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/plmodel.cxx b/extensions/source/plugin/base/plmodel.cxx deleted file mode 100644 index e3f3aed6e49c..000000000000 --- a/extensions/source/plugin/base/plmodel.cxx +++ /dev/null @@ -1,204 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include - -using namespace com::sun::star::uno; - - -Reference< XInterface > SAL_CALL PluginModel_CreateInstance( const Reference< css::lang::XMultiServiceFactory > & ) throw( Exception ) -{ - Reference< XInterface > xService = *new PluginModel(); - return xService; -} - -Any PluginModel::queryAggregation( const Type& type ) throw( RuntimeException, std::exception ) -{ - Any aRet( ::cppu::queryInterface( type, - static_cast< css::lang::XComponent* >(this), - static_cast< css::io::XPersistObject* >(this ), - static_cast< css::awt::XControlModel* >(this), - static_cast< css::beans::XPropertySet* >(this), - static_cast< css::beans::XMultiPropertySet* >(this), - static_cast< css::beans::XFastPropertySet* >(this) - ) ); - return aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( type ); -} - - -// XPluginManager_Impl -Sequence< OUString > PluginModel::getSupportedServiceNames_Static() throw() -{ - Sequence aSNS { "com.sun.star.plugin.PluginModel" }; - return aSNS; -} - - -static const char* aCreationURL = "URL"; -static const char* aMime = "TYPE"; - -static ::osl::Mutex aPropertyMutex; - -static css::beans::Property aProps[] = -{ - css::beans::Property( - OUString::createFromAscii( aMime ), - 1, - ::cppu::UnoType::get(), - css::beans::PropertyAttribute::BOUND ), - css::beans::Property( - OUString::createFromAscii( aCreationURL ), - 2, - ::cppu::UnoType::get(), - css::beans::PropertyAttribute::BOUND ) -}; - -PluginModel::PluginModel() : - BroadcasterHelperHolder( aPropertyMutex ), - OPropertySetHelper( m_aHelper ), - OPropertyArrayHelper( aProps, 2 ) -{ -} - -PluginModel::PluginModel(const OUString& rURL, const OUString& rMimeType ) : - BroadcasterHelperHolder( aPropertyMutex ), - OPropertySetHelper( m_aHelper ), - OPropertyArrayHelper( aProps, 2 ), - m_aCreationURL( rURL ), - m_aMimeType( rMimeType ) -{ -} - -PluginModel::~PluginModel() -{ -} - -Reference< css::beans::XPropertySetInfo > PluginModel::getPropertySetInfo() throw(std::exception) -{ - static Reference< css::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 ) throw() -{ - if( nHandle == 1 || nHandle == 2 ) - { - if( rValue.getValueTypeClass() == TypeClass_STRING ) - { - rConvertedValue = rValue; - if( nHandle == 2 ) - rOldValue <<= m_aCreationURL; - else if( nHandle == 1 ) - rOldValue <<= m_aMimeType; - return sal_True; - } - } - return sal_False; -} - -void PluginModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, - const Any& rValue ) - throw(css::uno::Exception, std::exception) -{ - if( rValue.getValueTypeClass() == TypeClass_STRING ) // FIXME wrong type! - - { - if( nHandle == 2 ) - rValue >>= m_aCreationURL; - else if( nHandle == 1 ) - rValue >>= m_aMimeType; - } - else - throw css::lang::IllegalArgumentException(); -} - -void PluginModel::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const throw() -{ - if( nHandle == 2 ) - rValue <<= m_aCreationURL; - else if( nHandle == 1 ) - rValue <<= m_aMimeType; -} - -//---- css::lang::XComponent ---------------------------------------------------------------------------------- -void PluginModel::addEventListener( const Reference< css::lang::XEventListener > & l ) throw(std::exception) -{ - m_aDisposeListeners.push_back( l ); -} - -//---- css::lang::XComponent ---------------------------------------------------------------------------------- -void PluginModel::removeEventListener( const Reference< css::lang::XEventListener > & l ) throw(std::exception) -{ - m_aDisposeListeners.remove( l ); -} - -//---- css::lang::XComponent ---------------------------------------------------------------------------------- -void PluginModel::dispose() throw(std::exception) -{ - // send disposing events - css::lang::EventObject aEvt; - aEvt.Source = static_cast(this); - ::std::list< Reference< css::lang::XEventListener > > aLocalListeners = m_aDisposeListeners; - for( ::std::list< Reference< css::lang::XEventListener > >::iterator it = aLocalListeners.begin(); - it != aLocalListeners.end(); ++it ) - (*it)->disposing( aEvt ); - - m_aDisposeListeners.clear(); - - disposing(); -} - - -// css::io::XPersistObject -OUString PluginModel::getServiceName() throw(std::exception) -{ - return OUString("com.sun.star.plugin.PluginModel"); -} - -void PluginModel::write(const Reference< css::io::XObjectOutputStream > & OutStream) throw(std::exception) -{ - OutStream->writeUTF( m_aCreationURL ); -} - -void PluginModel::read(const Reference< css::io::XObjectInputStream > & InStream) throw(std::exception) -{ - m_aCreationURL = InStream->readUTF(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/service.cxx b/extensions/source/plugin/base/service.cxx deleted file mode 100644 index f40de1dc4aa5..000000000000 --- a/extensions/source/plugin/base/service.cxx +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#ifdef WNT -#include -#include -#endif - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include - -using namespace cppu; - -extern "C" { - SAL_DLLPUBLIC_EXPORT void* SAL_CALL pl_component_getFactory( - const sal_Char* pImplementationName, - void* pXUnoSMgr, - void* /*pXUnoKey*/ - ) - { - void* pRet = nullptr; - - OUString aImplName( OUString::createFromAscii( pImplementationName ) ); - - if( pXUnoSMgr ) - { - Reference< css::lang::XMultiServiceFactory > xMgr( - static_cast< css::lang::XMultiServiceFactory* >( pXUnoSMgr ) - ); - Reference< css::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; - } -} /* extern "C" */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/xplugin.cxx b/extensions/source/plugin/base/xplugin.cxx deleted file mode 100644 index 46e903466ad1..000000000000 --- a/extensions/source/plugin/base/xplugin.cxx +++ /dev/null @@ -1,1206 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#ifdef WNT -#include -#include -#endif - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef UNX -#include -#include -#endif - -#if OSL_DEBUG_LEVEL > 1 -#include -#endif - -#include - -using namespace com::sun::star; -using namespace com::sun::star::io; -using namespace com::sun::star::beans; -using namespace com::sun::star::plugin; -using namespace osl; - -class PluginDisposer : public salhelper::Timer -{ -private: - XPlugin_Impl* m_pPlugin; - - virtual void SAL_CALL onShot() override; -public: - PluginDisposer( XPlugin_Impl* pPlugin ) : - salhelper::Timer( salhelper::TTimeValue( 2, 0 ), - salhelper::TTimeValue( 2, 0 ) ), - m_pPlugin( pPlugin ) - { start(); } - virtual ~PluginDisposer() {} -}; - -void PluginDisposer::onShot() -{ - if( m_pPlugin ) - { - if( m_pPlugin->isDisposable() ) - { - Application::PostUserEvent( LINK( m_pPlugin, XPlugin_Impl, secondLevelDispose ), static_cast(m_pPlugin) ); - } - } - else - release(); -} - -Any XPlugin_Impl::queryInterface( const Type& type ) throw( RuntimeException, std::exception ) -{ - return OWeakAggObject::queryInterface( type ); -} - -Any XPlugin_Impl::queryAggregation( const Type& type ) throw( RuntimeException, std::exception ) -{ - Any aRet( cppu::queryInterface( type, static_cast< XPlugin* >(this) ) ); - if( ! aRet.hasValue() ) - aRet = PluginControl_Impl::queryAggregation( type ); - return aRet; -} - - -XPlugin_Impl::XPlugin_Impl( const uno::Reference< css::lang::XMultiServiceFactory > & rSMgr) : - PluginControl_Impl(), - m_xSMgr( rSMgr ), - m_pPluginComm( nullptr ), - m_pSysPlugData( CreateSysPlugData() ), - m_aEncoding( osl_getThreadTextEncoding() ), - m_pArgv( nullptr ), - m_pArgn( nullptr ), - m_nArgs( 0 ), - m_aPluginMode( NP_FULL ), - m_nProvidingState( PROVIDING_NONE ), - m_nCalledFromPlugin( 0 ), - m_pDisposer( nullptr ), - m_bIsDisposed( false ) -{ - memset( &m_aInstance, 0, sizeof( m_aInstance ) ); - memset( &m_aNPWindow, 0, sizeof( m_aNPWindow ) ); - - m_xModel = new PluginModel(); - uno::Reference< css::beans::XPropertySet > xPS( m_xModel, UNO_QUERY ); - xPS->addPropertyChangeListener( OUString(), this ); - - Guard< Mutex > aGuard( ::PluginManager::get().getPluginMutex() ); - ::PluginManager::get().getPlugins().push_back( this ); -} - -void XPlugin_Impl::destroyInstance() -{ - Guard< Mutex > aGuard( m_aMutex ); - - NPSavedData* pSavedData = nullptr; - - destroyStreams(); - if( getPluginComm() ) - { - getPluginComm()->NPP_Destroy( this, &pSavedData ); - getPluginComm()->decRef(); - m_pPluginComm = nullptr; - } - - freeArgs(); - - 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; - - Guard< Mutex > aGuard( m_aMutex ); - - std::list::iterator iter; - for( iter = m_aPEventListeners.begin(); - iter != m_aPEventListeners.end(); - ++iter ) - { - if( ! strcmp( normalizedURL, (*iter)->getURL() ) || - ! strcmp( normalizedURL, (*iter)->getNormalizedURL() ) ) - { - (*iter)->disposing( css::lang::EventObject() ); - delete *iter; - m_aPEventListeners.remove( *iter ); - return; - } - } -} - -IMPL_LINK_NOARG_TYPED( XPlugin_Impl, secondLevelDispose, void*, void ) -{ - Guard< Mutex > aGuard( m_aMutex ); - - // may have become undisposable between PostUserEvent and here - // or may have disposed and receive a second UserEvent - std::list& rList = ::PluginManager::get().getPlugins(); - std::list::iterator iter; - - { - Guard< Mutex > aPluginGuard( ::PluginManager::get().getPluginMutex() ); - for( iter = rList.begin(); iter != rList.end(); ++iter ) - { - if( *iter == this ) - break; - } - if( iter == rList.end() || ! isDisposable() ) - return; - } - - if (m_pDisposer) - { - m_pDisposer->release(); - m_pDisposer = nullptr; - } - - uno::Reference< XPlugin > xProtection( this ); - uno::Reference< css::beans::XPropertySet > xPS( m_xModel, UNO_QUERY ); - xPS->removePropertyChangeListener( OUString(), this ); - { - Guard< Mutex > aPluginGuard( ::PluginManager::get().getPluginMutex() ); - rList.remove( this ); - } - m_aNPWindow.window = nullptr; -#ifndef UNX - // acrobat does an unconditional XtParent on the windows widget - getPluginComm()->NPP_SetWindow( this ); -#endif - destroyInstance(); - PluginControl_Impl::dispose(); -} - -void XPlugin_Impl::dispose() throw(std::exception) -{ - Guard< Mutex > aGuard( m_aMutex ); - - if (m_bIsDisposed || !getPluginComm()) - return; - m_bIsDisposed = true; - - if( isDisposable() ) - secondLevelDispose( this ); - else - { - m_pDisposer = new PluginDisposer( this ); - m_pDisposer->acquire(); - } -} - -void XPlugin_Impl::initArgs( const Sequence< OUString >& argn, - const Sequence< OUString >& argv, - sal_Int16 mode ) -{ - m_aPluginMode = mode; - - m_nArgs = argn.getLength(); - m_pArgn = new const char*[m_nArgs]; - m_pArgv = new const char*[m_nArgs]; - const OUString* pUArgn = argn.getConstArray(); - const OUString* pUArgv = argv.getConstArray(); - for( int i = 0; i < m_nArgs; i++ ) - { - m_pArgn[i] = strdup( - OUStringToOString( pUArgn[i], m_aEncoding ).getStr() - ); - m_pArgv[i] = strdup( - OUStringToOString( pUArgv[i], m_aEncoding ).getStr() - ); - } -} - -void XPlugin_Impl::freeArgs() -{ - if( m_nArgs > 0 ) - { - for( ; m_nArgs--; ) - { - free( const_cast(m_pArgn[m_nArgs]) ); - free( const_cast(m_pArgv[m_nArgs]) ); - } - delete [] m_pArgn; - delete [] m_pArgv; - } -} - -void XPlugin_Impl::prependArg( const char* pName, const char* pValue ) -{ - const char** pNewNames = new const char*[m_nArgs+1]; - const char** pNewValues = new const char*[m_nArgs+1]; - - pNewNames[0] = strdup( pName ); - pNewValues[0] = strdup( pValue ); - for( int nIndex = 0; nIndex < m_nArgs; ++nIndex ) - { - pNewNames[nIndex+1] = m_pArgn[nIndex]; - pNewValues[nIndex+1]= m_pArgv[nIndex]; - } - // free old arrays - delete [] m_pArgn; - delete [] m_pArgv; - // set new arrays - m_pArgn = pNewNames; - m_pArgv = pNewValues; - // set new number of arguments - m_nArgs++; -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "inserted %s=%s\n", pNewNames[0], pNewValues[0] ); -#endif -} - -void XPlugin_Impl::handleSpecialArgs() -{ - // special handling for real audio which needs a lot of parameters - // or won't function at all - if( m_aDescription.Mimetype == "audio/x-pn-realaudio-plugin" && m_nArgs < 1 ) - { - OUString aURL; - if( m_xModel.is() ) - { - try - { - uno::Reference< XPropertySet > xProp( m_xModel, UNO_QUERY ); - Any aProp = xProp->getPropertyValue("URL"); - aProp >>= aURL; - } - catch(const UnknownPropertyException &) - { - } - } - - if( !aURL.isEmpty() ) - { - // set new args, old args need not be freed as there were none set - m_nArgs = 6; - m_pArgn = new const char*[m_nArgs]; - m_pArgv = new const char*[m_nArgs]; - - // SRC - m_pArgn[0] = strdup( "SRC" ); - m_pArgv[0] = strdup( OUStringToOString( aURL, m_aEncoding ).getStr() ); - // WIDTH - m_pArgn[1] = strdup( "WIDTH" ); - m_pArgv[1] = strdup( "200" ); - // HEIGHT - m_pArgn[2] = strdup( "HEIGHT" ); - m_pArgv[2] = strdup( "200" ); - // CONTROLS - m_pArgn[3] = strdup( "CONTROLS" ); - m_pArgv[3] = strdup( "PlayButton,StopButton,ImageWindow" ); - // AUTOSTART - m_pArgn[4] = strdup( "AUTOSTART" ); - m_pArgv[4] = strdup( "TRUE" ); - // NOJAVA - m_pArgn[5] = strdup( "NOJAVA" ); - m_pArgv[5] = strdup( "TRUE" ); - } - } - // #69333# special for pdf - else if( m_aDescription.Mimetype == "application/pdf" ) - m_aPluginMode = PluginMode::FULL; - - // see if we have a TYPE tag - int nIndex; - for( nIndex = 0; nIndex < m_nArgs; ++nIndex ) - if( m_pArgn[nIndex][0] == 'T' && - m_pArgn[nIndex][1] == 'Y' && - m_pArgn[nIndex][2] == 'P' && - m_pArgn[nIndex][3] == 'E' && - m_pArgn[nIndex][4] == 0 ) - break; - if( nIndex >= m_nArgs ) - { - // TYPE - prependArg( "TYPE", OUStringToOString( m_aDescription.Mimetype, m_aEncoding ).getStr() ); - } - - // see if we have a SRC tag - for( nIndex = 0; nIndex < m_nArgs; ++nIndex ) - if( m_pArgn[nIndex][0] == 'S' && - m_pArgn[nIndex][1] == 'R' && - m_pArgn[nIndex][2] == 'C' && - m_pArgn[nIndex][3] == 0 ) - break; - if( nIndex >= m_nArgs ) - { - // need a SRC parameter (as all browser set one on the plugin - OUString aURL; - if( m_xModel.is() ) - { - try - { - uno::Reference< XPropertySet > xProp( m_xModel, UNO_QUERY ); - Any aProp = xProp->getPropertyValue("URL"); - aProp >>= aURL; - } - catch(const UnknownPropertyException &) - { - } - } - - if( !aURL.isEmpty() ) - { - // SRC - prependArg( "SRC", OUStringToOString( aURL, m_aEncoding ).getStr() ); - } - } -} - -void XPlugin_Impl::initInstance( const PluginDescription& rDescription, - const Sequence< OUString >& argn, - const Sequence< OUString >& argv, - sal_Int16 mode ) -{ - Guard< Mutex > aGuard( m_aMutex ); - - m_aDescription = rDescription; - initArgs( argn, argv, mode ); - handleSpecialArgs(); -} - -void XPlugin_Impl::initInstance( const OUString& rURL, - const Sequence< OUString >& argn, - const Sequence< OUString >& argv, - sal_Int16 mode ) -{ - Guard< Mutex > aGuard( m_aMutex ); - - initArgs( argn, argv, mode ); - m_aDescription = fitDescription( rURL ); - - m_xModel = new PluginModel( rURL, m_aDescription.Mimetype ); - handleSpecialArgs(); -} - -void XPlugin_Impl::modelChanged() -{ - Guard< Mutex > aGuard( m_aMutex ); - - m_nProvidingState = PROVIDING_MODEL_UPDATE; - - m_aDescription = fitDescription( getCreationURL() ); - destroyInstance(); - if( m_aDescription.Mimetype.isEmpty() ) - { - m_nProvidingState = PROVIDING_NONE; - return; - } - - OUString aURL = getCreationURL(); - provideNewStream( m_aDescription.Mimetype, - uno::Reference< XActiveDataSource >(), - aURL, - 0, 0, comphelper::isFileUrl(aURL) ); - m_nProvidingState = PROVIDING_NONE; -} - -OUString XPlugin_Impl::getCreationURL() -{ - Guard< Mutex > aGuard( m_aMutex ); - - OUString aRet; - uno::Reference< css::beans::XPropertySet > xPS( m_xModel, UNO_QUERY ); - if( xPS.is() ) - { - Any aValue = xPS->getPropertyValue("URL"); - aValue >>= aRet; - } - return aRet; -} - - -sal_Bool XPlugin_Impl::setModel( const uno::Reference< css::awt::XControlModel > & Model ) - throw( RuntimeException, std::exception ) -{ - Guard< Mutex > aGuard( m_aMutex ); - - uno::Reference< css::beans::XPropertySet > xPS( Model, UNO_QUERY ); - if( ! xPS.is() ) - return sal_False; - - if( !getCreationURL().isEmpty() ) - { - m_xModel = Model; - modelChanged(); - xPS->addPropertyChangeListener( OUString(), this ); - return sal_True; - } - return sal_False; -} - -void XPlugin_Impl::createPeer( const uno::Reference< css::awt::XToolkit > & xToolkit, const uno::Reference< css::awt::XWindowPeer > & Parent ) - throw( RuntimeException, std::exception ) -{ - Guard< Mutex > aGuard( m_aMutex ); - - if( ! _xPeer.is() ) - { - if( ! Parent.is() ) - throw RuntimeException(); - PluginControl_Impl::createPeer( xToolkit, Parent ); - } -} - -void XPlugin_Impl::loadPlugin() -{ - Guard< Mutex > aGuard( m_aMutex ); - - std::list::iterator iter; - for( iter = ::PluginManager::get().getPluginComms().begin(); - iter != ::PluginManager::get().getPluginComms().end(); ++iter ) - { - if( OStringToOUString( (*iter)->getLibName(), m_aEncoding ) == m_aDescription.PluginName ) - { - setPluginComm( *iter ); - break; - } - } - const SystemEnvData* pEnvData = getSysChildSysData(); -#if defined( UNX ) && !(defined(MACOSX)) - if (pEnvData->pDisplay) // headless? - { - XSync( static_cast(pEnvData->pDisplay), False ); - } -#endif - if( ! getPluginComm() ) - { - if( !m_aDescription.PluginName.isEmpty() ) - { -#if defined MACOSX - PluginComm* pComm = new MacPluginComm( m_aDescription.Mimetype, - m_aDescription.PluginName, - pEnvData->mpNSView ); -#elif defined UNX - // need a new PluginComm - PluginComm* pComm = nullptr; - int sv[2]; - if( !socketpair( AF_UNIX, SOCK_STREAM, 0, sv ) ) - pComm = new UnxPluginComm( m_aDescription.Mimetype, - m_aDescription.PluginName, - (Window)pEnvData->aWindow, - sv[0], - sv[1] - ); - - SAL_WARN_IF( !pComm, "extensions.plugin", "no PluginComm"); - if (!pComm) - return; - -#elif defined WNT - PluginComm* pComm; - try { - pComm = new PluginComm_Impl( - m_aDescription.Mimetype, m_aDescription.PluginName, - (HWND)pEnvData->hWnd); - } catch (PluginComm_Impl::CannotInitializeException &) { - return; - } -#endif - - setPluginComm( pComm ); - } - else - return; - } - - getPluginComm()-> - NPP_New( const_cast(OUStringToOString( m_aDescription.Mimetype, - m_aEncoding).getStr()), - &getNPPInstance(), - m_aPluginMode == PluginMode::FULL ? NP_FULL : NP_EMBED, - ::sal::static_int_cast< int16_t, int >( m_nArgs ), - const_cast(m_nArgs ? m_pArgn : nullptr), - const_cast(m_nArgs ? m_pArgv : nullptr), - nullptr ); -#ifdef MACOSX - // m_aNPWindow is set up in the MacPluginComm from the view - SetSysPlugDataParentView(*pEnvData); -#elif defined( UNX ) - if (pEnvData->pDisplay) // headless? - { - XSync( static_cast(pEnvData->pDisplay), False ); - m_aNPWindow.window = reinterpret_cast(pEnvData->aWindow); - } - else - { - m_aNPWindow.window = nullptr; - } - m_aNPWindow.ws_info = nullptr; -#else - m_aNPWindow.window = (void*)pEnvData->hWnd; -#endif - css::awt::Rectangle aPosSize = getPosSize(); - - for( int i = 0; i < m_nArgs; i++ ) - { - OString aName( m_pArgn[i] ); - if( aName.equalsIgnoreAsciiCase( "width" ) ) - { - OString aValue( m_pArgv[i] ); - aPosSize.Width = aValue.toInt32(); - } - else if( aName.equalsIgnoreAsciiCase( "height" ) ) - { - OString aValue( m_pArgv[i] ); - aPosSize.Height = aValue.toInt32(); - } - } - - m_aNPWindow.clipRect.top = 0; - m_aNPWindow.clipRect.left = 0; - m_aNPWindow.clipRect.bottom = ::sal::static_int_cast< uint16_t, sal_Int32 >( aPosSize.Height ); - m_aNPWindow.clipRect.right = ::sal::static_int_cast< uint16_t, sal_Int32 >( aPosSize.Width ); - m_aNPWindow.type = NPWindowTypeWindow; - - m_aNPWindow.x = 0; - m_aNPWindow.y = 0; - m_aNPWindow.width = aPosSize.Width ? aPosSize.Width : 600; - m_aNPWindow.height = aPosSize.Height ? aPosSize.Height : 600; - - getPluginComm()->NPP_SetWindow( this ); -} - -void XPlugin_Impl::destroyStreams() -{ - Guard< Mutex > aGuard( m_aMutex ); - - // 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 aLocalList( m_aInputStreams ); - for( std::list::iterator it = aLocalList.begin(); - it != aLocalList.end(); ++it ) - (*it)->setMode( -1 ); -} - -PluginStream* XPlugin_Impl::getStreamFromNPStream( NPStream* stream ) -{ - Guard< Mutex > aGuard( m_aMutex ); - - std::list::iterator iter; - for( iter = m_aInputStreams.begin(); iter != m_aInputStreams.end(); ++iter ) - if( &(*iter)->getStream() == stream ) - return *iter; - - std::list::iterator iter2; - for( iter2 = m_aOutputStreams.begin(); iter2 != m_aOutputStreams.end(); ++iter2 ) - if( &(*iter2)->getStream() == stream ) - return *iter2; - - return nullptr; -} - -sal_Bool XPlugin_Impl::provideNewStream(const OUString& mimetype, - const uno::Reference< css::io::XActiveDataSource > & stream, - const OUString& url, sal_Int32 length, - sal_Int32 lastmodified, sal_Bool isfile) throw(std::exception) - -{ - Guard< Mutex > aGuard( m_aMutex ); - bool bRet = false; - - if( m_nProvidingState != PROVIDING_NONE ) - { - m_nProvidingState = PROVIDING_NOW; - Any aAny; - aAny <<= url; - uno::Reference< css::beans::XPropertySet > xPS( m_xModel, UNO_QUERY ); - if( xPS.is() ) - { - try - { - xPS->setPropertyValue("URL", aAny ); - aAny <<= mimetype; - xPS->setPropertyValue("TYPE", aAny ); - } - catch(...) - { - } - } - } - m_nProvidingState = PROVIDING_NOW; - - OString aMIME; - if( !mimetype.isEmpty() ) - aMIME = OUStringToOString( mimetype, m_aEncoding ); - else - aMIME = OUStringToOString( m_aDescription.Mimetype, m_aEncoding ); - - OString aURL = OUStringToOString( url, m_aEncoding ); - - // check whether there is a notifylistener for this stream - // this means that the stream is created from the plugin - // via NPN_GetURLNotify or NPN_PostURLNotify - std::list::iterator iter; - for( iter = m_aPEventListeners.begin(); - iter != m_aPEventListeners.end(); - ++iter ) - { - if( (*iter)->getNormalizedURL() == aURL ) - { - aURL = (*iter)->getURL(); - break; - } - } - - if( ! m_pPluginComm ) - { - loadPlugin(); - if( !m_aLastGetUrl.isEmpty() && m_aLastGetUrl == aURL ) - { - // plugin is pulling data, don't push the same stream; - // this complicated method could have been avoided if - // all plugins respected the SRC parameter; but e.g. - // acrobat reader plugin does not - m_nProvidingState = PROVIDING_NONE; - return sal_True; - } - } - if( ! m_pPluginComm ) - return sal_False; - - if( url.isEmpty() ) - // this is valid if the plugin is supposed to - // pull data (via e.g. NPN_GetURL) - return sal_True; - - // set mimetype on model - { - uno::Reference< css::beans::XPropertySet > xPS( m_xModel, UNO_QUERY ); - if( xPS.is() ) - { - try - { - Any aAny; - aAny <<= m_aDescription.Mimetype; - xPS->setPropertyValue("TYPE", aAny ); - } - catch(...) - { - } - } - } - - // there may be plugins that can use the file length information, - // but currently none are known. Since this file opening/seeking/closing - // is rather costly, it is not implemented. If there are plugins known to - // make use of the file length, simply put it in - - PluginInputStream* pStream = new PluginInputStream( this, aURL.getStr(), - length, lastmodified ); - uno::Reference< css::io::XOutputStream > xNewStream( pStream ); - - if( iter != m_aPEventListeners.end() ) - pStream->getStream().notifyData = (*iter)->getNotifyData(); - - uint16_t stype = 0; - - // special handling acrobat reader - // presenting a seekable stream to it does not seem to work correctly - if( aMIME.equals( "application/pdf" ) ) - isfile = sal_False; - -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, - "new stream \"%s\" of MIMEType \"%s\"\n" - "for plugin \"%s\"\n" - "seekable = %s, length = %" SAL_PRIdINT32 "\n", - aURL.getStr(), aMIME.getStr(), getPluginComm()->getLibName().getStr(), - isfile ? "true" : "false", length ); - -#endif - if( ! m_pPluginComm->NPP_NewStream( &m_aInstance, - const_cast(aMIME.getStr()), - &pStream->getStream(), isfile, - &stype ) ) - { -#if OSL_DEBUG_LEVEL > 1 - const 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 ) - { - OString aFileName; - if( comphelper::isFileUrl(url) ) - { - OUString aSysName; - osl_getSystemPathFromFileURL( url.pData, &aSysName.pData ); - aFileName = OUStringToOString( aSysName, m_aEncoding ); - } - else - aFileName = OUStringToOString( url, m_aEncoding ); - m_pPluginComm-> - NPP_StreamAsFile( &m_aInstance, - &pStream->getStream(), - aFileName.getStr() ); - } - else - { - pStream->setMode( stype ); - - if( ! stream.is() ) - { - // stream has to be loaded by PluginStream itself via UCB - pStream->load(); - } - else - { - uno::Reference< css::io::XConnectable > xConnectable( stream, UNO_QUERY ); - pStream->setPredecessor( xConnectable ); - if( xConnectable.is() ) - { - xConnectable->setSuccessor( static_cast< css::io::XConnectable* >(pStream) ); - while( xConnectable->getPredecessor().is() ) - xConnectable = xConnectable->getPredecessor(); - } - stream->setOutputStream( xNewStream ); - pStream->setSource( stream ); - uno::Reference< css::io::XActiveDataControl > xController; - if( xConnectable.is() ) - xController.set( xConnectable, UNO_QUERY ); - else - xController.set( stream, UNO_QUERY ); - - if( xController.is() ) - xController->start(); - } - } - bRet = true; - } - - m_nProvidingState = PROVIDING_NONE; - - return bRet; -} - -void XPlugin_Impl::disposing( const css::lang::EventObject& /*rSource*/ ) throw(std::exception) -{ -} - -void XPlugin_Impl::propertyChange(const css::beans::PropertyChangeEvent& rEvent) - throw (css::uno::RuntimeException, std::exception) -{ - Guard< Mutex > aGuard( m_aMutex ); - - if( rEvent.PropertyName == "URL" ) - { - OUString aStr; - rEvent.NewValue >>= aStr; - if( m_nProvidingState == PROVIDING_NONE ) - { - if( aStr != m_aURL ) - { - m_aURL = aStr; - modelChanged(); - } - } - } -} - -void XPlugin_Impl::setPluginContext( const uno::Reference< 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, std::exception ) -{ - Guard< Mutex > aGuard( m_aMutex ); - -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "XPlugin_Impl::setPosSize( %" SAL_PRIdINT32 ", %" SAL_PRIdINT32 ", %" SAL_PRIdINT32 ", %" SAL_PRIdINT32 ", %d )\n", - nX_, nY_, nWidth_, nHeight_, nFlags ); -#endif - - PluginControl_Impl::setPosSize(nX_, nY_, nWidth_, nHeight_, nFlags); - - m_aNPWindow.x = 0; - m_aNPWindow.y = 0; - m_aNPWindow.width = nWidth_; - m_aNPWindow.height = nHeight_; - m_aNPWindow.clipRect.top = 0; - m_aNPWindow.clipRect.left = 0; - m_aNPWindow.clipRect.right = ::sal::static_int_cast< uint16_t, sal_Int32 >( nWidth_ ); - m_aNPWindow.clipRect.bottom = ::sal::static_int_cast< uint16_t, sal_Int32 >( nHeight_ ); - - if( getPluginComm() ) - getPluginComm()->NPP_SetWindow( this ); -} - -PluginDescription XPlugin_Impl::fitDescription( const OUString& rURL ) -{ - uno::Reference< XPluginManager > xPMgr( plugin::PluginManager::create(comphelper::getComponentContext(m_xSMgr)) ); - - Sequence< PluginDescription > aDescrs = xPMgr->getPluginDescriptions(); - const PluginDescription* pDescrs = aDescrs.getConstArray(); - - for( int nArg = 0; nArg < m_nArgs; nArg++ ) - { - if( strncmp( m_pArgn[nArg], "TYPE", 4 ) == 0 && - m_pArgn[nArg][4] == 0 ) - { - for( int i = 0; i < aDescrs.getLength(); i++ ) - { - if( pDescrs[i].Mimetype.equalsAscii( m_pArgv[nArg] ) ) - return pDescrs[i]; - } - } - } - - int nPos = rURL.lastIndexOf( (sal_Unicode)'.' ); - if( nPos != -1 ) - { - OUString const aExt = rURL.copy( nPos ).toAsciiLowerCase(); - for( int i = 0; i < aDescrs.getLength(); i++ ) - { - OUString aThisExt = pDescrs[ i ].Extension.toAsciiLowerCase(); - if( aThisExt.indexOf( aExt ) != -1 ) - { - return pDescrs[i]; - } - } - } - return PluginDescription(); -} - - -PluginStream::PluginStream( XPlugin_Impl* pPlugin, - const char* url, sal_uInt32 len, sal_uInt32 lastmod) - : m_wPlugin(static_cast< ::cppu::OWeakObject* >(pPlugin)) - , 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() -{ - uno::Reference const xPlugin(m_wPlugin); - XPlugin_Impl *const pPlugin(m_pPlugin); - if (xPlugin.is() && pPlugin) - { - Guard< Mutex > aGuard( pPlugin->getMutex() ); - - 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 ); - } - } - ::free( const_cast(m_aNPStream.url) ); -} - -PluginInputStream::PluginInputStream( XPlugin_Impl* pPlugin, - const char* url, - sal_uInt32 len, - sal_uInt32 lastmod ) : - PluginStream( pPlugin, url, len, lastmod ), - m_pContent( nullptr ), - m_nMode( NP_NORMAL ), - m_nWritePos( 0 ) -{ - assert(m_pPlugin); - Guard< Mutex > aGuard( m_pPlugin->getMutex() ); - - m_pPlugin->getInputStreams().push_back( this ); - OUString aTmpFile; - osl::FileBase::createTempFile( nullptr, nullptr, &aTmpFile ); - - // set correct extension, some plugins need that - OUString aName( m_aNPStream.url, strlen( m_aNPStream.url ), m_pPlugin->getTextEncoding() ); - OUString aExtension; - sal_Int32 nSepInd = aName.lastIndexOf('.'); - if( nSepInd != -1 ) - { - aExtension = aName.copy( nSepInd + 1, aName.getLength() - nSepInd - 1 ); - } - if( !aExtension.isEmpty() ) - { - aTmpFile += aExtension; - } - m_aFileStream.Open( aTmpFile, StreamMode::READ | StreamMode::WRITE ); - if( ! m_aFileStream.IsOpen() ) - { - // might be that the extension scrambled the whole filename - osl::FileBase::createTempFile( nullptr, nullptr, &aTmpFile ); - m_aFileStream.Open( aTmpFile, StreamMode::READ | StreamMode::WRITE ); - } -} - -PluginInputStream::~PluginInputStream() -{ - OUString aFile( m_aFileStream.GetFileName() ); - - m_aFileStream.Close(); - - uno::Reference const xPlugin(m_wPlugin); - XPlugin_Impl *const pPlugin(m_pPlugin); - if (xPlugin.is() && pPlugin) - { - Guard< Mutex > aGuard( pPlugin->getMutex() ); - - pPlugin->getInputStreams().remove( this ); - - if( m_pPlugin ) - { - OString aFileName(OUStringToOString(aFile, m_pPlugin->getTextEncoding())); - if( m_pPlugin->getPluginComm() && m_nMode != -1 ) - // mode -1 means either an error occurred, - // 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.getStr() ); - } - m_pPlugin->getPluginComm()->NPP_SetWindow( m_pPlugin ); - m_pPlugin->getInputStreams().remove( this ); - } - else - osl::File::remove( aFile ); - } - else - osl::File::remove( aFile ); - } - else - osl::File::remove( aFile ); - delete m_pContent; -} - -PluginStreamType PluginInputStream::getStreamType() -{ - return InputStream; -} - -void PluginInputStream::load() -{ - Guard< Mutex > aGuard( m_pPlugin->getMutex() ); - - INetURLObject aUrl; - aUrl.SetSmartProtocol( INetProtocol::File ); - aUrl.SetSmartURL( - OUString( getStream().url, - strlen( getStream().url ), - RTL_TEXTENCODING_MS_1252 - ) ); - try - { - m_pContent = - new ::ucbhelper::Content( - aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI), - uno::Reference< css::ucb::XCommandEnvironment >(), - comphelper::getProcessComponentContext() - ); - m_pContent->openStream( static_cast< XOutputStream* >( this ) ); - } - catch(const css::uno::Exception &) - { - } -} - -void PluginInputStream::setMode( sal_Int32 nMode ) -{ - assert(m_pPlugin); // this is currently only called from two places... - Guard< Mutex > aGuard( m_pPlugin->getMutex() ); - - m_nMode = nMode; - - // invalidation by plugin - if (m_nMode == -1) - { - m_pPlugin->getInputStreams().remove( this ); - m_pPlugin = nullptr; - m_wPlugin.clear(); - } -} - -void PluginInputStream::writeBytes( const Sequence& Buffer ) throw(std::exception) -{ - uno::Reference const xPlugin(m_wPlugin); - XPlugin_Impl *const pPlugin(m_pPlugin); - if (!xPlugin.is() || !pPlugin) - return; - - Guard< Mutex > aGuard( pPlugin->getMutex() ); - - m_aFileStream.Seek( STREAM_SEEK_TO_END ); - m_aFileStream.Write( Buffer.getConstArray(), Buffer.getLength() ); - - if( m_nMode == NP_SEEK ) - // hold reference, stream gets destroyed in NPN_DestroyStream - m_xSelf = this; - - if( m_nMode == -1 || !m_pPlugin->getPluginComm() ) - return; - - sal_Size nPos = m_aFileStream.Tell(); - sal_Size nBytes = 0; - while( m_nMode != NP_ASFILEONLY && - m_nWritePos < nPos && - (nBytes = m_pPlugin->getPluginComm()-> NPP_WriteReady( - &m_pPlugin->getNPPInstance(), &m_aNPStream )) > 0 ) - { - nBytes = (nBytes > nPos - m_nWritePos) ? nPos - m_nWritePos : nBytes; - - std::unique_ptr pBuffer(new char[ nBytes ]); - m_aFileStream.Seek( m_nWritePos ); - nBytes = m_aFileStream.Read( pBuffer.get(), nBytes ); - - int32_t nBytesRead = 0; - try - { - nBytesRead = m_pPlugin->getPluginComm()->NPP_Write( - &m_pPlugin->getNPPInstance(), &m_aNPStream, m_nWritePos, nBytes, pBuffer.get() ); - } - catch( ... ) - { - nBytesRead = 0; - } - - if( nBytesRead < 0 ) - { - m_nMode = -1; - return; - } - - m_nWritePos += nBytesRead; - } -} - -void PluginInputStream::closeOutput() throw(std::exception) -{ - uno::Reference const xPlugin(m_wPlugin); - XPlugin_Impl *const pPlugin(m_pPlugin); - if (!xPlugin.is() || !pPlugin) - return; - - Guard< Mutex > aGuard( pPlugin->getMutex() ); - - flush(); - m_xSource.clear(); -} - -sal_uInt32 PluginInputStream::read( sal_uInt32 offset, sal_Int8* buffer, sal_uInt32 size ) -{ - uno::Reference const xPlugin(m_wPlugin); - XPlugin_Impl *const pPlugin(m_pPlugin); - if (!xPlugin.is() || !pPlugin) - return 0; - - Guard< Mutex > aGuard( pPlugin->getMutex() ); - - if( m_nMode != NP_SEEK ) - return 0; - - m_aFileStream.Seek( offset ); - return m_aFileStream.Read( buffer, size ); -} - -void PluginInputStream::flush() throw(std::exception) -{ -} - -PluginOutputStream::PluginOutputStream( XPlugin_Impl* pPlugin, - const char* url, - sal_uInt32 len, - sal_uInt32 lastmod ) : - PluginStream( pPlugin, url, len, lastmod ), - m_xStream( pPlugin->getServiceManager()->createInstance("com.sun.star.io.DataOutputStream"), UNO_QUERY ) -{ - Guard< Mutex > aGuard( m_pPlugin->getMutex() ); - - m_pPlugin->getOutputStreams().push_back( this ); -} - -PluginOutputStream::~PluginOutputStream() -{ - Guard< Mutex > aGuard( m_pPlugin->getMutex() ); - - m_pPlugin->getOutputStreams().remove( this ); -} - -PluginStreamType PluginOutputStream::getStreamType() -{ - return OutputStream; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/aqua/sysplug.hxx b/extensions/source/plugin/inc/plugin/aqua/sysplug.hxx deleted file mode 100644 index 3a1638a9381e..000000000000 --- a/extensions/source/plugin/inc/plugin/aqua/sysplug.hxx +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_AQUA_SYSPLUG_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_AQUA_SYSPLUG_HXX - -#include - -#include -#include -#include -#include "premac.h" -#include -#include -#include "postmac.h" -#undef uint32 - -#define XP_MAC -#include "npapi.h" -#include "npsdk/npupp.h" - -#include "plugin/plcom.hxx" - -#include "vcl/sysdata.hxx" -#include "vcl/threadex.hxx" -#include "vcl/timer.hxx" -#include "osl/module.h" - -#ifdef __OBJC__ -@class NSView; -#else -class NSView; -#endif - -class XPlugin_Impl; - -namespace plugstringhelper -{ -OUString getString( CFStringRef i_xString ); -OUString getString( CFURLRef i_xURL ); -CFMutableStringRef createString( const OUString& i_rString ); -CFURLRef createURL( const OUString& i_rString ); -OUString getURLFromPath( const OUString& i_rPath ); -CFURLRef createURLFromPath( const OUString& i_rPath ); -OUString CFURLtoOSLURL( CFURLRef i_xURL ); -} - - -class MacPluginComm : - public PluginComm, - public vcl::SolarThreadExecutor - -{ - enum CallType { - eNPP_Destroy, - eNPP_DestroyStream, - eNPP_GetJavaClass, - eNPP_Initialize, - eNPP_New, - eNPP_NewStream, - eNPP_Print, - eNPP_SetWindow, - eNPP_Shutdown, - eNPP_StreamAsFile, - eNPP_URLNotify, - eNPP_Write, - eNPP_WriteReady, - eNPP_GetValue, - eNPP_SetValue, - eNPP_HandleEvent, - eNP_Initialize - }; - - void* m_aArgs[ 8 ]; - CallType m_eCall; - - virtual long doIt(); -public: - MacPluginComm( const OUString& rMIME, const OUString& rName, NSView* pView ); - virtual ~MacPluginComm(); - - // FIXME: - // this actually should be from the NP headers - // but currently we have too old a version - // changes this when we have updated our headers - typedef struct NP_CGContext - { - CGContextRef context; - WindowRef window; - } NP_CGContext; - -public: - virtual NPError NPP_Destroy( NPP instance, NPSavedData** save ); - virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason ); - virtual NPError NPP_Initialize(); - virtual NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, - char* argn[], char* argv[], NPSavedData *saved ); - virtual NPError NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream, - NPBool seekable, uint16_t* 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_t NPP_Write( NPP instance, NPStream* stream, int32_t offset, - int32_t len, void* buffer ); - virtual int32_t NPP_WriteReady( NPP instance, NPStream* stream ); - virtual NPError NPP_GetValue( NPP instance, NPPVariable variable, void *ret_value ); - virtual int16_t NPP_HandleEvent( NPP instance, void* event ); - - virtual NPError NPP_SetWindow( XPlugin_Impl* ); - virtual NPError NPP_Destroy( XPlugin_Impl*, NPSavedData** save ); - - void drawView( XPlugin_Impl* ); -private: - sal_Bool retrieveFunction( const char* i_pName, void** i_ppFunc ) const; - DECL_LINK_TYPED( NullTimerHdl, Timer*, void ); - -private: - CFBundleRef m_xBundle; - oslModule m_hPlugLib; - NPPluginFuncs m_aNPPfuncs; - - // timer for sending nullEvents - AutoTimer* m_pNullTimer; - std::list< XPlugin_Impl* > m_aNullEventClients; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/impl.hxx b/extensions/source/plugin/inc/plugin/impl.hxx deleted file mode 100644 index 85d74184a05b..000000000000 --- a/extensions/source/plugin/inc/plugin/impl.hxx +++ /dev/null @@ -1,437 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_IMPL_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_IMPL_HXX - -#include - -#include -#include - -#include "cppuhelper/weak.hxx" - -#include "com/sun/star/awt/Key.hpp" -#include "com/sun/star/awt/KeyFunction.hpp" -#include "com/sun/star/beans/PropertyAttribute.hpp" -#include "com/sun/star/plugin/PluginMode.hpp" -#include "com/sun/star/plugin/PluginDescription.hpp" -#include "com/sun/star/plugin/PluginException.hpp" -#include "com/sun/star/plugin/PluginVariable.hpp" -#include "com/sun/star/plugin/XPlugin.hpp" -#include "com/sun/star/plugin/XPluginManager.hpp" -#include "com/sun/star/plugin/XPluginContext.hpp" -#include "com/sun/star/io/XConnectable.hpp" -#include "com/sun/star/io/XOutputStream.hpp" -#include "com/sun/star/io/XDataOutputStream.hpp" -#include "com/sun/star/io/XActiveDataControl.hpp" -#include "com/sun/star/io/XDataInputStream.hpp" -#include "com/sun/star/io/XMarkableStream.hpp" -#include "com/sun/star/io/XInputStream.hpp" -#include "com/sun/star/io/XStreamListener.hpp" -#include "com/sun/star/io/XActiveDataSink.hpp" -#include "com/sun/star/io/XActiveDataSource.hpp" -#include "com/sun/star/lang/XServiceName.hpp" -#include "com/sun/star/lang/XServiceInfo.hpp" -#include "com/sun/star/lang/XMultiServiceFactory.hpp" -#include "com/sun/star/lang/XSingleServiceFactory.hpp" -#include "com/sun/star/awt/GradientStyle.hpp" -#include "com/sun/star/awt/RasterOperation.hpp" -#include "com/sun/star/awt/Gradient.hpp" -#include "com/sun/star/awt/XGraphics.hpp" -#include - -#include "cppuhelper/implbase2.hxx" -#include "cppuhelper/implbase1.hxx" - -#include - -#ifdef WNT -#include -#elif defined(MACOSX) -#include "plugin/aqua/sysplug.hxx" -#elif defined(UNX) -#include "plugin/unx/sysplug.hxx" -#endif - -struct SysPlugData; - -std::shared_ptr CreateSysPlugData(); - -extern "C" { - -void /*SAL_CALL NP_LOADDS*/ NPN_ForceRedraw_Impl(NPP instance); -NPError /*SAL_CALL NP_LOADDS*/ NPN_SetValue_Impl( NPP instance, - NPPVariable variable, - void* value ); -} // extern "C" - -#include "plugin/plctrl.hxx" -#include "plugin/model.hxx" - -#include "vcl/sysdata.hxx" -#include "vcl/syschild.hxx" - -#include "tools/link.hxx" -#include "tools/stream.hxx" - - -using namespace com::sun::star::uno; - -#define PROVIDING_NONE 0 -#define PROVIDING_NOW 1 -#define PROVIDING_MODEL_UPDATE 2 - -// forwards -namespace ucbhelper { class Content; } -class PluginStream; -class PluginInputStream; -class PluginOutputStream; -class XPlugin_Impl; -class PluginDisposer; -class PluginEventListener; - -class XPlugin_Impl : public css::plugin::XPlugin, - public PluginControl_Impl, - public css::beans::XPropertyChangeListener -{ -private: - ::osl::Mutex m_aMutex; - Reference< css::lang::XMultiServiceFactory > m_xSMgr; - Reference< css::plugin::XPluginContext > m_rBrowserContext; - - PluginComm* m_pPluginComm; - NPP_t m_aInstance; - NPWindow m_aNPWindow; - std::shared_ptr m_pSysPlugData; - rtl_TextEncoding m_aEncoding; - - const char** m_pArgv; - const char** m_pArgn; - int m_nArgs; - OString m_aLastGetUrl; - - Reference< css::awt::XControlModel > m_xModel; - - css::plugin::PluginDescription m_aDescription; - sal_Int16 m_aPluginMode; - - int m_nProvidingState; - int m_nCalledFromPlugin; - PluginDisposer* m_pDisposer; - - ::std::list m_aInputStreams; - ::std::list m_aOutputStreams; - ::std::list m_aPEventListeners; - OUString m_aURL; - - bool m_bIsDisposed; - -#ifdef MACOSX - void SetSysPlugDataParentView(SystemEnvData const& rEnvData); -#endif - - void prependArg( const char* pName, const char* pValue ); // arguments will be strdup'ed - void initArgs( const Sequence< OUString >& argn, - const Sequence< OUString >& argv, - sal_Int16 mode ); - void freeArgs(); - void handleSpecialArgs(); - - void loadPlugin(); - void destroyInstance(); - void modelChanged(); - -public: - XPlugin_Impl( const Reference< css::lang::XMultiServiceFactory > & rSMgr ); - virtual ~XPlugin_Impl(); - - ::osl::Mutex& getMutex() { return m_aMutex; } - - void destroyStreams(); - - void setLastGetUrl( const OString& rUrl ) { m_aLastGetUrl = rUrl; } - - css::plugin::PluginDescription fitDescription( const OUString& rURL ); - - ::std::list& getInputStreams() { return m_aInputStreams; } - ::std::list& getOutputStreams() { return m_aOutputStreams; } - PluginComm* getPluginComm() { return m_pPluginComm; } - void setPluginComm( PluginComm* comm ) - { - if( ! m_pPluginComm ) - { - m_pPluginComm = comm; - m_pPluginComm->addRef(); - } - } - Reference< css::lang::XMultiServiceFactory > getServiceManager() { return m_xSMgr; } - const css::plugin::PluginDescription& getDescription() const { return m_aDescription; } - rtl_TextEncoding getTextEncoding() { return m_aEncoding; } - NPP_t& getNPPInstance() { return m_aInstance; } - NPWindow& getNPWindow() { return m_aNPWindow; } - - void enterPluginCallback() { m_nCalledFromPlugin++; } - void leavePluginCallback() { m_nCalledFromPlugin--; } - bool isDisposable() { return m_nCalledFromPlugin < 1; } - DECL_LINK_TYPED( secondLevelDispose, void*, void ); - - void addPluginEventListener( PluginEventListener* pListener ) - { m_aPEventListeners.push_back( pListener ); } - void checkListeners( const char* normalizedURL ); - - void initInstance( - const css::plugin::PluginDescription& rDescription, - const Sequence< OUString >& argn, - const Sequence< OUString >& argv, - sal_Int16 mode ); - void initInstance( - const OUString& rURL, - const Sequence< OUString >& argn, - const Sequence< OUString >& argv, - sal_Int16 mode ); - - const OUString& getRefererURL() { return m_aURL; } - OUString getCreationURL(); - - PluginStream* getStreamFromNPStream( NPStream* ); - - const SystemEnvData* getSysChildSysData() - { return _pSysChild->GetSystemData(); } - - const Reference< css::plugin::XPluginContext > & getPluginContext() const - { return m_rBrowserContext; } - void setPluginContext( const Reference< css::plugin::XPluginContext > & ); - - // XInterface - virtual Any SAL_CALL queryInterface( const Type& ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL acquire() throw() override - { OWeakAggObject::acquire(); } - virtual void SAL_CALL release() throw() override - { OWeakAggObject::release(); } - - // OWeakAggObject - virtual Any SAL_CALL queryAggregation( const Type& ) - throw( css::uno::RuntimeException, std::exception ) override; - - // PluginContol_Impl - virtual void SAL_CALL dispose() throw(std::exception) override; - virtual void SAL_CALL createPeer( const Reference< css::awt::XToolkit > & xToolkit, const Reference< css::awt::XWindowPeer > & Parent) throw( RuntimeException, std::exception ) override; - - virtual sal_Bool SAL_CALL setModel( const Reference< css::awt::XControlModel > & Model ) throw( RuntimeException, std::exception ) override; - virtual Reference< css::awt::XControlModel > SAL_CALL getModel()throw( RuntimeException, std::exception ) override - { 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, std::exception ) override; - - // css::plugin::XPlugin - virtual sal_Bool SAL_CALL provideNewStream(const OUString& mimetype, const Reference< css::io::XActiveDataSource > & stream, const OUString& url, sal_Int32 length, sal_Int32 lastmodified, sal_Bool isfile) throw(std::exception) override; - - // css::beans::XPropertyChangeListener - virtual void SAL_CALL disposing( const css::lang::EventObject& rSource ) throw(std::exception) override; - virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& rEvent) - throw (css::uno::RuntimeException, std::exception) override; -}; - -class PluginManager -{ -private: - Reference< css::lang::XMultiServiceFactory > m_xSMgr; - ::std::list m_aPluginComms; - ::std::list m_aAllPlugins; - ::osl::Mutex m_aPluginMutex; - - static PluginManager* pManager; - - PluginManager(); -public: - - static PluginManager& get(); - static void setServiceFactory( const Reference< css::lang::XMultiServiceFactory >& xFactory ); - static const Sequence< OUString >& getAdditionalSearchPaths(); - - ::std::list& getPluginComms() { return m_aPluginComms; } - ::std::list& getPlugins() { return m_aAllPlugins; } - ::osl::Mutex& getPluginMutex() { return m_aPluginMutex; } -}; - -class XPluginManager_Impl : - public cppu::WeakAggImplHelper2< css::plugin::XPluginManager, - css::lang::XServiceInfo > -{ - Reference< css::uno::XComponentContext > m_xContext; -public: - XPluginManager_Impl( const Reference< css::uno::XComponentContext > & ); - virtual ~XPluginManager_Impl(); - - static XPlugin_Impl* getXPluginFromNPP( NPP ); - static XPlugin_Impl* getPluginImplementation( const Reference< css::plugin::XPlugin >& plugin ); - - virtual Reference< css::plugin::XPluginContext > SAL_CALL createPluginContext() throw(std::exception) override; - - // has to be implemented per system - static Sequence< css::plugin::PluginDescription > SAL_CALL impl_getPluginDescriptions() throw(css::uno::RuntimeException, std::exception); - // calls system specific impl_getPluginDescriptions - // checks whether plugins are disabled - virtual Sequence< css::plugin::PluginDescription > SAL_CALL getPluginDescriptions() - throw (css::uno::RuntimeException, std::exception) override; - - virtual Reference< css::plugin::XPlugin > SAL_CALL createPlugin( const Reference< css::plugin::XPluginContext > & acontext, sal_Int16 mode, const Sequence< OUString >& argn, const Sequence< OUString >& argv, const css::plugin::PluginDescription& plugintype) throw( RuntimeException,css::plugin::PluginException, std::exception ) override; - - virtual Reference< css::plugin::XPlugin > SAL_CALL createPluginFromURL( const Reference< css::plugin::XPluginContext > & acontext, sal_Int16 mode, const Sequence< OUString >& argn, const Sequence< OUString >& argv, const Reference< css::awt::XToolkit > & toolkit, const Reference< css::awt::XWindowPeer > & parent, const OUString& url ) throw (css::uno::RuntimeException, std::exception) override; - - virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw() override; - virtual OUString SAL_CALL getImplementationName() throw() override; - - Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( ) override; - static Sequence< OUString > getSupportedServiceNames_Static() throw( ); - static OUString getImplementationName_Static() throw( ) - { - /** the soplayer uses this name in its source! maybe not after 5.2 */ - return OUString( "com.sun.star.extensions.PluginManager" ); - } -}; -Reference< XInterface > SAL_CALL PluginManager_CreateInstance( const Reference< css::lang::XMultiServiceFactory > & ) throw( Exception ); - -enum PluginStreamType { InputStream, OutputStream }; - -class PluginStream -{ -protected: - css::uno::WeakReference m_wPlugin; - 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; } - - virtual PluginStreamType getStreamType() = 0; -}; - -class PluginInputStream : - public PluginStream, - public cppu::WeakAggImplHelper2< - css::io::XOutputStream, - css::io::XConnectable - > -{ -private: - ::ucbhelper::Content* m_pContent; - sal_Int32 m_nMode; - sal_uInt32 m_nWritePos; - - Reference< css::io::XActiveDataSource > m_xSource; - // hold a reference on input until closeOutput is called - - Reference< css::io::XConnectable > m_xPredecessor; - Reference< css::io::XConnectable > m_xSuccessor; - - // needed to hold a reference to self in NP_SEEK mode - Reference< css::io::XOutputStream > m_xSelf; - - SvFileStream m_aFileStream; -public: - PluginInputStream( XPlugin_Impl* pPlugin, - const char* url, sal_uInt32 len, sal_uInt32 lastmod ); - - PluginInputStream() : PluginStream( nullptr, nullptr, 0, 0 ) {} - - virtual ~PluginInputStream(); - - virtual PluginStreamType getStreamType() override; - - void setMode( sal_Int32 nMode ); - sal_uInt32 read( sal_uInt32 offset, sal_Int8* buffer, sal_uInt32 size ); - void setSource( const Reference< css::io::XActiveDataSource >& xSource ) { m_xSource = xSource; } - // get contents ot url via ucbhelper::Content - void load(); - - // clear reference - bool releaseSelf() - { bool bRet = m_xSelf.is(); m_xSelf.clear(); return bRet; } - - // XOutputStream - virtual void SAL_CALL writeBytes( const Sequence& ) throw(std::exception) override; - virtual void SAL_CALL flush() throw(std::exception) override; - virtual void SAL_CALL closeOutput() throw(std::exception) override; - - // XConnectable - virtual void SAL_CALL setPredecessor( const Reference< css::io::XConnectable >& xPredecessor ) throw(std::exception) override - { m_xPredecessor = xPredecessor; } - virtual Reference< css::io::XConnectable > SAL_CALL getPredecessor() throw(std::exception) override - { return m_xPredecessor; } - - virtual void SAL_CALL setSuccessor( const Reference< css::io::XConnectable >& xSuccessor ) throw(std::exception) override - { m_xSuccessor = xSuccessor; } - virtual Reference< css::io::XConnectable > SAL_CALL getSuccessor() throw(std::exception) override - { return m_xSuccessor; } -}; - -class PluginOutputStream : public PluginStream -{ -private: - Reference< css::io::XOutputStream > m_xStream; -public: - PluginOutputStream( XPlugin_Impl* pPlugin, const char* url, - sal_uInt32 len, sal_uInt32 lastmod ); - virtual ~PluginOutputStream(); - - virtual PluginStreamType getStreamType() override; - - Reference< css::io::XOutputStream > & getOutputStream() { return m_xStream; } -}; - -class PluginEventListener : - public cppu::WeakAggImplHelper1< css::lang::XEventListener > -{ -private: - XPlugin_Impl* m_pPlugin; - Reference< css::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; } - - // css::lang::XEventListener - virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw(std::exception) override; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/model.hxx b/extensions/source/plugin/inc/plugin/model.hxx deleted file mode 100644 index 227ae6f545bb..000000000000 --- a/extensions/source/plugin/inc/plugin/model.hxx +++ /dev/null @@ -1,132 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_MODEL_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_MODEL_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -using namespace com::sun::star::uno; - -class BroadcasterHelperHolder -{ -protected: - ::cppu::OBroadcastHelper m_aHelper; -public: - BroadcasterHelperHolder( osl::Mutex& rMutex ) : - m_aHelper( rMutex ) {} - ~BroadcasterHelperHolder() {} -}; - -class PluginModel : public BroadcasterHelperHolder, - public cppu::OPropertySetHelper, - public cppu::OPropertyArrayHelper, - public cppu::OWeakAggObject, - public css::lang::XComponent, - public css::io::XPersistObject, - public css::awt::XControlModel -{ - private: - OUString m_aCreationURL; - OUString m_aMimeType; - - std::list< Reference< css::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 OUString& rURL, const OUString& rMimeType ); - virtual ~PluginModel(); - - // XInterface - virtual Any SAL_CALL queryInterface( const Type& rType ) throw( css::uno::RuntimeException, std::exception ) override - { return OWeakAggObject::queryInterface( rType ); } - virtual void SAL_CALL acquire() throw() override - { OWeakAggObject::acquire(); } - virtual void SAL_CALL release() throw() override - { OWeakAggObject::release(); } - - virtual Any SAL_CALL queryAggregation( const Type& ) throw( css::uno::RuntimeException, std::exception ) override; - - - // css::lang::XTypeProvider - - static Sequence< OUString > SAL_CALL getSupportedServiceNames_Static() throw( ); - static OUString SAL_CALL getImplementationName_Static() throw( ) - { - /** the soplayer uses this name in its source! maybe not after 5.2 */ - return OUString( "com.sun.star.extensions.PluginModel" ); - } - - // OPropertySetHelper - virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; - virtual sal_Bool SAL_CALL convertFastPropertyValue( Any & rConvertedValue, - Any & rOldValue, - sal_Int32 nHandle, - const Any& rValue ) throw() override; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, - const Any& rValue ) - throw(css::uno::Exception, std::exception) override; - virtual void SAL_CALL getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const throw() override; - virtual Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(std::exception) override; - - // css::io::XPersistObject - virtual OUString SAL_CALL getServiceName() throw(std::exception) override; - virtual void SAL_CALL write(const Reference< css::io::XObjectOutputStream > & OutStream) throw(std::exception) override; - virtual void SAL_CALL read(const Reference< css::io::XObjectInputStream > & InStream) throw(std::exception) override; - - // css::lang::XComponent - virtual void SAL_CALL addEventListener( const Reference< css::lang::XEventListener > & l ) throw(std::exception) override; - virtual void SAL_CALL removeEventListener( const Reference< css::lang::XEventListener > & l ) throw(std::exception) override; - virtual void SAL_CALL dispose() throw(std::exception) override; - private: - using cppu::OPropertySetHelper::getFastPropertyValue; -}; -Reference< XInterface > SAL_CALL PluginModel_CreateInstance( const Reference< css::lang::XMultiServiceFactory > & ) throw( Exception ); - -#endif // INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_MODEL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/multiplx.hxx b/extensions/source/plugin/inc/plugin/multiplx.hxx deleted file mode 100644 index dc0e480e1b33..000000000000 --- a/extensions/source/plugin/inc/plugin/multiplx.hxx +++ /dev/null @@ -1,169 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_MULTIPLX_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_MULTIPLX_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -using namespace com::sun::star::uno; - -struct MRCListenerMultiplexerHelper_Mutex -{ - ::osl::Mutex aMutex; -}; - -class MRCListenerMultiplexerHelper : - public MRCListenerMultiplexerHelper_Mutex, - - public ::cppu::WeakAggImplHelper7< - css::awt::XFocusListener, - css::awt::XWindowListener, - css::awt::XKeyListener, - css::awt::XMouseListener, - css::awt::XMouseMotionListener, - css::awt::XPaintListener, - css::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< css::awt::XWindow > & rControl, const Reference< css::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< css::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); - - // css::lang::XEventListener - void SAL_CALL disposing(const css::lang::EventObject& Source) throw(std::exception) override; - // css::awt::XFocusListener - void SAL_CALL focusGained(const css::awt::FocusEvent& e) throw(std::exception) override; - void SAL_CALL focusLost(const css::awt::FocusEvent& e) throw(std::exception) override; - // css::awt::XWindowListener - void SAL_CALL windowResized(const css::awt::WindowEvent& e) throw(std::exception) override; - void SAL_CALL windowMoved(const css::awt::WindowEvent& e) throw(std::exception) override; - void SAL_CALL windowShown(const css::lang::EventObject& e) throw(std::exception) override; - void SAL_CALL windowHidden(const css::lang::EventObject& e) throw(std::exception) override; - // css::awt::XKeyListener - void SAL_CALL keyPressed( const css::awt::KeyEvent& e ) throw(std::exception) override; - void SAL_CALL keyReleased( const css::awt::KeyEvent& e ) throw(std::exception) override; - // css::awt::XMouseListener - void SAL_CALL mousePressed(const css::awt::MouseEvent& e) throw(std::exception) override; - void SAL_CALL mouseReleased(const css::awt::MouseEvent& e) throw(std::exception) override; - void SAL_CALL mouseEntered(const css::awt::MouseEvent& e) throw(std::exception) override; - void SAL_CALL mouseExited(const css::awt::MouseEvent& e) throw(std::exception) override; - // css::awt::XMouseMotionListener - void SAL_CALL mouseDragged(const css::awt::MouseEvent& e) throw(std::exception) override; - void SAL_CALL mouseMoved(const css::awt::MouseEvent& e) throw(std::exception) override; - // css::awt::XPaintListener - void SAL_CALL windowPaint(const css::awt::PaintEvent& e) throw(std::exception) override; - // css::awt::XTopWindowListener - void SAL_CALL windowOpened( const css::lang::EventObject& e ) throw(std::exception) override; - void SAL_CALL windowClosing( const css::lang::EventObject& e ) throw(std::exception) override; - void SAL_CALL windowClosed( const css::lang::EventObject& e ) throw(std::exception) override; - void SAL_CALL windowMinimized( const css::lang::EventObject& e ) throw(std::exception) override; - void SAL_CALL windowNormalized( const css::lang::EventObject& e ) throw(std::exception) override; - void SAL_CALL windowActivated( const css::lang::EventObject& e ) throw(std::exception) override; - void SAL_CALL windowDeactivated( const css::lang::EventObject& e ) throw(std::exception) override; -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< css::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< css::awt::XWindow > & rPeer, const Type & type ); -private: - /** The source of the events. Normally this is the peer object.*/ - Reference< css::awt::XWindow > xPeer; - WeakReference< css::awt::XControl > xControl; - ::cppu::OMultiTypeInterfaceContainerHelper aListenerHolder; - - - MRCListenerMultiplexerHelper( const MRCListenerMultiplexerHelper & ) = delete; - MRCListenerMultiplexerHelper & operator = ( const MRCListenerMultiplexerHelper & ) = delete; -}; - -#endif // INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_MULTIPLX_HXX - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/plcom.hxx b/extensions/source/plugin/inc/plugin/plcom.hxx deleted file mode 100644 index 213c6c494a96..000000000000 --- a/extensions/source/plugin/inc/plugin/plcom.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_PLCOM_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_PLCOM_HXX - -#include - -class XPlugin_Impl; - -class PluginComm -{ -protected: - int m_nRefCount; - OString m_aLibName; - std::list< OUString > m_aFilesToDelete; -public: - PluginComm( const OString& rLibName, bool bReusable = true ); - virtual ~PluginComm(); - - void addRef() { m_nRefCount++; } - void decRef() { m_nRefCount--; if( ! m_nRefCount ) delete this; } - - const OString& getLibName() { return m_aLibName; } - - void addFileToDelete( const OUString& 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 NPError NPP_Initialize() = 0; - virtual NPError NPP_New( NPMIMEType pluginType, NPP instance, - uint16_t mode, int16_t argc, - char* argn[], char* argv[], - NPSavedData *saved ) = 0; - virtual NPError NPP_NewStream( NPP instance, NPMIMEType type, - NPStream* stream, - NPBool seekable, uint16_t* stype ) = 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_t NPP_Write( NPP instance, NPStream* stream, int32_t offset, - int32_t len, void* buffer ) = 0; - virtual int32_t NPP_WriteReady( NPP instance, NPStream* stream ) = 0; - - NPError NPP_SetWindow( XPlugin_Impl* ); - NPError NPP_Destroy( XPlugin_Impl*, NPSavedData** save ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/plctrl.hxx b/extensions/source/plugin/inc/plugin/plctrl.hxx deleted file mode 100644 index 6f75cef3d8ec..000000000000 --- a/extensions/source/plugin/inc/plugin/plctrl.hxx +++ /dev/null @@ -1,181 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_PLCTRL_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_PLCTRL_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -class SystemChildWindow; - - -class PluginControl_Impl : public ::cppu::WeakAggImplHelper4< - css::awt::XControl, - css::awt::XWindow, - css::awt::XFocusListener, - css::awt::XView > -{ -public: - // css::awt::XControl - virtual void SAL_CALL setContext( const css::uno::Reference< css::uno::XInterface > & xContext ) throw( css::uno::RuntimeException, std::exception ) override - { _xContext = xContext; } - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getContext() throw( css::uno::RuntimeException, std::exception ) override - { return _xContext; } - - virtual sal_Bool SAL_CALL setModel( const css::uno::Reference< css::awt::XControlModel > & Model ) throw( css::uno::RuntimeException, std::exception ) override = 0; - virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel() throw( css::uno::RuntimeException, std::exception ) override = 0; - - virtual css::uno::Reference< css::awt::XView > SAL_CALL getView() throw( css::uno::RuntimeException, std::exception ) override - { return static_cast(this); } - - virtual sal_Bool SAL_CALL isTransparent() throw( css::uno::RuntimeException, std::exception ) override - { return sal_False; } - - virtual void SAL_CALL setDesignMode( sal_Bool bOn ) throw( css::uno::RuntimeException, std::exception ) override; - virtual sal_Bool SAL_CALL isDesignMode() throw( css::uno::RuntimeException, std::exception ) override - { return _bInDesignMode; } - - virtual void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit > & xToolkit, const css::uno::Reference< css::awt::XWindowPeer > & Parent) throw( css::uno::RuntimeException, std::exception ) override; - virtual css::uno::Reference< css::awt::XWindowPeer > SAL_CALL getPeer() throw( css::uno::RuntimeException, std::exception ) override - { return _xPeer; } - - // css::awt::XWindow - virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL setEnable( sal_Bool bEnable ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL setFocus() throw( css::uno::RuntimeException, std::exception ) override; - - virtual void SAL_CALL setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, sal_Int32 nHeight_, sal_Int16 nFlags ) throw( css::uno::RuntimeException, std::exception ) override; - virtual css::awt::Rectangle SAL_CALL getPosSize() throw( css::uno::RuntimeException, std::exception ) override; - - virtual void SAL_CALL addWindowListener( const css::uno::Reference< css::awt::XWindowListener > & l ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL removeWindowListener( const css::uno::Reference< css::awt::XWindowListener > & l ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL addFocusListener( const css::uno::Reference< css::awt::XFocusListener > & l ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL removeFocusListener( const css::uno::Reference< css::awt::XFocusListener > & l ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL addKeyListener( const css::uno::Reference< css::awt::XKeyListener > & l ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL removeKeyListener( const css::uno::Reference< css::awt::XKeyListener > & l ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL addMouseListener( const css::uno::Reference< css::awt::XMouseListener > & l ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL removeMouseListener( const css::uno::Reference< css::awt::XMouseListener > & l ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL addMouseMotionListener( const Reference< css::awt::XMouseMotionListener > & l ) throw( RuntimeException, std::exception ) override; - virtual void SAL_CALL removeMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener > & l ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL addPaintListener( const css::uno::Reference< css::awt::XPaintListener > & l ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL removePaintListener( const css::uno::Reference< css::awt::XPaintListener > & l ) throw( css::uno::RuntimeException, std::exception ) override; - - // css::lang::XEventListener - virtual void SAL_CALL disposing( const css::lang::EventObject & rSource ) throw( css::uno::RuntimeException, std::exception ) override; - // css::awt::XFocusListener - virtual void SAL_CALL focusGained( const css::awt::FocusEvent & rEvt ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL focusLost( const css::awt::FocusEvent & rEvt ) throw( css::uno::RuntimeException, std::exception ) override; - - // css::lang::XComponent - virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener > & l ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener > & l ) throw( css::uno::RuntimeException, std::exception ) override; - - virtual void SAL_CALL dispose() throw( css::uno::RuntimeException, std::exception ) override; - - // css::awt::XView - virtual sal_Bool SAL_CALL setGraphics( const css::uno::Reference< css::awt::XGraphics > & /*aDevice*/ ) throw( css::uno::RuntimeException, std::exception ) override - { return sal_False; } - virtual css::uno::Reference< css::awt::XGraphics > SAL_CALL getGraphics() throw( css::uno::RuntimeException, std::exception ) override - { return css::uno::Reference< css::awt::XGraphics > (); } - - virtual css::awt::Size SAL_CALL getSize() throw( css::uno::RuntimeException, std::exception ) override - { return css::awt::Size(_nWidth, _nHeight); } - - virtual void SAL_CALL draw( sal_Int32 x, sal_Int32 y ) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL setZoom( float ZoomX, float ZoomY ) throw( css::uno::RuntimeException, std::exception ) override; - -public: - PluginControl_Impl(); - virtual ~PluginControl_Impl(); - - MRCListenerMultiplexerHelper* getMultiplexer(); - -protected: - void releasePeer(); - -protected: - ::std::list< Reference< css::lang::XEventListener > > _aDisposeListeners; - MRCListenerMultiplexerHelper* _pMultiplexer; - - Reference< XInterface > _xContext; - - sal_Int32 _nX; - sal_Int32 _nY; - sal_Int32 _nWidth; - sal_Int32 _nHeight; - sal_Int16 _nFlags; - - bool _bVisible; - bool _bInDesignMode; - bool _bEnable; - - VclPtr _pSysChild; - css::uno::Reference< css::awt::XWindowPeer > _xPeer; - css::uno::Reference< css::awt::XWindow > _xPeerWindow; - - css::uno::Reference< css::awt::XWindow > _xParentWindow; - css::uno::Reference< css::awt::XWindowPeer > _xParentPeer; -}; - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/unx/mediator.hxx b/extensions/source/plugin/inc/plugin/unx/mediator.hxx deleted file mode 100644 index 8c8dbcf94602..000000000000 --- a/extensions/source/plugin/inc/plugin/unx/mediator.hxx +++ /dev/null @@ -1,147 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_UNX_MEDIATOR_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_UNX_MEDIATOR_HXX - -#include -#include -#include -#include -#include -#include -#include - -#include - -struct MediatorMessage -{ - sal_uLong m_nID; - sal_uLong m_nBytes; - char* m_pBytes; - char* m_pRun; - - MediatorMessage() : m_nID( 0 ), m_nBytes( 0 ), - m_pBytes( nullptr ), m_pRun( nullptr ) {} - MediatorMessage( sal_uLong nID, sal_uLong nBytes, char* pBytes ) : - m_nID( nID ),m_nBytes( nBytes ), m_pRun( nullptr ) - { - m_pBytes = new char[ m_nBytes ]; - memcpy( m_pBytes, pBytes, (size_t)m_nBytes ); - } - - ~MediatorMessage() - { - if( m_pBytes ) - delete [] m_pBytes; - } - - sal_uLong ExtractULONG(); - char* GetString(); - sal_uInt32 GetUINT32(); - void* GetBytes( sal_uLong& ); - void* GetBytes() { sal_uLong nBytes; return GetBytes( nBytes ); } -}; - -class MediatorListener; - -class Mediator -{ - friend class MediatorListener; -protected: - int m_nSocket; - - std::vector m_aMessageQueue; - osl::Mutex m_aQueueMutex; - osl::Mutex m_aSendMutex; - // only one thread can send a message at any given time - osl::Condition m_aNewMessageCdtn; - MediatorListener* m_pListener; - // thread to fill the queue - - sal_uLong m_nCurrentID; - // will be constantly increased with each message sent - bool m_bValid; - - Link m_aConnectionLostHdl; - Link m_aNewMessageHdl; -public: - Mediator( int nSocket ); - virtual ~Mediator(); - - // mark mediator as invalid. No more messages will be processed, - // SendMessage, WaitForMessage, TransactMessage will return immediately - // with error - void invalidate() { m_bValid = false; } - - sal_uLong SendMessage( sal_uLong nBytes, const char* pBytes, sal_uLong nMessageID = 0 ); - - bool WaitForMessage( sal_uLong nTimeOut = 5000 ); - // timeout in ms - // TRUE: Message came in - // FALSE: timed out - // if timeout is set, WaitForMessage will wait even if there are messages - // in the queue - - virtual MediatorMessage* WaitForAnswer( sal_uLong nMessageID ); - // wait for an answer message ( ID >= 1 << 24 ) - // the message will be removed from the queue and returned - - MediatorMessage* TransactMessage( sal_uLong nBytes, char* pBytes ); - // sends a message and waits for an answer - - MediatorMessage* GetNextMessage( bool bWait = false ); - - - void SetConnectionLostHdl( const Link& rLink ) - { - m_aConnectionLostHdl = rLink; - } - - void SetNewMessageHdl( const Link& rLink ) - { - m_aNewMessageHdl = rLink; - } -}; - -class MediatorListener : public osl::Thread -{ - friend class Mediator; -private: - Mediator* m_pMediator; - ::osl::Mutex m_aMutex; - - MediatorListener( Mediator* ); - virtual ~MediatorListener(); - - virtual void run() override; - virtual void onTerminated() override; -}; - -#endif // INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_UNX_MEDIATOR_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/unx/plugcon.hxx b/extensions/source/plugin/inc/plugin/unx/plugcon.hxx deleted file mode 100644 index 81325eb30f59..000000000000 --- a/extensions/source/plugin/inc/plugin/unx/plugcon.hxx +++ /dev/null @@ -1,206 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_UNX_PLUGCON_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_UNX_PLUGCON_HXX - -#include -#include - -#include -#include -#include - -#include - -#include -extern "C" { -#include -} -#include -#include /* Intrinsics Definitions*/ -#include /* Standard Name-String definitions*/ -#if defined USE_MOTIF -#include -#else -#include -#endif -#include -#ifndef XP_UNIX -# define XP_UNIX -#endif -#define MOZ_X11 -#include - -#if ! defined ( _NPAPI_H_) && ! defined (npapi_h_) -extern "C" { -#include -} -#include "npapi.h" - -#if NP_VERSION_MINOR < 17 -// compatibility hack: compile with older NPN api header, but define -// some later introduced constants -// for gcc 3 -#define NP_ABI_MASK 0x10000000 -#define NPNVSupportsXEmbedBool ((NPNVariable)14) -#define NPPVpluginNeedsXEmbed ((NPPVariable)14) -#define NPNVToolkit ((int)(13 | NP_ABI_MASK)) -#define NPNVGtk12 1 -#define NPNVGtk2 2 -#endif -#endif - -#include - -#if ENABLE_GTK -#define GLIB_DISABLE_DEPRECATION_WARNINGS -#include -#include -#else -#define GtkWidget void -#endif - -#include - -#include - -class ConnectorInstance -{ -public: - NPP instance; - NPWindow window; - NPSetWindowCallbackStruct ws_info; - char* pMimeType; - void* pShell; - void* pWidget; - - GtkWidget* pGtkWindow; - GtkWidget* pGtkWidget; - - bool bShouldUseXEmbed; - - int nArg; - char** argn; - char** argv; - char* pArgnBuf; - char* pArgvBuf; - NPSavedData aData; - - ConnectorInstance( NPP inst, char* type, - int args, char* pargnbuf, sal_uLong nargnbytes, - char* pargvbuf, sal_uLong nargvbytes, - char* savedata, sal_uLong savebytes ); - ~ConnectorInstance(); -}; - -class PluginConnector : public Mediator -{ -protected: - osl::Mutex m_aUserEventMutex; - - static std::vector allConnectors; - - DECL_LINK_TYPED( NewMessageHdl, Mediator*, void ); - DECL_LINK_TYPED( WorkOnNewMessageHdl, void*, void ); - - std::vector m_aNPWrapStreams; - std::vector m_aInstances; - - static sal_uLong FillBuffer( char*&, const char*, sal_uLong, va_list ); -public: - PluginConnector( int nSocket ); - virtual ~PluginConnector(); - - virtual MediatorMessage* WaitForAnswer( sal_uLong nMessageID ) override; - MediatorMessage* Transact( const char*, sal_uLong, ... ); - MediatorMessage* Transact( sal_uInt32, ... ); - void Respond( sal_uLong nID, char*, sal_uLong, ... ); - sal_uLong Send( sal_uInt32, ... ); - - static const sal_uInt32 UnknownStreamID = 0xffffffff; - static const sal_uInt32 UnknownNPPID = 0xffffffff; - - sal_uInt32 GetStreamID( NPStream* pStream ); - sal_uInt32 GetNPPID( NPP ); - - std::vector& getStreamList() { return m_aNPWrapStreams; } - - static NPError GetNPError( MediatorMessage* pMes ) - { - NPError* pErr = static_cast(pMes->GetBytes()); - NPError aErr = *pErr; - delete [] pErr; - return aErr; - } - - void CallWorkHandler() - { - LINK( this, PluginConnector, WorkOnNewMessageHdl ). - Call( static_cast(this) ); - } -}; - -enum CommandAtoms -{ - eNPN_GetURL, - eNPN_GetURLNotify, - eNPN_DestroyStream, - eNPN_NewStream, - eNPN_PostURLNotify, - eNPN_PostURL, - eNPN_RequestRead, - eNPN_Status, - eNPN_Version, - eNPN_Write, - eNPN_UserAgent, - - eNPP_DestroyStream, - eNPP_Destroy, - eNPP_DestroyPhase2, - eNPP_NewStream, - eNPP_New, - eNPP_SetWindow, - eNPP_StreamAsFile, - eNPP_URLNotify, - eNPP_WriteReady, - eNPP_Write, - eNPP_GetMIMEDescription, - eNPP_Initialize, - eNPP_Shutdown, - - eMaxCommand -}; - -const char* GetCommandName( CommandAtoms ); - -#define POST_NONCONST_STRING( x ) x ? x : const_cast(""), x ? strlen(x) : 1 -#define POST_STRING( x ) x ? x : "", x ? strlen(x) : 1 - -#endif // INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_UNX_PLUGCON_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/unx/sysplug.hxx b/extensions/source/plugin/inc/plugin/unx/sysplug.hxx deleted file mode 100644 index 03772a62ae2b..000000000000 --- a/extensions/source/plugin/inc/plugin/unx/sysplug.hxx +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_UNX_SYSPLUG_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_UNX_SYSPLUG_HXX - -#include - -#include -#include -#include - -class UnxPluginComm : public PluginComm, public PluginConnector -{ -private: - pid_t m_nCommPID; -public: - UnxPluginComm( const OUString& mimetype, - const OUString& library, - Window aParent, - int nDescriptor1, - int nDescriptor2 - ); - virtual ~UnxPluginComm(); - - using PluginComm::NPP_Destroy; - virtual NPError NPP_Destroy( NPP instance, NPSavedData** save ) override; - virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream, - NPError reason ) override; - virtual NPError NPP_Initialize() override; - virtual NPError NPP_New( NPMIMEType pluginType, NPP instance, - uint16_t mode, int16_t argc, - char* argn[], char* argv[], NPSavedData *saved ) override; - virtual NPError NPP_NewStream( NPP instance, NPMIMEType type, - NPStream* stream, - NPBool seekable, uint16_t* stype ) override; - - using PluginComm::NPP_SetWindow; - virtual NPError NPP_SetWindow( NPP instance, NPWindow* window ) override; - virtual void NPP_Shutdown() override; - virtual void NPP_StreamAsFile( NPP instance, NPStream* stream, - const char* fname ) override; - virtual void NPP_URLNotify( NPP instance, const char* url, NPReason reason, - void* notifyData ) override; - virtual int32_t NPP_Write( NPP instance, NPStream* stream, int32_t offset, - int32_t len, void* buffer ) override; - virtual int32_t NPP_WriteReady( NPP instance, NPStream* stream ) override; - - static bool getPluginappPath(OString * path); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/win/sysplug.hxx b/extensions/source/plugin/inc/plugin/win/sysplug.hxx deleted file mode 100644 index 38c5abf3d62f..000000000000 --- a/extensions/source/plugin/inc/plugin/win/sysplug.hxx +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_WIN_SYSPLUG_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_WIN_SYSPLUG_HXX - -#if defined _MSC_VER -#pragma warning (push,1) -#pragma warning (disable:4005) -#endif - -#include - -#if defined _MSC_VER -#pragma pack( push, 8 ) -#endif -#include "npapi.h" -#include -#if defined _MSC_VER -#pragma pack( pop ) -#endif - -#if defined _MSC_VER -#pragma warning (pop) -#endif - -#include -#include -#include - -#include -#include - - -class PluginComm_Impl : - public PluginComm, - public vcl::SolarThreadExecutor - -{ - enum CallType { - eNPP_Destroy, - eNPP_DestroyStream, - eNPP_GetJavaClass, - eNPP_Initialize, - eNPP_New, - eNPP_NewStream, - eNPP_Print, - eNPP_SetWindow, - eNPP_Shutdown, - eNPP_StreamAsFile, - eNPP_URLNotify, - eNPP_Write, - eNPP_WriteReady, - eNPP_GetValue, - eNPP_SetValue, - eNP_Initialize - }; - - void* m_aArgs[ 8 ]; - CallType m_eCall; - - virtual long doIt(); -public: - struct CannotInitializeException {}; - - PluginComm_Impl( const OUString& rMIME, const OUString& rName, HWND hWnd ); - virtual ~PluginComm_Impl(); - -public: - using PluginComm::NPP_Destroy; - virtual NPError NPP_Destroy( NPP instance, NPSavedData** save ); - virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason ); - virtual NPError NPP_Initialize(); - virtual NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, - char* argn[], char* argv[], NPSavedData *saved ); - virtual NPError NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream, - NPBool seekable, uint16_t* stype ); - virtual void NPP_Print( NPP instance, NPPrint* platformPrint ); - - using PluginComm::NPP_SetWindow; - virtual NPError NPP_SetWindow( NPP instance, NPWindow* window ); - virtual void NPP_Shutdown(); - virtual void NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname ); - virtual void NPP_URLNotify( NPP instance, const char* url, - NPReason reason, void* notifyData ); - virtual int32_t NPP_Write( NPP instance, NPStream* stream, int32_t offset, - int32_t len, void* buffer ); - virtual int32_t NPP_WriteReady( NPP instance, NPStream* stream ); - virtual NPError NPP_GetValue( NPP instance, NPPVariable variable, void *ret_alue ); - -private: - void shutdown(); - BOOL retrieveFunction( TCHAR const * pName, void** ppFunc ) const; - -private: - HINSTANCE _plDLL; - - NPPluginFuncs _NPPfuncs; -}; - - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/pl.component b/extensions/source/plugin/pl.component deleted file mode 100644 index 7f74fca066d5..000000000000 --- a/extensions/source/plugin/pl.component +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - diff --git a/extensions/source/plugin/unx/mediator.cxx b/extensions/source/plugin/unx/mediator.cxx deleted file mode 100644 index 390c960a1d03..000000000000 --- a/extensions/source/plugin/unx/mediator.cxx +++ /dev/null @@ -1,337 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include - -#include -#include -#include -#include - -#define MEDIATOR_MAGIC 0xf7a8d2f4 - -Mediator::Mediator( int nSocket ) : - m_nSocket( nSocket ), - m_pListener( nullptr ), - m_nCurrentID( 1 ), - m_bValid( true ) -{ - m_pListener = new MediatorListener( this ); - m_pListener->create(); -} - -Mediator::~Mediator() -{ - if( m_pListener ) - { - { - ::osl::MutexGuard aGuard( m_pListener->m_aMutex ); - m_pListener->m_pMediator = nullptr; - } - m_pListener = nullptr; - if( m_bValid ) - { - sal_uLong aHeader[3]; - aHeader[0] = 0; - aHeader[1] = 0; - aHeader[2] = MEDIATOR_MAGIC; - ssize_t nToWrite = sizeof(aHeader); - bool bSuccess = (nToWrite == write(m_nSocket, aHeader, nToWrite)); - SAL_WARN_IF(!bSuccess, "extensions.plugin", "short write"); - } - // kick the thread out of its run method; it deletes itself - close( m_nSocket ); - } - else - close( m_nSocket ); - for( std::vector< MediatorMessage* >::iterator it = m_aMessageQueue.begin(); - it != m_aMessageQueue.end(); ++it ) - { - delete *it; - } -} - - -sal_uLong Mediator::SendMessage( sal_uLong nBytes, const char* pBytes, sal_uLong nMessageID ) -{ - if( ! m_pListener ) - return 0; - - osl::MutexGuard aGuard( m_aSendMutex ); - if( ! nMessageID ) - nMessageID = m_nCurrentID; - - m_nCurrentID++; - if( m_nCurrentID >= 1 << 24 ) // protection against overflow - m_nCurrentID = 1; - - if( ! m_bValid ) - return nMessageID; - - std::unique_ptr pBuffer(new sal_uLong[ (nBytes/sizeof(sal_uLong)) + 4 ]); - pBuffer[ 0 ] = nMessageID; - pBuffer[ 1 ] = nBytes; - pBuffer[ 2 ] = MEDIATOR_MAGIC; - memcpy( &pBuffer[3], pBytes, (size_t)nBytes ); - ssize_t nToWrite = nBytes + 3*sizeof( sal_uLong ); - bool bSuccess = (nToWrite == write( m_nSocket, pBuffer.get(), nToWrite )); - SAL_WARN_IF(!bSuccess, "extensions.plugin", "short write"); - - return nMessageID; -} - -bool Mediator::WaitForMessage( sal_uLong nTimeOut ) -{ - if( ! m_pListener ) - return false; - - size_t nItems = m_aMessageQueue.size(); - - if( ! nTimeOut && nItems > 0 ) - return true; - - TimeValue aValue; - aValue.Seconds = nTimeOut/1000; - aValue.Nanosec = ( nTimeOut % 1000 ) * 1000; - - while( m_aMessageQueue.size() == nItems ) - { - m_aNewMessageCdtn.wait( & aValue ); - m_aNewMessageCdtn.reset(); - if( nTimeOut && m_aMessageQueue.size() == nItems ) - return false; - } - return true; -} - -MediatorMessage* Mediator::WaitForAnswer( sal_uLong nMessageID ) -{ - nMessageID &= 0x00ffffff; - while( m_pListener ) - { - { - osl::MutexGuard aGuard( m_aQueueMutex ); - for( size_t i = 0; i < m_aMessageQueue.size(); i++ ) - { - MediatorMessage* pMessage = m_aMessageQueue[ i ]; - sal_uLong nID = pMessage->m_nID; - if( ( nID & 0xff000000 ) && - ( ( nID & 0x00ffffff ) == nMessageID ) ) - { - m_aMessageQueue.erase( m_aMessageQueue.begin() + i ); - return pMessage; - } - } - } - WaitForMessage( 10 ); - } - return nullptr; -} - -MediatorMessage* Mediator::GetNextMessage( bool bWait ) -{ - while( m_pListener ) - { - { - // guard must be after WaitForMessage, else the listener - // cannot insert a new one -> deadlock - osl::MutexGuard aGuard( m_aQueueMutex ); - for( size_t i = 0; i < m_aMessageQueue.size(); i++ ) - { - MediatorMessage* pMessage = m_aMessageQueue[ i ]; - if( ! ( pMessage->m_nID & 0xff000000 ) ) - { - m_aMessageQueue.erase( m_aMessageQueue.begin() + i ); - return pMessage; - } - } - if( ! bWait ) - return nullptr; - } - WaitForMessage(); - } - return nullptr; -} - -MediatorMessage* Mediator::TransactMessage( sal_uLong nBytes, char* pBytes ) -{ - sal_uLong nID = SendMessage( nBytes, pBytes ); - return WaitForAnswer( nID ); -} - -MediatorListener::MediatorListener( Mediator* pMediator ) : - m_pMediator( pMediator ) -{ -} - -MediatorListener::~MediatorListener() -{ -} - -void MediatorListener::run() -{ - osl_setThreadName("MediatorListener"); - - bool bRun = true; - while( schedule() && m_pMediator && bRun ) - { - sal_uLong nHeader[ 3 ]; - int nBytes; - - if( ( nBytes = read( m_pMediator->m_nSocket, nHeader, sizeof( nHeader ) ) ) == sizeof( nHeader ) && nHeader[2] == MEDIATOR_MAGIC) - { - if( nHeader[ 0 ] == 0 && nHeader[ 1 ] == 0 ) - return; - std::unique_ptr pBuffer(new char[ nHeader[ 1 ] ]); - if( m_pMediator && (sal_uLong)read( m_pMediator->m_nSocket, pBuffer.get(), nHeader[ 1 ] ) == nHeader[ 1 ] ) - { - ::osl::MutexGuard aMyGuard( m_aMutex ); - { - osl::MutexGuard - aGuard( m_pMediator->m_aQueueMutex ); - MediatorMessage* pMessage = - new MediatorMessage( nHeader[ 0 ], nHeader[ 1 ], pBuffer.get() ); - m_pMediator->m_aMessageQueue.push_back( pMessage ); - } - m_pMediator->m_aNewMessageCdtn.set(); - m_pMediator->m_aNewMessageHdl.Call( m_pMediator ); - } - else - { - SAL_WARN( - "extensions.plugin", - "got incomplete MediatorMessage: { " << nHeader[0] << ", " - << nHeader[1] << ", ... }"); - bRun = false; - } - } - else - { - SAL_WARN( - "extensions.plugin", - "got incomplete message header of " << nBytes - << " bytes (nHeader = [" << nHeader[0] << ", " << nHeader[1] - << "]), errno is " << errno); - bRun = false; - } - } -} - -void MediatorListener::onTerminated() -{ - if( m_pMediator ) - { - m_pMediator->m_aConnectionLostHdl.Call( m_pMediator ); - m_pMediator->m_pListener = nullptr; - } - delete this; -} - -sal_uLong MediatorMessage::ExtractULONG() -{ - if( ! m_pRun ) - m_pRun = m_pBytes; - - SAL_WARN_IF( - (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "extensions.plugin", - "overflow in MediatorMessage::ExtractULONG"); - sal_uLong nCount; - memcpy( &nCount, m_pRun, sizeof( sal_uLong ) ); - m_pRun += sizeof( sal_uLong ); - return nCount; -} - -void* MediatorMessage::GetBytes( sal_uLong& rBytes ) -{ - if( ! m_pRun ) - m_pRun = m_pBytes; - - SAL_WARN_IF( - (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "extensions.plugin", - "overflow in MediatorMessage::GetBytes"); - sal_uLong nBytes = ExtractULONG(); - - if( nBytes == 0 ) - return nullptr; - - SAL_WARN_IF( - (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "extensions.plugin", - "overflow in MediatorMessage::GetBytes"); - char* pBuffer = new char[ nBytes ]; - memcpy( pBuffer, m_pRun, nBytes ); - m_pRun += nBytes; - rBytes = nBytes; - return pBuffer; -} - -char* MediatorMessage::GetString() -{ - if( ! m_pRun ) - m_pRun = m_pBytes; - - SAL_WARN_IF( - (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "extensions.plugin", - "overflow in MediatorMessage::GetString"); - sal_uLong nBytes = ExtractULONG(); - - if( nBytes == 0 ) - return nullptr; - - SAL_WARN_IF( - (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "extensions.plugin", - "overflow in MediatorMessage::GetString"); - char* pBuffer = new char[ nBytes+1 ]; - memcpy( pBuffer, m_pRun, nBytes ); - pBuffer[ nBytes ] = 0; - m_pRun += nBytes; - return pBuffer; -} - -sal_uInt32 MediatorMessage::GetUINT32() -{ - if( ! m_pRun ) - m_pRun = m_pBytes; - - SAL_WARN_IF( - (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "extensions.plugin", - "overflow in MediatorMessage::GetUINT32"); - sal_uLong nBytes = ExtractULONG(); - SAL_WARN_IF( - nBytes != sizeof( sal_uInt32 ), "extensions.plugin", - "no sal_uInt32 in MediatorMessage::GetUINT32"); - SAL_WARN_IF( - (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "extensions.plugin", - "overflow in MediatorMessage::GetUINT32"); - sal_uInt32 nRet; - memcpy( &nRet, m_pRun, sizeof( nRet ) ); - m_pRun += sizeof( sal_uInt32 ); - return nRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/unx/npnapi.cxx b/extensions/source/plugin/unx/npnapi.cxx deleted file mode 100644 index 80a201f27b7f..000000000000 --- a/extensions/source/plugin/unx/npnapi.cxx +++ /dev/null @@ -1,949 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#include - -#include -#include - -#include -#include - -#include - -#include -#include - -extern PluginConnector* pConnector; -extern XtAppContext app_context; -extern int wakeup_fd[]; -extern Widget topLevel, topBox; -extern Display* pAppDisplay; -extern Display* pXtAppDisplay; -extern int nAppArguments; -extern char** pAppArguments; - -// begin Netscape plugin api calls -extern "C" { - -static void* l_NPN_MemAlloc( uint32_t nBytes ) -{ - void* pMem = new char[nBytes]; - return pMem; -} - -static void l_NPN_MemFree( void* pMem ) -{ - delete [] static_cast(pMem); -} - -static uint32_t l_NPN_MemFlush( uint32_t /*nSize*/ ) -{ - return 0; -} - -static NPError l_NPN_DestroyStream( NPP instance, NPStream* stream, NPError reason ) -{ - sal_uInt32 nInstance = pConnector->GetNPPID( instance ); - if( nInstance == PluginConnector::UnknownNPPID ) - return NPERR_GENERIC_ERROR; - - sal_uInt32 nFileID = pConnector->GetStreamID( stream ); - MediatorMessage* pMes= - pConnector-> - Transact( eNPN_DestroyStream, - &nInstance, sizeof( nInstance ), - &nFileID, sizeof( nFileID ), - POST_STRING( stream->url ), - &reason, sizeof( reason ), - nullptr ); - - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - for( std::vector< NPStream* >::iterator it = pConnector->getStreamList().begin(); - it != pConnector->getStreamList().end(); ++it ) - { - if( *it == stream ) - { - pConnector->getStreamList().erase( it ); - break; - } - } - delete [] stream->url; - delete stream; - // returns NPError - NPError aRet = PluginConnector::GetNPError( pMes ); - delete pMes; - return aRet; -} - -#ifdef OJI -static JRIEnv* l_NPN_GetJavaEnv() -{ - // no java in this program - SAL_INFO("extensions.plugin", "SNI: NPN_GetJavaEnv"); - return NULL; -} - -static jref l_NPN_GetJavaPeer( NPP /*instance*/ ) -{ - SAL_INFO("extensions.plugin", "SNI: NPN_GetJavaPeer"); - return NULL; -} -#endif - -static NPError l_NPN_GetURL( NPP instance, const char* url, const char* window ) -{ - sal_uInt32 nInstance = pConnector->GetNPPID( instance ); - if( nInstance == PluginConnector::UnknownNPPID ) - return NPERR_GENERIC_ERROR; - - MediatorMessage* pMes= - pConnector-> - Transact( eNPN_GetURL, - &nInstance, sizeof( nInstance ), - POST_STRING(url), - POST_STRING(window), - nullptr ); - SAL_WARN_IF(!pMes, "extensions.plugin", "geturl: message unanswered"); - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - // returns NPError - NPError aRet = PluginConnector::GetNPError( pMes ); - SAL_WARN_IF(aRet, "extensions.plugin", "geturl returns " << aRet); - delete pMes; - return aRet; -} - -static NPError l_NPN_GetURLNotify( NPP instance, const char* url, const char* target, - void* notifyData ) -{ - sal_uInt32 nInstance = pConnector->GetNPPID( instance ); - if( nInstance == PluginConnector::UnknownNPPID ) - return NPERR_GENERIC_ERROR; - - MediatorMessage* pMes= - pConnector-> - Transact( eNPN_GetURLNotify, - &nInstance, sizeof( nInstance ), - POST_STRING(url), - POST_STRING(target), - ¬ifyData, sizeof( void* ), // transmit the actual pointer - // since it is a pointer to private data fed back - // by NPP_URLNotify; this can be thought of as an ID - nullptr ); - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - // returns NPError - NPError aRet = PluginConnector::GetNPError( pMes ); - delete pMes; - return aRet; -} - -static NPError l_NPN_NewStream( NPP instance, NPMIMEType type, const char* target, - NPStream** stream ) - // stream is a return value -{ - sal_uInt32 nInstance = pConnector->GetNPPID( instance ); - if( nInstance == PluginConnector::UnknownNPPID ) - return NPERR_GENERIC_ERROR; - - MediatorMessage* pMes= - pConnector-> - Transact( eNPN_NewStream, - &nInstance, sizeof( nInstance ), - POST_STRING(type), - POST_STRING(target), - nullptr ); - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - // returns a new NPStream and an error - NPError aRet = PluginConnector::GetNPError( pMes ); - if( ! aRet ) - { - NPStream* pStream = new NPStream; - pStream->url = pMes->GetString(); - pStream->end = pMes->GetUINT32(); - pStream->lastmodified = pMes->GetUINT32(); - pStream->ndata = pStream->pdata = pStream->notifyData = nullptr; - - pConnector->getStreamList().push_back( pStream ); - *stream = pStream; - } - - delete pMes; - return aRet; -} - -static NPError l_NPN_PostURLNotify( NPP instance, const char* url, const char* target, uint32_t len, const char* buf, NPBool file, void* notifyData ) -{ - sal_uInt32 nInstance = pConnector->GetNPPID( instance ); - if( nInstance == PluginConnector::UnknownNPPID ) - return NPERR_GENERIC_ERROR; - - MediatorMessage* pMes = pConnector-> - Transact( eNPN_PostURLNotify, - &nInstance, sizeof( nInstance ), - POST_STRING( url ), - POST_STRING( target ), - &len, sizeof( len ), - buf, len, - &file, sizeof( NPBool ), - ¬ifyData, sizeof( void* ), // send the real pointer - nullptr ); - - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - NPError aRet = PluginConnector::GetNPError( pMes ); - delete pMes; - return aRet; -} - -static NPError l_NPN_PostURL( NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file ) -{ - sal_uInt32 nInstance = pConnector->GetNPPID( instance ); - if( nInstance == PluginConnector::UnknownNPPID ) - return NPERR_GENERIC_ERROR; - - MediatorMessage* pMes = pConnector-> - Transact( eNPN_PostURL, - &nInstance, sizeof( nInstance ), - POST_STRING( url ), - POST_STRING( window ), - &len, sizeof( len ), - buf, len, - &file, sizeof( NPBool ), - nullptr ); - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - NPError aRet = PluginConnector::GetNPError( pMes ); - delete pMes; - return aRet; -} - -static NPError l_NPN_RequestRead( NPStream* stream, NPByteRange* rangeList ) -{ - SAL_INFO("extensions.plugin", "pluginapp: NPN_RequestRead"); - - NPByteRange* pRange = rangeList; - sal_uInt32 nRanges = 0; - while( pRange ) - { - nRanges++; - pRange = pRange->next; - } - - std::unique_ptr pArray(new sal_uInt32[ 2 * nRanges ]); - pRange = rangeList; - sal_uInt32 n = 0; - while( pRange ) - { - pArray[ 2*n ] = (sal_uInt32)pRange->offset; - pArray[ 2*n + 1] = (sal_uInt32)pRange->length; - n++; - pRange = pRange->next; - } - sal_uInt32 nFileID = pConnector->GetStreamID( stream ); - MediatorMessage* pMes = pConnector-> - Transact( eNPN_RequestRead, - &nFileID, sizeof( nFileID ), - &nRanges, sizeof( nRanges ), - pArray.get(), sizeof( sal_uInt32 ) * 2 * nRanges, - nullptr ); - - if( ! pMes ) - { - return NPERR_GENERIC_ERROR; - } - - NPError aRet = PluginConnector::GetNPError( pMes ); - delete pMes; - return aRet; -} - -static void l_NPN_Status( NPP instance, const char* message ) -{ - sal_uInt32 nInstance = pConnector->GetNPPID( instance ); - if( nInstance == PluginConnector::UnknownNPPID ) - return; - - pConnector->Send( eNPN_Status, - &nInstance, sizeof( nInstance ), - POST_STRING( message ), - nullptr ); -} - -static const char* l_NPN_UserAgent( NPP instance ) -{ - static char* pAgent = nullptr; - - sal_uInt32 nInstance = pConnector->GetNPPID( instance ); - if( nInstance == PluginConnector::UnknownNPPID ) - { - if( instance ) - return "Mozilla 3.0"; - else // e.g. flashplayer calls NPN_UserAgent with NULL - nInstance = 0; - } - - MediatorMessage* pMes = pConnector-> - Transact( eNPN_UserAgent, - &nInstance, sizeof( nInstance ), - nullptr ); - - if( ! pMes ) - return pAgent; - - if( pAgent ) - delete [] pAgent; - pAgent = pMes->GetString(); - - delete pMes; - - SAL_INFO("extensions.plugin", "NPN_UserAgent returns " << pAgent); - - return pAgent; -} - -static int32_t l_NPN_Write( NPP instance, NPStream* stream, int32_t len, void* buffer ) -{ - sal_uInt32 nFileID = pConnector->GetStreamID( stream ); - if( nFileID == PluginConnector::UnknownStreamID ) - return NPERR_GENERIC_ERROR; - sal_uInt32 nInstance = pConnector->GetNPPID( instance ); - if( nInstance == PluginConnector::UnknownNPPID ) - return NPERR_GENERIC_ERROR; - - MediatorMessage* pMes = pConnector-> - Transact( eNPN_Write, - &nInstance, sizeof( nInstance ), - &nFileID, sizeof( nFileID ), - &len, sizeof( len ), - buffer, len, - nullptr ); - - if( ! pMes ) - return 0; - - sal_Int32 nRet = pMes->GetUINT32(); - return nRet; -} - -static void l_NPN_ReloadPlugins( NPBool /*reloadPages*/ ) -{ - SAL_INFO("extensions.plugin", "NPN_ReloadPlugins: SNI"); -} - -static NPError l_NPN_GetValue( NPP, NPNVariable variable, void* value ) -{ - /* - * We want to handle values injected into a NPNVariable which aren't in - * the old enum we build against, but that we know are in the new enum - * we want to support - */ - switch( (int)variable ) - { - case NPNVxDisplay: - *static_cast(value) = pXtAppDisplay; - SAL_INFO("extensions.plugin", "Display requested"); - break; - case NPNVxtAppContext: - *static_cast(value) = app_context; - SAL_INFO("extensions.plugin", "AppContext requested"); - break; - case NPNVjavascriptEnabledBool: - // no javascript - *static_cast(value) = false; - SAL_INFO("extensions.plugin", "javascript enabled requested"); - break; - case NPNVasdEnabledBool: - // no SmartUpdate - *static_cast(value) = false; - SAL_INFO("extensions.plugin", "smart update enabled requested"); - break; - case NPNVisOfflineBool: - // no offline browsing - *static_cast(value) = false; - SAL_INFO("extensions.plugin", "offline browsing requested"); - break; - case NPNVSupportsXEmbedBool: - // asking xembed - *static_cast(value) = int(true); - SAL_INFO("extensions.plugin", "xembed requested"); - break; - case NPNVToolkit: -# if ENABLE_GTK - *static_cast(value) = NPNVGtk2; -# else - *(int*)value = 0; -# endif - SAL_INFO("extensions.plugin", "toolkit requested"); - break; - default: - SAL_WARN( - "extensions.plugin", - "unknown NPNVariable " << +variable << " requested"); - return NPERR_INVALID_PARAM; - } - return NPERR_NO_ERROR; -} - -static NPError l_NPN_SetValue(NPP /*instance*/, NPPVariable variable, void *value) -{ - SAL_INFO("extensions.plugin", "NPN_SetValue " << +variable << "=" << value); - return 0; -} - -static void l_NPN_InvalidateRect(NPP /*instance*/, NPRect* /*invalidRect*/) -{ - SAL_INFO("extensions.plugin", "NPN_InvalidateRect"); -} - -static void l_NPN_InvalidateRegion(NPP /*instance*/, NPRegion /*invalidRegion*/) -{ - SAL_INFO("extensions.plugin", "NPN_InvalidateRegion"); -} - -static void l_NPN_ForceRedraw(NPP /*instance*/) -{ - SAL_INFO("extensions.plugin", "NPN_ForceRedraw"); -} - -} - -static NPNetscapeFuncs aNetscapeFuncs = -{ - sizeof(aNetscapeFuncs), - (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR, - l_NPN_GetURL, - l_NPN_PostURL, - l_NPN_RequestRead, - l_NPN_NewStream, - l_NPN_Write, - l_NPN_DestroyStream, - l_NPN_Status, - l_NPN_UserAgent, - l_NPN_MemAlloc, - l_NPN_MemFree, - l_NPN_MemFlush, - l_NPN_ReloadPlugins, -# ifdef OJI - l_NPN_GetJavaEnv, - l_NPN_GetJavaPeer, -# else - nullptr, - nullptr, -# endif - l_NPN_GetURLNotify, - l_NPN_PostURLNotify, - l_NPN_GetValue, - l_NPN_SetValue, - l_NPN_InvalidateRect, - l_NPN_InvalidateRegion, - l_NPN_ForceRedraw -}; - -static NPPluginFuncs aPluginFuncs = -{ - sizeof(aPluginFuncs), - (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr -}; - - -oslModule pPluginLib = nullptr; -char*(*pNPP_GetMIMEDescription)() = nullptr; -NPError (*pNP_Initialize)(NPNetscapeFuncs*,NPPluginFuncs*) = nullptr; -NPError (*pNP_Shutdown)() = nullptr; - -std::vector< PluginConnector* > PluginConnector::allConnectors; - -PluginConnector::PluginConnector( int nSocket ) : - Mediator( nSocket ) -{ - SetNewMessageHdl( LINK( this, PluginConnector, NewMessageHdl ) ); -} - -PluginConnector::~PluginConnector() -{ -} - -IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) -{ - MediatorMessage* pMessage; - CommandAtoms nCommand; - while( (pMessage = GetNextMessage()) ) - { - nCommand = (CommandAtoms)pMessage->GetUINT32(); - SAL_INFO( - "extensions.plugin", "pluginapp: " << GetCommandName(nCommand)); - switch( nCommand ) - { - case eNPP_DestroyStream: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - sal_uInt32 nFileID = pMessage->GetUINT32(); - NPStream* pStream = m_aNPWrapStreams[ nFileID ]; - NPError aReason = GetNPError( pMessage ); - m_aNPWrapStreams.erase( m_aNPWrapStreams.begin() + nFileID ); - - aReason = aPluginFuncs.destroystream( instance, pStream, aReason ); - Respond( pMessage->m_nID, - reinterpret_cast(&aReason), sizeof( aReason ), - nullptr ); - - delete [] pStream->url; - delete pStream; - } - break; - case eNPP_Destroy: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - ConnectorInstance* pInst= m_aInstances[ nInstance ]; - - // some plugin rely on old netscapes behaviour - // to first destroy the widget and then destroy - // the instance, so mimic that behaviour here - if( pInst->pShell ) - XtDestroyWidget( static_cast(pInst->pShell) ); - - pInst->pWidget = pInst->pShell = nullptr; - - // the other side will call eNPP_DestroyPhase2 after this - NPError aReason = NPERR_NO_ERROR; - Respond( pMessage->m_nID, reinterpret_cast(&aReason), sizeof( aReason ), nullptr ); - } - break; - case eNPP_DestroyPhase2: - { - // now really destroy the instance - sal_uInt32 nInstance = pMessage->GetUINT32(); - ConnectorInstance* pInst= m_aInstances[ nInstance ]; - NPP instance = pInst->instance; - NPSavedData* pSave = nullptr; - - NPError aRet = aPluginFuncs.destroy( instance, &pSave ); - if( pSave ) - { - Respond( pMessage->m_nID, - reinterpret_cast(&aRet), sizeof( aRet ), - pSave->buf, pSave->len, - nullptr ); - delete [] static_cast(pSave->buf); - } - else - Respond( pMessage->m_nID, - reinterpret_cast(&aRet), sizeof( aRet ), - "0000", 4, - nullptr ); - - #if ENABLE_GTK - if( pInst->pGtkWindow ) - g_object_unref( G_OBJECT(pInst->pGtkWindow) ); - if( pInst->pGtkWidget ) - g_object_unref( G_OBJECT(pInst->pGtkWidget) ); - #endif - - m_aInstances.erase( m_aInstances.begin() + nInstance ); - delete pInst; - delete instance; - SAL_INFO( - "extensions.plugin", - "destroyed instance (returning " << aRet << ")"); - } - break; - case eNPP_NewStream: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* pType = pMessage->GetString(); - NPStream* pStream = new NPStream; - pStream->url = pMessage->GetString(); - pStream->end = pMessage->GetUINT32(); - pStream->lastmodified = pMessage->GetUINT32(); - pStream->pdata = pStream->ndata = pStream->notifyData = nullptr; - NPBool* pSeekable = static_cast(pMessage->GetBytes()); - m_aNPWrapStreams.push_back( pStream ); - uint16_t nStype = NP_ASFILE; - NPError aRet = aPluginFuncs.newstream( instance, pType, pStream, - *pSeekable, &nStype ); - SAL_INFO( - "extensions.plugin", - "pluginapp: NPP_NewStream(" << instance << ", " << pType - << ", " << pStream << ", " - << (*pSeekable ? "seekable" : "not seekable") << ", " - << &nStype << ") returns " << aRet - << "; stream = { pdata = " << pStream->pdata - << ", ndata = " << pStream->ndata << ", url = " - << pStream->url << ", end = " << pStream->end - << ", lastmodified = " << pStream->lastmodified - << ", notifyData = " << pStream->notifyData << " }"); - Respond( pMessage->m_nID, - reinterpret_cast(&aRet), sizeof( aRet ), - &nStype, sizeof( nStype ), - nullptr ); - delete [] pType; - delete [] pSeekable; - } - break; - case eNPP_New: - { - char* pType = pMessage->GetString(); - uint16_t* pMode = static_cast(pMessage->GetBytes()); - int16_t* pArgc = static_cast(pMessage->GetBytes()); - NPP instance = new NPP_t; - instance->pdata = instance->ndata = nullptr; - sal_uLong nArgnBytes, nArgvBytes; - char* pArgn = static_cast(pMessage->GetBytes( nArgnBytes )); - char* pArgv = static_cast(pMessage->GetBytes( nArgvBytes )); - sal_uLong nSaveBytes; - char* pSavedData = static_cast(pMessage->GetBytes( nSaveBytes )); - ConnectorInstance* pInst = - new ConnectorInstance( instance, pType, - *pArgc, - pArgn, nArgnBytes, - pArgv, nArgvBytes, - pSavedData, nSaveBytes ); - m_aInstances.push_back( pInst ); - NPError aRet; - aRet = aPluginFuncs.newp( pInst->pMimeType, instance, *pMode, *pArgc, - pInst->nArg ? pInst->argn : nullptr, - pInst->nArg ? pInst->argv : nullptr, - ( nSaveBytes == 4 && *reinterpret_cast(pSavedData) == 0 ) ? - &(pInst->aData) : nullptr ); - SAL_INFO( - "extensions.plugin", - "pluginapp: NPP_New( " << pInst->pMimeType << ", " - << instance << ", " << *pMode << ", " << pInst->nArg - << ", " << pInst->argn << ", " << pInst->argv << ", " - << &pInst->aData << ") returns" << aRet); - for( int i = 0; i < pInst->nArg; i++ ) - SAL_INFO( - "extensions.plugin", - " \"" << pInst->argn[i] << "\"=\"" << pInst->argv[i] - << "\""); - - #if ENABLE_GTK - // check if XEMBED is to be used - // ask for Bool. there seems to be no clear definition whether the - // return value should be an int or unsigned char - // int can hold both and will be nonzero in case of "true" - if( aPluginFuncs.getvalue ) - { - int bNeedsXEmbed = 0; - NPError error = aPluginFuncs.getvalue( instance, NPPVpluginNeedsXEmbed, static_cast(&bNeedsXEmbed) ); - if( error == NPERR_NO_ERROR ) - pInst->bShouldUseXEmbed = (bNeedsXEmbed != 0); - SAL_INFO( - "extensions.plugin", - "should use xembed = " - << (pInst->bShouldUseXEmbed ? "true" : "false")); - } - #endif - - Respond( pMessage->m_nID, - reinterpret_cast(&aRet), sizeof( aRet ), - nullptr ); - delete [] pMode; - delete [] pArgc; - delete [] pType; - } - break; - case eNPP_SetWindow: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - ConnectorInstance* pInst= m_aInstances[ nInstance ]; - NPWindow* pWindow = static_cast(pMessage->GetBytes()); - - if( pWindow->width < 1 ) - pWindow->width = 1; - if( pWindow->height < 1 ) - pWindow->height = 1; - - #if ENABLE_GTK - if( pInst->bShouldUseXEmbed ) - { - if( ! pInst->pGtkWidget ) - { - SAL_INFO( - "extensions.plugin", - "creating gtk plug and socket"); - - pInst->pGtkWindow = gtk_plug_new((GdkNativeWindow)reinterpret_cast(pWindow->window)); - gtk_widget_show( pInst->pGtkWindow ); - pInst->pGtkWidget = gtk_socket_new(); - gtk_widget_show( pInst->pGtkWidget ); - gtk_container_add( GTK_CONTAINER(pInst->pGtkWindow), pInst->pGtkWidget ); - gtk_widget_show_all( pInst->pGtkWindow ); - pInst->window.window = reinterpret_cast(gtk_socket_get_id( GTK_SOCKET(pInst->pGtkWidget ) )); - - XSync( pAppDisplay, False ); - - XMapWindow( pAppDisplay, GDK_WINDOW_XWINDOW(pInst->pGtkWindow->window) ); - - XSync( pAppDisplay, False ); - } - - // update widget size; alas out parent is not yet really XEMBED conformant - gtk_widget_set_size_request( pInst->pGtkWidget, pWindow->width, pWindow->height ); - gtk_window_resize( GTK_WINDOW(pInst->pGtkWindow), pWindow->width, pWindow->height ); - - GdkScreen* pGdkScreen = gtk_widget_get_screen( pInst->pGtkWidget ); - Screen* pScreen = ScreenOfDisplay( pAppDisplay, gdk_screen_get_number( pGdkScreen ) ); - - pInst->window.x = 0; - pInst->window.y = 0; - pInst->window.width = pWindow->width; - pInst->window.height = pWindow->height; - pInst->window.clipRect.left = 0; - pInst->window.clipRect.top = 0; - pInst->window.clipRect.right = pWindow->width; - pInst->window.clipRect.bottom = pWindow->height; - pInst->window.ws_info = &pInst->ws_info; - pInst->window.type = NPWindowTypeWindow; - pInst->ws_info.type = NP_SETWINDOW; - pInst->ws_info.display = pAppDisplay; - pInst->ws_info.visual = DefaultVisualOfScreen( pScreen ); - pInst->ws_info.colormap = DefaultColormapOfScreen( pScreen ); - pInst->ws_info.depth = DefaultDepthOfScreen( pScreen ); - } - else - #endif - { - if( ! pInst->pWidget ) - { - pInst->pWidget = CreateNewShell( &(pInst->pShell), reinterpret_cast(pWindow->window) ); - } - - // fill in NPWindow and NPCallbackStruct - pInst->window.window = reinterpret_cast(XtWindow( static_cast(pInst->pWidget) )); - pInst->window.x = 0; - pInst->window.y = 0; - pInst->window.width = pWindow->width; - pInst->window.height = pWindow->height; - pInst->window.clipRect.left = 0; - pInst->window.clipRect.top = 0; - pInst->window.clipRect.right = pWindow->width; - pInst->window.clipRect.bottom = pWindow->height; - pInst->window.ws_info = &pInst->ws_info; - pInst->window.type = NPWindowTypeWindow; - pInst->ws_info.type = NP_SETWINDOW; - pInst->ws_info.display = XtDisplay( static_cast(pInst->pWidget) ); - pInst->ws_info.visual = DefaultVisualOfScreen( XtScreen( static_cast(pInst->pWidget) ) ); - pInst->ws_info.colormap = DefaultColormapOfScreen( XtScreen( static_cast(pInst->pWidget) ) ); - pInst->ws_info.depth = DefaultDepthOfScreen( XtScreen( static_cast(pInst->pWidget) ) ); - - XtResizeWidget( static_cast(pInst->pShell), - pInst->window.width, - pInst->window.height, - 0 ); - XtResizeWidget( static_cast(pInst->pWidget), - pInst->window.width, - pInst->window.height, - 0 ); - } - - NPError aRet = aPluginFuncs.setwindow( pInst->instance, &pInst->window ); - SAL_INFO( - "extensions.plugin", - "pluginapp: NPP_SetWindow returns " << aRet); - Respond( pMessage->m_nID, - reinterpret_cast(&aRet), sizeof( aRet ), - nullptr ); - delete [] reinterpret_cast(pWindow); - } - break; - case eNPP_StreamAsFile: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - sal_uInt32 nFileID = pMessage->GetUINT32(); - NPStream* pStream = m_aNPWrapStreams[ nFileID ]; - char* fname = pMessage->GetString(); - SAL_INFO( - "extensions.plugin", - "pluginapp: NPP_StreamAsFile " << fname); - aPluginFuncs.asfile( instance, pStream, fname ); - delete [] fname; - } - break; - case eNPP_URLNotify: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* url = pMessage->GetString(); - NPReason* pReason = static_cast(pMessage->GetBytes()); - void** notifyData = static_cast(pMessage->GetBytes()); - aPluginFuncs.urlnotify( instance, url, *pReason, *notifyData ); - delete [] url; - delete [] pReason; - delete [] notifyData; - } - break; - case eNPP_WriteReady: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - sal_uInt32 nFileID = pMessage->GetUINT32(); - NPStream* pStream = m_aNPWrapStreams[ nFileID ]; - int32_t nRet = aPluginFuncs.writeready( instance, pStream ); - - SAL_INFO( - "extensions.plugin", - "pluginapp: NPP_WriteReady(" << instance << ", " << pStream - << ") (stream id = " << nFileID << ") returns " - << nRet); - - Respond( pMessage->m_nID, - reinterpret_cast(&nRet), sizeof( nRet ), - nullptr ); - } - break; - case eNPP_Write: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - sal_uInt32 nFileID = pMessage->GetUINT32(); - NPStream* pStream = m_aNPWrapStreams[ nFileID ]; - int32_t offset = pMessage->GetUINT32(); - sal_uLong len; - char* buffer = static_cast(pMessage->GetBytes( len )); - int32_t nRet = aPluginFuncs.write( instance, pStream, offset, len, buffer ); - - SAL_INFO( - "extensions.plugin", - "pluginapp: NPP_Write(" << instance << ", " << pStream - << ", " << offset << ", " << len << ", " << buffer - << ") returns " << nRet << "; stream = { pdata = " - << pStream->pdata << ", ndata = " << pStream->ndata - << ", url = " << pStream->url << ", end = " - << pStream->end << ", lastmodified = " - << pStream->lastmodified << ", notifyData = " - << pStream->notifyData << " }"); - - Respond( pMessage->m_nID, - reinterpret_cast(&nRet), sizeof( nRet ), - nullptr ); - delete [] buffer; - } - break; - case eNPP_GetMIMEDescription: - { - if( ! pNPP_GetMIMEDescription ) - pNPP_GetMIMEDescription = reinterpret_cast( - osl_getAsciiFunctionSymbol( pPluginLib, "NPP_GetMIMEDescription" )); - char* pMIME = pNPP_GetMIMEDescription(); - Respond( pMessage->m_nID, - POST_NONCONST_STRING( pMIME ), - nullptr ); - } - break; - case eNPP_Initialize: - { - - pNP_Initialize = - reinterpret_cast( - osl_getAsciiFunctionSymbol( pPluginLib, "NP_Initialize" )); - SAL_WARN_IF( - !pNP_Initialize, "extensions.plugin", - "no NP_Initialize, " << dlerror()); - pNP_Shutdown = reinterpret_cast( - osl_getAsciiFunctionSymbol( pPluginLib, "NP_Shutdown" )); - SAL_WARN_IF( - !pNP_Initialize, "extensions.plugin", - "no NP_Shutdown, " << dlerror()); - - SAL_INFO("extensions.plugin", "entering NP_Initialize"); - NPError aRet = pNP_Initialize( &aNetscapeFuncs, &aPluginFuncs ); - SAL_INFO( - "extensions.plugin", - "pluginapp: NP_Initialize returns " << aRet); - Respond( pMessage->m_nID, reinterpret_cast(&aRet), sizeof( aRet ), nullptr ); - } - break; - case eNPP_Shutdown: - { - bool bSuccess = (4 == write(wakeup_fd[1], "xxxx", 4)); - SAL_WARN_IF(!bSuccess, "extensions.plugin", "short write"); - } - break; - default: - SAL_WARN( - "extensions.plugin", - "caught unknown NPP request " << +nCommand); - break; - } - delete pMessage; - } -} - -void LoadAdditionalLibs( const char* _pPluginLib ) -{ - SAL_INFO("extensions.plugin", "LoadAdditionalLibs " << _pPluginLib); - - if( ! strncmp( _pPluginLib, "libflashplayer.so", 17 ) ) - { - /* #b4951312# flash 7 implicitly assumes a gtk application - * if the API version is greater or equal to 12 (probably - * because they think they run in mozilla then). In that - * case they try to find gtk within the process and crash - * when they don't find it. - */ - aNetscapeFuncs.version = 11; - aPluginFuncs.version = 11; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/unx/nppapi.cxx b/extensions/source/plugin/unx/nppapi.cxx deleted file mode 100644 index ec842dc87eef..000000000000 --- a/extensions/source/plugin/unx/nppapi.cxx +++ /dev/null @@ -1,593 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#include - -#include -#include - -#include -#include - -std::vector PluginConnector::allConnectors; - -PluginConnector::PluginConnector( int nSocket ) : - Mediator( nSocket ) -{ - allConnectors.push_back( this ); - SetNewMessageHdl( LINK( this, PluginConnector, NewMessageHdl ) ); -} - -PluginConnector::~PluginConnector() -{ - osl::MutexGuard aGuard( m_aUserEventMutex ); - for( std::vector< PluginConnector* >::iterator it = allConnectors.begin(); - it != allConnectors.end(); ++it ) - { - if( *it == this ) - { - allConnectors.erase( it ); - break; - } - } -} - -IMPL_LINK_NOARG_TYPED( PluginConnector, NewMessageHdl, Mediator*, void ) -{ - osl::MutexGuard aGuard( m_aUserEventMutex ); - bool bFound = false; - for( std::vector< PluginConnector* >::iterator it = allConnectors.begin(); - it != allConnectors.end() && !bFound; ++it ) - { - if( *it == this ) - bFound = true; - } - if( ! bFound ) - return; - Application::PostUserEvent( LINK( this, PluginConnector, WorkOnNewMessageHdl ) ); -} - -IMPL_LINK_NOARG_TYPED( PluginConnector, WorkOnNewMessageHdl, void*, void ) -{ - bool bFound = false; - for( std::vector< PluginConnector* >::iterator it = allConnectors.begin(); - it != allConnectors.end() && !bFound; ++it ) - { - if( *it == this ) - bFound = true; - } - if( ! bFound ) - return; - - MediatorMessage* pMessage; - CommandAtoms nCommand; - while( (pMessage = GetNextMessage()) ) - { - nCommand = (CommandAtoms)pMessage->GetUINT32(); - SAL_INFO("extensions.plugin", GetCommandName(nCommand)); - switch( nCommand ) - { - case eNPN_GetURL: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* pUrl = pMessage->GetString(); - char* pWindow = pMessage->GetString(); - NPError aRet = NPN_GetURL( instance, pUrl, pWindow ); - Respond( pMessage->m_nID, - reinterpret_cast(&aRet), sizeof( NPError ), nullptr ); - delete [] pUrl; - delete [] pWindow; - } - break; - case eNPN_GetURLNotify: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* pUrl = pMessage->GetString(); - char* pWindow = pMessage->GetString(); - void** pNotifyData = static_cast(pMessage->GetBytes()); - NPError aRet = NPN_GetURLNotify( instance, pUrl, pWindow, - *pNotifyData ); - Respond( pMessage->m_nID, - reinterpret_cast(&aRet), sizeof( NPError ), nullptr ); - delete [] pUrl; - delete [] pWindow; - delete [] pNotifyData; - } - break; - case eNPN_DestroyStream: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - sal_uInt32 nFileID = pMessage->GetUINT32(); - char* pUrl = pMessage->GetString(); - NPError* pReason = static_cast(pMessage->GetBytes()); - NPError aRet = NPERR_FILE_NOT_FOUND; - if( nFileID < static_cast(m_aNPWrapStreams.size()) ) - { - if( ! strcmp( m_aNPWrapStreams[ nFileID ]->url, pUrl ) ) - { - aRet = - NPN_DestroyStream( instance, m_aNPWrapStreams[ nFileID ], - *pReason ); - m_aNPWrapStreams.erase( m_aNPWrapStreams.begin() + nFileID ); - } - else - SAL_WARN( - "extensions.plugin", - "StreamID " << nFileID << " has incoherent urls " - << pUrl << " and " - << m_aNPWrapStreams[nFileID]->url); - } - else - SAL_WARN( - "extensions.plugin", - "nonexistent StreamID " << nFileID); - - Respond( pMessage->m_nID, - reinterpret_cast(&aRet), sizeof( NPError ), nullptr ); - - delete [] pUrl; - delete [] pReason; - } - break; - case eNPN_NewStream: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - NPMIMEType pType = pMessage->GetString(); - char* pTarget = pMessage->GetString(); - - NPStream* pStream = nullptr; - - NPError aRet = NPN_NewStream( instance, pType, pTarget, &pStream ); - - if( aRet != NPERR_NO_ERROR ) - { - sal_uInt32 nDummy = 0; - Respond( pMessage->m_nID, - reinterpret_cast(&aRet), sizeof( aRet ), - "", 0, - &nDummy, sizeof(sal_uInt32), - &nDummy, sizeof(sal_uInt32), - nullptr ); - } - else - { - m_aNPWrapStreams.push_back( pStream ); - - sal_uLong nLen = strlen( pStream->url ); - Respond( pMessage->m_nID, - reinterpret_cast(&aRet), sizeof( aRet ), - pStream->url, nLen, - &pStream->end, sizeof(sal_uInt32), - &pStream->lastmodified, sizeof(sal_uInt32), - nullptr ); - } - - delete [] pTarget; - delete [] pType; - } - break; - case eNPN_PostURLNotify: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* pUrl = pMessage->GetString(); - char* pTarget = pMessage->GetString(); - sal_uInt32 nLen = pMessage->GetUINT32(); - char* pBuf = static_cast(pMessage->GetBytes()); - NPBool* pFile = static_cast(pMessage->GetBytes()); - void** pNData = static_cast(pMessage->GetBytes()); - NPError aRet = - NPN_PostURLNotify( instance, pUrl, pTarget, nLen, pBuf, *pFile, *pNData ); - Respond( pMessage->m_nID, reinterpret_cast(&aRet), sizeof( aRet ), nullptr ); - delete [] pUrl; - delete [] pTarget; - delete [] pBuf; - delete [] pFile; - delete [] pNData; - } - break; - case eNPN_PostURL: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* pUrl = pMessage->GetString(); - char* pWindow = pMessage->GetString(); - sal_uInt32 nLen = pMessage->GetUINT32(); - char* pBuf = static_cast(pMessage->GetBytes()); - NPBool* pFile = static_cast(pMessage->GetBytes()); - NPError aRet = - NPN_PostURL( instance, pUrl, pWindow, nLen, pBuf, *pFile ); - Respond( pMessage->m_nID, reinterpret_cast(&aRet), sizeof( aRet ), nullptr ); - delete [] pUrl; - delete [] pWindow; - delete [] pBuf; - delete [] pFile; - } - break; - case eNPN_RequestRead: - { - sal_uInt32 nFileID = pMessage->GetUINT32(); - NPStream* pStream = m_aNPWrapStreams[ nFileID ]; - sal_uInt32 nRanges = pMessage->GetUINT32(); - sal_uInt32* pArray = static_cast(pMessage->GetBytes()); - // build ranges table - NPByteRange* pFirst = new NPByteRange; - NPByteRange* pRun = pFirst; - for( sal_uInt32 n = 0; n < nRanges; n++ ) - { - pRun->offset = pArray[ 2*n ]; - pRun->length = pArray[ 2*n+1 ]; - pRun->next = n < nRanges-1 ? new NPByteRange : nullptr; - pRun = pRun->next; - } - NPError aRet = NPN_RequestRead( pStream, pFirst ); - Respond( pMessage->m_nID, reinterpret_cast(&aRet), sizeof( aRet ), nullptr ); - while( pFirst ) - { - pRun = pFirst->next; - delete pFirst; - pFirst = pRun; - } - delete [] pArray; - } - break; - case eNPN_Status: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* pString = pMessage->GetString(); - NPN_Status( instance, pString ); - delete [] pString; - } - break; - case eNPN_Version: - { - int major, minor, net_major, net_minor; - NPN_Version( &major, &minor, &net_major, &net_minor ); - Respond( pMessage->m_nID, - reinterpret_cast(&major), sizeof( int ), - &minor, sizeof( int ), - &net_major, sizeof( int ), - &net_minor, sizeof( int ), - nullptr ); - } - break; - case eNPN_Write: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - sal_uInt32 nFileID = pMessage->GetUINT32(); - NPStream* pStream = m_aNPWrapStreams[ nFileID ]; - sal_Int32 nLen = pMessage->GetUINT32(); - void* pBuffer = pMessage->GetBytes(); - sal_Int32 nRet = NPN_Write( instance, pStream, nLen, pBuffer ); - Respond( pMessage->m_nID, - reinterpret_cast(&nRet), sizeof( nRet ), - nullptr ); - delete [] static_cast(pBuffer); - delete instance; - } - break; - case eNPN_UserAgent: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - const char* pAnswer = NPN_UserAgent( instance ); - Respond( pMessage->m_nID, - const_cast(pAnswer), strlen( pAnswer ), - nullptr ); - } - break; - default: - SAL_WARN( - "extensions.plugin", - "caught unknown NPN request " << +nCommand); - } - - delete pMessage; - } -} - -#define GET_INSTANCE() \ - sal_uInt32 nInstance; \ - nInstance = GetNPPID( instance ); - -#define GET_INSTANCE_RET( err ) \ - GET_INSTANCE() \ - if( nInstance == PluginConnector::UnknownNPPID ) \ - return err - - -#define POST_INSTANCE() reinterpret_cast(&nInstance), sizeof( nInstance ) - -NPError UnxPluginComm::NPP_Destroy( NPP instance, NPSavedData** save ) -{ - NPError aRet = NPERR_GENERIC_ERROR; - GET_INSTANCE_RET( aRet ); - MediatorMessage* pMes = - Transact( eNPP_Destroy, - POST_INSTANCE(), - nullptr ); - if( ! pMes ) - return NPERR_GENERIC_ERROR; - delete pMes; - - pMes = Transact( eNPP_DestroyPhase2, - POST_INSTANCE(), - nullptr ); - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - aRet = GetNPError( pMes ); - sal_uLong nSaveBytes; - void* pSaveData = pMes->GetBytes( nSaveBytes ); - if( nSaveBytes == 4 && *static_cast(pSaveData) == 0 ) - *save = nullptr; - else - { - *save = new NPSavedData; - (*save)->len = nSaveBytes; - (*save)->buf = pSaveData; - } - delete pMes; - - return aRet; -} - -NPError UnxPluginComm::NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason ) -{ - NPError aRet = NPERR_GENERIC_ERROR; - GET_INSTANCE_RET( aRet ); - sal_uInt32 nFileID = GetStreamID( stream ); - if( nFileID == PluginConnector::UnknownStreamID ) - return NPERR_GENERIC_ERROR; - - MediatorMessage* pMes = - Transact( eNPP_DestroyStream, - POST_INSTANCE(), - &nFileID, sizeof( nFileID ), - &reason, sizeof( reason ), - nullptr ); - m_aNPWrapStreams.erase( m_aNPWrapStreams.begin() + nFileID ); - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - aRet = GetNPError( pMes ); - delete pMes; - return aRet; -} - -NPError UnxPluginComm::NPP_Initialize() -{ - MediatorMessage* pMes = - Transact( eNPP_Initialize, - nullptr ); - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - NPError aRet = GetNPError( pMes ); - delete pMes; - return aRet; -} - -NPError UnxPluginComm::NPP_New( NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, - char* argn[], char* argv[], NPSavedData *saved ) -{ - m_aInstances.push_back( - new ConnectorInstance( instance, pluginType, 0, - nullptr, 0, nullptr, 0, - saved ? static_cast(saved->buf) : nullptr, - saved ? saved->len : 0 ) ); - - char *pArgnBuf, *pArgvBuf; - size_t nArgnLen = 0, nArgvLen = 0; - int i; - for( i = 0; i < argc; i++ ) - { - nArgnLen += strlen( argn[i] ) +1; - nArgvLen += strlen( argv[i] ) +1; - } - pArgnBuf = new char[ nArgnLen ]; - pArgvBuf = new char[ nArgvLen ]; - char* pRunArgn = pArgnBuf; - char* pRunArgv = pArgvBuf; - for( i = 0; i < argc; i++ ) - { - strcpy( pRunArgn, argn[i] ); - strcpy( pRunArgv, argv[i] ); - pRunArgn += strlen( argn[i] ) +1; - pRunArgv += strlen( argv[i] ) +1; - } - - MediatorMessage* pMes; - if( saved ) - pMes = - Transact( eNPP_New, - pluginType, strlen( pluginType ), - &mode, sizeof( mode ), - &argc, sizeof( argc ), - pArgnBuf, nArgnLen, - pArgvBuf, nArgvLen, - saved->buf, static_cast(saved->len), - nullptr ); - else - pMes = - Transact( eNPP_New, - pluginType, strlen( pluginType ), - &mode, sizeof( mode ), - &argc, sizeof( argc ), - pArgnBuf, nArgnLen, - pArgvBuf, nArgvLen, - "0000", size_t(4), - nullptr ); - delete [] pArgnBuf; - delete [] pArgvBuf; - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - NPError aRet = GetNPError( pMes ); - delete pMes; - - return aRet; -} - -NPError UnxPluginComm::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream, - NPBool seekable, uint16_t* stype ) -{ - NPError aRet = NPERR_GENERIC_ERROR; - GET_INSTANCE_RET( aRet ); - - m_aNPWrapStreams.push_back( stream ); - MediatorMessage* pMes = - Transact( eNPP_NewStream, - POST_INSTANCE(), - type, strlen( type ), - stream->url, strlen( stream->url ), - &stream->end, sizeof( stream->end ), - &stream->lastmodified, sizeof( stream->lastmodified ), - &seekable, sizeof( seekable ), - nullptr ); - - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - aRet = GetNPError( pMes ); - uint16_t* pSType = static_cast(pMes->GetBytes()); - *stype = *pSType; - - delete [] pSType; - delete pMes; - return aRet; -} - -NPError UnxPluginComm::NPP_SetWindow( NPP instance, NPWindow* window ) -{ - NPError aRet = NPERR_GENERIC_ERROR; - GET_INSTANCE_RET( aRet ); - - MediatorMessage* pMes = - Transact( eNPP_SetWindow, - POST_INSTANCE(), - window, sizeof( NPWindow ), - nullptr ); - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - aRet = GetNPError( pMes ); - delete pMes; - return aRet; -} - -void UnxPluginComm::NPP_Shutdown() -{ - Send( eNPP_Shutdown, nullptr ); -} - -void UnxPluginComm::NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname ) -{ - GET_INSTANCE(); - sal_uInt32 nFileID = GetStreamID( stream ); - if( nFileID == PluginConnector::UnknownStreamID ) - return; - - Send( eNPP_StreamAsFile, - POST_INSTANCE(), - &nFileID, sizeof( nFileID ), - fname, strlen( fname ), - nullptr ); -} - -void UnxPluginComm::NPP_URLNotify( NPP instance, const char* url, NPReason reason, void* notifyData ) -{ - GET_INSTANCE(); - - Send( eNPP_URLNotify, - POST_INSTANCE(), - url, strlen( url ), - &reason, sizeof( reason ), - ¬ifyData, sizeof( void* ), - nullptr ); -} - -int32_t UnxPluginComm::NPP_Write( NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer ) -{ - GET_INSTANCE_RET( -1 ); - sal_uInt32 nFileID = GetStreamID( stream ); - if( nFileID == PluginConnector::UnknownStreamID ) - return -1; - - MediatorMessage* pMes = - Transact( eNPP_Write, - POST_INSTANCE(), - &nFileID, sizeof( nFileID ), - &offset, sizeof( offset ), - buffer, static_cast(len), - nullptr ); - if( ! pMes ) - return 0; - - int32_t aRet = pMes->GetUINT32(); - delete pMes; - - return aRet; -} - -int32_t UnxPluginComm::NPP_WriteReady( NPP instance, NPStream* stream ) -{ - GET_INSTANCE_RET( -1 ); - sal_uInt32 nFileID = GetStreamID( stream ); - if( nFileID == PluginConnector::UnknownStreamID ) - return -1; - - MediatorMessage* pMes = - Transact( eNPP_WriteReady, - POST_INSTANCE(), - &nFileID, sizeof( nFileID ), - nullptr ); - - if( ! pMes ) - return 0; - - int32_t aRet = pMes->GetUINT32(); - delete pMes; - - return aRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/unx/npwrap.cxx b/extensions/source/plugin/unx/npwrap.cxx deleted file mode 100644 index e58c0f28de5e..000000000000 --- a/extensions/source/plugin/unx/npwrap.cxx +++ /dev/null @@ -1,495 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -#include - -PluginConnector* pConnector = nullptr; - -int nAppArguments = 0; -char** pAppArguments = nullptr; -Display* pAppDisplay = nullptr; -Display* pXtAppDisplay = nullptr; - -extern oslModule pPluginLib; -extern NPError (*pNP_Shutdown)(); - -XtAppContext app_context; -Widget topLevel = nullptr, topBox = nullptr; -int wakeup_fd[2] = { 0, 0 }; -static bool bPluginAppQuit = false; - -static void GlobalConnectionLostHdl( void* /*pInst*/, Mediator* /*pArg*/ ) -{ - SAL_WARN("extensions.plugin", "pluginapp exiting due to connection lost"); - - bool bSuccess = (4 == write(wakeup_fd[1], "xxxx", 4 )); - SAL_WARN_IF(!bSuccess, "extensions.plugin", "short write"); -} - -extern "C" -{ - static int plugin_x_error_handler( Display*, XErrorEvent* ) - { - return 0; - } - -#if ! ENABLE_GTK - static void ThreadEventHandler( XtPointer /*client_data*/, int* /*source*/, XtInputId* id ) - { - char buf[256]; - // clear pipe - int len, nLast = -1; - - while( (len = read( wakeup_fd[0], buf, sizeof( buf ) ) ) > 0 ) - nLast = len-1; - if( ! bPluginAppQuit ) { - if( ( nLast == -1 || buf[nLast] != 'x' ) && pConnector ) - pConnector->CallWorkHandler(); - else { - // it seems you can use XtRemoveInput only - // safely from within the callback - // why is that ? - SAL_INFO("extensions.plugin", "removing wakeup pipe"); - XtRemoveInput( *id ); - XtAppSetExitFlag( app_context ); - bPluginAppQuit = true; - - delete pConnector; - pConnector = NULL; - } - } - } -#endif -} - - -IMPL_LINK_NOARG_TYPED( PluginConnector, NewMessageHdl, Mediator*, void ) -{ - (void) this; // loplugin:staticmethods - SAL_INFO("extensions.plugin", "new message handler"); - bool bSuccess = (4 == write(wakeup_fd[1], "cccc", 4)); - SAL_WARN_IF(!bSuccess, "extensions.plugin", "short write"); -} - -Widget createSubWidget( char* /*pPluginText*/, Widget shell, Window aParentWindow ) -{ - Widget newWidget = XtVaCreateManagedWidget( -#if defined USE_MOTIF - "drawingArea", - xmDrawingAreaWidgetClass, -#else - "", - compositeWidgetClass, -#endif - shell, - XtNwidth, 200, - XtNheight, 200, - nullptr ); - XtRealizeWidget( shell ); - XtRealizeWidget( newWidget ); - - SAL_INFO( - "extensions.plugin", - "reparenting new widget " << XtWindow( newWidget ) << " to " - << aParentWindow); - XReparentWindow( pXtAppDisplay, - XtWindow( shell ), - aParentWindow, - 0, 0 ); - XtMapWidget( shell ); - XtMapWidget( newWidget ); - XRaiseWindow( pXtAppDisplay, XtWindow( shell ) ); - XSync( pXtAppDisplay, False ); - - return newWidget; -} - -void* CreateNewShell( void** pShellReturn, Window aParentWindow ) -{ - String n, c; - XtGetApplicationNameAndClass(pXtAppDisplay, &n, &c); - - Widget newShell = - XtVaAppCreateShell( "pane", c, - topLevelShellWidgetClass, - pXtAppDisplay, - XtNwidth, 200, - XtNheight, 200, - XtNoverrideRedirect, True, - nullptr ); - *pShellReturn = newShell; - - char pText[1024]; - sprintf( pText, "starting plugin %s ...", pAppArguments[2] ); - - Widget newWidget = createSubWidget( pText, newShell, aParentWindow ); - - return newWidget; -} - -static oslModule LoadModule( const char* pPath ) -{ - OUString sSystemPath( OUString::createFromAscii( pPath ) ); - OUString sFileURL; - osl_getFileURLFromSystemPath( sSystemPath.pData, &sFileURL.pData ); - - oslModule pLib = osl_loadModule( sFileURL.pData, SAL_LOADMODULE_LAZY ); - SAL_INFO_IF(!pLib, "extensions.plugin", "could not open " << pPath); - return pLib; -} - -// Unix specific implementation -static void CheckPlugin( const char* pPath ) -{ - oslModule pLib = LoadModule( pPath ); - if (pLib != nullptr) { - char*(*pNP_GetMIMEDescription)() = reinterpret_cast( - osl_getAsciiFunctionSymbol( pLib, "NP_GetMIMEDescription" )); - if( pNP_GetMIMEDescription ) - printf( "%s\n", pNP_GetMIMEDescription() ); - else - SAL_WARN( - "extensions.plugin", - "could not get symbol NP_GetMIMEDescription " << dlerror()); - osl_unloadModule( pLib ); - } -} - -#if OSL_DEBUG_LEVEL > 1 && defined LINUX -#include -#endif - -extern "C" { - - static void signal_handler( int nSig ) - { -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "caught signal %d, exiting\n", nSig ); -#ifdef LINUX - void* pStack[64]; - int nStackLevels = backtrace( pStack, SAL_N_ELEMENTS(pStack) ); - backtrace_symbols_fd( pStack, nStackLevels, STDERR_FILENO ); -#endif -#endif - if( pConnector ) { - // ensure that a read on the other side will wakeup - delete pConnector; - pConnector = nullptr; - } - - _exit(nSig); - } - -#if ENABLE_GTK - - static gboolean noClosure( gpointer ) - { - return sal_True; - } - -// Xt events - static gboolean prepareXtEvent( GSource*, gint* ) - { - int nMask = XtAppPending( app_context ); - return (nMask & XtIMAll) != 0; - } - - static gboolean checkXtEvent( GSource* ) - { - int nMask = XtAppPending( app_context ); - return (nMask & XtIMAll) != 0; - } - - static gboolean dispatchXtEvent( GSource*, GSourceFunc, gpointer ) - { - XtAppProcessEvent( app_context, XtIMAll ); - return sal_True; - } - - static GSourceFuncs aXtEventFuncs = { - prepareXtEvent, - checkXtEvent, - dispatchXtEvent, - nullptr, - noClosure, - nullptr - }; - - static gboolean pollXtTimerCallback(gpointer) - { - for(int i = 0; i < 5; i++) { - if( (XtAppPending(app_context) & (XtIMAll & ~XtIMXEvent)) == 0 ) - break; - XtAppProcessEvent(app_context, XtIMAll & ~XtIMXEvent); - } - return sal_True; - } - - static gboolean prepareWakeupEvent( GSource*, gint* ) - { - struct pollfd aPoll = { wakeup_fd[0], POLLIN, 0 }; - (void)poll(&aPoll, 1, 0); - return (aPoll.revents & POLLIN ) != 0; - } - - static gboolean checkWakeupEvent( GSource* pSource ) - { - gint nDum = 0; - return prepareWakeupEvent( pSource, &nDum ); - } - - static gboolean dispatchWakeupEvent( GSource*, GSourceFunc, gpointer ) - { - char buf[256]; - // clear pipe - int len, nLast = -1; - - while( (len = read( wakeup_fd[0], buf, sizeof( buf ) ) ) > 0 ) - nLast = len-1; - if( ( nLast == -1 || buf[nLast] != 'x' ) && pConnector ) - pConnector->CallWorkHandler(); - else { - XtAppSetExitFlag( app_context ); - bPluginAppQuit = true; - - delete pConnector; - pConnector = nullptr; - } - - return sal_True; - } - - static GSourceFuncs aWakeupEventFuncs = { - prepareWakeupEvent, - checkWakeupEvent, - dispatchWakeupEvent, - nullptr, - noClosure, - nullptr - }; - -#endif // GTK - -} - -int main( int argc, char **argv) -{ - try - { - struct sigaction aSigAction; - aSigAction.sa_handler = signal_handler; - sigemptyset( &aSigAction.sa_mask ); - aSigAction.sa_flags = SA_NOCLDSTOP; - sigaction( SIGSEGV, &aSigAction, nullptr ); - sigaction( SIGBUS, &aSigAction, nullptr ); - sigaction( SIGABRT, &aSigAction, nullptr ); - sigaction( SIGTERM, &aSigAction, nullptr ); - sigaction( SIGILL, &aSigAction, nullptr ); - - int nArg = (argc < 3) ? 1 : 2; - char* pBaseName = argv[nArg] + strlen(argv[nArg]); - while( pBaseName > argv[nArg] && pBaseName[-1] != '/' ) - pBaseName--; - LoadAdditionalLibs( pBaseName ); - - if( argc == 2 ) { - CheckPlugin(argv[1]); - exit(0); - } - nAppArguments = argc; - pAppArguments = argv; - - XSetErrorHandler( plugin_x_error_handler ); - - if( pipe( wakeup_fd ) ) { - SAL_WARN("extensions.plugin", "could not pipe()"); - return 1; - } - // initialize 'wakeup' pipe. - int flags; - - // set close-on-exec descriptor flag. - if ((flags = fcntl (wakeup_fd[0], F_GETFD)) != -1) { - flags |= FD_CLOEXEC; - (void)fcntl(wakeup_fd[0], F_SETFD, flags); - } - if ((flags = fcntl (wakeup_fd[1], F_GETFD)) != -1) { - flags |= FD_CLOEXEC; - (void)fcntl(wakeup_fd[1], F_SETFD, flags); - } - - // set non-blocking I/O flag. - if ((flags = fcntl (wakeup_fd[0], F_GETFL)) != -1) { - flags |= O_NONBLOCK; - (void)fcntl(wakeup_fd[0], F_SETFL, flags); - } - if ((flags = fcntl (wakeup_fd[1], F_GETFL)) != -1) { - flags |= O_NONBLOCK; - (void)fcntl(wakeup_fd[1], F_SETFL, flags); - } - - pPluginLib = LoadModule( argv[2] ); - if( ! pPluginLib ) { - exit(255); - } - int nSocket = atol( argv[1] ); - - #if ENABLE_GTK - g_thread_init(nullptr); - gtk_init(&argc, &argv); - #endif - - pConnector = new PluginConnector( nSocket ); - pConnector->SetConnectionLostHdl( Link( nullptr, GlobalConnectionLostHdl ) ); - - XtSetLanguageProc( nullptr, nullptr, nullptr ); - - XtToolkitInitialize(); - app_context = XtCreateApplicationContext(); - pXtAppDisplay = XtOpenDisplay( app_context, nullptr, "SOPlugin", "SOPlugin", nullptr, 0, &argc, argv ); - - - #if ENABLE_GTK - // integrate Xt events into GTK event loop - GPollFD aXtPollDesc, aWakeupPollDesc; - - GSource* pXTSource = g_source_new( &aXtEventFuncs, sizeof(GSource) ); - if( !pXTSource ) { - SAL_WARN("extensions.plugin", "could not get Xt GSource"); - return 1; - } - - g_source_set_priority( pXTSource, GDK_PRIORITY_EVENTS ); - g_source_set_can_recurse( pXTSource, sal_True ); - g_source_attach( pXTSource, nullptr ); - aXtPollDesc.fd = ConnectionNumber( pXtAppDisplay ); - aXtPollDesc.events = G_IO_IN; - aXtPollDesc.revents = 0; - g_source_add_poll( pXTSource, &aXtPollDesc ); - - gint xt_polling_timer_id = g_timeout_add( 25, pollXtTimerCallback, nullptr); - // Initialize wakeup events listener - GSource *pWakeupSource = g_source_new( &aWakeupEventFuncs, sizeof(GSource) ); - if ( pWakeupSource == nullptr ) { - SAL_WARN("extensions.plugin", "could not get wakeup source"); - return 1; - } - g_source_set_priority( pWakeupSource, GDK_PRIORITY_EVENTS); - g_source_attach( pWakeupSource, nullptr ); - aWakeupPollDesc.fd = wakeup_fd[0]; - aWakeupPollDesc.events = G_IO_IN; - aWakeupPollDesc.revents = 0; - g_source_add_poll( pWakeupSource, &aWakeupPollDesc ); - - pAppDisplay = gdk_x11_display_get_xdisplay( gdk_display_get_default() ); - #else - pAppDisplay = pXtAppDisplay; - XtAppAddInput( app_context, - wakeup_fd[0], - (XtPointer)XtInputReadMask, - ThreadEventHandler, NULL ); - #endif - - // send that we are ready to go - MediatorMessage* pMessage = - pConnector->Transact( "init req", 8, - nullptr ); - delete pMessage; - - #if OSL_DEBUG_LEVEL > 3 - int nPID = getpid(); - int nChild = fork(); - if( nChild == 0 ) { - char pidbuf[16]; - char* pArgs[] = { "xterm", "-sl", "2000", "-sb", "-e", "gdb", "pluginapp.bin", pidbuf, NULL }; - sprintf( pidbuf, "%d", nPID ); - execvp( pArgs[0], pArgs ); - _exit(255); - } else - sleep( 10 ); - #endif - - /* - * Loop for events. - */ - // for some reason XtAppSetExitFlag won't quit the application - // in ThreadEventHandler most of times; Xt will hang in select - // (hat is in XtAppNextEvent). Have our own mainloop instead - // of XtAppMainLoop - do { - #if ENABLE_GTK - g_main_context_iteration( nullptr, sal_True ); - #else - XtAppProcessEvent( app_context, XtIMAll ); - #endif - } while( ! XtAppGetExitFlag( app_context ) && ! bPluginAppQuit ); - - SAL_INFO("extensions.plugin", "left plugin app main loop"); - - #if ENABLE_GTK - g_source_remove(xt_polling_timer_id); - #endif - - pNP_Shutdown(); - SAL_INFO("extensions.plugin", "NP_Shutdown done"); - osl_unloadModule( pPluginLib ); - SAL_INFO("extensions.plugin", "plugin close"); - - close( wakeup_fd[0] ); - close( wakeup_fd[1] ); - - return 0; - } - catch (std::exception& e) - { - SAL_WARN("extensions.plugin", "exception: " << e.what()); - return 255; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/unx/npwrap.hxx b/extensions/source/plugin/unx/npwrap.hxx deleted file mode 100644 index ffadf00e0e78..000000000000 --- a/extensions/source/plugin/unx/npwrap.hxx +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_EXTENSIONS_SOURCE_PLUGIN_UNX_NPWRAP_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PLUGIN_UNX_NPWRAP_HXX - -#include - -void* CreateNewShell( void** pShellReturn, Window aParentWindow ); - -void LoadAdditionalLibs(const char*); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/unx/plugcon.cxx b/extensions/source/plugin/unx/plugcon.cxx deleted file mode 100644 index d50d72a0a64b..000000000000 --- a/extensions/source/plugin/unx/plugcon.cxx +++ /dev/null @@ -1,281 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#include - -#include - -#include -#include - -sal_uInt32 PluginConnector::GetStreamID( NPStream* pStream ) -{ - size_t nLen = m_aNPWrapStreams.size(); - for( size_t i = 0; i < nLen; i++ ) - if( m_aNPWrapStreams[ i ] == pStream ) - return static_cast(i); - SAL_WARN("extensions.plugin", "NPStream has no ID"); - return UnknownStreamID; -} - -sal_uInt32 PluginConnector::GetNPPID( NPP instance ) -{ - size_t nLen = m_aInstances.size(); - for( size_t i=0; i instance == instance ) - return static_cast(i); - SAL_WARN("extensions.plugin", "NPP has no ID"); - - return UnknownNPPID; -} - -struct PtrStruct -{ - char* pData; - sal_uLong nBytes; - - PtrStruct( char* i_pData, sal_uLong i_nBytes ) - : pData( i_pData ), nBytes( i_nBytes ) {} -}; - -sal_uLong PluginConnector::FillBuffer( char*& rpBuffer, - const char* pFunction, - sal_uLong nFunctionLen, - va_list ap ) -{ - std::vector< PtrStruct > aList; - aList.reserve( 5 ); - - sal_uLong nDataSize = nFunctionLen + sizeof( sal_uLong ); - char* pNext; - - do { - pNext = va_arg( ap, char* ); - if( pNext ) - { - aList.push_back( PtrStruct( pNext, va_arg( ap, sal_uLong ) ) ); - nDataSize += aList.back().nBytes + sizeof(sal_uLong); - } - } while( pNext ); - - rpBuffer = new char[ nDataSize ]; - char* pRun = rpBuffer; - memcpy( pRun, &nFunctionLen, sizeof( nFunctionLen ) ); - pRun += sizeof( nFunctionLen ); - memcpy( pRun, pFunction, nFunctionLen ); - pRun += nFunctionLen; - - for( std::vector::const_iterator it = aList.begin(); it != aList.end(); ++it ) - { - memcpy( pRun, &it->nBytes, sizeof( sal_uLong ) ); - pRun += sizeof( sal_uLong ); - memcpy( pRun, it->pData, it->nBytes ); - pRun += it->nBytes; - } - return nDataSize; -} - -MediatorMessage* PluginConnector::Transact( const char* pFunction, - sal_uLong nFunctionLen, ... ) -{ - va_list ap; - char* pBuffer; - - va_start( ap, nFunctionLen ); - sal_uLong nSize = FillBuffer( pBuffer, pFunction, nFunctionLen, ap ); - va_end( ap ); - MediatorMessage* pRet = TransactMessage( nSize, pBuffer ); - delete[] pBuffer; - return pRet; -} - -MediatorMessage* PluginConnector::Transact( sal_uInt32 nFunction, ... ) -{ - va_list ap; - char* pBuffer; - - va_start( ap, nFunction ); - sal_uLong nSize = FillBuffer( pBuffer, reinterpret_cast(&nFunction), sizeof( nFunction ), ap ); - va_end( ap ); - MediatorMessage* pRet = TransactMessage( nSize, pBuffer ); - delete[] pBuffer; - return pRet; -} - -sal_uLong PluginConnector::Send( sal_uInt32 nFunction, ... ) -{ - va_list ap; - char* pBuffer; - - va_start( ap, nFunction ); - sal_uLong nSize = FillBuffer( pBuffer, reinterpret_cast(&nFunction), sizeof( nFunction ), ap ); - va_end( ap ); - sal_uLong nRet = SendMessage( nSize, pBuffer ); - delete[] pBuffer; - return nRet; -} - -void PluginConnector::Respond( sal_uLong nID, - char* pFunction, - sal_uLong nFunctionLen, ... ) -{ - va_list ap; - char* pBuffer; - - va_start( ap, nFunctionLen ); - sal_uLong nSize = FillBuffer( pBuffer, pFunction, nFunctionLen, ap ); - va_end( ap ); - SendMessage( nSize, pBuffer, nID | ( 1 << 24 ) ); - delete[] pBuffer; -} - -MediatorMessage* PluginConnector::WaitForAnswer( sal_uLong nMessageID ) -{ - if( ! m_bValid ) - return nullptr; - - nMessageID &= 0x00ffffff; - while( m_pListener ) - { - { - osl::MutexGuard aGuard( m_aQueueMutex ); - for( size_t i = 0; i < m_aMessageQueue.size(); i++ ) - { - MediatorMessage* pMessage = m_aMessageQueue[ i ]; - sal_uLong nID = pMessage->m_nID; - if( ( nID & 0xff000000 ) && - ( ( nID & 0x00ffffff ) == nMessageID ) ) - { - m_aMessageQueue.erase( m_aMessageQueue.begin() + i ); - return pMessage; - } - } - } - if( ! m_aMessageQueue.empty() ) - CallWorkHandler(); - WaitForMessage( 2000 ); - } - return nullptr; -} - -ConnectorInstance::ConnectorInstance( NPP inst, char* type, - int args, char* pargnbuf, sal_uLong nargnbytes, - char* pargvbuf, sal_uLong nargvbytes, - char* savedata, sal_uLong savebytes ) : - instance( inst ), - pShell( nullptr ), - pWidget( nullptr ), - pGtkWindow( nullptr ), - pGtkWidget( nullptr ), - bShouldUseXEmbed( false ), - nArg( args ), - pArgnBuf( pargnbuf ), - pArgvBuf( pargvbuf ) -{ - memset( &window, 0, sizeof(window) ); - pMimeType = new char[ strlen( type ) + 1 ]; - strcpy( pMimeType, type ); - aData.len = savebytes; - aData.buf = savedata; - argn = new char*[ nArg ]; - argv = new char*[ nArg ]; - int i; - char* pRun = pArgnBuf; - for( i = 0; i < nArg; i++ ) - { - argn[i] = pRun; - while( *pRun != 0 && (sal_uLong)(pRun - pArgnBuf) < nargnbytes ) - pRun++; - if( (sal_uLong)(pRun - pArgnBuf) < nargnbytes ) - pRun++; - } - pRun = pArgvBuf; - for( i = 0; i < nArg; i++ ) - { - argv[i] = pRun; - while( *pRun != 0 && (sal_uLong)(pRun - pArgvBuf) < nargvbytes ) - pRun++; - if( (sal_uLong)(pRun - pArgvBuf) < nargvbytes ) - pRun++; - } -} - -ConnectorInstance::~ConnectorInstance() -{ - delete [] pMimeType; - delete [] argn; - delete [] argv; - delete [] pArgnBuf; - delete [] pArgvBuf; - delete [] static_cast(aData.buf); -} - -const char* GetCommandName( CommandAtoms eCommand ) -{ - switch( eCommand ) - { - case eNPN_GetURL: return "NPN_GetURL"; - case eNPN_GetURLNotify: return "NPN_GetURLNotify"; - case eNPN_DestroyStream: return "NPN_DestroyStream"; - case eNPN_NewStream: return "NPN_NewStream"; - case eNPN_PostURLNotify: return "NPN_PostURLNotify"; - case eNPN_PostURL: return "NPN_PostURL"; - case eNPN_RequestRead: return "NPN_RequestRead"; - case eNPN_Status: return "NPN_Status"; - case eNPN_Version: return "NPN_Version"; - case eNPN_Write: return "NPN_Write"; - case eNPN_UserAgent: return "NPN_UserAgent"; - - case eNPP_DestroyStream: return "NPP_DestroyStream"; - case eNPP_Destroy: return "NPP_Destroy"; - case eNPP_DestroyPhase2: return "NPP_DestroyPhase2"; - case eNPP_NewStream: return "NPP_NewStream"; - case eNPP_New: return "NPP_New"; - case eNPP_SetWindow: return "NPP_SetWindow"; - case eNPP_StreamAsFile: return "NPP_StreamAsFile"; - case eNPP_URLNotify: return "NPP_URLNotify"; - case eNPP_WriteReady: return "NPP_WriteReady"; - case eNPP_Write: return "NPP_Write"; - case eNPP_GetMIMEDescription: return "NPP_GetMIMEDescription"; - case eNPP_Initialize: return "NPP_Initialize"; - case eNPP_Shutdown: return "NPP_Shutdown"; - - case eMaxCommand: return "eMaxCommand"; - default: return "unknown command"; - } - return nullptr; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/unx/sysplug.cxx b/extensions/source/plugin/unx/sysplug.cxx deleted file mode 100644 index 0693033c81f7..000000000000 --- a/extensions/source/plugin/unx/sysplug.cxx +++ /dev/null @@ -1,152 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include - - -std::shared_ptr CreateSysPlugData() -{ - return std::shared_ptr(); -} - -UnxPluginComm::UnxPluginComm( - const OUString& /*mimetype*/, - const OUString& library, - Window aParent, - int nDescriptor1, - int nDescriptor2 - ) : - PluginComm( OUStringToOString( library, osl_getThreadTextEncoding() ), false ), - PluginConnector( nDescriptor2 ), - m_nCommPID( 0 ) -{ - OString path; - if (!getPluginappPath(&path)) - { - SAL_WARN("extensions.plugin", "cannot construct path to pluginapp.bin"); - return; - } - - char pDesc[32]; - char pWindow[32]; - sprintf( pWindow, "%d", (int)aParent ); - sprintf( pDesc, "%d", nDescriptor1 ); - OString aLib(OUStringToOString(library, osl_getThreadTextEncoding())); - - char const* pArgs[5]; - pArgs[0] = path.getStr(); - pArgs[1] = pDesc; - pArgs[2] = aLib.getStr(); - pArgs[3] = pWindow; - pArgs[4] = nullptr; - - SAL_INFO( - "extensions.plugin", - "try to launch: " << pArgs[0] << " " << pArgs[1] << " " << pArgs[2] - << " " << pArgs[3] << ", descriptors are " << nDescriptor1 << ", " - << nDescriptor2); - - pid_t pid = fork(); - if( pid == 0 ) - { - execvp( pArgs[0], const_cast< char ** >(pArgs) ); - SAL_WARN("extensions.plugin", "could not exec " << pArgs[0]); - _exit(255); - } - - if( pid == -1 ) - { - SAL_WARN("extensions.plugin", "fork failed"); - return; - } - - m_nCommPID = pid; - // wait for pluginapp.bin to start up - if( ! WaitForMessage() ) - { - SAL_WARN( - "extensions.plugin", - "timeout on command: " << pArgs[0] << " " << pArgs[1] << " " - << pArgs[2] << " " << pArgs[3]); - invalidate(); - } - else - { - MediatorMessage* pMessage = GetNextMessage( true ); - Respond( pMessage->m_nID, - const_cast("init ack"),8, - nullptr ); - delete pMessage; - NPP_Initialize(); - } -} - -UnxPluginComm::~UnxPluginComm() -{ - NPP_Shutdown(); - if( m_nCommPID != 0 ) - { - int status = 16777216; - pid_t nExit = waitpid( m_nCommPID, &status, WUNTRACED ); - SAL_INFO( - "extensions.plugin", - "child " << nExit << " (plugin app child " << m_nCommPID - << ") exited with status " << WEXITSTATUS(status)); - } -} - -bool UnxPluginComm::getPluginappPath(OString * path) { - OSL_ASSERT(path != nullptr); - OUString p("$BRAND_BASE_DIR/" LIBO_LIBEXEC_FOLDER "/pluginapp.bin"); - rtl::Bootstrap::expandMacros(p); - return - (osl::FileBase::getSystemPathFromFileURL(p, p) == - osl::FileBase::E_None) && - p.convertToString( - path, osl_getThreadTextEncoding(), - (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | - RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/unx/unxmgr.cxx b/extensions/source/plugin/unx/unxmgr.cxx deleted file mode 100644 index 3e82c38dfb0b..000000000000 --- a/extensions/source/plugin/unx/unxmgr.cxx +++ /dev/null @@ -1,313 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -using namespace std; -using namespace com::sun::star::uno; -using namespace com::sun::star::plugin; - - -// Unix specific implementation -static bool CheckPlugin( const OString& rPath, list< PluginDescription* >& rDescriptions ) -{ -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "Trying plugin %s ... ", rPath.getStr() ); -#endif - - sal_Int32 nPos = rPath.lastIndexOf('/'); - if (nPos == -1) - { -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "no absolute path to plugin\n" ); -#endif - return false; - } - - OString aBaseName = rPath.copy(nPos+1); - if (aBaseName == "libnullplugin.so") - { -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "don't like %s\n", aBaseName.getStr() ); -#endif - return false; - } - - struct stat aStat; - if (stat(rPath.getStr(), &aStat) || !S_ISREG(aStat.st_mode)) - { -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "%s is not a regular file\n", rPath.getStr() ); -#endif - return false; - } - - rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); - - OString path; - if (!UnxPluginComm::getPluginappPath(&path)) - { -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "cannot construct path to pluginapp.bin\n" ); -#endif - return false; - } - OStringBuffer cmd; - tools::appendUnixShellWord(&cmd, path); - cmd.append(' '); - tools::appendUnixShellWord(&cmd, rPath); - OString aCommand(cmd.makeStringAndClear()); - - FILE* pResult = popen( aCommand.getStr(), "r" ); - int nDescriptions = 0; - if( pResult ) - { - OStringBuffer aMIME; - char buf[256]; - while( fgets( buf, sizeof( buf ), pResult ) ) - { - for( size_t i = 0; i < sizeof(buf) && buf[i]; ++i ) - { - if( buf[i] == '\n' ) - buf[i] = ';'; - } - aMIME.append( buf ); - } - pclose( pResult ); - - if( !aMIME.isEmpty() ) - { - OString aLine = aMIME.makeStringAndClear(); - - sal_Int32 nIndex = 0; - while( nIndex != -1 ) - { - OString aType = aLine.getToken( 0, ';', nIndex ); - - sal_Int32 nTypeIndex = 0; - OString aMimetype = aType.getToken( 0, ':', nTypeIndex ); - OString aExtLine = aType.getToken( 0, ':', nTypeIndex ); - if( nTypeIndex < 0 ) // ensure at least three tokens - continue; - OString aDesc = aType.getToken( 0, ':', nTypeIndex ); - - // create extension list string - sal_Int32 nExtIndex = 0; - OStringBuffer aExtension; - while( nExtIndex != -1 ) - { - OString aExt = aExtLine.getToken( 0, ',', nExtIndex); - if( aExt.indexOf( "*." ) != 0 ) - aExtension.append( "*." ); - aExtension.append( aExt ); - if( nExtIndex != -1 ) - aExtension.append( ';' ); - } - - PluginDescription* pNew = new PluginDescription; - // set plugin name (path to library) - pNew->PluginName = OStringToOUString( rPath, aEncoding ); - // set mimetype - pNew->Mimetype = OStringToOUString( aMimetype, aEncoding ); - // set extension line - pNew->Extension = OStringToOUString( aExtension.makeStringAndClear(), aEncoding ); - // set description - pNew->Description= OStringToOUString( aDesc, aEncoding ); - rDescriptions.push_back( pNew ); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "Mimetype: %s\nExtension: %s\n" - "Description: %s\n", - OUStringToOString( pNew->Mimetype, aEncoding ).getStr(), - OUStringToOString( pNew->Extension, aEncoding ).getStr(), - OUStringToOString( pNew->Description, aEncoding ).getStr() - ); -#endif - } - } -#if OSL_DEBUG_LEVEL > 1 - else - fprintf( stderr, "result of \"%s\" contains no mimtype\n", - aCommand.getStr() ); -#endif - } -#if OSL_DEBUG_LEVEL > 1 - else - fprintf( stderr, "command \"%s\" failed\n", aCommand.getStr() ); -#endif - return nDescriptions > 0; -} - -static void CheckPluginRegistryFiles( const OString& rPath, list< PluginDescription* >& rDescriptions ) -{ - OStringBuffer aPath( 1024 ); - aPath.append( rPath ); - aPath.append( "/pluginreg.dat" ); - FILE* fp = fopen( aPath.getStr(), "r" ); - if( fp ) - { -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "parsing %s\n", aPath.getStr() ); -#endif - char aLine[1024]; - while( fgets( aLine, sizeof( aLine ), fp ) ) - { - int nLineLen = strlen( aLine ); - int nDotPos; - for( nDotPos = nLineLen-1; nDotPos > 0 && aLine[nDotPos] != ':'; nDotPos-- ) - ; - if( aLine[0] == '/' && aLine[nDotPos] == ':' && aLine[nDotPos+1] == '$' ) - CheckPlugin( OString(aLine, nDotPos), rDescriptions ); - } - fclose( fp ); - } - - // check subdirectories - DIR* pDIR = opendir( rPath.getStr() ); - struct dirent* pDirEnt = nullptr; - struct stat aStat; - struct dirent u; - while( pDIR && ! readdir_r( pDIR, &u, &pDirEnt ) && pDirEnt ) - { - char* pBaseName = u.d_name; - if( rtl_str_compare( ".", pBaseName ) && rtl_str_compare( "..", pBaseName ) ) - { - OStringBuffer aBuf( 1024 ); - aBuf.append( rPath ); - aBuf.append( '/' ); - aBuf.append( pBaseName ); - - if( ! stat( aBuf.getStr(), &aStat ) ) - { - if( S_ISDIR( aStat.st_mode ) ) - CheckPluginRegistryFiles( aBuf.makeStringAndClear(), rDescriptions ); - } - } - } - if( pDIR ) - closedir( pDIR ); -} - -Sequence XPluginManager_Impl::impl_getPluginDescriptions() throw(css::uno::RuntimeException, std::exception) -{ - static Sequence aDescriptions; - static bool bHavePlugins = false; - if( ! bHavePlugins ) - { - rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); - list aPlugins; - int i; - - // unix: search for plugins in /usr/lib/netscape/plugins, - // ~/.netscape/plugins und NPX_PLUGIN_PATH - // additionally: search in PluginsPath - static const char* pHome = getenv( "HOME" ); - static const char* pNPXPluginPath = getenv( "NPX_PLUGIN_PATH" ); - - // netscape!, quick, beam me back to the 90's when Motif roamed the earth - OStringBuffer aSearchBuffer("/usr/lib/netscape/plugins"); - if( pHome ) - aSearchBuffer.append(':').append(pHome).append("/.netscape/plugins"); - if( pNPXPluginPath ) - aSearchBuffer.append(':').append(pNPXPluginPath); - - const Sequence< OUString >& rPaths( PluginManager::getAdditionalSearchPaths() ); - for( i = 0; i < rPaths.getLength(); i++ ) - { - aSearchBuffer.append(':').append(OUStringToOString( - rPaths.getConstArray()[i], aEncoding)); - } - - OString aSearchPath = aSearchBuffer.makeStringAndClear(); - - sal_Int32 nIndex = 0; - struct dirent u; - do - { - OString aPath(aSearchPath.getToken(0, ':', nIndex)); - if (!aPath.isEmpty()) - { - DIR* pDIR = opendir(aPath.getStr()); - struct dirent* pDirEnt = nullptr; - while( pDIR && ! readdir_r( pDIR, &u, &pDirEnt ) && pDirEnt ) - { - char* pBaseName = u.d_name; - if( pBaseName[0] != '.' || - pBaseName[1] != '.' || - pBaseName[2] != 0 ) - { - OStringBuffer aFileName(aPath); - aFileName.append('/').append(pBaseName); - CheckPlugin( aFileName.makeStringAndClear(), aPlugins ); - } - } - if( pDIR ) - closedir( pDIR ); - } - } - while ( nIndex >= 0 ); - - // try ~/.mozilla/pluginreg.dat - OStringBuffer aBuf(256); - aBuf.append( pHome ); - aBuf.append( "/.mozilla" ); - CheckPluginRegistryFiles( aBuf.makeStringAndClear(), aPlugins ); - - // create return value - aDescriptions = Sequence( aPlugins.size() ); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "found %" SAL_PRI_SIZET "u plugins\n", aPlugins.size() ); -#endif - list::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; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/win/sysplug.cxx b/extensions/source/plugin/win/sysplug.cxx deleted file mode 100644 index 9c25da3c219d..000000000000 --- a/extensions/source/plugin/win/sysplug.cxx +++ /dev/null @@ -1,441 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include -#include - -#include - -#include - -#if defined _MSC_VER -#pragma warning (push,1) -#pragma warning (disable:4005) -#endif - -#include -#include -#include - -#if defined _MSC_VER -#pragma warning (pop) -#endif - -#include -#include -#include - - -extern NPNetscapeFuncs aNPNFuncs; - -#include - - -#if OSL_DEBUG_LEVEL > 1 -void TRACE( char const * s ); -void TRACEN( char const * s, long n ); -#else -#define TRACE(x) -#define TRACEN(x,n) -#endif - -std::shared_ptr CreateSysPlugData() -{ - return std::shared_ptr(); -} - - -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 (WINAPI * pEntry)( NPPluginFuncs* ); - retrieveFunction( _T("NP_GetEntryPoints"), (void**)&pEntry ); - - _NPPfuncs.size = sizeof( _NPPfuncs ); - _NPPfuncs.version = 0; - NPError nErr = (*pEntry)( &_NPPfuncs ); - - SAL_WARN_IF( - nErr != NPERR_NO_ERROR, "extensions.plugin", - "NP_GetEntryPoints() failed"); - DBG_ASSERT( (_NPPfuncs.version >> 8) >= NP_VERSION_MAJOR, - "### version failure!" ); - - m_eCall = eNP_Initialize; - if (execute() != NPERR_NO_ERROR) { - shutdown(); - throw CannotInitializeException(); - } -} - - -PluginComm_Impl::~PluginComm_Impl() -{ - shutdown(); -} - -void PluginComm_Impl::shutdown() -{ - if (_plDLL) - { -// NPP_Shutdown(); - - NPError (WINAPI * pShutdown)(); - if (retrieveFunction( _T("NP_Shutdown"), (void**)&pShutdown )) - { - NPError nErr = (*pShutdown)(); (void)nErr; - DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NP_Shutdown() failed!" ); - } - - BOOL bRet = (BOOL)::FreeLibrary( _plDLL ); (void)bRet; - DBG_ASSERT( bRet, "### unloading plugin dll failed!" ); - _plDLL = NULL; - } -} - - -BOOL PluginComm_Impl::retrieveFunction( TCHAR const * pName, void** ppFunc ) const -{ - if( ! _plDLL ) - return FALSE; - - *ppFunc = (void*)::GetProcAddress( _plDLL, pName ); - - return (*ppFunc != NULL); -} - - - -long PluginComm_Impl::doIt() -{ - long nRet = 0; - switch( m_eCall ) - { - case eNP_Initialize: - { - TRACE( "eNP_Initialize" ); - NPError (WINAPI * pInit)( NPNetscapeFuncs* ); - if ((_NPPfuncs.version >> 8) >= NP_VERSION_MAJOR && - (retrieveFunction( _T("NP_Initialize"), (void**)&pInit ) || - retrieveFunction( _T("NP_PluginInit"), (void**)&pInit ))) - { - nRet = (*pInit)( &aNPNFuncs ); - } - else - { - nRet = NPERR_GENERIC_ERROR; - } - DBG_ASSERT( nRet == NPERR_NO_ERROR, "### NP_Initialize() failed!" ); - } - break; - case eNPP_Destroy: - TRACE( "eNPP_Destroy" ); - nRet = (_NPPfuncs.destroy - ? (*_NPPfuncs.destroy)( - (NPP)m_aArgs[0], - (NPSavedData**)m_aArgs[1] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_DestroyStream: - TRACE( "eNPP_DestroyStream" ); - nRet = (_NPPfuncs.destroystream - ? (*_NPPfuncs.destroystream)( - (NPP)m_aArgs[0], - (NPStream*)m_aArgs[1], - (NPError)(sal_IntPtr)m_aArgs[2] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_New: - TRACE( "eNPP_New" ); - nRet = (_NPPfuncs.newp - ? (*_NPPfuncs.newp)( - (NPMIMEType)m_aArgs[0], - (NPP)m_aArgs[1], - (uint16_t)(sal_IntPtr)m_aArgs[2], - (int16_t)(sal_IntPtr)m_aArgs[3], - (char**)m_aArgs[4], - (char**)m_aArgs[5], - (NPSavedData*)m_aArgs[6] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_NewStream: - TRACE( "eNPP_NewStream" ); - nRet = (_NPPfuncs.newstream - ? (*_NPPfuncs.newstream)( - (NPP)m_aArgs[0], - (NPMIMEType)m_aArgs[1], - (NPStream*)m_aArgs[2], - (NPBool)(sal_IntPtr)m_aArgs[3], - (uint16_t*)m_aArgs[4] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_Print: - TRACE( "eNPP_Print" ); - if (_NPPfuncs.print) - (*_NPPfuncs.print)( - (NPP)m_aArgs[0], - (NPPrint*)m_aArgs[1] ); - break; - case eNPP_SetWindow: - { - TRACE( "eNPP_SetWindow" ); - nRet = (_NPPfuncs.setwindow - ? (*_NPPfuncs.setwindow)( - (NPP)m_aArgs[0], - (NPWindow*)m_aArgs[1] ) - : NPERR_GENERIC_ERROR); - break; - } - case eNPP_StreamAsFile: - TRACE( "eNPP_StreamAsFile" ); - if (_NPPfuncs.asfile) - (*_NPPfuncs.asfile)( - (NPP)m_aArgs[0], - (NPStream*)m_aArgs[1], - (char*)m_aArgs[2] ); - break; - case eNPP_URLNotify: - TRACE( "eNPP_URLNotify" ); - if (_NPPfuncs.urlnotify) - (*_NPPfuncs.urlnotify)( - (NPP)m_aArgs[0], - (char*)m_aArgs[1], - (NPReason)(sal_IntPtr)m_aArgs[2], - m_aArgs[3] ); - break; - case eNPP_Write: - TRACEN( "eNPP_Write n=", (int32_t)m_aArgs[3] ); - nRet = (_NPPfuncs.write - ? (*_NPPfuncs.write)( - (NPP)m_aArgs[0], - (NPStream*)m_aArgs[1], - (sal_IntPtr)m_aArgs[2], - (sal_IntPtr)m_aArgs[3], - m_aArgs[4] ) - : 0); - break; - case eNPP_WriteReady: - TRACE( "eNPP_WriteReady" ); - nRet = (_NPPfuncs.writeready - ? (*_NPPfuncs.writeready)( - (NPP)m_aArgs[0], - (NPStream*)m_aArgs[1] ) - : 0); - break; - case eNPP_GetValue: - TRACE( "eNPP_GetValue" ); - nRet = (_NPPfuncs.getvalue - ? (*_NPPfuncs.getvalue)( - (NPP)m_aArgs[0], - (NPPVariable)(sal_IntPtr)m_aArgs[1], - m_aArgs[2] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_SetValue: - TRACE( "eNPP_SetValue" ); - nRet = (_NPPfuncs.setvalue - ? (*_NPPfuncs.setvalue)( - (NPP)m_aArgs[0], - (NPNVariable)(sal_IntPtr)m_aArgs[1], - m_aArgs[2] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_Shutdown: - { - TRACE( "eNPP_Shutdown" ); - NPP_ShutdownUPP pFunc; - if (retrieveFunction( _T("NPP_Shutdown"), (void**)&pFunc )) - (*pFunc)(); - } - break; - case eNPP_Initialize: - TRACE( "eNPP_Initialize" ); - OSL_FAIL( "NPP_Initialize: not implemented!" ); - break; - case eNPP_GetJavaClass: - TRACE( "eNPP_GetJavaClass" ); - OSL_FAIL( "NPP_GetJavaClass: not implemented!" ); - break; - } - return nRet; -} - - -NPError PluginComm_Impl::NPP_Destroy( NPP instance, NPSavedData** save ) -{ - DBG_ASSERT( _NPPfuncs.destroy, "### NPP_Destroy(): null pointer in NPP functions table!" ); - m_eCall = eNPP_Destroy; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)save; - return (NPError)execute(); -} - - -NPError PluginComm_Impl::NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason ) -{ - DBG_ASSERT( _NPPfuncs.destroystream, "### NPP_DestroyStream(): null pointer in NPP functions table!" ); - m_eCall = eNPP_DestroyStream; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)stream; - m_aArgs[2] = reinterpret_cast< void * >(static_cast< sal_IntPtr >(reason)); - return (NPError)execute(); -} - - -NPError PluginComm_Impl::NPP_New( NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, - char* argn[], char* argv[], NPSavedData *saved ) -{ - DBG_ASSERT( _NPPfuncs.newp, "### NPP_New(): null pointer in NPP functions table!" ); - m_eCall = eNPP_New; - m_aArgs[0] = (void*)pluginType; - m_aArgs[1] = (void*)instance; - m_aArgs[2] = reinterpret_cast< void * >(static_cast< sal_uIntPtr >(mode)); - m_aArgs[3] = reinterpret_cast< void * >(static_cast< sal_IntPtr >(argc)); - m_aArgs[4] = (void*)argn; - m_aArgs[5] = (void*)argv; - m_aArgs[6] = (void*)saved; - return (NPError)execute(); -} - - -NPError PluginComm_Impl::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream, - NPBool seekable, uint16_t* stype ) -{ - DBG_ASSERT( _NPPfuncs.newstream, "### NPP_NewStream(): null pointer in NPP functions table!" ); - m_eCall = eNPP_NewStream; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)type; - m_aArgs[2] = (void*)stream; - m_aArgs[3] = reinterpret_cast< void * >( - static_cast< sal_uIntPtr >(seekable)); - m_aArgs[4] = (void*)stype; - return (NPError)execute(); -} - - -void PluginComm_Impl::NPP_Print( NPP instance, NPPrint* platformPrint ) -{ - DBG_ASSERT( _NPPfuncs.print, "### NPP_Print(): null pointer in NPP functions table!" ); - m_eCall = eNPP_Print; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)platformPrint; - execute(); -} - - -NPError PluginComm_Impl::NPP_SetWindow( NPP instance, NPWindow* window ) -{ - DBG_ASSERT( _NPPfuncs.setwindow, "### NPP_SetWindow(): null pointer in NPP functions table!" ); - m_eCall = eNPP_SetWindow; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)window; - return (NPError)execute(); -} - - -void PluginComm_Impl::NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname ) -{ - DBG_ASSERT( _NPPfuncs.asfile, "### NPP_StreamAsFile(): null pointer in NPP functions table!" ); - m_eCall = eNPP_StreamAsFile; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)stream; - m_aArgs[2] = (void*)fname; - execute(); -} - - -void 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!" ); - m_eCall = eNPP_URLNotify; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)url; - m_aArgs[2] = reinterpret_cast< void * >(static_cast< sal_IntPtr >(reason)); - m_aArgs[3] = notifyData; - execute(); -} - - -int32_t PluginComm_Impl::NPP_Write( NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer ) -{ - DBG_ASSERT( _NPPfuncs.write, "### NPP_Write(): null pointer in NPP functions table!" ); - m_eCall = eNPP_Write; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)stream; - m_aArgs[2] = (void*)(sal_IntPtr)offset; - m_aArgs[3] = (void*)(sal_IntPtr)len; - m_aArgs[4] = buffer; - return (NPError)execute(); -} - - -int32_t PluginComm_Impl::NPP_WriteReady( NPP instance, NPStream* stream ) -{ - DBG_ASSERT( _NPPfuncs.writeready, "### NPP_WriteReady(): null pointer in NPP functions table!" ); - m_eCall = eNPP_WriteReady; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)stream; - return execute(); -} - - -NPError PluginComm_Impl::NPP_GetValue( NPP instance, NPPVariable variable, void *ret_value ) -{ - DBG_ASSERT( _NPPfuncs.getvalue, "### NPP_GetValue(): null pointer in NPP functions table!" ); - m_eCall = eNPP_GetValue; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)variable; - m_aArgs[2] = ret_value; - return (NPError)execute(); -} - - -NPError PluginComm_Impl::NPP_Initialize() -{ - return NPERR_NO_ERROR; -} - - -void PluginComm_Impl::NPP_Shutdown() -{ - m_eCall = eNPP_Shutdown; - execute(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/win/winmgr.cxx b/extensions/source/plugin/win/winmgr.cxx deleted file mode 100644 index b84315e1873f..000000000000 --- a/extensions/source/plugin/win/winmgr.cxx +++ /dev/null @@ -1,445 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include -#include - -#include "vcl/svapp.hxx" -#include "tools/urlobj.hxx" -#include "osl/mutex.hxx" - -#include "rtl/string.hxx" -#include "rtl/ustring.hxx" -#include "rtl/ustrbuf.hxx" - -#include "plugin/impl.hxx" - -#if defined _MSC_VER -#pragma warning (push,1) -#pragma warning (disable:4005) -#endif - -#include -#include -#include - -#if defined _MSC_VER -#pragma warning (pop) -#endif - -#include -#include -#include - - -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; - - if (::rtl_str_indexOfStr( pPluginsPath, "%programfiles%" ) == 0) - { - const char * p = ::getenv( "ProgramFiles" ); - if (p) - { - ::lstrcpy( arPluginsPath, p ); - pPluginsPath += 14; - } - } - ::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) - { - OString aName = OString( aFindData.cFileName ).toAsciiLowerCase(); - - // no netscape default plugin anymore... - // and no double plugin dlls - if ( !aName.equals( "npnul32.dll" ) && - ! aName.equals( "npnrvp.dll" ) && - rPlugins.find( aName ) == rPlugins.end()) - { - TCHAR arComplete[MAX_PATH]; - ::lstrcpy( arComplete, arPluginsPath ); - ::lstrcat( arComplete, aFindData.cFileName ); - - OUString path( OStringToOUString( arComplete, RTL_TEXTENCODING_MS_1252 ) ); - rPlugins[ aName ] = path; - } - - 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); - arPluginsPath[dwPluginsPathSize-1] = 0; - - OString aStr( OUStringToOString( rPath, RTL_TEXTENCODING_MS_1252 ) ); - ::strncpy( arPluginsPath, aStr.getStr(), dwPluginsPathSize ); - - 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_keys( HKEY hKey, PluginLocationMap & rPlugins ) -{ - TCHAR value[MAX_PATH]; - DWORD dwType, size; - - // 4.7 - size = sizeof(value); - if (::RegQueryValueEx( - hKey, _T("Plugins Directory"), NULL, &dwType, - (LPBYTE)value, &size ) == ERROR_SUCCESS && - (dwType == REG_SZ || dwType == REG_EXPAND_SZ)) - { - addPluginsFromPath( value, rPlugins ); - } - // 6 - size = sizeof(value); - if (::RegQueryValueEx( - hKey, _T("Install Directory"), NULL, &dwType, - (LPBYTE)value, &size ) == ERROR_SUCCESS && - (dwType == REG_SZ || dwType == REG_EXPAND_SZ)) - { - int n = size / sizeof (TCHAR); - if ('\\' != value[ n -2 ]) - { - value[ n -1 ] = '\\'; - value[ n ] = 0; - } - addPluginsFromPath( ::lstrcat( value, _T("Plugins") ), rPlugins ); - } - size = sizeof(value); - if (::RegQueryValueEx( - hKey, _T("Plugins"), NULL, &dwType, - (LPBYTE)value, &size ) == ERROR_SUCCESS && - (dwType == REG_SZ || dwType == REG_EXPAND_SZ)) - { - addPluginsFromPath( value, rPlugins ); - } -} - -static void add_NS_lookupRecursive( HKEY hKey, PluginLocationMap & rPlugins ) -{ - add_NS_keys( hKey, rPlugins ); - - TCHAR keyName[MAX_PATH]; - DWORD dwIndex = 0, size = sizeof (keyName); - - while (::RegEnumKeyEx( hKey, dwIndex, keyName, &size, NULL, NULL, NULL, NULL ) == ERROR_SUCCESS) - { - size = sizeof (keyName); - HKEY hSubKey; - if (::RegOpenKeyEx( hKey, keyName, 0, KEY_READ, &hSubKey ) == ERROR_SUCCESS) - { - add_NS_lookupRecursive( hSubKey, rPlugins ); - ::RegCloseKey( hSubKey ); - } - ++dwIndex; - } -} - -static void add_MozPlugin( HKEY hKey, PluginLocationMap & rPlugins ) -{ - TCHAR value[MAX_PATH]; - DWORD dwType, size; - - size = sizeof(value); - if (::RegQueryValueEx( - hKey, _T("Path"), NULL, &dwType, - (LPBYTE)value, &size ) == ERROR_SUCCESS && - (dwType == REG_SZ || dwType == REG_EXPAND_SZ)) - { - OUString aUPath( OStringToOUString( value, RTL_TEXTENCODING_MS_1252 ) ); - INetURLObject aURL( aUPath ); - OString aName( OUStringToOString( aURL.GetName().toAsciiLowerCase(), RTL_TEXTENCODING_MS_1252 ) ); - - // no netscape default plugin anymore... - // and no double plugin dlls - if ( !aName.equals( "npnul32.dll" ) && - ! aName.equals( "npnrvp.dll" ) && - rPlugins.find( aName ) == rPlugins.end()) - { - rPlugins[ aName ] = aUPath; - } - } -} -static void add_MozillaPlugin( HKEY hKey, PluginLocationMap & rPlugins ) -{ - TCHAR keyName[MAX_PATH]; - DWORD dwIndex = 0, size = sizeof (keyName); - - while (::RegEnumKeyEx( hKey, dwIndex, keyName, &size, NULL, NULL, NULL, NULL ) == ERROR_SUCCESS) - { - size = sizeof (keyName); - HKEY hSubKey; - if (::RegOpenKeyEx( hKey, keyName, 0, KEY_READ, &hSubKey ) == ERROR_SUCCESS) - { - add_MozPlugin( hSubKey, rPlugins ); - ::RegCloseKey( hSubKey ); - } - ++dwIndex; - } -} - -static void add_NS_Plugins( PluginLocationMap & rPlugins ) -{ - HKEY hKey; - // Netscape - if (::RegOpenKeyEx( - HKEY_LOCAL_MACHINE, _T("Software\\Netscape"), - 0, KEY_READ, &hKey ) == ERROR_SUCCESS) - { - add_NS_lookupRecursive( hKey, rPlugins ); - ::RegCloseKey( hKey ); - } - // Mozilla - if (::RegOpenKeyEx( - HKEY_LOCAL_MACHINE, _T("Software\\Mozilla"), - 0, KEY_READ, &hKey ) == ERROR_SUCCESS) - { - add_NS_lookupRecursive( hKey, rPlugins ); - ::RegCloseKey( hKey ); - } - // Mozilla - plugins - if (::RegOpenKeyEx( - HKEY_LOCAL_MACHINE, _T("Software\\MozillaPlugins"), - 0, KEY_READ, &hKey ) == ERROR_SUCCESS) - { - add_MozillaPlugin( hKey, rPlugins ); - ::RegCloseKey( hKey ); - } -} - - -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::impl_getPluginDescriptions() throw(css::uno::RuntimeException, std::exception) -{ - Guard< Mutex > aGuard( Mutex::getGlobalMutex() ); - static Sequence s_aDescriptions( 0 ); - static bool 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() ); - - OString aStr( OUStringToOString( aName, RTL_TEXTENCODING_MS_1252 ) ); - ::strcpy( arFileName, aStr.getStr() ); - dwSize = ::GetFileVersionInfoSize( arFileName, &dwDummy ); - - if ( !dwSize ) - continue; - - char * pVersionData = new char[dwSize]; - if (::GetFileVersionInfo( arFileName, 0, dwSize, pVersionData)) - { - // optional comment - OUString aComment; - - TCHAR * pInfo = NULL, * pInfo2 = NULL; - UINT nSize = 0; - if (::VerQueryValue( pVersionData, _T("\\StringFileInfo\\040904E4\\ProductName"), - (void**)&pInfo, &nSize ) && pInfo) - { - aComment.operator=( OStringToOUString( OString(pInfo), RTL_TEXTENCODING_MS_1252 ) ); - } - - // 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) - { - OString aExt( pInfo2 ); - OString aMIME( pInfo ); - aMIME.trim(); - - // count mime tokens - USHORT nToken = 0; - if (aMIME.getLength()) - { - ++nToken; - for ( sal_Int32 n = aMIME.getLength(); n--; ) - { - if (aMIME[ n ] == '|') - { - ++nToken; - } - } - } - sal_Int32 nIndex = 0, nIndex2 = 0; - - UINT32 nStart = s_aDescriptions.getLength(); - s_aDescriptions.realloc( nStart + nToken ); - PluginDescription* pDescriptions = s_aDescriptions.getArray(); - // for every MIME Type - sal_Int32 nTok = 0; - while (true) - { - if (nIndex < 0 || nIndex2 < 0) - break; - - PluginDescription & rDescr = pDescriptions[nStart+nTok]; - OString aMIMEToken( aMIME.getToken( 0, '|', nIndex ) ); - OString aExtToken2( aExt.getToken( 0, '|', nIndex2 ) ); - if( aMIMEToken.isEmpty() || aExtToken2.isEmpty() ) - continue; - - rDescr.Mimetype = OUString( - aMIMEToken.getStr(), aMIMEToken.getLength(), RTL_TEXTENCODING_MS_1252 ); - if (! rDescr.Mimetype.getLength()) - break; - - OUString aExtToken( aExtToken2.getStr(), aExtToken2.getLength(), RTL_TEXTENCODING_MS_1252 ); - rDescr.PluginName = aName; - rDescr.Description = aComment; - - sal_Int32 nPos = 0, nLen = aExtToken.getLength(); - OUString aExtensions = nLen ? OUString("*.") : OUString("*.*"); - - for ( ; nPos < nLen; ++nPos ) - { - sal_Unicode c = aExtToken[nPos]; - switch (c) - { - case ',': - case ';': - aExtensions += ";*."; - case ' ': - break; - case '*': - if (nPos < (nLen-1) && aExtToken[ nPos+1 ] == '.') - { - ++nPos; - break; - } - default: - aExtensions += OUString( &c, 1 ); - } - } - rDescr.Extension = aExtensions; - - ++nTok; - } - - if (nToken != nTok) - { - s_aDescriptions.realloc( nTok ); - } - } -#if OSL_DEBUG_LEVEL > 1 - else - OSL_FAIL( "### cannot get MIME type or extensions!" ); -#endif - } - delete[] pVersionData; - } - - s_bInit = TRUE; - } - return s_aDescriptions; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/external/np_sdk/README b/external/np_sdk/README deleted file mode 100644 index da63135a8f86..000000000000 --- a/external/np_sdk/README +++ /dev/null @@ -1 +0,0 @@ -Netscape Plugin SDK. Header to build Mozilla plugins. diff --git a/external/np_sdk/inc/LEGAL b/external/np_sdk/inc/LEGAL deleted file mode 100644 index c10e0f0d21a8..000000000000 --- a/external/np_sdk/inc/LEGAL +++ /dev/null @@ -1,43 +0,0 @@ -Please be apprised of the following Legal Notices: - -A) The U.S. District Court for the Eastern District of Virginia has -ruled that the Netscape Navigator code does not infringe Wang's U.S. -Patent No. 4,751,669 ("the '669 Patent") because: 1) HTML is not -Videotex as defined by the '669 patent; 2) web servers are not central -suppliers; and 3) Navigator does not "connect," as defined by the '669 -Patent, to web servers on the Internet. Wang may appeal this decision to -the Federal Circuit. Wang contended that its Patent disclosing a -"Videotext" system, is infringed by the following functionality in the -Netscape Navigator code: 1) the animated logo and status line indicators ---See Claims 1,8 and 9; 2) the "File Save As" function --See Claims -23-27; 3) Bookmarks and Rename Bookmarks in the Properties window --See -Claims 20-22; 4) storing HTML, GIF, and JPEG files and adding filename -extensions --See Claim 38 - -B) Intermind owns pending U.S. patent applications on communications -systems which employ metadata ("channel objects") to define a control -structure for information transfer. The Netscape code does not infringe -as released; however, modifications which utilize channel objects as -described by Intermind should be considered carefully. The following is -a statement from Intermind: "Intermind's claims fundamentally involve -the use of a control structure to automate communications. ...The -essence of Intermind's top claim is that two devices sender and -receiver have persistent storage, communicate over a network, -and exchange a control structure including metadata which describes: 1) -what information is to be updated, 2) when to update this information, -and 3) how to transfer the updated information. In addition, at least -the receiving device must be able to process the metadata in order to -perform the update determination and transfer. Any digital -communications system which incorporates all of these elements will be -covered by Intermind's patents." See Intermind.com. - -C) Stac, Inc., and its licensing agent Hi/fn, own several patents which -disclose data compression methods implementing an LZS compression -algorithm, including U.S. Patent Nos. 4,701,745 and 5,016, 009 ("the -Stac Patents"). The Netscape Communicator code does not perform -compression. If you modify the Netscape source code to perform -compression, please take notice of the Stac Patents. - -D) Netscape Communications Corporation ("Netscape") does not guarantee -that any source code or executable code available from the mozilla.org -domain is Year 2000 compliant. diff --git a/external/np_sdk/inc/LICENSE b/external/np_sdk/inc/LICENSE deleted file mode 100644 index 18f8109b7972..000000000000 --- a/external/np_sdk/inc/LICENSE +++ /dev/null @@ -1,567 +0,0 @@ - MOZILLA PUBLIC LICENSE - Version 1.1 - - --------------- - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the - Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to - the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Code, prior Modifications used by a Contributor, and the Modifications - made by that particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the - combination of the Original Code and Modifications, in each case - including portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally - accepted in the software development community for the electronic - transfer of data. - - 1.5. "Executable" means Covered Code in any form other than Source - Code. - - 1.6. "Initial Developer" means the individual or entity identified - as the Initial Developer in the Source Code notice required by Exhibit - A. - - 1.7. "Larger Work" means a work which combines Covered Code or - portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the - substance or structure of either the Original Code or any previous - Modifications. When Covered Code is released as a series of files, a - Modification is: - A. Any addition to or deletion from the contents of a file - containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or - previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code - which is described in the Source Code notice required by Exhibit A as - Original Code, and which, at the time of its release under this - License is not already Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for - making modifications to it, including all modules it contains, plus - any associated interface definition files, scripts used to control - compilation and installation of an Executable, or source code - differential comparisons against either the Original Code or another - well known, available Covered Code of the Contributor's choice. The - Source Code can be in a compressed or archival form, provided the - appropriate decompression or de-archiving software is widely available - for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, this - License or a future version of this License issued under Section 6.1. - For legal entities, "You" includes any entity which controls, is - controlled by, or is under common control with You. For purposes of - this definition, "control" means (a) the power, direct or indirect, - to cause the direction or management of such entity, whether by - contract or otherwise, or (b) ownership of more than fifty percent - (50%) of the outstanding shares or beneficial ownership of such - entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, - non-exclusive license, subject to third party intellectual property - claims: - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Code (or portions thereof) with or without Modifications, and/or - as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or - selling of Original Code, to make, have made, use, practice, - sell, and offer for sale, and/or otherwise dispose of the - Original Code (or portions thereof). - - (c) the licenses granted in this Section 2.1(a) and (b) are - effective on the date Initial Developer first distributes - Original Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: 1) for code that You delete from the Original Code; 2) - separate from the Original Code; or 3) for infringements caused - by: i) the modification of the Original Code or ii) the - combination of the Original Code with other software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor - hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor, to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof) either on an - unmodified basis, with other Modifications, as Covered Code - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or - selling of Modifications made by that Contributor either alone - and/or in combination with its Contributor Version (or portions - of such combination), to make, use, sell, offer for sale, have - made, and/or otherwise dispose of: 1) Modifications made by that - Contributor (or portions thereof); and 2) the combination of - Modifications made by that Contributor with its Contributor - Version (or portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are - effective on the date Contributor first makes Commercial Use of - the Covered Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: 1) for any code that Contributor has deleted from the - Contributor Version; 2) separate from the Contributor Version; - 3) for infringements caused by: i) third party modifications of - Contributor Version or ii) the combination of Modifications made - by that Contributor with other software (except as part of the - Contributor Version) or other devices; or 4) under Patent Claims - infringed by Covered Code in the absence of Modifications made by - that Contributor. - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are - governed by the terms of this License, including without limitation - Section 2.2. The Source Code version of Covered Code may be - distributed only under the terms of this License or a future version - of this License released under Section 6.1, and You must include a - copy of this License with every copy of the Source Code You - distribute. You may not offer or impose any terms on any Source Code - version that alters or restricts the applicable version of this - License or the recipients' rights hereunder. However, You may include - an additional document offering the additional rights described in - Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be - made available in Source Code form under the terms of this License - either on the same media as an Executable version or via an accepted - Electronic Distribution Mechanism to anyone to whom you made an - Executable version available; and if made available via Electronic - Distribution Mechanism, must remain available for at least twelve (12) - months after the date it initially became available, or at least six - (6) months after a subsequent version of that particular Modification - has been made available to such recipients. You are responsible for - ensuring that the Source Code version remains available even if the - Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a - file documenting the changes You made to create that Covered Code and - the date of any change. You must include a prominent statement that - the Modification is derived, directly or indirectly, from Original - Code provided by the Initial Developer and including the name of the - Initial Developer in (a) the Source Code, and (b) in any notice in an - Executable version or related documentation in which You describe the - origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's - intellectual property rights is required to exercise the rights - granted by such Contributor under Sections 2.1 or 2.2, - Contributor must include a text file with the Source Code - distribution titled "LEGAL" which describes the claim and the - party making the claim in sufficient detail that a recipient will - know whom to contact. If Contributor obtains such knowledge after - the Modification is made available as described in Section 3.2, - Contributor shall promptly modify the LEGAL file in all copies - Contributor makes available thereafter and shall take other steps - (such as notifying appropriate mailing lists or newsgroups) - reasonably calculated to inform those who received the Covered - Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming - interface and Contributor has knowledge of patent licenses which - are reasonably necessary to implement that API, Contributor must - also include this information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to - Section 3.4(a) above, Contributor believes that Contributor's - Modifications are Contributor's original creation(s) and/or - Contributor has sufficient rights to grant the rights conveyed by - this License. - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source - Code. If it is not possible to put such notice in a particular Source - Code file due to its structure, then You must include such notice in a - location (such as a relevant directory) where a user would be likely - to look for such a notice. If You created one or more Modification(s) - You may add your name as a Contributor to the notice described in - Exhibit A. You must also duplicate this License in any documentation - for the Source Code where You describe recipients' rights or ownership - rights relating to Covered Code. You may choose to offer, and to - charge a fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Code. However, You - may do so only on Your own behalf, and not on behalf of the Initial - Developer or any Contributor. You must make it absolutely clear than - any such warranty, support, indemnity or liability obligation is - offered by You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred by the - Initial Developer or such Contributor as a result of warranty, - support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the - requirements of Section 3.1-3.5 have been met for that Covered Code, - and if You include a notice stating that the Source Code version of - the Covered Code is available under the terms of this License, - including a description of how and where You have fulfilled the - obligations of Section 3.2. The notice must be conspicuously included - in any notice in an Executable version, related documentation or - collateral in which You describe recipients' rights relating to the - Covered Code. You may distribute the Executable version of Covered - Code or ownership rights under a license of Your choice, which may - contain terms different from this License, provided that You are in - compliance with the terms of this License and that the license for the - Executable version does not attempt to limit or alter the recipient's - rights in the Source Code version from the rights set forth in this - License. If You distribute the Executable version under a different - license You must make it absolutely clear that any terms which differ - from this License are offered by You alone, not by the Initial - Developer or any Contributor. You hereby agree to indemnify the - Initial Developer and every Contributor for any liability incurred by - the Initial Developer or such Contributor as a result of any such - terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code - not governed by the terms of this License and distribute the Larger - Work as a single product. In such a case, You must make sure the - requirements of this License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this - License with respect to some or all of the Covered Code due to - statute, judicial order, or regulation then You must: (a) comply with - the terms of this License to the maximum extent possible; and (b) - describe the limitations and the code they affect. Such description - must be included in the LEGAL file described in Section 3.4 and must - be included with all distributions of the Source Code. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has - attached the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised - and/or new versions of the License from time to time. Each version - will be given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the - License, You may always continue to use it under the terms of that - version. You may also choose to use such Covered Code under the terms - of any subsequent version of the License published by Netscape. No one - other than Netscape has the right to modify the terms applicable to - Covered Code created under this License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may - only do in order to apply it to code which is not already Covered Code - governed by this License), You must (a) rename Your license so that - the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", - "MPL", "NPL" or any confusingly similar phrase do not appear in your - license (except to note that your license differs from this License) - and (b) otherwise make it clear that Your version of the license - contains terms which differ from the Mozilla Public License and - Netscape Public License. (Filling in the name of the Initial - Developer, Original Code or Contributor in the notice described in - Exhibit A shall not of themselves be deemed to be modifications of - this License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF - DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. - THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE - IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, - YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE - COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER - OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to cure - such breach within 30 days of becoming aware of the breach. All - sublicenses to the Covered Code which are properly granted shall - survive any termination of this License. Provisions which, by their - nature, must remain in effect beyond the termination of this License - shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement - claim (excluding declatory judgment actions) against Initial Developer - or a Contributor (the Initial Developer or Contributor against whom - You file such action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly - infringes any patent, then any and all rights granted by such - Participant to You under Sections 2.1 and/or 2.2 of this License - shall, upon 60 days notice from Participant terminate prospectively, - unless if within 60 days after receipt of notice You either: (i) - agree in writing to pay Participant a mutually agreeable reasonable - royalty for Your past and future use of Modifications made by such - Participant, or (ii) withdraw Your litigation claim with respect to - the Contributor Version against such Participant. If within 60 days - of notice, a reasonable royalty and payment arrangement are not - mutually agreed upon in writing by the parties or the litigation claim - is not withdrawn, the rights granted by Participant to You under - Sections 2.1 and/or 2.2 automatically terminate at the expiration of - the 60 day notice period specified above. - - (b) any software, hardware, or device, other than such Participant's - Contributor Version, directly or indirectly infringes any patent, then - any rights granted to You by such Participant under Sections 2.1(b) - and 2.2(b) are revoked effective as of the date You first made, used, - sold, distributed, or had made, Modifications made by that - Participant. - - 8.3. If You assert a patent infringement claim against Participant - alleging that such Participant's Contributor Version directly or - indirectly infringes any patent where such claim is resolved (such as - by license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, - all end user license agreements (excluding distributors and resellers) - which have been validly granted by You or any distributor hereunder - prior to termination shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL - DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, - OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR - ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY - CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, - WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY - RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW - PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE - EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO - THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in - 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" and "commercial computer software documentation," as such - terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 - C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), - all U.S. Government End Users acquire Covered Code with only those - rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - California law provisions (except to the extent applicable law, if - any, provides otherwise), excluding its conflict-of-law provisions. - With respect to disputes in which at least one party is a citizen of, - or an entity chartered or registered to do business in the United - States of America, any litigation relating to this License shall be - subject to the jurisdiction of the Federal Courts of the Northern - District of California, with venue lying in Santa Clara County, - California, with the losing party responsible for costs, including - without limitation, court costs and reasonable attorneys' fees and - expenses. The application of the United Nations Convention on - Contracts for the International Sale of Goods is expressly excluded. - Any law or regulation which provides that the language of a contract - shall be construed against the drafter shall not apply to this - License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as - "Multiple-Licensed". "Multiple-Licensed" means that the Initial - Developer permits you to utilize portions of the Covered Code under - Your choice of the NPL or the alternative licenses, if any, specified - by the Initial Developer in the file described in Exhibit A. - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. - Portions created by ______________________ are Copyright (C) ______ - _______________________. All Rights Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms - of the _____ license (the "[___] License"), in which case the - provisions of [______] License are applicable instead of those - above. If you wish to allow use of your version of this file only - under the terms of the [____] License and not to allow others to use - your version of this file under the MPL, indicate your decision by - deleting the provisions above and replace them with the notice and - other provisions required by the [___] License. If you do not delete - the provisions above, a recipient may use your version of this file - under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of - the notices in the Source Code files of the Original Code. You should - use the text of this Exhibit A rather than the text found in the - Original Code Source Code for Your Modifications.] - - ---------------------------------------------------------------------- - - AMENDMENTS - - The Netscape Public License Version 1.1 ("NPL") consists of the - Mozilla Public License Version 1.1 with the following Amendments, - including Exhibit A-Netscape Public License. Files identified with - "Exhibit A-Netscape Public License" are governed by the Netscape - Public License Version 1.1. - - Additional Terms applicable to the Netscape Public License. - I. Effect. - These additional terms described in this Netscape Public - License -- Amendments shall apply to the Mozilla Communicator - client code and to all Covered Code under this License. - - II. "Netscape's Branded Code" means Covered Code that Netscape - distributes and/or permits others to distribute under one or more - trademark(s) which are controlled by Netscape but which are not - licensed for use under this License. - - III. Netscape and logo. - This License does not grant any rights to use the trademarks - "Netscape", the "Netscape N and horizon" logo or the "Netscape - lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript", - "Smart Browsing" even if such marks are included in the Original - Code or Modifications. - - IV. Inability to Comply Due to Contractual Obligation. - Prior to licensing the Original Code under this License, Netscape - has licensed third party code for use in Netscape's Branded Code. - To the extent that Netscape is limited contractually from making - such third party code available under this License, Netscape may - choose to reintegrate such code into Covered Code without being - required to distribute such code in Source Code form, even if - such code would otherwise be considered "Modifications" under - this License. - - V. Use of Modifications and Covered Code by Initial Developer. - V.1. In General. - The obligations of Section 3 apply to Netscape, except to - the extent specified in this Amendment, Section V.2 and V.3. - - V.2. Other Products. - Netscape may include Covered Code in products other than the - Netscape's Branded Code which are released by Netscape - during the two (2) years following the release date of the - Original Code, without such additional products becoming - subject to the terms of this License, and may license such - additional products on different terms from those contained - in this License. - - V.3. Alternative Licensing. - Netscape may license the Source Code of Netscape's Branded - Code, including Modifications incorporated therein, without - such Netscape Branded Code becoming subject to the terms of - this License, and may license such Netscape Branded Code on - different terms from those contained in this License. - - VI. Litigation. - Notwithstanding the limitations of Section 11 above, the - provisions regarding litigation in Section 11(a), (b) and (c) of - the License shall apply to all disputes relating to this License. - - EXHIBIT A-Netscape Public License. - - "The contents of this file are subject to the Netscape Public - 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.mozilla.org/NPL/ - - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. - - The Original Code is Mozilla Communicator client code, released - March 31, 1998. - - The Initial Developer of the Original Code is Netscape - Communications Corporation. Portions created by Netscape are - Copyright (C) 1998-1999 Netscape Communications Corporation. All - Rights Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the - terms of the _____ license (the "[___] License"), in which case - the provisions of [______] License are applicable instead of - those above. If you wish to allow use of your version of this - file only under the terms of the [____] License and not to allow - others to use your version of this file under the NPL, indicate - your decision by deleting the provisions above and replace them - with the notice and other provisions required by the [___] - License. If you do not delete the provisions above, a recipient - may use your version of this file under either the NPL or the - [___] License." diff --git a/external/np_sdk/inc/npapi.h b/external/np_sdk/inc/npapi.h deleted file mode 100644 index d6b1c5986bdf..000000000000 --- a/external/np_sdk/inc/npapi.h +++ /dev/null @@ -1,879 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef npapi_h_ -#define npapi_h_ - -#if defined(__OS2__) -#pragma pack(1) -#endif - -#include "nptypes.h" - -#if defined(__OS2__) || defined(OS2) -#ifndef XP_OS2 -#define XP_OS2 1 -#endif -#endif - -#if defined(_WIN32) && !defined(__SYMBIAN32__) -#include -#ifndef XP_WIN -#define XP_WIN 1 -#endif -#endif - -#if defined(__SYMBIAN32__) -#ifndef XP_SYMBIAN -#define XP_SYMBIAN 1 -#undef XP_WIN -#endif -#endif - -#if defined(__APPLE_CC__) && !defined(XP_UNIX) -#ifndef XP_MACOSX -#define XP_MACOSX 1 -#endif -#endif - -#if defined(XP_MACOSX) && defined(__LP64__) -#define NP_NO_QUICKDRAW -#define NP_NO_CARBON -#endif - -#if defined(XP_MACOSX) -#include -#include -#ifndef NP_NO_CARBON -#include -#endif -#endif - -#if defined(XP_UNIX) -#include -#if defined(MOZ_X11) -#include -#include -#endif -#endif - -#if defined(XP_SYMBIAN) -#include -#include -#endif - -/*----------------------------------------------------------------------*/ -/* Plugin Version Constants */ -/*----------------------------------------------------------------------*/ - -#define NP_VERSION_MAJOR 0 -#define NP_VERSION_MINOR 27 - - -/* The OS/2 version of Netscape uses RC_DATA to define the - mime types, file extensions, etc that are required. - Use a vertical bar to separate types, end types with \0. - FileVersion and ProductVersion are 32bit ints, all other - entries are strings that MUST be terminated with a \0. - -AN EXAMPLE: - -RCDATA NP_INFO_ProductVersion { 1,0,0,1,} - -RCDATA NP_INFO_MIMEType { "video/x-video|", - "video/x-flick\0" } -RCDATA NP_INFO_FileExtents { "avi|", - "flc\0" } -RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|", - "MMOS2 Flc/Fli player(*.flc)\0" } - -RCDATA NP_INFO_FileVersion { 1,0,0,1 } -RCDATA NP_INFO_CompanyName { "Netscape Communications\0" } -RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0" -RCDATA NP_INFO_InternalName { "NPAVI32\0" ) -RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0" -RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" } -RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" } -*/ -/* RC_DATA types for version info - required */ -#define NP_INFO_ProductVersion 1 -#define NP_INFO_MIMEType 2 -#define NP_INFO_FileOpenName 3 -#define NP_INFO_FileExtents 4 -/* RC_DATA types for version info - used if found */ -#define NP_INFO_FileDescription 5 -#define NP_INFO_ProductName 6 -/* RC_DATA types for version info - optional */ -#define NP_INFO_CompanyName 7 -#define NP_INFO_FileVersion 8 -#define NP_INFO_InternalName 9 -#define NP_INFO_LegalCopyright 10 -#define NP_INFO_OriginalFilename 11 - -#ifndef RC_INVOKED - -/*----------------------------------------------------------------------*/ -/* Definition of Basic Types */ -/*----------------------------------------------------------------------*/ - -typedef unsigned char NPBool; -typedef int16_t NPError; -typedef int16_t NPReason; -typedef char* NPMIMEType; - -/*----------------------------------------------------------------------*/ -/* Structures and definitions */ -/*----------------------------------------------------------------------*/ - -#if !defined(__LP64__) -#if defined(XP_MACOSX) -#pragma options align=mac68k -#endif -#endif /* __LP64__ */ - -/* - * NPP is a plug-in's opaque instance handle - */ -typedef struct _NPP -{ - void* pdata; /* plug-in private data */ - void* ndata; /* netscape private data */ -} NPP_t; - -typedef NPP_t* NPP; - -typedef struct _NPStream -{ - void* pdata; /* plug-in private data */ - void* ndata; /* netscape private data */ - const char* url; - uint32_t end; - uint32_t lastmodified; - void* notifyData; - const char* headers; /* Response headers from host. - * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS. - * Used for HTTP only; NULL for non-HTTP. - * Available from NPP_NewStream onwards. - * Plugin should copy this data before storing it. - * Includes HTTP status line and all headers, - * preferably verbatim as received from server, - * headers formatted as in HTTP ("Header: Value"), - * and newlines (\n, NOT \r\n) separating lines. - * Terminated by \n\0 (NOT \n\n\0). */ -} NPStream; - -typedef struct _NPByteRange -{ - int32_t offset; /* negative offset means from the end */ - uint32_t length; - struct _NPByteRange* next; -} NPByteRange; - -typedef struct _NPSavedData -{ - int32_t len; - void* buf; -} NPSavedData; - -typedef struct _NPRect -{ - uint16_t top; - uint16_t left; - uint16_t bottom; - uint16_t right; -} NPRect; - -typedef struct _NPSize -{ - int32_t width; - int32_t height; -} NPSize; - -typedef enum { - NPFocusNext = 0, - NPFocusPrevious = 1 -} NPFocusDirection; - -/* Return values for NPP_HandleEvent */ -#define kNPEventNotHandled 0 -#define kNPEventHandled 1 -/* Exact meaning must be spec'd in event model. */ -#define kNPEventStartIME 2 - -#if defined(XP_UNIX) -/* - * Unix specific structures and definitions - */ - -/* - * Callback Structures. - * - * These are used to pass additional platform specific information. - */ -enum { - NP_SETWINDOW = 1, - NP_PRINT -}; - -typedef struct -{ - int32_t type; -} NPAnyCallbackStruct; - -typedef struct -{ - int32_t type; -#if defined(MOZ_X11) - Display* display; - Visual* visual; - Colormap colormap; - unsigned int depth; -#endif -} NPSetWindowCallbackStruct; - -typedef struct -{ - int32_t type; - FILE* fp; -} NPPrintCallbackStruct; - -#endif /* XP_UNIX */ - -#if defined(XP_MACOSX) -typedef enum { -#ifndef NP_NO_QUICKDRAW - NPDrawingModelQuickDraw = 0, -#endif - NPDrawingModelCoreGraphics = 1, - NPDrawingModelOpenGL = 2, - NPDrawingModelCoreAnimation = 3, - NPDrawingModelInvalidatingCoreAnimation = 4 -} NPDrawingModel; - -typedef enum { -#ifndef NP_NO_CARBON - NPEventModelCarbon = 0, -#endif - NPEventModelCocoa = 1 -} NPEventModel; -#endif - -/* - * The following masks are applied on certain platforms to NPNV and - * NPPV selectors that pass around pointers to COM interfaces. Newer - * compilers on some platforms may generate vtables that are not - * compatible with older compilers. To prevent older plugins from - * not understanding a new browser's ABI, these masks change the - * values of those selectors on those platforms. To remain backwards - * compatible with different versions of the browser, plugins can - * use these masks to dynamically determine and use the correct C++ - * ABI that the browser is expecting. This does not apply to Windows - * as Microsoft's COM ABI will likely not change. - */ - -#define NP_ABI_GCC3_MASK 0x10000000 -/* - * gcc 3.x generated vtables on UNIX and OSX are incompatible with - * previous compilers. - */ -#if defined(XP_UNIX) && defined(__GNUC__) -#define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK -#else -#define _NP_ABI_MIXIN_FOR_GCC3 0 -#endif - -#if defined(XP_MACOSX) -#define NP_ABI_MACHO_MASK 0x01000000 -#define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK -#else -#define _NP_ABI_MIXIN_FOR_MACHO 0 -#endif - -#define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO) - -/* - * List of variable names for which NPP_GetValue shall be implemented - */ -typedef enum { - NPPVpluginNameString = 1, - NPPVpluginDescriptionString, - NPPVpluginWindowBool, - NPPVpluginTransparentBool, - NPPVjavaClass, - NPPVpluginWindowSize, - NPPVpluginTimerInterval, - NPPVpluginScriptableInstance = (10 | NP_ABI_MASK), - NPPVpluginScriptableIID = 11, - NPPVjavascriptPushCallerBool = 12, - NPPVpluginKeepLibraryInMemory = 13, - NPPVpluginNeedsXEmbed = 14, - - /* Get the NPObject for scripting the plugin. Introduced in NPAPI minor version 14. - */ - NPPVpluginScriptableNPObject = 15, - - /* Get the plugin value (as \0-terminated UTF-8 string data) for - * form submission if the plugin is part of a form. Use - * NPN_MemAlloc() to allocate memory for the string data. Introduced - * in NPAPI minor version 15. - */ - NPPVformValue = 16, - - NPPVpluginUrlRequestsDisplayedBool = 17, - - /* Checks if the plugin is interested in receiving the http body of - * all http requests (including failed ones, http status != 200). - */ - NPPVpluginWantsAllNetworkStreams = 18, - - /* Browsers can retrieve a native ATK accessibility plug ID via this variable. */ - NPPVpluginNativeAccessibleAtkPlugId = 19, - - /* Checks to see if the plug-in would like the browser to load the "src" attribute. */ - NPPVpluginCancelSrcStream = 20, - - NPPVSupportsAdvancedKeyHandling = 21 - -#if defined(XP_MACOSX) - /* Used for negotiating drawing models */ - , NPPVpluginDrawingModel = 1000 - /* Used for negotiating event models */ - , NPPVpluginEventModel = 1001 - /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */ - , NPPVpluginCoreAnimationLayer = 1003 -#endif - -#if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)) - , NPPVpluginWindowlessLocalBool = 2002 -#endif -} NPPVariable; - -/* - * List of variable names for which NPN_GetValue should be implemented. - */ -typedef enum { - NPNVxDisplay = 1, - NPNVxtAppContext, - NPNVnetscapeWindow, - NPNVjavascriptEnabledBool, - NPNVasdEnabledBool, - NPNVisOfflineBool, - - NPNVserviceManager = (10 | NP_ABI_MASK), - NPNVDOMElement = (11 | NP_ABI_MASK), - NPNVDOMWindow = (12 | NP_ABI_MASK), - NPNVToolkit = (13 | NP_ABI_MASK), - NPNVSupportsXEmbedBool = 14, - - /* Get the NPObject wrapper for the browser window. */ - NPNVWindowNPObject = 15, - - /* Get the NPObject wrapper for the plugins DOM element. */ - NPNVPluginElementNPObject = 16, - - NPNVSupportsWindowless = 17, - - NPNVprivateModeBool = 18, - - NPNVsupportsAdvancedKeyHandling = 21 - -#if defined(XP_MACOSX) - /* Used for negotiating drawing models */ - , NPNVpluginDrawingModel = 1000 -#ifndef NP_NO_QUICKDRAW - , NPNVsupportsQuickDrawBool = 2000 -#endif - , NPNVsupportsCoreGraphicsBool = 2001 - , NPNVsupportsOpenGLBool = 2002 - , NPNVsupportsCoreAnimationBool = 2003 - , NPNVsupportsInvalidatingCoreAnimationBool = 2004 -#ifndef NP_NO_CARBON - , NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */ -#endif - , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */ - , NPNVsupportsUpdatedCocoaTextInputBool = 3002 /* TRUE if the browser supports the updated - Cocoa text input specification. */ -#endif -#if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)) - , NPNVSupportsWindowlessLocal = 2002 -#endif -} NPNVariable; - -typedef enum { - NPNURLVCookie = 501, - NPNURLVProxy -} NPNURLVariable; - -/* - * The type of Toolkit the widgets use - */ -typedef enum { - NPNVGtk12 = 1, - NPNVGtk2 -} NPNToolkitType; - -/* - * The type of a NPWindow - it specifies the type of the data structure - * returned in the window field. - */ -typedef enum { - NPWindowTypeWindow = 1, - NPWindowTypeDrawable -} NPWindowType; - -typedef struct _NPWindow -{ - void* window; /* Platform specific window handle */ - /* OS/2: x - Position of bottom left corner */ - /* OS/2: y - relative to visible netscape window */ - int32_t x; /* Position of top left corner relative */ - int32_t y; /* to a netscape page. */ - uint32_t width; /* Maximum window size */ - uint32_t height; - NPRect clipRect; /* Clipping rectangle in port coordinates */ -#if (defined(XP_UNIX) || defined(XP_SYMBIAN)) && !defined(XP_MACOSX) - void * ws_info; /* Platform-dependent additional data */ -#endif /* XP_UNIX */ - NPWindowType type; /* Is this a window or a drawable? */ -} NPWindow; - -typedef struct _NPImageExpose -{ - char* data; /* image pointer */ - int32_t stride; /* Stride of data image pointer */ - int32_t depth; /* Depth of image pointer */ - int32_t x; /* Expose x */ - int32_t y; /* Expose y */ - uint32_t width; /* Expose width */ - uint32_t height; /* Expose height */ - NPSize dataSize; /* Data buffer size */ - float translateX; /* translate X matrix value */ - float translateY; /* translate Y matrix value */ - float scaleX; /* scale X matrix value */ - float scaleY; /* scale Y matrix value */ -} NPImageExpose; - -typedef struct _NPFullPrint -{ - NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */ - NPBool printOne; /* TRUE if plugin should print one copy to default - printer */ - void* platformPrint; /* Platform-specific printing info */ -} NPFullPrint; - -typedef struct _NPEmbedPrint -{ - NPWindow window; - void* platformPrint; /* Platform-specific printing info */ -} NPEmbedPrint; - -typedef struct _NPPrint -{ - uint16_t mode; /* NP_FULL or NP_EMBED */ - union - { - NPFullPrint fullPrint; /* if mode is NP_FULL */ - NPEmbedPrint embedPrint; /* if mode is NP_EMBED */ - } print; -} NPPrint; - -#if defined(XP_MACOSX) -#ifndef NP_NO_CARBON -typedef EventRecord NPEvent; -#endif -#elif defined(XP_SYMBIAN) -typedef QEvent NPEvent; -#elif defined(XP_WIN) -typedef struct _NPEvent -{ - uint16_t event; - uintptr_t wParam; - uintptr_t lParam; -} NPEvent; -#elif defined(XP_OS2) -typedef struct _NPEvent -{ - uint32_t event; - uint32_t wParam; - uint32_t lParam; -} NPEvent; -#elif defined(XP_UNIX) && defined(MOZ_X11) -typedef XEvent NPEvent; -#else -typedef void* NPEvent; -#endif - -#if defined(XP_MACOSX) -typedef void* NPRegion; -#ifndef NP_NO_QUICKDRAW -typedef RgnHandle NPQDRegion; -#endif -typedef CGPathRef NPCGRegion; -#elif defined(XP_WIN) -typedef HRGN NPRegion; -#elif defined(XP_UNIX) && defined(MOZ_X11) -typedef Region NPRegion; -#elif defined(XP_SYMBIAN) -typedef QRegion* NPRegion; -#else -typedef void *NPRegion; -#endif - -typedef struct _NPNSString NPNSString; -typedef struct _NPNSWindow NPNSWindow; -typedef struct _NPNSMenu NPNSMenu; - -#if defined(XP_MACOSX) -typedef NPNSMenu NPMenu; -#else -typedef void *NPMenu; -#endif - -typedef enum { - NPCoordinateSpacePlugin = 1, - NPCoordinateSpaceWindow, - NPCoordinateSpaceFlippedWindow, - NPCoordinateSpaceScreen, - NPCoordinateSpaceFlippedScreen -} NPCoordinateSpace; - -#if defined(XP_MACOSX) - -#ifndef NP_NO_QUICKDRAW -typedef struct NP_Port -{ - CGrafPtr port; - int32_t portx; /* position inside the topmost window */ - int32_t porty; -} NP_Port; -#endif /* NP_NO_QUICKDRAW */ - -/* - * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics - * as its drawing model. - */ - -typedef struct NP_CGContext -{ - CGContextRef context; - void *window; /* A WindowRef under the Carbon event model. */ -} NP_CGContext; - -/* - * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its - * drawing model. - */ - -typedef struct NP_GLContext -{ - CGLContextObj context; -#ifdef NP_NO_CARBON - NPNSWindow *window; -#else - void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */ -#endif -} NP_GLContext; - -typedef enum { - NPCocoaEventDrawRect = 1, - NPCocoaEventMouseDown, - NPCocoaEventMouseUp, - NPCocoaEventMouseMoved, - NPCocoaEventMouseEntered, - NPCocoaEventMouseExited, - NPCocoaEventMouseDragged, - NPCocoaEventKeyDown, - NPCocoaEventKeyUp, - NPCocoaEventFlagsChanged, - NPCocoaEventFocusChanged, - NPCocoaEventWindowFocusChanged, - NPCocoaEventScrollWheel, - NPCocoaEventTextInput -} NPCocoaEventType; - -typedef struct _NPCocoaEvent { - NPCocoaEventType type; - uint32_t version; - union { - struct { - uint32_t modifierFlags; - double pluginX; - double pluginY; - int32_t buttonNumber; - int32_t clickCount; - double deltaX; - double deltaY; - double deltaZ; - } mouse; - struct { - uint32_t modifierFlags; - NPNSString *characters; - NPNSString *charactersIgnoringModifiers; - NPBool isARepeat; - uint16_t keyCode; - } key; - struct { - CGContextRef context; - double x; - double y; - double width; - double height; - } draw; - struct { - NPBool hasFocus; - } focus; - struct { - NPNSString *text; - } text; - } data; -} NPCocoaEvent; - -#ifndef NP_NO_CARBON -/* Non-standard event types that can be passed to HandleEvent */ -enum NPEventType { - NPEventType_GetFocusEvent = (osEvt + 16), - NPEventType_LoseFocusEvent, - NPEventType_AdjustCursorEvent, - NPEventType_MenuCommandEvent, - NPEventType_ClippingChangedEvent, - NPEventType_ScrollingBeginsEvent = 1000, - NPEventType_ScrollingEndsEvent -}; -#endif /* NP_NO_CARBON */ - -#endif /* XP_MACOSX */ - -/* - * Values for mode passed to NPP_New: - */ -#define NP_EMBED 1 -#define NP_FULL 2 - -/* - * Values for stream type passed to NPP_NewStream: - */ -#define NP_NORMAL 1 -#define NP_SEEK 2 -#define NP_ASFILE 3 -#define NP_ASFILEONLY 4 - -#define NP_MAXREADY (((unsigned)(~0)<<1)>>1) - -/* - * Flags for NPP_ClearSiteData. - */ -#define NP_CLEAR_ALL 0 -#define NP_CLEAR_CACHE (1 << 0) - -#if !defined(__LP64__) -#if defined(XP_MACOSX) -#pragma options align=reset -#endif -#endif /* __LP64__ */ - -/*----------------------------------------------------------------------*/ -/* Error and Reason Code definitions */ -/*----------------------------------------------------------------------*/ - -/* - * Values of type NPError: - */ -#define NPERR_BASE 0 -#define NPERR_NO_ERROR (NPERR_BASE + 0) -#define NPERR_GENERIC_ERROR (NPERR_BASE + 1) -#define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2) -#define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3) -#define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4) -#define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5) -#define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6) -#define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7) -#define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8) -#define NPERR_INVALID_PARAM (NPERR_BASE + 9) -#define NPERR_INVALID_URL (NPERR_BASE + 10) -#define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11) -#define NPERR_NO_DATA (NPERR_BASE + 12) -#define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13) -#define NPERR_TIME_RANGE_NOT_SUPPORTED (NPERR_BASE + 14) -#define NPERR_MALFORMED_SITE (NPERR_BASE + 15) - -/* - * Values of type NPReason: - */ -#define NPRES_BASE 0 -#define NPRES_DONE (NPRES_BASE + 0) -#define NPRES_NETWORK_ERR (NPRES_BASE + 1) -#define NPRES_USER_BREAK (NPRES_BASE + 2) - -/* - * Version feature information - */ -#define NPVERS_HAS_STREAMOUTPUT 8 -#define NPVERS_HAS_NOTIFICATION 9 -#define NPVERS_HAS_LIVECONNECT 9 -#define NPVERS_68K_HAS_LIVECONNECT 11 -#define NPVERS_HAS_WINDOWLESS 11 -#define NPVERS_HAS_XPCONNECT_SCRIPTING 13 -#define NPVERS_HAS_NPRUNTIME_SCRIPTING 14 -#define NPVERS_HAS_FORM_VALUES 15 -#define NPVERS_HAS_POPUPS_ENABLED_STATE 16 -#define NPVERS_HAS_RESPONSE_HEADERS 17 -#define NPVERS_HAS_NPOBJECT_ENUM 18 -#define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19 -#define NPVERS_HAS_ALL_NETWORK_STREAMS 20 -#define NPVERS_HAS_URL_AND_AUTH_INFO 21 -#define NPVERS_HAS_PRIVATE_MODE 22 -#define NPVERS_MACOSX_HAS_COCOA_EVENTS 23 -#define NPVERS_HAS_ADVANCED_KEY_HANDLING 25 -#define NPVERS_HAS_URL_REDIRECT_HANDLING 26 -#define NPVERS_HAS_CLEAR_SITE_DATA 27 - -/*----------------------------------------------------------------------*/ -/* Function Prototypes */ -/*----------------------------------------------------------------------*/ - -#if defined(__OS2__) -#define NP_LOADDS _System -#else -#define NP_LOADDS -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* NPP_* functions are provided by the plugin and called by the navigator. */ - -const char* NPP_GetMIMEDescription(void); -NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, - uint16_t mode, int16_t argc, char* argn[], - char* argv[], NPSavedData* saved); -NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save); -NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window); -NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type, - NPStream* stream, NPBool seekable, - uint16_t* stype); -NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream, - NPReason reason); -int32_t NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream); -int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset, - int32_t len, void* buffer); -void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, - const char* fname); -void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint); -int16_t NP_LOADDS NPP_HandleEvent(NPP instance, void* event); -void NP_LOADDS NPP_URLNotify(NPP instance, const char* url, - NPReason reason, void* notifyData); -NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value); -NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value); -NPBool NP_LOADDS NPP_GotFocus(NPP instance, NPFocusDirection direction); -void NP_LOADDS NPP_LostFocus(NPP instance); -void NP_LOADDS NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData); -NPError NP_LOADDS NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge); -char** NP_LOADDS NPP_GetSitesWithData(void); - -/* NPN_* functions are provided by the navigator and called by the plugin. */ -void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor, - int* netscape_major, int* netscape_minor); -NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url, - const char* target, void* notifyData); -NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url, - const char* target); -NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url, - const char* target, uint32_t len, - const char* buf, NPBool file, - void* notifyData); -NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url, - const char* target, uint32_t len, - const char* buf, NPBool file); -NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); -NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type, - const char* target, NPStream** stream); -int32_t NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t len, - void* buffer); -NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream, - NPReason reason); -void NP_LOADDS NPN_Status(NPP instance, const char* message); -const char* NP_LOADDS NPN_UserAgent(NPP instance); -void* NP_LOADDS NPN_MemAlloc(uint32_t size); -void NP_LOADDS NPN_MemFree(void* ptr); -uint32_t NP_LOADDS NPN_MemFlush(uint32_t size); -void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages); -NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable, - void *value); -NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable, - void *value); -void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect); -void NP_LOADDS NPN_InvalidateRegion(NPP instance, - NPRegion invalidRegion); -void NP_LOADDS NPN_ForceRedraw(NPP instance); -void NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled); -void NP_LOADDS NPN_PopPopupsEnabledState(NPP instance); -void NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance, - void (*func) (void *), - void *userData); -NPError NP_LOADDS NPN_GetValueForURL(NPP instance, NPNURLVariable variable, - const char *url, char **value, - uint32_t *len); -NPError NP_LOADDS NPN_SetValueForURL(NPP instance, NPNURLVariable variable, - const char *url, const char *value, - uint32_t len); -NPError NP_LOADDS NPN_GetAuthenticationInfo(NPP instance, - const char *protocol, - const char *host, int32_t port, - const char *scheme, - const char *realm, - char **username, uint32_t *ulen, - char **password, - uint32_t *plen); -uint32_t NP_LOADDS NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); -void NP_LOADDS NPN_UnscheduleTimer(NPP instance, uint32_t timerID); -NPError NP_LOADDS NPN_PopUpContextMenu(NPP instance, NPMenu* menu); -NPBool NP_LOADDS NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); -NPBool NP_LOADDS NPN_HandleEvent(NPP instance, void *event, NPBool handled); -NPBool NP_LOADDS NPN_UnfocusInstance(NPP instance, NPFocusDirection direction); -void NP_LOADDS NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow); - -#ifdef __cplusplus -} /* end extern "C" */ -#endif - -#endif /* RC_INVOKED */ -#if defined(__OS2__) -#pragma pack() -#endif - -#endif /* npapi_h_ */ diff --git a/external/np_sdk/inc/npfunctions.h b/external/np_sdk/inc/npfunctions.h deleted file mode 100644 index 0d3a66271bf6..000000000000 --- a/external/np_sdk/inc/npfunctions.h +++ /dev/null @@ -1,321 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef npfunctions_h_ -#define npfunctions_h_ - -#ifdef __OS2__ -#pragma pack(1) -#define NP_LOADDS _System -#else -#define NP_LOADDS -#endif - -#include "npapi.h" -#include "npruntime.h" - -typedef NPError (* NP_LOADDS NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); -typedef NPError (* NP_LOADDS NPP_DestroyProcPtr)(NPP instance, NPSavedData** save); -typedef NPError (* NP_LOADDS NPP_SetWindowProcPtr)(NPP instance, NPWindow* window); -typedef NPError (* NP_LOADDS NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype); -typedef NPError (* NP_LOADDS NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason); -typedef int32_t (* NP_LOADDS NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream); -typedef int32_t (* NP_LOADDS NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer); -typedef void (* NP_LOADDS NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname); -typedef void (* NP_LOADDS NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint); -typedef int16_t (* NP_LOADDS NPP_HandleEventProcPtr)(NPP instance, void* event); -typedef void (* NP_LOADDS NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData); -/* Any NPObjects returned to the browser via NPP_GetValue should be retained - by the plugin on the way out. The browser is responsible for releasing. */ -typedef NPError (* NP_LOADDS NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value); -typedef NPError (* NP_LOADDS NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value); -typedef NPBool (* NP_LOADDS NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction); -typedef void (* NP_LOADDS NPP_LostFocusPtr)(NPP instance); -typedef void (* NP_LOADDS NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData); -typedef NPError (* NP_LOADDS NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge); -typedef char** (* NP_LOADDS NPP_GetSitesWithDataPtr)(void); - -typedef NPError (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value); -typedef NPError (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value); -typedef NPError (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* url, const char* window, void* notifyData); -typedef NPError (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData); -typedef NPError (*NPN_GetURLProcPtr)(NPP instance, const char* url, const char* window); -typedef NPError (*NPN_PostURLProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file); -typedef NPError (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList); -typedef NPError (*NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, const char* window, NPStream** stream); -typedef int32_t (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t len, void* buffer); -typedef NPError (*NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason); -typedef void (*NPN_StatusProcPtr)(NPP instance, const char* message); -/* Browser manages the lifetime of the buffer returned by NPN_UserAgent, don't - depend on it sticking around and don't free it. */ -typedef const char* (*NPN_UserAgentProcPtr)(NPP instance); -typedef void* (*NPN_MemAllocProcPtr)(uint32_t size); -typedef void (*NPN_MemFreeProcPtr)(void* ptr); -typedef uint32_t (*NPN_MemFlushProcPtr)(uint32_t size); -typedef void (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages); -typedef void* (*NPN_GetJavaEnvProcPtr)(void); -typedef void* (*NPN_GetJavaPeerProcPtr)(NPP instance); -typedef void (*NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect); -typedef void (*NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion region); -typedef void (*NPN_ForceRedrawProcPtr)(NPP instance); -typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr)(const NPUTF8* name); -typedef void (*NPN_GetStringIdentifiersProcPtr)(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers); -typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr)(int32_t intid); -typedef bool (*NPN_IdentifierIsStringProcPtr)(NPIdentifier identifier); -typedef NPUTF8* (*NPN_UTF8FromIdentifierProcPtr)(NPIdentifier identifier); -typedef int32_t (*NPN_IntFromIdentifierProcPtr)(NPIdentifier identifier); -typedef NPObject* (*NPN_CreateObjectProcPtr)(NPP npp, NPClass *aClass); -typedef NPObject* (*NPN_RetainObjectProcPtr)(NPObject *obj); -typedef void (*NPN_ReleaseObjectProcPtr)(NPObject *obj); -typedef bool (*NPN_InvokeProcPtr)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result); -typedef bool (*NPN_InvokeDefaultProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result); -typedef bool (*NPN_EvaluateProcPtr)(NPP npp, NPObject *obj, NPString *script, NPVariant *result); -typedef bool (*NPN_GetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result); -typedef bool (*NPN_SetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value); -typedef bool (*NPN_RemovePropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName); -typedef bool (*NPN_HasPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName); -typedef bool (*NPN_HasMethodProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName); -typedef void (*NPN_ReleaseVariantValueProcPtr)(NPVariant *variant); -typedef void (*NPN_SetExceptionProcPtr)(NPObject *obj, const NPUTF8 *message); -typedef void (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enabled); -typedef void (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp); -typedef bool (*NPN_EnumerateProcPtr)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count); -typedef void (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance, void (*func)(void *), void *userData); -typedef bool (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result); -typedef NPError (*NPN_GetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, char **value, uint32_t *len); -typedef NPError (*NPN_SetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, const char *value, uint32_t len); -typedef NPError (*NPN_GetAuthenticationInfoPtr)(NPP npp, const char *protocol, const char *host, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, uint32_t *plen); -typedef uint32_t (*NPN_ScheduleTimerPtr)(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); -typedef void (*NPN_UnscheduleTimerPtr)(NPP instance, uint32_t timerID); -typedef NPError (*NPN_PopUpContextMenuPtr)(NPP instance, NPMenu* menu); -typedef NPBool (*NPN_ConvertPointPtr)(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); -typedef NPBool (*NPN_HandleEventPtr)(NPP instance, void *event, NPBool handled); -typedef NPBool (*NPN_UnfocusInstancePtr)(NPP instance, NPFocusDirection direction); -typedef void (*NPN_URLRedirectResponsePtr)(NPP instance, void* notifyData, NPBool allow); - -typedef struct _NPPluginFuncs { - uint16_t size; - uint16_t version; - NPP_NewProcPtr newp; - NPP_DestroyProcPtr destroy; - NPP_SetWindowProcPtr setwindow; - NPP_NewStreamProcPtr newstream; - NPP_DestroyStreamProcPtr destroystream; - NPP_StreamAsFileProcPtr asfile; - NPP_WriteReadyProcPtr writeready; - NPP_WriteProcPtr write; - NPP_PrintProcPtr print; - NPP_HandleEventProcPtr event; - NPP_URLNotifyProcPtr urlnotify; - void* javaClass; - NPP_GetValueProcPtr getvalue; - NPP_SetValueProcPtr setvalue; - NPP_GotFocusPtr gotfocus; - NPP_LostFocusPtr lostfocus; - NPP_URLRedirectNotifyPtr urlredirectnotify; - NPP_ClearSiteDataPtr clearsitedata; - NPP_GetSitesWithDataPtr getsiteswithdata; -} NPPluginFuncs; - -typedef struct _NPNetscapeFuncs { - uint16_t size; - uint16_t version; - NPN_GetURLProcPtr geturl; - NPN_PostURLProcPtr posturl; - NPN_RequestReadProcPtr requestread; - NPN_NewStreamProcPtr newstream; - NPN_WriteProcPtr write; - NPN_DestroyStreamProcPtr destroystream; - NPN_StatusProcPtr status; - NPN_UserAgentProcPtr uagent; - NPN_MemAllocProcPtr memalloc; - NPN_MemFreeProcPtr memfree; - NPN_MemFlushProcPtr memflush; - NPN_ReloadPluginsProcPtr reloadplugins; - NPN_GetJavaEnvProcPtr getJavaEnv; - NPN_GetJavaPeerProcPtr getJavaPeer; - NPN_GetURLNotifyProcPtr geturlnotify; - NPN_PostURLNotifyProcPtr posturlnotify; - NPN_GetValueProcPtr getvalue; - NPN_SetValueProcPtr setvalue; - NPN_InvalidateRectProcPtr invalidaterect; - NPN_InvalidateRegionProcPtr invalidateregion; - NPN_ForceRedrawProcPtr forceredraw; - NPN_GetStringIdentifierProcPtr getstringidentifier; - NPN_GetStringIdentifiersProcPtr getstringidentifiers; - NPN_GetIntIdentifierProcPtr getintidentifier; - NPN_IdentifierIsStringProcPtr identifierisstring; - NPN_UTF8FromIdentifierProcPtr utf8fromidentifier; - NPN_IntFromIdentifierProcPtr intfromidentifier; - NPN_CreateObjectProcPtr createobject; - NPN_RetainObjectProcPtr retainobject; - NPN_ReleaseObjectProcPtr releaseobject; - NPN_InvokeProcPtr invoke; - NPN_InvokeDefaultProcPtr invokeDefault; - NPN_EvaluateProcPtr evaluate; - NPN_GetPropertyProcPtr getproperty; - NPN_SetPropertyProcPtr setproperty; - NPN_RemovePropertyProcPtr removeproperty; - NPN_HasPropertyProcPtr hasproperty; - NPN_HasMethodProcPtr hasmethod; - NPN_ReleaseVariantValueProcPtr releasevariantvalue; - NPN_SetExceptionProcPtr setexception; - NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate; - NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate; - NPN_EnumerateProcPtr enumerate; - NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall; - NPN_ConstructProcPtr construct; - NPN_GetValueForURLPtr getvalueforurl; - NPN_SetValueForURLPtr setvalueforurl; - NPN_GetAuthenticationInfoPtr getauthenticationinfo; - NPN_ScheduleTimerPtr scheduletimer; - NPN_UnscheduleTimerPtr unscheduletimer; - NPN_PopUpContextMenuPtr popupcontextmenu; - NPN_ConvertPointPtr convertpoint; - NPN_HandleEventPtr handleevent; - NPN_UnfocusInstancePtr unfocusinstance; - NPN_URLRedirectResponsePtr urlredirectresponse; -} NPNetscapeFuncs; - -#ifdef XP_MACOSX -/* - * Mac OS X version(s) of NP_GetMIMEDescription(const char *) - * These can be called to retrieve MIME information from the plugin dynamically - * - * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way - * to get mime info from the plugin only on OSX and may not be supported - * in future version -- use NP_GetMIMEDescription instead - */ -enum -{ - kBPSupportedMIMETypesStructVers_1 = 1 -}; -typedef struct _BPSupportedMIMETypes -{ - SInt32 structVersion; /* struct version */ - Handle typeStrings; /* STR# formatted handle, allocated by plug-in */ - Handle infoStrings; /* STR# formatted handle, allocated by plug-in */ -} BPSupportedMIMETypes; -OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags); -#define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription" -typedef const char* (*NP_GetMIMEDescriptionProcPtr)(void); -typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32); -#endif - -#if defined(_WIN32) -#define OSCALL WINAPI -#else -#if defined(__OS2__) -#define OSCALL _System -#else -#define OSCALL -#endif -#endif - -#if defined(XP_UNIX) -#if defined(__GNUC__) -#define NP_VISIBILITY_DEFAULT __attribute__((visibility("default"))) -#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) -#define NP_VISIBILITY_DEFAULT __global -#else -#define NP_VISIBILITY_DEFAULT -#endif -#define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type -#endif - -#if defined(_WIN32) || defined (__OS2__) -#ifdef __cplusplus -extern "C" { -#endif -/* plugin meta member functions */ -#if defined(__OS2__) -typedef struct _NPPluginData { /* Alternate OS2 Plugin interface */ - char *pMimeTypes; - char *pFileExtents; - char *pFileOpenTemplate; - char *pProductName; - char *pProductDescription; - unsigned long dwProductVersionMS; - unsigned long dwProductVersionLS; -} NPPluginData; -typedef NPError (*NP_GetPluginDataFunc)(NPPluginData*); -NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData); -#endif -typedef NPError (*NP_GetEntryPointsFunc)(NPPluginFuncs*); -NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs); -typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*); -NPError OSCALL NP_Initialize(NPNetscapeFuncs* bFuncs); -typedef NPError (*NP_ShutdownFunc)(void); -NPError OSCALL NP_Shutdown(void); -typedef char* (*NP_GetMIMEDescriptionFunc)(void); -char* NP_GetMIMEDescription(void); -#ifdef __cplusplus -} -#endif -#endif - -#if defined(__OS2__) -#pragma pack() -#endif - -#ifdef XP_UNIX -#ifdef __cplusplus -extern "C" { -#endif -typedef char* (*NP_GetPluginVersionFunc)(void); -NP_EXPORT(char*) NP_GetPluginVersion(void); -typedef char* (*NP_GetMIMEDescriptionFunc)(void); -NP_EXPORT(char*) NP_GetMIMEDescription(void); -#ifdef XP_MACOSX -typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*); -NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs); -typedef NPError (*NP_GetEntryPointsFunc)(NPPluginFuncs*); -NP_EXPORT(NPError) NP_GetEntryPoints(NPPluginFuncs* pFuncs); -#else -typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*); -NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs); -#endif -typedef NPError (*NP_ShutdownFunc)(void); -NP_EXPORT(NPError) NP_Shutdown(void); -typedef NPError (*NP_GetValueFunc)(void *, NPPVariable, void *); -NP_EXPORT(NPError) NP_GetValue(void *future, NPPVariable aVariable, void *aValue); -#ifdef __cplusplus -} -#endif -#endif - -#endif /* npfunctions_h_ */ diff --git a/external/np_sdk/inc/npruntime.h b/external/np_sdk/inc/npruntime.h deleted file mode 100644 index 816a4f863965..000000000000 --- a/external/np_sdk/inc/npruntime.h +++ /dev/null @@ -1,393 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Copyright (c) 2004, Apple Computer, Inc. and The Mozilla Foundation. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the names of Apple Computer, Inc. ("Apple") or The Mozilla - * Foundation ("Mozilla") nor the names of their contributors may be used - * to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE, MOZILLA AND THEIR CONTRIBUTORS "AS - * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE, MOZILLA OR - * THEIR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -#ifndef _NP_RUNTIME_H_ -#define _NP_RUNTIME_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "nptypes.h" - -/* - This API is used to facilitate binding code written in C to script - objects. The API in this header does not assume the presence of a - user agent. That is, it can be used to bind C code to scripting - environments outside of the context of a user agent. - - However, the normal use of the this API is in the context of a - scripting environment running in a browser or other user agent. - In particular it is used to support the extended Netscape - script-ability API for plugins (NP-SAP). NP-SAP is an extension - of the Netscape plugin API. As such we have adopted the use of - the "NP" prefix for this API. - - The following NP{N|P}Variables were added to the Netscape plugin - API (in npapi.h): - - NPNVWindowNPObject - NPNVPluginElementNPObject - NPPVpluginScriptableNPObject - - These variables are exposed through NPN_GetValue() and - NPP_GetValue() (respectively) and are used to establish the - initial binding between the user agent and native code. The DOM - objects in the user agent can be examined and manipulated using - the NPN_ functions that operate on NPObjects described in this - header. - - To the extent possible the assumptions about the scripting - language used by the scripting environment have been minimized. -*/ - -#define NP_BEGIN_MACRO do { -#define NP_END_MACRO } while (0) - -/* - Objects (non-primitive data) passed between 'C' and script is - always wrapped in an NPObject. The 'interface' of an NPObject is - described by an NPClass. -*/ -typedef struct NPObject NPObject; -typedef struct NPClass NPClass; - -typedef char NPUTF8; -typedef struct _NPString { - const NPUTF8 *UTF8Characters; - uint32_t UTF8Length; -} NPString; - -typedef enum { - NPVariantType_Void, - NPVariantType_Null, - NPVariantType_Bool, - NPVariantType_Int32, - NPVariantType_Double, - NPVariantType_String, - NPVariantType_Object -} NPVariantType; - -typedef struct _NPVariant { - NPVariantType type; - union { - bool boolValue; - int32_t intValue; - double doubleValue; - NPString stringValue; - NPObject *objectValue; - } value; -} NPVariant; - -/* - NPN_ReleaseVariantValue is called on all 'out' parameters - references. Specifically it is to be called on variants that own - their value, as is the case with all non-const NPVariant* - arguments after a successful call to any methods (except this one) - in this API. - - After calling NPN_ReleaseVariantValue, the type of the variant - will be NPVariantType_Void. -*/ -void NPN_ReleaseVariantValue(NPVariant *variant); - -#define NPVARIANT_IS_VOID(_v) ((_v).type == NPVariantType_Void) -#define NPVARIANT_IS_NULL(_v) ((_v).type == NPVariantType_Null) -#define NPVARIANT_IS_BOOLEAN(_v) ((_v).type == NPVariantType_Bool) -#define NPVARIANT_IS_INT32(_v) ((_v).type == NPVariantType_Int32) -#define NPVARIANT_IS_DOUBLE(_v) ((_v).type == NPVariantType_Double) -#define NPVARIANT_IS_STRING(_v) ((_v).type == NPVariantType_String) -#define NPVARIANT_IS_OBJECT(_v) ((_v).type == NPVariantType_Object) - -#define NPVARIANT_TO_BOOLEAN(_v) ((_v).value.boolValue) -#define NPVARIANT_TO_INT32(_v) ((_v).value.intValue) -#define NPVARIANT_TO_DOUBLE(_v) ((_v).value.doubleValue) -#define NPVARIANT_TO_STRING(_v) ((_v).value.stringValue) -#define NPVARIANT_TO_OBJECT(_v) ((_v).value.objectValue) - -#define VOID_TO_NPVARIANT(_v) \ -NP_BEGIN_MACRO \ - (_v).type = NPVariantType_Void; \ - (_v).value.objectValue = NULL; \ -NP_END_MACRO - -#define NULL_TO_NPVARIANT(_v) \ -NP_BEGIN_MACRO \ - (_v).type = NPVariantType_Null; \ - (_v).value.objectValue = NULL; \ -NP_END_MACRO - -#define BOOLEAN_TO_NPVARIANT(_val, _v) \ -NP_BEGIN_MACRO \ - (_v).type = NPVariantType_Bool; \ - (_v).value.boolValue = !!(_val); \ -NP_END_MACRO - -#define INT32_TO_NPVARIANT(_val, _v) \ -NP_BEGIN_MACRO \ - (_v).type = NPVariantType_Int32; \ - (_v).value.intValue = _val; \ -NP_END_MACRO - -#define DOUBLE_TO_NPVARIANT(_val, _v) \ -NP_BEGIN_MACRO \ - (_v).type = NPVariantType_Double; \ - (_v).value.doubleValue = _val; \ -NP_END_MACRO - -#define STRINGZ_TO_NPVARIANT(_val, _v) \ -NP_BEGIN_MACRO \ - (_v).type = NPVariantType_String; \ - NPString str = { _val, (uint32_t)(strlen(_val)) }; \ - (_v).value.stringValue = str; \ -NP_END_MACRO - -#define STRINGN_TO_NPVARIANT(_val, _len, _v) \ -NP_BEGIN_MACRO \ - (_v).type = NPVariantType_String; \ - NPString str = { _val, (uint32_t)(_len) }; \ - (_v).value.stringValue = str; \ -NP_END_MACRO - -#define OBJECT_TO_NPVARIANT(_val, _v) \ -NP_BEGIN_MACRO \ - (_v).type = NPVariantType_Object; \ - (_v).value.objectValue = _val; \ -NP_END_MACRO - - -/* - Type mappings (JavaScript types have been used for illustration - purposes): - - JavaScript to C (NPVariant with type:) - undefined NPVariantType_Void - null NPVariantType_Null - Boolean NPVariantType_Bool - Number NPVariantType_Double or NPVariantType_Int32 - String NPVariantType_String - Object NPVariantType_Object - - C (NPVariant with type:) to JavaScript - NPVariantType_Void undefined - NPVariantType_Null null - NPVariantType_Bool Boolean - NPVariantType_Int32 Number - NPVariantType_Double Number - NPVariantType_String String - NPVariantType_Object Object -*/ - -typedef void *NPIdentifier; - -/* - NPObjects have methods and properties. Methods and properties are - identified with NPIdentifiers. These identifiers may be reflected - in script. NPIdentifiers can be either strings or integers, IOW, - methods and properties can be identified by either strings or - integers (i.e. foo["bar"] vs foo[1]). NPIdentifiers can be - compared using ==. In case of any errors, the requested - NPIdentifier(s) will be NULL. NPIdentifier lifetime is controlled - by the browser. Plugins do not need to worry about memory management - with regards to NPIdentifiers. -*/ -NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name); -void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, - NPIdentifier *identifiers); -NPIdentifier NPN_GetIntIdentifier(int32_t intid); -bool NPN_IdentifierIsString(NPIdentifier identifier); - -/* - The NPUTF8 returned from NPN_UTF8FromIdentifier SHOULD be freed. -*/ -NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier); - -/* - Get the integer represented by identifier. If identifier is not an - integer identifier, the behaviour is undefined. -*/ -int32_t NPN_IntFromIdentifier(NPIdentifier identifier); - -/* - NPObject behavior is implemented using the following set of - callback functions. - - The NPVariant *result argument of these functions (where - applicable) should be released using NPN_ReleaseVariantValue(). -*/ -typedef NPObject *(*NPAllocateFunctionPtr)(NPP npp, NPClass *aClass); -typedef void (*NPDeallocateFunctionPtr)(NPObject *npobj); -typedef void (*NPInvalidateFunctionPtr)(NPObject *npobj); -typedef bool (*NPHasMethodFunctionPtr)(NPObject *npobj, NPIdentifier name); -typedef bool (*NPInvokeFunctionPtr)(NPObject *npobj, NPIdentifier name, - const NPVariant *args, uint32_t argCount, - NPVariant *result); -typedef bool (*NPInvokeDefaultFunctionPtr)(NPObject *npobj, - const NPVariant *args, - uint32_t argCount, - NPVariant *result); -typedef bool (*NPHasPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name); -typedef bool (*NPGetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name, - NPVariant *result); -typedef bool (*NPSetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name, - const NPVariant *value); -typedef bool (*NPRemovePropertyFunctionPtr)(NPObject *npobj, - NPIdentifier name); -typedef bool (*NPEnumerationFunctionPtr)(NPObject *npobj, NPIdentifier **value, - uint32_t *count); -typedef bool (*NPConstructFunctionPtr)(NPObject *npobj, - const NPVariant *args, - uint32_t argCount, - NPVariant *result); - -/* - NPObjects returned by create, retain, invoke, and getProperty pass - a reference count to the caller. That is, the callee adds a - reference count which passes to the caller. It is the caller's - responsibility to release the returned object. - - NPInvokeFunctionPtr function may return 0 to indicate a void - result. - - NPInvalidateFunctionPtr is called by the scripting environment - when the native code is shutdown. Any attempt to message a - NPObject instance after the invalidate callback has been - called will result in undefined behavior, even if the native code - is still retaining those NPObject instances. (The runtime - will typically return immediately, with 0 or NULL, from an attempt - to dispatch to a NPObject, but this behavior should not be - depended upon.) - - The NPEnumerationFunctionPtr function may pass an array of - NPIdentifiers back to the caller. The callee allocs the memory of - the array using NPN_MemAlloc(), and it's the caller's responsibility - to release it using NPN_MemFree(). -*/ -struct NPClass -{ - uint32_t structVersion; - NPAllocateFunctionPtr allocate; - NPDeallocateFunctionPtr deallocate; - NPInvalidateFunctionPtr invalidate; - NPHasMethodFunctionPtr hasMethod; - NPInvokeFunctionPtr invoke; - NPInvokeDefaultFunctionPtr invokeDefault; - NPHasPropertyFunctionPtr hasProperty; - NPGetPropertyFunctionPtr getProperty; - NPSetPropertyFunctionPtr setProperty; - NPRemovePropertyFunctionPtr removeProperty; - NPEnumerationFunctionPtr enumerate; - NPConstructFunctionPtr construct; -}; - -#define NP_CLASS_STRUCT_VERSION 3 - -#define NP_CLASS_STRUCT_VERSION_ENUM 2 -#define NP_CLASS_STRUCT_VERSION_CTOR 3 - -#define NP_CLASS_STRUCT_VERSION_HAS_ENUM(npclass) \ - ((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_ENUM) - -#define NP_CLASS_STRUCT_VERSION_HAS_CTOR(npclass) \ - ((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_CTOR) - -struct NPObject { - NPClass *_class; - uint32_t referenceCount; - /* - * Additional space may be allocated here by types of NPObjects - */ -}; - -/* - If the class has an allocate function, NPN_CreateObject invokes - that function, otherwise a NPObject is allocated and - returned. This method will initialize the referenceCount member of - the NPObject to 1. -*/ -NPObject *NPN_CreateObject(NPP npp, NPClass *aClass); - -/* - Increment the NPObject's reference count. -*/ -NPObject *NPN_RetainObject(NPObject *npobj); - -/* - Decremented the NPObject's reference count. If the reference - count goes to zero, the class's destroy function is invoke if - specified, otherwise the object is freed directly. -*/ -void NPN_ReleaseObject(NPObject *npobj); - -/* - Functions to access script objects represented by NPObject. - - Calls to script objects are synchronous. If a function returns a - value, it will be supplied via the result NPVariant - argument. Successful calls will return true, false will be - returned in case of an error. - - Calls made from plugin code to script must be made from the thread - on which the plugin was initialized. -*/ - -bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName, - const NPVariant *args, uint32_t argCount, NPVariant *result); -bool NPN_InvokeDefault(NPP npp, NPObject *npobj, const NPVariant *args, - uint32_t argCount, NPVariant *result); -bool NPN_Evaluate(NPP npp, NPObject *npobj, NPString *script, - NPVariant *result); -bool NPN_GetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName, - NPVariant *result); -bool NPN_SetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName, - const NPVariant *value); -bool NPN_RemoveProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName); -bool NPN_HasProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName); -bool NPN_HasMethod(NPP npp, NPObject *npobj, NPIdentifier methodName); -bool NPN_Enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier, - uint32_t *count); -bool NPN_Construct(NPP npp, NPObject *npobj, const NPVariant *args, - uint32_t argCount, NPVariant *result); - -/* - NPN_SetException may be called to trigger a script exception upon - return from entry points into NPObjects. Typical usage: - - NPN_SetException (npobj, message); -*/ -void NPN_SetException(NPObject *npobj, const NPUTF8 *message); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/np_sdk/inc/nptypes.h b/external/np_sdk/inc/nptypes.h deleted file mode 100644 index 63dcb0602b3b..000000000000 --- a/external/np_sdk/inc/nptypes.h +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * mozilla.org. - * Portions created by the Initial Developer are Copyright (C) 2004 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Johnny Stenback (Original author) - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nptypes_h_ -#define nptypes_h_ - -/* - * Header file for ensuring that C99 types ([u]int32_t, [u]int64_t and bool) and - * true/false macros are available. - */ - -#if defined(WIN32) || defined(OS2) - /* - * Win32 and OS/2 don't know C99, so define [u]int_16/32/64 here. The bool - * is predefined tho, both in C and C++. - */ - typedef short int16_t; - typedef unsigned short uint16_t; - typedef int int32_t; - typedef unsigned int uint32_t; - typedef long long int64_t; - typedef unsigned long long uint64_t; -#elif defined(_AIX) || defined(__sun) || defined(__osf__) || defined(IRIX) || defined(HPUX) - /* - * AIX and SunOS ship a inttypes.h header that defines [u]int32_t, - * but not bool for C. - */ - #include - - #ifndef __cplusplus - typedef int bool; - #define true 1 - #define false 0 - #endif -#elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD) - /* - * BSD/OS, FreeBSD, and OpenBSD ship sys/types.h that define int32_t and - * u_int32_t. - */ - #include - - /* - * BSD/OS ships no header that defines uint32_t, nor bool (for C) - */ - #if defined(bsdi) - typedef u_int32_t uint32_t; - typedef u_int64_t uint64_t; - - #if !defined(__cplusplus) - typedef int bool; - #define true 1 - #define false 0 - #endif - #else - /* - * FreeBSD and OpenBSD define uint32_t and bool. - */ - #include - #include - #endif -#elif defined(BEOS) - #include -#else - /* - * For those that ship a standard C99 stdint.h header file, include - * it. Can't do the same for stdbool.h tho, since some systems ship - * with a stdbool.h file that doesn't compile! - */ - #include - - #ifndef __cplusplus - #include - #endif -#endif - -#endif /* nptypes_h_ */ diff --git a/external/np_sdk/npsdk/LEGAL b/external/np_sdk/npsdk/LEGAL deleted file mode 100644 index c10e0f0d21a8..000000000000 --- a/external/np_sdk/npsdk/LEGAL +++ /dev/null @@ -1,43 +0,0 @@ -Please be apprised of the following Legal Notices: - -A) The U.S. District Court for the Eastern District of Virginia has -ruled that the Netscape Navigator code does not infringe Wang's U.S. -Patent No. 4,751,669 ("the '669 Patent") because: 1) HTML is not -Videotex as defined by the '669 patent; 2) web servers are not central -suppliers; and 3) Navigator does not "connect," as defined by the '669 -Patent, to web servers on the Internet. Wang may appeal this decision to -the Federal Circuit. Wang contended that its Patent disclosing a -"Videotext" system, is infringed by the following functionality in the -Netscape Navigator code: 1) the animated logo and status line indicators ---See Claims 1,8 and 9; 2) the "File Save As" function --See Claims -23-27; 3) Bookmarks and Rename Bookmarks in the Properties window --See -Claims 20-22; 4) storing HTML, GIF, and JPEG files and adding filename -extensions --See Claim 38 - -B) Intermind owns pending U.S. patent applications on communications -systems which employ metadata ("channel objects") to define a control -structure for information transfer. The Netscape code does not infringe -as released; however, modifications which utilize channel objects as -described by Intermind should be considered carefully. The following is -a statement from Intermind: "Intermind's claims fundamentally involve -the use of a control structure to automate communications. ...The -essence of Intermind's top claim is that two devices sender and -receiver have persistent storage, communicate over a network, -and exchange a control structure including metadata which describes: 1) -what information is to be updated, 2) when to update this information, -and 3) how to transfer the updated information. In addition, at least -the receiving device must be able to process the metadata in order to -perform the update determination and transfer. Any digital -communications system which incorporates all of these elements will be -covered by Intermind's patents." See Intermind.com. - -C) Stac, Inc., and its licensing agent Hi/fn, own several patents which -disclose data compression methods implementing an LZS compression -algorithm, including U.S. Patent Nos. 4,701,745 and 5,016, 009 ("the -Stac Patents"). The Netscape Communicator code does not perform -compression. If you modify the Netscape source code to perform -compression, please take notice of the Stac Patents. - -D) Netscape Communications Corporation ("Netscape") does not guarantee -that any source code or executable code available from the mozilla.org -domain is Year 2000 compliant. diff --git a/external/np_sdk/npsdk/LICENSE b/external/np_sdk/npsdk/LICENSE deleted file mode 100644 index 18f8109b7972..000000000000 --- a/external/np_sdk/npsdk/LICENSE +++ /dev/null @@ -1,567 +0,0 @@ - MOZILLA PUBLIC LICENSE - Version 1.1 - - --------------- - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the - Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to - the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Code, prior Modifications used by a Contributor, and the Modifications - made by that particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the - combination of the Original Code and Modifications, in each case - including portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally - accepted in the software development community for the electronic - transfer of data. - - 1.5. "Executable" means Covered Code in any form other than Source - Code. - - 1.6. "Initial Developer" means the individual or entity identified - as the Initial Developer in the Source Code notice required by Exhibit - A. - - 1.7. "Larger Work" means a work which combines Covered Code or - portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the - substance or structure of either the Original Code or any previous - Modifications. When Covered Code is released as a series of files, a - Modification is: - A. Any addition to or deletion from the contents of a file - containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or - previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code - which is described in the Source Code notice required by Exhibit A as - Original Code, and which, at the time of its release under this - License is not already Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for - making modifications to it, including all modules it contains, plus - any associated interface definition files, scripts used to control - compilation and installation of an Executable, or source code - differential comparisons against either the Original Code or another - well known, available Covered Code of the Contributor's choice. The - Source Code can be in a compressed or archival form, provided the - appropriate decompression or de-archiving software is widely available - for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, this - License or a future version of this License issued under Section 6.1. - For legal entities, "You" includes any entity which controls, is - controlled by, or is under common control with You. For purposes of - this definition, "control" means (a) the power, direct or indirect, - to cause the direction or management of such entity, whether by - contract or otherwise, or (b) ownership of more than fifty percent - (50%) of the outstanding shares or beneficial ownership of such - entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, - non-exclusive license, subject to third party intellectual property - claims: - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Code (or portions thereof) with or without Modifications, and/or - as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or - selling of Original Code, to make, have made, use, practice, - sell, and offer for sale, and/or otherwise dispose of the - Original Code (or portions thereof). - - (c) the licenses granted in this Section 2.1(a) and (b) are - effective on the date Initial Developer first distributes - Original Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: 1) for code that You delete from the Original Code; 2) - separate from the Original Code; or 3) for infringements caused - by: i) the modification of the Original Code or ii) the - combination of the Original Code with other software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor - hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor, to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof) either on an - unmodified basis, with other Modifications, as Covered Code - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or - selling of Modifications made by that Contributor either alone - and/or in combination with its Contributor Version (or portions - of such combination), to make, use, sell, offer for sale, have - made, and/or otherwise dispose of: 1) Modifications made by that - Contributor (or portions thereof); and 2) the combination of - Modifications made by that Contributor with its Contributor - Version (or portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are - effective on the date Contributor first makes Commercial Use of - the Covered Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: 1) for any code that Contributor has deleted from the - Contributor Version; 2) separate from the Contributor Version; - 3) for infringements caused by: i) third party modifications of - Contributor Version or ii) the combination of Modifications made - by that Contributor with other software (except as part of the - Contributor Version) or other devices; or 4) under Patent Claims - infringed by Covered Code in the absence of Modifications made by - that Contributor. - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are - governed by the terms of this License, including without limitation - Section 2.2. The Source Code version of Covered Code may be - distributed only under the terms of this License or a future version - of this License released under Section 6.1, and You must include a - copy of this License with every copy of the Source Code You - distribute. You may not offer or impose any terms on any Source Code - version that alters or restricts the applicable version of this - License or the recipients' rights hereunder. However, You may include - an additional document offering the additional rights described in - Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be - made available in Source Code form under the terms of this License - either on the same media as an Executable version or via an accepted - Electronic Distribution Mechanism to anyone to whom you made an - Executable version available; and if made available via Electronic - Distribution Mechanism, must remain available for at least twelve (12) - months after the date it initially became available, or at least six - (6) months after a subsequent version of that particular Modification - has been made available to such recipients. You are responsible for - ensuring that the Source Code version remains available even if the - Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a - file documenting the changes You made to create that Covered Code and - the date of any change. You must include a prominent statement that - the Modification is derived, directly or indirectly, from Original - Code provided by the Initial Developer and including the name of the - Initial Developer in (a) the Source Code, and (b) in any notice in an - Executable version or related documentation in which You describe the - origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's - intellectual property rights is required to exercise the rights - granted by such Contributor under Sections 2.1 or 2.2, - Contributor must include a text file with the Source Code - distribution titled "LEGAL" which describes the claim and the - party making the claim in sufficient detail that a recipient will - know whom to contact. If Contributor obtains such knowledge after - the Modification is made available as described in Section 3.2, - Contributor shall promptly modify the LEGAL file in all copies - Contributor makes available thereafter and shall take other steps - (such as notifying appropriate mailing lists or newsgroups) - reasonably calculated to inform those who received the Covered - Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming - interface and Contributor has knowledge of patent licenses which - are reasonably necessary to implement that API, Contributor must - also include this information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to - Section 3.4(a) above, Contributor believes that Contributor's - Modifications are Contributor's original creation(s) and/or - Contributor has sufficient rights to grant the rights conveyed by - this License. - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source - Code. If it is not possible to put such notice in a particular Source - Code file due to its structure, then You must include such notice in a - location (such as a relevant directory) where a user would be likely - to look for such a notice. If You created one or more Modification(s) - You may add your name as a Contributor to the notice described in - Exhibit A. You must also duplicate this License in any documentation - for the Source Code where You describe recipients' rights or ownership - rights relating to Covered Code. You may choose to offer, and to - charge a fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Code. However, You - may do so only on Your own behalf, and not on behalf of the Initial - Developer or any Contributor. You must make it absolutely clear than - any such warranty, support, indemnity or liability obligation is - offered by You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred by the - Initial Developer or such Contributor as a result of warranty, - support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the - requirements of Section 3.1-3.5 have been met for that Covered Code, - and if You include a notice stating that the Source Code version of - the Covered Code is available under the terms of this License, - including a description of how and where You have fulfilled the - obligations of Section 3.2. The notice must be conspicuously included - in any notice in an Executable version, related documentation or - collateral in which You describe recipients' rights relating to the - Covered Code. You may distribute the Executable version of Covered - Code or ownership rights under a license of Your choice, which may - contain terms different from this License, provided that You are in - compliance with the terms of this License and that the license for the - Executable version does not attempt to limit or alter the recipient's - rights in the Source Code version from the rights set forth in this - License. If You distribute the Executable version under a different - license You must make it absolutely clear that any terms which differ - from this License are offered by You alone, not by the Initial - Developer or any Contributor. You hereby agree to indemnify the - Initial Developer and every Contributor for any liability incurred by - the Initial Developer or such Contributor as a result of any such - terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code - not governed by the terms of this License and distribute the Larger - Work as a single product. In such a case, You must make sure the - requirements of this License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this - License with respect to some or all of the Covered Code due to - statute, judicial order, or regulation then You must: (a) comply with - the terms of this License to the maximum extent possible; and (b) - describe the limitations and the code they affect. Such description - must be included in the LEGAL file described in Section 3.4 and must - be included with all distributions of the Source Code. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has - attached the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised - and/or new versions of the License from time to time. Each version - will be given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the - License, You may always continue to use it under the terms of that - version. You may also choose to use such Covered Code under the terms - of any subsequent version of the License published by Netscape. No one - other than Netscape has the right to modify the terms applicable to - Covered Code created under this License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may - only do in order to apply it to code which is not already Covered Code - governed by this License), You must (a) rename Your license so that - the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", - "MPL", "NPL" or any confusingly similar phrase do not appear in your - license (except to note that your license differs from this License) - and (b) otherwise make it clear that Your version of the license - contains terms which differ from the Mozilla Public License and - Netscape Public License. (Filling in the name of the Initial - Developer, Original Code or Contributor in the notice described in - Exhibit A shall not of themselves be deemed to be modifications of - this License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF - DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. - THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE - IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, - YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE - COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER - OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to cure - such breach within 30 days of becoming aware of the breach. All - sublicenses to the Covered Code which are properly granted shall - survive any termination of this License. Provisions which, by their - nature, must remain in effect beyond the termination of this License - shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement - claim (excluding declatory judgment actions) against Initial Developer - or a Contributor (the Initial Developer or Contributor against whom - You file such action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly - infringes any patent, then any and all rights granted by such - Participant to You under Sections 2.1 and/or 2.2 of this License - shall, upon 60 days notice from Participant terminate prospectively, - unless if within 60 days after receipt of notice You either: (i) - agree in writing to pay Participant a mutually agreeable reasonable - royalty for Your past and future use of Modifications made by such - Participant, or (ii) withdraw Your litigation claim with respect to - the Contributor Version against such Participant. If within 60 days - of notice, a reasonable royalty and payment arrangement are not - mutually agreed upon in writing by the parties or the litigation claim - is not withdrawn, the rights granted by Participant to You under - Sections 2.1 and/or 2.2 automatically terminate at the expiration of - the 60 day notice period specified above. - - (b) any software, hardware, or device, other than such Participant's - Contributor Version, directly or indirectly infringes any patent, then - any rights granted to You by such Participant under Sections 2.1(b) - and 2.2(b) are revoked effective as of the date You first made, used, - sold, distributed, or had made, Modifications made by that - Participant. - - 8.3. If You assert a patent infringement claim against Participant - alleging that such Participant's Contributor Version directly or - indirectly infringes any patent where such claim is resolved (such as - by license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, - all end user license agreements (excluding distributors and resellers) - which have been validly granted by You or any distributor hereunder - prior to termination shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL - DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, - OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR - ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY - CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, - WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY - RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW - PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE - EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO - THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in - 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" and "commercial computer software documentation," as such - terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 - C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), - all U.S. Government End Users acquire Covered Code with only those - rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - California law provisions (except to the extent applicable law, if - any, provides otherwise), excluding its conflict-of-law provisions. - With respect to disputes in which at least one party is a citizen of, - or an entity chartered or registered to do business in the United - States of America, any litigation relating to this License shall be - subject to the jurisdiction of the Federal Courts of the Northern - District of California, with venue lying in Santa Clara County, - California, with the losing party responsible for costs, including - without limitation, court costs and reasonable attorneys' fees and - expenses. The application of the United Nations Convention on - Contracts for the International Sale of Goods is expressly excluded. - Any law or regulation which provides that the language of a contract - shall be construed against the drafter shall not apply to this - License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as - "Multiple-Licensed". "Multiple-Licensed" means that the Initial - Developer permits you to utilize portions of the Covered Code under - Your choice of the NPL or the alternative licenses, if any, specified - by the Initial Developer in the file described in Exhibit A. - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. - Portions created by ______________________ are Copyright (C) ______ - _______________________. All Rights Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms - of the _____ license (the "[___] License"), in which case the - provisions of [______] License are applicable instead of those - above. If you wish to allow use of your version of this file only - under the terms of the [____] License and not to allow others to use - your version of this file under the MPL, indicate your decision by - deleting the provisions above and replace them with the notice and - other provisions required by the [___] License. If you do not delete - the provisions above, a recipient may use your version of this file - under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of - the notices in the Source Code files of the Original Code. You should - use the text of this Exhibit A rather than the text found in the - Original Code Source Code for Your Modifications.] - - ---------------------------------------------------------------------- - - AMENDMENTS - - The Netscape Public License Version 1.1 ("NPL") consists of the - Mozilla Public License Version 1.1 with the following Amendments, - including Exhibit A-Netscape Public License. Files identified with - "Exhibit A-Netscape Public License" are governed by the Netscape - Public License Version 1.1. - - Additional Terms applicable to the Netscape Public License. - I. Effect. - These additional terms described in this Netscape Public - License -- Amendments shall apply to the Mozilla Communicator - client code and to all Covered Code under this License. - - II. "Netscape's Branded Code" means Covered Code that Netscape - distributes and/or permits others to distribute under one or more - trademark(s) which are controlled by Netscape but which are not - licensed for use under this License. - - III. Netscape and logo. - This License does not grant any rights to use the trademarks - "Netscape", the "Netscape N and horizon" logo or the "Netscape - lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript", - "Smart Browsing" even if such marks are included in the Original - Code or Modifications. - - IV. Inability to Comply Due to Contractual Obligation. - Prior to licensing the Original Code under this License, Netscape - has licensed third party code for use in Netscape's Branded Code. - To the extent that Netscape is limited contractually from making - such third party code available under this License, Netscape may - choose to reintegrate such code into Covered Code without being - required to distribute such code in Source Code form, even if - such code would otherwise be considered "Modifications" under - this License. - - V. Use of Modifications and Covered Code by Initial Developer. - V.1. In General. - The obligations of Section 3 apply to Netscape, except to - the extent specified in this Amendment, Section V.2 and V.3. - - V.2. Other Products. - Netscape may include Covered Code in products other than the - Netscape's Branded Code which are released by Netscape - during the two (2) years following the release date of the - Original Code, without such additional products becoming - subject to the terms of this License, and may license such - additional products on different terms from those contained - in this License. - - V.3. Alternative Licensing. - Netscape may license the Source Code of Netscape's Branded - Code, including Modifications incorporated therein, without - such Netscape Branded Code becoming subject to the terms of - this License, and may license such Netscape Branded Code on - different terms from those contained in this License. - - VI. Litigation. - Notwithstanding the limitations of Section 11 above, the - provisions regarding litigation in Section 11(a), (b) and (c) of - the License shall apply to all disputes relating to this License. - - EXHIBIT A-Netscape Public License. - - "The contents of this file are subject to the Netscape Public - 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.mozilla.org/NPL/ - - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. - - The Original Code is Mozilla Communicator client code, released - March 31, 1998. - - The Initial Developer of the Original Code is Netscape - Communications Corporation. Portions created by Netscape are - Copyright (C) 1998-1999 Netscape Communications Corporation. All - Rights Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the - terms of the _____ license (the "[___] License"), in which case - the provisions of [______] License are applicable instead of - those above. If you wish to allow use of your version of this - file only under the terms of the [____] License and not to allow - others to use your version of this file under the NPL, indicate - your decision by deleting the provisions above and replace them - with the notice and other provisions required by the [___] - License. If you do not delete the provisions above, a recipient - may use your version of this file under either the NPL or the - [___] License." diff --git a/external/np_sdk/npsdk/README b/external/np_sdk/npsdk/README deleted file mode 100644 index e83fe38d449e..000000000000 --- a/external/np_sdk/npsdk/README +++ /dev/null @@ -1,2 +0,0 @@ -This folder contains Mozilla headers related to plugin development. The original version of the files were taken from Mozilla1.0 tarball. - diff --git a/external/np_sdk/npsdk/jri.h b/external/np_sdk/npsdk/jri.h deleted file mode 100644 index 04e237f2d144..000000000000 --- a/external/np_sdk/npsdk/jri.h +++ /dev/null @@ -1,689 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public 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.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -/******************************************************************************* - * Java Runtime Interface - ******************************************************************************/ - -#ifndef JRI_H -#define JRI_H - -#include "jritypes.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/******************************************************************************* - * JRIEnv - ******************************************************************************/ - -/* The type of the JRIEnv interface. */ -typedef struct JRIEnvInterface JRIEnvInterface; - -/* The type of a JRIEnv instance. */ -typedef const JRIEnvInterface* JRIEnv; - -/******************************************************************************* - * JRIEnv Operations - ******************************************************************************/ - -#define JRI_DefineClass(env, classLoader, buf, bufLen) \ - (((*(env))->DefineClass)(env, JRI_DefineClass_op, classLoader, buf, bufLen)) - -#define JRI_FindClass(env, name) \ - (((*(env))->FindClass)(env, JRI_FindClass_op, name)) - -#define JRI_Throw(env, obj) \ - (((*(env))->Throw)(env, JRI_Throw_op, obj)) - -#define JRI_ThrowNew(env, clazz, message) \ - (((*(env))->ThrowNew)(env, JRI_ThrowNew_op, clazz, message)) - -#define JRI_ExceptionOccurred(env) \ - (((*(env))->ExceptionOccurred)(env, JRI_ExceptionOccurred_op)) - -#define JRI_ExceptionDescribe(env) \ - (((*(env))->ExceptionDescribe)(env, JRI_ExceptionDescribe_op)) - -#define JRI_ExceptionClear(env) \ - (((*(env))->ExceptionClear)(env, JRI_ExceptionClear_op)) - -#define JRI_NewGlobalRef(env, ref) \ - (((*(env))->NewGlobalRef)(env, JRI_NewGlobalRef_op, ref)) - -#define JRI_DisposeGlobalRef(env, gref) \ - (((*(env))->DisposeGlobalRef)(env, JRI_DisposeGlobalRef_op, gref)) - -#define JRI_GetGlobalRef(env, gref) \ - (((*(env))->GetGlobalRef)(env, JRI_GetGlobalRef_op, gref)) - -#define JRI_SetGlobalRef(env, gref, ref) \ - (((*(env))->SetGlobalRef)(env, JRI_SetGlobalRef_op, gref, ref)) - -#define JRI_IsSameObject(env, a, b) \ - (((*(env))->IsSameObject)(env, JRI_IsSameObject_op, a, b)) - -#define JRI_NewObject(env) ((*(env))->NewObject) -#define JRI_NewObjectV(env, clazz, methodID, args) \ - (((*(env))->NewObjectV)(env, JRI_NewObject_op_va_list, clazz, methodID, args)) -#define JRI_NewObjectA(env, clazz, method, args) \ - (((*(env))->NewObjectA)(env, JRI_NewObject_op_array, clazz, methodID, args)) - -#define JRI_GetObjectClass(env, obj) \ - (((*(env))->GetObjectClass)(env, JRI_GetObjectClass_op, obj)) - -#define JRI_IsInstanceOf(env, obj, clazz) \ - (((*(env))->IsInstanceOf)(env, JRI_IsInstanceOf_op, obj, clazz)) - -#define JRI_GetMethodID(env, clazz, name, sig) \ - (((*(env))->GetMethodID)(env, JRI_GetMethodID_op, clazz, name, sig)) - -#define JRI_CallMethod(env) ((*(env))->CallMethod) -#define JRI_CallMethodV(env, obj, methodID, args) \ - (((*(env))->CallMethodV)(env, JRI_CallMethod_op_va_list, obj, methodID, args)) -#define JRI_CallMethodA(env, obj, methodID, args) \ - (((*(env))->CallMethodA)(env, JRI_CallMethod_op_array, obj, methodID, args)) - -#define JRI_CallMethodBoolean(env) ((*(env))->CallMethodBoolean) -#define JRI_CallMethodBooleanV(env, obj, methodID, args) \ - (((*(env))->CallMethodBooleanV)(env, JRI_CallMethodBoolean_op_va_list, obj, methodID, args)) -#define JRI_CallMethodBooleanA(env, obj, methodID, args) \ - (((*(env))->CallMethodBooleanA)(env, JRI_CallMethodBoolean_op_array, obj, methodID, args)) - -#define JRI_CallMethodByte(env) ((*(env))->CallMethodByte) -#define JRI_CallMethodByteV(env, obj, methodID, args) \ - (((*(env))->CallMethodByteV)(env, JRI_CallMethodByte_op_va_list, obj, methodID, args)) -#define JRI_CallMethodByteA(env, obj, methodID, args) \ - (((*(env))->CallMethodByteA)(env, JRI_CallMethodByte_op_array, obj, methodID, args)) - -#define JRI_CallMethodChar(env) ((*(env))->CallMethodChar) -#define JRI_CallMethodCharV(env, obj, methodID, args) \ - (((*(env))->CallMethodCharV)(env, JRI_CallMethodChar_op_va_list, obj, methodID, args)) -#define JRI_CallMethodCharA(env, obj, methodID, args) \ - (((*(env))->CallMethodCharA)(env, JRI_CallMethodChar_op_array, obj, methodID, args)) - -#define JRI_CallMethodShort(env) ((*(env))->CallMethodShort) -#define JRI_CallMethodShortV(env, obj, methodID, args) \ - (((*(env))->CallMethodShortV)(env, JRI_CallMethodShort_op_va_list, obj, methodID, args)) -#define JRI_CallMethodShortA(env, obj, methodID, args) \ - (((*(env))->CallMethodShortA)(env, JRI_CallMethodShort_op_array, obj, methodID, args)) - -#define JRI_CallMethodInt(env) ((*(env))->CallMethodInt) -#define JRI_CallMethodIntV(env, obj, methodID, args) \ - (((*(env))->CallMethodIntV)(env, JRI_CallMethodInt_op_va_list, obj, methodID, args)) -#define JRI_CallMethodIntA(env, obj, methodID, args) \ - (((*(env))->CallMethodIntA)(env, JRI_CallMethodInt_op_array, obj, methodID, args)) - -#define JRI_CallMethodLong(env) ((*(env))->CallMethodLong) -#define JRI_CallMethodLongV(env, obj, methodID, args) \ - (((*(env))->CallMethodLongV)(env, JRI_CallMethodLong_op_va_list, obj, methodID, args)) -#define JRI_CallMethodLongA(env, obj, methodID, args) \ - (((*(env))->CallMethodLongA)(env, JRI_CallMethodLong_op_array, obj, methodID, args)) - -#define JRI_CallMethodFloat(env) ((*(env))->CallMethodFloat) -#define JRI_CallMethodFloatV(env, obj, methodID, args) \ - (((*(env))->CallMethodFloatV)(env, JRI_CallMethodFloat_op_va_list, obj, methodID, args)) -#define JRI_CallMethodFloatA(env, obj, methodID, args) \ - (((*(env))->CallMethodFloatA)(env, JRI_CallMethodFloat_op_array, obj, methodID, args)) - -#define JRI_CallMethodDouble(env) ((*(env))->CallMethodDouble) -#define JRI_CallMethodDoubleV(env, obj, methodID, args) \ - (((*(env))->CallMethodDoubleV)(env, JRI_CallMethodDouble_op_va_list, obj, methodID, args)) -#define JRI_CallMethodDoubleA(env, obj, methodID, args) \ - (((*(env))->CallMethodDoubleA)(env, JRI_CallMethodDouble_op_array, obj, methodID, args)) - -#define JRI_GetFieldID(env, clazz, name, sig) \ - (((*(env))->GetFieldID)(env, JRI_GetFieldID_op, clazz, name, sig)) - -#define JRI_GetField(env, obj, fieldID) \ - (((*(env))->GetField)(env, JRI_GetField_op, obj, fieldID)) - -#define JRI_GetFieldBoolean(env, obj, fieldID) \ - (((*(env))->GetFieldBoolean)(env, JRI_GetFieldBoolean_op, obj, fieldID)) - -#define JRI_GetFieldByte(env, obj, fieldID) \ - (((*(env))->GetFieldByte)(env, JRI_GetFieldByte_op, obj, fieldID)) - -#define JRI_GetFieldChar(env, obj, fieldID) \ - (((*(env))->GetFieldChar)(env, JRI_GetFieldChar_op, obj, fieldID)) - -#define JRI_GetFieldShort(env, obj, fieldID) \ - (((*(env))->GetFieldShort)(env, JRI_GetFieldShort_op, obj, fieldID)) - -#define JRI_GetFieldInt(env, obj, fieldID) \ - (((*(env))->GetFieldInt)(env, JRI_GetFieldInt_op, obj, fieldID)) - -#define JRI_GetFieldLong(env, obj, fieldID) \ - (((*(env))->GetFieldLong)(env, JRI_GetFieldLong_op, obj, fieldID)) - -#define JRI_GetFieldFloat(env, obj, fieldID) \ - (((*(env))->GetFieldFloat)(env, JRI_GetFieldFloat_op, obj, fieldID)) - -#define JRI_GetFieldDouble(env, obj, fieldID) \ - (((*(env))->GetFieldDouble)(env, JRI_GetFieldDouble_op, obj, fieldID)) - -#define JRI_SetField(env, obj, fieldID, value) \ - (((*(env))->SetField)(env, JRI_SetField_op, obj, fieldID, value)) - -#define JRI_SetFieldBoolean(env, obj, fieldID, value) \ - (((*(env))->SetFieldBoolean)(env, JRI_SetFieldBoolean_op, obj, fieldID, value)) - -#define JRI_SetFieldByte(env, obj, fieldID, value) \ - (((*(env))->SetFieldByte)(env, JRI_SetFieldByte_op, obj, fieldID, value)) - -#define JRI_SetFieldChar(env, obj, fieldID, value) \ - (((*(env))->SetFieldChar)(env, JRI_SetFieldChar_op, obj, fieldID, value)) - -#define JRI_SetFieldShort(env, obj, fieldID, value) \ - (((*(env))->SetFieldShort)(env, JRI_SetFieldShort_op, obj, fieldID, value)) - -#define JRI_SetFieldInt(env, obj, fieldID, value) \ - (((*(env))->SetFieldInt)(env, JRI_SetFieldInt_op, obj, fieldID, value)) - -#define JRI_SetFieldLong(env, obj, fieldID, value) \ - (((*(env))->SetFieldLong)(env, JRI_SetFieldLong_op, obj, fieldID, value)) - -#define JRI_SetFieldFloat(env, obj, fieldID, value) \ - (((*(env))->SetFieldFloat)(env, JRI_SetFieldFloat_op, obj, fieldID, value)) - -#define JRI_SetFieldDouble(env, obj, fieldID, value) \ - (((*(env))->SetFieldDouble)(env, JRI_SetFieldDouble_op, obj, fieldID, value)) - -#define JRI_IsSubclassOf(env, a, b) \ - (((*(env))->IsSubclassOf)(env, JRI_IsSubclassOf_op, a, b)) - -#define JRI_GetStaticMethodID(env, clazz, name, sig) \ - (((*(env))->GetStaticMethodID)(env, JRI_GetStaticMethodID_op, clazz, name, sig)) - -#define JRI_CallStaticMethod(env) ((*(env))->CallStaticMethod) -#define JRI_CallStaticMethodV(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodV)(env, JRI_CallStaticMethod_op_va_list, clazz, methodID, args)) -#define JRI_CallStaticMethodA(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodA)(env, JRI_CallStaticMethod_op_array, clazz, methodID, args)) - -#define JRI_CallStaticMethodBoolean(env) ((*(env))->CallStaticMethodBoolean) -#define JRI_CallStaticMethodBooleanV(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodBooleanV)(env, JRI_CallStaticMethodBoolean_op_va_list, clazz, methodID, args)) -#define JRI_CallStaticMethodBooleanA(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodBooleanA)(env, JRI_CallStaticMethodBoolean_op_array, clazz, methodID, args)) - -#define JRI_CallStaticMethodByte(env) ((*(env))->CallStaticMethodByte) -#define JRI_CallStaticMethodByteV(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodByteV)(env, JRI_CallStaticMethodByte_op_va_list, clazz, methodID, args)) -#define JRI_CallStaticMethodByteA(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodByteA)(env, JRI_CallStaticMethodByte_op_array, clazz, methodID, args)) - -#define JRI_CallStaticMethodChar(env) ((*(env))->CallStaticMethodChar) -#define JRI_CallStaticMethodCharV(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodCharV)(env, JRI_CallStaticMethodChar_op_va_list, clazz, methodID, args)) -#define JRI_CallStaticMethodCharA(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodCharA)(env, JRI_CallStaticMethodChar_op_array, clazz, methodID, args)) - -#define JRI_CallStaticMethodShort(env) ((*(env))->CallStaticMethodShort) -#define JRI_CallStaticMethodShortV(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodShortV)(env, JRI_CallStaticMethodShort_op_va_list, clazz, methodID, args)) -#define JRI_CallStaticMethodShortA(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodShortA)(env, JRI_CallStaticMethodShort_op_array, clazz, methodID, args)) - -#define JRI_CallStaticMethodInt(env) ((*(env))->CallStaticMethodInt) -#define JRI_CallStaticMethodIntV(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodIntV)(env, JRI_CallStaticMethodInt_op_va_list, clazz, methodID, args)) -#define JRI_CallStaticMethodIntA(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodIntA)(env, JRI_CallStaticMethodInt_op_array, clazz, methodID, args)) - -#define JRI_CallStaticMethodLong(env) ((*(env))->CallStaticMethodLong) -#define JRI_CallStaticMethodLongV(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodLongV)(env, JRI_CallStaticMethodLong_op_va_list, clazz, methodID, args)) -#define JRI_CallStaticMethodLongA(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodLongA)(env, JRI_CallStaticMethodLong_op_array, clazz, methodID, args)) - -#define JRI_CallStaticMethodFloat(env) ((*(env))->CallStaticMethodFloat) -#define JRI_CallStaticMethodFloatV(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodFloatV)(env, JRI_CallStaticMethodFloat_op_va_list, clazz, methodID, args)) -#define JRI_CallStaticMethodFloatA(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodFloatA)(env, JRI_CallStaticMethodFloat_op_array, clazz, methodID, args)) - -#define JRI_CallStaticMethodDouble(env) ((*(env))->CallStaticMethodDouble) -#define JRI_CallStaticMethodDoubleV(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodDoubleV)(env, JRI_CallStaticMethodDouble_op_va_list, clazz, methodID, args)) -#define JRI_CallStaticMethodDoubleA(env, clazz, methodID, args) \ - (((*(env))->CallStaticMethodDoubleA)(env, JRI_CallStaticMethodDouble_op_array, clazz, methodID, args)) - -#define JRI_GetStaticFieldID(env, clazz, name, sig) \ - (((*(env))->GetStaticFieldID)(env, JRI_GetStaticFieldID_op, clazz, name, sig)) - -#define JRI_GetStaticField(env, clazz, fieldID) \ - (((*(env))->GetStaticField)(env, JRI_GetStaticField_op, clazz, fieldID)) - -#define JRI_GetStaticFieldBoolean(env, clazz, fieldID) \ - (((*(env))->GetStaticFieldBoolean)(env, JRI_GetStaticFieldBoolean_op, clazz, fieldID)) - -#define JRI_GetStaticFieldByte(env, clazz, fieldID) \ - (((*(env))->GetStaticFieldByte)(env, JRI_GetStaticFieldByte_op, clazz, fieldID)) - -#define JRI_GetStaticFieldChar(env, clazz, fieldID) \ - (((*(env))->GetStaticFieldChar)(env, JRI_GetStaticFieldChar_op, clazz, fieldID)) - -#define JRI_GetStaticFieldShort(env, clazz, fieldID) \ - (((*(env))->GetStaticFieldShort)(env, JRI_GetStaticFieldShort_op, clazz, fieldID)) - -#define JRI_GetStaticFieldInt(env, clazz, fieldID) \ - (((*(env))->GetStaticFieldInt)(env, JRI_GetStaticFieldInt_op, clazz, fieldID)) - -#define JRI_GetStaticFieldLong(env, clazz, fieldID) \ - (((*(env))->GetStaticFieldLong)(env, JRI_GetStaticFieldLong_op, clazz, fieldID)) - -#define JRI_GetStaticFieldFloat(env, clazz, fieldID) \ - (((*(env))->GetStaticFieldFloat)(env, JRI_GetStaticFieldFloat_op, clazz, fieldID)) - -#define JRI_GetStaticFieldDouble(env, clazz, fieldID) \ - (((*(env))->GetStaticFieldDouble)(env, JRI_GetStaticFieldDouble_op, clazz, fieldID)) - -#define JRI_SetStaticField(env, clazz, fieldID, value) \ - (((*(env))->SetStaticField)(env, JRI_SetStaticField_op, clazz, fieldID, value)) - -#define JRI_SetStaticFieldBoolean(env, clazz, fieldID, value) \ - (((*(env))->SetStaticFieldBoolean)(env, JRI_SetStaticFieldBoolean_op, clazz, fieldID, value)) - -#define JRI_SetStaticFieldByte(env, clazz, fieldID, value) \ - (((*(env))->SetStaticFieldByte)(env, JRI_SetStaticFieldByte_op, clazz, fieldID, value)) - -#define JRI_SetStaticFieldChar(env, clazz, fieldID, value) \ - (((*(env))->SetStaticFieldChar)(env, JRI_SetStaticFieldChar_op, clazz, fieldID, value)) - -#define JRI_SetStaticFieldShort(env, clazz, fieldID, value) \ - (((*(env))->SetStaticFieldShort)(env, JRI_SetStaticFieldShort_op, clazz, fieldID, value)) - -#define JRI_SetStaticFieldInt(env, clazz, fieldID, value) \ - (((*(env))->SetStaticFieldInt)(env, JRI_SetStaticFieldInt_op, clazz, fieldID, value)) - -#define JRI_SetStaticFieldLong(env, clazz, fieldID, value) \ - (((*(env))->SetStaticFieldLong)(env, JRI_SetStaticFieldLong_op, clazz, fieldID, value)) - -#define JRI_SetStaticFieldFloat(env, clazz, fieldID, value) \ - (((*(env))->SetStaticFieldFloat)(env, JRI_SetStaticFieldFloat_op, clazz, fieldID, value)) - -#define JRI_SetStaticFieldDouble(env, clazz, fieldID, value) \ - (((*(env))->SetStaticFieldDouble)(env, JRI_SetStaticFieldDouble_op, clazz, fieldID, value)) - -#define JRI_NewString(env, unicode, len) \ - (((*(env))->NewString)(env, JRI_NewString_op, unicode, len)) - -#define JRI_GetStringLength(env, string) \ - (((*(env))->GetStringLength)(env, JRI_GetStringLength_op, string)) - -#define JRI_GetStringChars(env, string) \ - (((*(env))->GetStringChars)(env, JRI_GetStringChars_op, string)) - -#define JRI_NewStringUTF(env, utf, len) \ - (((*(env))->NewStringUTF)(env, JRI_NewStringUTF_op, utf, len)) - -#define JRI_GetStringUTFLength(env, string) \ - (((*(env))->GetStringUTFLength)(env, JRI_GetStringUTFLength_op, string)) - -#define JRI_GetStringUTFChars(env, string) \ - (((*(env))->GetStringUTFChars)(env, JRI_GetStringUTFChars_op, string)) - -#define JRI_NewScalarArray(env, length, elementSig, initialElements) \ - (((*(env))->NewScalarArray)(env, JRI_NewScalarArray_op, length, elementSig, initialElements)) - -#define JRI_GetScalarArrayLength(env, array) \ - (((*(env))->GetScalarArrayLength)(env, JRI_GetScalarArrayLength_op, array)) - -#define JRI_GetScalarArrayElements(env, array) \ - (((*(env))->GetScalarArrayElements)(env, JRI_GetScalarArrayElements_op, array)) - -#define JRI_NewObjectArray(env, length, elementClass, initialElement) \ - (((*(env))->NewObjectArray)(env, JRI_NewObjectArray_op, length, elementClass, initialElement)) - -#define JRI_GetObjectArrayLength(env, array) \ - (((*(env))->GetObjectArrayLength)(env, JRI_GetObjectArrayLength_op, array)) - -#define JRI_GetObjectArrayElement(env, array, index) \ - (((*(env))->GetObjectArrayElement)(env, JRI_GetObjectArrayElement_op, array, index)) - -#define JRI_SetObjectArrayElement(env, array, index, value) \ - (((*(env))->SetObjectArrayElement)(env, JRI_SetObjectArrayElement_op, array, index, value)) - -#define JRI_RegisterNatives(env, clazz, nameAndSigArray, nativeProcArray) \ - (((*(env))->RegisterNatives)(env, JRI_RegisterNatives_op, clazz, nameAndSigArray, nativeProcArray)) - -#define JRI_UnregisterNatives(env, clazz) \ - (((*(env))->UnregisterNatives)(env, JRI_UnregisterNatives_op, clazz)) - -#define JRI_NewStringPlatform(env, string, len, encoding, encodingLength) \ - (((*(env))->NewStringPlatform)(env, JRI_NewStringPlatform_op, string, len, encoding, encodingLength)) - -#define JRI_GetStringPlatformChars(env, string, encoding, encodingLength) \ - (((*(env))->GetStringPlatformChars)(env, JRI_GetStringPlatformChars_op, string, encoding, encodingLength)) - - -/******************************************************************************* - * JRIEnv Interface - ******************************************************************************/ - -struct java_lang_ClassLoader; -struct java_lang_Class; -struct java_lang_Throwable; -struct java_lang_Object; -struct java_lang_String; - -struct JRIEnvInterface { - void* reserved0; - void* reserved1; - void* reserved2; - void* reserved3; - struct java_lang_Class* (*FindClass)(JRIEnv* env, jint op, const char* a); - void (*Throw)(JRIEnv* env, jint op, struct java_lang_Throwable* a); - void (*ThrowNew)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b); - struct java_lang_Throwable* (*ExceptionOccurred)(JRIEnv* env, jint op); - void (*ExceptionDescribe)(JRIEnv* env, jint op); - void (*ExceptionClear)(JRIEnv* env, jint op); - jglobal (*NewGlobalRef)(JRIEnv* env, jint op, void* a); - void (*DisposeGlobalRef)(JRIEnv* env, jint op, jglobal a); - void* (*GetGlobalRef)(JRIEnv* env, jint op, jglobal a); - void (*SetGlobalRef)(JRIEnv* env, jint op, jglobal a, void* b); - jbool (*IsSameObject)(JRIEnv* env, jint op, void* a, void* b); - void* (*NewObject)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - void* (*NewObjectV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - void* (*NewObjectA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - struct java_lang_Class* (*GetObjectClass)(JRIEnv* env, jint op, void* a); - jbool (*IsInstanceOf)(JRIEnv* env, jint op, void* a, struct java_lang_Class* b); - jint (*GetMethodID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c); - void* (*CallMethod)(JRIEnv* env, jint op, void* a, jint b, ...); - void* (*CallMethodV)(JRIEnv* env, jint op, void* a, jint b, va_list c); - void* (*CallMethodA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); - jbool (*CallMethodBoolean)(JRIEnv* env, jint op, void* a, jint b, ...); - jbool (*CallMethodBooleanV)(JRIEnv* env, jint op, void* a, jint b, va_list c); - jbool (*CallMethodBooleanA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); - jbyte (*CallMethodByte)(JRIEnv* env, jint op, void* a, jint b, ...); - jbyte (*CallMethodByteV)(JRIEnv* env, jint op, void* a, jint b, va_list c); - jbyte (*CallMethodByteA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); - jchar (*CallMethodChar)(JRIEnv* env, jint op, void* a, jint b, ...); - jchar (*CallMethodCharV)(JRIEnv* env, jint op, void* a, jint b, va_list c); - jchar (*CallMethodCharA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); - jshort (*CallMethodShort)(JRIEnv* env, jint op, void* a, jint b, ...); - jshort (*CallMethodShortV)(JRIEnv* env, jint op, void* a, jint b, va_list c); - jshort (*CallMethodShortA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); - jint (*CallMethodInt)(JRIEnv* env, jint op, void* a, jint b, ...); - jint (*CallMethodIntV)(JRIEnv* env, jint op, void* a, jint b, va_list c); - jint (*CallMethodIntA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); - jlong (*CallMethodLong)(JRIEnv* env, jint op, void* a, jint b, ...); - jlong (*CallMethodLongV)(JRIEnv* env, jint op, void* a, jint b, va_list c); - jlong (*CallMethodLongA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); - jfloat (*CallMethodFloat)(JRIEnv* env, jint op, void* a, jint b, ...); - jfloat (*CallMethodFloatV)(JRIEnv* env, jint op, void* a, jint b, va_list c); - jfloat (*CallMethodFloatA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); - jdouble (*CallMethodDouble)(JRIEnv* env, jint op, void* a, jint b, ...); - jdouble (*CallMethodDoubleV)(JRIEnv* env, jint op, void* a, jint b, va_list c); - jdouble (*CallMethodDoubleA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c); - jint (*GetFieldID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c); - void* (*GetField)(JRIEnv* env, jint op, void* a, jint b); - jbool (*GetFieldBoolean)(JRIEnv* env, jint op, void* a, jint b); - jbyte (*GetFieldByte)(JRIEnv* env, jint op, void* a, jint b); - jchar (*GetFieldChar)(JRIEnv* env, jint op, void* a, jint b); - jshort (*GetFieldShort)(JRIEnv* env, jint op, void* a, jint b); - jint (*GetFieldInt)(JRIEnv* env, jint op, void* a, jint b); - jlong (*GetFieldLong)(JRIEnv* env, jint op, void* a, jint b); - jfloat (*GetFieldFloat)(JRIEnv* env, jint op, void* a, jint b); - jdouble (*GetFieldDouble)(JRIEnv* env, jint op, void* a, jint b); - void (*SetField)(JRIEnv* env, jint op, void* a, jint b, void* c); - void (*SetFieldBoolean)(JRIEnv* env, jint op, void* a, jint b, jbool c); - void (*SetFieldByte)(JRIEnv* env, jint op, void* a, jint b, jbyte c); - void (*SetFieldChar)(JRIEnv* env, jint op, void* a, jint b, jchar c); - void (*SetFieldShort)(JRIEnv* env, jint op, void* a, jint b, jshort c); - void (*SetFieldInt)(JRIEnv* env, jint op, void* a, jint b, jint c); - void (*SetFieldLong)(JRIEnv* env, jint op, void* a, jint b, jlong c); - void (*SetFieldFloat)(JRIEnv* env, jint op, void* a, jint b, jfloat c); - void (*SetFieldDouble)(JRIEnv* env, jint op, void* a, jint b, jdouble c); - jbool (*IsSubclassOf)(JRIEnv* env, jint op, struct java_lang_Class* a, struct java_lang_Class* b); - jint (*GetStaticMethodID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c); - void* (*CallStaticMethod)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - void* (*CallStaticMethodV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - void* (*CallStaticMethodA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - jbool (*CallStaticMethodBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - jbool (*CallStaticMethodBooleanV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - jbool (*CallStaticMethodBooleanA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - jbyte (*CallStaticMethodByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - jbyte (*CallStaticMethodByteV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - jbyte (*CallStaticMethodByteA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - jchar (*CallStaticMethodChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - jchar (*CallStaticMethodCharV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - jchar (*CallStaticMethodCharA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - jshort (*CallStaticMethodShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - jshort (*CallStaticMethodShortV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - jshort (*CallStaticMethodShortA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - jint (*CallStaticMethodInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - jint (*CallStaticMethodIntV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - jint (*CallStaticMethodIntA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - jlong (*CallStaticMethodLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - jlong (*CallStaticMethodLongV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - jlong (*CallStaticMethodLongA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - jfloat (*CallStaticMethodFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - jfloat (*CallStaticMethodFloatV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - jfloat (*CallStaticMethodFloatA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - jdouble (*CallStaticMethodDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...); - jdouble (*CallStaticMethodDoubleV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c); - jdouble (*CallStaticMethodDoubleA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c); - jint (*GetStaticFieldID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c); - void* (*GetStaticField)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); - jbool (*GetStaticFieldBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); - jbyte (*GetStaticFieldByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); - jchar (*GetStaticFieldChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); - jshort (*GetStaticFieldShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); - jint (*GetStaticFieldInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); - jlong (*GetStaticFieldLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); - jfloat (*GetStaticFieldFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); - jdouble (*GetStaticFieldDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b); - void (*SetStaticField)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, void* c); - void (*SetStaticFieldBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jbool c); - void (*SetStaticFieldByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jbyte c); - void (*SetStaticFieldChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jchar c); - void (*SetStaticFieldShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jshort c); - void (*SetStaticFieldInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jint c); - void (*SetStaticFieldLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jlong c); - void (*SetStaticFieldFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jfloat c); - void (*SetStaticFieldDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jdouble c); - struct java_lang_String* (*NewString)(JRIEnv* env, jint op, const jchar* a, jint b); - jint (*GetStringLength)(JRIEnv* env, jint op, struct java_lang_String* a); - const jchar* (*GetStringChars)(JRIEnv* env, jint op, struct java_lang_String* a); - struct java_lang_String* (*NewStringUTF)(JRIEnv* env, jint op, const jbyte* a, jint b); - jint (*GetStringUTFLength)(JRIEnv* env, jint op, struct java_lang_String* a); - const jbyte* (*GetStringUTFChars)(JRIEnv* env, jint op, struct java_lang_String* a); - void* (*NewScalarArray)(JRIEnv* env, jint op, jint a, const char* b, const jbyte* c); - jint (*GetScalarArrayLength)(JRIEnv* env, jint op, void* a); - jbyte* (*GetScalarArrayElements)(JRIEnv* env, jint op, void* a); - void* (*NewObjectArray)(JRIEnv* env, jint op, jint a, struct java_lang_Class* b, void* c); - jint (*GetObjectArrayLength)(JRIEnv* env, jint op, void* a); - void* (*GetObjectArrayElement)(JRIEnv* env, jint op, void* a, jint b); - void (*SetObjectArrayElement)(JRIEnv* env, jint op, void* a, jint b, void* c); - void (*RegisterNatives)(JRIEnv* env, jint op, struct java_lang_Class* a, char** b, void** c); - void (*UnregisterNatives)(JRIEnv* env, jint op, struct java_lang_Class* a); - struct java_lang_Class* (*DefineClass)(JRIEnv* env, jint op, struct java_lang_ClassLoader* a, jbyte* b, jsize bLen); - struct java_lang_String* (*NewStringPlatform)(JRIEnv* env, jint op, const jbyte* a, jint b, const jbyte* c, jint d); - const jbyte* (*GetStringPlatformChars)(JRIEnv* env, jint op, struct java_lang_String* a, const jbyte* b, jint c); -}; - -/* -** **************************************************************************** -** JRIEnv Operation IDs -** *************************************************************************** -*/ - -typedef enum JRIEnvOperations { - JRI_Reserved0_op, - JRI_Reserved1_op, - JRI_Reserved2_op, - JRI_Reserved3_op, - JRI_FindClass_op, - JRI_Throw_op, - JRI_ThrowNew_op, - JRI_ExceptionOccurred_op, - JRI_ExceptionDescribe_op, - JRI_ExceptionClear_op, - JRI_NewGlobalRef_op, - JRI_DisposeGlobalRef_op, - JRI_GetGlobalRef_op, - JRI_SetGlobalRef_op, - JRI_IsSameObject_op, - JRI_NewObject_op, - JRI_NewObject_op_va_list, - JRI_NewObject_op_array, - JRI_GetObjectClass_op, - JRI_IsInstanceOf_op, - JRI_GetMethodID_op, - JRI_CallMethod_op, - JRI_CallMethod_op_va_list, - JRI_CallMethod_op_array, - JRI_CallMethodBoolean_op, - JRI_CallMethodBoolean_op_va_list, - JRI_CallMethodBoolean_op_array, - JRI_CallMethodByte_op, - JRI_CallMethodByte_op_va_list, - JRI_CallMethodByte_op_array, - JRI_CallMethodChar_op, - JRI_CallMethodChar_op_va_list, - JRI_CallMethodChar_op_array, - JRI_CallMethodShort_op, - JRI_CallMethodShort_op_va_list, - JRI_CallMethodShort_op_array, - JRI_CallMethodInt_op, - JRI_CallMethodInt_op_va_list, - JRI_CallMethodInt_op_array, - JRI_CallMethodLong_op, - JRI_CallMethodLong_op_va_list, - JRI_CallMethodLong_op_array, - JRI_CallMethodFloat_op, - JRI_CallMethodFloat_op_va_list, - JRI_CallMethodFloat_op_array, - JRI_CallMethodDouble_op, - JRI_CallMethodDouble_op_va_list, - JRI_CallMethodDouble_op_array, - JRI_GetFieldID_op, - JRI_GetField_op, - JRI_GetFieldBoolean_op, - JRI_GetFieldByte_op, - JRI_GetFieldChar_op, - JRI_GetFieldShort_op, - JRI_GetFieldInt_op, - JRI_GetFieldLong_op, - JRI_GetFieldFloat_op, - JRI_GetFieldDouble_op, - JRI_SetField_op, - JRI_SetFieldBoolean_op, - JRI_SetFieldByte_op, - JRI_SetFieldChar_op, - JRI_SetFieldShort_op, - JRI_SetFieldInt_op, - JRI_SetFieldLong_op, - JRI_SetFieldFloat_op, - JRI_SetFieldDouble_op, - JRI_IsSubclassOf_op, - JRI_GetStaticMethodID_op, - JRI_CallStaticMethod_op, - JRI_CallStaticMethod_op_va_list, - JRI_CallStaticMethod_op_array, - JRI_CallStaticMethodBoolean_op, - JRI_CallStaticMethodBoolean_op_va_list, - JRI_CallStaticMethodBoolean_op_array, - JRI_CallStaticMethodByte_op, - JRI_CallStaticMethodByte_op_va_list, - JRI_CallStaticMethodByte_op_array, - JRI_CallStaticMethodChar_op, - JRI_CallStaticMethodChar_op_va_list, - JRI_CallStaticMethodChar_op_array, - JRI_CallStaticMethodShort_op, - JRI_CallStaticMethodShort_op_va_list, - JRI_CallStaticMethodShort_op_array, - JRI_CallStaticMethodInt_op, - JRI_CallStaticMethodInt_op_va_list, - JRI_CallStaticMethodInt_op_array, - JRI_CallStaticMethodLong_op, - JRI_CallStaticMethodLong_op_va_list, - JRI_CallStaticMethodLong_op_array, - JRI_CallStaticMethodFloat_op, - JRI_CallStaticMethodFloat_op_va_list, - JRI_CallStaticMethodFloat_op_array, - JRI_CallStaticMethodDouble_op, - JRI_CallStaticMethodDouble_op_va_list, - JRI_CallStaticMethodDouble_op_array, - JRI_GetStaticFieldID_op, - JRI_GetStaticField_op, - JRI_GetStaticFieldBoolean_op, - JRI_GetStaticFieldByte_op, - JRI_GetStaticFieldChar_op, - JRI_GetStaticFieldShort_op, - JRI_GetStaticFieldInt_op, - JRI_GetStaticFieldLong_op, - JRI_GetStaticFieldFloat_op, - JRI_GetStaticFieldDouble_op, - JRI_SetStaticField_op, - JRI_SetStaticFieldBoolean_op, - JRI_SetStaticFieldByte_op, - JRI_SetStaticFieldChar_op, - JRI_SetStaticFieldShort_op, - JRI_SetStaticFieldInt_op, - JRI_SetStaticFieldLong_op, - JRI_SetStaticFieldFloat_op, - JRI_SetStaticFieldDouble_op, - JRI_NewString_op, - JRI_GetStringLength_op, - JRI_GetStringChars_op, - JRI_NewStringUTF_op, - JRI_GetStringUTFLength_op, - JRI_GetStringUTFChars_op, - JRI_NewScalarArray_op, - JRI_GetScalarArrayLength_op, - JRI_GetScalarArrayElements_op, - JRI_NewObjectArray_op, - JRI_GetObjectArrayLength_op, - JRI_GetObjectArrayElement_op, - JRI_SetObjectArrayElement_op, - JRI_RegisterNatives_op, - JRI_UnregisterNatives_op, - JRI_DefineClass_op, - JRI_NewStringPlatform_op, - JRI_GetStringPlatformChars_op -} JRIEnvOperations; - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ - -#endif /* JRI_H */ -/******************************************************************************/ diff --git a/external/np_sdk/npsdk/jri_md.h b/external/np_sdk/npsdk/jri_md.h deleted file mode 100644 index ab631d1904a7..000000000000 --- a/external/np_sdk/npsdk/jri_md.h +++ /dev/null @@ -1,545 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public 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.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -/******************************************************************************* - * Java Runtime Interface - Machine Dependent Types - ******************************************************************************/ - -#ifndef JRI_MD_H -#define JRI_MD_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * WHAT'S UP WITH THIS FILE? - * - * This is where we define the mystical JRI_PUBLIC_API macro that works on all - * platforms. If you're running with Visual C++, Symantec C, or Borland's - * development environment on the PC, you're all set. Or if you're on the Mac - * with Metrowerks, Symantec or MPW with SC you're ok too. For UNIX it shouldn't - * matter. - * - * On UNIX though you probably care about a couple of other symbols though: - * IS_LITTLE_ENDIAN must be defined for little-endian systems - * HAVE_LONG_LONG must be defined on systems that have 'long long' integers - * HAVE_ALIGNED_LONGLONGS must be defined if long-longs must be 8 byte aligned - * HAVE_ALIGNED_DOUBLES must be defined if doubles must be 8 byte aligned - * IS_64 must be defined on 64-bit machines (like Dec Alpha) - ******************************************************************************/ - -/* DLL Entry modifiers... */ - -/* PC */ -#if defined(XP_PC) || defined(_WINDOWS) || defined(WIN32) || defined(_WIN32) -# include -# if defined(_MSC_VER) || defined(__MINGW32__) -# if defined(WIN32) || defined(_WIN32) -# define JRI_PUBLIC_API(ResultType) __declspec(dllexport) ResultType -# define JRI_PUBLIC_VAR(VarType) VarType -# define JRI_PUBLIC_VAR_EXP(VarType) __declspec(dllexport) VarType -# define JRI_PUBLIC_VAR_IMP(VarType) __declspec(dllimport) VarType -# define JRI_NATIVE_STUB(ResultType) __declspec(dllexport) ResultType -# define JRI_CALLBACK -# else /* !_WIN32 */ -# if defined(_WINDLL) -# define JRI_PUBLIC_API(ResultType) ResultType __cdecl __export __loadds -# define JRI_PUBLIC_VAR(VarType) VarType -# define JRI_PUBLIC_VAR_EXP(VarType) JRI_PUBLIC_VAR(VarType) -# define JRI_PUBLIC_VAR_IMP(VarType) JRI_PUBLIC_VAR(VarType) -# define JRI_NATIVE_STUB(ResultType) ResultType __cdecl __loadds -# define JRI_CALLBACK __loadds -# else /* !WINDLL */ -# define JRI_PUBLIC_API(ResultType) ResultType __cdecl __export -# define JRI_PUBLIC_VAR(VarType) VarType -# define JRI_PUBLIC_VAR_EXP(VarType) JRI_PUBLIC_VAR(VarType) -# define JRI_PUBLIC_VAR_IMP(VarType) JRI_PUBLIC_VAR(VarType) -# define JRI_NATIVE_STUB(ResultType) ResultType __cdecl __export -# define JRI_CALLBACK __export -# endif /* !WINDLL */ -# endif /* !_WIN32 */ -# elif defined(__BORLANDC__) -# if defined(WIN32) || defined(_WIN32) -# define JRI_PUBLIC_API(ResultType) __export ResultType -# define JRI_PUBLIC_VAR(VarType) VarType -# define JRI_PUBLIC_VAR_EXP(VarType) __export VarType -# define JRI_PUBLIC_VAR_IMP(VarType) __import VarType -# define JRI_NATIVE_STUB(ResultType) __export ResultType -# define JRI_CALLBACK -# else /* !_WIN32 */ -# define JRI_PUBLIC_API(ResultType) ResultType _cdecl _export _loadds -# define JRI_PUBLIC_VAR(VarType) VarType -# define JRI_PUBLIC_VAR_EXP(VarType) __cdecl __export VarType -# define JRI_PUBLIC_VAR_IMP(VarType) __cdecl __import VarType -# define JRI_NATIVE_STUB(ResultType) ResultType _cdecl _loadds -# define JRI_CALLBACK _loadds -# endif -# else -# error Unsupported PC development environment. -# endif -# ifndef IS_LITTLE_ENDIAN -# define IS_LITTLE_ENDIAN -# endif - -/* Mac */ -#elif defined (macintosh) || defined(Macintosh) || defined(THINK_C) -# if defined(__MWERKS__) /* Metrowerks */ -# if !__option(enumsalwaysint) -# error You need to define 'Enums Always Int' for your project. -# endif -# if defined(TARGET_CPU_68K) && !TARGET_RT_MAC_CFM -# if !__option(fourbyteints) -# error You need to define 'Struct Alignment: 68k' for your project. -# endif -# endif /* !GENERATINGCFM */ -# define JRI_PUBLIC_API(ResultType) __declspec(export) ResultType -# define JRI_PUBLIC_VAR(VarType) JRI_PUBLIC_API(VarType) -# define JRI_PUBLIC_VAR_EXP(VarType) JRI_PUBLIC_API(VarType) -# define JRI_PUBLIC_VAR_IMP(VarType) JRI_PUBLIC_API(VarType) -# define JRI_NATIVE_STUB(ResultType) JRI_PUBLIC_API(ResultType) -# elif defined(__SC__) /* Symantec */ -# error What are the Symantec defines? (warren@netscape.com) -# elif macintosh && applec /* MPW */ -# error Please upgrade to the latest MPW compiler (SC). -# else -# error Unsupported Mac development environment. -# endif -# define JRI_CALLBACK - -/* Unix or else */ -#else -# define JRI_PUBLIC_API(ResultType) ResultType -# define JRI_PUBLIC_VAR(VarType) VarType -# define JRI_PUBLIC_VAR_EXP(VarType) JRI_PUBLIC_VAR(VarType) -# define JRI_PUBLIC_VAR_IMP(VarType) JRI_PUBLIC_VAR(VarType) -# define JRI_NATIVE_STUB(ResultType) ResultType -# define JRI_CALLBACK -#endif - -#ifndef FAR /* for non-Win16 */ -#define FAR -#endif - -/******************************************************************************/ - -/* Java Scalar Types */ - -/* moved from jni.h -- Sun's new jni.h doesn't have this anymore */ -#ifdef __cplusplus -typedef class _jobject *jref; -#else -typedef struct _jobject *jref; -#endif - -typedef unsigned char jbool; -typedef char jbyte; -typedef short jchar; -typedef short jshort; -#ifdef IS_64 /* XXX ok for alpha, but not right on all 64-bit architectures */ -typedef unsigned int juint; -typedef int jint; -#else -typedef unsigned long juint; -typedef long jint; -#endif - -typedef float jfloat; -typedef double jdouble; - -typedef juint jsize; - - -/******************************************************************************* - * jlong : long long (64-bit signed integer type) support. - ******************************************************************************/ - -/* -** Bit masking macros. (n must be <= 31 to be portable) -*/ -#define JRI_BIT(n) ((juint)1 << (n)) -#define JRI_BITMASK(n) (JRI_BIT(n) - 1) - -#ifdef HAVE_LONG_LONG - -#if (defined(WIN32) || defined(_WIN32)) - -typedef LONGLONG jlong; -typedef DWORDLONG julong; -#define jlong_MAXINT 0x7fffffffffffffffi64 -#define jlong_MININT 0x8000000000000000i64 -#define jlong_ZERO 0x0i64 - -#else - -typedef long long jlong; -typedef unsigned long long julong; -#define jlong_MAXINT 0x7fffffffffffffffLL -#define jlong_MININT 0x8000000000000000LL -#define jlong_ZERO 0x0LL - -#endif - -#define jlong_IS_ZERO(a) ((a) == 0) -#define jlong_EQ(a, b) ((a) == (b)) -#define jlong_NE(a, b) ((a) != (b)) -#define jlong_GE_ZERO(a) ((a) >= 0) -#define jlong_CMP(a, op, b) ((a) op (b)) - -#define jlong_AND(r, a, b) ((r) = (a) & (b)) -#define jlong_OR(r, a, b) ((r) = (a) | (b)) -#define jlong_XOR(r, a, b) ((r) = (a) ^ (b)) -#define jlong_OR2(r, a) ((r) = (r) | (a)) -#define jlong_NOT(r, a) ((r) = ~(a)) - -#define jlong_NEG(r, a) ((r) = -(a)) -#define jlong_ADD(r, a, b) ((r) = (a) + (b)) -#define jlong_SUB(r, a, b) ((r) = (a) - (b)) - -#define jlong_MUL(r, a, b) ((r) = (a) * (b)) -#define jlong_DIV(r, a, b) ((r) = (a) / (b)) -#define jlong_MOD(r, a, b) ((r) = (a) % (b)) - -#define jlong_SHL(r, a, b) ((r) = (a) << (b)) -#define jlong_SHR(r, a, b) ((r) = (a) >> (b)) -#define jlong_USHR(r, a, b) ((r) = (julong)(a) >> (b)) -#define jlong_ISHL(r, a, b) ((r) = ((jlong)(a)) << (b)) - -#define jlong_L2I(i, l) ((i) = (int)(l)) -#define jlong_L2UI(ui, l) ((ui) =(unsigned int)(l)) -#define jlong_L2F(f, l) ((f) = (l)) -#define jlong_L2D(d, l) ((d) = (l)) - -#define jlong_I2L(l, i) ((l) = (i)) -#define jlong_UI2L(l, ui) ((l) = (ui)) -#define jlong_F2L(l, f) ((l) = (f)) -#define jlong_D2L(l, d) ((l) = (d)) - -#define jlong_UDIVMOD(qp, rp, a, b) \ - (*(qp) = ((julong)(a) / (b)), \ - *(rp) = ((julong)(a) % (b))) - -#else /* !HAVE_LONG_LONG */ - -typedef struct { -#ifdef IS_LITTLE_ENDIAN - juint lo, hi; -#else - juint hi, lo; -#endif -} jlong; -typedef jlong julong; - -extern jlong jlong_MAXINT, jlong_MININT, jlong_ZERO; - -#define jlong_IS_ZERO(a) (((a).hi == 0) && ((a).lo == 0)) -#define jlong_EQ(a, b) (((a).hi == (b).hi) && ((a).lo == (b).lo)) -#define jlong_NE(a, b) (((a).hi != (b).hi) || ((a).lo != (b).lo)) -#define jlong_GE_ZERO(a) (((a).hi >> 31) == 0) - -/* - * NB: jlong_CMP and jlong_UCMP work only for strict relationals (<, >). - */ -#define jlong_CMP(a, op, b) (((int32)(a).hi op (int32)(b).hi) || \ - (((a).hi == (b).hi) && ((a).lo op (b).lo))) -#define jlong_UCMP(a, op, b) (((a).hi op (b).hi) || \ - (((a).hi == (b).hi) && ((a).lo op (b).lo))) - -#define jlong_AND(r, a, b) ((r).lo = (a).lo & (b).lo, \ - (r).hi = (a).hi & (b).hi) -#define jlong_OR(r, a, b) ((r).lo = (a).lo | (b).lo, \ - (r).hi = (a).hi | (b).hi) -#define jlong_XOR(r, a, b) ((r).lo = (a).lo ^ (b).lo, \ - (r).hi = (a).hi ^ (b).hi) -#define jlong_OR2(r, a) ((r).lo = (r).lo | (a).lo, \ - (r).hi = (r).hi | (a).hi) -#define jlong_NOT(r, a) ((r).lo = ~(a).lo, \ - (r).hi = ~(a).hi) - -#define jlong_NEG(r, a) ((r).lo = -(int32)(a).lo, \ - (r).hi = -(int32)(a).hi - ((r).lo != 0)) -#define jlong_ADD(r, a, b) { \ - jlong _a, _b; \ - _a = a; _b = b; \ - (r).lo = _a.lo + _b.lo; \ - (r).hi = _a.hi + _b.hi + ((r).lo < _b.lo); \ -} - -#define jlong_SUB(r, a, b) { \ - jlong _a, _b; \ - _a = a; _b = b; \ - (r).lo = _a.lo - _b.lo; \ - (r).hi = _a.hi - _b.hi - (_a.lo < _b.lo); \ -} \ - -/* - * Multiply 64-bit operands a and b to get 64-bit result r. - * First multiply the low 32 bits of a and b to get a 64-bit result in r. - * Then add the outer and inner products to r.hi. - */ -#define jlong_MUL(r, a, b) { \ - jlong _a, _b; \ - _a = a; _b = b; \ - jlong_MUL32(r, _a.lo, _b.lo); \ - (r).hi += _a.hi * _b.lo + _a.lo * _b.hi; \ -} - -/* XXX _jlong_lo16(a) = ((a) << 16 >> 16) is better on some archs (not on mips) */ -#define _jlong_lo16(a) ((a) & JRI_BITMASK(16)) -#define _jlong_hi16(a) ((a) >> 16) - -/* - * Multiply 32-bit operands a and b to get 64-bit result r. - * Use polynomial expansion based on primitive field element (1 << 16). - */ -#define jlong_MUL32(r, a, b) { \ - juint _a1, _a0, _b1, _b0, _y0, _y1, _y2, _y3; \ - _a1 = _jlong_hi16(a), _a0 = _jlong_lo16(a); \ - _b1 = _jlong_hi16(b), _b0 = _jlong_lo16(b); \ - _y0 = _a0 * _b0; \ - _y1 = _a0 * _b1; \ - _y2 = _a1 * _b0; \ - _y3 = _a1 * _b1; \ - _y1 += _jlong_hi16(_y0); /* can't carry */ \ - _y1 += _y2; /* might carry */ \ - if (_y1 < _y2) _y3 += 1 << 16; /* propagate */ \ - (r).lo = (_jlong_lo16(_y1) << 16) + _jlong_lo16(_y0); \ - (r).hi = _y3 + _jlong_hi16(_y1); \ -} - -/* - * Divide 64-bit unsigned operand a by 64-bit unsigned operand b, setting *qp - * to the 64-bit unsigned quotient, and *rp to the 64-bit unsigned remainder. - * Minimize effort if one of qp and rp is null. - */ -#define jlong_UDIVMOD(qp, rp, a, b) jlong_udivmod(qp, rp, a, b) - -extern JRI_PUBLIC_API(void) -jlong_udivmod(julong *qp, julong *rp, julong a, julong b); - -#define jlong_DIV(r, a, b) { \ - jlong _a, _b; \ - juint _negative = (int32)(a).hi < 0; \ - if (_negative) { \ - jlong_NEG(_a, a); \ - } else { \ - _a = a; \ - } \ - if ((int32)(b).hi < 0) { \ - _negative ^= 1; \ - jlong_NEG(_b, b); \ - } else { \ - _b = b; \ - } \ - jlong_UDIVMOD(&(r), 0, _a, _b); \ - if (_negative) \ - jlong_NEG(r, r); \ -} - -#define jlong_MOD(r, a, b) { \ - jlong _a, _b; \ - juint _negative = (int32)(a).hi < 0; \ - if (_negative) { \ - jlong_NEG(_a, a); \ - } else { \ - _a = a; \ - } \ - if ((int32)(b).hi < 0) { \ - jlong_NEG(_b, b); \ - } else { \ - _b = b; \ - } \ - jlong_UDIVMOD(0, &(r), _a, _b); \ - if (_negative) \ - jlong_NEG(r, r); \ -} - -/* - * NB: b is a juint, not jlong or julong, for the shift ops. - */ -#define jlong_SHL(r, a, b) { \ - if (b) { \ - jlong _a; \ - _a = a; \ - if ((b) < 32) { \ - (r).lo = _a.lo << (b); \ - (r).hi = (_a.hi << (b)) | (_a.lo >> (32 - (b))); \ - } else { \ - (r).lo = 0; \ - (r).hi = _a.lo << ((b) & 31); \ - } \ - } else { \ - (r) = (a); \ - } \ -} - -/* a is an int32, b is int32, r is jlong */ -#define jlong_ISHL(r, a, b) { \ - if (b) { \ - jlong _a; \ - _a.lo = (a); \ - _a.hi = 0; \ - if ((b) < 32) { \ - (r).lo = (a) << (b); \ - (r).hi = ((a) >> (32 - (b))); \ - } else { \ - (r).lo = 0; \ - (r).hi = (a) << ((b) & 31); \ - } \ - } else { \ - (r).lo = (a); \ - (r).hi = 0; \ - } \ -} - -#define jlong_SHR(r, a, b) { \ - if (b) { \ - jlong _a; \ - _a = a; \ - if ((b) < 32) { \ - (r).lo = (_a.hi << (32 - (b))) | (_a.lo >> (b)); \ - (r).hi = (int32)_a.hi >> (b); \ - } else { \ - (r).lo = (int32)_a.hi >> ((b) & 31); \ - (r).hi = (int32)_a.hi >> 31; \ - } \ - } else { \ - (r) = (a); \ - } \ -} - -#define jlong_USHR(r, a, b) { \ - if (b) { \ - jlong _a; \ - _a = a; \ - if ((b) < 32) { \ - (r).lo = (_a.hi << (32 - (b))) | (_a.lo >> (b)); \ - (r).hi = _a.hi >> (b); \ - } else { \ - (r).lo = _a.hi >> ((b) & 31); \ - (r).hi = 0; \ - } \ - } else { \ - (r) = (a); \ - } \ -} - -#define jlong_L2I(i, l) ((i) = (l).lo) -#define jlong_L2UI(ui, l) ((ui) = (l).lo) -#define jlong_L2F(f, l) { double _d; jlong_L2D(_d, l); (f) = (float) _d; } - -#define jlong_L2D(d, l) { \ - int32 _negative; \ - jlong _absval; \ - \ - _negative = (l).hi >> 31; \ - if (_negative) { \ - jlong_NEG(_absval, l); \ - } else { \ - _absval = l; \ - } \ - (d) = (double)_absval.hi * 4.294967296e9 + _absval.lo; \ - if (_negative) \ - (d) = -(d); \ -} - -#define jlong_I2L(l, i) ((l).hi = (i) >> 31, (l).lo = (i)) -#define jlong_UI2L(l, ui) ((l).hi = 0, (l).lo = (ui)) -#define jlong_F2L(l, f) { double _d = (double) f; jlong_D2L(l, _d); } - -#define jlong_D2L(l, d) { \ - int _negative; \ - double _absval, _d_hi; \ - jlong _lo_d; \ - \ - _negative = ((d) < 0); \ - _absval = _negative ? -(d) : (d); \ - \ - (l).hi = (juint)(_absval / 4.294967296e9); \ - (l).lo = 0; \ - jlong_L2D(_d_hi, l); \ - _absval -= _d_hi; \ - _lo_d.hi = 0; \ - if (_absval < 0) { \ - _lo_d.lo = (juint) -_absval; \ - jlong_SUB(l, l, _lo_d); \ - } else { \ - _lo_d.lo = (juint) _absval; \ - jlong_ADD(l, l, _lo_d); \ - } \ - \ - if (_negative) \ - jlong_NEG(l, l); \ -} - -#endif /* !HAVE_LONG_LONG */ - -/******************************************************************************/ - -#ifdef HAVE_ALIGNED_LONGLONGS -#define JRI_GET_INT64(_t,_addr) ( ((_t).x[0] = ((jint*)(_addr))[0]), \ - ((_t).x[1] = ((jint*)(_addr))[1]), \ - (_t).l ) -#define JRI_SET_INT64(_t, _addr, _v) ( (_t).l = (_v), \ - ((jint*)(_addr))[0] = (_t).x[0], \ - ((jint*)(_addr))[1] = (_t).x[1] ) -#else -#define JRI_GET_INT64(_t,_addr) (*(jlong*)(_addr)) -#define JRI_SET_INT64(_t, _addr, _v) (*(jlong*)(_addr) = (_v)) -#endif - -/* If double's must be aligned on doubleword boundaries then define this */ -#ifdef HAVE_ALIGNED_DOUBLES -#define JRI_GET_DOUBLE(_t,_addr) ( ((_t).x[0] = ((jint*)(_addr))[0]), \ - ((_t).x[1] = ((jint*)(_addr))[1]), \ - (_t).d ) -#define JRI_SET_DOUBLE(_t, _addr, _v) ( (_t).d = (_v), \ - ((jint*)(_addr))[0] = (_t).x[0], \ - ((jint*)(_addr))[1] = (_t).x[1] ) -#else -#define JRI_GET_DOUBLE(_t,_addr) (*(jdouble*)(_addr)) -#define JRI_SET_DOUBLE(_t, _addr, _v) (*(jdouble*)(_addr) = (_v)) -#endif - -/******************************************************************************/ -#ifdef __cplusplus -} -#endif -#endif /* JRI_MD_H */ -/******************************************************************************/ diff --git a/external/np_sdk/npsdk/jritypes.h b/external/np_sdk/npsdk/jritypes.h deleted file mode 100644 index 03a7a9dcfe41..000000000000 --- a/external/np_sdk/npsdk/jritypes.h +++ /dev/null @@ -1,232 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public 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.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -/******************************************************************************* - * Java Runtime Interface - ******************************************************************************/ - -#ifndef JRITYPES_H -#define JRITYPES_H - -#include "jri_md.h" -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * Types - ******************************************************************************/ - -struct JRIEnvInterface; - -typedef void* JRIRef; -typedef void* JRIGlobalRef; - -typedef jint JRIFieldID; -typedef jint JRIMethodID; - -/* synonyms: */ -typedef JRIGlobalRef jglobal; - -typedef union JRIValue { - jbool z; - jbyte b; - jchar c; - jshort s; - jint i; - jlong l; - jfloat f; - jdouble d; - jref r; -} JRIValue; - -typedef enum JRIBoolean { - JRIFalse = 0, - JRITrue = 1 -} JRIBoolean; - -typedef enum JRIConstant { - JRIUninitialized = -1 -} JRIConstant; - -/* convenience types (these must be distinct struct types for c++ overloading): */ - -typedef struct jstringArrayStruct* jstringArray; -typedef struct jarrayArrayStruct* jarrayArray; - -#define JRIConstructorMethodName "" - -/******************************************************************************* - * Signature Construction Macros - ******************************************************************************/ - -/* -** These macros can be used to construct signature strings. Hopefully their names -** are a little easier to remember than the single character they correspond to. -** For example, to specify the signature of the method: -** -** public int read(byte b[], int off, int len); -** -** you could write something like this in C: -** -** char* readSig = JRISigMethod(JRISigArray(JRISigByte) -** JRISigInt -** JRISigInt) JRISigInt; -** -** Of course, don't put commas between the types. -*/ -#define JRISigArray(T) "[" T -#define JRISigByte "B" -#define JRISigChar "C" -#define JRISigClass(name) "L" name ";" -#define JRISigFloat "F" -#define JRISigDouble "D" -#define JRISigMethod(args) "(" args ")" -#define JRISigNoArgs "" -#define JRISigInt "I" -#define JRISigLong "J" -#define JRISigShort "S" -#define JRISigVoid "V" -#define JRISigBoolean "Z" - -/******************************************************************************* - * Environments - ******************************************************************************/ - -extern JRI_PUBLIC_API(const struct JRIEnvInterface**) -JRI_GetCurrentEnv(void); - -/******************************************************************************* - * Specific Scalar Array Types - ******************************************************************************/ - -/* -** The JRI Native Method Interface does not support boolean arrays. This -** is to allow Java runtime implementations to optimize boolean array -** storage. Using the ScalarArray operations on boolean arrays is bound -** to fail, so convert any boolean arrays to byte arrays in Java before -** passing them to a native method. -*/ - -#define JRI_NewByteArray(env, length, initialValues) \ - JRI_NewScalarArray(env, length, JRISigByte, (jbyte*)(initialValues)) -#define JRI_GetByteArrayLength(env, array) \ - JRI_GetScalarArrayLength(env, array) -#define JRI_GetByteArrayElements(env, array) \ - JRI_GetScalarArrayElements(env, array) - -#define JRI_NewCharArray(env, length, initialValues) \ - JRI_NewScalarArray(env, ((length) * sizeof(jchar)), JRISigChar, (jbyte*)(initialValues)) -#define JRI_GetCharArrayLength(env, array) \ - JRI_GetScalarArrayLength(env, array) -#define JRI_GetCharArrayElements(env, array) \ - ((jchar*)JRI_GetScalarArrayElements(env, array)) - -#define JRI_NewShortArray(env, length, initialValues) \ - JRI_NewScalarArray(env, ((length) * sizeof(jshort)), JRISigShort, (jbyte*)(initialValues)) -#define JRI_GetShortArrayLength(env, array) \ - JRI_GetScalarArrayLength(env, array) -#define JRI_GetShortArrayElements(env, array) \ - ((jshort*)JRI_GetScalarArrayElements(env, array)) - -#define JRI_NewIntArray(env, length, initialValues) \ - JRI_NewScalarArray(env, ((length) * sizeof(jint)), JRISigInt, (jbyte*)(initialValues)) -#define JRI_GetIntArrayLength(env, array) \ - JRI_GetScalarArrayLength(env, array) -#define JRI_GetIntArrayElements(env, array) \ - ((jint*)JRI_GetScalarArrayElements(env, array)) - -#define JRI_NewLongArray(env, length, initialValues) \ - JRI_NewScalarArray(env, ((length) * sizeof(jlong)), JRISigLong, (jbyte*)(initialValues)) -#define JRI_GetLongArrayLength(env, array) \ - JRI_GetScalarArrayLength(env, array) -#define JRI_GetLongArrayElements(env, array) \ - ((jlong*)JRI_GetScalarArrayElements(env, array)) - -#define JRI_NewFloatArray(env, length, initialValues) \ - JRI_NewScalarArray(env, ((length) * sizeof(jfloat)), JRISigFloat, (jbyte*)(initialValues)) -#define JRI_GetFloatArrayLength(env, array) \ - JRI_GetScalarArrayLength(env, array) -#define JRI_GetFloatArrayElements(env, array) \ - ((jfloat*)JRI_GetScalarArrayElements(env, array)) - -#define JRI_NewDoubleArray(env, length, initialValues) \ - JRI_NewScalarArray(env, ((length) * sizeof(jdouble)), JRISigDouble, (jbyte*)(initialValues)) -#define JRI_GetDoubleArrayLength(env, array) \ - JRI_GetScalarArrayLength(env, array) -#define JRI_GetDoubleArrayElements(env, array) \ - ((jdouble*)JRI_GetScalarArrayElements(env, array)) - -/******************************************************************************/ -/* -** JDK Stuff -- This stuff is still needed while we're using the JDK -** dynamic linking strategy to call native methods. -*/ - -typedef union JRI_JDK_stack_item { - /* Non pointer items */ - jint i; - jfloat f; - jint o; - /* Pointer items */ - void *h; - void *p; - unsigned char *addr; -#ifdef IS_64 - double d; - long l; /* == 64bits! */ -#endif -} JRI_JDK_stack_item; - -typedef union JRI_JDK_Java8Str { - jint x[2]; - jdouble d; - jlong l; - void *p; - float f; -} JRI_JDK_Java8; - -/******************************************************************************/ -#ifdef __cplusplus -} -#endif -#endif /* JRITYPES_H */ -/******************************************************************************/ diff --git a/external/np_sdk/npsdk/npupp.h b/external/np_sdk/npsdk/npupp.h deleted file mode 100644 index e21475aabbe1..000000000000 --- a/external/np_sdk/npsdk/npupp.h +++ /dev/null @@ -1,1267 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public 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.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -/* - * function call mechanics needed by platform specific glue code. - */ - - -#ifndef _NPUPP_H_ -#define _NPUPP_H_ - -#ifndef GENERATINGCFM -#define GENERATINGCFM 0 -#endif - -#ifndef _NPAPI_H_ -#include "npapi.h" -#endif - -#include "jri.h" - -/****************************************************************************************** - plug-in function table macros - for each function in and out of the plugin API we define - typedef NPP_FooUPP - #define NewNPP_FooProc - #define CallNPP_FooProc - for mac, define the UPP magic for PPC/68K calling - *******************************************************************************************/ - - -/* NPP_Initialize */ - -#ifndef TARGET_RT_MAC_CFM -#define TARGET_RT_MAC_CFM 0 -#endif - -#define _NPUPP_USE_UPP_ (TARGET_RT_MAC_CFM && !TARGET_API_MAC_CARBON) - -#if _NPUPP_USE_UPP_ -typedef UniversalProcPtr NPP_InitializeUPP; - -enum { - uppNPP_InitializeProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0)) - | RESULT_SIZE(SIZE_CODE(0)) -}; - -#define NewNPP_InitializeProc(FUNC) \ - (NPP_InitializeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_InitializeProcInfo, GetCurrentArchitecture()) -#define CallNPP_InitializeProc(FUNC) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_InitializeProcInfo) - -#else - -typedef void (* NP_LOADDS NPP_InitializeUPP)(void); -#define NewNPP_InitializeProc(FUNC) \ - ((NPP_InitializeUPP) (FUNC)) -#define CallNPP_InitializeProc(FUNC) \ - (*(FUNC))() - -#endif - - -/* NPP_Shutdown */ - -#if _NPUPP_USE_UPP_ -typedef UniversalProcPtr NPP_ShutdownUPP; - -enum { - uppNPP_ShutdownProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0)) - | RESULT_SIZE(SIZE_CODE(0)) -}; - -#define NewNPP_ShutdownProc(FUNC) \ - (NPP_ShutdownUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_ShutdownProcInfo, GetCurrentArchitecture()) -#define CallNPP_ShutdownProc(FUNC) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_ShutdownProcInfo) - -#else - -typedef void (* NP_LOADDS NPP_ShutdownUPP)(void); -#define NewNPP_ShutdownProc(FUNC) \ - ((NPP_ShutdownUPP) (FUNC)) -#define CallNPP_ShutdownProc(FUNC) \ - (*(FUNC))() - -#endif - - -/* NPP_New */ - -#if _NPUPP_USE_UPP_ -typedef UniversalProcPtr NPP_NewUPP; - -enum { - uppNPP_NewProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPMIMEType))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(uint16_t))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int16_t))) - | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(char **))) - | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(char **))) - | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(NPSavedData *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; - -#define NewNPP_NewProc(FUNC) \ - (NPP_NewUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewProcInfo, GetCurrentArchitecture()) -#define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewProcInfo, \ - (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7)) -#else - -typedef NPError (* NP_LOADDS NPP_NewUPP)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); -#define NewNPP_NewProc(FUNC) \ - ((NPP_NewUPP) (FUNC)) -#define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \ - (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7)) - -#endif - - -/* NPP_Destroy */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPP_DestroyUPP; -enum { - uppNPP_DestroyProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPSavedData **))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_DestroyProc(FUNC) \ - (NPP_DestroyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyProcInfo, GetCurrentArchitecture()) -#define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyProcInfo, (ARG1), (ARG2)) -#else - -typedef NPError (* NP_LOADDS NPP_DestroyUPP)(NPP instance, NPSavedData** save); -#define NewNPP_DestroyProc(FUNC) \ - ((NPP_DestroyUPP) (FUNC)) -#define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \ - (*(FUNC))((ARG1), (ARG2)) - -#endif - - -/* NPP_SetWindow */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPP_SetWindowUPP; -enum { - uppNPP_SetWindowProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPWindow *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_SetWindowProc(FUNC) \ - (NPP_SetWindowUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_SetWindowProcInfo, GetCurrentArchitecture()) -#define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_SetWindowProcInfo, (ARG1), (ARG2)) - -#else - -typedef NPError (* NP_LOADDS NPP_SetWindowUPP)(NPP instance, NPWindow* window); -#define NewNPP_SetWindowProc(FUNC) \ - ((NPP_SetWindowUPP) (FUNC)) -#define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \ - (*(FUNC))((ARG1), (ARG2)) - -#endif - - -/* NPP_NewStream */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPP_NewStreamUPP; -enum { - uppNPP_NewStreamProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPBool))) - | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(uint16_t *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_NewStreamProc(FUNC) \ - (NPP_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewStreamProcInfo, GetCurrentArchitecture()) -#define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewStreamProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5)) -#else - -typedef NPError (* NP_LOADDS NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype); -#define NewNPP_NewStreamProc(FUNC) \ - ((NPP_NewStreamUPP) (FUNC)) -#define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \ - (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5)) -#endif - - -/* NPP_DestroyStream */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPP_DestroyStreamUPP; -enum { - uppNPP_DestroyStreamProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_DestroyStreamProc(FUNC) \ - (NPP_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, GetCurrentArchitecture()) -#define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPReasonArg) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, (NPParg), (NPStreamPtr), (NPReasonArg)) - -#else - -typedef NPError (* NP_LOADDS NPP_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason); -#define NewNPP_DestroyStreamProc(FUNC) \ - ((NPP_DestroyStreamUPP) (FUNC)) -#define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPReasonArg) \ - (*(FUNC))((NPParg), (NPStreamPtr), (NPReasonArg)) - -#endif - - -/* NPP_WriteReady */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPP_WriteReadyUPP; -enum { - uppNPP_WriteReadyProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | RESULT_SIZE(SIZE_CODE(sizeof(int32_t))) -}; -#define NewNPP_WriteReadyProc(FUNC) \ - (NPP_WriteReadyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, GetCurrentArchitecture()) -#define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \ - (int32_t)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, (NPParg), (NPStreamPtr)) - -#else - -typedef int32_t (* NP_LOADDS NPP_WriteReadyUPP)(NPP instance, NPStream* stream); -#define NewNPP_WriteReadyProc(FUNC) \ - ((NPP_WriteReadyUPP) (FUNC)) -#define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \ - (*(FUNC))((NPParg), (NPStreamPtr)) - -#endif - - -/* NPP_Write */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPP_WriteUPP; -enum { - uppNPP_WriteProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32_t))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int32_t))) - | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(void*))) - | RESULT_SIZE(SIZE_CODE(sizeof(int32_t))) -}; -#define NewNPP_WriteProc(FUNC) \ - (NPP_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteProcInfo, GetCurrentArchitecture()) -#define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \ - (int32_t)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteProcInfo, (NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr)) - -#else - -typedef int32_t (* NP_LOADDS NPP_WriteUPP)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer); -#define NewNPP_WriteProc(FUNC) \ - ((NPP_WriteUPP) (FUNC)) -#define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \ - (*(FUNC))((NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr)) - -#endif - - -/* NPP_StreamAsFile */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPP_StreamAsFileUPP; -enum { - uppNPP_StreamAsFileProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char *))) - | RESULT_SIZE(SIZE_CODE(0)) -}; -#define NewNPP_StreamAsFileProc(FUNC) \ - (NPP_StreamAsFileUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, GetCurrentArchitecture()) -#define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, (ARG1), (ARG2), (ARG3)) - -#else - -typedef void (* NP_LOADDS NPP_StreamAsFileUPP)(NPP instance, NPStream* stream, const char* fname); -#define NewNPP_StreamAsFileProc(FUNC) \ - ((NPP_StreamAsFileUPP) (FUNC)) -#define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \ - (*(FUNC))((ARG1), (ARG2), (ARG3)) -#endif - - -/* NPP_Print */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPP_PrintUPP; -enum { - uppNPP_PrintProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPrint *))) - | RESULT_SIZE(SIZE_CODE(0)) -}; -#define NewNPP_PrintProc(FUNC) \ - (NPP_PrintUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_PrintProcInfo, GetCurrentArchitecture()) -#define CallNPP_PrintProc(FUNC, NPParg, voidPtr) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_PrintProcInfo, (NPParg), (voidPtr)) - -#else - -typedef void (* NP_LOADDS NPP_PrintUPP)(NPP instance, NPPrint* platformPrint); -#define NewNPP_PrintProc(FUNC) \ - ((NPP_PrintUPP) (FUNC)) -#define CallNPP_PrintProc(FUNC, NPParg, NPPrintArg) \ - (*(FUNC))((NPParg), (NPPrintArg)) - -#endif - - -/* NPP_HandleEvent */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPP_HandleEventUPP; -enum { - uppNPP_HandleEventProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void *))) - | RESULT_SIZE(SIZE_CODE(sizeof(int16_t))) -}; -#define NewNPP_HandleEventProc(FUNC) \ - (NPP_HandleEventUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_HandleEventProcInfo, GetCurrentArchitecture()) -#define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \ - (int16_t)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_HandleEventProcInfo, (NPParg), (voidPtr)) - -#else - -typedef int16_t (* NP_LOADDS NPP_HandleEventUPP)(NPP instance, void* event); -#define NewNPP_HandleEventProc(FUNC) \ - ((NPP_HandleEventUPP) (FUNC)) -#define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \ - (*(FUNC))((NPParg), (voidPtr)) - -#endif - - -/* NPP_URLNotify */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPP_URLNotifyUPP; -enum { - uppNPP_URLNotifyProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*))) - | RESULT_SIZE(SIZE_CODE(SIZE_CODE(0))) -}; -#define NewNPP_URLNotifyProc(FUNC) \ - (NPP_URLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_URLNotifyProcInfo, GetCurrentArchitecture()) -#define CallNPP_URLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_URLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4)) - -#else - -typedef void (* NP_LOADDS NPP_URLNotifyUPP)(NPP instance, const char* url, NPReason reason, void* notifyData); -#define NewNPP_URLNotifyProc(FUNC) \ - ((NPP_URLNotifyUPP) (FUNC)) -#define CallNPP_URLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \ - (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4)) - -#endif - - -/* NPP_GetValue */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPP_GetValueUPP; -enum { - uppNPP_GetValueProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPVariable))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_GetValueProc(FUNC) \ - (NPP_GetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_GetValueProcInfo, GetCurrentArchitecture()) -#define CallNPP_GetValueProc(FUNC, ARG1, ARG2, ARG3) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_GetValueProcInfo, (ARG1), (ARG2), (ARG3)) -#else - -typedef NPError (* NP_LOADDS NPP_GetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue); -#define NewNPP_GetValueProc(FUNC) \ - ((NPP_GetValueUPP) (FUNC)) -#define CallNPP_GetValueProc(FUNC, ARG1, ARG2, ARG3) \ - (*(FUNC))((ARG1), (ARG2), (ARG3)) -#endif - - -/* NPP_SetValue */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPP_SetValueUPP; -enum { - uppNPP_SetValueProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPNVariable))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_SetValueProc(FUNC) \ - (NPP_SetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_SetValueProcInfo, GetCurrentArchitecture()) -#define CallNPP_SetValueProc(FUNC, ARG1, ARG2, ARG3) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_SetValueProcInfo, (ARG1), (ARG2), (ARG3)) -#else - -typedef NPError (* NP_LOADDS NPP_SetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue); -#define NewNPP_SetValueProc(FUNC) \ - ((NPP_SetValueUPP) (FUNC)) -#define CallNPP_SetValueProc(FUNC, ARG1, ARG2, ARG3) \ - (*(FUNC))((ARG1), (ARG2), (ARG3)) -#endif - - - - -/* - * Netscape entry points - */ - - -/* NPN_GetValue */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_GetValueUPP; -enum { - uppNPN_GetValueProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPNVariable))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_GetValueProc(FUNC) \ - (NPN_GetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetValueProcInfo, GetCurrentArchitecture()) -#define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetValueProcInfo, (ARG1), (ARG2), (ARG3)) -#else - -typedef NPError (* NP_LOADDS NPN_GetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue); -#define NewNPN_GetValueProc(FUNC) \ - ((NPN_GetValueUPP) (FUNC)) -#define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \ - (*(FUNC))((ARG1), (ARG2), (ARG3)) -#endif - - -/* NPN_SetValue */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_SetValueUPP; -enum { - uppNPN_SetValueProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPVariable))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_SetValueProc(FUNC) \ - (NPN_SetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_SetValueProcInfo, GetCurrentArchitecture()) -#define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_SetValueProcInfo, (ARG1), (ARG2), (ARG3)) -#else - -typedef NPError (* NP_LOADDS NPN_SetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue); -#define NewNPN_SetValueProc(FUNC) \ - ((NPN_SetValueUPP) (FUNC)) -#define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3) \ - (*(FUNC))((ARG1), (ARG2), (ARG3)) -#endif - - -/* NPN_GetUrlNotify */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_GetURLNotifyUPP; -enum { - uppNPN_GetURLNotifyProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_GetURLNotifyProc(FUNC) \ - (NPN_GetURLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetURLNotifyProcInfo, GetCurrentArchitecture()) -#define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetURLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4)) -#else - -typedef NPError (* NP_LOADDS NPN_GetURLNotifyUPP)(NPP instance, const char* url, const char* window, void* notifyData); -#define NewNPN_GetURLNotifyProc(FUNC) \ - ((NPN_GetURLNotifyUPP) (FUNC)) -#define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \ - (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4)) -#endif - - -/* NPN_PostUrlNotify */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_PostURLNotifyUPP; -enum { - uppNPN_PostURLNotifyProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32_t))) - | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool))) - | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(void*))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_PostURLNotifyProc(FUNC) \ - (NPN_PostURLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PostURLNotifyProcInfo, GetCurrentArchitecture()) -#define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7)) -#else - -typedef NPError (* NP_LOADDS NPN_PostURLNotifyUPP)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData); -#define NewNPN_PostURLNotifyProc(FUNC) \ - ((NPN_PostURLNotifyUPP) (FUNC)) -#define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \ - (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7)) -#endif - - -/* NPN_GetUrl */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_GetURLUPP; -enum { - uppNPN_GetURLProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_GetURLProc(FUNC) \ - (NPN_GetURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetURLProcInfo, GetCurrentArchitecture()) -#define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetURLProcInfo, (ARG1), (ARG2), (ARG3)) -#else - -typedef NPError (* NP_LOADDS NPN_GetURLUPP)(NPP instance, const char* url, const char* window); -#define NewNPN_GetURLProc(FUNC) \ - ((NPN_GetURLUPP) (FUNC)) -#define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \ - (*(FUNC))((ARG1), (ARG2), (ARG3)) -#endif - - -/* NPN_PostUrl */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_PostURLUPP; -enum { - uppNPN_PostURLProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32_t))) - | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_PostURLProc(FUNC) \ - (NPN_PostURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PostURLProcInfo, GetCurrentArchitecture()) -#define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6)) -#else - -typedef NPError (* NP_LOADDS NPN_PostURLUPP)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file); -#define NewNPN_PostURLProc(FUNC) \ - ((NPN_PostURLUPP) (FUNC)) -#define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \ - (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6)) -#endif - - -/* NPN_RequestRead */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_RequestReadUPP; -enum { - uppNPN_RequestReadProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPByteRange *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_RequestReadProc(FUNC) \ - (NPN_RequestReadUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_RequestReadProcInfo, GetCurrentArchitecture()) -#define CallNPN_RequestReadProc(FUNC, stream, range) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_RequestReadProcInfo, (stream), (range)) - -#else - -typedef NPError (* NP_LOADDS NPN_RequestReadUPP)(NPStream* stream, NPByteRange* rangeList); -#define NewNPN_RequestReadProc(FUNC) \ - ((NPN_RequestReadUPP) (FUNC)) -#define CallNPN_RequestReadProc(FUNC, stream, range) \ - (*(FUNC))((stream), (range)) - -#endif - - -/* NPN_NewStream */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_NewStreamUPP; -enum { - uppNPN_NewStreamProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char *))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPStream **))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_NewStreamProc(FUNC) \ - (NPN_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_NewStreamProcInfo, GetCurrentArchitecture()) -#define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_NewStreamProcInfo, (npp), (type), (window), (stream)) - -#else - -typedef NPError (* NP_LOADDS NPN_NewStreamUPP)(NPP instance, NPMIMEType type, const char* window, NPStream** stream); -#define NewNPN_NewStreamProc(FUNC) \ - ((NPN_NewStreamUPP) (FUNC)) -#define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \ - (*(FUNC))((npp), (type), (window), (stream)) - -#endif - - -/* NPN_Write */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_WriteUPP; -enum { - uppNPN_WriteProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32_t))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*))) - | RESULT_SIZE(SIZE_CODE(sizeof(int32_t))) -}; -#define NewNPN_WriteProc(FUNC) \ - (NPN_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_WriteProcInfo, GetCurrentArchitecture()) -#define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \ - (int32_t)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_WriteProcInfo, (npp), (stream), (len), (buffer)) - -#else - -typedef int32_t (* NP_LOADDS NPN_WriteUPP)(NPP instance, NPStream* stream, int32_t len, void* buffer); -#define NewNPN_WriteProc(FUNC) \ - ((NPN_WriteUPP) (FUNC)) -#define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \ - (*(FUNC))((npp), (stream), (len), (buffer)) - -#endif - - -/* NPN_DestroyStream */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_DestroyStreamUPP; -enum { - uppNPN_DestroyStreamProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP ))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_DestroyStreamProc(FUNC) \ - (NPN_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, GetCurrentArchitecture()) -#define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, (npp), (stream), (reason)) - -#else - -typedef NPError (* NP_LOADDS NPN_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason); -#define NewNPN_DestroyStreamProc(FUNC) \ - ((NPN_DestroyStreamUPP) (FUNC)) -#define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \ - (*(FUNC))((npp), (stream), (reason)) - -#endif - - -/* NPN_Status */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_StatusUPP; -enum { - uppNPN_StatusProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char *))) -}; - -#define NewNPN_StatusProc(FUNC) \ - (NPN_StatusUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_StatusProcInfo, GetCurrentArchitecture()) -#define CallNPN_StatusProc(FUNC, npp, msg) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_StatusProcInfo, (npp), (msg)) - -#else - -typedef void (* NP_LOADDS NPN_StatusUPP)(NPP instance, const char* message); -#define NewNPN_StatusProc(FUNC) \ - ((NPN_StatusUPP) (FUNC)) -#define CallNPN_StatusProc(FUNC, npp, msg) \ - (*(FUNC))((npp), (msg)) - -#endif - - -/* NPN_UserAgent */ -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_UserAgentUPP; -enum { - uppNPN_UserAgentProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | RESULT_SIZE(SIZE_CODE(sizeof(const char *))) -}; - -#define NewNPN_UserAgentProc(FUNC) \ - (NPN_UserAgentUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_UserAgentProcInfo, GetCurrentArchitecture()) -#define CallNPN_UserAgentProc(FUNC, ARG1) \ - (const char*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_UserAgentProcInfo, (ARG1)) - -#else - -typedef const char* (* NP_LOADDS NPN_UserAgentUPP)(NPP instance); -#define NewNPN_UserAgentProc(FUNC) \ - ((NPN_UserAgentUPP) (FUNC)) -#define CallNPN_UserAgentProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - -/* NPN_MemAlloc */ -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_MemAllocUPP; -enum { - uppNPN_MemAllocProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32_t))) - | RESULT_SIZE(SIZE_CODE(sizeof(void *))) -}; - -#define NewNPN_MemAllocProc(FUNC) \ - (NPN_MemAllocUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemAllocProcInfo, GetCurrentArchitecture()) -#define CallNPN_MemAllocProc(FUNC, ARG1) \ - (void*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemAllocProcInfo, (ARG1)) - -#else - -typedef void* (* NP_LOADDS NPN_MemAllocUPP)(uint32_t size); -#define NewNPN_MemAllocProc(FUNC) \ - ((NPN_MemAllocUPP) (FUNC)) -#define CallNPN_MemAllocProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - -/* NPN__MemFree */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_MemFreeUPP; -enum { - uppNPN_MemFreeProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(void *))) -}; - -#define NewNPN_MemFreeProc(FUNC) \ - (NPN_MemFreeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFreeProcInfo, GetCurrentArchitecture()) -#define CallNPN_MemFreeProc(FUNC, ARG1) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFreeProcInfo, (ARG1)) - -#else - -typedef void (* NP_LOADDS NPN_MemFreeUPP)(void* ptr); -#define NewNPN_MemFreeProc(FUNC) \ - ((NPN_MemFreeUPP) (FUNC)) -#define CallNPN_MemFreeProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - -/* NPN_MemFlush */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_MemFlushUPP; -enum { - uppNPN_MemFlushProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32_t))) - | RESULT_SIZE(SIZE_CODE(sizeof(uint32_t))) -}; - -#define NewNPN_MemFlushProc(FUNC) \ - (NPN_MemFlushUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFlushProcInfo, GetCurrentArchitecture()) -#define CallNPN_MemFlushProc(FUNC, ARG1) \ - (uint32_t)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFlushProcInfo, (ARG1)) - -#else - -typedef uint32_t (* NP_LOADDS NPN_MemFlushUPP)(uint32_t size); -#define NewNPN_MemFlushProc(FUNC) \ - ((NPN_MemFlushUPP) (FUNC)) -#define CallNPN_MemFlushProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - - -/* NPN_ReloadPlugins */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_ReloadPluginsUPP; -enum { - uppNPN_ReloadPluginsProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPBool))) - | RESULT_SIZE(SIZE_CODE(0)) -}; - -#define NewNPN_ReloadPluginsProc(FUNC) \ - (NPN_ReloadPluginsUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, GetCurrentArchitecture()) -#define CallNPN_ReloadPluginsProc(FUNC, ARG1) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, (ARG1)) - -#else - -typedef void (* NP_LOADDS NPN_ReloadPluginsUPP)(NPBool reloadPages); -#define NewNPN_ReloadPluginsProc(FUNC) \ - ((NPN_ReloadPluginsUPP) (FUNC)) -#define CallNPN_ReloadPluginsProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - -/* NPN_GetJavaEnv */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_GetJavaEnvUPP; -enum { - uppNPN_GetJavaEnvProcInfo = kThinkCStackBased - | RESULT_SIZE(SIZE_CODE(sizeof(JRIEnv*))) -}; - -#define NewNPN_GetJavaEnvProc(FUNC) \ - (NPN_GetJavaEnvUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetJavaEnvProcInfo, GetCurrentArchitecture()) -#define CallNPN_GetJavaEnvProc(FUNC) \ - (JRIEnv*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetJavaEnvProcInfo) - -#else -typedef JRIEnv* (* NP_LOADDS NPN_GetJavaEnvUPP)(void); -#define NewNPN_GetJavaEnvProc(FUNC) \ - ((NPN_GetJavaEnvUPP) (FUNC)) -#define CallNPN_GetJavaEnvProc(FUNC) \ - (*(FUNC))() - -#endif - - -/* NPN_GetJavaPeer */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_GetJavaPeerUPP; -enum { - uppNPN_GetJavaPeerProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | RESULT_SIZE(SIZE_CODE(sizeof(jref))) -}; - -#define NewNPN_GetJavaPeerProc(FUNC) \ - (NPN_GetJavaPeerUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetJavaPeerProcInfo, GetCurrentArchitecture()) -#define CallNPN_GetJavaPeerProc(FUNC, ARG1) \ - (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetJavaPeerProcInfo, (ARG1)) - -#else - -typedef jref (* NP_LOADDS NPN_GetJavaPeerUPP)(NPP instance); -#define NewNPN_GetJavaPeerProc(FUNC) \ - ((NPN_GetJavaPeerUPP) (FUNC)) -#define CallNPN_GetJavaPeerProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - -/* NPN_InvalidateRect */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_InvalidateRectUPP; -enum { - uppNPN_InvalidateRectProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPRect *))) - | RESULT_SIZE(SIZE_CODE(0)) -}; - -#define NewNPN_InvalidateRectProc(FUNC) \ - (NPN_InvalidateRectUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_InvalidateRectProcInfo, GetCurrentArchitecture()) -#define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_InvalidateRectProcInfo, (ARG1), (ARG2)) - -#else - -typedef void (* NP_LOADDS NPN_InvalidateRectUPP)(NPP instance, NPRect *rect); -#define NewNPN_InvalidateRectProc(FUNC) \ - ((NPN_InvalidateRectUPP) (FUNC)) -#define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2) \ - (*(FUNC))((ARG1), (ARG2)) - -#endif - - -/* NPN_InvalidateRegion */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_InvalidateRegionUPP; -enum { - uppNPN_InvalidateRegionProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPRegion))) - | RESULT_SIZE(SIZE_CODE(0)) -}; - -#define NewNPN_InvalidateRegionProc(FUNC) \ - (NPN_InvalidateRegionUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_InvalidateRegionProcInfo, GetCurrentArchitecture()) -#define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_InvalidateRegionProcInfo, (ARG1), (ARG2)) - -#else - -typedef void (* NP_LOADDS NPN_InvalidateRegionUPP)(NPP instance, NPRegion region); -#define NewNPN_InvalidateRegionProc(FUNC) \ - ((NPN_InvalidateRegionUPP) (FUNC)) -#define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2) \ - (*(FUNC))((ARG1), (ARG2)) - -#endif - -/* NPN_ForceRedraw */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPN_ForceRedrawUPP; -enum { - uppNPN_ForceRedrawProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | RESULT_SIZE(SIZE_CODE(sizeof(0))) -}; - -#define NewNPN_ForceRedrawProc(FUNC) \ - (NPN_ForceRedrawUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_ForceRedrawProcInfo, GetCurrentArchitecture()) -#define CallNPN_ForceRedrawProc(FUNC, ARG1) \ - (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_ForceRedrawProcInfo, (ARG1)) - -#else - -typedef void (* NP_LOADDS NPN_ForceRedrawUPP)(NPP instance); -#define NewNPN_ForceRedrawProc(FUNC) \ - ((NPN_ForceRedrawUPP) (FUNC)) -#define CallNPN_ForceRedrawProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - -/****************************************************************************************** - * The actual plugin function table definitions - *******************************************************************************************/ - -#ifdef XP_MAC -#if PRAGMA_STRUCT_ALIGN -#pragma options align=mac68k -#endif -#endif - -typedef struct _NPPluginFuncs { - uint16_t size; - uint16_t version; - NPP_NewUPP newp; - NPP_DestroyUPP destroy; - NPP_SetWindowUPP setwindow; - NPP_NewStreamUPP newstream; - NPP_DestroyStreamUPP destroystream; - NPP_StreamAsFileUPP asfile; - NPP_WriteReadyUPP writeready; - NPP_WriteUPP write; - NPP_PrintUPP print; - NPP_HandleEventUPP event; - NPP_URLNotifyUPP urlnotify; - JRIGlobalRef javaClass; - NPP_GetValueUPP getvalue; - NPP_SetValueUPP setvalue; -} NPPluginFuncs; - -typedef struct _NPNetscapeFuncs { - uint16_t size; - uint16_t version; - NPN_GetURLUPP geturl; - NPN_PostURLUPP posturl; - NPN_RequestReadUPP requestread; - NPN_NewStreamUPP newstream; - NPN_WriteUPP write; - NPN_DestroyStreamUPP destroystream; - NPN_StatusUPP status; - NPN_UserAgentUPP uagent; - NPN_MemAllocUPP memalloc; - NPN_MemFreeUPP memfree; - NPN_MemFlushUPP memflush; - NPN_ReloadPluginsUPP reloadplugins; - NPN_GetJavaEnvUPP getJavaEnv; - NPN_GetJavaPeerUPP getJavaPeer; - NPN_GetURLNotifyUPP geturlnotify; - NPN_PostURLNotifyUPP posturlnotify; - NPN_GetValueUPP getvalue; - NPN_SetValueUPP setvalue; - NPN_InvalidateRectUPP invalidaterect; - NPN_InvalidateRegionUPP invalidateregion; - NPN_ForceRedrawUPP forceredraw; -} NPNetscapeFuncs; - -#ifdef XP_MAC -#if PRAGMA_STRUCT_ALIGN -#pragma options align=reset -#endif -#endif - - -#ifdef XP_MAC -/****************************************************************************************** - * Mac platform-specific plugin glue stuff - *******************************************************************************************/ - -/* - * Main entry point of the plugin. - * This routine will be called when the plugin is loaded. The function - * tables are passed in and the plugin fills in the NPPluginFuncs table - * and NPPShutdownUPP for Netscape's use. - */ - -#if _NPUPP_USE_UPP_ - -typedef UniversalProcPtr NPP_MainEntryUPP; -enum { - uppNPP_MainEntryProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPNetscapeFuncs*))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPluginFuncs*))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPP_ShutdownUPP*))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_MainEntryProc(FUNC) \ - (NPP_MainEntryUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_MainEntryProcInfo, GetCurrentArchitecture()) -#define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \ - CallUniversalProc((UniversalProcPtr)(FUNC), (ProcInfoType)uppNPP_MainEntryProcInfo, (netscapeFunc), (pluginFunc), (shutdownUPP)) - -#else - -typedef NPError (* NP_LOADDS NPP_MainEntryUPP)(NPNetscapeFuncs*, NPPluginFuncs*, NPP_ShutdownUPP*); -#define NewNPP_MainEntryProc(FUNC) \ - ((NPP_MainEntryUPP) (FUNC)) -#define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \ - (*(FUNC))((netscapeFunc), (pluginFunc), (shutdownUPP)) - -#endif - - -/* - * Mac version(s) of NP_GetMIMEDescription(const char *) - * These can be called to retrieve MIME information from the plugin dynamically - * - * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way - * to get mime info from the plugin only on OSX and may not be supported - * in future version--use NP_GetMIMEDescription instead - */ - -enum -{ - kBPSupportedMIMETypesStructVers_1 = 1 -}; - -typedef struct _BPSupportedMIMETypes -{ - SInt32 structVersion; // struct version - Handle typeStrings; // STR# formatted handle, allocated by plug-in - Handle infoStrings; // STR# formatted handle, allocated by plug-in -} BPSupportedMIMETypes; -OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags); - -#if _NPUPP_USE_UPP_ - -#define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescriptionRD" -typedef UniversalProcPtr NP_GetMIMEDescriptionUPP; -enum { - uppNP_GetMIMEDescEntryProc = kThinkCStackBased - | RESULT_SIZE(SIZE_CODE(sizeof(const char *))) -}; -#define NewNP_GetMIMEDescEntryProc(FUNC) \ - (NP_GetMIMEDescriptionUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNP_GetMIMEDescEntryProc, GetCurrentArchitecture()) -#define CallNP_GetMIMEDescEntryProc(FUNC) \ - (const char *)CallUniversalProc((UniversalProcPtr)(FUNC), (ProcInfoType)uppNP_GetMIMEDescEntryProc) - - -#else // !_NPUPP_USE_UPP_ - - // NP_GetMIMEDescription -#define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription" -typedef const char* (* NP_LOADDS NP_GetMIMEDescriptionUPP)(); -#define NewNP_GetMIMEDescEntryProc(FUNC) \ - ((NP_GetMIMEDescriptionUPP) (FUNC)) -#define CallNP_GetMIMEDescEntryProc(FUNC) \ - (*(FUNC))() -// BP_GetSupportedMIMETypes -typedef OSErr (* NP_LOADDS BP_GetSupportedMIMETypesUPP)(BPSupportedMIMETypes*, UInt32); -#define NewBP_GetSupportedMIMETypesEntryProc(FUNC) \ - ((BP_GetSupportedMIMETypesUPP) (FUNC)) -#define CallBP_GetMIMEDescEntryProc(FUNC, mimeInfo, flags) \ - (*(FUNC))((mimeInfo), (flags)) - -#endif -#endif /* MAC */ - -#if defined(_WINDOWS) -#define OSCALL WINAPI -#else -#define OSCALL -#endif - -#if defined( _WINDOWS ) - -#ifdef __cplusplus -extern "C" { -#endif - -/* plugin meta member functions */ - -NPError WINAPI NP_GetEntryPoints(NPPluginFuncs* pFuncs); - -NPError WINAPI NP_Initialize(NPNetscapeFuncs *aNPNFuncs); - -void WINAPI NP_Shutdown(); - -char* NP_GetMIMEDescription(); - -#ifdef __cplusplus -} -#endif - -#endif /* _WINDOWS */ - -#ifdef XP_UNIX - -#ifdef __cplusplus -extern "C" { -#endif - -/* plugin meta member functions */ - -char* NP_GetMIMEDescription(void); -NPError NP_Initialize(NPNetscapeFuncs *aNPNFuncs, NPPluginFuncs *aNPPFuncs); -void NP_Shutdown(void); - -#ifdef __cplusplus -} -#endif - -#endif /* XP_UNIX */ - -#endif /* _NPUPP_H_ */ diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index c8880078ed6f..cd23fbf97c72 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -270,9 +270,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/packages/manifest $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/packages/zip,\ ZipFileAccess \ )) -$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/plugin,\ - PluginManager \ -)) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/presentation,\ SlideShow \ TransitionFactory \ @@ -2898,11 +2895,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/mozilla,\ XMenuProxy \ XMenuProxyListener \ XMozillaBootstrap \ - XPluginInstance \ - XPluginInstanceNotifySink \ - XPluginInstancePeer \ - XPluginInstanceSyncPeer \ - XPluginWindowPeer \ XProfileDiscover \ XProfileManager \ XProxyRunner \ @@ -2932,15 +2924,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/packages/zip,\ ZipException \ ZipIOException \ )) -$(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/plugin,\ - PluginDescription \ - PluginException \ - PluginMode \ - PluginVariable \ - XPlugin \ - XPluginContext \ - XPluginManager \ -)) $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/presentation,\ AnimationEffect \ AnimationSpeed \ diff --git a/offapi/com/sun/star/mozilla/XPluginInstance.idl b/offapi/com/sun/star/mozilla/XPluginInstance.idl deleted file mode 100644 index 82f94a52e768..000000000000 --- a/offapi/com/sun/star/mozilla/XPluginInstance.idl +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef __com_sun_star_mozilla_XPluginInstance_idl__ -#define __com_sun_star_mozilla_XPluginInstance_idl__ - -#include -#include - - - module com { module sun { module star { module mozilla { - - -/** Allows to control an office side plugin instance and to communicate with it. - This interface is oriented for communication with browsers plugins. - */ -published interface XPluginInstance: com::sun::star::uno::XInterface -{ - - /** Starts plugin operation. This is called after a plugin instance is - created. - */ - void start(); - - - /** Stops plugin operation. This is called when the user goes to another web - page. The XPluginInstance::destroy() method is directly called - afterwards. - */ - void stop(); - - - /** Destroy the plugin instance. This method is called when it is no - longer possible to return to the plugin instance, because it was - destroyed by the browser (e.g., window close). - */ - void destroy(); - - - /** Creates a new window for plugin operation. - - @param PlatformParentData [in]: platform dependent window data - @param embedded [in]: selects embedded or full page plugin mode - - */ - void createWindow( [in] any PlatformParentData, [in] boolean embedded ); - - - /** Notifies the plugin of a new stream to display. - - @param MIMEDesc [in]: the MIMEtype of the data stream - @param theURL [in]: the URL that denotes the stream - @param filter [in]: a filter string to suggest a component that should handle the document - @param stream [in]: the data stream - @param sessionData [in]: the data specifying the current session - - */ - void newStream( - [in] string MIMEDesc, - [in] string theURL, - [in] string filter, - [in] ::com::sun::star::io::XInputStream stream , - [in] any sessionData - ); - - - /** Notifies the plugin of a new url to open as document. - - @param MIMEDesc [in]: the MIMEtype of the data stream - @param theURL [in]: the URL to be opened - @param filter [in]: a filter string to suggest a component that should handle the document - @param sessionData [in]: the data specifying the current session - - */ - void newURL( [in] string MIMEDesc, [in] string theURL, [in] string filter, [in] any sessionData ); - - - /** Retrieves the URL of the HTTP Load balancing Slave. - - @param aHost [out]: the full qualified host name of the LBS - @param aPort [out]: the port number - @param aPrefix [out]: the url prefix to the portal - - */ - void getHttpServerURL( [out] string aHost, [out] unsigned short aPort, - [out] string aPrefix); -}; - - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/mozilla/XPluginInstanceNotifySink.idl b/offapi/com/sun/star/mozilla/XPluginInstanceNotifySink.idl deleted file mode 100644 index 085da0565f89..000000000000 --- a/offapi/com/sun/star/mozilla/XPluginInstanceNotifySink.idl +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef __com_sun_star_mozilla_XPluginInstanceNotifySink_idl__ -#define __com_sun_star_mozilla_XPluginInstanceNotifySink_idl__ - -#include - - - module com { module sun { module star { module mozilla { - - -/** Allows a plugin to get notification from office side - about status of new document opening. - This interface is oriented for communication with browsers plugins. - */ -published interface XPluginInstanceNotifySink: com::sun::star::uno::XInterface -{ - - /** Notifies the plugin that a getURL / postURL operation on the - corresponding XPluginInstancePeer was finished. - - @param theURL [in]: name of the URL that was used during a previous getURL or postURL call - - */ - void notifyURL( [in] string theURL ); -}; - - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/mozilla/XPluginInstancePeer.idl b/offapi/com/sun/star/mozilla/XPluginInstancePeer.idl deleted file mode 100644 index 1c87cf241c28..000000000000 --- a/offapi/com/sun/star/mozilla/XPluginInstancePeer.idl +++ /dev/null @@ -1,132 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef __com_sun_star_mozilla_XPluginInstancePeer_idl__ -#define __com_sun_star_mozilla_XPluginInstancePeer_idl__ - -#include - -#include - -#include - -#include - - - module com { module sun { module star { module mozilla { - - - published interface XPluginInstanceNotifySink; - - -/** Allows to communicate with a plugin from the office side. - This interface is oriented for communication with browsers plugins. - */ -published interface XPluginInstancePeer: com::sun::star::uno::XInterface -{ - - /** Alters the plugin's window size in the browser window. - - @param width [in]: the new window width - @param height [in]: the new window height - - @return TRUE on success - */ - boolean setWindowSize( [in] long width, [in] long height ); - - - /** Show status / hint message in browser's message area. - - @param message [in]: the string to be displayed - */ - void showStatusMessage( [in] string message ); - - - /** Indicates to the plugin that the document was loaded successfully and scripting - interfaces are now available. - - @param document [in]: the active document - @param servicemanager [in]: the office servicemanager - - */ - void enableScripting( [in] com::sun::star::uno::XInterface document, [in] com::sun::star::lang::XMultiServiceFactory servicemanager ); - - - /** Creates a new stream of data produced by the plug-in and consumed by - the browser. - - @param MIMEDesc [in]: the MIME type of the plug-in to create - @param target [in]: the name of the target window or frame (supports _blank, _self) - @param data [in]: on success the output stream will be associated with this instance - - */ - void newStream( - [in] string MIMEDesc, - [in] string target, - [in] com::sun::star::io::XActiveDataSource data - ); - - - /** Fetches an URL into the target window. The parameters and their meaning map to the - corresponding Netscape-API call. - - @param aURL [in]: the URL to be fetched - @param target [in]: the name of the target window or frame (supports _blank, _self) - @param alternativeHost [in]: alternativeHost - @param referrer [in]: referrer - @param sink [in]: the sink is notified on success - - */ - void getURL ( - [in] string aURL, - [in] string target, - [in] string alternativeHost, - [in] string referrer, - [in] XPluginInstanceNotifySink sink - ); - - - /** Posts to a URL with post data and/or post headers. The parameters and their meaning - map to the corresponding Netscape-API call. - - @param aURL [in]: the URL to be posted to - @param postData [in]: the data to be posted - @param target [in]: the name of the target window or frame (supports _blank, _self) - @param alternativeHost [in]: alternativeHost - @param referrer [in]: referrer - @param postHeaders [in]: the header to be posted - @param sink [in]: the sink is notified on success - - */ - void postURL ( - [in] string aURL, - [in] com::sun::star::io::XInputStream postData, - [in] string target, - [in] string alternativeHost, - [in] string referrer, - [in] com::sun::star::io::XInputStream postHeaders, - [in] XPluginInstanceNotifySink sink - ); -}; - - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/mozilla/XPluginInstanceSyncPeer.idl b/offapi/com/sun/star/mozilla/XPluginInstanceSyncPeer.idl deleted file mode 100644 index 2aeb3e522a63..000000000000 --- a/offapi/com/sun/star/mozilla/XPluginInstanceSyncPeer.idl +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef __com_sun_star_mozilla_XPluginInstanceSyncPeer_idl__ -#define __com_sun_star_mozilla_XPluginInstanceSyncPeer_idl__ - -#include -#include - - - module com { module sun { module star { module mozilla { - -/** This interface is an extension for XPluginInstancePeer interface. - An object can support this interface in addition to XPluginInstancePeer interface. - */ -published interface XPluginInstanceSyncPeer : com::sun::star::uno::XInterface -{ - - /** Opens a new browser window with a plugin instance synchronously. - - @param aInstance [out]: new plugin instance in case of success - @param aLinkage [out]: linkage to the window data - @param embedded [out]: selects embedded or full page plugin mode - - - */ - void openNewBrowserWindow( - [out] XPluginInstance aInstance, - [out] any aLinkage, - [out] boolean embedded); - -}; - - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/mozilla/XPluginWindowPeer.idl b/offapi/com/sun/star/mozilla/XPluginWindowPeer.idl deleted file mode 100644 index de9c21b0da1e..000000000000 --- a/offapi/com/sun/star/mozilla/XPluginWindowPeer.idl +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef __com_sun_star_mozilla_XPluginWindowPeer_idl__ -#define __com_sun_star_mozilla_XPluginWindowPeer_idl__ - -#include - - - module com { module sun { module star { module mozilla { - -/** Allows to notify a plugin from the office side about plugin window's child window creation. - This interface is oriented for communication with browsers plugins. - */ -published interface XPluginWindowPeer: com::sun::star::uno::XInterface -{ - - /** Notifies the peer of the created child window. - - @param SystemWindowData [in]: platform dependent window data - - */ - void setChildWindow( [in] any SystemWindowData ); -}; - - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/plugin/PluginDescription.idl b/offapi/com/sun/star/plugin/PluginDescription.idl deleted file mode 100644 index b40467235231..000000000000 --- a/offapi/com/sun/star/plugin/PluginDescription.idl +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef __com_sun_star_plugin_PluginDescription_idl__ -#define __com_sun_star_plugin_PluginDescription_idl__ - - - - module com { module sun { module star { module plugin { - - -/** Describes a specific plugin. If there are multiple mimetypes and/or - extensions, multiple PluginDescriptions will be created. -*/ -published struct PluginDescription -{ - /** the plugin's name (usually the shared object file name) */ - string PluginName; - /** a mimetype for which this plugin should be registered */ - string Mimetype; - /** the file extension for files the plugin can handle */ - string Extension; - /** text description of the plugin */ - string Description; -}; - - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/plugin/PluginException.idl b/offapi/com/sun/star/plugin/PluginException.idl deleted file mode 100644 index 5da2477e3d0f..000000000000 --- a/offapi/com/sun/star/plugin/PluginException.idl +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef __com_sun_star_plugin_PluginException_idl__ -#define __com_sun_star_plugin_PluginException_idl__ - -#include - - - - module com { module sun { module star { module plugin { - - -/** Indicates that an error occurred in an NPN or NPP function call. - - @see XPlugin - @see XPluginContext - @see XPluginManager -*/ -published exception PluginException: com::sun::star::uno::Exception -{ - /** original Netscape plugin error code */ - short ErrorCode; -}; - - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/plugin/PluginManager.idl b/offapi/com/sun/star/plugin/PluginManager.idl deleted file mode 100644 index 0013978b3399..000000000000 --- a/offapi/com/sun/star/plugin/PluginManager.idl +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef __com_sun_star_plugin_PluginManager_idl__ -#define __com_sun_star_plugin_PluginManager_idl__ - -#include - - - - module com { module sun { module star { module plugin { - - -/** This service manages all recognized Netscape plugins. -*/ -published service PluginManager : XPluginManager; - - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/plugin/PluginMode.idl b/offapi/com/sun/star/plugin/PluginMode.idl deleted file mode 100644 index 25b543f1dccc..000000000000 --- a/offapi/com/sun/star/plugin/PluginMode.idl +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef __com_sun_star_plugin_PluginMode_idl__ -#define __com_sun_star_plugin_PluginMode_idl__ - - - - module com { module sun { module star { module plugin { - - -published constants PluginMode -{ - /** embedded into document */ - const short EMBED = 1; - /** full size */ - const short FULL = 2; -}; - - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/plugin/PluginVariable.idl b/offapi/com/sun/star/plugin/PluginVariable.idl deleted file mode 100644 index 35bad6174c86..000000000000 --- a/offapi/com/sun/star/plugin/PluginVariable.idl +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef __com_sun_star_plugin_PluginVariable_idl__ -#define __com_sun_star_plugin_PluginVariable_idl__ - - - - module com { module sun { module star { module plugin { - - -/** Describes the possible parameters to XPluginContext::getValue. - It describes what kind of object is requested. -*/ -published enum PluginVariable -{ - /** XPluginContext::getValue will return the XWindow display pointer of - a display connection (UNIX only) - */ - VxDisplay, - - /** XPluginContext::getValue will return the global Xt application context - (UNIX only) - */ - VxtAppContext -}; - - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/plugin/XPlugin.idl b/offapi/com/sun/star/plugin/XPlugin.idl deleted file mode 100644 index d494455cb206..000000000000 --- a/offapi/com/sun/star/plugin/XPlugin.idl +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef __com_sun_star_plugin_XPlugin_idl__ -#define __com_sun_star_plugin_XPlugin_idl__ - -#include - -#include - -#include - - - - module com { module sun { module star { module plugin { - - -/** This interface allows the container, e.g. document to control the plugin. -*/ -published interface XPlugin: com::sun::star::uno::XInterface -{ - /** Tells the plugin instance that a new stream is requested. - - @param mimetype - mime type of provided data - @param aSource - data source - @param url - url - @param length - number of bytes (if file) - @param lastmodified - time stamp of last modification (if file) - @param isfile - whether data comes from a file - @return true upon success - */ - boolean provideNewStream( [in] string mimetype, - [in] com::sun::star::io::XActiveDataSource aSource, - [in] string url, - [in] long length, - [in] long lastmodified, - [in] boolean isfile ) - raises( com::sun::star::plugin::PluginException ); -}; - - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/plugin/XPluginContext.idl b/offapi/com/sun/star/plugin/XPluginContext.idl deleted file mode 100644 index 1fd6103e7cd9..000000000000 --- a/offapi/com/sun/star/plugin/XPluginContext.idl +++ /dev/null @@ -1,177 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef __com_sun_star_plugin_XPluginContext_idl__ -#define __com_sun_star_plugin_XPluginContext_idl__ - -#include - -#include - -#include - -#include - -#include - -#include - - - - module com { module sun { module star { module plugin { - - -/** Interface receiving calls from a plugin library. - A default context can be created using the PluginManager. -*/ -published interface XPluginContext: com::sun::star::uno::XInterface -{ - /** Requests global application parameters like display connection - on UNIX systems. - - @param xPlugin - plugin - @param aVariable - variable - @return value - */ - string getValue( [in] com::sun::star::plugin::XPlugin xPlugin, - [in] com::sun::star::plugin::PluginVariable aVariable ) - raises( com::sun::star::plugin::PluginException ); - - /** Requests a notification of completion of the operation on an URL. - - @param plugin - plugin - @param url - url - @param target - target frame - @param listener - event listener - */ - void getURLNotify( [in] com::sun::star::plugin::XPlugin plugin, - [in] string url, - [in] string target, - [in] com::sun::star::lang::XEventListener listener ) - raises( com::sun::star::plugin::PluginException ); - - /** Requests an URL to be loaded into the frame target. - - @param plugin - plugin - @param url - url - @param target - target frame - */ - void getURL( [in] com::sun::star::plugin::XPlugin plugin, - [in] string url, - [in] string target ) - raises( com::sun::star::plugin::PluginException ); - - /** Posts data from a buffer or file to an URL and receives a - notification upon completion. - - @param plugin - plugin - @param url - url - @param target - target frame - @param buf - data - @param file - whether data is from file - @param listener - event listener - */ - void postURLNotify( [in] com::sun::star::plugin::XPlugin plugin, - [in] string url, - [in] string target, - [in] sequence buf, - [in] boolean file, - [in] com::sun::star::lang::XEventListener listener ) - raises( com::sun::star::plugin::PluginException ); - - /** Posts data from a buffer or file to an URL. - - @param plugin - plugin - @param url - url - @param target - target frame - @param buf - data - @param file - whether data is from file - */ - void postURL( [in] com::sun::star::plugin::XPlugin plugin, - [in] string url, - [in] string target, - [in] sequence buf, - [in] boolean file ) - raises( com::sun::star::plugin::PluginException ); - - /** Requests a new stream that is created by the plugin and consumed - by the browser. - - @param plugin - plugin - @param mimetype - mime type - @param target - target frame - @param aSource - data source - */ - void newStream( [in] com::sun::star::plugin::XPlugin plugin, - [in] string mimetype, - [in] string target, - [in] com::sun::star::io::XActiveDataSource aSource ) - raises( com::sun::star::plugin::PluginException ); - - /** Displays a message in the browser status line. - - @param plugin - plugin - @param message - message - */ - void displayStatusText( [in] com::sun::star::plugin::XPlugin plugin, - [in] string message ) - raises( com::sun::star::plugin::PluginException ); - - /** Returns an application dependent identification string. - This is the same string that is transmitted by a browser to an http server. - - @param plugin - plugin - @return id - */ - string getUserAgent( [in] com::sun::star::plugin::XPlugin plugin ) - raises( com::sun::star::plugin::PluginException ); -}; - - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/plugin/XPluginManager.idl b/offapi/com/sun/star/plugin/XPluginManager.idl deleted file mode 100644 index 7a3b3f68d5d0..000000000000 --- a/offapi/com/sun/star/plugin/XPluginManager.idl +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef __com_sun_star_plugin_XPluginManager_idl__ -#define __com_sun_star_plugin_XPluginManager_idl__ - -#include - -#include - -#include - -#include - -#include - -#include - -#include - - - - module com { module sun { module star { module plugin { - - -/** Interface accessing all recognized Netscape plugins. -*/ -published interface XPluginManager: com::sun::star::uno::XInterface -{ - /** Creates a default context. This context depends on the service - com::sun::star::frame::Desktop.

- - @return plugin context - */ - com::sun::star::plugin::XPluginContext createPluginContext(); - - /** Returns the descriptions for all recognized plugins. - - @return plugin descriptions - */ - sequence getPluginDescriptions(); - - /** Creates a new plugin instance. - - @param acontext - plugin context - @param mode - plugin mode - @param argn - argument name list provided to plugin - @param argv - argument value list provided to plugin - @param plugintype - plugin description - @return plugin instance - */ - com::sun::star::plugin::XPlugin createPlugin( - [in] com::sun::star::plugin::XPluginContext acontext, - [in] short mode, - [in] sequence argn, - [in] sequence argv, - [in] com::sun::star::plugin::PluginDescription plugintype ) - raises( com::sun::star::plugin::PluginException ); - - /** Creates a new plugin instance. - - @param acontext - plugin context - @param mode - plugin mode - @param argn - argument name list provided to plugin - @param argv - argument value list provided to plugin - @param toolkit - toolkit to be used to get system window handle for plugin - @param parent - parent window - @param url - url - @return plugin instance - */ - com::sun::star::plugin::XPlugin createPluginFromURL( - [in] com::sun::star::plugin::XPluginContext acontext, - [in] short mode, - [in] sequence argn, - [in] sequence argv, - [in] com::sun::star::awt::XToolkit toolkit, - [in] com::sun::star::awt::XWindowPeer parent, - [in] string url ); - -}; - - -}; }; }; }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/type_reference/offapi.idl b/offapi/type_reference/offapi.idl index c4bd5c4b1322..4923160207a1 100644 --- a/offapi/type_reference/offapi.idl +++ b/offapi/type_reference/offapi.idl @@ -9208,41 +9208,6 @@ module com { ::com::sun::star::mozilla::MozillaProductType getProductType(); string getProfileName(); }; - published interface XPluginInstance { - interface ::com::sun::star::uno::XInterface; - void start(); - void stop(); - void destroy(); - void createWindow([in] any PlatformParentData, [in] boolean embedded); - void newStream([in] string MIMEDesc, [in] string theURL, [in] string filter, [in] ::com::sun::star::io::XInputStream stream, [in] any sessionData); - void newURL([in] string MIMEDesc, [in] string theURL, [in] string filter, [in] any sessionData); - void getHttpServerURL([out] string aHost, [out] unsigned short aPort, [out] string aPrefix); - }; - published interface XPluginInstanceNotifySink { - interface ::com::sun::star::uno::XInterface; - void notifyURL([in] string theURL); - }; - published interface XPluginInstancePeer { - interface ::com::sun::star::uno::XInterface; - boolean setWindowSize([in] long width, [in] long height); - void showStatusMessage([in] string message); - void enableScripting([in] ::com::sun::star::uno::XInterface document, [in] ::com::sun::star::lang::XMultiServiceFactory servicemanager); - void newStream([in] string MIMEDesc, [in] string target, [in] ::com::sun::star::io::XActiveDataSource data); - void getURL([in] string aURL, [in] string target, [in] string alternativeHost, [in] string referrer, [in] ::com::sun::star::mozilla::XPluginInstanceNotifySink sink); - void postURL([in] string aURL, [in] ::com::sun::star::io::XInputStream postData, [in] string target, [in] string alternativeHost, [in] string referrer, [in] ::com::sun::star::io::XInputStream postHeaders, [in] ::com::sun::star::mozilla::XPluginInstanceNotifySink sink); - }; - published interface XPluginInstanceSyncPeer { - interface ::com::sun::star::uno::XInterface; - void openNewBrowserWindow([out] ::com::sun::star::mozilla::XPluginInstance aInstance, [out] any aLinkage, [out] boolean embedded); - }; - published interface XPluginWindowPeer { - interface ::com::sun::star::uno::XInterface; - void setChildWindow([in] any SystemWindowData); - }; - /** @deprecated */ published interface XRemoteServiceManagerProvider { - interface ::com::sun::star::uno::XInterface; - ::com::sun::star::lang::XMultiServiceFactory getServiceManager([in] any sessionData); - }; }; module packages { published service Package { @@ -9414,50 +9379,6 @@ module com { }; }; }; - module plugin { - published struct PluginDescription { - string PluginName; - string Mimetype; - string Extension; - string Description; - }; - published exception PluginException: ::com::sun::star::uno::Exception { - short ErrorCode; - }; - published interface XPlugin; - published interface XPluginContext; - published interface XPluginManager { - interface ::com::sun::star::uno::XInterface; - ::com::sun::star::plugin::XPluginContext createPluginContext(); - sequence< ::com::sun::star::plugin::PluginDescription > getPluginDescriptions(); - ::com::sun::star::plugin::XPlugin createPlugin([in] ::com::sun::star::plugin::XPluginContext acontext, [in] short mode, [in] sequence< string > argn, [in] sequence< string > argv, [in] ::com::sun::star::plugin::PluginDescription plugintype) raises (::com::sun::star::plugin::PluginException); - ::com::sun::star::plugin::XPlugin createPluginFromURL([in] ::com::sun::star::plugin::XPluginContext acontext, [in] short mode, [in] sequence< string > argn, [in] sequence< string > argv, [in] ::com::sun::star::awt::XToolkit toolkit, [in] ::com::sun::star::awt::XWindowPeer parent, [in] string url); - }; - published service PluginManager: ::com::sun::star::plugin::XPluginManager; - published constants PluginMode { - const short EMBED = 1; - const short FULL = 2; - }; - published enum PluginVariable { - VxDisplay = 0, - VxtAppContext = 1 - }; - published interface XPlugin { - interface ::com::sun::star::uno::XInterface; - boolean provideNewStream([in] string mimetype, [in] ::com::sun::star::io::XActiveDataSource aSource, [in] string url, [in] long length, [in] long lastmodified, [in] boolean isfile) raises (::com::sun::star::plugin::PluginException); - }; - published interface XPluginContext { - interface ::com::sun::star::uno::XInterface; - string getValue([in] ::com::sun::star::plugin::XPlugin xPlugin, [in] ::com::sun::star::plugin::PluginVariable aVariable) raises (::com::sun::star::plugin::PluginException); - void getURLNotify([in] ::com::sun::star::plugin::XPlugin plugin, [in] string url, [in] string target, [in] ::com::sun::star::lang::XEventListener listener) raises (::com::sun::star::plugin::PluginException); - void getURL([in] ::com::sun::star::plugin::XPlugin plugin, [in] string url, [in] string target) raises (::com::sun::star::plugin::PluginException); - void postURLNotify([in] ::com::sun::star::plugin::XPlugin plugin, [in] string url, [in] string target, [in] sequence< byte > buf, [in] boolean file, [in] ::com::sun::star::lang::XEventListener listener) raises (::com::sun::star::plugin::PluginException); - void postURL([in] ::com::sun::star::plugin::XPlugin plugin, [in] string url, [in] string target, [in] sequence< byte > buf, [in] boolean file) raises (::com::sun::star::plugin::PluginException); - void newStream([in] ::com::sun::star::plugin::XPlugin plugin, [in] string mimetype, [in] string target, [in] ::com::sun::star::io::XActiveDataSource aSource) raises (::com::sun::star::plugin::PluginException); - void displayStatusText([in] ::com::sun::star::plugin::XPlugin plugin, [in] string message) raises (::com::sun::star::plugin::PluginException); - string getUserAgent([in] ::com::sun::star::plugin::XPlugin plugin) raises (::com::sun::star::plugin::PluginException); - }; - }; module presentation { published enum AnimationEffect { NONE = 0, -- cgit