Kaydet (Commit) a1a0bcc5 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld insert row/column dialog

Change-Id: Ib035e4ea18e65558e6b7cd7d7ebb643f68241ead
Reviewed-on: https://gerrit.libreoffice.org/50594Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 6e121917
......@@ -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: */
......@@ -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(
......
......@@ -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;
......
......@@ -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;
......
<?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>
......@@ -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
......
......@@ -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;
......
......@@ -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) )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment