include/sfx2/tabdlg.hxx | 14 +++-- sfx2/source/dialog/tabdlg.cxx | 20 +++++++ sw/inc/swabstdlg.hxx | 2 sw/source/ui/dialog/swdlgfact.cxx | 5 - sw/source/ui/dialog/swdlgfact.hxx | 2 sw/source/ui/misc/docfnote.cxx | 25 ++++----- sw/source/uibase/inc/docfnote.hxx | 13 +--- sw/source/uibase/uiview/view0.cxx | 2 sw/uiconfig/swriter/ui/footendnotedialog.ui | 75 ++++++++++++++++++++++++++-- 9 files changed, 123 insertions(+), 35 deletions(-)
New commits: commit b32a54d6da5c51a5d0d607d4d97a3fdbede20e03 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Apr 28 15:27:47 2018 +0100 weld SwFootNoteOptionDlg Change-Id: I00713527deab7f8cb9f137c35db7d28c5a896171 Reviewed-on: https://gerrit.libreoffice.org/53609 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index d3fda57a3d32..e4df01acbc9a 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -229,6 +229,11 @@ class SFX2_DLLPUBLIC SfxTabDialogController : public weld::GenericDialogControll { protected: std::unique_ptr<weld::Notebook> m_xTabCtrl; + + DECL_LINK(OkHdl, weld::Button&, void); + DECL_LINK(ResetHdl, weld::Button&, void); + DECL_LINK(UserHdl, weld::Button&, void); + DECL_LINK(CancelHdl, weld::Button&, void); private: std::unique_ptr<weld::Button> m_xOKBtn; std::unique_ptr<weld::Button> m_xApplyBtn; @@ -244,10 +249,6 @@ private: DECL_DLLPRIVATE_LINK(ActivatePageHdl, const OString&, void); DECL_DLLPRIVATE_LINK(DeactivatePageHdl, const OString&, bool); - DECL_DLLPRIVATE_LINK(OkHdl, weld::Button&, void); - DECL_DLLPRIVATE_LINK(ResetHdl, weld::Button&, void); - DECL_DLLPRIVATE_LINK(UserHdl, weld::Button&, void); - DECL_DLLPRIVATE_LINK(CancelHdl, weld::Button&, void); SAL_DLLPRIVATE void Init_Impl(bool bFmtFlag); protected: @@ -257,6 +258,7 @@ protected: SfxItemSet* m_pExampleSet; SfxItemSet* GetInputSetImpl(); + SfxTabPage* GetTabPage(const OString& rPageId) const; /** prepare to leave the current page. Calls the DeactivatePage method of the current page, (if necessary), handles the item sets to copy. @@ -285,8 +287,12 @@ public: void SetInputSet( const SfxItemSet* pInSet ); const SfxItemSet* GetOutputItemSet() const { return m_pOutSet.get(); } + const weld::Button& GetOKButton() const { return *m_xOKBtn; } + weld::Button& GetOKButton() { return *m_xOKBtn; } + const weld::Button* GetUserButton() const { return m_xUserBtn.get(); } weld::Button* GetUserButton() { return m_xUserBtn.get(); } + void RemoveResetButton(); short execute(); diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 9fc31515b861..9e6e9155cd9a 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -2057,4 +2057,24 @@ SfxItemSet* SfxTabDialogController::GetInputSetImpl() return m_pSet; } +void SfxTabDialogController::RemoveResetButton() +{ + m_xResetBtn->hide(); + m_pImpl->bHideResetBtn = true; +} + +SfxTabPage* SfxTabDialogController::GetTabPage(const OString& rPageId) const + +/* [Description] + + Return TabPage with the specified Id. +*/ + +{ + Data_Impl* pDataObject = Find(m_pImpl->aData, rPageId); + if (pDataObject) + return pDataObject->pTabPage; + return nullptr; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index 4fb601dc76a9..3ed9b295a0b3 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -384,7 +384,7 @@ public: css::uno::Reference< css::sdbc::XDataSource> rxSource, css::uno::Reference<css::sdbcx::XColumnsSupplier> xColSupp, const SwDBData& rData) = 0; - virtual VclPtr<SfxAbstractTabDialog> CreateSwFootNoteOptionDlg(vcl::Window *pParent, SwWrtShell &rSh) = 0; + virtual VclPtr<SfxAbstractTabDialog> CreateSwFootNoteOptionDlg(weld::Window *pParent, SwWrtShell &rSh) = 0; virtual VclPtr<AbstractDropDownFieldDialog> CreateDropDownFieldDialog(weld::Window* pParent, SwWrtShell &rSh, SwField* pField, bool bPrevButton, bool bNextButton) = 0; diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index a0b0d95e3897..60485e2137e4 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -776,10 +776,9 @@ VclPtr<AbstractSwInsertDBColAutoPilot> SwAbstractDialogFactory_Impl::CreateSwIns return VclPtr<AbstractSwInsertDBColAutoPilot_Impl>::Create( pDlg ); } -VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSwFootNoteOptionDlg(vcl::Window *pParent, SwWrtShell &rSh) +VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSwFootNoteOptionDlg(weld::Window *pParent, SwWrtShell &rSh) { - VclPtr<SfxTabDialog> pDlg = VclPtr<SwFootNoteOptionDlg>::Create( pParent, rSh ); - return VclPtr<AbstractTabDialog_Impl>::Create( pDlg ); + return VclPtr<AbstractTabController_Impl>::Create(new SwFootNoteOptionDlg(pParent, rSh)); } VclPtr<AbstractDropDownFieldDialog> SwAbstractDialogFactory_Impl::CreateDropDownFieldDialog(weld::Window *pParent, diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 3afdec171700..f2f10176493f 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -564,7 +564,7 @@ public: css::uno::Reference< css::sdbc::XDataSource> rxSource, css::uno::Reference<css::sdbcx::XColumnsSupplier> xColSupp, const SwDBData& rData) override; - virtual VclPtr<SfxAbstractTabDialog> CreateSwFootNoteOptionDlg(vcl::Window *pParent, SwWrtShell &rSh) override; + virtual VclPtr<SfxAbstractTabDialog> CreateSwFootNoteOptionDlg(weld::Window *pParent, SwWrtShell &rSh) override; virtual VclPtr<AbstractDropDownFieldDialog> CreateDropDownFieldDialog(weld::Window* pParent, SwWrtShell &rSh, SwField* pField, bool bPrevButton, bool bNextButton) override; diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx index afa467580c4f..4de40de6f68a 100644 --- a/sw/source/ui/misc/docfnote.cxx +++ b/sw/source/ui/misc/docfnote.cxx @@ -34,34 +34,33 @@ #include <SwStyleNameMapper.hxx> #include <memory> -SwFootNoteOptionDlg::SwFootNoteOptionDlg(vcl::Window *pParent, SwWrtShell &rS) - : SfxTabDialog(pParent, "FootEndnoteDialog", "modules/swriter/ui/footendnotedialog.ui") +SwFootNoteOptionDlg::SwFootNoteOptionDlg(weld::Window *pParent, SwWrtShell &rS) + : SfxTabDialogController(pParent, "modules/swriter/ui/footendnotedialog.ui", "FootEndnoteDialog") , rSh( rS ) { RemoveResetButton(); - aOldOkHdl = GetOKButton().GetClickHdl(); - GetOKButton().SetClickHdl( LINK( this, SwFootNoteOptionDlg, OkHdl ) ); + GetOKButton().connect_clicked(LINK(this, SwFootNoteOptionDlg, OkHdl)); - m_nFootNoteId = AddTabPage( "footnotes", SwFootNoteOptionPage::Create, nullptr ); - m_nEndNoteId = AddTabPage( "endnotes", SwEndNoteOptionPage::Create, nullptr ); + AddTabPage("footnotes", SwFootNoteOptionPage::Create, nullptr); + AddTabPage("endnotes", SwEndNoteOptionPage::Create, nullptr); } -void SwFootNoteOptionDlg::PageCreated( sal_uInt16 /*nId*/, SfxTabPage &rPage ) +void SwFootNoteOptionDlg::PageCreated(const OString& /*rId*/, SfxTabPage &rPage) { - static_cast<SwEndNoteOptionPage&>(rPage).SetShell( rSh ); + static_cast<SwEndNoteOptionPage&>(rPage).SetShell(rSh); } -IMPL_LINK( SwFootNoteOptionDlg, OkHdl, Button *, pBtn, void ) +IMPL_LINK(SwFootNoteOptionDlg, OkHdl, weld::Button&, rBtn, void) { SfxItemSet aDummySet(rSh.GetAttrPool(), svl::Items<1, 1>{} ); - SfxTabPage *pPage = GetTabPage( m_nFootNoteId ); + SfxTabPage *pPage = GetTabPage("footnotes"); if ( pPage ) pPage->FillItemSet( &aDummySet ); - pPage = GetTabPage( m_nEndNoteId ); + pPage = GetTabPage("endnotes"); if ( pPage ) pPage->FillItemSet( &aDummySet ); - aOldOkHdl.Call( pBtn ); + SfxTabDialogController::OkHdl(rBtn); } SwEndNoteOptionPage::SwEndNoteOptionPage(TabPageParent pParent, bool bEN, @@ -82,7 +81,7 @@ SwEndNoteOptionPage::SwEndNoteOptionPage(TabPageParent pParent, bool bEN, , m_xPosFT(m_xBuilder->weld_label("pos")) , m_xPosPageBox(m_xBuilder->weld_radio_button("pospagecb")) , m_xPosChapterBox(m_xBuilder->weld_radio_button("posdoccb")) - , m_xStylesContainer(m_xBuilder->weld_combo_box_text("allstyles")) + , m_xStylesContainer(m_xBuilder->weld_widget("allstyles")) , m_xParaTemplBox(m_xBuilder->weld_combo_box_text("parastylelb")) , m_xPageTemplLbl(m_xBuilder->weld_label("pagestyleft")) , m_xPageTemplBox(m_xBuilder->weld_combo_box_text("pagestylelb")) diff --git a/sw/source/uibase/inc/docfnote.hxx b/sw/source/uibase/inc/docfnote.hxx index 61393659cc51..471169505b7b 100644 --- a/sw/source/uibase/inc/docfnote.hxx +++ b/sw/source/uibase/inc/docfnote.hxx @@ -23,20 +23,17 @@ class SwWrtShell; -class SwFootNoteOptionDlg :public SfxTabDialog +class SwFootNoteOptionDlg : public SfxTabDialogController { SwWrtShell &rSh; - Link<Button*, void> aOldOkHdl; + Link<weld::Button&, void> aOldOkHdl; - sal_uInt16 m_nFootNoteId; - sal_uInt16 m_nEndNoteId; + virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override; - virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) override; - - DECL_LINK( OkHdl, Button *, void ); + DECL_LINK(OkHdl, weld::Button&, void); public: - SwFootNoteOptionDlg(vcl::Window *pParent, SwWrtShell &rSh ); + SwFootNoteOptionDlg(weld::Window *pParent, SwWrtShell &rSh); }; #endif diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index 5367ac4c4507..4b7694b49584 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -600,7 +600,7 @@ void SwView::ExecFormatFootnote() SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSwFootNoteOptionDlg(GetWindow(), GetWrtShell())); + ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSwFootNoteOptionDlg(GetFrameWeld(), GetWrtShell())); OSL_ENSURE(pDlg, "Dialog creation failed!"); pDlg->Execute(); } diff --git a/sw/uiconfig/swriter/ui/footendnotedialog.ui b/sw/uiconfig/swriter/ui/footendnotedialog.ui index a38aca365a45..6a74cfe800e5 100644 --- a/sw/uiconfig/swriter/ui/footendnotedialog.ui +++ b/sw/uiconfig/swriter/ui/footendnotedialog.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.20.4 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="FootEndnoteDialog"> @@ -7,6 +7,9 @@ <property name="border_width">6</property> <property name="title" translatable="yes" context="footendnotedialog|FootEndnoteDialog">Footnotes/Endnotes Settings</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"> @@ -18,6 +21,19 @@ <property name="can_focus">False</property> <property name="layout_style">end</property> <child> + <object class="GtkButton" id="reset"> + <property name="label">gtk-revert-to-saved</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> <object class="GtkButton" id="ok"> <property name="label">gtk-ok</property> <property name="visible">True</property> @@ -30,7 +46,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">1</property> </packing> </child> <child> @@ -44,7 +60,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> <child> @@ -58,7 +74,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">2</property> + <property name="position">3</property> <property name="secondary">True</property> </packing> </child> @@ -83,6 +99,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> </child> <child type="tab"> @@ -102,6 +142,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">1</property> @@ -132,5 +196,8 @@ <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits