1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #include <multmrk.hxx>
24 SwMultiTOXMarkDlg::SwMultiTOXMarkDlg(weld::Window
* pParent
, SwTOXMgr
& rTOXMgr
)
25 : GenericDialogController(pParent
, "modules/swriter/ui/selectindexdialog.ui",
29 , m_xTextFT(m_xBuilder
->weld_label("type"))
30 , m_xTOXLB(m_xBuilder
->weld_tree_view("treeview"))
32 m_xTOXLB
->set_size_request(m_xTOXLB
->get_approximate_digit_width() * 32,
33 m_xTOXLB
->get_height_rows(8));
35 m_xTOXLB
->connect_changed(LINK(this, SwMultiTOXMarkDlg
, SelectHdl
));
37 sal_uInt16 nSize
= m_rMgr
.GetTOXMarkCount();
38 for (sal_uInt16 i
= 0; i
< nSize
; ++i
)
39 m_xTOXLB
->append_text(m_rMgr
.GetTOXMark(i
)->GetText(m_rMgr
.GetShell()->GetLayout()));
42 m_xTextFT
->set_label(m_rMgr
.GetTOXMark(0)->GetTOXType()->GetTypeName());
45 IMPL_LINK(SwMultiTOXMarkDlg
, SelectHdl
, weld::TreeView
&, rBox
, void)
47 if (rBox
.get_selected_index() != -1)
49 SwTOXMark
* pMark
= m_rMgr
.GetTOXMark(rBox
.get_selected_index());
50 m_xTextFT
->set_label(pMark
->GetTOXType()->GetTypeName());
51 m_nPos
= rBox
.get_selected_index();
55 short SwMultiTOXMarkDlg::run()
57 short nRet
= GenericDialogController::run();
59 m_rMgr
.SetCurTOXMark(m_nPos
);
63 SwMultiTOXMarkDlg::~SwMultiTOXMarkDlg() {}
65 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */