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@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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>
|
||||
|
@@ -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& );
|
||||
|
@@ -838,7 +838,7 @@ IMPL_LINK_NOARG(SfxDocumentPage, SignatureHdl, Button*, void)
|
||||
SfxObjectShell* pDoc = SfxObjectShell::Current();
|
||||
if( pDoc )
|
||||
{
|
||||
pDoc->SignDocumentContent();
|
||||
pDoc->SignDocumentContent(GetFrameWeld());
|
||||
|
||||
ImplUpdateSignatures();
|
||||
}
|
||||
|
@@ -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))
|
||||
|
Reference in New Issue
Block a user