apparently some table .docx properties shouldn't be < 0
Somewhat related to 10b4da63e3
, 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:
@@ -57,7 +57,7 @@ void CellMarginHandler::lcl_attribute(Id rName, Value & rVal)
|
|||||||
{
|
{
|
||||||
case NS_ooxml::LN_CT_TblWidth_w:
|
case NS_ooxml::LN_CT_TblWidth_w:
|
||||||
m_nWidth = nIntValue;
|
m_nWidth = nIntValue;
|
||||||
m_nValue = ConversionHelper::convertTwipToMM100( nIntValue );
|
m_nValue = ConversionHelper::convertTwipToMM100Unsigned( nIntValue );
|
||||||
break;
|
break;
|
||||||
case NS_ooxml::LN_CT_TblWidth_type:
|
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");
|
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)
|
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,
|
// It appears that MSO handles large twip values specially, probably legacy 16bit handling,
|
||||||
// anything that's bigger than 32767 appears to be simply ignored.
|
// anything that's bigger than 32767 appears to be simply ignored.
|
||||||
if( _t >= 0x8000 )
|
if( _t >= 0x8000 )
|
||||||
return 0;
|
return 0;
|
||||||
#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
|
|
||||||
return TWIP_TO_MM100( _t );
|
return TWIP_TO_MM100( _t );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sal_Int32 convertEMUToMM100(sal_Int32 _t)
|
sal_Int32 convertEMUToMM100(sal_Int32 _t)
|
||||||
{
|
{
|
||||||
return _t / 360;
|
return _t / 360;
|
||||||
|
@@ -44,6 +44,7 @@ namespace ConversionHelper{
|
|||||||
OUString ConvertMSFormatStringToSO(
|
OUString ConvertMSFormatStringToSO(
|
||||||
const OUString& rFormat, ::com::sun::star::lang::Locale& rLocale, bool bHijri);
|
const OUString& rFormat, ::com::sun::star::lang::Locale& rLocale, bool bHijri);
|
||||||
sal_Int32 convertTwipToMM100(sal_Int32 _t);
|
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
|
// probably the most useless unit in the world - English Metric Units (EMU) 360 000 EMU == 1cm
|
||||||
sal_Int32 convertEMUToMM100(sal_Int32 _t);
|
sal_Int32 convertEMUToMM100(sal_Int32 _t);
|
||||||
sal_Int16 convertTableJustification( sal_Int32 nIntValue );
|
sal_Int16 convertTableJustification( sal_Int32 nIntValue );
|
||||||
|
Reference in New Issue
Block a user