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,17 +1042,32 @@ bool LoadEnv::impl_loadContent()
bool bHidden = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_HIDDEN(), false);
bool bMinimized = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_MINIMIZED(), 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)
{
// Note: it's an optional interface!
css::uno::Reference< css::task::XStatusIndicatorFactory > xProgressFactory(xTargetFrame, css::uno::UNO_QUERY);
if (xProgressFactory.is())
css::uno::Reference< css::task::XStatusIndicator > xProgress = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_STATUSINDICATOR(), css::uno::Reference< css::task::XStatusIndicator >());
if (!xProgress.is())
{
xProgress = xProgressFactory->createStatusIndicator();
if (xProgress.is())
m_lMediaDescriptor[utl::MediaDescriptor::PROP_STATUSINDICATOR()] <<= xProgress;
// Note: it's an optional interface!
css::uno::Reference< css::task::XStatusIndicatorFactory > xProgressFactory(xTargetFrame, css::uno::UNO_QUERY);
if (xProgressFactory.is())
{
xProgress = xProgressFactory->createStatusIndicator();
if (xProgress.is())
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;
}
}
}
......
......@@ -125,11 +125,12 @@ public:
4. Default ButtonsOk, MessageError
@param nErrCodeId error id
@param pParent parent window the error dialog will be modal for. nullptr for unrecommended "pick default"
@param nFlags error flags.
@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);
protected:
......
......@@ -189,7 +189,7 @@ bool SwFEShell::InsertRow( sal_uInt16 nCnt, bool bBehind )
if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
{
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR,
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
return false;
}
......@@ -230,7 +230,7 @@ bool SwFEShell::InsertCol( sal_uInt16 nCnt, bool bBehind )
if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
{
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR,
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
return false;
}
......@@ -239,7 +239,7 @@ bool SwFEShell::InsertCol( sal_uInt16 nCnt, bool bBehind )
if( !CheckSplitCells( *this, nCnt + 1, SwTableSearchType::Col ) )
{
ErrorHandler::HandleError( ERR_TBLINSCOL_ERROR,
ErrorHandler::HandleError( ERR_TBLINSCOL_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
return false;
}
......@@ -285,7 +285,7 @@ bool SwFEShell::DeleteCol()
if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
{
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR,
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
return false;
}
......@@ -336,7 +336,7 @@ bool SwFEShell::DeleteRow(bool bCompleteTable)
if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
{
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR,
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
return false;
}
......@@ -455,7 +455,7 @@ TableMergeErr SwFEShell::MergeTab()
const SwTableNode* pTableNd = pTableCursor->GetNode().FindTableNode();
if( dynamic_cast< const SwDDETable* >(&pTableNd->GetTable()) != nullptr )
{
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR,
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
}
else
......@@ -486,7 +486,7 @@ bool SwFEShell::SplitTab( bool bVert, sal_uInt16 nCnt, bool bSameHeight )
if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
{
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR,
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
return false;
}
......@@ -495,7 +495,7 @@ bool SwFEShell::SplitTab( bool bVert, sal_uInt16 nCnt, bool bSameHeight )
if( bVert && !CheckSplitCells( *this, nCnt + 1 ) )
{
ErrorHandler::HandleError( ERR_TBLSPLIT_ERROR,
ErrorHandler::HandleError( ERR_TBLSPLIT_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
return false;
}
......@@ -1295,7 +1295,7 @@ bool SwFEShell::DeleteTableSel()
if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
{
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR,
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
return false;
}
......@@ -2161,7 +2161,7 @@ bool SwFEShell::SetColRowWidthHeight( TableChgWidthHeightType eType, sal_uInt16
if( (TableChgWidthHeightType::InsertDeleteMode & eType) &&
dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
{
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR,
ErrorHandler::HandleError( ERR_TBLDDECHG_ERROR, GetWin(),
DialogMask::MessageInfo | DialogMask::ButtonDefaultsOk );
return false;
}
......
......@@ -1111,7 +1111,7 @@ UUIInteractionHelper::handleGenericErrorRequest(
executeMessageBox(getParentProperty(), aTitle, aErrorString, MessBoxStyle::Ok);
}
else
ErrorHandler::HandleError(nErrorCode);
ErrorHandler::HandleError(nErrorCode, getParentProperty());
if (xApprove.is() && bWarning)
xApprove->select();
......
......@@ -108,13 +108,12 @@ bool ErrorHandler::GetErrorString(ErrCode nErrCodeId, OUString& rErrStr)
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)
return DialogMask::NONE;
ErrorRegistry &rData = TheErrorRegistry::get();
vcl::Window *pParent = nullptr;
ErrorInfo *pInfo = ErrorInfo::GetErrorInfo(nErrCodeId);
OUString aAction;
......@@ -126,7 +125,7 @@ DialogMask ErrorHandler::HandleError(ErrCode nErrCodeId, DialogMask nFlags)
{
if(pCtx->GetParent())
{
pParent=pCtx->GetParent();
pParent = pCtx->GetParent();
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