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 :
10 : #include "dlg_PropertyMapping.hxx"
11 :
12 : #include "DialogModel.hxx"
13 :
14 : using namespace com::sun::star;
15 :
16 : namespace chart {
17 :
18 : namespace {
19 :
20 : long pListBoxTabs[] =
21 : {
22 : 3,
23 : 0, 75, 150
24 : };
25 :
26 : }
27 :
28 0 : PropertyMappingDlg::PropertyMappingDlg(Window* pParent, uno::Reference< chart2::XChartType > xChartType )
29 : : ModalDialog(pParent, "PropertyMappingDialog",
30 0 : "modules/schart/ui/dlg_PropertyMapping.ui")
31 : {
32 0 : get(mpMappingTable, "LST_PROPERTY_MAPPING");
33 0 : get(mpBtnOk, "ok");
34 0 : get(mpBtnCancel, "cancel");
35 :
36 0 : mpMappingTable->SetTabs( pListBoxTabs, MAP_APPFONT );
37 0 : uno::Sequence< OUString > aPropRoles = xChartType->getSupportedPropertyRoles();
38 0 : for(sal_Int32 i = 0, n = aPropRoles.getLength(); i < n; ++i)
39 : {
40 0 : OUString aUIString = DialogModel::ConvertRoleFromInternalToUI(aPropRoles[i]);
41 0 : mpMappingTable->InsertEntry(aUIString);
42 0 : }
43 0 : mpBtnOk->SetClickHdl( LINK( this, PropertyMappingDlg, OkBtnHdl ) );
44 0 : mpBtnCancel->SetClickHdl( LINK( this, PropertyMappingDlg, CancelBtnHdl ) );
45 0 : }
46 :
47 0 : OUString PropertyMappingDlg::getSelectedEntry()
48 : {
49 0 : if(mpMappingTable->GetSelectionCount())
50 : {
51 0 : SvTreeListEntry* pEntry = mpMappingTable->FirstSelected();
52 0 : OUString aText = mpMappingTable->GetEntryText(pEntry, 0);
53 0 : return aText;
54 : }
55 :
56 0 : return OUString();
57 : }
58 :
59 0 : IMPL_LINK_NOARG(PropertyMappingDlg, OkBtnHdl)
60 : {
61 0 : EndDialog(RET_OK);
62 0 : return 0;
63 : }
64 :
65 0 : IMPL_LINK_NOARG(PropertyMappingDlg, CancelBtnHdl)
66 : {
67 0 : EndDialog(RET_CANCEL);
68 0 : return 0;
69 : }
70 :
71 : }
72 :
73 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|