[Libreoffice] [REVIEW] - One line patche - Export hyperlinks to .doc

Knut Olav Bøhmer bohmer at gmail.com
Sun May 22 14:36:53 PDT 2011


Hi,

Related to this bug.
http://openoffice.org/bugzilla/show_bug.cgi?id=115297

2011/5/20 Knut Olav Bøhmer <bohmer at gmail.com>

> Hi,
>
> Exporting hyperlinks to .doc is done wrong in LibreOffice Writer. There is
> a flag (hlstmfIsAbsolute) that is set to 1. It should be 0, because all
> links are exported relative.
>
>
> Before I make a patch, give me input on this.
>
> B - hlstmfIsAbsolute (1 bit): A bit that specifies whether this hyperlink
> is an absolute path or
> relative path.
> Value Meaning
> 0 This hyperlink is a relative path.
> 1 This hyperlink is an absolute path.
>
> The patch I have used for some time, that works for me and some hundred
> users is:
>
> diff --git a/sw/source/filter/ww8/wrtw8nds.cxx
> b/sw/source/filter/ww8/wrtw8nds.cxx
> index 4db4999..d5f7327 100644
> --- a/sw/source/filter/ww8/wrtw8nds.cxx
> +++ b/sw/source/filter/ww8/wrtw8nds.cxx
> @@ -918,7 +918,7 @@ bool WW8AttributeOutput::StartURL( const String &rUrl,
> const String &rTarget )
>      SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, 0x00000002);
>      sal_uInt32 nFlag = bBookMarkOnly ? 0 : 0x01;
>      if ( bAbsolute )
> -        nFlag |= 0x02;
> +        nFlag |= 0x00;
>      if ( sMark.Len() )
>          nFlag |= 0x08;
>      SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, nFlag );
>
>
> But I guess a better patch would be (which I have not tested):
>

The following was suppose to do
     if ( !bAbsolute )
 insted of
     if ( bAbsolute )


> diff --git a/sw/source/filter/ww8/wrtw8nds.cxx
> b/sw/source/filter/ww8/wrtw8nds.cxx
> index 4db4999..d5f7327 100644
> --- a/sw/source/filter/ww8/wrtw8nds.cxx
> +++ b/sw/source/filter/ww8/wrtw8nds.cxx
> @@ -918,7 +918,7 @@ bool WW8AttributeOutput::StartURL( const String &rUrl,
> const String &rTarget )
>      SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, 0x00000002);
>      sal_uInt32 nFlag = bBookMarkOnly ? 0 : 0x01;
>      if ( bAbsolute )
> -        nFlag |= 0x02;
> +        nFlag |= 0x00;
>      if ( sMark.Len() )
>          nFlag |= 0x08;
>      SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, nFlag );
>
>
> Anyway, this is very easy to test for anyone.
> 1. Create a document with a hyperlink.
> 2. Save it as .doc
> 3. Open it in MS Word
> 4. Ctrl Click on the link
> 5 and, look.. It does not work
>
> 6. Apply my patch
> 7. repeat point 1,2,3,4
> 8. and look.. It works :)
>
>
>
> --
> Knut Olav Bøhmer
>



-- 
Knut Olav Bøhmer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110522/7c2e8610/attachment.html>


More information about the LibreOffice mailing list