Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / uibase / inc / translatelangselect.hxx
blobbd1c8c85e6f08e524868e985ebefb31a02991bbe
2 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 /*
4 * This file is part of the LibreOffice project.
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 * This file incorporates work covered by the following license notice:
12 * Licensed to the Apache Software Foundation (ASF) under one or more
13 * contributor license agreements. See the NOTICE file distributed
14 * with this work for additional information regarding copyright
15 * ownership. The ASF licenses this file to you under the Apache
16 * License, Version 2.0 (the "License"); you may not use this file
17 * except in compliance with the License. You may obtain a copy of
18 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
21 #include <vcl/weld.hxx>
22 #include <rtl/string.h>
23 #include <vector>
24 #include <optional>
25 #include "translatehelper.hxx"
27 class SwWrtShell;
29 // SwLanguageListItem Helper class for displaying available languages with their names and tags on the listbox.
30 class SwLanguageListItem final
32 public:
33 SwLanguageListItem(const OString& sLanguage, const OString& sName)
34 : m_sLanguage(sLanguage)
35 , m_sName(sName)
38 const OString& getLanguage() const { return m_sLanguage; }
39 const OString& getName() const { return m_sName; }
41 private:
42 const OString m_sLanguage;
43 const OString m_sName;
46 // SwTranslateLangSelectDlg Language selection dialog for translation API.
47 class SwTranslateLangSelectDlg final : public weld::GenericDialogController
49 public:
50 static int selectedLangIdx;
51 SwTranslateLangSelectDlg(weld::Window* pParent, SwWrtShell& rSh);
52 static std::optional<SwLanguageListItem> GetSelectedLanguage();
54 private:
55 SwWrtShell& m_rWrtSh;
56 std::unique_ptr<weld::ComboBox> m_xLanguageListBox;
57 std::unique_ptr<weld::Button> m_xBtnCancel;
58 std::unique_ptr<weld::Button> m_xBtnTranslate;
60 bool m_bTranslationStarted;
61 bool m_bCancelTranslation;
63 DECL_STATIC_LINK(SwTranslateLangSelectDlg, LangSelectHdl, weld::ComboBox&, void);
64 DECL_LINK(LangSelectCancelHdl, weld::Button&, void);
65 DECL_LINK(LangSelectTranslateHdl, weld::Button&, void);
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */