diff options
author | Gökay Şatır <gokaysatir@collabora.com> | 2023-11-28 14:32:59 +0300 |
---|---|---|
committer | Gökay ŞATIR <gokaysatir@collabora.com> | 2023-12-28 13:33:59 +0100 |
commit | 6fc77c2fa419137abe6e1950eda3d4a0bffe105e (patch) | |
tree | 81a3e4eddae0c321340ff5f4a6568c5d597217d9 /desktop | |
parent | a22ac6caece8da5add6800bdfba9865bdcfde064 (diff) |
In readonly mode, we restrict many events like click.
In readonly mode, Online users need to be able to click on a hyperlink and get the related info.
For this purpose, this PR adds a new function template that sends the hyperlink info if there is any at the clicked position.
I will send the implementation with the next commit.
Signed-off-by: Gökay Şatır <gokaysatir@collabora.com>
Change-Id: I886ea22a7097aac73ade0da78a88ddfc95ad819c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160022
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161372
Tested-by: Jenkins
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 5 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 18 |
2 files changed, 22 insertions, 1 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index b3410bd8eb49..cc4360807717 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -3702,8 +3702,11 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(71), offsetof(struct _LibreOfficeKitDocumentClass, getA11yCaretPosition)); + CPPUNIT_ASSERT_EQUAL(documentClassOffset(72), + offsetof(struct _LibreOfficeKitDocumentClass, hyperlinkInfoAtPosition)); + // As above - CPPUNIT_ASSERT_EQUAL(documentClassOffset(72), sizeof(struct _LibreOfficeKitDocumentClass)); + CPPUNIT_ASSERT_EQUAL(documentClassOffset(73), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 76772b4162be..2f82ab48225d 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1139,6 +1139,9 @@ static void doc_postWindowExtTextInputEvent(LibreOfficeKitDocument* pThis, unsigned nWindowId, int nType, const char* pText); + +static char* doc_hyperlinkInfoAtPosition(LibreOfficeKitDocument *pThis, int x, int y); + static void doc_removeTextContext(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nCharBefore, @@ -1424,6 +1427,7 @@ LibLODocument_Impl::LibLODocument_Impl(uno::Reference <css::lang::XComponent> xC m_pDocumentClass->registerCallback = doc_registerCallback; m_pDocumentClass->postKeyEvent = doc_postKeyEvent; m_pDocumentClass->postWindowExtTextInputEvent = doc_postWindowExtTextInputEvent; + m_pDocumentClass->hyperlinkInfoAtPosition = doc_hyperlinkInfoAtPosition; m_pDocumentClass->removeTextContext = doc_removeTextContext; m_pDocumentClass->postWindowKeyEvent = doc_postWindowKeyEvent; m_pDocumentClass->postMouseEvent = doc_postMouseEvent; @@ -4693,6 +4697,20 @@ static void doc_postWindowExtTextInputEvent(LibreOfficeKitDocument* pThis, unsig SfxLokHelper::postExtTextEventAsync(pWindow, nType, OUString::fromUtf8(std::string_view(pText, strlen(pText)))); } +static char* doc_hyperlinkInfoAtPosition(LibreOfficeKitDocument* pThis, int x, int y) +{ + SolarMutexGuard aGuard; + + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) + { + SetLastExceptionMsg("Document doesn't support tiled rendering"); + return nullptr; + } + + return convertOUString(pDoc->hyperlinkInfoAtPosition(x, y)); +} + static void doc_removeTextContext(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nCharBefore, int nCharAfter) { SolarMutexGuard aGuard; |