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