diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /sc/source/ui/miscdlgs/gototabdlg.cxx | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sc/source/ui/miscdlgs/gototabdlg.cxx')
-rw-r--r-- | sc/source/ui/miscdlgs/gototabdlg.cxx | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/sc/source/ui/miscdlgs/gototabdlg.cxx b/sc/source/ui/miscdlgs/gototabdlg.cxx new file mode 100644 index 0000000000..c817e506d6 --- /dev/null +++ b/sc/source/ui/miscdlgs/gototabdlg.cxx @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#undef SC_DLLIMPLEMENTATION + +#include <gototabdlg.hxx> + +ScGoToTabDlg::ScGoToTabDlg(weld::Window* pParent) + : GenericDialogController(pParent, "modules/scalc/ui/gotosheetdialog.ui", "GoToSheetDialog") + , m_xFrameMask(m_xBuilder->weld_frame("frame-mask")) + , m_xEnNameMask(m_xBuilder->weld_entry("entry-mask")) + , m_xFrameSheets(m_xBuilder->weld_frame("frame-sheets")) + , m_xLb(m_xBuilder->weld_tree_view("treeview")) +{ + m_xLb->set_selection_mode(SelectionMode::Single); + m_xLb->set_size_request(-1, m_xLb->get_height_rows(10)); + m_xLb->connect_row_activated(LINK(this, ScGoToTabDlg, DblClkHdl)); + m_xEnNameMask->connect_changed(LINK(this, ScGoToTabDlg, FindNameHdl)); +} + +ScGoToTabDlg::~ScGoToTabDlg() {} + +void ScGoToTabDlg::SetDescription(const OUString& rTitle, const OUString& rEntryLabel, + const OUString& rListLabel, const OUString& rDlgHelpId, + const OUString& rEnHelpId, const OUString& rLbHelpId) +{ + m_xDialog->set_title(rTitle); + m_xFrameMask->set_label(rEntryLabel); + m_xFrameSheets->set_label(rListLabel); + m_xDialog->set_help_id(rDlgHelpId); + m_xEnNameMask->set_help_id(rEnHelpId); + m_xLb->set_help_id(rLbHelpId); +} + +void ScGoToTabDlg::Insert(const OUString& rString, bool bSelected) +{ + maCacheSheetsNames.push_back(rString); + m_xLb->append_text(rString); + if (bSelected) + m_xLb->select(m_xLb->n_children() - 1); +} + +OUString ScGoToTabDlg::GetSelectedEntry() const { return m_xLb->get_selected_text(); } + +IMPL_LINK_NOARG(ScGoToTabDlg, DblClkHdl, weld::TreeView&, bool) +{ + m_xDialog->response(RET_OK); + return true; +} + +IMPL_LINK_NOARG(ScGoToTabDlg, FindNameHdl, weld::Entry&, void) +{ + const OUString aMask = m_xEnNameMask->get_text(); + m_xLb->clear(); + if (aMask.isEmpty()) + { + for (const OUString& s : maCacheSheetsNames) + { + m_xLb->append_text(s); + } + } + else + { + for (const OUString& s : maCacheSheetsNames) + { + if (s.indexOf(aMask) >= 0) + { + m_xLb->append_text(s); + } + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |