summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2023-01-30 09:35:46 +0100
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2023-01-30 12:26:07 +0000
commit829f898f0076082c039494bc0fffe00e2dd4ac26 (patch)
tree7b8bee5163285b6aa2493dfd096bf6260b26679a /sfx2
parentf589d7e769bee4b82826a944fed3cf2382d84fb2 (diff)
Show infobar instead of dialog when unsigned content is found
Follow up to f41627ab60372345be646c53d967b65be43b562f Change-Id: I67dadad0fe69e29199c5bc160af1a46cc8aafac2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146338 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/docmacromode.cxx30
-rw-r--r--sfx2/source/view/viewfrm.cxx6
2 files changed, 13 insertions, 23 deletions
diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx
index bf17a0497a5d..db527ef3a036 100644
--- a/sfx2/source/doc/docmacromode.cxx
+++ b/sfx2/source/doc/docmacromode.cxx
@@ -74,38 +74,19 @@ namespace sfx2
IMacroDocumentAccess& m_rDocumentAccess;
bool m_bMacroDisabledMessageShown;
bool m_bDocMacroDisabledMessageShown;
+ bool m_bHasUnsignedContentError;
explicit DocumentMacroMode_Data( IMacroDocumentAccess& rDocumentAccess )
:m_rDocumentAccess( rDocumentAccess )
,m_bMacroDisabledMessageShown( false )
,m_bDocMacroDisabledMessageShown( false )
+ ,m_bHasUnsignedContentError( false )
{
}
};
-
- //= helper
-
namespace
{
-
- void lcl_showGeneralSfxErrorOnce( const Reference< XInteractionHandler >& rxHandler, ErrCode nSfxErrorCode, bool& rbAlreadyShown )
- {
- if ( rbAlreadyShown )
- return;
-
- ErrorCodeRequest aErrorCodeRequest;
- aErrorCodeRequest.ErrCode = sal_uInt32(nSfxErrorCode);
-
- SfxMedium::CallApproveHandler( rxHandler, Any( aErrorCodeRequest ), false );
- rbAlreadyShown = true;
- }
-
- void lcl_showMacrosDisabledUnsignedContentError( const Reference< XInteractionHandler >& rxHandler, bool& rbAlreadyShown )
- {
- lcl_showGeneralSfxErrorOnce( rxHandler, ERRCODE_SFX_DOCUMENT_MACRO_DISABLED_CONTENT_UNSIGNED, rbAlreadyShown );
- }
-
bool lcl_showMacroWarning( const Reference< XInteractionHandler >& rxHandler,
const OUString& rDocumentLocation )
{
@@ -231,7 +212,7 @@ namespace sfx2
!bHasValidContentSignature)
{
// When macros are signed, and the document has events which call macros, the document content needs to be signed too.
- lcl_showMacrosDisabledUnsignedContentError(rxInteraction, m_xData->m_bDocMacroDisabledMessageShown);
+ m_xData->m_bHasUnsignedContentError = true;
return disallowMacroExecution();
}
else if ( bHasTrustedMacroSignature )
@@ -407,6 +388,11 @@ namespace sfx2
return bHasMacroLib;
}
+ bool DocumentMacroMode::hasUnsignedContentError() const
+ {
+ return m_xData->m_bHasUnsignedContentError;
+ }
+
bool DocumentMacroMode::storageHasMacros( const Reference< XStorage >& rxStorage )
{
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index e8429ecf7721..1e4df24f60b9 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1326,7 +1326,11 @@ void SfxViewFrame::AppendContainsMacrosInfobar()
if (bHasDocumentMacros || bHasBoundConfigEvents)
{
- auto aResId = SvtSecurityOptions::IsMacroDisabled() ? STR_MACROS_DISABLED : STR_CONTAINS_MACROS;
+ auto aResId = STR_MACROS_DISABLED;
+ if (SvtSecurityOptions::IsMacroDisabled())
+ aResId = STR_CONTAINS_MACROS;
+ else if (pObjImpl->aMacroMode.hasUnsignedContentError())
+ aResId = STR_MACROS_DISABLED_CONTENT_UNSIGNED;
auto pInfoBar = AppendInfoBar("macro", SfxResId(RID_SECURITY_WARNING_TITLE),
SfxResId(aResId), InfobarType::WARNING);
if (!pInfoBar)