[ooo-build-commit] patches/dev300

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Mon Sep 21 03:23:56 PDT 2009


 patches/dev300/apply                    |    1 
 patches/dev300/external-apm-header.diff |  246 ++++++++++++++++++++++++++++++++
 2 files changed, 247 insertions(+)

New commits:
commit 3ffc67f8027a5b75c7bebb949046a4ce9cdb2dfd
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Mon Sep 21 12:23:32 2009 +0200

    Added uncommitted patch from Florian
    
    * patches/dev300/apply:
    * patches/dev300/external-apm-header.diff:

diff --git a/patches/dev300/apply b/patches/dev300/apply
index fc424df..1322611 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -3215,6 +3215,7 @@ cws-ooxml03-enable-docx.diff
 # oox-calc-export-row-limit.diff, n#504623, janneke.
 
 [ Fixes ]
+external-apm-header.diff, freuter
 wmf-mm-text.diff, n#417818, rodo
 wmf-mm-text-1.diff, n#417818, rodo
 sd-create-table-height-fix.diff, i#100275, thorsten
diff --git a/patches/dev300/external-apm-header.diff b/patches/dev300/external-apm-header.diff
new file mode 100644
index 0000000..2319c46
--- /dev/null
+++ b/patches/dev300/external-apm-header.diff
@@ -0,0 +1,246 @@
+diff --git svtools/inc/svtools/filter.hxx svtools/inc/svtools/filter.hxx
+index 4f33b66..177db61 100644
+--- svtools/inc/svtools/filter.hxx
++++ svtools/inc/svtools/filter.hxx
+@@ -41,6 +41,7 @@
+ #include <com/sun/star/uno/Sequence.h>
+ #include <com/sun/star/beans/PropertyValue.hpp>
+ 
++struct WMF_APMFILEHEADER;
+ // -----------------------
+ // - GraphicFilter-Types -
+ // -----------------------
+@@ -392,13 +393,15 @@ public:
+ 	USHORT          ImportGraphic( Graphic& rGraphic, const String& rPath,
+ 								   SvStream& rStream,
+ 								   USHORT nFormat = GRFILTER_FORMAT_DONTKNOW,
+-								   USHORT * pDeterminedFormat = NULL, sal_uInt32 nImportFlags = 0 );
++								   USHORT * pDeterminedFormat = NULL, sal_uInt32 nImportFlags = 0
++				       , WMF_APMFILEHEADER *pAPMHeader = NULL);
+ 
+ 	USHORT          ImportGraphic( Graphic& rGraphic, const String& rPath,
+ 								   SvStream& rStream,
+ 								   USHORT nFormat,
+ 								   USHORT * pDeterminedFormat, sal_uInt32 nImportFlags,
+-								   com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData );
++								   com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData
++				       , WMF_APMFILEHEADER *pAPMHeader = NULL);
+ 
+ 	BOOL            Setup( USHORT nFormat );
+ 
+diff --git svtools/inc/svtools/wmf.hxx svtools/inc/svtools/wmf.hxx
+index 68a4c4f..d3dc61d 100644
+--- svtools/inc/svtools/wmf.hxx
++++ svtools/inc/svtools/wmf.hxx
+@@ -34,7 +34,30 @@
+ #include "svtools/svtdllapi.h"
+ #include <svtools/fltcall.hxx>
+ 
+-BOOL ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem = NULL );
++struct WMF_APMFILEHEADER {
++  sal_uInt32 key;
++  sal_uInt16 hmf;
++  sal_uInt16 left;
++  sal_uInt16 top;
++  sal_uInt16 right;
++  sal_uInt16 bottom;
++  sal_uInt16 inch;
++  sal_uInt32 reserved;
++  sal_uInt16 checksum;
++
++  WMF_APMFILEHEADER() : key(0x9ac6cdd7L),
++		    hmf(0),
++		    left(0),
++		    top(0),
++		    right(0),
++		    bottom(0),
++		    inch(96),
++		    reserved(0),
++		    checksum(0) {
++  }
++};
++
++BOOL ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem = NULL, WMF_APMFILEHEADER *pAPMHeader = NULL );
+ 
+ SVT_DLLPUBLIC BOOL ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF, FilterConfigItem* pConfigItem );
+ 
+diff --git svtools/source/filter.vcl/filter/filter.cxx svtools/source/filter.vcl/filter/filter.cxx
+index db14402..14c9ea4 100644
+--- svtools/source/filter.vcl/filter/filter.cxx
++++ svtools/source/filter.vcl/filter/filter.cxx
+@@ -1276,17 +1276,17 @@ USHORT GraphicFilter::ImportGraphic( Graphic& rGraphic, const INetURLObject& rPa
+ 	return nRetValue;
+ }
+ 
+-USHORT GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvStream& rIStream,
+-									 USHORT nFormat, USHORT* pDeterminedFormat, sal_uInt32 nImportFlags )
++USHORT GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvStream& rIStream, USHORT nFormat, USHORT* pDeterminedFormat, sal_uInt32 nImportFlags, WMF_APMFILEHEADER *pAPMHeader )
+ {
+-	return ImportGraphic( rGraphic, rPath, rIStream, nFormat, pDeterminedFormat, nImportFlags, NULL );
++  return ImportGraphic( rGraphic, rPath, rIStream, nFormat, pDeterminedFormat, nImportFlags, NULL, pAPMHeader );
+ }
+ 
+ //-------------------------------------------------------------------------
+ 
+ USHORT GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvStream& rIStream,
+ 									 USHORT nFormat, USHORT* pDeterminedFormat, sal_uInt32 nImportFlags,
+-									 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData )
++									 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData 
++				     , WMF_APMFILEHEADER *pAPMHeader)
+ {
+ 	String					aFilterName;
+ 	ULONG					nStmBegin;
+@@ -1483,7 +1483,7 @@ USHORT GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvS
+ 				aFilterName.EqualsIgnoreCaseAscii( IMP_EMF ) )
+ 		{
+ 			GDIMetaFile aMtf;
+-			if( !ConvertWMFToGDIMetaFile( rIStream, aMtf, NULL ) )
++			if( !ConvertWMFToGDIMetaFile( rIStream, aMtf, NULL, pAPMHeader ) )
+ 				nStatus = GRFILTER_FORMATERROR;
+ 			else
+ 			{
+diff --git svtools/source/filter.vcl/wmf/winmtf.hxx svtools/source/filter.vcl/wmf/winmtf.hxx
+index f4ac2d4..9253169 100644
+--- svtools/source/filter.vcl/wmf/winmtf.hxx
++++ svtools/source/filter.vcl/wmf/winmtf.hxx
+@@ -162,6 +162,7 @@ struct LOGFONTW
+ 	BYTE		lfPitchAndFamily;
+ 	String		alfFaceName;
+ };
++struct WMF_APMFILEHEADER;
+ 
+ #define TA_NOUPDATECP			0x0000
+ #define TA_UPDATECP				0x0001
+@@ -765,7 +766,7 @@ private:
+ 	sal_uInt32		nUnicodeEscapeAction;
+ 
+ 	// Liesst den Kopf der WMF-Datei
+-	BOOL			ReadHeader();
++	BOOL			ReadHeader(WMF_APMFILEHEADER *pAPMHeader);
+ 
+ 	// Liesst die Parameter des Rocords mit der Funktionsnummer nFunction.
+ 	void			ReadRecordParams( USHORT nFunction );
+@@ -782,7 +783,7 @@ public:
+ 						: WinMtf( new WinMtfOutput( rGDIMetaFile ), rStreamWMF, pConfigItem ) {};
+ 
+ 	// Liesst aus dem Stream eine WMF-Datei und fuellt das GDIMetaFile
+-	void			ReadWMF();
++	void			ReadWMF(WMF_APMFILEHEADER *pAPMHeader=NULL);
+ };
+ 
+ #endif
+diff --git svtools/source/filter.vcl/wmf/winwmf.cxx svtools/source/filter.vcl/wmf/winwmf.cxx
+index 9db828c..fda0b81 100644
+--- svtools/source/filter.vcl/wmf/winwmf.cxx
++++ svtools/source/filter.vcl/wmf/winwmf.cxx
+@@ -32,6 +32,7 @@
+ #include "precompiled_svtools.hxx"
+ 
+ #include "winmtf.hxx"
++#include <svtools/wmf.hxx>
+ #include <rtl/crc.h>
+ #include <rtl/tencinfo.h>
+ #include <osl/endian.h>
+@@ -938,7 +939,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc )
+ 
+ // ------------------------------------------------------------------------
+ 
+-BOOL WMFReader::ReadHeader()
++BOOL WMFReader::ReadHeader(WMF_APMFILEHEADER *pAPMHeader)
+ {
+ 	Rectangle	aPlaceableBound;
+ 	sal_uInt32  nl, nStrmPos = pWMF->Tell();
+@@ -971,11 +972,18 @@ BOOL WMFReader::ReadHeader()
+     }
+ 	else
+ 	{
+-		nUnitsPerInch = 96;       
+-        pWMF->Seek( nStrmPos + 18 );    // set the streampos to the start of the the metaactions
+-        GetPlaceableBound( aPlaceableBound, pWMF );
+-        pWMF->Seek( nStrmPos );
+-	}
++	  nUnitsPerInch = (pAPMHeader!=NULL?pAPMHeader->inch:96);
++	  pWMF->Seek( nStrmPos + 18 );    // set the streampos to the start of the the metaactions
++	  GetPlaceableBound( aPlaceableBound, pWMF );
++	  pWMF->Seek( nStrmPos );
++	  if (pAPMHeader!=NULL) { 
++	    // #n417818#: If we have an external header then overwrite the bounds!
++	    aPlaceableBound=Rectangle(pAPMHeader->left*567*nUnitsPerInch/1440/1000,
++				      pAPMHeader->top*567*nUnitsPerInch/1440/1000,
++				      pAPMHeader->right*567*nUnitsPerInch/1440/1000, 
++				      pAPMHeader->bottom*567*nUnitsPerInch/1440/1000);
++	  }
++	}	
+ 
+ 	pOut->SetUnitsPerInch( nUnitsPerInch );
+     pOut->SetWinOrg( aPlaceableBound.TopLeft() );
+@@ -1010,7 +1018,7 @@ BOOL WMFReader::ReadHeader()
+ 	return TRUE;
+ }
+ 
+-void WMFReader::ReadWMF()
++void WMFReader::ReadWMF(WMF_APMFILEHEADER *pAPMHeader)
+ {
+ 	USHORT	nFunction;
+ 	ULONG	nPos, nPercent, nLastPercent;
+@@ -1028,7 +1036,7 @@ void WMFReader::ReadWMF()
+ 	pWMF->Seek( nStartPos );
+ 	Callback( (USHORT) ( nLastPercent = 0 ) );
+ 
+-	if ( ReadHeader() )
++	if ( ReadHeader( pAPMHeader ) )
+ 	{
+ 
+ 		nPos = pWMF->Tell();
+diff --git svtools/source/filter.vcl/wmf/wmf.cxx svtools/source/filter.vcl/wmf/wmf.cxx
+index 4654864..9e3e258 100644
+--- svtools/source/filter.vcl/wmf/wmf.cxx
++++ svtools/source/filter.vcl/wmf/wmf.cxx
+@@ -38,7 +38,7 @@
+ 
+ // -----------------------------------------------------------------------------
+ 
+-BOOL ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem )
++BOOL ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem, WMF_APMFILEHEADER *pAPMHeader )
+ {
+ 	UINT32 nMetaType;
+ 	UINT32 nOrgPos = rStreamWMF.Tell();
+@@ -54,7 +54,7 @@ BOOL ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile,
+ 	}
+ 	else
+ 	{
+-		WMFReader( rStreamWMF, rGDIMetaFile, pConfigItem ).ReadWMF();
++		WMFReader( rStreamWMF, rGDIMetaFile, pConfigItem ).ReadWMF( pAPMHeader );
+ 	}
+ 	rStreamWMF.SetNumberFormatInt( nOrigNumberFormat );
+ 	return !rStreamWMF.GetError();
+diff --git svx/source/svrtf/rtfgrf.cxx svx/source/svrtf/rtfgrf.cxx
+index ddddab8..587a4ce 100644
+--- svx/source/svrtf/rtfgrf.cxx
++++ svx/source/svrtf/rtfgrf.cxx
+@@ -39,6 +39,7 @@
+ #include <svtools/rtfkeywd.hxx>
+ #include <svtools/rtftoken.h>
+ #include <svtools/filter.hxx>
++#include <svtools/wmf.hxx>
+ 
+ #include "impgrf.hxx"
+ #include "svxrtf.hxx"
+@@ -508,9 +509,15 @@ BOOL SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType )
+ 			}
+ 
+ 			String sTmpStr;
++			WMF_APMFILEHEADER aAPMHeader;
++			aAPMHeader.left=0;
++			aAPMHeader.top=0;
++			aAPMHeader.right=rPicType.nWidth;
++			aAPMHeader.bottom=rPicType.nHeight;
++			
++			WMF_APMFILEHEADER *pAPMHeader=(aAPMHeader.right>0 && aAPMHeader.bottom>0?&aAPMHeader:NULL);
+ 			pTmpFile->Seek( STREAM_SEEK_TO_BEGIN );
+-			bValidBmp = 0 == pGF->ImportGraphic( rGrf, sTmpStr, *pTmpFile,
+-												nImportFilter );
++			bValidBmp = 0 == pGF->ImportGraphic( rGrf, sTmpStr, *pTmpFile, nImportFilter, NULL, 0, pAPMHeader );
+ 		}
+ 		delete pTmpFile;
+ 	}


More information about the ooo-build-commit mailing list