LibreOffice Module cui (master) 1
optlanguagetool.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 "optlanguagetool.hxx"
22#include <sal/log.hxx>
23
25 weld::DialogController* pController,
26 const SfxItemSet& rSet)
27 : SfxTabPage(pPage, pController, "cui/ui/langtoolconfigpage.ui", "OptLangToolPage", &rSet)
28 , m_xBaseURLED(m_xBuilder->weld_entry("baseurl"))
29 , m_xUsernameED(m_xBuilder->weld_entry("username"))
30 , m_xApiKeyED(m_xBuilder->weld_entry("apikey"))
31 , m_xActivateBox(m_xBuilder->weld_check_button("activate"))
32 , m_xApiSettingsFrame(m_xBuilder->weld_frame("apisettings"))
33{
34 m_xActivateBox->connect_toggled(LINK(this, OptLanguageToolTabPage, CheckHdl));
36 EnableControls(rLanguageOpts.getEnabled());
37}
38
40
42{
44 rLanguageOpts.setEnabled(bEnable);
45 m_xApiSettingsFrame->set_visible(bEnable);
46 m_xActivateBox->set_active(bEnable);
47}
48
50{
51 EnableControls(m_xActivateBox->get_active());
52}
53
55{
57 m_xBaseURLED->set_text(rLanguageOpts.getBaseURL());
58 m_xUsernameED->set_text(rLanguageOpts.getUsername());
59 m_xApiKeyED->set_text(rLanguageOpts.getApiKey());
60}
61
63{
65 rLanguageOpts.setBaseURL(m_xBaseURLED->get_text());
66 rLanguageOpts.setUsername(m_xUsernameED->get_text());
67 rLanguageOpts.setApiKey(m_xApiKeyED->get_text());
68 return false;
69}
70
71std::unique_ptr<SfxTabPage> OptLanguageToolTabPage::Create(weld::Container* pPage,
72 weld::DialogController* pController,
73 const SfxItemSet* rAttrSet)
74{
75 return std::make_unique<OptLanguageToolTabPage>(pPage, pController, *rAttrSet);
76}
std::unique_ptr< weld::CheckButton > m_xActivateBox
virtual ~OptLanguageToolTabPage() override
std::unique_ptr< weld::Frame > m_xApiSettingsFrame
OptLanguageToolTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
std::unique_ptr< weld::Entry > m_xBaseURLED
virtual void Reset(const SfxItemSet *rSet) override
std::unique_ptr< weld::Entry > m_xUsernameED
void EnableControls(bool bEnable)
virtual bool FillItemSet(SfxItemSet *rSet) override
std::unique_ptr< weld::Entry > m_xApiKeyED
const OUString & getApiKey() const
void setApiKey(const OUString &rVal)
void setUsername(const OUString &rVal)
const OUString & getUsername() const
static SvxLanguageToolOptions & Get()
void setBaseURL(const OUString &rVal)
bool getEnabled() const
const OUString & getBaseURL() const
void setEnabled(bool enabled)
IMPL_LINK_NOARG(OptLanguageToolTabPage, CheckHdl, weld::Toggleable &, void)
static SfxItemSet & rSet