From cd08397eedbe347784a3ac569481a17a8391e7b2 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 2 Jun 2018 19:37:35 +0100 Subject: weld SwSectionFootnoteEndTabPage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib4246a2f90780a005e79e2d071b43a5629a3242c Reviewed-on: https://gerrit.libreoffice.org/55216 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- cui/source/tabpages/textattr.cxx | 89 +------ extras/source/glade/libreoffice-catalog.xml.in | 3 - sw/source/ui/dialog/uiregionsw.cxx | 293 +++++++++------------ sw/source/uibase/inc/numberingtypelistbox.hxx | 18 +- sw/source/uibase/inc/regionsw.hxx | 52 ++-- sw/source/uibase/misc/numberingtypelistbox.cxx | 145 ---------- sw/uiconfig/swriter/ui/footnotesendnotestabpage.ui | 88 ++----- 7 files changed, 186 insertions(+), 502 deletions(-) diff --git a/cui/source/tabpages/textattr.cxx b/cui/source/tabpages/textattr.cxx index 9cb423211176..1e1eddde34de 100644 --- a/cui/source/tabpages/textattr.cxx +++ b/cui/source/tabpages/textattr.cxx @@ -322,24 +322,28 @@ bool SvxTextAttrPage::FillItemSet( SfxItemSet* rAttrs) if( m_xMtrFldLeft->get_value_changed_from_saved() ) { + fprintf(stderr, "a one\n"); nValue = GetCoreValue( *m_xMtrFldLeft, eUnit ); rAttrs->Put( makeSdrTextLeftDistItem( nValue ) ); } if( m_xMtrFldRight->get_value_changed_from_saved() ) { + fprintf(stderr, "b one\n"); nValue = GetCoreValue( *m_xMtrFldRight, eUnit ); rAttrs->Put( makeSdrTextRightDistItem( nValue ) ); } if( m_xMtrFldTop->get_value_changed_from_saved() ) { + fprintf(stderr, "c one\n"); nValue = GetCoreValue( *m_xMtrFldTop, eUnit ); rAttrs->Put( makeSdrTextUpperDistItem( nValue ) ); } if( m_xMtrFldBottom->get_value_changed_from_saved() ) { + fprintf(stderr, "d one\n"); nValue = GetCoreValue( *m_xMtrFldBottom, eUnit ); rAttrs->Put( makeSdrTextLowerDistItem( nValue ) ); } @@ -347,108 +351,31 @@ bool SvxTextAttrPage::FillItemSet( SfxItemSet* rAttrs) eState = m_xTsbAutoGrowHeight->get_state(); if( m_xTsbAutoGrowHeight->get_state_changed_from_saved() ) { + fprintf(stderr, "one %d\n", TRISTATE_TRUE == eState); rAttrs->Put( makeSdrTextAutoGrowHeightItem( TRISTATE_TRUE == eState ) ); } eState = m_xTsbAutoGrowWidth->get_state(); if( m_xTsbAutoGrowWidth->get_state_changed_from_saved() ) { + fprintf(stderr, "e one\n"); rAttrs->Put( makeSdrTextAutoGrowWidthItem( TRISTATE_TRUE == eState ) ); } eState = m_xTsbAutoGrowSize->get_state(); if( m_xTsbAutoGrowSize->get_state_changed_from_saved() ) { + fprintf(stderr, "two %d\n", TRISTATE_TRUE == eState); rAttrs->Put( makeSdrTextAutoGrowHeightItem( TRISTATE_TRUE == eState ) ); } eState = m_xTsbWordWrapText->get_state(); if( m_xTsbWordWrapText->get_state_changed_from_saved() ) { + fprintf(stderr, "f one\n"); rAttrs->Put( makeSdrTextWordWrapItem( TRISTATE_TRUE == eState ) ); } - eState = m_xTsbContour->get_state(); - if( m_xTsbContour->get_state_changed_from_saved() ) - { - rAttrs->Put( makeSdrTextContourFrameItem( TRISTATE_TRUE == eState ) ); - } - - eState = m_xTsbFitToSize->get_state(); - if( m_xTsbFitToSize->get_state_changed_from_saved() ) - { - drawing::TextFitToSizeType eFTS; - switch( eState ) - { - default: ; //prevent warning - OSL_FAIL( "svx::SvxTextAttrPage::FillItemSet(), unhandled state!" ); - SAL_FALLTHROUGH; - case TRISTATE_FALSE: eFTS = drawing::TextFitToSizeType_AUTOFIT; break; - case TRISTATE_TRUE: eFTS = drawing::TextFitToSizeType_PROPORTIONAL; break; - } - rAttrs->Put( SdrTextFitToSizeTypeItem( eFTS ) ); - } - - // centered - RectPoint eRP = m_aCtlPosition.GetActualRP(); - SdrTextVertAdjust eTVA, eOldTVA; - SdrTextHorzAdjust eTHA, eOldTHA; - - switch( eRP ) - { - default: - case RectPoint::LT: eTVA = SDRTEXTVERTADJUST_TOP; - eTHA = SDRTEXTHORZADJUST_LEFT; break; - case RectPoint::LM: eTVA = SDRTEXTVERTADJUST_CENTER; - eTHA = SDRTEXTHORZADJUST_LEFT; break; - case RectPoint::LB: eTVA = SDRTEXTVERTADJUST_BOTTOM; - eTHA = SDRTEXTHORZADJUST_LEFT; break; - case RectPoint::MT: eTVA = SDRTEXTVERTADJUST_TOP; - eTHA = SDRTEXTHORZADJUST_CENTER; break; - case RectPoint::MM: eTVA = SDRTEXTVERTADJUST_CENTER; - eTHA = SDRTEXTHORZADJUST_CENTER; break; - case RectPoint::MB: eTVA = SDRTEXTVERTADJUST_BOTTOM; - eTHA = SDRTEXTHORZADJUST_CENTER; break; - case RectPoint::RT: eTVA = SDRTEXTVERTADJUST_TOP; - eTHA = SDRTEXTHORZADJUST_RIGHT; break; - case RectPoint::RM: eTVA = SDRTEXTVERTADJUST_CENTER; - eTHA = SDRTEXTHORZADJUST_RIGHT; break; - case RectPoint::RB: eTVA = SDRTEXTVERTADJUST_BOTTOM; - eTHA = SDRTEXTHORZADJUST_RIGHT; break; - } - - // #103516# Do not change values if adjust controls were disabled. - bool bIsDisabled(m_aCtlPosition.IsCompletelyDisabled()); - - if(!bIsDisabled) - { - if( m_xTsbFullWidth->get_state() == TRISTATE_TRUE ) - { - if (IsTextDirectionLeftToRight()) - eTHA = SDRTEXTHORZADJUST_BLOCK; - else - eTVA = SDRTEXTVERTADJUST_BLOCK; - } - - if ( rOutAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ) != SfxItemState::DONTCARE ) - { - eOldTVA = rOutAttrs.Get( SDRATTR_TEXT_VERTADJUST ).GetValue(); - if( eOldTVA != eTVA ) - rAttrs->Put( SdrTextVertAdjustItem( eTVA ) ); - } - else - rAttrs->Put( SdrTextVertAdjustItem( eTVA ) ); - - if ( rOutAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ) != SfxItemState::DONTCARE ) - { - eOldTHA = rOutAttrs.Get( SDRATTR_TEXT_HORZADJUST ).GetValue(); - if( eOldTHA != eTHA ) - rAttrs->Put( SdrTextHorzAdjustItem( eTHA ) ); - } - else - rAttrs->Put( SdrTextHorzAdjustItem( eTHA ) ); - } - return true; } diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index 04fbd09c5a22..37e57b1c4c83 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -440,9 +440,6 @@ - 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 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 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 SwSectionFootnoteEndTabPage::Create( TabPageParent pParent, const SfxItemSet* rAttrSet) { - return VclPtr::Create(pParent.pParent, *rAttrSet); + return VclPtr::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( diff --git a/sw/source/uibase/inc/numberingtypelistbox.hxx b/sw/source/uibase/inc/numberingtypelistbox.hxx index b6c83f14e5c1..fc4c48890805 100644 --- a/sw/source/uibase/inc/numberingtypelistbox.hxx +++ b/sw/source/uibase/inc/numberingtypelistbox.hxx @@ -41,23 +41,6 @@ namespace o3tl { struct SwNumberingTypeListBox_Impl; -class SW_DLLPUBLIC SwNumberingTypeListBox : public ListBox -{ - std::unique_ptr pImpl; - -public: - SwNumberingTypeListBox( vcl::Window* pWin, WinBits nStyle ); - virtual ~SwNumberingTypeListBox() override; - virtual void dispose() override; - - virtual bool set_property(const OString &rKey, const OUString &rValue) override; - - void Reload(SwInsertNumTypes nTypeFlags); - - SvxNumType GetSelectedNumberingType(); - bool SelectNumberingType(SvxNumType nType); -}; - class SW_DLLPUBLIC NumberingTypeListBox { std::unique_ptr m_xWidget; @@ -73,6 +56,7 @@ public: SvxNumType GetSelectedNumberingType(); bool SelectNumberingType(SvxNumType nType); void SetNoSelection() { m_xWidget->set_active(-1); } + void Enable(bool bEnable) { m_xWidget->set_sensitive(bEnable); } }; #endif diff --git a/sw/source/uibase/inc/regionsw.hxx b/sw/source/uibase/inc/regionsw.hxx index 83480447d891..df0642a2e140 100644 --- a/sw/source/uibase/inc/regionsw.hxx +++ b/sw/source/uibase/inc/regionsw.hxx @@ -191,39 +191,33 @@ public: class SwSectionFootnoteEndTabPage : public SfxTabPage { - VclPtr m_pFootnoteNtAtTextEndCB; - - VclPtr m_pFootnoteNtNumCB; - VclPtr m_pFootnoteOffsetLbl; - VclPtr m_pFootnoteOffsetField; - - VclPtr m_pFootnoteNtNumFormatCB; - VclPtr m_pFootnotePrefixFT; - VclPtr m_pFootnotePrefixED; - VclPtr m_pFootnoteNumViewBox; - VclPtr m_pFootnoteSuffixFT; - VclPtr m_pFootnoteSuffixED; - - VclPtr m_pEndNtAtTextEndCB; - - VclPtr m_pEndNtNumCB; - VclPtr m_pEndOffsetLbl; - VclPtr m_pEndOffsetField; - - VclPtr m_pEndNtNumFormatCB; - VclPtr m_pEndPrefixFT; - VclPtr m_pEndPrefixED; - VclPtr m_pEndNumViewBox; - VclPtr m_pEndSuffixFT; - VclPtr m_pEndSuffixED; - - DECL_LINK( FootEndHdl, Button*, void ); + std::unique_ptr m_xFootnoteNtAtTextEndCB; + std::unique_ptr m_xFootnoteNtNumCB; + std::unique_ptr m_xFootnoteOffsetLbl; + std::unique_ptr m_xFootnoteOffsetField; + std::unique_ptr m_xFootnoteNtNumFormatCB; + std::unique_ptr m_xFootnotePrefixFT; + std::unique_ptr m_xFootnotePrefixED; + std::unique_ptr m_xFootnoteNumViewBox; + std::unique_ptr m_xFootnoteSuffixFT; + std::unique_ptr m_xFootnoteSuffixED; + std::unique_ptr m_xEndNtAtTextEndCB; + std::unique_ptr m_xEndNtNumCB; + std::unique_ptr m_xEndOffsetLbl; + std::unique_ptr m_xEndOffsetField; + std::unique_ptr m_xEndNtNumFormatCB; + std::unique_ptr m_xEndPrefixFT; + std::unique_ptr m_xEndPrefixED; + std::unique_ptr m_xEndNumViewBox; + std::unique_ptr m_xEndSuffixFT; + std::unique_ptr m_xEndSuffixED; + + DECL_LINK(FootEndHdl, weld::ToggleButton&, void); void ResetState( bool bFootnote, const SwFormatFootnoteEndAtTextEnd& ); public: - SwSectionFootnoteEndTabPage( vcl::Window *pParent, const SfxItemSet &rAttrSet ); + SwSectionFootnoteEndTabPage(TabPageParent pParent, const SfxItemSet &rAttrSet); virtual ~SwSectionFootnoteEndTabPage() override; - virtual void dispose() override; virtual bool FillItemSet( SfxItemSet* ) override; virtual void Reset( const SfxItemSet* ) override; diff --git a/sw/source/uibase/misc/numberingtypelistbox.cxx b/sw/source/uibase/misc/numberingtypelistbox.cxx index c4bc802155ca..ad3b37db48f7 100644 --- a/sw/source/uibase/misc/numberingtypelistbox.cxx +++ b/sw/source/uibase/misc/numberingtypelistbox.cxx @@ -38,151 +38,6 @@ struct SwNumberingTypeListBox_Impl uno::Reference xInfo; }; -SwNumberingTypeListBox::SwNumberingTypeListBox( vcl::Window* pWin, WinBits nStyle ) : - ListBox(pWin, nStyle), - pImpl(new SwNumberingTypeListBox_Impl) -{ - uno::Reference xContext( ::comphelper::getProcessComponentContext() ); - uno::Reference xDefNum = text::DefaultNumberingProvider::create(xContext); - - pImpl->xInfo.set(xDefNum, uno::UNO_QUERY); -} - -bool SwNumberingTypeListBox::set_property(const OString &rKey, const OUString &rValue) -{ - if (rKey == "type") - Reload(static_cast(rValue.toInt32())); - else - return ListBox::set_property(rKey, rValue); - return true; -} - -extern "C" SAL_DLLPUBLIC_EXPORT void makeSwNumberingTypeListBox(VclPtr & rRet, VclPtr & pParent, VclBuilder::stringmap &) -{ - VclPtrInstance pListBox(pParent, WB_LEFT|WB_DROPDOWN|WB_VCENTER|WB_3DLOOK|WB_TABSTOP); - pListBox->EnableAutoSize(true); - rRet = pListBox; -} - -SwNumberingTypeListBox::~SwNumberingTypeListBox() -{ - disposeOnce(); -} - -void SwNumberingTypeListBox::dispose() -{ - pImpl.reset(); - ListBox::dispose(); -} - -void SwNumberingTypeListBox::Reload(SwInsertNumTypes nTypeFlags) -{ - Clear(); - uno::Sequence aTypes; - const sal_Int16* pTypes = nullptr; - if(nTypeFlags & SwInsertNumTypes::Extended) - { - if(pImpl->xInfo.is()) - { - aTypes = pImpl->xInfo->getSupportedNumberingTypes(); - pTypes = aTypes.getConstArray(); - } - } - - for(size_t i = 0; i < SvxNumberingTypeTable::Count(); i++) - { - sal_IntPtr nValue = SvxNumberingTypeTable::GetValue(i); - bool bInsert = true; - sal_Int32 nPos = LISTBOX_APPEND; - switch(nValue) - { - case style::NumberingType::NUMBER_NONE: - bInsert = bool(nTypeFlags & SwInsertNumTypes::NoNumbering); - nPos = 0; - - break; - case style::NumberingType::CHAR_SPECIAL: - bInsert = bool(nTypeFlags & SwInsertNumTypes::Bullet); - - break; - case style::NumberingType::PAGE_DESCRIPTOR: - bInsert = bool(nTypeFlags & SwInsertNumTypes::PageStyleNumbering); - - break; - case style::NumberingType::BITMAP: - bInsert = bool(nTypeFlags & SwInsertNumTypes::Bitmap ); - - break; - case style::NumberingType::BITMAP | LINK_TOKEN: - bInsert = false; - - break; - default: - if (nValue > style::NumberingType::CHARS_LOWER_LETTER_N) - { - // Insert only if offered by i18n framework per configuration. - bInsert = false; - if (pTypes) - { - for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++) - { - if (pTypes[nType] == nValue) - { - bInsert = true; - break; // for - } - } - } - } - } - if(bInsert) - { - sal_Int32 nEntry = InsertEntry(SvxNumberingTypeTable::GetString(i), nPos); - SetEntryData( nEntry, reinterpret_cast(nValue) ); - } - } - if(nTypeFlags & SwInsertNumTypes::Extended) - { - if(pTypes) - { - for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++) - { - sal_Int16 nCurrent = pTypes[nType]; - if(nCurrent > style::NumberingType::CHARS_LOWER_LETTER_N) - { - if(LISTBOX_ENTRY_NOTFOUND == GetEntryPos(reinterpret_cast(static_cast(nCurrent)))) - { - OUString aIdent = pImpl->xInfo->getNumberingIdentifier( nCurrent ); - sal_Int32 nPos = InsertEntry(aIdent); - SetEntryData(nPos, reinterpret_cast(static_cast(nCurrent))); - } - } - } - } - SelectEntryPos(0); - } -} - -SvxNumType SwNumberingTypeListBox::GetSelectedNumberingType() -{ - SvxNumType nRet = SVX_NUM_CHARS_UPPER_LETTER; - sal_Int32 nSelPos = GetSelectedEntryPos(); - if(LISTBOX_ENTRY_NOTFOUND != nSelPos) - nRet = static_cast(reinterpret_cast(GetEntryData(nSelPos))); -#if OSL_DEBUG_LEVEL > 0 - else - OSL_FAIL("SwNumberingTypeListBox not selected"); -#endif - return nRet; -} - -bool SwNumberingTypeListBox::SelectNumberingType(SvxNumType nType) -{ - sal_Int32 nPos = GetEntryPos(reinterpret_cast(static_cast(nType))); - SelectEntryPos( nPos ); - return LISTBOX_ENTRY_NOTFOUND != nPos; -} - NumberingTypeListBox::NumberingTypeListBox(weld::ComboBoxText* pWidget) : m_xWidget(pWidget) , m_xImpl(new SwNumberingTypeListBox_Impl) diff --git a/sw/uiconfig/swriter/ui/footnotesendnotestabpage.ui b/sw/uiconfig/swriter/ui/footnotesendnotestabpage.ui index 7c846fa4c5d9..bd4e527399d3 100644 --- a/sw/uiconfig/swriter/ui/footnotesendnotestabpage.ui +++ b/sw/uiconfig/swriter/ui/footnotesendnotestabpage.ui @@ -1,13 +1,19 @@ + - - + 1 9999 1 10 + + 1 + 9999 + 1 + 10 + True False @@ -58,8 +64,6 @@ 0 0 - 1 - 1 @@ -73,13 +77,12 @@ True True + True adjustment1 1 0 - 1 - 1 @@ -87,24 +90,20 @@ True False 12 - 0 _Start at: True ftnoffset + 0 0 0 - 1 - 1 0 1 - 1 - 1 @@ -122,8 +121,6 @@ 0 2 - 1 - 1 @@ -138,42 +135,36 @@ True True 50 + True 6 4 0 - 1 - 1 True False - 0 Aft_er: True ftnsuffix + 0 3 0 - 1 - 1 - + True False - 16 2 0 - 1 - 1 @@ -181,13 +172,12 @@ True True 50 + True 6 1 0 - 1 - 1 @@ -195,32 +185,26 @@ True False 24 - 0 Be_fore: True ftnprefix + 0 0 0 - 1 - 1 0 3 - 1 - 1 0 1 - 1 - 1 @@ -237,8 +221,6 @@ 0 0 - 1 - 1 @@ -298,8 +280,6 @@ 0 0 - 1 - 1 @@ -324,8 +304,6 @@ 0 0 - 1 - 1 @@ -339,13 +317,12 @@ True True - adjustment1 + True + adjustment2 1 0 - 1 - 1 @@ -353,24 +330,20 @@ True False 12 - 0 _Start at: True endoffset + 0 0 0 - 1 - 1 0 1 - 1 - 1 @@ -388,8 +361,6 @@ 0 2 - 1 - 1 @@ -404,42 +375,36 @@ True True 50 + True 6 4 0 - 1 - 1 True False - 0 Aft_er: True endsuffix + 0 3 0 - 1 - 1 - + True False - 16 2 0 - 1 - 1 @@ -447,13 +412,12 @@ True True 50 + True 6 1 0 - 1 - 1 @@ -461,32 +425,26 @@ True False 24 - 0 Be_fore: True endprefix + 0 0 0 - 1 - 1 0 3 - 1 - 1 0 1 - 1 - 1 -- cgit v1.2.3