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


Hi,

I would be very happy if someone could take a look at the attached patch,
and maybe improve it.

Libo/OOo exports hyperlinks with / as directory separator. MS Office does
not understand that kind of paths, so / has to be rewritten to \

Description is here:
http://qa.openoffice.org/issues/show_bug.cgi?id=115297

-- 
Knut Olav Bøhmer
From b75385158bab3a4f60c1a07ceba2122e2e3f9625 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Knut=20Olav=20B=C3=B8hmer?= <bohmer@gmail.com>
Date: Fri, 29 Oct 2010 23:24:58 +0200
Subject: [PATCH] OOo bug 115297, WW8: Export of relative hyperlinks is in a non-portable format

---
 sw/source/filter/ww8/wrtw8nds.cxx |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 277387a..165f0d0 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -826,8 +826,10 @@ bool WW8AttributeOutput::AnalyzeURL( const String& rUrl, const String& rTarget,
     String sURL = *pLinkURL;
     String sMark = *pMark;
 
-    if ( sURL.Len() )
-        sURL = URIHelper::simpleNormalizedMakeRelative( m_rWW8Export.GetWriter().GetBaseURL(), 
sURL );
+    if ( sURL.Len() ){
+      sURL = URIHelper::simpleNormalizedMakeRelative( m_rWW8Export.GetWriter().GetBaseURL(), sURL 
);
+      sURL.SearchAndReplaceAll( '/', '\\' );
+    }
 
     if ( bBookMarkOnly )
         sURL = FieldString( ww::eHYPERLINK );
@@ -955,6 +957,9 @@ bool WW8AttributeOutput::StartURL( const String &rUrl, const String &rTarget )
             sURL.SearchAndReplaceAll( '/', '\\' );
         }
 
+       if ( sURL.EqualsAscii( "../", 0, 3 ) )
+            sURL.SearchAndReplaceAll( '/', '\\' );
+
         m_rWW8Export.pDataStrm->Write( MAGIC_C, sizeof(MAGIC_C) );
         SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, sURL.Len()+1 );
         SwWW8Writer::WriteString8( *m_rWW8Export.pDataStrm, sURL, true,
@@ -978,6 +983,9 @@ bool WW8AttributeOutput::StartURL( const String &rUrl, const String &rTarget )
             0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B
         };
 
+       if ( sURL.EqualsAscii( "../", 0, 3 ) )
+            sURL.SearchAndReplaceAll( '/', '\\' );
+
         m_rWW8Export.pDataStrm->Write( MAGIC_B, sizeof(MAGIC_B) );
         SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, 2 * ( sURL.Len() + 1 ) );
         SwWW8Writer::WriteString16( *m_rWW8Export.pDataStrm, sURL, true );
-- 
1.7.1


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.