summaryrefslogtreecommitdiffstats
path: root/chart2/source/controller/dialogs/dlg_InsertDataTable.cxx
blob: 4b5e928db057f3efc8c30ea90dee6e4116810f7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#include <dlg_InsertDataTable.hxx>

namespace chart
{
InsertDataTableDialog::InsertDataTableDialog(weld::Window* pWindow)
    : GenericDialogController(pWindow, "modules/schart/ui/dlg_InsertDataTable.ui",
                              "InsertDataTableDialog")
    , m_aDataTablePropertiesResources(*m_xBuilder)
    , m_xCbShowDataTable(m_xBuilder->weld_check_button("showDataTable"))
{
    m_xCbShowDataTable->connect_toggled(LINK(this, InsertDataTableDialog, ShowDataTableToggle));
    init(m_aData);
}

IMPL_LINK_NOARG(InsertDataTableDialog, ShowDataTableToggle, weld::Toggleable&, void)
{
    changeEnabled();
}

void InsertDataTableDialog::changeEnabled()
{
    bool bEnable = m_xCbShowDataTable->get_active();
    m_aDataTablePropertiesResources.setChecksSensitive(bEnable);
    m_aData.mbShow = bEnable;
}

void InsertDataTableDialog::init(DataTableDialogData const& rData)
{
    m_aData = rData;
    m_aDataTablePropertiesResources.setHorizontalBorder(m_aData.mbHorizontalBorders);
    m_aDataTablePropertiesResources.setVerticalBorder(m_aData.mbVerticalBorders);
    m_aDataTablePropertiesResources.setOutline(m_aData.mbOutline);
    m_aDataTablePropertiesResources.setKeys(m_aData.mbKeys);
    m_xCbShowDataTable->set_active(m_aData.mbShow);
    changeEnabled();
}

DataTableDialogData& InsertDataTableDialog::getDataTableDialogData()
{
    m_aData.mbShow = m_xCbShowDataTable->get_active();

    m_aData.mbHorizontalBorders = m_aDataTablePropertiesResources.getHorizontalBorder();
    m_aData.mbVerticalBorders = m_aDataTablePropertiesResources.getVerticalBorder();
    m_aData.mbOutline = m_aDataTablePropertiesResources.getOutline();
    m_aData.mbKeys = m_aDataTablePropertiesResources.getKeys();

    return m_aData;
}

} //namespace chart

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */