[Libreoffice] Export hyperlinks to .doc

Cedric Bosdonnat cedric.bosdonnat.ooo at free.fr
Mon May 23 02:00:14 PDT 2011


Hello Knut,

Glad to see you around ;)

On Fri, 2011-05-20 at 13:48 +0200, Knut Olav Bøhmer wrote:
> 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.

Well, that means that the code you're patch is perfectly OK:
if bAbsolute contains the correct value matching the path relativness,
then the proper flag is exported (OR'ing 0x02 add the hlstmfIsAbsolute
flag)

>      if ( bAbsolute )
> -        nFlag |= 0x02;
> +        nFlag |= 0x00;

As said, this is really not the ideal solution... just imagine that for
some reason, we start writing both absolute and relative paths in
different cases, we would be fooled by this hack.

> But I guess a better patch would be (which I have not tested):

> 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;
>     
That's the same than the first one... are you sure you didn't make a
copy-paste error?

I'ld be more in favor of fixing the root cause of the problem (seemingly
the bAbsolute being set to true where it shouldn't)... but maybe that's
what you intended to post as the second patch ;)

-- 
Cédric Bosdonnat
LibreOffice hacker
http://documentfoundation.org
OOo Eclipse Integration developer
http://cedric.bosdonnat.free.fr



More information about the LibreOffice mailing list