1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVTOOLS_INETTBC_HXX
21 #define INCLUDED_SVTOOLS_INETTBC_HXX
23 #include <rtl/ref.hxx>
24 #include <svtools/svtdllapi.h>
25 #include <tools/urlobj.hxx>
27 #include <vcl/combobox.hxx>
29 class SvtMatchContext_Impl
;
31 class SVT_DLLPUBLIC SvtURLBox
: public ComboBox
33 friend class SvtMatchContext_Impl
;
34 friend class SvtURLBox_Impl
;
37 OUString aPlaceHolder
;
38 rtl::Reference
< SvtMatchContext_Impl
> pCtx
;
40 INetProtocol eSmartProtocol
;
41 sal_Bool bAutoCompleteMode
: 1;
42 sal_Bool bOnlyDirectories
: 1;
43 sal_Bool bCtrlClick
: 1;
44 sal_Bool bHistoryDisabled
: 1;
45 sal_Bool bNoSelection
: 1;
46 sal_Bool bIsAutoCompleteEnabled
: 1;
48 SVT_DLLPRIVATE sal_Bool
ProcessKey( const KeyCode
& rCode
);
49 SVT_DLLPRIVATE
void TryAutoComplete();
50 SVT_DLLPRIVATE
void UpdatePicklistForSmartProtocol_Impl();
51 DECL_DLLPRIVATE_LINK( AutoCompleteHdl_Impl
, void* );
52 SVT_DLLPRIVATE
void Init(bool bSetDefaultHelpID
);
55 virtual long Notify( NotifyEvent
& rNEvt
);
56 virtual void Select();
57 virtual void Modify();
58 virtual long PreNotify( NotifyEvent
& rNEvt
);
61 SvtURLBox( Window
* pParent
, INetProtocol eSmart
= INET_PROT_NOT_VALID
, bool bSetDefaultHelpID
= true );
62 SvtURLBox( Window
* pParent
, WinBits _nStyle
, INetProtocol eSmart
= INET_PROT_NOT_VALID
, bool bSetDefaultHelpID
= true );
63 SvtURLBox( Window
* pParent
, const ResId
& _rResId
, INetProtocol eSmart
= INET_PROT_NOT_VALID
, bool bSetDefaultHelpID
= true );
66 void SetBaseURL( const OUString
& rURL
);
67 const OUString
& GetBaseURL() const { return aBaseURL
; }
68 void SetOpenHdl( const Link
& rLink
) { aOpenHdl
= rLink
; }
69 const Link
& GetOpenHdl() const { return aOpenHdl
; }
70 void SetOnlyDirectories( sal_Bool bDir
= sal_True
);
71 void SetNoURLSelection( sal_Bool bSet
= sal_True
);
72 INetProtocol
GetSmartProtocol() const { return eSmartProtocol
; }
73 void SetSmartProtocol( INetProtocol eProt
);
75 { return bCtrlClick
; }
77 void DisableHistory();
79 void UpdatePickList( );
81 static OUString
ParseSmart( OUString aText
, OUString aBaseURL
, const OUString
& aWorkDir
);
83 void SetFilter(const OUString
& _sFilter
);
85 inline void EnableAutocompletion( sal_Bool _bEnable
= sal_True
)
86 { bIsAutoCompleteEnabled
= _bEnable
; }
87 void SetPlaceHolder( const OUString
& sPlaceHolder
)
88 { aPlaceHolder
= sPlaceHolder
; }
89 OUString
GetPlaceHolder() { return aPlaceHolder
; }
90 bool MatchesPlaceHolder( const OUString
& sToMatch
) const
91 { return ( !aPlaceHolder
.isEmpty() ) && ( aPlaceHolder
== sToMatch
); }
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */