| 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 |
: m_xCbHorizontalBorder(rBuilder.weld_check_button(u"horizontalBorderCB"_ustr)) |
| 21 |
, m_xCbVerticalBorder(rBuilder.weld_check_button(u"verticalBorderCB"_ustr)) |
| 22 |
, m_xCbOutilne(rBuilder.weld_check_button(u"outlineCB"_ustr)) |
| 23 |
, m_xCbKeys(rBuilder.weld_check_button(u"keysCB"_ustr)) |
| 24 |
{ |
| 25 |
} |
| 26 |
|
| 27 |
void DataTablePropertiesResources::setChecksSensitive(bool bSensitive) |
| 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 |
|
| 35 |
void DataTablePropertiesResources::initFromItemSet(const SfxItemSet& rInAttrs) |
| 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::INVALID) |
| 42 |
{ |
| 43 |
m_xCbHorizontalBorder->set_state(TRISTATE_INDET); |
| 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::INVALID) |
| 54 |
{ |
| 55 |
m_xCbVerticalBorder->set_state(TRISTATE_INDET); |
| 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::INVALID) |
| 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::INVALID) |
| 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 |
|
| 86 |
bool DataTablePropertiesResources::writeToItemSet(SfxItemSet& rOutAttrs) const |
| 87 |
{ |
| 88 |
if (m_xCbHorizontalBorder->get_state() != TRISTATE_INDET) |
| 89 |
{ |
| 90 |
rOutAttrs.Put( |
| 91 |
SfxBoolItem(SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, m_xCbHorizontalBorder->get_active())); |
| 92 |
} |
| 93 |
if (m_xCbVerticalBorder->get_state() != TRISTATE_INDET) |
| 94 |
{ |
| 95 |
rOutAttrs.Put( |
| 96 |
SfxBoolItem(SCHATTR_DATA_TABLE_VERTICAL_BORDER, m_xCbVerticalBorder->get_active())); |
| 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: */ |