diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-10-29 12:17:40 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-10-29 13:02:40 +0000 |
commit | a346dfccd7e342d776dd59eb3ed128557e22a1bf (patch) | |
tree | fd2b7dcb940e054bdc080afed3b52257c9e4ca84 /vcl/source | |
parent | b051510796dcf289edcd03737087176e53bbe4b8 (diff) |
tdf#70833: IDNA support when exporing hyperlinks to PDF
Any URLs using non-ASCII IDNA syntax need to be resolved to ASCII-only, as PDF
URI Action's URI needs to be "encoded in 7-bit ASCII."
Introduce URIHelper::resolveIdnaHost (svl/urihelper.hxx), which internally uses
icu::IDNA, which requires to bump the minimal --with-system-icu requirement from
4.2 to 4.6, which means ICU_RECLASSIFIED_CLOSE_PARENTHESIS is always true now.
Change-Id: I0e20d9a20ed2b869fba0cc7c969721411db590b3
Reviewed-on: https://gerrit.libreoffice.org/19669
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index fcd04b44515a..ae009788aaa5 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -44,6 +44,7 @@ #include <rtl/crc.h> #include <rtl/digest.h> #include <rtl/ustrbuf.hxx> +#include <svl/urihelper.hxx> #include <tools/debug.hxx> #include <tools/fract.hxx> #include <tools/stream.hxx> @@ -4495,8 +4496,10 @@ we check in the following sequence: // are the correct one!! // extract target file type + auto url(URIHelper::resolveIdnaHost(rLink.m_aURL)); + INetURLObject aDocumentURL( m_aContext.BaseURL ); - INetURLObject aTargetURL( rLink.m_aURL ); + INetURLObject aTargetURL( url ); bool bSetGoToRMode = false; bool bTargetHasPDFExtension = false; INetProtocol eTargetProtocol = aTargetURL.GetProtocol(); @@ -4507,7 +4510,7 @@ we check in the following sequence: // getting the needed URL information from the current document path if( eTargetProtocol == INetProtocol::NotValid ) { - if( rLink.m_aURL.getLength() > 4 && rLink.m_aURL.startsWith("\\\\\\\\")) + if( url.getLength() > 4 && url.startsWith("\\\\\\\\")) { bIsUNCPath = true; } @@ -4516,7 +4519,7 @@ we check in the following sequence: INetURLObject aNewBase( aDocumentURL );//duplicate document URL aNewBase.removeSegment(); //remove last segment from it, obtaining the base URL of the //target document - aNewBase.insertName( rLink.m_aURL ); + aNewBase.insertName( url ); aTargetURL = aNewBase;//reassign the new target URL //recompute the target protocol, with the new URL //normal URL processing resumes @@ -4564,7 +4567,7 @@ we check in the following sequence: { aLine.append( "/Launch/Win<</F" ); // INetURLObject is not good with UNC paths, use original path - appendLiteralStringEncrypt( rLink.m_aURL, rLink.m_nObject, aLine, osl_getThreadTextEncoding() ); + appendLiteralStringEncrypt( url, rLink.m_nObject, aLine, osl_getThreadTextEncoding() ); aLine.append( ">>" ); } else |