Debian Codegraph @

svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx

raw
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
21 #include <svx/chinese_translation_unodialog.hxx>
22 #include "chinese_translationdialog.hxx"
23 #include <vcl/svapp.hxx>
24 #include <cppuhelper/supportsservice.hxx>
25 #include <com/sun/star/beans/PropertyValue.hpp>
26 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
27
28 namespace textconversiondlgs
29 {
30 using namespace ::com::sun::star;
31
32 ChineseTranslation_UnoDialog::ChineseTranslation_UnoDialog(const css::uno::Reference< css::awt::XWindow >& xParentWindow)
33 {
34 m_xParentWindow = xParentWindow;
35 }
36
37 ChineseTranslation_UnoDialog::~ChineseTranslation_UnoDialog()
38 {
39 SolarMutexGuard aSolarGuard;
40 impl_DeleteDialog();
41 }
42
43 void ChineseTranslation_UnoDialog::impl_DeleteDialog()
44 {
45 if (m_xDialog)
46 {
47 m_xDialog->response(RET_CANCEL);
48 m_xDialog.reset();
49 }
50 }
51
52 sal_Int16 ChineseTranslation_UnoDialog::execute()
53 {
54 sal_Int16 nRet = ui::dialogs::ExecutableDialogResults::CANCEL;
55 {
56 SolarMutexGuard aSolarGuard;
57 if (!m_xDialog)
58 m_xDialog.reset(new ChineseTranslationDialog(Application::GetFrameWeld(m_xParentWindow)));
59 nRet = m_xDialog->run();
60 if (nRet == RET_OK)
61 nRet=ui::dialogs::ExecutableDialogResults::OK;
62 }
63 return nRet;
64 }
65
66 bool ChineseTranslation_UnoDialog::getIsDirectionToSimplified()
67 {
68 bool bDirectionToSimplified = true;
69 bool bTranslateCommonTerms = false;
70
71 {
72 SolarMutexGuard aSolarGuard;
73 m_xDialog->getSettings(bDirectionToSimplified, bTranslateCommonTerms);
74 }
75 return bDirectionToSimplified;
76 }
77
78 bool ChineseTranslation_UnoDialog::getIsTranslateCommonTerms()
79 {
80 bool bDirectionToSimplified = true;
81 bool bTranslateCommonTerms = false;
82
83 {
84 SolarMutexGuard aSolarGuard;
85 m_xDialog->getSettings(bDirectionToSimplified, bTranslateCommonTerms);
86 }
87 return bTranslateCommonTerms;
88 }
89
90 } //namespace textconversiondlgs
91
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */