Line data Source code
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 <vcl/svapp.hxx>
24 : #include <vcl/msgbox.hxx>
25 : #include <vcl/window.hxx>
26 : #include <vcl/settings.hxx>
27 :
28 0 : ScTextImportOptionsDlg::ScTextImportOptionsDlg(vcl::Window* pParent)
29 0 : : ModalDialog(pParent, "TextImportOptionsDialog", "modules/scalc/ui/textimportoptions.ui")
30 : {
31 0 : get(m_pBtnOk, "ok");
32 0 : get(m_pRbAutomatic, "automatic");
33 0 : get(m_pRbCustom, "custom");
34 0 : get(m_pBtnConvertDate, "convertdata");
35 0 : get(m_pLbCustomLang, "lang");
36 0 : init();
37 0 : }
38 :
39 0 : ScTextImportOptionsDlg::~ScTextImportOptionsDlg()
40 : {
41 0 : disposeOnce();
42 0 : }
43 :
44 0 : void ScTextImportOptionsDlg::dispose()
45 : {
46 0 : m_pBtnOk.clear();
47 0 : m_pRbAutomatic.clear();
48 0 : m_pRbCustom.clear();
49 0 : m_pLbCustomLang.clear();
50 0 : m_pBtnConvertDate.clear();
51 0 : ModalDialog::dispose();
52 0 : }
53 :
54 :
55 0 : short ScTextImportOptionsDlg::Execute()
56 : {
57 0 : return ModalDialog::Execute();
58 : }
59 :
60 0 : LanguageType ScTextImportOptionsDlg::getLanguageType() const
61 : {
62 0 : if (m_pRbAutomatic->IsChecked())
63 0 : return LANGUAGE_SYSTEM;
64 :
65 0 : return m_pLbCustomLang->GetSelectLanguage();
66 : }
67 :
68 0 : bool ScTextImportOptionsDlg::isDateConversionSet() const
69 : {
70 0 : return m_pBtnConvertDate->IsChecked();
71 : }
72 :
73 0 : void ScTextImportOptionsDlg::init()
74 : {
75 0 : Link<> aLink = LINK( this, ScTextImportOptionsDlg, OKHdl );
76 0 : m_pBtnOk->SetClickHdl(aLink);
77 0 : aLink = LINK( this, ScTextImportOptionsDlg, RadioHdl );
78 0 : m_pRbAutomatic->SetClickHdl(aLink);
79 0 : m_pRbCustom->SetClickHdl(aLink);
80 :
81 0 : m_pRbAutomatic->Check(true);
82 :
83 0 : m_pLbCustomLang->SetLanguageList(
84 0 : SvxLanguageListFlags::ALL | SvxLanguageListFlags::ONLY_KNOWN, false, false);
85 :
86 0 : LanguageType eLang = Application::GetSettings().GetLanguageTag().getLanguageType();
87 0 : m_pLbCustomLang->SelectLanguage(eLang);
88 0 : m_pLbCustomLang->Disable();
89 0 : }
90 :
91 0 : IMPL_LINK_NOARG(ScTextImportOptionsDlg, OKHdl)
92 : {
93 0 : EndDialog(RET_OK);
94 0 : return 0;
95 : }
96 :
97 0 : IMPL_LINK( ScTextImportOptionsDlg, RadioHdl, RadioButton*, pBtn )
98 : {
99 0 : if (pBtn == m_pRbAutomatic)
100 : {
101 0 : m_pLbCustomLang->Disable();
102 : }
103 0 : else if (pBtn == m_pRbCustom)
104 : {
105 0 : m_pLbCustomLang->Enable();
106 : }
107 0 : return 0;
108 0 : }
109 :
110 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|