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