diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-03-01 16:38:02 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-03-01 22:15:39 +0100 |
commit | a1a0bcc5c4c011c0aa1339ca5dde1c9a2481c91a (patch) | |
tree | d784da8b406a35b60949b1e830ed89add56914a4 | |
parent | 6e12191749542d81f9b29f34148cbc8c511748d2 (diff) |
weld insert row/column dialog
Change-Id: Ib035e4ea18e65558e6b7cd7d7ebb643f68241ead
Reviewed-on: https://gerrit.libreoffice.org/50594
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | cui/source/dialogs/insrc.cxx | 36 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 4 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.hxx | 2 | ||||
-rw-r--r-- | cui/source/inc/insrc.hxx | 22 | ||||
-rw-r--r-- | cui/uiconfig/ui/insertrowcolumn.ui | 11 | ||||
-rw-r--r-- | include/svx/svxdlg.hxx | 3 | ||||
-rw-r--r-- | sd/source/ui/table/tableobjectbar.cxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/shells/tabsh.cxx | 4 |
8 files changed, 40 insertions, 47 deletions
diff --git a/cui/source/dialogs/insrc.cxx b/cui/source/dialogs/insrc.cxx index 8bd342152d33..01e2335e6c8f 100644 --- a/cui/source/dialogs/insrc.cxx +++ b/cui/source/dialogs/insrc.cxx @@ -19,49 +19,37 @@ #include <dialmgr.hxx> #include <svx/svxdlg.hxx> +#include <vcl/svapp.hxx> #include <strings.hrc> #include <insrc.hxx> bool SvxInsRowColDlg::isInsertBefore() const { - return !m_pAfterBtn->IsChecked(); + return !m_xAfterBtn->get_active(); } sal_uInt16 SvxInsRowColDlg::getInsertCount() const { - return static_cast< sal_uInt16 >( m_pCountEdit->GetValue() ); + return m_xCountEdit->get_value(); } -SvxInsRowColDlg::SvxInsRowColDlg(vcl::Window* pParent, bool bCol, const OString& sHelpId ) - : m_pDialog(VclPtr<ModalDialog>::Create(pParent, "InsertRowColumnDialog", "cui/ui/insertrowcolumn.ui")) +SvxInsRowColDlg::SvxInsRowColDlg(weld::Window* pParent, bool bCol, const OString& rHelpId) + : m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/insertrowcolumn.ui")) + , m_xDialog(m_xBuilder->weld_dialog("InsertRowColumnDialog")) + , m_xCountEdit(m_xBuilder->weld_spin_button("insert_number")) + , m_xBeforeBtn(m_xBuilder->weld_radio_button("insert_before")) + , m_xAfterBtn(m_xBuilder->weld_radio_button("insert_after")) , aRow(CuiResId(RID_SVXSTR_ROW)) , aCol(CuiResId(RID_SVXSTR_COL)) , bColumn(bCol) { - m_pDialog->get(m_pCountEdit, "insert_number"); - m_pDialog->get(m_pBeforeBtn, "insert_before"); - m_pDialog->get(m_pAfterBtn, "insert_after"); - m_pDialog->SetText( bColumn ? aCol : aRow ); - m_pDialog->SetHelpId( sHelpId ); -} - -SvxInsRowColDlg::~SvxInsRowColDlg() -{ - disposeOnce(); -} - -void SvxInsRowColDlg::dispose() -{ - m_pCountEdit.clear(); - m_pBeforeBtn.clear(); - m_pAfterBtn.clear(); - m_pDialog.disposeAndClear(); - SvxAbstractInsRowColDlg::dispose(); + m_xDialog->set_title(bColumn ? aCol : aRow); + m_xDialog->set_help_id(rHelpId); } short SvxInsRowColDlg::Execute() { - return m_pDialog->Execute(); + return m_xDialog->run(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 863753ce99bd..365fd949c9e9 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1504,9 +1504,9 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateOptionsDialog( return VclPtr<CuiVclAbstractDialog_Impl>::Create( VclPtr<OfaTreeOptionsDialog>::Create( pParent, rExtensionId ) ); } -VclPtr<SvxAbstractInsRowColDlg> AbstractDialogFactory_Impl::CreateSvxInsRowColDlg( vcl::Window* pParent, bool bCol, const OString& sHelpId ) +VclPtr<SvxAbstractInsRowColDlg> AbstractDialogFactory_Impl::CreateSvxInsRowColDlg(weld::Window* pParent, bool bCol, const OString& rHelpId) { - return VclPtr<SvxInsRowColDlg>::Create( pParent, bCol, sHelpId ); + return VclPtr<SvxInsRowColDlg>::Create(pParent, bCol, rHelpId); } VclPtr<AbstractPasswordToOpenModifyDialog> AbstractDialogFactory_Impl::CreatePasswordToOpenModifyDialog( diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 800f02f1f27a..ca7273273d50 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -624,7 +624,7 @@ public: virtual VclPtr<VclAbstractDialog> CreateOptionsDialog( vcl::Window* pParent, const OUString& rExtensionId ) override; - virtual VclPtr<SvxAbstractInsRowColDlg> CreateSvxInsRowColDlg( vcl::Window* pParent, bool bCol, const OString& sHelpId ) override; + virtual VclPtr<SvxAbstractInsRowColDlg> CreateSvxInsRowColDlg(weld::Window* pParent, bool bCol, const OString& rHelpId) override; virtual VclPtr<AbstractPasswordToOpenModifyDialog> CreatePasswordToOpenModifyDialog(vcl::Window * pParent, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify) override; diff --git a/cui/source/inc/insrc.hxx b/cui/source/inc/insrc.hxx index e6fa2a01b94f..b2e9cb96b70d 100644 --- a/cui/source/inc/insrc.hxx +++ b/cui/source/inc/insrc.hxx @@ -21,21 +21,17 @@ #include <rtl/string.hxx> #include <rtl/ustring.hxx> - #include <svx/stddlg.hxx> - -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <vcl/group.hxx> -#include <vcl/button.hxx> +#include <vcl/weld.hxx> class SvxInsRowColDlg : public SvxAbstractInsRowColDlg { - VclPtr<ModalDialog> m_pDialog; - VclPtr<NumericField> m_pCountEdit; - - VclPtr<RadioButton> m_pBeforeBtn; - VclPtr<RadioButton> m_pAfterBtn; +private: + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Dialog> m_xDialog; + std::unique_ptr<weld::SpinButton> m_xCountEdit; + std::unique_ptr<weld::RadioButton> m_xBeforeBtn; + std::unique_ptr<weld::RadioButton> m_xAfterBtn; OUString aRow; OUString aCol; @@ -43,9 +39,7 @@ class SvxInsRowColDlg : public SvxAbstractInsRowColDlg bool bColumn; public: - SvxInsRowColDlg( vcl::Window* pParent, bool bCol, const OString& sHelpId ); - virtual ~SvxInsRowColDlg() override; - virtual void dispose() override; + SvxInsRowColDlg(weld::Window* pParent, bool bCol, const OString& rHelpId); virtual short Execute() override; diff --git a/cui/uiconfig/ui/insertrowcolumn.ui b/cui/uiconfig/ui/insertrowcolumn.ui index 2d3b04d2fee9..9404b51edc32 100644 --- a/cui/uiconfig/ui/insertrowcolumn.ui +++ b/cui/uiconfig/ui/insertrowcolumn.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.2 --> <interface domain="cui"> - <requires lib="gtk+" version="3.0"/> + <requires lib="gtk+" version="3.20"/> <object class="GtkAdjustment" id="adjustment1"> <property name="lower">1</property> <property name="upper">99</property> @@ -14,6 +14,9 @@ <property name="border_width">6</property> <property name="title" translatable="yes" context="insertrowcolumn|InsertRowColumnDialog">Insert Row</property> <property name="resizable">False</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 internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> @@ -174,7 +177,6 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">insert_after</property> </object> <packing> <property name="left_attach">0</property> @@ -233,5 +235,8 @@ <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index 67f06b9e1a02..92e116ff4c8a 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -60,6 +60,7 @@ typedef const sal_uInt16* (*DialogGetRanges)(); typedef ::std::vector< OUString > TargetList; namespace svx{ class SpellDialogChildWindow;} +namespace weld{ class Window; } class AbstractSvxDistributeDialog :public VclAbstractDialog { @@ -473,7 +474,7 @@ public: virtual VclPtr<SvxAbstractNewTableDialog> CreateSvxNewTableDialog() = 0; - virtual VclPtr<SvxAbstractInsRowColDlg> CreateSvxInsRowColDlg( vcl::Window* pParent, bool bCol, const OString& sHelpId ) = 0; + virtual VclPtr<SvxAbstractInsRowColDlg> CreateSvxInsRowColDlg(weld::Window* pParent, bool bCol, const OString& rHelpId) = 0; }; #endif diff --git a/sd/source/ui/table/tableobjectbar.cxx b/sd/source/ui/table/tableobjectbar.cxx index 046880e4822f..599d7275627c 100644 --- a/sd/source/ui/table/tableobjectbar.cxx +++ b/sd/source/ui/table/tableobjectbar.cxx @@ -142,7 +142,10 @@ void TableObjectBar::Execute( SfxRequest& rReq ) if (nSlotId == SID_TABLE_INSERT_ROW_DLG || nSlotId == SID_TABLE_INSERT_COL_DLG) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - pDlg.disposeAndReset(pFact ? pFact->CreateSvxInsRowColDlg(mpView->GetViewShell()->GetParentWindow(), nSlotId == SID_TABLE_INSERT_COL_DLG, SD_MOD()->GetSlotPool()->GetSlot(nSlotId)->GetCommand()) : nullptr); + vcl::Window* pWin = mpView->GetViewShell()->GetParentWindow(); + pDlg.disposeAndReset(pFact ? pFact->CreateSvxInsRowColDlg(pWin ? pWin->GetFrameWeld() : nullptr, + nSlotId == SID_TABLE_INSERT_COL_DLG, + SD_MOD()->GetSlotPool()->GetSlot(nSlotId)->GetCommand()) : nullptr); if (!pDlg.get() || (pDlg->Execute() != 1)) break; diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 907d210997c3..f696bac5717d 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -949,7 +949,9 @@ void SwTableShell::Execute(SfxRequest &rReq) if ( FN_TABLE_INSERT_ROW_DLG != nSlot || !rSh.IsInRepeatedHeadline()) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<SvxAbstractInsRowColDlg> pDlg( pFact ? pFact->CreateSvxInsRowColDlg( GetView().GetWindow(), nSlot == FN_TABLE_INSERT_COL_DLG, pSlot->GetCommand() ) : nullptr); + vcl::Window* pWin = GetView().GetWindow(); + ScopedVclPtr<SvxAbstractInsRowColDlg> pDlg(pFact ? pFact->CreateSvxInsRowColDlg(pWin ? pWin->GetFrameWeld() : nullptr, + nSlot == FN_TABLE_INSERT_COL_DLG, pSlot->GetCommand() ) : nullptr); if( pDlg.get() && (pDlg->Execute() == 1) ) { |