diff options
author | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2011-11-24 15:05:25 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2011-11-24 16:08:46 +0100 |
commit | f4f4a899f0d5520a497bbd07ccfef9086c54ca1c (patch) | |
tree | 06c378dc6f5596f90dbfb3f1508c1630be838d2a /writerfilter | |
parent | 616db52655b65201e60f53deb3a063b0fdd7cc6b (diff) |
RTF import: partly fixed the WMF images scaling.
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/rtftok/rtfcontrolwords.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 19 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.hxx | 1 |
3 files changed, 20 insertions, 2 deletions
diff --git a/writerfilter/source/rtftok/rtfcontrolwords.cxx b/writerfilter/source/rtftok/rtfcontrolwords.cxx index aef56ab77962..3b82e8065f50 100644 --- a/writerfilter/source/rtftok/rtfcontrolwords.cxx +++ b/writerfilter/source/rtftok/rtfcontrolwords.cxx @@ -1184,6 +1184,7 @@ RTFSymbol aRTFControlWords[] = { {"piccropt", CONTROL_VALUE, RTF_PICCROPT}, {"pich", CONTROL_VALUE, RTF_PICH}, {"pichgoal", CONTROL_VALUE, RTF_PICHGOAL}, + {"pichGoal", CONTROL_VALUE, RTF_PICHGOAL}, {"picprop", CONTROL_DESTINATION, RTF_PICPROP}, {"picscaled", CONTROL_FLAG, RTF_PICSCALED}, {"picscalex", CONTROL_VALUE, RTF_PICSCALEX}, @@ -1191,6 +1192,7 @@ RTFSymbol aRTFControlWords[] = { {"pict", CONTROL_DESTINATION, RTF_PICT}, {"picw", CONTROL_VALUE, RTF_PICW}, {"picwgoal", CONTROL_VALUE, RTF_PICWGOAL}, + {"picwGoal", CONTROL_VALUE, RTF_PICWGOAL}, {"pindtabqc", CONTROL_FLAG, RTF_PINDTABQC}, {"pindtabql", CONTROL_FLAG, RTF_PINDTABQL}, {"pindtabqr", CONTROL_FLAG, RTF_PINDTABQR}, diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 2e31bc7f32bf..bd1636d46fc5 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -36,6 +36,7 @@ #include <com/sun/star/text/RelOrientation.hpp> #include <editeng/borderline.hxx> #include <rtl/tencinfo.h> +#include <svtools/wmf.hxx> #include <svl/lngmisc.hxx> #include <unotools/ucbstreamhelper.hxx> #include <unotools/streamwrap.hxx> @@ -570,7 +571,11 @@ int RTFDocumentImpl::resolvePict(bool bInline) // Store, and get its URL. aStream.Seek(0); uno::Reference<io::XInputStream> xInputStream(new utl::OInputStreamWrapper(&aStream)); - OUString aGraphicUrl = m_pGraphicHelper->importGraphicObject(xInputStream); + WMF_EXTERNALHEADER aExtHeader; + aExtHeader.mapMode = m_aStates.top().aPicture.eWMetafile; + aExtHeader.xExt = m_aStates.top().aPicture.nWidth; + aExtHeader.yExt = m_aStates.top().aPicture.nHeight; + OUString aGraphicUrl = m_pGraphicHelper->importGraphicObject(xInputStream, &aExtHeader); // Wrap it in an XShape. uno::Reference<drawing::XShape> xShape; @@ -599,6 +604,12 @@ int RTFDocumentImpl::resolvePict(bool bInline) uno::Reference<graphic::XGraphic> xGraphic = xGraphicProvider->queryGraphic(aMediaProperties); xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Graphic")), uno::Any(xGraphic)); + // Set the object size + awt::Size aSize; + aSize.Width = (m_aStates.top().aPicture.nGoalWidth ? m_aStates.top().aPicture.nGoalWidth : m_aStates.top().aPicture.nWidth); + aSize.Height = (m_aStates.top().aPicture.nGoalHeight ? m_aStates.top().aPicture.nGoalHeight : m_aStates.top().aPicture.nHeight); + xShape->setSize( aSize ); + RTFValue::Pointer_t pShapeValue(new RTFValue(xShape)); m_aObjectAttributes->push_back(make_pair(NS_ooxml::LN_shape, pShapeValue)); return 0; @@ -2524,6 +2535,9 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) case RTF_FLYANCHOR: m_aStates.top().aFrame.nAnchorType = nParam; break; + case RTF_WMETAFILE: + m_aStates.top().aPicture.eWMetafile = nParam; + break; default: #if OSL_DEBUG_LEVEL > 1 OSL_TRACE("%s: TODO handle value '%s'", OSL_THIS_FUNC, lcl_RtfToString(nKeyword)); @@ -3227,7 +3241,8 @@ RTFPicture::RTFPicture() nCropT(0), nCropB(0), nCropL(0), - nCropR(0) + nCropR(0), + eWMetafile(0) { } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index ef333596d5c7..d0aa294e7f3d 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -182,6 +182,7 @@ namespace writerfilter { sal_uInt16 nGoalWidth, nGoalHeight; sal_uInt16 nScaleX, nScaleY; short nCropT, nCropB, nCropL, nCropR; + sal_uInt16 eWMetafile; }; /// Stores the properties of a frame |