Kaydet (Commit) 0a09ca61 authored tarafından Caolán McNamara's avatar Caolán McNamara

Related: tdf#113160 set parent of warning dialogs during load

to the new window frame being constructed that (may) contain
the progress bar, that way such modal dialogs affect the loading
document window and not whatever window happens to be active

Change-Id: I1c7d3185e47fa316eef003b80d18b31d341b79d6
Reviewed-on: https://gerrit.libreoffice.org/44269Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 26211f04
...@@ -1042,9 +1042,11 @@ bool LoadEnv::impl_loadContent() ...@@ -1042,9 +1042,11 @@ bool LoadEnv::impl_loadContent()
bool bHidden = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_HIDDEN(), false); bool bHidden = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_HIDDEN(), false);
bool bMinimized = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_MINIMIZED(), false); bool bMinimized = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_MINIMIZED(), false);
bool bPreview = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_PREVIEW(), false); bool bPreview = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_PREVIEW(), false);
css::uno::Reference< css::task::XStatusIndicator > xProgress = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_STATUSINDICATOR(), css::uno::Reference< css::task::XStatusIndicator >());
if (!bHidden && !bMinimized && !bPreview && !xProgress.is()) if (!bHidden && !bMinimized && !bPreview)
{
css::uno::Reference< css::task::XStatusIndicator > xProgress = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_STATUSINDICATOR(), css::uno::Reference< css::task::XStatusIndicator >());
if (!xProgress.is())
{ {
// Note: it's an optional interface! // Note: it's an optional interface!
css::uno::Reference< css::task::XStatusIndicatorFactory > xProgressFactory(xTargetFrame, css::uno::UNO_QUERY); css::uno::Reference< css::task::XStatusIndicatorFactory > xProgressFactory(xTargetFrame, css::uno::UNO_QUERY);
...@@ -1055,6 +1057,19 @@ bool LoadEnv::impl_loadContent() ...@@ -1055,6 +1057,19 @@ bool LoadEnv::impl_loadContent()
m_lMediaDescriptor[utl::MediaDescriptor::PROP_STATUSINDICATOR()] <<= xProgress; m_lMediaDescriptor[utl::MediaDescriptor::PROP_STATUSINDICATOR()] <<= xProgress;
} }
} }
if (!comphelper::LibreOfficeKit::isActive())
{
//now that we have a window, set things up so that warnings dialogs are relative to that window
css::uno::Reference<css::task::XInteractionHandler> xInteractionHandler(
task::InteractionHandler::createWithParent(m_xContext, xTargetFrame->getContainerWindow()),
css::uno::UNO_QUERY);
if (xInteractionHandler.is())
{
m_lMediaDescriptor[utl::MediaDescriptor::PROP_INTERACTIONHANDLER()] <<= xInteractionHandler;
m_lMediaDescriptor[utl::MediaDescriptor::PROP_AUTHENTICATIONHANDLER()] <<= xInteractionHandler;
}
}
}
// convert media descriptor and URL to right format for later interface call! // convert media descriptor and URL to right format for later interface call!
css::uno::Sequence< css::beans::PropertyValue > lDescriptor; css::uno::Sequence< css::beans::PropertyValue > lDescriptor;
......
...@@ -125,11 +125,12 @@ public: ...@@ -125,11 +125,12 @@ public:
4. Default ButtonsOk, MessageError 4. Default ButtonsOk, MessageError
@param nErrCodeId error id @param nErrCodeId error id
@param pParent parent window the error dialog will be modal for. nullptr for unrecommended "pick default"
@param nFlags error flags. @param nFlags error flags.
@return what sort of dialog to use, with what buttons @return what sort of dialog to use, with what buttons
*/ */
static DialogMask HandleError(ErrCode nId, DialogMask nMask = DialogMask::MAX); static DialogMask HandleError(ErrCode nId, vcl::Window* pParent = nullptr, DialogMask nMask = DialogMask::MAX);
static bool GetErrorString(ErrCode nId, OUString& rStr); static bool GetErrorString(ErrCode nId, OUString& rStr);
protected: protected:
......
...@@ -189,7 +189,7 @@ bool SwFEShell::InsertRow( sal_uInt16 nCnt, bool bBehind ) ...@@ -189,7 +189,7 @@ bool SwFEShell::InsertRow( sal_uInt16 nCnt, bool bBehind )
if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr ) if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
{ {
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk ); DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
return false; return false;
} }
...@@ -230,7 +230,7 @@ bool SwFEShell::InsertCol( sal_uInt16 nCnt, bool bBehind ) ...@@ -230,7 +230,7 @@ bool SwFEShell::InsertCol( sal_uInt16 nCnt, bool bBehind )
if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr ) if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
{ {
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk ); DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
return false; return false;
} }
...@@ -239,7 +239,7 @@ bool SwFEShell::InsertCol( sal_uInt16 nCnt, bool bBehind ) ...@@ -239,7 +239,7 @@ bool SwFEShell::InsertCol( sal_uInt16 nCnt, bool bBehind )
if( !CheckSplitCells( *this, nCnt + 1, SwTableSearchType::Col ) ) if( !CheckSplitCells( *this, nCnt + 1, SwTableSearchType::Col ) )
{ {
ErrorHandler::HandleError( ERR_TBLINSCOL_ERROR, ErrorHandler::HandleError( ERR_TBLINSCOL_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk ); DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
return false; return false;
} }
...@@ -285,7 +285,7 @@ bool SwFEShell::DeleteCol() ...@@ -285,7 +285,7 @@ bool SwFEShell::DeleteCol()
if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr ) if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
{ {
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk ); DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
return false; return false;
} }
...@@ -336,7 +336,7 @@ bool SwFEShell::DeleteRow(bool bCompleteTable) ...@@ -336,7 +336,7 @@ bool SwFEShell::DeleteRow(bool bCompleteTable)
if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr ) if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
{ {
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk ); DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
return false; return false;
} }
...@@ -455,7 +455,7 @@ TableMergeErr SwFEShell::MergeTab() ...@@ -455,7 +455,7 @@ TableMergeErr SwFEShell::MergeTab()
const SwTableNode* pTableNd = pTableCursor->GetNode().FindTableNode(); const SwTableNode* pTableNd = pTableCursor->GetNode().FindTableNode();
if( dynamic_cast< const SwDDETable* >(&pTableNd->GetTable()) != nullptr ) if( dynamic_cast< const SwDDETable* >(&pTableNd->GetTable()) != nullptr )
{ {
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk ); DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
} }
else else
...@@ -486,7 +486,7 @@ bool SwFEShell::SplitTab( bool bVert, sal_uInt16 nCnt, bool bSameHeight ) ...@@ -486,7 +486,7 @@ bool SwFEShell::SplitTab( bool bVert, sal_uInt16 nCnt, bool bSameHeight )
if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr ) if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
{ {
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk ); DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
return false; return false;
} }
...@@ -495,7 +495,7 @@ bool SwFEShell::SplitTab( bool bVert, sal_uInt16 nCnt, bool bSameHeight ) ...@@ -495,7 +495,7 @@ bool SwFEShell::SplitTab( bool bVert, sal_uInt16 nCnt, bool bSameHeight )
if( bVert && !CheckSplitCells( *this, nCnt + 1 ) ) if( bVert && !CheckSplitCells( *this, nCnt + 1 ) )
{ {
ErrorHandler::HandleError( ERR_TBLSPLIT_ERROR, ErrorHandler::HandleError( ERR_TBLSPLIT_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk ); DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
return false; return false;
} }
...@@ -1295,7 +1295,7 @@ bool SwFEShell::DeleteTableSel() ...@@ -1295,7 +1295,7 @@ bool SwFEShell::DeleteTableSel()
if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr ) if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
{ {
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk ); DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
return false; return false;
} }
...@@ -2161,7 +2161,7 @@ bool SwFEShell::SetColRowWidthHeight( TableChgWidthHeightType eType, sal_uInt16 ...@@ -2161,7 +2161,7 @@ bool SwFEShell::SetColRowWidthHeight( TableChgWidthHeightType eType, sal_uInt16
if( (TableChgWidthHeightType::InsertDeleteMode & eType) && if( (TableChgWidthHeightType::InsertDeleteMode & eType) &&
dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr ) dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
{ {
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk ); DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
return false; return false;
} }
......
...@@ -1111,7 +1111,7 @@ UUIInteractionHelper::handleGenericErrorRequest( ...@@ -1111,7 +1111,7 @@ UUIInteractionHelper::handleGenericErrorRequest(
executeMessageBox(getParentProperty(), aTitle, aErrorString, MessBoxStyle::Ok); executeMessageBox(getParentProperty(), aTitle, aErrorString, MessBoxStyle::Ok);
} }
else else
ErrorHandler::HandleError(nErrorCode); ErrorHandler::HandleError(nErrorCode, getParentProperty());
if (xApprove.is() && bWarning) if (xApprove.is() && bWarning)
xApprove->select(); xApprove->select();
......
...@@ -108,13 +108,12 @@ bool ErrorHandler::GetErrorString(ErrCode nErrCodeId, OUString& rErrStr) ...@@ -108,13 +108,12 @@ bool ErrorHandler::GetErrorString(ErrCode nErrCodeId, OUString& rErrStr)
return false; return false;
} }
DialogMask ErrorHandler::HandleError(ErrCode nErrCodeId, DialogMask nFlags) DialogMask ErrorHandler::HandleError(ErrCode nErrCodeId, vcl::Window *pParent, DialogMask nFlags)
{ {
if (nErrCodeId == ERRCODE_NONE || nErrCodeId == ERRCODE_ABORT) if (nErrCodeId == ERRCODE_NONE || nErrCodeId == ERRCODE_ABORT)
return DialogMask::NONE; return DialogMask::NONE;
ErrorRegistry &rData = TheErrorRegistry::get(); ErrorRegistry &rData = TheErrorRegistry::get();
vcl::Window *pParent = nullptr;
ErrorInfo *pInfo = ErrorInfo::GetErrorInfo(nErrCodeId); ErrorInfo *pInfo = ErrorInfo::GetErrorInfo(nErrCodeId);
OUString aAction; OUString aAction;
...@@ -126,7 +125,7 @@ DialogMask ErrorHandler::HandleError(ErrCode nErrCodeId, DialogMask nFlags) ...@@ -126,7 +125,7 @@ DialogMask ErrorHandler::HandleError(ErrCode nErrCodeId, DialogMask nFlags)
{ {
if(pCtx->GetParent()) if(pCtx->GetParent())
{ {
pParent=pCtx->GetParent(); pParent = pCtx->GetParent();
break; break;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment