diff options
23 files changed, 124 insertions, 112 deletions
diff --git a/cui/source/customize/SvxMenuConfigPage.cxx b/cui/source/customize/SvxMenuConfigPage.cxx index cedbaa457f91..882c578aa2cb 100644 --- a/cui/source/customize/SvxMenuConfigPage.cxx +++ b/cui/source/customize/SvxMenuConfigPage.cxx @@ -366,13 +366,13 @@ IMPL_LINK( SvxMenuConfigPage, InsertHdl, MenuButton *, pButton, void ) OUString aNewName; OUString aDesc = CuiResId( RID_SVXSTR_SUBMENU_NAME ); - VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc ); - pNameDialog->SetHelpId( HID_SVX_CONFIG_NAME_SUBMENU ); - pNameDialog->SetText( CuiResId( RID_SVXSTR_ADD_SUBMENU ) ); + SvxNameDialog aNameDialog(GetFrameWeld(), aNewName, aDesc); + aNameDialog.set_help_id(HID_SVX_CONFIG_NAME_SUBMENU); + aNameDialog.set_title(CuiResId( RID_SVXSTR_ADD_SUBMENU)); - if ( pNameDialog->Execute() == RET_OK ) + if (aNameDialog.run() == RET_OK) { - pNameDialog->GetName(aNewName); + aNewName = aNameDialog.GetName(); SvxConfigEntry* pNewEntryData = new SvxConfigEntry( aNewName, aNewName, true, /*bParentData*/false ); @@ -415,13 +415,13 @@ IMPL_LINK( SvxMenuConfigPage, ModifyItemHdl, MenuButton *, pButton, void ) OUString aNewName( SvxConfigPageHelper::stripHotKey( pEntry->GetName() ) ); OUString aDesc = CuiResId( RID_SVXSTR_LABEL_NEW_NAME ); - VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc ); - pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_MENU_ITEM ); - pNameDialog->SetText( CuiResId( RID_SVXSTR_RENAME_MENU ) ); + SvxNameDialog aNameDialog(GetFrameWeld(), aNewName, aDesc); + aNameDialog.set_help_id(HID_SVX_CONFIG_RENAME_MENU_ITEM); + aNameDialog.set_title(CuiResId(RID_SVXSTR_RENAME_MENU)); - if ( pNameDialog->Execute() == RET_OK ) + if (aNameDialog.run() == RET_OK) { - pNameDialog->GetName( aNewName ); + aNewName = aNameDialog.GetName(); pEntry->SetName( aNewName ); m_pContentsListBox->SetEntryText( pActEntry, aNewName ); diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx index 2b485738c6b3..f8a530cb5094 100644 --- a/cui/source/customize/SvxToolbarConfigPage.cxx +++ b/cui/source/customize/SvxToolbarConfigPage.cxx @@ -472,13 +472,13 @@ IMPL_LINK( SvxToolbarConfigPage, ModifyItemHdl, MenuButton *, pButton, void ) OUString aNewName( SvxConfigPageHelper::stripHotKey( pEntry->GetName() ) ); OUString aDesc = CuiResId( RID_SVXSTR_LABEL_NEW_NAME ); - VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc ); - pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_TOOLBAR_ITEM ); - pNameDialog->SetText( CuiResId( RID_SVXSTR_RENAME_TOOLBAR ) ); + SvxNameDialog aNameDialog(GetFrameWeld(), aNewName, aDesc); + aNameDialog.set_help_id(HID_SVX_CONFIG_RENAME_TOOLBAR_ITEM); + aNameDialog.set_title(CuiResId(RID_SVXSTR_RENAME_TOOLBAR)); - if ( pNameDialog->Execute() == RET_OK ) + if (aNameDialog.run() == RET_OK) { - pNameDialog->GetName(aNewName); + aNewName = aNameDialog.GetName(); if( aNewName.isEmpty() ) // tdf#80758 - Accelerator character ("~") is passed as pEntry->SetName( "~" ); // the button name in case of empty values. diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx index eddb0450ecc2..e8873de17ebd 100644 --- a/cui/source/dialogs/dlgname.cxx +++ b/cui/source/dialogs/dlgname.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <vcl/svapp.hxx> #include <dlgname.hxx> #include <defdlgname.hxx> #include <dialmgr.hxx> @@ -27,43 +28,29 @@ |* \************************************************************************/ -SvxNameDialog::SvxNameDialog( vcl::Window* pWindow, const OUString& rName, const OUString& rDesc ) : - ModalDialog ( pWindow, "NameDialog", "cui/ui/namedialog.ui" ) +SvxNameDialog::SvxNameDialog(weld::Window* pParent, const OUString& rName, const OUString& rDesc) + : m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/namedialog.ui")) + , m_xDialog(m_xBuilder->weld_dialog("NameDialog")) + , m_xEdtName(m_xBuilder->weld_entry("name_entry")) + , m_xFtDescription(m_xBuilder->weld_label("description_label")) + , m_xBtnOK(m_xBuilder->weld_button("ok")) { - get(pBtnOK, "ok"); - get(pFtDescription, "description_label"); - get(pEdtName, "name_entry"); - - pFtDescription->SetText( rDesc ); - pEdtName->SetText( rName ); - pEdtName->SetSelection(Selection(SELECTION_MIN, SELECTION_MAX)); - ModifyHdl(*pEdtName.get()); - pEdtName->SetModifyHdl(LINK(this, SvxNameDialog, ModifyHdl)); -} - -SvxNameDialog::~SvxNameDialog() -{ - disposeOnce(); + m_xFtDescription->set_label(rDesc); + m_xEdtName->set_text(rName); + m_xEdtName->select_region(0, -1); + ModifyHdl(*m_xEdtName); + m_xEdtName->connect_changed(LINK(this, SvxNameDialog, ModifyHdl)); } -void SvxNameDialog::dispose() -{ - pFtDescription.clear(); - pEdtName.clear(); - pBtnOK.clear(); - ModalDialog::dispose(); -} - -IMPL_LINK_NOARG(SvxNameDialog, ModifyHdl, Edit&, void) +IMPL_LINK_NOARG(SvxNameDialog, ModifyHdl, weld::Entry&, void) { // Do not allow empty names - if(aCheckNameHdl.IsSet()) - pBtnOK->Enable(!pEdtName->GetText().isEmpty() && aCheckNameHdl.Call(*this)); + if (m_aCheckNameHdl.IsSet()) + m_xBtnOK->set_sensitive(!m_xEdtName->get_text().isEmpty() && m_aCheckNameHdl.Call(*this)); else - pBtnOK->Enable(!pEdtName->GetText().isEmpty()); + m_xBtnOK->set_sensitive(!m_xEdtName->get_text().isEmpty()); } - // #i68101# // Dialog for editing Object Name // plus uniqueness-callback-linkHandler diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 0abacf383412..b1f5a97dc2e3 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -115,7 +115,11 @@ IMPL_ABSTDLG_BASE(AbstractSvxCaptionDialog_Impl); IMPL_ABSTDLG_BASE(AbstractSvxJSearchOptionsDialog_Impl); IMPL_ABSTDLG_BASE(AbstractFmInputRecordNoDialog_Impl); IMPL_ABSTDLG_BASE(AbstractSvxNewDictionaryDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractSvxNameDialog_Impl); + +short AbstractSvxNameDialog_Impl::Execute() +{ + return m_xDlg->run(); +} // #i68101# IMPL_ABSTDLG_BASE(AbstractSvxObjectNameDialog_Impl); @@ -555,29 +559,33 @@ long AbstractFmInputRecordNoDialog_Impl::GetValue() const void AbstractSvxNameDialog_Impl::GetName(OUString& rName) { - pDlg->GetName( rName ); + rName = m_xDlg->GetName(); } void AbstractSvxNameDialog_Impl::SetCheckNameHdl( const Link<AbstractSvxNameDialog&,bool>& rLink, bool bCheckImmediately ) { aCheckNameHdl = rLink; if( rLink.IsSet() ) - pDlg->SetCheckNameHdl( LINK(this, AbstractSvxNameDialog_Impl, CheckNameHdl), bCheckImmediately ); + m_xDlg->SetCheckNameHdl( LINK(this, AbstractSvxNameDialog_Impl, CheckNameHdl), bCheckImmediately ); else - pDlg->SetCheckNameHdl( Link<SvxNameDialog&,bool>(), bCheckImmediately ); + m_xDlg->SetCheckNameHdl( Link<SvxNameDialog&,bool>(), bCheckImmediately ); } -void AbstractSvxNameDialog_Impl::SetEditHelpId(const OString& aHelpId) + +void AbstractSvxNameDialog_Impl::SetEditHelpId(const OString& rHelpId) { - pDlg->SetEditHelpId( aHelpId ); + m_xDlg->SetEditHelpId(rHelpId); } -void AbstractSvxNameDialog_Impl::SetHelpId( const OString& aHelpId ) + +void AbstractSvxNameDialog_Impl::SetHelpId(const OString& rHelpId) { - pDlg->SetHelpId( aHelpId ); + m_xDlg->set_help_id(rHelpId); } + void AbstractSvxNameDialog_Impl::SetText( const OUString& rStr ) { - pDlg->SetText( rStr ); + m_xDlg->set_title(rStr); } + IMPL_LINK_NOARG(AbstractSvxNameDialog_Impl, CheckNameHdl, SvxNameDialog&, bool) { return aCheckNameHdl.Call(*this); @@ -1090,11 +1098,10 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateSvxEditDictionaryDia return VclPtr<CuiVclAbstractDialog_Impl>::Create( pDlg ); } -VclPtr<AbstractSvxNameDialog> AbstractDialogFactory_Impl::CreateSvxNameDialog( vcl::Window* pParent, - const OUString& rName, const OUString& rDesc ) +VclPtr<AbstractSvxNameDialog> AbstractDialogFactory_Impl::CreateSvxNameDialog(weld::Window* pParent, + const OUString& rName, const OUString& rDesc) { - VclPtrInstance<SvxNameDialog> pDlg( pParent, rName, rDesc ); - return VclPtr<AbstractSvxNameDialog_Impl>::Create( pDlg ); + return VclPtr<AbstractSvxNameDialog_Impl>::Create(new SvxNameDialog(pParent, rName, rDesc)); } VclPtr<AbstractSvxObjectNameDialog> AbstractDialogFactory_Impl::CreateSvxObjectNameDialog(const OUString& rName ) diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 8df336439a78..988553a38e9b 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -302,7 +302,14 @@ class AbstractSvxNewDictionaryDialog_Impl :public AbstractSvxNewDictionaryDialog class SvxNameDialog; class AbstractSvxNameDialog_Impl :public AbstractSvxNameDialog { - DECL_ABSTDLG_BASE(AbstractSvxNameDialog_Impl,SvxNameDialog) +protected: + std::unique_ptr<SvxNameDialog> m_xDlg; +public: + explicit AbstractSvxNameDialog_Impl(SvxNameDialog* p) + : m_xDlg(p) + { + } + virtual short Execute() override; virtual void GetName( OUString& rName ) override ; virtual void SetCheckNameHdl( const Link<AbstractSvxNameDialog&,bool>& rLink, bool bCheckImmediately = false ) override ; virtual void SetEditHelpId(const OString&) override ; @@ -554,8 +561,8 @@ public: virtual VclPtr<AbstractSvxNewDictionaryDialog> CreateSvxNewDictionaryDialog( vcl::Window* pParent ) override; virtual VclPtr<VclAbstractDialog> CreateSvxEditDictionaryDialog( vcl::Window* pParent, const OUString& rName) override; - virtual VclPtr<AbstractSvxNameDialog> CreateSvxNameDialog( vcl::Window* pParent, - const OUString& rName, const OUString& rDesc ) override; + virtual VclPtr<AbstractSvxNameDialog> CreateSvxNameDialog(weld::Window* pParent, + const OUString& rName, const OUString& rDesc) override; // #i68101# virtual VclPtr<AbstractSvxObjectNameDialog> CreateSvxObjectNameDialog(const OUString& rName ) override; virtual VclPtr<AbstractSvxObjectTitleDescDialog> CreateSvxObjectTitleDescDialog(const OUString& rTitle, const OUString& rDescription) override; diff --git a/cui/source/inc/dlgname.hxx b/cui/source/inc/dlgname.hxx index 689008e38849..6c960ce114da 100644 --- a/cui/source/inc/dlgname.hxx +++ b/cui/source/inc/dlgname.hxx @@ -25,25 +25,30 @@ #include <vcl/dialog.hxx> #include <vcl/fixed.hxx> #include <vcl/vclmedit.hxx> +#include <vcl/weld.hxx> /// Dialog for editing a name -class SvxNameDialog : public ModalDialog +class SvxNameDialog { private: - VclPtr<FixedText> pFtDescription; - VclPtr<Edit> pEdtName; - VclPtr<OKButton> pBtnOK; + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Dialog> m_xDialog; + std::unique_ptr<weld::Entry> m_xEdtName; + std::unique_ptr<weld::Label> m_xFtDescription; + std::unique_ptr<weld::Button> m_xBtnOK; - Link<SvxNameDialog&,bool> aCheckNameHdl; + Link<SvxNameDialog&,bool> m_aCheckNameHdl; - DECL_LINK(ModifyHdl, Edit&, void); + DECL_LINK(ModifyHdl, weld::Entry&, void); public: - SvxNameDialog( vcl::Window* pWindow, const OUString& rName, const OUString& rDesc ); - virtual ~SvxNameDialog() override; - virtual void dispose() override; + SvxNameDialog(weld::Window* pWindow, const OUString& rName, const OUString& rDesc); + + void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); } + void set_help_id(const OString& rHelpId) { m_xDialog->set_help_id(rHelpId); } + OUString GetName() const { return m_xEdtName->get_text(); } - void GetName( OUString& rName ){rName = pEdtName->GetText();} + short run() { return m_xDialog->run(); } /** add a callback Link that is called whenever the content of the edit field is changed. The Link result determines whether the OK @@ -60,14 +65,14 @@ public: @todo Remove the parameter bCheckImmediately and incorporate the 'true' behaviour as default. */ - void SetCheckNameHdl( const Link<SvxNameDialog&,bool>& rLink, bool bCheckImmediately ) + void SetCheckNameHdl(const Link<SvxNameDialog&,bool>& rLink, bool bCheckImmediately) { - aCheckNameHdl = rLink; - if ( bCheckImmediately ) - pBtnOK->Enable( rLink.Call( *this ) ); + m_aCheckNameHdl = rLink; + if (bCheckImmediately) + m_xBtnOK->set_sensitive(rLink.Call(*this)); } - void SetEditHelpId( const OString& aHelpId) {pEdtName->SetHelpId(aHelpId);} + void SetEditHelpId(const OString& aHelpId) { m_xEdtName->set_help_id(aHelpId);} }; /** #i68101# diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx index e161cced7a68..535388b6fcbc 100644 --- a/cui/source/options/optcolor.cxx +++ b/cui/source/options/optcolor.cxx @@ -1109,7 +1109,7 @@ IMPL_LINK(SvxColorOptionsTabPage, SaveDeleteHdl_Impl, Button*, pButton, void ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "Dialog creation failed!"); - ScopedVclPtr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog( pButton, + ScopedVclPtr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog(pButton->GetFrameWeld(), sName, CuiResId(RID_SVXSTR_COLOR_CONFIG_SAVE2) )); DBG_ASSERT(aNameDlg, "Dialog creation failed!"); aNameDlg->SetCheckNameHdl( LINK(this, SvxColorOptionsTabPage, CheckNameHdl_Impl)); diff --git a/cui/source/options/tsaurls.cxx b/cui/source/options/tsaurls.cxx index aa3de388ff8c..df496a095585 100644 --- a/cui/source/options/tsaurls.cxx +++ b/cui/source/options/tsaurls.cxx @@ -103,7 +103,7 @@ IMPL_LINK_NOARG(TSAURLsDialog, AddHdl_Impl, Button*, void) OUString aDesc( get<FixedText>("enteraurl")->GetText() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( m_pAddBtn, aURL, aDesc)); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(m_pAddBtn->GetFrameWeld(), aURL, aDesc)); if ( pDlg->Execute() == RET_OK ) { diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 37ee324e01f5..8c58641bdb1a 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -562,7 +562,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickRenameHdl, SvxPresetListBox*, void) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); assert(pFact && "Dialog creation failed!"); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); assert(pDlg && "Dialog creation failed!"); bool bLoop = true; @@ -778,7 +778,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl, Button*, void) INetURLObject aURL( aDlg.GetPath() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "Dialog creation failed!"); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aURL.GetName().getToken( 0, '.' ), aDesc )); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aURL.GetName().getToken(0, '.'), aDesc)); DBG_ASSERT(pDlg, "Dialog creation failed!"); nError = ErrCode(1); diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index cffd860f785e..9afe095ed2a6 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -364,7 +364,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl, Button*, void) } SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); sal_uInt16 nError = 1; while (pDlg->Execute() == RET_OK) diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx index 7f6bd0c98257..a9da9b9887f0 100644 --- a/cui/source/tabpages/tpgradnt.cxx +++ b/cui/source/tabpages/tpgradnt.cxx @@ -376,7 +376,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickAddHdl_Impl, Button*, void) } SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); sal_uInt16 nError = 1; while (pDlg->Execute() == RET_OK) @@ -502,7 +502,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); assert(pFact && "Dialog creation failed!"); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); assert(pDlg && "Dialog creation failed!"); bool bLoop = true; diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx index 5d0add228d9b..a90e5d24305e 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -445,7 +445,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickAddHdl_Impl, Button*, void) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); assert(pFact && "Dialog creation failed!"); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); assert(pDlg && "Dialog creation failed!"); sal_uInt16 nError = 1; @@ -559,7 +559,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); assert(pFact && "Dialog creation failed!"); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); assert(pDlg && "Dialog creation failed!"); bool bLoop = true; diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx index ae5981659394..73f5f8c87e9e 100644 --- a/cui/source/tabpages/tplnedef.cxx +++ b/cui/source/tabpages/tplnedef.cxx @@ -550,7 +550,7 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickAddHdl_Impl, Button*, void) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "Dialog creation failed!"); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); DBG_ASSERT(pDlg, "Dialog creation failed!"); bool bLoop = true; @@ -620,7 +620,7 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickModifyHdl_Impl, Button*, void) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "Dialog creation failed!"); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); DBG_ASSERT(pDlg, "Dialog creation failed!"); long nCount = pDashList->Count(); diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx index 9d42da7f7e3b..cc9b679c84e1 100644 --- a/cui/source/tabpages/tplneend.cxx +++ b/cui/source/tabpages/tplneend.cxx @@ -326,7 +326,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickModifyHdl_Impl, Button*, void) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "Dialog creation failed!"); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); DBG_ASSERT(pDlg, "Dialog creation failed!"); bool bLoop = true; @@ -432,7 +432,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickAddHdl_Impl, Button*, void) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "Dialog creation failed!"); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc )); DBG_ASSERT(pDlg, "Dialog creation failed!"); bool bLoop = true; diff --git a/cui/source/tabpages/tppattern.cxx b/cui/source/tabpages/tppattern.cxx index 4164990c1891..297cc9da67cc 100644 --- a/cui/source/tabpages/tppattern.cxx +++ b/cui/source/tabpages/tppattern.cxx @@ -358,7 +358,7 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickAddHdl_Impl, Button*, void) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); assert(pFact && "Dialog creation failed!"); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); assert(pDlg && "Dialog creation failed!"); sal_uInt16 nError(1); @@ -465,7 +465,7 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); assert(pFact && "Dialog creation failed!"); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); assert(pDlg && "Dialog creation failed!"); bool bLoop = true; diff --git a/cui/uiconfig/ui/namedialog.ui b/cui/uiconfig/ui/namedialog.ui index e6674c3c6c98..f256c8523600 100644 --- a/cui/uiconfig/ui/namedialog.ui +++ b/cui/uiconfig/ui/namedialog.ui @@ -1,11 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.20.2 --> <interface domain="cui"> <requires lib="gtk+" version="3.0"/> <object class="GtkDialog" id="NameDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="namedialog|NameDialog">Name</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"> @@ -15,15 +18,12 @@ <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area1"> <property name="can_focus">False</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> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> <property name="visible">True</property> - <property name="sensitive">False</property> <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -35,10 +35,13 @@ </packing> </child> <child> - <object class="GtkButton" id="cancel"> - <property name="label">gtk-cancel</property> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> <property name="visible">True</property> + <property name="sensitive">False</property> <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -46,12 +49,11 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="position">1</property> - <property name="secondary">True</property> </packing> </child> <child> - <object class="GtkButton" id="help"> - <property name="label">gtk-help</property> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -115,9 +117,12 @@ </object> </child> <action-widgets> + <action-widget response="-11">help</action-widget> <action-widget response="-5">ok</action-widget> <action-widget response="-6">cancel</action-widget> - <action-widget response="-11">help</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index 14f73131c0e9..7a2eda38d370 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -399,7 +399,7 @@ public: virtual VclPtr<AbstractSvxNewDictionaryDialog> CreateSvxNewDictionaryDialog( vcl::Window* pParent ) = 0; virtual VclPtr<VclAbstractDialog> CreateSvxEditDictionaryDialog( vcl::Window* pParent, const OUString& rName) = 0; - virtual VclPtr<AbstractSvxNameDialog> CreateSvxNameDialog( vcl::Window* pParent, + virtual VclPtr<AbstractSvxNameDialog> CreateSvxNameDialog(weld::Window* pParent, const OUString& rName, const OUString& rDesc ) = 0; // #i68101# diff --git a/sd/source/ui/docshell/docshel2.cxx b/sd/source/ui/docshell/docshel2.cxx index d25c6c0abb94..a0958eb1ef0e 100644 --- a/sd/source/ui/docshell/docshel2.cxx +++ b/sd/source/ui/docshell/docshel2.cxx @@ -275,7 +275,7 @@ Bitmap DrawDocShell::GetPagePreviewBitmap(SdPage* pPage) * name. * @return sal_False if the user cancels the action. */ -bool DrawDocShell::CheckPageName (vcl::Window* pWin, OUString& rName ) +bool DrawDocShell::CheckPageName(weld::Window* pWin, OUString& rName) { const OUString aStrForDlg( rName ); bool bIsNameValid = IsNewPageNameValid( rName, true ); @@ -286,7 +286,7 @@ bool DrawDocShell::CheckPageName (vcl::Window* pWin, OUString& rName ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if( pFact ) { - ScopedVclPtr<AbstractSvxNameDialog> aNameDlg( pFact->CreateSvxNameDialog( pWin, aStrForDlg, aDesc ) ); + ScopedVclPtr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog(pWin, aStrForDlg, aDesc)); aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE ); aNameDlg->SetCheckNameHdl( LINK( this, DrawDocShell, RenameSlideHdl ) ); diff --git a/sd/source/ui/inc/DrawDocShell.hxx b/sd/source/ui/inc/DrawDocShell.hxx index 7638d35b61b2..3645b27f22d4 100644 --- a/sd/source/ui/inc/DrawDocShell.hxx +++ b/sd/source/ui/inc/DrawDocShell.hxx @@ -148,7 +148,7 @@ public: a default name of a not-yet-existing slide (e.g. 'Slide 17'), sal_True is returned, but rName is set to an empty string. */ - bool CheckPageName(vcl::Window* pWin, OUString& rName ); + bool CheckPageName(weld::Window* pWin, OUString& rName ); void SetSlotFilter(bool bEnable = false, o3tl::array_view<sal_uInt16 const> pSIDs = o3tl::array_view<sal_uInt16 const>()) { mbFilterEnable = bEnable; mpFilterSIDs = pSIDs; } void ApplySlotFilter() const; diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index 36876957064e..9f302fdd8f7c 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -881,8 +881,9 @@ void SlotManager::RenameSlide(const SfxRequest& rRequest) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "Dialog creation failed!"); + vcl::Window* pWin = mrSlideSorter.GetContentWindow(); ScopedVclPtr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog( - mrSlideSorter.GetContentWindow(), + pWin ? pWin->GetFrameWeld() : nullptr, aPageName, aDescr)); DBG_ASSERT(aNameDlg, "Dialog creation failed!"); aNameDlg->SetText( aTitle ); diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index df48f77d5642..f3bbb1ee5117 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -786,7 +786,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "Dialog creation failed!"); - ScopedVclPtr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog( GetActiveWindow(), aPageName, aDescr )); + ScopedVclPtr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aPageName, aDescr)); DBG_ASSERT(aNameDlg, "Dialog creation failed!"); aNameDlg->SetText( aTitle ); aNameDlg->SetCheckNameHdl( LINK( this, DrawViewShell, RenameSlideHdl ), true ); diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index 7a042c44623a..81aff44869e2 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -870,7 +870,7 @@ bool View::GetExchangeList (std::vector<OUString> &rExchangeList, OUString aNewName = *pIter; if( nType == 0 || nType == 2 ) - bNameOK = mpDocSh->CheckPageName(mpViewSh->GetActiveWindow(), aNewName); + bNameOK = mpDocSh->CheckPageName(mpViewSh->GetFrameWeld(), aNewName); if( bNameOK && ( nType == 1 || nType == 2 ) ) { @@ -880,7 +880,7 @@ bool View::GetExchangeList (std::vector<OUString> &rExchangeList, OUString aDesc(SdResId(STR_DESC_NAMEGROUP)); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact ? pFact->CreateSvxNameDialog(mpViewSh->GetActiveWindow(), aNewName, aDesc) : nullptr); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact ? pFact->CreateSvxNameDialog(mpViewSh->GetFrameWeld(), aNewName, aDesc) : nullptr); if (pDlg) { diff --git a/sd/source/ui/view/tabcontr.cxx b/sd/source/ui/view/tabcontr.cxx index c1d9398d77a8..7f71c3e1a05c 100644 --- a/sd/source/ui/view/tabcontr.cxx +++ b/sd/source/ui/view/tabcontr.cxx @@ -319,7 +319,7 @@ TabBarAllowRenamingReturnCode TabControl::AllowRenaming() if( aCompareName != aNewName ) { // rename page - if( pDrViewSh->GetDocSh()->CheckPageName( this, aNewName ) ) + if (pDrViewSh->GetDocSh()->CheckPageName(GetFrameWeld(), aNewName)) { SetEditText( aNewName ); EndRenaming(); |