LibreOffice Module fpicker (master) 1
autocmpledit.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
10#pragma once
11
12#include <vcl/idle.hxx>
13#include <vcl/weld.hxx>
14#include <vector>
15
17{
18private:
19 std::unique_ptr<weld::Entry> m_xEntry;
20
21 std::vector<OUString> m_aEntries;
22 std::vector<OUString> m_aMatching;
25 sal_uInt16 m_nLastCharCode;
26
27 DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
28 DECL_LINK(ChangedHdl, weld::Entry&, void);
29 DECL_LINK(TryAutoComplete, Timer*, void);
30
31 bool Match(std::u16string_view rText);
32
33public:
34 AutocompleteEdit(std::unique_ptr<weld::Entry> xEntry);
35
36 void show() { m_xEntry->show(); }
37 void set_sensitive(bool bSensitive) { m_xEntry->set_sensitive(bSensitive); }
38 OUString get_text() const { return m_xEntry->get_text(); }
39 void set_text(const OUString& rText) { m_xEntry->set_text(rText); }
40 void grab_focus() { m_xEntry->grab_focus(); }
41 void select_region(int nStartPos, int nEndPos) { m_xEntry->select_region(nStartPos, nEndPos); }
42
45 {
46 m_xEntry->connect_focus_in(rLink);
47 }
48
49 void AddEntry(const OUString& rEntry);
50 void ClearEntries();
51};
52
53/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void select_region(int nStartPos, int nEndPos)
std::vector< OUString > m_aEntries
DECL_LINK(KeyInputHdl, const KeyEvent &, bool)
void set_sensitive(bool bSensitive)
DECL_LINK(TryAutoComplete, Timer *, void)
DECL_LINK(ChangedHdl, weld::Entry &, void)
AutocompleteEdit(std::unique_ptr< weld::Entry > xEntry)
std::unique_ptr< weld::Entry > m_xEntry
bool Match(std::u16string_view rText)
void connect_changed(const Link< weld::Entry &, void > &rLink)
void set_text(const OUString &rText)
void connect_focus_in(const Link< weld::Widget &, void > &rLink)
sal_uInt16 m_nLastCharCode
void AddEntry(const OUString &rEntry)
OUString get_text() const
Link< weld::Entry &, void > m_aChangeHdl
std::vector< OUString > m_aMatching