diff options
author | Jan-Marek Glogowski <jan-marek.glogowski@extern.cib.de> | 2019-12-11 11:51:45 +0100 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-12-13 11:27:06 +0100 |
commit | 0b5fea74963d499be5d59acee29ba89137f9f0cd (patch) | |
tree | 931a229ec8c7d9e85776fcff93d71de153d60df1 /sfx2 | |
parent | 04a28f1c3c657338fefd61ea926357d3fad23325 (diff) |
Correctly set the macro security auto confirm mode
The code of adjustMacroMode() has one major problem: (almost)
everything is handled by the single nMacroExecutionMode variable,
which is even changed based on its initial setting.
I don't know if this fixed functionality breaks something, but it
doesn't look like it, as the enum AutoConfirmation is just used
and defined locally.
Change-Id: Iac305e9ec0020a11fd53b4bb87cc782686a247ac
Reviewed-on: https://gerrit.libreoffice.org/85055
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/docmacromode.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx index 13954b06f6d8..ef5123a2c39d 100644 --- a/sfx2/source/doc/docmacromode.cxx +++ b/sfx2/source/doc/docmacromode.cxx @@ -166,6 +166,12 @@ namespace sfx2 || ( nMacroExecutionMode == MacroExecMode::USE_CONFIG_APPROVE_CONFIRMATION ) ) { + // check confirm first, as nMacroExecutionMode is always overwritten by the GetMacroSecurityLevel() switch + if (nMacroExecutionMode == MacroExecMode::USE_CONFIG_REJECT_CONFIRMATION) + eAutoConfirm = eAutoConfirmReject; + else if (nMacroExecutionMode == MacroExecMode::USE_CONFIG_APPROVE_CONFIRMATION) + eAutoConfirm = eAutoConfirmApprove; + SvtSecurityOptions aOpt; switch ( aOpt.GetMacroSecurityLevel() ) { @@ -185,11 +191,6 @@ namespace sfx2 OSL_FAIL( "DocumentMacroMode::adjustMacroMode: unexpected macro security level!" ); nMacroExecutionMode = MacroExecMode::NEVER_EXECUTE; } - - if ( nMacroExecutionMode == MacroExecMode::USE_CONFIG_REJECT_CONFIRMATION ) - eAutoConfirm = eAutoConfirmReject; - else if ( nMacroExecutionMode == MacroExecMode::USE_CONFIG_APPROVE_CONFIRMATION ) - eAutoConfirm = eAutoConfirmApprove; } if ( nMacroExecutionMode == MacroExecMode::NEVER_EXECUTE ) |