From 20a8768b1c6a6a1456cda9cd096a304e16473fbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Fri, 4 May 2012 20:17:44 +0200 Subject: [PATCH] .docx wrap values mean different things than in LO, map them (bnc#750838) Change-Id: Ic355ae9993702c37c958ea16d8d97e6ef4892dcd --- writerfilter/source/dmapper/GraphicHelpers.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx b/writerfilter/source/dmapper/GraphicHelpers.cxx index 551c5e932099..31cded9aef89 100644 --- a/writerfilter/source/dmapper/GraphicHelpers.cxx +++ b/writerfilter/source/dmapper/GraphicHelpers.cxx @@ -184,12 +184,16 @@ void WrapHandler::lcl_sprm( Sprm& ) sal_Int32 WrapHandler::getWrapMode( ) { - sal_Int32 nMode = com::sun::star::text::WrapTextMode_NONE; + // The wrap values do not map directly to our wrap mode, + // e.g. none in .docx actually means through in LO. + sal_Int32 nMode = com::sun::star::text::WrapTextMode_THROUGHT; switch ( m_nType ) { case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapType_square: + // through and tight are somewhat complicated, approximate case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapType_tight: + case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapType_through: { switch ( m_nSide ) { @@ -204,13 +208,13 @@ sal_Int32 WrapHandler::getWrapMode( ) } } break; - case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapType_through: - nMode = com::sun::star::text::WrapTextMode_THROUGHT; break; case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapType_topAndBottom: + nMode = com::sun::star::text::WrapTextMode_NONE; + break; case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapType_none: default: - nMode = com::sun::star::text::WrapTextMode_NONE; + nMode = com::sun::star::text::WrapTextMode_THROUGHT; } return nMode;