1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_shell.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "rtl/ustrbuf.hxx"
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include "wininetbackend.hxx"
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #if defined _MSC_VER
36*cdf0e10cSrcweir #pragma warning(push, 1)
37*cdf0e10cSrcweir #endif
38*cdf0e10cSrcweir #include <windows.h>
39*cdf0e10cSrcweir #include <wininet.h>
40*cdf0e10cSrcweir #include <sal/alloca.h>
41*cdf0e10cSrcweir #if defined _MSC_VER
42*cdf0e10cSrcweir #pragma warning(pop)
43*cdf0e10cSrcweir #endif
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir #define WININET_DLL_NAME "wininet.dll"
46*cdf0e10cSrcweir #define EQUAL_SIGN '='
47*cdf0e10cSrcweir #define COLON      ':'
48*cdf0e10cSrcweir #define SPACE      ' '
49*cdf0e10cSrcweir #define SEMI_COLON ';'
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir namespace {
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir struct Library {
54*cdf0e10cSrcweir     HMODULE module;
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir     Library(HMODULE theModule): module(theModule) {}
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir     ~Library() { if (module) FreeLibrary(module); }
59*cdf0e10cSrcweir };
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir }
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir typedef struct
64*cdf0e10cSrcweir {
65*cdf0e10cSrcweir     rtl::OUString Server;
66*cdf0e10cSrcweir     rtl::OUString Port;
67*cdf0e10cSrcweir } ProxyEntry;
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir //------------------------------------------------------------------------
70*cdf0e10cSrcweir // helper functions
71*cdf0e10cSrcweir //------------------------------------------------------------------------
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir namespace // private
74*cdf0e10cSrcweir {
75*cdf0e10cSrcweir     ProxyEntry ReadProxyEntry(const rtl::OUString& aProxy, sal_Int32& i)
76*cdf0e10cSrcweir     {
77*cdf0e10cSrcweir         ProxyEntry aProxyEntry;
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir         aProxyEntry.Server = aProxy.getToken( 0, COLON, i );
80*cdf0e10cSrcweir         if ( i > -1 )
81*cdf0e10cSrcweir             aProxyEntry.Port = aProxy.getToken( 0, COLON, i );
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir         return aProxyEntry;
84*cdf0e10cSrcweir     }
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir     ProxyEntry FindProxyEntry(const rtl::OUString& aProxyList, const rtl::OUString& aType)
87*cdf0e10cSrcweir     {
88*cdf0e10cSrcweir         sal_Int32 nIndex = 0;
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir         do
91*cdf0e10cSrcweir         {
92*cdf0e10cSrcweir             // get the next token, e.g. ftp=server:port
93*cdf0e10cSrcweir             rtl::OUString nextToken = aProxyList.getToken( 0, SPACE, nIndex );
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir             // split the next token again into the parts separated
96*cdf0e10cSrcweir             // through '=', e.g. ftp=server:port -> ftp and server:port
97*cdf0e10cSrcweir             sal_Int32 i = 0;
98*cdf0e10cSrcweir             if( nextToken.indexOf( EQUAL_SIGN ) > -1 )
99*cdf0e10cSrcweir             {
100*cdf0e10cSrcweir                 if( aType.equals( nextToken.getToken( 0, EQUAL_SIGN, i ) ) )
101*cdf0e10cSrcweir                     return ReadProxyEntry(nextToken, i);
102*cdf0e10cSrcweir             }
103*cdf0e10cSrcweir             else if( aType.getLength() == 0)
104*cdf0e10cSrcweir                 return ReadProxyEntry(nextToken, i);
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir         } while ( nIndex >= 0 );
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir         return ProxyEntry();
109*cdf0e10cSrcweir     }
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir } // end private namespace
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir //------------------------------------------------------------------------------
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir WinInetBackend::WinInetBackend()
116*cdf0e10cSrcweir {
117*cdf0e10cSrcweir     Library hWinInetDll( LoadLibrary( WININET_DLL_NAME ) );
118*cdf0e10cSrcweir     if( hWinInetDll.module )
119*cdf0e10cSrcweir     {
120*cdf0e10cSrcweir         typedef BOOL ( WINAPI *InternetQueryOption_Proc_T )( HINTERNET, DWORD, LPVOID, LPDWORD );
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir         InternetQueryOption_Proc_T lpfnInternetQueryOption =
123*cdf0e10cSrcweir             reinterpret_cast< InternetQueryOption_Proc_T >(
124*cdf0e10cSrcweir                 GetProcAddress( hWinInetDll.module, "InternetQueryOptionA" ) );
125*cdf0e10cSrcweir         if (lpfnInternetQueryOption)
126*cdf0e10cSrcweir         {
127*cdf0e10cSrcweir             LPINTERNET_PROXY_INFO lpi = NULL;
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir             // query for the neccessary space
130*cdf0e10cSrcweir             DWORD dwLength = 0;
131*cdf0e10cSrcweir             BOOL bRet = lpfnInternetQueryOption(
132*cdf0e10cSrcweir                 NULL,
133*cdf0e10cSrcweir                 INTERNET_OPTION_PROXY,
134*cdf0e10cSrcweir                 (LPVOID)lpi,
135*cdf0e10cSrcweir                 &dwLength );
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir             // allocate sufficient space on the heap
138*cdf0e10cSrcweir             // insufficient space on the heap results
139*cdf0e10cSrcweir             // in a stack overflow exception, we assume
140*cdf0e10cSrcweir             // this never happens, because of the relatively
141*cdf0e10cSrcweir             // small amount of memory we need
142*cdf0e10cSrcweir             // alloca is nice because it is fast and we don't
143*cdf0e10cSrcweir             // have to free the allocated memory, it will be
144*cdf0e10cSrcweir             // automatically done
145*cdf0e10cSrcweir             lpi = reinterpret_cast< LPINTERNET_PROXY_INFO >(
146*cdf0e10cSrcweir                 alloca( dwLength ) );
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir             bRet = lpfnInternetQueryOption(
149*cdf0e10cSrcweir                 NULL,
150*cdf0e10cSrcweir                 INTERNET_OPTION_PROXY,
151*cdf0e10cSrcweir                 (LPVOID)lpi,
152*cdf0e10cSrcweir                 &dwLength );
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir             // if a proxy is disabled, InternetQueryOption returns
155*cdf0e10cSrcweir             // an empty proxy list, so we don't have to check if
156*cdf0e10cSrcweir             // proxy is enabled or not
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir             rtl::OUString aProxyList       = rtl::OUString::createFromAscii( lpi->lpszProxy );
159*cdf0e10cSrcweir             rtl::OUString aProxyBypassList = rtl::OUString::createFromAscii( lpi->lpszProxyBypass );
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir             // override default for ProxyType, which is "0" meaning "No proxies".
162*cdf0e10cSrcweir             sal_Int32 nProperties = 1;
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir             valueProxyType_.IsPresent = true;
165*cdf0e10cSrcweir             valueProxyType_.Value <<= nProperties;
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir             // fill proxy bypass list
168*cdf0e10cSrcweir             if( aProxyBypassList.getLength() > 0 )
169*cdf0e10cSrcweir             {
170*cdf0e10cSrcweir                 rtl::OUStringBuffer aReverseList;
171*cdf0e10cSrcweir                 sal_Int32 nIndex = 0;
172*cdf0e10cSrcweir                 do
173*cdf0e10cSrcweir                 {
174*cdf0e10cSrcweir                     rtl::OUString aToken = aProxyBypassList.getToken( 0, SPACE, nIndex );
175*cdf0e10cSrcweir                     if ( aProxyList.indexOf( aToken ) == -1 )
176*cdf0e10cSrcweir                     {
177*cdf0e10cSrcweir                         if ( aReverseList.getLength() )
178*cdf0e10cSrcweir                         {
179*cdf0e10cSrcweir                             aReverseList.insert( 0, sal_Unicode( SEMI_COLON ) );
180*cdf0e10cSrcweir                             aReverseList.insert( 0, aToken );
181*cdf0e10cSrcweir                         }
182*cdf0e10cSrcweir                         else
183*cdf0e10cSrcweir                             aReverseList = aToken;
184*cdf0e10cSrcweir                     }
185*cdf0e10cSrcweir                 }
186*cdf0e10cSrcweir                 while ( nIndex >= 0 );
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir                 aProxyBypassList = aReverseList.makeStringAndClear();
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir                 valueNoProxy_.IsPresent = true;
191*cdf0e10cSrcweir                 valueNoProxy_.Value <<= aProxyBypassList.replace( SPACE, SEMI_COLON );
192*cdf0e10cSrcweir             }
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir             if( aProxyList.getLength() > 0 )
195*cdf0e10cSrcweir             {
196*cdf0e10cSrcweir                 //-------------------------------------------------
197*cdf0e10cSrcweir                 // this implementation follows the algorithm
198*cdf0e10cSrcweir                 // of the internet explorer
199*cdf0e10cSrcweir                 // if there are type-dependent proxy settings
200*cdf0e10cSrcweir                 // and type independent proxy settings in the
201*cdf0e10cSrcweir                 // registry the internet explorer chooses the
202*cdf0e10cSrcweir                 // type independent proxy for all settings
203*cdf0e10cSrcweir                 // e.g. imagine the following registry entry
204*cdf0e10cSrcweir                 // ftp=server:port;http=server:port;server:port
205*cdf0e10cSrcweir                 // the last token server:port is type independent
206*cdf0e10cSrcweir                 // so the ie chooses this proxy server
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir                 // if there is no port specified for a type independent
209*cdf0e10cSrcweir                 // server the ie uses the port of an http server if
210*cdf0e10cSrcweir                 // there is one and it has a port
211*cdf0e10cSrcweir                 //-------------------------------------------------
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir                 ProxyEntry aTypeIndepProxy = FindProxyEntry( aProxyList, rtl::OUString());
214*cdf0e10cSrcweir                 ProxyEntry aHttpProxy = FindProxyEntry( aProxyList, rtl::OUString(
215*cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM( "http" ) ) );
216*cdf0e10cSrcweir                 ProxyEntry aHttpsProxy  = FindProxyEntry( aProxyList, rtl::OUString(
217*cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM( "https" ) ) );
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir                 ProxyEntry aFtpProxy  = FindProxyEntry( aProxyList, rtl::OUString(
220*cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM( "ftp" ) ) );
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir                 if( aTypeIndepProxy.Server.getLength() )
223*cdf0e10cSrcweir                 {
224*cdf0e10cSrcweir                     aHttpProxy.Server = aTypeIndepProxy.Server;
225*cdf0e10cSrcweir                     aHttpsProxy.Server  = aTypeIndepProxy.Server;
226*cdf0e10cSrcweir                     aFtpProxy.Server  = aTypeIndepProxy.Server;
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir                     if( aTypeIndepProxy.Port.getLength() )
229*cdf0e10cSrcweir                     {
230*cdf0e10cSrcweir                         aHttpProxy.Port = aTypeIndepProxy.Port;
231*cdf0e10cSrcweir                         aHttpsProxy.Port  = aTypeIndepProxy.Port;
232*cdf0e10cSrcweir                         aFtpProxy.Port  = aTypeIndepProxy.Port;
233*cdf0e10cSrcweir                     }
234*cdf0e10cSrcweir                     else
235*cdf0e10cSrcweir                     {
236*cdf0e10cSrcweir                         aFtpProxy.Port  = aHttpProxy.Port;
237*cdf0e10cSrcweir                         aHttpsProxy.Port  = aHttpProxy.Port;
238*cdf0e10cSrcweir                     }
239*cdf0e10cSrcweir                 }
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir                 // http proxy name
242*cdf0e10cSrcweir                 if( aHttpProxy.Server.getLength() > 0 )
243*cdf0e10cSrcweir                 {
244*cdf0e10cSrcweir                     valueHttpProxyName_.IsPresent = true;
245*cdf0e10cSrcweir                     valueHttpProxyName_.Value <<= aHttpProxy.Server;
246*cdf0e10cSrcweir                 }
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir                 // http proxy port
249*cdf0e10cSrcweir                 if( aHttpProxy.Port.getLength() > 0 )
250*cdf0e10cSrcweir                 {
251*cdf0e10cSrcweir                     valueHttpProxyPort_.IsPresent = true;
252*cdf0e10cSrcweir                     valueHttpProxyPort_.Value <<= aHttpProxy.Port.toInt32();
253*cdf0e10cSrcweir                 }
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir                 // https proxy name
256*cdf0e10cSrcweir                 if( aHttpsProxy.Server.getLength() > 0 )
257*cdf0e10cSrcweir                 {
258*cdf0e10cSrcweir                     valueHttpsProxyName_.IsPresent = true;
259*cdf0e10cSrcweir                     valueHttpsProxyName_.Value <<= aHttpsProxy.Server;
260*cdf0e10cSrcweir                 }
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir                 // https proxy port
263*cdf0e10cSrcweir                 if( aHttpsProxy.Port.getLength() > 0 )
264*cdf0e10cSrcweir                 {
265*cdf0e10cSrcweir                     valueHttpsProxyPort_.IsPresent = true;
266*cdf0e10cSrcweir                     valueHttpsProxyPort_.Value <<= aHttpsProxy.Port.toInt32();
267*cdf0e10cSrcweir                 }
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir                 // ftp proxy name
270*cdf0e10cSrcweir                 if( aFtpProxy.Server.getLength() > 0 )
271*cdf0e10cSrcweir                 {
272*cdf0e10cSrcweir                     valueFtpProxyName_.IsPresent = true;
273*cdf0e10cSrcweir                     valueFtpProxyName_.Value <<= aFtpProxy.Server;
274*cdf0e10cSrcweir                 }
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir                 // ftp proxy port
277*cdf0e10cSrcweir                 if( aFtpProxy.Port.getLength() > 0 )
278*cdf0e10cSrcweir                 {
279*cdf0e10cSrcweir                     valueFtpProxyPort_.IsPresent = true;
280*cdf0e10cSrcweir                     valueFtpProxyPort_.Value <<= aFtpProxy.Port.toInt32();
281*cdf0e10cSrcweir                 }
282*cdf0e10cSrcweir             }
283*cdf0e10cSrcweir         }
284*cdf0e10cSrcweir     }
285*cdf0e10cSrcweir }
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir //------------------------------------------------------------------------------
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir WinInetBackend::~WinInetBackend(void)
290*cdf0e10cSrcweir {
291*cdf0e10cSrcweir }
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir //------------------------------------------------------------------------------
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir WinInetBackend* WinInetBackend::createInstance()
296*cdf0e10cSrcweir {
297*cdf0e10cSrcweir     return new WinInetBackend;
298*cdf0e10cSrcweir }
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir // ---------------------------------------------------------------------------------------
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir void WinInetBackend::setPropertyValue(
303*cdf0e10cSrcweir     rtl::OUString const &, css::uno::Any const &)
304*cdf0e10cSrcweir     throw (
305*cdf0e10cSrcweir         css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
306*cdf0e10cSrcweir         css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
307*cdf0e10cSrcweir         css::uno::RuntimeException)
308*cdf0e10cSrcweir {
309*cdf0e10cSrcweir     throw css::lang::IllegalArgumentException(
310*cdf0e10cSrcweir         rtl::OUString(
311*cdf0e10cSrcweir             RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")),
312*cdf0e10cSrcweir         static_cast< cppu::OWeakObject * >(this), -1);
313*cdf0e10cSrcweir }
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir css::uno::Any WinInetBackend::getPropertyValue(
316*cdf0e10cSrcweir     rtl::OUString const & PropertyName)
317*cdf0e10cSrcweir     throw (
318*cdf0e10cSrcweir         css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
319*cdf0e10cSrcweir         css::uno::RuntimeException)
320*cdf0e10cSrcweir {
321*cdf0e10cSrcweir     if (PropertyName.equalsAsciiL(
322*cdf0e10cSrcweir             RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName")))
323*cdf0e10cSrcweir     {
324*cdf0e10cSrcweir         return css::uno::makeAny(valueFtpProxyName_);
325*cdf0e10cSrcweir     } else if (PropertyName.equalsAsciiL(
326*cdf0e10cSrcweir                    RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort")))
327*cdf0e10cSrcweir     {
328*cdf0e10cSrcweir         return css::uno::makeAny(valueFtpProxyPort_);
329*cdf0e10cSrcweir     } else if (PropertyName.equalsAsciiL(
330*cdf0e10cSrcweir                    RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName")))
331*cdf0e10cSrcweir     {
332*cdf0e10cSrcweir         return css::uno::makeAny(valueHttpProxyName_);
333*cdf0e10cSrcweir     } else if (PropertyName.equalsAsciiL(
334*cdf0e10cSrcweir                    RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort")))
335*cdf0e10cSrcweir     {
336*cdf0e10cSrcweir         return css::uno::makeAny(valueHttpProxyPort_);
337*cdf0e10cSrcweir     } else if (PropertyName.equalsAsciiL(
338*cdf0e10cSrcweir                    RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName")))
339*cdf0e10cSrcweir     {
340*cdf0e10cSrcweir         return css::uno::makeAny(valueHttpsProxyName_);
341*cdf0e10cSrcweir     } else if (PropertyName.equalsAsciiL(
342*cdf0e10cSrcweir                    RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort")))
343*cdf0e10cSrcweir     {
344*cdf0e10cSrcweir         return css::uno::makeAny(valueHttpsProxyPort_);
345*cdf0e10cSrcweir     } else if (PropertyName.equalsAsciiL(
346*cdf0e10cSrcweir                    RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy")))
347*cdf0e10cSrcweir     {
348*cdf0e10cSrcweir         return css::uno::makeAny(valueNoProxy_);
349*cdf0e10cSrcweir     } else if (PropertyName.equalsAsciiL(
350*cdf0e10cSrcweir                    RTL_CONSTASCII_STRINGPARAM("ooInetProxyType")))
351*cdf0e10cSrcweir     {
352*cdf0e10cSrcweir         return css::uno::makeAny(valueProxyType_);
353*cdf0e10cSrcweir     } else {
354*cdf0e10cSrcweir         throw css::beans::UnknownPropertyException(
355*cdf0e10cSrcweir             PropertyName, static_cast< cppu::OWeakObject * >(this));
356*cdf0e10cSrcweir     }
357*cdf0e10cSrcweir }
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir //------------------------------------------------------------------------------
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir rtl::OUString SAL_CALL WinInetBackend::getBackendName(void) {
362*cdf0e10cSrcweir 	return rtl::OUString::createFromAscii("com.sun.star.comp.configuration.backend.WinInetBackend") ;
363*cdf0e10cSrcweir }
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir //------------------------------------------------------------------------------
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir rtl::OUString SAL_CALL WinInetBackend::getImplementationName(void)
368*cdf0e10cSrcweir     throw (uno::RuntimeException)
369*cdf0e10cSrcweir {
370*cdf0e10cSrcweir     return getBackendName() ;
371*cdf0e10cSrcweir }
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir //------------------------------------------------------------------------------
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir uno::Sequence<rtl::OUString> SAL_CALL WinInetBackend::getBackendServiceNames(void)
376*cdf0e10cSrcweir {
377*cdf0e10cSrcweir     uno::Sequence<rtl::OUString> aServiceNameList(1);
378*cdf0e10cSrcweir     aServiceNameList[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.WinInetBackend")) ;
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir     return aServiceNameList ;
381*cdf0e10cSrcweir }
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir //------------------------------------------------------------------------------
384*cdf0e10cSrcweir 
385*cdf0e10cSrcweir sal_Bool SAL_CALL WinInetBackend::supportsService(const rtl::OUString& aServiceName)
386*cdf0e10cSrcweir     throw (uno::RuntimeException)
387*cdf0e10cSrcweir {
388*cdf0e10cSrcweir     uno::Sequence< rtl::OUString > const svc = getBackendServiceNames();
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir     for(sal_Int32 i = 0; i < svc.getLength(); ++i )
391*cdf0e10cSrcweir         if(svc[i] == aServiceName)
392*cdf0e10cSrcweir             return true;
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir     return false;
395*cdf0e10cSrcweir }
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir //------------------------------------------------------------------------------
398*cdf0e10cSrcweir 
399*cdf0e10cSrcweir uno::Sequence<rtl::OUString> SAL_CALL WinInetBackend::getSupportedServiceNames(void)
400*cdf0e10cSrcweir     throw (uno::RuntimeException)
401*cdf0e10cSrcweir {
402*cdf0e10cSrcweir     return getBackendServiceNames() ;
403*cdf0e10cSrcweir }
404