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

Grzegorz Araminowicz (via logerrit) logerrit at kemper.freedesktop.org
Fri May 31 14:47:04 UTC 2019


 include/oox/drawingml/shape.hxx                                  |    2 
 oox/source/drawingml/diagram/diagram.cxx                         |   11 
 oox/source/drawingml/shape.cxx                                   |    9 
 oox/source/shape/ShapeContextHandler.cxx                         |    8 
 sd/qa/unit/data/pptx/smartart-background-drawingml-fallback.pptx |binary
 sd/qa/unit/data/pptx/smartart-background.pptx                    |binary
 sd/qa/unit/data/xml/n819614_0.xml                                |   69 ++
 sd/qa/unit/export-tests-ooxml1.cxx                               |    4 
 sd/qa/unit/export-tests-ooxml2.cxx                               |    9 
 sd/qa/unit/import-tests-smartart.cxx                             |  238 ++++++----
 sd/qa/unit/import-tests.cxx                                      |    7 
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx                       |    8 
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx                         |    4 
 13 files changed, 270 insertions(+), 99 deletions(-)

New commits:
commit 3235ae697e1ae90e218f5c3bee280659d8a74a60
Author:     Grzegorz Araminowicz <grzegorz.araminowicz at collabora.com>
AuthorDate: Wed May 8 21:49:34 2019 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri May 31 16:46:22 2019 +0200

    SmartArt: support diagram background
    
    Solved by adding additional shape filling whole diagram.
    MS PowerPoint does the same when converting SmartArt to shapes.
    
    Background shape is also copied when loading from drawingML fallback,
    appearently there is no background information.
    
    Corrected SmartArt import tests, so that they are aware of extra shape.
    
    Change-Id: I6154f8e1b34e5867ab582d6fc54459c7c93edbac
    Reviewed-on: https://gerrit.libreoffice.org/72012
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/73250

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 9e879b47bc9c..73fb85ad8dc9 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -150,6 +150,7 @@ public:
     const OUString&                 getId() { return msId; }
     void                            setHidden( bool bHidden ) { mbHidden = bHidden; }
     void                            setHiddenMasterShape( bool bHiddenMasterShape ) { mbHiddenMasterShape = bHiddenMasterShape; }
+    void                            setLocked( bool bLocked ) { mbLocked = bLocked; }
     void                            setSubType( sal_Int32 nSubType ) { mnSubType = nSubType; }
     sal_Int32                       getSubType() const { return mnSubType; }
     void                            setSubTypeIndex( sal_Int32 nSubTypeIndex ) { moSubTypeIndex = nSubTypeIndex; }
@@ -336,6 +337,7 @@ private:
     bool                            mbHiddenMasterShape; // master shapes can be hidden in layout slides
                                                          // we need separate flag because we don't want
                                                          // to propagate it when applying reference shape
+    bool                            mbLocked;
     bool mbLockedCanvas; ///< Is this shape part of a locked canvas?
     bool mbWps; ///< Is this a wps shape?
     bool mbTextBox; ///< This shape has a textbox.
diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx
index d1de1c72f94d..8efefe139dbf 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -29,6 +29,7 @@
 #include <drawingml/textrun.hxx>
 #include <drawingml/diagram/diagram.hxx>
 #include <drawingml/fillproperties.hxx>
+#include <drawingml/customshapeproperties.hxx>
 #include <oox/ppt/pptshapegroupcontext.hxx>
 #include <oox/ppt/pptshape.hxx>
 #include <oox/token/namespaces.hxx>
@@ -317,6 +318,16 @@ void Diagram::addTo( const ShapePtr & pParentShape )
         ShapeLayoutingVisitor aLayoutingVisitor;
         mpLayout->getNode()->accept(aLayoutingVisitor);
     }
+
+    ShapePtr pBackground(new Shape("com.sun.star.drawing.CustomShape"));
+    pBackground->setSubType(XML_rect);
+    pBackground->getCustomShapeProperties()->setShapePresetType(XML_rect);
+    pBackground->setSize(pParentShape->getSize());
+    pBackground->getFillProperties() = *mpData->getFillProperties();
+    pBackground->setLocked(true);
+    auto& aChildren = pParentShape->getChildren();
+    aChildren.insert(aChildren.begin(), pBackground);
+
     pParentShape->setDiagramDoms( getDomsAsPropertyValues() );
 }
 
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 4848f4086e02..23e9537f4b32 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -127,6 +127,7 @@ Shape::Shape( const sal_Char* pServiceName, bool bDefaultHeight )
 , mbFlipV( false )
 , mbHidden( false )
 , mbHiddenMasterShape( false )
+, mbLocked( false )
 , mbLockedCanvas( false )
 , mbWps( false )
 , mbTextBox( false )
@@ -170,6 +171,7 @@ Shape::Shape( const ShapePtr& pSourceShape )
 , mbFlipV( pSourceShape->mbFlipV )
 , mbHidden( pSourceShape->mbHidden )
 , mbHiddenMasterShape( pSourceShape->mbHiddenMasterShape )
+, mbLocked( pSourceShape->mbLocked )
 , mbLockedCanvas( pSourceShape->mbLockedCanvas )
 , mbWps( pSourceShape->mbWps )
 , mbTextBox( pSourceShape->mbTextBox )
@@ -333,6 +335,7 @@ void Shape::applyShapeReference( const Shape& rReferencedShape, bool bUseText )
     mbFlipH = rReferencedShape.mbFlipH;
     mbFlipV = rReferencedShape.mbFlipV;
     mbHidden = rReferencedShape.mbHidden;
+    mbLocked = rReferencedShape.mbLocked;
 }
 
 struct ActionLockGuard
@@ -858,6 +861,12 @@ Reference< XShape > const & Shape::createAndInsert(
             xSet->setPropertyValue( sPrintable, Any( false ) );
         }
 
+        if (mbLocked)
+        {
+            xSet->setPropertyValue("MoveProtect", Any(true));
+            xSet->setPropertyValue("SizeProtect", Any(true));
+        }
+
         ActionLockGuard const alg(mxShape);
 
         // sj: removing default text of placeholder objects such as SlideNumberShape or HeaderShape
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index 2747572f0479..e6feaa818c69 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -428,6 +428,14 @@ ShapeContextHandler::getShape()
                     pShapePtr->setDiagramDoms(mpShape->getDiagramDoms());
                     pShapePtr->keepDiagramDrawing(*mxFilterBase, aFragmentPath);
 
