Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SVTOOLS_INETTBC_HXX
30 : : #define _SVTOOLS_INETTBC_HXX
31 : :
32 : : #include "rtl/ref.hxx"
33 : : #include "svtools/svtdllapi.h"
34 : : #include <tools/string.hxx>
35 : : #include <tools/urlobj.hxx>
36 : :
37 : : #include <vcl/combobox.hxx>
38 : :
39 : : class IUrlFilter;
40 : : class SvtMatchContext_Impl;
41 : : class SvtURLBox_Impl;
42 : : class SVT_DLLPUBLIC SvtURLBox : public ComboBox
43 : : {
44 : : friend class SvtMatchContext_Impl;
45 : : friend class SvtURLBox_Impl;
46 : : Link aOpenHdl;
47 : : String aBaseURL;
48 : : String aPlaceHolder;
49 : : rtl::Reference< SvtMatchContext_Impl > pCtx;
50 : : SvtURLBox_Impl* pImp;
51 : : INetProtocol eSmartProtocol;
52 : : sal_Bool bAutoCompleteMode : 1;
53 : : sal_Bool bOnlyDirectories : 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 );
79 : 0 : const String& GetBaseURL() const { return aBaseURL; }
80 : 0 : void SetOpenHdl( const Link& rLink ) { aOpenHdl = rLink; }
81 : 0 : const Link& GetOpenHdl() const { return aOpenHdl; }
82 : : void SetOnlyDirectories( sal_Bool bDir = sal_True );
83 : : void SetNoURLSelection( sal_Bool bSet = sal_True );
84 : 0 : INetProtocol GetSmartProtocol() const { return eSmartProtocol; }
85 : : void SetSmartProtocol( INetProtocol eProt );
86 : 0 : sal_Bool IsCtrlOpen()
87 : 0 : { 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 : :
98 : 0 : inline void EnableAutocompletion( sal_Bool _bEnable = sal_True )
99 : 0 : { bIsAutoCompleteEnabled = _bEnable; }
100 : 0 : void SetPlaceHolder( const String& sPlaceHolder ) { aPlaceHolder = sPlaceHolder; }
101 : 0 : String GetPlaceHolder() { return aPlaceHolder; }
102 [ # # ][ # # ]: 0 : bool MatchesPlaceHolder( const String& sToMatch ) { return ( ( aPlaceHolder.Len() > 0 ) && ( aPlaceHolder == sToMatch ) ); }
103 : : };
104 : :
105 : : #endif
106 : :
107 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|