diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-07-11 16:24:47 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-07-12 07:57:17 +0200 |
commit | 44df407f63bc20c402b513e9e38470517a775317 (patch) | |
tree | 6cecf40474451be9282a3ef2ce7f356123b552d3 /sw/source/core/draw | |
parent | 295c3eb9f86b6928f82d79c6705daa2e0f61b5a4 (diff) |
tdf#121014 Display tooltip for URLs in Writer textboxes/shapes
Change-Id: I7be36f804079bf415b1b548c997c97513f34730d
Reviewed-on: https://gerrit.libreoffice.org/75423
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sw/source/core/draw')
-rw-r--r-- | sw/source/core/draw/dpage.cxx | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx index 15466ed11be8..36d887aa6cbf 100644 --- a/sw/source/core/draw/dpage.cxx +++ b/sw/source/core/draw/dpage.cxx @@ -18,6 +18,7 @@ */ #include <basic/basmgr.hxx> +#include <editeng/flditem.hxx> #include <vcl/imapobj.hxx> #include <svl/urihelper.hxx> #include <sfx2/sfxhelp.hxx> @@ -164,11 +165,11 @@ bool SwDPage::RequestHelp( vcl::Window* pWindow, SdrView const * pView, SdrPageView* pPV; SdrObject* pObj = pView->PickObj(aPos, 0, pPV, SdrSearchOptions::PICKMACRO); SwVirtFlyDrawObj* pDrawObj = dynamic_cast<SwVirtFlyDrawObj*>(pObj); + OUString sText; if (pDrawObj) { SwFlyFrame *pFly = pDrawObj->GetFlyFrame(); const SwFormatURL &rURL = pFly->GetFormat()->GetURL(); - OUString sText; if( rURL.GetMap() ) { IMapObject *pTmpObj = pFly->GetFormat()->GetIMapObject( aPos, pFly ); @@ -200,29 +201,34 @@ bool SwDPage::RequestHelp( vcl::Window* pWindow, SdrView const * pView, + "," + OUString::number( aPt.getY() ); } } - - if ( !sText.isEmpty() ) + } + else + { + SdrViewEvent aVEvt; + MouseEvent aMEvt(pWindow->ScreenToOutputPixel(rEvt.GetMousePosPixel()), 1, + MouseEventModifiers::NONE, MOUSE_LEFT); + pView->PickAnything(aMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt); + if (aVEvt.eEvent == SdrEventKind::ExecuteUrl) { - // #i80029# - bool bExecHyperlinks = pDoc->GetDocShell()->IsReadOnly(); - if ( !bExecHyperlinks ) - { - sText = SfxHelp::GetURLHelpText(sText); - } - - // then display the help: - tools::Rectangle aRect( rEvt.GetMousePosPixel(), Size(1,1) ); - if( rEvt.GetMode() & HelpEventMode::BALLOON ) - { - Help::ShowBalloon( pWindow, rEvt.GetMousePosPixel(), aRect, sText ); - } - else - { - Help::ShowQuickHelp( pWindow, aRect, sText ); - } - bContinue = false; + sText = aVEvt.pURLField->GetURL(); } } + + if (!sText.isEmpty()) + { + // #i80029# + bool bExecHyperlinks = pDoc->GetDocShell()->IsReadOnly(); + if (!bExecHyperlinks) + sText = SfxHelp::GetURLHelpText(sText); + + // then display the help: + tools::Rectangle aRect(rEvt.GetMousePosPixel(), Size(1, 1)); + if (rEvt.GetMode() & HelpEventMode::BALLOON) + Help::ShowBalloon(pWindow, rEvt.GetMousePosPixel(), aRect, sText); + else + Help::ShowQuickHelp(pWindow, aRect, sText); + bContinue = false; + } } if( bContinue ) |