+                    if (!mpShape->getChildren().empty())
+                    {
+                        // first child is diagram background - we want to keep it, as drawingML fallback doesn't contain it
+                        auto& aChildren = pShapePtr->getChildren();
+                        ShapePtr pBackground = mpShape->getChildren().front();
+                        aChildren.insert(aChildren.begin(), pBackground);
+                    }
+
                     pShapePtr->addShape( *mxFilterBase, mpThemePtr.get(), xShapes, aMatrix, pShapePtr->getFillProperties() );
                     xResult = pShapePtr->getXShape();
                 }
diff --git a/sd/qa/unit/data/pptx/smartart-background-drawingml-fallback.pptx b/sd/qa/unit/data/pptx/smartart-background-drawingml-fallback.pptx
new file mode 100644
index 000000000000..d89f28a21c02
Binary files /dev/null and b/sd/qa/unit/data/pptx/smartart-background-drawingml-fallback.pptx differ
diff --git a/sd/qa/unit/data/pptx/smartart-background.pptx b/sd/qa/unit/data/pptx/smartart-background.pptx
new file mode 100644
index 000000000000..beb862dc12d3
Binary files /dev/null and b/sd/qa/unit/data/pptx/smartart-background.pptx differ
diff --git a/sd/qa/unit/data/xml/n819614_0.xml b/sd/qa/unit/data/xml/n819614_0.xml
index fc109917c460..72e28f38c82d 100644
--- a/sd/qa/unit/data/xml/n819614_0.xml
+++ b/sd/qa/unit/data/xml/n819614_0.xml
@@ -14,8 +14,71 @@
    <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
   </Transformation>
  </XShape>
- <XShape positionX="182" positionY="2544" sizeX="25125" sizeY="16293" type="com.sun.star.drawing.GroupShape" name="Content Placeholder 4">
+ <XShape positionX="0" positionY="2328" sizeX="25399" sizeY="16509" type="com.sun.star.drawing.GroupShape" name="Content Placeholder 4">
   <XShapes>
+   <XShape positionX="0" positionY="2328" sizeX="25399" sizeY="16509" type="com.sun.star.drawing.CustomShape" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="729fcf" fillTransparence="0" fillTransparenceGradientName="">
+    <FillTransparenceGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
+    <FillGradient style="LINEAR" startColor="3465a4" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
+    <FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
+    <FillBitmap width="32" height="32"/>
+    <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
+    <LineStart/>
+    <LineEnd/>
+    <Transformation>
+     <Line1 column1="25400.000000" column2="0.000000" column3="0.000000"/>
+     <Line2 column1="0.000000" column2="16510.000000" column3="2328.000000"/>
+     <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
+    </Transformation>
+    <CustomShapeGeometry>
+     <PropertyValue name="AdjustmentValues">
+      <AdjustmentValues/>
+     </PropertyValue>
+     <PropertyValue name="Equations" handle="0" propertyState="DIRECT_VALUE"/>
+     <PropertyValue name="Handles">
+      <Handles/>
+     </PropertyValue>
+     <PropertyValue name="MirroredX" value="false" handle="0" propertyState="DIRECT_VALUE"/>
+     <PropertyValue name="MirroredY" value="false" handle="0" propertyState="DIRECT_VALUE"/>
+     <PropertyValue name="Path">
+      <Path>
+       <PropertyValue name="Coordinates">
+        <Coordinates>
+         <EnhancedCustomShapeParameterPair>
+          <First value="0" type="0"/>
+          <Second value="0" type="0"/>
+         </EnhancedCustomShapeParameterPair>
+         <EnhancedCustomShapeParameterPair>
+          <First value="3" type="1"/>
+          <Second value="0" type="0"/>
+         </EnhancedCustomShapeParameterPair>
+         <EnhancedCustomShapeParameterPair>
+          <First value="3" type="1"/>
+          <Second value="2" type="1"/>
+         </EnhancedCustomShapeParameterPair>
+         <EnhancedCustomShapeParameterPair>
+          <First value="0" type="0"/>
+          <Second value="2" type="1"/>
+         </EnhancedCustomShapeParameterPair>
+        </Coordinates>
+       </PropertyValue>
+       <PropertyValue name="Segments">
+        <Segments>
+         <EnhancedCustomShapeSegment command="1" count="1"/>
+         <EnhancedCustomShapeSegment command="2" count="3"/>
+         <EnhancedCustomShapeSegment command="4" count="0"/>
+         <EnhancedCustomShapeSegment command="5" count="0"/>
+        </Segments>
+       </PropertyValue>
+       <PropertyValue name="TextFrames" handle="0" propertyState="DIRECT_VALUE"/>
+      </Path>
+     </PropertyValue>
+     <PropertyValue name="TextPreRotateAngle" value="0" handle="0" propertyState="DIRECT_VALUE"/>
+     <PropertyValue name="Type" value="ooxml-rect" handle="0" propertyState="DIRECT_VALUE"/>
+     <PropertyValue name="ViewBox">
+      <ViewBox x="0" y="0" width="0" height="0"/>
+     </PropertyValue>
+    </CustomShapeGeometry>
+   </XShape>
    <XShape positionX="10751" positionY="3496" sizeX="1563" sizeY="253" type="com.sun.star.drawing.CustomShape" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="729fcf" fillTransparence="0" fillTransparenceGradientName="">
     <FillTransparenceGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
     <FillGradient style="LINEAR" startColor="3465a4" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
@@ -6819,8 +6882,8 @@
    </XShape>
   </XShapes>
   <Transformation>
-   <Line1 column1="25126.000000" column2="0.000000" column3="182.000000"/>
-   <Line2 column1="0.000000" column2="16294.000000" column3="2544.000000"/>
+   <Line1 column1="25400.000000" column2="0.000000" column3="0.000000"/>
+   <Line2 column1="0.000000" column2="16510.000000" column3="2328.000000"/>
    <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
   </Transformation>
  </XShape>
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index 3e832aad4e3f..fdad81af2307 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -376,7 +376,7 @@ void SdOOXMLExportTest1::testBnc880763()
     // First object in the background has blue background color
     const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(0));
     CPPUNIT_ASSERT(pObjGroup);
-    const SdrObject *pObj = pObjGroup->GetSubList()->GetObj(0);
+    const SdrObject *pObj = pObjGroup->GetSubList()->GetObj(1);
     CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr);
     CPPUNIT_ASSERT_EQUAL( Color(0x0000ff),(static_cast< const XColorItem& >(pObj->GetMergedItem(XATTR_FILLCOLOR))).GetColorValue());
 
