writerfilter/source/dmapper/CellMarginHandler.cxx | 2 +- writerfilter/source/dmapper/ConversionHelper.cxx | 10 ++++++++-- writerfilter/source/dmapper/ConversionHelper.hxx | 1 + 3 files changed, 10 insertions(+), 3 deletions(-)
New commits: commit 4fe112281b30c7ad2a18a15465d316a4e8be588e Author: LuboÅ¡ LuÅák <l.lu...@collabora.com> Date: Wed Mar 26 17:28:51 2014 +0100 apparently some table .docx properties shouldn't be < 0 Somewhat related to 10b4da63e3143108ba75891e9e98fdaa2f7953ab , a similar doc has negative value inside w:tblCellMar, which MSO seems to ignore (altering the value has no visible effect), so ignore it as well. Change-Id: I846e9b55fea0d4e66f03ce615584516360b8b7dd Reviewed-on: https://gerrit.libreoffice.org/8764 Reviewed-by: Tor Lillqvist <t...@collabora.com> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/writerfilter/source/dmapper/CellMarginHandler.cxx b/writerfilter/source/dmapper/CellMarginHandler.cxx index a74e02b..f4191f8 100644 --- a/writerfilter/source/dmapper/CellMarginHandler.cxx +++ b/writerfilter/source/dmapper/CellMarginHandler.cxx @@ -58,7 +58,7 @@ void CellMarginHandler::lcl_attribute(Id rName, Value & rVal) { case NS_ooxml::LN_CT_TblWidth_w: m_nWidth = nIntValue; - m_nValue = ConversionHelper::convertTwipToMM100( nIntValue ); + m_nValue = ConversionHelper::convertTwipToMM100Unsigned( nIntValue ); break; case NS_ooxml::LN_CT_TblWidth_type: OSL_ENSURE( NS_ooxml::LN_Value_ST_TblWidth_dxa == sal::static_int_cast<Id>(nIntValue), "cell margins work for absolute values, only"); diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx index d6dba13..7c0c2a1 100644 --- a/writerfilter/source/dmapper/ConversionHelper.cxx +++ b/writerfilter/source/dmapper/ConversionHelper.cxx @@ -226,18 +226,24 @@ OUString ConvertMSFormatStringToSO( } +#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) sal_Int32 convertTwipToMM100(sal_Int32 _t) { + return TWIP_TO_MM100( _t ); +} + +sal_uInt32 convertTwipToMM100Unsigned(sal_Int32 _t) +{ + if( _t < 0 ) + return 0; // It appears that MSO handles large twip values specially, probably legacy 16bit handling, // anything that's bigger than 32767 appears to be simply ignored. if( _t >= 0x8000 ) return 0; -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) return TWIP_TO_MM100( _t ); } - sal_Int32 convertEMUToMM100(sal_Int32 _t) { return _t / 360; diff --git a/writerfilter/source/dmapper/ConversionHelper.hxx b/writerfilter/source/dmapper/ConversionHelper.hxx index b23872b..3873a39 100644 --- a/writerfilter/source/dmapper/ConversionHelper.hxx +++ b/writerfilter/source/dmapper/ConversionHelper.hxx @@ -44,6 +44,7 @@ namespace ConversionHelper{ OUString ConvertMSFormatStringToSO( const OUString& rFormat, ::com::sun::star::lang::Locale& rLocale, bool bHijri); sal_Int32 convertTwipToMM100(sal_Int32 _t); + sal_uInt32 convertTwipToMM100Unsigned(sal_Int32 _t); // probably the most useless unit in the world - English Metric Units (EMU) 360 000 EMU == 1cm sal_Int32 convertEMUToMM100(sal_Int32 _t); sal_Int32 ConvertColor(sal_Int32 nWordColor );
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits