Kaydet (Commit) 38fa68b9 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld TitleDialog

Change-Id: I009da829e2b866844e67f976582e2a9d99bd22c0
Reviewed-on: https://gerrit.libreoffice.org/54316Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 76f30450
......@@ -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 )
......
......@@ -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,
......
......@@ -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,
......
......@@ -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
......
<?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>
......
......@@ -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,
......
......@@ -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 )
{
......
......@@ -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 )
{
......
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