@@ -398,7 +398,7 @@ void SdOOXMLExportTest1::testBnc862510_5()
     // Same as testBnc870237, but here we check the horizontal spacing
     const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(0));
     CPPUNIT_ASSERT(pObjGroup);
-    const SdrObject* pObj = pObjGroup->GetSubList()->GetObj(1);
+    const SdrObject* pObj = pObjGroup->GetSubList()->GetObj(2);
     CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr);
     CPPUNIT_ASSERT_EQUAL( sal_Int32(0), pObj->GetMergedItem(SDRATTR_TEXT_UPPERDIST).GetValue());
     CPPUNIT_ASSERT_EQUAL( sal_Int32(0), pObj->GetMergedItem(SDRATTR_TEXT_LOWERDIST).GetValue());
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 04527f9f0e04..07e61ca1d74a 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -1378,10 +1378,11 @@ void SdOOXMLExportTest2::testSmartartRotation2()
     xDocShRef->DoClose();
 
     xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
-    assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:txBody/a:p/a:r/a:t", "Text");
-    assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:txBody/a:bodyPr", "rot", "10800000");
-    double dX = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "x").toDouble();
-    double dY = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "y").toDouble();
+    assertXPathContent(pXmlDocContent,
+                       "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:txBody/a:p/a:r/a:t", "Text");
+    assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:txBody/a:bodyPr", "rot", "10800000");
+    double dX = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:spPr/a:xfrm/a:off", "x").toDouble();
+    double dY = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:spPr/a:xfrm/a:off", "y").toDouble();
     CPPUNIT_ASSERT_DOUBLES_EQUAL( 2276280.0, dX, dX * .001);
     CPPUNIT_ASSERT_DOUBLES_EQUAL( 3158280.0, dY, dY * .001);
 }
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index c8f64fee859f..682c775b80fe 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -69,6 +69,8 @@ public:
     void testCycleMatrix();
     void testPictureStrip();
     void testInteropGrabBag();
+    void testBackground();
+    void testBackgroundDrawingmlFallback();
 
     CPPUNIT_TEST_SUITE(SdImportTestSmartArt);
 
@@ -102,6 +104,8 @@ public:
     CPPUNIT_TEST(testCycleMatrix);
     CPPUNIT_TEST(testPictureStrip);
     CPPUNIT_TEST(testInteropGrabBag);
+    CPPUNIT_TEST(testBackground);
+    CPPUNIT_TEST(testBackgroundDrawingmlFallback);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -110,20 +114,20 @@ void SdImportTestSmartArt::testBase()
 {
     sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/smartart1.pptx"), PPTX);
     uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW);
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xShapeGroup->getCount());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(6), xShapeGroup->getCount());
 
