From 77d6f58dddcc9aba0c9262c9ebb62f56e2845838 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 14 Nov 2012 23:30:20 +0000 Subject: convert text import options to .ui Change-Id: Ice6228f0548507b0400c25f40d8aa7cb557c8088 --- sc/AllLangResTarget_sc.mk | 1 - sc/UI_scalc.mk | 1 + sc/inc/sc.hrc | 2 +- sc/inc/scabstdlg.hxx | 2 +- sc/source/ui/attrdlg/scdlgfact.cxx | 17 +-- sc/source/ui/attrdlg/scdlgfact.hxx | 2 +- sc/source/ui/dbgui/textimportoptions.cxx | 55 +++----- sc/source/ui/dbgui/textimportoptions.src | 102 -------------- sc/source/ui/inc/textimportoptions.hrc | 30 ---- sc/source/ui/inc/textimportoptions.hxx | 16 +-- sc/source/ui/unoobj/filtuno.cxx | 4 +- sc/source/ui/view/viewfun5.cxx | 4 +- sc/uiconfig/scalc/ui/textimportoptions.ui | 227 ++++++++++++++++++++++++++++++ 13 files changed, 266 insertions(+), 197 deletions(-) delete mode 100644 sc/source/ui/dbgui/textimportoptions.src delete mode 100644 sc/source/ui/inc/textimportoptions.hrc create mode 100644 sc/uiconfig/scalc/ui/textimportoptions.ui diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk index 978f2fae7f6f..50fbd82bc091 100644 --- a/sc/AllLangResTarget_sc.mk +++ b/sc/AllLangResTarget_sc.mk @@ -99,7 +99,6 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\ sc/source/ui/dbgui/pvfundlg.src \ sc/source/ui/dbgui/dapitype.src \ sc/source/ui/dbgui/imoptdlg.src \ - sc/source/ui/dbgui/textimportoptions.src \ sc/source/ui/dbgui/scendlg.src \ sc/source/ui/dbgui/outline.src \ sc/source/ui/dbgui/validate.src \ diff --git a/sc/UI_scalc.mk b/sc/UI_scalc.mk index d5696e1aa7c0..628752be8d26 100644 --- a/sc/UI_scalc.mk +++ b/sc/UI_scalc.mk @@ -11,6 +11,7 @@ $(eval $(call gb_UI_UI,modules/scalc)) $(eval $(call gb_UI_add_uifiles,modules/scalc,\ sc/uiconfig/scalc/ui/printeroptions \ + sc/uiconfig/scalc/ui/textimportoptions \ )) # vim: set noet sw=4 ts=4: diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index efec7ab11b6a..80b91142243b 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -1084,7 +1084,7 @@ #define RID_SCDLG_TABPROTECTION (SC_DIALOGS_START + 148) #define RID_SCDLG_RETYPEPASS (SC_DIALOGS_START + 150) #define RID_SCDLG_RETYPEPASS_INPUT (SC_DIALOGS_START + 151) -#define RID_SCDLG_TEXT_IMPORT_OPTIONS (SC_DIALOGS_START + 152) + #define RID_POPUP_FILTER (SC_DIALOGS_START + 153) #define RID_SCDLG_TAB_BG_COLOR (SC_DIALOGS_START + 154) #define RID_SCDLG_DATABAR (SC_DIALOGS_START + 155) diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index d09027cad4cf..a2ce65c8727b 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -336,7 +336,7 @@ public: SvStream* pInStream, int nId, ScImportAsciiCall eCall) = 0; - virtual AbstractScTextImportOptionsDlg * CreateScTextImportOptionsDlg( Window* pParent, int nId ) = 0; + virtual AbstractScTextImportOptionsDlg * CreateScTextImportOptionsDlg(Window* pParent) = 0; virtual AbstractScAutoFormatDlg * CreateScAutoFormatDlg( Window* pParent, //add for ScAutoFormatDlg ScAutoFormat* pAutoFormat, diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index a23d0edf3f8f..f0fe0d65845e 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -668,23 +668,12 @@ AbstractScImportAsciiDlg * ScAbstractDialogFactory_Impl::CreateScImportAsciiDlg } // ScImportAsciiDlg end -AbstractScTextImportOptionsDlg * ScAbstractDialogFactory_Impl::CreateScTextImportOptionsDlg( Window* pParent, int nId ) +AbstractScTextImportOptionsDlg * ScAbstractDialogFactory_Impl::CreateScTextImportOptionsDlg(Window* pParent) { - ScTextImportOptionsDlg* pDlg = NULL; - switch (nId) - { - case RID_SCDLG_TEXT_IMPORT_OPTIONS: - pDlg = new ScTextImportOptionsDlg(pParent); - break; - default: - ; - } - - return pDlg ? new AbstractScTextImportOptionsDlg_Impl(pDlg) : NULL; + ScTextImportOptionsDlg* pDlg = new ScTextImportOptionsDlg(pParent); + return new AbstractScTextImportOptionsDlg_Impl(pDlg); } - - AbstractScAutoFormatDlg * ScAbstractDialogFactory_Impl::CreateScAutoFormatDlg( Window* pParent, ScAutoFormat* pAutoFormat, const ScAutoFormatData* pSelFormatData, diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index dfbd7fd272c7..2e16c9670951 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -401,7 +401,7 @@ public: SvStream* pInStream, int nId, ScImportAsciiCall eCall); - virtual AbstractScTextImportOptionsDlg * CreateScTextImportOptionsDlg( Window* pParent, int nId ); + virtual AbstractScTextImportOptionsDlg * CreateScTextImportOptionsDlg(Window* pParent); virtual AbstractScAutoFormatDlg * CreateScAutoFormatDlg( Window* pParent, //add for ScAutoFormatDlg ScAutoFormat* pAutoFormat, diff --git a/sc/source/ui/dbgui/textimportoptions.cxx b/sc/source/ui/dbgui/textimportoptions.cxx index 122151d8d0fa..503a5e4f5c4d 100644 --- a/sc/source/ui/dbgui/textimportoptions.cxx +++ b/sc/source/ui/dbgui/textimportoptions.cxx @@ -32,27 +32,18 @@ //------------------------------------------------------------------------ #include "textimportoptions.hxx" -#include "textimportoptions.hrc" - -#include "scresid.hxx" -#include "vcl/window.hxx" -#include "vcl/msgbox.hxx" #include "vcl/svapp.hxx" +#include "vcl/msgbox.hxx" +#include "vcl/window.hxx" -ScTextImportOptionsDlg::ScTextImportOptionsDlg(Window* pParent) : - ModalDialog(pParent, ScResId(RID_SCDLG_TEXT_IMPORT_OPTIONS)), - - maBtnOk(this, ScResId(BTN_OK)), - maBtnCancel(this, ScResId(BTN_CANCEL)), - maBtnHelp(this, ScResId(BTN_HELP)), - maFlChooseLang(this, ScResId(FL_CHOOSE_LANG)), - maRbAutomatic(this, ScResId(RB_AUTOMATIC)), - maRbCustom(this, ScResId(RB_CUSTOM)), - maLbCustomLang(this, ScResId(LB_CUSTOM_LANG)), - maFlOption(this, ScResId(FL_OPTION)), - maBtnConvertDate(this, ScResId(BTN_CONVERT_DATE)) +ScTextImportOptionsDlg::ScTextImportOptionsDlg(Window* pParent) + : ModalDialog(pParent, "TextImportOptionsDialog", "modules/scalc/ui/textimportoptions.ui") { - FreeResource(); + get(m_pBtnOk, "ok"); + get(m_pRbAutomatic, "automatic"); + get(m_pRbCustom, "custom"); + get(m_pBtnConvertDate, "convertdata"); + get(m_pLbCustomLang, "lang"); init(); } @@ -67,33 +58,33 @@ short ScTextImportOptionsDlg::Execute() LanguageType ScTextImportOptionsDlg::getLanguageType() const { - if (maRbAutomatic.IsChecked()) + if (m_pRbAutomatic->IsChecked()) return LANGUAGE_SYSTEM; - return maLbCustomLang.GetSelectLanguage(); + return m_pLbCustomLang->GetSelectLanguage(); } bool ScTextImportOptionsDlg::isDateConversionSet() const { - return maBtnConvertDate.IsChecked(); + return m_pBtnConvertDate->IsChecked(); } void ScTextImportOptionsDlg::init() { Link aLink = LINK( this, ScTextImportOptionsDlg, OKHdl ); - maBtnOk.SetClickHdl(aLink); + m_pBtnOk->SetClickHdl(aLink); aLink = LINK( this, ScTextImportOptionsDlg, RadioHdl ); - maRbAutomatic.SetClickHdl(aLink); - maRbCustom.SetClickHdl(aLink); + m_pRbAutomatic->SetClickHdl(aLink); + m_pRbCustom->SetClickHdl(aLink); - maRbAutomatic.Check(true); + m_pRbAutomatic->Check(true); - maLbCustomLang.SetLanguageList( + m_pLbCustomLang->SetLanguageList( LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, false, false); LanguageType eLang = Application::GetSettings().GetLanguage(); - maLbCustomLang.SelectLanguage(eLang); - maLbCustomLang.Disable(); + m_pLbCustomLang->SelectLanguage(eLang); + m_pLbCustomLang->Disable(); } IMPL_LINK_NOARG(ScTextImportOptionsDlg, OKHdl) @@ -104,13 +95,13 @@ IMPL_LINK_NOARG(ScTextImportOptionsDlg, OKHdl) IMPL_LINK( ScTextImportOptionsDlg, RadioHdl, RadioButton*, pBtn ) { - if (pBtn == &maRbAutomatic) + if (pBtn == m_pRbAutomatic) { - maLbCustomLang.Disable(); + m_pLbCustomLang->Disable(); } - else if (pBtn == &maRbCustom) + else if (pBtn == m_pRbCustom) { - maLbCustomLang.Enable(); + m_pLbCustomLang->Enable(); } return 0; } diff --git a/sc/source/ui/dbgui/textimportoptions.src b/sc/source/ui/dbgui/textimportoptions.src deleted file mode 100644 index f09e31c6b07a..000000000000 --- a/sc/source/ui/dbgui/textimportoptions.src +++ /dev/null @@ -1,102 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "textimportoptions.hrc" - -ModalDialog RID_SCDLG_TEXT_IMPORT_OPTIONS -{ - HelpID = "sc:ModalDialog:RID_SCDLG_TEXT_IMPORT_OPTIONS"; - Text [ en-US ] = "Import Options" ; - Size = MAP_APPFONT ( 230 , 101 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - OutputSize = TRUE ; - - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 175, 6 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - DefButton = TRUE ; - }; - - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 175, 23 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - }; - - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 175, 43 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - }; - - FixedLine FL_CHOOSE_LANG - { - Pos = MAP_APPFONT( 6, 3 ) ; - Size = MAP_APPFONT( 165, 14 ) ; - - Text [ en-US ] = "Select the language to use for import" ; - }; - - RadioButton RB_AUTOMATIC - { - HelpID = "sc:RadioButton:RID_SCDLG_TEXT_IMPORT_OPTIONS:RB_AUTOMATIC"; - Pos = MAP_APPFONT( 12, 20 ) ; - Size = MAP_APPFONT( 159, 10 ) ; - TabStop = TRUE ; - - Text [ en-US ] = "Automatic" ; - }; - - RadioButton RB_CUSTOM - { - HelpID = "sc:RadioButton:RID_SCDLG_TEXT_IMPORT_OPTIONS:RB_CUSTOM"; - Pos = MAP_APPFONT( 12, 34 ) ; - Size = MAP_APPFONT( 159, 10 ) ; - TabStop = TRUE ; - - Text [ en-US ] = "Custom" ; - }; - - ListBox LB_CUSTOM_LANG - { - HelpID = "sc:ListBox:RID_SCDLG_TEXT_IMPORT_OPTIONS:LB_CUSTOM_LANG"; - Pos = MAP_APPFONT( 20, 50 ) ; - Size = MAP_APPFONT( 140, 120 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE ; - }; - - FixedLine FL_OPTION - { - Pos = MAP_APPFONT( 6, 70 ); - Size = MAP_APPFONT( 165, 14 ); - Text [ en-US ] = "Options" ; - }; - - CheckBox BTN_CONVERT_DATE - { - HelpID = "sc:CheckBox:RID_SCDLG_TEXT_IMPORT_OPTIONS:BTN_CONVERT_DATE"; - Pos = MAP_APPFONT( 12, 86 ); - Size = MAP_APPFONT( 159, 10 ); - TabStop = TRUE ; - Text [ en-US ] = "Detect special numbers (such as dates)." ; - }; -}; diff --git a/sc/source/ui/inc/textimportoptions.hrc b/sc/source/ui/inc/textimportoptions.hrc deleted file mode 100644 index ea346cdecbf0..000000000000 --- a/sc/source/ui/inc/textimportoptions.hrc +++ /dev/null @@ -1,30 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include - -#define BTN_OK 1 -#define BTN_CANCEL 2 -#define BTN_HELP 3 - -#define FL_CHOOSE_LANG 4 -#define RB_AUTOMATIC 5 -#define RB_CUSTOM 6 -#define LB_CUSTOM_LANG 7 -#define FL_OPTION 8 -#define BTN_CONVERT_DATE 9 diff --git a/sc/source/ui/inc/textimportoptions.hxx b/sc/source/ui/inc/textimportoptions.hxx index 27be357cef3e..31cdeec6a391 100644 --- a/sc/source/ui/inc/textimportoptions.hxx +++ b/sc/source/ui/inc/textimportoptions.hxx @@ -50,20 +50,14 @@ private: void init(); private: - OKButton maBtnOk; - CancelButton maBtnCancel; - HelpButton maBtnHelp; + OKButton* m_pBtnOk; - FixedLine maFlChooseLang; + RadioButton* m_pRbAutomatic; + RadioButton* m_pRbCustom; - RadioButton maRbAutomatic; - RadioButton maRbCustom; + SvxLanguageBox* m_pLbCustomLang; - SvxLanguageBox maLbCustomLang; - - FixedLine maFlOption; - - CheckBox maBtnConvertDate; + CheckBox* m_pBtnConvertDate; DECL_LINK(OKHdl, void *); diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx index 1d35a9c9048f..bd4afdd644cb 100644 --- a/sc/source/ui/unoobj/filtuno.cxx +++ b/sc/source/ui/unoobj/filtuno.cxx @@ -236,8 +236,8 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException) else { // HTML import. - ::std::auto_ptr pDlg( - pFact->CreateScTextImportOptionsDlg(NULL, RID_SCDLG_TEXT_IMPORT_OPTIONS)); + boost::scoped_ptr pDlg( + pFact->CreateScTextImportOptionsDlg(NULL)); if (pDlg->Execute() == RET_OK) { diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index be970f4250c7..820b7b9e4bc3 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -309,8 +309,8 @@ sal_Bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, // this for html pasting only, but in the future it may // make sense to do it for other data types too. ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - ::std::auto_ptr pDlg( - pFact->CreateScTextImportOptionsDlg(NULL, RID_SCDLG_TEXT_IMPORT_OPTIONS)); + boost::scoped_ptr pDlg( + pFact->CreateScTextImportOptionsDlg(NULL)); if (pDlg->Execute() == RET_OK) { diff --git a/sc/uiconfig/scalc/ui/textimportoptions.ui b/sc/uiconfig/scalc/ui/textimportoptions.ui new file mode 100644 index 000000000000..47b1be504ec4 --- /dev/null +++ b/sc/uiconfig/scalc/ui/textimportoptions.ui @@ -0,0 +1,227 @@ + + + + + False + 5 + Import Options + dialog + + + False + 2 + + + False + vertical + start + + + gtk-ok + False + True + True + True + True + True + False + True + + + False + True + 0 + + + + + gtk-cancel + False + True + True + True + False + True + + + False + True + 1 + + + + + gtk-help + False + True + True + True + False + True + + + False + True + 2 + + + + + False + True + end + 0 + + + + + True + False + vertical + 12 + + + True + False + 0 + none + + + True + False + 12 + + + True + False + 6 + 6 + + + Custom + False + True + True + False + False + 0 + True + automatic + + + 0 + 1 + 1 + 1 + + + + + Automatic + False + True + True + False + False + 0 + True + custom + + + 0 + 0 + 2 + 1 + + + + + True + False + + + 1 + 1 + 1 + 1 + + + + + + + + + True + False + Select the language to use for import + + + + + + + + False + True + 0 + + + + + True + False + 0 + none + + + True + False + 12 + + + Detect special numbers (such as dates). + False + True + True + False + False + 0 + True + + + + + + + True + False + Options + + + + + + + + False + True + 1 + + + + + True + True + 1 + + + + + + ok + cancel + help + + + -- cgit