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

weld split table dialog

Change-Id: I329a57fa09e6eb0fe75b93b0726d9b7718426693
Reviewed-on: https://gerrit.libreoffice.org/50639Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 810cfc01
...@@ -430,7 +430,7 @@ public: ...@@ -430,7 +430,7 @@ public:
virtual VclPtr<VclAbstractDialog> CreateSwSortingDialog(vcl::Window * pParent, SwWrtShell &rSh) = 0; virtual VclPtr<VclAbstractDialog> CreateSwSortingDialog(vcl::Window * pParent, SwWrtShell &rSh) = 0;
virtual VclPtr<VclAbstractDialog> CreateSwTableHeightDialog(vcl::Window *pParent, SwWrtShell &rSh) = 0; virtual VclPtr<VclAbstractDialog> CreateSwTableHeightDialog(vcl::Window *pParent, SwWrtShell &rSh) = 0;
virtual VclPtr<VclAbstractDialog> CreateSwColumnDialog(vcl::Window *pParent, SwWrtShell &rSh) = 0; virtual VclPtr<VclAbstractDialog> CreateSwColumnDialog(vcl::Window *pParent, SwWrtShell &rSh) = 0;
virtual VclPtr<AbstractSplitTableDialog> CreateSplitTableDialog ( vcl::Window * pParent, SwWrtShell &rSh ) = 0; virtual VclPtr<AbstractSplitTableDialog> CreateSplitTableDialog(weld::Window* pParent, SwWrtShell &rSh) = 0;
virtual VclPtr<AbstractSwAutoFormatDlg> CreateSwAutoFormatDlg(weld::Window* pParent, SwWrtShell* pShell, virtual VclPtr<AbstractSwAutoFormatDlg> CreateSwAutoFormatDlg(weld::Window* pParent, SwWrtShell* pShell,
bool bSetAutoFormat = true, bool bSetAutoFormat = true,
......
...@@ -92,7 +92,10 @@ IMPL_ABSTDLG_BASE(AbstractSwInsertAbstractDlg_Impl); ...@@ -92,7 +92,10 @@ IMPL_ABSTDLG_BASE(AbstractSwInsertAbstractDlg_Impl);
IMPL_ABSTDLG_BASE(SwAbstractSfxDialog_Impl); IMPL_ABSTDLG_BASE(SwAbstractSfxDialog_Impl);
IMPL_ABSTDLG_BASE(AbstractSwAsciiFilterDlg_Impl); IMPL_ABSTDLG_BASE(AbstractSwAsciiFilterDlg_Impl);
IMPL_ABSTDLG_BASE(VclAbstractDialog_Impl); IMPL_ABSTDLG_BASE(VclAbstractDialog_Impl);
IMPL_ABSTDLG_BASE(AbstractSplitTableDialog_Impl); short AbstractSplitTableDialog_Impl::Execute()
{
return m_xDlg->run();
}
short AbstractSwBreakDlg_Impl::Execute() short AbstractSwBreakDlg_Impl::Execute()
{ {
return m_xDlg->run(); return m_xDlg->run();
...@@ -197,7 +200,7 @@ void AbstractSwAsciiFilterDlg_Impl::FillOptions( SwAsciiOptions& rOptions ) ...@@ -197,7 +200,7 @@ void AbstractSwAsciiFilterDlg_Impl::FillOptions( SwAsciiOptions& rOptions )
SplitTable_HeadlineOption AbstractSplitTableDialog_Impl::GetSplitMode() SplitTable_HeadlineOption AbstractSplitTableDialog_Impl::GetSplitMode()
{ {
return pDlg->GetSplitMode(); return m_xDlg->GetSplitMode();
} }
OUString AbstractSwBreakDlg_Impl::GetTemplateName() OUString AbstractSwBreakDlg_Impl::GetTemplateName()
...@@ -795,9 +798,9 @@ VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwSortingDialog(vc ...@@ -795,9 +798,9 @@ VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwSortingDialog(vc
return VclPtr<VclAbstractDialog_Impl>::Create( pDlg ); return VclPtr<VclAbstractDialog_Impl>::Create( pDlg );
} }
VclPtr<AbstractSplitTableDialog> SwAbstractDialogFactory_Impl::CreateSplitTableDialog ( vcl::Window *pParent, SwWrtShell &rSh ) VclPtr<AbstractSplitTableDialog> SwAbstractDialogFactory_Impl::CreateSplitTableDialog(weld::Window *pParent, SwWrtShell &rSh)
{ {
return VclPtr<AbstractSplitTableDialog_Impl>::Create( VclPtr<SwSplitTableDlg>::Create( pParent, rSh) ); return VclPtr<AbstractSplitTableDialog_Impl>::Create(new SwSplitTableDlg(pParent, rSh));
} }
VclPtr<AbstractSwSelGlossaryDlg> SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg(const OUString &rShortName) VclPtr<AbstractSwSelGlossaryDlg> SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg(const OUString &rShortName)
......
...@@ -118,7 +118,14 @@ public: ...@@ -118,7 +118,14 @@ public:
class AbstractSplitTableDialog_Impl : public AbstractSplitTableDialog // add for class AbstractSplitTableDialog_Impl : public AbstractSplitTableDialog // add for
{ {
DECL_ABSTDLG_BASE(AbstractSplitTableDialog_Impl, SwSplitTableDlg) protected:
std::unique_ptr<SwSplitTableDlg> m_xDlg;
public:
explicit AbstractSplitTableDialog_Impl(SwSplitTableDlg* p)
: m_xDlg(p)
{
}
virtual short Execute() override;
virtual SplitTable_HeadlineOption GetSplitMode() override; virtual SplitTable_HeadlineOption GetSplitMode() override;
}; };
...@@ -438,7 +445,7 @@ public: ...@@ -438,7 +445,7 @@ public:
virtual VclPtr<VclAbstractDialog> CreateSwSortingDialog(vcl::Window * pParent, SwWrtShell &rSh) override; virtual VclPtr<VclAbstractDialog> CreateSwSortingDialog(vcl::Window * pParent, SwWrtShell &rSh) override;
virtual VclPtr<VclAbstractDialog> CreateSwTableHeightDialog(vcl::Window *pParent, SwWrtShell &rSh) override; virtual VclPtr<VclAbstractDialog> CreateSwTableHeightDialog(vcl::Window *pParent, SwWrtShell &rSh) override;
virtual VclPtr<VclAbstractDialog> CreateSwColumnDialog(vcl::Window *pParent, SwWrtShell &rSh) override; virtual VclPtr<VclAbstractDialog> CreateSwColumnDialog(vcl::Window *pParent, SwWrtShell &rSh) override;
virtual VclPtr<AbstractSplitTableDialog> CreateSplitTableDialog ( vcl::Window * pParent, SwWrtShell &rSh ) override; virtual VclPtr<AbstractSplitTableDialog> CreateSplitTableDialog(weld::Window* pParent, SwWrtShell &rSh) override;
virtual VclPtr<AbstractSwAutoFormatDlg> CreateSwAutoFormatDlg(weld::Window* pParent, SwWrtShell* pShell, virtual VclPtr<AbstractSwAutoFormatDlg> CreateSwAutoFormatDlg(weld::Window* pParent, SwWrtShell* pShell,
bool bSetAutoFormat = true, bool bSetAutoFormat = true,
......
...@@ -21,39 +21,26 @@ ...@@ -21,39 +21,26 @@
#include <splittbl.hxx> #include <splittbl.hxx>
#include <tblenum.hxx> #include <tblenum.hxx>
SwSplitTableDlg::SwSplitTableDlg( vcl::Window *pParent, SwWrtShell &rSh ) SwSplitTableDlg::SwSplitTableDlg(weld::Window *pParent, SwWrtShell &rSh)
: SvxStandardDialog( pParent, "SplitTableDialog", "modules/swriter/ui/splittable.ui" ) : m_xBuilder(Application::CreateBuilder(pParent, "modules/swriter/ui/splittable.ui"))
, m_xDialog(m_xBuilder->weld_dialog("SplitTableDialog"))
, m_xContentCopyRB(m_xBuilder->weld_radio_button("copyheading"))
, m_xBoxAttrCopyWithParaRB(m_xBuilder->weld_radio_button("customheadingapplystyle"))
, m_xBoxAttrCopyNoParaRB(m_xBuilder->weld_radio_button("customheading"))
, m_xBorderCopyRB(m_xBuilder->weld_radio_button("noheading"))
, rShell(rSh) , rShell(rSh)
, m_nSplit(SplitTable_HeadlineOption::ContentCopy) , m_nSplit(SplitTable_HeadlineOption::ContentCopy)
{ {
get(mpContentCopyRB, "copyheading");
get(mpBoxAttrCopyWithParaRB, "customheadingapplystyle");
get(mpBoxAttrCopyNoParaRB, "customheading");
get(mpBorderCopyRB, "noheading");
}
SwSplitTableDlg::~SwSplitTableDlg()
{
disposeOnce();
}
void SwSplitTableDlg::dispose()
{
mpContentCopyRB.clear();
mpBoxAttrCopyWithParaRB.clear();
mpBoxAttrCopyNoParaRB.clear();
mpBorderCopyRB.clear();
SvxStandardDialog::dispose();
} }
void SwSplitTableDlg::Apply() void SwSplitTableDlg::Apply()
{ {
m_nSplit = SplitTable_HeadlineOption::ContentCopy; m_nSplit = SplitTable_HeadlineOption::ContentCopy;
if(mpBoxAttrCopyWithParaRB->IsChecked()) if (m_xBoxAttrCopyWithParaRB->get_active())
m_nSplit = SplitTable_HeadlineOption::BoxAttrAllCopy; m_nSplit = SplitTable_HeadlineOption::BoxAttrAllCopy;
else if(mpBoxAttrCopyNoParaRB->IsChecked()) else if (m_xBoxAttrCopyNoParaRB->get_active())
m_nSplit = SplitTable_HeadlineOption::BoxAttrCopy; m_nSplit = SplitTable_HeadlineOption::BoxAttrCopy;
else if(mpBorderCopyRB->IsChecked()) else if (m_xBorderCopyRB->get_active())
m_nSplit = SplitTable_HeadlineOption::BorderCopy; m_nSplit = SplitTable_HeadlineOption::BorderCopy;
rShell.SplitTable(m_nSplit); rShell.SplitTable(m_nSplit);
......
...@@ -19,30 +19,37 @@ ...@@ -19,30 +19,37 @@
#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_SPLITTBL_HXX #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_SPLITTBL_HXX
#define INCLUDED_SW_SOURCE_UIBASE_INC_SPLITTBL_HXX #define INCLUDED_SW_SOURCE_UIBASE_INC_SPLITTBL_HXX
#include <svx/stddlg.hxx> #include <vcl/weld.hxx>
#include <vcl/fixed.hxx>
#include <vcl/button.hxx>
#include <tblenum.hxx> #include <tblenum.hxx>
class SwWrtShell; class SwWrtShell;
class SwSplitTableDlg : public SvxStandardDialog class SwSplitTableDlg
{ {
VclPtr<RadioButton> mpContentCopyRB; private:
VclPtr<RadioButton> mpBoxAttrCopyWithParaRB ; std::unique_ptr<weld::Builder> m_xBuilder;
VclPtr<RadioButton> mpBoxAttrCopyNoParaRB ; std::unique_ptr<weld::Dialog> m_xDialog;
VclPtr<RadioButton> mpBorderCopyRB; std::unique_ptr<weld::RadioButton> m_xHorzBox;
std::unique_ptr<weld::RadioButton> m_xContentCopyRB;
std::unique_ptr<weld::RadioButton> m_xBoxAttrCopyWithParaRB;
std::unique_ptr<weld::RadioButton> m_xBoxAttrCopyNoParaRB;
std::unique_ptr<weld::RadioButton> m_xBorderCopyRB;
SwWrtShell &rShell; SwWrtShell &rShell;
SplitTable_HeadlineOption m_nSplit; SplitTable_HeadlineOption m_nSplit;
protected: void Apply();
virtual void Apply() override;
public: public:
SwSplitTableDlg( vcl::Window *pParent, SwWrtShell &rSh ); SwSplitTableDlg(weld::Window *pParent, SwWrtShell &rSh);
virtual ~SwSplitTableDlg() override;
virtual void dispose() override; short run()
{
short nRet = m_xDialog->run();
if (nRet == RET_OK)
Apply();
return nRet;
}
SplitTable_HeadlineOption GetSplitMode() const { return m_nSplit; } SplitTable_HeadlineOption GetSplitMode() const { return m_nSplit; }
}; };
......
...@@ -1036,7 +1036,8 @@ void SwTableShell::Execute(SfxRequest &rReq) ...@@ -1036,7 +1036,8 @@ void SwTableShell::Execute(SfxRequest &rReq)
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
ScopedVclPtr<AbstractSplitTableDialog> pDlg(pFact->CreateSplitTableDialog( GetView().GetWindow(), rSh )); vcl::Window* pWin = GetView().GetWindow();
ScopedVclPtr<AbstractSplitTableDialog> pDlg(pFact->CreateSplitTableDialog(pWin ? pWin->GetFrameWeld() : nullptr, rSh));
OSL_ENSURE(pDlg, "Dialog creation failed!"); OSL_ENSURE(pDlg, "Dialog creation failed!");
pDlg->Execute(); pDlg->Execute();
rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, static_cast<sal_uInt16>(pDlg->GetSplitMode()) ) ); rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, static_cast<sal_uInt16>(pDlg->GetSplitMode()) ) );
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.2 -->
<interface domain="sw"> <interface domain="sw">
<!-- interface-requires gtk+ 3.0 --> <requires lib="gtk+" version="3.20"/>
<object class="GtkDialog" id="SplitTableDialog"> <object class="GtkDialog" id="SplitTableDialog">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="title" translatable="yes" context="splittable|SplitTableDialog">Split Table</property> <property name="title" translatable="yes" context="splittable|SplitTableDialog">Split Table</property>
<property name="modal">True</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1"> <object class="GtkBox" id="dialog-vbox1">
...@@ -94,13 +98,10 @@ ...@@ -94,13 +98,10 @@
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="active">True</property> <property name="active">True</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<property name="group">customheadingapplystyle</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">0</property> <property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
<child> <child>
...@@ -111,13 +112,11 @@ ...@@ -111,13 +112,11 @@
<property name="receives_default">False</property> <property name="receives_default">False</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<property name="group">customheading</property> <property name="group">copyheading</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
<child> <child>
...@@ -128,13 +127,11 @@ ...@@ -128,13 +127,11 @@
<property name="receives_default">False</property> <property name="receives_default">False</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<property name="group">noheading</property> <property name="group">copyheading</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">2</property> <property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
<child> <child>
...@@ -150,8 +147,6 @@ ...@@ -150,8 +147,6 @@
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">3</property> <property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
</object> </object>
...@@ -182,5 +177,8 @@ ...@@ -182,5 +177,8 @@
<action-widget response="-6">cancel</action-widget> <action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget> <action-widget response="-11">help</action-widget>
</action-widgets> </action-widgets>
<child>
<placeholder/>
</child>
</object> </object>
</interface> </interface>
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