sc/inc/globstr.hrc               |    2 +-
 sc/inc/helpids.h                 |    2 ++
 sc/inc/strings.hrc               |    2 ++
 sc/source/ui/docshell/docsh4.cxx |   20 ++++++++++++++++++++
 4 files changed, 25 insertions(+), 1 deletion(-)

New commits:
commit 321dac0b80c875247ae064e023d107d3ac1caef3
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Apr 4 12:30:40 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Apr 4 15:54:24 2022 +0200

    clarify that the link warning is a security relevant one
    
    add a tooltip to the "allow button" about trust and add a help button
    that links to documentation on the risk
    
    Change-Id: I3390c1316d65e1a50c564e11101551a4ed9d6b51
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132508
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index bed2e10f9b51..0eb0e7929625 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -345,7 +345,7 @@
 #define STR_DOC_PRINTED                         NC_("STR_DOC_PRINTED", 
"Printed")
 #define STR_BY                                  NC_("STR_BY", "by")
 #define STR_ON                                  NC_("STR_ON", "on")
-#define STR_RELOAD_TABLES                       NC_("STR_RELOAD_TABLES", 
"Automatic update of external links has been disabled.")
+#define STR_RELOAD_TABLES                       NC_("STR_RELOAD_TABLES", 
"Security Warning: Automatic update of external links has been disabled.")
 #define STR_REIMPORT_AFTER_LOAD                 NC_("STR_REIMPORT_AFTER_LOAD", 
"This file contains queries. The results of these queries were not saved.\nDo 
you want these queries to be repeated?")
 #define STR_INSERT_FULL                         NC_("STR_INSERT_FULL", "Filled 
cells cannot be shifted\nbeyond the sheet.")
 #define STR_TABINSERT_ERROR                     NC_("STR_TABINSERT_ERROR", 
"The table could not be inserted.")
diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h
index d677f133edf0..bb9ff1c2faed 100644
--- a/sc/inc/helpids.h
+++ b/sc/inc/helpids.h
@@ -168,6 +168,8 @@ inline constexpr OStringLiteral HID_SELECTTABLES = 
"SC_HID_SELECTTABLES";
 #define HID_AAI_FUNC_IMSECH                                     
"SC_HID_AAI_FUNC_IMSECH"
 #define HID_AAI_FUNC_IMCSCH                                     
"SC_HID_AAI_FUNC_IMCSCH"
 
+#define HID_UPDATE_LINK_WARNING                                 
"cui/ui/baselinksdialog/UPDATE_NOW"
+
 // DateFunc Addin Functions (max.20) -----------------------------------------
 #define HID_DAI_FUNC_DAYSINMONTH                                
"SC_HID_DAI_FUNC_DAYSINMONTH"
 #define HID_DAI_FUNC_DAYSINYEAR                                 
"SC_HID_DAI_FUNC_DAYSINYEAR"
diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc
index 2e5f646af476..8f94d9a94104 100644
--- a/sc/inc/strings.hrc
+++ b/sc/inc/strings.hrc
@@ -361,6 +361,8 @@
 #define STR_INPUT_DATA_RANGE                        
NC_("STR_INPUT_DATA_RANGE", "Input data range")
 /*infobar for allowing links to update or not*/
 #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.")
 /*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 3d69269d5a36..15ba7c8abba4 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -40,6 +40,7 @@ using namespace ::com::sun::star;
 #include <svx/ofaitem.hxx>
 #include <svl/stritem.hxx>
 #include <svl/whiter.hxx>
+#include <vcl/stdtext.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/weld.hxx>
 #include <svx/dataaccessdescriptor.hxx>
@@ -206,6 +207,21 @@ IMPL_LINK_NOARG( ScDocShell, ReloadAllLinksHdl, 
weld::Button&, void )
     SAL_WARN_IF(!pViewFrame, "sc", "expected there to be a ViewFrame");
 }
 
+namespace
+{
+    class LinkHelp
+    {
+    public:
+        DECL_STATIC_LINK(LinkHelp, DispatchHelpLinksHdl, weld::Button&, void);
+    };
+}
+
+IMPL_STATIC_LINK(LinkHelp, DispatchHelpLinksHdl, weld::Button&, rBtn, void)
+{
+    if (Help* pHelp = Application::GetHelp())
+        pHelp->Start(HID_UPDATE_LINK_WARNING, &rBtn);
+}
+
 void ScDocShell::Execute( SfxRequest& rReq )
 {
     const SfxItemSet* pReqArgs = rReq.GetArgs();
@@ -525,8 +541,12 @@ void ScDocShell::Execute( SfxRequest& rReq )
                         auto pInfoBar = 
pViewFrame->AppendInfoBar("enablecontent", "", ScResId(STR_RELOAD_TABLES), 
InfobarType::WARNING);
                         if (pInfoBar)
                         {
+                            weld::Button& rHelpBtn = pInfoBar->addButton();
+                            
rHelpBtn.set_label(GetStandardText(StandardButtonType::Help).replaceFirst("~", 
""));
+                            rHelpBtn.connect_clicked(LINK(nullptr, LinkHelp, 
DispatchHelpLinksHdl));
                             weld::Button& rBtn = pInfoBar->addButton();
                             rBtn.set_label(ScResId(STR_ENABLE_CONTENT));
+                            
rBtn.set_tooltip_text(ScResId(STR_ENABLE_CONTENT_TOOLTIP));
                             rBtn.connect_clicked(LINK(this, ScDocShell, 
ReloadAllLinksHdl));
                         }
                     }

Reply via email to