desktop/source/lib/init.cxx |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

New commits:
commit 78b53fc86dcf97df9d00828788611527e78d40a6
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Fri Mar 5 19:53:51 2021 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Wed Apr 7 20:04:08 2021 +0200

    lok: add "MacroSecurityLevel" option
    
    Change-Id: I1cf4e6d4495c552b94c6fe80333291fc4ab20936
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112043
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113691
    Tested-by: Jenkins
    Reviewed-by: Henry Castro <hcas...@collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 056a48caa68d..087474487b97 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -137,6 +137,8 @@
 #include <vcl/ITiledRenderable.hxx>
 #include <vcl/dialoghelper.hxx>
 #include <unicode/uchar.h>
+#include <unotools/securityoptions.hxx>
+#include <unotools/configmgr.hxx>
 #include <unotools/confignode.hxx>
 #include <unotools/syslocaleoptions.hxx>
 #include <unotools/mediadescriptor.hxx>
@@ -2265,6 +2267,18 @@ static LibreOfficeKitDocument* 
lo_documentLoadWithOptions(LibreOfficeKit* pThis,
         aFilterOptions[1].Name = "InteractionHandler";
         aFilterOptions[1].Value <<= xInteraction;
 
+        int nMacroSecurityLevel = 1;
+        const OUString aMacroSecurityLevel = extractParameter(aOptions, 
u"MacroSecurityLevel");
+        if (!aMacroSecurityLevel.isEmpty())
+        {
+            double nNumber;
+            sal_uInt32 nFormat = 1;
+            SvNumberFormatter 
aFormatter(::comphelper::getProcessComponentContext(), LANGUAGE_ENGLISH_US);
+            if (aFormatter.IsNumberFormat(aMacroSecurityLevel, nFormat, 
nNumber))
+                nMacroSecurityLevel = static_cast<int>(nNumber);
+        }
+        SvtSecurityOptions().SetMacroSecurityLevel(nMacroSecurityLevel);
+
         const OUString aEnableMacrosExecution = extractParameter(aOptions, 
u"EnableMacrosExecution");
         sal_Int16 nMacroExecMode = aEnableMacrosExecution == "true" ? 
document::MacroExecMode::USE_CONFIG :
             document::MacroExecMode::NEVER_EXECUTE;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to