diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-03-09 17:17:41 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-03-09 19:36:57 +0000 |
commit | 9aca8e1333393af69972450d5e7e924cdfed4269 (patch) | |
tree | 5a3614031304b6c7c9d9510572ae854064d6fd0c /svtools | |
parent | 92598f5a5eed932048e060ab2ca17ffcbcca56dc (diff) |
Use officecfg instead of SvxLanguageToolOptions
Change-Id: Ia9add4ff3ebe20ba491e33de1e9a2644a48ef7a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148548
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/Library_svt.mk | 1 | ||||
-rw-r--r-- | svtools/source/config/languagetoolcfg.cxx | 211 |
2 files changed, 0 insertions, 212 deletions
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index ec2405d65636..96714fdcfea1 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -84,7 +84,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/config/extcolorcfg \ svtools/source/config/fontsubstconfig \ svtools/source/config/htmlcfg \ - svtools/source/config/languagetoolcfg \ svtools/source/config/deeplcfg \ svtools/source/config/itemholder2 \ svtools/source/config/miscopt \ diff --git a/svtools/source/config/languagetoolcfg.cxx b/svtools/source/config/languagetoolcfg.cxx deleted file mode 100644 index bc18e23980db..000000000000 --- a/svtools/source/config/languagetoolcfg.cxx +++ /dev/null @@ -1,211 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ - -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <sal/log.hxx> -#include <sal/config.h> -#include <svtools/languagetoolcfg.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <tools/debug.hxx> - -using namespace utl; -using namespace com::sun::star::uno; - -struct LanguageToolOptions_Impl -{ - OUString sBaseURL; - OUString sUsername; - OUString sApiKey; - OUString sRestProtocol; - bool bEnabled; - bool bSSLCertVerificatrionEnabled; -}; - -const Sequence<OUString>& SvxLanguageToolOptions::GetPropertyNames() -{ - static Sequence<OUString> const aNames{ - "LanguageTool/BaseURL", "LanguageTool/Username", "LanguageTool/ApiKey", - "LanguageTool/IsEnabled", "LanguageTool/SSLCertVerify", "LanguageTool/RestProtocol" - }; - return aNames; -} - -const OUString& SvxLanguageToolOptions::getBaseURL() const { return pImpl->sBaseURL; } - -void SvxLanguageToolOptions::setBaseURL(const OUString& rVal) -{ - pImpl->sBaseURL = rVal; - SetModified(); -} - -const OUString& SvxLanguageToolOptions::getUsername() const { return pImpl->sUsername; } - -void SvxLanguageToolOptions::setUsername(const OUString& rVal) -{ - pImpl->sUsername = rVal; - SetModified(); -} - -OUString SvxLanguageToolOptions::getLocaleListURL() const -{ - if (pImpl->sBaseURL.isEmpty()) - return OUString(); - return pImpl->sBaseURL + "/languages"; -} - -OUString SvxLanguageToolOptions::getCheckerURL() const -{ - if (pImpl->sBaseURL.isEmpty()) - return OUString(); - return pImpl->sBaseURL + "/check"; -} - -const OUString& SvxLanguageToolOptions::getApiKey() const { return pImpl->sApiKey; } - -const OUString& SvxLanguageToolOptions::getRestProtocol() const { return pImpl->sRestProtocol; } - -void SvxLanguageToolOptions::setApiKey(const OUString& rVal) -{ - pImpl->sApiKey = rVal; - SetModified(); -} - -void SvxLanguageToolOptions::setRestProtocol(const OUString& rVal) -{ - if (pImpl->sRestProtocol != rVal) - { - pImpl->sRestProtocol = rVal; - SetModified(); - } -} - -bool SvxLanguageToolOptions::getEnabled() const { return pImpl->bEnabled; } - -bool SvxLanguageToolOptions::getSSLVerification() const -{ - return pImpl->bSSLCertVerificatrionEnabled; -} - -void SvxLanguageToolOptions::setSSLVerification(bool bEnabled) -{ - pImpl->bSSLCertVerificatrionEnabled = bEnabled; - SetModified(); -} - -void SvxLanguageToolOptions::setEnabled(bool bEnabled) -{ - pImpl->bEnabled = bEnabled; - SetModified(); -} - -namespace -{ -class theSvxLanguageToolOptions - : public rtl::Static<SvxLanguageToolOptions, theSvxLanguageToolOptions> -{ -}; -} - -SvxLanguageToolOptions& SvxLanguageToolOptions::Get() { return theSvxLanguageToolOptions::get(); } - -SvxLanguageToolOptions::SvxLanguageToolOptions() - : ConfigItem("Office.Linguistic/GrammarChecking") - , pImpl(new LanguageToolOptions_Impl) -{ - Load(GetPropertyNames()); -} - -SvxLanguageToolOptions::~SvxLanguageToolOptions() {} -void SvxLanguageToolOptions::Notify(const css::uno::Sequence<OUString>&) -{ - Load(GetPropertyNames()); -} - -void SvxLanguageToolOptions::Load(const css::uno::Sequence<OUString>& aNames) -{ - Sequence<Any> aValues = GetProperties(aNames); - const Any* pValues = aValues.getConstArray(); - DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed"); - if (aValues.getLength() != aNames.getLength()) - return; - for (int nProp = 0; nProp < aNames.getLength(); nProp++) - { - if (!pValues[nProp].hasValue()) - continue; - switch (nProp) - { - case 0: - pValues[nProp] >>= pImpl->sBaseURL; - break; - case 1: - pValues[nProp] >>= pImpl->sUsername; - break; - case 2: - pValues[nProp] >>= pImpl->sApiKey; - break; - case 3: - pValues[nProp] >>= pImpl->bEnabled; - break; - case 4: - pValues[nProp] >>= pImpl->bSSLCertVerificatrionEnabled; - break; - case 5: - pValues[nProp] >>= pImpl->sRestProtocol; - break; - default: - break; - } - } -} - -void SvxLanguageToolOptions::ImplCommit() -{ - const Sequence<OUString>& aNames = GetPropertyNames(); - Sequence<Any> aValues(aNames.getLength()); - Any* pValues = aValues.getArray(); - for (int nProp = 0; nProp < aNames.getLength(); nProp++) - { - switch (nProp) - { - case 0: - pValues[nProp] <<= pImpl->sBaseURL; - break; - case 1: - pValues[nProp] <<= pImpl->sUsername; - break; - case 2: - pValues[nProp] <<= pImpl->sApiKey; - break; - case 3: - pValues[nProp] <<= pImpl->bEnabled; - break; - case 4: - pValues[nProp] <<= pImpl->bSSLCertVerificatrionEnabled; - break; - case 5: - pValues[nProp] <<= pImpl->sRestProtocol; - break; - default: - break; - } - } - PutProperties(aNames, aValues); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |