com.sun.star.text.textfield.URL doesn’t work with Writer documents. It ends up creating a text field that only works with editeng and then when a user tries to insert it into a document it throws a confusing IllegalArgumentException because the attach method is expecting an SvxUnoTextRange but it is given an SwXTextRange. This patch makes it catch that situation and throw a replacement exception with a more helpful message giving an indication to the developer about the right way to add links. Change-Id: If1fe29e3ab6270256351cd263a4461620e4b5426 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201148 Reviewed-by: Neil Roberts <nroberts@libreoffice.org> Tested-by: Jenkins