From 64ffabbdb2725e93de997171708bb31c33c93a55 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 12 Mar 2021 17:51:07 +0100 Subject: sw bibliography, refer to a page: make the biblio field clickable - add support for this in SwWrtShell::ClickToField() - restrict this to ctrl-click by default (similar to hyperlinks) - ignore empty URLs - extend the tooltip to hint the URL - change pointer to hint that the field is clickable - downgrade the assert to SAL_WARN in SwAuthorityFieldType::RemoveField(), that currently fires every time a biblio field is de-selected Change-Id: I3b4a12d8a7661f7d8d41804f104505c7594debd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112400 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sw/source/uibase/wrtsh/wrtsh2.cxx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'sw/source/uibase/wrtsh') diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index c179383bd28a..cbda31185fed 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -334,7 +335,7 @@ void SwWrtShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet) // handler for click on the field given as parameter. // the cursor is positioned on the field. -void SwWrtShell::ClickToField( const SwField& rField ) +void SwWrtShell::ClickToField(const SwField& rField, bool bExecHyperlinks) { // cross reference field must not be selected because it moves the cursor if (SwFieldIds::GetRef != rField.GetTyp()->Which()) @@ -396,6 +397,24 @@ void SwWrtShell::ClickToField( const SwField& rField ) } break; + case SwFieldIds::TableOfAuthorities: + { + if (!bExecHyperlinks) + { + break; + } + + auto pField = static_cast(&rField); + if (!pField->HasURL()) + { + break; + } + + const OUString& rURL = pField->GetAuthEntry()->GetAuthorField(AUTH_FIELD_URL); + ::LoadURL(*this, rURL, LoadUrlFlags::NewView, /*rTargetFrameName=*/OUString()); + } + break; + case SwFieldIds::GetRef: StartAllAction(); SwCursorShell::GotoRefMark( static_cast(rField).GetSetRefName(), -- cgit