[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - include/oox oox/source sd/qa

2019-10-15 Thread Miklos Vajna (via logerrit)
 include/oox/drawingml/shape.hxx |5 +
 oox/source/drawingml/shape.cxx  |6 +-
 oox/source/ppt/pptshapegroupcontext.cxx |4 +++-
 sd/qa/unit/data/pptx/tdf127964.pptx |binary
 sd/qa/unit/import-tests.cxx |   23 +++
 5 files changed, 36 insertions(+), 2 deletions(-)

New commits:
commit 6f9407c0d872675dbcbd0dc52fd7a0fdb098804b
Author: Miklos Vajna 
AuthorDate: Mon Oct 14 21:49:32 2019 +0200
Commit: Xisco FaulĂ­ 
CommitDate: Tue Oct 15 10:52:30 2019 +0200

tdf#127964 PPTX import: fix shape fill handling: style vs slide background

Regression from commit 943a534ac7cb3df513583e226c986dafd8ba246b
(tdf#123684 PPTX import: fix wrong background color for , 2019-04-23), the problem was that we didn't handle the
case when a shape had an XML fragment like this:

  

  

  

  

i.e. the shape both wants to use background fill and it has a style
declaring how to fill it as well. We gave the style a priority, while
PowerPoint gives the background fill a priority.

Fix the problem by not setting the fill from the style in case the
background fill is already set.

Change-Id: Ie1b56e5615219138a5b7ddd7a2b25295b991bc05
Reviewed-on: https://gerrit.libreoffice.org/80804
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 46d630f98f1c07ec2048da35d1a4804181148ac5)
Reviewed-on: https://gerrit.libreoffice.org/80807
Reviewed-by: Xisco FaulĂ­ 

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 5aa6f00318a8..4abf973d8cb7 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -228,6 +228,8 @@ public:
 void setVerticalShapesCount(sal_Int32 nVerticalShapesCount) { 
mnVerticalShapesCount = nVerticalShapesCount; }
 sal_Int32 getVerticalShapesCount() const { return mnVerticalShapesCount; }
 
+void setUseBgFill(bool bUseBgFill) { mbUseBgFill = bUseBgFill; }
+
 /// Changes reference semantics to value semantics for fill properties.
 void cloneFillProperties();
 
@@ -367,6 +369,9 @@ private:
 
 /// Number of child shapes to be layouted vertically inside org chart 
in-diagram shape.
 sal_Int32 mnVerticalShapesCount = 0;
+
+/// The shape fill should be set to that of the slide background surface.
+bool mbUseBgFill = false;
 };
 
 } }
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 3525ad7d0317..16b0c5b04824 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -183,6 +183,7 @@ Shape::Shape( const ShapePtr& pSourceShape )
 , mnZOrderOff(pSourceShape->mnZOrderOff)
 , mnDataNodeType(pSourceShape->mnDataNodeType)
 , mfAspectRatio(pSourceShape->mfAspectRatio)
+, mbUseBgFill(pSourceShape->mbUseBgFill)
 {}
 
 Shape::~Shape()
