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