LibreOffice Module svx (master) 1
chinese_translationdialog.cxx
Go to the documentation of this file.
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
23#include <com/sun/star/i18n/TextConversionOption.hpp>
24#include <unotools/lingucfg.hxx>
26
27namespace textconversiondlgs
28{
29
30using namespace ::com::sun::star;
31using namespace ::com::sun::star::uno;
32
34 : GenericDialogController(pParent, "svx/ui/chineseconversiondialog.ui", "ChineseConversionDialog")
35 , m_xBP_OK(m_xBuilder->weld_button("ok"))
36 , m_xPB_Editterms(m_xBuilder->weld_button("editterms"))
37 , m_xRB_To_Simplified(m_xBuilder->weld_radio_button("tosimplified"))
38 , m_xRB_To_Traditional(m_xBuilder->weld_radio_button("totraditional"))
39 , m_xCB_Translate_Commonterms(m_xBuilder->weld_check_button("commonterms"))
40{
41 SvtLinguConfig aLngCfg;
42 bool bValue = false;
44 aAny >>= bValue;
45 if( bValue )
46 m_xRB_To_Simplified->set_active(true);
47 else
48 m_xRB_To_Traditional->set_active(true);
49
51 if( aAny >>= bValue )
52 m_xCB_Translate_Commonterms->set_active( bValue );
53
54 m_xPB_Editterms->connect_clicked( LINK( this, ChineseTranslationDialog, DictionaryHdl ) );
55 m_xBP_OK->connect_clicked( LINK( this, ChineseTranslationDialog, OkHdl ) );
56}
57
59{
60}
61
62void ChineseTranslationDialog::getSettings( bool& rbDirectionToSimplified
63 , bool& rbTranslateCommonTerms ) const
64{
65 rbDirectionToSimplified = m_xRB_To_Simplified->get_active();
66 rbTranslateCommonTerms = m_xCB_Translate_Commonterms->get_active();
67}
68
70{
71 //save settings to configuration
72 SvtLinguConfig aLngCfg;
73 Any aAny;
74 aAny <<= m_xRB_To_Simplified->get_active();
76 aAny <<= m_xCB_Translate_Commonterms->get_active();
78
79 m_xDialog->response(RET_OK);
80}
81
83{
84 if( !m_xDictionaryDialog )
85 m_xDictionaryDialog.reset(new ChineseDictionaryDialog(m_xDialog.get()));
86 sal_Int32 nTextConversionOptions = i18n::TextConversionOption::NONE;
87 if (!m_xCB_Translate_Commonterms->get_active())
88 nTextConversionOptions = nTextConversionOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
89 m_xDictionaryDialog->setDirectionAndTextConversionOptions(m_xRB_To_Simplified->get_active(), nTextConversionOptions);
90 m_xDictionaryDialog->run();
91}
92
93
94} //end namespace
95
96
97/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XExecutableDialog > m_xDialog
css::uno::Any GetProperty(std::u16string_view rPropertyName) const
bool SetProperty(std::u16string_view rPropertyName, const css::uno::Any &rValue)
std::unique_ptr< weld::RadioButton > m_xRB_To_Simplified
void getSettings(bool &rbDirectionToSimplified, bool &rbTranslateCommonTerms) const
std::unique_ptr< weld::CheckButton > m_xCB_Translate_Commonterms
std::unique_ptr< weld::RadioButton > m_xRB_To_Traditional
constexpr OUStringLiteral UPN_IS_DIRECTION_TO_SIMPLIFIED
constexpr OUStringLiteral UPN_IS_TRANSLATE_COMMON_TERMS
IMPL_LINK_NOARG(ChineseDictionaryDialog, SizeAllocHdl, const Size &, void)
RET_OK