diff options
-rw-r--r-- | include/svtools/strings.hrc | 1 | ||||
-rw-r--r-- | sc/inc/strings.hrc | 1 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwshb.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/func/fulink.cxx | 13 | ||||
-rw-r--r-- | sw/source/uibase/shells/textfld.cxx | 13 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 11 |
7 files changed, 56 insertions, 0 deletions
diff --git a/include/svtools/strings.hrc b/include/svtools/strings.hrc index 53cefc48d8ff..ab18119242b3 100644 --- a/include/svtools/strings.hrc +++ b/include/svtools/strings.hrc @@ -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") diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index d58777176e52..266cb4cc6c5b 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -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)") diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 964515743c27..4de5b1950183 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -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(); diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index f0415d03d9aa..ad0e757ce0aa 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -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 ); diff --git a/sd/source/ui/func/fulink.cxx b/sd/source/ui/func/fulink.cxx index 8a6d726deca1..32b3b70ad880 100644 --- a/sd/source/ui/func/fulink.cxx +++ b/sd/source/ui/func/fulink.cxx @@ -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(); diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 780a01f943da..68561d8b8ded 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -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(); diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 6cb3aeedeece..cc6faf78a3c5 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -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)); |