[Libreoffice-commits] core.git: Branch 'aoo/trunk' - sfx2/source

Damjan Jovanovic damjan at apache.org
Thu Oct 20 16:26:42 UTC 2016


 sfx2/source/bastyp/mieclip.cxx |   23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

New commits:
commit ae698a63b640b708a41022fdc39ef8ec7c76d3cd
Author: Damjan Jovanovic <damjan at apache.org>
Date:   Thu Oct 20 15:47:11 2016 +0000

    #i83004# cannot paste HTML data from any Java application via clipboard
    
    Allow StartHTML and EndHTML values in the Windows clipboard's
    "HTML Format" to be -1, and use StartFragment and EndFragment instead
    when they are. Excel allows -1, as does Mozilla since 2011, so we
    really should too. Java has been providing >= 0 for a while now, but
    we should still support -1 in case any other applications use it.
    
    Patch by: me

diff --git a/sfx2/source/bastyp/mieclip.cxx b/sfx2/source/bastyp/mieclip.cxx
index bcea749..8a7038b 100644
--- a/sfx2/source/bastyp/mieclip.cxx
+++ b/sfx2/source/bastyp/mieclip.cxx
@@ -44,7 +44,8 @@ SvStream* MSE40HTMLClipFormatObj::IsValid( SvStream& rStream )
         delete pStrm, pStrm = 0;
 
     ByteString sLine, sVersion;
-    sal_uIntPtr nStt = 0, nEnd = 0;
+    sal_Int32 nStt = -1, nEnd = -1;
+    sal_Int32 nStartFragment = 0, nEndFragment = 0;
     sal_uInt16 nIndex = 0;
 
     rStream.Seek(STREAM_SEEK_TO_BEGIN);
@@ -59,14 +60,26 @@ SvStream* MSE40HTMLClipFormatObj::IsValid( SvStream& rStream )
             nIndex = 0;
             ByteString sTmp( sLine.GetToken( 0, ':', nIndex ) );
             if( sTmp == "StartHTML" )
-                nStt = (sal_uIntPtr)(sLine.Erase( 0, nIndex ).ToInt32());
+                nStt = sLine.Erase( 0, nIndex ).ToInt32();
             else if( sTmp == "EndHTML" )
-                nEnd = (sal_uIntPtr)(sLine.Erase( 0, nIndex ).ToInt32());
+                nEnd = sLine.Erase( 0, nIndex ).ToInt32();
+            else if( sTmp == "StartFragment" )
+            {
+                nStartFragment = sLine.Erase( 0, nIndex ).ToInt32();
+                if( nStt == -1 )
+                    nStt = nStartFragment;
+            }
+            else if( sTmp == "EndFragment" )
+            {
+                nEndFragment = sLine.Erase( 0, nIndex ).ToInt32();
+                if (nEnd == -1 )
+                    nEnd = nEndFragment;
+            }
             else if( sTmp == "SourceURL" )
                 sBaseURL = String( sLine.Erase( 0, nIndex ), RTL_TEXTENCODING_UTF8);
 
-            if( nEnd && nStt &&
-                ( sBaseURL.Len() || rStream.Tell() >= nStt ))
+            if( nEnd >= 0 && nStt >= 0 &&
+                ( sBaseURL.Len() || rStream.Tell() >= (sal_uInt32)nStt ))
             {
                 bRet = sal_True;
                 break;


More information about the Libreoffice-commits mailing list