[Libreoffice-commits] .: 2 commits - patches/dev300

Fridrich Strba fridrich at kemper.freedesktop.org
Fri Nov 26 05:45:27 PST 2010


 patches/dev300/apply                              |    2 
 patches/dev300/samba-hyperlinks-sc-sd.diff        |   83 ----------------
 patches/dev300/tools-urlobj-smb-scheme-patch.diff |  114 ----------------------
 3 files changed, 199 deletions(-)

New commits:
commit 27922f4acc5bfbc956f1b0d12b03c79c25415bf6
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Fri Nov 26 14:45:00 2010 +0100

    samba-hyperlinks-sc-sd.diff: migrated
    
    process relative SMB paths (in hyperlinks) correctly
    n#382718

diff --git a/patches/dev300/apply b/patches/dev300/apply
index dfdfc95..af9e999 100755
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -350,7 +350,6 @@ jpegc.c.diff, i#80674, n#272574, flr
 
 [ Fixes ]
 # process relative SMB paths (in hyperlinks) correctly
-samba-hyperlinks-sc-sd.diff, n#382718, jholesov
 tools-qa-urlobj-unittest.diff, n#261623, flr
 
 # check real help path defined in registry instead of the $(instpath)/help
diff --git a/patches/dev300/samba-hyperlinks-sc-sd.diff b/patches/dev300/samba-hyperlinks-sc-sd.diff
deleted file mode 100644
index 8f09b13..0000000
--- a/patches/dev300/samba-hyperlinks-sc-sd.diff
+++ /dev/null
@@ -1,83 +0,0 @@
----
- sc/source/filter/excel/xecontent.cxx |   10 +++++++++-
- sd/source/filter/eppt/epptso.cxx     |   11 ++++++++++-
- sd/source/filter/ppt/pptin.cxx       |    5 +++++
- 3 files changed, 24 insertions(+), 2 deletions(-)
-
-diff --git sc/source/filter/excel/xecontent.cxx sc/source/filter/excel/xecontent.cxx
-index 82aced9..c5c2620 100644
---- sc/source/filter/excel/xecontent.cxx
-+++ sc/source/filter/excel/xecontent.cxx
-@@ -409,12 +409,20 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU
-     }
- 
-     // file link or URL
--    if( eProtocol == INET_PROT_FILE )
-+    if( eProtocol == INET_PROT_FILE || eProtocol == INET_PROT_SMB )
-     {
-         sal_uInt16 nLevel;
-         bool bRel;
-         String aFileName( BuildFileName( nLevel, bRel, rUrl, rRoot ) );
- 
-+        if( eProtocol == INET_PROT_SMB )
-+        {
-+            // #n382718# (and #n261623#) Convert smb notation to '\\'
-+            aFileName = aUrlObj.GetMainURL( INetURLObject::NO_DECODE );
-+            aFileName = String( aFileName.GetBuffer() + 4 ); // skip the 'smb:' part
-+            aFileName.SearchAndReplaceAll( '/', '\\' );
-+        }
-+
-         if( !bRel )
-             mnFlags |= EXC_HLINK_ABS;
-         mnFlags |= EXC_HLINK_BODY;
-diff --git sd/source/filter/eppt/epptso.cxx sd/source/filter/eppt/epptso.cxx
-index c948353..d8121b2 100755
---- sd/source/filter/eppt/epptso.cxx
-+++ sd/source/filter/eppt/epptso.cxx
-@@ -3177,9 +3177,18 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u
-                             String aPageUrl;
-                             String aEmpty;
-                             String aFile( pFieldEntry->aFieldUrl );
-+                            String aTarget( pFieldEntry->aFieldUrl );
-                             INetURLObject aUrl( pFieldEntry->aFieldUrl );
-                             if ( INET_PROT_FILE == aUrl.GetProtocol() )
-                                 aFile = aUrl.PathToFileName();
-+                            else if ( INET_PROT_SMB == aUrl.GetProtocol() )
-+                            {
-+                                // #n382718# (and #n261623#) Convert smb notation to '\\'
-+                                aFile = aUrl.GetMainURL( INetURLObject::NO_DECODE );
-+                                aFile = String( aFile.GetBuffer() + 4 ); // skip the 'smb:' part
-+                                aFile.SearchAndReplaceAll( '/', '\\' );
-+                                aTarget = aFile;
-+                            }
-                             else if ( pFieldEntry->aFieldUrl.GetChar( 0 ) == '#' )
-                             {
-                                 String aPage( INetURLObject::decode( pFieldEntry->aFieldUrl, '%', INetURLObject::DECODE_WITH_CHARSET ) );
-@@ -3200,7 +3209,7 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u
-                             if ( aPageUrl.Len() )
-                                 nHyperId = ImplInsertBookmarkURL( aPageUrl, 1 | ( nPageIndex << 8 ) | ( 1 << 31 ), pFieldEntry->aRepresentation, aEmpty, aEmpty, aPageUrl );
-                             else
--                                nHyperId = ImplInsertBookmarkURL( pFieldEntry->aFieldUrl, 2 | ( nHyperId << 8 ), aFile, pFieldEntry->aFieldUrl, aEmpty, aEmpty );
-+                                nHyperId = ImplInsertBookmarkURL( pFieldEntry->aFieldUrl, 2 | ( nHyperId << 8 ), aFile, aTarget, aEmpty, aEmpty );
- 
-                             rOut << (sal_uInt32)( ( EPP_InteractiveInfo << 16 ) | 0xf ) << (sal_uInt32)24
-                                  << (sal_uInt32)( EPP_InteractiveInfoAtom << 16 ) << (sal_uInt32)16
-diff --git sd/source/filter/ppt/pptin.cxx sd/source/filter/ppt/pptin.cxx
-index 9d0fcc5..5209667 100755
---- sd/source/filter/ppt/pptin.cxx
-+++ sd/source/filter/ppt/pptin.cxx
-@@ -429,6 +429,11 @@ sal_Bool ImplSdPPTImport::Import()
-                                         aPropItem >> pHyperlink->nInfo;
-                                         if ( !aPropItem.Read( pHyperlink->aTarget, VT_EMPTY ) )
-                                             break;
-+
-+                                        // #n382718# (and #n261623#) Convert '\\' notation to 'smb://'
-+                                        INetURLObject aUrl( pHyperlink->aTarget, INET_PROT_FILE );
-+                                        pHyperlink->aTarget = aUrl.GetMainURL( INetURLObject::NO_DECODE );
-+
-                                         if ( !aPropItem.Read( pHyperlink->aSubAdress, VT_EMPTY ) )
-                                             break;
-                                         pHyperlink->nStartPos = pHyperlink->nEndPos = -1;
--- 
-1.7.0.1
-
commit 3fb764622b45bcee2b997a774589d842cb1fca4d
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Fri Nov 26 14:37:53 2010 +0100

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

diff --git a/patches/dev300/apply b/patches/dev300/apply
index b8e4003..dfdfc95 100755
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -350,7 +350,6 @@ jpegc.c.diff, i#80674, n#272574, flr
 
 [ Fixes ]
 # process relative SMB paths (in hyperlinks) correctly
-tools-urlobj-smb-scheme-patch.diff, n#261623, flr
 samba-hyperlinks-sc-sd.diff, n#382718, jholesov
 tools-qa-urlobj-unittest.diff, n#261623, flr
 
diff --git a/patches/dev300/tools-urlobj-smb-scheme-patch.diff b/patches/dev300/tools-urlobj-smb-scheme-patch.diff
deleted file mode 100644
index bf9f9b4..0000000
--- a/patches/dev300/tools-urlobj-smb-scheme-patch.diff
+++ /dev/null
@@ -1,114 +0,0 @@
----
- sw/source/filter/ww8/wrtw8nds.cxx |   13 ++++++++++-
- tools/inc/tools/urlobj.hxx        |    3 ++
- tools/source/fsys/urlobj.cxx      |   38 +++++++++++++++++++++++++++++++++++++
- 3 files changed, 52 insertions(+), 2 deletions(-)
-
-diff --git sw/source/filter/ww8/wrtw8nds.cxx sw/source/filter/ww8/wrtw8nds.cxx
-index d22decd..d923bb5 100644
---- sw/source/filter/ww8/wrtw8nds.cxx
-+++ sw/source/filter/ww8/wrtw8nds.cxx
-@@ -976,7 +976,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)
- 
-@@ -994,7 +994,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
-@@ -1008,6 +1008,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,
-diff --git tools/inc/tools/urlobj.hxx tools/inc/tools/urlobj.hxx
-index 05fe49f..e47127e 100644
---- tools/inc/tools/urlobj.hxx
-+++ tools/inc/tools/urlobj.hxx
-@@ -1532,6 +1532,9 @@ private:
- 
-     TOOLS_DLLPRIVATE static bool scanIPv6reference(
-         sal_Unicode const *& rBegin, sal_Unicode const * pEnd);
-+
-+private:
-+    void changeScheme(INetProtocol eTargetScheme);
- };
- 
- // static
-diff --git tools/source/fsys/urlobj.cxx tools/source/fsys/urlobj.cxx
-index 19d4737..81b94fa 100644
---- tools/source/fsys/urlobj.cxx
-+++ tools/source/fsys/urlobj.cxx
-@@ -1443,10 +1443,48 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef,
- 
-     m_aAbsURIRef = aSynAbsURIRef;
- 
-+    // At this point references of type "\\server\paths" have
-+    // been converted to file:://server/path".
-+#ifdef LINUX
-+    if (m_eScheme==INET_PROT_FILE && !m_aHost.isEmpty()) {
-+        // Change "file:://server/path" URIs to "smb:://server/path" on
-+        // Linux
-+        // Leave "file::path" URIs unchanged.
-+        changeScheme(INET_PROT_SMB);
-+    }
-+#endif
-+
-+#ifdef WIN
-+    if (m_eScheme==INET_PROT_SMB) {
-+        // Change "smb://server/path" URIs to "file://server/path"
-+        // URIs on Windows, since Windows doesn't understand the
-+        // SMB scheme.
-+        changeScheme(INET_PROT_FILE);
-+    }
-+#endif
-+
-     return true;
- }
- 
- //============================================================================
-+void INetURLObject::changeScheme(INetProtocol eTargetScheme) {
-+    ::rtl::OUString aTmpStr=m_aAbsURIRef.makeStringAndClear();
-+    int oldSchemeLen=strlen(getSchemeInfo().m_pScheme);
-+    m_eScheme=eTargetScheme;
-+    int newSchemeLen=strlen(getSchemeInfo().m_pScheme);
-+    m_aAbsURIRef.appendAscii(getSchemeInfo().m_pScheme);
-+    m_aAbsURIRef.append(aTmpStr.getStr()+oldSchemeLen);
-+    int delta=newSchemeLen-oldSchemeLen;
-+    m_aUser+=delta;
-+    m_aAuth+=delta;
-+    m_aHost+=delta;
-+    m_aPort+=delta;
-+    m_aPath+=delta;
-+    m_aQuery+=delta;
-+    m_aFragment+=delta;
-+}
-+
-+//============================================================================
- bool INetURLObject::convertRelToAbs(rtl::OUString const & rTheRelURIRef,
-                                     bool bOctets,
-                                     INetURLObject & rTheAbsURIRef,
--- 
-1.7.0.1
-


More information about the Libreoffice-commits mailing list