sfx2/source/doc/objserv.cxx |   17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 7cb471e32c9b9db960bb3671c592dcd3292e4e52
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Jan 8 17:11:50 2019 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Jan 10 09:52:06 2019 +0100

    Resolves: tdf#122308 ensure parent for message dialog
    
    Change-Id: Ie7e97d3beedfa007243e4a6b7408341857f2d903
    Reviewed-on: https://gerrit.libreoffice.org/65981
    Tested-by: Jenkins
    Tested-by: Xisco Faulí <xiscofa...@libreoffice.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index f69afb5e059e..6e0ce218e286 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -391,13 +391,22 @@ uno::Sequence< document::CmisVersion > 
SfxObjectShell::GetCmisVersions( )
 
 void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
 {
+    weld::Window* pDialogParent = rReq.GetFrameWeld();
+    if (!pDialogParent)
+    {
+        SfxViewFrame* pFrame = GetFrame();
+        if (!pFrame)
+            pFrame = SfxViewFrame::GetFirst(this);
+        if (pFrame)
+            pDialogParent = pFrame->GetWindow().GetFrameWeld();
+    }
 
     sal_uInt16 nId = rReq.GetSlot();
 
     if( SID_SIGNATURE == nId || SID_MACRO_SIGNATURE == nId )
     {
         if ( QueryHiddenInformation( HiddenWarningFact::WhenSigning, nullptr ) 
== RET_YES )
-            ( SID_SIGNATURE == nId ) ? 
SignDocumentContent(rReq.GetFrameWeld()) : 
SignScriptingContent(rReq.GetFrameWeld());
+            ( SID_SIGNATURE == nId ) ? SignDocumentContent(pDialogParent) : 
SignScriptingContent(pDialogParent);
         return;
     }
 
@@ -712,7 +721,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
             if ( lErr != ERRCODE_IO_ABORT )
             {
                 SfxErrorContext aEc(ERRCTX_SFX_SAVEASDOC,GetTitle());
-                ErrorHandler::HandleError(lErr, rReq.GetFrameWeld());
+                ErrorHandler::HandleError(lErr, pDialogParent);
             }
 
             if ( nId == SID_EXPORTDOCASPDF )
@@ -801,7 +810,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
 
             SetModified( false );
             ErrCode lErr = GetErrorCode();
-            ErrorHandler::HandleError(lErr, rReq.GetFrameWeld());
+            ErrorHandler::HandleError(lErr, pDialogParent);
 
             rReq.SetReturnValue( SfxBoolItem(0, true) );
             rReq.Done();
@@ -814,7 +823,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
         case SID_DOCTEMPLATE:
         {
             // save as document templates
-            SfxSaveAsTemplateDialog aDlg(rReq.GetFrameWeld(), GetModel());
+            SfxSaveAsTemplateDialog aDlg(pDialogParent, GetModel());
             (void)aDlg.run();
             break;
         }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to