[Libreoffice-commits] core.git: basctl/source cui/source include/sfx2 sfx2/source

Caolán McNamara caolanm at redhat.com
Mon Jun 18 11:59:29 UTC 2018


 basctl/source/basicide/baside2.cxx             |    2 +-
 basctl/source/basicide/docsignature.cxx        |    4 ++--
 basctl/source/inc/docsignature.hxx             |    4 ++--
 cui/source/dialogs/SignSignatureLineDialog.cxx |    4 ++--
 include/sfx2/objsh.hxx                         |    8 ++++----
 sfx2/source/dialog/dinfdlg.cxx                 |    2 +-
 sfx2/source/doc/objserv.cxx                    |   25 +++++++++++++------------
 7 files changed, 25 insertions(+), 24 deletions(-)

New commits:
commit 4b5765200776574e6a2a61fe6384f00b89d02bcc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jun 18 10:39:35 2018 +0100

    set explicit parent for signing warning messages
    
    Change-Id: Ifbd1aaec13e2f3a51963c4942face64847eefc07
    Reviewed-on: https://gerrit.libreoffice.org/55989
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 217075194460..5ac20f04c0a6 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -1033,7 +1033,7 @@ void ModulWindow::ExecuteGlobal (SfxRequest& rReq)
             DocumentSignature aSignature(m_aDocument);
             if (aSignature.supportsSignatures())
             {
-                aSignature.signScriptingContent();
+                aSignature.signScriptingContent(rReq.GetFrameWeld());
                 if (SfxBindings* pBindings = GetBindingsPtr())
                     pBindings->Invalidate(SID_SIGNATURE);
             }
diff --git a/basctl/source/basicide/docsignature.cxx b/basctl/source/basicide/docsignature.cxx
index 3bb0f1ae9a18..251e0eb06508 100644
--- a/basctl/source/basicide/docsignature.cxx
+++ b/basctl/source/basicide/docsignature.cxx
@@ -69,11 +69,11 @@ namespace basctl
         return ( m_pImpl->pShell != nullptr );
     }
 
-    void DocumentSignature::signScriptingContent() const
+    void DocumentSignature::signScriptingContent(weld::Window* pDialogParent) const
     {
         OSL_PRECOND( supportsSignatures(), "DocumentSignature::signScriptingContent: signatures not supported by this document!" );
         if ( m_pImpl->pShell )
-            m_pImpl->pShell->SignScriptingContent();
+            m_pImpl->pShell->SignScriptingContent(pDialogParent);
     }
 
     SignatureState DocumentSignature::getScriptingSignatureState() const
diff --git a/basctl/source/inc/docsignature.hxx b/basctl/source/inc/docsignature.hxx
index 5fd07704d691..d2d6698f810e 100644
--- a/basctl/source/inc/docsignature.hxx
+++ b/basctl/source/inc/docsignature.hxx
@@ -20,9 +20,9 @@
 #define INCLUDED_BASCTL_SOURCE_INC_DOCSIGNATURE_HXX
 
 #include <sfx2/signaturestate.hxx>
+#include <vcl/weld.hxx>
 #include <memory>
 
