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 INCLUDED_SVTOOLS_INETTBC_HXX
21 : #define INCLUDED_SVTOOLS_INETTBC_HXX
22 :
23 : #include <rtl/ref.hxx>
24 : #include <svtools/svtdllapi.h>
25 : #include <tools/urlobj.hxx>
26 :
27 : #include <vcl/combobox.hxx>
28 :
29 : class SvtMatchContext_Impl;
30 : class SvtURLBox_Impl;
31 : class SVT_DLLPUBLIC SvtURLBox : public ComboBox
32 : {
33 : friend class SvtMatchContext_Impl;
34 : friend class SvtURLBox_Impl;
35 : Link<> aOpenHdl;
36 : OUString aBaseURL;
37 : OUString aPlaceHolder;
38 : rtl::Reference< SvtMatchContext_Impl > pCtx;
39 : SvtURLBox_Impl* pImp;
40 : INetProtocol eSmartProtocol;
41 : bool bAutoCompleteMode : 1;
42 : bool bOnlyDirectories : 1;
43 : bool bCtrlClick : 1;
44 : bool bHistoryDisabled : 1;
45 : bool bNoSelection : 1;
46 : bool bIsAutoCompleteEnabled : 1;
47 :
48 : SVT_DLLPRIVATE bool ProcessKey( const vcl::KeyCode& rCode );
49 : SVT_DLLPRIVATE void TryAutoComplete();
50 : SVT_DLLPRIVATE void UpdatePicklistForSmartProtocol_Impl();
51 : SVT_DLLPRIVATE void Init(bool bSetDefaultHelpID);
52 :
53 : SAL_DLLPRIVATE void AutoCompleteHandler( Edit* );
54 :
55 : protected:
56 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
57 : virtual void Select() SAL_OVERRIDE;
58 : virtual void Modify() SAL_OVERRIDE;
59 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
60 :
61 : public:
62 : SvtURLBox( vcl::Window* pParent, INetProtocol eSmart = INetProtocol::NotValid, bool bSetDefaultHelpID = true );
63 : SvtURLBox( vcl::Window* pParent, WinBits _nStyle, INetProtocol eSmart = INetProtocol::NotValid, bool bSetDefaultHelpID = true );
64 : SvtURLBox( vcl::Window* pParent, const ResId& _rResId, INetProtocol eSmart = INetProtocol::NotValid, bool bSetDefaultHelpID = true );
65 : virtual ~SvtURLBox();
66 : virtual void dispose() SAL_OVERRIDE;
67 :
68 : void SetBaseURL( const OUString& rURL );
69 0 : const OUString& GetBaseURL() const { return aBaseURL; }
70 0 : void SetOpenHdl( const Link<>& rLink ) { aOpenHdl = rLink; }
71 0 : const Link<>& GetOpenHdl() const { return aOpenHdl; }
72 : void SetOnlyDirectories( bool bDir = true );
73 : void SetNoURLSelection( bool bSet = true );
74 0 : INetProtocol GetSmartProtocol() const { return eSmartProtocol; }
75 : void SetSmartProtocol( INetProtocol eProt );
76 0 : bool IsCtrlOpen()
77 0 : { return bCtrlClick; }
78 : OUString GetURL();
79 : void DisableHistory();
80 :
81 : void UpdatePickList( );
82 :
83 : static OUString ParseSmart( const OUString& aText, const OUString& aBaseURL, const OUString& aWorkDir );
84 :
85 : void SetFilter(const OUString& _sFilter);
86 :
87 0 : inline void EnableAutocompletion( bool _bEnable = true )
88 0 : { bIsAutoCompleteEnabled = _bEnable; }
89 0 : void SetPlaceHolder( const OUString& sPlaceHolder )
90 0 : { aPlaceHolder = sPlaceHolder; }
91 0 : OUString GetPlaceHolder() { return aPlaceHolder; }
92 0 : bool MatchesPlaceHolder( const OUString& sToMatch ) const
93 0 : { return ( !aPlaceHolder.isEmpty() ) && ( aPlaceHolder == sToMatch ); }
94 : };
95 :
96 : #endif
97 :
98 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|