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

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Fri Dec 13 10:27:50 UTC 2019


 sfx2/source/doc/docmacromode.cxx |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 0b5fea74963d499be5d59acee29ba89137f9f0cd
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Wed Dec 11 11:51:45 2019 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Dec 13 11:27:06 2019 +0100

    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 at fbihome.de>

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 )


More information about the Libreoffice-commits mailing list