xref: /trunk/main/svtools/inc/svtools/inettbc.hxx (revision 01aa44aa)
1*01aa44aaSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*01aa44aaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*01aa44aaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*01aa44aaSAndrew Rist  * distributed with this work for additional information
6*01aa44aaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*01aa44aaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*01aa44aaSAndrew Rist  * "License"); you may not use this file except in compliance
9*01aa44aaSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*01aa44aaSAndrew Rist  *
11*01aa44aaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*01aa44aaSAndrew Rist  *
13*01aa44aaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*01aa44aaSAndrew Rist  * software distributed under the License is distributed on an
15*01aa44aaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*01aa44aaSAndrew Rist  * KIND, either express or implied.  See the License for the
17*01aa44aaSAndrew Rist  * specific language governing permissions and limitations
18*01aa44aaSAndrew Rist  * under the License.
19*01aa44aaSAndrew Rist  *
20*01aa44aaSAndrew Rist  *************************************************************/
21*01aa44aaSAndrew Rist 
22*01aa44aaSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SVTOOLS_INETTBC_HXX
25cdf0e10cSrcweir #define _SVTOOLS_INETTBC_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // includes *****************************************************************
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "svtools/svtdllapi.h"
30cdf0e10cSrcweir #include <tools/string.hxx>
31cdf0e10cSrcweir #include <tools/urlobj.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #ifndef _COMBOBOX_HXX //autogen
34cdf0e10cSrcweir #include <vcl/combobox.hxx>
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir 
37cdf0e10cSrcweir class IUrlFilter;
38cdf0e10cSrcweir class SvtMatchContext_Impl;
39cdf0e10cSrcweir class SvtURLBox_Impl;
40cdf0e10cSrcweir class SVT_DLLPUBLIC SvtURLBox : public ComboBox
41cdf0e10cSrcweir {
42cdf0e10cSrcweir friend class SvtMatchContext_Impl;
43cdf0e10cSrcweir friend class SvtURLBox_Impl;
44cdf0e10cSrcweir 	Link							aOpenHdl;
45cdf0e10cSrcweir 	String							aBaseURL;
46cdf0e10cSrcweir 	String							aPlaceHolder;
47cdf0e10cSrcweir 	SvtMatchContext_Impl*			pCtx;
48cdf0e10cSrcweir 	SvtURLBox_Impl*					pImp;
49cdf0e10cSrcweir 	INetProtocol					eSmartProtocol;
50cdf0e10cSrcweir     sal_Bool            				bAutoCompleteMode   : 1;
51cdf0e10cSrcweir     sal_Bool							bOnlyDirectories    : 1;
52cdf0e10cSrcweir     sal_Bool							bModified           : 1;
53cdf0e10cSrcweir     sal_Bool                            bTryAutoComplete    : 1;
54cdf0e10cSrcweir     sal_Bool							bCtrlClick          : 1;
55cdf0e10cSrcweir     sal_Bool							bHistoryDisabled    : 1;
56cdf0e10cSrcweir     sal_Bool							bNoSelection        : 1;
57cdf0e10cSrcweir     sal_Bool                            bIsAutoCompleteEnabled : 1;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 	SVT_DLLPRIVATE sal_Bool            				ProcessKey( const KeyCode& rCode );
60cdf0e10cSrcweir 	SVT_DLLPRIVATE void            				TryAutoComplete( sal_Bool bForce );
61cdf0e10cSrcweir     SVT_DLLPRIVATE void                            UpdatePicklistForSmartProtocol_Impl();
62cdf0e10cSrcweir     DECL_DLLPRIVATE_LINK(                      AutoCompleteHdl_Impl, void* );
63cdf0e10cSrcweir     using Window::ImplInit;
64cdf0e10cSrcweir     SVT_DLLPRIVATE void                            ImplInit();
65cdf0e10cSrcweir 
66cdf0e10cSrcweir protected:
67cdf0e10cSrcweir 	virtual long					Notify( NotifyEvent& rNEvt );
68cdf0e10cSrcweir 	virtual void					Select();
69cdf0e10cSrcweir 	virtual void					Modify();
70cdf0e10cSrcweir 	virtual long					PreNotify( NotifyEvent& rNEvt );
71cdf0e10cSrcweir 
72cdf0e10cSrcweir public:
73cdf0e10cSrcweir                                     SvtURLBox( Window* pParent, INetProtocol eSmart = INET_PROT_NOT_VALID );
74cdf0e10cSrcweir                                     SvtURLBox( Window* pParent, WinBits _nStyle, INetProtocol eSmart = INET_PROT_NOT_VALID );
75cdf0e10cSrcweir                                     SvtURLBox( Window* pParent, const ResId& _rResId, INetProtocol eSmart = INET_PROT_NOT_VALID );
76cdf0e10cSrcweir                                     ~SvtURLBox();
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 	void							SetBaseURL( const String& rURL );
GetBaseURL() const79cdf0e10cSrcweir 	const String&					GetBaseURL() const { return aBaseURL; }
SetOpenHdl(const Link & rLink)80cdf0e10cSrcweir 	void							SetOpenHdl( const Link& rLink ) { aOpenHdl = rLink; }
GetOpenHdl() const81cdf0e10cSrcweir 	const Link& 					GetOpenHdl() const { return aOpenHdl; }
82cdf0e10cSrcweir 	void							SetOnlyDirectories( sal_Bool bDir = sal_True );
83cdf0e10cSrcweir 	void							SetNoURLSelection( sal_Bool bSet = sal_True );
GetSmartProtocol() const84cdf0e10cSrcweir 	INetProtocol					GetSmartProtocol() const { return eSmartProtocol; }
85cdf0e10cSrcweir     void                            SetSmartProtocol( INetProtocol eProt );
IsCtrlOpen()86cdf0e10cSrcweir     sal_Bool                            IsCtrlOpen()
87cdf0e10cSrcweir                                         { return bCtrlClick; }
88cdf0e10cSrcweir     String                          GetURL();
89cdf0e10cSrcweir 	void							DisableHistory();
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	void							UpdatePickList( );
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     static String                   ParseSmart( String aText, String aBaseURL, String aWorkDir );
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	void							SetFilter(const String& _sFilter);
96cdf0e10cSrcweir     void                            SetUrlFilter( const IUrlFilter* _pFilter );
97cdf0e10cSrcweir     const IUrlFilter*               GetUrlFilter( ) const;
98cdf0e10cSrcweir 
EnableAutocompletion(sal_Bool _bEnable=sal_True)99cdf0e10cSrcweir     inline void                     EnableAutocompletion( sal_Bool _bEnable = sal_True )
100cdf0e10cSrcweir                                         { bIsAutoCompleteEnabled = _bEnable; }
SetPlaceHolder(const String & sPlaceHolder)101cdf0e10cSrcweir     void SetPlaceHolder( const String& sPlaceHolder ) { aPlaceHolder = sPlaceHolder; }
GetPlaceHolder()102cdf0e10cSrcweir     String GetPlaceHolder() { return aPlaceHolder; }
MatchesPlaceHolder(const String & sToMatch)103cdf0e10cSrcweir     bool MatchesPlaceHolder( const String& sToMatch ) { return ( ( aPlaceHolder.Len() > 0 ) && ( aPlaceHolder == sToMatch ) ); }
104cdf0e10cSrcweir };
105cdf0e10cSrcweir 
106cdf0e10cSrcweir #endif
107cdf0e10cSrcweir 
108