summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-05-14 12:41:06 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-05-14 16:28:38 +0200
commit38fa68b90ae50d9bf25cf22fef36e030282b44a3 (patch)
tree9ef976d7d9cc121c9e90bf669169793b0211bfd7
parent76f30450577bcecf0423833884e3e5215decdd07 (diff)
weld TitleDialog
Change-Id: I009da829e2b866844e67f976582e2a9d99bd22c0 Reviewed-on: https://gerrit.libreoffice.org/54316 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--cui/source/dialogs/cuigaldlg.cxx20
-rw-r--r--cui/source/factory/dlgfact.cxx13
-rw-r--r--cui/source/factory/dlgfact.hxx12
-rw-r--r--cui/source/inc/cuigaldlg.hxx9
-rw-r--r--cui/uiconfig/ui/gallerytitledialog.ui91
-rw-r--r--include/svx/svxdlg.hxx4
-rw-r--r--svx/source/gallery2/galbrws1.cxx6
-rw-r--r--svx/source/gallery2/galbrws2.cxx2
8 files changed, 81 insertions, 76 deletions
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index 972dbc0f5399..1e39d5b1055b 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -491,28 +491,18 @@ IMPL_LINK( ActualizeProgress, ActualizeHdl, const INetURLObject&, rURL, void )
}
-TitleDialog::TitleDialog(vcl::Window* pParent, const OUString& rOldTitle)
- : ModalDialog(pParent, "GalleryTitleDialog", "cui/ui/gallerytitledialog.ui")
+TitleDialog::TitleDialog(weld::Window* pParent, const OUString& rOldTitle)
+ : GenericDialogController(pParent, "cui/ui/gallerytitledialog.ui", "GalleryTitleDialog")
+ , m_xEdit(m_xBuilder->weld_entry("entry"))
{
- get(m_pEdit, "entry");
- m_pEdit->SetText( rOldTitle );
- m_pEdit->GrabFocus();
+ m_xEdit->set_text(rOldTitle);
+ m_xEdit->grab_focus();
}
-
TitleDialog::~TitleDialog()
{
- disposeOnce();
-}
-
-
-void TitleDialog::dispose()
-{
- m_pEdit.clear();
- ModalDialog::dispose();
}
-
GalleryIdDialog::GalleryIdDialog( vcl::Window* pParent, GalleryTheme* _pThm )
: ModalDialog(pParent, "GalleryThemeIDDialog", "cui/ui/gallerythemeiddialog.ui")
, pThm(_pThm )
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 0bf6ea154642..283bd1a651d1 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -111,7 +111,11 @@ short AbstractSvxZoomDialog_Impl::Execute()
return m_xDlg->run();
}
-IMPL_ABSTDLG_BASE(AbstractTitleDialog_Impl);
+short AbstractTitleDialog_Impl::Execute()
+{
+ return m_xDlg->run();
+}
+
IMPL_ABSTDLG_BASE(AbstractScriptSelectorDialog_Impl);
IMPL_ABSTDLG_BASE(AbstractGalleryIdDialog_Impl);
IMPL_ABSTDLG_BASE(AbstractURLDlg_Impl);
@@ -509,7 +513,7 @@ SfxBindings& AbstractSpellDialog_Impl::GetBindings()
OUString AbstractTitleDialog_Impl::GetTitle() const
{
- return pDlg->GetTitle();
+ return m_xDlg->GetTitle();
}
sal_uInt32 AbstractGalleryIdDialog_Impl::GetId() const
@@ -1074,11 +1078,10 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxScriptOrgDialog(
return VclPtr<CuiVclAbstractDialog_Impl>::Create( pDlg );
}
-VclPtr<AbstractTitleDialog> AbstractDialogFactory_Impl::CreateTitleDialog( vcl::Window* pParent,
+VclPtr<AbstractTitleDialog> AbstractDialogFactory_Impl::CreateTitleDialog(weld::Window* pParent,
const OUString& rOldText)
{
- VclPtrInstance<TitleDialog> pDlg( pParent, rOldText);
- return VclPtr<AbstractTitleDialog_Impl>::Create( pDlg );
+ return VclPtr<AbstractTitleDialog_Impl>::Create(new TitleDialog(pParent, rOldText));
}
VclPtr<AbstractGalleryIdDialog> AbstractDialogFactory_Impl::CreateGalleryIdDialog( vcl::Window* pParent,
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index e5be4de5f999..7d75a69b9d98 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -230,7 +230,14 @@ class AbstractSpellDialog_Impl : public AbstractSpellDialog
class TitleDialog;
class AbstractTitleDialog_Impl : public AbstractTitleDialog
{
- DECL_ABSTDLG_BASE(AbstractTitleDialog_Impl,TitleDialog)
+protected:
+ std::unique_ptr<TitleDialog> m_xDlg;
+public:
+ explicit AbstractTitleDialog_Impl(TitleDialog* p)
+ : m_xDlg(p)
+ {
+ }
+ virtual short Execute() override;
virtual OUString GetTitle() const override ;
};
@@ -666,8 +673,7 @@ public:
svx::SpellDialogChildWindow* pSpellChildWindow ) override;
virtual VclPtr<VclAbstractRefreshableDialog> CreateActualizeProgressDialog( vcl::Window* pParent, GalleryTheme* pThm ) override;
- virtual VclPtr<AbstractTitleDialog> CreateTitleDialog( vcl::Window* pParent,
- const OUString& rOldText) override;
+ virtual VclPtr<AbstractTitleDialog> CreateTitleDialog(weld::Window* pParent, const OUString& rOldText) override;
virtual VclPtr<AbstractGalleryIdDialog> CreateGalleryIdDialog( vcl::Window* pParent,
GalleryTheme* pThm) override;
virtual VclPtr<VclAbstractDialog2> CreateGalleryThemePropertiesDialog(vcl::Window* pParent,
diff --git a/cui/source/inc/cuigaldlg.hxx b/cui/source/inc/cuigaldlg.hxx
index e9c96b561b0a..c316fb6b7e95 100644
--- a/cui/source/inc/cuigaldlg.hxx
+++ b/cui/source/inc/cuigaldlg.hxx
@@ -168,15 +168,14 @@ public:
virtual short Execute() override;
};
-class TitleDialog : public ModalDialog
+class TitleDialog : public weld::GenericDialogController
{
private:
- VclPtr<Edit> m_pEdit;
+ std::unique_ptr<weld::Entry> m_xEdit;
public:
- TitleDialog(vcl::Window* pParent, const OUString& rOldText);
+ TitleDialog(weld::Window* pParent, const OUString& rOldText);
virtual ~TitleDialog() override;
- virtual void dispose() override;
- OUString GetTitle() const { return m_pEdit->GetText(); }
+ OUString GetTitle() const { return m_xEdit->get_text(); }
};
class GalleryIdDialog : public ModalDialog
diff --git a/cui/uiconfig/ui/gallerytitledialog.ui b/cui/uiconfig/ui/gallerytitledialog.ui
index 4ec04553f283..1352b8180ca7 100644
--- a/cui/uiconfig/ui/gallerytitledialog.ui
+++ b/cui/uiconfig/ui/gallerytitledialog.ui
@@ -1,58 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="GalleryTitleDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="gallerytitledialog|GalleryTitleDialog">Enter Title</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>
+ <placeholder/>
+ </child>
<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>
- <object class="GtkBox" id="box1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">start</property>
- <property name="hexpand">True</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="gallerytitledialog|label2">Title:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">entry</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hexpand">True</property>
- <property name="width_chars">32</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
@@ -110,6 +75,48 @@
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">start</property>
+ <property name="hexpand">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="gallerytitledialog|label2">Title:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">entry</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="activates_default">True</property>
+ <property name="width_chars">32</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
</object>
</child>
<action-widgets>
diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx
index d877eaef4add..a760676020ab 100644
--- a/include/svx/svxdlg.hxx
+++ b/include/svx/svxdlg.hxx
@@ -356,8 +356,8 @@ public:
virtual VclPtr<VclAbstractRefreshableDialog> CreateActualizeProgressDialog( vcl::Window* pParent,
GalleryTheme* pThm ) = 0;
- virtual VclPtr<AbstractTitleDialog> CreateTitleDialog( vcl::Window* pParent,
- const OUString& rOldText ) = 0;
+ virtual VclPtr<AbstractTitleDialog> CreateTitleDialog(weld::Window* pParent,
+ const OUString& rOldText) = 0;
virtual VclPtr<AbstractGalleryIdDialog> CreateGalleryIdDialog( vcl::Window* pParent,
GalleryTheme* pThm ) = 0;
virtual VclPtr<VclAbstractDialog2> CreateGalleryThemePropertiesDialog(vcl::Window* pParent,
diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx
index 4958e41f3ae5..89b9af36a852 100644
--- a/svx/source/gallery2/galbrws1.cxx
+++ b/svx/source/gallery2/galbrws1.cxx
@@ -368,9 +368,9 @@ void GalleryBrowser1::ImplExecute(const OString &rIdent)
const OUString aOldName( pTheme->GetName() );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- DBG_ASSERT(pFact, "Dialog creation failed!");
- ScopedVclPtr<AbstractTitleDialog> aDlg(pFact->CreateTitleDialog( this, aOldName ));
- DBG_ASSERT(aDlg, "Dialog creation failed!");
+ assert(pFact && "Dialog creation failed!");
+ ScopedVclPtr<AbstractTitleDialog> aDlg(pFact->CreateTitleDialog(GetFrameWeld(), aOldName));
+ assert(aDlg.get() && "Dialog creation failed!");
if( aDlg->Execute() == RET_OK )
{
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 32fee03bee82..dc7d4ff6a386 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -1120,7 +1120,7 @@ void GalleryBrowser2::Execute(const OString &rIdent)
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if(pFact)
{
- ScopedVclPtr<AbstractTitleDialog> aDlg(pFact->CreateTitleDialog( this, aOldTitle ));
+ ScopedVclPtr<AbstractTitleDialog> aDlg(pFact->CreateTitleDialog(GetFrameWeld(), aOldTitle));
DBG_ASSERT(aDlg, "Dialog creation failed!");
if( aDlg->Execute() == RET_OK )
{