LibreOffice Module sc (master) 1
gototabdlg.cxx
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
11#undef SC_DLLIMPLEMENTATION
12
13#include <gototabdlg.hxx>
14
16 : GenericDialogController(pParent, "modules/scalc/ui/gotosheetdialog.ui", "GoToSheetDialog")
17 , m_xFrameMask(m_xBuilder->weld_frame("frame-mask"))
18 , m_xEnNameMask(m_xBuilder->weld_entry("entry-mask"))
19 , m_xFrameSheets(m_xBuilder->weld_frame("frame-sheets"))
20 , m_xLb(m_xBuilder->weld_tree_view("treeview"))
21{
22 m_xLb->set_selection_mode(SelectionMode::Single);
23 m_xLb->set_size_request(-1, m_xLb->get_height_rows(10));
24 m_xLb->connect_row_activated(LINK(this, ScGoToTabDlg, DblClkHdl));
25 m_xEnNameMask->connect_changed(LINK(this, ScGoToTabDlg, FindNameHdl));
26}
27
29
30void ScGoToTabDlg::SetDescription(const OUString& rTitle, const OUString& rEntryLabel,
31 const OUString& rListLabel, const OUString& rDlgHelpId,
32 const OUString& rEnHelpId, const OUString& rLbHelpId)
33{
34 m_xDialog->set_title(rTitle);
35 m_xFrameMask->set_label(rEntryLabel);
36 m_xFrameSheets->set_label(rListLabel);
37 m_xDialog->set_help_id(rDlgHelpId);
38 m_xEnNameMask->set_help_id(rEnHelpId);
39 m_xLb->set_help_id(rLbHelpId);
40}
41
42void ScGoToTabDlg::Insert(const OUString& rString, bool bSelected)
43{
44 maCacheSheetsNames.push_back(rString);
45 m_xLb->append_text(rString);
46 if (bSelected)
47 m_xLb->select(m_xLb->n_children() - 1);
48}
49
50OUString ScGoToTabDlg::GetSelectedEntry() const { return m_xLb->get_selected_text(); }
51
53{
54 m_xDialog->response(RET_OK);
55 return true;
56}
57
59{
60 const OUString aMask = m_xEnNameMask->get_text();
61 m_xLb->clear();
62 if (aMask.isEmpty())
63 {
64 for (const OUString& s : maCacheSheetsNames)
65 {
66 m_xLb->append_text(s);
67 }
68 }
69 else
70 {
71 for (const OUString& s : maCacheSheetsNames)
72 {
73 if (s.indexOf(aMask) >= 0)
74 {
75 m_xLb->append_text(s);
76 }
77 }
78 }
79}
80
81/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XExecutableDialog > m_xDialog
void SetDescription(const OUString &rTitle, const OUString &rEntryLabel, const OUString &rListLabel, const OUString &rDlgHelpId, const OUString &rEnHelpId, const OUString &rLbHelpId)
Sets dialog title, label texts and help IDs.
Definition: gototabdlg.cxx:30
ScGoToTabDlg(weld::Window *pParent)
Definition: gototabdlg.cxx:15
std::unique_ptr< weld::Frame > m_xFrameSheets
Definition: gototabdlg.hxx:22
void Insert(const OUString &rString, bool bSelected)
Inserts a string into the weld::TreeView.
Definition: gototabdlg.cxx:42
std::unique_ptr< weld::Entry > m_xEnNameMask
Definition: gototabdlg.hxx:21
std::vector< OUString > maCacheSheetsNames
Definition: gototabdlg.hxx:18
std::unique_ptr< weld::Frame > m_xFrameMask
Definition: gototabdlg.hxx:20
std::unique_ptr< weld::TreeView > m_xLb
Definition: gototabdlg.hxx:23
virtual ~ScGoToTabDlg() override
Definition: gototabdlg.cxx:28
OUString GetSelectedEntry() const
Definition: gototabdlg.cxx:50
std::shared_ptr< weld::Dialog > m_xDialog
IMPL_LINK_NOARG(ScGoToTabDlg, DblClkHdl, weld::TreeView &, bool)
Definition: gototabdlg.cxx:52
RET_OK