Debian Codegraph @

chart2/source/controller/dialogs/tp_DataPointOption.cxx

raw
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 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20 #include "tp_DataPointOption.hxx"
21
22 #include <chartview/ChartSfxItemIds.hxx>
23 #include <svl/eitem.hxx>
24
25 namespace chart
26 {
27 DataPointOptionTabPage::DataPointOptionTabPage(weld::Container* pPage,
28 weld::DialogController* pController,
29 const SfxItemSet& rInAttrs)
30 : SfxTabPage(pPage, pController, u"modules/schart/ui/tp_DataPointOption.ui"_ustr,
31 u"tp_DataPointOption"_ustr, &rInAttrs)
32 , m_xCBHideLegendEntry(m_xBuilder->weld_check_button(u"CB_LEGEND_ENTRY_HIDDEN"_ustr))
33 {
34 }
35
36 DataPointOptionTabPage::~DataPointOptionTabPage() {}
37
38 std::unique_ptr<SfxTabPage> DataPointOptionTabPage::Create(weld::Container* pPage,
39 weld::DialogController* pController,
40 const SfxItemSet* rOutAttrs)
41 {
42 return std::make_unique<DataPointOptionTabPage>(pPage, pController, *rOutAttrs);
43 }
44
45 bool DataPointOptionTabPage::FillItemSet(SfxItemSet* rOutAttrs)
46 {
47 if (m_xCBHideLegendEntry->get_visible())
48 rOutAttrs->Put(
49 SfxBoolItem(SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY, m_xCBHideLegendEntry->get_active()));
50
51 return true;
52 }
53
54 void DataPointOptionTabPage::Reset(const SfxItemSet* rInAttrs)
55 {
56 if (const SfxBoolItem* pEntryItem
57 = rInAttrs->GetItemIfSet(SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY))
58 {
59 bool bVal = pEntryItem->GetValue();
60 m_xCBHideLegendEntry->set_active(bVal);
61 }
62 }
63
64 } //namespace chart
65
66 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */