/src/libreoffice/chart2/source/controller/dialogs/res_Titles.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 <res_Titles.hxx> |
21 | | #include <TitleDialogData.hxx> |
22 | | #include <vcl/weld/Builder.hxx> |
23 | | #include <vcl/weld/Entry.hxx> |
24 | | #include <vcl/weld/weld.hxx> |
25 | | |
26 | | namespace chart |
27 | | { |
28 | | TitleResources::TitleResources(weld::Builder& rBuilder, bool bShowSecondaryAxesTitle) |
29 | 0 | : m_xFT_Main(rBuilder.weld_label(u"labelMainTitle"_ustr)) |
30 | 0 | , m_xFT_Sub(rBuilder.weld_label(u"labelSubTitle"_ustr)) |
31 | 0 | , m_xEd_Main(rBuilder.weld_entry(u"maintitle"_ustr)) |
32 | 0 | , m_xEd_Sub(rBuilder.weld_entry(u"subtitle"_ustr)) |
33 | 0 | , m_xFT_XAxis(rBuilder.weld_label(u"labelPrimaryXaxis"_ustr)) |
34 | 0 | , m_xFT_YAxis(rBuilder.weld_label(u"labelPrimaryYaxis"_ustr)) |
35 | 0 | , m_xFT_ZAxis(rBuilder.weld_label(u"labelPrimaryZaxis"_ustr)) |
36 | 0 | , m_xEd_XAxis(rBuilder.weld_entry(u"primaryXaxis"_ustr)) |
37 | 0 | , m_xEd_YAxis(rBuilder.weld_entry(u"primaryYaxis"_ustr)) |
38 | 0 | , m_xEd_ZAxis(rBuilder.weld_entry(u"primaryZaxis"_ustr)) |
39 | 0 | , m_xFT_SecondaryXAxis(rBuilder.weld_label(u"labelSecondaryXAxis"_ustr)) |
40 | 0 | , m_xFT_SecondaryYAxis(rBuilder.weld_label(u"labelSecondaryYAxis"_ustr)) |
41 | 0 | , m_xEd_SecondaryXAxis(rBuilder.weld_entry(u"secondaryXaxis"_ustr)) |
42 | 0 | , m_xEd_SecondaryYAxis(rBuilder.weld_entry(u"secondaryYaxis"_ustr)) |
43 | 0 | { |
44 | 0 | m_xFT_SecondaryXAxis->set_visible(bShowSecondaryAxesTitle); |
45 | 0 | m_xFT_SecondaryYAxis->set_visible(bShowSecondaryAxesTitle); |
46 | 0 | m_xEd_SecondaryXAxis->set_visible(bShowSecondaryAxesTitle); |
47 | 0 | m_xEd_SecondaryYAxis->set_visible(bShowSecondaryAxesTitle); |
48 | 0 | } |
49 | | |
50 | 0 | TitleResources::~TitleResources() {} |
51 | | |
52 | | void TitleResources::connect_changed(const Link<weld::Entry&, void>& rLink) |
53 | 0 | { |
54 | 0 | m_xEd_Main->connect_changed(rLink); |
55 | 0 | m_xEd_Sub->connect_changed(rLink); |
56 | 0 | m_xEd_XAxis->connect_changed(rLink); |
57 | 0 | m_xEd_YAxis->connect_changed(rLink); |
58 | 0 | m_xEd_ZAxis->connect_changed(rLink); |
59 | 0 | m_xEd_SecondaryXAxis->connect_changed(rLink); |
60 | 0 | m_xEd_SecondaryYAxis->connect_changed(rLink); |
61 | 0 | } |
62 | | |
63 | | bool TitleResources::get_value_changed_from_saved() const |
64 | 0 | { |
65 | 0 | return m_xEd_Main->get_value_changed_from_saved() || m_xEd_Sub->get_value_changed_from_saved() |
66 | 0 | || m_xEd_XAxis->get_value_changed_from_saved() |
67 | 0 | || m_xEd_YAxis->get_value_changed_from_saved() |
68 | 0 | || m_xEd_ZAxis->get_value_changed_from_saved() |
69 | 0 | || m_xEd_SecondaryXAxis->get_value_changed_from_saved() |
70 | 0 | || m_xEd_SecondaryYAxis->get_value_changed_from_saved(); |
71 | 0 | } |
72 | | |
73 | | void TitleResources::save_value() |
74 | 0 | { |
75 | 0 | m_xEd_Main->save_value(); |
76 | 0 | m_xEd_Sub->save_value(); |
77 | 0 | m_xEd_XAxis->save_value(); |
78 | 0 | m_xEd_YAxis->save_value(); |
79 | 0 | m_xEd_ZAxis->save_value(); |
80 | 0 | m_xEd_SecondaryXAxis->save_value(); |
81 | 0 | m_xEd_SecondaryYAxis->save_value(); |
82 | 0 | } |
83 | | |
84 | | void TitleResources::writeToResources(const TitleDialogData& rInput) |
85 | 0 | { |
86 | 0 | m_xFT_Main->set_sensitive(rInput.aPossibilityList[0]); |
87 | 0 | m_xFT_Sub->set_sensitive(rInput.aPossibilityList[1]); |
88 | 0 | m_xFT_XAxis->set_sensitive(rInput.aPossibilityList[2]); |
89 | 0 | m_xFT_YAxis->set_sensitive(rInput.aPossibilityList[3]); |
90 | 0 | m_xFT_ZAxis->set_sensitive(rInput.aPossibilityList[4]); |
91 | 0 | m_xFT_SecondaryXAxis->set_sensitive(rInput.aPossibilityList[5]); |
92 | 0 | m_xFT_SecondaryYAxis->set_sensitive(rInput.aPossibilityList[6]); |
93 | |
|
94 | 0 | m_xEd_Main->set_sensitive(rInput.aPossibilityList[0]); |
95 | 0 | m_xEd_Sub->set_sensitive(rInput.aPossibilityList[1]); |
96 | 0 | m_xEd_XAxis->set_sensitive(rInput.aPossibilityList[2]); |
97 | 0 | m_xEd_YAxis->set_sensitive(rInput.aPossibilityList[3]); |
98 | 0 | m_xEd_ZAxis->set_sensitive(rInput.aPossibilityList[4]); |
99 | 0 | m_xEd_SecondaryXAxis->set_sensitive(rInput.aPossibilityList[5]); |
100 | 0 | m_xEd_SecondaryYAxis->set_sensitive(rInput.aPossibilityList[6]); |
101 | |
|
102 | 0 | m_xEd_Main->set_text(rInput.aTextList[0]); |
103 | 0 | m_xEd_Sub->set_text(rInput.aTextList[1]); |
104 | 0 | m_xEd_XAxis->set_text(rInput.aTextList[2]); |
105 | 0 | m_xEd_YAxis->set_text(rInput.aTextList[3]); |
106 | 0 | m_xEd_ZAxis->set_text(rInput.aTextList[4]); |
107 | 0 | m_xEd_SecondaryXAxis->set_text(rInput.aTextList[5]); |
108 | 0 | m_xEd_SecondaryYAxis->set_text(rInput.aTextList[6]); |
109 | 0 | } |
110 | | |
111 | | void TitleResources::readFromResources(TitleDialogData& rOutput) |
112 | 0 | { |
113 | 0 | sal_Bool* pExistenceList = rOutput.aExistenceList.getArray(); |
114 | 0 | pExistenceList[0] = !m_xEd_Main->get_text().isEmpty(); |
115 | 0 | pExistenceList[1] = !m_xEd_Sub->get_text().isEmpty(); |
116 | 0 | pExistenceList[2] = !m_xEd_XAxis->get_text().isEmpty(); |
117 | 0 | pExistenceList[3] = !m_xEd_YAxis->get_text().isEmpty(); |
118 | 0 | pExistenceList[4] = !m_xEd_ZAxis->get_text().isEmpty(); |
119 | 0 | pExistenceList[5] = !m_xEd_SecondaryXAxis->get_text().isEmpty(); |
120 | 0 | pExistenceList[6] = !m_xEd_SecondaryYAxis->get_text().isEmpty(); |
121 | |
|
122 | 0 | auto pTextList = rOutput.aTextList.getArray(); |
123 | 0 | pTextList[0] = m_xEd_Main->get_text(); |
124 | 0 | pTextList[1] = m_xEd_Sub->get_text(); |
125 | 0 | pTextList[2] = m_xEd_XAxis->get_text(); |
126 | 0 | pTextList[3] = m_xEd_YAxis->get_text(); |
127 | 0 | pTextList[4] = m_xEd_ZAxis->get_text(); |
128 | 0 | pTextList[5] = m_xEd_SecondaryXAxis->get_text(); |
129 | 0 | pTextList[6] = m_xEd_SecondaryYAxis->get_text(); |
130 | 0 | } |
131 | | |
132 | | } //namespace chart |
133 | | |
134 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |