summaryrefslogtreecommitdiff
path: root/svtools/source
diff options
context:
space:
mode:
Diffstat (limited to 'svtools/source')
-rw-r--r--svtools/source/filter.vcl/filter/filter.cxx10
-rw-r--r--svtools/source/filter.vcl/wmf/winmtf.hxx5
-rw-r--r--svtools/source/filter.vcl/wmf/winwmf.cxx22
-rw-r--r--svtools/source/filter.vcl/wmf/wmf.cxx4
4 files changed, 25 insertions, 16 deletions
diff --git a/svtools/source/filter.vcl/filter/filter.cxx b/svtools/source/filter.vcl/filter/filter.cxx
index 5ea07d2017f2..00bddb4fc221 100644
--- a/svtools/source/filter.vcl/filter/filter.cxx
+++ b/svtools/source/filter.vcl/filter/filter.cxx
@@ -1303,17 +1303,17 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const INetURLObject&
return nRetValue;
}
-sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvStream& rIStream,
- sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat, sal_uInt32 nImportFlags )
+sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvStream& rIStream, sal_uInt16 nFormat, sal_uInt16* 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 );
}
//-------------------------------------------------------------------------
sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvStream& rIStream,
sal_uInt16 nFormat, sal_uInt16* 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;
sal_uLong nStmBegin;
@@ -1510,7 +1510,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath,
aFilterName.EqualsIgnoreCaseAscii( IMP_EMF ) )
{
GDIMetaFile aMtf;
- if( !ConvertWMFToGDIMetaFile( rIStream, aMtf, NULL ) )
+ if( !ConvertWMFToGDIMetaFile( rIStream, aMtf, NULL, pAPMHeader ) )
nStatus = GRFILTER_FORMATERROR;
else
{
diff --git a/svtools/source/filter.vcl/wmf/winmtf.hxx b/svtools/source/filter.vcl/wmf/winmtf.hxx
index d0b4e42cbed4..25551716e091 100644
--- a/svtools/source/filter.vcl/wmf/winmtf.hxx
+++ b/svtools/source/filter.vcl/wmf/winmtf.hxx
@@ -157,6 +157,7 @@ struct LOGFONTW
sal_uInt8 lfPitchAndFamily;
String alfFaceName;
};
+struct WMF_APMFILEHEADER;
#define TA_NOUPDATECP 0x0000
#define TA_UPDATECP 0x0001
@@ -770,7 +771,7 @@ private:
sal_uInt32 nUnicodeEscapeAction;
// Liesst den Kopf der WMF-Datei
- sal_Bool ReadHeader();
+ sal_Bool ReadHeader(WMF_APMFILEHEADER *pAPMHeader);
// Liesst die Parameter des Rocords mit der Funktionsnummer nFunction.
void ReadRecordParams( sal_uInt16 nFunction );
@@ -791,7 +792,7 @@ public:
~WMFReader();
// Liesst aus dem Stream eine WMF-Datei und fuellt das GDIMetaFile
- void ReadWMF();
+ void ReadWMF(WMF_APMFILEHEADER *pAPMHeader=NULL);
};
#endif
diff --git a/svtools/source/filter.vcl/wmf/winwmf.cxx b/svtools/source/filter.vcl/wmf/winwmf.cxx
index 095b1c45eb68..a794da5b3274 100644
--- a/svtools/source/filter.vcl/wmf/winwmf.cxx
+++ b/svtools/source/filter.vcl/wmf/winwmf.cxx
@@ -31,6 +31,7 @@
#include "winmtf.hxx"
#include <vcl/gdimtf.hxx>
+#include <svtools/wmf.hxx>
#include <rtl/crc.h>
#include <rtl/tencinfo.h>
#include <osl/endian.h>
@@ -997,7 +998,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
// ------------------------------------------------------------------------
-sal_Bool WMFReader::ReadHeader()
+sal_Bool WMFReader::ReadHeader(WMF_APMFILEHEADER *pAPMHeader)
{
Rectangle aPlaceableBound;
sal_uInt32 nl, nStrmPos = pWMF->Tell();
@@ -1030,10 +1031,17 @@ sal_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 );
@@ -1069,7 +1077,7 @@ sal_Bool WMFReader::ReadHeader()
return sal_True;
}
-void WMFReader::ReadWMF()
+void WMFReader::ReadWMF(WMF_APMFILEHEADER *pAPMHeader)
{
sal_uInt16 nFunction;
sal_uLong nPos, nPercent, nLastPercent;
@@ -1094,7 +1102,7 @@ void WMFReader::ReadWMF()
pWMF->Seek( nStartPos );
Callback( (sal_uInt16) ( nLastPercent = 0 ) );
- if ( ReadHeader() )
+ if ( ReadHeader( pAPMHeader ) )
{
nPos = pWMF->Tell();
diff --git a/svtools/source/filter.vcl/wmf/wmf.cxx b/svtools/source/filter.vcl/wmf/wmf.cxx
index d78ce2d160bb..9b2a8edf2d6e 100644
--- a/svtools/source/filter.vcl/wmf/wmf.cxx
+++ b/svtools/source/filter.vcl/wmf/wmf.cxx
@@ -36,7 +36,7 @@
// -----------------------------------------------------------------------------
-sal_Bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem )
+sal_Bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem, WMF_APMFILEHEADER *pAPMHeader )
{
sal_uInt32 nMetaType;
sal_uInt32 nOrgPos = rStreamWMF.Tell();
@@ -52,7 +52,7 @@ sal_Bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaF
}
else
{
- WMFReader( rStreamWMF, rGDIMetaFile, pConfigItem ).ReadWMF();
+ WMFReader( rStreamWMF, rGDIMetaFile, pConfigItem ).ReadWMF( pAPMHeader );
}
rStreamWMF.SetNumberFormatInt( nOrigNumberFormat );
return !rStreamWMF.GetError();