LibreOffice Module svtools (master) 1
inettbc.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <memory>
23#include <rtl/ref.hxx>
24#include <svtools/svtdllapi.h>
25#include <tools/urlobj.hxx>
26
27#include <vcl/idle.hxx>
28#include <vcl/weld.hxx>
29
31class SvtURLBox_Impl;
32
34{
36 friend class SvtURLBox_Impl;
37
39 OUString aBaseURL;
40 OUString aPlaceHolder;
42 std::unique_ptr<SvtURLBox_Impl> pImpl;
46 bool bNoSelection : 1;
47
51
52 std::unique_ptr<weld::ComboBox> m_xWidget;
53
54 DECL_DLLPRIVATE_LINK( TryAutoComplete, Timer*, void);
55 SVT_DLLPRIVATE void UpdatePicklistForSmartProtocol_Impl();
57 DECL_DLLPRIVATE_LINK( FocusInHdl, weld::Widget&, void);
58 DECL_DLLPRIVATE_LINK( FocusOutHdl, weld::Widget&, void);
59 SVT_DLLPRIVATE void Init();
60
61public:
62 SvtURLBox(std::unique_ptr<weld::ComboBox> xWidget);
63 ~SvtURLBox();
64
65 void set_entry_text(const OUString& rStr) { m_xWidget->set_entry_text(rStr); }
66 void show() { m_xWidget->show(); }
67 void clear() { m_xWidget->clear(); }
68 void connect_entry_activate(const Link<weld::ComboBox&, bool>& rLink) { m_xWidget->connect_entry_activate(rLink); }
69 void connect_key_press(const Link<const KeyEvent&, bool>& rLink) { m_xWidget->connect_key_press(rLink); }
70 void connect_changed(const Link<weld::ComboBox&, void>& rLink) { aChangeHdl = rLink; }
71 void trigger_changed() { aChangeHdl.Call(*m_xWidget); }
72 void connect_focus_in(const Link<weld::Widget&, void>& rLink) { aFocusInHdl = rLink; }
73 void connect_focus_out(const Link<weld::Widget&, void>& rLink) { aFocusOutHdl = rLink; }
74 void append_text(const OUString& rStr) { m_xWidget->append_text(rStr); }
75 int find_text(const OUString& rStr) const { return m_xWidget->find_text(rStr); }
76 OUString get_active_text() const { return m_xWidget->get_active_text(); }
77 void grab_focus() { m_xWidget->grab_focus(); }
78 void set_sensitive(bool bSensitive) { m_xWidget->set_sensitive(bSensitive); }
79 void set_help_id(const OUString& rHelpId) { m_xWidget->set_help_id(rHelpId); }
80 void select_entry_region(int nStartPos, int nEndPos) { m_xWidget->select_entry_region(nStartPos, nEndPos); }
81 Size get_preferred_size() const { return m_xWidget->get_preferred_size(); }
82
83 void EnableAutocomplete(bool bEnable = true) { m_xWidget->set_entry_completion(bEnable); }
84 void SetBaseURL( const OUString& rURL );
85 const OUString& GetBaseURL() const { return aBaseURL; }
86 void SetOnlyDirectories( bool bDir );
87 void SetNoURLSelection( bool bSet );
88 void SetSmartProtocol( INetProtocol eProt );
89 INetProtocol GetSmartProtocol() const { return eSmartProtocol; }
90 OUString GetURL();
91 void DisableHistory();
92
93 weld::ComboBox* getWidget() { return m_xWidget.get(); }
94
95 static OUString ParseSmart( const OUString& aText, const OUString& aBaseURL );
96
97 void SetPlaceHolder(const OUString& sPlaceHolder) { aPlaceHolder = sPlaceHolder; }
98 const OUString& GetPlaceHolder() const { return aPlaceHolder; }
99 bool MatchesPlaceHolder(std::u16string_view sToMatch) const
100 {
101 return (!aPlaceHolder.isEmpty() && aPlaceHolder == sToMatch);
102 }
103
104 void SetFilter(std::u16string_view _sFilter);
105};
106
107/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::Image > m_xWidget
bool bNoSelection
Definition: inettbc.hxx:46
Idle aChangedIdle
Definition: inettbc.hxx:38
Size get_preferred_size() const
Definition: inettbc.hxx:81
void show()
Definition: inettbc.hxx:66
void grab_focus()
Definition: inettbc.hxx:77
void connect_focus_in(const Link< weld::Widget &, void > &rLink)
Definition: inettbc.hxx:72
bool bOnlyDirectories
Definition: inettbc.hxx:44
rtl::Reference< SvtMatchContext_Impl > pCtx
Definition: inettbc.hxx:41
bool MatchesPlaceHolder(std::u16string_view sToMatch) const
Definition: inettbc.hxx:99
const OUString & GetBaseURL() const
Definition: inettbc.hxx:85
Link< weld::ComboBox &, void > aChangeHdl
Definition: inettbc.hxx:48
std::unique_ptr< SvtURLBox_Impl > pImpl
Definition: inettbc.hxx:42
void set_entry_text(const OUString &rStr)
Definition: inettbc.hxx:65
std::unique_ptr< weld::ComboBox > m_xWidget
Definition: inettbc.hxx:52
Link< weld::Widget &, void > aFocusOutHdl
Definition: inettbc.hxx:50
INetProtocol GetSmartProtocol() const
Definition: inettbc.hxx:89
void connect_entry_activate(const Link< weld::ComboBox &, bool > &rLink)
Definition: inettbc.hxx:68
weld::ComboBox * getWidget()
Definition: inettbc.hxx:93
void connect_changed(const Link< weld::ComboBox &, void > &rLink)
Definition: inettbc.hxx:70
bool bHistoryDisabled
Definition: inettbc.hxx:45
INetProtocol eSmartProtocol
Definition: inettbc.hxx:43
OUString aBaseURL
Definition: inettbc.hxx:39
int find_text(const OUString &rStr) const
Definition: inettbc.hxx:75
OUString aPlaceHolder
Definition: inettbc.hxx:40
void set_help_id(const OUString &rHelpId)
Definition: inettbc.hxx:79
void append_text(const OUString &rStr)
Definition: inettbc.hxx:74
Link< weld::Widget &, void > aFocusInHdl
Definition: inettbc.hxx:49
void select_entry_region(int nStartPos, int nEndPos)
Definition: inettbc.hxx:80
const OUString & GetPlaceHolder() const
Definition: inettbc.hxx:98
void connect_focus_out(const Link< weld::Widget &, void > &rLink)
Definition: inettbc.hxx:73
DECL_DLLPRIVATE_LINK(ChangedHdl, weld::ComboBox &, void)
void trigger_changed()
Definition: inettbc.hxx:71
DECL_DLLPRIVATE_LINK(FocusOutHdl, weld::Widget &, void)
void set_sensitive(bool bSensitive)
Definition: inettbc.hxx:78
void EnableAutocomplete(bool bEnable=true)
Definition: inettbc.hxx:83
void SetPlaceHolder(const OUString &sPlaceHolder)
Definition: inettbc.hxx:97
void connect_key_press(const Link< const KeyEvent &, bool > &rLink)
Definition: inettbc.hxx:69
DECL_DLLPRIVATE_LINK(TryAutoComplete, Timer *, void)
OUString get_active_text() const
Definition: inettbc.hxx:76
void clear()
Definition: inettbc.hxx:67
DECL_DLLPRIVATE_LINK(FocusInHdl, weld::Widget &, void)
void Init()
virtual OUString GetURL() const override
#define SVT_DLLPUBLIC
Definition: svtdllapi.h:27
#define SVT_DLLPRIVATE
Definition: svtdllapi.h:29
INetProtocol