From 03a59d9f43c3bbe80e1f06b1a95afd4694ac2f50 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 13 Apr 2018 12:20:13 +0100 Subject: weld ScInsertCellDlg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I91118d4c0c5e2fa17fed02377547caa65e11bfdc Reviewed-on: https://gerrit.libreoffice.org/52824 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sc/inc/scabstdlg.hxx | 4 +-- sc/source/ui/attrdlg/scdlgfact.cxx | 17 +++++---- sc/source/ui/attrdlg/scdlgfact.hxx | 12 +++++-- sc/source/ui/inc/inscldlg.hxx | 17 ++++----- sc/source/ui/miscdlgs/inscldlg.cxx | 69 +++++++++++++++++++------------------ sc/source/ui/view/cellsh1.cxx | 2 +- sc/uiconfig/scalc/ui/insertcells.ui | 14 +++++--- sfx2/uiconfig/ui/bookmarkdialog.ui | 5 +-- 8 files changed, 76 insertions(+), 64 deletions(-) diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index ccdd419f2a69..d970cac36827 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -443,8 +443,8 @@ public: virtual VclPtr CreateAbstractScGroupDlg( vcl::Window* pParent, bool bUnGroup = false ) = 0; - virtual VclPtr CreateScInsertCellDlg( vcl::Window* pParent, - bool bDisallowCellMove ) = 0; + virtual VclPtr CreateScInsertCellDlg(weld::Window* pParent, + bool bDisallowCellMove) = 0; virtual VclPtr CreateScInsertContentsDlg( vcl::Window* pParent, const OUString* pStrTitle = nullptr ) = 0; diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 101ad4c56d96..2c7c7eb2ebba 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -88,7 +88,12 @@ IMPL_ABSTDLG_BASE(AbstractScDataFormDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScDeleteContentsDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScFillSeriesDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScGroupDlg_Impl); -IMPL_ABSTDLG_BASE(AbstractScInsertCellDlg_Impl); + +short AbstractScInsertCellDlg_Impl::Execute() +{ + return m_xDlg->run(); +} + IMPL_ABSTDLG_BASE(AbstractScInsertContentsDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScInsertTableDlg_Impl); IMPL_ABSTDLG_BASE(AbstractScSelEntryDlg_Impl); @@ -113,6 +118,7 @@ IMPL_ABSTDLG_BASE(ScAbstractTabDialog_Impl); AbstractScLinkedAreaDlg_Impl::~AbstractScLinkedAreaDlg_Impl() { } + short AbstractScLinkedAreaDlg_Impl::Execute() { return m_xDlg->run(); @@ -296,7 +302,7 @@ bool AbstractScGroupDlg_Impl::GetColsChecked() const InsCellCmd AbstractScInsertCellDlg_Impl::GetInsCellCmd() const { - return pDlg->GetInsCellCmd(); + return m_xDlg->GetInsCellCmd(); } InsertDeleteFlags AbstractScInsertContentsDlg_Impl::GetInsContentsCmdBits() const @@ -714,11 +720,10 @@ VclPtr ScAbstractDialogFactory_Impl::CreateAbstractScGroupDl return VclPtr::Create( pDlg ); } -VclPtr ScAbstractDialogFactory_Impl::CreateScInsertCellDlg( vcl::Window* pParent, - bool bDisallowCellMove ) +VclPtr ScAbstractDialogFactory_Impl::CreateScInsertCellDlg(weld::Window* pParent, + bool bDisallowCellMove) { - VclPtr pDlg = VclPtr::Create( pParent, bDisallowCellMove); - return VclPtr::Create( pDlg ); + return VclPtr::Create(new ScInsertCellDlg(pParent, bDisallowCellMove)); } VclPtr ScAbstractDialogFactory_Impl::CreateScInsertContentsDlg( vcl::Window* pParent, diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 86cf786de353..1f2bcee38bce 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -200,7 +200,13 @@ class AbstractScGroupDlg_Impl : public AbstractScGroupDlg class AbstractScInsertCellDlg_Impl : public AbstractScInsertCellDlg { - DECL_ABSTDLG_BASE( AbstractScInsertCellDlg_Impl, ScInsertCellDlg) + std::unique_ptr m_xDlg; +public: + explicit AbstractScInsertCellDlg_Impl(ScInsertCellDlg* p) + : m_xDlg(p) + { + } + virtual short Execute() override; virtual InsCellCmd GetInsCellCmd() const override ; }; @@ -449,8 +455,8 @@ public: virtual VclPtr CreateAbstractScGroupDlg( vcl::Window* pParent, bool bUnGroup = false) override; - virtual VclPtr CreateScInsertCellDlg( vcl::Window* pParent, - bool bDisallowCellMove ) override; + virtual VclPtr CreateScInsertCellDlg(weld::Window* pParent, + bool bDisallowCellMove) override; virtual VclPtr CreateScInsertContentsDlg( vcl::Window* pParent, const OUString* pStrTitle = nullptr ) override; diff --git a/sc/source/ui/inc/inscldlg.hxx b/sc/source/ui/inc/inscldlg.hxx index 58b830e27cf4..84f978f7cb9a 100644 --- a/sc/source/ui/inc/inscldlg.hxx +++ b/sc/source/ui/inc/inscldlg.hxx @@ -20,24 +20,21 @@ #ifndef INCLUDED_SC_SOURCE_UI_INC_INSCLDLG_HXX #define INCLUDED_SC_SOURCE_UI_INC_INSCLDLG_HXX -#include -#include -#include +#include #include -class ScInsertCellDlg : public ModalDialog +class ScInsertCellDlg : public weld::GenericDialogController { private: - VclPtr m_pBtnCellsDown; - VclPtr m_pBtnCellsRight; - VclPtr m_pBtnInsRow; - VclPtr m_pBtnInsCol; + std::unique_ptr m_xBtnCellsDown; + std::unique_ptr m_xBtnCellsRight; + std::unique_ptr m_xBtnInsRow; + std::unique_ptr m_xBtnInsCol; public: - ScInsertCellDlg( vcl::Window* pParent, bool bDisallowCellMove ); + ScInsertCellDlg(weld::Window* pParent, bool bDisallowCellMove); virtual ~ScInsertCellDlg() override; - virtual void dispose() override; InsCellCmd GetInsCellCmd() const; }; diff --git a/sc/source/ui/miscdlgs/inscldlg.cxx b/sc/source/ui/miscdlgs/inscldlg.cxx index 3ce3ae4a36e2..ceb4c4a85021 100644 --- a/sc/source/ui/miscdlgs/inscldlg.cxx +++ b/sc/source/ui/miscdlgs/inscldlg.cxx @@ -25,73 +25,76 @@ static sal_uInt8 nInsItemChecked=0; -ScInsertCellDlg::ScInsertCellDlg( vcl::Window* pParent,bool bDisallowCellMove) : - ModalDialog ( pParent, "InsertCellsDialog", "modules/scalc/ui/insertcells.ui") +ScInsertCellDlg::ScInsertCellDlg(weld::Window* pParent,bool bDisallowCellMove) + : GenericDialogController(pParent, "modules/scalc/ui/insertcells.ui", "InsertCellsDialog") + , m_xBtnCellsDown(m_xBuilder->weld_radio_button("down")) + , m_xBtnCellsRight(m_xBuilder->weld_radio_button("right")) + , m_xBtnInsRow(m_xBuilder->weld_radio_button("rows")) + , m_xBtnInsCol(m_xBuilder->weld_radio_button("cols")) { - get(m_pBtnCellsDown, "down"); - get(m_pBtnCellsRight, "right"); - get(m_pBtnInsRow, "rows"); - get(m_pBtnInsCol, "cols"); - if (bDisallowCellMove) { - m_pBtnCellsDown->Disable(); - m_pBtnCellsRight->Disable(); - m_pBtnInsRow->Check(); + m_xBtnCellsDown->set_sensitive(false); + m_xBtnCellsRight->set_sensitive(false); + m_xBtnInsRow->set_active(true); - switch(nInsItemChecked) + switch (nInsItemChecked) { - case 2: m_pBtnInsRow->Check();break; - case 3: m_pBtnInsCol->Check();break; - default:m_pBtnInsRow->Check();break; + case 2: + m_xBtnInsRow->set_active(true); + break; + case 3: + m_xBtnInsCol->set_active(true); + break; + default: + m_xBtnInsRow->set_active(true); + break; } } else { - switch(nInsItemChecked) + switch (nInsItemChecked) { - case 0: m_pBtnCellsDown->Check();break; - case 1: m_pBtnCellsRight->Check();break; - case 2: m_pBtnInsRow->Check();break; - case 3: m_pBtnInsCol->Check();break; + case 0: + m_xBtnCellsDown->set_active(true); + break; + case 1: + m_xBtnCellsRight->set_active(true); + break; + case 2: + m_xBtnInsRow->set_active(true); + break; + case 3: + m_xBtnInsCol->set_active(true); + break; } } } ScInsertCellDlg::~ScInsertCellDlg() { - disposeOnce(); -} - -void ScInsertCellDlg::dispose() -{ - m_pBtnCellsDown.clear(); - m_pBtnCellsRight.clear(); - m_pBtnInsRow.clear(); - m_pBtnInsCol.clear(); - ModalDialog::dispose(); } InsCellCmd ScInsertCellDlg::GetInsCellCmd() const { InsCellCmd nReturn = INS_NONE; - if ( m_pBtnCellsDown->IsChecked() ) + if (m_xBtnCellsDown->get_active()) { nInsItemChecked=0; nReturn = INS_CELLSDOWN; } - else if ( m_pBtnCellsRight->IsChecked()) + else if (m_xBtnCellsRight->get_active()) { nInsItemChecked=1; nReturn = INS_CELLSRIGHT; } - else if ( m_pBtnInsRow->IsChecked() ) + else if (m_xBtnInsRow->get_active()) { nInsItemChecked=2; nReturn = INS_INSROWS_BEFORE; } - else if ( m_pBtnInsCol->IsChecked() ) + else if (m_xBtnInsCol->get_active()) { nInsItemChecked=3; nReturn = INS_INSCOLS_BEFORE; diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index a7b28e26fafd..0593574a9891 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -293,7 +293,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - ScopedVclPtr pDlg(pFact->CreateScInsertCellDlg( pTabViewShell->GetDialogParent(), bTheFlag)); + ScopedVclPtr pDlg(pFact->CreateScInsertCellDlg(pTabViewShell->GetFrameWeld(), bTheFlag)); OSL_ENSURE(pDlg, "Dialog create fail!"); if (pDlg->Execute() == RET_OK) eCmd = pDlg->GetInsCellCmd(); diff --git a/sc/uiconfig/scalc/ui/insertcells.ui b/sc/uiconfig/scalc/ui/insertcells.ui index dae243c24f5e..8dd827fd7c89 100644 --- a/sc/uiconfig/scalc/ui/insertcells.ui +++ b/sc/uiconfig/scalc/ui/insertcells.ui @@ -1,5 +1,5 @@ - + @@ -7,6 +7,9 @@ 6 Insert Cells False + True + 0 + 0 dialog @@ -64,7 +67,6 @@ True 2 True - True @@ -104,7 +106,6 @@ 0 True True - right False @@ -122,7 +123,7 @@ True 0 True - rows + down False @@ -140,7 +141,7 @@ True 0 True - cols + down False @@ -194,5 +195,8 @@ cancel help + + + diff --git a/sfx2/uiconfig/ui/bookmarkdialog.ui b/sfx2/uiconfig/ui/bookmarkdialog.ui index b8663d906b5f..f8daf9eaf2bd 100644 --- a/sfx2/uiconfig/ui/bookmarkdialog.ui +++ b/sfx2/uiconfig/ui/bookmarkdialog.ui @@ -1,7 +1,7 @@ - + False 6 @@ -32,7 +32,6 @@ False True - end 0 @@ -47,7 +46,6 @@ False True - end 1 @@ -63,7 +61,6 @@ False True - end 2 True -- cgit