diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-04-30 10:30:31 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-04-30 13:20:35 +0200 |
commit | 58c07ae9829c1d40f0a851d379c126933243fce3 (patch) | |
tree | 5b6f6cdbefd2f0e25c9194efdaffd1b922938999 | |
parent | e0958329000ac04601ceed964fc9fe6559649503 (diff) |
weld SdInsertLayerDlg
Change-Id: I1f298fe6bf1bbd1dc8edc6386bf4466d5ac1e05a
Reviewed-on: https://gerrit.libreoffice.org/53651
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sd/inc/sdabstdlg.hxx | 2 | ||||
-rw-r--r-- | sd/qa/unit/dialogs-test.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/dlg/layeroptionsdlg.cxx | 66 | ||||
-rw-r--r-- | sd/source/ui/dlg/sddlgfact.cxx | 15 | ||||
-rw-r--r-- | sd/source/ui/dlg/sddlgfact.hxx | 11 | ||||
-rw-r--r-- | sd/source/ui/inc/layeroptionsdlg.hxx | 28 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 6 | ||||
-rw-r--r-- | sd/uiconfig/sdraw/ui/insertlayer.ui | 16 |
8 files changed, 77 insertions, 70 deletions
diff --git a/sd/inc/sdabstdlg.hxx b/sd/inc/sdabstdlg.hxx index 571d8369e2d7..8587d9dc256e 100644 --- a/sd/inc/sdabstdlg.hxx +++ b/sd/inc/sdabstdlg.hxx @@ -185,7 +185,7 @@ public: virtual VclPtr<SfxAbstractTabDialog> CreateSdTabPageDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage) = 0; virtual VclPtr<AbstractSdModifyFieldDlg> CreateSdModifyFieldDlg(vcl::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet) = 0; virtual VclPtr<AbstractSdSnapLineDlg> CreateSdSnapLineDlg(vcl::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) = 0; - virtual VclPtr<AbstractSdInsertLayerDlg> CreateSdInsertLayerDlg(vcl::Window* pParent, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& aStr) = 0; + virtual VclPtr<AbstractSdInsertLayerDlg> CreateSdInsertLayerDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& rStr) = 0; virtual VclPtr<AbstractSdInsertPagesObjsDlg> CreateSdInsertPagesObjsDlg(vcl::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName) = 0; virtual VclPtr<AbstractMorphDlg> CreateMorphDlg(weld::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2) = 0; virtual VclPtr<SfxAbstractTabDialog> CreateSdOutlineBulletTabDlg(vcl::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView) = 0; diff --git a/sd/qa/unit/dialogs-test.cxx b/sd/qa/unit/dialogs-test.cxx index 89e036af3442..260b22ce7fc0 100644 --- a/sd/qa/unit/dialogs-test.cxx +++ b/sd/qa/unit/dialogs-test.cxx @@ -372,8 +372,9 @@ VclPtr<VclAbstractDialog> SdDialogsTest::createDialogByID(sal_uInt32 nID) aNewAttr.Put(makeSdAttrLayerPrintable()); aNewAttr.Put(makeSdAttrLayerLocked()); aNewAttr.Put(makeSdAttrLayerThisPage()); + auto const parent = getViewShell()->GetActiveWindow(); pRetval = getSdAbstractDialogFactory()->CreateSdInsertLayerDlg( - getViewShell()->GetActiveWindow(), + parent == nullptr ? nullptr : parent->GetFrameWeld(), aNewAttr, true, // alternative: false SdResId(STR_INSERTLAYER) /* alternative: STR_MODIFYLAYER */); diff --git a/sd/source/ui/dlg/layeroptionsdlg.cxx b/sd/source/ui/dlg/layeroptionsdlg.cxx index 4c966ab0bea5..2530f3cbdace 100644 --- a/sd/source/ui/dlg/layeroptionsdlg.cxx +++ b/sd/source/ui/dlg/layeroptionsdlg.cxx @@ -18,60 +18,46 @@ */ #include <svl/itemset.hxx> -#include <vcl/layout.hxx> #include <sdattr.hxx> #include <layeroptionsdlg.hxx> -SdInsertLayerDlg::SdInsertLayerDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs, - bool bDeletable, const OUString& rStr ) - : ModalDialog(pWindow, "InsertLayerDialog", "modules/sdraw/ui/insertlayer.ui") +SdInsertLayerDlg::SdInsertLayerDlg(weld::Window* pWindow, const SfxItemSet& rInAttrs, + bool bDeletable, const OUString& rStr) + : GenericDialogController(pWindow, "modules/sdraw/ui/insertlayer.ui", "InsertLayerDialog") , mrOutAttrs(rInAttrs) + , m_xEdtName(m_xBuilder->weld_entry("name")) + , m_xEdtTitle(m_xBuilder->weld_entry("title")) + , m_xEdtDesc(m_xBuilder->weld_text_view("textview")) + , m_xCbxVisible(m_xBuilder->weld_check_button("visible")) + , m_xCbxPrintable(m_xBuilder->weld_check_button("printable")) + , m_xCbxLocked(m_xBuilder->weld_check_button("locked")) + , m_xNameFrame(m_xBuilder->weld_widget("nameframe")) { - SetText(rStr); - - get(m_pEdtName, "name"); - get(m_pEdtTitle, "title"); - get(m_pEdtDesc, "textview"); - get(m_pCbxVisible, "visible"); - get(m_pCbxPrintable, "printable"); - get(m_pCbxLocked, "locked"); - - m_pEdtName->SetText( static_cast<const SfxStringItem&>( mrOutAttrs.Get( ATTR_LAYER_NAME ) ).GetValue() ); - m_pEdtTitle->SetText( static_cast<const SfxStringItem&>( mrOutAttrs.Get( ATTR_LAYER_TITLE ) ).GetValue() ); - m_pEdtDesc->SetText( static_cast<const SfxStringItem&>( mrOutAttrs.Get( ATTR_LAYER_DESC ) ).GetValue() ); - m_pEdtDesc->set_height_request(4 * m_pEdtDesc->GetTextHeight()); - m_pCbxVisible->Check( static_cast<const SfxBoolItem&>( mrOutAttrs.Get( ATTR_LAYER_VISIBLE ) ).GetValue() ); - m_pCbxPrintable->Check( static_cast<const SfxBoolItem&>( mrOutAttrs.Get( ATTR_LAYER_PRINTABLE ) ).GetValue() ); - m_pCbxLocked->Check( static_cast<const SfxBoolItem&>( mrOutAttrs.Get( ATTR_LAYER_LOCKED ) ).GetValue() ); - - get<VclContainer>("nameframe")->Enable(bDeletable); + m_xDialog->set_title(rStr); + + m_xEdtName->set_text( static_cast<const SfxStringItem&>( mrOutAttrs.Get( ATTR_LAYER_NAME ) ).GetValue() ); + m_xEdtTitle->set_text( static_cast<const SfxStringItem&>( mrOutAttrs.Get( ATTR_LAYER_TITLE ) ).GetValue() ); + m_xEdtDesc->set_text( static_cast<const SfxStringItem&>( mrOutAttrs.Get( ATTR_LAYER_DESC ) ).GetValue() ); + m_xEdtDesc->set_size_request(-1, m_xEdtDesc->get_height_rows(4)); + m_xCbxVisible->set_active( static_cast<const SfxBoolItem&>( mrOutAttrs.Get( ATTR_LAYER_VISIBLE ) ).GetValue() ); + m_xCbxPrintable->set_active( static_cast<const SfxBoolItem&>( mrOutAttrs.Get( ATTR_LAYER_PRINTABLE ) ).GetValue() ); + m_xCbxLocked->set_active( static_cast<const SfxBoolItem&>( mrOutAttrs.Get( ATTR_LAYER_LOCKED ) ).GetValue() ); + m_xNameFrame->set_sensitive(bDeletable); } SdInsertLayerDlg::~SdInsertLayerDlg() { - disposeOnce(); -} - -void SdInsertLayerDlg::dispose() -{ - m_pEdtName.clear(); - m_pEdtTitle.clear(); - m_pEdtDesc.clear(); - m_pCbxVisible.clear(); - m_pCbxPrintable.clear(); - m_pCbxLocked.clear(); - ModalDialog::dispose(); } void SdInsertLayerDlg::GetAttr( SfxItemSet& rAttrs ) { - rAttrs.Put( makeSdAttrLayerName( m_pEdtName->GetText() ) ); - rAttrs.Put( makeSdAttrLayerTitle( m_pEdtTitle->GetText() ) ); - rAttrs.Put( makeSdAttrLayerDesc( m_pEdtDesc->GetText() ) ); - rAttrs.Put( makeSdAttrLayerVisible( m_pCbxVisible->IsChecked() ) ); - rAttrs.Put( makeSdAttrLayerPrintable( m_pCbxPrintable->IsChecked() ) ); - rAttrs.Put( makeSdAttrLayerLocked( m_pCbxLocked->IsChecked() ) ); + rAttrs.Put( makeSdAttrLayerName( m_xEdtName->get_text() ) ); + rAttrs.Put( makeSdAttrLayerTitle( m_xEdtTitle->get_text() ) ); + rAttrs.Put( makeSdAttrLayerDesc( m_xEdtDesc->get_text() ) ); + rAttrs.Put( makeSdAttrLayerVisible( m_xCbxVisible->get_active() ) ); + rAttrs.Put( makeSdAttrLayerPrintable( m_xCbxPrintable->get_active() ) ); + rAttrs.Put( makeSdAttrLayerLocked( m_xCbxLocked->get_active() ) ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx index 54e2d56a6712..dca60841af70 100644 --- a/sd/source/ui/dlg/sddlgfact.cxx +++ b/sd/source/ui/dlg/sddlgfact.cxx @@ -53,7 +53,12 @@ IMPL_ABSTDLG_BASE(SdAbstractTabDialog_Impl); IMPL_ABSTDLG_BASE(SdPresLayoutTemplateDlg_Impl); IMPL_ABSTDLG_BASE(AbstractSdModifyFieldDlg_Impl); IMPL_ABSTDLG_BASE(AbstractSdSnapLineDlg_Impl); -IMPL_ABSTDLG_BASE(AbstractSdInsertLayerDlg_Impl); + +short AbstractSdInsertLayerDlg_Impl::Execute() +{ + return m_xDlg->run(); +} + IMPL_ABSTDLG_BASE(AbstractSdInsertPagesObjsDlg_Impl); short AbstractMorphDlg_Impl::Execute() @@ -217,12 +222,12 @@ void AbstractSdSnapLineDlg_Impl::SetText( const OUString& rStr ) void AbstractSdInsertLayerDlg_Impl::GetAttr( SfxItemSet& rOutAttrs ) { - pDlg->GetAttr( rOutAttrs ); + m_xDlg->GetAttr(rOutAttrs); } void AbstractSdInsertLayerDlg_Impl::SetHelpId( const OString& rHelpId ) { - pDlg->SetHelpId( rHelpId ); + m_xDlg->set_help_id(rHelpId); } std::vector<OUString> AbstractSdInsertPagesObjsDlg_Impl::GetList(const sal_uInt16 nType) @@ -334,9 +339,9 @@ VclPtr<AbstractSdSnapLineDlg> SdAbstractDialogFactory_Impl::CreateSdSnapLineDlg( return VclPtr<AbstractSdSnapLineDlg_Impl>::Create( VclPtr<SdSnapLineDlg>::Create( pParent, rInAttrs, pView ) ); } -VclPtr<AbstractSdInsertLayerDlg> SdAbstractDialogFactory_Impl::CreateSdInsertLayerDlg( vcl::Window* pParent, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& aStr ) +VclPtr<AbstractSdInsertLayerDlg> SdAbstractDialogFactory_Impl::CreateSdInsertLayerDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& aStr) { - return VclPtr<AbstractSdInsertLayerDlg_Impl>::Create( VclPtr<SdInsertLayerDlg>::Create( pParent, rInAttrs, bDeletable, aStr ) ); + return VclPtr<AbstractSdInsertLayerDlg_Impl>::Create(new SdInsertLayerDlg(pParent, rInAttrs, bDeletable, aStr)); } VclPtr<AbstractSdInsertPagesObjsDlg> SdAbstractDialogFactory_Impl::CreateSdInsertPagesObjsDlg( vcl::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName ) diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx index 97f407922a31..0367e9a8e192 100644 --- a/sd/source/ui/dlg/sddlgfact.hxx +++ b/sd/source/ui/dlg/sddlgfact.hxx @@ -154,7 +154,14 @@ class AbstractSdSnapLineDlg_Impl : public AbstractSdSnapLineDlg class SdInsertLayerDlg; class AbstractSdInsertLayerDlg_Impl : public AbstractSdInsertLayerDlg { - DECL_ABSTDLG_BASE(AbstractSdInsertLayerDlg_Impl,SdInsertLayerDlg) +private: + std::unique_ptr<SdInsertLayerDlg> m_xDlg; +public: + AbstractSdInsertLayerDlg_Impl(SdInsertLayerDlg* pDlg) + : m_xDlg(pDlg) + { + } + virtual short Execute() override; virtual void GetAttr( SfxItemSet& rOutAttrs ) override ; //from class Window virtual void SetHelpId( const OString& rHelpId ) override ; @@ -239,7 +246,7 @@ public: virtual VclPtr<SfxAbstractTabDialog> CreateSdTabPageDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage) override; virtual VclPtr<AbstractSdModifyFieldDlg> CreateSdModifyFieldDlg( vcl::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet ) override; virtual VclPtr<AbstractSdSnapLineDlg> CreateSdSnapLineDlg(vcl::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) override; - virtual VclPtr<AbstractSdInsertLayerDlg> CreateSdInsertLayerDlg(vcl::Window* pParent, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& aStr) override; + virtual VclPtr<AbstractSdInsertLayerDlg> CreateSdInsertLayerDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& aStr) override; virtual VclPtr<AbstractSdInsertPagesObjsDlg> CreateSdInsertPagesObjsDlg(vcl::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName ) override; virtual VclPtr<AbstractMorphDlg> CreateMorphDlg(weld::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2) override; virtual VclPtr<SfxAbstractTabDialog> CreateSdOutlineBulletTabDlg(vcl::Window* pParent, const SfxItemSet* pAttr, ::sd::View* pView) override; diff --git a/sd/source/ui/inc/layeroptionsdlg.hxx b/sd/source/ui/inc/layeroptionsdlg.hxx index 318aa749d595..4efd30368c63 100644 --- a/sd/source/ui/inc/layeroptionsdlg.hxx +++ b/sd/source/ui/inc/layeroptionsdlg.hxx @@ -22,32 +22,28 @@ #include <sddllapi.h> -#include <vcl/edit.hxx> -#include <vcl/fixed.hxx> -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/vclmedit.hxx> +#include <vcl/weld.hxx> class SfxItemSet; -class SD_DLLPUBLIC SdInsertLayerDlg : public ModalDialog +class SD_DLLPUBLIC SdInsertLayerDlg : public weld::GenericDialogController { private: - VclPtr<Edit> m_pEdtName; - VclPtr<Edit> m_pEdtTitle; - VclPtr<VclMultiLineEdit> m_pEdtDesc; - VclPtr<CheckBox> m_pCbxVisible; - VclPtr<CheckBox> m_pCbxPrintable; - VclPtr<CheckBox> m_pCbxLocked; - const SfxItemSet& mrOutAttrs; + std::unique_ptr<weld::Entry> m_xEdtName; + std::unique_ptr<weld::Entry> m_xEdtTitle; + std::unique_ptr<weld::TextView> m_xEdtDesc; + std::unique_ptr<weld::CheckButton> m_xCbxVisible; + std::unique_ptr<weld::CheckButton> m_xCbxPrintable; + std::unique_ptr<weld::CheckButton> m_xCbxLocked; + std::unique_ptr<weld::Widget> m_xNameFrame; + public: - SdInsertLayerDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs, - bool bDeletable, const OUString& rStr ); + SdInsertLayerDlg(weld::Window* pWindow, const SfxItemSet& rInAttrs, + bool bDeletable, const OUString& rStr); virtual ~SdInsertLayerDlg() override; - virtual void dispose() override; void GetAttr( SfxItemSet& rOutAttrs ); }; diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 48d0bc806589..3f6e477e5165 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1798,7 +1798,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) aNewAttr.Put( makeSdAttrLayerThisPage() ); SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSdInsertLayerDlg> pDlg(pFact ? pFact->CreateSdInsertLayerDlg(GetActiveWindow(), aNewAttr, true, SdResId(STR_INSERTLAYER)) : nullptr); + vcl::Window* pWin = GetActiveWindow(); + ScopedVclPtr<AbstractSdInsertLayerDlg> pDlg(pFact ? pFact->CreateSdInsertLayerDlg(pWin ? pWin->GetFrameWeld() : nullptr, aNewAttr, true, SdResId(STR_INSERTLAYER)) : nullptr); if( pDlg ) { pDlg->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_INSERTLAYER )->GetCommand() ); @@ -1965,7 +1966,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) aNewAttr.Put( makeSdAttrLayerThisPage() ); SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSdInsertLayerDlg> pDlg(pFact ? pFact->CreateSdInsertLayerDlg(GetActiveWindow(), aNewAttr, bDelete, SdResId(STR_MODIFYLAYER)) : nullptr); + vcl::Window* pWin = GetActiveWindow(); + ScopedVclPtr<AbstractSdInsertLayerDlg> pDlg(pFact ? pFact->CreateSdInsertLayerDlg(pWin ? pWin->GetFrameWeld() : nullptr, aNewAttr, bDelete, SdResId(STR_MODIFYLAYER)) : nullptr); if( pDlg ) { pDlg->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_MODIFYLAYER )->GetCommand() ); diff --git a/sd/uiconfig/sdraw/ui/insertlayer.ui b/sd/uiconfig/sdraw/ui/insertlayer.ui index 61127353e00a..206c09caa91c 100644 --- a/sd/uiconfig/sdraw/ui/insertlayer.ui +++ b/sd/uiconfig/sdraw/ui/insertlayer.ui @@ -1,11 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.4 --> <interface domain="sd"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="InsertLayerDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="insertlayer|InsertLayerDialog">Insert Layer</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-vbox4"> @@ -93,6 +96,7 @@ <object class="GtkEntry" id="name"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="width_chars">54</property> </object> </child> @@ -132,6 +136,7 @@ <object class="GtkEntry" id="title"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="width_chars">54</property> </object> </child> @@ -175,9 +180,11 @@ <object class="GtkScrolledWindow" id="scrolledwindow1"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> <property name="shadow_type">in</property> <child> - <object class="GtkTextView" id="textview:border"> + <object class="GtkTextView" id="textview"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> @@ -189,7 +196,7 @@ </object> </child> <child type="label"> - <object class="GtkLabel" id="description"> + <object class="GtkLabel" id="description1"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes" context="insertlayer|description">_Description</property> @@ -268,5 +275,8 @@ <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> |