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 /sc/source/ui/docshell | |
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>
Diffstat (limited to 'sc/source/ui/docshell')
-rw-r--r-- | sc/source/ui/docshell/dbdocfun.cxx | 32 | ||||
-rw-r--r-- | sc/source/ui/docshell/dbdocimp.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 36 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 37 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh3.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 55 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh5.cxx | 21 | ||||
-rw-r--r-- | sc/source/ui/docshell/externalrefmgr.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 3 |
9 files changed, 88 insertions, 122 deletions
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; |