[Libreoffice-commits] .: sw/source

Fridrich Strba fridrich at kemper.freedesktop.org
Fri Nov 26 05:51:14 PST 2010


 sw/source/filter/ww8/wrtw8nds.cxx |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 3cec70e3ea40ce552e5d0303aee528ef78d0ae67
Author: Florian Reuter <freuter at novell.com>
Date:   Fri Nov 26 14:40:04 2010 +0100

    tools-urlobj-smb-scheme-patch.diff: migrated
    
    process relative SMB paths (in hyperlinks) correctly

diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 907a408..eea153d 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -923,7 +923,7 @@ bool WW8AttributeOutput::StartURL( const String &rUrl, const String &rTarget )
     SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, nFlag );
 
     INetProtocol eProto = aURL.GetProtocol();
-    if ( eProto == INET_PROT_FILE )
+    if ( eProto == INET_PROT_FILE || eProto == INET_PROT_SMB )
     {
         // version 1 (for a document)
 
@@ -941,7 +941,7 @@ bool WW8AttributeOutput::StartURL( const String &rUrl, const String &rTarget )
 
         // save the links to files as relative
         sURL = URIHelper::simpleNormalizedMakeRelative( m_rWW8Export.GetWriter().GetBaseURL(), sURL );
-        if ( sURL.EqualsAscii( "/", 0, 1 ) )
+        if ( eProto == INET_PROT_FILE && sURL.EqualsAscii( "/", 0, 1 ) )
             sURL = aURL.PathToFileName();
 
         // special case for the absolute windows names
@@ -955,6 +955,15 @@ bool WW8AttributeOutput::StartURL( const String &rUrl, const String &rTarget )
             sURL.SearchAndReplaceAll( '/', '\\' );
         }
 
+        // n#261623 convert smb notation to '\\'
+        const char pSmb[] = "smb://";
+        if ( eProto == INET_PROT_SMB &&
+             sURL.EqualsAscii( pSmb, 0, sizeof( pSmb ) - 1 ) )
+        {
+            sURL.Erase( 0, sizeof( pSmb ) - 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,


More information about the Libreoffice-commits mailing list