Kaydet (Commit) e6f39221 authored tarafından Miklos Vajna's avatar Miklos Vajna Kaydeden (comit) Aron Budea

tdf#116976 DOCX import: fix rel size of shape after bitmap

We have a queue of these odd relative sizes (which are not XML
attributes but text inside the XML element), if the bitmap doesn't pop
the queue, the following shape won't get its size.

Conflicts:
	sw/qa/extras/ooxmlexport/ooxmlexport11.cxx

Change-Id: I1602208c9509d8889bf0be254f3b25fb25fafca2
Reviewed-on: https://gerrit.libreoffice.org/54669Reviewed-by: 's avatarAron Budea <aron.budea@collabora.com>
Tested-by: 's avatarAron Budea <aron.budea@collabora.com>
üst eac3d5cb
......@@ -726,6 +726,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf115861, "tdf115861.docx")
CPPUNIT_ASSERT_EQUAL(OUString("(k)"), getParagraph(2)->getString());
}
DECLARE_OOXMLEXPORT_TEST(testTdf116976, "tdf116976.docx")
{
// This was 0, reltive size of shape after bitmap was ignored.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(40),
getProperty<sal_Int16>(getShape(1), "RelativeWidth"));
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -1087,10 +1087,12 @@ void GraphicImport::lcl_sprm(Sprm& rSprm)
break;
case NS_ooxml::LN_CT_SizeRelH_pctWidth:
case NS_ooxml::LN_CT_SizeRelV_pctHeight:
if (m_xShape.is() && !m_pImpl->m_rPositivePercentages.empty())
if (m_pImpl->m_rPositivePercentages.empty())
break;
if (m_xShape.is())
{
sal_Int16 nPositivePercentage = rtl::math::round(m_pImpl->m_rPositivePercentages.front().toDouble() / oox::drawingml::PER_PERCENT);
m_pImpl->m_rPositivePercentages.pop();
if (nPositivePercentage)
{
......@@ -1099,6 +1101,10 @@ void GraphicImport::lcl_sprm(Sprm& rSprm)
xPropertySet->setPropertyValue(aProperty, uno::makeAny(nPositivePercentage));
}
}
// Make sure the token is consumed even if xShape is an empty
// reference.
m_pImpl->m_rPositivePercentages.pop();
break;
case NS_ooxml::LN_EG_WrapType_wrapNone: // 90944; - doesn't contain attributes
//depending on the behindDoc attribute text wraps through behind or in fron of the object
......
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