summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadek Doulik <rodo@novell.com>2011-05-04 17:37:26 +0200
committerC├ędric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2011-05-04 17:49:15 +0200
commit0920878d5f7965b8ea072f51d21bb9d21de5ba5c (patch)
tree8d7e436866a8b56585c5ca871cf21c3562aaaea0
parentac9fbf25dad680195005524902daeb5d48dc6c28 (diff)
wmf-mm-text.diff: Fix WMF rendering, n#417818
-rw-r--r--svtools/source/filter.vcl/wmf/winmtf.cxx21
-rw-r--r--svtools/source/filter.vcl/wmf/winmtf.hxx3
-rw-r--r--svtools/source/filter.vcl/wmf/winwmf.cxx1
3 files changed, 25 insertions, 0 deletions
diff --git a/svtools/source/filter.vcl/wmf/winmtf.cxx b/svtools/source/filter.vcl/wmf/winmtf.cxx
index 40635d9b61..cd3145d480 100644
--- a/svtools/source/filter.vcl/wmf/winmtf.cxx
+++ b/svtools/source/filter.vcl/wmf/winmtf.cxx
@@ -377,6 +377,14 @@ Point WinMtfOutput::ImplMap( const Point& rPt )
{
switch( mnMapMode )
{
+ case MM_TEXT:
+ fX2 -= mnWinOrgX;
+ fY2 -= mnWinOrgY;
+ fX2 *= 2540.0/mnUnitsPerInch;
+ fY2 *= 2540.0/mnUnitsPerInch;
+ fX2 += mnDevOrgX;
+ fY2 += mnDevOrgY;
+ break;
case MM_LOENGLISH :
{
fX2 -= mnWinOrgX;
@@ -452,6 +460,10 @@ Size WinMtfOutput::ImplMap( const Size& rSz )
{
switch( mnMapMode )
{
+ case MM_TEXT:
+ fWidth *= 2540.0/mnUnitsPerInch;
+ fHeight*= 2540.0/mnUnitsPerInch;
+ break;
case MM_LOENGLISH :
{
fWidth *= 25.40;
@@ -894,6 +906,7 @@ WinMtfOutput::WinMtfOutput( GDIMetaFile& rGDIMetaFile ) :
mbComplexClip ( false ),
mnGfxMode ( GM_COMPATIBLE ),
mnMapMode ( MM_TEXT ),
+ mnUnitsPerInch ( 96 ),
mnDevOrgX ( 0 ),
mnDevOrgY ( 0 ),
mnDevWidth ( 1 ),
@@ -2014,6 +2027,14 @@ void WinMtfOutput::SetMapMode( sal_uInt32 nMapMode )
//-----------------------------------------------------------------------------------
+void WinMtfOutput::SetUnitsPerInch( sal_uInt16 nUnitsPerInch )
+{
+ if( nUnitsPerInch != 0 )
+ mnUnitsPerInch = nUnitsPerInch;
+}
+
+//-----------------------------------------------------------------------------------
+
void WinMtfOutput::SetWorldTransform( const XForm& rXForm )
{
maXForm.eM11 = rXForm.eM11;
diff --git a/svtools/source/filter.vcl/wmf/winmtf.hxx b/svtools/source/filter.vcl/wmf/winmtf.hxx
index 76dcfd676e..d1f4e5b79e 100644
--- a/svtools/source/filter.vcl/wmf/winmtf.hxx
+++ b/svtools/source/filter.vcl/wmf/winmtf.hxx
@@ -582,6 +582,8 @@ class WinMtfOutput
sal_uInt32 mnGfxMode;
sal_uInt32 mnMapMode;
+ sal_uInt16 mnUnitsPerInch;
+
XForm maXForm;
sal_Int32 mnDevOrgX, mnDevOrgY;
sal_Int32 mnDevWidth, mnDevHeight;
@@ -628,6 +630,7 @@ class WinMtfOutput
sal_uInt32 GetMapMode() const { return mnMapMode; };
void SetMapMode( sal_uInt32 mnMapMode );
+ void SetUnitsPerInch( sal_uInt16 nUnitsPerInch );
void SetWorldTransform( const XForm& rXForm );
void ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode );
diff --git a/svtools/source/filter.vcl/wmf/winwmf.cxx b/svtools/source/filter.vcl/wmf/winwmf.cxx
index c5326335e3..42da2ac3e7 100644
--- a/svtools/source/filter.vcl/wmf/winwmf.cxx
+++ b/svtools/source/filter.vcl/wmf/winwmf.cxx
@@ -1044,6 +1044,7 @@ sal_Bool WMFReader::ReadHeader(WMF_APMFILEHEADER *pAPMHeader)
}
}
+ pOut->SetUnitsPerInch( nUnitsPerInch );
pOut->SetWinOrg( aPlaceableBound.TopLeft() );
aWMFSize = Size( labs( aPlaceableBound.GetWidth() ), labs( aPlaceableBound.GetHeight() ) );
pOut->SetWinExt( aWMFSize );