-    uno::Reference<text::XText> xText0(xShapeGroup->getByIndex(0), uno::UNO_QUERY_THROW);
+    uno::Reference<text::XText> xText0(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("a"), xText0->getString());
-    uno::Reference<text::XText> xText1(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
+    uno::Reference<text::XText> xText1(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("b"), xText1->getString());
-    uno::Reference<text::XText> xText2(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
+    uno::Reference<text::XText> xText2(xShapeGroup->getByIndex(3), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("c"), xText2->getString());
-    uno::Reference<text::XText> xText3(xShapeGroup->getByIndex(3), uno::UNO_QUERY_THROW);
+    uno::Reference<text::XText> xText3(xShapeGroup->getByIndex(4), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("d"), xText3->getString());
-    uno::Reference<text::XText> xText4(xShapeGroup->getByIndex(4), uno::UNO_QUERY_THROW);
+    uno::Reference<text::XText> xText4(xShapeGroup->getByIndex(5), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("e"), xText4->getString());
 
-    uno::Reference<beans::XPropertySet> xShape(xShapeGroup->getByIndex(0), uno::UNO_QUERY_THROW);
+    uno::Reference<beans::XPropertySet> xShape(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
 
     sal_Int32 nFillColor = 0;
     xShape->getPropertyValue("FillColor") >>= nFillColor;
@@ -135,11 +139,11 @@ void SdImportTestSmartArt::testBase()
     xPropSet->getPropertyValue("ParaAdjust") >>= nParaAdjust;
     CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(nParaAdjust));
 
-    uno::Reference<drawing::XShape> xShape0(xShapeGroup->getByIndex(0), uno::UNO_QUERY_THROW);
-    uno::Reference<drawing::XShape> xShape1(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
-    uno::Reference<drawing::XShape> xShape2(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
-    uno::Reference<drawing::XShape> xShape3(xShapeGroup->getByIndex(3), uno::UNO_QUERY_THROW);
-    uno::Reference<drawing::XShape> xShape4(xShapeGroup->getByIndex(4), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape0(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape1(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape2(xShapeGroup->getByIndex(3), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape3(xShapeGroup->getByIndex(4), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape4(xShapeGroup->getByIndex(5), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(xShape0->getPosition().Y,xShape1->getPosition().Y);
     CPPUNIT_ASSERT_EQUAL(xShape2->getPosition().Y,xShape3->getPosition().Y);
     CPPUNIT_ASSERT(xShape2->getPosition().Y > xShape0->getPosition().Y);
@@ -155,9 +159,9 @@ void SdImportTestSmartArt::testChildren()
 {
     sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/smartart-children.pptx"), PPTX);
     uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW);
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xShapeGroup->getCount());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xShapeGroup->getCount());
 
-    uno::Reference<drawing::XShapes> xShapeGroup0(xShapeGroup->getByIndex(0), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShapes> xShapeGroup0(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xShapeGroup0->getCount());
     uno::Reference<text::XText> xTextA(xShapeGroup0->getByIndex(0), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("a"), xTextA->getString());
@@ -171,7 +175,7 @@ void SdImportTestSmartArt::testChildren()
     uno::Reference<text::XText> xTextC(xChildC->getByIndex(0), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("c"), xTextC->getString());
 
-    uno::Reference<drawing::XShapes> xShapeGroup1(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShapes> xShapeGroup1(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xShapeGroup1->getCount());
     uno::Reference<text::XText> xTextX(xShapeGroup1->getByIndex(0), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("x"), xTextX->getString());
@@ -192,7 +196,7 @@ void SdImportTestSmartArt::testText()
 {
     sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/smartart-text.pptx"), PPTX);
     uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW);
-    uno::Reference<drawing::XShapes> xShapeGroup2(xShapeGroup->getByIndex(0), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShapes> xShapeGroup2(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
 
     uno::Reference<text::XText> xText0(xShapeGroup2->getByIndex(0), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT(xText0->getString().isEmpty());
@@ -224,10 +228,10 @@ void SdImportTestSmartArt::testDir()
 {
     sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/smartart-dir.pptx"), PPTX);
     uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW);
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xShapeGroup->getCount());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xShapeGroup->getCount());
 
-    uno::Reference<drawing::XShape> xShape0(xShapeGroup->getByIndex(0), uno::UNO_QUERY_THROW);
-    uno::Reference<drawing::XShape> xShape1(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape0(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape1(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT(xShape0->getPosition().X > xShape1->getPosition().X);
 
     xDocShRef->DoClose();
@@ -237,15 +241,15 @@ void SdImportTestSmartArt::testMaxDepth()
 {
     sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/smartart-maxdepth.pptx"), PPTX);
     uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW);
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xShapeGroup->getCount());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xShapeGroup->getCount());
 
-    uno::Reference<text::XText> xText0(xShapeGroup->getByIndex(0), uno::UNO_QUERY_THROW);
+    uno::Reference<text::XText> xText0(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("first"), xText0->getString());
-    uno::Reference<text::XText> xText1(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
+    uno::Reference<text::XText> xText1(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("second"), xText1->getString());
 
-    uno::Reference<drawing::XShape> xShape0(xShapeGroup->getByIndex(0), uno::UNO_QUERY_THROW);
-    uno::Reference<drawing::XShape> xShape1(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape0(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape1(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(xShape0->getPosition().Y , xShape1->getPosition().Y); // Confirms shapes are in same Y axis-level.
 
     xDocShRef->DoClose();
@@ -256,13 +260,13 @@ void SdImportTestSmartArt::testRotation()
     sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/smartart-rotation.pptx"), PPTX);
     uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW);
 
-    uno::Reference<beans::XPropertySet> xShape0(xShapeGroup->getByIndex(0), uno::UNO_QUERY_THROW);
+    uno::Reference<beans::XPropertySet> xShape0(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xShape0->getPropertyValue("RotateAngle").get<sal_Int32>());
 
-    uno::Reference<beans::XPropertySet> xShape1(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
+    uno::Reference<beans::XPropertySet> xShape1(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(24000), xShape1->getPropertyValue("RotateAngle").get<sal_Int32>());
 
-    uno::Reference<beans::XPropertySet> xShape2(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
+    uno::Reference<beans::XPropertySet> xShape2(xShapeGroup->getByIndex(3), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(12000), xShape2->getPropertyValue("RotateAngle").get<sal_Int32>());
 
     xDocShRef->DoClose();
@@ -282,18 +286,18 @@ void SdImportTestSmartArt::testChevron()
 {
     sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/smartart-chevron.pptx"), PPTX);
     uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW);
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xShapeGroup->getCount());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xShapeGroup->getCount());
 
-    uno::Reference<text::XText> xText0(xShapeGroup->getByIndex(0), uno::UNO_QUERY_THROW);
+    uno::Reference<text::XText> xText0(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("a"), xText0->getString());
-    uno::Reference<text::XText> xText1(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
+    uno::Reference<text::XText> xText1(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("b"), xText1->getString());
-    uno::Reference<text::XText> xText2(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
+    uno::Reference<text::XText> xText2(xShapeGroup->getByIndex(3), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("c"), xText2->getString());
 
-    uno::Reference<drawing::XShape> xShape0(xShapeGroup->getByIndex(0), uno::UNO_QUERY_THROW);
-    uno::Reference<drawing::XShape> xShape1(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
-    uno::Reference<drawing::XShape> xShape2(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape0(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape1(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape2(xShapeGroup->getByIndex(3), uno::UNO_QUERY_THROW);
 
     CPPUNIT_ASSERT(xShape0->getPosition().X < xShape1->getPosition().X && xShape1->getPosition().X < xShape2->getPosition().X);
     CPPUNIT_ASSERT_EQUAL(xShape0->getPosition().Y, xShape1->getPosition().Y);
@@ -356,20 +360,20 @@ void SdImportTestSmartArt::testBaseRtoL()
 {
     sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/smartart-rightoleftblockdiagram.pptx"), PPTX);
     uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW);
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xShapeGroup->getCount());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(6), xShapeGroup->getCount());
 
-    uno::Reference<text::XText> xText0(xShapeGroup->getByIndex(0), uno::UNO_QUERY_THROW);
+    uno::Reference<text::XText> xText0(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("a"), xText0->getString());
-    uno::Reference<text::XText> xText1(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
+    uno::Reference<text::XText> xText1(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("b"), xText1->getString());
-    uno::Reference<text::XText> xText2(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
+    uno::Reference<text::XText> xText2(xShapeGroup->getByIndex(3), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("c"), xText2->getString());
-    uno::Reference<text::XText> xText3(xShapeGroup->getByIndex(3), uno::UNO_QUERY_THROW);
+    uno::Reference<text::XText> xText3(xShapeGroup->getByIndex(4), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("d"), xText3->getString());
-    uno::Reference<text::XText> xText4(xShapeGroup->getByIndex(4), uno::UNO_QUERY_THROW);
+    uno::Reference<text::XText> xText4(xShapeGroup->getByIndex(5), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(OUString("e"), xText4->getString());
 
-    uno::Reference<beans::XPropertySet> xShape(xShapeGroup->getByIndex(0), uno::UNO_QUERY_THROW);
+    uno::Reference<beans::XPropertySet> xShape(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
 
     sal_Int32 nFillColor = 0;
     xShape->getPropertyValue("FillColor") >>= nFillColor;
@@ -381,11 +385,11 @@ void SdImportTestSmartArt::testBaseRtoL()
     xPropSet->getPropertyValue("ParaAdjust") >>= nParaAdjust;
     CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(nParaAdjust));
 
-    uno::Reference<drawing::XShape> xShape0(xShapeGroup->getByIndex(0), uno::UNO_QUERY_THROW);
-    uno::Reference<drawing::XShape> xShape1(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
-    uno::Reference<drawing::XShape> xShape2(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
-    uno::Reference<drawing::XShape> xShape3(xShapeGroup->getByIndex(3), uno::UNO_QUERY_THROW);
-    uno::Reference<drawing::XShape> xShape4(xShapeGroup->getByIndex(4), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape0(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape1(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape2(xShapeGroup->getByIndex(3), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape3(xShapeGroup->getByIndex(4), uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape4(xShapeGroup->getByIndex(5), uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL(xShape0->getPosition().Y,xShape1->getPosition().Y);
     CPPUNIT_ASSERT_EQUAL(xShape2->getPosition().Y,xShape3->getPosition().Y);
     CPPUNIT_ASSERT(xShape2->getPosition().Y > xShape0->getPosition().Y);
@@ -405,9 +409,9 @@ void SdImportTestSmartArt::testVertialBoxList()
                                                  uno::UNO_QUERY_THROW);
     // Without the accompanying fix in place, this test would have failed with
     // 'actual: 0'.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xShapeGroup->getCount());
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xShapeGroup->getCount());
 
-    uno::Reference<drawing::XShapes> xFirstChild(xShapeGroup->getByIndex(0), uno::UNO_QUERY);
+    uno::Reference<drawing::XShapes> xFirstChild(xShapeGroup->getByIndex(1), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xFirstChild.is());
     uno::Reference<drawing::XShape> xParentText(xFirstChild->getByIndex(1), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xParentText.is());
@@ -416,7 +420,7 @@ void SdImportTestSmartArt::testVertialBoxList()
     // constraint wanted.
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(11852), xParentText->getSize().Width);
 
-    uno::Reference<drawing::XShape> xChildText(xShapeGroup->getByIndex(1), uno::UNO_QUERY);
+    uno::Reference<drawing::XShape> xChildText(xShapeGroup->getByIndex(2), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xChildText.is());
     // Without the accompanying fix in place, this test would have failed with
     // 'actual: 7361' (and with the fix: 'actual: 16932', i.e. the width of the
@@ -439,9 +443,9 @@ void SdImportTestSmartArt::testVertialBracketList()
         m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/vertical-bracket-list.pptx"), PPTX);
     uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0, xDocShRef),
                                                  uno::UNO_QUERY_THROW);
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xShapeGroup->getCount());
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xShapeGroup->getCount());
 
-    uno::Reference<drawing::XShapes> xFirstChild(xShapeGroup->getByIndex(0), uno::UNO_QUERY);
+    uno::Reference<drawing::XShapes> xFirstChild(xShapeGroup->getByIndex(1), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xFirstChild.is());
     // Without the accompanying fix in place, this test would have failed with
     // 'actual: 2', i.e. one child shape (with its "A" text) was missing.
@@ -456,16 +460,16 @@ void SdImportTestSmartArt::testTableList()
         m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/table-list.pptx"), PPTX);
     uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xShapeGroup.is());
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xShapeGroup->getCount());
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), xShapeGroup->getCount());
 
-    uno::Reference<text::XText> xParentText(xShapeGroup->getByIndex(0), uno::UNO_QUERY);
+    uno::Reference<text::XText> xParentText(xShapeGroup->getByIndex(1), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xParentText.is());
     CPPUNIT_ASSERT_EQUAL(OUString("Parent"), xParentText->getString());
     uno::Reference<drawing::XShape> xParent(xParentText, uno::UNO_QUERY);
     CPPUNIT_ASSERT(xParent.is());
     int nParentRight = xParent->getPosition().X + xParent->getSize().Width;
 
-    uno::Reference<drawing::XShapes> xChildren(xShapeGroup->getByIndex(1), uno::UNO_QUERY);
+    uno::Reference<drawing::XShapes> xChildren(xShapeGroup->getByIndex(2), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xChildren.is());
     uno::Reference<text::XText> xChild2Text(xChildren->getByIndex(1), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xChild2Text.is());
@@ -489,13 +493,13 @@ void SdImportTestSmartArt::testAccentProcess()
     uno::Reference<drawing::XShapes> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xGroup.is());
     // 3 children: first pair, connector, second pair.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xGroup->getCount());
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), xGroup->getCount());
     uno::Reference<drawing::XShape> xGroupShape(xGroup, uno::UNO_QUERY);
     CPPUNIT_ASSERT(xGroupShape.is());
 
     // The pair is a parent (shape + text) and a child, so 3 shapes in total.
     // The order is important, first is at the back, last is at the front.
-    uno::Reference<drawing::XShapes> xFirstPair(xGroup->getByIndex(0), uno::UNO_QUERY);
+    uno::Reference<drawing::XShapes> xFirstPair(xGroup->getByIndex(1), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xFirstPair.is());
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xFirstPair->getCount());
 
@@ -538,7 +542,7 @@ void SdImportTestSmartArt::testAccentProcess()
     CPPUNIT_ASSERT_LESS(nFirstChildTop, nFirstParentTop);
 
     // Make sure that we have an arrow shape between the two pairs.
-    uno::Reference<beans::XPropertySet> xArrow(xGroup->getByIndex(1), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xArrow(xGroup->getByIndex(2), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xArrow.is());
     comphelper::SequenceAsHashMap aCustomShapeGeometry(
         xArrow->getPropertyValue("CustomShapeGeometry"));
@@ -554,7 +558,7 @@ void SdImportTestSmartArt::testAccentProcess()
     awt::Size aArrowSize = xArrowShape->getSize();
     CPPUNIT_ASSERT_LESS(aArrowSize.Width, aArrowSize.Height);
 
-    uno::Reference<drawing::XShapes> xSecondPair(xGroup->getByIndex(2), uno::UNO_QUERY);
+    uno::Reference<drawing::XShapes> xSecondPair(xGroup->getByIndex(3), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xSecondPair.is());
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xSecondPair->getCount());
     uno::Reference<text::XText> xSecondParentText(xSecondPair->getByIndex(1), uno::UNO_QUERY);
@@ -580,10 +584,10 @@ void SdImportTestSmartArt::testContinuousBlockProcess()
         PPTX);
     uno::Reference<drawing::XShapes> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xGroup.is());
-    // 2 children: background, foreground.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xGroup->getCount());
+    // 3 children: diagram background, background arrow, foreground.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xGroup->getCount());
 
-    uno::Reference<drawing::XShapes> xLinear(xGroup->getByIndex(1), uno::UNO_QUERY);
+    uno::Reference<drawing::XShapes> xLinear(xGroup->getByIndex(2), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xLinear.is());
     // 3 children: A, B and C.
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xLinear->getCount());
@@ -612,7 +616,7 @@ void SdImportTestSmartArt::testOrgChart()
     CPPUNIT_ASSERT(xGroup.is());
 
     uno::Reference<text::XText> xManager(
-        getChildShape(getChildShape(getChildShape(xGroup, 0), 0), 0), uno::UNO_QUERY);
+        getChildShape(getChildShape(getChildShape(xGroup, 1), 0), 0), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xManager.is());
     // Without the accompanying fix in place, this test would have failed: this
     // was just "Manager", and the second paragraph was lost.
@@ -637,7 +641,7 @@ void SdImportTestSmartArt::testOrgChart()
     awt::Size aManagerSize = xManagerShape->getSize();
 
     // Make sure that the manager has 2 employees.
-    uno::Reference<drawing::XShapes> xEmployees(getChildShape(getChildShape(xGroup, 0), 2),
+    uno::Reference<drawing::XShapes> xEmployees(getChildShape(getChildShape(xGroup, 1), 2),
                                                 uno::UNO_QUERY);
     CPPUNIT_ASSERT(xEmployees.is());
     // 4 children: connector, 1st employee, connector, 2nd employee.
@@ -645,7 +649,7 @@ void SdImportTestSmartArt::testOrgChart()
 
     uno::Reference<text::XText> xEmployee(
         getChildShape(
-            getChildShape(getChildShape(getChildShape(getChildShape(xGroup, 0), 2), 1), 0), 0),
+            getChildShape(getChildShape(getChildShape(getChildShape(xGroup, 1), 2), 1), 0), 0),
         uno::UNO_QUERY);
     CPPUNIT_ASSERT(xEmployee.is());
     CPPUNIT_ASSERT_EQUAL(OUString("Employee"), xEmployee->getString());
@@ -667,7 +671,7 @@ void SdImportTestSmartArt::testOrgChart()
     // the second employee was below the first one.
     uno::Reference<text::XText> xEmployee2(
         getChildShape(
-            getChildShape(getChildShape(getChildShape(getChildShape(xGroup, 0), 2), 3), 0), 0),
+            getChildShape(getChildShape(getChildShape(getChildShape(xGroup, 1), 2), 3), 0), 0),
         uno::UNO_QUERY);
     CPPUNIT_ASSERT(xEmployee2.is());
     CPPUNIT_ASSERT_EQUAL(OUString("Employee2"), xEmployee2->getString());
@@ -682,7 +686,7 @@ void SdImportTestSmartArt::testOrgChart()
     // Make sure that assistant is above employees.
     uno::Reference<text::XText> xAssistant(
         getChildShape(
-            getChildShape(getChildShape(getChildShape(getChildShape(xGroup, 0), 1), 1), 0), 0),
+            getChildShape(getChildShape(getChildShape(getChildShape(xGroup, 1), 1), 1), 0), 0),
         uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(OUString("Assistant"), xAssistant->getString());
 
@@ -696,7 +700,7 @@ void SdImportTestSmartArt::testOrgChart()
 
     // Make sure the connector of the assistant is above the shape.
     uno::Reference<drawing::XShape> xAssistantConnector(
-        getChildShape(getChildShape(getChildShape(xGroup, 0), 1), 0), uno::UNO_QUERY);
+        getChildShape(getChildShape(getChildShape(xGroup, 1), 1), 0), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xAssistantConnector.is());
     awt::Point aAssistantConnectorPos = xAssistantConnector->getPosition();
     // This failed, the vertical positions of the connector and the shape of
@@ -705,7 +709,7 @@ void SdImportTestSmartArt::testOrgChart()
 
     // Make sure the height of xManager and xManager2 is the same.
     uno::Reference<text::XText> xManager2(
-        getChildShape(getChildShape(getChildShape(xGroup, 1), 0), 0), uno::UNO_QUERY);
+        getChildShape(getChildShape(getChildShape(xGroup, 2), 0), 0), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xManager2.is());
     CPPUNIT_ASSERT_EQUAL(OUString("Manager2"), xManager2->getString());
 
@@ -737,14 +741,14 @@ void SdImportTestSmartArt::testCycleMatrix()
 
     // Without the accompanying fix in place, this test would have failed: the height was 12162,
     // which is not the mm100 equivalent of the 4064000 EMU in the input file.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(11287), xGroup->getSize().Height);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(11288), xGroup->getSize().Height);
 
-    uno::Reference<text::XText> xA1(getChildShape(getChildShape(xGroup, 1), 0), uno::UNO_QUERY);
+    uno::Reference<text::XText> xA1(getChildShape(getChildShape(xGroup, 2), 0), uno::UNO_QUERY);
     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);
+    uno::Reference<text::XText> xB1(getChildShape(getChildShape(xGroup, 2), 1), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xB1.is());
     CPPUNIT_ASSERT_EQUAL(OUString("B1"), xB1->getString());
 
@@ -758,7 +762,7 @@ void SdImportTestSmartArt::testCycleMatrix()
 
     // 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),
+    uno::Reference<text::XText> xA2(getChildShape(getChildShape(getChildShape(xGroup, 1), 0), 1),
                                     uno::UNO_QUERY);
     CPPUNIT_ASSERT(xA2.is());
     CPPUNIT_ASSERT_EQUAL(OUString("A2"), xA2->getString());
@@ -770,7 +774,7 @@ void SdImportTestSmartArt::testCycleMatrix()
     uno::Reference<drawing::XShape> xA2Shape(xA2, uno::UNO_QUERY);
     CPPUNIT_ASSERT(xA2Shape.is());
 
-    uno::Reference<text::XText> xB2(getChildShape(getChildShape(getChildShape(xGroup, 0), 1), 1),
+    uno::Reference<text::XText> xB2(getChildShape(getChildShape(getChildShape(xGroup, 1), 1), 1),
                                     uno::UNO_QUERY);
     CPPUNIT_ASSERT(xB2.is());
     CPPUNIT_ASSERT_EQUAL(OUString("B2"), xB2->getString());
@@ -784,7 +788,7 @@ void SdImportTestSmartArt::testCycleMatrix()
     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::Reference<text::XText> xC2(getChildShape(getChildShape(getChildShape(xGroup, 1), 2), 1),
                                     uno::UNO_QUERY);
     CPPUNIT_ASSERT(xC2.is());
     // Without the accompanying fix in place, this test would have failed, i.e. the order of the
@@ -793,7 +797,7 @@ void SdImportTestSmartArt::testCycleMatrix()
     uno::Reference<drawing::XShape> xC2Shape(xC2, uno::UNO_QUERY);
     CPPUNIT_ASSERT(xC2Shape.is());
 
-    uno::Reference<text::XText> xD2(getChildShape(getChildShape(getChildShape(xGroup, 0), 3), 1),
+    uno::Reference<text::XText> xD2(getChildShape(getChildShape(getChildShape(xGroup, 1), 3), 1),
                                     uno::UNO_QUERY);
     CPPUNIT_ASSERT(xD2.is());
     CPPUNIT_ASSERT_EQUAL(OUString("D2"), xD2->getString());
@@ -826,7 +830,7 @@ void SdImportTestSmartArt::testPictureStrip()
     uno::Reference<drawing::XShape> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xGroup.is());
 
-    uno::Reference<beans::XPropertySet> xFirstImage(getChildShape(getChildShape(xGroup, 0), 1),
+    uno::Reference<beans::XPropertySet> xFirstImage(getChildShape(getChildShape(xGroup, 1), 1),
                                                     uno::UNO_QUERY);
     CPPUNIT_ASSERT(xFirstImage.is());
     drawing::FillStyle eFillStyle = drawing::FillStyle_NONE;
@@ -839,7 +843,7 @@ void SdImportTestSmartArt::testPictureStrip()
     xFirstImage->getPropertyValue("FillBitmap") >>= xGraphic;
     Graphic aFirstGraphic(xGraphic);
 
-    uno::Reference<beans::XPropertySet> xSecondImage(getChildShape(getChildShape(xGroup, 1), 1),
+    uno::Reference<beans::XPropertySet> xSecondImage(getChildShape(getChildShape(xGroup, 2), 1),
                                                      uno::UNO_QUERY);
     CPPUNIT_ASSERT(xSecondImage.is());
     eFillStyle = drawing::FillStyle_NONE;
@@ -857,7 +861,7 @@ void SdImportTestSmartArt::testPictureStrip()
     CPPUNIT_ASSERT(xFirstImage.is());
     uno::Reference<drawing::XShape> xSecondImageShape(xSecondImage, uno::UNO_QUERY);
     CPPUNIT_ASSERT(xSecondImage.is());
-    uno::Reference<drawing::XShape> xThirdImageShape(getChildShape(getChildShape(xGroup, 2), 1),
+    uno::Reference<drawing::XShape> xThirdImageShape(getChildShape(getChildShape(xGroup, 3), 1),
                                                      uno::UNO_QUERY);
     CPPUNIT_ASSERT(xThirdImageShape.is());
     // Without the accompanying fix in place, this test would have failed: the first and the second
@@ -874,11 +878,12 @@ void SdImportTestSmartArt::testPictureStrip()
     CPPUNIT_ASSERT(xTitle.is());
     // Without the accompanying fix in place, this test would have failed with 'Expected greater
     // than: 2873; Actual  : 2320', i.e. the title shape and the diagram overlapped.
+    uno::Reference<drawing::XShape> xFirstPair = getChildShape(xGroup, 1);
     CPPUNIT_ASSERT_GREATER(xTitle->getPosition().Y + xTitle->getSize().Height,
-                           xGroup->getPosition().Y);
+                           xFirstPair->getPosition().Y);
 
     // Make sure that left margin is 60% of width (if you count width in points and margin in mms).
-    uno::Reference<beans::XPropertySet> xFirstText(getChildShape(getChildShape(xGroup, 0), 0),
+    uno::Reference<beans::XPropertySet> xFirstText(getChildShape(getChildShape(xGroup, 1), 0),
                                                    uno::UNO_QUERY);
     CPPUNIT_ASSERT(xFirstText.is());
     sal_Int32 nTextLeftDistance = 0;
@@ -892,7 +897,6 @@ void SdImportTestSmartArt::testPictureStrip()
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(nWidth * fFactor), nTextLeftDistance);
 
     // Make sure that aspect ratio is not ignored, i.e. width is not larger than height 3 times.
-    uno::Reference<drawing::XShape> xFirstPair = getChildShape(xGroup, 0);
     awt::Size aFirstPairSize = xFirstPair->getSize();
     // Without the accompanying fix in place, this test would have failed: bad width was 16932, good
     // width is 12540, but let's accept 12541 as well.
@@ -921,6 +925,78 @@ void SdImportTestSmartArt::testInteropGrabBag()
     xDocShRef->DoClose();
 }
 
+void SdImportTestSmartArt::testBackground()
+{
+    sd::DrawDocShellRef xDocShRef = loadURL(
+        m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-background.pptx"), PPTX);
+    uno::Reference<drawing::XShapes> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
+    CPPUNIT_ASSERT(xGroup.is());
+
+    // background should fill whole diagram
+    uno::Reference<drawing::XShape> xShapeGroup(xGroup, uno::UNO_QUERY);
+    uno::Reference<drawing::XShape> xShape(xGroup->getByIndex(0), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(xShape->getPosition().X, xShapeGroup->getPosition().X);
+    CPPUNIT_ASSERT_EQUAL(xShape->getPosition().Y, xShapeGroup->getPosition().Y);
+    CPPUNIT_ASSERT_EQUAL(xShape->getSize().Width, xShapeGroup->getSize().Width);
+    CPPUNIT_ASSERT_EQUAL(xShape->getSize().Height, xShapeGroup->getSize().Height);
+
+    uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY_THROW);
+    drawing::FillStyle eFillStyle = drawing::FillStyle_NONE;
+    xPropertySet->getPropertyValue("FillStyle") >>= eFillStyle;
+    CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, eFillStyle);
+
+    sal_Int32 nFillColor = 0;
+    xPropertySet->getPropertyValue("FillColor") >>= nFillColor;
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x339933), nFillColor);
+
+    bool bMoveProtect = false;
+    xPropertySet->getPropertyValue("MoveProtect") >>= bMoveProtect;
+    CPPUNIT_ASSERT_EQUAL(true, bMoveProtect);
+
+    bool bSizeProtect = false;
+    xPropertySet->getPropertyValue("SizeProtect") >>= bSizeProtect;
+    CPPUNIT_ASSERT_EQUAL(true, bSizeProtect);
+
+    xDocShRef->DoClose();
+}
+
+void SdImportTestSmartArt::testBackgroundDrawingmlFallback()
+{
+    // same as testBackground, but test file contains drawingML fallback
+
+    sd::DrawDocShellRef xDocShRef = loadURL(
+        m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-background-drawingml-fallback.pptx"), PPTX);
+    uno::Reference<drawing::XShapes> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
+    CPPUNIT_ASSERT(xGroup.is());
+
+    // background should fill whole diagram
+    uno::Reference<drawing::XShape> xShapeGroup(xGroup, uno::UNO_QUERY);
+    uno::Reference<drawing::XShape> xShape(xGroup->getByIndex(0), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(xShape->getPosition().X, xShapeGroup->getPosition().X);
+    CPPUNIT_ASSERT_EQUAL(xShape->getPosition().Y, xShapeGroup->getPosition().Y);
+    CPPUNIT_ASSERT_EQUAL(xShape->getSize().Width, xShapeGroup->getSize().Width);
+    CPPUNIT_ASSERT_EQUAL(xShape->getSize().Height, xShapeGroup->getSize().Height);
+
+    uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY_THROW);
+    drawing::FillStyle eFillStyle = drawing::FillStyle_NONE;
+    xPropertySet->getPropertyValue("FillStyle") >>= eFillStyle;
+    CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, eFillStyle);
+
+    sal_Int32 nFillColor = 0;
+    xPropertySet->getPropertyValue("FillColor") >>= nFillColor;
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x339933), nFillColor);
+
+    bool bMoveProtect = false;
+    xPropertySet->getPropertyValue("MoveProtect") >>= bMoveProtect;
+    CPPUNIT_ASSERT_EQUAL(true, bMoveProtect);
+
+    bool bSizeProtect = false;
+    xPropertySet->getPropertyValue("SizeProtect") >>= bSizeProtect;
+    CPPUNIT_ASSERT_EQUAL(true, bSizeProtect);
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 6ca42293bf1c..362d67814d91 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -447,7 +447,7 @@ void SdImportTest::testN862510_2()
         CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount());
         SdrObjGroup *pGrpObj = dynamic_cast<SdrObjGroup *>( pPage->GetObj( 0 ) );
         CPPUNIT_ASSERT( pGrpObj );
-        SdrObjCustomShape *pObj = dynamic_cast<SdrObjCustomShape *>( pGrpObj->GetSubList()->GetObj( 0 ) );
+        SdrObjCustomShape *pObj = dynamic_cast<SdrObjCustomShape *>( pGrpObj->GetSubList()->GetObj( 1 ) );
         CPPUNIT_ASSERT( pObj );
         CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong Text Rotation!", 90.0, pObj->GetExtraTextRotation( true ) );
     }
@@ -833,7 +833,8 @@ void SdImportTest::testBnc870237()
     const SdrPage *pPage = GetPage( 1, xDocShRef );
 
     // Simulate a:ext inside dsp:txXfrm with changing the lower distance
-    const SdrObjGroup* pObj = dynamic_cast<SdrObjGroup*>( pPage->GetObj( 0 ) );
+    const SdrObjGroup* pGroupObj = dynamic_cast<SdrObjGroup*>( pPage->GetObj( 0 ) );
+    const SdrObject* pObj = pGroupObj->GetSubList()->GetObj( 1 );
     CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr);
     CPPUNIT_ASSERT_EQUAL( sal_Int32(0), pObj->GetMergedItem(SDRATTR_TEXT_UPPERDIST).GetValue());
     CPPUNIT_ASSERT_EQUAL( sal_Int32(9919), pObj->GetMergedItem(SDRATTR_TEXT_LOWERDIST).GetValue());
@@ -1281,7 +1282,7 @@ void SdImportTest::testTdf93830()
 
     // Get the first text box from group shape
     uno::Reference< container::XIndexAccess > xShape( xPage->getByIndex(0), uno::UNO_QUERY );
-    uno::Reference< beans::XPropertySet > xPropSet( xShape->getByIndex(2), uno::UNO_QUERY );
+    uno::Reference< beans::XPropertySet > xPropSet( xShape->getByIndex(3), uno::UNO_QUERY );
     CPPUNIT_ASSERT_MESSAGE( "no textbox shape", xPropSet.is() );
 
     sal_Int32 nTextLeftDistance = 0;
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 6bd4debbb768..0a947b055abd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -121,14 +121,14 @@ DECLARE_OOXMLEXPORT_TEST(testSmartart, "smartart.docx")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); // One groupshape in the doc
 
     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xGroup->getCount()); // 3 rectangles and an arrow in the group
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xGroup->getCount()); // background, 3 rectangles and an arrow in the group
 
-    uno::Reference<beans::XPropertySet> xPropertySet(xGroup->getByIndex(1), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xPropertySet(xGroup->getByIndex(2), uno::UNO_QUERY);
     sal_Int32 nValue(0);
     xPropertySet->getPropertyValue("FillColor") >>= nValue;
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f81bd), nValue); // If fill color is right, theme import is OK
 
-    uno::Reference<text::XTextRange> xTextRange(xGroup->getByIndex(1), uno::UNO_QUERY);
+    uno::Reference<text::XTextRange> xTextRange(xGroup->getByIndex(2), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(OUString("Sample"), xTextRange->getString()); // Shape has text
 
     uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextRange->getText(), uno::UNO_QUERY);
@@ -491,7 +491,7 @@ DECLARE_OOXMLEXPORT_TEST(testSmartartStrict, "strict-smartart.docx")
 {
     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
     // This was 0, SmartArt was visually missing.
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(6), xGroup->getCount()); // 3 ellipses + 3 arrows
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(7), xGroup->getCount()); // background, 3 ellipses + 3 arrows
 }
 
 DECLARE_OOXMLEXPORT_TEST(testLibreOfficeHang, "frame-wrap-auto.docx")
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 982e02f57c87..e05d7490519a 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1050,11 +1050,11 @@ DECLARE_OOXMLIMPORT_TEST(testFdo87488, "fdo87488.docx")
     // StarView MetaFile.
     uno::Reference<container::XIndexAccess> group(getShape(1), uno::UNO_QUERY);
     {
-        uno::Reference<text::XTextRange> text(group->getByIndex(0), uno::UNO_QUERY);
+        uno::Reference<text::XTextRange> text(group->getByIndex(1), uno::UNO_QUERY);
         CPPUNIT_ASSERT_EQUAL(OUString("text2"), text->getString());
     }
     {
-        uno::Reference<beans::XPropertySet> props(group->getByIndex(0), uno::UNO_QUERY);
+        uno::Reference<beans::XPropertySet> props(group->getByIndex(1), uno::UNO_QUERY);
         CPPUNIT_ASSERT_EQUAL(props->getPropertyValue("RotateAngle"),
                              uno::makeAny<sal_Int32>(270 * 100));
         comphelper::SequenceAsHashMap geom(props->getPropertyValue("CustomShapeGeometry"));


More information about the Libreoffice-commits mailing list