diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-04-16 10:44:32 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-04-16 21:11:26 +0200 |
commit | 6703b806a7d33f27bdec53d5c897beac94308fd9 (patch) | |
tree | c6fe38d86f4d7d997607e57ae0fcaa4adf4477f2 /sw | |
parent | b3846685e52f06f7c7a6c293e6ce6849ee795ac6 (diff) |
weld SwInsFootNoteDlg
Change-Id: I54849e2336d093e9044d4b32275387fa04e3bab9
Reviewed-on: https://gerrit.libreoffice.org/52963
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/swabstdlg.hxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.cxx | 25 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.hxx | 11 | ||||
-rw-r--r-- | sw/source/ui/misc/insfnote.cxx | 223 | ||||
-rw-r--r-- | sw/source/uibase/inc/insfnote.hxx | 71 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh1.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewdlg2.cxx | 2 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/insertfootnote.ui | 22 |
8 files changed, 181 insertions, 181 deletions
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index a72a8f17fde1..8e35a4114fc9 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -462,7 +462,7 @@ public: SwWrtShell *pWrtShell) = 0; virtual VclPtr<AbstractFieldInputDlg> CreateFieldInputDlg(vcl::Window *pParent, SwWrtShell &rSh, SwField* pField, bool bPrevButton, bool bNextButton) = 0; - virtual VclPtr<AbstractInsFootNoteDlg> CreateInsFootNoteDlg(vcl::Window * pParent, + virtual VclPtr<AbstractInsFootNoteDlg> CreateInsFootNoteDlg(weld::Window * pParent, SwWrtShell &rSh, bool bEd = false) = 0; virtual VclPtr<VclAbstractDialog> CreateTitlePageDlg ( vcl::Window * pParent ) = 0; virtual VclPtr<VclAbstractDialog> CreateVclSwViewDialog(SwView& rView) = 0; diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index b105bd332808..880792e93a84 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -145,11 +145,17 @@ short AbstractSwRenameXNamedDlg_Impl::Execute() IMPL_ABSTDLG_BASE(AbstractSwModalRedlineAcceptDlg_Impl); IMPL_ABSTDLG_BASE(AbstractGlossaryDlg_Impl); IMPL_ABSTDLG_BASE(AbstractFieldInputDlg_Impl); -IMPL_ABSTDLG_BASE(AbstractInsFootNoteDlg_Impl); + +short AbstractInsFootNoteDlg_Impl::Execute() +{ + return m_xDlg->execute(); +} + short AbstractInsTableDlg_Impl::Execute() { return m_xDlg->run(); } + IMPL_ABSTDLG_BASE(AbstractJavaEditDialog_Impl); IMPL_ABSTDLG_BASE(AbstractMailMergeDlg_Impl); IMPL_ABSTDLG_BASE(AbstractMailMergeCreateFromDlg_Impl); @@ -456,27 +462,27 @@ bool AbstractFieldInputDlg_Impl::NextButtonPressed() const OUString AbstractInsFootNoteDlg_Impl::GetFontName() { - return pDlg->GetFontName(); + return m_xDlg->GetFontName(); } bool AbstractInsFootNoteDlg_Impl::IsEndNote() { - return pDlg->IsEndNote(); + return m_xDlg->IsEndNote(); } OUString AbstractInsFootNoteDlg_Impl::GetStr() { - return pDlg->GetStr(); + return m_xDlg->GetStr(); } -void AbstractInsFootNoteDlg_Impl::SetHelpId( const OString& sHelpId ) +void AbstractInsFootNoteDlg_Impl::SetHelpId(const OString& rHelpId) { - pDlg->SetHelpId( sHelpId ); + m_xDlg->set_help_id(rHelpId); } void AbstractInsFootNoteDlg_Impl::SetText( const OUString& rStr ) { - pDlg->SetText( rStr ); + m_xDlg->set_title(rStr); } void AbstractInsTableDlg_Impl::GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rCol, @@ -928,10 +934,9 @@ VclPtr<AbstractFieldInputDlg> SwAbstractDialogFactory_Impl::CreateFieldInputDlg( } VclPtr<AbstractInsFootNoteDlg> SwAbstractDialogFactory_Impl::CreateInsFootNoteDlg( - vcl::Window * pParent, SwWrtShell &rSh, bool bEd ) + weld::Window * pParent, SwWrtShell &rSh, bool bEd ) { - VclPtr<SwInsFootNoteDlg> pDlg = VclPtr<SwInsFootNoteDlg>::Create(pParent, rSh, bEd); - return VclPtr<AbstractInsFootNoteDlg_Impl>::Create( pDlg ); + return VclPtr<AbstractInsFootNoteDlg_Impl>::Create(new SwInsFootNoteDlg(pParent, rSh, bEd)); } VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateTitlePageDlg ( vcl::Window *pParent ) diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 363f110362d4..503049b63f8b 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -354,7 +354,14 @@ class AbstractFieldInputDlg_Impl : public AbstractFieldInputDlg class SwInsFootNoteDlg; class AbstractInsFootNoteDlg_Impl : public AbstractInsFootNoteDlg { - DECL_ABSTDLG_BASE(AbstractInsFootNoteDlg_Impl,SwInsFootNoteDlg) +protected: + std::unique_ptr<SwInsFootNoteDlg> m_xDlg; +public: + explicit AbstractInsFootNoteDlg_Impl(SwInsFootNoteDlg* p) + : m_xDlg(p) + { + } + virtual short Execute() override; virtual OUString GetFontName() override; virtual bool IsEndNote() override; virtual OUString GetStr() override; @@ -563,7 +570,7 @@ public: virtual VclPtr<AbstractFieldInputDlg> CreateFieldInputDlg(vcl::Window *pParent, SwWrtShell &rSh, SwField* pField, bool bPrevButton, bool bNextButton) override; virtual VclPtr<AbstractInsFootNoteDlg> CreateInsFootNoteDlg( - vcl::Window * pParent, SwWrtShell &rSh, bool bEd = false) override; + weld::Window * pParent, SwWrtShell &rSh, bool bEd = false) override; virtual VclPtr<VclAbstractDialog> CreateTitlePageDlg ( vcl::Window * pParent ) override; virtual VclPtr<VclAbstractDialog> CreateVclSwViewDialog(SwView& rView) override; virtual VclPtr<AbstractInsTableDlg> CreateInsTableDlg(SwView& rView) override; diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx index 9a3aea7d3953..19dc1c01c0c8 100644 --- a/sw/source/ui/misc/insfnote.cxx +++ b/sw/source/ui/misc/insfnote.cxx @@ -43,169 +43,149 @@ static bool bFootnote = true; void SwInsFootNoteDlg::Apply() { OUString aStr; - if ( m_pNumberCharBtn->IsChecked() ) - aStr = m_pNumberCharEdit->GetText(); + if ( m_xNumberCharBtn->get_active() ) + aStr = m_xNumberCharEdit->get_text(); - if ( bEdit ) + if (m_bEdit) { - rSh.StartAction(); - rSh.Left(CRSR_SKIP_CHARS, false, 1, false ); - rSh.StartUndo( SwUndoId::START ); - SwFormatFootnote aNote( m_pEndNoteBtn->IsChecked() ); + m_rSh.StartAction(); + m_rSh.Left(CRSR_SKIP_CHARS, false, 1, false ); + m_rSh.StartUndo( SwUndoId::START ); + SwFormatFootnote aNote( m_xEndNoteBtn->get_active() ); aNote.SetNumStr( aStr ); - if( rSh.SetCurFootnote( aNote ) && bExtCharAvailable ) + if (m_rSh.SetCurFootnote( aNote ) && m_bExtCharAvailable) { - rSh.Right(CRSR_SKIP_CHARS, true, 1, false ); - SfxItemSet aSet( rSh.GetAttrPool(), svl::Items<RES_CHRATR_FONT, RES_CHRATR_FONT>{} ); - rSh.GetCurAttr( aSet ); + m_rSh.Right(CRSR_SKIP_CHARS, true, 1, false ); + SfxItemSet aSet(m_rSh.GetAttrPool(), svl::Items<RES_CHRATR_FONT, RES_CHRATR_FONT>{}); + m_rSh.GetCurAttr(aSet); const SvxFontItem &rFont = aSet.Get( RES_CHRATR_FONT ); SvxFontItem aFont( rFont.GetFamily(), m_aFontName, rFont.GetStyleName(), rFont.GetPitch(), - eCharSet, RES_CHRATR_FONT ); + m_eCharSet, RES_CHRATR_FONT ); aSet.Put( aFont ); - rSh.SetAttrSet( aSet, SetAttrMode::DONTEXPAND ); - rSh.ResetSelect(nullptr, false); - rSh.Left(CRSR_SKIP_CHARS, false, 1, false ); + m_rSh.SetAttrSet( aSet, SetAttrMode::DONTEXPAND ); + m_rSh.ResetSelect(nullptr, false); + m_rSh.Left(CRSR_SKIP_CHARS, false, 1, false ); } - rSh.EndUndo( SwUndoId::END ); - rSh.EndAction(); + m_rSh.EndUndo( SwUndoId::END ); + m_rSh.EndAction(); } - bFootnote = m_pFootnoteBtn->IsChecked(); + bFootnote = m_xFootnoteBtn->get_active(); } -IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberCharHdl, Button*, void) +IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberCharHdl, weld::Button&, void) { - m_pNumberCharEdit->GrabFocus(); - m_pOkBtn->Enable( !m_pNumberCharEdit->GetText().isEmpty() || bExtCharAvailable ); + m_xNumberCharEdit->grab_focus(); + m_xOkBtn->set_sensitive( !m_xNumberCharEdit->get_text().isEmpty() || m_bExtCharAvailable ); } -IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberEditHdl, Edit&, void) +IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberEditHdl, weld::Entry&, void) { - m_pNumberCharBtn->Check(); - m_pOkBtn->Enable( !m_pNumberCharEdit->GetText().isEmpty() ); + m_xNumberCharBtn->set_active(true); + m_xOkBtn->set_sensitive( !m_xNumberCharEdit->get_text().isEmpty() ); } -IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberAutoBtnHdl, Button*, void) +IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberAutoBtnHdl, weld::Button&, void) { - m_pOkBtn->Enable(); + m_xOkBtn->set_sensitive(true); } -IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberExtCharHdl, Button*, void) +IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberExtCharHdl, weld::Button&, void) { - m_pNumberCharBtn->Check(); + m_xNumberCharBtn->set_active(true); - SfxItemSet aSet( rSh.GetAttrPool(), svl::Items<RES_CHRATR_FONT, RES_CHRATR_FONT>{} ); - rSh.GetCurAttr( aSet ); + SfxItemSet aSet(m_rSh.GetAttrPool(), svl::Items<RES_CHRATR_FONT, RES_CHRATR_FONT>{}); + m_rSh.GetCurAttr( aSet ); const SvxFontItem &rFont = aSet.Get( RES_CHRATR_FONT ); - SfxAllItemSet aAllSet( rSh.GetAttrPool() ); + SfxAllItemSet aAllSet(m_rSh.GetAttrPool()); aAllSet.Put( SfxBoolItem( FN_PARAM_1, false ) ); aAllSet.Put( rFont ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(GetFrameWeld(), aAllSet, false)); + ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(m_xDialog.get(), aAllSet, false)); if (RET_OK == pDlg->Execute()) { const SfxStringItem* pItem = SfxItemSet::GetItem<SfxStringItem>(pDlg->GetOutputItemSet(), SID_CHARMAP, false); const SvxFontItem* pFontItem = SfxItemSet::GetItem<SvxFontItem>(pDlg->GetOutputItemSet(), SID_ATTR_CHAR_FONT, false); if ( pItem ) { - m_pNumberCharEdit->SetText( pItem->GetValue() ); + m_xNumberCharEdit->set_text(pItem->GetValue()); if ( pFontItem ) { m_aFontName = pFontItem->GetFamilyName(); - eCharSet = pFontItem->GetCharSet(); - vcl::Font aFont( m_aFontName, pFontItem->GetStyleName(), m_pNumberCharEdit->GetFont().GetFontSize() ); + m_eCharSet = pFontItem->GetCharSet(); + vcl::Font aFont(m_aFontName, pFontItem->GetStyleName(), m_xNumberCharEdit->get_font().GetFontSize()); aFont.SetCharSet( pFontItem->GetCharSet() ); aFont.SetPitch( pFontItem->GetPitch() ); - m_pNumberCharEdit->SetFont( aFont ); + m_xNumberCharEdit->set_font(aFont); } - bExtCharAvailable = true; - m_pOkBtn->Enable(!m_pNumberCharEdit->GetText().isEmpty()); + m_bExtCharAvailable = true; + m_xOkBtn->set_sensitive(!m_xNumberCharEdit->get_text().isEmpty()); } } } -IMPL_LINK( SwInsFootNoteDlg, NextPrevHdl, Button *, pBtn, void ) +IMPL_LINK( SwInsFootNoteDlg, NextPrevHdl, weld::Button&, rBtn, void ) { Apply(); // go to the next foot/endnote here - rSh.ResetSelect(nullptr, false); - if (pBtn == m_pNextBT) - rSh.GotoNextFootnoteAnchor(); + m_rSh.ResetSelect(nullptr, false); + if (&rBtn == m_xNextBT.get()) + m_rSh.GotoNextFootnoteAnchor(); else - rSh.GotoPrevFootnoteAnchor(); + m_rSh.GotoPrevFootnoteAnchor(); Init(); } -SwInsFootNoteDlg::SwInsFootNoteDlg(vcl::Window *pParent, SwWrtShell &rShell, bool bEd) - : SvxStandardDialog(pParent, "InsertFootnoteDialog", "modules/swriter/ui/insertfootnote.ui") - , rSh(rShell) - , eCharSet(RTL_TEXTENCODING_DONTKNOW) - , bExtCharAvailable(false) - , bEdit(bEd) +SwInsFootNoteDlg::SwInsFootNoteDlg(weld::Window *pParent, SwWrtShell &rShell, bool bEd) + : GenericDialogController(pParent, "modules/swriter/ui/insertfootnote.ui", "InsertFootnoteDialog") + , m_rSh(rShell) + , m_eCharSet(RTL_TEXTENCODING_DONTKNOW) + , m_bExtCharAvailable(false) + , m_bEdit(bEd) + , m_xNumberFrame(m_xBuilder->weld_widget("numberingframe")) + , m_xNumberAutoBtn(m_xBuilder->weld_radio_button("automatic")) + , m_xNumberCharBtn(m_xBuilder->weld_radio_button("character")) + , m_xNumberCharEdit(m_xBuilder->weld_entry("characterentry")) + , m_xNumberExtChar(m_xBuilder->weld_button("choosecharacter")) + , m_xFootnoteBtn(m_xBuilder->weld_radio_button("footnote")) + , m_xEndNoteBtn(m_xBuilder->weld_radio_button("endnote")) + , m_xOkBtn(m_xBuilder->weld_button("ok")) + , m_xPrevBT(m_xBuilder->weld_button("prev")) + , m_xNextBT(m_xBuilder->weld_button("next")) { - get(m_pNumberFrame, "numberingframe"); - get(m_pNumberAutoBtn, "automatic"); - get(m_pNumberCharBtn, "character"); - get(m_pNumberCharEdit, "characterentry"); - get(m_pNumberExtChar, "choosecharacter"); - get(m_pFootnoteBtn, "footnote"); - get(m_pEndNoteBtn, "endnote"); - get(m_pOkBtn, "ok"); - get(m_pPrevBT, "prev"); - get(m_pNextBT, "next"); - - m_pNumberAutoBtn->SetClickHdl(LINK(this,SwInsFootNoteDlg,NumberAutoBtnHdl)); - m_pNumberExtChar->SetClickHdl(LINK(this,SwInsFootNoteDlg,NumberExtCharHdl)); - m_pNumberCharBtn->SetClickHdl(LINK(this,SwInsFootNoteDlg,NumberCharHdl)); - m_pNumberCharEdit->SetModifyHdl(LINK(this,SwInsFootNoteDlg,NumberEditHdl)); - m_pNumberCharEdit->SetMaxTextLen(10); - m_pNumberCharEdit->Enable(); - - m_pPrevBT->SetClickHdl(LINK(this, SwInsFootNoteDlg, NextPrevHdl)); - m_pNextBT->SetClickHdl(LINK(this, SwInsFootNoteDlg, NextPrevHdl)); - - SwViewShell::SetCareWin(this); - - if (bEdit) + m_xNumberAutoBtn->connect_clicked(LINK(this,SwInsFootNoteDlg,NumberAutoBtnHdl)); + m_xNumberExtChar->connect_clicked(LINK(this,SwInsFootNoteDlg,NumberExtCharHdl)); + m_xNumberCharBtn->connect_clicked(LINK(this,SwInsFootNoteDlg,NumberCharHdl)); + m_xNumberCharEdit->connect_changed(LINK(this,SwInsFootNoteDlg,NumberEditHdl)); + + m_xPrevBT->connect_clicked(LINK(this, SwInsFootNoteDlg, NextPrevHdl)); + m_xNextBT->connect_clicked(LINK(this, SwInsFootNoteDlg, NextPrevHdl)); + + SwViewShell::SetCareDialog(m_xDialog); + + if (m_bEdit) { Init(); - m_pPrevBT->Show(); - m_pNextBT->Show(); + m_xPrevBT->show(); + m_xNextBT->show(); } } SwInsFootNoteDlg::~SwInsFootNoteDlg() { - disposeOnce(); -} + SwViewShell::SetCareDialog(nullptr); -void SwInsFootNoteDlg::dispose() -{ - SwViewShell::SetCareWin(nullptr); - - if (bEdit) - rSh.ResetSelect(nullptr, false); - - m_pNumberFrame.clear(); - m_pNumberAutoBtn.clear(); - m_pNumberCharBtn.clear(); - m_pNumberCharEdit.clear(); - m_pNumberExtChar.clear(); - m_pFootnoteBtn.clear(); - m_pEndNoteBtn.clear(); - m_pOkBtn.clear(); - m_pPrevBT.clear(); - m_pNextBT.clear(); - SvxStandardDialog::dispose(); + if (m_bEdit) + m_rSh.ResetSelect(nullptr, false); } void SwInsFootNoteDlg::Init() @@ -213,62 +193,61 @@ void SwInsFootNoteDlg::Init() SwFormatFootnote aFootnoteNote; OUString sNumStr; vcl::Font aFont; - bExtCharAvailable = false; + m_bExtCharAvailable = false; - rSh.StartAction(); + m_rSh.StartAction(); - if( rSh.GetCurFootnote( &aFootnoteNote )) + if (m_rSh.GetCurFootnote(&aFootnoteNote)) { if (!aFootnoteNote.GetNumStr().isEmpty()) { sNumStr = aFootnoteNote.GetNumStr(); - rSh.Right(CRSR_SKIP_CHARS, true, 1, false ); - SfxItemSet aSet( rSh.GetAttrPool(), svl::Items<RES_CHRATR_FONT, RES_CHRATR_FONT>{} ); - rSh.GetCurAttr( aSet ); + m_rSh.Right(CRSR_SKIP_CHARS, true, 1, false ); + SfxItemSet aSet(m_rSh.GetAttrPool(), svl::Items<RES_CHRATR_FONT, RES_CHRATR_FONT>{}); + m_rSh.GetCurAttr(aSet); const SvxFontItem &rFont = aSet.Get( RES_CHRATR_FONT ); - - aFont = m_pNumberCharEdit->GetFont(); + aFont = m_xNumberCharEdit->get_font(); m_aFontName = rFont.GetFamilyName(); - eCharSet = rFont.GetCharSet(); + m_eCharSet = rFont.GetCharSet(); aFont.SetFamilyName(m_aFontName); - aFont.SetCharSet(eCharSet); - bExtCharAvailable = true; - rSh.Left( CRSR_SKIP_CHARS, false, 1, false ); + aFont.SetCharSet(m_eCharSet); + m_bExtCharAvailable = true; + m_rSh.Left( CRSR_SKIP_CHARS, false, 1, false ); } bFootnote = !aFootnoteNote.IsEndNote(); } - m_pNumberCharEdit->SetFont(aFont); + m_xNumberCharEdit->set_font(aFont); const bool bNumChar = !sNumStr.isEmpty(); - m_pNumberCharEdit->SetText(sNumStr); - m_pNumberCharBtn->Check(bNumChar); - m_pNumberAutoBtn->Check(!bNumChar); + m_xNumberCharEdit->set_text(sNumStr); + m_xNumberCharBtn->set_active(bNumChar); + m_xNumberAutoBtn->set_active(!bNumChar); if (bNumChar) - m_pNumberCharEdit->GrabFocus(); + m_xNumberCharEdit->grab_focus(); if (bFootnote) - m_pFootnoteBtn->Check(); + m_xFootnoteBtn->set_active(true); else - m_pEndNoteBtn->Check(); + m_xEndNoteBtn->set_active(true); - bool bNext = rSh.GotoNextFootnoteAnchor(); + bool bNext = m_rSh.GotoNextFootnoteAnchor(); if (bNext) - rSh.GotoPrevFootnoteAnchor(); + m_rSh.GotoPrevFootnoteAnchor(); - bool bPrev = rSh.GotoPrevFootnoteAnchor(); + bool bPrev = m_rSh.GotoPrevFootnoteAnchor(); if (bPrev) - rSh.GotoNextFootnoteAnchor(); + m_rSh.GotoNextFootnoteAnchor(); - m_pPrevBT->Enable(bPrev); - m_pNextBT->Enable(bNext); + m_xPrevBT->set_sensitive(bPrev); + m_xNextBT->set_sensitive(bNext); - rSh.Right(CRSR_SKIP_CHARS, true, 1, false ); + m_rSh.Right(CRSR_SKIP_CHARS, true, 1, false ); - rSh.EndAction(); + m_rSh.EndAction(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/insfnote.hxx b/sw/source/uibase/inc/insfnote.hxx index 9f83638fd88d..49ea5563fede 100644 --- a/sw/source/uibase/inc/insfnote.hxx +++ b/sw/source/uibase/inc/insfnote.hxx @@ -19,64 +19,65 @@ #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_INSFNOTE_HXX #define INCLUDED_SW_SOURCE_UIBASE_INC_INSFNOTE_HXX -#include <svx/stddlg.hxx> - -#include <vcl/button.hxx> - -#include <vcl/edit.hxx> -#include <vcl/fixed.hxx> +#include <vcl/weld.hxx> class SwWrtShell; class VclFrame; -class SwInsFootNoteDlg: public SvxStandardDialog +class SwInsFootNoteDlg: public weld::GenericDialogController { - SwWrtShell &rSh; + SwWrtShell &m_rSh; // everything for the character(s) OUString m_aFontName; - rtl_TextEncoding eCharSet; - bool bExtCharAvailable; - bool bEdit; + rtl_TextEncoding m_eCharSet; + bool m_bExtCharAvailable; + bool m_bEdit; - VclPtr<VclFrame> m_pNumberFrame; - VclPtr<RadioButton> m_pNumberAutoBtn; - VclPtr<RadioButton> m_pNumberCharBtn; - VclPtr<Edit> m_pNumberCharEdit; - VclPtr<PushButton> m_pNumberExtChar; + std::unique_ptr<weld::Widget> m_xNumberFrame; + std::unique_ptr<weld::RadioButton> m_xNumberAutoBtn; + std::unique_ptr<weld::RadioButton> m_xNumberCharBtn; + std::unique_ptr<weld::Entry> m_xNumberCharEdit; + std::unique_ptr<weld::Button> m_xNumberExtChar; // everything for the selection footnote/endnote - VclPtr<RadioButton> m_pFootnoteBtn; - VclPtr<RadioButton> m_pEndNoteBtn; + std::unique_ptr<weld::RadioButton> m_xFootnoteBtn; + std::unique_ptr<weld::RadioButton> m_xEndNoteBtn; - VclPtr<PushButton> m_pOkBtn; - VclPtr<PushButton> m_pPrevBT; - VclPtr<PushButton> m_pNextBT; + std::unique_ptr<weld::Button> m_xOkBtn; + std::unique_ptr<weld::Button> m_xPrevBT; + std::unique_ptr<weld::Button> m_xNextBT; - DECL_LINK(NumberCharHdl, Button *, void); - DECL_LINK(NumberEditHdl, Edit&, void); - DECL_LINK(NumberAutoBtnHdl, Button *, void); - DECL_LINK(NumberExtCharHdl, Button *, void); - DECL_LINK(NextPrevHdl, Button *, void); + DECL_LINK(NumberCharHdl, weld::Button&, void); + DECL_LINK(NumberEditHdl, weld::Entry&, void); + DECL_LINK(NumberAutoBtnHdl, weld::Button&, void); + DECL_LINK(NumberExtCharHdl, weld::Button&, void); + DECL_LINK(NextPrevHdl, weld::Button&, void); - virtual void Apply() override; + void Apply(); void Init(); public: - SwInsFootNoteDlg(vcl::Window * pParent, SwWrtShell &rSh, bool bEd); + SwInsFootNoteDlg(weld::Window * pParent, SwWrtShell &rSh, bool bEd); virtual ~SwInsFootNoteDlg() override; - virtual void dispose() override; const OUString& GetFontName() { return m_aFontName; } - bool IsEndNote() { return m_pEndNoteBtn->IsChecked(); } + bool IsEndNote() const { return m_xEndNoteBtn->get_active(); } OUString GetStr() - { - if ( m_pNumberCharBtn->IsChecked() ) - return m_pNumberCharEdit->GetText(); - return OUString(); - } + { + if (m_xNumberCharBtn->get_active()) + return m_xNumberCharEdit->get_text(); + return OUString(); + } + short execute() + { + short nRet = run(); + if (nRet == RET_OK) + Apply(); + return nRet; + } }; #endif diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 65f4b25ce6d2..ae9eff3704e9 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -564,7 +564,7 @@ void SwTextShell::Execute(SfxRequest &rReq) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialog creation failed!"); ScopedVclPtr<AbstractInsFootNoteDlg> pDlg(pFact->CreateInsFootNoteDlg( - GetView().GetWindow(), rWrtSh)); + GetView().GetFrameWeld(), rWrtSh)); OSL_ENSURE(pDlg, "Dialog creation failed!"); pDlg->SetHelpId(GetStaticInterface()->GetSlot(nSlot)->GetCommand()); if ( pDlg->Execute() == RET_OK ) @@ -647,7 +647,7 @@ void SwTextShell::Execute(SfxRequest &rReq) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); assert(pFact && "SwAbstractDialogFactory fail!"); - ScopedVclPtr<AbstractSwBreakDlg> pDlg(pFact->CreateSwBreakDlg(GetView().GetWindow()->GetFrameWeld(), rWrtSh)); + ScopedVclPtr<AbstractSwBreakDlg> pDlg(pFact->CreateSwBreakDlg(GetView().GetFrameWeld(), rWrtSh)); assert(pDlg && "Dialog creation failed!"); if ( pDlg->Execute() == RET_OK ) { @@ -740,7 +740,7 @@ void SwTextShell::Execute(SfxRequest &rReq) ScopedVclPtr<AbstractSwModalRedlineAcceptDlg> pDlg(pFact->CreateSwModalRedlineAcceptDlg(&GetView().GetEditWin())); OSL_ENSURE(pDlg, "Dialog creation failed!"); - switch (lcl_AskRedlineFlags(GetView().GetEditWin().GetFrameWeld())) + switch (lcl_AskRedlineFlags(GetView().GetFrameWeld())) { case RET_OK: { diff --git a/sw/source/uibase/uiview/viewdlg2.cxx b/sw/source/uibase/uiview/viewdlg2.cxx index 495bad85afd8..41bec30c8023 100644 --- a/sw/source/uibase/uiview/viewdlg2.cxx +++ b/sw/source/uibase/uiview/viewdlg2.cxx @@ -97,7 +97,7 @@ void SwView::ExecDlgExt(SfxRequest const &rReq) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); assert(pFact && "Dialog creation failed!"); ScopedVclPtr<AbstractInsFootNoteDlg> pDlg(pFact->CreateInsFootNoteDlg( - &rMDI, *m_pWrtShell, true)); + GetFrameWeld(), *m_pWrtShell, true)); assert(pDlg && "Dialog creation failed!"); pDlg->SetHelpId(GetStaticInterface()->GetSlot(FN_EDIT_FOOTNOTE)->GetCommand()); diff --git a/sw/uiconfig/swriter/ui/insertfootnote.ui b/sw/uiconfig/swriter/ui/insertfootnote.ui index 4b0d91128b35..7d1a0b05151f 100644 --- a/sw/uiconfig/swriter/ui/insertfootnote.ui +++ b/sw/uiconfig/swriter/ui/insertfootnote.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.4 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> <object class="GtkImage" id="image1"> @@ -16,6 +16,9 @@ <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="insertfootnote|InsertFootnoteDialog">Insert Footnote/Endnote</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"> @@ -30,6 +33,7 @@ <object class="GtkGrid" id="grid2"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="column_spacing">6</property> <property name="column_homogeneous">True</property> <child> <object class="GtkButton" id="prev"> @@ -103,6 +107,7 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="position">3</property> + <property name="secondary">True</property> </packing> </child> </object> @@ -144,12 +149,11 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="use_underline">True</property> <property name="valign">center</property> + <property name="use_underline">True</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">character</property> </object> <packing> <property name="left_attach">0</property> @@ -163,8 +167,8 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="use_underline">True</property> <property name="valign">center</property> + <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> <property name="group">automatic</property> @@ -183,6 +187,8 @@ <property name="can_focus">True</property> <property name="halign">start</property> <property name="valign">center</property> + <property name="max_length">10</property> + <property name="activates_default">True</property> <property name="width_chars">4</property> <property name="progress_fraction">0.0099999997764825821</property> <property name="progress_pulse_step">0.090000003576278687</property> @@ -259,12 +265,11 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="use_underline">True</property> <property name="valign">center</property> + <property name="use_underline">True</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">endnote</property> </object> <packing> <property name="expand">False</property> @@ -278,8 +283,8 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="use_underline">True</property> <property name="valign">center</property> + <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> <property name="group">footnote</property> @@ -325,5 +330,8 @@ <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> |