@@ -975,7 +976,10 @@ Reference< XShape > const & Shape::createAndInsert(
 }
 if( const ShapeStyleRef* pFillRef = getShapeStyleRef( XML_fillRef 
) )
 {
-nFillPhClr = pFillRef->maPhClr.getColor( rGraphicHelper );
+if (!mbUseBgFill)
+{
+nFillPhClr = pFillRef->maPhClr.getColor(rGraphicHelper);
+}
 
 OUString sColorScheme = pFillRef->maPhClr.getSchemeName();
 if( !sColorScheme.isEmpty() )
diff --git a/oox/source/ppt/pptshapegroupcontext.cxx 
b/oox/source/ppt/pptshapegroupcontext.cxx
index 6535e12d3f81..745a9b8e847e 100644
--- a/oox/source/ppt/pptshapegroupcontext.cxx
+++ b/oox/source/ppt/pptshapegroupcontext.cxx
@@ -101,7 +101,9 @@ ContextHandlerRef PPTShapeGroupContext::onCreateContext( 
sal_Int32 aElementToken
 case PPT_TOKEN( sp ):   // Shape
 {
 std::shared_ptr pShape( new PPTShape( meShapeLocation, 
"com.sun.star.drawing.CustomShape" ) );
-if( rAttribs.getBool( XML_useBgFill, false ) )
+bool bUseBgFill = rAttribs.getBool(XML_useBgFill, false);
+pShape->setUseBgFill(bUseBgFill);
+if (bUseBgFill)
 {
 oox::drawingml::FillPropertiesPtr pBackgroundPropertiesPtr = 
mpSlidePersistPtr->getBackgroundProperties();
 if (!pBackgroundPropertiesPtr)
diff --git a/sd/qa/unit/data/pptx/tdf127964.pptx 
b/sd/qa/unit/data/pptx/tdf127964.pptx
new file mode 100644
index ..89482a4ce99c
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf127964.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 6252ca27161f..28a908197fdc 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -207,6 +207,7 @@ public:
 void testTdf122899();
 void testOOXTheme();
 void testCropToShape();
+void testTdf127964();
 
 CPPUNIT_TEST_SUITE(SdImportTest);
 
@@ -299,6 +300,7 @@ public:
 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - include/oox oox/source sd/qa

2019-08-12 Thread Bartosz Kosiorek (via logerrit)
 include/oox/export/drawingml.hxx  |2 +-
 oox/source/export/drawingml.cxx   |4 +++-
 oox/source/export/shapes.cxx  |8 
 sd/qa/unit/data/odp/closed-shapes.odp |binary
 sd/qa/unit/export-tests-ooxml2.cxx|   14 ++
 5 files changed, 22 insertions(+), 6 deletions(-)

New commits:
commit f4a660c38471daa35db2dcfa69fb3ebe56d599b9
Author: Bartosz Kosiorek 
AuthorDate: Fri Aug 9 01:20:37 2019 +0200
Commit: Bartosz Kosiorek 
CommitDate: Mon Aug 12 13:10:21 2019 +0200

tdf#126746 Fix exporting closed Polylines to PPTX

In previous implementation the closed shapes was
imported as a polylines without closing joint.
As a result the joint style was not applied.

This patch fixes that, and allow proper PPTX export.

TODO The same issue needs to be fixed for PPT export

Change-Id: I557daac1ba02330d8923f7eda3476e67d8711384
Reviewed-on: https://gerrit.libreoffice.org/77179
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Reviewed-by: Regina Henschel 
(cherry picked from commit 3feaff84fafc23c26ff9c6a716709f17a6c8330b)
Reviewed-on: https://gerrit.libreoffice.org/77229
Reviewed-by: Bartosz Kosiorek 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 55279e2de69f..c11664bb2738 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -265,7 +265,7 @@ public:
 static sal_Int32 GetCustomGeometryPointValue(
 const css::drawing::EnhancedCustomShapeParameter& rParam,
 const SdrObjCustomShape& rSdrObjCustomShape);
-void WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon );
+void WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon, const bool 
bClosed );
 void WriteFill( const css::uno::Reference< css::beans::XPropertySet >& 
xPropSet );
 void WriteShapeStyle( const css::uno::Reference< css::beans::XPropertySet 
>& rXPropSet );
 void WriteShapeEffects( const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet );
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 38320242c3ce..b49ccfce21d2 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3127,7 +3127,7 @@ sal_Int32 DrawingML::GetCustomGeometryPointValue(
 return nValue;
 }
 
-void DrawingML::WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon )
+void DrawingML::WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon, 
const bool bClosed )
 {
 // In case of Writer, the parent element is , and there the
 //  element is not optional.
@@ -3197,6 +3197,8 @@ void DrawingML::WritePolyPolygon( const 
tools::PolyPolygon& rPolyPolygon )
 }
 }
 }
+if (bClosed)
+mpFS->singleElementNS( XML_a, XML_close);
 mpFS->endElementNS( XML_a, XML_path );
 
 mpFS->endElementNS( XML_a, XML_pathLst );
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index b36ebb26f67f..80de09f97a76 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -418,7 +418,7 @@ bool ShapeExport::NonEmptyText( const Reference< XInterface 
>& xIface )
 return false;
 }
 
