1*f8e2c85aSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f8e2c85aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f8e2c85aSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f8e2c85aSAndrew Rist * distributed with this work for additional information 6*f8e2c85aSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f8e2c85aSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f8e2c85aSAndrew Rist * "License"); you may not use this file except in compliance 9*f8e2c85aSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*f8e2c85aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*f8e2c85aSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f8e2c85aSAndrew Rist * software distributed under the License is distributed on an 15*f8e2c85aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f8e2c85aSAndrew Rist * KIND, either express or implied. See the License for the 17*f8e2c85aSAndrew Rist * specific language governing permissions and limitations 18*f8e2c85aSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*f8e2c85aSAndrew Rist *************************************************************/ 21*f8e2c85aSAndrew Rist 22*f8e2c85aSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_shell.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir // For MAXHOSTNAMELEN constant 28cdf0e10cSrcweir #include <sys/param.h> 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <premac.h> 31cdf0e10cSrcweir #include <SystemConfiguration/SystemConfiguration.h> 32cdf0e10cSrcweir #include <Foundation/NSPathUtilities.h> 33cdf0e10cSrcweir #include <postmac.h> 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include "macbackend.hxx" 36cdf0e10cSrcweir 37cdf0e10cSrcweir #include "com/sun/star/beans/Optional.hpp" 38cdf0e10cSrcweir #include "rtl/ustrbuf.hxx" 39cdf0e10cSrcweir #include "osl/file.h" 40cdf0e10cSrcweir 41cdf0e10cSrcweir #define SPACE ' ' 42cdf0e10cSrcweir #define SEMI_COLON ';' 43cdf0e10cSrcweir 44cdf0e10cSrcweir typedef struct 45cdf0e10cSrcweir { 46cdf0e10cSrcweir rtl::OUString Server; 47cdf0e10cSrcweir sal_Int32 Port; 48cdf0e10cSrcweir } ProxyEntry; 49cdf0e10cSrcweir 50cdf0e10cSrcweir typedef enum { 51cdf0e10cSrcweir sHTTP, 52cdf0e10cSrcweir sHTTPS, 53cdf0e10cSrcweir sFTP 54cdf0e10cSrcweir } ServiceType; 55cdf0e10cSrcweir 56cdf0e10cSrcweir //------------------------------------------------------------------------ 57cdf0e10cSrcweir // helper functions 58cdf0e10cSrcweir //------------------------------------------------------------------------ 59cdf0e10cSrcweir 60cdf0e10cSrcweir namespace // private 61cdf0e10cSrcweir { 62cdf0e10cSrcweir 63cdf0e10cSrcweir /* 64cdf0e10cSrcweir * Returns current proxy settings for selected service type (HTTP or 65cdf0e10cSrcweir * FTP) as a C string (in the buffer specified by host and hostSize) 66cdf0e10cSrcweir * and a port number. 67cdf0e10cSrcweir */ 68cdf0e10cSrcweir 69cdf0e10cSrcweir bool GetProxySetting(ServiceType sType, char *host, size_t hostSize, UInt16 *port) 70cdf0e10cSrcweir { 71cdf0e10cSrcweir bool result; 72cdf0e10cSrcweir CFDictionaryRef proxyDict; 73cdf0e10cSrcweir CFNumberRef enableNum; 74cdf0e10cSrcweir int enable; 75cdf0e10cSrcweir CFStringRef hostStr; 76cdf0e10cSrcweir CFNumberRef portNum; 77cdf0e10cSrcweir int portInt; 78cdf0e10cSrcweir 79cdf0e10cSrcweir proxyDict = SCDynamicStoreCopyProxies(NULL); 80cdf0e10cSrcweir 81cdf0e10cSrcweir if (!proxyDict) 82cdf0e10cSrcweir return false; 83cdf0e10cSrcweir 84cdf0e10cSrcweir CFStringRef proxiesEnable; 85cdf0e10cSrcweir CFStringRef proxiesProxy; 86cdf0e10cSrcweir CFStringRef proxiesPort; 87cdf0e10cSrcweir 88cdf0e10cSrcweir switch ( sType ) 89cdf0e10cSrcweir { 90cdf0e10cSrcweir case sHTTP : proxiesEnable = kSCPropNetProxiesHTTPEnable; 91cdf0e10cSrcweir proxiesProxy = kSCPropNetProxiesHTTPProxy; 92cdf0e10cSrcweir proxiesPort = kSCPropNetProxiesHTTPPort; 93cdf0e10cSrcweir break; 94cdf0e10cSrcweir case sHTTPS: proxiesEnable = kSCPropNetProxiesHTTPSEnable; 95cdf0e10cSrcweir proxiesProxy = kSCPropNetProxiesHTTPSProxy; 96cdf0e10cSrcweir proxiesPort = kSCPropNetProxiesHTTPSPort; 97cdf0e10cSrcweir break; 98cdf0e10cSrcweir default: proxiesEnable = kSCPropNetProxiesFTPEnable; 99cdf0e10cSrcweir proxiesProxy = kSCPropNetProxiesFTPProxy; 100cdf0e10cSrcweir proxiesPort = kSCPropNetProxiesFTPPort; 101cdf0e10cSrcweir break; 102cdf0e10cSrcweir } 103cdf0e10cSrcweir // Proxy enabled? 104cdf0e10cSrcweir enableNum = (CFNumberRef) CFDictionaryGetValue( proxyDict, 105cdf0e10cSrcweir proxiesEnable ); 106cdf0e10cSrcweir 107cdf0e10cSrcweir result = (enableNum != NULL) && (CFGetTypeID(enableNum) == CFNumberGetTypeID()); 108cdf0e10cSrcweir 109cdf0e10cSrcweir if (result) 110cdf0e10cSrcweir result = CFNumberGetValue(enableNum, kCFNumberIntType, &enable) && (enable != 0); 111cdf0e10cSrcweir 112cdf0e10cSrcweir // Proxy enabled -> get hostname 113cdf0e10cSrcweir if (result) 114cdf0e10cSrcweir { 115cdf0e10cSrcweir hostStr = (CFStringRef) CFDictionaryGetValue( proxyDict, 116cdf0e10cSrcweir proxiesProxy ); 117cdf0e10cSrcweir 118cdf0e10cSrcweir result = (hostStr != NULL) && (CFGetTypeID(hostStr) == CFStringGetTypeID()); 119cdf0e10cSrcweir } 120cdf0e10cSrcweir 121cdf0e10cSrcweir if (result) 122cdf0e10cSrcweir result = CFStringGetCString(hostStr, host, (CFIndex) hostSize, kCFStringEncodingASCII); 123cdf0e10cSrcweir 124cdf0e10cSrcweir // Get proxy port 125cdf0e10cSrcweir if (result) 126cdf0e10cSrcweir { 127cdf0e10cSrcweir portNum = (CFNumberRef) CFDictionaryGetValue( proxyDict, 128cdf0e10cSrcweir proxiesPort ); 129cdf0e10cSrcweir 130cdf0e10cSrcweir result = (portNum != NULL) && (CFGetTypeID(portNum) == CFNumberGetTypeID()); 131cdf0e10cSrcweir } 132cdf0e10cSrcweir else 133cdf0e10cSrcweir { 134cdf0e10cSrcweir CFRelease(proxyDict); 135cdf0e10cSrcweir return false; 136cdf0e10cSrcweir } 137cdf0e10cSrcweir 138cdf0e10cSrcweir if (result) 139cdf0e10cSrcweir result = CFNumberGetValue(portNum, kCFNumberIntType, &portInt); 140cdf0e10cSrcweir 141cdf0e10cSrcweir if (result) 142cdf0e10cSrcweir *port = (UInt16) portInt; 143cdf0e10cSrcweir 144cdf0e10cSrcweir if (proxyDict) 145cdf0e10cSrcweir CFRelease(proxyDict); 146cdf0e10cSrcweir 147cdf0e10cSrcweir if (!result) 148cdf0e10cSrcweir { 149cdf0e10cSrcweir *host = 0; 150cdf0e10cSrcweir *port = 0; 151cdf0e10cSrcweir } 152cdf0e10cSrcweir 153cdf0e10cSrcweir return result; 154cdf0e10cSrcweir } 155cdf0e10cSrcweir 156cdf0e10cSrcweir } // end private namespace 157cdf0e10cSrcweir 158cdf0e10cSrcweir //------------------------------------------------------------------------------ 159cdf0e10cSrcweir 160cdf0e10cSrcweir MacOSXBackend::MacOSXBackend() 161cdf0e10cSrcweir { 162cdf0e10cSrcweir } 163cdf0e10cSrcweir 164cdf0e10cSrcweir //------------------------------------------------------------------------------ 165cdf0e10cSrcweir 166cdf0e10cSrcweir MacOSXBackend::~MacOSXBackend(void) 167cdf0e10cSrcweir { 168cdf0e10cSrcweir } 169cdf0e10cSrcweir 170cdf0e10cSrcweir //------------------------------------------------------------------------------ 171cdf0e10cSrcweir 172cdf0e10cSrcweir MacOSXBackend* MacOSXBackend::createInstance() 173cdf0e10cSrcweir { 174cdf0e10cSrcweir return new MacOSXBackend; 175cdf0e10cSrcweir } 176cdf0e10cSrcweir 177cdf0e10cSrcweir // --------------------------------------------------------------------------------------- 178cdf0e10cSrcweir 179cdf0e10cSrcweir rtl::OUString CFStringToOUString(const CFStringRef sOrig) { 180cdf0e10cSrcweir CFRetain(sOrig); 181cdf0e10cSrcweir 182cdf0e10cSrcweir CFIndex nStringLen = CFStringGetLength(sOrig)+1; 183cdf0e10cSrcweir 184cdf0e10cSrcweir // Allocate a c string buffer 185cdf0e10cSrcweir char sBuffer[nStringLen]; 186cdf0e10cSrcweir 187cdf0e10cSrcweir CFStringGetCString(sOrig, sBuffer, nStringLen, kCFStringEncodingASCII); 188cdf0e10cSrcweir 189cdf0e10cSrcweir CFRelease(sOrig); 190cdf0e10cSrcweir 191cdf0e10cSrcweir return rtl::OUString::createFromAscii((sal_Char*)sBuffer); 192cdf0e10cSrcweir } 193cdf0e10cSrcweir 194cdf0e10cSrcweir rtl::OUString GetOUString( NSString* pStr ) 195cdf0e10cSrcweir { 196cdf0e10cSrcweir if( ! pStr ) 197cdf0e10cSrcweir return rtl::OUString(); 198cdf0e10cSrcweir int nLen = [pStr length]; 199cdf0e10cSrcweir if( nLen == 0 ) 200cdf0e10cSrcweir return rtl::OUString(); 201cdf0e10cSrcweir 202cdf0e10cSrcweir rtl::OUStringBuffer aBuf( nLen+1 ); 203cdf0e10cSrcweir aBuf.setLength( nLen ); 204cdf0e10cSrcweir [pStr getCharacters: const_cast<sal_Unicode*>(aBuf.getStr())]; 205cdf0e10cSrcweir return aBuf.makeStringAndClear(); 206cdf0e10cSrcweir } 207cdf0e10cSrcweir 208cdf0e10cSrcweir void MacOSXBackend::setPropertyValue( 209cdf0e10cSrcweir rtl::OUString const &, css::uno::Any const &) 210cdf0e10cSrcweir throw ( 211cdf0e10cSrcweir css::beans::UnknownPropertyException, css::beans::PropertyVetoException, 212cdf0e10cSrcweir css::lang::IllegalArgumentException, css::lang::WrappedTargetException, 213cdf0e10cSrcweir css::uno::RuntimeException) 214cdf0e10cSrcweir { 215cdf0e10cSrcweir throw css::lang::IllegalArgumentException( 216cdf0e10cSrcweir rtl::OUString( 217cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")), 218cdf0e10cSrcweir static_cast< cppu::OWeakObject * >(this), -1); 219cdf0e10cSrcweir } 220cdf0e10cSrcweir 221cdf0e10cSrcweir css::uno::Any MacOSXBackend::getPropertyValue( 222cdf0e10cSrcweir rtl::OUString const & PropertyName) 223cdf0e10cSrcweir throw ( 224cdf0e10cSrcweir css::beans::UnknownPropertyException, css::lang::WrappedTargetException, 225cdf0e10cSrcweir css::uno::RuntimeException) 226cdf0e10cSrcweir { 227cdf0e10cSrcweir if (PropertyName.equalsAsciiL( 228cdf0e10cSrcweir RTL_CONSTASCII_STRINGPARAM("WorkPathVariable"))) 229cdf0e10cSrcweir { 230cdf0e10cSrcweir rtl::OUString aDocDir; 231cdf0e10cSrcweir NSArray* pPaths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, true ); 232cdf0e10cSrcweir if( pPaths && [pPaths count] > 0 ) 233cdf0e10cSrcweir { 234cdf0e10cSrcweir aDocDir = GetOUString( [pPaths objectAtIndex: 0] ); 235cdf0e10cSrcweir 236cdf0e10cSrcweir rtl::OUString aDocURL; 237cdf0e10cSrcweir if( aDocDir.getLength() > 0 && 238cdf0e10cSrcweir osl_getFileURLFromSystemPath( aDocDir.pData, &aDocURL.pData ) == osl_File_E_None ) 239cdf0e10cSrcweir { 240cdf0e10cSrcweir return css::uno::makeAny( 241cdf0e10cSrcweir css::beans::Optional< css::uno::Any >( 242cdf0e10cSrcweir true, css::uno::makeAny( aDocURL ) ) ); 243cdf0e10cSrcweir } 244cdf0e10cSrcweir else 245cdf0e10cSrcweir { 246cdf0e10cSrcweir OSL_TRACE( "user documents list contains empty file path or conversion failed" ); 247cdf0e10cSrcweir } 248cdf0e10cSrcweir } 249cdf0e10cSrcweir else 250cdf0e10cSrcweir { 251cdf0e10cSrcweir OSL_TRACE( "Got nil or empty list of user document directories" ); 252cdf0e10cSrcweir } 253cdf0e10cSrcweir return css::uno::makeAny(css::beans::Optional< css::uno::Any >()); 254cdf0e10cSrcweir } else if (PropertyName.equalsAsciiL( 255cdf0e10cSrcweir RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName"))) 256cdf0e10cSrcweir { 257cdf0e10cSrcweir ProxyEntry aFtpProxy; 258cdf0e10cSrcweir 259cdf0e10cSrcweir char host[MAXHOSTNAMELEN]; 260cdf0e10cSrcweir UInt16 port; 261cdf0e10cSrcweir bool retVal; 262cdf0e10cSrcweir 263cdf0e10cSrcweir retVal = GetProxySetting(sFTP, host, 100, &port); 264cdf0e10cSrcweir 265cdf0e10cSrcweir if (retVal) 266cdf0e10cSrcweir { 267cdf0e10cSrcweir aFtpProxy.Server = rtl::OUString::createFromAscii( host ); 268cdf0e10cSrcweir } 269cdf0e10cSrcweir 270cdf0e10cSrcweir // ftp proxy name 271cdf0e10cSrcweir if( aFtpProxy.Server.getLength() > 0 ) 272cdf0e10cSrcweir { 273cdf0e10cSrcweir return css::uno::makeAny( 274cdf0e10cSrcweir css::beans::Optional< css::uno::Any >( 275cdf0e10cSrcweir true, uno::makeAny( aFtpProxy.Server ) ) ); 276cdf0e10cSrcweir } 277cdf0e10cSrcweir return css::uno::makeAny(css::beans::Optional< css::uno::Any >()); 278cdf0e10cSrcweir } else if (PropertyName.equalsAsciiL( 279cdf0e10cSrcweir RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort"))) 280cdf0e10cSrcweir { 281cdf0e10cSrcweir ProxyEntry aFtpProxy; 282cdf0e10cSrcweir 283cdf0e10cSrcweir char host[MAXHOSTNAMELEN]; 284cdf0e10cSrcweir UInt16 port; 285cdf0e10cSrcweir bool retVal; 286cdf0e10cSrcweir 287cdf0e10cSrcweir retVal = GetProxySetting(sFTP, host, 100, &port); 288cdf0e10cSrcweir 289cdf0e10cSrcweir if (retVal) 290cdf0e10cSrcweir { 291cdf0e10cSrcweir aFtpProxy.Port = port; 292cdf0e10cSrcweir } 293cdf0e10cSrcweir 294cdf0e10cSrcweir // ftp proxy port 295cdf0e10cSrcweir if( aFtpProxy.Port > 0 ) 296cdf0e10cSrcweir { 297cdf0e10cSrcweir return css::uno::makeAny( 298cdf0e10cSrcweir css::beans::Optional< css::uno::Any >( 299cdf0e10cSrcweir true, uno::makeAny( aFtpProxy.Port ) ) ); 300cdf0e10cSrcweir } 301cdf0e10cSrcweir return css::uno::makeAny(css::beans::Optional< css::uno::Any >()); 302cdf0e10cSrcweir } else if (PropertyName.equalsAsciiL( 303cdf0e10cSrcweir RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName"))) 304cdf0e10cSrcweir { 305cdf0e10cSrcweir ProxyEntry aHttpProxy; 306cdf0e10cSrcweir 307cdf0e10cSrcweir char host[MAXHOSTNAMELEN]; 308cdf0e10cSrcweir UInt16 port; 309cdf0e10cSrcweir bool retVal; 310cdf0e10cSrcweir 311cdf0e10cSrcweir retVal = GetProxySetting(sHTTP, host, 100, &port); 312cdf0e10cSrcweir 313cdf0e10cSrcweir if (retVal) 314cdf0e10cSrcweir { 315cdf0e10cSrcweir aHttpProxy.Server = rtl::OUString::createFromAscii( host ); 316cdf0e10cSrcweir } 317cdf0e10cSrcweir 318cdf0e10cSrcweir // http proxy name 319cdf0e10cSrcweir if( aHttpProxy.Server.getLength() > 0 ) 320cdf0e10cSrcweir { 321cdf0e10cSrcweir return css::uno::makeAny( 322cdf0e10cSrcweir css::beans::Optional< css::uno::Any >( 323cdf0e10cSrcweir true, uno::makeAny( aHttpProxy.Server ) ) ); 324cdf0e10cSrcweir } 325cdf0e10cSrcweir return css::uno::makeAny(css::beans::Optional< css::uno::Any >()); 326cdf0e10cSrcweir } else if (PropertyName.equalsAsciiL( 327cdf0e10cSrcweir RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort"))) 328cdf0e10cSrcweir { 329cdf0e10cSrcweir ProxyEntry aHttpProxy; 330cdf0e10cSrcweir 331cdf0e10cSrcweir char host[MAXHOSTNAMELEN]; 332cdf0e10cSrcweir UInt16 port; 333cdf0e10cSrcweir bool retVal; 334cdf0e10cSrcweir 335cdf0e10cSrcweir retVal = GetProxySetting(sHTTP, host, 100, &port); 336cdf0e10cSrcweir 337cdf0e10cSrcweir if (retVal) 338cdf0e10cSrcweir { 339cdf0e10cSrcweir aHttpProxy.Port = port; 340cdf0e10cSrcweir } 341cdf0e10cSrcweir 342cdf0e10cSrcweir // http proxy port 343cdf0e10cSrcweir if( aHttpProxy.Port > 0 ) 344cdf0e10cSrcweir { 345cdf0e10cSrcweir return css::uno::makeAny( 346cdf0e10cSrcweir css::beans::Optional< css::uno::Any >( 347cdf0e10cSrcweir true, uno::makeAny( aHttpProxy.Port ) ) ); 348cdf0e10cSrcweir } 349cdf0e10cSrcweir return css::uno::makeAny(css::beans::Optional< css::uno::Any >()); 350cdf0e10cSrcweir } else if (PropertyName.equalsAsciiL( 351cdf0e10cSrcweir RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName"))) 352cdf0e10cSrcweir { 353cdf0e10cSrcweir ProxyEntry aHttpsProxy; 354cdf0e10cSrcweir 355cdf0e10cSrcweir char host[MAXHOSTNAMELEN]; 356cdf0e10cSrcweir UInt16 port; 357cdf0e10cSrcweir bool retVal; 358cdf0e10cSrcweir 359cdf0e10cSrcweir retVal = GetProxySetting(sHTTPS, host, 100, &port); 360cdf0e10cSrcweir 361cdf0e10cSrcweir if (retVal) 362cdf0e10cSrcweir { 363cdf0e10cSrcweir aHttpsProxy.Server = rtl::OUString::createFromAscii( host ); 364cdf0e10cSrcweir } 365cdf0e10cSrcweir 366cdf0e10cSrcweir // https proxy name 367cdf0e10cSrcweir if( aHttpsProxy.Server.getLength() > 0 ) 368cdf0e10cSrcweir { 369cdf0e10cSrcweir return css::uno::makeAny( 370cdf0e10cSrcweir css::beans::Optional< css::uno::Any >( 371cdf0e10cSrcweir true, uno::makeAny( aHttpsProxy.Server ) ) ); 372cdf0e10cSrcweir } 373cdf0e10cSrcweir return css::uno::makeAny(css::beans::Optional< css::uno::Any >()); 374cdf0e10cSrcweir } else if (PropertyName.equalsAsciiL( 375cdf0e10cSrcweir RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort"))) 376cdf0e10cSrcweir { 377cdf0e10cSrcweir ProxyEntry aHttpsProxy; 378cdf0e10cSrcweir 379cdf0e10cSrcweir char host[MAXHOSTNAMELEN]; 380cdf0e10cSrcweir UInt16 port; 381cdf0e10cSrcweir bool retVal; 382cdf0e10cSrcweir 383cdf0e10cSrcweir retVal = GetProxySetting(sHTTPS, host, 100, &port); 384cdf0e10cSrcweir 385cdf0e10cSrcweir if (retVal) 386cdf0e10cSrcweir { 387cdf0e10cSrcweir aHttpsProxy.Port = port; 388cdf0e10cSrcweir } 389cdf0e10cSrcweir 390cdf0e10cSrcweir // https proxy port 391cdf0e10cSrcweir if( aHttpsProxy.Port > 0 ) 392cdf0e10cSrcweir { 393cdf0e10cSrcweir return css::uno::makeAny( 394cdf0e10cSrcweir css::beans::Optional< css::uno::Any >( 395cdf0e10cSrcweir true, uno::makeAny( aHttpsProxy.Port ) ) ); 396cdf0e10cSrcweir } 397cdf0e10cSrcweir return css::uno::makeAny(css::beans::Optional< css::uno::Any >()); 398cdf0e10cSrcweir } else if (PropertyName.equalsAsciiL( 399cdf0e10cSrcweir RTL_CONSTASCII_STRINGPARAM("ooInetProxyType"))) 400cdf0e10cSrcweir { 401cdf0e10cSrcweir // override default for ProxyType, which is "0" meaning "No proxies". 402cdf0e10cSrcweir sal_Int32 nProperties = 1; 403cdf0e10cSrcweir return css::uno::makeAny( 404cdf0e10cSrcweir css::beans::Optional< css::uno::Any >( 405cdf0e10cSrcweir true, uno::makeAny( nProperties ) ) ); 406cdf0e10cSrcweir } else if (PropertyName.equalsAsciiL( 407cdf0e10cSrcweir RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy"))) 408cdf0e10cSrcweir { 409cdf0e10cSrcweir rtl::OUString aProxyBypassList; 410cdf0e10cSrcweir 411cdf0e10cSrcweir CFArrayRef rExceptionsList; 412cdf0e10cSrcweir CFDictionaryRef rProxyDict = SCDynamicStoreCopyProxies(NULL); 413cdf0e10cSrcweir 414cdf0e10cSrcweir if (!rProxyDict) 415cdf0e10cSrcweir rExceptionsList = false; 416cdf0e10cSrcweir else 417cdf0e10cSrcweir rExceptionsList = (CFArrayRef) CFDictionaryGetValue(rProxyDict, kSCPropNetProxiesExceptionsList); 418cdf0e10cSrcweir 419cdf0e10cSrcweir if (rExceptionsList) 420cdf0e10cSrcweir { 421cdf0e10cSrcweir for (CFIndex idx = 0; idx < CFArrayGetCount(rExceptionsList); idx++) 422cdf0e10cSrcweir { 423cdf0e10cSrcweir CFStringRef rException = (CFStringRef) CFArrayGetValueAtIndex(rExceptionsList, idx); 424cdf0e10cSrcweir 425cdf0e10cSrcweir if (idx>0) 426cdf0e10cSrcweir aProxyBypassList += rtl::OUString::createFromAscii( ";" ); 427cdf0e10cSrcweir 428cdf0e10cSrcweir aProxyBypassList += CFStringToOUString(rException); 429cdf0e10cSrcweir } 430cdf0e10cSrcweir } 431cdf0e10cSrcweir 432cdf0e10cSrcweir if (rProxyDict) 433cdf0e10cSrcweir CFRelease(rProxyDict); 434cdf0e10cSrcweir 435cdf0e10cSrcweir // fill proxy bypass list 436cdf0e10cSrcweir if( aProxyBypassList.getLength() > 0 ) 437cdf0e10cSrcweir { 438cdf0e10cSrcweir return css::uno::makeAny( 439cdf0e10cSrcweir css::beans::Optional< css::uno::Any >( 440cdf0e10cSrcweir true, 441cdf0e10cSrcweir uno::makeAny( aProxyBypassList.replace( SPACE, SEMI_COLON ) ) ) ); 442cdf0e10cSrcweir } 443cdf0e10cSrcweir return css::uno::makeAny(css::beans::Optional< css::uno::Any >()); 444cdf0e10cSrcweir } else { 445cdf0e10cSrcweir throw css::beans::UnknownPropertyException( 446cdf0e10cSrcweir PropertyName, static_cast< cppu::OWeakObject * >(this)); 447cdf0e10cSrcweir } 448cdf0e10cSrcweir } 449cdf0e10cSrcweir 450cdf0e10cSrcweir //------------------------------------------------------------------------------ 451cdf0e10cSrcweir 452cdf0e10cSrcweir rtl::OUString SAL_CALL MacOSXBackend::getBackendName(void) 453cdf0e10cSrcweir { 454cdf0e10cSrcweir return rtl::OUString::createFromAscii("com.sun.star.comp.configuration.backend.MacOSXBackend"); 455cdf0e10cSrcweir } 456cdf0e10cSrcweir 457cdf0e10cSrcweir //------------------------------------------------------------------------------ 458cdf0e10cSrcweir 459cdf0e10cSrcweir rtl::OUString SAL_CALL MacOSXBackend::getImplementationName(void) 460cdf0e10cSrcweir throw (uno::RuntimeException) 461cdf0e10cSrcweir { 462cdf0e10cSrcweir return getBackendName(); 463cdf0e10cSrcweir } 464cdf0e10cSrcweir 465cdf0e10cSrcweir //------------------------------------------------------------------------------ 466cdf0e10cSrcweir 467cdf0e10cSrcweir uno::Sequence<rtl::OUString> SAL_CALL MacOSXBackend::getBackendServiceNames(void) 468cdf0e10cSrcweir { 469cdf0e10cSrcweir uno::Sequence<rtl::OUString> aServiceNameList(1); 470cdf0e10cSrcweir aServiceNameList[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.MacOSXBackend")); 471cdf0e10cSrcweir 472cdf0e10cSrcweir return aServiceNameList; 473cdf0e10cSrcweir } 474cdf0e10cSrcweir 475cdf0e10cSrcweir //------------------------------------------------------------------------------ 476cdf0e10cSrcweir 477cdf0e10cSrcweir sal_Bool SAL_CALL MacOSXBackend::supportsService(const rtl::OUString& aServiceName) 478cdf0e10cSrcweir throw (uno::RuntimeException) 479cdf0e10cSrcweir { 480cdf0e10cSrcweir uno::Sequence< rtl::OUString > const svc = getBackendServiceNames(); 481cdf0e10cSrcweir 482cdf0e10cSrcweir for(sal_Int32 i = 0; i < svc.getLength(); ++i ) 483cdf0e10cSrcweir if(svc[i] == aServiceName) 484cdf0e10cSrcweir return true; 485cdf0e10cSrcweir 486cdf0e10cSrcweir return false; 487cdf0e10cSrcweir } 488cdf0e10cSrcweir 489cdf0e10cSrcweir //------------------------------------------------------------------------------ 490cdf0e10cSrcweir 491cdf0e10cSrcweir uno::Sequence<rtl::OUString> SAL_CALL MacOSXBackend::getSupportedServiceNames(void) 492cdf0e10cSrcweir throw (uno::RuntimeException) 493cdf0e10cSrcweir { 494cdf0e10cSrcweir return getBackendServiceNames(); 495cdf0e10cSrcweir } 496