tdf#158375: adapt UI when DDE is disabled via DisableActiveContent

When DisableActiveContent is set, provide now non-functional areas
meaningful error messages / popup dialogs.

Change-Id: I34bffee10fb0ba5c0194193f3d3d81b93d7dbd26
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160923
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Tested-by: Jenkins
This commit is contained in:
Sarper Akdemir
2023-12-21 07:49:16 +01:00
parent a2a9850217
commit 09b13f3f85
7 changed files with 56 additions and 0 deletions
+1
View File
@@ -264,6 +264,7 @@
#define STR_FIELD_INVITE NC_("STR_FIELD_INVITE", "Invite")
#define STR_WARNING_ACTIVE_CONTENT_DISABLED NC_("STR_WARNING_ACTIVE_CONTENT_DISABLED", "Active content is disabled.")
#define STR_WARNING_EXTERNAL_LINK_EDIT_DISABLED NC_("STR_ERROR_EXTERNAL_LINK_EDIT_DISABLED", "It is not possible to edit external links. Active content is disabled in the security settings.")
#define STR_SVT_DEFAULT_SERVICE_LABEL NC_("STR_SVT_DEFAULT_SERVICE_LABEL", "$user$'s $service$")
#define STR_WARNING_JAVANOTFOUND NC_("STR_WARNING_JAVANOTFOUND", "%PRODUCTNAME requires a Java runtime environment (JRE) to perform this task. Please install a JRE and restart %PRODUCTNAME. %FAQLINK")
+1
View File
@@ -371,6 +371,7 @@
#define STR_ENABLE_CONTENT NC_("STR_ENABLE_CONTENT", "Allow updating")
/*tooltip for the "Allow updating" infobar button*/
#define STR_ENABLE_CONTENT_TOOLTIP NC_("STR_ENABLE_CONTENT_TOOLTIP", "Only allow updating if you trust this document.")
#define STR_ENABLE_CONTENT_TOOLTIP_DISABLED NC_("STR_ENABLE_CONTENT_TOOLTIP_DISABLED", "Active content is disabled in the security settings. It is not possible to allow updating.")
/*Insert image dialog*/
#define STR_ANCHOR_TO_CELL NC_("STR_ANCHOR_TO_CELL", "To cell")
#define STR_ANCHOR_TO_CELL_RESIZE NC_("STR_ANCHOR_TO_CELL_RESIZE", "To cell (resize with cell)")
+7
View File
@@ -566,6 +566,13 @@ void ScDocShell::Execute( SfxRequest& rReq )
rBtn.set_label(ScResId(STR_ENABLE_CONTENT));
rBtn.set_tooltip_text(ScResId(STR_ENABLE_CONTENT_TOOLTIP));
rBtn.connect_clicked(LINK(this, ScDocShell, ReloadAllLinksHdl));
// when active content is disabled the "Allow updating" button has no functionality.
if (officecfg::Office::Common::Security::Scripting::DisableActiveContent::get())
{
rBtn.set_tooltip_text(ScResId(STR_ENABLE_CONTENT_TOOLTIP_DISABLED));
rBtn.set_sensitive(false);
}
}
}
rReq.Done();
+10
View File
@@ -64,6 +64,7 @@
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <svx/svdpagv.hxx>
#include <o3tl/temporary.hxx>
#include <officecfg/Office/Common.hxx>
#include <comphelper/lok.hxx>
@@ -485,6 +486,15 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq)
case SID_LINKS:
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if (officecfg::Office::Common::Security::Scripting::DisableActiveContent::get())
{
std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(
nullptr, VclMessageType::Warning, VclButtonsType::Ok,
SvtResId(STR_WARNING_EXTERNAL_LINK_EDIT_DISABLED)));
xError->run();
break;
}
ScopedVclPtr<SfxAbstractLinksDialog> pDlg(pFact->CreateLinksDialog(pWin->GetFrameWeld(), rDoc.GetLinkManager()));
pDlg->Execute();
rBindings.Invalidate( nSlot );
+13
View File
@@ -28,6 +28,10 @@
#include <ViewShell.hxx>
#include <app.hrc>
#include <svtools/strings.hrc>
#include <svtools/svtresid.hxx>
#include <officecfg/Office/Common.hxx>
class SfxRequest;
namespace sd {
@@ -52,6 +56,15 @@ rtl::Reference<FuPoor> FuLink::Create( ViewShell* pViewSh, ::sd::Window* pWin, :
void FuLink::DoExecute( SfxRequest& )
{
if (officecfg::Office::Common::Security::Scripting::DisableActiveContent::get())
{
std::unique_ptr<weld::MessageDialog> xError(
Application::CreateMessageDialog(nullptr, VclMessageType::Warning, VclButtonsType::Ok,
SvtResId(STR_WARNING_EXTERNAL_LINK_EDIT_DISABLED)));
xError->run();
return;
}
sfx2::LinkManager* pLinkManager = mpDoc->GetLinkManager();
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+13
View File
@@ -56,6 +56,8 @@
#include <doc.hxx>
#include <PostItMgr.hxx>
#include <swmodule.hxx>
#include <svtools/strings.hrc>
#include <svtools/svtresid.hxx>
#include <editeng/ulspitem.hxx>
#include <xmloff/odffields.hxx>
@@ -68,6 +70,7 @@
#include <svx/pageitem.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <IMark.hxx>
#include <officecfg/Office/Common.hxx>
#include <officecfg/Office/Compatibility.hxx>
#include <ndtxt.hxx>
#include <translatehelper.hxx>
@@ -137,6 +140,16 @@ void SwTextShell::ExecField(SfxRequest &rReq)
GetBaseLink();
if(rLink.IsVisible())
{
if (officecfg::Office::Common::Security::Scripting::DisableActiveContent::get())
{
std::unique_ptr<weld::MessageDialog> xError(
Application::CreateMessageDialog(
nullptr, VclMessageType::Warning, VclButtonsType::Ok,
SvtResId(STR_WARNING_EXTERNAL_LINK_EDIT_DISABLED)));
xError->run();
break;
}
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<SfxAbstractLinksDialog> pDlg(pFact->CreateLinksDialog(GetView().GetFrameWeld(), &rSh.GetLinkManager(), false, &rLink));
pDlg->Execute();
+11
View File
@@ -120,6 +120,8 @@
#include <comphelper/lok.hxx>
#include <comphelper/string.hxx>
#include <comphelper/docpasswordhelper.hxx>
#include <svtools/strings.hrc>
#include <svtools/svtresid.hxx>
#include <PostItMgr.hxx>
@@ -2454,6 +2456,15 @@ void SwView::InsFrameMode(sal_uInt16 nCols)
/// show "edit link" dialog
void SwView::EditLinkDlg()
{
if (officecfg::Office::Common::Security::Scripting::DisableActiveContent::get())
{
std::unique_ptr<weld::MessageDialog> xError(
Application::CreateMessageDialog(nullptr, VclMessageType::Warning, VclButtonsType::Ok,
SvtResId(STR_WARNING_EXTERNAL_LINK_EDIT_DISABLED)));
xError->run();
return;
}
bool bWeb = dynamic_cast<SwWebView*>( this ) != nullptr;
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr<SfxAbstractLinksDialog> pDlg(pFact->CreateLinksDialog(GetViewFrame().GetFrameWeld(), &GetWrtShell().GetLinkManager(), bWeb));