-ShapeExport& ShapeExport::WritePolyPolygonShape( const Reference< XShape >& 
xShape, bool bClosed )
+ShapeExport& ShapeExport::WritePolyPolygonShape( const Reference< XShape >& 
xShape, const bool bClosed )
 {
 SAL_INFO("oox.shape", "write polypolygon shape");
 
@@ -452,7 +452,7 @@ ShapeExport& ShapeExport::WritePolyPolygonShape( const 
Reference< XShape >& xSha
 // visual shape properties
 pFS->startElementNS(mnXmlNamespace, XML_spPr);
 WriteTransformation( aRect, XML_a );
-WritePolyPolygon( aPolyPolygon );
+WritePolyPolygon( aPolyPolygon, bClosed );
 Reference< XPropertySet > xProps( xShape, UNO_QUERY );
 if( xProps.is() ) {
 if( bClosed )
@@ -840,7 +840,7 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 bool bInvertRotation = bFlipH != bFlipV;
 if (nRotation != 0)
 aPolyPolygon.Rotate(Point(0,0), 
static_cast(bInvertRotation ? nRotation/10 : 3600-nRotation/10));
-WritePolyPolygon( aPolyPolygon );
+WritePolyPolygon( aPolyPolygon, false );
 }
 else if (bCustGeom)
 {
@@ -1437,7 +1437,7 @@ static const NameToConvertMapType& lcl_GetConverters()
 { "com.sun.star.drawing.LineShape" , 
::WriteLineShape },
 { "com.sun.star.drawing.OpenBezierShape"   , 
::WriteOpenPolyPolygonShape },
 { "com.sun.star.drawing.PolyPolygonShape"  , 
::WriteClosedPolyPolygonShape },
-{ "com.sun.star.drawing.PolyLineShape" , 
::WriteClosedPolyPolygonShape },
+{ "com.sun.star.drawing.PolyLineShape" , 
::WriteOpenPolyPolygonShape },
 { "com.sun.star.drawing.RectangleShape", 
::WriteRectangleShape },
 { 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - include/oox oox/source sd/qa

2019-07-10 Thread Grzegorz Araminowicz (via logerrit)
 include/oox/drawingml/shape.hxx|6 
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx|  107 -
 oox/source/drawingml/diagram/diagramlayoutatoms.hxx|1 
 oox/source/drawingml/diagram/layoutatomvisitorbase.hxx |4 
 oox/source/drawingml/diagram/layoutatomvisitors.cxx|   22 ++-
 oox/source/drawingml/diagram/layoutatomvisitors.hxx|4 
 sd/qa/unit/data/pptx/smartart-org-chart2.pptx  |binary
 sd/qa/unit/import-tests-smartart.cxx   |   60 +
 8 files changed, 168 insertions(+), 36 deletions(-)

New commits:
commit d4aa418fbfb9bd23e05fa739f20363bc299570d5
Author: Grzegorz Araminowicz 
AuthorDate: Sun Jul 7 14:12:05 2019 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jul 10 12:20:01 2019 +0200

SmartArt: improve organization chart layout

layout shapes in two steps:
  * first calculate vertical child shapes count for every shape
(taking into accout hierBranch alg variable)
  * then actual layout using that count to calculate size for subtrees

Change-Id: I2e5ca34ed3383aa9502c52511cc1fb2bee215572
Reviewed-on: https://gerrit.libreoffice.org/75195
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/75311

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 1f8b163b5d35..5aa6f00318a8 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -225,6 +225,9 @@ public:
 
 double getAspectRatio() const { return mfAspectRatio; }
 
+void setVerticalShapesCount(sal_Int32 nVerticalShapesCount) { 
mnVerticalShapesCount = nVerticalShapesCount; }
+sal_Int32 getVerticalShapesCount() const { return mnVerticalShapesCount; }
+
 /// Changes reference semantics to value semantics for fill properties.
 void cloneFillProperties();
 
@@ -361,6 +364,9 @@ private:
 
 /// Aspect ratio for an in-diagram shape.
 double mfAspectRatio = 0;
+
+/// Number of child shapes to be layouted vertically inside org chart 
in-diagram shape.
+sal_Int32 mnVerticalShapesCount = 0;
 };
 
 } }
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index f3c3f52dce04..7f77880b28e8 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -418,6 +418,40 @@ sal_Int32 AlgAtom::getConnectorType()
 return oox::XML_rightArrow;
 }
 
