summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sfx2/sfxhelp.hxx2
-rw-r--r--include/sfx2/strings.hrc2
-rw-r--r--sc/inc/globstr.hrc2
-rw-r--r--sc/source/ui/view/gridwin5.cxx73
-rw-r--r--sd/inc/strings.hrc3
-rw-r--r--sd/source/ui/func/fudraw.cxx23
-rw-r--r--sfx2/source/appl/sfxhelp.cxx22
-rw-r--r--sw/inc/shellres.hxx3
-rw-r--r--sw/inc/strings.hrc2
-rw-r--r--sw/source/core/draw/dpage.cxx10
-rw-r--r--sw/source/uibase/docvw/SidebarTxtControl.cxx11
-rw-r--r--sw/source/uibase/docvw/edtwin2.cxx10
-rw-r--r--sw/source/uibase/utlui/initui.cxx10
13 files changed, 43 insertions, 130 deletions
diff --git a/include/sfx2/sfxhelp.hxx b/include/sfx2/sfxhelp.hxx
index e76872f3f201..7af26fab0708 100644
--- a/include/sfx2/sfxhelp.hxx
+++ b/include/sfx2/sfxhelp.hxx
@@ -50,6 +50,8 @@ public:
static OUString GetCurrentModuleIdentifier();
// Check for built-in help
static bool IsHelpInstalled();
+
+ static OUString GetURLHelpText(const OUString&);
};
#endif // INCLUDED_SFX2_SFXHELP_HXX
diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc
index 96883a2384b0..f7b2c1673b90 100644
--- a/include/sfx2/strings.hrc
+++ b/include/sfx2/strings.hrc
@@ -319,6 +319,8 @@
#define STR_PASSWORD_LEN NC_("STR_PASSWORD_LEN", "Password length")
#define STR_PASSWORD_WARNING NC_("STR_PASSWORD_WARNING", "The password you have entered causes interoperability issues. Please enter a password that is shorter than 52 bytes, or longer than 55 bytes.")
+#define STR_CTRLCLICKHYPERLINK NC_("STR_CTRLCLICKHYPERLINK", "%{key}-click to follow hyperlink: %{link}")
+#define STR_CLICKHYPERLINK NC_("STR_CLICKHYPERLINK", "Click to open hyperlink: %{link}")
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 38d182613fdb..1273baf40238 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -492,8 +492,6 @@
#define STR_COPYLIST NC_("STR_COPYLIST", "Copy List")
#define STR_COPYFROM NC_("STR_COPYFROM", "List from")
#define STR_COPYERR NC_("STR_COPYERR", "Cells without text have been ignored.")
-#define STR_CTRLCLICKHYPERLINK NC_("STR_CTRLCLICKHYPERLINK", "%s-click to follow hyperlink:")
-#define STR_CLICKHYPERLINK NC_("STR_CLICKHYPERLINK", "click to open hyperlink:")
#define STR_PRINT_PREVIEW_NODATA NC_("STR_PRINT_PREVIEW_NODATA", "No Data")
#define STR_PRINT_PREVIEW_EMPTY_RANGE NC_("STR_PRINT_PREVIEW_EMPTY_RANGE", "Print Range Empty")
#define STR_UNDO_CONDFORMAT NC_("STR_UNDO_CONDFORMAT", "Conditional Format")
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index 1d2ff0af25b4..44ae79acf321 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -30,9 +30,7 @@
#include <vcl/svapp.hxx>
#include <tools/urlobj.hxx>
#include <sfx2/viewfrm.hxx>
-
-#include <unotools/localedatawrapper.hxx>
-#include <unotools/securityoptions.hxx>
+#include <sfx2/sfxhelp.hxx>
#include <viewuno.hxx>
#include <AccessibleDocument.hxx>
@@ -216,23 +214,6 @@ bool ScGridWindow::ShowNoteMarker( SCCOL nPosX, SCROW nPosY, bool bKeyboard )
void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
{
- //To know whether to prefix STR_CTRLCLICKHYERLINK or STR_CLICKHYPERLINK
- //to hyperlink tooltips/help text
- SvtSecurityOptions aSecOpt;
- bool bCtrlClickHlink = aSecOpt.IsOptionSet( SvtSecurityOptions::EOption::CtrlClickHyperlink );
- //Global string STR_CTRLCLICKHYPERLINK i.e,
- // "ctrl-click to follow link:" for not MacOS
- // "⌘-click to follow link:" for MacOs
- vcl::KeyCode aCode( KEY_SPACE );
- vcl::KeyCode aModifiedCode( KEY_SPACE, KEY_MOD1 );
- OUString aModStr( aModifiedCode.GetName() );
- aModStr = aModStr.replaceFirst(aCode.GetName(), "");
- aModStr = aModStr.replaceAll("+", "");
- OUString aCtrlClickHlinkStr = ScResId( STR_CTRLCLICKHYPERLINK );
-
- aCtrlClickHlinkStr = aCtrlClickHlinkStr.replaceAll("%s", aModStr);
- //Global string STR_CLICKHYPERLINK i.e, "click to open hyperlink"
- OUString aClickHlinkStr = ScResId( STR_CLICKHYPERLINK );
bool bDone = false;
bool bHelpEnabled = bool(rHEvt.GetMode() & ( HelpEventMode::BALLOON | HelpEventMode::QUICK ));
SdrView* pDrView = pViewData->GetScDrawView();
@@ -294,17 +275,7 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
// For image maps show the description, if available
aHelpText = pIMapObj->GetAltText();
if (aHelpText.isEmpty())
- aHelpText = pIMapObj->GetURL();
- if( bCtrlClickHlink )
- {
- //prefix STR_CTRLCLICKHYPERLINK to aHelpText
- aHelpText = aCtrlClickHlinkStr + aHelpText;
- }
- else
- {
- //Option not set, so prefix STR_CLICKHYPERLINK
- aHelpText = aClickHlinkStr + aHelpText;
- }
+ aHelpText = SfxHelp::GetURLHelpText(pIMapObj->GetURL());
aPixRect = LogicToPixel(aVEvt.pObj->GetLogicRect());
}
}
@@ -313,17 +284,7 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
{
if( aVEvt.eEvent == SdrEventKind::ExecuteUrl )
{
- aHelpText = aVEvt.pURLField->GetURL();
- if( bCtrlClickHlink )
- {
- //prefix STR_CTRLCLICKHYPERLINK to aHelpText
- aHelpText = aCtrlClickHlinkStr + aHelpText;
- }
- else
- {
- //Option not set, so prefix STR_CLICKHYPERLINK
- aHelpText = aClickHlinkStr + aHelpText;
- }
+ aHelpText = SfxHelp::GetURLHelpText(aVEvt.pURLField->GetURL());
aPixRect = LogicToPixel(aVEvt.pObj->GetLogicRect());
}
else
@@ -343,18 +304,7 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
if ( pInfo && (pInfo->GetHlink().getLength() > 0) )
{
aPixRect = LogicToPixel(aVEvt.pObj->GetLogicRect());
- aHelpText = pInfo->GetHlink();
- if( bCtrlClickHlink )
- {
- //prefix STR_CTRLCLICKHYPERLINK to aHelpText
- aHelpText = aCtrlClickHlinkStr + aHelpText;
- }
- else
- {
- //Option not set, so prefix STR_CLICKHYPERLINK
- aHelpText = aClickHlinkStr + aHelpText;
- }
-
+ aHelpText = SfxHelp::GetURLHelpText(pInfo->GetHlink());
}
}
}
@@ -367,19 +317,8 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
OUString aUrl;
if ( GetEditUrl( aPosPixel, nullptr, &aUrl ) )
{
- aHelpText = INetURLObject::decode( aUrl,
- INetURLObject::DecodeMechanism::Unambiguous );
-
- if( bCtrlClickHlink )
- {
- //prefix STR_CTRLCLICKHYPERLINK to aHelpText
- aHelpText = aCtrlClickHlinkStr + aHelpText;
- }
- else
- {
- //Option not set, so prefix STR_CLICKHYPERLINK
- aHelpText = aClickHlinkStr + aHelpText;
- }
+ aHelpText = SfxHelp::GetURLHelpText(
+ INetURLObject::decode(aUrl, INetURLObject::DecodeMechanism::Unambiguous));
ScDocument* pDoc = pViewData->GetDocument();
SCCOL nPosX;
diff --git a/sd/inc/strings.hrc b/sd/inc/strings.hrc
index 38b9491b497b..6aa554df0c9f 100644
--- a/sd/inc/strings.hrc
+++ b/sd/inc/strings.hrc
@@ -486,9 +486,6 @@
#define STR_SD_NONE NC_("STR_SD_NONE", "- None -")
-#define STR_CTRLCLICKHYPERLINK NC_("STR_CTRLCLICKHYPERLINK", "%s-click to follow hyperlink: ")
-#define STR_CLICKHYPERLINK NC_("STR_CLICKHYPERLINK", "Click to open hyperlink: ")
-
#define RID_SVXSTR_EDIT_GRAPHIC NC_("RID_SVXSTR_EDIT_GRAPHIC", "Link")
#endif
diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx
index 64bef1f58aac..b6e915fdd052 100644
--- a/sd/source/ui/func/fudraw.cxx
+++ b/sd/source/ui/func/fudraw.cxx
@@ -32,6 +32,7 @@
#include <sfx2/app.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/bindings.hxx>
+#include <sfx2/sfxhelp.hxx>
#include <svx/svdpagv.hxx>
#include <vcl/imapobj.hxx>
#include <svx/svxids.hrc>
@@ -756,27 +757,7 @@ bool FuDraw::SetHelpText(SdrObject* pObj, const Point& rPosPixel, const SdrViewE
else
return false;
- SvtSecurityOptions aSecOpt;
- if (aSecOpt.IsOptionSet(SvtSecurityOptions::EOption::CtrlClickHyperlink))
- {
- // Hint about Ctrl-click to open hyperlink, but need to detect "Ctrl" key for MacOs
- vcl::KeyCode aCode(KEY_SPACE);
- vcl::KeyCode aModifiedCode(KEY_SPACE, KEY_MOD1);
- OUString aModStr(aModifiedCode.GetName());
- aModStr = aModStr.replaceFirst(aCode.GetName(), "");
- aModStr = aModStr.replaceAll("+", "");
-
- OUString aCtrlClickHlinkStr = SdResId(STR_CTRLCLICKHYPERLINK);
-
- aCtrlClickHlinkStr = aCtrlClickHlinkStr.replaceAll("%s", aModStr);
-
- aHelpText = aCtrlClickHlinkStr + aURL;
- }
- else
- {
- // Hint about just clicking hyperlink
- aHelpText = SdResId(STR_CLICKHYPERLINK) + aURL;
- }
+ aHelpText = SfxHelp::GetURLHelpText(aURL);
if (aHelpText.isEmpty())
return false;
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 8fbdad1fc794..d6fac42bd6de 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -65,8 +65,11 @@
#include <osl/file.hxx>
#include <unotools/bootstrap.hxx>
#include <unotools/tempfile.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <unotools/securityoptions.hxx>
#include <rtl/uri.hxx>
#include <vcl/commandinfoprovider.hxx>
+#include <vcl/keycod.hxx>
#include <vcl/layout.hxx>
#include <vcl/waitobj.hxx>
#include <vcl/weld.hxx>
@@ -680,6 +683,25 @@ OUString SfxHelp::GetHelpText(const OUString& aCommandURL, const weld::Widget* p
return sHelpText;
}
+OUString SfxHelp::GetURLHelpText(const OUString& aURL)
+{
+ SvtSecurityOptions aSecOpt;
+ bool bCtrlClickHlink = aSecOpt.IsOptionSet(SvtSecurityOptions::EOption::CtrlClickHyperlink);
+
+ // "ctrl-click to follow link:" for not MacOS
+ // "⌘-click to follow link:" for MacOs
+ vcl::KeyCode aCode(KEY_SPACE);
+ vcl::KeyCode aModifiedCode(KEY_SPACE, KEY_MOD1);
+ OUString aModStr(aModifiedCode.GetName());
+ aModStr = aModStr.replaceFirst(aCode.GetName(), "");
+ aModStr = aModStr.replaceAll("+", "");
+ OUString aHelpStr
+ = bCtrlClickHlink ? SfxResId(STR_CTRLCLICKHYPERLINK) : SfxResId(STR_CLICKHYPERLINK);
+ aHelpStr = aHelpStr.replaceFirst("%{key}", aModStr);
+ aHelpStr = aHelpStr.replaceFirst("%{link}", aURL);
+ return aHelpStr;
+}
+
void SfxHelp::SearchKeyword( const OUString& rKeyword )
{
Start_Impl(OUString(), static_cast<vcl::Window*>(nullptr), rKeyword);
diff --git a/sw/inc/shellres.hxx b/sw/inc/shellres.hxx
index abdfb341cc35..85b18b0c2478 100644
--- a/sw/inc/shellres.hxx
+++ b/sw/inc/shellres.hxx
@@ -58,9 +58,6 @@ struct SW_DLLPUBLIC ShellResource
OUString const aTOXAuthoritiesName;
OUString const aTOXCitationName;
- OUString aLinkCtrlClick;
- OUString const aLinkClick;
-
std::vector<OUString> aDocInfoLst;
// The autoFormat-Redline comments.
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 1de4f3303db8..7f9d7e28aeb3 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -690,8 +690,6 @@
#define STR_TOX_TBL NC_("STR_TOX_TBL", "Index of Tables")
#define STR_TOX_OBJ NC_("STR_TOX_OBJ", "Table of Objects")
#define STR_TOX_ILL NC_("STR_TOX_ILL", "Table of Figures")
-#define STR_LINK_CTRL_CLICK NC_("STR_LINK_CTRL_CLICK", "%s-Click to follow link")
-#define STR_LINK_CLICK NC_("STR_LINK_CLICK", "Click to follow link")
// SubType DocInfo
#define FLD_DOCINFO_TITEL NC_("FLD_DOCINFO_TITEL", "Title")
#define FLD_DOCINFO_THEMA NC_("FLD_DOCINFO_THEMA", "Subject")
diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx
index 84762f89cea1..15466ed11be8 100644
--- a/sw/source/core/draw/dpage.cxx
+++ b/sw/source/core/draw/dpage.cxx
@@ -20,8 +20,10 @@
#include <basic/basmgr.hxx>
#include <vcl/imapobj.hxx>
#include <svl/urihelper.hxx>
+#include <sfx2/sfxhelp.hxx>
#include <unotools/securityoptions.hxx>
#include <vcl/help.hxx>
+#include <vcl/svapp.hxx>
#include <svx/svdview.hxx>
#include <fmturl.hxx>
#include <frmfmt.hxx>
@@ -205,13 +207,7 @@ bool SwDPage::RequestHelp( vcl::Window* pWindow, SdrView const * pView,
bool bExecHyperlinks = pDoc->GetDocShell()->IsReadOnly();
if ( !bExecHyperlinks )
{
- SvtSecurityOptions aSecOpts;
- bExecHyperlinks = !aSecOpts.IsOptionSet( SvtSecurityOptions::EOption::CtrlClickHyperlink );
-
- if ( !bExecHyperlinks )
- sText = SwViewShell::GetShellRes()->aLinkCtrlClick + ": " + sText;
- else
- sText = SwViewShell::GetShellRes()->aLinkClick + ": " + sText;
+ sText = SfxHelp::GetURLHelpText(sText);
}
// then display the help:
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index ef1f9f915977..bdbb0e2804e4 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -34,6 +34,7 @@
#include <sfx2/viewfrm.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
+#include <sfx2/sfxhelp.hxx>
#include <vcl/commandevent.hxx>
#include <vcl/svapp.hxx>
@@ -307,13 +308,9 @@ void SidebarTextControl::MouseMove( const MouseEvent& rMEvt )
const SvxURLField* pURL = dynamic_cast<const SvxURLField*>( pField );
if ( pURL )
{
- OUString sURL( pURL->GetURL() );
- SvtSecurityOptions aSecOpts;
- if ( aSecOpts.IsOptionSet( SvtSecurityOptions::EOption::CtrlClickHyperlink) )
- sURL = SwViewShell::GetShellRes()->aLinkCtrlClick + ": " + sURL;
- else
- sURL = SwViewShell::GetShellRes()->aLinkClick + ": " + sURL;
- Help::ShowQuickHelp( this,PixelToLogic(tools::Rectangle(GetPosPixel(),Size(50,10))),sURL);
+ OUString sText(SfxHelp::GetURLHelpText(pURL->GetURL()));
+ Help::ShowQuickHelp(
+ this, PixelToLogic(tools::Rectangle(GetPosPixel(), Size(50, 10))), sText);
}
}
}
diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx
index 044154da39b2..c8bce67fb972 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -31,6 +31,7 @@
#include <svl/urihelper.hxx>
#include <svx/svdotext.hxx>
#include <editeng/outliner.hxx>
+#include <sfx2/sfxhelp.hxx>
#include <svl/itemiter.hxx>
#include <svx/svdview.hxx>
#include <svx/svdpagv.hxx>
@@ -221,14 +222,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
bool bExecHyperlinks = m_rView.GetDocShell()->IsReadOnly();
if ( !bExecHyperlinks )
{
- SvtSecurityOptions aSecOpts;
- bExecHyperlinks = !aSecOpts.IsOptionSet( SvtSecurityOptions::EOption::CtrlClickHyperlink );
-
- sText = ": " + sText;
- if ( !bExecHyperlinks )
- sText = SwViewShell::GetShellRes()->aLinkCtrlClick + sText;
- else
- sText = SwViewShell::GetShellRes()->aLinkClick + sText;
+ sText = SfxHelp::GetURLHelpText(sText);
}
break;
}
diff --git a/sw/source/uibase/utlui/initui.cxx b/sw/source/uibase/utlui/initui.cxx
index d8fd77e627d1..7a1d9dacea8a 100644
--- a/sw/source/uibase/utlui/initui.cxx
+++ b/sw/source/uibase/utlui/initui.cxx
@@ -33,7 +33,6 @@
#include <authfld.hxx>
#include <dbmgr.hxx>
#include <unotools/syslocale.hxx>
-#include <vcl/keycod.hxx>
#include <unomid.h>
@@ -135,19 +134,10 @@ ShellResource::ShellResource()
aTOXTablesName( SwResId(STR_TOX_TBL)),
aTOXAuthoritiesName( SwResId(STR_TOX_AUTH)),
aTOXCitationName( SwResId(STR_TOX_CITATION)),
- aLinkCtrlClick(SwResId(STR_LINK_CTRL_CLICK)),
- aLinkClick(SwResId(STR_LINK_CLICK)),
sPageDescFirstName( SwResId(STR_PAGEDESC_FIRSTNAME)),
sPageDescFollowName( SwResId(STR_PAGEDESC_FOLLOWNAME)),
sPageDescName( SwResId(STR_PAGEDESC_NAME))
{
- vcl::KeyCode aCode( KEY_SPACE );
- vcl::KeyCode aModifiedCode( KEY_SPACE, KEY_MOD1 );
- OUString aModStr( aModifiedCode.GetName() );
- aModStr = aModStr.replaceFirst(aCode.GetName(), "");
- aModStr = aModStr.replaceAll("+", "");
- aLinkCtrlClick = aLinkCtrlClick.replaceAll("%s", aModStr);
-
for (size_t i = 0; i < SAL_N_ELEMENTS(FLD_DOCINFO_ARY); ++i)
aDocInfoLst.push_back(SwResId(FLD_DOCINFO_ARY[i]));
}