LibreOffice Module sc (master) 1
shtabdlg.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 <shtabdlg.hxx>
23
25 : GenericDialogController(pParent, "modules/scalc/ui/showsheetdialog.ui", "ShowSheetDialog")
26 , m_xFrame(m_xBuilder->weld_frame("frame"))
27 , m_xLb(m_xBuilder->weld_tree_view("treeview"))
28{
29 m_xLb->set_selection_mode(SelectionMode::Multiple);
30 m_xLb->set_size_request(-1, m_xLb->get_height_rows(10));
31 m_xLb->connect_row_activated(LINK(this, ScShowTabDlg, DblClkHdl));
32}
33
35
36void ScShowTabDlg::SetDescription(const OUString& rTitle, const OUString& rFixedText,
37 const OString& rDlgHelpId, const OString& sLbHelpId)
38{
39 m_xDialog->set_title(rTitle);
40 m_xFrame->set_label(rFixedText);
41 m_xDialog->set_help_id(rDlgHelpId);
42 m_xLb->set_help_id(sLbHelpId);
43}
44
45void ScShowTabDlg::Insert(const OUString& rString, bool bSelected)
46{
47 m_xLb->append_text(rString);
48 if (bSelected)
49 m_xLb->select(m_xLb->n_children() - 1);
50}
51
52std::vector<sal_Int32> ScShowTabDlg::GetSelectedRows() const
53{
54 auto aTmp = m_xLb->get_selected_rows();
55 return std::vector<sal_Int32>(aTmp.begin(), aTmp.end());
56}
57
58OUString ScShowTabDlg::GetEntry(sal_Int32 nIndex) const { return m_xLb->get_text(nIndex); }
59
61{
62 m_xDialog->response(RET_OK);
63 return true;
64}
65
66/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::lang::XComponent > m_xFrame
Reference< XExecutableDialog > m_xDialog
std::unique_ptr< weld::Frame > m_xFrame
Definition: shtabdlg.hxx:27
void Insert(const OUString &rString, bool bSelected)
Inserts a string into the weld::TreeView.
Definition: shtabdlg.cxx:45
virtual ~ScShowTabDlg() override
Definition: shtabdlg.cxx:34
std::unique_ptr< weld::TreeView > m_xLb
Definition: shtabdlg.hxx:28
OUString GetEntry(sal_Int32 nPos) const
Definition: shtabdlg.cxx:58
ScShowTabDlg(weld::Window *pParent)
Definition: shtabdlg.cxx:24
std::vector< sal_Int32 > GetSelectedRows() const
Definition: shtabdlg.cxx:52
void SetDescription(const OUString &rTitle, const OUString &rFixedText, const OString &nDlgHelpId, const OString &nLbHelpId)
Sets dialog title, fixed text for listbox and help IDs.
Definition: shtabdlg.cxx:36
std::shared_ptr< weld::Dialog > m_xDialog
sal_Int32 nIndex
IMPL_LINK_NOARG(ScShowTabDlg, DblClkHdl, weld::TreeView &, bool)
Definition: shtabdlg.cxx:60
RET_OK