summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2021-03-05 19:53:51 -0400
committerHenry Castro <hcastro@collabora.com>2021-04-07 20:04:08 +0200
commit78b53fc86dcf97df9d00828788611527e78d40a6 (patch)
tree3ebd259f08b1ae53197a359a1048322cc8561898 /desktop
parent2736f7693a3099469599a0f9ebb132fe69651649 (diff)
lok: add "MacroSecurityLevel" option
Change-Id: I1cf4e6d4495c552b94c6fe80333291fc4ab20936 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112043 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113691 Tested-by: Jenkins Reviewed-by: Henry Castro <hcastro@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx14
1 files changed, 14 insertions, 0 deletions
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;