summaryrefslogtreecommitdiff
path: root/xmlsecurity/source/dialogs
diff options
context:
space:
mode:
authorRafael Lima <rafael.palma.lima@gmail.com>2024-03-14 00:45:43 +0100
committerRafael Lima <rafael.palma.lima@gmail.com>2024-03-19 14:48:34 +0100
commit6178387f7bcc35df9272978ec936f8b53c6da80d (patch)
tree150c8c46cd929534b0d4b77111ae2d34b7d44e2b /xmlsecurity/source/dialogs
parenta1fbfbabbf65bbddd99e1e660ea5435abc8d9ca9 (diff)
tdf#159985 Warn about the need to reload file after changing macro security level
Change-Id: I191fd5d676d6d54fb0ef15652420afdceab2fc78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164810 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'xmlsecurity/source/dialogs')
-rw-r--r--xmlsecurity/source/dialogs/macrosecurity.cxx34
1 files changed, 34 insertions, 0 deletions
diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx
index ca4df4e64c03..9432220ae5ae 100644
--- a/xmlsecurity/source/dialogs/macrosecurity.cxx
+++ b/xmlsecurity/source/dialogs/macrosecurity.cxx
@@ -105,6 +105,9 @@ MacroSecurityLevelTP::MacroSecurityLevelTP(weld::Container* pParent, MacroSecuri
, m_xHighImg(m_xBuilder->weld_widget("highimg"))
, m_xMedImg(m_xBuilder->weld_widget("medimg"))
, m_xLowImg(m_xBuilder->weld_widget("lowimg"))
+ , m_xWarningLb(m_xBuilder->weld_label("warningmsg"))
+ , m_xWarningImg(m_xBuilder->weld_image("warningimg"))
+ , m_xWarningBox(m_xBuilder->weld_box("warningbox"))
{
m_xLowRB->connect_toggled( LINK( this, MacroSecurityLevelTP, RadioButtonHdl ) );
m_xMediumRB->connect_toggled( LINK( this, MacroSecurityLevelTP, RadioButtonHdl ) );
@@ -129,6 +132,7 @@ MacroSecurityLevelTP::MacroSecurityLevelTP(weld::Container* pParent, MacroSecuri
}
mnCurLevel = static_cast<sal_uInt16>(SvtSecurityOptions::GetMacroSecurityLevel());
+ mnInitialLevel = mnCurLevel;
bool bReadonly = SvtSecurityOptions::IsReadOnly( SvtSecurityOptions::EOption::MacroSecLevel );
weld::RadioButton* pCheck = nullptr;
@@ -166,6 +170,28 @@ MacroSecurityLevelTP::MacroSecurityLevelTP(weld::Container* pParent, MacroSecuri
m_xMediumRB->set_sensitive(false);
m_xLowRB->set_sensitive(false);
}
+
+ SetWarningLabel("");
+ // Use same font color as in InfobarType::WARNING
+ m_xWarningLb->set_font_color(Color(0x70, 0x43, 0x00));
+ m_xWarningImg->set_size_request(24, 24);
+}
+
+void MacroSecurityLevelTP::SetWarningLabel(const OUString& sMsg)
+{
+ m_xWarningLb->set_label(sMsg);
+ if (!sMsg.isEmpty())
+ {
+ m_xWarningLb->show();
+ m_xWarningImg->show();
+ m_xWarningBox->set_background(Color(0xFE, 0xEF, 0xB3));
+ }
+ else
+ {
+ m_xWarningLb->hide();
+ m_xWarningImg->hide();
+ m_xWarningBox->set_background(COL_TRANSPARENT);
+ }
}
IMPL_LINK_NOARG(MacroSecurityLevelTP, RadioButtonHdl, weld::Toggleable&, void)
@@ -183,6 +209,14 @@ IMPL_LINK_NOARG(MacroSecurityLevelTP, RadioButtonHdl, weld::Toggleable&, void)
mnCurLevel = nNewLevel;
m_pDlg->EnableReset();
}
+
+ // Show warning message if a different security level is chosen
+ if (nNewLevel != mnInitialLevel)
+ SetWarningLabel(XsResId(STR_RELOAD_FILE_WARNING));
+ else
+ {
+ SetWarningLabel("");
+ }
}
void MacroSecurityLevelTP::ClosePage()