You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by da...@apache.org on 2016/10/20 15:47:11 UTC

svn commit: r1765837 - /openoffice/trunk/main/sfx2/source/bastyp/mieclip.cxx

Author: damjan
Date: Thu Oct 20 15:47:11 2016
New Revision: 1765837

URL: http://svn.apache.org/viewvc?rev=1765837&view=rev
Log:
#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


Modified:
    openoffice/trunk/main/sfx2/source/bastyp/mieclip.cxx

Modified: openoffice/trunk/main/sfx2/source/bastyp/mieclip.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/bastyp/mieclip.cxx?rev=1765837&r1=1765836&r2=1765837&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/bastyp/mieclip.cxx (original)
+++ openoffice/trunk/main/sfx2/source/bastyp/mieclip.cxx Thu Oct 20 15:47:11 2016
@@ -44,7 +44,8 @@ SvStream* MSE40HTMLClipFormatObj::IsVali
 		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::IsVali
 			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;