Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / cui / source / options / opthtml.cxx
blob18e3beceb8efcf8c0056898e9e74f0d4019a0588
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <svtools/langtab.hxx>
21 #include <svtools/htmlcfg.hxx>
22 #include <comphelper/configuration.hxx>
23 #include <officecfg/Office/Common.hxx>
24 #include "opthtml.hxx"
27 OfaHtmlTabPage::OfaHtmlTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
28 : SfxTabPage(pPage, pController, "cui/ui/opthtmlpage.ui", "OptHtmlPage", &rSet)
29 , m_xSize1NF(m_xBuilder->weld_spin_button("size1"))
30 , m_xSize2NF(m_xBuilder->weld_spin_button("size2"))
31 , m_xSize3NF(m_xBuilder->weld_spin_button("size3"))
32 , m_xSize4NF(m_xBuilder->weld_spin_button("size4"))
33 , m_xSize5NF(m_xBuilder->weld_spin_button("size5"))
34 , m_xSize6NF(m_xBuilder->weld_spin_button("size6"))
35 , m_xSize7NF(m_xBuilder->weld_spin_button("size7"))
36 , m_xNumbersEnglishUSCB(m_xBuilder->weld_check_button("numbersenglishus"))
37 , m_xUnknownTagCB(m_xBuilder->weld_check_button("unknowntag"))
38 , m_xIgnoreFontNamesCB(m_xBuilder->weld_check_button("ignorefontnames"))
39 , m_xStarBasicCB(m_xBuilder->weld_check_button("starbasic"))
40 , m_xStarBasicWarningCB(m_xBuilder->weld_check_button("starbasicwarning"))
41 , m_xPrintExtensionCB(m_xBuilder->weld_check_button("printextension"))
42 , m_xSaveGrfLocalCB(m_xBuilder->weld_check_button("savegrflocal"))
44 // replace placeholder with UI string from language list
45 OUString aText(m_xNumbersEnglishUSCB->get_label());
46 OUString aPlaceholder("%ENGLISHUSLOCALE");
47 sal_Int32 nPos;
48 if ((nPos = aText.indexOf( aPlaceholder)) != -1)
50 const OUString& rStr = SvtLanguageTable::GetLanguageString( LANGUAGE_ENGLISH_US);
51 if (!rStr.isEmpty())
53 aText = aText.replaceAt( nPos, aPlaceholder.getLength(), rStr);
54 m_xNumbersEnglishUSCB->set_label( aText);
58 m_xStarBasicCB->connect_toggled(LINK(this, OfaHtmlTabPage, CheckBoxHdl_Impl));
61 OfaHtmlTabPage::~OfaHtmlTabPage()
65 std::unique_ptr<SfxTabPage> OfaHtmlTabPage::Create( weld::Container* pPage, weld::DialogController* pController,
66 const SfxItemSet* rAttrSet )
68 return std::make_unique<OfaHtmlTabPage>(pPage, pController, *rAttrSet);
71 bool OfaHtmlTabPage::FillItemSet( SfxItemSet* )
73 std::shared_ptr<comphelper::ConfigurationChanges> xChanges = comphelper::ConfigurationChanges::create();
74 if(m_xSize1NF->get_value_changed_from_saved())
75 officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_1::set(
76 static_cast<sal_uInt16>(m_xSize1NF->get_value()), xChanges);
77 if(m_xSize2NF->get_value_changed_from_saved())
78 officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_2::set(
79 static_cast<sal_uInt16>(m_xSize2NF->get_value()), xChanges);
80 if(m_xSize3NF->get_value_changed_from_saved())
81 officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_3::set(
82 static_cast<sal_uInt16>(m_xSize3NF->get_value()), xChanges);
83 if(m_xSize4NF->get_value_changed_from_saved())
84 officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_4::set(
85 static_cast<sal_uInt16>(m_xSize4NF->get_value()), xChanges);
86 if(m_xSize5NF->get_value_changed_from_saved())
87 officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_5::set(
88 static_cast<sal_uInt16>(m_xSize5NF->get_value()), xChanges);
89 if(m_xSize6NF->get_value_changed_from_saved())
90 officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_6::set(
91 static_cast<sal_uInt16>(m_xSize6NF->get_value()), xChanges);
92 if(m_xSize7NF->get_value_changed_from_saved())
93 officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_7::set(
94 static_cast<sal_uInt16>(m_xSize7NF->get_value()), xChanges);
96 if(m_xNumbersEnglishUSCB->get_state_changed_from_saved())
97 officecfg::Office::Common::Filter::HTML::Import::NumbersEnglishUS::set(
98 m_xNumbersEnglishUSCB->get_active(), xChanges);
100 if(m_xUnknownTagCB->get_state_changed_from_saved())
101 officecfg::Office::Common::Filter::HTML::Import::UnknownTag::set(
102 m_xUnknownTagCB->get_active(), xChanges);
104 if(m_xIgnoreFontNamesCB->get_state_changed_from_saved())
105 officecfg::Office::Common::Filter::HTML::Import::FontSetting::set(
106 m_xIgnoreFontNamesCB->get_active(), xChanges);
108 if(m_xStarBasicCB->get_state_changed_from_saved())
109 officecfg::Office::Common::Filter::HTML::Export::Basic::set(
110 m_xStarBasicCB->get_active(), xChanges);
112 if(m_xStarBasicWarningCB->get_state_changed_from_saved())
113 officecfg::Office::Common::Filter::HTML::Export::Warning::set(
114 m_xStarBasicWarningCB->get_active(), xChanges);
116 if(m_xSaveGrfLocalCB->get_state_changed_from_saved())
117 officecfg::Office::Common::Filter::HTML::Export::LocalGraphic::set(
118 m_xSaveGrfLocalCB->get_active(), xChanges);
120 if(m_xPrintExtensionCB->get_state_changed_from_saved())
121 officecfg::Office::Common::Filter::HTML::Export::PrintLayout::set(
122 m_xPrintExtensionCB->get_active(), xChanges);
124 xChanges->commit();
125 return false;
128 void OfaHtmlTabPage::Reset( const SfxItemSet* )
130 m_xSize1NF->set_value(officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_1::get());
131 m_xSize2NF->set_value(officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_2::get());
132 m_xSize3NF->set_value(officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_3::get());
133 m_xSize4NF->set_value(officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_4::get());
134 m_xSize5NF->set_value(officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_5::get());
135 m_xSize6NF->set_value(officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_6::get());
136 m_xSize7NF->set_value(officecfg::Office::Common::Filter::HTML::Import::FontSize::Size_7::get());
137 m_xNumbersEnglishUSCB->set_active(officecfg::Office::Common::Filter::HTML::Import::NumbersEnglishUS::get());
138 m_xUnknownTagCB->set_active(officecfg::Office::Common::Filter::HTML::Import::UnknownTag::get());
139 m_xIgnoreFontNamesCB->set_active(officecfg::Office::Common::Filter::HTML::Import::FontSetting::get());
141 m_xStarBasicCB->set_active(officecfg::Office::Common::Filter::HTML::Export::Basic::get());
142 m_xStarBasicWarningCB->set_active(officecfg::Office::Common::Filter::HTML::Export::Warning::get());
143 m_xStarBasicWarningCB->set_sensitive(!m_xStarBasicCB->get_active());
144 m_xSaveGrfLocalCB->set_active(officecfg::Office::Common::Filter::HTML::Export::LocalGraphic::get());
145 m_xPrintExtensionCB->set_active(SvxHtmlOptions::IsPrintLayoutExtension());
147 m_xPrintExtensionCB->save_state();
148 m_xStarBasicCB->save_state();
149 m_xStarBasicWarningCB->save_state();
150 m_xSaveGrfLocalCB->save_state();
151 m_xSize1NF->save_value();
152 m_xSize2NF->save_value();
153 m_xSize3NF->save_value();
154 m_xSize4NF->save_value();
155 m_xSize5NF->save_value();
156 m_xSize6NF->save_value();
157 m_xSize7NF->save_value();
158 m_xNumbersEnglishUSCB->save_state();
159 m_xUnknownTagCB->save_state();
160 m_xIgnoreFontNamesCB->save_state();
163 IMPL_LINK(OfaHtmlTabPage, CheckBoxHdl_Impl, weld::Toggleable&, rBox, void)
165 m_xStarBasicWarningCB->set_sensitive(!rBox.get_active());
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */