LibreOffice Module sc (master) 1
textimportoptions.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#undef SC_DLLIMPLEMENTATION
21
22#include <textimportoptions.hxx>
23#include <svx/langbox.hxx>
24#include <vcl/svapp.hxx>
25#include <vcl/settings.hxx>
27
29 : GenericDialogController(pParent, "modules/scalc/ui/textimportoptions.ui", "TextImportOptionsDialog")
30 , m_xBtnOk(m_xBuilder->weld_button("ok"))
31 , m_xRbAutomatic(m_xBuilder->weld_radio_button("automatic"))
32 , m_xRbCustom(m_xBuilder->weld_radio_button("custom"))
33 , m_xCkbConvertDate(m_xBuilder->weld_check_button("convertdata"))
34 , m_xCkbConvertScientific(m_xBuilder->weld_check_button("convertscientificnotation"))
35 , m_xCkbKeepAsking(m_xBuilder->weld_check_button("keepasking"))
36 , m_xLbCustomLang(new SvxLanguageBox(m_xBuilder->weld_combo_box("lang")))
37{
38 init();
39}
40
42{
43}
44
46{
47 if (m_xRbAutomatic->get_active())
48 return LANGUAGE_SYSTEM;
49
50 return m_xLbCustomLang->get_active_id();
51}
52
54{
55 return m_xCkbConvertDate->get_active();
56}
57
59{
60 return m_xCkbConvertScientific->get_active();
61}
62
64{
65 return m_xCkbKeepAsking->get_active();
66}
67
69{
70 m_xBtnOk->connect_clicked(LINK(this, ScTextImportOptionsDlg, OKHdl));
71 Link<weld::Toggleable&,void> aLink = LINK(this, ScTextImportOptionsDlg, RadioCheckHdl);
72 m_xRbAutomatic->connect_toggled(aLink);
73 m_xRbCustom->connect_toggled(aLink);
74 m_xCkbConvertDate->connect_toggled(aLink);
75 m_xCkbConvertScientific->connect_toggled(aLink);
76
77 m_xRbAutomatic->set_active(true);
78
79 m_xLbCustomLang->SetLanguageList(
80 SvxLanguageListFlags::ALL | SvxLanguageListFlags::ONLY_KNOWN, false);
81
83 m_xLbCustomLang->set_active_id(eLang);
84 m_xLbCustomLang->set_sensitive(false);
85}
86
88{
89 m_xDialog->response(RET_OK);
90}
91
93{
94 if (&rBtn == m_xRbAutomatic.get())
95 {
96 m_xLbCustomLang->set_sensitive(false);
97 }
98 else if (&rBtn == m_xRbCustom.get())
99 {
100 m_xLbCustomLang->set_sensitive(true);
101 }
102 else if (&rBtn == m_xCkbConvertDate.get())
103 {
104 if (m_xCkbConvertDate->get_active())
105 {
106 m_xCkbConvertScientific->set_active(true);
107 m_xCkbConvertScientific->set_sensitive(false);
108 }
109 else
110 {
111 m_xCkbConvertScientific->set_sensitive(true);
112 }
113 }
114 else if (&rBtn == m_xCkbConvertScientific.get())
115 {
116 assert( !m_xCkbConvertDate->get_active() && "ScTextImportOptionsDlg::RadioCheckHdl - scientific option disabled if Detect numbers active" );
117 }
118}
119
120/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XExecutableDialog > m_xDialog
const LanguageTag & GetLanguageTag() const
static const AllSettings & GetSettings()
LanguageType getLanguageType(bool bResolveSystem=true) const
std::unique_ptr< weld::CheckButton > m_xCkbConvertDate
virtual ~ScTextImportOptionsDlg() override
std::unique_ptr< SvxLanguageBox > m_xLbCustomLang
std::unique_ptr< weld::CheckButton > m_xCkbKeepAsking
bool isScientificConversionSet() const
ScTextImportOptionsDlg(weld::Window *pParent)
std::unique_ptr< weld::RadioButton > m_xRbAutomatic
LanguageType getLanguageType() const
std::unique_ptr< weld::Button > m_xBtnOk
std::unique_ptr< weld::CheckButton > m_xCkbConvertScientific
std::unique_ptr< weld::RadioButton > m_xRbCustom
#define LANGUAGE_SYSTEM
IMPL_LINK_NOARG(ScTextImportOptionsDlg, OKHdl, weld::Button &, void)
IMPL_LINK(ScTextImportOptionsDlg, RadioCheckHdl, weld::Toggleable &, rBtn, void)
RET_OK