sc/inc/scabstdlg.hxx | 2 sc/qa/unit/screenshots/screenshots.cxx | 2 sc/source/ui/attrdlg/scdlgfact.cxx | 16 ++++--- sc/source/ui/attrdlg/scdlgfact.hxx | 11 ++++- sc/source/ui/dbgui/textimportoptions.cxx | 64 +++++++++++------------------- sc/source/ui/inc/textimportoptions.hxx | 28 +++++-------- sc/source/ui/unoobj/filtuno.cxx | 2 sc/source/ui/view/viewfun5.cxx | 3 - sc/uiconfig/scalc/ui/textimportoptions.ui | 21 ++++++--- 9 files changed, 74 insertions(+), 75 deletions(-)
New commits: commit c744995d7acbfd1ba06eb61c8f00d119a59d3cbf Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Feb 2 16:19:16 2019 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat Feb 2 18:20:06 2019 +0100 weld ScTextImportOptionsDlg Change-Id: If558a805e48bc7cfa57e729143588a533060a65b Reviewed-on: https://gerrit.libreoffice.org/67291 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index fa82d4550da9..8c1153fcabc1 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -398,7 +398,7 @@ public: SvStream* pInStream, ScImportAsciiCall eCall) = 0; - virtual VclPtr<AbstractScTextImportOptionsDlg> CreateScTextImportOptionsDlg() = 0; + virtual VclPtr<AbstractScTextImportOptionsDlg> CreateScTextImportOptionsDlg(weld::Window* pParent) = 0; virtual VclPtr<AbstractScAutoFormatDlg> CreateScAutoFormatDlg(vcl::Window* pParent, ScAutoFormat* pAutoFormat, diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx index 8f212bbda1e8..a036b693702c 100644 --- a/sc/qa/unit/screenshots/screenshots.cxx +++ b/sc/qa/unit/screenshots/screenshots.cxx @@ -209,7 +209,7 @@ VclPtr<VclAbstractDialog> ScScreenshotTest::createDialogByID(sal_uInt32 nID) case 10: // "modules/scalc/ui/textimportoptions.ui" { - pReturnDialog = mpFact->CreateScTextImportOptionsDlg(); + pReturnDialog = mpFact->CreateScTextImportOptionsDlg(mpViewShell->GetFrameWeld()); break; } diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 161297ab80d2..12599e6f6ca4 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -198,7 +198,12 @@ short AbstractScTabBgColorDlg_Impl::Execute() } IMPL_ABSTDLG_BASE(AbstractScImportOptionsDlg_Impl); -IMPL_ABSTDLG_BASE(AbstractScTextImportOptionsDlg_Impl); + +short AbstractScTextImportOptionsDlg_Impl::Execute() +{ + return m_xDlg->run(); +} + IMPL_ABSTDLG_BASE(ScAbstractTabDialog_Impl); AbstractScLinkedAreaDlg_Impl::~AbstractScLinkedAreaDlg_Impl() @@ -684,12 +689,12 @@ void AbstractScImportOptionsDlg_Impl::SaveImportOptions() const LanguageType AbstractScTextImportOptionsDlg_Impl::GetLanguageType() const { - return pDlg->getLanguageType(); + return m_xDlg->getLanguageType(); } bool AbstractScTextImportOptionsDlg_Impl::IsDateConversionSet() const { - return pDlg->isDateConversionSet(); + return m_xDlg->isDateConversionSet(); } short ScAbstractTabController_Impl::Execute() @@ -737,10 +742,9 @@ VclPtr<AbstractScImportAsciiDlg> ScAbstractDialogFactory_Impl::CreateScImportAsc return VclPtr<AbstractScImportAsciiDlg_Impl>::Create( pDlg ); } -VclPtr<AbstractScTextImportOptionsDlg> ScAbstractDialogFactory_Impl::CreateScTextImportOptionsDlg() +VclPtr<AbstractScTextImportOptionsDlg> ScAbstractDialogFactory_Impl::CreateScTextImportOptionsDlg(weld::Window* pParent) { - VclPtr<ScTextImportOptionsDlg> pDlg = VclPtr<ScTextImportOptionsDlg>::Create(nullptr); - return VclPtr<AbstractScTextImportOptionsDlg_Impl>::Create(pDlg); + return VclPtr<AbstractScTextImportOptionsDlg_Impl>::Create(std::make_unique<ScTextImportOptionsDlg>(pParent)); } VclPtr<AbstractScAutoFormatDlg> ScAbstractDialogFactory_Impl::CreateScAutoFormatDlg(vcl::Window* pParent, diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 8413310703f8..1519074fa28e 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -505,7 +505,14 @@ class AbstractScImportOptionsDlg_Impl : public AbstractScImportOptionsDlg class AbstractScTextImportOptionsDlg_Impl : public AbstractScTextImportOptionsDlg { - DECL_ABSTDLG_BASE( AbstractScTextImportOptionsDlg_Impl, ScTextImportOptionsDlg) +protected: + std::unique_ptr<ScTextImportOptionsDlg> m_xDlg; +public: + explicit AbstractScTextImportOptionsDlg_Impl(std::unique_ptr<ScTextImportOptionsDlg> p) + : m_xDlg(std::move(p)) + { + } + virtual short Execute() override; virtual LanguageType GetLanguageType() const override; virtual bool IsDateConversionSet() const override; }; @@ -552,7 +559,7 @@ public: SvStream* pInStream, ScImportAsciiCall eCall) override; - virtual VclPtr<AbstractScTextImportOptionsDlg> CreateScTextImportOptionsDlg() override; + virtual VclPtr<AbstractScTextImportOptionsDlg> CreateScTextImportOptionsDlg(weld::Window* pParent) override; virtual VclPtr<AbstractScAutoFormatDlg> CreateScAutoFormatDlg(vcl::Window* pParent, ScAutoFormat* pAutoFormat, diff --git a/sc/source/ui/dbgui/textimportoptions.cxx b/sc/source/ui/dbgui/textimportoptions.cxx index b0cc1a375a43..4414a132bef6 100644 --- a/sc/source/ui/dbgui/textimportoptions.cxx +++ b/sc/source/ui/dbgui/textimportoptions.cxx @@ -21,82 +21,68 @@ #include <textimportoptions.hxx> #include <vcl/svapp.hxx> -#include <vcl/window.hxx> #include <vcl/settings.hxx> #include <i18nlangtag/languagetag.hxx> -ScTextImportOptionsDlg::ScTextImportOptionsDlg(vcl::Window* pParent) - : ModalDialog(pParent, "TextImportOptionsDialog", "modules/scalc/ui/textimportoptions.ui") +ScTextImportOptionsDlg::ScTextImportOptionsDlg(weld::Window* pParent) + : GenericDialogController(pParent, "modules/scalc/ui/textimportoptions.ui", "TextImportOptionsDialog") + , m_xBtnOk(m_xBuilder->weld_button("ok")) + , m_xRbAutomatic(m_xBuilder->weld_radio_button("automatic")) + , m_xRbCustom(m_xBuilder->weld_radio_button("custom")) + , m_xBtnConvertDate(m_xBuilder->weld_check_button("convertdata")) + , m_xLbCustomLang(new LanguageBox(m_xBuilder->weld_combo_box("lang"))) { - get(m_pBtnOk, "ok"); - get(m_pRbAutomatic, "automatic"); - get(m_pRbCustom, "custom"); - get(m_pBtnConvertDate, "convertdata"); - get(m_pLbCustomLang, "lang"); init(); } ScTextImportOptionsDlg::~ScTextImportOptionsDlg() { - disposeOnce(); } -void ScTextImportOptionsDlg::dispose() -{ - m_pBtnOk.clear(); - m_pRbAutomatic.clear(); - m_pRbCustom.clear(); - m_pLbCustomLang.clear(); - m_pBtnConvertDate.clear(); - ModalDialog::dispose(); -} - - LanguageType ScTextImportOptionsDlg::getLanguageType() const { - if (m_pRbAutomatic->IsChecked()) + if (m_xRbAutomatic->get_active()) return LANGUAGE_SYSTEM; - return m_pLbCustomLang->GetSelectedLanguage(); + return m_xLbCustomLang->get_active_id(); } bool ScTextImportOptionsDlg::isDateConversionSet() const { - return m_pBtnConvertDate->IsChecked(); + return m_xBtnConvertDate->get_active(); } void ScTextImportOptionsDlg::init() { - Link<Button*,void> aLink = LINK( this, ScTextImportOptionsDlg, OKHdl ); - m_pBtnOk->SetClickHdl(aLink); - aLink = LINK( this, ScTextImportOptionsDlg, RadioHdl ); - m_pRbAutomatic->SetClickHdl(aLink); - m_pRbCustom->SetClickHdl(aLink); + m_xBtnOk->connect_clicked(LINK(this, ScTextImportOptionsDlg, OKHdl)); + Link<weld::ToggleButton&,void> aLink = LINK(this, ScTextImportOptionsDlg, RadioHdl); + m_xRbAutomatic->connect_toggled(aLink); + m_xRbCustom->connect_toggled(aLink); - m_pRbAutomatic->Check(); + m_xRbAutomatic->set_active(true); - m_pLbCustomLang->SetLanguageList( + m_xLbCustomLang->SetLanguageList( SvxLanguageListFlags::ALL | SvxLanguageListFlags::ONLY_KNOWN, false); LanguageType eLang = Application::GetSettings().GetLanguageTag().getLanguageType(); - m_pLbCustomLang->SelectLanguage(eLang); - m_pLbCustomLang->Disable(); + m_xLbCustomLang->set_active_id(eLang); + m_xLbCustomLang->set_sensitive(false); } -IMPL_LINK_NOARG(ScTextImportOptionsDlg, OKHdl, Button*, void) +IMPL_LINK_NOARG(ScTextImportOptionsDlg, OKHdl, weld::Button&, void) { - EndDialog(RET_OK); + m_xDialog->response(RET_OK); } -IMPL_LINK( ScTextImportOptionsDlg, RadioHdl, Button*, pBtn, void ) +IMPL_LINK(ScTextImportOptionsDlg, RadioHdl, weld::ToggleButton&, rBtn, void) { - if (pBtn == m_pRbAutomatic) + if (&rBtn == m_xRbAutomatic.get()) { - m_pLbCustomLang->Disable(); + m_xLbCustomLang->set_sensitive(false); } - else if (pBtn == m_pRbCustom) + else if (&rBtn == m_xRbCustom.get()) { - m_pLbCustomLang->Enable(); + m_xLbCustomLang->set_sensitive(true); } } diff --git a/sc/source/ui/inc/textimportoptions.hxx b/sc/source/ui/inc/textimportoptions.hxx index b052b4fda609..9c01e895a6cc 100644 --- a/sc/source/ui/inc/textimportoptions.hxx +++ b/sc/source/ui/inc/textimportoptions.hxx @@ -20,17 +20,15 @@ #ifndef INCLUDED_SC_SOURCE_UI_INC_TEXTIMPORTOPTIONS_HXX #define INCLUDED_SC_SOURCE_UI_INC_TEXTIMPORTOPTIONS_HXX -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> +#include <vcl/weld.hxx> #include <i18nlangtag/lang.h> #include <svx/langbox.hxx> -class ScTextImportOptionsDlg : public ModalDialog +class ScTextImportOptionsDlg : public weld::GenericDialogController { public: - ScTextImportOptionsDlg(vcl::Window* pParent); + ScTextImportOptionsDlg(weld::Window* pParent); virtual ~ScTextImportOptionsDlg() override; - virtual void dispose() override; LanguageType getLanguageType() const; bool isDateConversionSet() const; @@ -39,18 +37,14 @@ private: void init(); private: - VclPtr<OKButton> m_pBtnOk; - - VclPtr<RadioButton> m_pRbAutomatic; - VclPtr<RadioButton> m_pRbCustom; - - VclPtr<SvxLanguageBox> m_pLbCustomLang; - - VclPtr<CheckBox> m_pBtnConvertDate; - - DECL_LINK(OKHdl, Button*, void); - - DECL_LINK( RadioHdl, Button*, void ); + std::unique_ptr<weld::Button> m_xBtnOk; + std::unique_ptr<weld::RadioButton> m_xRbAutomatic; + std::unique_ptr<weld::RadioButton> m_xRbCustom; + std::unique_ptr<weld::CheckButton> m_xBtnConvertDate; + std::unique_ptr<LanguageBox> m_xLbCustomLang; + + DECL_LINK(OKHdl, weld::Button&, void); + DECL_LINK(RadioHdl, weld::ToggleButton&, void); }; #endif diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx index 4d2697563dd5..73f319263992 100644 --- a/sc/source/ui/unoobj/filtuno.cxx +++ b/sc/source/ui/unoobj/filtuno.cxx @@ -208,7 +208,7 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() { // HTML import. ScopedVclPtr<AbstractScTextImportOptionsDlg> pDlg( - pFact->CreateScTextImportOptionsDlg()); + pFact->CreateScTextImportOptionsDlg(nullptr)); if (pDlg->Execute() == RET_OK) { diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 79d16433dc0d..0b0a65600fd4 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -310,8 +310,9 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId 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(); + vcl::Window* pParent = GetActiveWin(); ScopedVclPtr<AbstractScTextImportOptionsDlg> pDlg( - pFact->CreateScTextImportOptionsDlg()); + pFact->CreateScTextImportOptionsDlg(pParent ? pParent->GetFrameWeld() : nullptr)); if (pDlg->Execute() == RET_OK) { diff --git a/sc/uiconfig/scalc/ui/textimportoptions.ui b/sc/uiconfig/scalc/ui/textimportoptions.ui index 2a974ca873bf..3e1b258a7958 100644 --- a/sc/uiconfig/scalc/ui/textimportoptions.ui +++ b/sc/uiconfig/scalc/ui/textimportoptions.ui @@ -1,22 +1,27 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> <object class="GtkDialog" id="TextImportOptionsDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="textimportoptions|TextImportOptionsDialog">Import Options</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> + <child> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> - <property name="spacing">2</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area1"> <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="layout_style">start</property> + <property name="layout_style">end</property> <child> <object class="GtkButton" id="ok"> <property name="label">gtk-ok</property> @@ -59,6 +64,7 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="position">2</property> + <property name="secondary">True</property> </packing> </child> </object> @@ -117,8 +123,8 @@ <property name="receives_default">False</property> <property name="use_underline">True</property> <property name="xalign">0</property> + <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">custom</property> </object> <packing> <property name="left_attach">0</property> @@ -127,9 +133,10 @@ </packing> </child> <child> - <object class="svxcorelo-SvxLanguageBox" id="lang"> + <object class="GtkComboBoxText" id="lang"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> </object> <packing> <property name="left_attach">1</property> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits