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 _SVTOOLS_INETTBC_HXX 25 #define _SVTOOLS_INETTBC_HXX 26 27 // includes ***************************************************************** 28 29 #include "svtools/svtdllapi.h" 30 #include <tools/string.hxx> 31 #include <tools/urlobj.hxx> 32 33 #ifndef _COMBOBOX_HXX //autogen 34 #include <vcl/combobox.hxx> 35 #endif 36 37 class IUrlFilter; 38 class SvtMatchContext_Impl; 39 class SvtURLBox_Impl; 40 class SVT_DLLPUBLIC SvtURLBox : public ComboBox 41 { 42 friend class SvtMatchContext_Impl; 43 friend class SvtURLBox_Impl; 44 Link aOpenHdl; 45 String aBaseURL; 46 String aPlaceHolder; 47 SvtMatchContext_Impl* pCtx; 48 SvtURLBox_Impl* pImp; 49 INetProtocol eSmartProtocol; 50 sal_Bool bAutoCompleteMode : 1; 51 sal_Bool bOnlyDirectories : 1; 52 sal_Bool bModified : 1; 53 sal_Bool bTryAutoComplete : 1; 54 sal_Bool bCtrlClick : 1; 55 sal_Bool bHistoryDisabled : 1; 56 sal_Bool bNoSelection : 1; 57 sal_Bool bIsAutoCompleteEnabled : 1; 58 59 SVT_DLLPRIVATE sal_Bool ProcessKey( const KeyCode& rCode ); 60 SVT_DLLPRIVATE void TryAutoComplete( sal_Bool bForce ); 61 SVT_DLLPRIVATE void UpdatePicklistForSmartProtocol_Impl(); 62 DECL_DLLPRIVATE_LINK( AutoCompleteHdl_Impl, void* ); 63 using Window::ImplInit; 64 SVT_DLLPRIVATE void ImplInit(); 65 66 protected: 67 virtual long Notify( NotifyEvent& rNEvt ); 68 virtual void Select(); 69 virtual void Modify(); 70 virtual long PreNotify( NotifyEvent& rNEvt ); 71 72 public: 73 SvtURLBox( Window* pParent, INetProtocol eSmart = INET_PROT_NOT_VALID ); 74 SvtURLBox( Window* pParent, WinBits _nStyle, INetProtocol eSmart = INET_PROT_NOT_VALID ); 75 SvtURLBox( Window* pParent, const ResId& _rResId, INetProtocol eSmart = INET_PROT_NOT_VALID ); 76 ~SvtURLBox(); 77 78 void SetBaseURL( const String& rURL ); GetBaseURL() const79 const String& GetBaseURL() const { return aBaseURL; } SetOpenHdl(const Link & rLink)80 void SetOpenHdl( const Link& rLink ) { aOpenHdl = rLink; } GetOpenHdl() const81 const Link& GetOpenHdl() const { return aOpenHdl; } 82 void SetOnlyDirectories( sal_Bool bDir = sal_True ); 83 void SetNoURLSelection( sal_Bool bSet = sal_True ); GetSmartProtocol() const84 INetProtocol GetSmartProtocol() const { return eSmartProtocol; } 85 void SetSmartProtocol( INetProtocol eProt ); IsCtrlOpen()86 sal_Bool IsCtrlOpen() 87 { return bCtrlClick; } 88 String GetURL(); 89 void DisableHistory(); 90 91 void UpdatePickList( ); 92 93 static String ParseSmart( String aText, String aBaseURL, String aWorkDir ); 94 95 void SetFilter(const String& _sFilter); 96 void SetUrlFilter( const IUrlFilter* _pFilter ); 97 const IUrlFilter* GetUrlFilter( ) const; 98 EnableAutocompletion(sal_Bool _bEnable=sal_True)99 inline void EnableAutocompletion( sal_Bool _bEnable = sal_True ) 100 { bIsAutoCompleteEnabled = _bEnable; } SetPlaceHolder(const String & sPlaceHolder)101 void SetPlaceHolder( const String& sPlaceHolder ) { aPlaceHolder = sPlaceHolder; } GetPlaceHolder()102 String GetPlaceHolder() { return aPlaceHolder; } MatchesPlaceHolder(const String & sToMatch)103 bool MatchesPlaceHolder( const String& sToMatch ) { return ( ( aPlaceHolder.Len() > 0 ) && ( aPlaceHolder == sToMatch ) ); } 104 }; 105 106 #endif 107 108