Avoid potential negative array index access to cached text.
[LibreOffice.git] / chart2 / source / controller / dialogs / dlg_InsertDataTable.cxx
blob4b5e928db057f3efc8c30ea90dee6e4116810f7d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #include <dlg_InsertDataTable.hxx>
12 namespace chart
14 InsertDataTableDialog::InsertDataTableDialog(weld::Window* pWindow)
15 : GenericDialogController(pWindow, "modules/schart/ui/dlg_InsertDataTable.ui",
16 "InsertDataTableDialog")
17 , m_aDataTablePropertiesResources(*m_xBuilder)
18 , m_xCbShowDataTable(m_xBuilder->weld_check_button("showDataTable"))
20 m_xCbShowDataTable->connect_toggled(LINK(this, InsertDataTableDialog, ShowDataTableToggle));
21 init(m_aData);
24 IMPL_LINK_NOARG(InsertDataTableDialog, ShowDataTableToggle, weld::Toggleable&, void)
26 changeEnabled();
29 void InsertDataTableDialog::changeEnabled()
31 bool bEnable = m_xCbShowDataTable->get_active();
32 m_aDataTablePropertiesResources.setChecksSensitive(bEnable);
33 m_aData.mbShow = bEnable;
36 void InsertDataTableDialog::init(DataTableDialogData const& rData)
38 m_aData = rData;
39 m_aDataTablePropertiesResources.setHorizontalBorder(m_aData.mbHorizontalBorders);
40 m_aDataTablePropertiesResources.setVerticalBorder(m_aData.mbVerticalBorders);
41 m_aDataTablePropertiesResources.setOutline(m_aData.mbOutline);
42 m_aDataTablePropertiesResources.setKeys(m_aData.mbKeys);
43 m_xCbShowDataTable->set_active(m_aData.mbShow);
44 changeEnabled();
47 DataTableDialogData& InsertDataTableDialog::getDataTableDialogData()
49 m_aData.mbShow = m_xCbShowDataTable->get_active();
51 m_aData.mbHorizontalBorders = m_aDataTablePropertiesResources.getHorizontalBorder();
52 m_aData.mbVerticalBorders = m_aDataTablePropertiesResources.getVerticalBorder();
53 m_aData.mbOutline = m_aDataTablePropertiesResources.getOutline();
54 m_aData.mbKeys = m_aDataTablePropertiesResources.getKeys();
56 return m_aData;
59 } //namespace chart
61 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */