summaryrefslogtreecommitdiff
path: root/shell/source/backends/wininetbe
diff options
context:
space:
mode:
Diffstat (limited to 'shell/source/backends/wininetbe')
-rw-r--r--shell/source/backends/wininetbe/makefile.mk5
-rw-r--r--shell/source/backends/wininetbe/wininetbackend.cxx361
-rw-r--r--shell/source/backends/wininetbe/wininetbackend.hxx118
-rw-r--r--shell/source/backends/wininetbe/wininetbe.xml1
-rw-r--r--shell/source/backends/wininetbe/wininetbecdef.cxx43
-rw-r--r--shell/source/backends/wininetbe/wininetlayer.cxx374
-rw-r--r--shell/source/backends/wininetbe/wininetlayer.hxx73
7 files changed, 381 insertions, 594 deletions
diff --git a/shell/source/backends/wininetbe/makefile.mk b/shell/source/backends/wininetbe/makefile.mk
index fd87b9268475..0401cb88b7dd 100644
--- a/shell/source/backends/wininetbe/makefile.mk
+++ b/shell/source/backends/wininetbe/makefile.mk
@@ -46,9 +46,8 @@ DLLPRE =
SLOFILES=\
$(SLO)$/wininetbecdef.obj \
- $(SLO)$/wininetbackend.obj \
- $(SLO)$/wininetlayer.obj
-
+ $(SLO)$/wininetbackend.obj
+
SHL1TARGET=$(TARGET)1.uno
SHL1OBJS=$(SLOFILES)
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
diff --git a/shell/source/backends/wininetbe/wininetbackend.cxx b/shell/source/backends/wininetbe/wininetbackend.cxx
index 0734b2cbba3a..e28bab3affe4 100644
--- a/shell/source/backends/wininetbe/wininetbackend.cxx
+++ b/shell/source/backends/wininetbe/wininetbackend.cxx
@@ -28,76 +28,331 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_shell.hxx"
+#include "rtl/ustrbuf.hxx"
+
#include "wininetbackend.hxx"
-#include "wininetlayer.hxx"
-#include <com/sun/star/configuration/backend/ComponentChangeEvent.hpp>
-#include <uno/current_context.hxx>
+
+#if defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+#include <windows.h>
+#include <wininet.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
#define WININET_DLL_NAME "wininet.dll"
+#define EQUAL_SIGN '='
+#define COLON ':'
+#define SPACE ' '
+#define SEMI_COLON ';'
-WinInetBackend::WinInetBackend(const uno::Reference<uno::XComponentContext>& xContext)
- throw (backend::BackendAccessException) :
- ::cppu::WeakImplHelper2 < backend::XSingleLayerStratum, lang::XServiceInfo > (),
- m_xContext(xContext)
-{
- m_hWinInetDll = LoadLibrary( WININET_DLL_NAME );
-}
+namespace {
-//------------------------------------------------------------------------------
+struct Library {
+ HMODULE module;
-WinInetBackend::~WinInetBackend(void)
-{
- if ( m_hWinInetDll )
- FreeLibrary( m_hWinInetDll );
-}
+ Library(HMODULE theModule): module(theModule) {}
-//------------------------------------------------------------------------------
+ ~Library() { if (module) FreeLibrary(module); }
+};
-WinInetBackend* WinInetBackend::createInstance(
- const uno::Reference<uno::XComponentContext>& xContext
-)
-{
- return new WinInetBackend(xContext);
}
-// ---------------------------------------------------------------------------------------
+typedef struct
+{
+ rtl::OUString Server;
+ rtl::OUString Port;
+} ProxyEntry;
+
+//------------------------------------------------------------------------
+// helper functions
+//------------------------------------------------------------------------
-uno::Reference<backend::XLayer> SAL_CALL WinInetBackend::getLayer(
- const rtl::OUString& aComponent, const rtl::OUString& /*aTimestamp*/)
- throw (backend::BackendAccessException, lang::IllegalArgumentException)
+namespace // private
{
+ ProxyEntry ReadProxyEntry(const rtl::OUString& aProxy, sal_Int32& i)
+ {
+ ProxyEntry aProxyEntry;
- if( aComponent.equals( getSupportedComponents()[0]) )
+ aProxyEntry.Server = aProxy.getToken( 0, COLON, i );
+ if ( i > -1 )
+ aProxyEntry.Port = aProxy.getToken( 0, COLON, i );
+
+ return aProxyEntry;
+ }
+
+ ProxyEntry FindProxyEntry(const rtl::OUString& aProxyList, const rtl::OUString& aType)
{
- if( ! m_xSystemLayer.is() && m_hWinInetDll )
+ sal_Int32 nIndex = 0;
+
+ do
{
- WinInetLayer::InternetQueryOption_Proc_T lpfnInternetQueryOption =
- reinterpret_cast< WinInetLayer::InternetQueryOption_Proc_T >(
- GetProcAddress( m_hWinInetDll, "InternetQueryOptionA" ) );
+ // get the next token, e.g. ftp=server:port
+ rtl::OUString nextToken = aProxyList.getToken( 0, SPACE, nIndex );
+
+ // split the next token again into the parts separated
+ // through '=', e.g. ftp=server:port -> ftp and server:port
+ sal_Int32 i = 0;
+ if( nextToken.indexOf( EQUAL_SIGN ) > -1 )
+ {
+ if( aType.equals( nextToken.getToken( 0, EQUAL_SIGN, i ) ) )
+ return ReadProxyEntry(nextToken, i);
+ }
+ else if( aType.getLength() == 0)
+ return ReadProxyEntry(nextToken, i);
+
+ } while ( nIndex >= 0 );
+
+ return ProxyEntry();
+ }
- if( lpfnInternetQueryOption )
- m_xSystemLayer = new WinInetLayer(lpfnInternetQueryOption, m_xContext);
- }
+} // end private namespace
+
+//------------------------------------------------------------------------------
+
+WinInetBackend::WinInetBackend()
+{
+ Library hWinInetDll( LoadLibrary( WININET_DLL_NAME ) );
+ if( hWinInetDll.module )
+ {
+ typedef BOOL ( WINAPI *InternetQueryOption_Proc_T )( HINTERNET, DWORD, LPVOID, LPDWORD );
- return m_xSystemLayer;
+ InternetQueryOption_Proc_T lpfnInternetQueryOption =
+ reinterpret_cast< InternetQueryOption_Proc_T >(
+ GetProcAddress( hWinInetDll.module, "InternetQueryOptionA" ) );
+ if (lpfnInternetQueryOption)
+ {
+ LPINTERNET_PROXY_INFO lpi = NULL;
+
+ // query for the neccessary space
+ DWORD dwLength = 0;
+ BOOL bRet = lpfnInternetQueryOption(
+ NULL,
+ INTERNET_OPTION_PROXY,
+ (LPVOID)lpi,
+ &dwLength );
+
+ // allocate sufficient space on the heap
+ // insufficient space on the heap results
+ // in a stack overflow exception, we assume
+ // this never happens, because of the relatively
+ // small amount of memory we need
+ // _alloca is nice because it is fast and we don't
+ // have to free the allocated memory, it will be
+ // automatically done
+ lpi = reinterpret_cast< LPINTERNET_PROXY_INFO >(
+ _alloca( dwLength ) );
+
+ bRet = lpfnInternetQueryOption(
+ NULL,
+ INTERNET_OPTION_PROXY,
+ (LPVOID)lpi,
+ &dwLength );
+
+ // if a proxy is disabled, InternetQueryOption returns
+ // an empty proxy list, so we don't have to check if
+ // proxy is enabled or not
+
+ rtl::OUString aProxyList = rtl::OUString::createFromAscii( lpi->lpszProxy );
+ rtl::OUString aProxyBypassList = rtl::OUString::createFromAscii( lpi->lpszProxyBypass );
+
+ // override default for ProxyType, which is "0" meaning "No proxies".
+ sal_Int32 nProperties = 1;
+
+ valueProxyType_.IsPresent = true;
+ valueProxyType_.Value <<= nProperties;
+
+ // fill proxy bypass list
+ if( aProxyBypassList.getLength() > 0 )
+ {
+ rtl::OUStringBuffer aReverseList;
+ sal_Int32 nIndex = 0;
+ do
+ {
+ rtl::OUString aToken = aProxyBypassList.getToken( 0, SPACE, nIndex );
+ if ( aProxyList.indexOf( aToken ) == -1 )
+ {
+ if ( aReverseList.getLength() )
+ {
+ aReverseList.insert( 0, sal_Unicode( SEMI_COLON ) );
+ aReverseList.insert( 0, aToken );
+ }
+ else
+ aReverseList = aToken;
+ }
+ }
+ while ( nIndex >= 0 );
+
+ aProxyBypassList = aReverseList.makeStringAndClear();
+
+ valueNoProxy_.IsPresent = true;
+ valueNoProxy_.Value <<= aProxyBypassList.replace( SPACE, SEMI_COLON );
+ }
+
+ if( aProxyList.getLength() > 0 )
+ {
+ //-------------------------------------------------
+ // this implementation follows the algorithm
+ // of the internet explorer
+ // if there are type-dependent proxy settings
+ // and type independent proxy settings in the
+ // registry the internet explorer chooses the
+ // type independent proxy for all settings
+ // e.g. imagine the following registry entry
+ // ftp=server:port;http=server:port;server:port
+ // the last token server:port is type independent
+ // so the ie chooses this proxy server
+
+ // if there is no port specified for a type independent
+ // server the ie uses the port of an http server if
+ // there is one and it has a port
+ //-------------------------------------------------
+
+ ProxyEntry aTypeIndepProxy = FindProxyEntry( aProxyList, rtl::OUString());
+ ProxyEntry aHttpProxy = FindProxyEntry( aProxyList, rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "http" ) ) );
+ ProxyEntry aHttpsProxy = FindProxyEntry( aProxyList, rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "https" ) ) );
+
+ ProxyEntry aFtpProxy = FindProxyEntry( aProxyList, rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "ftp" ) ) );
+
+ if( aTypeIndepProxy.Server.getLength() )
+ {
+ aHttpProxy.Server = aTypeIndepProxy.Server;
+ aHttpsProxy.Server = aTypeIndepProxy.Server;
+ aFtpProxy.Server = aTypeIndepProxy.Server;
+
+ if( aTypeIndepProxy.Port.getLength() )
+ {
+ aHttpProxy.Port = aTypeIndepProxy.Port;
+ aHttpsProxy.Port = aTypeIndepProxy.Port;
+ aFtpProxy.Port = aTypeIndepProxy.Port;
+ }
+ else
+ {
+ aFtpProxy.Port = aHttpProxy.Port;
+ aHttpsProxy.Port = aHttpProxy.Port;
+ }
+ }
+
+ // http proxy name
+ if( aHttpProxy.Server.getLength() > 0 )
+ {
+ valueHttpProxyName_.IsPresent = true;
+ valueHttpProxyName_.Value <<= aHttpProxy.Server;
+ }
+
+ // http proxy port
+ if( aHttpProxy.Port.getLength() > 0 )
+ {
+ valueHttpProxyPort_.IsPresent = true;
+ valueHttpProxyPort_.Value <<= aHttpProxy.Port.toInt32();
+ }
+
+ // https proxy name
+ if( aHttpsProxy.Server.getLength() > 0 )
+ {
+ valueHttpsProxyName_.IsPresent = true;
+ valueHttpsProxyName_.Value <<= aHttpsProxy.Server;
+ }
+
+ // https proxy port
+ if( aHttpsProxy.Port.getLength() > 0 )
+ {
+ valueHttpsProxyPort_.IsPresent = true;
+ valueHttpsProxyPort_.Value <<= aHttpsProxy.Port.toInt32();
+ }
+
+ // ftp proxy name
+ if( aFtpProxy.Server.getLength() > 0 )
+ {
+ valueFtpProxyName_.IsPresent = true;
+ valueFtpProxyName_.Value <<= aFtpProxy.Server;
+ }
+
+ // ftp proxy port
+ if( aFtpProxy.Port.getLength() > 0 )
+ {
+ valueFtpProxyPort_.IsPresent = true;
+ valueFtpProxyPort_.Value <<= aFtpProxy.Port.toInt32();
+ }
+ }
+ }
}
+}
- return uno::Reference<backend::XLayer>();
+//------------------------------------------------------------------------------
+
+WinInetBackend::~WinInetBackend(void)
+{
}
//------------------------------------------------------------------------------
-uno::Reference<backend::XUpdatableLayer> SAL_CALL
-WinInetBackend::getUpdatableLayer(const rtl::OUString& /*aComponent*/)
- throw (backend::BackendAccessException,lang::NoSupportException,
- lang::IllegalArgumentException)
+WinInetBackend* WinInetBackend::createInstance()
{
- throw lang::NoSupportException(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "WinInetBackend: No Update Operation allowed, Read Only access") ),
- *this) ;
+ return new WinInetBackend;
+}
+
+// ---------------------------------------------------------------------------------------
- return NULL;
+void WinInetBackend::setPropertyValue(
+ rtl::OUString const &, css::uno::Any const &)
+ throw (
+ css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ throw css::lang::IllegalArgumentException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")),
+ static_cast< cppu::OWeakObject * >(this), -1);
+}
+
+css::uno::Any WinInetBackend::getPropertyValue(
+ rtl::OUString const & PropertyName)
+ throw (
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName")))
+ {
+ return css::uno::makeAny(valueFtpProxyName_);
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort")))
+ {
+ return css::uno::makeAny(valueFtpProxyPort_);
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName")))
+ {
+ return css::uno::makeAny(valueHttpProxyName_);
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort")))
+ {
+ return css::uno::makeAny(valueHttpProxyPort_);
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName")))
+ {
+ return css::uno::makeAny(valueHttpsProxyName_);
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort")))
+ {
+ return css::uno::makeAny(valueHttpsProxyPort_);
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy")))
+ {
+ return css::uno::makeAny(valueNoProxy_);
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetProxyType")))
+ {
+ return css::uno::makeAny(valueProxyType_);
+ } else {
+ throw css::beans::UnknownPropertyException(
+ PropertyName, static_cast< cppu::OWeakObject * >(this));
+ }
}
//------------------------------------------------------------------------------
@@ -118,9 +373,8 @@ rtl::OUString SAL_CALL WinInetBackend::getImplementationName(void)
uno::Sequence<rtl::OUString> SAL_CALL WinInetBackend::getBackendServiceNames(void)
{
- uno::Sequence<rtl::OUString> aServiceNameList(2);
+ uno::Sequence<rtl::OUString> aServiceNameList(1);
aServiceNameList[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.WinInetBackend")) ;
- aServiceNameList[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.PlatformBackend")) ;
return aServiceNameList ;
}
@@ -146,16 +400,3 @@ uno::Sequence<rtl::OUString> SAL_CALL WinInetBackend::getSupportedServiceNames(v
{
return getBackendServiceNames() ;
}
-
-// ---------------------------------------------------------------------------------------
-
-uno::Sequence<rtl::OUString> SAL_CALL WinInetBackend::getSupportedComponents(void)
-{
- uno::Sequence<rtl::OUString> aSupportedComponentList(1);
- aSupportedComponentList[0] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet" )
- );
-
- return aSupportedComponentList;
-}
-
diff --git a/shell/source/backends/wininetbe/wininetbackend.hxx b/shell/source/backends/wininetbe/wininetbackend.hxx
index d624d2cefb10..5fe4d5625a9a 100644
--- a/shell/source/backends/wininetbe/wininetbackend.hxx
+++ b/shell/source/backends/wininetbe/wininetbackend.hxx
@@ -28,38 +28,23 @@
#ifndef _FIXEDVALUEBACKEND_HXX_
#define _FIXEDVALUEBACKEND_HXX_
-#include <com/sun/star/configuration/backend/XSingleLayerStratum.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/beans/Optional.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/configuration/backend/XBackendChangesNotifier.hpp>
#include <cppuhelper/implbase2.hxx>
#include <rtl/string.hxx>
-#if defined _MSC_VER
-#pragma warning(push, 1)
-#endif
-#include <windows.h>
-#include <wininet.h>
-#if defined _MSC_VER
-#pragma warning(pop)
-#endif
-
namespace css = com::sun::star ;
namespace uno = css::uno ;
namespace lang = css::lang ;
-namespace backend = css::configuration::backend ;
-
-/**
- Implements the SingleLayerStratum service.
- */
class WinInetBackend : public ::cppu::WeakImplHelper2 <
- backend::XSingleLayerStratum,
+ css::beans::XPropertySet,
lang::XServiceInfo > {
public :
- static WinInetBackend* createInstance(const uno::Reference<uno::XComponentContext>& xContext);
+ static WinInetBackend* createInstance();
// XServiceInfo
virtual rtl::OUString SAL_CALL
@@ -86,43 +71,86 @@ class WinInetBackend : public ::cppu::WeakImplHelper2 <
@return service names
*/
static uno::Sequence<rtl::OUString> SAL_CALL getBackendServiceNames(void) ;
- /**
- Provides the supported component nodes
-
- @return supported component nodes
- */
- static uno::Sequence<rtl::OUString> SAL_CALL getSupportedComponents(void) ;
-
- //XSingleLayerStratum
- virtual uno::Reference<backend::XLayer> SAL_CALL
- getLayer( const rtl::OUString& aLayerId, const rtl::OUString& aTimestamp )
- throw (backend::BackendAccessException,
- lang::IllegalArgumentException) ;
-
- virtual uno::Reference<backend::XUpdatableLayer> SAL_CALL
- getUpdatableLayer( const rtl::OUString& aLayerId )
- throw (backend::BackendAccessException,
- lang::NoSupportException,
- lang::IllegalArgumentException) ;
+
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo() throw (css::uno::RuntimeException)
+ { return css::uno::Reference< css::beans::XPropertySetInfo >(); }
+
+ virtual void SAL_CALL setPropertyValue(
+ rtl::OUString const &, css::uno::Any const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException);
+
+ virtual css::uno::Any SAL_CALL getPropertyValue(
+ rtl::OUString const & PropertyName)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL addPropertyChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XPropertyChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL removePropertyChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XPropertyChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL addVetoableChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XVetoableChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL removeVetoableChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XVetoableChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
protected:
/**
Service constructor from a service factory.
@param xContext component context
*/
- WinInetBackend(const uno::Reference<uno::XComponentContext>& xContext)
- throw (backend::BackendAccessException);
+ WinInetBackend();
/** Destructor */
~WinInetBackend(void) ;
private:
-
- uno::Reference<uno::XComponentContext> m_xContext ;
- uno::Reference<backend::XLayer> m_xSystemLayer ;
-
- // The wininet.dll module handle
- HMODULE m_hWinInetDll;
+ com::sun::star::beans::Optional< com::sun::star::uno::Any >
+ valueProxyType_;
+ com::sun::star::beans::Optional< com::sun::star::uno::Any >
+ valueNoProxy_;
+ com::sun::star::beans::Optional< com::sun::star::uno::Any >
+ valueHttpProxyName_;
+ com::sun::star::beans::Optional< com::sun::star::uno::Any >
+ valueHttpProxyPort_;
+ com::sun::star::beans::Optional< com::sun::star::uno::Any >
+ valueHttpsProxyName_;
+ com::sun::star::beans::Optional< com::sun::star::uno::Any >
+ valueHttpsProxyPort_;
+ com::sun::star::beans::Optional< com::sun::star::uno::Any >
+ valueFtpProxyName_;
+ com::sun::star::beans::Optional< com::sun::star::uno::Any >
+ valueFtpProxyPort_;
} ;
diff --git a/shell/source/backends/wininetbe/wininetbe.xml b/shell/source/backends/wininetbe/wininetbe.xml
index 42364deba3cb..1bf4bd2cd053 100644
--- a/shell/source/backends/wininetbe/wininetbe.xml
+++ b/shell/source/backends/wininetbe/wininetbe.xml
@@ -10,7 +10,6 @@
<language>c++</language>
<status value="beta"/>
<supported-service>com.sun.star.comp.configuration.backend.Win32Backend</supported-service>
- <supported-service>com.sun.star.comp.configuration.backend.PlatformBackend</supported-service>
<service-dependency>...</service-dependency>
<type>com.sun.star.configuration.backend.XBackendChangesListener</type>
<type>com.sun.star.configuration.backend.XBackendChangesNotifier</type>
diff --git a/shell/source/backends/wininetbe/wininetbecdef.cxx b/shell/source/backends/wininetbe/wininetbecdef.cxx
index 1a941429a3ec..862600009e30 100644
--- a/shell/source/backends/wininetbe/wininetbecdef.cxx
+++ b/shell/source/backends/wininetbe/wininetbecdef.cxx
@@ -39,14 +39,13 @@
namespace css = com::sun::star ;
namespace uno = css::uno ;
namespace lang = css::lang ;
-namespace backend = css::configuration::backend ;
//------------------------------------------------------------------------------
static uno::Reference<uno::XInterface> SAL_CALL createWinInetBackend(
- const uno::Reference<uno::XComponentContext>& xContext){
+ const uno::Reference<uno::XComponentContext>&){
- return * WinInetBackend::createInstance(xContext);
+ return * WinInetBackend::createInstance();
}
//------------------------------------------------------------------------------
@@ -74,41 +73,9 @@ extern "C" void SAL_CALL component_getImplementationEnvironment(
//------------------------------------------------------------------------------
-extern "C" sal_Bool SAL_CALL component_writeInfo(void * /*pServiceManager*/, void *pRegistryKey) {
-
- using namespace ::com::sun::star::registry;
- if (pRegistryKey)
- {
- try
- {
- uno::Reference< XRegistryKey > xImplKey = static_cast< XRegistryKey* >( pRegistryKey )->createKey(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + WinInetBackend::getBackendName()
- );
-
- // Register associated service names
- uno::Reference< XRegistryKey > xServicesKey = xImplKey->createKey(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES") )
- );
-
- uno::Sequence<rtl::OUString> sServiceNames = WinInetBackend::getBackendServiceNames();
- for (sal_Int32 i = 0 ; i < sServiceNames.getLength() ; ++ i)
- xServicesKey->createKey(sServiceNames[i]);
-
- // Register supported components
- uno::Reference<XRegistryKey> xComponentKey = xImplKey->createKey(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/DATA/SupportedComponents") )
- );
-
- xComponentKey->setAsciiListValue( WinInetBackend::getSupportedComponents() );
-
- return sal_True;
- }
- catch( InvalidRegistryException& )
- {
- OSL_ENSURE(sal_False, "InvalidRegistryException caught");
- }
- }
- return sal_False;
+extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void *pRegistryKey) {
+ return cppu::component_writeInfoHelper(
+ pServiceManager, pRegistryKey, kImplementations_entries);
}
//------------------------------------------------------------------------------
diff --git a/shell/source/backends/wininetbe/wininetlayer.cxx b/shell/source/backends/wininetbe/wininetlayer.cxx
deleted file mode 100644
index df00abe0081b..000000000000
--- a/shell/source/backends/wininetbe/wininetlayer.cxx
+++ /dev/null
@@ -1,374 +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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_shell.hxx"
-
-#ifndef _WININETLAYER_HXX_
-#include "wininetlayer.hxx"
-#endif
-
-#include <malloc.h>
-
-#include <rtl/ustrbuf.hxx>
-
-#define EQUAL_SIGN '='
-#define COLON ':'
-#define SPACE ' '
-#define SEMI_COLON ';'
-
-typedef struct
-{
- rtl::OUString Server;
- rtl::OUString Port;
-} ProxyEntry;
-
-//------------------------------------------------------------------------
-// helper functions
-//------------------------------------------------------------------------
-
-namespace // private
-{
- ProxyEntry ReadProxyEntry(const rtl::OUString& aProxy, sal_Int32& i)
- {
- ProxyEntry aProxyEntry;
-
- aProxyEntry.Server = aProxy.getToken( 0, COLON, i );
- if ( i > -1 )
- aProxyEntry.Port = aProxy.getToken( 0, COLON, i );
-
- return aProxyEntry;
- }
-
- ProxyEntry FindProxyEntry(const rtl::OUString& aProxyList, const rtl::OUString& aType)
- {
- sal_Int32 nIndex = 0;
-
- do
- {
- // get the next token, e.g. ftp=server:port
- rtl::OUString nextToken = aProxyList.getToken( 0, SPACE, nIndex );
-
- // split the next token again into the parts separated
- // through '=', e.g. ftp=server:port -> ftp and server:port
- sal_Int32 i = 0;
- if( nextToken.indexOf( EQUAL_SIGN ) > -1 )
- {
- if( aType.equals( nextToken.getToken( 0, EQUAL_SIGN, i ) ) )
- return ReadProxyEntry(nextToken, i);
- }
- else if( aType.getLength() == 0)
- return ReadProxyEntry(nextToken, i);
-
- } while ( nIndex >= 0 );
-
- return ProxyEntry();
- }
-
-} // end private namespace
-
-//------------------------------------------------------------------------------
-
-WinInetLayer::WinInetLayer( InternetQueryOption_Proc_T lpfnInternetQueryOption,
- const uno::Reference<uno::XComponentContext>& xContext)
- : m_lpfnInternetQueryOption(lpfnInternetQueryOption)
-{
- //Create instance of LayerContentDescriber Service
- rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.comp.configuration.backend.LayerDescriber"));
-
- typedef uno::Reference<backend::XLayerContentDescriber> LayerDescriber;
- uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
- if( xServiceManager.is() )
- {
- m_xLayerContentDescriber = LayerDescriber::query(
- xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext));
- }
- else
- {
- OSL_TRACE("Could not retrieve ServiceManager");
- }
-
-}
-
-//------------------------------------------------------------------------------
-
-void SAL_CALL WinInetLayer::readData(
- const uno::Reference<backend::XLayerHandler>& xHandler)
- throw ( backend::MalformedDataException,
- lang::NullPointerException,
- lang::WrappedTargetException,
- uno::RuntimeException)
-{
-
- if (m_xLayerContentDescriber.is() && m_lpfnInternetQueryOption)
- {
- LPINTERNET_PROXY_INFO lpi = NULL;
-
- // query for the neccessary space
- DWORD dwLength = 0;
- BOOL bRet = m_lpfnInternetQueryOption(
- NULL,
- INTERNET_OPTION_PROXY,
- (LPVOID)lpi,
- &dwLength );
-
- // allocate sufficient space on the heap
- // insufficient space on the heap results
- // in a stack overflow exception, we assume
- // this never happens, because of the relatively
- // small amount of memory we need
- // _alloca is nice because it is fast and we don't
- // have to free the allocated memory, it will be
- // automatically done
- lpi = reinterpret_cast< LPINTERNET_PROXY_INFO >(
- _alloca( dwLength ) );
-
- bRet = m_lpfnInternetQueryOption(
- NULL,
- INTERNET_OPTION_PROXY,
- (LPVOID)lpi,
- &dwLength );
-
- // if a proxy is disabled, InternetQueryOption returns
- // an empty proxy list, so we don't have to check if
- // proxy is enabled or not
-
- rtl::OUString aProxyList = rtl::OUString::createFromAscii( lpi->lpszProxy );
- rtl::OUString aProxyBypassList = rtl::OUString::createFromAscii( lpi->lpszProxyBypass );
-
- // override default for ProxyType, which is "0" meaning "No proxies".
- uno::Sequence<backend::PropertyInfo> aPropInfoList(8);
- sal_Int32 nProperties = 1;
-
- aPropInfoList[0].Name = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetProxyType") );
- aPropInfoList[0].Type = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "int" ) );
- aPropInfoList[0].Protected = sal_False;
- aPropInfoList[0].Value = uno::makeAny( nProperties );
-
- // fill proxy bypass list
- if( aProxyBypassList.getLength() > 0 )
- {
- rtl::OUStringBuffer aReverseList;
- sal_Int32 nIndex = 0;
- do
- {
- rtl::OUString aToken = aProxyBypassList.getToken( 0, SPACE, nIndex );
- if ( aProxyList.indexOf( aToken ) == -1 )
- {
- if ( aReverseList.getLength() )
- {
- aReverseList.insert( 0, sal_Unicode( SEMI_COLON ) );
- aReverseList.insert( 0, aToken );
- }
- else
- aReverseList = aToken;
- }
- }
- while ( nIndex >= 0 );
-
- aProxyBypassList = aReverseList.makeStringAndClear();
-
- aPropInfoList[nProperties].Name = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetNoProxy") );
- aPropInfoList[nProperties].Type = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "string" ) );
- aPropInfoList[nProperties].Protected = sal_False;
- aPropInfoList[nProperties++].Value = uno::makeAny( aProxyBypassList.replace( SPACE, SEMI_COLON ) );
- }
-
- if( aProxyList.getLength() > 0 )
- {
- //-------------------------------------------------
- // this implementation follows the algorithm
- // of the internet explorer
- // if there are type-dependent proxy settings
- // and type independent proxy settings in the
- // registry the internet explorer chooses the
- // type independent proxy for all settings
- // e.g. imagine the following registry entry
- // ftp=server:port;http=server:port;server:port
- // the last token server:port is type independent
- // so the ie chooses this proxy server
-
- // if there is no port specified for a type independent
- // server the ie uses the port of an http server if
- // there is one and it has a port
- //-------------------------------------------------
-
- ProxyEntry aTypeIndepProxy = FindProxyEntry( aProxyList, rtl::OUString());
- ProxyEntry aHttpProxy = FindProxyEntry( aProxyList, rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "http" ) ) );
- ProxyEntry aHttpsProxy = FindProxyEntry( aProxyList, rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "https" ) ) );
-
- ProxyEntry aFtpProxy = FindProxyEntry( aProxyList, rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "ftp" ) ) );
-
- if( aTypeIndepProxy.Server.getLength() )
- {
- aHttpProxy.Server = aTypeIndepProxy.Server;
- aHttpsProxy.Server = aTypeIndepProxy.Server;
- aFtpProxy.Server = aTypeIndepProxy.Server;
-
- if( aTypeIndepProxy.Port.getLength() )
- {
- aHttpProxy.Port = aTypeIndepProxy.Port;
- aHttpsProxy.Port = aTypeIndepProxy.Port;
- aFtpProxy.Port = aTypeIndepProxy.Port;
- }
- else
- {
- aFtpProxy.Port = aHttpProxy.Port;
- aHttpsProxy.Port = aHttpProxy.Port;
- }
- }
-
- // http proxy name
- if( aHttpProxy.Server.getLength() > 0 )
- {
- aPropInfoList[nProperties].Name = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPProxyName") );
- aPropInfoList[nProperties].Type = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "string" ) );
- aPropInfoList[nProperties].Protected = sal_False;
- aPropInfoList[nProperties++].Value = uno::makeAny( aHttpProxy.Server );
- }
-
- // http proxy port
- if( aHttpProxy.Port.getLength() > 0 )
- {
- aPropInfoList[nProperties].Name = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPProxyPort") );
- aPropInfoList[nProperties].Type = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "int" ) );
- aPropInfoList[nProperties].Protected = sal_False;
- aPropInfoList[nProperties++].Value = uno::makeAny( aHttpProxy.Port.toInt32() );
- }
-
- // https proxy name
- if( aHttpsProxy.Server.getLength() > 0 )
- {
- aPropInfoList[nProperties].Name = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPSProxyName") );
- aPropInfoList[nProperties].Type = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "string" ) );
- aPropInfoList[nProperties].Protected = sal_False;
- aPropInfoList[nProperties++].Value = uno::makeAny( aHttpsProxy.Server );
- }
-
- // https proxy port
- if( aHttpsProxy.Port.getLength() > 0 )
- {
- aPropInfoList[nProperties].Name = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPSProxyPort") );
- aPropInfoList[nProperties].Type = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "int" ) );
- aPropInfoList[nProperties].Protected = sal_False;
- aPropInfoList[nProperties++].Value = uno::makeAny( aHttpsProxy.Port.toInt32() );
- }
-
- // ftp proxy name
- if( aFtpProxy.Server.getLength() > 0 )
- {
- aPropInfoList[nProperties].Name = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetFTPProxyName") );
- aPropInfoList[nProperties].Type = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "string" ) );
- aPropInfoList[nProperties].Protected = sal_False;
- aPropInfoList[nProperties++].Value = uno::makeAny( aFtpProxy.Server );
- }
-
- // ftp proxy port
- if( aFtpProxy.Port.getLength() > 0 )
- {
- aPropInfoList[nProperties].Name = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetFTPProxyPort") );
- aPropInfoList[nProperties].Type = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "int" ) );
- aPropInfoList[nProperties].Protected = sal_False;
- aPropInfoList[nProperties++].Value = uno::makeAny( aFtpProxy.Port.toInt32() );
- }
- }
-
- // resize the property info list appropriately
- aPropInfoList.realloc(nProperties);
-
- m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList);
- }
- else
- {
- OSL_TRACE("Could not create com.sun.star.configuration.backend.LayerContentDescriber Service");
- }
-}
-
-//------------------------------------------------------------------------------
-
-rtl::OUString SAL_CALL WinInetLayer::getTimestamp(void)
- throw (uno::RuntimeException)
-{
- rtl::OUString aTimestamp;
-
- if (m_lpfnInternetQueryOption)
- {
- LPINTERNET_PROXY_INFO lpi = NULL;
-
- // query for the neccessary space
- DWORD dwLength = 0;
- BOOL bRet = m_lpfnInternetQueryOption(
- NULL,
- INTERNET_OPTION_PROXY,
- (LPVOID)lpi,
- &dwLength );
-
- // allocate sufficient space on the heap
- // insufficient space on the heap results
- // in a stack overflow exception, we assume
- // this never happens, because of the relatively
- // small amount of memory we need
- // _alloca is nice because it is fast and we don't
- // have to free the allocated memory, it will be
- // automatically done
- lpi = reinterpret_cast< LPINTERNET_PROXY_INFO >(
- _alloca( dwLength ) );
-
- bRet = m_lpfnInternetQueryOption(
- NULL,
- INTERNET_OPTION_PROXY,
- (LPVOID)lpi,
- &dwLength );
-
- aTimestamp = rtl::OUString::createFromAscii( lpi->lpszProxy );
- aTimestamp += rtl::OUString::createFromAscii( lpi->lpszProxyBypass );
- }
-
- return aTimestamp;
-}
-
-//------------------------------------------------------------------------------
diff --git a/shell/source/backends/wininetbe/wininetlayer.hxx b/shell/source/backends/wininetbe/wininetlayer.hxx
deleted file mode 100644
index 761e174d1df5..000000000000
--- a/shell/source/backends/wininetbe/wininetlayer.hxx
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef _WinInetLayer_HXX_
-#define _WinInetLayer_HXX_
-
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/configuration/backend/XLayer.hpp>
-#include <com/sun/star/configuration/backend/PropertyInfo.hpp>
-#include <com/sun/star/configuration/backend/BackendAccessException.hpp>
-
-#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_
-#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
-#endif
-#include <com/sun/star/util/XTimeStamped.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <cppuhelper/implbase2.hxx>
-
-#if defined _MSC_VER
-#pragma warning(push, 1)
-#endif
-#include <windows.h>
-#include <wininet.h>
-#if defined _MSC_VER
-#pragma warning(pop)
-#endif
-
-namespace css = com::sun::star ;
-namespace uno = css::uno ;
-namespace lang = css::lang ;
-namespace backend = css::configuration::backend ;
-namespace util = css::util ;
-
-/**
- Implementation of the XLayer interfaces for fixed values
- */
-
-class WinInetLayer : public cppu::WeakImplHelper2<backend::XLayer, util::XTimeStamped>
-{
- public :
- typedef BOOL ( WINAPI *InternetQueryOption_Proc_T )( HINTERNET, DWORD, LPVOID, LPDWORD );
-
- /**
- Constructor given the requested component name
-
- @param lpfnInternetQueryOption function pointer into wininet.dll
- @param aTimestamp timestamp indicating last modifictaion
- */
- WinInetLayer(InternetQueryOption_Proc_T lpfnInternetQueryOption,
- const uno::Reference<uno::XComponentContext>& xContext);
-
- /** Destructor */
- ~WinInetLayer(void) {}
-
- // XLayer
- virtual void SAL_CALL readData(const uno::Reference<backend::XLayerHandler>& xHandler)
- throw ( backend::MalformedDataException,
- lang::NullPointerException,
- lang::WrappedTargetException,
- uno::RuntimeException) ;
-
- // XTimeStamped
- virtual rtl::OUString SAL_CALL getTimestamp(void)
- throw (uno::RuntimeException);
-
- private :
-
- rtl::OUString m_aComponent ;
-
- uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ;
-
- // The InternetQueryOption function pointer
- InternetQueryOption_Proc_T m_lpfnInternetQueryOption;
-} ;
-
-#endif // _WinInetLayer_HXX_