tdf#158375: add UI option to disable active content
Adds a checkbox to disable active contents and OLE Automation at
Options - LibreOffice - Security - Security Options and Warnings
Change-Id: Idfac86e31c97f186eb6b6b2a7a7236b84aedbe83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161808
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 083c3e4..de34b03 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -906,6 +906,7 @@ bool SvxSecurityTabPage::FillItemSet( SfxItemSet* )
CheckAndSave( SvtSecurityOptions::EOption::DocWarnRecommendPassword, m_xSecOptDlg->IsRecommPasswdChecked(), bModified );
CheckAndSave( SvtSecurityOptions::EOption::CtrlClickHyperlink, m_xSecOptDlg->IsCtrlHyperlinkChecked(), bModified );
CheckAndSave( SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, m_xSecOptDlg->IsBlockUntrustedRefererLinksChecked(), bModified );
CheckAndSave( SvtSecurityOptions::EOption::DisableActiveContent, m_xSecOptDlg->IsDisableActiveContentChecked(), bModified );
}
std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
diff --git a/cui/source/options/securityoptions.cxx b/cui/source/options/securityoptions.cxx
index d583f62..8f97033 100644
--- a/cui/source/options/securityoptions.cxx
+++ b/cui/source/options/securityoptions.cxx
@@ -54,6 +54,8 @@ SecurityOptionsDialog::SecurityOptionsDialog(weld::Window* pParent)
, m_xCtrlHyperlinkImg(m_xBuilder->weld_widget("lockctrlclick"))
, m_xBlockUntrustedRefererLinksCB(m_xBuilder->weld_check_button("blockuntrusted"))
, m_xBlockUntrustedRefererLinksImg(m_xBuilder->weld_widget("lockblockuntrusted"))
, m_xDisableActiveContentCB(m_xBuilder->weld_check_button("disableactivecontent"))
, m_xDisableActiveContentImg(m_xBuilder->weld_widget("lockdisableactivecontent"))
, m_xRedlineinfoCB(m_xBuilder->weld_check_button("redlineinfo"))
, m_xRedlineinfoImg(m_xBuilder->weld_widget("lockredlineinfo"))
, m_xDocPropertiesCB(m_xBuilder->weld_check_button("docproperties"))
@@ -98,6 +100,8 @@ void SecurityOptionsDialog::init()
*m_xCtrlHyperlinkImg);
enableAndSet(SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, *m_xBlockUntrustedRefererLinksCB,
*m_xBlockUntrustedRefererLinksImg);
enableAndSet(SvtSecurityOptions::EOption::DisableActiveContent,
*m_xDisableActiveContentCB, *m_xDisableActiveContentImg);
if (!SvtSecurityOptions::IsReadOnly(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo))
changeKeepSecurityInfosEnabled();
diff --git a/cui/source/options/securityoptions.hxx b/cui/source/options/securityoptions.hxx
index 7884ccf..10534d4 100644
--- a/cui/source/options/securityoptions.hxx
+++ b/cui/source/options/securityoptions.hxx
@@ -42,6 +42,8 @@ namespace svx
std::unique_ptr<weld::Widget> m_xCtrlHyperlinkImg;
std::unique_ptr<weld::CheckButton> m_xBlockUntrustedRefererLinksCB;
std::unique_ptr<weld::Widget> m_xBlockUntrustedRefererLinksImg;
std::unique_ptr<weld::CheckButton> m_xDisableActiveContentCB;
std::unique_ptr<weld::Widget> m_xDisableActiveContentImg;
std::unique_ptr<weld::CheckButton> m_xRedlineinfoCB;
std::unique_ptr<weld::Widget> m_xRedlineinfoImg;
@@ -69,6 +71,7 @@ namespace svx
bool IsRecommPasswdChecked() const { return m_xRecommPasswdCB->get_active(); }
bool IsCtrlHyperlinkChecked() const { return m_xCtrlHyperlinkCB->get_active(); }
bool IsBlockUntrustedRefererLinksChecked() const { return m_xBlockUntrustedRefererLinksCB->get_active(); }
bool IsDisableActiveContentChecked() const { return m_xDisableActiveContentCB->get_active(); }
DECL_LINK(ShowPersonalInfosToggle, weld::Toggleable&, void);
diff --git a/cui/uiconfig/ui/securityoptionsdialog.ui b/cui/uiconfig/ui/securityoptionsdialog.ui
index 17f253f..309b964 100644
--- a/cui/uiconfig/ui/securityoptionsdialog.ui
+++ b/cui/uiconfig/ui/securityoptionsdialog.ui
@@ -275,7 +275,7 @@
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<!-- n-columns=2 n-rows=8 -->
<!-- n-columns=2 n-rows=9 -->
<object class="GtkGrid" id="grid3">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -532,6 +532,38 @@
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkImage" id="lockdisableactivecontent">
<property name="can-focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">8</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="disableactivecontent">
<property name="label" translatable="yes" context="securityoptionsdialog|blockuntrusted">Disable active contents for OLE Objects, DDE and OLE Automation.</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="hexpand">True</property>
<property name="use-underline">True</property>
<property name="draw-indicator">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="disableactivecontent-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="extended_tip|blockuntrusted">Blocks active state of OLE Objects, disables active DDE content links, and OLE Automation interface.</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">8</property>
</packing>
</child>
</object>
</child>
<child type="label">
diff --git a/include/unotools/securityoptions.hxx b/include/unotools/securityoptions.hxx
index 53f16de..650056e 100644
--- a/include/unotools/securityoptions.hxx
+++ b/include/unotools/securityoptions.hxx
@@ -49,7 +49,8 @@ namespace SvtSecurityOptions
MacroSecLevel,
MacroTrustedAuthors,
CtrlClickHyperlink,
BlockUntrustedRefererLinks
BlockUntrustedRefererLinks,
DisableActiveContent
};
struct Certificate
diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx
index 5c1c3db..f75a21a 100644
--- a/unotools/source/config/securityoptions.cxx
+++ b/unotools/source/config/securityoptions.cxx
@@ -100,6 +100,10 @@ bool IsReadOnly( EOption eOption )
case SvtSecurityOptions::EOption::BlockUntrustedRefererLinks:
bReadonly = officecfg::Office::Common::Security::Scripting::BlockUntrustedRefererLinks::isReadOnly();
break;
case SvtSecurityOptions::EOption::DisableActiveContent:
bReadonly = officecfg::Office::Common::Security::Scripting::DisableActiveContent::isReadOnly() ||
officecfg::Office::Common::Security::Scripting::DisableOLEAutomation::isReadOnly();
break;
default:
assert(false);
@@ -334,6 +338,10 @@ bool IsOptionSet( EOption eOption )
case SvtSecurityOptions::EOption::BlockUntrustedRefererLinks:
bSet = officecfg::Office::Common::Security::Scripting::BlockUntrustedRefererLinks::get();
break;
case SvtSecurityOptions::EOption::DisableActiveContent:
bSet = officecfg::Office::Common::Security::Scripting::DisableActiveContent::get() &&
officecfg::Office::Common::Security::Scripting::DisableOLEAutomation::get();
break;
default:
assert(false);
@@ -383,6 +391,10 @@ void SetOption( EOption eOption, bool bValue )
case SvtSecurityOptions::EOption::BlockUntrustedRefererLinks:
officecfg::Office::Common::Security::Scripting::BlockUntrustedRefererLinks::set(bValue, xChanges);
break;
case SvtSecurityOptions::EOption::DisableActiveContent:
officecfg::Office::Common::Security::Scripting::DisableActiveContent::set(bValue, xChanges);
officecfg::Office::Common::Security::Scripting::DisableOLEAutomation::set(bValue, xChanges);
break;
default:
assert(false);