[Libreoffice-commits] core.git: chart2/source cui/source cui/uiconfig include/svx sc/source sd/source sw/source
Caolán McNamara
caolanm at redhat.com
Thu Mar 15 23:25:36 UTC 2018
chart2/source/controller/main/ShapeController.cxx | 3 +
cui/source/dialogs/dlgname.cxx | 38 ++++++----------------
cui/source/factory/dlgfact.cxx | 16 +++++----
cui/source/factory/dlgfact.hxx | 13 +++++--
cui/source/inc/dlgname.hxx | 14 +++-----
cui/uiconfig/ui/objectnamedialog.ui | 11 +++++-
include/svx/svxdlg.hxx | 2 -
sc/source/ui/drawfunc/drawsh5.cxx | 3 +
sd/source/ui/view/drviews2.cxx | 3 +
sw/source/uibase/shells/drwbassh.cxx | 3 +
sw/source/uibase/shells/frmsh.cxx | 3 +
11 files changed, 57 insertions(+), 52 deletions(-)
New commits:
commit 8f61b382a776b2e241be0e3743c38fea53a6a729
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Mar 15 20:52:43 2018 +0000
weld SvxObjectNameDialog
Change-Id: I588bdc61cce9a7b4e709fcac612b229c02e734c0
Reviewed-on: https://gerrit.libreoffice.org/51375
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/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx
index 6abf9a97f1ed..fd4c8a6fb488 100644
--- a/chart2/source/controller/main/ShapeController.cxx
+++ b/chart2/source/controller/main/ShapeController.cxx
@@ -456,8 +456,9 @@ void ShapeController::executeDispatch_RenameObject()
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if ( pFact )
{
+ VclPtr<ChartWindow> pChartWindow( m_pChartController->GetChartWindow() );
ScopedVclPtr< AbstractSvxObjectNameDialog > pDlg(
- pFact->CreateSvxObjectNameDialog( aName ) );
+ pFact->CreateSvxObjectNameDialog(pChartWindow ? pChartWindow->GetFrameWeld() : nullptr, aName));
pDlg->SetCheckNameHdl( LINK( this, ShapeController, CheckNameHdl ) );
if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) )
{
diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx
index e3ad99d3497e..3e9eb3d0d78b 100644
--- a/cui/source/dialogs/dlgname.cxx
+++ b/cui/source/dialogs/dlgname.cxx
@@ -54,44 +54,28 @@ IMPL_LINK_NOARG(SvxNameDialog, ModifyHdl, weld::Entry&, void)
// Dialog for editing Object Name
// plus uniqueness-callback-linkHandler
-SvxObjectNameDialog::SvxObjectNameDialog(
- vcl::Window* pWindow,
- const OUString& rName) :
- ModalDialog ( pWindow, "ObjectNameDialog", "cui/ui/objectnamedialog.ui" )
+SvxObjectNameDialog::SvxObjectNameDialog(weld::Window* pParent, const OUString& rName)
+ : GenericDialogController(pParent, "cui/ui/objectnamedialog.ui", "ObjectNameDialog")
+ , m_xEdtName(m_xBuilder->weld_entry("object_name_entry"))
+ , m_xBtnOK(m_xBuilder->weld_button("ok"))
{
- get(pBtnOK, "ok");
- get(pEdtName, "object_name_entry");
// set name
- pEdtName->SetText(rName);
+ m_xEdtName->set_text(rName);
+ m_xEdtName->select_region(0, -1);
// activate name
- pEdtName->SetSelection(Selection(SELECTION_MIN, SELECTION_MAX));
- ModifyHdl(*pEdtName.get());
- pEdtName->SetModifyHdl(LINK(this, SvxObjectNameDialog, ModifyHdl));
-}
-
-SvxObjectNameDialog::~SvxObjectNameDialog()
-{
- disposeOnce();
-}
-
-void SvxObjectNameDialog::dispose()
-{
- pEdtName.clear();
- pBtnOK.clear();
- ModalDialog::dispose();
+ ModifyHdl(*m_xEdtName);
+ m_xEdtName->connect_changed(LINK(this, SvxObjectNameDialog, ModifyHdl));
}
-
-IMPL_LINK_NOARG(SvxObjectNameDialog, ModifyHdl, Edit&, void)
+IMPL_LINK_NOARG(SvxObjectNameDialog, ModifyHdl, weld::Entry&, void)
{
- if(aCheckNameHdl.IsSet())
+ if (aCheckNameHdl.IsSet())
{
- pBtnOK->Enable(aCheckNameHdl.Call(*this));
+ m_xBtnOK->set_sensitive(aCheckNameHdl.Call(*this));
}
}
-
// #i68101#
// Dialog for editing Object Title and Description
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index e5306a261f1e..33abcf354fea 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -122,7 +122,11 @@ short AbstractSvxNameDialog_Impl::Execute()
}
// #i68101#
-IMPL_ABSTDLG_BASE(AbstractSvxObjectNameDialog_Impl);
+short AbstractSvxObjectNameDialog_Impl::Execute()
+{
+ return m_xDlg->run();
+}
+
IMPL_ABSTDLG_BASE(AbstractSvxObjectTitleDescDialog_Impl);
IMPL_ABSTDLG_BASE(AbstractSvxMultiPathDialog_Impl);
@@ -593,7 +597,7 @@ IMPL_LINK_NOARG(AbstractSvxNameDialog_Impl, CheckNameHdl, SvxNameDialog&, bool)
void AbstractSvxObjectNameDialog_Impl::GetName(OUString& rName)
{
- pDlg->GetName(rName);
+ rName = m_xDlg->GetName();
}
void AbstractSvxObjectNameDialog_Impl::SetCheckNameHdl(const Link<AbstractSvxObjectNameDialog&,bool>& rLink)
@@ -602,11 +606,11 @@ void AbstractSvxObjectNameDialog_Impl::SetCheckNameHdl(const Link<AbstractSvxObj
if(rLink.IsSet())
{
- pDlg->SetCheckNameHdl(LINK(this, AbstractSvxObjectNameDialog_Impl, CheckNameHdl));
+ m_xDlg->SetCheckNameHdl(LINK(this, AbstractSvxObjectNameDialog_Impl, CheckNameHdl));
}
else
{
- pDlg->SetCheckNameHdl(Link<SvxObjectNameDialog&,bool>());
+ m_xDlg->SetCheckNameHdl(Link<SvxObjectNameDialog&,bool>());
}
}
@@ -1103,9 +1107,9 @@ VclPtr<AbstractSvxNameDialog> AbstractDialogFactory_Impl::CreateSvxNameDialog(we
return VclPtr<AbstractSvxNameDialog_Impl>::Create(new SvxNameDialog(pParent, rName, rDesc));
}
-VclPtr<AbstractSvxObjectNameDialog> AbstractDialogFactory_Impl::CreateSvxObjectNameDialog(const OUString& rName )
+VclPtr<AbstractSvxObjectNameDialog> AbstractDialogFactory_Impl::CreateSvxObjectNameDialog(weld::Window* pParent, const OUString& rName)
{
- return VclPtr<AbstractSvxObjectNameDialog_Impl>::Create(VclPtr<SvxObjectNameDialog>::Create(nullptr, rName));
+ return VclPtr<AbstractSvxObjectNameDialog_Impl>::Create(new SvxObjectNameDialog(pParent, rName));
}
VclPtr<AbstractSvxObjectTitleDescDialog> AbstractDialogFactory_Impl::CreateSvxObjectTitleDescDialog(const OUString& rTitle, const OUString& rDescription)
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index d36ecabeb517..e21a3d895d1c 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -324,9 +324,16 @@ private:
class SvxObjectNameDialog;
class SvxObjectTitleDescDialog;
-class AbstractSvxObjectNameDialog_Impl :public AbstractSvxObjectNameDialog
+class AbstractSvxObjectNameDialog_Impl : public AbstractSvxObjectNameDialog
{
- DECL_ABSTDLG_BASE(AbstractSvxObjectNameDialog_Impl, SvxObjectNameDialog)
+protected:
+ std::unique_ptr<SvxObjectNameDialog> m_xDlg;
+public:
+ explicit AbstractSvxObjectNameDialog_Impl(SvxObjectNameDialog* p)
+ : m_xDlg(p)
+ {
+ }
+ virtual short Execute() override;
virtual void GetName(OUString& rName) override ;
virtual void SetCheckNameHdl(const Link<AbstractSvxObjectNameDialog&,bool>& rLink) override;
@@ -566,7 +573,7 @@ public:
virtual VclPtr<AbstractSvxNameDialog> CreateSvxNameDialog(weld::Window* pParent,
const OUString& rName, const OUString& rDesc) override;
// #i68101#
- virtual VclPtr<AbstractSvxObjectNameDialog> CreateSvxObjectNameDialog(const OUString& rName ) override;
+ virtual VclPtr<AbstractSvxObjectNameDialog> CreateSvxObjectNameDialog(weld::Window* pParent, const OUString& rName) override;
virtual VclPtr<AbstractSvxObjectTitleDescDialog> CreateSvxObjectTitleDescDialog(const OUString& rTitle, const OUString& rDescription) override;
virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxMultiPathDialog(vcl::Window* pParent) override;
diff --git a/cui/source/inc/dlgname.hxx b/cui/source/inc/dlgname.hxx
index 5543d9cf1dea..73f66be6854b 100644
--- a/cui/source/inc/dlgname.hxx
+++ b/cui/source/inc/dlgname.hxx
@@ -72,28 +72,26 @@ public:
/** #i68101#
Dialog for editing Object name
plus uniqueness-callback-linkHandler */
-class SvxObjectNameDialog : public ModalDialog
+class SvxObjectNameDialog : public weld::GenericDialogController
{
private:
// name
- VclPtr<Edit> pEdtName;
+ std::unique_ptr<weld::Entry> m_xEdtName;
// buttons
- VclPtr<OKButton> pBtnOK;
+ std::unique_ptr<weld::Button> m_xBtnOK;
// callback link for name uniqueness
Link<SvxObjectNameDialog&,bool> aCheckNameHdl;
- DECL_LINK(ModifyHdl, Edit&, void);
+ DECL_LINK(ModifyHdl, weld::Entry&, void);
public:
// constructor
- SvxObjectNameDialog(vcl::Window* pWindow, const OUString& rName);
- virtual ~SvxObjectNameDialog() override;
- virtual void dispose() override;
+ SvxObjectNameDialog(weld::Window* pWindow, const OUString& rName);
// data access
- void GetName(OUString& rName) {rName = pEdtName->GetText(); }
+ OUString GetName() { return m_xEdtName->get_text(); }
// set handler
void SetCheckNameHdl(const Link<SvxObjectNameDialog&,bool>& rLink)
diff --git a/cui/uiconfig/ui/objectnamedialog.ui b/cui/uiconfig/ui/objectnamedialog.ui
index 8644c0ae3835..907e334a2db9 100644
--- a/cui/uiconfig/ui/objectnamedialog.ui
+++ b/cui/uiconfig/ui/objectnamedialog.ui
@@ -1,11 +1,14 @@
<?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.18"/>
<object class="GtkDialog" id="ObjectNameDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="objectnamedialog|ObjectNameDialog">Name</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-vbox3">
@@ -79,10 +82,10 @@
<object class="GtkLabel" id="object_name_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="objectnamedialog|object_name_label">_Name:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">object_name_entry</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
@@ -95,6 +98,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
+ <property name="activates_default">True</property>
<property name="width_chars">55</property>
</object>
<packing>
@@ -117,5 +121,8 @@
<action-widget response="-5">ok</action-widget>
<action-widget response="-6">cancel</action-widget>
</action-widgets>
+ <child>
+ <placeholder/>
+ </child>
</object>
</interface>
diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx
index 993ef8d76ee5..4be48fffae50 100644
--- a/include/svx/svxdlg.hxx
+++ b/include/svx/svxdlg.hxx
@@ -402,7 +402,7 @@ public:
const OUString& rName, const OUString& rDesc ) = 0;
// #i68101#
- virtual VclPtr<AbstractSvxObjectNameDialog> CreateSvxObjectNameDialog(const OUString& rName ) = 0;
+ virtual VclPtr<AbstractSvxObjectNameDialog> CreateSvxObjectNameDialog(weld::Window* pParent, const OUString& rName) = 0;
virtual VclPtr<AbstractSvxObjectTitleDescDialog> CreateSvxObjectTitleDescDialog(const OUString& rTitle, const OUString& rDescription) = 0;
virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxMultiPathDialog(vcl::Window* pParent) = 0 ;
diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx
index cd4d38ae5b7f..c426ef2c43dd 100644
--- a/sc/source/ui/drawfunc/drawsh5.cxx
+++ b/sc/source/ui/drawfunc/drawsh5.cxx
@@ -488,7 +488,8 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq )
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "Dialog creation failed!");
- ScopedVclPtr<AbstractSvxObjectNameDialog> pDlg(pFact->CreateSvxObjectNameDialog(aName));
+ vcl::Window* pWin = pViewData->GetActiveWin();
+ ScopedVclPtr<AbstractSvxObjectNameDialog> pDlg(pFact->CreateSvxObjectNameDialog(pWin ? pWin->GetFrameWeld() : nullptr, aName));
OSL_ENSURE(pDlg, "Dialog creation failed!");
pDlg->SetCheckNameHdl(LINK(this, ScDrawShell, NameObjectHdl));
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 2c8a71bd3a18..6ca5cf90da8a 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -2506,7 +2506,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "Dialog creation failed!");
- ScopedVclPtr<AbstractSvxObjectNameDialog> pDlg(pFact->CreateSvxObjectNameDialog(aName));
+ ::sd::Window* pWindow = GetActiveWindow();
+ ScopedVclPtr<AbstractSvxObjectNameDialog> pDlg(pFact->CreateSvxObjectNameDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, aName));
OSL_ENSURE(pDlg, "Dialog creation failed!");
pDlg->SetCheckNameHdl(LINK(this, DrawViewShell, NameObjectHdl));
diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx
index d5f1f42066c7..d3539e472820 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -515,7 +515,8 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq)
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "Dialog creation failed!");
- ScopedVclPtr<AbstractSvxObjectNameDialog> pDlg(pFact->CreateSvxObjectNameDialog(aName));
+ vcl::Window* pWin = GetView().GetWindow();
+ ScopedVclPtr<AbstractSvxObjectNameDialog> pDlg(pFact->CreateSvxObjectNameDialog(pWin ? pWin->GetFrameWeld() : nullptr, aName));
OSL_ENSURE(pDlg, "Dialog creation failed!");
pDlg->SetCheckNameHdl(LINK(this, SwDrawBaseShell, CheckGroupShapeNameHdl));
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index a9777a88b800..7c564e11f1c4 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -635,8 +635,9 @@ void SwFrameShell::Execute(SfxRequest &rReq)
OUString aName(rSh.GetFlyName());
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
assert(pFact);
+ vcl::Window* pWin = GetView().GetWindow();
ScopedVclPtr<AbstractSvxObjectNameDialog> pDlg(
- pFact->CreateSvxObjectNameDialog( aName ));
+ pFact->CreateSvxObjectNameDialog(pWin ? pWin->GetFrameWeld() : nullptr, aName));
assert(pDlg);
More information about the Libreoffice-commits
mailing list