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 .
21 #undef SC_DLLIMPLEMENTATION
23 //------------------------------------------------------------------------
25 #include "textimportoptions.hxx"
26 #include "vcl/svapp.hxx"
27 #include "vcl/msgbox.hxx"
28 #include "vcl/window.hxx"
30 ScTextImportOptionsDlg::ScTextImportOptionsDlg(Window
* pParent
)
31 : ModalDialog(pParent
, "TextImportOptionsDialog", "modules/scalc/ui/textimportoptions.ui")
34 get(m_pRbAutomatic
, "automatic");
35 get(m_pRbCustom
, "custom");
36 get(m_pBtnConvertDate
, "convertdata");
37 get(m_pLbCustomLang
, "lang");
41 ScTextImportOptionsDlg::~ScTextImportOptionsDlg()
45 short ScTextImportOptionsDlg::Execute()
47 return ModalDialog::Execute();
50 LanguageType
ScTextImportOptionsDlg::getLanguageType() const
52 if (m_pRbAutomatic
->IsChecked())
53 return LANGUAGE_SYSTEM
;
55 return m_pLbCustomLang
->GetSelectLanguage();
58 bool ScTextImportOptionsDlg::isDateConversionSet() const
60 return m_pBtnConvertDate
->IsChecked();
63 void ScTextImportOptionsDlg::init()
65 Link aLink
= LINK( this, ScTextImportOptionsDlg
, OKHdl
);
66 m_pBtnOk
->SetClickHdl(aLink
);
67 aLink
= LINK( this, ScTextImportOptionsDlg
, RadioHdl
);
68 m_pRbAutomatic
->SetClickHdl(aLink
);
69 m_pRbCustom
->SetClickHdl(aLink
);
71 m_pRbAutomatic
->Check(true);
73 m_pLbCustomLang
->SetLanguageList(
74 LANG_LIST_ALL
| LANG_LIST_ONLY_KNOWN
, false, false);
76 LanguageType eLang
= Application::GetSettings().GetLanguageTag().getLanguageType();
77 m_pLbCustomLang
->SelectLanguage(eLang
);
78 m_pLbCustomLang
->Disable();
81 IMPL_LINK_NOARG(ScTextImportOptionsDlg
, OKHdl
)
87 IMPL_LINK( ScTextImportOptionsDlg
, RadioHdl
, RadioButton
*, pBtn
)
89 if (pBtn
== m_pRbAutomatic
)
91 m_pLbCustomLang
->Disable();
93 else if (pBtn
== m_pRbCustom
)
95 m_pLbCustomLang
->Enable();
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */