Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _SVTOOLS_INETTBC_HXX
21 : #define _SVTOOLS_INETTBC_HXX
22 :
23 : #include "rtl/ref.hxx"
24 : #include "svtools/svtdllapi.h"
25 : #include <tools/string.hxx>
26 : #include <tools/urlobj.hxx>
27 :
28 : #include <vcl/combobox.hxx>
29 :
30 : class IUrlFilter;
31 : class SvtMatchContext_Impl;
32 : class SvtURLBox_Impl;
33 : class SVT_DLLPUBLIC SvtURLBox : public ComboBox
34 : {
35 : friend class SvtMatchContext_Impl;
36 : friend class SvtURLBox_Impl;
37 : Link aOpenHdl;
38 : String aBaseURL;
39 : String aPlaceHolder;
40 : rtl::Reference< SvtMatchContext_Impl > pCtx;
41 : SvtURLBox_Impl* pImp;
42 : INetProtocol eSmartProtocol;
43 : sal_Bool bAutoCompleteMode : 1;
44 : sal_Bool bOnlyDirectories : 1;
45 : sal_Bool bCtrlClick : 1;
46 : sal_Bool bHistoryDisabled : 1;
47 : sal_Bool bNoSelection : 1;
48 : sal_Bool bIsAutoCompleteEnabled : 1;
49 :
50 : SVT_DLLPRIVATE sal_Bool ProcessKey( const KeyCode& rCode );
51 : SVT_DLLPRIVATE void TryAutoComplete( sal_Bool bForce );
52 : SVT_DLLPRIVATE void UpdatePicklistForSmartProtocol_Impl();
53 : DECL_DLLPRIVATE_LINK( AutoCompleteHdl_Impl, void* );
54 : using Window::ImplInit;
55 : SVT_DLLPRIVATE void ImplInit();
56 :
57 : protected:
58 : virtual long Notify( NotifyEvent& rNEvt );
59 : virtual void Select();
60 : virtual void Modify();
61 : virtual long PreNotify( NotifyEvent& rNEvt );
62 :
63 : public:
64 : SvtURLBox( Window* pParent, INetProtocol eSmart = INET_PROT_NOT_VALID );
65 : SvtURLBox( Window* pParent, WinBits _nStyle, INetProtocol eSmart = INET_PROT_NOT_VALID );
66 : SvtURLBox( Window* pParent, const ResId& _rResId, INetProtocol eSmart = INET_PROT_NOT_VALID );
67 : ~SvtURLBox();
68 :
69 : void SetBaseURL( const String& rURL );
70 0 : const String& GetBaseURL() const { return aBaseURL; }
71 0 : void SetOpenHdl( const Link& rLink ) { aOpenHdl = rLink; }
72 0 : const Link& GetOpenHdl() const { return aOpenHdl; }
73 : void SetOnlyDirectories( sal_Bool bDir = sal_True );
74 : void SetNoURLSelection( sal_Bool bSet = sal_True );
75 0 : INetProtocol GetSmartProtocol() const { return eSmartProtocol; }
76 : void SetSmartProtocol( INetProtocol eProt );
77 0 : sal_Bool IsCtrlOpen()
78 0 : { return bCtrlClick; }
79 : String GetURL();
80 : void DisableHistory();
81 :
82 : void UpdatePickList( );
83 :
84 : static String ParseSmart( String aText, String aBaseURL, String aWorkDir );
85 :
86 : void SetFilter(const String& _sFilter);
87 : void SetUrlFilter( const IUrlFilter* _pFilter );
88 :
89 0 : inline void EnableAutocompletion( sal_Bool _bEnable = sal_True )
90 0 : { bIsAutoCompleteEnabled = _bEnable; }
91 0 : void SetPlaceHolder( const String& sPlaceHolder ) { aPlaceHolder = sPlaceHolder; }
92 0 : String GetPlaceHolder() { return aPlaceHolder; }
93 0 : bool MatchesPlaceHolder( const String& sToMatch ) { return ( ( aPlaceHolder.Len() > 0 ) && ( aPlaceHolder == sToMatch ) ); }
94 : };
95 :
96 : #endif
97 :
98 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|