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 : }
42 :
43 0 : short ScTextImportOptionsDlg::Execute()
44 : {
45 0 : return ModalDialog::Execute();
46 : }
47 :
48 0 : LanguageType ScTextImportOptionsDlg::getLanguageType() const
49 : {
50 0 : if (m_pRbAutomatic->IsChecked())
51 0 : return LANGUAGE_SYSTEM;
52 :
53 0 : return m_pLbCustomLang->GetSelectLanguage();
54 : }
55 :
56 0 : bool ScTextImportOptionsDlg::isDateConversionSet() const
57 : {
58 0 : return m_pBtnConvertDate->IsChecked();
59 : }
60 :
61 0 : void ScTextImportOptionsDlg::init()
62 : {
63 0 : Link aLink = LINK( this, ScTextImportOptionsDlg, OKHdl );
64 0 : m_pBtnOk->SetClickHdl(aLink);
65 0 : aLink = LINK( this, ScTextImportOptionsDlg, RadioHdl );
66 0 : m_pRbAutomatic->SetClickHdl(aLink);
67 0 : m_pRbCustom->SetClickHdl(aLink);
68 :
69 0 : m_pRbAutomatic->Check(true);
70 :
71 : m_pLbCustomLang->SetLanguageList(
72 0 : LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, false, false);
73 :
74 0 : LanguageType eLang = Application::GetSettings().GetLanguageTag().getLanguageType();
75 0 : m_pLbCustomLang->SelectLanguage(eLang);
76 0 : m_pLbCustomLang->Disable();
77 0 : }
78 :
79 0 : IMPL_LINK_NOARG(ScTextImportOptionsDlg, OKHdl)
80 : {
81 0 : EndDialog(RET_OK);
82 0 : return 0;
83 : }
84 :
85 0 : IMPL_LINK( ScTextImportOptionsDlg, RadioHdl, RadioButton*, pBtn )
86 : {
87 0 : if (pBtn == m_pRbAutomatic)
88 : {
89 0 : m_pLbCustomLang->Disable();
90 : }
91 0 : else if (pBtn == m_pRbCustom)
92 : {
93 0 : m_pLbCustomLang->Enable();
94 : }
95 0 : return 0;
96 0 : }
97 :
98 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|