summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2020-09-30 11:28:02 +0200
committerAndras Timar <andras.timar@collabora.com>2020-10-05 21:56:00 +0200
commit3e94f095c4f5db0a132e94de471ba82b6cc1380f (patch)
treedb354b62149fbe87bff15cf726264e01ae6a654d
parent80ba3eda8cd3c8ebbf2e49b215e2f2eb6d4b1837 (diff)
Don't insert hyperlink outside the page
Change-Id: Ida562bdf4eab479b4df2bba7917466d5da788a6a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103673 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--sd/source/ui/view/drviewse.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index df63acc9e107..189f789457bf 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -1511,8 +1511,11 @@ void DrawViewShell::InsertURLField(const OUString& rURL, const OUString& rText,
::tools::Rectangle aRect(aPos, GetActiveWindow()->GetOutputSizePixel() );
aPos = aRect.Center();
aPos = GetActiveWindow()->PixelToLogic(aPos);
- aPos.AdjustX( -(aSize.Width() / 2) );
- aPos.AdjustY( -(aSize.Height() / 2) );
+
+ if (aPos.getX() - (aSize.Width() / 2) >= 0)
+ aPos.AdjustX( -(aSize.Width() / 2) );
+ if (aPos.getY() - (aSize.Height() / 2) >= 0)
+ aPos.AdjustY( -(aSize.Height() / 2) );
::tools::Rectangle aLogicRect(aPos, aSize);
pRectObj->SetLogicRect(aLogicRect);