1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #undef SC_DLLIMPLEMENTATION
22 #include "textimportoptions.hxx"
23 #include <vcl/svapp.hxx>
24 #include <vcl/msgbox.hxx>
25 #include <vcl/window.hxx>
26 #include <vcl/settings.hxx>
28 ScTextImportOptionsDlg::ScTextImportOptionsDlg(vcl::Window
* pParent
)
29 : ModalDialog(pParent
, "TextImportOptionsDialog", "modules/scalc/ui/textimportoptions.ui")
32 get(m_pRbAutomatic
, "automatic");
33 get(m_pRbCustom
, "custom");
34 get(m_pBtnConvertDate
, "convertdata");
35 get(m_pLbCustomLang
, "lang");
39 ScTextImportOptionsDlg::~ScTextImportOptionsDlg()
44 void ScTextImportOptionsDlg::dispose()
47 m_pRbAutomatic
.clear();
49 m_pLbCustomLang
.clear();
50 m_pBtnConvertDate
.clear();
51 ModalDialog::dispose();
55 short ScTextImportOptionsDlg::Execute()
57 return ModalDialog::Execute();
60 LanguageType
ScTextImportOptionsDlg::getLanguageType() const
62 if (m_pRbAutomatic
->IsChecked())
63 return LANGUAGE_SYSTEM
;
65 return m_pLbCustomLang
->GetSelectLanguage();
68 bool ScTextImportOptionsDlg::isDateConversionSet() const
70 return m_pBtnConvertDate
->IsChecked();
73 void ScTextImportOptionsDlg::init()
75 Link
<> aLink
= LINK( this, ScTextImportOptionsDlg
, OKHdl
);
76 m_pBtnOk
->SetClickHdl(aLink
);
77 aLink
= LINK( this, ScTextImportOptionsDlg
, RadioHdl
);
78 m_pRbAutomatic
->SetClickHdl(aLink
);
79 m_pRbCustom
->SetClickHdl(aLink
);
81 m_pRbAutomatic
->Check(true);
83 m_pLbCustomLang
->SetLanguageList(
84 SvxLanguageListFlags::ALL
| SvxLanguageListFlags::ONLY_KNOWN
, false, false);
86 LanguageType eLang
= Application::GetSettings().GetLanguageTag().getLanguageType();
87 m_pLbCustomLang
->SelectLanguage(eLang
);
88 m_pLbCustomLang
->Disable();
91 IMPL_LINK_NOARG(ScTextImportOptionsDlg
, OKHdl
)
97 IMPL_LINK( ScTextImportOptionsDlg
, RadioHdl
, RadioButton
*, pBtn
)
99 if (pBtn
== m_pRbAutomatic
)
101 m_pLbCustomLang
->Disable();
103 else if (pBtn
== m_pRbCustom
)
105 m_pLbCustomLang
->Enable();
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */