Hi all, Attached is a patch fixing correctly the relative flag for hyperlinks when exporting ww8 files. Sorry Knut, but I didn't integrate any of your patches as they were not fixing the bug properly (see troubles with http, ftp or other URLs like that)
Can anyone review the patch, sign it off and push it to 3.4 branch? Thanks, -- Cédric Bosdonnat LibreOffice hacker http://documentfoundation.org OOo Eclipse Integration developer http://cedric.bosdonnat.free.fr
>From 79efa9e03d8b1252c36bd524c88a34d045daaffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= <cedric.bosdonnat....@free.fr> Date: Wed, 25 May 2011 16:30:40 +0200 Subject: [PATCH] i#115297: Fixed the relative links export in ww8 files Actually check that the output URL is relative or absolute. Non mark-only URLs doesn't necessarily reflect absolute URLs! --- sw/source/filter/ww8/wrtw8nds.cxx | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 7808f89..863b2ea 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -893,8 +893,12 @@ bool WW8AttributeOutput::StartURL( const String &rUrl, const String &rTarget ) // now write the picture structur sURL = aURL.GetURLNoMark(); - //all links end up in the data stream as absolute references. - bool bAbsolute = !bBookMarkOnly; + // Compare the URL written by AnalyzeURL with the original one to see if + // the output URL is absolute or relative. + String sRelativeURL; + if ( rUrl.Len() ) + sRelativeURL = URIHelper::simpleNormalizedMakeRelative( m_rWW8Export.GetWriter().GetBaseURL(), rUrl ); + bool bAbsolute = sRelativeURL.Equals( rUrl ); static sal_uInt8 aURLData1[] = { 0,0,0,0, // len of struct @@ -912,11 +916,14 @@ bool WW8AttributeOutput::StartURL( const String &rUrl, const String &rTarget ) }; m_rWW8Export.pDataStrm->Write( aURLData1, sizeof( aURLData1 ) ); + /* Write HFD Structure */ sal_uInt8 nAnchor = 0x00; if ( sMark.Len() ) nAnchor = 0x08; - m_rWW8Export.pDataStrm->Write( &nAnchor, 1 ); - m_rWW8Export.pDataStrm->Write( MAGIC_A, sizeof(MAGIC_A) ); + m_rWW8Export.pDataStrm->Write( &nAnchor, 1 ); // HFDBits + m_rWW8Export.pDataStrm->Write( MAGIC_A, sizeof(MAGIC_A) ); //clsid + + /* Write Hyperlink Object see [MS-OSHARED] spec*/ SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, 0x00000002); sal_uInt32 nFlag = bBookMarkOnly ? 0 : 0x01; if ( bAbsolute ) -- 1.7.3.4
_______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice