diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-06-21 15:20:58 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-06-21 22:41:59 +0200 |
commit | f805e0b969fba5c3b2c2bad4d5b951873ec2908f (patch) | |
tree | d197f4ced62119ae6ddf290d1d28bdffe5684e04 | |
parent | 4e39f9e13e0f6133cc7cf403e97c1b9b654562e2 (diff) |
reference childwins are all welded
Change-Id: I050b4bdff4eaa645316538725c69e83bee4a90c5
Reviewed-on: https://gerrit.libreoffice.org/74526
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
41 files changed, 175 insertions, 278 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index af372c270675..bebbd4fafb9a 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -225,6 +225,12 @@ namespace com { namespace sun { namespace star { } } } } +namespace weld { + +class Window; + +} + #define SC_DOC_NEW 0xFFFF #define SC_MACROCALL_ALLOWED 0 @@ -977,7 +983,7 @@ public: ScFormulaParserPool& GetFormulaParserPool() const; bool HasAreaLinks() const; - void UpdateExternalRefLinks(vcl::Window* pWin); + void UpdateExternalRefLinks(weld::Window* pWin); void UpdateAreaLinks(); // originating DDE links diff --git a/sc/inc/scopetools.hxx b/sc/inc/scopetools.hxx index 7789d9645b8a..93f7238ec138 100644 --- a/sc/inc/scopetools.hxx +++ b/sc/inc/scopetools.hxx @@ -57,14 +57,6 @@ public: ~IdleSwitch(); }; -class WaitPointerSwitch -{ - VclPtr<vcl::Window> mpFrameWin; -public: - WaitPointerSwitch(vcl::Window* pWin); - ~WaitPointerSwitch(); -}; - /// Wrapper for ScDocument::DelayFormulaGrouping() class SC_DLLPUBLIC DelayFormulaGroupingSwitch { diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 059293291eee..b1459942f83f 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -805,7 +805,7 @@ bool ScDocument::IsInLinkUpdate() const return bInLinkUpdate || IsInDdeLinkUpdate(); } -void ScDocument::UpdateExternalRefLinks(vcl::Window* pWin) +void ScDocument::UpdateExternalRefLinks(weld::Window* pWin) { if (!pExternalRefMgr) return; @@ -829,7 +829,7 @@ void ScDocument::UpdateExternalRefLinks(vcl::Window* pWin) aRefLinks.push_back(pRefLink); } - sc::WaitPointerSwitch aWaitSwitch(pWin); + weld::WaitObject aWaitSwitch(pWin); pExternalRefMgr->enableDocTimer(false); ScProgress aProgress(GetDocumentShell(), ScResId(SCSTR_UPDATE_EXTDOCS), aRefLinks.size(), true); @@ -856,7 +856,7 @@ void ScDocument::UpdateExternalRefLinks(vcl::Window* pWin) aBuf.append(ScResId(SCSTR_EXTDOC_NOT_LOADED)); aBuf.append("\n\n"); aBuf.append(aFile); - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin, VclMessageType::Warning, VclButtonsType::Ok, aBuf.makeStringAndClear())); xBox->run(); diff --git a/sc/source/core/tool/scopetools.cxx b/sc/source/core/tool/scopetools.cxx index 185a44fc65ca..44e634ef1ecf 100644 --- a/sc/source/core/tool/scopetools.cxx +++ b/sc/source/core/tool/scopetools.cxx @@ -57,19 +57,6 @@ IdleSwitch::~IdleSwitch() mrDoc.EnableIdle(mbOldValue); } -WaitPointerSwitch::WaitPointerSwitch(vcl::Window* pWin) : - mpFrameWin(pWin) -{ - if (mpFrameWin) - mpFrameWin->EnterWait(); -} - -WaitPointerSwitch::~WaitPointerSwitch() -{ - if (mpFrameWin) - mpFrameWin->LeaveWait(); -} - DelayFormulaGroupingSwitch::DelayFormulaGroupingSwitch(ScDocument& rDoc, bool delay) : mrDoc(rDoc), mbOldValue(rDoc.IsDelayedFormulaGrouping()) { diff --git a/sc/source/filter/oox/excelfilter.cxx b/sc/source/filter/oox/excelfilter.cxx index b3ec268b0db9..418d45c1efdc 100644 --- a/sc/source/filter/oox/excelfilter.cxx +++ b/sc/source/filter/oox/excelfilter.cxx @@ -160,8 +160,7 @@ bool ExcelFilter::importDocument() * detailed information other than returning true or * false at this point? */ - vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(ScDocShell::GetActiveDialogParent(), VclMessageType::Warning, VclButtonsType::Ok, aWarning)); xWarn->run(); diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index 2f7eb767ec6f..540c2b3b89de 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -543,9 +543,7 @@ void WorkbookFragment::recalcFormulaCells() if (rDoc.IsUserInteractionEnabled()) { // Ask the user if full re-calculation is desired. - vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - - MessageWithCheck aQueryBox(pWin ? pWin->GetFrameWeld() : nullptr, "modules/scalc/ui/recalcquerydialog.ui", "RecalcQueryDialog"); + MessageWithCheck aQueryBox(ScDocShell::GetActiveDialogParent(), "modules/scalc/ui/recalcquerydialog.ui", "RecalcQueryDialog"); aQueryBox.set_primary_text(ScResId(STR_QUERY_FORMULA_RECALC_ONLOAD_XLS)); aQueryBox.set_default_response(RET_YES); diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 8faa371895ce..033581de40c1 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -1241,7 +1241,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet ) if ( pDoc && bCalcAll ) { - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); pDoc->CalcAll(); if ( pViewSh ) pViewSh->UpdateCharts( true ); @@ -1568,13 +1568,6 @@ bool ScModule::IsModalMode(SfxObjectShell* pDocSh) SfxChildWindow* pChildWnd = lcl_GetChildWinFromCurrentView( m_nCurRefDlgId ); if ( pChildWnd ) { - if (pChildWnd->GetWindow()) - { - IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()); - assert(pRefDlg); - bIsModal = pChildWnd->IsVisible() && pRefDlg && - !( pRefDlg->IsRefInputMode() && pRefDlg->IsDocAllowed(pDocSh) ); - } if (pChildWnd->GetController()) { IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get()); @@ -1606,13 +1599,6 @@ bool ScModule::IsTableLocked() SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( m_nCurRefDlgId ); if ( pChildWnd ) { - if (pChildWnd->GetWindow()) - { - IAnyRefDialog* pRefDlg(dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow())); - assert(pRefDlg); - if (pRefDlg) - bLocked = pRefDlg->IsTableLocked(); - } if (pChildWnd->GetController()) { IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get()); @@ -1664,12 +1650,6 @@ bool ScModule::IsFormulaMode() SfxChildWindow* pChildWnd = lcl_GetChildWinFromCurrentView( m_nCurRefDlgId ); if ( pChildWnd ) { - if (pChildWnd->GetWindow()) - { - IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()); - assert(pRefDlg); - bIsFormula = pChildWnd->IsVisible() && pRefDlg && pRefDlg->IsRefInputMode(); - } if (pChildWnd->GetController()) { IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get()); @@ -1725,18 +1705,6 @@ void ScModule::SetReference( const ScRange& rRef, ScDocument* pDoc, aNew.aEnd.SetTab(nEndTab); } - if (pChildWnd->GetWindow()) - { - IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()); - assert(pRefDlg); - if(pRefDlg) - { - // hide the (color) selection now instead of later from LoseFocus, - // don't abort the ref input that causes this call (bDoneRefMode = sal_False) - pRefDlg->HideReference( false ); - pRefDlg->SetReference( aNew, pDoc ); - } - } if (pChildWnd->GetController()) { IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get()); @@ -1776,15 +1744,6 @@ void ScModule::AddRefEntry() OSL_ENSURE( pChildWnd, "NoChildWin" ); if ( pChildWnd ) { - if (pChildWnd->GetWindow()) - { - IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()); - assert(pRefDlg); - if (pRefDlg) - { - pRefDlg->AddRefEntry(); - } - } if (pChildWnd->GetController()) { IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get()); @@ -1818,15 +1777,6 @@ void ScModule::EndReference() OSL_ENSURE( pChildWnd, "NoChildWin" ); if ( pChildWnd ) { - if (pChildWnd->GetWindow()) - { - IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()); - assert(pRefDlg); - if(pRefDlg) - { - pRefDlg->SetActive(); - } - } if (pChildWnd->GetController()) { IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get()); diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 809ead0ff98f..cc72a804d47d 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -547,7 +547,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam, // execute - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // Calculate the script types for all cells in the sort range beforehand. // This will speed up the row height adjustment that takes place after the @@ -734,7 +734,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam, // execute - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); bool bKeepSub = false; // repeat existing partial results? ScSubTotalParam aSubTotalParam; @@ -1020,8 +1020,7 @@ void ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam, { if (rDoc.TestRemoveSubTotals( nTab, rParam )) { - vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(ScDocShell::GetActiveDialogParent(), VclMessageType::Question, VclButtonsType::YesNo, ScResId(STR_MSSG_DOSUBTOTALS_1))); // "Delete Data?" xBox->set_title(ScResId(STR_MSSG_DOSUBTOTALS_0)); // "StarCalc" @@ -1031,7 +1030,7 @@ void ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam, if (bOk) { - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); ScDocShellModificator aModificator( rDocShell ); ScSubTotalParam aNewParam( rParam ); // end of range is being changed @@ -1258,7 +1257,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb OSL_ASSERT(pOldObj && pNewObj && pOldObj != pNewObj); ScDocShellModificator aModificator( rDocShell ); - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); ScRangeList aRanges; aRanges.push_back(pOldObj->GetOutRange()); @@ -1307,8 +1306,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb // OutRange of pOldObj (pDestObj) is still old area if (!lcl_EmptyExcept(&rDoc, aNewOut, pOldObj->GetOutRange())) { - vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(ScDocShell::GetActiveDialogParent(), VclMessageType::Question, VclButtonsType::YesNo, ScResId(STR_PIVOT_NOTEMPTY))); xQueryBox->set_default_response(RET_YES); @@ -1344,7 +1342,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi) { ScDocShellModificator aModificator(rDocShell); - WaitObject aWait(ScDocShell::GetActiveDialogParent()); + weld::WaitObject aWait(ScDocShell::GetActiveDialogParent()); if (!isEditable(rDocShell, rDPObj.GetOutRange(), bApi)) return false; @@ -1361,8 +1359,7 @@ bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi) if (pModel && !aListOfObjects.empty()) { - vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(ScDocShell::GetActiveDialogParent(), VclMessageType::Question, VclButtonsType::YesNo, ScResId(STR_PIVOT_REMOVE_PIVOTCHART))); xQueryBox->set_default_response(RET_YES); @@ -1427,7 +1424,7 @@ bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi) bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool bApi) { ScDocShellModificator aModificator(rDocShell); - WaitObject aWait(ScDocShell::GetActiveDialogParent()); + weld::WaitObject aWait(ScDocShell::GetActiveDialogParent()); // At least one cell in the output range should be editable. Check in advance. if (!isEditable(rDocShell, ScRange(rDPObj.GetOutRange().aStart), bApi)) @@ -1504,8 +1501,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool if (!bEmpty) { - vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(ScDocShell::GetActiveDialogParent(), VclMessageType::Question, VclButtonsType::YesNo, ScResId(STR_PIVOT_NOTEMPTY))); xQueryBox->set_default_response(RET_YES); @@ -1539,7 +1535,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi) { ScDocShellModificator aModificator( rDocShell ); - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); if (!isEditable(rDocShell, rDPObj.GetOutRange(), bApi)) return false; @@ -1579,8 +1575,7 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi) { if (!lcl_EmptyExcept(&rDoc, aNewOut, rDPObj.GetOutRange())) { - vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(ScDocShell::GetActiveDialogParent(), VclMessageType::Question, VclButtonsType::YesNo, ScResId(STR_PIVOT_NOTEMPTY))); xQueryBox->set_default_response(RET_YES); @@ -1681,8 +1676,7 @@ void ScDBDocFunc::UpdateImport( const OUString& rTarget, const svx::ODataAccessD const ScDBData* pData = rDBColl.getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(rTarget)); if (!pData) { - vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(ScDocShell::GetActiveDialogParent(), VclMessageType::Info, VclButtonsType::Ok, ScResId(STR_TARGETNOTFOUND))); xInfoBox->run(); diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index 3a250687b65b..5c698c6b9176 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -136,9 +136,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, return false; } - vcl::Window* pWaitWin = ScDocShell::GetActiveDialogParent(); - if (pWaitWin) - pWaitWin->EnterWait(); + std::unique_ptr<weld::WaitObject> xWaitWin(new weld::WaitObject(ScDocShell::GetActiveDialogParent())); ScDocShellModificator aModificator( rDocShell ); bool bSuccess = false; @@ -596,16 +594,14 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, ScDBRangeRefreshedHint aHint( rParam ); rDoc.BroadcastUno( aHint ); - if (pWaitWin) - pWaitWin->LeaveWait(); + xWaitWin.reset(); if ( bTruncated ) // show warning ErrorHandler::HandleError(SCWARN_IMPORT_RANGE_OVERFLOW); } else { - if (pWaitWin) - pWaitWin->LeaveWait(); + xWaitWin.reset(); if (aErrorMessage.isEmpty()) { @@ -613,8 +609,8 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, pErrStringId = STR_MSSG_IMPORTDATA_0; aErrorMessage = ScResId(pErrStringId); } - vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(ScDocShell::GetActiveDialogParent(), VclMessageType::Info, VclButtonsType::Ok, aErrorMessage)); xInfoBox->run(); diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index a5a61830f0fc..76f5a6c49848 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -361,9 +361,7 @@ bool ScDocFunc::DetectiveMarkInvalid(SCTAB nTab) bool bUndo (rDoc.IsUndoEnabled()); ScDrawLayer* pModel = rDoc.GetDrawLayer(); - vcl::Window* pWaitWin = ScDocShell::GetActiveDialogParent(); - if (pWaitWin) - pWaitWin->EnterWait(); + std::unique_ptr<weld::WaitObject> xWaitWin(new weld::WaitObject(ScDocShell::GetActiveDialogParent())); if (bUndo) pModel->BeginCalcUndo(false); bool bOverflow; @@ -371,8 +369,7 @@ bool ScDocFunc::DetectiveMarkInvalid(SCTAB nTab) std::unique_ptr<SdrUndoGroup> pUndo; if (bUndo) pUndo = pModel->GetCalcUndo(); - if (pWaitWin) - pWaitWin->LeaveWait(); + xWaitWin.reset(); if (bDone) { if (pUndo && bUndo) @@ -1849,7 +1846,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark, return false; } - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important due to TrackFormulas at UpdateReference + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important due to TrackFormulas at UpdateReference ScDocumentUniquePtr pRefUndoDoc; std::unique_ptr<ScRefUndoData> pUndoData; @@ -2504,7 +2501,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, // do it - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference ScDocumentUniquePtr pUndoDoc; std::unique_ptr<ScDocument> pRefUndoDoc; @@ -3201,7 +3198,7 @@ void VBA_DeleteModule( ScDocShell& rDocSh, const OUString& sModuleName ) bool ScDocFunc::InsertTable( SCTAB nTab, const OUString& rName, bool bRecord, bool bApi ) { bool bSuccess = false; - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); ScDocShellModificator aModificator( rDocShell ); @@ -3252,7 +3249,7 @@ bool ScDocFunc::InsertTable( SCTAB nTab, const OUString& rName, bool bRecord, bo bool ScDocFunc::DeleteTable( SCTAB nTab, bool bRecord ) { - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); ScDocShellModificator aModificator( rDocShell ); @@ -3977,8 +3974,7 @@ bool ScDocFunc::Unprotect( SCTAB nTab, const OUString& rPassword, bool bApi ) { if (!bApi) { - vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(ScDocShell::GetActiveDialogParent(), VclMessageType::Info, VclButtonsType::Ok, ScResId(SCSTR_WRONGPASSWORD))); xInfoBox->run(); @@ -4010,8 +4006,7 @@ bool ScDocFunc::Unprotect( SCTAB nTab, const OUString& rPassword, bool bApi ) { if (!bApi) { - vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(ScDocShell::GetActiveDialogParent(), VclMessageType::Info, VclButtonsType::Ok, ScResId(SCSTR_WRONGPASSWORD))); xInfoBox->run(); @@ -4182,7 +4177,7 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark, ScEditableTester aTester( &rDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark ); if ( nFormatNo < pAutoFormat->size() && aTester.IsEditable() ) { - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); bool bSize = pAutoFormat->findByIndex(nFormatNo)->GetIncludeWidthHeight(); @@ -4295,7 +4290,7 @@ bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark, ScEditableTester aTester( &rDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark ); if ( aTester.IsEditable() ) { - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); ScDocumentUniquePtr pUndoDoc; @@ -4382,7 +4377,7 @@ bool ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark, ScEditableTester aTester( &rDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark ); if ( aTester.IsEditable() ) { - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); rDoc.SetDirty( rRange, false ); if ( bRecord ) { @@ -4526,7 +4521,7 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark, ScEditableTester aTester( &rDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark ); if ( aTester.IsEditable() ) { - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); ScRange aSourceArea = aRange; ScRange aDestArea = aRange; @@ -4639,7 +4634,7 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark, ScEditableTester aTester( &rDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark ); if ( aTester.IsEditable() ) { - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); ScRange aSourceArea = rRange; ScRange aDestArea = rRange; @@ -4826,7 +4821,7 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e if (ScViewData::SelectionFillDOOM( aDestArea)) return false; - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); ScDocumentUniquePtr pUndoDoc; if ( bRecord ) @@ -5185,8 +5180,7 @@ void ScDocFunc::CreateOneName( ScRangeName& rList, OUString aTemplate = ScResId( STR_CREATENAME_REPLACE ); OUString aMessage = aTemplate.getToken( 0, '#' ) + aName + aTemplate.getToken( 1, '#' ); - vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(ScDocShell::GetActiveDialogParent(), VclMessageType::Question, VclButtonsType::YesNo, aMessage)); xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 9f9741db2add..4d4872840151 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -505,9 +505,7 @@ bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const css::uno::Reference< css { // Generator is not LibreOffice. Ask if the user wants to perform // full re-calculation. - vcl::Window* pWin = GetActiveDialogParent(); - - MessageWithCheck aQueryBox(pWin ? pWin->GetFrameWeld() : nullptr, + MessageWithCheck aQueryBox(GetActiveDialogParent(), "modules/scalc/ui/recalcquerydialog.ui", "RecalcQueryDialog"); aQueryBox.set_primary_text(ScResId(STR_QUERY_FORMULA_RECALC_ONLOAD_ODS)); aQueryBox.set_default_response(RET_YES); @@ -729,9 +727,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) ScAppOptions aAppOptions = SC_MOD()->GetAppOptions(); if ( aAppOptions.GetShowSharedDocumentWarning() ) { - vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - - MessageWithCheck aWarningBox(pWin ? pWin->GetFrameWeld() : nullptr, + MessageWithCheck aWarningBox(ScDocShell::GetActiveDialogParent(), "modules/scalc/ui/sharedwarningdialog.ui", "SharedWarningDialog"); aWarningBox.run(); @@ -858,8 +854,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) OUString aMessage( ScResId( STR_FILE_LOCKED_SAVE_LATER ) ); aMessage = aMessage.replaceFirst( "%1", aUserName ); - vcl::Window* pWin = GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetActiveDialogParent(), VclMessageType::Warning, VclButtonsType::NONE, aMessage)); xWarn->add_button(Button::GetStandardText(StandardButtonType::Retry), RET_RETRY); @@ -939,8 +934,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) } else { - vcl::Window* pWin = GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetActiveDialogParent(), VclMessageType::Warning, VclButtonsType::Ok, ScResId(STR_DOC_NOLONGERSHARED))); xWarn->run(); @@ -982,8 +976,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) { if ( GetDocument().GetExternalRefManager()->containsUnsavedReferences() ) { - vcl::Window* pWin = GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetActiveDialogParent(), VclMessageType::Warning, VclButtonsType::YesNo, ScResId(STR_UNSAVED_EXT_REF))); if (RET_NO == xWarn->run()) @@ -1082,7 +1075,7 @@ bool ScDocShell::LoadFrom( SfxMedium& rMedium ) LoadMediumGuard aLoadGuard(&m_aDocument); ScRefreshTimerProtector aProt( m_aDocument.GetRefreshTimerControlAddress() ); - WaitObject aWait( GetActiveDialogParent() ); + weld::WaitObject aWait( GetActiveDialogParent() ); bool bRet = false; @@ -2325,7 +2318,7 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed ) aFltName == pFilterExcel97 || aFltName == pFilterEx5Temp || aFltName == pFilterEx95Temp || aFltName == pFilterEx97Temp) { - WaitObject aWait( GetActiveDialogParent() ); + weld::WaitObject aWait( GetActiveDialogParent() ); bool bDoSave = true; if( ScTabViewShell* pViewShell = GetBestViewShell() ) @@ -2403,7 +2396,7 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed ) sItStr = aDefOptions.BuildString(); } - WaitObject aWait( GetActiveDialogParent() ); + weld::WaitObject aWait( GetActiveDialogParent() ); ScImportOptions aOptions( sItStr ); AsciiSave( *pStream, aOptions ); bRet = true; @@ -2432,7 +2425,7 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed ) sCharSet = ScGlobal::GetCharsetString( RTL_TEXTENCODING_IBM_850 ); } - WaitObject aWait( GetActiveDialogParent() ); + weld::WaitObject aWait( GetActiveDialogParent() ); // FIXME: Hack so that the Sba opened TempFile can be overwritten rMed.CloseOutStream(); bool bHasMemo = false; @@ -2504,7 +2497,7 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed ) sItStr = ScGlobal::GetCharsetString( RTL_TEXTENCODING_MS_1252 ); } - WaitObject aWait( GetActiveDialogParent() ); + weld::WaitObject aWait( GetActiveDialogParent() ); ScFormatFilter::Get().ScExportDif( *pStream, &m_aDocument, ScAddress(0,0,0), ScGlobal::GetCharsetValue(sItStr) ); bRet = true; @@ -2519,7 +2512,7 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed ) SvStream* pStream = rMed.GetOutStream(); if ( pStream ) { - WaitObject aWait( GetActiveDialogParent() ); + weld::WaitObject aWait( GetActiveDialogParent() ); SCCOL nEndCol; SCROW nEndRow; @@ -2543,7 +2536,7 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed ) if (pSet->GetItemState(SID_FILE_FILTEROPTIONS, true, &pItem) == SfxItemState::SET) sFilterOptions = static_cast<const SfxStringItem*>(pItem)->GetValue(); - WaitObject aWait(GetActiveDialogParent()); + weld::WaitObject aWait(GetActiveDialogParent()); ScImportExport aImExport(&m_aDocument); aImExport.SetStreamPath(rMed.GetName()); aImExport.SetFilterOptions(sFilterOptions); @@ -2930,13 +2923,13 @@ std::unique_ptr<SfxDocumentInfoDialog> ScDocShell::CreateDocumentInfoDialog(weld return xDlg; } -vcl::Window* ScDocShell::GetActiveDialogParent() +weld::Window* ScDocShell::GetActiveDialogParent() { ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell(); if ( pViewSh ) return pViewSh->GetDialogParent(); - else - return Application::GetDefDialogParent(); + vcl::Window* pRet = Application::GetDefDialogParent(); + return pRet ? pRet->GetFrameWeld() : nullptr; } void ScDocShell::SetSolverSaveData( std::unique_ptr<ScOptSolverSave> pData ) diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index 64fc29f7634a..bbb5dbcb45ec 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -1201,11 +1201,11 @@ bool ScDocShell::MergeSharedDocument( ScDocShell* pSharedDocShell ) while ( bLoop ) { bLoop = false; - vcl::Window* pWin = GetActiveDialogParent(); - ScConflictsDlg aDlg(pWin ? pWin->GetFrameWeld() : nullptr, GetViewData(), &rSharedDoc, aConflictsList); + weld::Window* pWin = GetActiveDialogParent(); + ScConflictsDlg aDlg(pWin, GetViewData(), &rSharedDoc, aConflictsList); if (aDlg.run() == RET_CANCEL) { - std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin, VclMessageType::Question, VclButtonsType::YesNo, ScResId(STR_DOC_WILLNOTBESAVED))); xQueryBox->set_default_response(RET_YES); @@ -1321,8 +1321,7 @@ bool ScDocShell::MergeSharedDocument( ScDocShell* pSharedDocShell ) PostPaintExtras(); PostPaintGridAll(); - vcl::Window* pWin = GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetActiveDialogParent(), VclMessageType::Info, VclButtonsType::Ok, ScResId(STR_DOC_UPDATED))); xInfoBox->run(); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index a5a42acddfa2..a46aac7147ba 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -115,10 +115,10 @@ void ScDocShell::ReloadAllLinks() getEmbeddedObjectContainer().setUserAllowsLinkUpdate(true); ReloadTabLinks(); - vcl::Window *pDialogParent = GetActiveDialogParent(); + weld::Window *pDialogParent = GetActiveDialogParent(); m_aDocument.UpdateExternalRefLinks(pDialogParent); - bool bAnyDde = m_aDocument.GetDocLinkManager().updateDdeOrOleOrWebServiceLinks(pDialogParent ? pDialogParent->GetFrameWeld() : nullptr); + bool bAnyDde = m_aDocument.GetDocLinkManager().updateDdeOrOleOrWebServiceLinks(pDialogParent); if (bAnyDde) { @@ -520,8 +520,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) OSL_ENSURE(pViewSh,"SID_REIMPORT_AFTER_LOAD: no View"); if (pViewSh && pDBColl) { - vcl::Window* pWin = GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetActiveDialogParent(), VclMessageType::Question, VclButtonsType::YesNo, ScResId(STR_REIMPORT_AFTER_LOAD))); xQueryBox->set_default_response(RET_YES); @@ -614,8 +613,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) if ( !pItem ) { // no dialog on playing the macro - vcl::Window* pWin = GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetActiveDialogParent(), VclMessageType::Warning, VclButtonsType::YesNo, ScResId(STR_END_REDLINING))); xWarn->set_default_response(RET_NO); @@ -681,8 +679,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) { if ( nSlot == SID_DOCUMENT_COMPARE ) { //! old changes trace will be lost - vcl::Window* pWin = GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetActiveDialogParent(), VclMessageType::Warning, VclButtonsType::YesNo, ScResId(STR_END_REDLINING))); xWarn->set_default_response(RET_NO); @@ -909,8 +906,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - vcl::Window* pWin = GetActiveDialogParent(); - ScopedVclPtr<AbstractScNewScenarioDlg> pNewDlg(pFact->CreateScNewScenarioDlg(pWin ? pWin->GetFrameWeld() : nullptr, aName, true, bSheetProtected)); + ScopedVclPtr<AbstractScNewScenarioDlg> pNewDlg(pFact->CreateScNewScenarioDlg(GetActiveDialogParent(), aName, true, bSheetProtected)); pNewDlg->SetScenarioData( aName, aComment, aColor, nFlags ); if ( pNewDlg->Execute() == RET_OK ) { @@ -962,8 +958,8 @@ void ScDocShell::Execute( SfxRequest& rReq ) break; } - vcl::Window* pWin = GetActiveDialogParent(); - ScShareDocumentDlg aDlg(pWin ? pWin->GetFrameWeld() : nullptr, pViewData); + weld::Window* pWin = GetActiveDialogParent(); + ScShareDocumentDlg aDlg(pWin, pViewData); if (aDlg.run() == RET_OK) { bool bSetShared = aDlg.IsShareDocumentChecked(); @@ -974,7 +970,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) bool bContinue = true; if ( HasName() ) { - std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin, VclMessageType::Question, VclButtonsType::YesNo, ScResId(STR_DOC_WILLBESAVED))); xQueryBox->set_default_response(RET_YES); @@ -1065,14 +1061,14 @@ void ScDocShell::Execute( SfxRequest& rReq ) OUString aMessage( ScResId( STR_FILE_LOCKED_TRY_LATER ) ); aMessage = aMessage.replaceFirst( "%1", aUserName ); - std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin, VclMessageType::Warning, VclButtonsType::Ok, aMessage)); xWarn->run(); } else { - std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin, VclMessageType::Warning, VclButtonsType::YesNo, ScResId(STR_DOC_DISABLESHARED))); xWarn->set_default_response(RET_YES); @@ -1109,7 +1105,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) else { xCloseable->close( true ); - std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin, VclMessageType::Warning, VclButtonsType::Ok, ScResId(STR_DOC_NOLONGERSHARED))); xWarn->run(); @@ -1176,7 +1172,8 @@ void ScDocShell::Execute( SfxRequest& rReq ) if ( aLangText == "*" ) { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog(GetActiveDialogParent(), SID_LANGUAGE_OPTIONS)); + ScTabViewShell* pSh = GetBestViewShell(); + ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog(pSh ? pSh->GetLegacyDialogParent() : nullptr, SID_LANGUAGE_OPTIONS)); pDlg->Execute(); rDoc.GetLanguage( eLang, eCjk, eCtl ); @@ -1270,8 +1267,8 @@ bool ScDocShell::ExecuteChangeProtectionDialog( bool bJustQueryIfProtected ) OUString aText( ScResId( SCSTR_PASSWORD ) ); OUString aPassword; - vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - SfxPasswordDialog aDlg(pWin ? pWin->GetFrameWeld() : nullptr, &aText); + weld::Window* pWin = ScDocShell::GetActiveDialogParent(); + SfxPasswordDialog aDlg(pWin, &aText); aDlg.set_title(aTitle); aDlg.SetMinLen(1); aDlg.set_help_id(GetStaticInterface()->GetSlot(SID_CHG_PROTECT)->GetCommand()); @@ -1295,7 +1292,7 @@ bool ScDocShell::ExecuteChangeProtectionDialog( bool bJustQueryIfProtected ) } else { - std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin, VclMessageType::Info, VclButtonsType::Ok, ScResId(SCSTR_WRONGPASSWORD))); xInfoBox->run(); @@ -1340,7 +1337,7 @@ void ScDocShell::DoRecalc( bool bApi ) } if (!bDone) // otherwise re-calculate document { - WaitObject aWaitObj( GetActiveDialogParent() ); + weld::WaitObject aWaitObj( GetActiveDialogParent() ); if ( pHdl ) { // tdf97897 set current cell to Dirty to force recalculation of cell @@ -1369,7 +1366,7 @@ void ScDocShell::DoHardRecalc() { auto start = std::chrono::steady_clock::now(); ScDocShellRecalcGuard aGuard(m_aDocument); - WaitObject aWaitObj( GetActiveDialogParent() ); + weld::WaitObject aWaitObj( GetActiveDialogParent() ); ScTabViewShell* pSh = GetBestViewShell(); if ( pSh ) { @@ -1634,9 +1631,9 @@ void ScDocShell::PageStyleModified( const OUString& rStyleName, bool bApi ) if (bWarn && !bApi) { - vcl::Window* pWin = GetActiveDialogParent(); - ScWaitCursorOff aWaitOff(pWin); - std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + weld::Window* pWin = GetActiveDialogParent(); + weld::WaitObject aWaitOff(pWin); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin, VclMessageType::Info, VclButtonsType::Ok, ScResId(STR_PRINT_INVALID_AREA))); xInfoBox->run(); @@ -1686,8 +1683,7 @@ void ScDocShell::ExecutePageStyle( const SfxViewShell& rCaller, ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - vcl::Window* pParent = GetActiveDialogParent(); - VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScStyleDlg(pParent ? pParent->GetFrameWeld() : nullptr, *pStyleSheet, true)); + VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScStyleDlg(GetActiveDialogParent(), *pStyleSheet, true)); std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq)); rReq.Ignore(); // the 'old' request is not relevant any more @@ -1696,7 +1692,7 @@ void ScDocShell::ExecutePageStyle( const SfxViewShell& rCaller, { const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); - WaitObject aWait( GetActiveDialogParent() ); + weld::WaitObject aWait( GetActiveDialogParent() ); OUString aNewName = pStyleSheet->GetName(); if ( aNewName != aOldName && @@ -1844,9 +1840,8 @@ void ScDocShell::ExecutePageStyle( const SfxViewShell& rCaller, ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - vcl::Window *pDialogParent = GetActiveDialogParent(); VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScHFEditDlg( - pDialogParent ? pDialogParent->GetFrameWeld() : nullptr, + GetActiveDialogParent(), rStyleSet, aStr, nResId)); diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index bc7c6fcfc943..a1604c3d4861 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -73,9 +73,9 @@ void ScDocShell::ErrorMessage(const char* pGlobStrId) { //! StopMarking at the (active) view? - vcl::Window* pParent = GetActiveDialogParent(); - ScWaitCursorOff aWaitOff( pParent ); - bool bFocus = pParent && pParent->HasFocus(); + weld::Window* pParent = GetActiveDialogParent(); + weld::WaitObject aWaitOff( pParent ); + bool bFocus = pParent && pParent->has_focus(); if (pGlobStrId && strcmp(pGlobStrId, STR_PROTECTIONERR) == 0) { @@ -85,13 +85,13 @@ void ScDocShell::ErrorMessage(const char* pGlobStrId) } } - std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pParent, VclMessageType::Info, VclButtonsType::Ok, ScResId(pGlobStrId))); xInfoBox->run(); if (bFocus) - pParent->GrabFocus(); + pParent->grab_focus(); } bool ScDocShell::IsEditable() const @@ -522,8 +522,7 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord ) if (bErr) { - vcl::Window* pWin = GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetActiveDialogParent(), VclMessageType::Info, VclButtonsType::Ok, ScResId(STR_CONSOLIDATE_ERR1))); xInfoBox->run(); @@ -532,7 +531,7 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord ) // execute - WaitObject aWait( GetActiveDialogParent() ); + weld::WaitObject aWait( GetActiveDialogParent() ); ScDocShellModificator aModificator( *this ); ScRange aOldDest; @@ -734,8 +733,7 @@ void ScDocShell::UseScenario( SCTAB nTab, const OUString& rName, bool bRecord ) } else { - vcl::Window* pWin = GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetActiveDialogParent(), VclMessageType::Info, VclButtonsType::Ok, ScResId(STR_PROTECTIONERR))); xInfoBox->run(); @@ -743,8 +741,7 @@ void ScDocShell::UseScenario( SCTAB nTab, const OUString& rName, bool bRecord ) } else { - vcl::Window* pWin = GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetActiveDialogParent(), VclMessageType::Info, VclButtonsType::Ok, ScResId(STR_SCENARIO_NOTFOUND))); xInfoBox->run(); diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 36b4aac3fc79..8e995ebf0c40 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -3144,8 +3144,7 @@ void ScExternalRefManager::Notify( SfxBroadcaster&, const SfxHint& rHint ) { case SfxEventHintId::PrepareCloseDoc: { - vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(ScDocShell::GetActiveDialogParent(), VclMessageType::Warning, VclButtonsType::Ok, ScResId(STR_CLOSE_WITH_UNSAVED_REFS))); xWarn->run(); diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 58d848a3095e..e49c4d4a89f4 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -1485,8 +1485,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) if ( !mbApi && nStartCol != nEndCol && !pDoc->IsBlockEmpty( nTab, nStartCol + 1, nStartRow, nEndCol, nRow ) ) { - vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - ScReplaceWarnBox aBox(pWin ? pWin->GetFrameWeld() : nullptr); + ScReplaceWarnBox aBox(ScDocShell::GetActiveDialogParent()); if (aBox.run() != RET_YES) { return false; diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx index c510d685248b..66b776f2f9e0 100644 --- a/sc/source/ui/drawfunc/drawsh.cxx +++ b/sc/source/ui/drawfunc/drawsh.cxx @@ -381,7 +381,7 @@ void ScDrawShell::ExecuteLineDlg( SfxRequest& rReq ) pView->MergeAttrFromMarked( aNewAttr, false ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxLineTabDialog( pViewData->GetFrameWeld(), + ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxLineTabDialog( pViewData->GetDialogParent(), &aNewAttr, pViewData->GetDocument()->GetDrawLayer(), pObj, @@ -409,7 +409,7 @@ void ScDrawShell::ExecuteAreaDlg( SfxRequest& rReq ) pView->MergeAttrFromMarked( aNewAttr, false ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - weld::Window* pWin = pViewData->GetFrameWeld(); + weld::Window* pWin = pViewData->GetDialogParent(); ScopedVclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog( pWin, &aNewAttr, pViewData->GetDocument()->GetDrawLayer(), true)); @@ -436,7 +436,7 @@ void ScDrawShell::ExecuteTextAttrDlg( SfxRequest& rReq ) pView->MergeAttrFromMarked( aNewAttr, false ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - weld::Window* pWin = pViewData->GetFrameWeld(); + weld::Window* pWin = pViewData->GetDialogParent(); ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateTextTabDialog(pWin, &aNewAttr, pView)); sal_uInt16 nResult = pDlg->Execute(); @@ -463,7 +463,7 @@ void ScDrawShell::ExecuteMeasureDlg( SfxRequest& rReq ) pView->MergeAttrFromMarked( aNewAttr, false ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - weld::Window* pWin = pViewData->GetFrameWeld(); + weld::Window* pWin = pViewData->GetDialogParent(); ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateSfxDialog(pWin, aNewAttr, pView, RID_SVXPAGE_MEASURE)); sal_uInt16 nResult = pDlg->Execute(); diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 3c03fa2b2eba..c37b8f11e7ed 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -874,7 +874,7 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq ) case SID_DRAWTEXT_ATTR_DLG: { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateTextTabDialog(pViewData->GetFrameWeld(), &aEditAttr, pView)); + ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateTextTabDialog(pViewData->GetDialogParent(), &aEditAttr, pView)); bDone = ( RET_OK == pDlg->Execute() ); diff --git a/sc/source/ui/drawfunc/drtxtob1.cxx b/sc/source/ui/drawfunc/drtxtob1.cxx index 401c954a2065..1b092128afe3 100644 --- a/sc/source/ui/drawfunc/drtxtob1.cxx +++ b/sc/source/ui/drawfunc/drtxtob1.cxx @@ -42,7 +42,7 @@ bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs, { ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScCharDlg( - pViewData->GetFrameWeld(), &rArgs, + pViewData->GetDialogParent(), &rArgs, pViewData->GetSfxDocShell())); if (nSlot == SID_CHAR_DLG_EFFECT) { @@ -84,7 +84,7 @@ bool ScDrawTextObjectBar::ExecuteParaDlg( const SfxItemSet& rArgs, ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScParagraphDlg( - pViewData->GetFrameWeld(), &aNewAttr)); + pViewData->GetDialogParent(), &aNewAttr)); bool bRet = ( pDlg->Execute() == RET_OK ); if ( bRet ) @@ -102,7 +102,7 @@ void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest & /* rReq */ ) SdrView* pView = pViewData->GetScDrawView(); OutlinerView* pOutView = pView->GetTextEditOutlinerView(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog(pViewData->GetFrameWeld())); + ScopedVclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog(pViewData->GetDialogParent())); pDlg->Insert( SotClipboardFormatId::STRING, EMPTY_OUSTRING ); pDlg->Insert( SotClipboardFormatId::RTF, EMPTY_OUSTRING ); diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx index 61c3899a3fae..8fcbc8a586bd 100644 --- a/sc/source/ui/drawfunc/graphsh.cxx +++ b/sc/source/ui/drawfunc/graphsh.cxx @@ -199,7 +199,7 @@ void ScGraphicShell::ExecuteCompressGraphic( SAL_UNUSED_PARAMETER SfxRequest& ) if( dynamic_cast<const SdrGrafObj*>( pObj) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap ) { SdrGrafObj* pGraphicObj = static_cast<SdrGrafObj*>(pObj); - CompressGraphicsDialog dialog(GetViewData()->GetFrameWeld(), pGraphicObj, GetViewData()->GetBindings()); + CompressGraphicsDialog dialog(GetViewData()->GetDialogParent(), pGraphicObj, GetViewData()->GetBindings()); if (dialog.run() == RET_OK) { SdrGrafObj* pNewObject = dialog.GetCompressedSdrGrafObj(); diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 375d84378eb9..c3e8b850d8ab 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -262,7 +262,7 @@ public: void NotifyStyle( const SfxStyleSheetHint& rHint ); void DoAutoStyle( const ScRange& rRange, const OUString& rStyle ); - static vcl::Window* GetActiveDialogParent(); + static weld::Window* GetActiveDialogParent(); void ErrorMessage(const char* pGlobStrId); bool IsEditable() const; diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 3aa575aaa0da..64951da8ab4c 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -222,7 +222,8 @@ public: virtual ~ScTabViewShell() override; - vcl::Window* GetDialogParent(); + weld::Window* GetDialogParent(); + vcl::Window* GetLegacyDialogParent(); bool IsRefInputMode() const; void ExecuteInputDirect(); diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index 8f65e80c9a47..8400027458d6 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -360,8 +360,7 @@ public: ScMarkData& GetMarkData(); const ScMarkData& GetMarkData() const; - vcl::Window* GetDialogParent(); // forwarded from tabvwsh - weld::Window* GetFrameWeld(); // forwarded from tabvwsh + weld::Window* GetDialogParent(); // forwarded from tabvwsh ScGridWindow* GetActiveWin(); // from View const ScGridWindow* GetActiveWin() const; ScDrawView* GetScDrawView(); // from View diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index a24ff8558d31..15d6a8e3e273 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -287,7 +287,7 @@ void ScUndoInsertCells::Undo() if ( pPasteUndo ) pPasteUndo->Undo(); // undo paste first - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important due to TrackFormulas in UpdateReference + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important due to TrackFormulas in UpdateReference BeginUndo(); DoChange( true ); EndUndo(); @@ -299,7 +299,7 @@ void ScUndoInsertCells::Undo() void ScUndoInsertCells::Redo() { - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important due to TrackFormulas in UpdateReference + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important due to TrackFormulas in UpdateReference BeginRedo(); DoChange( false ); EndRedo(); @@ -546,7 +546,7 @@ void ScUndoDeleteCells::DoChange( const bool bUndo ) void ScUndoDeleteCells::Undo() { - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference BeginUndo(); DoChange( true ); EndUndo(); @@ -582,7 +582,7 @@ void ScUndoDeleteCells::Undo() void ScUndoDeleteCells::Redo() { - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference BeginRedo(); DoChange( false); EndRedo(); @@ -714,7 +714,7 @@ void ScUndoDeleteMulti::SetChangeTrack() void ScUndoDeleteMulti::Undo() { - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference BeginUndo(); ScDocument& rDoc = pDocShell->GetDocument(); @@ -756,7 +756,7 @@ void ScUndoDeleteMulti::Undo() void ScUndoDeleteMulti::Redo() { - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference BeginRedo(); ScDocument& rDoc = pDocShell->GetDocument(); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 56ace0ee0a74..027555aa0b70 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -2289,7 +2289,7 @@ sheet::GoalResult SAL_CALL ScModelObj::seekGoal( aResult.Divergence = DBL_MAX; // not found if (pDocShell) { - WaitObject aWait( ScDocShell::GetActiveDialogParent() ); + weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() ); ScDocument& rDoc = pDocShell->GetDocument(); double fValue = 0.0; bool bFound = rDoc.Solver( diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 1d793592c620..27d135a02b04 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -1263,7 +1263,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case SID_COPY: // for graphs in DrawShell { - WaitObject aWait( GetViewData()->GetDialogParent() ); + weld::WaitObject aWait( GetViewData()->GetDialogParent() ); pTabViewShell->CopyToClip( nullptr, false, false, true ); rReq.Done(); GetViewData()->SetPasteMode( ScPasteFlags::Mode | ScPasteFlags::Border ); @@ -1274,7 +1274,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case SID_CUT: // for graphs in DrawShell { - WaitObject aWait( GetViewData()->GetDialogParent() ); + weld::WaitObject aWait( GetViewData()->GetDialogParent() ); pTabViewShell->CutToClip(); rReq.Done(); GetViewData()->SetPasteMode( ScPasteFlags::Mode | ScPasteFlags::Border ); @@ -1292,7 +1292,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case SID_CLIPBOARD_FORMAT_ITEMS: { - WaitObject aWait( GetViewData()->GetDialogParent() ); + weld::WaitObject aWait( GetViewData()->GetDialogParent() ); SotClipboardFormatId nFormat = SotClipboardFormatId::NONE; const SfxPoolItem* pItem; @@ -1455,7 +1455,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if( nFlags != InsertDeleteFlags::NONE ) { { - WaitObject aWait( GetViewData()->GetDialogParent() ); + weld::WaitObject aWait( GetViewData()->GetDialogParent() ); if ( bAsLink && bOtherDoc ) pTabViewShell->PasteFromSystem(SotClipboardFormatId::LINK); // DDE insert else @@ -1522,7 +1522,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) SotClipboardFormatId nFormat = static_cast<SotClipboardFormatId>(static_cast<const SfxUInt32Item*>(pItem)->GetValue()); bool bRet=true; { - WaitObject aWait( GetViewData()->GetDialogParent() ); + weld::WaitObject aWait( GetViewData()->GetDialogParent() ); bool bDraw = ( ScDrawTransferObj::GetOwnClipboard(xTransferable) != nullptr ); if ( bDraw && nFormat == SotClipboardFormatId::EMBED_SOURCE ) pTabViewShell->PasteDraw(); @@ -1576,7 +1576,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if (nFormat != SotClipboardFormatId::NONE) { { - WaitObject aWait( GetViewData()->GetDialogParent() ); + weld::WaitObject aWait( GetViewData()->GetDialogParent() ); if ( bDraw && nFormat == SotClipboardFormatId::EMBED_SOURCE ) pTabViewShell->PasteDraw(); else @@ -1604,7 +1604,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) // differentiate between own cell data and draw objects/external data // this makes FID_INS_CELL_CONTENTS superfluous { - WaitObject aWait( GetViewData()->GetDialogParent() ); + weld::WaitObject aWait( GetViewData()->GetDialogParent() ); // we should differentiate between SotClipboardFormatId::STRING and SotClipboardFormatId::STRING_TSVC, // and paste the SotClipboardFormatId::STRING_TSVC if it is available. diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 8f5f587fa9e1..72f12d6d016d 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -800,7 +800,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) std::shared_ptr<ScDocument> xDoc(new ScDocument, o3tl::default_delete<ScDocument>()); xDoc->InsertTab(0, "test"); ScDocument* pDoc = GetViewData()->GetDocument(); - ScopedVclPtrInstance< ScDataProviderDlg > aDialog( pTabViewShell->GetDialogParent(), xDoc, pDoc); + ScopedVclPtrInstance< ScDataProviderDlg > aDialog( pTabViewShell->GetLegacyDialogParent(), xDoc, pDoc); if (aDialog->Execute() == RET_OK) { aDialog->import(pDoc); diff --git a/sc/source/ui/view/cliputil.cxx b/sc/source/ui/view/cliputil.cxx index 89d6f95b7f4f..ebcce7e0f76e 100644 --- a/sc/source/ui/view/cliputil.cxx +++ b/sc/source/ui/view/cliputil.cxx @@ -74,7 +74,7 @@ void ScClipUtil::PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* pTab else { // normal paste - WaitObject aWait( pViewData->GetDialogParent() ); + weld::WaitObject aWait( pViewData->GetDialogParent() ); if (!pOwnClip) pTabViewShell->PasteFromSystem(); else diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx index b82762b7212b..790bf624f1ab 100644 --- a/sc/source/ui/view/dbfunc.cxx +++ b/sc/source/ui/view/dbfunc.cxx @@ -342,7 +342,7 @@ void ScDBFunc::ToggleAutoFilter() { if (!bHeader) { - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetViewData().GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetViewData().GetDialogParent(), VclMessageType::Question, VclButtonsType::YesNo, ScResId(STR_MSSG_MAKEAUTOFILTER_0))); // header from first row? xBox->set_title(ScResId(STR_MSSG_DOSUBTOTALS_0)); // "StarCalc" @@ -371,7 +371,7 @@ void ScDBFunc::ToggleAutoFilter() } else { - std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetViewData().GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetViewData().GetDialogParent(), VclMessageType::Warning, VclButtonsType::Ok, ScResId(STR_ERR_AUTOFILTER))); xErrorBox->run(); diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index 7a7946be7b32..63e4c195f6ca 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -418,13 +418,13 @@ void ScDBFunc::DoSubTotals( const ScSubTotalParam& rParam, bool bRecord, return; } - weld::WaitObject aWait(GetViewData().GetFrameWeld()); + weld::WaitObject aWait(GetViewData().GetDialogParent()); bool bOk = true; if (rParam.bReplace) { if (rDoc.TestRemoveSubTotals( nTab, rParam )) { - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetViewData().GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetViewData().GetDialogParent(), VclMessageType::Question, VclButtonsType::YesNo, ScResId(STR_MSSG_DOSUBTOTALS_1))); // "delete data?" xBox->set_title(ScResId(STR_MSSG_DOSUBTOTALS_0)); // "StarCalc" diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 77c47994f19d..f458a0a75b8e 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -270,7 +270,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) case SID_PASTE_SPECIAL: { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog(pViewData->GetFrameWeld())); + ScopedVclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog(pViewData->GetDialogParent())); SotClipboardFormatId nFormat = SotClipboardFormatId::NONE; pDlg->Insert( SotClipboardFormatId::STRING, EMPTY_OUSTRING ); pDlg->Insert( SotClipboardFormatId::RTF, EMPTY_OUSTRING ); @@ -468,7 +468,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) { ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractScNamePasteDlg> pDlg(pFact->CreateScNamePasteDlg(pViewData->GetFrameWeld(), pViewData->GetDocShell())); + ScopedVclPtr<AbstractScNamePasteDlg> pDlg(pFact->CreateScNamePasteDlg(pViewData->GetDialogParent(), pViewData->GetDocShell())); short nRet = pDlg->Execute(); // pDlg is needed below @@ -508,7 +508,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScCharDlg( - pViewData->GetFrameWeld(), &aAttrs, pObjSh)); + pViewData->GetDialogParent(), &aAttrs, pObjSh)); if (nSlot == SID_CHAR_DLG_EFFECT) { pDlg->SetCurPageId("fonteffects"); diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx index af1ea81d735b..c3b3f16775ab 100644 --- a/sc/source/ui/view/spelleng.cxx +++ b/sc/source/ui/view/spelleng.cxx @@ -347,8 +347,7 @@ weld::Window* ScSpellingEngine::GetDialogParent() } // fall back to standard dialog parent - vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - return pWin ? pWin->GetFrameWeld() : nullptr; + return ScDocShell::GetActiveDialogParent(); } ScConversionParam::ScConversionParam( ScConversionType eConvType ) : diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 1551678717e9..19d55eb882d4 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -1423,9 +1423,9 @@ void ScTabView::ErrorMessage(const char* pGlobStrId) StopMarking(); // if called by Focus from MouseButtonDown - vcl::Window* pParent = aViewData.GetDialogParent(); - ScWaitCursorOff aWaitOff( pParent ); - bool bFocus = pParent && pParent->HasFocus(); + weld::Window* pParent = aViewData.GetDialogParent(); + weld::WaitObject aWaitOff( pParent ); + bool bFocus = pParent && pParent->has_focus(); if (pGlobStrId && strcmp(pGlobStrId, STR_PROTECTIONERR) == 0) { @@ -1435,13 +1435,13 @@ void ScTabView::ErrorMessage(const char* pGlobStrId) } } - std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pParent, VclMessageType::Info, VclButtonsType::Ok, ScResId(pGlobStrId))); xInfoBox->run(); if (bFocus) - pParent->GrabFocus(); + pParent->grab_focus(); } void ScTabView::UpdatePageBreakData( bool bForcePaint ) diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index adfa1230ec5c..aa7890723393 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -2015,12 +2015,6 @@ void ScTabView::SetTabNo( SCTAB nTab, bool bNew, bool bExtendSelection, bool bSa SfxChildWindow* pChildWnd = pViewFrm->GetChildWindow( nCurRefDlgId ); if (pChildWnd) { - if (pChildWnd->GetWindow()) - { - IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()); - if (pRefDlg) - pRefDlg->ViewShellChanged(); - } if (pChildWnd->GetController()) { IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get()); diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index bb12bbd3dc19..8a083d1be7b9 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -200,13 +200,6 @@ void ScTabViewShell::Activate(bool bMDI) SfxChildWindow* pChildWnd = pThisFrame->GetChildWindow( nModRefDlgId ); if ( pChildWnd ) { - if (pChildWnd->GetWindow()) - { - IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()); - assert(pRefDlg); - if (pRefDlg) - pRefDlg->ViewShellChanged(); - } if (auto pController = pChildWnd->GetController()) { IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pController.get()); diff --git a/sc/source/ui/view/tabvwshd.cxx b/sc/source/ui/view/tabvwshd.cxx index 9a85c4ccac79..45b2c10d7c7e 100644 --- a/sc/source/ui/view/tabvwshd.cxx +++ b/sc/source/ui/view/tabvwshd.cxx @@ -33,7 +33,7 @@ //! parent window for dialogs //! Problem: OLE Server! -vcl::Window* ScTabViewShell::GetDialogParent() +weld::Window* ScTabViewShell::GetDialogParent() { // if a ref-input dialog is open, use it as parent // (necessary when a slot is executed from the dialog's OK handler) @@ -45,9 +45,10 @@ vcl::Window* ScTabViewShell::GetDialogParent() SfxChildWindow* pChild = pViewFrm->GetChildWindow(nCurRefDlgId); if (pChild) { - vcl::Window* pWin = pChild->GetWindow(); - if (pWin && pWin->IsVisible()) - return pWin; + auto xController = pChild->GetController(); + weld::Window* pRet = xController ? xController->getDialog() : nullptr; + if (pRet && pRet->get_visible()) + return pRet; } } } @@ -57,6 +58,24 @@ vcl::Window* ScTabViewShell::GetDialogParent() { // TODO/LATER: how to GetEditWindow in embedded document?! // It should be OK to return the ViewShell Window! + vcl::Window* pWin = GetWindow(); + return pWin ? pWin->GetFrameWeld() : nullptr; + // SvInPlaceEnvironment* pEnv = pDocSh->GetIPEnv(); + // if (pEnv) + // return pEnv->GetEditWin(); + } + + vcl::Window* pWin = GetActiveWin(); // for normal views, too + return pWin ? pWin->GetFrameWeld() : nullptr; +} + +vcl::Window* ScTabViewShell::GetLegacyDialogParent() +{ + ScDocShell* pDocSh = GetViewData().GetDocShell(); + if ( pDocSh->IsOle() ) + { + // TODO/LATER: how to GetEditWindow in embedded document?! + // It should be OK to return the ViewShell Window! return GetWindow(); // SvInPlaceEnvironment* pEnv = pDocSh->GetIPEnv(); // if (pEnv) diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 0d3d52bb353e..d0c5f0e66d2f 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -2669,18 +2669,12 @@ const ScMarkData& ScViewData::GetMarkData() const return *mpMarkData; } -vcl::Window* ScViewData::GetDialogParent() +weld::Window* ScViewData::GetDialogParent() { assert(pViewShell && "GetDialogParent() without ViewShell"); return pViewShell->GetDialogParent(); } -weld::Window* ScViewData::GetFrameWeld() -{ - assert(pViewShell && "GetDialogParent() without ViewShell"); - return pViewShell->GetFrameWeld(); -} - ScGridWindow* ScViewData::GetActiveWin() { assert(pView && "GetActiveWin() without View"); diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index b97b40b95068..f0772bab4aa2 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -1182,7 +1182,7 @@ bool ScViewFunc::MergeCells( bool bApi, bool& rDoContents, bool bCenter ) bool bShowDialog = officecfg::Office::Calc::Compatibility::MergeCells::ShowDialog::get(); if (!bApi && bShowDialog) { - ScMergeCellsDialog aBox(GetViewData().GetFrameWeld()); + ScMergeCellsDialog aBox(GetViewData().GetDialogParent()); sal_uInt16 nRetVal = aBox.run(); if ( nRetVal == RET_OK ) @@ -2134,7 +2134,7 @@ void ScViewFunc::Solve( const ScSolveParam& rParam ) aMsgStr += ScResId( STR_MSSG_SOLVE_4 ); } - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetViewData().GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetViewData().GetDialogParent(), VclMessageType::Question, VclButtonsType::YesNo, aMsgStr)); xBox->set_title(ScResId(STR_MSSG_DOSUBTOTALS_0)); xBox->set_default_response(RET_NO); diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index b2911cabcc9e..89aa916d26ab 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -1062,7 +1062,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, ScWaitCursorOff aWaitOff( GetFrameWin() ); OUString aMessage = ScResId( STR_PASTE_BIGGER ); - std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetViewData().GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetViewData().GetDialogParent(), VclMessageType::Question, VclButtonsType::YesNo, aMessage)); xQueryBox->set_default_response(RET_NO); @@ -1150,7 +1150,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, if ( bAskIfNotEmpty ) { ScRangeList aTestRanges(aUserRange); - if (!checkDestRangeForOverwrite(aTestRanges, pDoc, aFilteredMark, GetViewData().GetFrameWeld())) + if (!checkDestRangeForOverwrite(aTestRanges, pDoc, aFilteredMark, GetViewData().GetDialogParent())) return false; } } @@ -1517,7 +1517,7 @@ bool ScViewFunc::PasteMultiRangesFromClip( if (bAskIfNotEmpty) { ScRangeList aTestRanges(aMarkedRange); - if (!checkDestRangeForOverwrite(aTestRanges, pDoc, aMark, GetViewData().GetFrameWeld())) + if (!checkDestRangeForOverwrite(aTestRanges, pDoc, aMark, GetViewData().GetDialogParent())) return false; } @@ -1679,7 +1679,7 @@ bool ScViewFunc::PasteFromClipToMultiRanges( if (bAskIfNotEmpty) { - if (!checkDestRangeForOverwrite(aRanges, pDoc, aMark, GetViewData().GetFrameWeld())) + if (!checkDestRangeForOverwrite(aRanges, pDoc, aMark, GetViewData().GetDialogParent())) return false; } diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index dbae345879d0..8bb8eb9db4f5 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -398,7 +398,7 @@ void ScViewFunc::DoThesaurus() OUString aErr = SvtLanguageTable::GetLanguageString(eLnge); aErr += ScResId( STR_SPELLING_NO_LANG ); - std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetViewData().GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetViewData().GetDialogParent(), VclMessageType::Info, VclButtonsType::Ok, aErr)); xInfoBox->run(); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index ec73df529d72..40d3dd18b186 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -447,7 +447,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, OUString aMessage( ScResId( SCSTR_FORMULA_AUTOCORRECTION ) ); aMessage += aCorrectedFormula; - std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetViewData().GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetViewData().GetDialogParent(), VclMessageType::Question, VclButtonsType::YesNo, aMessage)); xQueryBox->set_default_response(RET_YES); |