+sal_Int32 AlgAtom::getVerticalShapesCount(const ShapePtr& rShape)
+{
+if (rShape->getChildren().empty())
+return (rShape->getSubType() != XML_conn) ? 1 : 0;
+
+sal_Int32 nDir = XML_fromL;
+if (mnType == XML_hierRoot)
+nDir = XML_fromT;
+else if (maMap.count(XML_linDir))
+nDir = maMap.find(XML_linDir)->second;
+
+const sal_Int32 nSecDir = maMap.count(XML_secLinDir) ? 
maMap.find(XML_secLinDir)->second : 0;
+
+sal_Int32 nCount = 0;
+if (nDir == XML_fromT || nDir == XML_fromB)
+{
+for (ShapePtr& pChild : rShape->getChildren())
+nCount += pChild->getVerticalShapesCount();
+}
+else if ((nDir == XML_fromL || nDir == XML_fromR) && nSecDir == XML_fromT)
+{
+for (ShapePtr& pChild : rShape->getChildren())
+nCount += pChild->getVerticalShapesCount();
+nCount = (nCount + 1) / 2;
+}
+else
+{
+for (ShapePtr& pChild : rShape->getChildren())
+nCount = std::max(nCount, pChild->getVerticalShapesCount());
+}
+
+return nCount;
+}
+
 void AlgAtom::layoutShape( const ShapePtr& rShape,
const std::vector& rConstraints )
 {
@@ -660,6 +694,9 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
 case XML_hierChild:
 case XML_hierRoot:
 {
+if (rShape->getChildren().empty() || rShape->getSize().Width == 0 
|| rShape->getSize().Height == 0)
+break;
+
 // hierRoot is the manager -> employees vertical linear path,
 // hierChild is the first employee -> last employee horizontal
 // linear path.
@@ -669,31 +706,20 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
 else if (maMap.count(XML_linDir))
 nDir = maMap.find(XML_linDir)->second;
 
-if (rShape->getChildren().empty() || rShape->getSize().Width == 0
-|| rShape->getSize().Height == 0)
-break;
+const sal_Int32 nSecDir = maMap.count(XML_secLinDir) ? 
maMap.find(XML_secLinDir)->second : 0;
 
 sal_Int32 nCount = rShape->getChildren().size();
 
 if (mnType == XML_hierChild)
 {
-// Connectors should not influence the size of non-connect
-// shapes.
+// Connectors should not influence the size of non-connect 
shapes.
 nCount = std::count_if(
  

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - include/oox oox/source sd/qa

2019-07-03 Thread Miklos Vajna (via logerrit)
 include/oox/export/drawingml.hxx|9 +--
 oox/source/export/drawingml.cxx |   43 ++--
 sd/qa/unit/data/pptx/tdf125554.pptx |binary
 sd/qa/unit/export-tests-ooxml1.cxx  |   19 +++
 4 files changed, 63 insertions(+), 8 deletions(-)

New commits:
commit 1e8a9c19a6f7b82c9e0c481aee0c04c0780f4433
Author: Miklos Vajna 
AuthorDate: Mon Jul 1 21:10:01 2019 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jul 3 14:45:35 2019 +0200

tdf#125554 PPTX export: handle gradient transparency for gradient fill

Regression from commit cfc1f4ea4889f768d689a0df71519e9bcb707bc0 (oox:
disable gradient fill grab-bag for PPTX, 2019-02-05), the problem was
that in the past grab-bag roundtrip worked (in some cases) for this
shape fill case, but true roundtrip did not.

So when the commit disabled grab-bags (since their color pointers in the
theme don't work in the PPTX case), a previously not implemented feature
now started causing a real problem.

Fix the bug by adding support for transparent linear gradients on the
exports side. This means that in case the import creates both a fill
gradient and a transparency gradient, then now the export creates markup
based on both, not only based on the fill gradient.

Change-Id: I99fa3caba2b2884c2acb7e0704bbeb0b6cffd4a4
Reviewed-on: https://gerrit.libreoffice.org/74968
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 599ae1151bf893491db7ad983d64c77521c3ae9d)
Reviewed-on: https://gerrit.libreoffice.org/75032

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index d74c82ff8b28..55279e2de69f 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -183,7 +183,7 @@ public:
 void WriteColor( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteColor( const OUString& sColorSchemeName, const 
css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 
nAlpha = MAX_PERCENT );
 void WriteColorTransformations( const css::uno::Sequence< 
css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT );
-void WriteGradientStop( sal_uInt16 nStop, ::Color nColor );
+void WriteGradientStop(sal_uInt16 nStop, ::Color nColor, sal_Int32 nAlpha 
= MAX_PERCENT);
 void WriteLineArrow( const css::uno::Reference< css::beans::XPropertySet 
>& rXPropSet, bool bLineStart );
 void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, 
sal_Int32 nStartID, sal_Int32 nEndID );
 
@@ -191,7 +191,12 @@ public:
 void WriteSolidFill( const OUString& sSchemeName, const 
css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 
nAlpha = MAX_PERCENT );
 void WriteSolidFill( const css::uno::Reference< css::beans::XPropertySet 
>& rXPropSet );
 void WriteGradientFill( const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet );
-void WriteGradientFill( css::awt::Gradient rGradient );
+
+/// In case rXPropSet is set, it may serve as a source of gradient 
transparency information.
+void WriteGradientFill(css::awt::Gradient rGradient,
+   const 
css::uno::Reference& rXPropSet
+   = css::uno::Reference());
+
 void WriteGrabBagGradientFill( const css::uno::Sequence< 
css::beans::PropertyValue >& aGradientStops, css::awt::Gradient rGradient);
 
 void WriteBlipOrNormalFill( const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet,
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 85834a14b1b0..38320242c3ce 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -130,6 +130,17 @@ using ::css::io::XOutputStream;
 using ::sax_fastparser::FSHelperPtr;
 using ::sax_fastparser::FastSerializerHelper;
 
+namespace
+{
+/// Extracts start or end alpha information from a transparency gradient.
+sal_Int32 GetAlphaFromTransparenceGradient(const awt::Gradient& rGradient, 
bool bStart)
+{
+// Our alpha is a gray color value.
+sal_uInt8 nRed = ::Color(bStart ? rGradient.StartColor : 
rGradient.EndColor).GetRed();
+// drawingML alpha is a percentage on a 0..10 scale.
+return (255 - nRed) * oox::drawingml::MAX_PERCENT / 255;
+}
+}
 
 namespace oox {
 namespace drawingml {
@@ -413,10 +424,10 @@ void DrawingML::WriteSolidFill( const Reference< 
XPropertySet >& rXPropSet )
 }
 }
 
-void DrawingML::WriteGradientStop( sal_uInt16 nStop, ::Color nColor )
+void DrawingML::WriteGradientStop(sal_uInt16 nStop, ::Color nColor, sal_Int32 
nAlpha)
 {
 mpFS->startElementNS(XML_a, XML_gs, XML_pos, OString::number(nStop * 
1000));
-WriteColor( nColor );
+WriteColor(nColor, nAlpha);
 mpFS->endElementNS( XML_a, XML_gs );
 }
 
@@ -478,7 +489,7 @@ void DrawingML::WriteGradientFill( const Reference< 
XPropertySet >& rXPropSet )
 else

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - include/oox oox/source

2019-07-02 Thread Grzegorz Araminowicz (via logerrit)
 include/oox/helper/attributelist.hxx   |4 +
 oox/source/drawingml/diagram/diagram.cxx   |5 -
 oox/source/drawingml/diagram/diagram.hxx   |5 -
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx|   51 -
 oox/source/drawingml/diagram/diagramlayoutatoms.hxx|2 
 oox/source/drawingml/diagram/layoutatomvisitorbase.cxx |2 
 oox/source/helper/attributelist.cxx|   13 
 7 files changed, 44 insertions(+), 38 deletions(-)

New commits:
commit d3d6661956e6681cdba7eabad0abfec559db45b9
Author: Grzegorz Araminowicz 
AuthorDate: Tue Jul 2 16:53:40 2019 +0200
Commit: Grzegorz Araminowicz 
CommitDate: Tue Jul 2 19:36:06 2019 +0200

SmartArt: make if-node functions relative to current presentation node

* maxDepth calculates maximum depth of associated data node children
  (instead of per-diagram max depth)
* cnt counts children of associated data node (instead of looking up presOf
  node and if not found counting presentation node children)

Change-Id: Ifb50510acb9e6a3d2655197102060ec1c207075b
Reviewed-on: https://gerrit.libreoffice.org/75000
Tested-by: Jenkins
Reviewed-by: Grzegorz Araminowicz 
Reviewed-on: https://gerrit.libreoffice.org/75006

diff --git a/include/oox/helper/attributelist.hxx 
b/include/oox/helper/attributelist.hxx
index 524d7f769a51..2d65ad889699 100644
--- a/include/oox/helper/attributelist.hxx
+++ b/include/oox/helper/attributelist.hxx
@@ -20,6 +20,8 @@
 #ifndef INCLUDED_OOX_HELPER_ATTRIBUTELIST_HXX
 #define INCLUDED_OOX_HELPER_ATTRIBUTELIST_HXX
 
+#include 
+
 #include 
 #include 
 #include 
@@ -164,6 +166,8 @@ public:
 value if the attribute is missing or not convertible to a date/time 
value. */
 css::util::DateTime getDateTime( sal_Int32 nAttrToken, const 
css::util::DateTime& rDefault ) const;
 
+std::vector getTokenList(sal_Int32 nAttrToken) const;
+
 private:
 css::uno::Reference< css::xml::sax::XFastAttributeList >
 mxAttribs;
diff --git a/oox/source/drawingml/diagram/diagram.cxx 
b/oox/source/drawingml/diagram/diagram.cxx
index 2a5f2d054721..0edd94a874be 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -72,8 +72,7 @@ void Point::dump() const
 } // dgm namespace
 
 DiagramData::DiagramData() :
-mpFillProperties( new FillProperties ),
-mnMaxDepth(0)
+mpFillProperties( new FillProperties )
 {
 }
 
@@ -328,8 +327,6 @@ void Diagram::build(  )
 {
 const sal_Int32 nDepth = calcDepth(elem.second.msSourceId, 
getData()->getConnections());
 elem.second.mnDepth = nDepth != 0 ? nDepth : -1;
-if (nDepth > getData()->getMaxDepth())
-getData()->setMaxDepth(nDepth);
 }
 }
 #ifdef DEBUG_OOX_DIAGRAM
diff --git a/oox/source/drawingml/diagram/diagram.hxx 
b/oox/source/drawingml/diagram/diagram.hxx
index e8839d1b0fe6..8e615ea5fd24 100644
--- a/oox/source/drawingml/diagram/diagram.hxx
+++ b/oox/source/drawingml/diagram/diagram.hxx
@@ -188,10 +188,6 @@ public:
 ::std::vector ()
 { return maExtDrawings; }
 const dgm::Point* getRootPoint() const;
-sal_Int32 getMaxDepth() const
-{ return mnMaxDepth; }
-void setMaxDepth(sal_Int32 nDepth)
-{ mnMaxDepth = nDepth; }
 void dump() const;
 private:
 ::std::vector  maExtDrawings;
@@ -202,7 +198,6 @@ private:
 PointsNameMap maPointsPresNameMap;
 ConnectionNameMap maConnectionNameMap;
 StringMap maPresOfNameMap;
-sal_Int32 mnMaxDepth;
 };
 
 typedef std::shared_ptr< DiagramData > DiagramDataPtr;
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index d4845c768331..6a8ffd2c4b3e 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -176,8 +176,7 @@ void setHierChildConnPosSize(const 
oox::drawingml::ShapePtr& pShape)
 namespace oox { namespace drawingml {
 
 IteratorAttr::IteratorAttr( )
-: mnAxis( 0 )
-, mnCnt( -1 )
+: mnCnt( -1 )
 , mbHideLastTrans( true )
 , mnPtType( 0 )
 , mnSt( 0 )
@@ -188,12 +187,15 @@ IteratorAttr::IteratorAttr( )
 void IteratorAttr::loadFromXAttr( const Reference< XFastAttributeList >& xAttr 
)
 {
 AttributeList attr( xAttr );
-mnAxis = xAttr->getOptionalValueToken( XML_axis, 0 );
+maAxis = attr.getTokenList(XML_axis);
 mnCnt = attr.getInteger( XML_cnt, -1 );
 mbHideLastTrans = attr.getBool( XML_hideLastTrans, true );
-mnPtType = xAttr->getOptionalValueToken( XML_ptType, 0 );
 mnSt = attr.getInteger( XML_st, 0 );
 mnStep = attr.getInteger( XML_step, 1 );
+
+// better to keep first token instead of error when multiple values
+std::vector aPtTypes = attr.getTokenList(XML_ptType);
+mnPtType = aPtTypes.empty() ? XML_all :