weld SwFootNoteOptionDlg

Change-Id: I00713527deab7f8cb9f137c35db7d28c5a896171
Reviewed-on: https://gerrit.libreoffice.org/53609
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2018-04-28 15:27:47 +01:00
parent 288b9a3e22
commit b32a54d6da
9 changed files with 123 additions and 35 deletions

View File

@@ -229,6 +229,11 @@ class SFX2_DLLPUBLIC SfxTabDialogController : public weld::GenericDialogControll
{ {
protected: protected:
std::unique_ptr<weld::Notebook> m_xTabCtrl; 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: private:
std::unique_ptr<weld::Button> m_xOKBtn; std::unique_ptr<weld::Button> m_xOKBtn;
std::unique_ptr<weld::Button> m_xApplyBtn; std::unique_ptr<weld::Button> m_xApplyBtn;
@@ -244,10 +249,6 @@ private:
DECL_DLLPRIVATE_LINK(ActivatePageHdl, const OString&, void); DECL_DLLPRIVATE_LINK(ActivatePageHdl, const OString&, void);
DECL_DLLPRIVATE_LINK(DeactivatePageHdl, const OString&, bool); 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); SAL_DLLPRIVATE void Init_Impl(bool bFmtFlag);
protected: protected:
@@ -257,6 +258,7 @@ protected:
SfxItemSet* m_pExampleSet; SfxItemSet* m_pExampleSet;
SfxItemSet* GetInputSetImpl(); SfxItemSet* GetInputSetImpl();
SfxTabPage* GetTabPage(const OString& rPageId) const;
/** prepare to leave the current page. Calls the DeactivatePage method of the current page, (if necessary), /** prepare to leave the current page. Calls the DeactivatePage method of the current page, (if necessary),
handles the item sets to copy. handles the item sets to copy.
@@ -285,8 +287,12 @@ public:
void SetInputSet( const SfxItemSet* pInSet ); void SetInputSet( const SfxItemSet* pInSet );
const SfxItemSet* GetOutputItemSet() const { return m_pOutSet.get(); } 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(); } const weld::Button* GetUserButton() const { return m_xUserBtn.get(); }
weld::Button* GetUserButton() { return m_xUserBtn.get(); } weld::Button* GetUserButton() { return m_xUserBtn.get(); }
void RemoveResetButton();
short execute(); short execute();

View File

@@ -2057,4 +2057,24 @@ SfxItemSet* SfxTabDialogController::GetInputSetImpl()
return m_pSet; 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -384,7 +384,7 @@ public:
css::uno::Reference< css::sdbc::XDataSource> rxSource, css::uno::Reference< css::sdbc::XDataSource> rxSource,
css::uno::Reference<css::sdbcx::XColumnsSupplier> xColSupp, css::uno::Reference<css::sdbcx::XColumnsSupplier> xColSupp,
const SwDBData& rData) = 0; 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, virtual VclPtr<AbstractDropDownFieldDialog> CreateDropDownFieldDialog(weld::Window* pParent, SwWrtShell &rSh,
SwField* pField, bool bPrevButton, bool bNextButton) = 0; SwField* pField, bool bPrevButton, bool bNextButton) = 0;

View File

@@ -776,10 +776,9 @@ VclPtr<AbstractSwInsertDBColAutoPilot> SwAbstractDialogFactory_Impl::CreateSwIns
return VclPtr<AbstractSwInsertDBColAutoPilot_Impl>::Create( pDlg ); 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<AbstractTabController_Impl>::Create(new SwFootNoteOptionDlg(pParent, rSh));
return VclPtr<AbstractTabDialog_Impl>::Create( pDlg );
} }
VclPtr<AbstractDropDownFieldDialog> SwAbstractDialogFactory_Impl::CreateDropDownFieldDialog(weld::Window *pParent, VclPtr<AbstractDropDownFieldDialog> SwAbstractDialogFactory_Impl::CreateDropDownFieldDialog(weld::Window *pParent,

View File

@@ -564,7 +564,7 @@ public:
css::uno::Reference< css::sdbc::XDataSource> rxSource, css::uno::Reference< css::sdbc::XDataSource> rxSource,
css::uno::Reference<css::sdbcx::XColumnsSupplier> xColSupp, css::uno::Reference<css::sdbcx::XColumnsSupplier> xColSupp,
const SwDBData& rData) override; 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, virtual VclPtr<AbstractDropDownFieldDialog> CreateDropDownFieldDialog(weld::Window* pParent, SwWrtShell &rSh,
SwField* pField, bool bPrevButton, bool bNextButton) override; SwField* pField, bool bPrevButton, bool bNextButton) override;

View File

@@ -34,34 +34,33 @@
#include <SwStyleNameMapper.hxx> #include <SwStyleNameMapper.hxx>
#include <memory> #include <memory>
SwFootNoteOptionDlg::SwFootNoteOptionDlg(vcl::Window *pParent, SwWrtShell &rS) SwFootNoteOptionDlg::SwFootNoteOptionDlg(weld::Window *pParent, SwWrtShell &rS)
: SfxTabDialog(pParent, "FootEndnoteDialog", "modules/swriter/ui/footendnotedialog.ui") : SfxTabDialogController(pParent, "modules/swriter/ui/footendnotedialog.ui", "FootEndnoteDialog")
, rSh( rS ) , rSh( rS )
{ {
RemoveResetButton(); RemoveResetButton();
aOldOkHdl = GetOKButton().GetClickHdl(); GetOKButton().connect_clicked(LINK(this, SwFootNoteOptionDlg, OkHdl));
GetOKButton().SetClickHdl( LINK( this, SwFootNoteOptionDlg, OkHdl ) );
m_nFootNoteId = AddTabPage( "footnotes", SwFootNoteOptionPage::Create, nullptr ); AddTabPage("footnotes", SwFootNoteOptionPage::Create, nullptr);
m_nEndNoteId = AddTabPage( "endnotes", SwEndNoteOptionPage::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>{} ); SfxItemSet aDummySet(rSh.GetAttrPool(), svl::Items<1, 1>{} );
SfxTabPage *pPage = GetTabPage( m_nFootNoteId ); SfxTabPage *pPage = GetTabPage("footnotes");
if ( pPage ) if ( pPage )
pPage->FillItemSet( &aDummySet ); pPage->FillItemSet( &aDummySet );
pPage = GetTabPage( m_nEndNoteId ); pPage = GetTabPage("endnotes");
if ( pPage ) if ( pPage )
pPage->FillItemSet( &aDummySet ); pPage->FillItemSet( &aDummySet );
aOldOkHdl.Call( pBtn ); SfxTabDialogController::OkHdl(rBtn);
} }
SwEndNoteOptionPage::SwEndNoteOptionPage(TabPageParent pParent, bool bEN, SwEndNoteOptionPage::SwEndNoteOptionPage(TabPageParent pParent, bool bEN,
@@ -82,7 +81,7 @@ SwEndNoteOptionPage::SwEndNoteOptionPage(TabPageParent pParent, bool bEN,
, m_xPosFT(m_xBuilder->weld_label("pos")) , m_xPosFT(m_xBuilder->weld_label("pos"))
, m_xPosPageBox(m_xBuilder->weld_radio_button("pospagecb")) , m_xPosPageBox(m_xBuilder->weld_radio_button("pospagecb"))
, m_xPosChapterBox(m_xBuilder->weld_radio_button("posdoccb")) , 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_xParaTemplBox(m_xBuilder->weld_combo_box_text("parastylelb"))
, m_xPageTemplLbl(m_xBuilder->weld_label("pagestyleft")) , m_xPageTemplLbl(m_xBuilder->weld_label("pagestyleft"))
, m_xPageTemplBox(m_xBuilder->weld_combo_box_text("pagestylelb")) , m_xPageTemplBox(m_xBuilder->weld_combo_box_text("pagestylelb"))

View File

@@ -23,20 +23,17 @@
class SwWrtShell; class SwWrtShell;
class SwFootNoteOptionDlg :public SfxTabDialog class SwFootNoteOptionDlg : public SfxTabDialogController
{ {
SwWrtShell &rSh; SwWrtShell &rSh;
Link<Button*, void> aOldOkHdl; Link<weld::Button&, void> aOldOkHdl;
sal_uInt16 m_nFootNoteId; virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
sal_uInt16 m_nEndNoteId;
virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) override; DECL_LINK(OkHdl, weld::Button&, void);
DECL_LINK( OkHdl, Button *, void );
public: public:
SwFootNoteOptionDlg(vcl::Window *pParent, SwWrtShell &rSh ); SwFootNoteOptionDlg(weld::Window *pParent, SwWrtShell &rSh);
}; };
#endif #endif

View File

@@ -600,7 +600,7 @@ void SwView::ExecFormatFootnote()
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); 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!"); OSL_ENSURE(pDlg, "Dialog creation failed!");
pDlg->Execute(); pDlg->Execute();
} }

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 --> <!-- Generated with glade 3.20.4 -->
<interface domain="sw"> <interface domain="sw">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="FootEndnoteDialog"> <object class="GtkDialog" id="FootEndnoteDialog">
@@ -7,6 +7,9 @@
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="title" translatable="yes" context="footendnotedialog|FootEndnoteDialog">Footnotes/Endnotes Settings</property> <property name="title" translatable="yes" context="footendnotedialog|FootEndnoteDialog">Footnotes/Endnotes Settings</property>
<property name="resizable">False</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> <property name="type_hint">dialog</property>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1"> <object class="GtkBox" id="dialog-vbox1">
@@ -17,6 +20,19 @@
<object class="GtkButtonBox" id="dialog-action_area1"> <object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="layout_style">end</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> <child>
<object class="GtkButton" id="ok"> <object class="GtkButton" id="ok">
<property name="label">gtk-ok</property> <property name="label">gtk-ok</property>
@@ -30,7 +46,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -44,7 +60,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child> <child>
@@ -58,7 +74,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">2</property> <property name="position">3</property>
<property name="secondary">True</property> <property name="secondary">True</property>
</packing> </packing>
</child> </child>
@@ -83,6 +99,30 @@
<child> <child>
<placeholder/> <placeholder/>
</child> </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> </object>
</child> </child>
<child type="tab"> <child type="tab">
@@ -102,6 +142,30 @@
<child> <child>
<placeholder/> <placeholder/>
</child> </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> </object>
<packing> <packing>
<property name="position">1</property> <property name="position">1</property>
@@ -132,5 +196,8 @@
<action-widget response="-6">cancel</action-widget> <action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget> <action-widget response="-11">help</action-widget>
</action-widgets> </action-widgets>
<child>
<placeholder/>
</child>
</object> </object>
</interface> </interface>