vcl/source/filter/wmf/winmtf.cxx | 17 +++-------------- vcl/source/filter/wmf/winwmf.cxx | 37 ++++++++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 23 deletions(-)
New commits: commit d0855e3a4d874b76b64d219ba2737901621bda6a Author: Tomaž Vajngerl <tomaz.vajng...@collabora.com> Date: Thu Apr 24 18:46:48 2014 +0200 fdo#77089 if available, use ext. dimensions for non-placable WMF Change-Id: Idcfaa127ed6abed40d6eec7f81fbbfb36658cc91 diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx index d323d0f..a9a85c5 100644 --- a/vcl/source/filter/wmf/winwmf.cxx +++ b/vcl/source/filter/wmf/winwmf.cxx @@ -1132,19 +1132,22 @@ sal_Bool WMFReader::ReadHeader() else { nUnitsPerInch = 96; - pWMF->Seek( nStrmPos + 18 ); // set the streampos to the start of the metaactions - GetPlaceableBound( aPlaceableBound, pWMF ); - pWMF->Seek( nStrmPos ); - if ( pExternalHeader != NULL && ( pExternalHeader->mapMode == MM_ISOTROPIC - || pExternalHeader->mapMode == MM_ANISOTROPIC ) ) + if ( pExternalHeader != NULL && ( pExternalHeader->mapMode == MM_ISOTROPIC || pExternalHeader->mapMode == MM_ANISOTROPIC ) ) { // #n417818#: If we have an external header then overwrite the bounds! Rectangle aExtRect(0, 0, - pExternalHeader->xExt*567*nUnitsPerInch/1440/1000, - pExternalHeader->yExt*567*nUnitsPerInch/1440/1000); - GetWinExtMax( aExtRect, aPlaceableBound, pExternalHeader->mapMode ); + (double) pExternalHeader->xExt * 567 * nUnitsPerInch / 1440000, + (double) pExternalHeader->yExt * 567 * nUnitsPerInch / 1440000); + aPlaceableBound = aExtRect; pOut->SetMapMode( pExternalHeader->mapMode ); } + else + { + pWMF->Seek( nStrmPos + 18 ); // set the streampos to the start of the metaactions + GetPlaceableBound( aPlaceableBound, pWMF ); + } + + pWMF->Seek( nStrmPos ); } pOut->SetWinOrg( aPlaceableBound.TopLeft() ); @@ -1357,6 +1360,22 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt } break; + case W_META_SETVIEWPORTORG: + { + Point aWinOrg; + aWinOrg = ReadYX(); + rPlaceableBound.SetPos( aWinOrg ); + } + break; + + case W_META_SETVIEWPORTEXT: + { + sal_Int16 nWidth(0), nHeight(0); + *pStm >> nHeight >> nWidth; + rPlaceableBound.SetSize( Size( nWidth, nHeight ) ); + } + break; + case W_META_SETMAPMODE : *pStm >> nMapMode; break; @@ -1414,7 +1433,7 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt SAL_WARN_IF(!bRecordOk, "vcl.filter", "polypolygon record has more polygons than we can handle"); - bRecordOk &= pStm->good(); + bRecordOk = bRecordOk && pStm->good(); if (!bRecordOk) { commit 63dc30c49c5b560cff49ea69ac563dffa5b01a71 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.com> Date: Thu Apr 24 18:41:11 2014 +0200 fdo#77089 if font width 0, pass 0 - don't take it from font metric Conflicts: vcl/source/filter/wmf/winmtf.cxx Change-Id: I6c73da1d2470e75774affda836a8d587eebfbe4b diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx index 97eed0c..8bc853c 100644 --- a/vcl/source/filter/wmf/winmtf.cxx +++ b/vcl/source/filter/wmf/winmtf.cxx @@ -240,26 +240,15 @@ WinMtfFontStyle::WinMtfFontStyle( LOGFONTW& rFont ) aVDev.SetFont( aFont ); FontMetric aMetric( aVDev.GetFontMetric() ); long nHeight = aMetric.GetAscent() + aMetric.GetDescent(); - if ( nHeight ) + if (nHeight) { double fHeight = ((double)aFontSize.Height() * rFont.lfHeight ) / nHeight; aFontSize.Height() = (sal_Int32)( fHeight + 0.5 ); } } - else if ( aFontSize.Height() < 0 ) - aFontSize.Height() *= -1; - - if ( !rFont.lfWidth ) - { - // #i117968# VirtualDevice is not thread safe, but filter is used in multithreading - SolarMutexGuard aGuard; - VirtualDevice aVDev; - aFont.SetSize( aFontSize ); - aVDev.SetFont( aFont ); - FontMetric aMetric( aVDev.GetFontMetric() ); - aFontSize.Width() = aMetric.GetWidth(); - } + // Convert height to positive + aFontSize.Height() = std::abs(aFontSize.Height()); aFont.SetSize( aFontSize ); };
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits