[Libreoffice-commits] core.git: oox/source sd/qa
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Jan 11 08:05:17 UTC 2019
oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 23 +++++++++++---------
sd/qa/unit/data/pptx/smartart-org-chart.pptx |binary
sd/qa/unit/import-tests-smartart.cxx | 5 +++-
3 files changed, 17 insertions(+), 11 deletions(-)
New commits:
commit dfc97dd381ef516ca4a7e99b29f9da1033a380f4
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Jan 10 13:39:02 2019 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Jan 11 09:04:48 2019 +0100
oox smartart, org chart: handle multiple paragraphs on data node
This problem was similar to the one fixed in
cfa76f538a44d4396574ece59e8a3953c22c6eb7 (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/66066
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Jenkins
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index dd762a9bc77a..e768bebf362d 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -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;
diff --git a/sd/qa/unit/data/pptx/smartart-org-chart.pptx b/sd/qa/unit/data/pptx/smartart-org-chart.pptx
index 259a9f5a1d13..df6e0521fdca 100644
Binary files a/sd/qa/unit/data/pptx/smartart-org-chart.pptx and b/sd/qa/unit/data/pptx/smartart-org-chart.pptx differ
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 45cc9b6e5523..5895289ad0ce 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -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();
More information about the Libreoffice-commits
mailing list