LibreOffice Module sw (master)  1
multmrk.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 #include <multmrk.hxx>
21 #include <toxmgr.hxx>
22 #include <wrtsh.hxx>
23 
25  : GenericDialogController(pParent, "modules/swriter/ui/selectindexdialog.ui", "SelectIndexDialog")
26  , m_rMgr(rTOXMgr)
27  , m_nPos(0)
28  , m_xTextFT(m_xBuilder->weld_label("type"))
29  , m_xTOXLB(m_xBuilder->weld_tree_view("treeview"))
30 {
31  m_xTOXLB->set_size_request(m_xTOXLB->get_approximate_digit_width() * 32,
32  m_xTOXLB->get_height_rows(8));
33 
34  m_xTOXLB->connect_changed(LINK(this, SwMultiTOXMarkDlg, SelectHdl));
35 
36  sal_uInt16 nSize = m_rMgr.GetTOXMarkCount();
37  for(sal_uInt16 i=0; i < nSize; ++i)
39 
40  m_xTOXLB->select(0);
41  m_xTextFT->set_label(m_rMgr.GetTOXMark(0)->GetTOXType()->GetTypeName());
42 }
43 
44 IMPL_LINK( SwMultiTOXMarkDlg, SelectHdl, weld::TreeView&, rBox, void )
45 {
46  if (rBox.get_selected_index() != -1)
47  {
48  SwTOXMark* pMark = m_rMgr.GetTOXMark(rBox.get_selected_index());
49  m_xTextFT->set_label(pMark->GetTOXType()->GetTypeName());
50  m_nPos = rBox.get_selected_index();
51  }
52 }
53 
55 {
56  short nRet = GenericDialogController::run();
57  if (nRet == RET_OK)
59  return nRet;
60 }
61 
63 {
64 }
65 
66 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwWrtShell * GetShell()
Definition: toxmgr.hxx:259
size_t m_nPos
SwTOXMgr & m_rMgr
Definition: multmrk.hxx:31
IMPL_LINK(SwMultiTOXMarkDlg, SelectHdl, weld::TreeView &, rBox, void)
Definition: multmrk.cxx:44
const SwTOXType * GetTOXType() const
Definition: tox.hxx:578
int i
virtual short run() override
Definition: multmrk.cxx:54
SwTOXMark * GetTOXMark(sal_uInt16 nId)
Definition: toxmgr.cxx:36
std::unique_ptr< weld::TreeView > m_xTOXLB
Definition: multmrk.hxx:35
OUString GetText(SwRootFrame const *pLayout) const
Definition: tox.cxx:193
sal_uInt16 GetTOXMarkCount() const
Definition: toxmgr.hxx:263
const OUString & GetTypeName() const
Definition: tox.hxx:696
void SetCurTOXMark(sal_uInt16 nId)
Definition: toxmgr.cxx:261
std::unique_ptr< weld::Label > m_xTextFT
Definition: multmrk.hxx:34
SwMultiTOXMarkDlg(weld::Window *pParent, SwTOXMgr &rTOXMgr)
Definition: multmrk.cxx:24
RET_OK
sal_uInt16 m_nPos
Definition: multmrk.hxx:32
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2070
virtual ~SwMultiTOXMarkDlg() override
Definition: multmrk.cxx:62