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