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

oox smartart, org chart: handle multiple paragraphs on data node

This problem was similar to the one fixed in
cfa76f53 (oox smartart, accent process:
handle multiple runs from a data point, 2018-11-21), but this there we
handled multiple runs and this handles multiple paragraphs.

It seems some smartart types allow multiple paragraphs in a diagram
node, others only allow multiple runs. Org chart is in the former
category.

Change-Id: I281f01fdfa809d0a232d5da7fdaa23de7adcd627
Reviewed-on: https://gerrit.libreoffice.org/66066Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
üst 1e344298
......@@ -1047,16 +1047,19 @@ bool LayoutNode::setupShape( const ShapePtr& rShape, const dgm::Point* pPresNode
rShape->setTextBody(pTextBody);
}
TextParagraph& rPara=pTextBody->addParagraph();
if( aVecIter->second != -1 )
rPara.getProperties().setLevel(aVecIter->second);
std::shared_ptr<TextParagraph> pSourceParagraph
= aDataNode2->second->mpShape->getTextBody()->getParagraphs().front();
for (const auto& pRun : pSourceParagraph->getRuns())
rPara.addRun(pRun);
rPara.getProperties().apply(
aDataNode2->second->mpShape->getTextBody()->getParagraphs().front()->getProperties());
const TextParagraphVector& rSourceParagraphs
= aDataNode2->second->mpShape->getTextBody()->getParagraphs();
for (const auto& pSourceParagraph : rSourceParagraphs)
{
TextParagraph& rPara = pTextBody->addParagraph();
if (aVecIter->second != -1)
rPara.getProperties().setLevel(aVecIter->second);
for (const auto& pRun : pSourceParagraph->getRuns())
rPara.addRun(pRun);
const TextBodyPtr& rBody = aDataNode2->second->mpShape->getTextBody();
rPara.getProperties().apply(rBody->getParagraphs().front()->getProperties());
}
}
++aVecIter;
......
......@@ -698,7 +698,10 @@ void SdImportTestSmartArt::testOrgChart()
uno::Reference<text::XText> xManager(
getChildShape(getChildShape(getChildShape(xGroup, 0), 0), 0), uno::UNO_QUERY);
CPPUNIT_ASSERT(xManager.is());
CPPUNIT_ASSERT_EQUAL(OUString("Manager"), xManager->getString());
// Without the accompanying fix in place, this test would have failed: this
// was just "Manager", and the second paragraph was lost.
OUString aExpected("Manager\nSecond para");
CPPUNIT_ASSERT_EQUAL(aExpected, xManager->getString());
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xManager, uno::UNO_QUERY);
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
......
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