1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski  *
3*b1cdbd2cSJim Jagielski  * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski  * or more contributor license agreements.  See the NOTICE file
5*b1cdbd2cSJim Jagielski  * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski  * regarding copyright ownership.  The ASF licenses this file
7*b1cdbd2cSJim Jagielski  * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski  * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski  * with the License.  You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski  *
11*b1cdbd2cSJim Jagielski  *   http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski  *
13*b1cdbd2cSJim Jagielski  * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski  * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski  * KIND, either express or implied.  See the License for the
17*b1cdbd2cSJim Jagielski  * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski  * under the License.
19*b1cdbd2cSJim Jagielski  *
20*b1cdbd2cSJim Jagielski  *************************************************************/
21*b1cdbd2cSJim Jagielski 
22*b1cdbd2cSJim Jagielski 
23*b1cdbd2cSJim Jagielski 
24*b1cdbd2cSJim Jagielski #include "precompiled_shell.hxx"
25*b1cdbd2cSJim Jagielski #include "sal/config.h"
26*b1cdbd2cSJim Jagielski 
27*b1cdbd2cSJim Jagielski #include "QFont"
28*b1cdbd2cSJim Jagielski #include "QString"
29*b1cdbd2cSJim Jagielski #include "kemailsettings.h"
30*b1cdbd2cSJim Jagielski #include "kglobalsettings.h"
31*b1cdbd2cSJim Jagielski #include "kprotocolmanager.h"
32*b1cdbd2cSJim Jagielski 
33*b1cdbd2cSJim Jagielski #include "com/sun/star/uno/Any.hxx"
34*b1cdbd2cSJim Jagielski #include "cppu/unotype.hxx"
35*b1cdbd2cSJim Jagielski #include "osl/diagnose.h"
36*b1cdbd2cSJim Jagielski #include "osl/file.h"
37*b1cdbd2cSJim Jagielski #include "rtl/string.h"
38*b1cdbd2cSJim Jagielski #include "rtl/ustring.hxx"
39*b1cdbd2cSJim Jagielski 
40*b1cdbd2cSJim Jagielski #include "kde4access.hxx"
41*b1cdbd2cSJim Jagielski 
42*b1cdbd2cSJim Jagielski #define SPACE      ' '
43*b1cdbd2cSJim Jagielski #define COMMA      ','
44*b1cdbd2cSJim Jagielski #define SEMI_COLON ';'
45*b1cdbd2cSJim Jagielski 
46*b1cdbd2cSJim Jagielski namespace kde4access {
47*b1cdbd2cSJim Jagielski 
48*b1cdbd2cSJim Jagielski namespace {
49*b1cdbd2cSJim Jagielski 
50*b1cdbd2cSJim Jagielski namespace css = com::sun::star ;
51*b1cdbd2cSJim Jagielski namespace uno = css::uno ;
52*b1cdbd2cSJim Jagielski 
53*b1cdbd2cSJim Jagielski }
54*b1cdbd2cSJim Jagielski 
getValue(rtl::OUString const & id)55*b1cdbd2cSJim Jagielski css::beans::Optional< css::uno::Any > getValue(rtl::OUString const & id) {
56*b1cdbd2cSJim Jagielski     if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ExternalMailer"))) {
57*b1cdbd2cSJim Jagielski         KEMailSettings aEmailSettings;
58*b1cdbd2cSJim Jagielski         QString aClientProgram;
59*b1cdbd2cSJim Jagielski         ::rtl::OUString sClientProgram;
60*b1cdbd2cSJim Jagielski 
61*b1cdbd2cSJim Jagielski         aClientProgram = aEmailSettings.getSetting( KEMailSettings::ClientProgram );
62*b1cdbd2cSJim Jagielski         if ( aClientProgram.isEmpty() )
63*b1cdbd2cSJim Jagielski             aClientProgram = "kmail";
64*b1cdbd2cSJim Jagielski         else
65*b1cdbd2cSJim Jagielski             aClientProgram = aClientProgram.section(SPACE, 0, 0);
66*b1cdbd2cSJim Jagielski         sClientProgram = (const sal_Unicode *) aClientProgram.utf16();
67*b1cdbd2cSJim Jagielski         return css::beans::Optional< css::uno::Any >(
68*b1cdbd2cSJim Jagielski             true, uno::makeAny( sClientProgram ) );
69*b1cdbd2cSJim Jagielski     } else if (id.equalsAsciiL(
70*b1cdbd2cSJim Jagielski                    RTL_CONSTASCII_STRINGPARAM("SourceViewFontHeight")))
71*b1cdbd2cSJim Jagielski     {
72*b1cdbd2cSJim Jagielski         QFont aFixedFont;
73*b1cdbd2cSJim Jagielski         short nFontHeight;
74*b1cdbd2cSJim Jagielski 
75*b1cdbd2cSJim Jagielski         aFixedFont = KGlobalSettings::fixedFont();
76*b1cdbd2cSJim Jagielski         nFontHeight = aFixedFont.pointSize();
77*b1cdbd2cSJim Jagielski         return css::beans::Optional< css::uno::Any >(
78*b1cdbd2cSJim Jagielski             true, uno::makeAny( nFontHeight ) );
79*b1cdbd2cSJim Jagielski     } else if (id.equalsAsciiL(
80*b1cdbd2cSJim Jagielski                    RTL_CONSTASCII_STRINGPARAM("SourceViewFontName")))
81*b1cdbd2cSJim Jagielski     {
82*b1cdbd2cSJim Jagielski         QFont aFixedFont;
83*b1cdbd2cSJim Jagielski         QString aFontName;
84*b1cdbd2cSJim Jagielski         :: rtl::OUString sFontName;
85*b1cdbd2cSJim Jagielski 
86*b1cdbd2cSJim Jagielski         aFixedFont = KGlobalSettings::fixedFont();
87*b1cdbd2cSJim Jagielski         aFontName = aFixedFont.family();
88*b1cdbd2cSJim Jagielski         sFontName = (const sal_Unicode *) aFontName.utf16();
89*b1cdbd2cSJim Jagielski         return css::beans::Optional< css::uno::Any >(
90*b1cdbd2cSJim Jagielski             true, uno::makeAny( sFontName ) );
91*b1cdbd2cSJim Jagielski     } else if (id.equalsAsciiL(
92*b1cdbd2cSJim Jagielski                    RTL_CONSTASCII_STRINGPARAM("EnableATToolSupport")))
93*b1cdbd2cSJim Jagielski     {
94*b1cdbd2cSJim Jagielski         /* does not make much sense without an accessibility bridge */
95*b1cdbd2cSJim Jagielski         sal_Bool ATToolSupport = sal_False;
96*b1cdbd2cSJim Jagielski         return css::beans::Optional< css::uno::Any >(
97*b1cdbd2cSJim Jagielski             true, uno::makeAny( rtl::OUString::valueOf( ATToolSupport ) ) );
98*b1cdbd2cSJim Jagielski     } else if (id.equalsAsciiL(
99*b1cdbd2cSJim Jagielski                    RTL_CONSTASCII_STRINGPARAM("WorkPathVariable")))
100*b1cdbd2cSJim Jagielski     {
101*b1cdbd2cSJim Jagielski         QString aDocumentsDir( KGlobalSettings::documentPath() );
102*b1cdbd2cSJim Jagielski         rtl::OUString sDocumentsDir;
103*b1cdbd2cSJim Jagielski         rtl::OUString sDocumentsURL;
104*b1cdbd2cSJim Jagielski         if ( aDocumentsDir.endsWith(QChar('/')) )
105*b1cdbd2cSJim Jagielski             aDocumentsDir.truncate ( aDocumentsDir.length() - 1 );
106*b1cdbd2cSJim Jagielski         sDocumentsDir = (const sal_Unicode *) aDocumentsDir.utf16();
107*b1cdbd2cSJim Jagielski         osl_getFileURLFromSystemPath( sDocumentsDir.pData, &sDocumentsURL.pData );
108*b1cdbd2cSJim Jagielski         return css::beans::Optional< css::uno::Any >(
109*b1cdbd2cSJim Jagielski             true, uno::makeAny( sDocumentsURL ) );
110*b1cdbd2cSJim Jagielski     } else if (id.equalsAsciiL(
111*b1cdbd2cSJim Jagielski                    RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName")))
112*b1cdbd2cSJim Jagielski     {
113*b1cdbd2cSJim Jagielski         QString aFTPProxy;
114*b1cdbd2cSJim Jagielski         switch ( KProtocolManager::proxyType() )
115*b1cdbd2cSJim Jagielski         {
116*b1cdbd2cSJim Jagielski         case KProtocolManager::ManualProxy: // Proxies are manually configured
117*b1cdbd2cSJim Jagielski             aFTPProxy = KProtocolManager::proxyFor( "FTP" );
118*b1cdbd2cSJim Jagielski             break;
119*b1cdbd2cSJim Jagielski         case KProtocolManager::PACProxy:    // A proxy configuration URL has been given
120*b1cdbd2cSJim Jagielski         case KProtocolManager::WPADProxy:   // A proxy should be automatically discovered
121*b1cdbd2cSJim Jagielski         case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
122*b1cdbd2cSJim Jagielski // In such cases, the proxy address is not stored in KDE, but determined dynamically.
123*b1cdbd2cSJim Jagielski // The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
124*b1cdbd2cSJim Jagielski // The best we can do here is to ask the current value for a given address.
125*b1cdbd2cSJim Jagielski             aFTPProxy = KProtocolManager::proxyForUrl( KUrl("ftp://ftp.openoffice.org") );
126*b1cdbd2cSJim Jagielski             break;
127*b1cdbd2cSJim Jagielski         default:                            // No proxy is used
128*b1cdbd2cSJim Jagielski             break;
129*b1cdbd2cSJim Jagielski         }
130*b1cdbd2cSJim Jagielski         if ( !aFTPProxy.isEmpty() )
131*b1cdbd2cSJim Jagielski         {
132*b1cdbd2cSJim Jagielski             KUrl aProxy(aFTPProxy);
133*b1cdbd2cSJim Jagielski             ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
134*b1cdbd2cSJim Jagielski             return css::beans::Optional< css::uno::Any >(
135*b1cdbd2cSJim Jagielski                 true, uno::makeAny( sProxy ) );
136*b1cdbd2cSJim Jagielski         }
137*b1cdbd2cSJim Jagielski     } else if (id.equalsAsciiL(
138*b1cdbd2cSJim Jagielski                    RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort")))
139*b1cdbd2cSJim Jagielski     {
140*b1cdbd2cSJim Jagielski         QString aFTPProxy;
141*b1cdbd2cSJim Jagielski         switch ( KProtocolManager::proxyType() )
142*b1cdbd2cSJim Jagielski         {
143*b1cdbd2cSJim Jagielski         case KProtocolManager::ManualProxy: // Proxies are manually configured
144*b1cdbd2cSJim Jagielski             aFTPProxy = KProtocolManager::proxyFor( "FTP" );
145*b1cdbd2cSJim Jagielski             break;
146*b1cdbd2cSJim Jagielski         case KProtocolManager::PACProxy:    // A proxy configuration URL has been given
147*b1cdbd2cSJim Jagielski         case KProtocolManager::WPADProxy:   // A proxy should be automatically discovered
148*b1cdbd2cSJim Jagielski         case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
149*b1cdbd2cSJim Jagielski // In such cases, the proxy address is not stored in KDE, but determined dynamically.
150*b1cdbd2cSJim Jagielski // The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
151*b1cdbd2cSJim Jagielski // The best we can do here is to ask the current value for a given address.
152*b1cdbd2cSJim Jagielski             aFTPProxy = KProtocolManager::proxyForUrl( KUrl("ftp://ftp.openoffice.org") );
153*b1cdbd2cSJim Jagielski             break;
154*b1cdbd2cSJim Jagielski         default:                            // No proxy is used
155*b1cdbd2cSJim Jagielski             break;
156*b1cdbd2cSJim Jagielski         }
157*b1cdbd2cSJim Jagielski         if ( !aFTPProxy.isEmpty() )
158*b1cdbd2cSJim Jagielski         {
159*b1cdbd2cSJim Jagielski             KUrl aProxy(aFTPProxy);
160*b1cdbd2cSJim Jagielski             sal_Int32 nPort = aProxy.port();
161*b1cdbd2cSJim Jagielski             return css::beans::Optional< css::uno::Any >(
162*b1cdbd2cSJim Jagielski                 true, uno::makeAny( nPort ) );
163*b1cdbd2cSJim Jagielski         }
164*b1cdbd2cSJim Jagielski     } else if (id.equalsAsciiL(
165*b1cdbd2cSJim Jagielski                    RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName")))
166*b1cdbd2cSJim Jagielski     {
167*b1cdbd2cSJim Jagielski         QString aHTTPProxy;
168*b1cdbd2cSJim Jagielski         switch ( KProtocolManager::proxyType() )
169*b1cdbd2cSJim Jagielski         {
170*b1cdbd2cSJim Jagielski         case KProtocolManager::ManualProxy: // Proxies are manually configured
171*b1cdbd2cSJim Jagielski             aHTTPProxy = KProtocolManager::proxyFor( "HTTP" );
172*b1cdbd2cSJim Jagielski             break;
173*b1cdbd2cSJim Jagielski         case KProtocolManager::PACProxy:    // A proxy configuration URL has been given
174*b1cdbd2cSJim Jagielski         case KProtocolManager::WPADProxy:   // A proxy should be automatically discovered
175*b1cdbd2cSJim Jagielski         case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
176*b1cdbd2cSJim Jagielski // In such cases, the proxy address is not stored in KDE, but determined dynamically.
177*b1cdbd2cSJim Jagielski // The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
178*b1cdbd2cSJim Jagielski // The best we can do here is to ask the current value for a given address.
179*b1cdbd2cSJim Jagielski             aHTTPProxy = KProtocolManager::proxyForUrl( KUrl("http://http.openoffice.org") );
180*b1cdbd2cSJim Jagielski             break;
181*b1cdbd2cSJim Jagielski         default:                            // No proxy is used
182*b1cdbd2cSJim Jagielski             break;
183*b1cdbd2cSJim Jagielski         }
184*b1cdbd2cSJim Jagielski         if ( !aHTTPProxy.isEmpty() )
185*b1cdbd2cSJim Jagielski         {
186*b1cdbd2cSJim Jagielski             KUrl aProxy(aHTTPProxy);
187*b1cdbd2cSJim Jagielski             ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
188*b1cdbd2cSJim Jagielski             return css::beans::Optional< css::uno::Any >(
189*b1cdbd2cSJim Jagielski                 true, uno::makeAny( sProxy ) );
190*b1cdbd2cSJim Jagielski         }
191*b1cdbd2cSJim Jagielski     } else if (id.equalsAsciiL(
192*b1cdbd2cSJim Jagielski                    RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort")))
193*b1cdbd2cSJim Jagielski     {
194*b1cdbd2cSJim Jagielski         QString aHTTPProxy;
195*b1cdbd2cSJim Jagielski         switch ( KProtocolManager::proxyType() )
196*b1cdbd2cSJim Jagielski         {
197*b1cdbd2cSJim Jagielski         case KProtocolManager::ManualProxy: // Proxies are manually configured
198*b1cdbd2cSJim Jagielski             aHTTPProxy = KProtocolManager::proxyFor( "HTTP" );
199*b1cdbd2cSJim Jagielski             break;
200*b1cdbd2cSJim Jagielski         case KProtocolManager::PACProxy:    // A proxy configuration URL has been given
201*b1cdbd2cSJim Jagielski         case KProtocolManager::WPADProxy:   // A proxy should be automatically discovered
202*b1cdbd2cSJim Jagielski         case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
203*b1cdbd2cSJim Jagielski // In such cases, the proxy address is not stored in KDE, but determined dynamically.
204*b1cdbd2cSJim Jagielski // The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
205*b1cdbd2cSJim Jagielski // The best we can do here is to ask the current value for a given address.
206*b1cdbd2cSJim Jagielski             aHTTPProxy = KProtocolManager::proxyForUrl( KUrl("http://http.openoffice.org") );
207*b1cdbd2cSJim Jagielski             break;
208*b1cdbd2cSJim Jagielski         default:                            // No proxy is used
209*b1cdbd2cSJim Jagielski             break;
210*b1cdbd2cSJim Jagielski         }
211*b1cdbd2cSJim Jagielski         if ( !aHTTPProxy.isEmpty() )
212*b1cdbd2cSJim Jagielski         {
213*b1cdbd2cSJim Jagielski             KUrl aProxy(aHTTPProxy);
214*b1cdbd2cSJim Jagielski             sal_Int32 nPort = aProxy.port();
215*b1cdbd2cSJim Jagielski             return css::beans::Optional< css::uno::Any >(
216*b1cdbd2cSJim Jagielski                 true, uno::makeAny( nPort ) );
217*b1cdbd2cSJim Jagielski         }
218*b1cdbd2cSJim Jagielski     } else if (id.equalsAsciiL(
219*b1cdbd2cSJim Jagielski                    RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName")))
220*b1cdbd2cSJim Jagielski     {
221*b1cdbd2cSJim Jagielski         QString aHTTPSProxy;
222*b1cdbd2cSJim Jagielski         switch ( KProtocolManager::proxyType() )
223*b1cdbd2cSJim Jagielski         {
224*b1cdbd2cSJim Jagielski         case KProtocolManager::ManualProxy: // Proxies are manually configured
225*b1cdbd2cSJim Jagielski             aHTTPSProxy = KProtocolManager::proxyFor( "HTTPS" );
226*b1cdbd2cSJim Jagielski             break;
227*b1cdbd2cSJim Jagielski         case KProtocolManager::PACProxy:    // A proxy configuration URL has been given
228*b1cdbd2cSJim Jagielski         case KProtocolManager::WPADProxy:   // A proxy should be automatically discovered
229*b1cdbd2cSJim Jagielski         case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
230*b1cdbd2cSJim Jagielski // In such cases, the proxy address is not stored in KDE, but determined dynamically.
231*b1cdbd2cSJim Jagielski // The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
232*b1cdbd2cSJim Jagielski // The best we can do here is to ask the current value for a given address.
233*b1cdbd2cSJim Jagielski             aHTTPSProxy = KProtocolManager::proxyForUrl( KUrl("https://https.openoffice.org") );
234*b1cdbd2cSJim Jagielski             break;
235*b1cdbd2cSJim Jagielski         default:                            // No proxy is used
236*b1cdbd2cSJim Jagielski             break;
237*b1cdbd2cSJim Jagielski         }
238*b1cdbd2cSJim Jagielski         if ( !aHTTPSProxy.isEmpty() )
239*b1cdbd2cSJim Jagielski         {
240*b1cdbd2cSJim Jagielski             KUrl aProxy(aHTTPSProxy);
241*b1cdbd2cSJim Jagielski             ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
242*b1cdbd2cSJim Jagielski             return css::beans::Optional< css::uno::Any >(
243*b1cdbd2cSJim Jagielski                 true, uno::makeAny( sProxy ) );
244*b1cdbd2cSJim Jagielski         }
245*b1cdbd2cSJim Jagielski     } else if (id.equalsAsciiL(
246*b1cdbd2cSJim Jagielski                    RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort")))
247*b1cdbd2cSJim Jagielski     {
248*b1cdbd2cSJim Jagielski         QString aHTTPSProxy;
249*b1cdbd2cSJim Jagielski         switch ( KProtocolManager::proxyType() )
250*b1cdbd2cSJim Jagielski         {
251*b1cdbd2cSJim Jagielski         case KProtocolManager::ManualProxy: // Proxies are manually configured
252*b1cdbd2cSJim Jagielski             aHTTPSProxy = KProtocolManager::proxyFor( "HTTPS" );
253*b1cdbd2cSJim Jagielski             break;
254*b1cdbd2cSJim Jagielski         case KProtocolManager::PACProxy:    // A proxy configuration URL has been given
255*b1cdbd2cSJim Jagielski         case KProtocolManager::WPADProxy:   // A proxy should be automatically discovered
256*b1cdbd2cSJim Jagielski         case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
257*b1cdbd2cSJim Jagielski // In such cases, the proxy address is not stored in KDE, but determined dynamically.
258*b1cdbd2cSJim Jagielski // The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
259*b1cdbd2cSJim Jagielski // The best we can do here is to ask the current value for a given address.
260*b1cdbd2cSJim Jagielski             aHTTPSProxy = KProtocolManager::proxyForUrl( KUrl("https://https.openoffice.org") );
261*b1cdbd2cSJim Jagielski             break;
262*b1cdbd2cSJim Jagielski         default:                            // No proxy is used
263*b1cdbd2cSJim Jagielski             break;
264*b1cdbd2cSJim Jagielski         }
265*b1cdbd2cSJim Jagielski         if ( !aHTTPSProxy.isEmpty() )
266*b1cdbd2cSJim Jagielski         {
267*b1cdbd2cSJim Jagielski             KUrl aProxy(aHTTPSProxy);
268*b1cdbd2cSJim Jagielski             sal_Int32 nPort = aProxy.port();
269*b1cdbd2cSJim Jagielski             return css::beans::Optional< css::uno::Any >(
270*b1cdbd2cSJim Jagielski                 true, uno::makeAny( nPort ) );
271*b1cdbd2cSJim Jagielski         }
272*b1cdbd2cSJim Jagielski     } else if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy"))) {
273*b1cdbd2cSJim Jagielski         QString aNoProxyFor;
274*b1cdbd2cSJim Jagielski         switch ( KProtocolManager::proxyType() )
275*b1cdbd2cSJim Jagielski         {
276*b1cdbd2cSJim Jagielski         case KProtocolManager::ManualProxy: // Proxies are manually configured
277*b1cdbd2cSJim Jagielski         case KProtocolManager::PACProxy:    // A proxy configuration URL has been given
278*b1cdbd2cSJim Jagielski         case KProtocolManager::WPADProxy:   // A proxy should be automatically discovered
279*b1cdbd2cSJim Jagielski         case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
280*b1cdbd2cSJim Jagielski             aNoProxyFor = KProtocolManager::noProxyFor();
281*b1cdbd2cSJim Jagielski             break;
282*b1cdbd2cSJim Jagielski         default:                            // No proxy is used
283*b1cdbd2cSJim Jagielski             break;
284*b1cdbd2cSJim Jagielski         }
285*b1cdbd2cSJim Jagielski         if ( !aNoProxyFor.isEmpty() )
286*b1cdbd2cSJim Jagielski         {
287*b1cdbd2cSJim Jagielski             ::rtl::OUString sNoProxyFor;
288*b1cdbd2cSJim Jagielski 
289*b1cdbd2cSJim Jagielski             aNoProxyFor = aNoProxyFor.replace( COMMA, SEMI_COLON );
290*b1cdbd2cSJim Jagielski             sNoProxyFor = (const sal_Unicode *) aNoProxyFor.utf16();
291*b1cdbd2cSJim Jagielski             return css::beans::Optional< css::uno::Any >(
292*b1cdbd2cSJim Jagielski                 true, uno::makeAny( sNoProxyFor ) );
293*b1cdbd2cSJim Jagielski         }
294*b1cdbd2cSJim Jagielski     } else if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetProxyType"))) {
295*b1cdbd2cSJim Jagielski         int nProxyType;
296*b1cdbd2cSJim Jagielski         switch ( KProtocolManager::proxyType() )
297*b1cdbd2cSJim Jagielski         {
298*b1cdbd2cSJim Jagielski         case KProtocolManager::ManualProxy: // Proxies are manually configured
299*b1cdbd2cSJim Jagielski         case KProtocolManager::PACProxy:    // A proxy configuration URL has been given
300*b1cdbd2cSJim Jagielski         case KProtocolManager::WPADProxy:   // A proxy should be automatically discovered
301*b1cdbd2cSJim Jagielski         case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
302*b1cdbd2cSJim Jagielski             nProxyType = 1;
303*b1cdbd2cSJim Jagielski             break;
304*b1cdbd2cSJim Jagielski         default:                            // No proxy is used
305*b1cdbd2cSJim Jagielski             nProxyType = 0;
306*b1cdbd2cSJim Jagielski         }
307*b1cdbd2cSJim Jagielski         return css::beans::Optional< css::uno::Any >(
308*b1cdbd2cSJim Jagielski             true, uno::makeAny( (sal_Int32) nProxyType ) );
309*b1cdbd2cSJim Jagielski     } else {
310*b1cdbd2cSJim Jagielski         OSL_ASSERT(false); // this cannot happen
311*b1cdbd2cSJim Jagielski     }
312*b1cdbd2cSJim Jagielski     return css::beans::Optional< css::uno::Any >();
313*b1cdbd2cSJim Jagielski }
314*b1cdbd2cSJim Jagielski 
315*b1cdbd2cSJim Jagielski }
316