From 60ec497e0e91354a616978be531d15d3efa3f559 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 4 Jan 2013 12:56:40 +0100 Subject: n#793262 DOCX: import w:tcMar inside w:tc These were ignored previously, and in case they contained some margins, the resulting table was potentially smaller than necessary. --- writerfilter/source/dmapper/CellMarginHandler.cxx | 6 +++++- .../source/dmapper/TablePropertiesHandler.cxx | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'writerfilter') diff --git a/writerfilter/source/dmapper/CellMarginHandler.cxx b/writerfilter/source/dmapper/CellMarginHandler.cxx index 6ee219ec6854..61198310c67d 100644 --- a/writerfilter/source/dmapper/CellMarginHandler.cxx +++ b/writerfilter/source/dmapper/CellMarginHandler.cxx @@ -75,6 +75,7 @@ void CellMarginHandler::lcl_sprm(Sprm & rSprm) switch( rSprm.getId() ) { case NS_ooxml::LN_CT_TblCellMar_top: + case NS_ooxml::LN_CT_TcMar_top: m_nTopMargin = m_nValue; m_bTopMarginValid = true; break; @@ -91,10 +92,12 @@ void CellMarginHandler::lcl_sprm(Sprm & rSprm) } break; case NS_ooxml::LN_CT_TblCellMar_left: + case NS_ooxml::LN_CT_TcMar_left: m_nLeftMargin = m_nValue; m_bLeftMarginValid = true; break; case NS_ooxml::LN_CT_TblCellMar_bottom: + case NS_ooxml::LN_CT_TcMar_bottom: m_nBottomMargin = m_nValue; m_bBottomMarginValid = true; break; @@ -111,11 +114,12 @@ void CellMarginHandler::lcl_sprm(Sprm & rSprm) } break; case NS_ooxml::LN_CT_TblCellMar_right: + case NS_ooxml::LN_CT_TcMar_right: m_nRightMargin = m_nValue; m_bRightMarginValid = true; break; default: - OSL_FAIL( "unknown attribute"); + OSL_FAIL( "unknown sprm"); } } m_nValue = 0; diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx index 17e1a84d39d6..b1d560cd592a 100644 --- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx +++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx @@ -170,6 +170,26 @@ namespace dmapper { } } break; + case NS_ooxml::LN_CT_TcPrBase_tcMar: + { + writerfilter::Reference::Pointer_t pProperties = rSprm.getProps(); + if (pProperties.get()) + { + CellMarginHandlerPtr pCellMarginHandler(new CellMarginHandler); + pProperties->resolve(*pCellMarginHandler); + TablePropertyMapPtr pCellProperties(new TablePropertyMap); + if (pCellMarginHandler->m_bTopMarginValid) + pCellProperties->Insert(PROP_TOP_BORDER_DISTANCE, false, uno::makeAny(pCellMarginHandler->m_nTopMargin)); + if (pCellMarginHandler->m_bLeftMarginValid) + pCellProperties->Insert(PROP_LEFT_BORDER_DISTANCE, false, uno::makeAny(pCellMarginHandler->m_nLeftMargin)); + if (pCellMarginHandler->m_bBottomMarginValid) + pCellProperties->Insert(PROP_BOTTOM_BORDER_DISTANCE, false, uno::makeAny(pCellMarginHandler->m_nBottomMargin)); + if (pCellMarginHandler->m_bRightMarginValid) + pCellProperties->Insert(PROP_RIGHT_BORDER_DISTANCE, false, uno::makeAny(pCellMarginHandler->m_nRightMargin)); + cellProps(pCellProperties); + } + } + break; case NS_ooxml::LN_CT_TblPrBase_shd: { writerfilter::Reference::Pointer_t pProperties = rSprm.getProps(); -- cgit