diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-05-12 09:38:28 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-05-12 10:09:26 +0100 |
commit | 71c4a2b761885c2d5515e89fd5aedf7d1e8a249b (patch) | |
tree | c8d9cbd035e2dcf601c18ef28cbb12f4f043295f | |
parent | 533fd775d51472e6cff93487a27136f67f06d77f (diff) |
mpDefDialogParent is not used since 2002
i.e.
commit c0ae87cb5f2989bc4b8dff4907994d513ee87e39
Author: Stephan Schäfer <ssa@openoffice.org>
Date: Tue Oct 22 08:39:05 2002 +0000
#103442# choose DefDialogParent on-the-fly
and so calling SetDefDialogParent doesn't achieve anything
Change-Id: I2ec72da47b2dac03fdddbdb9eba5ae4bf205eb22
31 files changed, 59 insertions, 238 deletions
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx index c3619246ef45..ec7ed3a5c414 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -242,16 +242,9 @@ short MacroChooser::Execute() if ( StarBASIC::IsRunning() ) m_pCloseButton->GrabFocus(); - vcl::Window* pPrevDlgParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( this ); - short nRet = ModalDialog::Execute(); - // #57314# If the BasicIDE has been activated, don't reset the DefModalDialogParent to the inactive document. - if ( Application::GetDefDialogParent() == this ) - Application::SetDefDialogParent( pPrevDlgParent ); - return nRet; + return ModalDialog::Execute(); } - void MacroChooser::EnableButton( Button& rButton, bool bEnable ) { if ( bEnable ) diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx index bf5b6ae32a89..a1eafce59e58 100644 --- a/basctl/source/basicide/moduldlg.cxx +++ b/basctl/source/basicide/moduldlg.cxx @@ -503,14 +503,9 @@ void OrganizeDialog::dispose() short OrganizeDialog::Execute() { - vcl::Window* pPrevDlgParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( this ); - short nRet = TabDialog::Execute(); - Application::SetDefDialogParent( pPrevDlgParent ); - return nRet; + return TabDialog::Execute(); } - IMPL_LINK_TYPED( OrganizeDialog, ActivatePageHdl, TabControl *, pTabCtrl, void ) { sal_uInt16 nId = pTabCtrl->GetCurPageId(); diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx index a5008d252c80..c9207f9ad8d8 100644 --- a/cui/source/dialogs/insdlg.cxx +++ b/cui/source/dialogs/insdlg.cxx @@ -623,9 +623,6 @@ IMPL_LINK_TYPED( SfxInsertFloatingFrameDialog, CheckHdl, Button*, pButton, void IMPL_LINK_NOARG_TYPED( SfxInsertFloatingFrameDialog, OpenHdl, Button*, void) { - vcl::Window* pOldParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( this ); - // create the file dialog sfx2::FileDialogHelper aFileDlg( ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, OUString() ); @@ -637,8 +634,6 @@ IMPL_LINK_NOARG_TYPED( SfxInsertFloatingFrameDialog, OpenHdl, Button*, void) if ( aFileDlg.Execute() == ERRCODE_NONE ) m_pEDURL->SetText( INetURLObject( aFileDlg.GetPath() ).GetMainURL( INetURLObject::DECODE_WITH_CHARSET ) ); - - Application::SetDefDialogParent( pOldParent ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx index 14b57ca7ff20..7ae62e46f231 100644 --- a/cui/source/dialogs/scriptdlg.cxx +++ b/cui/source/dialogs/scriptdlg.cxx @@ -533,11 +533,7 @@ short SvxScriptOrgDialog::Execute() pDoc = SfxObjectShell::GetNext(*pDoc); } - vcl::Window* pPrevDlgParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( this ); - short nRet = ModalDialog::Execute(); - Application::SetDefDialogParent( pPrevDlgParent ); - return nRet; + return ModalDialog::Execute(); } void SvxScriptOrgDialog::CheckButtons( Reference< browse::XBrowseNode >& node ) diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 7fb2c5bb0174..133c4c5bef17 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1230,8 +1230,6 @@ void Desktop::Exception(sal_uInt16 nError) SystemWindowFlags nOldMode = Application::GetSystemWindowMode(); Application::SetSystemWindowMode( nOldMode & ~SystemWindowFlags::NOAUTOMODE ); - Application::SetDefDialogParent( nullptr ); - if ( bInException ) { OUString aDoubleExceptionString; diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index abc43719bb0a..4f5be408b176 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -1612,20 +1612,6 @@ bool SvtFileDialog::Notify( NotifyEvent& rNEvt ) return bRet || ModalDialog::Notify( rNEvt ); } - -class SvtDefModalDialogParent_Impl -{ -private: - VclPtr<vcl::Window> _pOld; - -public: - explicit SvtDefModalDialogParent_Impl( vcl::Window *pNew ) : - _pOld( Application::GetDefDialogParent() ) - { Application::SetDefDialogParent( pNew ); } - - ~SvtDefModalDialogParent_Impl() { Application::SetDefDialogParent( _pOld ); } -}; - namespace { @@ -2014,7 +2000,6 @@ short SvtFileDialog::PrepareExecute() _pFileView->Show(); _pSplitter->Show(); - SvtDefModalDialogParent_Impl aDefParent( this ); // if applicable read and set size from ini InitSize(); diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index c946b353440b..639433b01fb2 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -1165,24 +1165,14 @@ public: */ ///@{ - /** Set the default parent window for dialog boxes. - - @param pWindow Pointer to window that should be the default parent. - - @remark You can set pWindow to NULL, which means there \em is no default parent. - - @see GetDefDialogParent - */ - static void SetDefDialogParent( vcl::Window* pWindow ); - /** Get the default parent window for dialog boxes. @remark GetDefDialogParent does all sorts of things find a useful parent - window for dialogs. If it can't find one (it wasn't set!) then it - first uses the topmost parent of the active window to avoid using - floating windows or other dialog boxes. If there are no active - windows, then it will take a random stab and choose the first visible - top window. Otherwise, it defaults to the desktop. + window for dialogs. It first uses the topmost parent of the active + window to avoid using floating windows or other dialog boxes. If + there are no active windows, then it will take a random stab and + choose the first visible top window. Otherwise, it defaults to + the desktop. @returns Pointer to the default window. */ diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index 9585f5ec9dc0..9952af2ef15a 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -842,15 +842,10 @@ IMPL_LINK_NOARG_TYPED(ScTPValidationError, SelectActionHdl, ListBox&, void) IMPL_LINK_NOARG_TYPED(ScTPValidationError, ClickSearchHdl, Button*, void) { - vcl::Window* pOld = Application::GetDefDialogParent(); - Application::SetDefDialogParent( this ); - // Use static SfxApplication method to bring up selector dialog for // choosing a script OUString aScriptURL = SfxApplication::ChooseScript(); - Application::SetDefDialogParent( pOld ); - if ( aScriptURL != nullptr && !aScriptURL.isEmpty() ) { m_pEdtTitle->SetText( aScriptURL ); diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index fc689e410e20..d973e2d50cbe 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -85,9 +85,6 @@ ScAreaLink::~ScAreaLink() void ScAreaLink::Edit(vcl::Window* pParent, const Link<SvBaseLink&,void>& /* rEndEditHdl */ ) { // use own dialog instead of SvBaseLink::Edit... - // DefModalDialogParent setzen, weil evtl. aus der DocShell beim ConvertFrom - // ein Optionen-Dialog kommt... - ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx index aedb902a4f7e..2e062f501782 100644 --- a/sc/source/ui/docshell/tablink.cxx +++ b/sc/source/ui/docshell/tablink.cxx @@ -48,10 +48,9 @@ struct TableLink_Impl { ScDocShell* m_pDocSh; - VclPtr<vcl::Window> m_pOldParent; Link<sfx2::SvBaseLink&,void> m_aEndEditLink; - TableLink_Impl() : m_pDocSh( nullptr ), m_pOldParent( nullptr ) {} + TableLink_Impl() : m_pDocSh( nullptr ) {} }; @@ -105,13 +104,7 @@ ScTableLink::~ScTableLink() void ScTableLink::Edit( vcl::Window* pParent, const Link<SvBaseLink&,void>& rEndEditHdl ) { - // DefModalDialogParent setzen, weil evtl. aus der DocShell beim ConvertFrom - // ein Optionen-Dialog kommt... - pImpl->m_aEndEditLink = rEndEditHdl; - pImpl->m_pOldParent = Application::GetDefDialogParent(); - if (pParent) - Application::SetDefDialogParent(pParent); bInEdit = true; SvBaseLink::Edit( pParent, LINK( this, ScTableLink, TableEndEditHdl ) ); @@ -420,7 +413,6 @@ IMPL_LINK_TYPED( ScTableLink, TableEndEditHdl, ::sfx2::SvBaseLink&, rLink, void { pImpl->m_aEndEditLink.Call( rLink ); bInEdit = false; - Application::SetDefDialogParent( pImpl->m_pOldParent ); } // === ScDocumentLoader ================================================== diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx index a84d893b3b98..ff1714c23932 100644 --- a/sc/source/ui/miscdlgs/instbdlg.cxx +++ b/sc/source/ui/miscdlgs/instbdlg.cxx @@ -138,16 +138,10 @@ void ScInsertTableDlg::Init_Impl( bool bFromFile ) short ScInsertTableDlg::Execute() { - // set Parent of DocumentInserter and Doc-Manager - vcl::Window* pOldDefParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( this ); - if ( m_pBtnFromFile->IsChecked() ) aBrowseTimer.Start(); - short nRet = ModalDialog::Execute(); - Application::SetDefDialogParent( pOldDefParent ); - return nRet; + return ModalDialog::Execute(); } void ScInsertTableDlg::SetNewTable_Impl() diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx index 2306e69c048b..143799d52ce3 100644 --- a/sc/source/ui/miscdlgs/linkarea.cxx +++ b/sc/source/ui/miscdlgs/linkarea.cxx @@ -80,16 +80,7 @@ void ScLinkedAreaDlg::dispose() short ScLinkedAreaDlg::Execute() { - // set parent for file dialog or filter options - - vcl::Window* pOldDefParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( this ); - - short nRet = ModalDialog::Execute(); - - Application::SetDefDialogParent( pOldDefParent ); - - return nRet; + return ModalDialog::Execute(); } #define FILTERNAME_HTML "HTML (StarCalc)" diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index b32f3ef6fdd7..7b4ba77fbd20 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -844,9 +844,8 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) vcl::Window* pParent = Application::GetDefDialogParent(); if ( !pParent || !pParent->IsDialog() ) { - // GetDefDialogParent currently doesn't return the window - // that was set with SetDefDialogParent (but dynamically finds the - // topmost parent of the focus window), so IsDialog above is FALSE + // GetDefDialogParent dynamically finds the + // topmost parent of the focus window, so IsDialog above is FALSE // even if called from the style catalog. // -> Use NULL if a modal dialog is open, to enable the Dialog's // default parent handling. diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx index 50581e0061c3..5f4a8caed73b 100644 --- a/sd/source/ui/dlg/dlgass.cxx +++ b/sd/source/ui/dlg/dlgass.cxx @@ -1457,9 +1457,6 @@ void AssistentDlgImpl::UpdatePreview( bool bDocPreview ) { CloseDocShell(); - vcl::Window *pParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( mpWindow ); - SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE,mpWindow); if(IsOwnFormat(aDocFile)) @@ -1489,8 +1486,6 @@ void AssistentDlgImpl::UpdatePreview( bool bDocPreview ) xDocShell = pRet->GetFrame()->GetObjectShell(); } - Application::SetDefDialogParent( pParent ); - mnShowPage = 0; mbDocPreview = bDocPreview; maDocFile = aDocFile; @@ -1503,9 +1498,6 @@ void AssistentDlgImpl::UpdatePreview( bool bDocPreview ) SfxObjectShellLock xLayoutDocShell; SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE,mpWindow); - vcl::Window *pParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( mpWindow ); - if(IsOwnFormat(aLayoutFile)) { SfxItemSet* pSet = new SfxAllItemSet( pSfxApp->GetPool() ); @@ -1518,8 +1510,6 @@ void AssistentDlgImpl::UpdatePreview( bool bDocPreview ) SavePassword( xLayoutDocShell, aLayoutFile ); } - Application::SetDefDialogParent( pParent ); - // determine the implementation SfxObjectShell* pShell = xDocShell; DrawDocShell* pDocShell = dynamic_cast< DrawDocShell *>( pShell ); diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx index 99175dbee38f..49393bd441d5 100644 --- a/sd/source/ui/dlg/tpaction.cxx +++ b/sd/source/ui/dlg/tpaction.cxx @@ -429,9 +429,6 @@ void SdTPAction::OpenFileDialog() } else if (bMacro) { - vcl::Window* pOldWin = Application::GetDefDialogParent(); - Application::SetDefDialogParent( this ); - // choose macro dialog OUString aScriptURL = SfxApplication::ChooseScript(); @@ -439,8 +436,6 @@ void SdTPAction::OpenFileDialog() { SetEditText( aScriptURL ); } - - Application::SetDefDialogParent( pOldWin ); } else { diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index badd3edb7ddb..0e9ad314705b 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -332,15 +332,8 @@ bool FuInsertFile::InsSDDinDrMode(SfxMedium* pMedium) if( !pDlg ) return false; - /* Maybe a QueryBox is opened ("update links?"), therefore the dialog - becomes the current DefModalDialogParent */ - vcl::Window* pDefParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent(pDlg->GetWindow()); - sal_uInt16 nRet = pDlg->Execute(); - Application::SetDefDialogParent(pDefParent); - mpDocSh->SetWaitCursor( true ); if( nRet == RET_OK ) diff --git a/sfx2/source/appl/fileobj.cxx b/sfx2/source/appl/fileobj.cxx index 4e9b9011682c..c56bba56fe50 100644 --- a/sfx2/source/appl/fileobj.cxx +++ b/sfx2/source/appl/fileobj.cxx @@ -49,7 +49,6 @@ SvFileObject::SvFileObject() : nPostUserEventId(nullptr) , mxDelMed() - , pOldParent(nullptr) , nType(FILETYPE_TEXT) , bLoadAgain(true) , bSynchron(false) @@ -390,7 +389,7 @@ OUString impl_getFilter( const OUString& _rURL ) return sFilter; } -void SvFileObject::Edit( vcl::Window* pParent, sfx2::SvBaseLink* pLink, const Link<const OUString&, void>& rEndEditHdl ) +void SvFileObject::Edit( vcl::Window* /*pParent*/, sfx2::SvBaseLink* pLink, const Link<const OUString&, void>& rEndEditHdl ) { aEndEditLink = rEndEditHdl; OUString sFile, sRange, sTmpFilter; @@ -426,8 +425,6 @@ void SvFileObject::Edit( vcl::Window* pParent, sfx2::SvBaseLink* pLink, const Li case OBJECT_CLIENT_OLE: { nType = FILETYPE_OBJECT; // if not set already - pOldParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( pParent ); ::sfx2::FileDialogHelper & rFileDlg = pLink->GetInsertFileDialog( OUString() ); @@ -439,8 +436,6 @@ void SvFileObject::Edit( vcl::Window* pParent, sfx2::SvBaseLink* pLink, const Li case OBJECT_CLIENT_FILE: { nType = FILETYPE_TEXT; // if not set already - pOldParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( pParent ); OUString sFactory; SfxObjectShell* pShell = pLink->GetLinkManager()->GetPersist(); @@ -500,7 +495,6 @@ IMPL_LINK_NOARG_TYPED( SvFileObject, DelMedium_Impl, void*, void ) IMPL_LINK_TYPED( SvFileObject, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, void ) { OUString sFile; - Application::SetDefDialogParent( pOldParent ); if ( FILETYPE_TEXT == nType || FILETYPE_OBJECT == nType ) { diff --git a/sfx2/source/appl/fileobj.hxx b/sfx2/source/appl/fileobj.hxx index a84126f06017..e7907f70a087 100644 --- a/sfx2/source/appl/fileobj.hxx +++ b/sfx2/source/appl/fileobj.hxx @@ -35,7 +35,6 @@ class SvFileObject : public sfx2::SvLinkSource tools::SvRef<SfxMedium> xMed; ImplSVEvent* nPostUserEventId; tools::SvRef<SfxMedium> mxDelMed; - VclPtr<vcl::Window> pOldParent; sal_uInt8 nType; diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index d5c539f971a5..c29c12838fba 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -1861,13 +1861,6 @@ void SfxCommonTemplateDialog_Impl::NewHdl() { if ( nActFamily != 0xffff && (pTreeBox || aFmtLb->GetSelectionCount() <= 1)) { - vcl::Window* pTmp; - pTmp = Application::GetDefDialogParent(); - if ( dynamic_cast< const SfxTemplateDialog_Impl* >(this) != nullptr ) - Application::SetDefDialogParent( pWindow->GetParent() ); - else - Application::SetDefDialogParent( pWindow ); - const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl(); const SfxStyleFamily eFam=pItem->GetFamily(); sal_uInt16 nMask; @@ -1886,8 +1879,6 @@ void SfxCommonTemplateDialog_Impl::NewHdl() "", GetSelectedEntry(), ( sal_uInt16 )GetFamilyItem_Impl()->GetFamily(), nMask); - - Application::SetDefDialogParent( pTmp ); } } @@ -1899,18 +1890,10 @@ void SfxCommonTemplateDialog_Impl::EditHdl() sal_uInt16 nFilter = nActFilter; OUString aTemplName(GetSelectedEntry()); GetSelectedStyle(); // -Wall required?? - vcl::Window* pTmp; - //DefModalDialogParent set for modality of the following dialogs - pTmp = Application::GetDefDialogParent(); - if ( dynamic_cast< const SfxTemplateDialog_Impl* >(this) != nullptr ) - Application::SetDefDialogParent( pWindow->GetParent() ); - else - Application::SetDefDialogParent( pWindow ); if ( Execute_Impl( SID_STYLE_EDIT, aTemplName, OUString(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily(), 0, &nFilter ) ) { } - Application::SetDefDialogParent( pTmp ); } } diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx index 3eb85f12760c..06e93ce7a7d9 100644 --- a/sfx2/source/doc/new.cxx +++ b/sfx2/source/doc/new.cxx @@ -215,8 +215,6 @@ IMPL_LINK_NOARG_TYPED(SfxNewFileDialog_Impl, Update, Idle*, void) if (!xDocShell.Is()) { - vcl::Window *pParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent(pAntiImpl); SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE,pAntiImpl); SfxApplication *pSfxApp = SfxGetpApp(); sal_uIntPtr lErr; @@ -226,7 +224,6 @@ IMPL_LINK_NOARG_TYPED(SfxNewFileDialog_Impl, Update, Idle*, void) lErr = pSfxApp->LoadTemplate(xDocShell, aFileName, pSet); if (lErr) ErrorHandler::HandleError(lErr); - Application::SetDefDialogParent(pParent); if (!xDocShell.Is()) { m_pPreviewWin->SetObjectShell(nullptr); diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index 8525ff22896e..3db1ed3cde6d 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -308,7 +308,6 @@ SwEditRegionDlg::SwEditRegionDlg( vcl::Window* pParent, SwWrtShell& rWrtSh ) , aImageIL(SW_RES(IL_SECTION_BITMAPS)) , rSh(rWrtSh) , m_pDocInserter(nullptr) - , m_pOldDefDlgParent(nullptr) , bDontCheckPasswd(true) { get(m_pCurName, "curname"); @@ -545,7 +544,6 @@ void SwEditRegionDlg::dispose() m_pOK.clear(); m_pOptionsPB.clear(); m_pDismiss.clear(); - m_pOldDefDlgParent.clear(); SfxModalDialog::dispose(); } @@ -1024,8 +1022,6 @@ IMPL_LINK_NOARG_TYPED(SwEditRegionDlg, FileSearchHdl, Button*, void) { if(!CheckPasswd()) return; - m_pOldDefDlgParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( this ); delete m_pDocInserter; m_pDocInserter = new ::sfx2::DocumentInserter( "swriter" ); @@ -1342,8 +1338,6 @@ IMPL_LINK_TYPED( SwEditRegionDlg, DlgClosedHdl, sfx2::FileDialogHelper *, _pFile pSectRepr->GetSectionData().SetLinkFilePassword(sPassword); m_pFileNameED->SetText(pSectRepr->GetFile()); } - - Application::SetDefDialogParent( m_pOldDefDlgParent ); } IMPL_LINK_TYPED( SwEditRegionDlg, SubRegionEventHdl, VclWindowEvent&, rEvent, void ) @@ -1504,7 +1498,6 @@ SwInsertSectionTabPage::SwInsertSectionTabPage( "modules/swriter/ui/sectionpage.ui", &rAttrSet) , m_pWrtSh(nullptr) , m_pDocInserter(nullptr) - , m_pOldDefDlgParent(nullptr) { get(m_pCurName, "sectionnames"); m_pCurName->SetStyle(m_pCurName->GetStyle() | WB_SORT); @@ -1563,7 +1556,6 @@ void SwInsertSectionTabPage::dispose() m_pConditionFT.clear(); m_pConditionED.clear(); m_pEditInReadonlyCB.clear(); - m_pOldDefDlgParent.clear(); SfxTabPage::dispose(); } @@ -1755,8 +1747,6 @@ IMPL_LINK_TYPED( SwInsertSectionTabPage, UseFileHdl, Button *, pButton, void ) IMPL_LINK_NOARG_TYPED(SwInsertSectionTabPage, FileSearchHdl, Button*, void) { - m_pOldDefDlgParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( this ); delete m_pDocInserter; m_pDocInserter = new ::sfx2::DocumentInserter( "swriter" ); m_pDocInserter->StartExecuteModal( LINK( this, SwInsertSectionTabPage, DlgClosedHdl ) ); @@ -1808,8 +1798,6 @@ IMPL_LINK_TYPED( SwInsertSectionTabPage, DlgClosedHdl, sfx2::FileDialogHelper *, } else m_sFilterName = m_sFilePasswd = aEmptyOUStr; - - Application::SetDefDialogParent( m_pOldDefDlgParent ); } SwSectionFootnoteEndTabPage::SwSectionFootnoteEndTabPage( vcl::Window *pParent, diff --git a/sw/source/ui/fldui/fldfunc.cxx b/sw/source/ui/fldui/fldfunc.cxx index e2828bf1e02c..5f3a1701f771 100644 --- a/sw/source/ui/fldui/fldfunc.cxx +++ b/sw/source/ui/fldui/fldfunc.cxx @@ -531,15 +531,11 @@ void SwFieldFuncPage::UpdateSubType() } // call MacroBrowser, fill Listbox with Macros -IMPL_LINK_TYPED( SwFieldFuncPage, MacroHdl, Button *, pBtn, void ) +IMPL_LINK_NOARG_TYPED( SwFieldFuncPage, MacroHdl, Button *, void) { - vcl::Window* pDefModalDlgParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( pBtn ); const OUString sMacro(TurnMacroString(m_pNameED->GetText()).replaceAll(".", ";")); if (GetFieldMgr().ChooseMacro(sMacro)) UpdateSubType(); - - Application::SetDefDialogParent( pDefModalDlgParent ); } bool SwFieldFuncPage::FillItemSet(SfxItemSet* ) diff --git a/sw/source/ui/fldui/javaedit.cxx b/sw/source/ui/fldui/javaedit.cxx index df81c3c1cb29..d448a193f533 100644 --- a/sw/source/ui/fldui/javaedit.cxx +++ b/sw/source/ui/fldui/javaedit.cxx @@ -45,8 +45,7 @@ SwJavaEditDialog::SwJavaEditDialog(vcl::Window* pParent, SwWrtShell* pWrtSh) : bIsUrl(false), pSh(pWrtSh), - pFileDlg(nullptr), - pOldDefDlgParent(nullptr) + pFileDlg(nullptr) { get(m_pTypeED, "scripttype"); get(m_pUrlRB, "url"); @@ -96,7 +95,6 @@ void SwJavaEditDialog::dispose() pSh->EnterStdMode(); delete pMgr; delete pFileDlg; - Application::SetDefDialogParent( pOldDefDlgParent ); m_pTypeED.clear(); m_pUrlRB.clear(); m_pEditRB.clear(); @@ -106,7 +104,6 @@ void SwJavaEditDialog::dispose() m_pOKBtn.clear(); m_pPrevBtn.clear(); m_pNextBtn.clear(); - pOldDefDlgParent.clear(); SvxStandardDialog::dispose(); } @@ -251,13 +248,10 @@ IMPL_LINK_NOARG_TYPED(SwJavaEditDialog, RadioButtonHdl, Button*, void) } } -IMPL_LINK_TYPED( SwJavaEditDialog, InsertFileHdl, Button *, pBtn, void ) +IMPL_LINK_NOARG_TYPED( SwJavaEditDialog, InsertFileHdl, Button *, void ) { if ( !pFileDlg ) { - pOldDefDlgParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( pBtn ); - pFileDlg = new ::sfx2::FileDialogHelper( ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::Insert, OUString("swriter") ); diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index c7a5e82f59ed..248b60acb51f 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -2224,19 +2224,16 @@ VclPtr<SfxTabPage> SwTOXEntryTabPage::Create( vcl::Window* pParent, const Sf return VclPtr<SwTOXEntryTabPage>::Create(pParent, *rAttrSet); } -IMPL_LINK_TYPED(SwTOXEntryTabPage, EditStyleHdl, Button*, pBtn, void) +IMPL_LINK_NOARG_TYPED(SwTOXEntryTabPage, EditStyleHdl, Button*, void) { if( LISTBOX_ENTRY_NOTFOUND != m_pCharStyleLB->GetSelectEntryPos()) { SfxStringItem aStyle(SID_STYLE_EDIT, m_pCharStyleLB->GetSelectEntry()); SfxUInt16Item aFamily(SID_STYLE_FAMILY, (sal_uInt16)SfxStyleFamily::Char); - vcl::Window* pDefDlgParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( pBtn ); static_cast<SwMultiTOXTabDialog*>(GetTabDialog())->GetWrtShell(). GetView().GetViewFrame()->GetDispatcher()->ExecuteList(SID_STYLE_EDIT, SfxCallMode::SYNCHRON|SfxCallMode::MODAL, { &aStyle, &aFamily }); - Application::SetDefDialogParent( pDefDlgParent ); } } @@ -3737,19 +3734,16 @@ VclPtr<SfxTabPage> SwTOXStylesTabPage::Create( vcl::Window* pParent, return VclPtr<SwTOXStylesTabPage>::Create(pParent, *rAttrSet); } -IMPL_LINK_TYPED( SwTOXStylesTabPage, EditStyleHdl, Button *, pBtn, void ) +IMPL_LINK_NOARG_TYPED(SwTOXStylesTabPage, EditStyleHdl, Button *, void) { if( LISTBOX_ENTRY_NOTFOUND != m_pParaLayLB->GetSelectEntryPos()) { SfxStringItem aStyle(SID_STYLE_EDIT, m_pParaLayLB->GetSelectEntry()); SfxUInt16Item aFamily(SID_STYLE_FAMILY, (sal_uInt16)SfxStyleFamily::Para); - vcl::Window* pDefDlgParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( pBtn ); SwWrtShell& rSh = static_cast<SwMultiTOXTabDialog*>(GetTabDialog())->GetWrtShell(); rSh.GetView().GetViewFrame()->GetDispatcher()->ExecuteList(SID_STYLE_EDIT, SfxCallMode::SYNCHRON|SfxCallMode::MODAL, { &aStyle, &aFamily }); - Application::SetDefDialogParent( pDefDlgParent ); } } diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index 034dcf4e1d72..7cf73e1a0fb1 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -257,7 +257,6 @@ private: SvTreeListEntry* pDDSource; // source for Drag'n Drop SwGlblDocContents* pSwGlblDocContents; // array with sorted content - VclPtr<vcl::Window> pDefParentWin; SwGlblDocContent* pDocContent; sfx2::DocumentInserter* pDocInserter; diff --git a/sw/source/uibase/inc/javaedit.hxx b/sw/source/uibase/inc/javaedit.hxx index f320cc9ce4c5..d8c5739faeba 100644 --- a/sw/source/uibase/inc/javaedit.hxx +++ b/sw/source/uibase/inc/javaedit.hxx @@ -54,7 +54,6 @@ private: SwFieldMgr* pMgr; SwWrtShell* pSh; sfx2::FileDialogHelper* pFileDlg; - VclPtr<vcl::Window> pOldDefDlgParent; DECL_LINK_TYPED(OKHdl, Button*, void); DECL_LINK_TYPED(PrevHdl, Button*, void); diff --git a/sw/source/uibase/inc/regionsw.hxx b/sw/source/uibase/inc/regionsw.hxx index 53da3750bcc3..b6da39f2f056 100644 --- a/sw/source/uibase/inc/regionsw.hxx +++ b/sw/source/uibase/inc/regionsw.hxx @@ -95,7 +95,6 @@ class SwEditRegionDlg : public SfxModalDialog SectReprs_t m_SectReprs; const SwSection* pCurrSect; sfx2::DocumentInserter* m_pDocInserter; - VclPtr<vcl::Window> m_pOldDefDlgParent; bool bDontCheckPasswd :1; bool bWeb :1; @@ -169,7 +168,6 @@ class SwInsertSectionTabPage : public SfxTabPage css::uno::Sequence <sal_Int8 > m_aNewPasswd; SwWrtShell* m_pWrtSh; sfx2::DocumentInserter* m_pDocInserter; - VclPtr<vcl::Window> m_pOldDefDlgParent; DECL_LINK_TYPED( ChangeHideHdl, Button *, void ); DECL_LINK_TYPED( ChangeProtectHdl, Button *, void ); diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index b5c95e684c8a..2bea8e8d2736 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -153,7 +153,6 @@ SwGlobalTree::SwGlobalTree(vcl::Window* pParent, const ResId& rResId) : pEmphasisEntry ( nullptr ), pDDSource ( nullptr ), pSwGlblDocContents ( nullptr ), - pDefParentWin ( nullptr ), pDocContent ( nullptr ), pDocInserter ( nullptr ), @@ -190,7 +189,6 @@ void SwGlobalTree::dispose() pSwGlblDocContents = nullptr; delete pDocInserter; pDocInserter = nullptr; - pDefParentWin.clear(); aUpdateTimer.Stop(); SvTreeListBox::dispose(); } @@ -721,8 +719,6 @@ void SwGlobalTree::InsertRegion( const SwGlblDocContent* pCont, const OUString* Sequence< OUString > aFileNames; if ( !pFileName ) { - pDefParentWin = Application::GetDefDialogParent(); - Application::SetDefDialogParent( this ); delete pDocInserter; pDocInserter = new ::sfx2::DocumentInserter( OUString("swriter"), true ); @@ -1362,7 +1358,6 @@ void SwGlobalTree::InsertRegion( const SwGlblDocContent* _pContent, const Sequen IMPL_LINK_TYPED( SwGlobalTree, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, void ) { - Application::SetDefDialogParent( pDefParentWin ); if ( ERRCODE_NONE != _pFileDlg->GetError() ) return; diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index f3f34e74dfb7..5d0b719a02d2 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -181,7 +181,6 @@ struct ImplSVGDIData struct ImplSVWinData { VclPtr<vcl::Window> mpFirstFrame; // First FrameWindow - VclPtr<vcl::Window> mpDefDialogParent; // Default Dialog Parent VclPtr<WorkWindow> mpAppWin; // Application-Window VclPtr<vcl::Window> mpFocusWin; // window, that has the focus VclPtr<vcl::Window> mpActiveApplicationFrame; // the last active application frame, can be used as DefModalDialogParent if no focuswin set diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 6225104ababf..5a2ae0c8a586 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1431,70 +1431,60 @@ OUString Application::GetToolkitName() return OUString(); } -void Application::SetDefDialogParent( vcl::Window* pWindow ) -{ - ImplGetSVData()->maWinData.mpDefDialogParent = pWindow; -} - vcl::Window* Application::GetDefDialogParent() { ImplSVData* pSVData = ImplGetSVData(); - // #103442# find some useful dialog parent if there - // was no default set - // NOTE: currently even the default is not used - if( false && pSVData->maWinData.mpDefDialogParent.get() != nullptr ) - return pSVData->maWinData.mpDefDialogParent; - else - { - // always use the topmost parent of the candidate - // window to avoid using dialogs or floaters - // as DefDialogParent + // find some useful dialog parent - // current focus frame - vcl::Window *pWin = nullptr; - if( (pWin = pSVData->maWinData.mpFocusWin) != nullptr ) - { - while( pWin->mpWindowImpl && pWin->mpWindowImpl->mpParent ) - pWin = pWin->mpWindowImpl->mpParent; + // always use the topmost parent of the candidate + // window to avoid using dialogs or floaters + // as DefDialogParent - // check for corrupted window hierarchy, #122232#, may be we now crash somewhere else - if( !pWin->mpWindowImpl ) - { - OSL_FAIL( "Window hierarchy corrupted!" ); - pSVData->maWinData.mpFocusWin = nullptr; // avoid further access - return nullptr; - } + // current focus frame + vcl::Window *pWin = nullptr; + if( (pWin = pSVData->maWinData.mpFocusWin) != nullptr ) + { + while( pWin->mpWindowImpl && pWin->mpWindowImpl->mpParent ) + pWin = pWin->mpWindowImpl->mpParent; - if( (pWin->mpWindowImpl->mnStyle & WB_INTROWIN) == 0 ) - { - return pWin->mpWindowImpl->mpFrameWindow->ImplGetWindow(); - } + // check for corrupted window hierarchy, #122232#, may be we now crash somewhere else + if( !pWin->mpWindowImpl ) + { + OSL_FAIL( "Window hierarchy corrupted!" ); + pSVData->maWinData.mpFocusWin = nullptr; // avoid further access + return nullptr; } - // last active application frame - if( nullptr != (pWin = pSVData->maWinData.mpActiveApplicationFrame) ) + + if( (pWin->mpWindowImpl->mnStyle & WB_INTROWIN) == 0 ) { return pWin->mpWindowImpl->mpFrameWindow->ImplGetWindow(); } - else + } + + // last active application frame + if( nullptr != (pWin = pSVData->maWinData.mpActiveApplicationFrame) ) + { + return pWin->mpWindowImpl->mpFrameWindow->ImplGetWindow(); + } + else + { + // first visible top window (may be totally wrong....) + pWin = pSVData->maWinData.mpFirstFrame; + while( pWin ) { - // first visible top window (may be totally wrong....) - pWin = pSVData->maWinData.mpFirstFrame; - while( pWin ) + if( pWin->ImplGetWindow()->IsTopWindow() && + pWin->mpWindowImpl->mbReallyVisible && + (pWin->mpWindowImpl->mnStyle & WB_INTROWIN) == 0 + ) { - if( pWin->ImplGetWindow()->IsTopWindow() && - pWin->mpWindowImpl->mbReallyVisible && - (pWin->mpWindowImpl->mnStyle & WB_INTROWIN) == 0 - ) - { - while( pWin->mpWindowImpl->mpParent ) - pWin = pWin->mpWindowImpl->mpParent; - return pWin->mpWindowImpl->mpFrameWindow->ImplGetWindow(); - } - pWin = pWin->mpWindowImpl->mpFrameData->mpNextFrame; + while( pWin->mpWindowImpl->mpParent ) + pWin = pWin->mpWindowImpl->mpParent; + return pWin->mpWindowImpl->mpFrameWindow->ImplGetWindow(); } - // use the desktop - return nullptr; + pWin = pWin->mpWindowImpl->mpFrameData->mpNextFrame; } + // use the desktop + return nullptr; } } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 9a4d62ba634c..de678c506131 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -255,8 +255,6 @@ void Window::dispose() EndTracking(); if (IsMouseCaptured()) ReleaseMouse(); - if ( pSVData->maWinData.mpDefDialogParent == this ) - pSVData->maWinData.mpDefDialogParent = nullptr; #if OSL_DEBUG_LEVEL > 0 if ( true ) // always perform these tests in debug builds |