oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 15 +++++++++++++++ sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx |binary sd/qa/unit/import-tests-smartart.cxx | 20 ++++++++++++++++++++ 3 files changed, 35 insertions(+)
New commits: commit 8193e697d286595aa62859011761adeb002244e3 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Wed Feb 20 18:09:14 2019 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Feb 20 20:35:22 2019 +0100 oox smartart, cycle matrix: fix fill and line props of shape The topmost shape may not have 0 depth, but something larger. In that case at least it's safe to still use fill & line properties. The B1 quadrant of the test file now has the proper orange background, and B2's border is also properly orange. Change-Id: Iccc5f6993693a0f1cf8f50d163003c24d3ad690e Reviewed-on: https://gerrit.libreoffice.org/68104 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index b26c32b6fb4b..1d6259ef698a 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -1168,6 +1168,14 @@ bool LayoutNode::setupShape( const ShapePtr& rShape, const dgm::Point* pPresNode pPresNode->msModelId); if( aNodeName != mrDgm.getData()->getPresOfNameMap().end() ) { + // Calculate the depth of what is effectively the topmost element. + sal_Int32 nMinDepth = std::numeric_limits<sal_Int32>::max(); + for (const auto& rPair : aNodeName->second) + { + if (rPair.second.mnDepth < nMinDepth) + nMinDepth = rPair.second.mnDepth; + } + for (const auto& rPair : aNodeName->second) { const DiagramData::SourceIdAndDepth& rItem = rPair.second; @@ -1199,6 +1207,13 @@ bool LayoutNode::setupShape( const ShapePtr& rShape, const dgm::Point* pPresNode << " added for layout node named \"" << msName << "\""); } + else if (rItem.mnDepth == nMinDepth) + { + // If no real topmost element, then take properties from the one that's the closest + // to topmost. + rShape->getLineProperties() = aDataNode2->second->mpShape->getLineProperties(); + rShape->getFillProperties() = aDataNode2->second->mpShape->getFillProperties(); + } // append text with right outline level if( aDataNode2->second->mpShape->getTextBody() && diff --git a/sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx b/sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx index 76b771644cbb..fb1cb7ea2c2e 100644 Binary files a/sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx and b/sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx differ diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 2138b2ccf33b..2faf360b5b72 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -829,6 +829,19 @@ void SdImportTestSmartArt::testCycleMatrix() CPPUNIT_ASSERT(xA1.is()); CPPUNIT_ASSERT_EQUAL(OUString("A1"), xA1->getString()); + // Test fill color of B1, should be orange. + uno::Reference<text::XText> xB1(getChildShape(getChildShape(xGroup, 1), 1), uno::UNO_QUERY); + CPPUNIT_ASSERT(xB1.is()); + CPPUNIT_ASSERT_EQUAL(OUString("B1"), xB1->getString()); + + uno::Reference<beans::XPropertySet> xB1Props(xB1, uno::UNO_QUERY); + CPPUNIT_ASSERT(xB1Props.is()); + sal_Int32 nFillColor = 0; + xB1Props->getPropertyValue("FillColor") >>= nFillColor; + // Without the accompanying fix in place, this test would have failed: the background color was + // 0x4f81bd, i.e. blue, not orange. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xf79646), nFillColor); + // Without the accompanying fix in place, this test would have failed: the // content of the "A2" shape was lost. uno::Reference<text::XText> xA2(getChildShape(getChildShape(getChildShape(xGroup, 0), 0), 1), @@ -850,6 +863,13 @@ void SdImportTestSmartArt::testCycleMatrix() uno::Reference<drawing::XShape> xB2Shape(xB2, uno::UNO_QUERY); CPPUNIT_ASSERT(xB2Shape.is()); + // Test line color of B2, should be orange. + uno::Reference<beans::XPropertySet> xB2Props(xB2, uno::UNO_QUERY); + CPPUNIT_ASSERT(xB2Props.is()); + sal_Int32 nLineColor = 0; + xB2Props->getPropertyValue("LineColor") >>= nLineColor; + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xf79646), nLineColor); + uno::Reference<text::XText> xC2(getChildShape(getChildShape(getChildShape(xGroup, 0), 2), 1), uno::UNO_QUERY); CPPUNIT_ASSERT(xC2.is()); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits