[Libreoffice-commits] core.git: sw/source sw/uiconfig
Caolán McNamara
caolanm at redhat.com
Wed Feb 28 21:10:47 UTC 2018
sw/source/ui/table/tautofmt.cxx | 74 +++++++++++++---------------------
sw/uiconfig/swriter/ui/insertbreak.ui | 5 ++
sw/uiconfig/swriter/ui/stringinput.ui | 9 +++-
3 files changed, 42 insertions(+), 46 deletions(-)
New commits:
commit 4a7f011f0c4da80f2109d779e68ee569c8061b30
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Feb 28 15:56:58 2018 +0000
weld SwStringInput to native dialog
Change-Id: I31333ef4a4cef3fe282245cc9622fc7e44d55432
Reviewed-on: https://gerrit.libreoffice.org/50520
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/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index f930e53799f1..bea100caf940 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -24,49 +24,36 @@
#include <shellres.hxx>
#include <tautofmt.hxx>
-class SwStringInputDlg : public ModalDialog
+class SwStringInputDlg
{
-public:
- SwStringInputDlg(vcl::Window* pParent, const OUString& rTitle,
- const OUString& rEditTitle, const OUString& rDefault );
- virtual ~SwStringInputDlg() override;
- virtual void dispose() override;
-
- OUString GetInputString() const;
-
private:
- VclPtr<Edit> m_pEdInput; // Edit obtains the focus.
-};
-
-SwStringInputDlg::SwStringInputDlg(vcl::Window* pParent, const OUString& rTitle,
- const OUString& rEditTitle, const OUString& rDefault)
- : ModalDialog(pParent, "StringInputDialog", "modules/swriter/ui/stringinput.ui")
-{
- get<FixedText>("name")->SetText(rEditTitle);
- get(m_pEdInput, "edit");
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Dialog> m_xDialog;
+ std::unique_ptr<weld::Label> m_xLabel;
+ std::unique_ptr<weld::Entry> m_xEdInput; // Edit obtains the focus.
- SetText(rTitle);
- m_pEdInput->SetText(rDefault);
-}
-
-OUString SwStringInputDlg::GetInputString() const
-{
- return m_pEdInput->GetText();
-}
+public:
+ SwStringInputDlg(weld::Window* pParent, const OUString& rTitle,
+ const OUString& rEditTitle, const OUString& rDefault)
+ : m_xBuilder(Application::CreateBuilder(pParent, "modules/swriter/ui/stringinput.ui"))
+ , m_xDialog(m_xBuilder->weld_dialog("StringInputDialog"))
+ , m_xLabel(m_xBuilder->weld_label("name"))
+ , m_xEdInput(m_xBuilder->weld_entry("edit"))
+ {
+ m_xLabel->set_label(rEditTitle);
+ m_xDialog->set_title(rTitle);
+ m_xEdInput->set_text(rDefault);
+ }
-SwStringInputDlg::~SwStringInputDlg()
-{
- disposeOnce();
-}
+ OUString GetInputString() const
+ {
+ return m_xEdInput->get_text();
+ }
-void SwStringInputDlg::dispose()
-{
- m_pEdInput.clear();
- ModalDialog::dispose();
-}
+ short run() { return m_xDialog->run(); }
+};
// AutoFormat-Dialogue:
-
SwAutoFormatDlg::SwAutoFormatDlg( vcl::Window* pParent, SwWrtShell* pWrtShell,
bool bAutoFormat, const SwTableAutoFormat* pSelFormat )
: SfxModalDialog(pParent, "AutoFormatTableDialog", "modules/swriter/ui/autoformattable.ui")
@@ -252,11 +239,10 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, AddHdl, Button*, void)
bool bOk = false, bFormatInserted = false;
while( !bOk )
{
- VclPtrInstance<SwStringInputDlg> pDlg( this, aStrTitle,
- aStrLabel, OUString() );
- if( RET_OK == pDlg->Execute() )
+ SwStringInputDlg aDlg(GetFrameWeld(), aStrTitle, aStrLabel, OUString());
+ if (RET_OK == aDlg.run())
{
- const OUString aFormatName( pDlg->GetInputString() );
+ const OUString aFormatName(aDlg.GetInputString());
if ( !aFormatName.isEmpty() )
{
@@ -345,13 +331,11 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl, Button*, void)
bool bOk = false;
while( !bOk )
{
- VclPtrInstance<SwStringInputDlg> pDlg( this, aStrRenameTitle,
- m_pLbFormat->GetSelectedEntry(),
- OUString() );
- if( pDlg->Execute() == RET_OK )
+ SwStringInputDlg aDlg(GetFrameWeld(), aStrRenameTitle, m_pLbFormat->GetSelectedEntry(), OUString());
+ if (aDlg.run() == RET_OK)
{
bool bFormatRenamed = false;
- const OUString aFormatName( pDlg->GetInputString() );
+ const OUString aFormatName(aDlg.GetInputString());
if ( !aFormatName.isEmpty() )
{
diff --git a/sw/uiconfig/swriter/ui/insertbreak.ui b/sw/uiconfig/swriter/ui/insertbreak.ui
index 9cfe1bab7732..3bde55154b3c 100644
--- a/sw/uiconfig/swriter/ui/insertbreak.ui
+++ b/sw/uiconfig/swriter/ui/insertbreak.ui
@@ -14,6 +14,8 @@
<property name="title" translatable="yes" context="insertbreak|BreakDialog">Insert Break</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">
@@ -264,5 +266,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/sw/uiconfig/swriter/ui/stringinput.ui b/sw/uiconfig/swriter/ui/stringinput.ui
index 78c21f19f2bd..a811a1bb9b43 100644
--- a/sw/uiconfig/swriter/ui/stringinput.ui
+++ b/sw/uiconfig/swriter/ui/stringinput.ui
@@ -1,10 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.20.2 -->
<interface domain="sw">
<requires lib="gtk+" version="3.0"/>
<object class="GtkDialog" id="StringInputDialog">
<property name="can_focus">False</property>
<property name="border_width">6</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">
@@ -85,6 +88,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
+ <property name="width_chars">30</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -104,5 +108,8 @@
<action-widget response="-5">ok</action-widget>
<action-widget response="-6">cancel</action-widget>
</action-widgets>
+ <child>
+ <placeholder/>
+ </child>
</object>
</interface>
More information about the Libreoffice-commits
mailing list