tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / miscdlgs / lbseldlg.cxx
blobf3c28ad0e25cf0f4644d615e70c34b6aed839831
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #undef SC_DLLIMPLEMENTATION
22 #include <lbseldlg.hxx>
24 ScSelEntryDlg::ScSelEntryDlg(weld::Window* pParent, const std::vector<OUString> &rEntryList)
25 : GenericDialogController(pParent, u"modules/scalc/ui/selectrange.ui"_ustr, u"SelectRangeDialog"_ustr)
26 , m_xLb(m_xBuilder->weld_tree_view(u"treeview"_ustr))
28 m_xLb->set_size_request(m_xLb->get_approximate_digit_width() * 32,
29 m_xLb->get_height_rows(8));
30 m_xLb->connect_row_activated(LINK(this, ScSelEntryDlg, DblClkHdl));
32 for (const auto& rEntry : rEntryList)
33 m_xLb->append_text(rEntry);
35 if (m_xLb->n_children() > 0)
36 m_xLb->select(0);
39 ScSelEntryDlg::~ScSelEntryDlg()
43 OUString ScSelEntryDlg::GetSelectedEntry() const
45 return m_xLb->get_selected_text();
48 IMPL_LINK_NOARG(ScSelEntryDlg, DblClkHdl, weld::TreeView&, bool)
50 m_xDialog->response(RET_OK);
51 return true;
54 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */