diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-06-02 19:37:35 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-06-02 22:16:25 +0200 |
commit | cd08397eedbe347784a3ac569481a17a8391e7b2 (patch) | |
tree | da1e98217f92c5b505caaa2dcb8d71a09180705d /sw/source/ui | |
parent | 846675d6c0ff6838526f97961e95eca945c60eeb (diff) |
weld SwSectionFootnoteEndTabPage
Change-Id: Ib4246a2f90780a005e79e2d071b43a5629a3242c
Reviewed-on: https://gerrit.libreoffice.org/55216
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/source/ui')
-rw-r--r-- | sw/source/ui/dialog/uiregionsw.cxx | 293 |
1 files changed, 131 insertions, 162 deletions
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index 6e1b83666fea..50f052154de7 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -1827,81 +1827,50 @@ IMPL_LINK( SwInsertSectionTabPage, DlgClosedHdl, sfx2::FileDialogHelper *, _pFil m_sFilterName = m_sFilePasswd = aEmptyOUStr; } -SwSectionFootnoteEndTabPage::SwSectionFootnoteEndTabPage( vcl::Window *pParent, - const SfxItemSet &rAttrSet) - : SfxTabPage( pParent, "FootnotesEndnotesTabPage", "modules/swriter/ui/footnotesendnotestabpage.ui", &rAttrSet ) - -{ - get(m_pFootnoteNtAtTextEndCB,"ftnntattextend"); - - get(m_pFootnoteNtNumCB,"ftnntnum"); - get(m_pFootnoteOffsetLbl,"ftnoffset_label"); - get(m_pFootnoteOffsetField,"ftnoffset"); - - get(m_pFootnoteNtNumFormatCB,"ftnntnumfmt"); - get(m_pFootnotePrefixFT,"ftnprefix_label"); - get(m_pFootnotePrefixED,"ftnprefix"); - get(m_pFootnoteNumViewBox,"ftnnumviewbox"); - get(m_pFootnoteSuffixFT,"ftnsuffix_label"); - get(m_pFootnoteSuffixED,"ftnsuffix"); - - get(m_pEndNtAtTextEndCB,"endntattextend"); - - get(m_pEndNtNumCB,"endntnum"); - get(m_pEndOffsetLbl,"endoffset_label"); - get(m_pEndOffsetField,"endoffset"); - - get(m_pEndNtNumFormatCB,"endntnumfmt"); - get(m_pEndPrefixFT,"endprefix_label"); - get(m_pEndPrefixED,"endprefix"); - get(m_pEndNumViewBox,"endnumviewbox"); - get(m_pEndSuffixFT,"endsuffix_label"); - get(m_pEndSuffixED,"endsuffix"); - - Link<Button*,void> aLk( LINK( this, SwSectionFootnoteEndTabPage, FootEndHdl)); - m_pFootnoteNtAtTextEndCB->SetClickHdl( aLk ); - m_pFootnoteNtNumCB->SetClickHdl( aLk ); - m_pEndNtAtTextEndCB->SetClickHdl( aLk ); - m_pEndNtNumCB->SetClickHdl( aLk ); - m_pFootnoteNtNumFormatCB->SetClickHdl( aLk ); - m_pEndNtNumFormatCB->SetClickHdl( aLk ); +SwSectionFootnoteEndTabPage::SwSectionFootnoteEndTabPage(TabPageParent pParent, const SfxItemSet &rAttrSet) + : SfxTabPage(pParent, "modules/swriter/ui/footnotesendnotestabpage.ui", "FootnotesEndnotesTabPage", &rAttrSet) + , m_xFootnoteNtAtTextEndCB(m_xBuilder->weld_check_button("ftnntattextend")) + , m_xFootnoteNtNumCB(m_xBuilder->weld_check_button("ftnntnum")) + , m_xFootnoteOffsetLbl(m_xBuilder->weld_label("ftnoffset_label")) + , m_xFootnoteOffsetField(m_xBuilder->weld_spin_button("ftnoffset")) + , m_xFootnoteNtNumFormatCB(m_xBuilder->weld_check_button("ftnntnumfmt")) + , m_xFootnotePrefixFT(m_xBuilder->weld_label("ftnprefix_label")) + , m_xFootnotePrefixED(m_xBuilder->weld_entry("ftnprefix")) + , m_xFootnoteNumViewBox(new NumberingTypeListBox(m_xBuilder->weld_combo_box_text("ftnnumviewbox"))) + , m_xFootnoteSuffixFT(m_xBuilder->weld_label("ftnsuffix_label")) + , m_xFootnoteSuffixED(m_xBuilder->weld_entry("ftnsuffix")) + , m_xEndNtAtTextEndCB(m_xBuilder->weld_check_button("endntattextend")) + , m_xEndNtNumCB(m_xBuilder->weld_check_button("endntnum")) + , m_xEndOffsetLbl(m_xBuilder->weld_label("endoffset_label")) + , m_xEndOffsetField(m_xBuilder->weld_spin_button("endoffset")) + , m_xEndNtNumFormatCB(m_xBuilder->weld_check_button("endntnumfmt")) + , m_xEndPrefixFT(m_xBuilder->weld_label("endprefix_label")) + , m_xEndPrefixED(m_xBuilder->weld_entry("endprefix")) + , m_xEndNumViewBox(new NumberingTypeListBox(m_xBuilder->weld_combo_box_text("endnumviewbox"))) + , m_xEndSuffixFT(m_xBuilder->weld_label("endsuffix_label")) + , m_xEndSuffixED(m_xBuilder->weld_entry("endsuffix")) +{ + m_xFootnoteNumViewBox->Reload(SwInsertNumTypes::Extended); + m_xEndNumViewBox->Reload(SwInsertNumTypes::Extended); + + Link<weld::ToggleButton&,void> aLk( LINK( this, SwSectionFootnoteEndTabPage, FootEndHdl)); + m_xFootnoteNtAtTextEndCB->connect_toggled( aLk ); + m_xFootnoteNtNumCB->connect_toggled( aLk ); + m_xEndNtAtTextEndCB->connect_toggled( aLk ); + m_xEndNtNumCB->connect_toggled( aLk ); + m_xFootnoteNtNumFormatCB->connect_toggled( aLk ); + m_xEndNtNumFormatCB->connect_toggled( aLk ); } SwSectionFootnoteEndTabPage::~SwSectionFootnoteEndTabPage() { - disposeOnce(); -} - -void SwSectionFootnoteEndTabPage::dispose() -{ - m_pFootnoteNtAtTextEndCB.clear(); - m_pFootnoteNtNumCB.clear(); - m_pFootnoteOffsetLbl.clear(); - m_pFootnoteOffsetField.clear(); - m_pFootnoteNtNumFormatCB.clear(); - m_pFootnotePrefixFT.clear(); - m_pFootnotePrefixED.clear(); - m_pFootnoteNumViewBox.clear(); - m_pFootnoteSuffixFT.clear(); - m_pFootnoteSuffixED.clear(); - m_pEndNtAtTextEndCB.clear(); - m_pEndNtNumCB.clear(); - m_pEndOffsetLbl.clear(); - m_pEndOffsetField.clear(); - m_pEndNtNumFormatCB.clear(); - m_pEndPrefixFT.clear(); - m_pEndPrefixED.clear(); - m_pEndNumViewBox.clear(); - m_pEndSuffixFT.clear(); - m_pEndSuffixED.clear(); - SfxTabPage::dispose(); } bool SwSectionFootnoteEndTabPage::FillItemSet( SfxItemSet* rSet ) { - SwFormatFootnoteAtTextEnd aFootnote( m_pFootnoteNtAtTextEndCB->IsChecked() - ? ( m_pFootnoteNtNumCB->IsChecked() - ? ( m_pFootnoteNtNumFormatCB->IsChecked() + SwFormatFootnoteAtTextEnd aFootnote( m_xFootnoteNtAtTextEndCB->get_active() + ? ( m_xFootnoteNtNumCB->get_active() + ? ( m_xFootnoteNtNumFormatCB->get_active() ? FTNEND_ATTXTEND_OWNNUMANDFMT : FTNEND_ATTXTEND_OWNNUMSEQ ) : FTNEND_ATTXTEND ) @@ -1910,20 +1879,20 @@ bool SwSectionFootnoteEndTabPage::FillItemSet( SfxItemSet* rSet ) switch( aFootnote.GetValue() ) { case FTNEND_ATTXTEND_OWNNUMANDFMT: - aFootnote.SetNumType( m_pFootnoteNumViewBox->GetSelectedNumberingType() ); - aFootnote.SetPrefix( m_pFootnotePrefixED->GetText().replaceAll("\\t", "\t") ); // fdo#65666 - aFootnote.SetSuffix( m_pFootnoteSuffixED->GetText().replaceAll("\\t", "\t") ); + aFootnote.SetNumType( m_xFootnoteNumViewBox->GetSelectedNumberingType() ); + aFootnote.SetPrefix( m_xFootnotePrefixED->get_text().replaceAll("\\t", "\t") ); // fdo#65666 + aFootnote.SetSuffix( m_xFootnoteSuffixED->get_text().replaceAll("\\t", "\t") ); SAL_FALLTHROUGH; case FTNEND_ATTXTEND_OWNNUMSEQ: - aFootnote.SetOffset( static_cast< sal_uInt16 >( m_pFootnoteOffsetField->GetValue()-1 ) ); + aFootnote.SetOffset( static_cast< sal_uInt16 >( m_xFootnoteOffsetField->get_value()-1 ) ); break; default: break; } - SwFormatEndAtTextEnd aEnd( m_pEndNtAtTextEndCB->IsChecked() - ? ( m_pEndNtNumCB->IsChecked() - ? ( m_pEndNtNumFormatCB->IsChecked() + SwFormatEndAtTextEnd aEnd( m_xEndNtAtTextEndCB->get_active() + ? ( m_xEndNtNumCB->get_active() + ? ( m_xEndNtNumFormatCB->get_active() ? FTNEND_ATTXTEND_OWNNUMANDFMT : FTNEND_ATTXTEND_OWNNUMSEQ ) : FTNEND_ATTXTEND ) @@ -1932,13 +1901,13 @@ bool SwSectionFootnoteEndTabPage::FillItemSet( SfxItemSet* rSet ) switch( aEnd.GetValue() ) { case FTNEND_ATTXTEND_OWNNUMANDFMT: - aEnd.SetNumType( m_pEndNumViewBox->GetSelectedNumberingType() ); - aEnd.SetPrefix( m_pEndPrefixED->GetText().replaceAll("\\t", "\t") ); - aEnd.SetSuffix( m_pEndSuffixED->GetText().replaceAll("\\t", "\t") ); + aEnd.SetNumType( m_xEndNumViewBox->GetSelectedNumberingType() ); + aEnd.SetPrefix( m_xEndPrefixED->get_text().replaceAll("\\t", "\t") ); + aEnd.SetSuffix( m_xEndSuffixED->get_text().replaceAll("\\t", "\t") ); SAL_FALLTHROUGH; case FTNEND_ATTXTEND_OWNNUMSEQ: - aEnd.SetOffset( static_cast< sal_uInt16 >( m_pEndOffsetField->GetValue()-1 ) ); + aEnd.SetOffset( static_cast< sal_uInt16 >( m_xEndOffsetField->get_value()-1 ) ); break; default: break; } @@ -1952,79 +1921,79 @@ bool SwSectionFootnoteEndTabPage::FillItemSet( SfxItemSet* rSet ) void SwSectionFootnoteEndTabPage::ResetState( bool bFootnote, const SwFormatFootnoteEndAtTextEnd& rAttr ) { - CheckBox *pNtAtTextEndCB, *pNtNumCB, *pNtNumFormatCB; - FixedText*pPrefixFT, *pSuffixFT; - Edit *pPrefixED, *pSuffixED; - SwNumberingTypeListBox *pNumViewBox; - FixedText* pOffsetText; - NumericField *pOffsetField; + weld::CheckButton *pNtAtTextEndCB, *pNtNumCB, *pNtNumFormatCB; + weld::Label *pPrefixFT, *pSuffixFT; + weld::Entry *pPrefixED, *pSuffixED; + NumberingTypeListBox *pNumViewBox; + weld::Label *pOffsetText; + weld::SpinButton *pOffsetField; if( bFootnote ) { - pNtAtTextEndCB = m_pFootnoteNtAtTextEndCB; - pNtNumCB = m_pFootnoteNtNumCB; - pNtNumFormatCB = m_pFootnoteNtNumFormatCB; - pPrefixFT = m_pFootnotePrefixFT; - pPrefixED = m_pFootnotePrefixED; - pSuffixFT = m_pFootnoteSuffixFT; - pSuffixED = m_pFootnoteSuffixED; - pNumViewBox = m_pFootnoteNumViewBox; - pOffsetText = m_pFootnoteOffsetLbl; - pOffsetField = m_pFootnoteOffsetField; + pNtAtTextEndCB = m_xFootnoteNtAtTextEndCB.get(); + pNtNumCB = m_xFootnoteNtNumCB.get(); + pNtNumFormatCB = m_xFootnoteNtNumFormatCB.get(); + pPrefixFT = m_xFootnotePrefixFT.get(); + pPrefixED = m_xFootnotePrefixED.get(); + pSuffixFT = m_xFootnoteSuffixFT.get(); + pSuffixED = m_xFootnoteSuffixED.get(); + pNumViewBox = m_xFootnoteNumViewBox.get(); + pOffsetText = m_xFootnoteOffsetLbl.get(); + pOffsetField = m_xFootnoteOffsetField.get(); } else { - pNtAtTextEndCB = m_pEndNtAtTextEndCB; - pNtNumCB = m_pEndNtNumCB; - pNtNumFormatCB = m_pEndNtNumFormatCB; - pPrefixFT = m_pEndPrefixFT; - pPrefixED = m_pEndPrefixED; - pSuffixFT = m_pEndSuffixFT; - pSuffixED = m_pEndSuffixED; - pNumViewBox = m_pEndNumViewBox; - pOffsetText = m_pEndOffsetLbl; - pOffsetField = m_pEndOffsetField; + pNtAtTextEndCB = m_xEndNtAtTextEndCB.get(); + pNtNumCB = m_xEndNtNumCB.get(); + pNtNumFormatCB = m_xEndNtNumFormatCB.get(); + pPrefixFT = m_xEndPrefixFT.get(); + pPrefixED = m_xEndPrefixED.get(); + pSuffixFT = m_xEndSuffixFT.get(); + pSuffixED = m_xEndSuffixED.get(); + pNumViewBox = m_xEndNumViewBox.get(); + pOffsetText = m_xEndOffsetLbl.get(); + pOffsetField = m_xEndOffsetField.get(); } const sal_uInt16 eState = rAttr.GetValue(); switch( eState ) { case FTNEND_ATTXTEND_OWNNUMANDFMT: - pNtNumFormatCB->SetState( TRISTATE_TRUE ); + pNtNumFormatCB->set_state( TRISTATE_TRUE ); SAL_FALLTHROUGH; case FTNEND_ATTXTEND_OWNNUMSEQ: - pNtNumCB->SetState( TRISTATE_TRUE ); + pNtNumCB->set_state( TRISTATE_TRUE ); SAL_FALLTHROUGH; case FTNEND_ATTXTEND: - pNtAtTextEndCB->SetState( TRISTATE_TRUE ); + pNtAtTextEndCB->set_state( TRISTATE_TRUE ); // no break; } pNumViewBox->SelectNumberingType( rAttr.GetNumType() ); - pOffsetField->SetValue( rAttr.GetOffset() + 1 ); - pPrefixED->SetText( rAttr.GetPrefix().replaceAll("\t", "\\t") ); - pSuffixED->SetText( rAttr.GetSuffix().replaceAll("\t", "\\t") ); + pOffsetField->set_value( rAttr.GetOffset() + 1 ); + pPrefixED->set_text( rAttr.GetPrefix().replaceAll("\t", "\\t") ); + pSuffixED->set_text( rAttr.GetSuffix().replaceAll("\t", "\\t") ); switch( eState ) { case FTNEND_ATPGORDOCEND: - pNtNumCB->Enable( false ); + pNtNumCB->set_sensitive( false ); SAL_FALLTHROUGH; case FTNEND_ATTXTEND: - pNtNumFormatCB->Enable( false ); - pOffsetField->Enable( false ); - pOffsetText->Enable( false ); + pNtNumFormatCB->set_sensitive( false ); + pOffsetField->set_sensitive( false ); + pOffsetText->set_sensitive( false ); SAL_FALLTHROUGH; case FTNEND_ATTXTEND_OWNNUMSEQ: pNumViewBox->Enable( false ); - pPrefixFT->Enable( false ); - pPrefixED->Enable( false ); - pSuffixFT->Enable( false ); - pSuffixED->Enable( false ); + pPrefixFT->set_sensitive( false ); + pPrefixED->set_sensitive( false ); + pSuffixFT->set_sensitive( false ); + pSuffixED->set_sensitive( false ); // no break; } } @@ -2038,61 +2007,61 @@ void SwSectionFootnoteEndTabPage::Reset( const SfxItemSet* rSet ) VclPtr<SfxTabPage> SwSectionFootnoteEndTabPage::Create( TabPageParent pParent, const SfxItemSet* rAttrSet) { - return VclPtr<SwSectionFootnoteEndTabPage>::Create(pParent.pParent, *rAttrSet); + return VclPtr<SwSectionFootnoteEndTabPage>::Create(pParent, *rAttrSet); } -IMPL_LINK( SwSectionFootnoteEndTabPage, FootEndHdl, Button *, pBox, void ) +IMPL_LINK( SwSectionFootnoteEndTabPage, FootEndHdl, weld::ToggleButton&, rBox, void ) { - bool bFoot = m_pFootnoteNtAtTextEndCB == pBox || m_pFootnoteNtNumCB == pBox || - m_pFootnoteNtNumFormatCB == pBox ; + bool bFoot = m_xFootnoteNtAtTextEndCB.get() == &rBox || m_xFootnoteNtNumCB.get() == &rBox || + m_xFootnoteNtNumFormatCB.get() == &rBox ; - CheckBox *pNumBox, *pNumFormatBox, *pEndBox; - SwNumberingTypeListBox* pNumViewBox; - FixedText* pOffsetText; - NumericField *pOffsetField; - FixedText*pPrefixFT, *pSuffixFT; - Edit *pPrefixED, *pSuffixED; + weld::CheckButton *pNumBox, *pNumFormatBox, *pEndBox; + NumberingTypeListBox* pNumViewBox; + weld::Label *pOffsetText; + weld::SpinButton *pOffsetField; + weld::Label *pPrefixFT, *pSuffixFT; + weld::Entry *pPrefixED, *pSuffixED; if( bFoot ) { - pEndBox = m_pFootnoteNtAtTextEndCB; - pNumBox = m_pFootnoteNtNumCB; - pNumFormatBox = m_pFootnoteNtNumFormatCB; - pNumViewBox = m_pFootnoteNumViewBox; - pOffsetText = m_pFootnoteOffsetLbl; - pOffsetField = m_pFootnoteOffsetField; - pPrefixFT = m_pFootnotePrefixFT; - pSuffixFT = m_pFootnoteSuffixFT; - pPrefixED = m_pFootnotePrefixED; - pSuffixED = m_pFootnoteSuffixED; + pEndBox = m_xFootnoteNtAtTextEndCB.get(); + pNumBox = m_xFootnoteNtNumCB.get(); + pNumFormatBox = m_xFootnoteNtNumFormatCB.get(); + pNumViewBox = m_xFootnoteNumViewBox.get(); + pOffsetText = m_xFootnoteOffsetLbl.get(); + pOffsetField = m_xFootnoteOffsetField.get(); + pPrefixFT = m_xFootnotePrefixFT.get(); + pSuffixFT = m_xFootnoteSuffixFT.get(); + pPrefixED = m_xFootnotePrefixED.get(); + pSuffixED = m_xFootnoteSuffixED.get(); } else { - pEndBox = m_pEndNtAtTextEndCB; - pNumBox = m_pEndNtNumCB; - pNumFormatBox = m_pEndNtNumFormatCB; - pNumViewBox = m_pEndNumViewBox; - pOffsetText = m_pEndOffsetLbl; - pOffsetField = m_pEndOffsetField; - pPrefixFT = m_pEndPrefixFT; - pSuffixFT = m_pEndSuffixFT; - pPrefixED = m_pEndPrefixED; - pSuffixED = m_pEndSuffixED; - } - - bool bEnableAtEnd = TRISTATE_TRUE == pEndBox->GetState(); - bool bEnableNum = bEnableAtEnd && TRISTATE_TRUE == pNumBox->GetState(); - bool bEnableNumFormat = bEnableNum && TRISTATE_TRUE == pNumFormatBox->GetState(); - - pNumBox->Enable( bEnableAtEnd ); - pOffsetText->Enable( bEnableNum ); - pOffsetField->Enable( bEnableNum ); - pNumFormatBox->Enable( bEnableNum ); + pEndBox = m_xEndNtAtTextEndCB.get(); + pNumBox = m_xEndNtNumCB.get(); + pNumFormatBox = m_xEndNtNumFormatCB.get(); + pNumViewBox = m_xEndNumViewBox.get(); + pOffsetText = m_xEndOffsetLbl.get(); + pOffsetField = m_xEndOffsetField.get(); + pPrefixFT = m_xEndPrefixFT.get(); + pSuffixFT = m_xEndSuffixFT.get(); + pPrefixED = m_xEndPrefixED.get(); + pSuffixED = m_xEndSuffixED.get(); + } + + bool bEnableAtEnd = TRISTATE_TRUE == pEndBox->get_state(); + bool bEnableNum = bEnableAtEnd && TRISTATE_TRUE == pNumBox->get_state(); + bool bEnableNumFormat = bEnableNum && TRISTATE_TRUE == pNumFormatBox->get_state(); + + pNumBox->set_sensitive( bEnableAtEnd ); + pOffsetText->set_sensitive( bEnableNum ); + pOffsetField->set_sensitive( bEnableNum ); + pNumFormatBox->set_sensitive( bEnableNum ); pNumViewBox->Enable( bEnableNumFormat ); - pPrefixED->Enable( bEnableNumFormat ); - pSuffixED->Enable( bEnableNumFormat ); - pPrefixFT->Enable( bEnableNumFormat ); - pSuffixFT->Enable( bEnableNumFormat ); + pPrefixED->set_sensitive( bEnableNumFormat ); + pSuffixED->set_sensitive( bEnableNumFormat ); + pPrefixFT->set_sensitive( bEnableNumFormat ); + pSuffixFT->set_sensitive( bEnableNumFormat ); } SwSectionPropertyTabDialog::SwSectionPropertyTabDialog( |