Kaydet (Commit) 279f1a20 authored tarafından Miklos Vajna's avatar Miklos Vajna

tdf#50821 RTF import: fix handling of \trpaddf{b,l,r,t}

The width type is an attribute, not an sprm; this resulted in zero cell
margin in the table -> the text overlapped with the border shape.

Change-Id: I611feb084a16c76faf281d376e1a4a31e162f53d
Reviewed-on: https://gerrit.libreoffice.org/25997Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst f08e1630
{\rtf1
\pard\plain
before\par
\trowd \trpaddl108\trpaddfl3 \cellx10362\pard\plain\intbl
table
\cell\row
\pard\plain
end
\par
}
...@@ -2626,6 +2626,14 @@ DECLARE_RTFIMPORT_TEST(testTdf77349, "tdf77349.rtf") ...@@ -2626,6 +2626,14 @@ DECLARE_RTFIMPORT_TEST(testTdf77349, "tdf77349.rtf")
CPPUNIT_ASSERT_EQUAL(OUString("Image1"), xImage->getName()); CPPUNIT_ASSERT_EQUAL(OUString("Image1"), xImage->getName());
} }
DECLARE_RTFIMPORT_TEST(testTdf50821, "tdf50821.rtf")
{
uno::Reference<text::XTextTable> xTable(getParagraphOrTable(2), uno::UNO_QUERY);
uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
// This was 0, \trpaddfl was mishandled on import.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(191), getProperty<sal_Int32>(xCell, "LeftBorderDistance"));
}
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -1314,8 +1314,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -1314,8 +1314,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
default: default:
break; break;
} }
putNestedSprm(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, std::make_shared<RTFValue>(aAttributes)); putNestedAttribute(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, std::make_shared<RTFValue>(aAttributes));
putNestedSprm(m_aDefaultState.aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, std::make_shared<RTFValue>(aAttributes)); putNestedAttribute(m_aDefaultState.aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, std::make_shared<RTFValue>(aAttributes));
} }
break; break;
case RTF_TRPADDB: case RTF_TRPADDB:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment