Debian Codegraph @

chart2/source/controller/dialogs/tp_LegendPosition.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_LegendPosition.hxx"
21 #include <res_LegendPosition.hxx>
22 #include <TextDirectionListBox.hxx>
23 #include <chartview/ChartSfxItemIds.hxx>
24 #include <editeng/eeitem.hxx>
25 #include <editeng/frmdiritem.hxx>
26
27 namespace chart
28 {
29
30 SchLegendPosTabPage::SchLegendPosTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs)
31 : SfxTabPage(pPage, pController, u"modules/schart/ui/tp_LegendPosition.ui"_ustr, u"tp_LegendPosition"_ustr, &rInAttrs)
32 , m_aLegendPositionResources(*m_xBuilder)
33 , m_aLbTextDirection(m_xBuilder->weld_combo_box(u"LB_LEGEND_TEXTDIR"_ustr))
34 , m_xCBLegendNoOverlay(m_xBuilder->weld_check_button(u"CB_NO_OVERLAY"_ustr))
35 {
36 }
37
38 SchLegendPosTabPage::~SchLegendPosTabPage()
39 {
40 }
41
42 std::unique_ptr<SfxTabPage> SchLegendPosTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rOutAttrs)
43 {
44 return std::make_unique<SchLegendPosTabPage>(pPage, pController, *rOutAttrs);
45 }
46
47 bool SchLegendPosTabPage::FillItemSet(SfxItemSet* rOutAttrs)
48 {
49 m_aLegendPositionResources.writeToItemSet(*rOutAttrs);
50
51 if (m_aLbTextDirection.get_active() != -1)
52 rOutAttrs->Put(SvxFrameDirectionItem(m_aLbTextDirection.get_active_id(), EE_PARA_WRITINGDIR));
53
54 if (m_xCBLegendNoOverlay->get_visible())
55 rOutAttrs->Put(SfxBoolItem(SCHATTR_LEGEND_NO_OVERLAY, m_xCBLegendNoOverlay->get_active()));
56
57 return true;
58 }
59
60 void SchLegendPosTabPage::Reset(const SfxItemSet* rInAttrs)
61 {
62 m_aLegendPositionResources.initFromItemSet(*rInAttrs);
63
64 if( const SvxFrameDirectionItem* pDirectionItem = rInAttrs->GetItemIfSet( EE_PARA_WRITINGDIR ) )
65 m_aLbTextDirection.set_active_id( pDirectionItem->GetValue() );
66
67 if (const SfxBoolItem* pNoOverlayItem = rInAttrs->GetItemIfSet(SCHATTR_LEGEND_NO_OVERLAY))
68 {
69 bool bVal = pNoOverlayItem->GetValue();
70 m_xCBLegendNoOverlay->set_active(bVal);
71 }
72 }
73
74 } //namespace chart
75
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */