LibreOffice Module cui (master) 1
opthtml.cxx
Go to the documentation of this file.
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 <svtools/langtab.hxx>
21#include <svtools/htmlcfg.hxx>
23#include <officecfg/Office/Common.hxx>
24#include "opthtml.hxx"
25
26
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"))
43{
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)
49 {
51 if (!rStr.isEmpty())
52 {
53 aText = aText.replaceAt( nPos, aPlaceholder.getLength(), rStr);
54 m_xNumbersEnglishUSCB->set_label( aText);
55 }
56 }
57
58 m_xStarBasicCB->connect_toggled(LINK(this, OfaHtmlTabPage, CheckBoxHdl_Impl));
59}
60
62{
63}
64
65std::unique_ptr<SfxTabPage> OfaHtmlTabPage::Create( weld::Container* pPage, weld::DialogController* pController,
66 const SfxItemSet* rAttrSet )
67{
68 return std::make_unique<OfaHtmlTabPage>(pPage, pController, *rAttrSet);
69}
70
72{
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);
95
96 if(m_xNumbersEnglishUSCB->get_state_changed_from_saved())
97 officecfg::Office::Common::Filter::HTML::Import::NumbersEnglishUS::set(
98 m_xNumbersEnglishUSCB->get_active(), xChanges);
99
100 if(m_xUnknownTagCB->get_state_changed_from_saved())
101 officecfg::Office::Common::Filter::HTML::Import::UnknownTag::set(
102 m_xUnknownTagCB->get_active(), xChanges);
103
104 if(m_xIgnoreFontNamesCB->get_state_changed_from_saved())
105 officecfg::Office::Common::Filter::HTML::Import::FontSetting::set(
106 m_xIgnoreFontNamesCB->get_active(), xChanges);
107
108 if(m_xStarBasicCB->get_state_changed_from_saved())
109 officecfg::Office::Common::Filter::HTML::Export::Basic::set(
110 m_xStarBasicCB->get_active(), xChanges);
111
112 if(m_xStarBasicWarningCB->get_state_changed_from_saved())
113 officecfg::Office::Common::Filter::HTML::Export::Warning::set(
114 m_xStarBasicWarningCB->get_active(), xChanges);
115
116 if(m_xSaveGrfLocalCB->get_state_changed_from_saved())
117 officecfg::Office::Common::Filter::HTML::Export::LocalGraphic::set(
118 m_xSaveGrfLocalCB->get_active(), xChanges);
119
120 if(m_xPrintExtensionCB->get_state_changed_from_saved())
121 officecfg::Office::Common::Filter::HTML::Export::PrintLayout::set(
122 m_xPrintExtensionCB->get_active(), xChanges);
123
124 xChanges->commit();
125 return false;
126}
127
129{
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());
140
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());
146
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();
161}
162
163IMPL_LINK(OfaHtmlTabPage, CheckBoxHdl_Impl, weld::Toggleable&, rBox, void)
164{
165 m_xStarBasicWarningCB->set_sensitive(!rBox.get_active());
166}
167
168
169/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~OfaHtmlTabPage() override
Definition: opthtml.cxx:61
std::unique_ptr< weld::CheckButton > m_xSaveGrfLocalCB
Definition: opthtml.hxx:42
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: opthtml.cxx:65
virtual void Reset(const SfxItemSet *rSet) override
Definition: opthtml.cxx:128
std::unique_ptr< weld::CheckButton > m_xIgnoreFontNamesCB
Definition: opthtml.hxx:37
std::unique_ptr< weld::SpinButton > m_xSize7NF
Definition: opthtml.hxx:33
std::unique_ptr< weld::SpinButton > m_xSize5NF
Definition: opthtml.hxx:31
std::unique_ptr< weld::CheckButton > m_xPrintExtensionCB
Definition: opthtml.hxx:41
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: opthtml.cxx:71
std::unique_ptr< weld::SpinButton > m_xSize4NF
Definition: opthtml.hxx:30
OfaHtmlTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: opthtml.cxx:27
std::unique_ptr< weld::CheckButton > m_xUnknownTagCB
Definition: opthtml.hxx:36
std::unique_ptr< weld::CheckButton > m_xNumbersEnglishUSCB
Definition: opthtml.hxx:35
std::unique_ptr< weld::SpinButton > m_xSize6NF
Definition: opthtml.hxx:32
std::unique_ptr< weld::SpinButton > m_xSize3NF
Definition: opthtml.hxx:29
std::unique_ptr< weld::CheckButton > m_xStarBasicCB
Definition: opthtml.hxx:39
std::unique_ptr< weld::CheckButton > m_xStarBasicWarningCB
Definition: opthtml.hxx:40
std::unique_ptr< weld::SpinButton > m_xSize2NF
Definition: opthtml.hxx:28
std::unique_ptr< weld::SpinButton > m_xSize1NF
Definition: opthtml.hxx:27
static OUString GetLanguageString(const LanguageType eType)
static std::shared_ptr< ConfigurationChanges > create()
#define LANGUAGE_ENGLISH_US
sal_uInt16 nPos
bool IsPrintLayoutExtension()
IMPL_LINK(OfaHtmlTabPage, CheckBoxHdl_Impl, weld::Toggleable &, rBox, void)
Definition: opthtml.cxx:163
static SfxItemSet & rSet