Coverage Report

Created: 2026-10-14 09:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/chart2/source/controller/dialogs/res_DataTableProperties.cxx
Line
Count
Source
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 <res_DataTableProperties.hxx>
11
12
#include <chartview/ChartSfxItemIds.hxx>
13
#include <svl/eitem.hxx>
14
15
using namespace css;
16
17
namespace chart
18
{
19
DataTablePropertiesResources::DataTablePropertiesResources(weld::Builder& rBuilder)
20
0
    : m_xCbHorizontalBorder(rBuilder.weld_check_button(u"horizontalBorderCB"_ustr))
21
0
    , m_xCbVerticalBorder(rBuilder.weld_check_button(u"verticalBorderCB"_ustr))
22
0
    , m_xCbOutilne(rBuilder.weld_check_button(u"outlineCB"_ustr))
23
0
    , m_xCbKeys(rBuilder.weld_check_button(u"keysCB"_ustr))
24
0
{
25
0
}
26
27
void DataTablePropertiesResources::setChecksSensitive(bool bSensitive)
28
0
{
29
0
    m_xCbHorizontalBorder->set_sensitive(bSensitive);
30
0
    m_xCbVerticalBorder->set_sensitive(bSensitive);
31
0
    m_xCbOutilne->set_sensitive(bSensitive);
32
0
    m_xCbKeys->set_sensitive(bSensitive);
33
0
}
34
35
void DataTablePropertiesResources::initFromItemSet(const SfxItemSet& rInAttrs)
36
0
{
37
0
    const SfxPoolItem* pPoolItem = nullptr;
38
0
    SfxItemState aState;
39
40
0
    aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, false, &pPoolItem);
41
0
    if (aState == SfxItemState::INVALID)
42
0
    {
43
0
        m_xCbHorizontalBorder->set_state(TRISTATE_INDET);
44
0
    }
45
0
    else
46
0
    {
47
0
        if (aState == SfxItemState::SET)
48
0
            m_xCbHorizontalBorder->set_active(
49
0
                pPoolItem->StaticWhichCast(SCHATTR_DATA_TABLE_HORIZONTAL_BORDER).GetValue());
50
0
    }
51
52
0
    aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_VERTICAL_BORDER, false, &pPoolItem);
53
0
    if (aState == SfxItemState::INVALID)
54
0
    {
55
0
        m_xCbVerticalBorder->set_state(TRISTATE_INDET);
56
0
    }
57
0
    else
58
0
    {
59
0
        if (aState == SfxItemState::SET)
60
0
            m_xCbVerticalBorder->set_active(
61
0
                pPoolItem->StaticWhichCast(SCHATTR_DATA_TABLE_VERTICAL_BORDER).GetValue());
62
0
    }
63
64
0
    aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_OUTLINE, false, &pPoolItem);
65
0
    if (aState == SfxItemState::INVALID)
66
0
    {
67
0
        m_xCbOutilne->set_state(TRISTATE_INDET);
68
0
    }
69
0
    else
70
0
    {
71
0
        if (aState == SfxItemState::SET)
72
0
            m_xCbOutilne->set_active(
73
0
                pPoolItem->StaticWhichCast(SCHATTR_DATA_TABLE_OUTLINE).GetValue());
74
0
    }
75
76
0
    aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_KEYS, false, &pPoolItem);
77
0
    if (aState == SfxItemState::INVALID)
78
0
    {
79
0
        m_xCbKeys->set_state(TRISTATE_INDET);
80
0
    }
81
0
    else
82
0
    {
83
0
        if (aState == SfxItemState::SET)
84
0
            m_xCbKeys->set_active(pPoolItem->StaticWhichCast(SCHATTR_DATA_TABLE_KEYS).GetValue());
85
0
    }
86
0
}
87
88
bool DataTablePropertiesResources::writeToItemSet(SfxItemSet& rOutAttrs) const
89
0
{
90
0
    if (m_xCbHorizontalBorder->get_state() != TRISTATE_INDET)
91
0
    {
92
0
        rOutAttrs.Put(
93
0
            SfxBoolItem(SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, m_xCbHorizontalBorder->get_active()));
94
0
    }
95
0
    if (m_xCbVerticalBorder->get_state() != TRISTATE_INDET)
96
0
    {
97
0
        rOutAttrs.Put(
98
0
            SfxBoolItem(SCHATTR_DATA_TABLE_VERTICAL_BORDER, m_xCbVerticalBorder->get_active()));
99
0
    }
100
0
    if (m_xCbOutilne->get_state() != TRISTATE_INDET)
101
0
    {
102
0
        rOutAttrs.Put(SfxBoolItem(SCHATTR_DATA_TABLE_OUTLINE, m_xCbOutilne->get_active()));
103
0
    }
104
0
    if (m_xCbKeys->get_state() != TRISTATE_INDET)
105
0
    {
106
0
        rOutAttrs.Put(SfxBoolItem(SCHATTR_DATA_TABLE_KEYS, m_xCbKeys->get_active()));
107
0
    }
108
0
    return true;
109
0
}
110
111
} //namespace chart
112
113
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */