2 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 #include <vcl/weld.hxx>
22 #include <rtl/string.h>
25 #include "translatehelper.hxx"
29 // SwLanguageListItem Helper class for displaying available languages with their names and tags on the listbox.
30 class SwLanguageListItem final
33 SwLanguageListItem(const OString
& sLanguage
, const OString
& sName
)
34 : m_sLanguage(sLanguage
)
38 const OString
& getLanguage() const { return m_sLanguage
; }
39 const OString
& getName() const { return m_sName
; }
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
50 static int selectedLangIdx
;
51 SwTranslateLangSelectDlg(weld::Window
* pParent
, SwWrtShell
& rSh
);
52 static std::optional
<SwLanguageListItem
> GetSelectedLanguage();
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: */