summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2021-03-05 19:53:51 -0400
committerSzymon Kłos <szymon.klos@collabora.com>2021-03-09 11:12:25 +0100
commit91aaa36286208791327aaa28460374942a237dc6 (patch)
tree5516030145f4cf8d864070884390ba69981ade37
parentd7aa69d3b3418f388518a726a44b6433b0586de9 (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>
-rw-r--r--desktop/source/lib/init.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 81b15d4b4fa4..a3ea934e9ebf 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -143,6 +143,7 @@
#include <vcl/IDialogRenderable.hxx>
#include <vcl/dialog.hxx>
#include <unicode/uchar.h>
+#include <unotools/securityoptions.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/confignode.hxx>
#include <unotools/syslocaleoptions.hxx>
@@ -2274,6 +2275,18 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis,
aFilterOptions[1].Name = "InteractionHandler";
aFilterOptions[1].Value <<= xInteraction;
+ int nMacroSecurityLevel = 1;
+ const OUString aMacroSecurityLevel = extractParameter(aOptions, "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, "EnableMacrosExecution");
sal_Int16 nMacroExecMode = aEnableMacrosExecution == "true" ? document::MacroExecMode::USE_CONFIG :
document::MacroExecMode::NEVER_EXECUTE;