-
 namespace basctl
 {
 
@@ -53,7 +53,7 @@ namespace basctl
             @precond
                 isValid returns <TRUE/>
         */
-        void        signScriptingContent() const;
+        void        signScriptingContent(weld::Window* pDialogParent) const;
 
         /** retrieves the state of the signature of the scripting content inside the document
 
diff --git a/cui/source/dialogs/SignSignatureLineDialog.cxx b/cui/source/dialogs/SignSignatureLineDialog.cxx
index fa7df5861b71..6566d6f66f41 100644
--- a/cui/source/dialogs/SignSignatureLineDialog.cxx
+++ b/cui/source/dialogs/SignSignatureLineDialog.cxx
@@ -146,8 +146,8 @@ void SignSignatureLineDialog::Apply()
     SfxObjectShell* pShell = SfxObjectShell::Current();
     Reference<XGraphic> xValidGraphic = getSignedGraphic(true);
     Reference<XGraphic> xInvalidGraphic = getSignedGraphic(false);
-    pShell->SignSignatureLine(m_aSignatureLineId, m_xSelectedCertifate, xValidGraphic,
-                              xInvalidGraphic, m_xEditComment->get_text());
+    pShell->SignSignatureLine(m_xDialog.get(), m_aSignatureLineId, m_xSelectedCertifate,
+                              xValidGraphic, xInvalidGraphic, m_xEditComment->get_text());
 }
 
 const css::uno::Reference<css::graphic::XGraphic>
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index ad56de0173ca..d04758567c80 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -355,19 +355,19 @@ public:
     bool                        ExportTo( SfxMedium &rMedium );
 
     /** Returns to if preparing was succesful, else false. */
-    bool PrepareForSigning();
+    bool PrepareForSigning(weld::Window* pDialogParent);
     bool CheckIsReadonly(bool bSignScriptingContent);
     void AfterSigning(bool bSignSuccess, bool bSignScriptingContent);
     bool HasValidSignatures();
     SignatureState              GetDocumentSignatureState();
-    void                        SignDocumentContent();
-    void SignSignatureLine(const OUString& aSignatureLineId,
+    void                        SignDocumentContent(weld::Window* pDialogParent);
+    void SignSignatureLine(weld::Window* pDialogParent, const OUString& aSignatureLineId,
                            const css::uno::Reference<css::security::XCertificate> xCert,
                            const css::uno::Reference<css::graphic::XGraphic> xValidGraphic,
                            const css::uno::Reference<css::graphic::XGraphic> xInvalidGraphic,
                            const OUString& aComment);
     SignatureState              GetScriptingSignatureState();
-    void                        SignScriptingContent();
+    void                        SignScriptingContent(weld::Window* pDialogParent);
     DECL_LINK(SignDocumentHandler, Button*, void);
 
     virtual VclPtr<SfxDocumentInfoDialog> CreateDocumentInfoDialog( const SfxItemSet& );
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index a2bacfe4e008..ba621833781e 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -838,7 +838,7 @@ IMPL_LINK_NOARG(SfxDocumentPage, SignatureHdl, Button*, void)
     SfxObjectShell* pDoc = SfxObjectShell::Current();
     if( pDoc )
     {
-        pDoc->SignDocumentContent();
+        pDoc->SignDocumentContent(GetFrameWeld());
 
         ImplUpdateSignatures();
     }
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 29a398c92f8c..ea9103c3804e 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -396,7 +396,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
     if( SID_SIGNATURE == nId || SID_MACRO_SIGNATURE == nId )
     {
         if ( QueryHiddenInformation( HiddenWarningFact::WhenSigning, nullptr ) == RET_YES )
-            ( SID_SIGNATURE == nId ) ? SignDocumentContent() : SignScriptingContent();
+            ( SID_SIGNATURE == nId ) ? SignDocumentContent(rReq.GetFrameWeld()) : SignScriptingContent(rReq.GetFrameWeld());
         return;
     }
 
@@ -1363,7 +1363,7 @@ SignatureState SfxObjectShell::ImplGetSignatureState( bool bScriptingContent )
     return *pState;
 }
 
-bool SfxObjectShell::PrepareForSigning()
+bool SfxObjectShell::PrepareForSigning(weld::Window* pDialogParent)
 {
     // Check if it is stored in OASIS format...
     if  (   GetMedium()
@@ -1375,7 +1375,7 @@ bool SfxObjectShell::PrepareForSigning()
         )
     {
         // Only OASIS and OOo6.x formats will be handled further
-        std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
+        std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pDialogParent,
                                                   VclMessageType::Info, VclButtonsType::Ok, SfxResId(STR_INFO_WRONGDOCFORMAT)));
 
         xBox->run();
@@ -1411,7 +1411,7 @@ bool SfxObjectShell::PrepareForSigning()
         if ( nVersion >= SvtSaveOptions::ODFVER_012 )
         {
             OUString sQuestion(bHasSign ? SfxResId(STR_XMLSEC_QUERY_SAVESIGNEDBEFORESIGN) : SfxResId(RID_SVXSTR_XMLSEC_QUERY_SAVEBEFORESIGN));
-            std::unique_ptr<weld::MessageDialog> xQuestion(Application::CreateMessageDialog(nullptr,
+            std::unique_ptr<weld::MessageDialog> xQuestion(Application::CreateMessageDialog(pDialogParent,
                                                            VclMessageType::Question, VclButtonsType::YesNo, sQuestion));
 
 
@@ -1431,7 +1431,7 @@ bool SfxObjectShell::PrepareForSigning()
                     || SotStorage::GetVersion( GetMedium()->GetStorage() ) <= SOFFICE_FILEFORMAT_60 ) )
                 {
                     // Only OASIS format will be handled further
-                    std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
+                    std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pDialogParent,
                                                               VclMessageType::Info, VclButtonsType::Ok, SfxResId(STR_INFO_WRONGDOCFORMAT)));
                     xBox->run();
                     return false;
@@ -1448,7 +1448,7 @@ bool SfxObjectShell::PrepareForSigning()
         }
         else
         {
-            std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
+            std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pDialogParent,
                                                       VclMessageType::Warning, VclButtonsType::Ok, SfxResId(STR_XMLSEC_ODF12_EXPECTED)));
             xBox->run();
             return false;
@@ -1549,9 +1549,9 @@ SignatureState SfxObjectShell::GetDocumentSignatureState()
     return ImplGetSignatureState();
 }
 
-void SfxObjectShell::SignDocumentContent()
+void SfxObjectShell::SignDocumentContent(weld::Window* pDialogParent)
 {
-    if (!PrepareForSigning())
+    if (!PrepareForSigning(pDialogParent))
         return;
 
     if (CheckIsReadonly(false))
@@ -1562,13 +1562,14 @@ void SfxObjectShell::SignDocumentContent()
     AfterSigning(bSignSuccess, false);
 }
 
-void SfxObjectShell::SignSignatureLine(const OUString& aSignatureLineId,
+void SfxObjectShell::SignSignatureLine(weld::Window* pDialogParent,
+                                       const OUString& aSignatureLineId,
                                        const Reference<XCertificate> xCert,
                                        const Reference<XGraphic> xValidGraphic,
                                        const Reference<XGraphic> xInvalidGraphic,
                                        const OUString& aComment)
 {
-    if (!PrepareForSigning())
+    if (!PrepareForSigning(pDialogParent))
         return;
 
     if (CheckIsReadonly(false))
@@ -1585,9 +1586,9 @@ SignatureState SfxObjectShell::GetScriptingSignatureState()
     return ImplGetSignatureState( true );
 }
 
-void SfxObjectShell::SignScriptingContent()
+void SfxObjectShell::SignScriptingContent(weld::Window* pDialogParent)
 {
-    if (!PrepareForSigning())
+    if (!PrepareForSigning(pDialogParent))
         return;
 
     if (CheckIsReadonly(true))


More information about the Libreoffice-commits mailing list