diff options
author | Bryan Quigley <gquigs@gmail.com> | 2014-08-04 17:31:23 -0400 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-09-09 15:20:35 +0200 |
commit | 496bc3cd6c037360632c33471c4622a095cdcadd (patch) | |
tree | 694253c3f03821765ec9fa3636e4255b3c4ea210 /extensions | |
parent | 1d62f6a24f6160c33ad5c96f39b2ab3c918f0625 (diff) |
fdo#45071 Remove Libreoffice browser plugin
This removes ENABLE_NPAPI_INTO_BROWSER while it should keep
ENABLE_NPAPI_FROM_BROWSER (embed flash in LO) intact.
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Conflicts:
extensions/source/nsplugin/source/npshell.cxx
Change-Id: I80a9159a75653c74423d8fdc7c188568d3188e04
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/Module_extensions.mk | 16 | ||||
-rw-r--r-- | extensions/source/nsplugin/source/npshell.cxx | 930 | ||||
-rw-r--r-- | extensions/source/nsplugin/source/npshell.hxx | 99 | ||||
-rw-r--r-- | extensions/source/nsplugin/source/ns_debug.hxx | 44 | ||||
-rw-r--r-- | extensions/source/nsplugin/source/nsp_func.hxx | 103 | ||||
-rw-r--r-- | extensions/source/nsplugin/source/nsp_windows.cxx | 59 | ||||
-rw-r--r-- | extensions/source/nsplugin/source/nsp_windows.hxx | 51 | ||||
-rw-r--r-- | extensions/source/nsplugin/source/nsplugin_oo.rc | 158 | ||||
-rw-r--r-- | extensions/source/nsplugin/source/so_closelistener.cxx | 48 | ||||
-rw-r--r-- | extensions/source/nsplugin/source/so_closelistener.hxx | 56 | ||||
-rw-r--r-- | extensions/source/nsplugin/source/so_env.cxx | 507 | ||||
-rw-r--r-- | extensions/source/nsplugin/source/so_env.hxx | 95 | ||||
-rw-r--r-- | extensions/source/nsplugin/source/so_instance.cxx | 441 | ||||
-rw-r--r-- | extensions/source/nsplugin/source/so_instance.hxx | 114 | ||||
-rw-r--r-- | extensions/source/nsplugin/source/so_main.cxx | 494 | ||||
-rw-r--r-- | extensions/source/nsplugin/source/so_msg.hxx | 61 |
16 files changed, 0 insertions, 3276 deletions
diff --git a/extensions/Module_extensions.mk b/extensions/Module_extensions.mk index de1fa1bc9610..fa527f5f1364 100644 --- a/extensions/Module_extensions.mk +++ b/extensions/Module_extensions.mk @@ -111,22 +111,6 @@ endif endif # ENABLE_NPAPI_FROM_BROWSER=TRUE -ifeq ($(ENABLE_NPAPI_INTO_BROWSER),TRUE) - -$(eval $(call gb_Module_add_targets,extensions,\ - Executable_nsplugin \ - Library_npsoplugin \ - StaticLibrary_npsoenv \ -)) - -ifeq ($(OS),WNT) -$(eval $(call gb_Module_add_targets,extensions,\ - WinResTarget_npsoplugin \ -)) -endif - -endif # ENABLE_NPAPI_INTO_BROWSER=TRUE - ifeq ($(OS),MACOSX) $(eval $(call gb_Module_add_targets,extensions,\ Library_OOoSpotlightImporter \ diff --git a/extensions/source/nsplugin/source/npshell.cxx b/extensions/source/nsplugin/source/npshell.cxx deleted file mode 100644 index 84aff99c9d5d..000000000000 --- a/extensions/source/nsplugin/source/npshell.cxx +++ /dev/null @@ -1,930 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifdef UNIX - -#define XP_UNIX 1 - -#include <strings.h> -#include <arpa/inet.h> -#include <netinet/in.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/stat.h> -#include <sys/wait.h> -#include <unistd.h> -#include <fcntl.h> - -#endif //end of UNIX - -#ifdef WNT - -#ifdef _MSC_VER -#pragma warning (push,1) -#pragma warning (disable:4668) -#endif - -#include <windows.h> -#include <direct.h> -#include <stdlib.h> -#include <io.h> -#include <sys/types.h> -#include <fcntl.h> - -#ifdef _MSC_VER -#pragma warning (pop) -#endif - -#include "tools/pathutils.hxx" - -#endif //end of WNT - - -#include <stdio.h> - -#include <string.h> -#include <errno.h> -#include "boost/scoped_array.hpp" - -#include "npapi.h" -#include "npshell.hxx" -#include "so_env.hxx" -#include "so_msg.hxx" -#include "ns_debug.hxx" - - -#include "nsp_func.hxx" - -#include "npsdk/plugin.h" - -#include <comphelper/documentconstants.hxx> - -#ifdef _MSC_VER -#define NP_DLLPUBLIC -#else -#define NP_DLLPUBLIC SAL_DLLPUBLIC_EXPORT -#endif - -#if defined WNT -static SECURITY_ATTRIBUTES NSP_pipe_access = { - sizeof (SECURITY_ATTRIBUTES), NULL, TRUE }; -#define NSP_Inherited_Pipe(fd) \ - (!CreatePipe(&fd[0], &fd[1], &NSP_pipe_access, 1024 * 10)) -#else -#define NSP_Inherited_Pipe(fp) pipe(fd) -#endif - -/*********************************************************************** - * - * Implementations of plugin API functions - * - ***********************************************************************/ - -static NSP_Mute_Obj send_lock = NSP_New_Mute_Obj(); -static NSP_PIPE_FD write_fd = (NSP_PIPE_FD)-1; - - -long int NSP_WriteToPipe(NSP_PIPE_FD fp, void* buf, unsigned long int len) -{ - unsigned long int len_unix = 0, len_wnt = 0; - - len_unix = NSP_Write_Pipe(fp, buf, len, &len_wnt); -#ifdef UNIX - (void)len_wnt; - return len_unix; -#endif //end of UNIX -#ifdef WNT - (void)len_unix; - return len_wnt; -#endif //end of WNT - -} - -#ifdef UNIX -static pid_t nChildPID = 0; -#endif - -#if defined WNT - -#define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1) -#define MY_STRING(s) (s), MY_LENGTH(s) - -namespace { - -bool extendEnvironment(boost::scoped_array< WCHAR > * environment) { - WCHAR path[MAX_PATH]; - int len = MultiByteToWideChar( - CP_ACP, MB_PRECOMPOSED, findInstallDir(), -1, path, MAX_PATH); - //TODO: conversion errors - if (len == 0 || - (tools::buildPath(path, path, path + len - 1, MY_STRING(L"\\ure-link")) - == NULL)) - { - return false; - } - WCHAR * pathEnd = tools::resolveLink(path); - if (pathEnd == NULL) { - return false; - } - pathEnd = tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin")); - if (pathEnd == NULL) { - return false; - } - WCHAR const * env = GetEnvironmentStringsW(); - if (env == NULL) { - return false; - } - WCHAR const * p = env; - WCHAR const * p1 = NULL; - while (*p != L'\0') { - size_t n = wcslen(p); - if (p1 == NULL && n >= MY_LENGTH(L"PATH=") && - (p[0] == L'P' || p[0] == L'p') && - (p[1] == L'A' || p[1] == L'a') && - (p[2] == L'T' || p[2] == L't') && - (p[3] == L'H' || p[3] == L'h') && p[4] == L'=') - { - p1 = p + MY_LENGTH(L"PATH="); - //TODO: check whether the path is already present in PATH (at the - // beginning of PATH?) - } - p += n + 1; - } - ++p; - if (p1 == NULL) { - environment->reset( - new WCHAR[MY_LENGTH(L"PATH=") + (pathEnd - path) + 1 + (p - env)]); - //TODO: overflow - memcpy(environment->get(), MY_STRING(L"PATH=") * sizeof (WCHAR)); - memcpy( - environment->get() + MY_LENGTH(L"PATH="), path, - ((pathEnd - path) + 1) * sizeof (WCHAR)); - memcpy( - environment->get() + MY_LENGTH(L"PATH=") + (pathEnd - path) + 1, - env, (p - env) * sizeof (WCHAR)); - } else { - environment->reset( - new WCHAR[(p - env) + (pathEnd - path) + MY_LENGTH(L";")]); - //TODO: overflow - memcpy(environment->get(), env, (p1 - env) * sizeof (WCHAR)); - memcpy( - environment->get() + (p1 - env), path, - (pathEnd - path) * sizeof (WCHAR)); - environment->get()[(p1 - env) + (pathEnd - path)] = L';'; - memcpy( - environment->get() + (p1 - env) + (pathEnd - path) + 1, p1, - (p - p1) * sizeof (WCHAR)); - } - return true; -} - -} -#endif - -// start nspluin executable in child process, and use pipe to talk with it -int do_init_pipe() -{ - debug_fprintf(NSP_LOG_APPEND, "enter do_init_pipe 1\n"); - NSP_PIPE_FD fd[2]; - - if( 0 != NSP_Inherited_Pipe(fd) ) - return NPERR_GENERIC_ERROR; - - write_fd = fd[1]; // write fd -#ifdef UNIX - // the parent process will wait for the child process in NPP_Shutdown code - nChildPID = fork(); - - if( ! nChildPID ) // child process -#endif //end of UNIX - { -#ifdef UNIX - char s_read_fd[16] = {0}; - char s_write_fd[16] = {0}; - sprintf(s_read_fd, "%d", fd[0]); - sprintf(s_write_fd, "%d", fd[1]); - char const * progdir = findProgramDir(); - boost::scoped_array< char > exepath( - new char[strlen(progdir) + RTL_CONSTASCII_LENGTH("/nsplugin") + 1]); - sprintf(exepath.get(), "%s/nsplugin", progdir); - boost::scoped_array< char > inifilepath( - new char[ - RTL_CONSTASCII_LENGTH( - "-env:INIFILENAME=vnd.sun.star.pathname:") + - strlen(progdir) + RTL_CONSTASCII_LENGTH("/redirectrc") + 1]); - //TODO: overflow - sprintf( - inifilepath.get(), - "-env:INIFILENAME=vnd.sun.star.pathname:%s/redirectrc", progdir); - execl( - exepath.get(), exepath.get(), s_read_fd, s_write_fd, - inifilepath.get(), progdir, NULL); - _exit(255); -#endif //end of UNIX -#ifdef WNT - WCHAR s_read_fd[16] = {0}; - WCHAR s_write_fd[16] = {0}; - wsprintfW(s_read_fd, L"%d", fd[0]); - wsprintfW(s_write_fd, L"%d", fd[1]); - boost::scoped_array< WCHAR > env; - if (!extendEnvironment(&env)) { - return NPERR_GENERIC_ERROR; - } - WCHAR path[MAX_PATH]; - int pathLen = MultiByteToWideChar( - CP_ACP, MB_PRECOMPOSED, findProgramDir(), -1, path, MAX_PATH); - //TODO: conversion errors - if (pathLen == 0) { - return NPERR_GENERIC_ERROR; - } - WCHAR exe[MAX_PATH]; - WCHAR * exeEnd = tools::buildPath( - exe, path, path + pathLen - 1, MY_STRING(L"\\nsplugin.exe")); - if (exeEnd == NULL) { - return NPERR_GENERIC_ERROR; - } - WCHAR ini[MAX_PATH]; - WCHAR * iniEnd = tools::buildPath( - ini, path, path + pathLen - 1, MY_STRING(L"\\redirect.ini")); - if (iniEnd == NULL) { - return NPERR_GENERIC_ERROR; - } - size_t len = MY_LENGTH(L"\"") + (exeEnd - exe) + MY_LENGTH(L"\" ") + - wcslen(s_read_fd) + MY_LENGTH(L" ") + wcslen(s_write_fd) + - MY_LENGTH(L" \"-env:INIFILENAME=vnd.sun.star.pathname:") + - (iniEnd - ini) + MY_LENGTH(L"\"") + 1; //TODO: overflow - boost::scoped_array< WCHAR > args(new WCHAR[len]); - _snwprintf( - args.get(), len, - L"\"%s\" %s %s \"-env:INIFILENAME=vnd.sun.star.pathname:%s\"", exe, - s_read_fd, s_write_fd, ini); - STARTUPINFOW NSP_StarInfo; - memset((void*) &NSP_StarInfo, 0, sizeof(STARTUPINFOW)); - NSP_StarInfo.cb = sizeof(STARTUPINFOW); - PROCESS_INFORMATION NSP_ProcessInfo; - memset((void*)&NSP_ProcessInfo, 0, sizeof(PROCESS_INFORMATION)); - if(!CreateProcessW( - exe, args.get(), NULL, NULL, TRUE, - CREATE_NO_WINDOW | CREATE_UNICODE_ENVIRONMENT, env.get(), path, - &NSP_StarInfo, &NSP_ProcessInfo)) - { - DWORD Err = GetLastError(); - (void)Err; - } -#endif //end of WNT - } - NSP_Close_Pipe(fd[0]); - return NPERR_NO_ERROR; -} - -bool sendMsg( PLUGIN_MSG* pMsg, size_t len, int iEnsure) -{ - NSP_Lock_Mute_Obj(send_lock); - size_t len_w = 0; - - debug_fprintf(NSP_LOG_APPEND, "try to send message type:%d; len: %d\n", pMsg->msg_id, len); - /* - debug_fprintf(NSP_LOG_APPEND, "NSPlugin Message: msg_id:%d; instance_id:%d; - wnd_id:%d;wnd_x:%d;wnd_y:%d;wnd_w:%d;wnd_h:%d; url:%s\n", - pMsg->msg_id, pMsg->instance_id, pMsg->wnd_id, - pMsg->wnd_x, pMsg->wnd_y, pMsg->wnd_w, pMsg->wnd_h, pMsg->url);*/ - len_w = NSP_WriteToPipe(write_fd, (void*) pMsg, len); - if (len_w != len){ - if(errno == EPIPE) // If pipe breaks, then init pipe again and resend the msg - { - if(iEnsure){ - debug_fprintf(NSP_LOG_APPEND, "send message error, plugin exec need to be restart\n"); - NSP_Close_Pipe(write_fd); - do_init_pipe(); - len_w = NSP_WriteToPipe(write_fd, (void*) pMsg, len); - } - } - else if(errno == EINTR) // If interrupted by signal, then continue to send - { - long new_len; - debug_fprintf(NSP_LOG_APPEND, "send message error, send intrrupted by singal, resend again\n"); - new_len = NSP_WriteToPipe(write_fd, (char*)pMsg+len_w, len-len_w); - len_w = len_w + new_len; - } - else // else return error - { - debug_fprintf(NSP_LOG_APPEND, "send message error :%s.\n", strerror(errno)); - len_w = 0; - } - } - NSP_Unlock_Mute_Obj(send_lock); - debug_fprintf(NSP_LOG_APPEND, "send message success!\n"); - return len_w == len; -} - -extern "C" -{ -char* pMimeTypes = const_cast< char* >( "application/msword:doc:MS Word 97-2003 document;" -"application/msword:dot:MS Word 97-2003 document template;" -"application/vnd.openxmlformats-officedocument.wordprocessingml.document:docx:MS Word document;" -"application/vnd.ms-word.document.macroenabled.12:docm:MS Word document with macros;" -"application/vnd.openxmlformats-officedocument.wordprocessingml.template:dotx:MS Word document template;" -"application/vnd.ms-word.template.macroenabled.12:dotm:MS Word document template with macros;" -"application/rtf:rtf:Rich Text Format;" -"application/vnd.ms-excel:xls:MS Excel 97-2003 spreadsheet;" -"application/vnd.ms-excel:xlt:MS Excel 97-2003 spreadsheet template;" -"application/vnd.ms-excel:xla:MS Excel 97-2003 spreadsheet;" -"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:xlsx:MS Excel spreadsheet;" -"application/vnd.ms-excel.sheet.macroenabled.12:xlsm:MS Excel spreadsheet with macros;" -"application/vnd.openxmlformats-officedocument.spreadsheetml.template:xltx:MS Excel spreadsheet template;" -"application/vnd.ms-excel.template.macroenabled.12:xltm:MS Excel spreadsheet template with macros;" -"application/vnd.ms-powerpoint:ppt:MS PowerPoint 97-2003 presentation;" -"application/vnd.openxmlformats-officedocument.presentationml.presentation:pptx:MS PowerPoint presentation;" -"application/vnd.ms-powerpoint.presentation.macroenabled.12:pptm:MS PowerPoint presentation with macros;" -"application/vnd.openxmlformats-officedocument.presentationml.template:potx:MS PowerPoint presentation template;" -"application/vnd.ms-powerpoint.template.macroenabled.12:potm:MS PowerPoint presentation template with macros;" -MIMETYPE_VND_SUN_XML_CALC_ASCII ":sxc:StarOffice 6.0/7 Spreadsheet;" -MIMETYPE_VND_SUN_XML_CALC_TEMPLATE_ASCII":stc:StarOffice 6.0/7 Spreadsheet Template;" -MIMETYPE_VND_SUN_XML_DRAW_ASCII ":sxd:StarOffice 6.0/7 Drawing;" -MIMETYPE_VND_SUN_XML_DRAW_TEMPLATE_ASCII ":std:StarOffice 6.0/7 Drawing Template;" -MIMETYPE_VND_SUN_XML_IMPRESS_ASCII ":sxi:StarOffice 6.0/7 Presentation;" -MIMETYPE_VND_SUN_XML_IMPRESS_TEMPLATE_ASCII ":sti:StarOffice 6.0/7 Presentation Template;" -MIMETYPE_VND_SUN_XML_MATH_ASCII ":sxm:StarOffice 6.0/7 Formula;" -MIMETYPE_VND_SUN_XML_WRITER_ASCII ":sxw:StarOffice 6.0/7 Text Document;" -MIMETYPE_VND_SUN_XML_WRITER_GLOBAL_ASCII ":sxg:StarOffice 6.0/7 Master Document;" -MIMETYPE_VND_SUN_XML_WRITER_TEMPLATE_ASCII ":stw:StarOffice 6.0/7 Text Document Template;" -MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII ":odt:OpenDocument Text;" -MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII "-flat-xml:fodt:OpenDocument Text Flat XML;" -MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII ":ott:OpenDocument Text Template;" -MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII ":odm:OpenDocument Master Document;" -MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII ":oth:HTML Document Template;" -MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII ":ods:OpenDocument Spreadsheet;" -MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII "-flat-xml:fods:OpenDocument Spreadsheet Flat XML;" -MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII ":ots:OpenDocument Spreadsheet Template;" -MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII ":odg:OpenDocument Drawing;" -MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII "-flat-xml:fodg:OpenDocument Drawing Flat XML;" -MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII ":otg:OpenDocument Drawing Template;" -MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII ":odp:OpenDocument Presentation;" -MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII "-flat-xml:fodp:OpenDocument Presentation Flat XML;" -MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII ":otp:OpenDocument Presentation Template;" -MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII ":odf:OpenDocument Formula;" ); - -NP_DLLPUBLIC -#ifndef HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION -const -#endif -char* -NPP_GetMIMEDescription(void) -{ - debug_fprintf(NSP_LOG_APPEND, "print by Netscape Plugin, NPP_GetMIMEDescription:%s.\n", pMimeTypes); - return(pMimeTypes); -} - -#ifdef UNIX -NP_DLLPUBLIC NPError -NPP_GetValue(NPP /*instance*/, NPPVariable variable, void *value) -{ - NPError err = NPERR_NO_ERROR; - - switch (variable) { - case NPPVpluginNameString: - // add here, for dynamic productname - *((char **)value) = NSP_getPluginName(); - break; - case NPPVpluginDescriptionString: - // add here, for dynamic product description - *((char **)value) = NSP_getPluginDesc(); - break; - default: - err = NPERR_GENERIC_ERROR; - } - debug_fprintf(NSP_LOG_APPEND, "print by Netscape Plugin, NPP_GetValue return %d.\n", err); - return err; -} - - -NPMIMEType -dupMimeType(NPMIMEType type) -{ - NPMIMEType mimetype = (NPMIMEType) NPN_MemAlloc(strlen(type)+1); - strcpy(mimetype, type); - return(mimetype); -} -#endif // end of UNIX - -NPError -NPP_Initialize(void) -{ - debug_fprintf(NSP_LOG_NEW, "NS Plugin begin initialize.\n"); - return (NPError)do_init_pipe(); -} - -#ifdef OJI -NP_DLLPUBLIC jref -NPP_GetJavaClass() -{ - return NULL; -} -#endif - -void -NPP_Shutdown(void) -{ - PLUGIN_MSG msg; - memset((char*)&msg, 0, sizeof(PLUGIN_MSG)); - msg.msg_id = SO_SHUTDOWN; - sendMsg(&msg, sizeof(PLUGIN_MSG), 0); - NSP_Close_Pipe(write_fd); - -#ifdef UNIX - // on Unix we should wait till the child process is dead - int nStatus; - waitpid( nChildPID, &nStatus, 0 ); -#endif -} - -NP_DLLPUBLIC NPError NP_LOADDS -NPP_New(NPMIMEType pluginType, - NPP instance, - uint16_t mode, - int16_t /*argc*/, - char* /*argn*/[], - char* /*argv*/[], - NPSavedData* /*saved*/) -{ - PluginInstance* This; - - debug_fprintf(NSP_LOG_APPEND, "print by Netscape Plugin, enter NPP_New.\n"); - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - instance->pdata = (PluginInstance*)NPN_MemAlloc(sizeof(PluginInstance)); - - memset(instance->pdata, 0 , sizeof(PluginInstance)); - This = (PluginInstance*) instance->pdata; - - if (This == NULL) - { - return NPERR_OUT_OF_MEMORY_ERROR; - } - - memset(This, 0, sizeof(PluginInstance)); - - /* mode is NP_EMBED, NP_FULL, or NP_BACKGROUND (see npapi.h) */ -#ifdef UNIX - This->mode = mode; - This->type = dupMimeType(pluginType); - This->instance = instance; - This->pluginsPageUrl = NULL; - This->exists = FALSE; -#endif //end of UNIX -#ifdef WNT - (void)pluginType; - This->fWindow = (NPWindow*)NPN_MemAlloc(sizeof(NPWindow)); - memset(This->fWindow, 0, sizeof (NPWindow)); - This->fMode = mode; -#endif //end of WNT - PLUGIN_MSG msg; - memset((char*)&msg, 0, sizeof(PLUGIN_MSG)); - msg.msg_id = SO_NEW_INSTANCE; - msg.instance_id = reinterpret_cast<plugin_Int32>(instance); - if (!sendMsg(&msg, sizeof(PLUGIN_MSG), 1)) - return NPERR_GENERIC_ERROR; - - NPN_Status(instance, "......"); - return NPERR_NO_ERROR; -} - -NP_DLLPUBLIC NPError NP_LOADDS -NPP_Destroy(NPP instance, NPSavedData** /*save*/) -{ - debug_fprintf(NSP_LOG_APPEND, "print by Nsplugin, enter NPP_Destroy.\n"); - PluginInstance* This; - - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - // Send destroy message - PLUGIN_MSG msg; - memset((char*)&msg, 0, sizeof(PLUGIN_MSG)); - msg.msg_id = SO_DESTROY; - msg.instance_id = reinterpret_cast<plugin_Int32>(instance); -#ifdef UNIX - msg.wnd_id =(plugin_Int32)((PluginInstance*) instance->pdata)->window; -#endif //end of UNIX -#ifdef WNT - msg.wnd_id =(plugin_Int32)((PluginInstance*) instance->pdata)->fhWnd; -#endif //end of WNT - sendMsg(&msg, sizeof(PLUGIN_MSG), 0); - - // Free the instance space - This = (PluginInstance*) instance->pdata; - if (This != NULL) { -#ifdef UNIX - if (This->type) - NPN_MemFree(This->type); - if (This->pluginsPageUrl) - NPN_MemFree(This->pluginsPageUrl); - if (This->pluginsFileUrl) - NPN_MemFree(This->pluginsFileUrl); -#endif //end of UNIX -#ifdef WNT - if(This->fWindow) - NPN_MemFree(This->fWindow); -#endif //end of WNT - NPN_MemFree(instance->pdata); - instance->pdata = NULL; - } - - return NPERR_NO_ERROR; -} - - -NP_DLLPUBLIC NPError NP_LOADDS -NPP_SetWindow(NPP instance, NPWindow* window) -{ - PluginInstance* This; -#ifdef UNIX - NPSetWindowCallbackStruct *ws_info; -#endif //end of UNIX - - debug_fprintf(NSP_LOG_APPEND, "print by Netscape Plugin, received window resize.\n"); - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - This = (PluginInstance*) instance->pdata; - if (This == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - // Prepare the general part of the SET_WINDOW message - PLUGIN_MSG msg; - memset((char*)&msg, 0, sizeof(msg)); - msg.msg_id = SO_SET_WINDOW; - msg.instance_id = reinterpret_cast<plugin_Int32>(instance); - - if ( window ) - { - // Set window info for instance -#ifdef UNIX - ws_info = (NPSetWindowCallbackStruct *)window->ws_info; - This->window = reinterpret_cast<Window>( window->window); - This->x = window->x; - This->y = window->y; - This->width = window->width; - This->height = window->height; - This->display = ws_info->display; - This->visual = ws_info->visual; - This->depth = ws_info->depth; - This->colormap = ws_info->colormap; -#endif //end of UNIX -#ifdef WNT - This->fhWnd = (HWND) window->window; - This->fWindow->x = window->x; - This->fWindow->y = window->y; - This->fWindow->width = window->width; - This->fWindow->height = window->height; -#endif //end of WNT - debug_fprintf(NSP_LOG_APPEND, "begin Set window of Office\n"); - debug_fprintf(NSP_LOG_APPEND, "W=(%d) H=(%d)\n", window->width, window->height); - - // fill the window dependent part of the message - msg.wnd_id = reinterpret_cast<plugin_Int32>(window->window); - msg.wnd_x = window->x; - msg.wnd_y = window->y; - msg.wnd_w = window->width; - msg.wnd_h = window->height; - } - else - { - // empty window pointer usually means closing of the parent window -#ifdef UNIX - ws_info = NULL; - This->window = (Window) NULL; - This->x = 0; - This->y = 0; - This->width = 0; - This->height = 0; - This->display = NULL; - This->visual = NULL; -#endif //end of UNIX -#ifdef WNT - This->fhWnd = (HWND) NULL; - This->fWindow->x = 0; - This->fWindow->y = 0; - This->fWindow->width = 0; - This->fWindow->height = 0; -#endif //end of WNT - debug_fprintf(NSP_LOG_APPEND, "Empty window pointer is provided\n"); - - // fill the window dependent part of the message - msg.wnd_id = (plugin_Int32) NULL; - msg.wnd_x = 0; - msg.wnd_y = 0; - msg.wnd_w = 0; - msg.wnd_h = 0; - } - - if(!sendMsg(&msg, sizeof(PLUGIN_MSG), 1)) - { - debug_fprintf(NSP_LOG_APPEND, "NPP_SetWindow return failure \n"); - return NPERR_GENERIC_ERROR; - } - - return NPERR_NO_ERROR; -} - - -NP_DLLPUBLIC NPError NP_LOADDS -NPP_NewStream(NPP instance, - NPMIMEType /*type*/, - NPStream* /*stream*/, - NPBool /*seekable*/, - uint16_t *stype) -{ - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - // Notify Mozilla to fetch the remote file into local cache directory - *stype=NP_ASFILEONLY; - - return NPERR_NO_ERROR; -} - - -int32_t STREAMBUFSIZE = 0X0FFFFFFF; -/* If we are reading from a file in NPAsFile - * mode so we can take any size stream in our - * write call (since we ignore it) */ - -NP_DLLPUBLIC int32_t NP_LOADDS -NPP_WriteReady(NPP /*instance*/, NPStream* /*stream*/) -{ - return STREAMBUFSIZE; -} - - -NP_DLLPUBLIC int32_t NP_LOADDS -NPP_Write(NPP /*instance*/, NPStream* /*stream*/, int32_t /*offset*/, int32_t len, void* /*buffer*/) -{ - return len; /* The number of bytes accepted */ -} - - -NP_DLLPUBLIC NPError NP_LOADDS -NPP_DestroyStream(NPP instance, NPStream* /*stream*/, NPError /*reason*/) -{ - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - return NPERR_NO_ERROR; -} - -// save fname to another file with the original file name -NP_DLLPUBLIC void NP_LOADDS -NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname) -{ - debug_fprintf(NSP_LOG_APPEND, "Into Stream\n"); - char* url = (char*)stream->url; - char filename[1024] = {0}; - char* pfilename = NULL; - if (NULL != (pfilename = strrchr(url, '/'))) - { - strncat(filename, pfilename+1, 1023); - } - else - { - return; - } - - int length = strlen(url); - debug_fprintf(NSP_LOG_APPEND, "url: %s; length: %d\n", url, length); - PluginInstance* This; - This = (PluginInstance*) instance->pdata; - - debug_fprintf(NSP_LOG_APPEND, "NPP_StreamAsFile\n"); - - // copy cached file to another file with original name - char localPathNew[NPP_PATH_MAX] = {0}; - char localFileNew[NPP_PATH_MAX] = {0}; - // if the file is from local - if (0 == STRNICMP(url, "file:///", strlen("file:///"))) - { - sprintf(localPathNew, "%s", fname); - char* pAskSymbol = NULL; - if(NULL != (pAskSymbol = strrchr(localPathNew, '?'))) - *pAskSymbol = 0; - } - else // from network, on windows, fname is c:\abc123 - { - strncpy(localPathNew, fname, NPP_PATH_MAX - 1); - char* pRandomFilename = NULL; - -#ifdef UNIX - if(NULL != (pRandomFilename = strrchr(localPathNew, '/'))) -#endif //end of UNIX -#ifdef WNT - if(NULL != (pRandomFilename = strrchr(localPathNew, '\\'))) -#endif //end of WNT - { - pRandomFilename[1] = 0; - } else { - return; - } - strcat(localPathNew, filename); - char* pAskSymbol = NULL; - if(NULL != (pAskSymbol = strrchr(localPathNew, '?'))) - *pAskSymbol = 0; - - sprintf(localFileNew, "file://%s", localPathNew); - UnixToDosPath(localFileNew); - debug_fprintf(NSP_LOG_APPEND, "fname: %s\n localPathNew: %s\nlocalFileNew: %s\n", - fname, localPathNew, localFileNew); - - restoreUTF8(localPathNew); - restoreUTF8(localFileNew); - if(0 != strcmp(fname, localPathNew)) { - -#ifdef WNT - if(FALSE == CopyFile(fname, localPathNew, FALSE)) - return; -#endif //end of WNT - -#ifdef UNIX - int fdSrc, fdDst; - if((0 > (fdSrc = open(fname, O_RDONLY)))){ - return; - } - remove(localPathNew); - if (0 > (fdDst = open(localPathNew, O_WRONLY|O_CREAT, - S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH))){ - close( fdSrc); - debug_fprintf(NSP_LOG_APPEND, "NPP_StreamAsFile:can not create cache file %s. error: %s \n", - localPathNew, strerror(errno)); - return; - } - char buffer[NPP_BUFFER_SIZE] = {0}; - ssize_t ret; - while(0 <= (ret = read(fdSrc, buffer, NPP_BUFFER_SIZE))) - { - if (0 == ret) - { - if(EINTR == errno) - continue; - else - - break; - } - ssize_t written_bytes = write(fdDst, buffer, ret); - if (written_bytes != ret) - { - debug_fprintf(NSP_LOG_APPEND, "NPP_StreamAsFile:short write to %s. error: %s \n", - localPathNew, strerror(errno)); - close(fdSrc); - close(fdDst); - return; - } - } - close(fdSrc); - close(fdDst); -#endif //end of UNIX - - debug_fprintf(NSP_LOG_APPEND, "NPP_StreamAsFile:before SetURL\n"); - } - } - - // send SO_SET_URl message to inform the new URL - PLUGIN_MSG msg; - memset((char*)&msg, 0, sizeof(PLUGIN_MSG)); - msg.msg_id = SO_SET_URL; - msg.instance_id = reinterpret_cast<plugin_Int32>(instance); -#ifdef UNIX - msg.wnd_id =(plugin_Int32)(This->window); - sprintf(msg.url, "file://%s", localPathNew); -#endif //end of UNIX -#ifdef WNT - msg.wnd_id =(plugin_Int32)(This->fhWnd); - sprintf(msg.url, "file:///%s", localPathNew); - DosToUnixPath(msg.url); -#endif //endof WNT - if(!sendMsg(&msg, sizeof(PLUGIN_MSG), 1)) - debug_fprintf(NSP_LOG_APPEND, "NPP_StreamAsFile send SO_SET_URL return failure \n"); - - // send SO_SET_WINDOW message -// memset((char*)&msg, 0, sizeof(PLUGIN_MSG)); - msg.msg_id = SO_SET_WINDOW; - msg.instance_id = reinterpret_cast<plugin_Int32>(instance); -// msg.wnd_id =(plugin_Int32)((PluginInstance*) instance->pdata)->window; -#ifdef UNIX - msg.wnd_x = This->x; - msg.wnd_y = This->y; - msg.wnd_w = This->width; - msg.wnd_h = This->height; -#endif //end of UNIX -#ifdef WNT - msg.wnd_x = This->fWindow->x; - msg.wnd_y = This->fWindow->y; - msg.wnd_w = This->fWindow->width; - msg.wnd_h = This->fWindow->height; -#endif //endof WNT - if(!sendMsg(&msg, sizeof(PLUGIN_MSG), 1)) - debug_fprintf(NSP_LOG_APPEND, "NPP_StreamAsFile send SO_SET_WINDOW return failure \n"); -} - -NP_DLLPUBLIC void NP_LOADDS -NPP_URLNotify(NPP /*instance*/, const char* /*url*/, - NPReason /*reason*/, void* /*notifyData*/) -{ -} - - -NP_DLLPUBLIC void NP_LOADDS -NPP_Print(NPP instance, NPPrint* printInfo) -{ - if(printInfo == NULL) - return; - - if (instance != NULL) { - /***** Insert NPP_Print code here *****/ - PluginInstance* This = (PluginInstance*) instance->pdata; - (void)This; - PLUGIN_MSG msg; - memset((char*)&msg, 0, sizeof(PLUGIN_MSG)); - msg.msg_id = SO_PRINT; - msg.instance_id = reinterpret_cast<plugin_Int32>(instance); - if(!sendMsg(&msg, sizeof(PLUGIN_MSG), 1)) - debug_fprintf(NSP_LOG_APPEND, "NPP_StreamAsFile send SO_SET_WINDOW return failure \n"); - /**************************************/ - - if (printInfo->mode == NP_FULL) { - /* - * PLUGIN DEVELOPERS: - * If your plugin would like to take over - * printing completely when it is in full-screen mode, - * set printInfo->pluginPrinted to TRUE and print your - * plugin as you see fit. If your plugin wants Netscape - * to handle printing in this case, set - * printInfo->pluginPrinted to FALSE (the default) and - * do nothing. If you do want to handle printing - * yourself, printOne is true if the print button - * (as opposed to the print menu) was clicked. - * On the Macintosh, platformPrint is a THPrint; on - * Windows, platformPrint is a structure - * (defined in npapi.h) containing the printer name, port, - * etc. - */ - - /***** Insert NPP_Print code here *****\ - void* platformPrint = - printInfo->print.fullPrint.platformPrint; - NPBool printOne = - printInfo->print.fullPrint.printOne; - \**************************************/ - - /* Do the default*/ - printInfo->print.fullPrint.pluginPrinted = FALSE; - } - else { /* If not fullscreen, we must be embedded */ - /* - * PLUGIN DEVELOPERS: - * If your plugin is embedded, or is full-screen - * but you returned false in pluginPrinted above, NPP_Print - * will be called with mode == NP_EMBED. The NPWindow - * in the printInfo gives the location and dimensions of - * the embedded plugin on the printed page. On the - * Macintosh, platformPrint is the printer port; on - * Windows, platformPrint is the handle to the printing - * device context. - */ - - /***** Insert NPP_Print code here *****\ - NPWindow* printWindow = - &(printInfo->print.embedPrint.window); - void* platformPrint = - printInfo->print.embedPrint.platformPrint; - \**************************************/ - } - } -} - -}// end of extern "C" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/npshell.hxx b/extensions/source/nsplugin/source/npshell.hxx deleted file mode 100644 index 343f3b06b978..000000000000 --- a/extensions/source/nsplugin/source/npshell.hxx +++ /dev/null @@ -1,99 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_EXTENSIONS_SOURCE_NSPLUGIN_SOURCE_NPSHELL_HXX -#define INCLUDED_EXTENSIONS_SOURCE_NSPLUGIN_SOURCE_NPSHELL_HXX - -#ifdef UNIX - -#ifndef MOZ_X11 -# define MOZ_X11 -#endif - -#include <gtk/gtk.h> -#include <X11/Xlib.h> - -typedef struct _PluginInstance -{ - uint16_t mode; -#ifdef MOZ_X11 - Window window; - Display *display; -#endif - uint32_t x, y; - uint32_t width, height; - NPMIMEType type; - char *message; - - NPP instance; - char *pluginsPageUrl; - char *pluginsFileUrl; - NPBool pluginsHidden; -#ifdef MOZ_X11 - Visual* visual; - Colormap colormap; -#endif - unsigned int depth; - GtkWidget* dialogBox; - - NPBool exists; /* Does the widget already exist? */ - int action; /* What action should we take? (GET or REFRESH) */ - -} PluginInstance; - -typedef struct _MimeTypeElement -{ - PluginInstance *pinst; - struct _MimeTypeElement *next; -} MimeTypeElement; - -#endif //end of UNIX - - -#ifdef WNT - -#include <windows.h> - -typedef struct _PluginInstance -{ - NPWindow* fWindow; - uint16_t fMode; - - HWND fhWnd; - WNDPROC fDefaultWindowProc; -} PluginInstance; - -#endif //end of WNT - - -/* Extern functions */ -extern "C" NPMIMEType dupMimeType(NPMIMEType type); - -#endif // INCLUDED_EXTENSIONS_SOURCE_NSPLUGIN_SOURCE_NPSHELL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/ns_debug.hxx b/extensions/source/nsplugin/source/ns_debug.hxx deleted file mode 100644 index dc6ddc3f4942..000000000000 --- a/extensions/source/nsplugin/source/ns_debug.hxx +++ /dev/null @@ -1,44 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_EXTENSIONS_SOURCE_NSPLUGIN_SOURCE_NS_DEBUG_HXX -#define INCLUDED_EXTENSIONS_SOURCE_NSPLUGIN_SOURCE_NS_DEBUG_HXX - -#define NPP_PATH_MAX 1024 -#define NPP_BUFFER_SIZE 1024 - -#define NSP_LOG_APPEND 2 -#define NSP_LOG_NEW 0 - -#define debug_fprintf NSP_WriteLog - -#include <config_lgpl.h> - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/nsp_func.hxx b/extensions/source/nsplugin/source/nsp_func.hxx deleted file mode 100644 index bcf4bf1f2ad0..000000000000 --- a/extensions/source/nsplugin/source/nsp_func.hxx +++ /dev/null @@ -1,103 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_EXTENSIONS_SOURCE_NSPLUGIN_SOURCE_NSP_FUNC_HXX -#define INCLUDED_EXTENSIONS_SOURCE_NSPLUGIN_SOURCE_NSP_FUNC_HXX - - -// Some function different from UNIX and Window. - -/************************ In UNIX ************************/ - - -#ifdef UNIX -// for chdir() -#define NSP_CHDIR chdir -//for vsnprintf() -#define NSP_vsnprintf vsnprintf - - -//for pipe() -typedef int NSP_PIPE_FD; -#define NSP_Close_Pipe(fp) close(fp) -//for write(), read() -#define NSP_Write_Pipe(a, b, c, d) write(a, b, c) -#define NSP_Read_Pipe(a, b, c, d) read(a, b, c) - -//for socket -#define NSP_CloseSocket close - -//for sleep -#define NSP_Sleep(a) sleep(a) - -//for mutex -#define NSP_Mute_Obj pthread_mutex_t -#define NSP_New_Mute_Obj() PTHREAD_MUTEX_INITIALIZER -#define NSP_Lock_Mute_Obj(a) pthread_mutex_lock(&a) -#define NSP_Unlock_Mute_Obj(a) pthread_mutex_unlock(&a) - -#define STRNICMP(a, b ,c) strncasecmp(a, b ,c) -#endif //end of UNIX - -/************************ In WINWS ************************/ - -#ifdef WNT - -#include <windows.h> -//for chdir() -#define NSP_CHDIR(a) _chdir(a) -//for vsnprintf() -#define NSP_vsnprintf _vsnprintf - -//for pipe() -typedef HANDLE NSP_PIPE_FD; -#define NSP_Close_Pipe(fp) CloseHandle(fp) -//for write(), read() -#define NSP_Write_Pipe(a, b, c, d) WriteFile(a, b, c, d, NULL) -#define NSP_Read_Pipe(a, b, c, d) ReadFile(a, b, c, d, NULL) - -//for execl() -#define NSP_CreateProcess(a, b ) CreateProcess(a, b, NULL, NULL, TRUE, 0, NULL, NULL, NULL, NULL) - -//for socket -#define NSP_CloseSocket closesocket -//for sleep -#define NSP_Sleep(a) Sleep(a*1000) - -//for mutex -#define NSP_Mute_Obj HANDLE -#define NSP_New_Mute_Obj() CreateMutex (NULL, FALSE, NULL) -#define NSP_Lock_Mute_Obj(a) WaitForSingleObject(a, INFINITE) -#define NSP_Unlock_Mute_Obj(a) ReleaseMutex(a) -#define STRNICMP(a, b ,c) strnicmp(a, b ,c) - -#endif //end of WNT - - -#endif //end of INCLUDED_EXTENSIONS_SOURCE_NSPLUGIN_SOURCE_NSP_FUNC_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/nsp_windows.cxx b/extensions/source/nsplugin/source/nsp_windows.cxx deleted file mode 100644 index 3315ec15a1e4..000000000000 --- a/extensions/source/nsplugin/source/nsp_windows.cxx +++ /dev/null @@ -1,59 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include "nsp_windows.hxx" - -int NSP_ResetWinStyl(LONG_PTR hParent) -{ - int ret = 0; -#ifdef WNT - LONG_PTR dOldStyl = GetWindowLongPtr( (HWND)hParent, GWL_STYLE); - ret = dOldStyl; - - if(ret != 0) - { - LONG_PTR dNewStyl = dOldStyl|WS_CLIPCHILDREN; - if(0 == SetWindowLongPtr((HWND)hParent, GWL_STYLE, dNewStyl)) - ret = 0; - } -#endif - return ret; - -} - -int NSP_RestoreWinStyl(LONG_PTR hParent, LONG_PTR dOldStyle) -{ - int ret = 0; -#ifdef WNT - ret = SetWindowLongPtr((HWND)hParent, GWL_STYLE, dOldStyle); -#endif - return ret; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/nsp_windows.hxx b/extensions/source/nsplugin/source/nsp_windows.hxx deleted file mode 100644 index 4dbcc8413652..000000000000 --- a/extensions/source/nsplugin/source/nsp_windows.hxx +++ /dev/null @@ -1,51 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_EXTENSIONS_SOURCE_NSPLUGIN_SOURCE_NSP_WINDOWS_HXX -#define INCLUDED_EXTENSIONS_SOURCE_NSPLUGIN_SOURCE_NSP_WINDOWS_HXX -#ifdef WNT -#ifdef _MSC_VER - #pragma warning (push,1) - #pragma warning (disable:4668) -#endif - #include <windows.h> -#ifdef _MSC_VER - #pragma warning (pop) -#endif -#else -#ifndef LONG_PTR - #define LONG_PTR long -#endif -#endif - -int NSP_ResetWinStyl(LONG_PTR hParent); -int NSP_RestoreWinStyl(LONG_PTR hParent, LONG_PTR dOldStyle); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/nsplugin_oo.rc b/extensions/source/nsplugin/source/nsplugin_oo.rc deleted file mode 100644 index 6e14c097d427..000000000000 --- a/extensions/source/nsplugin/source/nsplugin_oo.rc +++ /dev/null @@ -1,158 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <windows.h> -#include "version.hrc" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION VERSION, SUBVERSION, MICROVERSION, VERVARIANT - PRODUCTVERSION VERSION, SUBVERSION, MICROVERSION, VERVARIANT - FILEFLAGSMASK 0x3F - FILEFLAGS -#if defined(DEBUG) - VS_FF_DEBUG | -#endif -#ifdef VER_PREL - VS_FF_PRERELEASE | -#endif - 0 - FILEOS VOS_NT_WINDOWS32 - FILETYPE VFT_APP - { - BLOCK "StringFileInfo" - { - BLOCK "040904E4" - { - // International StringTable - VALUE "CompanyName", PPS(RES_APP_VENDOR) "\0" - VALUE "ProductName", "LibreOffice Plug-in\0" - VALUE "ProductVersion", PPS(VER_LEVEL) "\0" - VALUE "FileVersion", PPS(VER_LEVEL) "\0" - VALUE "FileDescription", "LibreOffice Plug-in handles all its documents\0" - VALUE "OriginalFilename", "npsoplugin.dll\0" - VALUE "InternalName", "npsoplugin\0" - VALUE "LegalCopyright", S_CRIGHT " LibreOffice contributors. All rights reserved.\0" - VALUE "FileExtents", "sxc|stc|sxd|std|sxi|sti|sxm|sxw|sxg|stw|" - "odt|ott|odm|oth|ods|ots|odg|otg|odp|otp|odf|" - "fodt|fods|fogd|fodp|" - "doc|dot|docx|docm|dotx|dotm|rtf|xls|xlt|xla|xlsx|xlsm|xltx|xltm|ppt|pptx|pptm|potx|potm\0" - VALUE "FileOpenName", "StarOffice 6.0/7 Spreadsheet|" - "StarOffice 6.0/7 Spreadsheet Template|" - "StarOffice 6.0/7 Drawing|" - "StarOffice 6.0/7 Drawing Template|" - "StarOffice 6.0/7 Presentation|" - "StarOffice 6.0/7 Presentation Template|" - "StarOffice 6.0/7 Formula|" - "StarOffice 6.0/7 Text Document|" - "StarOffice 6.0/7 Master Document|" - "StarOffice 6.0/7 Text Document Template|" - "OpenDocument Text|" - "OpenDocument Text Template|" - "OpenDocument Master Document|" - "HTML Document Template|" - "OpenDocument Spreadsheet|" - "OpenDocument Spreadsheet Template|" - "OpenDocument Drawing|" - "OpenDocument Drawing Template|" - "OpenDocument Presentation|" - "OpenDocument Presentation Template|" - "OpenDocument Formula|" - "OpenDocument Text Flat XML|" - "OpenDocument Spreadsheet Flat XML|" - "OpenDocument Drawing Flat XML|" - "OpenDocument Presentation Flat XML|" - "MS Word 97-2003 document|" - "MS Word 97-2003 document template|" - "MS Word document|" - "MS Word document with macros|" - "MS Word document template|" - "MS Word document template with macros|" - "Rich Text Format|" - "MS Excel 97-2003 spreadsheet|" - "MS Excel 97-2003 spreadsheet template|" - "MS Excel 97-2003 spreadsheet|" - "MS Excel spreadsheet|" - "MS Excel spreadsheet with macros|" - "MS Excel spreadsheet template|" - "MS Excel spreadsheet template with macros|" - "MS PowerPoint 97-2003 presentation|" - "MS PowerPoint presentation|" - "MS PowerPoint presentation with macros|" - "MS PowerPoint presentation template|" - "MS PowerPoint presentation template with macros\0" - VALUE "MIMEType", "application/vnd.sun.xml.calc|" - "application/vnd.sun.xml.calc.template|" - "application/vnd.sun.xml.draw|" - "application/vnd.sun.xml.draw.template|" - "application/vnd.sun.xml.impress|" - "application/vnd.sun.xml.impress.template|" - "application/vnd.sun.xml.math|" - "application/vnd.sun.xml.writer|" - "application/vnd.sun.xml.writer.global|" - "application/vnd.sun.xml.writer.template|" - "application/vnd.oasis.opendocument.text|" - "application/vnd.oasis.opendocument.text-template|" - "application/vnd.oasis.opendocument.text-master|" - "application/vnd.oasis.opendocument.text-web|" - "application/vnd.oasis.opendocument.spreadsheet|" - "application/vnd.oasis.opendocument.spreadsheet-template|" - "application/vnd.oasis.opendocument.graphics|" - "application/vnd.oasis.opendocument.graphics-template|" - "application/vnd.oasis.opendocument.presentation|" - "application/vnd.oasis.opendocument.presentation-template|" - "application/vnd.oasis.opendocument.formula|" - "application/vnd.oasis.opendocument.text-flat-xml|" - "application/vnd.oasis.opendocument.spreadsheet-flat-xml|" - "application/vnd.oasis.opendocument.graphics-flat-xml|" - "application/vnd.oasis.opendocument.presentation-flat-xml|" - "application/msword|" - "application/msword|" - "application/vnd.openxmlformats-officedocument.wordprocessingml.document|" - "application/vnd.ms-word.document.macroenabled.12|" - "application/vnd.openxmlformats-officedocument.wordprocessingml.template|" - "application/vnd.ms-word.template.macroenabled.12|" - "application/rtf|" - "application/vnd.ms-excel|" - "application/vnd.ms-excel|" - "application/vnd.ms-excel|" - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|" - "application/vnd.ms-excel.sheet.macroenabled.12|" - "application/vnd.openxmlformats-officedocument.spreadsheetml.template|" - "application/vnd.ms-excel.template.macroenabled.12|" - "application/vnd.ms-powerpoint|" - "application/vnd.openxmlformats-officedocument.presentationml.presentation|" - "application/vnd.ms-powerpoint.presentation.macroenabled.12|" - "application/vnd.openxmlformats-officedocument.presentationml.template|" - "application/vnd.ms-powerpoint.template.macroenabled.12\0" - } - } - - BLOCK "VarFileInfo" - { - VALUE "Translation", 0x0409, 1252 - } - } diff --git a/extensions/source/nsplugin/source/so_closelistener.cxx b/extensions/source/nsplugin/source/so_closelistener.cxx deleted file mode 100644 index 6dc4bbbe0145..000000000000 --- a/extensions/source/nsplugin/source/so_closelistener.cxx +++ /dev/null @@ -1,48 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include "so_closelistener.hxx" - -using namespace ::com::sun::star; - -void SAL_CALL PluginDocumentClosePreventer::queryClosing( const lang::EventObject& /*aEvent*/, sal_Bool /*bDeliverOwnership*/ ) - throw ( uno::RuntimeException, util::CloseVetoException, std::exception ) -{ - if ( m_bPreventClose ) - throw util::CloseVetoException(); -} - -void SAL_CALL PluginDocumentClosePreventer::notifyClosing( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException, std::exception ) -{} - -void SAL_CALL PluginDocumentClosePreventer::disposing( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException, std::exception ) -{} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/so_closelistener.hxx b/extensions/source/nsplugin/source/so_closelistener.hxx deleted file mode 100644 index ff5fabdfa731..000000000000 --- a/extensions/source/nsplugin/source/so_closelistener.hxx +++ /dev/null @@ -1,56 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_EXTENSIONS_SOURCE_NSPLUGIN_SOURCE_SO_CLOSELISTENER_HXX -#define INCLUDED_EXTENSIONS_SOURCE_NSPLUGIN_SOURCE_SO_CLOSELISTENER_HXX - -#include <com/sun/star/util/XCloseListener.hpp> -#include <cppuhelper/implbase1.hxx> - -class PluginDocumentClosePreventer : public ::cppu::WeakImplHelper1< ::com::sun::star::util::XCloseListener > -{ - bool m_bPreventClose; - -public: - PluginDocumentClosePreventer() - : m_bPreventClose( true ) - {} - - void StopPreventClose() { m_bPreventClose = false; } - - virtual void SAL_CALL queryClosing( const ::com::sun::star::lang::EventObject& aEvent, sal_Bool bDeliverOwnership ) - throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::util::CloseVetoException, std::exception ) SAL_OVERRIDE; - - virtual void SAL_CALL notifyClosing( const ::com::sun::star::lang::EventObject& aEvent ) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE ; - - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE ; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/so_env.cxx b/extensions/source/nsplugin/source/so_env.cxx deleted file mode 100644 index a2a98d9c3107..000000000000 --- a/extensions/source/nsplugin/source/so_env.cxx +++ /dev/null @@ -1,507 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <config_folders.h> - -#include "sal/config.h" - -#include "nsp_func.hxx" - -#ifdef UNIX -#include <sys/types.h> -#include <strings.h> -#ifdef LINUX -#include <dlfcn.h> -#endif -#include <stdarg.h> -#endif // End UNIX - -#ifdef WNT - -#ifdef _MSC_VER -#pragma warning (push,1) -#pragma warning (disable:4668) -#pragma warning (disable:4917) -#endif - -#include <windows.h> -#include <direct.h> -#include <stdlib.h> -#include <shlobj.h> -#include <objidl.h> - -#ifdef _MSC_VER -#pragma warning (pop) -#endif -#endif // End WNT - -#include <sys/stat.h> -#include <errno.h> -#include "so_env.hxx" -#include "ns_debug.hxx" -#include <sal/config.h> - -// Tranform all strings like %20 in pPath to one char like space -/*int retoreUTF8(char* pPath) -{ - // Prepare buf - int len = strlen(pPath) + 1; - char* pBuf = (char*)malloc(len); - memset(pBuf, 0, len); - - // Store the original pBuf and pPath - char* pBufCur = pBuf; - char* pPathCur = pPath; - // ie, for %20, UTF8Numbers[0][0] = 2, UTF8Numbers[1][0] = 0 - char UTF8Numbers[2][2] = {{0, 0}, {0,0}}; - int temp; - - while (*pPathCur) { - if (('%' == *pPathCur) && (0 != *(pPathCur + 1)) - && (0 != *(pPathCur + 2))) - { - UTF8Numbers[0][0] = *(pPathCur + 1); - UTF8Numbers[1][0] = *(pPathCur + 2); - temp = 0; - temp = atoi(UTF8Numbers[0])*16 + atoi(UTF8Numbers[1]); - *pBufCur = (char)temp; - pBufCur++; - pPathCur += 3; - } else { - *pBufCur++ = *pPathCur++; - } - } - - *pBufCur = 0; - strcpy(pPath, pBuf); - free(pBuf); - return 0; -}*/ - -int -restoreUTF8(char *pPath) -{ - unsigned char *s, *d; - -#define XDIGIT(c) ((c) <= '9' ? (c) - '0' : ((c) & 0x4F) - 'A' + 10) - - s = d = (unsigned char *)pPath; - do { - if (*s == '%' && s[1] && s[2]) { - *d++ = (XDIGIT (s[1]) << 4) + XDIGIT (s[2]); - s += 2; - } else - *d++ = *s; - } while (*s++); - debug_fprintf(NSP_LOG_APPEND, "after restoreUTF8, pPath is %s\n", pPath); - return 0; -} - -#ifdef LINUX -extern int nspluginOOoModuleHook (void** aResult); -int nspluginOOoModuleHook (void** aResult) -{ - void *dl_handle; - - dl_handle = dlopen(NULL, RTLD_NOW); - if (!dl_handle) - { - fprintf (stderr, "Can't open myself '%s'\n", dlerror()); - return 1; - } - dlclose(dl_handle); - - Dl_info dl_info = { 0,0,0,0 }; - if(!dladdr((void *)nspluginOOoModuleHook, &dl_info)) - { - fprintf (stderr, "Can't find my own address '%s'\n", dlerror()); - return 1; - } - - if (!dl_info.dli_fname) - { - fprintf (stderr, "Can't find my own file name\n"); - return 1; - } - - char cwdstr[NPP_PATH_MAX]; - if (!getcwd (cwdstr, sizeof(cwdstr))) - { - fprintf (stderr, "Can't get cwd\n"); - return 1; - } - - char libFileName[NPP_PATH_MAX]; - - if (dl_info.dli_fname[0] != '/') - { - if ((strlen(cwdstr) + 1 + strlen(dl_info.dli_fname)) >= NPP_PATH_MAX) - { - fprintf (stderr, "Plugin path too long\n"); - return 1; - } - strcpy (libFileName, cwdstr); - strcat (libFileName, "/"); - strcat (libFileName, dl_info.dli_fname); - } - else - { - if (strlen(dl_info.dli_fname) >= NPP_PATH_MAX) - { - fprintf (stderr, "Plugin path too long\n"); - return 1; - } - strcpy (libFileName, dl_info.dli_fname); - } - - char *clobber; - static char realFileName[NPP_PATH_MAX] = {0}; -# define SEARCH_SUFFIX "/" LIBO_LIB_FOLDER "/libnpsoplug" - - if (!(clobber = strstr (libFileName, SEARCH_SUFFIX))) - { - ssize_t len = readlink(libFileName, realFileName, NPP_PATH_MAX-1); - if (len == -1) - { - fprintf (stderr, "Couldn't read link '%s'\n", libFileName); - return 1; - } - realFileName[len] = '\0'; - if (!(clobber = strstr (realFileName, SEARCH_SUFFIX))) - { - fprintf (stderr, "Couldn't find suffix in '%s'\n", realFileName); - return 1; - } - *clobber = '\0'; - } - else - { - *clobber = '\0'; - strcpy (realFileName, libFileName); - } - -#if OSL_DEBUG_LEVEL > 0 - fprintf (stderr, "LibreOffice path before fixup is '%s'\n", realFileName); -#endif - - if (realFileName[0] != '/') { - /* a relative sym-link and we need to get an absolute path */ - char scratch[NPP_PATH_MAX] = {0}; - if (strlen (realFileName) + strlen (libFileName) + 2 >= NPP_PATH_MAX - 1) - { - fprintf (stderr, "Paths too long to fix up.\n"); - return 1; - } - strcpy (scratch, libFileName); - if (strrchr (scratch, '/')) /* remove the last element */ - *(strrchr (scratch, '/') + 1) = '\0'; - strcat (scratch, realFileName); - strcpy (realFileName, scratch); - } - - *aResult = realFileName; - -#if OSL_DEBUG_LEVEL > 0 - fprintf (stderr, "LibreOffice path is '%s'\n", realFileName); -#endif - - return 0; -} -#endif - -// *aResult points the static string holding "/opt/staroffice8" -int findReadSversion(void** aResult, int /*bWnt*/, const char* /*tag*/, const char* /*entry*/) -{ -#ifdef UNIX - // The real space to hold "/opt/staroffice8" - static char realFileName[NPP_PATH_MAX] = {0}; - memset(realFileName, 0, NPP_PATH_MAX); - *aResult = realFileName; - - // Filename of lnk file, eg. "soffice" - char lnkFileName[NPP_PATH_MAX] = {0}; - char* pTempZero = NULL; - -#ifdef LINUX - /* try to fetch a 'self' pointer */ - if (!nspluginOOoModuleHook (aResult)) - return 0; - - /* .. now in $HOME */ -#endif // LINUX - snprintf(lnkFileName, NPP_PATH_MAX - 1, "%s/.mozilla/plugins/libnpsoplugin%s", getenv("HOME"), SAL_DLLEXTENSION); -#ifdef LINUX - ssize_t len = readlink(lnkFileName, realFileName, NPP_PATH_MAX-1); - if (-1 == len) - { - *realFileName = 0; - return -1; - } - realFileName[len] = '\0'; - - if (NULL == (pTempZero = strstr(realFileName, "/" LIBO_LIB_FOLDER "/libnpsoplugin" SAL_DLLEXTENSION))) -#else // LINUX - if ((0 > readlink(lnkFileName, realFileName, NPP_PATH_MAX)) || - (NULL == (pTempZero = strstr(realFileName, "/" LIBO_LIB_FOLDER "/libnpsoplugin" SAL_DLLEXTENSION)))) -#endif // LINUX - { - *realFileName = 0; - return -1; - } - *pTempZero = 0; - return 0; -#elif defined WNT // UNIX - static char realFileName[NPP_PATH_MAX] = {0}; - *aResult = realFileName; - HKEY hKey; - DWORD dwBufLen = NPP_PATH_MAX; - LONG lRet; - - debug_fprintf(NSP_LOG_APPEND, "1 before before strstr realFileName is %s\n", realFileName); - lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE, - "SOFTWARE\\MozillaPlugins\\@sun.com/npsopluginmi;version=1.0", - 0, KEY_QUERY_VALUE, &hKey ); - if (lRet == ERROR_FILE_NOT_FOUND) { - lRet = RegOpenKeyEx( - HKEY_CURRENT_USER, - "SOFTWARE\\MozillaPlugins\\@sun.com/npsopluginmi;version=1.0", 0, - KEY_QUERY_VALUE, &hKey); - } - debug_fprintf(NSP_LOG_APPEND, "2 before before strstr realFileName is %s\n", realFileName); - if( lRet != ERROR_SUCCESS ) - return FALSE; - - lRet = RegQueryValueEx( hKey, "Path", NULL, NULL, - (LPBYTE) realFileName, &dwBufLen); - debug_fprintf(NSP_LOG_APPEND, "3 before before strstr realFileName is %s\n", realFileName); - if( (lRet != ERROR_SUCCESS) || (dwBufLen > NPP_PATH_MAX) ) - return FALSE; - - RegCloseKey( hKey ); - char* pTempZero = NULL; - debug_fprintf(NSP_LOG_APPEND, "before strstr realFileName is %s\n", realFileName); - if (NULL == (pTempZero = strstr(realFileName, "\\program"))) - { - *realFileName = 0; - return -1; - } - *pTempZero = 0; - debug_fprintf(NSP_LOG_APPEND, "realFileName is %s\n", realFileName); - return 0; -#endif // UNIX -} - -// Return the install dir path of staroffice, return value like "/home/build/staroffice" -const char* findInstallDir() -{ - static char* pInstall = NULL; - debug_fprintf(NSP_LOG_APPEND, "start of findInstallDir()\n"); - if (!pInstall) - { - findReadSversion((void**)&pInstall, 0, "[" SECTION_NAME "]", SOFFICE_VERSION "="); - if (!pInstall) - pInstall = const_cast< char* >( "" ); - } - return pInstall; -} - -// Return the program dir path of staroffice, return value like "/home/build/staroffice/program" -const char* findProgramDir() -{ - static char sProgram[NPP_BUFFER_SIZE] = {0}; - if (!sProgram[0]) - { - sprintf(sProgram, "%s/" LIBO_BIN_FOLDER, findInstallDir()); -#ifdef WNT - UnixToDosPath(sProgram); -#endif - } - return sProgram; -} - -#ifdef WNT -// Return SO executable absolute path, like "/home/build/staroffice/program/soffice" -const char* findSofficeExecutable() -{ - static char pSofficeExeccutable[NPP_PATH_MAX] = {0}; - if (!pSofficeExeccutable[0]) - { - sprintf(pSofficeExeccutable, "%s/%s", findProgramDir(), STAROFFICE_EXE_FILE_NAME); -#ifdef WNT - UnixToDosPath(pSofficeExeccutable); -#endif - } - - return pSofficeExeccutable; -} - -// Change Dos path such as c:\program\soffice to c:/program/soffice -int DosToUnixPath(char* sPath) -{ - if (!sPath) - return -1; - char* p = sPath; - while (*p) - { - if(*p == '\\') - *p = '/'; - p++; - } - return 0; - -} -#endif -// Change Unix path such as program/soffice to program\soffice -int UnixToDosPath(char* sPath) -{ - if (!sPath) - return -1; - char* p = sPath; - while (*p) - { - if(*p == '/') - *p = '\\'; - p++; - } - return 0; - -} - -#ifdef UNIX -#define PLUGIN_NAME "LibreOffice" -char productName[128] = {0}; -char* NSP_getProductName() -{ - if(productName[0]) - return productName; - char fullBootstrapIniPath[1024] = {0}; - const char* pFullFilePath = findProgramDir(); - if(0 == *pFullFilePath) - { - strcpy(productName, PLUGIN_NAME); - return productName; - } - sprintf(fullBootstrapIniPath, "%s/%s", pFullFilePath, - "bootstraprc"); - - FILE* fp = fopen(fullBootstrapIniPath, "r"); - - if (NULL == fp) - { - strcpy(productName, PLUGIN_NAME); - return productName; - } - char line[4096] = {0}; - char *pStart = 0; - char *pEnd = 0; - while(!feof(fp)) - { - if (fgets( line, sizeof(line), fp ) == NULL) - continue; - if (NULL == (pStart = strstr( line, "ProductKey=" ))) - continue; - pStart += strlen("ProductKey="); - if (NULL == (pEnd = strchr( pStart, ' ' )) && - (NULL == (pEnd = strchr( pStart, '\r' )))) - continue; - *pEnd = 0; - if (static_cast<size_t>(pEnd - pStart) <= sizeof(productName)) - strcpy(productName, pStart); - } - fclose(fp); - if (*productName == 0) - { - strcpy(productName, PLUGIN_NAME); - return productName; - } - return productName; -} - -char PluginName[1024] = {0}; -char* NSP_getPluginName() -{ - if(*PluginName) - return PluginName; - sprintf(PluginName, "%s Plug-in", NSP_getProductName()); - return PluginName; -} - -char PluginDesc[1024] = {0}; -char* NSP_getPluginDesc() -{ - if(*PluginDesc) - return PluginDesc; - - sprintf(PluginDesc, "%s Plug-in handles all its documents", - productName); - return PluginDesc; -} -#endif //end of UNIX - -void NSP_WriteLog(int level, const char* pFormat, ...) -{ - (void)level; -#ifndef DEBUG - (void)pFormat; -#else - va_list ap; - char msgBuf[NPP_BUFFER_SIZE]; - static char logName[NPP_PATH_MAX] = {0}; - FILE * fp = NULL; - - va_start(ap,pFormat); - NSP_vsnprintf(msgBuf, NPP_BUFFER_SIZE, pFormat, ap); - va_end(ap); - - if (!logName[0]) - { -#ifdef UNIX - const char* homeDir = getenv("HOME"); - sprintf(logName,"%s/%s",homeDir,"nsplugin.log"); -#endif // End UNIX -#ifdef WNT - char szPath[MAX_PATH]; - if (!SHGetSpecialFolderPath(NULL, szPath, CSIDL_APPDATA, 0)) - { - return; - } - char* homeDir = szPath; - sprintf(logName,"%s\\%s", szPath, "nsplugin.log"); -#endif // End WNT - } - else - fp = fopen(logName, "a+"); - - if (!fp) - return; - fputs(msgBuf, fp); - fclose(fp); -#endif -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/so_env.hxx b/extensions/source/nsplugin/source/so_env.hxx deleted file mode 100644 index 28c6c6716409..000000000000 --- a/extensions/source/nsplugin/source/so_env.hxx +++ /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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_EXTENSIONS_SOURCE_NSPLUGIN_SOURCE_SO_ENV_HXX -#define INCLUDED_EXTENSIONS_SOURCE_NSPLUGIN_SOURCE_SO_ENV_HXX - - - -#ifdef UNIX - -#include <unistd.h> -#include <pthread.h> -#include <sys/types.h> -#include <sys/socket.h> - -#endif //end of UNIX - - -#include <stdio.h> -#include <stdlib.h> -#include <ctype.h> -#include <string.h> - -#define SO_SERVER_PORT 8100 - - -#ifdef UNIX -#define STAROFFICE_VERSION_FILE "/.sversionrc" -#define STAROFFICE_EXE_FILE_NAME "soffice" -#endif -#ifdef WNT -#define STAROFFICE_VERSION_FILE "\\sversion.ini" -#define STAROFFICE_EXE_FILE_NAME "soffice.exe" -#endif - -#define SECTION_NAME "Versions" -#define SOFFICE_VERSION "StarOffice 8" - -#define APP_ERROR 1 -#define APP_CHAR 2 -#define APP_WCHAR 3 - -// return the install path of staroffice, return value like "/home/build/staroffice" -const char* findInstallDir(); - -// return SO program dir absolute path, like "/home/build/staroffice/program" -const char* findProgramDir(); - -#ifdef WNT -// return SO executable absolute path, like "/home/build/staroffice/program/soffice" -const char* findSofficeExecutable(); - -// change Dos path such as c:\program\soffice to c:/program/soffice -int DosToUnixPath(char*); -#endif - -//change Unix path such as program\soffice to program/soffice -int UnixToDosPath(char*); - -void NSP_WriteLog(int level, const char* pFormat, ...); - -int restoreUTF8(char* pPath); - -char* NSP_getPluginName(); - -char* NSP_getPluginDesc(); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/so_instance.cxx b/extensions/source/nsplugin/source/so_instance.cxx deleted file mode 100644 index 1a338aa51992..000000000000 --- a/extensions/source/nsplugin/source/so_instance.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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/frame/Desktop.hpp> -#include <com/sun/star/frame/DispatchHelper.hpp> -#include <com/sun/star/frame/XDispatchProviderInterception.hpp> -#include <com/sun/star/frame/Frame.hpp> -#include <com/sun/star/lang/SystemDependent.hpp> -#include <com/sun/star/awt/Toolkit.hpp> -#include <com/sun/star/awt/XVclWindowPeer.hpp> -#include <com/sun/star/util/XCloseable.hpp> -#include <com/sun/star/lang/DisposedException.hpp> -#include <com/sun/star/ucb/SimpleFileAccess.hpp> -#include <com/sun/star/presentation/XPresentation.hpp> -#include <com/sun/star/presentation/XPresentationSupplier.hpp> -#include <comphelper/processfactory.hxx> -#include <tools/color.hxx> -#include <rtl/textenc.h> -#include <rtl/locale.h> -#include <osl/nlsupport.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> - -#include "so_instance.hxx" -#include "ns_debug.hxx" -#include "so_env.hxx" -#include "nsp_windows.hxx" -#include "so_closelistener.hxx" -#include <osl/process.h> - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::connection; -using namespace cppu; -using namespace com::sun::star; - - -char SoPluginInstance::sSO_Dir[] = {0}; -Reference< XMultiServiceFactory > SoPluginInstance::mxRemoteMSF = Reference< XMultiServiceFactory >(NULL); - -SoPluginInstance::SoPluginInstance(long pParent, Reference< XMultiServiceFactory > xMSF): - m_xUnoWin(NULL), - m_xComponent(NULL), - m_xFrame(NULL), - m_xFrames(NULL), - m_xDispatcher(NULL), - m_xDispatchProvider(NULL), - m_pCloseListener(NULL) -{ - m_nWidth = 0; - m_nHeight = 0; - m_nX = 0; - m_nY = 0; - m_nFlag = 15; - m_bInit = false; - m_hParent = 0; - m_pParent = pParent; - m_dParentStyl = 0; - mxRemoteMSF = xMSF; -} - -SoPluginInstance::~SoPluginInstance() -{ -} - -bool SoPluginInstance::SetURL(char* aURL) -{ - debug_fprintf(NSP_LOG_APPEND, "SoPluginInstance::SetURL %s\n", aURL); - - rtl_Locale* pLocale = NULL; - osl_getProcessLocale(&pLocale); - sal_uInt16 encoding = osl_getTextEncodingFromLocale(pLocale); - - m_sURL = OUString(aURL, strlen(aURL), encoding); - debug_fprintf(NSP_LOG_APPEND, "SetURL %s\nencoding is: %d\n", OUStringToOString(m_sURL, - RTL_TEXTENCODING_GB_18030).getStr(), m_sURL.getLength(), encoding); - return true; -} - -// plugin window UI part: create window, load document -bool SoPluginInstance::LoadDocument(NSP_HWND hParent) -{ - // If doc has been loaded, we just resize the window and return - if(m_bInit) - { - debug_fprintf(NSP_LOG_APPEND, "only reset windows size\n"); - m_xUnoWin->setPosSize( m_nX, m_nY, m_nWidth, m_nHeight, m_nFlag ); - debug_fprintf(NSP_LOG_APPEND, "set windows to x:%d y:%d w:%d h%d falg:%d\n", - m_nX, m_nY, m_nWidth, m_nHeight, m_nFlag); - return true; - } - - // If mxRemoteMSF is not initialized, we assert and return sal_False - if(!mxRemoteMSF.is()) - { - debug_fprintf(NSP_LOG_APPEND, "Remote StarOfiice ServiceManager is not initilzed correctly!\n"); - return false; - } - - try - { - Reference< beans::XPropertySet > xFactoryProperties( mxRemoteMSF, uno::UNO_QUERY ); - Reference< uno::XComponentContext > xContext( xFactoryProperties->getPropertyValue( "DefaultContext" ), UNO_QUERY ); - - // try to create netscape plugin window - Reference< awt::XToolkit2 > xToolkit( awt::Toolkit::create(xContext) ); - - // prepare parameters for plugin window - css::uno::Any hwndParent = css::uno::makeAny((sal_Int32)hParent); -#ifdef UNIX - sal_Int16 nWindowType = css::lang::SystemDependent::SYSTEM_XWINDOW; -#endif //end of UNIX -#ifdef WNT - sal_Int16 nWindowType = css::lang::SystemDependent::SYSTEM_WIN32; -#endif //end of WNT - - debug_fprintf(NSP_LOG_APPEND, "print by Nsplugin, try to create plugin container window HWIN:%ld.\n", hParent); - - // create the plugin window - Reference< awt::XWindowPeer > xNewWinPeer = - xToolkit->createSystemChild( hwndParent, - css::uno::Sequence<sal_Int8>(), nWindowType ); - if ( !xNewWinPeer.is() ) - { - debug_fprintf(NSP_LOG_APPEND, "can not create first window\n", hParent); - return false; - } - - // get interface of first window - m_xUnoWin = Reference< awt::XWindow >( xNewWinPeer, uno::UNO_QUERY ); - if( !m_xUnoWin.is() ) - { - debug_fprintf(NSP_LOG_APPEND, "can not get interface of first window\n", hParent); - return false; - } - - // initialize window - xNewWinPeer->setBackground( COL_GRAY ); - m_xUnoWin->setVisible( sal_True ); - m_xUnoWin->setPosSize( m_nX, m_nY, m_nWidth, m_nHeight, m_nFlag ); - debug_fprintf(NSP_LOG_APPEND, "set windows to x:%d y:%d w:%d h%d falg:%d\n", - m_nX, m_nY, m_nWidth, m_nHeight, m_nFlag); - - // create frame - m_xFrame = frame::Frame::create( xContext ); - - // initialize frame - m_xFrame->initialize( m_xUnoWin ); - - try - { - // currently ignore errors in this code - uno::Reference< beans::XPropertySet > xFrameProps( m_xFrame, uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xLMProps; - xFrameProps->getPropertyValue("LayoutManager") >>= xLMProps; - if ( xLMProps.is() ) - xLMProps->setPropertyValue("AutomaticToolbars", uno::makeAny( false ) ); - } - catch( const uno::Exception& ) - {} - - // get frames supplier - Reference< frame::XDesktop2 > xFramesSupplier = frame::Desktop::create( xContext ); - - // get frames - m_xFrames = xFramesSupplier->getFrames(); - if ( !m_xFrames.is() ) - { - debug_fprintf(NSP_LOG_APPEND, "can not get frames from FramesSupplier\n"); - return false; - } - - // append m_xFrame to m_xFrames - m_xFrames->append( Reference<frame::XFrame>(m_xFrame, uno::UNO_QUERY_THROW) ); - - // create XComponentLoader - Reference< frame::XComponentLoader > xLoader( m_xFrame, uno::UNO_QUERY ); - if ( !xLoader.is() ) - { - debug_fprintf(NSP_LOG_APPEND, "can not get ComponentLoader to load URL\n"); - return false; - } - - //create stream for the document - Reference< ucb::XSimpleFileAccess3 > xSimpleFileAccess( ucb::SimpleFileAccess::create(xContext) ); - Reference<io::XInputStream> xInputStream = xSimpleFileAccess->openFileRead( m_sURL ); - - if(!xInputStream.is()) - { - debug_fprintf(NSP_LOG_APPEND, "can not create XInputStream for URL\n"); - return false; - } - - // prepare to load document - debug_fprintf(NSP_LOG_APPEND, "try to load document\n"); - Sequence< ::com::sun::star::beans::PropertyValue > setPropValues(3); - setPropValues[0].Name = "ViewOnly"; - setPropValues[0].Value <<= sal_True; - setPropValues[1].Name = "ReadOnly"; - setPropValues[1].Value <<= sal_True; - setPropValues[2].Name = "InputStream"; - setPropValues[2].Value <<= xInputStream; - /* - setPropValues[ 3 ].Name = "FilterName"; - setPropValues[ 3 ].Value = "Flat XML File";*/ - - debug_fprintf(NSP_LOG_APPEND, "try to load copy of URL from local file %s:%d\n", - OUStringToOString( m_sURL, RTL_TEXTENCODING_ASCII_US ).getStr( ), - m_sURL.getLength() ); - - // load document - Sequence< ::com::sun::star::beans::PropertyValue > setPropValues2(3); - setPropValues2[0].Name = "ViewOnly"; - setPropValues2[0].Value <<= sal_True; - setPropValues2[1].Name = "ReadOnly"; - setPropValues2[1].Value <<= sal_True; - setPropValues2[2].Name = "AsTemplate"; - setPropValues2[2].Value <<= sal_False; - m_xComponent = xLoader->loadComponentFromURL( - m_sURL, - m_xFrame->getName(), 0, setPropValues2 ); - - if ( !m_xComponent.is() ) - { - debug_fprintf(NSP_LOG_APPEND, "print by Nsplugin, Load Componment error\n"); - return false; - } - - // register the closelistener that will prevent closing of the component - Reference< util::XCloseable > xCloseable( m_xFrame, uno::UNO_QUERY ); - if ( xCloseable.is() ) - { - m_pCloseListener = new PluginDocumentClosePreventer(); - m_xCloseListener = Reference< util::XCloseListener >( m_pCloseListener ); - xCloseable->addCloseListener( m_xCloseListener ); - } - - //free the input stream, it is hold by the m_xComponent - xInputStream.clear(); - - debug_fprintf(NSP_LOG_APPEND, "load document success\n"); - - // create frame::XDispatchHelper and frame::XDispatchProvider - m_xDispatcher = Reference< frame::XDispatchHelper >( frame::DispatchHelper::create( xContext ) ); - m_xDispatchProvider = Reference< frame::XDispatchProvider >(m_xFrame, uno::UNO_QUERY); - if(!m_xDispatchProvider.is()) - { - debug_fprintf(NSP_LOG_APPEND, "m_xDispatchProvider can not be getten\n"); - return false; - } - - //try to enable toolbar and tool windows - Sequence< ::com::sun::star::beans::PropertyValue > propertyValue(1); - propertyValue[0].Name = "FunctionBarVisible"; - propertyValue[0].Value <<= sal_True; - m_xDispatcher->executeDispatch(m_xDispatchProvider, - OUString(".uno:FunctionBarVisible"), - m_xFrame->getName(), 0, - propertyValue ); - - // reset window style of parent window -#ifdef WNT - m_dParentStyl = ::NSP_ResetWinStyl (m_hParent); -#endif - m_bInit = true; - - try - { - // in case of presentation try to set the mode of slide-show, and start it - uno::Reference< presentation::XPresentationSupplier > xPresSuppl( m_xComponent, uno::UNO_QUERY_THROW ); - uno::Reference< presentation::XPresentation > xPres( xPresSuppl->getPresentation(), uno::UNO_SET_THROW ); - uno::Reference< beans::XPropertySet > xProps( xPresSuppl->getPresentation(), uno::UNO_QUERY_THROW ); - xProps->setPropertyValue("IsFullScreen", uno::makeAny( sal_False ) ); - xPres->start(); - } - catch( const uno::Exception& ) - {} - } - catch( const uno::Exception& e ) - { - debug_fprintf(NSP_LOG_APPEND, "Unknown exception while loading document in netscape plugin windows\n"); - OString o = OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ); - debug_fprintf(NSP_LOG_APPEND, "error: %s \n", o.pData->buffer ); - return false; - } - return true; -} - -bool SoPluginInstance::SetWindow(NSP_HWND hParent, int x, int y, int w, int h) -{ - bool bRetval(true); - - if ( m_hParent && !hParent ) - { - // the plugin instance has the parent window set already and now it becomes NULL as parent window - // that means that the instance should be closed - Destroy(); - m_hParent = hParent; - } - else - { - m_hParent = hParent; - - debug_fprintf(NSP_LOG_APPEND, "SoPluginInstance::SetWindow %s : %d\n", - OUStringToOString(m_sURL, RTL_TEXTENCODING_ASCII_US).getStr(), - m_sURL.getLength() ); - m_nWidth = w; - m_nHeight =h; - m_nX = x; - m_nY = y; - - if ( m_sURL.isEmpty() ) - return true; - - if(!mxRemoteMSF.is()) - { - debug_fprintf(NSP_LOG_APPEND, "Remote StarOfiice ServiceManager is not initilzed correctly!\n"); - return false; - } - debug_fprintf(NSP_LOG_APPEND, "in SoPluginInstance::SetWindow, begin LoadDocument(hParent)\n"); - bRetval = LoadDocument(hParent); // Load document into current window - if(!bRetval){ - // try to reload document again - debug_fprintf(NSP_LOG_APPEND, "load document error, try to reload it once again\n"); - mxRemoteMSF.clear(); - m_bInit = false; - bRetval = LoadDocument(hParent); - debug_fprintf(NSP_LOG_APPEND, "load document again, return %d\n", bRetval ? 1 : 0); - } - } - - return bRetval; -} - -bool SoPluginInstance::Destroy(void) -{ -#ifdef WNT - if(m_dParentStyl != 0) - NSP_RestoreWinStyl(m_hParent, m_dParentStyl); -#endif - - uno::Reference< util::XCloseable > xCloseable( m_xFrame, uno::UNO_QUERY ); - - try - { - if ( m_xCloseListener.is() ) - { - if ( m_pCloseListener ) - m_pCloseListener->StopPreventClose(); - - if ( xCloseable.is() ) - xCloseable->removeCloseListener( m_xCloseListener ); - } - } - catch( const uno::Exception& ) - {} - - try - { - uno::Sequence< uno::Any > aArgs( 1 ); - aArgs[0] <<= m_xFrame; - uno::Reference< lang::XComponent > xDocumentCloser( - mxRemoteMSF->createInstanceWithArguments( - OUString( "com.sun.star.embed.DocumentCloser" ), - aArgs ), - uno::UNO_QUERY_THROW ); - - xDocumentCloser->dispose(); // this call should close the document - } - catch( const uno::Exception& ) - { - debug_fprintf(NSP_LOG_APPEND, "print by Nsplugin.exe, could not close the document correctly!\n"); - try - { - if ( xCloseable.is() ) - xCloseable->close( sal_True ); - else - { - uno::Reference< lang::XComponent > xDisposable( m_xFrame, uno::UNO_QUERY ); - if ( xDisposable.is() ) - xDisposable->dispose(); - } - } - catch (const uno::Exception&) - { - } - } - - m_xUnoWin.clear(); - m_xComponent.clear(); - m_xFrame.clear(); - m_xFrames.clear(); - m_xDispatcher.clear(); - m_xDispatchProvider.clear(); - return true; -} - -bool SoPluginInstance::Print(void) -{ - if(!m_xDispatcher.is()) - return false; - - Sequence< ::com::sun::star::beans::PropertyValue > propertyValue(1); - m_xDispatcher->executeDispatch(m_xDispatchProvider, - OUString(".uno:PrintDefault"), - m_xFrame->getName(), 0, - propertyValue ); - return true; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/so_instance.hxx b/extensions/source/nsplugin/source/so_instance.hxx deleted file mode 100644 index 3111b27d62d1..000000000000 --- a/extensions/source/nsplugin/source/so_instance.hxx +++ /dev/null @@ -1,114 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_EXTENSIONS_SOURCE_NSPLUGIN_SOURCE_SO_INSTANCE_HXX -#define INCLUDED_EXTENSIONS_SOURCE_NSPLUGIN_SOURCE_SO_INSTANCE_HXX - -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <osl/diagnose.h> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/io/XActiveDataSource.hpp> -#include <com/sun/star/bridge/XUnoUrlResolver.hpp> -#include <com/sun/star/uno/XNamingService.hpp> -#include <com/sun/star/connection/ConnectionSetupException.hpp> -#include <com/sun/star/frame/XComponentLoader.hpp> -#include <com/sun/star/frame/XLayoutManager.hpp> -#include <com/sun/star/util/URL.hpp> -#include <com/sun/star/frame/XStorable.hpp> -#include <com/sun/star/io/XSeekable.hpp> - -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/util/XCloseListener.hpp> -#include <cppuhelper/bootstrap.hxx> -#include <com/sun/star/awt/WindowDescriptor.hpp> -#include <rtl/ustring.hxx> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/frame/XFrame2.hpp> -#include <com/sun/star/frame/XDispatchHelper.hpp> - -#include "ns_debug.hxx" - -typedef sal_Int32 NSP_HWND; - -class PluginDocumentClosePreventer; -class SoPluginInstance -{ - -private: - // Service manager of remote Soffice - static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxRemoteMSF; - // Dir where Soffice is in, ie. /Soffice7/program - static char sSO_Dir[NPP_PATH_MAX]; - int m_nWidth; - int m_nHeight; - int m_nX; - int m_nY; - sal_Int16 m_nFlag; // Set to 12 during initialization - OUString m_sURL; // URL of the document to be loaded - bool m_bInit; // If the Plugin instance is initilaized. - NSP_HWND m_hParent; // Windows handle of parent window - long m_pParent; // ID of this instance - get from NPP - // StarOffice window - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xUnoWin; - // StarOffice component window - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xComponent; - // StarOffice frame for this Plugin - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame2 > m_xFrame; - // Frames of StarOffice - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrames > m_xFrames; - // Dispatcher of frame - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchHelper > m_xDispatcher; - // DispatchProvider of frame - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider; - - // the closelistener that will prevent document closing - PluginDocumentClosePreventer* m_pCloseListener; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener > m_xCloseListener; - - bool LoadDocument(NSP_HWND hParent); - - long m_dParentStyl; // Old Windows style of parent window - - -public: - SoPluginInstance(long iInstance, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF); - virtual ~SoPluginInstance(void); - virtual bool SetURL(char* aURL); - virtual bool IsInit(void){return m_bInit;}; - virtual bool SetWindow(NSP_HWND hParent, int x, int y, int w, int h) ; - virtual bool Destroy(void) ; - virtual bool Print(void) ; - - static bool ShutDown(void); - static char* GetSODir(void) {return sSO_Dir;}; - long GetParent(void) {return m_pParent;}; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/so_main.cxx b/extensions/source/nsplugin/source/so_main.cxx deleted file mode 100644 index 80a009c70f5d..000000000000 --- a/extensions/source/nsplugin/source/so_main.cxx +++ /dev/null @@ -1,494 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifdef UNIX -#include <sys/stat.h> -#include <sys/socket.h> -#include <sys/types.h> -#include <arpa/inet.h> -#include <netinet/in.h> -#endif //end of UNIX - -#ifdef WNT -#ifdef _MSC_VER -#pragma once -#pragma warning (push,1) -#pragma warning (disable:4668) -#endif -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#include <winsock2.h> -#include <malloc.h> -#include <memory.h> -#include <tchar.h> -#ifdef _MSC_VER -#pragma warning (pop) -#endif -#endif //end of WNT - -#include <stdio.h> -#include <stdlib.h> -#include <errno.h> -#include "boost/scoped_array.hpp" - -#include "ns_debug.hxx" -#include "so_msg.hxx" -#include "so_instance.hxx" -#include "so_env.hxx" - -#include "nsp_func.hxx" - -#include "sal/main.h" -#include <sal/macros.h> - -#include "rtl/process.h" -#include "rtl/bootstrap.hxx" -#include "rtl/string.hxx" -#include "rtl/ustrbuf.hxx" - -#include "osl/security.hxx" -#include "osl/thread.hxx" - -#include "cppuhelper/bootstrap.hxx" - - - -#include "com/sun/star/uno/XComponentContext.hpp" -#include "com/sun/star/lang/XMultiServiceFactory.hpp" -#include "com/sun/star/bridge/UnoUrlResolver.hpp" -#include "com/sun/star/bridge/XUnoUrlResolver.hpp" - -using namespace ::rtl; -using namespace ::osl; -using namespace ::cppu; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - - -#define MAX_NODE_NUM 1024 - -SoPluginInstance* lpInstance[MAX_NODE_NUM]; - -static NSP_PIPE_FD la_read_fd = 0; -static char const * progdir = NULL; - - -long int NSP_ReadFromPipe(NSP_PIPE_FD fp, void* buf, unsigned long int len) -{ - unsigned long int len_unix = 0, len_wnt = 0; - - len_unix = NSP_Read_Pipe(fp, buf, len, &len_wnt); -#ifdef UNIX - (void)len_wnt; - return len_unix; -#endif //end of UNIX -#ifdef WNT - (void)len_unix; - return len_wnt; -#endif //end of WNT - -} - -int find_free_node() -{ - for(int i=0; i<MAX_NODE_NUM; i++) - { - if(NULL == lpInstance[i]) - return i; - } - return -1; -} - -int find_cur_node(long cur_id) -{ - for(int i=0; i<MAX_NODE_NUM; i++) - { - if(lpInstance[i] == NULL) - continue; - if(cur_id == lpInstance[i]->GetParent()) - return i; - } - return -1; -} - -bool dump_plugin_message(PLUGIN_MSG* pMsg) -{ - if (!pMsg) - return false; - debug_fprintf(NSP_LOG_APPEND, "NSPlugin Message: msg_id:%d; instance_id:%d;wnd_id:%d;wnd_x:%d;wnd_y:%d;wnd_w:%d;wnd_h:%d; url:%s\n", - pMsg->msg_id, pMsg->instance_id, pMsg->wnd_id, - pMsg->wnd_x, pMsg->wnd_y, pMsg->wnd_w, pMsg->wnd_h, pMsg->url); - return true; -} - -int Set_Window(PLUGIN_MSG* pMsg) -{ - dump_plugin_message(pMsg); - int cur_no; - if( -1 == (cur_no = find_cur_node(pMsg->instance_id))) - return -1; - if(lpInstance[cur_no]->SetWindow(pMsg->wnd_id, - pMsg->wnd_x, pMsg->wnd_y, pMsg->wnd_w, pMsg->wnd_h)) - return 0; - else - return -1; -} - -int Set_URL(PLUGIN_MSG* pMsg) -{ - dump_plugin_message(pMsg); - int cur_no; - if( -1 == (cur_no = find_cur_node(pMsg->instance_id))) - return -1; - if(lpInstance[cur_no]->SetURL(pMsg->url)) - return 0; - else - return -1; -} - -int New_Instance(PLUGIN_MSG* pMsg, Reference< lang::XMultiServiceFactory > xMSF) -{ - dump_plugin_message(pMsg); - int free_no; - if( -1 == (free_no = find_free_node())) - return -1; - lpInstance[free_no] = new SoPluginInstance(pMsg->instance_id, xMSF); - return 0; -} - -int Destroy(PLUGIN_MSG* pMsg) -{ - dump_plugin_message(pMsg); - int cur_no; - if( -1 == (cur_no = find_cur_node(pMsg->instance_id))) - return -1; - if(lpInstance[cur_no] != NULL) - { - lpInstance[cur_no]->Destroy(); - debug_fprintf(NSP_LOG_APPEND, "print by Nsplugin, begin delete.\n"); - delete(lpInstance[cur_no]); - lpInstance[cur_no] = NULL; - } - return 0; -} - -int Print(PLUGIN_MSG* pMsg) -{ - dump_plugin_message(pMsg); - int cur_no; - if( -1 == (cur_no = find_cur_node(pMsg->instance_id))) - return -1; - if(lpInstance[cur_no] != NULL) - { - lpInstance[cur_no]->Print(); - } - return 0; -} - -int Shutdown() -{ - for(int cur_no=0; cur_no<MAX_NODE_NUM; cur_no++) - { - if(lpInstance[cur_no] == NULL) - continue; - lpInstance[cur_no]->Destroy(); - debug_fprintf(NSP_LOG_APPEND, "print by Nsplugin, begin delete.\n"); - delete(lpInstance[cur_no]); - lpInstance[cur_no] = NULL; - } - return -1; -} - -int dispatchMsg(PLUGIN_MSG* pMsg, Reference< lang::XMultiServiceFactory > xMSF) -{ - switch(pMsg->msg_id) - { - case SO_SET_WINDOW: - return Set_Window(pMsg); - case SO_NEW_INSTANCE: - if(xMSF.is()) - return New_Instance(pMsg, xMSF); - case SO_SET_URL: - return Set_URL(pMsg); - case SO_DESTROY: - return Destroy(pMsg); - case SO_SHUTDOWN: - Shutdown(); - return -1; - case SO_PRINT: - Print(pMsg); - return 0; - default: - return -1; - } -} - -Reference< lang::XMultiServiceFactory > SAL_CALL start_office(NSP_PIPE_FD read_fd) -{ - Reference< XComponentContext > xRemoteContext; - - try - { - OUString aOfficePath; - -#ifdef UNIX - boost::scoped_array< char > exepath( - new char[( progdir ? strlen( progdir ) : 0 ) + RTL_CONSTASCII_LENGTH( "/soffice" ) + 1] ); - if ( progdir ) - sprintf( exepath.get(), "%s/soffice", progdir ); - else - sprintf( exepath.get(), "soffice" ); - if (!rtl_convertStringToUString( - &aOfficePath.pData, exepath.get(), strlen(exepath.get()), osl_getThreadTextEncoding(), - (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | - RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | - RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))) - { - debug_fprintf(NSP_LOG_APPEND,"bad characters in soffice installation path!\n"); - return Reference< lang::XMultiServiceFactory >(NULL); - } -#endif //end of UNIX -#ifdef WNT - char sPath[NPP_PATH_MAX]; - sPath[0] = 0; - - // The quotes will be added in osl_executeProcess - sprintf(sPath, "%s", findSofficeExecutable() ); - if (!rtl_convertStringToUString( - &aOfficePath.pData, sPath, strlen(sPath), osl_getThreadTextEncoding(), - (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | - RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | - RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))) - { - debug_fprintf(NSP_LOG_APPEND,"bad characters in soffice installation path!\n"); - return Reference< lang::XMultiServiceFactory >(NULL); - } -#endif //end of WNT - - // create default local component context - Reference< XComponentContext > xLocalContext( - defaultBootstrap_InitialComponentContext() ); - if ( !xLocalContext.is() ) - { - debug_fprintf(NSP_LOG_APPEND,"no local component context!\n"); - return Reference< lang::XMultiServiceFactory >(NULL); - } - - // env string - OUStringBuffer buf; - OUString aPath, aPluginPipeName; - - if(!Bootstrap::get("BRAND_BASE_DIR", aPath)) - { - debug_fprintf(NSP_LOG_APPEND,"failed to get BRAND_BASE_DIR!\n"); - return Reference< lang::XMultiServiceFactory >(NULL); - } - - aPluginPipeName = OUString::number( aPath.hashCode() ); - - // accept string - OSL_ASSERT( buf.isEmpty() ); - buf.append( "--accept=pipe,name=" ); - buf.append( aPluginPipeName ); //user installation path as pipe name - buf.append( ";urp;" ); - OUString sConnectStartString( buf.makeStringAndClear() ); - - // arguments - OUString args [] = { - OUString("--nologo"), - OUString("--nodefault"), - OUString("--nolockcheck"), - sConnectStartString, - }; - - // create a URL resolver - Reference< bridge::XUnoUrlResolver > xUrlResolver( - bridge::UnoUrlResolver::create( xLocalContext ) ); - - // connection string - OSL_ASSERT( buf.isEmpty() ); - buf.append( "uno:pipe,name=" ); - buf.append( aPluginPipeName ); - buf.append( ";urp;StarOffice.ComponentContext" ); - OUString sConnectString( buf.makeStringAndClear() ); - - try - { - // try to connect to office, no need to start instance again if office already started - xRemoteContext.set( - xUrlResolver->resolve( sConnectString ), UNO_QUERY_THROW ); - debug_fprintf(NSP_LOG_APPEND, "Staroffice already start\n"); - return Reference< lang::XMultiServiceFactory >(xRemoteContext->getServiceManager(), UNO_QUERY); - } - catch ( const connection::NoConnectException & ) - { - } - - // start office process -#ifdef UNIX - // a temporary solution - // in future the process should be started using the osl_executeProcess call - int nChildPID = fork(); - if( ! nChildPID ) // child process - { - NSP_Close_Pipe(read_fd); - execl( "/bin/sh", - "/bin/sh", - OUStringToOString( aOfficePath, osl_getThreadTextEncoding() ).getStr(), - OUStringToOString( args[0], osl_getThreadTextEncoding() ).getStr(), - OUStringToOString( args[1], osl_getThreadTextEncoding() ).getStr(), - OUStringToOString( args[2], osl_getThreadTextEncoding() ).getStr(), - OUStringToOString( args[3], osl_getThreadTextEncoding() ).getStr(), - NULL); - _exit(255); - } -#else - (void) read_fd; /* avoid warning about unused parameter */ - Security sec; - oslProcess hProcess = 0; - rtl_uString * ar_args [] = { - args[ 0 ].pData, - args[ 1 ].pData, - args[ 2 ].pData, - args[ 3 ].pData, - }; - - oslProcessError rc = osl_executeProcess( - aOfficePath.pData, - ar_args, - SAL_N_ELEMENTS( ar_args ), - osl_Process_DETACHED, - sec.getHandle(), - 0, // => current working dir - 0, - 0, // => no env vars - &hProcess ); - switch ( rc ) - { - case osl_Process_E_None: - osl_freeProcessHandle( hProcess ); - break; - default: - debug_fprintf(NSP_LOG_APPEND, "unmapped error!\n"); - return Reference< lang::XMultiServiceFactory >(NULL); - } -#endif - - // wait until office is started - for ( int i = 0; i < 240 /* stop the connection after 240 * 500ms */; ++i ) - { - try - { - // try to connect to office - xRemoteContext.set( - xUrlResolver->resolve( sConnectString ), UNO_QUERY_THROW ); - return Reference< lang::XMultiServiceFactory >(xRemoteContext->getServiceManager(), UNO_QUERY); - } - catch ( const connection::NoConnectException & ) - { - // wait 500 ms, then try to connect again - TimeValue tv = { 0 /* secs */, 500000000 /* nanosecs */ }; - ::osl::Thread::wait( tv ); - } - } - debug_fprintf(NSP_LOG_APPEND, "Failed to connect to Staroffice in 2 minutes\n"); - return Reference< lang::XMultiServiceFactory >(NULL); - } - catch (const Exception & e) - { - debug_fprintf(NSP_LOG_APPEND, "unexpected UNO exception caught: "); - debug_fprintf(NSP_LOG_APPEND, (sal_Char *)e.Message.getStr()); - return Reference< lang::XMultiServiceFactory >(NULL); - } - -} - - -SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) -{ - // Sleep(20*1000); - debug_fprintf(NSP_LOG_APPEND, "start of main\n"); - memset(lpInstance, 0, sizeof(lpInstance)); - - // MessageBox( NULL, "nsplugin has been started", "Info", MB_OK ); - - NSP_PIPE_FD fd_pipe[2]; - int iPipe[2]; - if(argc < 3) - { - debug_fprintf(NSP_LOG_APPEND, "print by nsplugin, command error; too little argument to start plugin exec\n"); - return EXIT_FAILURE; - } - iPipe[0] = atoi(argv[1]); - iPipe[1] = atoi(argv[2]); - - // fd_pipe[0]: read, fd_pipe[0]: write - fd_pipe[0] = (NSP_PIPE_FD) (sal_IntPtr) iPipe[0] ; - fd_pipe[1] = (NSP_PIPE_FD) (sal_IntPtr) iPipe[1] ; - NSP_Close_Pipe(fd_pipe[1]); - - if(iPipe[0] < 0) - { - debug_fprintf(NSP_LOG_APPEND, "print by nsplugin, command error: bad read file id:%s \n", iPipe[0]); - return 0; - } - la_read_fd = fd_pipe[0]; - - // the program path is provided only on unix, on windows the registry entry is used - if ( argc > 4 ) - progdir = argv[4]; - - Reference< lang::XMultiServiceFactory > xFactory = start_office(la_read_fd); - if(!xFactory.is()) - { - NSP_Close_Pipe(la_read_fd); - return -1; - } - PLUGIN_MSG nMsg; - int len; - while(true) - { - memset(&nMsg, 0, sizeof(PLUGIN_MSG)); - len = NSP_ReadFromPipe(la_read_fd, (char*)&nMsg, sizeof(PLUGIN_MSG)); - if(len != sizeof(PLUGIN_MSG)) - break; - debug_fprintf(NSP_LOG_APPEND, "Read message from pipe type %d \n", nMsg.msg_id); - if(-1 == dispatchMsg(&nMsg, xFactory)) - { - debug_fprintf(NSP_LOG_APPEND, "plugin will shutdown\n"); - break; - } - } - NSP_Close_Pipe(la_read_fd); - _exit(0); -#ifndef _MSC_VER - return EXIT_SUCCESS; // avoid warnings -#endif -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/so_msg.hxx b/extensions/source/nsplugin/source/so_msg.hxx deleted file mode 100644 index c556bb54137f..000000000000 --- a/extensions/source/nsplugin/source/so_msg.hxx +++ /dev/null @@ -1,61 +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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_EXTENSIONS_SOURCE_NSPLUGIN_SOURCE_SO_MSG_HXX -#define INCLUDED_EXTENSIONS_SOURCE_NSPLUGIN_SOURCE_SO_MSG_HXX -enum msg_type -{ - SO_EMPTY, // 0 - SO_SET_WINDOW, // 1 - SO_SET_URL, // 2 - SO_NEW_INSTANCE, // 3 - SO_DESTROY, // 4 - SO_SHUTDOWN, // 5 - SO_PRINT // 6 -}; - -#ifdef _WIN64 -#define plugin_Int32 unsigned __int64 -#else -#define plugin_Int32 unsigned long int -#endif - -typedef struct _PLUGIN_MSG { - plugin_Int32 msg_id; - plugin_Int32 instance_id; - plugin_Int32 wnd_id; - plugin_Int32 wnd_x; - plugin_Int32 wnd_y; - plugin_Int32 wnd_w; - plugin_Int32 wnd_h; - char url[484]; -} PLUGIN_MSG; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |