include/svx/langbox.hxx | 2 sd/inc/sdabstdlg.hxx | 2 sd/qa/unit/dialogs-test.cxx | 5 sd/source/ui/dlg/dlgfield.cxx | 190 ++++++++++++++++-------------------- sd/source/ui/dlg/sddlgfact.cxx | 14 +- sd/source/ui/dlg/sddlgfact.hxx | 11 +- sd/source/ui/inc/dlgfield.hxx | 25 +--- sd/source/ui/view/drviews2.cxx | 3 sd/source/ui/view/outlnvs2.cxx | 3 sd/uiconfig/simpress/ui/dlgfield.ui | 23 +++- 10 files changed, 144 insertions(+), 134 deletions(-)
New commits: commit 1bbc741c078899a16cedd78def6d4107f3ed4c96 Author: Caolán McNamara <caol...@redhat.com> Date: Fri May 11 16:11:47 2018 +0100 weld SdModifyFieldDlg Change-Id: I7e84f09b854d30474d37dfb3ce47a8a739dd5543 Reviewed-on: https://gerrit.libreoffice.org/54148 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/svx/langbox.hxx b/include/svx/langbox.hxx index b64f5d28fc3f..3b91701f8df9 100644 --- a/include/svx/langbox.hxx +++ b/include/svx/langbox.hxx @@ -170,6 +170,8 @@ public: void SelectEntryPos(int nPos) { m_xControl->set_active(nPos); } void connect_changed(const Link<weld::ComboBoxText&, void>& rLink) { m_aChangeHdl = rLink; } + void save_value() { m_xControl->save_value(); } + bool get_value_changed_from_saved() const { return m_xControl->get_value_changed_from_saved(); } void hide() { m_xControl->hide(); } }; diff --git a/sd/inc/sdabstdlg.hxx b/sd/inc/sdabstdlg.hxx index 27fb17ddd9ed..076555758960 100644 --- a/sd/inc/sdabstdlg.hxx +++ b/sd/inc/sdabstdlg.hxx @@ -177,7 +177,7 @@ public: virtual VclPtr<AbstractSdCustomShowDlg> CreateSdCustomShowDlg(weld::Window* pWindow, SdDrawDocument& rDrawDoc) = 0; virtual VclPtr<SfxAbstractTabDialog> CreateSdTabCharDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell) = 0; virtual VclPtr<SfxAbstractTabDialog> CreateSdTabPageDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage) = 0; - virtual VclPtr<AbstractSdModifyFieldDlg> CreateSdModifyFieldDlg(vcl::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet) = 0; + virtual VclPtr<AbstractSdModifyFieldDlg> CreateSdModifyFieldDlg(weld::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet) = 0; virtual VclPtr<AbstractSdSnapLineDlg> CreateSdSnapLineDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) = 0; virtual VclPtr<AbstractSdInsertLayerDlg> CreateSdInsertLayerDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& rStr) = 0; virtual VclPtr<AbstractSdInsertPagesObjsDlg> CreateSdInsertPagesObjsDlg(vcl::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName) = 0; diff --git a/sd/qa/unit/dialogs-test.cxx b/sd/qa/unit/dialogs-test.cxx index 8a2d6603ac55..d68ef7e4b5e1 100644 --- a/sd/qa/unit/dialogs-test.cxx +++ b/sd/qa/unit/dialogs-test.cxx @@ -338,9 +338,10 @@ VclPtr<VclAbstractDialog> SdDialogsTest::createDialogByID(sal_uInt32 nID) } case 6: { - // CreateSdModifyFieldDlg(vcl::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet) override; + // CreateSdModifyFieldDlg(weld::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet) override; + auto const parent = getViewShell()->GetActiveWindow(); pRetval = getSdAbstractDialogFactory()->CreateSdModifyFieldDlg( - Application::GetDefDialogParent(), + parent == nullptr ? nullptr : parent->GetFrameWeld(), nullptr, getEmptySfxItemSet()); break; diff --git a/sd/source/ui/dlg/dlgfield.cxx b/sd/source/ui/dlg/dlgfield.cxx index b20291547764..0f185c25813f 100644 --- a/sd/source/ui/dlg/dlgfield.cxx +++ b/sd/source/ui/dlg/dlgfield.cxx @@ -38,36 +38,24 @@ /** * dialog to edit field commands */ -SdModifyFieldDlg::SdModifyFieldDlg( vcl::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet ) : - ModalDialog ( pWindow, "EditFieldsDialog", "modules/simpress/ui/dlgfield.ui" ), - maInputSet ( rSet ), - pField ( pInField ) +SdModifyFieldDlg::SdModifyFieldDlg(weld::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet) + : GenericDialogController(pWindow, "modules/simpress/ui/dlgfield.ui", "EditFieldsDialog") + , m_aInputSet(rSet) + , m_pField(pInField) + , m_xRbtFix(m_xBuilder->weld_radio_button("fixedRB")) + , m_xRbtVar(m_xBuilder->weld_radio_button("varRB")) + , m_xLbLanguage(new LanguageBox(m_xBuilder->weld_combo_box_text("languageLB"))) + , m_xLbFormat(m_xBuilder->weld_combo_box_text("formatLB")) { - get(m_pRbtFix, "fixedRB"); - get(m_pRbtVar, "varRB"); - get(m_pLbLanguage, "languageLB"); - get(m_pLbFormat, "formatLB"); - - m_pLbLanguage->SetLanguageList( SvxLanguageListFlags::ALL|SvxLanguageListFlags::ONLY_KNOWN, false ); - m_pLbLanguage->SetSelectHdl( LINK( this, SdModifyFieldDlg, LanguageChangeHdl ) ); + m_xLbLanguage->SetLanguageList( SvxLanguageListFlags::ALL|SvxLanguageListFlags::ONLY_KNOWN, false ); + m_xLbLanguage->connect_changed(LINK(this, SdModifyFieldDlg, LanguageChangeHdl)); FillControls(); } SdModifyFieldDlg::~SdModifyFieldDlg() { - disposeOnce(); } -void SdModifyFieldDlg::dispose() -{ - m_pRbtFix.clear(); - m_pRbtVar.clear(); - m_pLbLanguage.clear(); - m_pLbFormat.clear(); - ModalDialog::dispose(); -} - - /** * Returns the new field, owned by caller. * Returns NULL if nothing has changed. @@ -76,56 +64,56 @@ SvxFieldData* SdModifyFieldDlg::GetField() { SvxFieldData* pNewField = nullptr; - if( m_pRbtFix->IsValueChangedFromSaved() || - m_pRbtVar->IsValueChangedFromSaved() || - m_pLbFormat->IsValueChangedFromSaved() ) + if( m_xRbtFix->get_state_changed_from_saved() || + m_xRbtVar->get_state_changed_from_saved() || + m_xLbFormat->get_value_changed_from_saved() ) { - if( dynamic_cast< const SvxDateField *>( pField ) != nullptr ) + if( dynamic_cast< const SvxDateField *>( m_pField ) != nullptr ) { - const SvxDateField* pDateField = static_cast<const SvxDateField*>(pField); + const SvxDateField* pDateField = static_cast<const SvxDateField*>(m_pField); SvxDateType eType; SvxDateFormat eFormat; - if( m_pRbtFix->IsChecked() ) + if( m_xRbtFix->get_active() ) eType = SvxDateType::Fix; else eType = SvxDateType::Var; - eFormat = static_cast<SvxDateFormat>( m_pLbFormat->GetSelectedEntryPos() + 2 ); + eFormat = static_cast<SvxDateFormat>( m_xLbFormat->get_active() + 2 ); pNewField = new SvxDateField( *pDateField ); static_cast<SvxDateField*>( pNewField )->SetType( eType ); static_cast<SvxDateField*>( pNewField )->SetFormat( eFormat ); } - else if( dynamic_cast< const SvxExtTimeField *>( pField ) != nullptr ) + else if( dynamic_cast< const SvxExtTimeField *>( m_pField ) != nullptr ) { - const SvxExtTimeField* pTimeField = static_cast<const SvxExtTimeField*>( pField ); + const SvxExtTimeField* pTimeField = static_cast<const SvxExtTimeField*>( m_pField ); SvxTimeType eType; SvxTimeFormat eFormat; - if( m_pRbtFix->IsChecked() ) + if( m_xRbtFix->get_active() ) eType = SvxTimeType::Fix; else eType = SvxTimeType::Var; - eFormat = static_cast<SvxTimeFormat>( m_pLbFormat->GetSelectedEntryPos() + 2 ); + eFormat = static_cast<SvxTimeFormat>( m_xLbFormat->get_active() + 2 ); pNewField = new SvxExtTimeField( *pTimeField ); static_cast<SvxExtTimeField*>( pNewField )->SetType( eType ); static_cast<SvxExtTimeField*>( pNewField )->SetFormat( eFormat ); } - else if( dynamic_cast< const SvxExtFileField *>( pField ) != nullptr ) + else if( dynamic_cast< const SvxExtFileField *>( m_pField ) != nullptr ) { - const SvxExtFileField* pFileField = static_cast<const SvxExtFileField*>( pField ); + const SvxExtFileField* pFileField = static_cast<const SvxExtFileField*>( m_pField ); SvxFileType eType; SvxFileFormat eFormat; - if( m_pRbtFix->IsChecked() ) + if( m_xRbtFix->get_active() ) eType = SvxFileType::Fix; else eType = SvxFileType::Var; - eFormat = static_cast<SvxFileFormat>( m_pLbFormat->GetSelectedEntryPos() ); + eFormat = static_cast<SvxFileFormat>( m_xLbFormat->get_active() ); ::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell* >(SfxObjectShell::Current() ); @@ -143,17 +131,17 @@ SvxFieldData* SdModifyFieldDlg::GetField() static_cast<SvxExtFileField*>( pNewField )->SetFormat( eFormat ); } } - else if( dynamic_cast< const SvxAuthorField *>( pField ) != nullptr ) + else if( dynamic_cast< const SvxAuthorField *>( m_pField ) != nullptr ) { SvxAuthorType eType; SvxAuthorFormat eFormat; - if( m_pRbtFix->IsChecked() ) + if( m_xRbtFix->get_active() ) eType = SvxAuthorType::Fix; else eType = SvxAuthorType::Var; - eFormat = static_cast<SvxAuthorFormat>( m_pLbFormat->GetSelectedEntryPos() ); + eFormat = static_cast<SvxAuthorFormat>( m_xLbFormat->get_active() ); // Get current state of address, not the old one SvtUserOptions aUserOptions; @@ -168,88 +156,88 @@ SvxFieldData* SdModifyFieldDlg::GetField() void SdModifyFieldDlg::FillFormatList() { - LanguageType eLangType = m_pLbLanguage->GetSelectedLanguage(); + LanguageType eLangType = m_xLbLanguage->GetSelectedLanguage(); - m_pLbFormat->Clear(); + m_xLbFormat->clear(); - if( dynamic_cast< const SvxDateField *>( pField ) != nullptr ) + if( dynamic_cast< const SvxDateField *>( m_pField ) != nullptr ) { - const SvxDateField* pDateField = static_cast<const SvxDateField*>( pField ); + const SvxDateField* pDateField = static_cast<const SvxDateField*>( m_pField ); SvxDateField aDateField( *pDateField ); //SvxDateFormat::AppDefault, // not used //SvxDateFormat::System, // not used - m_pLbFormat->InsertEntry( SdResId( STR_STANDARD_SMALL ) ); - m_pLbFormat->InsertEntry( SdResId( STR_STANDARD_BIG ) ); + m_xLbFormat->append_text( SdResId( STR_STANDARD_SMALL ) ); + m_xLbFormat->append_text( SdResId( STR_STANDARD_BIG ) ); SvNumberFormatter* pNumberFormatter = SD_MOD()->GetNumberFormatter(); aDateField.SetFormat( SvxDateFormat::A ); // 13.02.96 - m_pLbFormat->InsertEntry( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); + m_xLbFormat->append_text( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); aDateField.SetFormat( SvxDateFormat::B ); // 13.02.1996 - m_pLbFormat->InsertEntry( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); + m_xLbFormat->append_text( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); aDateField.SetFormat( SvxDateFormat::C ); // 13.Feb 1996 - m_pLbFormat->InsertEntry( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); + m_xLbFormat->append_text( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); aDateField.SetFormat( SvxDateFormat::D ); // 13.Februar 1996 - m_pLbFormat->InsertEntry( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); + m_xLbFormat->append_text( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); aDateField.SetFormat( SvxDateFormat::E ); // Die, 13.Februar 1996 - m_pLbFormat->InsertEntry( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); + m_xLbFormat->append_text( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); aDateField.SetFormat( SvxDateFormat::F ); // Dienstag, 13.Februar 1996 - m_pLbFormat->InsertEntry( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); + m_xLbFormat->append_text( aDateField.GetFormatted( *pNumberFormatter, eLangType ) ); - m_pLbFormat->SelectEntryPos( static_cast<sal_uInt16>(pDateField->GetFormat()) - 2 ); + m_xLbFormat->set_active( static_cast<sal_uInt16>(pDateField->GetFormat()) - 2 ); } - else if( dynamic_cast< const SvxExtTimeField *>( pField ) != nullptr ) + else if( dynamic_cast< const SvxExtTimeField *>( m_pField ) != nullptr ) { - const SvxExtTimeField* pTimeField = static_cast<const SvxExtTimeField*>( pField ); + const SvxExtTimeField* pTimeField = static_cast<const SvxExtTimeField*>( m_pField ); SvxExtTimeField aTimeField( *pTimeField ); //SvxTimeFormat::AppDefault, // not used //SvxTimeFormat::System, // not used - m_pLbFormat->InsertEntry( SdResId( STR_STANDARD_NORMAL ) ); + m_xLbFormat->append_text( SdResId( STR_STANDARD_NORMAL ) ); SvNumberFormatter* pNumberFormatter = SD_MOD()->GetNumberFormatter(); aTimeField.SetFormat( SvxTimeFormat::HH24_MM ); // 13:49 - m_pLbFormat->InsertEntry( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); + m_xLbFormat->append_text( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); aTimeField.SetFormat( SvxTimeFormat::HH24_MM_SS ); // 13:49:38 - m_pLbFormat->InsertEntry( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); + m_xLbFormat->append_text( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); aTimeField.SetFormat( SvxTimeFormat::HH24_MM_SS_00 ); // 13:49:38.78 - m_pLbFormat->InsertEntry( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); + m_xLbFormat->append_text( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); aTimeField.SetFormat( SvxTimeFormat::HH12_MM ); // 01:49 - m_pLbFormat->InsertEntry( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); + m_xLbFormat->append_text( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); aTimeField.SetFormat( SvxTimeFormat::HH12_MM_SS ); // 01:49:38 - m_pLbFormat->InsertEntry( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); + m_xLbFormat->append_text( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); aTimeField.SetFormat( SvxTimeFormat::HH12_MM_SS_00 ); // 01:49:38.78 - m_pLbFormat->InsertEntry( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); + m_xLbFormat->append_text( aTimeField.GetFormatted( *pNumberFormatter, eLangType ) ); //SvxTimeFormat::HH12_MM_AMPM, // 01:49 PM //SvxTimeFormat::HH12_MM_SS_AMPM, // 01:49:38 PM //SvxTimeFormat::HH12_MM_SS_00_AMPM // 01:49:38.78 PM - m_pLbFormat->SelectEntryPos( static_cast<sal_uInt16>(pTimeField->GetFormat()) - 2 ); + m_xLbFormat->set_active( static_cast<sal_uInt16>(pTimeField->GetFormat()) - 2 ); } - else if( dynamic_cast< const SvxExtFileField *>( pField ) != nullptr ) + else if( dynamic_cast< const SvxExtFileField *>( m_pField ) != nullptr ) { - const SvxExtFileField* pFileField = static_cast<const SvxExtFileField*>( pField ); + const SvxExtFileField* pFileField = static_cast<const SvxExtFileField*>( m_pField ); SvxExtFileField aFileField( *pFileField ); - m_pLbFormat->InsertEntry( SdResId( STR_FILEFORMAT_NAME_EXT ) ); - m_pLbFormat->InsertEntry( SdResId( STR_FILEFORMAT_FULLPATH ) ); - m_pLbFormat->InsertEntry( SdResId( STR_FILEFORMAT_PATH ) ); - m_pLbFormat->InsertEntry( SdResId( STR_FILEFORMAT_NAME ) ); + m_xLbFormat->append_text( SdResId( STR_FILEFORMAT_NAME_EXT ) ); + m_xLbFormat->append_text( SdResId( STR_FILEFORMAT_FULLPATH ) ); + m_xLbFormat->append_text( SdResId( STR_FILEFORMAT_PATH ) ); + m_xLbFormat->append_text( SdResId( STR_FILEFORMAT_NAME ) ); - m_pLbFormat->SelectEntryPos( static_cast<sal_uInt16>( pFileField->GetFormat() ) ); + m_xLbFormat->set_active( static_cast<sal_uInt16>( pFileField->GetFormat() ) ); } - else if( dynamic_cast< const SvxAuthorField *>( pField ) != nullptr ) + else if( dynamic_cast< const SvxAuthorField *>( m_pField ) != nullptr ) { - const SvxAuthorField* pAuthorField = static_cast<const SvxAuthorField*>( pField ); + const SvxAuthorField* pAuthorField = static_cast<const SvxAuthorField*>( m_pField ); SvxAuthorField aAuthorField( *pAuthorField ); for( sal_uInt16 i = 0; i < 4; i++ ) { aAuthorField.SetFormat( static_cast<SvxAuthorFormat>(i) ); - m_pLbFormat->InsertEntry( aAuthorField.GetFormatted() ); + m_xLbFormat->append_text( aAuthorField.GetFormatted() ); } - m_pLbFormat->SelectEntryPos( static_cast<sal_uInt16>( pAuthorField->GetFormat() ) ); + m_xLbFormat->set_active( static_cast<sal_uInt16>( pAuthorField->GetFormat() ) ); } @@ -257,73 +245,73 @@ void SdModifyFieldDlg::FillFormatList() void SdModifyFieldDlg::FillControls() { - m_pLbFormat->Clear(); + m_xLbFormat->clear(); - if( dynamic_cast< const SvxDateField *>( pField ) != nullptr ) + if( dynamic_cast< const SvxDateField *>( m_pField ) != nullptr ) { - const SvxDateField* pDateField = static_cast<const SvxDateField*>(pField); + const SvxDateField* pDateField = static_cast<const SvxDateField*>(m_pField); SvxDateField aDateField( *pDateField ); if( pDateField->GetType() == SvxDateType::Fix ) - m_pRbtFix->Check(); + m_xRbtFix->set_active(true); else - m_pRbtVar->Check(); + m_xRbtVar->set_active(true); } - else if( dynamic_cast< const SvxExtTimeField *>( pField ) != nullptr ) + else if( dynamic_cast< const SvxExtTimeField *>( m_pField ) != nullptr ) { - const SvxExtTimeField* pTimeField = static_cast<const SvxExtTimeField*>(pField); + const SvxExtTimeField* pTimeField = static_cast<const SvxExtTimeField*>(m_pField); SvxExtTimeField aTimeField( *pTimeField ); if( pTimeField->GetType() == SvxTimeType::Fix ) - m_pRbtFix->Check(); + m_xRbtFix->set_active(true); else - m_pRbtVar->Check(); + m_xRbtVar->set_active(true); } - else if( dynamic_cast< const SvxExtFileField *>( pField ) != nullptr ) + else if( dynamic_cast< const SvxExtFileField *>( m_pField ) != nullptr ) { - const SvxExtFileField* pFileField = static_cast<const SvxExtFileField*>(pField); + const SvxExtFileField* pFileField = static_cast<const SvxExtFileField*>(m_pField); SvxExtFileField aFileField( *pFileField ); if( pFileField->GetType() == SvxFileType::Fix ) - m_pRbtFix->Check(); + m_xRbtFix->set_active(true); else - m_pRbtVar->Check(); + m_xRbtVar->set_active(true); } - else if( dynamic_cast< const SvxAuthorField *>( pField ) != nullptr ) + else if( dynamic_cast< const SvxAuthorField *>( m_pField ) != nullptr ) { - const SvxAuthorField* pAuthorField = static_cast<const SvxAuthorField*>(pField); + const SvxAuthorField* pAuthorField = static_cast<const SvxAuthorField*>(m_pField); SvxAuthorField aAuthorField( *pAuthorField ); if( pAuthorField->GetType() == SvxAuthorType::Fix ) - m_pRbtFix->Check(); + m_xRbtFix->set_active(true); else - m_pRbtVar->Check(); + m_xRbtVar->set_active(true); } - m_pRbtFix->SaveValue(); - m_pRbtVar->SaveValue(); + m_xRbtFix->save_state(); + m_xRbtVar->save_state(); const SfxPoolItem* pItem; - if( SfxItemState::SET == maInputSet.GetItemState(EE_CHAR_LANGUAGE, true, &pItem ) ) - m_pLbLanguage->SelectLanguage( static_cast<const SvxLanguageItem*>(pItem)->GetLanguage() ); + if( SfxItemState::SET == m_aInputSet.GetItemState(EE_CHAR_LANGUAGE, true, &pItem ) ) + m_xLbLanguage->SelectLanguage( static_cast<const SvxLanguageItem*>(pItem)->GetLanguage() ); - m_pLbLanguage->SaveValue(); + m_xLbLanguage->save_value(); FillFormatList(); - m_pLbFormat->SaveValue(); + m_xLbFormat->save_value(); } -IMPL_LINK_NOARG(SdModifyFieldDlg, LanguageChangeHdl, ListBox&, void) +IMPL_LINK_NOARG(SdModifyFieldDlg, LanguageChangeHdl, weld::ComboBoxText&, void) { FillFormatList(); } SfxItemSet SdModifyFieldDlg::GetItemSet() { - SfxItemSet aOutput( *maInputSet.GetPool(), svl::Items<EE_CHAR_LANGUAGE, EE_CHAR_LANGUAGE_CTL>{} ); + SfxItemSet aOutput( *m_aInputSet.GetPool(), svl::Items<EE_CHAR_LANGUAGE, EE_CHAR_LANGUAGE_CTL>{} ); - if( m_pLbLanguage->IsValueChangedFromSaved() ) + if( m_xLbLanguage->get_value_changed_from_saved() ) { - LanguageType eLangType = m_pLbLanguage->GetSelectedLanguage(); + LanguageType eLangType = m_xLbLanguage->GetSelectedLanguage(); SvxLanguageItem aItem( eLangType, EE_CHAR_LANGUAGE ); aOutput.Put( aItem ); diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx index f609fca3a774..5481d7533e38 100644 --- a/sd/source/ui/dlg/sddlgfact.cxx +++ b/sd/source/ui/dlg/sddlgfact.cxx @@ -62,7 +62,11 @@ short AbstractSdCustomShowDlg_Impl::Execute() IMPL_ABSTDLG_BASE(SdAbstractTabDialog_Impl); IMPL_ABSTDLG_BASE(SdPresLayoutTemplateDlg_Impl); -IMPL_ABSTDLG_BASE(AbstractSdModifyFieldDlg_Impl); + +short AbstractSdModifyFieldDlg_Impl::Execute() +{ + return m_xDlg->run(); +} short AbstractSdSnapLineDlg_Impl::Execute() { @@ -211,12 +215,12 @@ void SdPresLayoutTemplateDlg_Impl::SetText( const OUString& rStr ) SvxFieldData* AbstractSdModifyFieldDlg_Impl::GetField() { - return pDlg->GetField(); + return m_xDlg->GetField(); } SfxItemSet AbstractSdModifyFieldDlg_Impl::GetItemSet() { - return pDlg->GetItemSet(); + return m_xDlg->GetItemSet(); } void AbstractSdSnapLineDlg_Impl::GetAttr(SfxItemSet& rOutAttrs) @@ -353,9 +357,9 @@ VclPtr<SfxAbstractTabDialog> SdAbstractDialogFactory_Impl::CreateSdTabPageDialo return VclPtr<SdAbstractTabDialog_Impl>::Create( VclPtr<SdPageDlg>::Create( pDocShell, pParent, pAttr, bAreaPage ) ); } -VclPtr<AbstractSdModifyFieldDlg> SdAbstractDialogFactory_Impl::CreateSdModifyFieldDlg( vcl::Window* pParent, const SvxFieldData* pInField, const SfxItemSet& rSet ) +VclPtr<AbstractSdModifyFieldDlg> SdAbstractDialogFactory_Impl::CreateSdModifyFieldDlg(weld::Window* pParent, const SvxFieldData* pInField, const SfxItemSet& rSet) { - return VclPtr<AbstractSdModifyFieldDlg_Impl>::Create( VclPtr<SdModifyFieldDlg>::Create( pParent, pInField, rSet ) ); + return VclPtr<AbstractSdModifyFieldDlg_Impl>::Create(new SdModifyFieldDlg(pParent, pInField, rSet)); } VclPtr<AbstractSdSnapLineDlg> SdAbstractDialogFactory_Impl::CreateSdSnapLineDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx index a6f5319dba38..5e2b2f11c2d8 100644 --- a/sd/source/ui/dlg/sddlgfact.hxx +++ b/sd/source/ui/dlg/sddlgfact.hxx @@ -153,7 +153,14 @@ class SdPresLayoutTemplateDlg_Impl : public SfxAbstractTabDialog class SdModifyFieldDlg; class AbstractSdModifyFieldDlg_Impl : public AbstractSdModifyFieldDlg { - DECL_ABSTDLG_BASE(AbstractSdModifyFieldDlg_Impl,SdModifyFieldDlg) +private: + std::unique_ptr<SdModifyFieldDlg> m_xDlg; +public: + AbstractSdModifyFieldDlg_Impl(SdModifyFieldDlg* pDlg) + : m_xDlg(pDlg) + { + } + virtual short Execute() override; virtual SvxFieldData* GetField() override; virtual SfxItemSet GetItemSet() override; }; @@ -284,7 +291,7 @@ public: virtual VclPtr<AbstractSdCustomShowDlg> CreateSdCustomShowDlg(weld::Window* pParent, SdDrawDocument& rDrawDoc) override; virtual VclPtr<SfxAbstractTabDialog> CreateSdTabCharDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell) override; virtual VclPtr<SfxAbstractTabDialog> CreateSdTabPageDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage) override; - virtual VclPtr<AbstractSdModifyFieldDlg> CreateSdModifyFieldDlg( vcl::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet ) override; + virtual VclPtr<AbstractSdModifyFieldDlg> CreateSdModifyFieldDlg(weld::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet) override; virtual VclPtr<AbstractSdSnapLineDlg> CreateSdSnapLineDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) override; virtual VclPtr<AbstractSdInsertLayerDlg> CreateSdInsertLayerDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& aStr) override; virtual VclPtr<AbstractSdInsertPagesObjsDlg> CreateSdInsertPagesObjsDlg(vcl::Window* pParent, const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName ) override; diff --git a/sd/source/ui/inc/dlgfield.hxx b/sd/source/ui/inc/dlgfield.hxx index 69e194f8ba55..4fa9e740e99e 100644 --- a/sd/source/ui/inc/dlgfield.hxx +++ b/sd/source/ui/inc/dlgfield.hxx @@ -20,37 +20,32 @@ #ifndef INCLUDED_SD_SOURCE_UI_INC_DLGFIELD_HXX #define INCLUDED_SD_SOURCE_UI_INC_DLGFIELD_HXX -#include <vcl/lstbox.hxx> -#include <vcl/group.hxx> -#include <vcl/fixed.hxx> -#include <vcl/button.hxx> -#include <vcl/dialog.hxx> +#include <vcl/weld.hxx> #include <svx/langbox.hxx> class SvxFieldData; /** * dialog to adjust field-commands */ -class SdModifyFieldDlg : public ModalDialog +class SdModifyFieldDlg : public weld::GenericDialogController { private: - VclPtr<RadioButton> m_pRbtFix; - VclPtr<RadioButton> m_pRbtVar; - VclPtr<SvxLanguageBox> m_pLbLanguage; - VclPtr<ListBox> m_pLbFormat; - SfxItemSet maInputSet; + SfxItemSet m_aInputSet; + const SvxFieldData* m_pField; - const SvxFieldData* pField; + std::unique_ptr<weld::RadioButton> m_xRbtFix; + std::unique_ptr<weld::RadioButton> m_xRbtVar; + std::unique_ptr<LanguageBox> m_xLbLanguage; + std::unique_ptr<weld::ComboBoxText> m_xLbFormat; void FillFormatList(); void FillControls(); - DECL_LINK( LanguageChangeHdl, ListBox&, void ); + DECL_LINK(LanguageChangeHdl, weld::ComboBoxText&, void); public: - SdModifyFieldDlg( vcl::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet ); + SdModifyFieldDlg(weld::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet); virtual ~SdModifyFieldDlg() override; - virtual void dispose() override; SvxFieldData* GetField(); SfxItemSet GetItemSet(); diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 5a9649b48eaf..e6b9b92604fa 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -2392,7 +2392,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { // Dialog... SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSdModifyFieldDlg> pDlg(pFact ? pFact->CreateSdModifyFieldDlg(GetActiveWindow(), pFldItem->GetField(), pOLV->GetAttribs() ) : nullptr); + vcl::Window* pWin = GetActiveWindow(); + ScopedVclPtr<AbstractSdModifyFieldDlg> pDlg(pFact ? pFact->CreateSdModifyFieldDlg(pWin ? pWin->GetFrameWeld() : nullptr, pFldItem->GetField(), pOLV->GetAttribs() ) : nullptr); if( pDlg && pDlg->Execute() == RET_OK ) { // To make a correct SetAttribs() call at the utlinerView diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx index d5dddac528f1..c398f2148224 100644 --- a/sd/source/ui/view/outlnvs2.cxx +++ b/sd/source/ui/view/outlnvs2.cxx @@ -573,7 +573,8 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) { // Dialog... SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSdModifyFieldDlg> pDlg(pFact ? pFact->CreateSdModifyFieldDlg(GetActiveWindow(), pFldItem->GetField(), pOutlinerView->GetAttribs() ) : nullptr); + vcl::Window* pWin = GetActiveWindow(); + ScopedVclPtr<AbstractSdModifyFieldDlg> pDlg(pFact ? pFact->CreateSdModifyFieldDlg(pWin ? pWin->GetFrameWeld() : nullptr, pFldItem->GetField(), pOutlinerView->GetAttribs() ) : nullptr); if( pDlg && (pDlg->Execute() == RET_OK) ) { std::unique_ptr<SvxFieldData> pField(pDlg->GetField()); diff --git a/sd/uiconfig/simpress/ui/dlgfield.ui b/sd/uiconfig/simpress/ui/dlgfield.ui index 68f42648f164..b6e81af1518b 100644 --- a/sd/uiconfig/simpress/ui/dlgfield.ui +++ b/sd/uiconfig/simpress/ui/dlgfield.ui @@ -1,22 +1,27 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sd"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> <object class="GtkDialog" id="EditFieldsDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="dlgfield|EditFieldsDialog">Edit Field</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> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <property name="spacing">12</property> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area1"> <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="layout_style">start</property> + <property name="layout_style">end</property> <child> <object class="GtkButton" id="ok"> <property name="label">gtk-ok</property> @@ -59,6 +64,7 @@ <property name="expand">True</property> <property name="fill">True</property> <property name="position">2</property> + <property name="secondary">True</property> </packing> </child> </object> @@ -105,7 +111,6 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">varRB</property> </object> <packing> <property name="expand">False</property> @@ -172,9 +177,15 @@ </packing> </child> <child> - <object class="svxcorelo-SvxLanguageBox" id="languageLB"> + <object class="GtkComboBoxText" id="languageLB"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="has_entry">True</property> + <child internal-child="entry"> + <object class="GtkEntry"> + <property name="can_focus">True</property> + </object> + </child> </object> <packing> <property name="expand">False</property> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits