tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / miscdlgs / shtabdlg.cxx
blob07b606b4dbd533e6c0556401d88d94ed58ee73ce
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 <shtabdlg.hxx>
24 ScShowTabDlg::ScShowTabDlg(weld::Window* pParent)
25 : GenericDialogController(pParent, u"modules/scalc/ui/showsheetdialog.ui"_ustr,
26 u"ShowSheetDialog"_ustr)
27 , m_xFrame(m_xBuilder->weld_frame(u"frame"_ustr))
28 , m_xLb(m_xBuilder->weld_tree_view(u"treeview"_ustr))
30 m_xLb->set_selection_mode(SelectionMode::Multiple);
31 m_xLb->set_size_request(-1, m_xLb->get_height_rows(10));
32 m_xLb->connect_row_activated(LINK(this, ScShowTabDlg, DblClkHdl));
35 ScShowTabDlg::~ScShowTabDlg() {}
37 void ScShowTabDlg::SetDescription(const OUString& rTitle, const OUString& rFixedText,
38 const OUString& rDlgHelpId, const OUString& sLbHelpId)
40 m_xDialog->set_title(rTitle);
41 m_xFrame->set_label(rFixedText);
42 m_xDialog->set_help_id(rDlgHelpId);
43 m_xLb->set_help_id(sLbHelpId);
46 void ScShowTabDlg::Insert(const OUString& rString, bool bSelected)
48 m_xLb->append_text(rString);
49 if (bSelected)
50 m_xLb->select(m_xLb->n_children() - 1);
53 std::vector<sal_Int32> ScShowTabDlg::GetSelectedRows() const
55 auto aTmp = m_xLb->get_selected_rows();
56 return std::vector<sal_Int32>(aTmp.begin(), aTmp.end());
59 OUString ScShowTabDlg::GetEntry(sal_Int32 nIndex) const { return m_xLb->get_text(nIndex); }
61 IMPL_LINK_NOARG(ScShowTabDlg, DblClkHdl, weld::TreeView&, bool)
63 m_xDialog->response(RET_OK);
64 return true;
67 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */