LibreOffice Module chart2 (master) 1
res_DataTableProperties.cxx
Go to the documentation of this file.
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
11
13#include <svl/eitem.hxx>
14
15using namespace css;
16
17namespace chart
18{
20 : m_xCbHorizontalBorder(rBuilder.weld_check_button("horizontalBorderCB"))
21 , m_xCbVerticalBorder(rBuilder.weld_check_button("verticalBorderCB"))
22 , m_xCbOutilne(rBuilder.weld_check_button("outlineCB"))
23 , m_xCbKeys(rBuilder.weld_check_button("keysCB"))
24{
25}
26
28{
29 m_xCbHorizontalBorder->set_sensitive(bSensitive);
30 m_xCbVerticalBorder->set_sensitive(bSensitive);
31 m_xCbOutilne->set_sensitive(bSensitive);
32 m_xCbKeys->set_sensitive(bSensitive);
33}
34
36{
37 const SfxPoolItem* pPoolItem = nullptr;
38 SfxItemState aState;
39
40 aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, false, &pPoolItem);
41 if (aState == SfxItemState::DONTCARE)
42 {
44 }
45 else
46 {
47 if (aState == SfxItemState::SET)
48 m_xCbHorizontalBorder->set_active(
49 static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
50 }
51
52 aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_VERTICAL_BORDER, false, &pPoolItem);
53 if (aState == SfxItemState::DONTCARE)
54 {
56 }
57 else
58 {
59 if (aState == SfxItemState::SET)
60 m_xCbVerticalBorder->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
61 }
62
63 aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_OUTLINE, false, &pPoolItem);
64 if (aState == SfxItemState::DONTCARE)
65 {
66 m_xCbOutilne->set_state(TRISTATE_INDET);
67 }
68 else
69 {
70 if (aState == SfxItemState::SET)
71 m_xCbOutilne->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
72 }
73
74 aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_KEYS, false, &pPoolItem);
75 if (aState == SfxItemState::DONTCARE)
76 {
77 m_xCbKeys->set_state(TRISTATE_INDET);
78 }
79 else
80 {
81 if (aState == SfxItemState::SET)
82 m_xCbKeys->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
83 }
84}
85
87{
88 if (m_xCbHorizontalBorder->get_state() != TRISTATE_INDET)
89 {
90 rOutAttrs.Put(
92 }
93 if (m_xCbVerticalBorder->get_state() != TRISTATE_INDET)
94 {
95 rOutAttrs.Put(
97 }
98 if (m_xCbOutilne->get_state() != TRISTATE_INDET)
99 {
100 rOutAttrs.Put(SfxBoolItem(SCHATTR_DATA_TABLE_OUTLINE, m_xCbOutilne->get_active()));
101 }
102 if (m_xCbKeys->get_state() != TRISTATE_INDET)
103 {
104 rOutAttrs.Put(SfxBoolItem(SCHATTR_DATA_TABLE_KEYS, m_xCbKeys->get_active()));
105 }
106 return true;
107}
108
109} //namespace chart
110
111/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr TypedWhichId< SfxBoolItem > SCHATTR_DATA_TABLE_OUTLINE(SCHATTR_DATA_TABLE_START+2)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_DATA_TABLE_HORIZONTAL_BORDER(SCHATTR_DATA_TABLE_START+0)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_DATA_TABLE_KEYS(SCHATTR_DATA_TABLE_START+3)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_DATA_TABLE_VERTICAL_BORDER(SCHATTR_DATA_TABLE_START+1)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
std::unique_ptr< weld::CheckButton > m_xCbOutilne
std::unique_ptr< weld::CheckButton > m_xCbHorizontalBorder
std::unique_ptr< weld::CheckButton > m_xCbVerticalBorder
bool writeToItemSet(SfxItemSet &rOutAttrs) const
DataTablePropertiesResources(weld::Builder &rBuilder)
std::unique_ptr< weld::CheckButton > m_xCbKeys
void initFromItemSet(SfxItemSet const &rInAttrs)
TRISTATE_INDET
const char GetValue[]
SfxItemState