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
This commit is contained in:
parent
77f4c4b8db
commit
1e47614cdb
@ -57,7 +57,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");
|
||||
|
@ -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;
|
||||
|
@ -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_Int16 convertTableJustification( sal_Int32 nIntValue );
|
||||
|
Loading…
x
Reference in New Issue
Block a user