Line data Source code
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 "swtypes.hxx"
21 :
22 : #include "multmrk.hxx"
23 : #include "toxmgr.hxx"
24 :
25 : #include "index.hrc"
26 :
27 0 : SwMultiTOXMarkDlg::SwMultiTOXMarkDlg(vcl::Window* pParent, SwTOXMgr& rTOXMgr)
28 : : SvxStandardDialog(pParent, "SelectIndexDialog",
29 : "modules/swriter/ui/selectindexdialog.ui")
30 : , rMgr(rTOXMgr)
31 0 : , nPos(0)
32 : {
33 0 : get(m_pTextFT, "type");
34 0 : get(m_pTOXLB, "treeview");
35 0 : m_pTOXLB->set_height_request(m_pTOXLB->GetTextHeight() * 10);
36 0 : m_pTOXLB->set_width_request(m_pTOXLB->approximate_char_width() * 25);
37 :
38 0 : m_pTOXLB->SetSelectHdl(LINK(this, SwMultiTOXMarkDlg, SelectHdl));
39 :
40 0 : sal_uInt16 nSize = rMgr.GetTOXMarkCount();
41 0 : for(sal_uInt16 i=0; i < nSize; ++i)
42 0 : m_pTOXLB->InsertEntry(rMgr.GetTOXMark(i)->GetText());
43 :
44 0 : m_pTOXLB->SelectEntryPos(0);
45 0 : m_pTextFT->SetText(rMgr.GetTOXMark(0)->GetTOXType()->GetTypeName());
46 0 : }
47 :
48 0 : IMPL_LINK( SwMultiTOXMarkDlg, SelectHdl, ListBox *, pBox )
49 : {
50 0 : if(pBox->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND)
51 0 : { SwTOXMark* pMark = rMgr.GetTOXMark(pBox->GetSelectEntryPos());
52 0 : m_pTextFT->SetText(pMark->GetTOXType()->GetTypeName());
53 0 : nPos = pBox->GetSelectEntryPos();
54 : }
55 0 : return 0;
56 : }
57 :
58 0 : void SwMultiTOXMarkDlg::Apply()
59 : {
60 0 : rMgr.SetCurTOXMark(nPos);
61 0 : }
62 :
63 0 : SwMultiTOXMarkDlg::~SwMultiTOXMarkDlg()
64 : {
65 0 : disposeOnce();
66 0 : }
67 :
68 0 : void SwMultiTOXMarkDlg::dispose()
69 : {
70 0 : m_pTextFT.clear();
71 0 : m_pTOXLB.clear();
72 0 : SvxStandardDialog::dispose();
73 0 : }
74 :
75 :
76 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|