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:
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();

View File

@@ -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: */

View File

@@ -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;

View File

@@ -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,

View File

@@ -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;

View File

@@ -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"))

View File

@@ -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

View File

@@ -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();
}

View File

@@ -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">
@@ -17,6 +20,19 @@
<object class="GtkButtonBox" id="dialog-action_area1">
<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>
@@ -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>