/src/libreoffice/sw/source/uibase/inc/translatelangselect.hxx
Line | Count | Source (jump to first uncovered line) |
1 | | |
2 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
3 | | /* |
4 | | * This file is part of the LibreOffice project. |
5 | | * |
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/. |
9 | | * |
10 | | * This file incorporates work covered by the following license notice: |
11 | | * |
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 . |
19 | | */ |
20 | | #pragma once |
21 | | #include <vcl/weld.hxx> |
22 | | #include <rtl/string.h> |
23 | | #include <vector> |
24 | | #include <optional> |
25 | | #include "translatehelper.hxx" |
26 | | |
27 | | class SwWrtShell; |
28 | | |
29 | | // SwLanguageListItem Helper class for displaying available languages with their names and tags on the listbox. |
30 | | class SwLanguageListItem final |
31 | | { |
32 | | public: |
33 | | SwLanguageListItem(const OString& sLanguage, const OString& sName) |
34 | | : m_sLanguage(sLanguage) |
35 | | , m_sName(sName) |
36 | 0 | { |
37 | 0 | } |
38 | 0 | const OString& getLanguage() const { return m_sLanguage; } |
39 | 0 | const OString& getName() const { return m_sName; } |
40 | | |
41 | | private: |
42 | | const OString m_sLanguage; |
43 | | const OString m_sName; |
44 | | }; |
45 | | |
46 | | // SwTranslateLangSelectDlg Language selection dialog for translation API. |
47 | | class SwTranslateLangSelectDlg final : public weld::GenericDialogController |
48 | | { |
49 | | public: |
50 | | static int selectedLangIdx; |
51 | | SwTranslateLangSelectDlg(weld::Window* pParent, SwWrtShell& rSh); |
52 | | static std::optional<SwLanguageListItem> GetSelectedLanguage(); |
53 | | |
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; |
59 | | |
60 | | bool m_bTranslationStarted; |
61 | | bool m_bCancelTranslation; |
62 | | |
63 | | DECL_STATIC_LINK(SwTranslateLangSelectDlg, LangSelectHdl, weld::ComboBox&, void); |
64 | | DECL_LINK(LangSelectCancelHdl, weld::Button&, void); |
65 | | DECL_LINK(LangSelectTranslateHdl, weld::Button&, void); |
66 | | }; |
67 | | |
68 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |