diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-09-09 15:19:05 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-09-09 15:20:35 +0200 |
commit | d968c28287c8ffbaf6fd6da3a5d872adc8e354b4 (patch) | |
tree | d07ea309ae41546f97383efb46e992cdb0322992 /cui/source | |
parent | 496bc3cd6c037360632c33471c4622a095cdcadd (diff) |
fdo#45071: Remove ENABLE_NPAPI_INTO_BROWSER left-overs
...from previous commit
Change-Id: I945faa6215f971ce817c6450fe0786da0696091f
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/dialogs/winpluginlib.cxx | 196 | ||||
-rw-r--r-- | cui/source/options/optinet2.cxx | 196 | ||||
-rw-r--r-- | cui/source/options/optinet2.hxx | 21 |
3 files changed, 0 insertions, 413 deletions
diff --git a/cui/source/dialogs/winpluginlib.cxx b/cui/source/dialogs/winpluginlib.cxx deleted file mode 100644 index 46c4af2e7ab1..000000000000 --- a/cui/source/dialogs/winpluginlib.cxx +++ /dev/null @@ -1,196 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#if defined _MSC_VER -#pragma warning(push, 1) -#endif -#undef WB_LEFT -#undef WB_RIGHT -#include <windows.h> -#if defined _MSC_VER -#pragma warning(pop) -#endif -#include <winreg.h> -#include <shlwapi.h> -#include <stdio.h> - -#define SO_PATH_SIZE 4096 - -extern "C" { -int lc_isInstalled(const char* realFilePath) -{ - HKEY hLibreOffice; - char sSoPath[SO_PATH_SIZE]; - char sPluginPath[SO_PATH_SIZE]; - - LONG ret; - ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\MozillaPlugins\\@sun.com/npsopluginmi;version=1.0", 0, KEY_READ, &hLibreOffice); - if(ret != ERROR_SUCCESS){ - ret = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE\\MozillaPlugins\\@sun.com/npsopluginmi;version=1.0", 0, KEY_READ, &hLibreOffice); - if(ret != ERROR_SUCCESS){ - return -1; - } - } - - if((realFilePath == NULL) || (strlen(realFilePath) == 0) || (strlen(realFilePath) >= SO_PATH_SIZE)) - ret = -1; - else{ - sprintf(sSoPath,"%s", realFilePath); - ret = 0; - } - - // GetCurrentDirectory return the char number of the string - if(ret == 0){ - DWORD dType = REG_SZ; - DWORD dSize = SO_PATH_SIZE; - ret = RegQueryValueEx (hLibreOffice, "Path", NULL, &dType , (LPBYTE) sPluginPath, &dSize); - if(ret == ERROR_SUCCESS){ - if(strcmp(sPluginPath, sSoPath) == 0) - ret = 0; - else - ret = 1; - } - else - ret = -1; - } - else - ret = -1; - RegCloseKey(hLibreOffice); - return ret; -} - -int lc_uninstallPlugin(const char*) -{ - HKEY hKeySoftware; - HKEY hMozillaPlugins; - HKEY hStarOffice; - - LONG ret; - ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WRITE, &hKeySoftware); - if(ret != ERROR_SUCCESS){ - ret = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE", 0, KEY_READ|KEY_WRITE, &hKeySoftware); - if(ret != ERROR_SUCCESS){ - return -1; - } - } - ret = RegOpenKeyEx(hKeySoftware, "MozillaPlugins", 0, KEY_READ|KEY_WRITE, &hMozillaPlugins); - if(ret != ERROR_SUCCESS){ - RegCloseKey(hKeySoftware); - if( ret == ERROR_FILE_NOT_FOUND) - return 0; - else - return -1; - } - - ret = RegOpenKeyEx(hMozillaPlugins, "@sun.com/npsopluginmi;version=1.0", 0, KEY_READ|KEY_WRITE, &hStarOffice); - if(ret != ERROR_SUCCESS){ - RegCloseKey(hKeySoftware); - RegCloseKey(hMozillaPlugins); - if( ret == ERROR_FILE_NOT_FOUND) - return 0; - else - return -1; - } - RegCloseKey(hStarOffice); - ret = SHDeleteKey(hMozillaPlugins, "@sun.com/npsopluginmi;version=1.0"); - if(ret != ERROR_SUCCESS){ - ret = -1; - } - RegFlushKey(hMozillaPlugins); - RegCloseKey(hMozillaPlugins); - RegCloseKey(hKeySoftware); - return ret; -} - -int lc_installPlugin(const char* realFilePath) -{ - HKEY hKeySoftware; - HKEY hMozillaPlugins; - HKEY hStarOffice; - char sSoPath[SO_PATH_SIZE]; - DWORD sState; - - LONG ret; - ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WRITE, &hKeySoftware); - if(ret != ERROR_SUCCESS){ - ret = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE", 0, KEY_READ|KEY_WRITE, &hKeySoftware); - if(ret != ERROR_SUCCESS){ - return -1; - } - } - ret = RegOpenKeyEx(hKeySoftware, "MozillaPlugins", 0, KEY_READ|KEY_WRITE, &hMozillaPlugins); - if(ret != ERROR_SUCCESS){ - RegCreateKeyEx(hKeySoftware, - "MozillaPlugins", - 0, - NULL, - REG_OPTION_NON_VOLATILE, - KEY_READ|KEY_WRITE, - NULL, - &hMozillaPlugins, - &sState); - } - - ret = RegCreateKeyEx(hMozillaPlugins, - "@sun.com/npsopluginmi;version=1.0", - 0, - NULL, - REG_OPTION_NON_VOLATILE, - KEY_READ|KEY_WRITE, - NULL, - &hStarOffice, - &sState); - if(ret != ERROR_SUCCESS){ - RegCloseKey(hKeySoftware); - RegCloseKey(hMozillaPlugins); - return -1; - } - - RegFlushKey(hStarOffice); - RegFlushKey(hMozillaPlugins); - - if((realFilePath == NULL) || (strlen(realFilePath) == 0) || (strlen(realFilePath) >= SO_PATH_SIZE)) - ret = -1; - else{ - sprintf(sSoPath,"%s", realFilePath); - ret = 0; - } - - // GetCurrentDirectory return the char number of the string - if(ret == 0){ - ret = RegSetValueEx( hStarOffice, "Path", 0, REG_SZ, (LPBYTE) sSoPath, strlen(sSoPath) + 1); - if(ret == ERROR_SUCCESS) - ret = 0; - else - ret = -1; - } - else - ret = -1; - RegFlushKey(hStarOffice); - RegFlushKey(hMozillaPlugins); - RegCloseKey(hStarOffice); - RegCloseKey(hMozillaPlugins); - RegCloseKey(hKeySoftware); - RegFlushKey(HKEY_LOCAL_MACHINE); - - return ret; -} -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index 4909b894ebe6..760d1ceb94a6 100644 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -913,202 +913,6 @@ void SvxSecurityTabPage::Reset( const SfxItemSet* ) { } -MozPluginTabPage::MozPluginTabPage(Window* pParent, const SfxItemSet& rSet) - : SfxTabPage(pParent, "OptBrowserPage", "cui/ui/optbrowserpage.ui", &rSet) -{ - get(m_pWBasicCodeCB, "display"); -} - -MozPluginTabPage::~MozPluginTabPage() -{ -} - -SfxTabPage* MozPluginTabPage::Create( Window* pParent, - const SfxItemSet* rAttrSet ) -{ - return new MozPluginTabPage( pParent, *rAttrSet ); -} - -bool MozPluginTabPage::FillItemSet( SfxItemSet* ) -{ - bool hasInstall = isInstalled(); - bool hasChecked = m_pWBasicCodeCB->IsChecked(); - if(hasInstall && (!hasChecked)){ - //try to uninstall - uninstallPlugin(); - } - else if((!hasInstall) && hasChecked){ - //try to install - installPlugin(); - } - else{ - // do nothing - } - return true; -} - -void MozPluginTabPage::Reset( const SfxItemSet* ) -{ - m_pWBasicCodeCB->Check( isInstalled()); - m_pWBasicCodeCB->SaveValue(); -} - -#ifdef WNT -extern "C" { - int lc_isInstalled(const char* realFilePath); - int lc_installPlugin(const char* realFilePath); - int lc_uninstallPlugin(const char* realFilePath); -} -#endif - -#define NPP_PATH_MAX 2048 -inline bool getDllURL(OString * path) -{ - OSL_ASSERT(path != NULL); - OUString dirPath/*dllPath, */; - if (osl_getExecutableFile(&dirPath.pData) != osl_Process_E_None) { - return false; - } - dirPath = dirPath.copy(0, dirPath.lastIndexOf('/')); - OUString sysDirPath; - osl::FileBase::getSystemPathFromFileURL(dirPath, sysDirPath); - *path = OUStringToOString(sysDirPath, RTL_TEXTENCODING_ASCII_US); - return true; -} - -bool MozPluginTabPage::isInstalled() -{ -#ifdef UNIX - // get the real file referred by .so lnk file - char lnkReferFilePath[NPP_PATH_MAX] = {0}; - char* pHome = getpwuid(getuid())->pw_dir; - OString lnkFilePath(OString(pHome) + OString("/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION)); - - struct stat sBuf; - if (0 > lstat(lnkFilePath.getStr(), &sBuf)) - return false; - if (!S_ISLNK(sBuf.st_mode)) - return false; - if (0 >= readlink(lnkFilePath.getStr(), lnkReferFilePath, NPP_PATH_MAX)) - return false; - // If the link is relative, then we regard it as non-standard - if (lnkReferFilePath[0] != '/') - return false; - - // get the real file path - char realFilePath[NPP_PATH_MAX] = {0}; - OString tempString; - if (!getDllURL(&tempString)) { - return false; - } - strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX - 1); - strcat(realFilePath, "/libnpsoplugin" SAL_DLLEXTENSION); - - if (0 != strcmp(lnkReferFilePath, realFilePath)) - return false; - return true; -#endif -#ifdef WNT - // get the value from registry - sal_Bool ret = true; - OString tempString; - char realFilePath[NPP_PATH_MAX] = {0}; - if (!getDllURL(&tempString)){ - return false; - } - strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX); - if(! lc_isInstalled(realFilePath)) - ret =true; - else - ret = false; - return ret; -#endif -} - -bool MozPluginTabPage::installPlugin() -{ -#ifdef UNIX - // get the real file referred by .so lnk file - char* pHome = getpwuid(getuid())->pw_dir; - if(!pHome) - { - return false; - } - OString lnkFilePath(OString(pHome) + OString("/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION)); - (void)remove(lnkFilePath.getStr()); - - // create the dirs if necessary - struct stat buf; - char tmpDir[NPP_PATH_MAX] = {0}; - snprintf(tmpDir, NPP_PATH_MAX, "%s/.mozilla", pHome); - if (0 > stat(lnkFilePath.getStr(), &buf)) - { - if(mkdir(tmpDir, 0755)) - { - return false; - } - strcat(tmpDir, "/plugins"); - if(mkdir(tmpDir, 0755)) - { - return false; - } - } - - // get the real file path - char realFilePath[NPP_PATH_MAX] = {0}; - OString tempString; - if (!getDllURL(&tempString)) { - return false; - } - strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX - 1); - strcat(realFilePath, "/libnpsoplugin" SAL_DLLEXTENSION); - - // create the link - if (0 != symlink(realFilePath, lnkFilePath.getStr())) - return false; - return true; -#endif -#ifdef WNT - OString tempString; - char realFilePath[NPP_PATH_MAX] = {0}; - if (!getDllURL(&tempString)) { - return false; - } - strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX); - if( !lc_installPlugin(realFilePath)) - return true; - else - return false; -#endif -} - -bool MozPluginTabPage::uninstallPlugin() -{ -#ifdef UNIX - // get the real file referred by .so lnk file - char* pHome = getpwuid(getuid())->pw_dir; - OString lnkFilePath(OString(pHome) + OString("/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION)); - - if(0 > remove(lnkFilePath.getStr())) - return false; - return true; -#endif -#ifdef WNT - OString tempString; - char realFilePath[NPP_PATH_MAX] = {0}; - if (!getDllURL(&tempString)) { - return false; - } - strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX); - if(!lc_uninstallPlugin(realFilePath)) - return true; - else - return false; -#endif -} - -/* -------------------------------------------------------------------------*/ - class MailerProgramCfg_Impl : public utl::ConfigItem { friend class SvxEMailTabPage; diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx index 4aa3cdeb9166..4182f76efd02 100644 --- a/cui/source/options/optinet2.hxx +++ b/cui/source/options/optinet2.hxx @@ -177,27 +177,6 @@ public: virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; }; -class MozPluginTabPage : public SfxTabPage -{ - CheckBox* m_pWBasicCodeCB; - - bool isInstalled(void); - bool installPlugin(void); - bool uninstallPlugin(void); - - MozPluginTabPage( Window* pParent, const SfxItemSet& rSet ); - virtual ~MozPluginTabPage(); - -public: - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet* rAttrSet ); - - virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE; - virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE; - -}; - struct SvxEMailTabPage_Impl; class SvxEMailTabPage : public SfxTabPage { |