1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _unotools_INETOPTIONS_HXX_ 25 #define _unotools_INETOPTIONS_HXX_ 26 27 #include "unotools/unotoolsdllapi.h" 28 #include <com/sun/star/uno/Reference.hxx> 29 #include <com/sun/star/uno/Sequence.hxx> 30 #include <sal/types.h> 31 #include <unotools/options.hxx> 32 33 namespace com { namespace sun { namespace star { namespace beans { 34 class XPropertiesChangeListener; 35 } } } } 36 namespace rtl { class OUString; } 37 38 //============================================================================ 39 /** The names of all the properties (options) accessible through 40 SvtInetOptions. 41 42 @descr These names are used in the methods 43 SvtInetOptions::addPropertiesChangeListener() and 44 SvtInetOptions::removePropertiesChangeListener(). 45 */ 46 #define SVT_INET_OPTION_PROXY_NO_PROXY "Inet/Proxy/NoProxy" 47 #define SVT_INET_OPTION_PROXY_TYPE "Inet/Proxy/Type" 48 #define SVT_INET_OPTION_PROXY_FTP_NAME "Inet/Proxy/FTP/Name" 49 #define SVT_INET_OPTION_PROXY_FTP_PORT "Inet/Proxy/FTP/Port" 50 #define SVT_INET_OPTION_PROXY_HTTP_NAME "Inet/Proxy/HTTP/Name" 51 #define SVT_INET_OPTION_PROXY_HTTP_PORT "Inet/Proxy/HTTP/Port" 52 53 //============================================================================ 54 /** Interface to access those configuration database entries that are related 55 to the various Internet services. 56 57 @descr The Set...() methods all have a second parameter bFlush. If false 58 is passed (the default), the new value is not written back directly, but 59 only cached within this class. If the value in the configuration database 60 is also changed, the cached change will get lost. If, on the other hand, 61 true is passed, the new value is instantly written back to the 62 configuration database. 63 */ 64 class UNOTOOLS_DLLPUBLIC SvtInetOptions: public utl::detail::Options 65 { 66 public: 67 SvtInetOptions(); 68 69 virtual ~SvtInetOptions(); 70 71 enum ProxyType { NONE, AUTOMATIC, MANUAL }; 72 73 rtl::OUString GetProxyNoProxy() const; 74 75 sal_Int32 GetProxyType() const; 76 77 rtl::OUString GetProxyFtpName() const; 78 79 sal_Int32 GetProxyFtpPort() const; 80 81 rtl::OUString GetProxyHttpName() const; 82 83 sal_Int32 GetProxyHttpPort() const; 84 85 void SetProxyNoProxy(rtl::OUString const & rValue, bool bFlush = false); 86 87 void SetProxyType(ProxyType eValue, bool bFlush = false); 88 89 void SetProxyFtpName(rtl::OUString const & rValue, bool bFlush = false); 90 91 void SetProxyFtpPort(sal_Int32 nValue, bool bFlush = false); 92 93 void SetProxyHttpName(rtl::OUString const & rValue, bool bFlush = false); 94 95 void SetProxyHttpPort(sal_Int32 nValue, bool bFlush = false); 96 97 void flush(); 98 99 /** Add a listener on changes of certain properties (options). 100 101 @param rPropertyNames The names of the properties (options). If an 102 empty sequence is used, nothing is done. 103 104 @param rListener A listener. If the listener is already registered 105 on other properties, it continues to also get notifications about 106 changes of those properties. The 107 com::sun::star::beans::PropertyChangeEvents supplied to the listener 108 will have void OldValue and NewValue slots. 109 */ 110 void 111 addPropertiesChangeListener( 112 com::sun::star::uno::Sequence< rtl::OUString > const & rPropertyNames, 113 com::sun::star::uno::Reference< 114 com::sun::star::beans::XPropertiesChangeListener > const & 115 rListener); 116 117 /** Remove a listener on changes of certain properties (options). 118 119 @param rPropertyNames The names of the properties (options). If an 120 empty sequence is used, nothing is done. 121 122 @param rListener A listener. If the listener is still registered on 123 other properties, it continues to get notifications about changes of 124 those properties. 125 */ 126 void 127 removePropertiesChangeListener( 128 com::sun::star::uno::Sequence< rtl::OUString > const & rPropertyNames, 129 com::sun::star::uno::Reference< 130 com::sun::star::beans::XPropertiesChangeListener > const & 131 rListener); 132 133 private: 134 class Impl; 135 136 static Impl * m_pImpl; 137 }; 138 139 #endif // _unotools_INETOPTIONS_HXX_ 140