[Libreoffice-commits] core.git: sw/inc sw/source sw/uiconfig
Caolán McNamara
caolanm at redhat.com
Mon Apr 2 19:54:51 UTC 2018
sw/inc/colwd.hxx | 3 ++
sw/inc/swabstdlg.hxx | 2 -
sw/source/ui/dialog/swdlgfact.cxx | 9 ++++--
sw/source/ui/dialog/swdlgfact.hxx | 15 ++++++++++
sw/source/ui/dialog/swuiexp.cxx | 1
sw/source/ui/table/colwd.cxx | 14 +++++-----
sw/source/ui/table/rowht.cxx | 50 +++++++++++++++---------------------
sw/source/uibase/inc/rowht.hxx | 18 ++++++------
sw/source/uibase/shells/tabsh.cxx | 2 -
sw/uiconfig/swriter/ui/rowheight.ui | 20 ++++++++++----
10 files changed, 79 insertions(+), 55 deletions(-)
New commits:
commit cc78e723723bac34a43e5f3ad05947f775abe0db
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Apr 2 16:57:30 2018 +0100
weld SwTableHeightDlg
Change-Id: I46b90b97da28a7461a069867bade40a64b17c9b5
Reviewed-on: https://gerrit.libreoffice.org/52269
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/inc/colwd.hxx b/sw/inc/colwd.hxx
index 894ed19b2f5a..379f4584c922 100644
--- a/sw/inc/colwd.hxx
+++ b/sw/inc/colwd.hxx
@@ -25,6 +25,7 @@ class SwTableFUNC;
class SwTableWidthDlg final : public weld::GenericDialogController
{
+private:
SwTableFUNC &m_rFnc;
std::unique_ptr<weld::SpinButton> m_xColNF;
@@ -32,6 +33,8 @@ class SwTableWidthDlg final : public weld::GenericDialogController
DECL_LINK(LoseFocusHdl, weld::SpinButton&, void);
+ void Apply();
+
public:
SwTableWidthDlg(weld::Window *pParent, SwTableFUNC &rFnc);
short execute();
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 9c900e9d4b6f..aa80546e98f7 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -425,7 +425,7 @@ public:
virtual VclPtr<AbstractSwSelGlossaryDlg> CreateSwSelGlossaryDlg(const OUString &rShortName) = 0;
virtual VclPtr<VclAbstractDialog> CreateSwSortingDialog(weld::Window * pParent, SwWrtShell &rSh) = 0;
- virtual VclPtr<VclAbstractDialog> CreateSwTableHeightDialog(vcl::Window *pParent, SwWrtShell &rSh) = 0;
+ virtual VclPtr<VclAbstractDialog> CreateSwTableHeightDialog(weld::Window *pParent, SwWrtShell &rSh) = 0;
virtual VclPtr<VclAbstractDialog> CreateSwColumnDialog(vcl::Window *pParent, SwWrtShell &rSh) = 0;
virtual VclPtr<AbstractSplitTableDialog> CreateSplitTableDialog(weld::Window* pParent, SwWrtShell &rSh) = 0;
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index ca8b8c12fb44..309a7393ea6a 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -107,6 +107,10 @@ short AbstractSwTableWidthDlg_Impl::Execute()
{
return m_xDlg->execute();
}
+short AbstractSwTableHeightDlg_Impl::Execute()
+{
+ return m_xDlg->execute();
+}
short AbstractSwSortDlg_Impl::Execute()
{
return m_xDlg->execute();
@@ -806,10 +810,9 @@ VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwColumnDialog(vcl
return VclPtr<VclAbstractDialog_Impl>::Create( pDlg );
}
-VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwTableHeightDialog(vcl::Window *pParent, SwWrtShell &rSh)
+VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwTableHeightDialog(weld::Window *pParent, SwWrtShell &rSh)
{
- VclPtr<Dialog> pDlg = VclPtr<SwTableHeightDlg>::Create( pParent, rSh);
- return VclPtr<VclAbstractDialog_Impl>::Create( pDlg );
+ return VclPtr<AbstractSwTableHeightDlg_Impl>::Create(new SwTableHeightDlg(pParent, rSh));
}
VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwSortingDialog(weld::Window *pParent, SwWrtShell &rSh)
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index 6635787db0fc..d2cab9091623 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -26,6 +26,7 @@ class SwAsciiFilterDlg;
class Dialog;
class SwBreakDlg;
class SwSortDlg;
+class SwTableHeightDlg;
class SwTableWidthDlg;
class SignatureLineDialog;
class SfxTabDialog;
@@ -155,6 +156,18 @@ public:
virtual short Execute() override;
};
+class AbstractSwTableHeightDlg_Impl : public VclAbstractDialog
+{
+protected:
+ std::unique_ptr<SwTableHeightDlg> m_xDlg;
+public:
+ explicit AbstractSwTableHeightDlg_Impl(SwTableHeightDlg* p)
+ : m_xDlg(p)
+ {
+ }
+ virtual short Execute() override;
+};
+
class AbstractSplitTableDialog_Impl : public AbstractSplitTableDialog // add for
{
protected:
@@ -490,7 +503,7 @@ public:
virtual VclPtr<VclAbstractDialog> CreateSwAutoMarkDialog(vcl::Window *pParent, SwWrtShell &rSh) override;
virtual VclPtr<AbstractSwSelGlossaryDlg> CreateSwSelGlossaryDlg(const OUString &rShortName) override;
virtual VclPtr<VclAbstractDialog> CreateSwSortingDialog(weld::Window * pParent, SwWrtShell &rSh) override;
- virtual VclPtr<VclAbstractDialog> CreateSwTableHeightDialog(vcl::Window *pParent, SwWrtShell &rSh) override;
+ virtual VclPtr<VclAbstractDialog> CreateSwTableHeightDialog(weld::Window *pParent, SwWrtShell &rSh) override;
virtual VclPtr<VclAbstractDialog> CreateSwColumnDialog(vcl::Window *pParent, SwWrtShell &rSh) override;
virtual VclPtr<AbstractSplitTableDialog> CreateSplitTableDialog(weld::Window* pParent, SwWrtShell &rSh) override;
diff --git a/sw/source/ui/dialog/swuiexp.cxx b/sw/source/ui/dialog/swuiexp.cxx
index 1b681c9e8b52..657801c4af65 100644
--- a/sw/source/ui/dialog/swuiexp.cxx
+++ b/sw/source/ui/dialog/swuiexp.cxx
@@ -37,6 +37,7 @@
#include <mailmrge.hxx>
#include <mailmergewizard.hxx>
#include <regionsw.hxx>
+#include <rowht.hxx>
#include <selglos.hxx>
#include <splittbl.hxx>
#include <tautofmt.hxx>
diff --git a/sw/source/ui/table/colwd.cxx b/sw/source/ui/table/colwd.cxx
index 4ca22dda4b5e..deb4fb03e35a 100644
--- a/sw/source/ui/table/colwd.cxx
+++ b/sw/source/ui/table/colwd.cxx
@@ -61,16 +61,18 @@ SwTableWidthDlg::SwTableWidthDlg(weld::Window *pParent, SwTableFUNC &rTableFnc)
LoseFocusHdl(*m_xColNF);
}
+void SwTableWidthDlg::Apply()
+{
+ m_rFnc.InitTabCols();
+ m_rFnc.SetColWidth(static_cast<sal_uInt16>(m_xColNF->get_value() - 1),
+ static_cast<sal_uInt16>(m_xWidthMF->denormalize(m_xWidthMF->get_value(FUNIT_TWIP))));
+}
+
short SwTableWidthDlg::execute()
{
short nRet = run();
if (nRet == RET_OK)
- {
- m_rFnc.InitTabCols();
- m_rFnc.SetColWidth(
- static_cast<sal_uInt16>(m_xColNF->get_value() - 1),
- static_cast<sal_uInt16>(m_xWidthMF->denormalize(m_xWidthMF->get_value(FUNIT_TWIP))));
- }
+ Apply();
return nRet;
}
diff --git a/sw/source/ui/table/rowht.cxx b/sw/source/ui/table/rowht.cxx
index 3dcf60ae7531..29c84b7fd242 100644
--- a/sw/source/ui/table/rowht.cxx
+++ b/sw/source/ui/table/rowht.cxx
@@ -36,54 +36,46 @@
void SwTableHeightDlg::Apply()
{
- SwTwips nHeight = static_cast< SwTwips >(m_pHeightEdit->Denormalize(m_pHeightEdit->GetValue(FUNIT_TWIP)));
+ SwTwips nHeight = static_cast< SwTwips >(m_xHeightEdit->denormalize(m_xHeightEdit->get_value(FUNIT_TWIP)));
SwFormatFrameSize aSz(ATT_FIX_SIZE, 0, nHeight);
- SwFrameSize eFrameSize = m_pAutoHeightCB->IsChecked() ?
- ATT_MIN_SIZE : ATT_FIX_SIZE;
+ SwFrameSize eFrameSize = m_xAutoHeightCB->get_active() ? ATT_MIN_SIZE : ATT_FIX_SIZE;
if(eFrameSize != aSz.GetHeightSizeType())
{
aSz.SetHeightSizeType(eFrameSize);
}
- rSh.SetRowHeight( aSz );
+ m_rSh.SetRowHeight(aSz);
}
-SwTableHeightDlg::SwTableHeightDlg(vcl::Window *pParent, SwWrtShell &rS)
- : SvxStandardDialog(pParent, "RowHeightDialog", "modules/swriter/ui/rowheight.ui")
- , rSh( rS )
+SwTableHeightDlg::SwTableHeightDlg(weld::Window *pParent, SwWrtShell &rS)
+ : GenericDialogController(pParent, "modules/swriter/ui/rowheight.ui", "RowHeightDialog")
+ , m_rSh(rS)
+ , m_xHeightEdit(m_xBuilder->weld_metric_spin_button("heightmf"))
+ , m_xAutoHeightCB(m_xBuilder->weld_check_button("fit"))
{
- get(m_pHeightEdit, "heightmf");
- get(m_pAutoHeightCB, "fit");
-
FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( dynamic_cast< const SwWebDocShell*>(
- rSh.GetView().GetDocShell() ) != nullptr )->GetMetric();
- ::SetFieldUnit(*m_pHeightEdit, eFieldUnit);
+ m_rSh.GetView().GetDocShell() ) != nullptr )->GetMetric();
+ ::SetFieldUnit(*m_xHeightEdit, eFieldUnit);
- m_pHeightEdit->SetMin(MINLAY, FUNIT_TWIP);
- if(!m_pHeightEdit->GetMin())
- m_pHeightEdit->SetMin(1);
+ m_xHeightEdit->set_min(MINLAY, FUNIT_TWIP);
SwFormatFrameSize *pSz;
- rSh.GetRowHeight( pSz );
- if ( pSz )
+ m_rSh.GetRowHeight(pSz);
+ if (pSz)
{
- long nHeight = pSz->GetHeight();
- m_pAutoHeightCB->Check(pSz->GetHeightSizeType() != ATT_FIX_SIZE);
- m_pHeightEdit->SetValue(m_pHeightEdit->Normalize(nHeight), FUNIT_TWIP);
+ auto nHeight = pSz->GetHeight();
+ m_xAutoHeightCB->set_active(pSz->GetHeightSizeType() != ATT_FIX_SIZE);
+ m_xHeightEdit->set_value(m_xHeightEdit->normalize(nHeight), FUNIT_TWIP);
delete pSz;
}
}
-SwTableHeightDlg::~SwTableHeightDlg()
-{
- disposeOnce();
-}
-
-void SwTableHeightDlg::dispose()
+short SwTableHeightDlg::execute()
{
- m_pHeightEdit.clear();
- m_pAutoHeightCB.clear();
- SvxStandardDialog::dispose();
+ short nRet = run();
+ if (nRet == RET_OK)
+ Apply();
+ return nRet;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/inc/rowht.hxx b/sw/source/uibase/inc/rowht.hxx
index 02b82dee2387..afe10a0552ab 100644
--- a/sw/source/uibase/inc/rowht.hxx
+++ b/sw/source/uibase/inc/rowht.hxx
@@ -26,19 +26,19 @@
class SwWrtShell;
-class SwTableHeightDlg : public SvxStandardDialog
+class SwTableHeightDlg : public weld::GenericDialogController
{
- VclPtr<MetricField> m_pHeightEdit;
- VclPtr<CheckBox> m_pAutoHeightCB;
- SwWrtShell &rSh;
+ SwWrtShell &m_rSh;
-protected:
- virtual void Apply() override;
+ std::unique_ptr<weld::MetricSpinButton> m_xHeightEdit;
+ std::unique_ptr<weld::CheckButton> m_xAutoHeightCB;
+
+private:
+ void Apply();
public:
- SwTableHeightDlg( vcl::Window *pParent, SwWrtShell &rS );
- virtual ~SwTableHeightDlg() override;
- virtual void dispose() override;
+ SwTableHeightDlg(weld::Window *pParent, SwWrtShell &rS);
+ short execute();
};
#endif
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index f42d14e5a956..45f4fc36fa83 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -834,7 +834,7 @@ void SwTableShell::Execute(SfxRequest &rReq)
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
assert(pFact && "SwAbstractDialogFactory fail!");
- ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSwTableHeightDialog(GetView().GetWindow(), rSh));
+ ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSwTableHeightDialog(GetView().GetFrameWeld(), rSh));
assert(pDlg && "Dialog creation failed!");
pDlg->Execute();
break;
diff --git a/sw/uiconfig/swriter/ui/rowheight.ui b/sw/uiconfig/swriter/ui/rowheight.ui
index f8112bb4f536..94818a7bbc64 100644
--- a/sw/uiconfig/swriter/ui/rowheight.ui
+++ b/sw/uiconfig/swriter/ui/rowheight.ui
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.4 -->
<interface domain="sw">
- <!-- interface-requires gtk+ 3.0 -->
+ <requires lib="gtk+" version="3.18"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">0.01</property>
<property name="upper">99</property>
@@ -12,16 +13,19 @@
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="rowheight|RowHeightDialog">Row Height</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">
<property name="can_focus">False</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>
@@ -64,6 +68,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
+ <property name="secondary">True</property>
</packing>
</child>
</object>
@@ -93,15 +98,17 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
- <object class="GtkSpinButton" id="heightmf:0.00cm">
+ <object class="GtkSpinButton" id="heightmf">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="halign">start</property>
+ <property name="activates_default">True</property>
<property name="adjustment">adjustment1</property>
<property name="digits">2</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">True</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
@@ -149,5 +156,8 @@
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
+ <child>
+ <placeholder/>
+ </child>
</object>
</interface>
More information about the Libreoffice-commits
mailing list