LibreOffice Module sc (master)  1
lbseldlg.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  * 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 #undef SC_DLLIMPLEMENTATION
21 
22 #include <lbseldlg.hxx>
23 
24 ScSelEntryDlg::ScSelEntryDlg(weld::Window* pParent, const std::vector<OUString> &rEntryList)
25  : GenericDialogController(pParent, "modules/scalc/ui/selectrange.ui", "SelectRangeDialog")
26  , m_xLb(m_xBuilder->weld_tree_view("treeview"))
27 {
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));
31 
32  for (const auto& rEntry : rEntryList)
33  m_xLb->append_text(rEntry);
34 
35  if (m_xLb->n_children() > 0)
36  m_xLb->select(0);
37 }
38 
40 {
41 }
42 
44 {
45  return m_xLb->get_selected_text();
46 }
47 
49 {
50  m_xDialog->response(RET_OK);
51  return true;
52 }
53 
54 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString GetSelectedEntry() const
Definition: lbseldlg.cxx:43
virtual ~ScSelEntryDlg() override
Definition: lbseldlg.cxx:39
IMPL_LINK_NOARG(ScSelEntryDlg, DblClkHdl, weld::TreeView &, bool)
Definition: lbseldlg.cxx:48
ScSelEntryDlg(weld::Window *pParent, const std::vector< OUString > &rEntryList)
Definition: lbseldlg.cxx:24
RET_OK
Reference< XExecutableDialog > m_xDialog
std::unique_ptr< weld::TreeView > m_xLb
Definition: lbseldlg.hxx:27