oox/source/drawingml/diagram/layoutatomvisitors.cxx | 14 ++++++++++++++ oox/source/drawingml/diagram/layoutatomvisitors.hxx | 2 ++ sd/qa/unit/import-tests-smartart.cxx | 3 ++- sw/source/filter/ww8/rtfstringbuffer.cxx | 4 ++-- sw/source/filter/ww8/rtfstringbuffer.hxx | 3 +++ 5 files changed, 23 insertions(+), 3 deletions(-)
New commits: commit 099f481d3668f1e6ed25e8d045b99052f4b2cc4b Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Tue Nov 27 23:12:31 2018 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Nov 28 09:06:36 2018 +0100 sw RtfStringBufferValue: make members private Change-Id: I82f8e96901312e91bbc9a2b5c93bea02e180e907 Reviewed-on: https://gerrit.libreoffice.org/64133 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/source/filter/ww8/rtfstringbuffer.cxx b/sw/source/filter/ww8/rtfstringbuffer.cxx index b50ffc31e5e9..2a4bb12fe352 100644 --- a/sw/source/filter/ww8/rtfstringbuffer.cxx +++ b/sw/source/filter/ww8/rtfstringbuffer.cxx @@ -41,7 +41,7 @@ sal_Int32 RtfStringBuffer::getLength() const sal_Int32 nRet = 0; for (const auto& rValue : m_aValues) if (!rValue.isGraphic()) - nRet += rValue.m_aBuffer.getLength(); + nRet += rValue.getBuffer().getLength(); return nRet; } @@ -64,7 +64,7 @@ OStringBuffer& RtfStringBuffer::getLastBuffer() { if (m_aValues.empty() || m_aValues.back().isGraphic()) m_aValues.emplace_back(RtfStringBufferValue()); - return m_aValues.back().m_aBuffer; + return m_aValues.back().getBuffer(); } OStringBuffer* RtfStringBuffer::operator->() { return &getLastBuffer(); } diff --git a/sw/source/filter/ww8/rtfstringbuffer.hxx b/sw/source/filter/ww8/rtfstringbuffer.hxx index 71b3df3a5240..67ad6664433d 100644 --- a/sw/source/filter/ww8/rtfstringbuffer.hxx +++ b/sw/source/filter/ww8/rtfstringbuffer.hxx @@ -29,7 +29,10 @@ public: /// This one doesn't. OString makeStringAndClear(); bool isGraphic() const; + OStringBuffer& getBuffer() { return m_aBuffer; } + const OStringBuffer& getBuffer() const { return m_aBuffer; } +private: OStringBuffer m_aBuffer; const SwFlyFrameFormat* m_pFlyFrameFormat = nullptr; const SwGrfNode* m_pGrfNode = nullptr; commit aedc5427e4b6645ff3257e523c33190cf5e1934d Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Tue Nov 27 17:41:05 2018 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Nov 28 09:06:24 2018 +0100 oox smartart, accent process: handle followSib axis of forEach Currently the accept process document creates 0 connectors. Instead, it creates empty custom shapes: this commit fixes the loop, so that only one of them is created. The whole purpose of the follow sibling axis is that N - 1 connectors are created for N shapes, not N connectors. Change-Id: I54244c7615b83f607ef53a4ff8d01d3c9594856e Reviewed-on: https://gerrit.libreoffice.org/64122 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/oox/source/drawingml/diagram/layoutatomvisitors.cxx b/oox/source/drawingml/diagram/layoutatomvisitors.cxx index 700b48080bc6..ced94784aff4 100644 --- a/oox/source/drawingml/diagram/layoutatomvisitors.cxx +++ b/oox/source/drawingml/diagram/layoutatomvisitors.cxx @@ -48,6 +48,14 @@ void ShapeCreationVisitor::visit(AlgAtom& rAtom) void ShapeCreationVisitor::visit(ForEachAtom& rAtom) { + if (rAtom.iterator().mnAxis == XML_followSib) + { + // If the axis is the follow sibling, then the last atom should not be + // visited. + if (mnCurrIdx + mnCurrStep >= mnCurrCnt) + return; + } + const std::vector<LayoutAtomPtr>& rChildren=rAtom.getChildren(); sal_Int32 nChildren=1; @@ -67,7 +75,11 @@ void ShapeCreationVisitor::visit(ForEachAtom& rAtom) rAtom.iterator().mnCnt==-1 ? nChildren : rAtom.iterator().mnCnt); const sal_Int32 nOldIdx=mnCurrIdx; + const sal_Int32 nOldStep = mnCurrStep; + const sal_Int32 nOldCnt = mnCurrCnt; const sal_Int32 nStep=rAtom.iterator().mnStep; + mnCurrStep = nStep; + mnCurrCnt = nCnt; for( mnCurrIdx=0; mnCurrIdx<nCnt && nStep>0; mnCurrIdx+=nStep ) { // TODO there is likely some conditions @@ -77,6 +89,8 @@ void ShapeCreationVisitor::visit(ForEachAtom& rAtom) // and restore idx mnCurrIdx = nOldIdx; + mnCurrStep = nOldStep; + mnCurrCnt = nOldCnt; } void ShapeCreationVisitor::visit(ConditionAtom& rAtom) diff --git a/oox/source/drawingml/diagram/layoutatomvisitors.hxx b/oox/source/drawingml/diagram/layoutatomvisitors.hxx index 299739186315..f395f6a68668 100644 --- a/oox/source/drawingml/diagram/layoutatomvisitors.hxx +++ b/oox/source/drawingml/diagram/layoutatomvisitors.hxx @@ -33,6 +33,8 @@ class ShapeCreationVisitor : public LayoutAtomVisitor ShapePtr mpParentShape; const Diagram& mrDgm; sal_Int32 mnCurrIdx; + sal_Int32 mnCurrStep = 0; + sal_Int32 mnCurrCnt = 0; const dgm::Point* mpCurrentNode; void defaultVisit(LayoutAtom const & rAtom); diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 7c46270015ee..aa8498b73ce9 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -458,7 +458,8 @@ void SdImportTestSmartArt::testAccentProcess() m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-accent-process.pptx"), PPTX); uno::Reference<drawing::XShapes> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY); CPPUNIT_ASSERT(xGroup.is()); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), xGroup->getCount()); + // 3 children: first pair, connector, second pair. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xGroup->getCount()); uno::Reference<drawing::XShape> xGroupShape(xGroup, uno::UNO_QUERY); CPPUNIT_ASSERT(xGroupShape.is()); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits