Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


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):

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

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.