LCOV - code coverage report
Current view: top level - sw/qa/extras/ooxmlexport - ooxmlsdrexport.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 837 837 100.0 %
Date: 2014-11-03 Functions: 717 798 89.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #include <swmodeltestbase.hxx>
      11             : 
      12             : #if !defined(WNT)
      13             : 
      14             : #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
      15             : #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
      16             : #include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
      17             : #include <com/sun/star/drawing/FillStyle.hpp>
      18             : #include <com/sun/star/drawing/Hatch.hpp>
      19             : #include <com/sun/star/drawing/LineJoint.hpp>
      20             : #include <com/sun/star/drawing/LineStyle.hpp>
      21             : #include <com/sun/star/drawing/PointSequenceSequence.hpp>
      22             : #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
      23             : #include <com/sun/star/style/LineSpacing.hpp>
      24             : #include <com/sun/star/style/LineSpacingMode.hpp>
      25             : #include <com/sun/star/text/GraphicCrop.hpp>
      26             : 
      27             : #include <comphelper/sequenceashashmap.hxx>
      28             : #include <comphelper/sequenceasvector.hxx>
      29             : 
      30         316 : class Test : public SwModelTestBase
      31             : {
      32             : public:
      33         316 :     Test() : SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open XML Text") {}
      34             : 
      35             : protected:
      36             :     /**
      37             :      * Blacklist handling
      38             :      */
      39         158 :     bool mustTestImportOf(const char* filename) const SAL_OVERRIDE {
      40             :         // If the testcase is stored in some other format, it's pointless to test.
      41         158 :         return (OString(filename).endsWith(".docx"));
      42             :     }
      43             : };
      44             : 
      45          28 : DECLARE_OOXMLEXPORT_TEST(testDmlShapeTitle, "dml-shape-title.docx")
      46             : {
      47           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Title"), getProperty<OUString>(getShape(1), "Title"));
      48           4 :     CPPUNIT_ASSERT_EQUAL(OUString("Description"), getProperty<OUString>(getShape(1), "Description"));
      49           4 : }
      50             : 
      51          26 : DECLARE_OOXMLEXPORT_TEST(testDmlZorder, "dml-zorder.odt")
      52             : {
      53           2 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
      54           2 :     if (!pXmlDoc)
      55           2 :         return;
      56             :     // This was "0": causing that in Word, the second shape was on top, while in the original odt the first shape is on top.
      57           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor", "relativeHeight", "2");
      58             : }
      59             : 
      60          28 : DECLARE_OOXMLEXPORT_TEST(testDmlShapeRelsize, "dml-shape-relsize.docx")
      61             : {
      62           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
      63           4 :     if (!pXmlDoc)
      64           6 :         return;
      65             :     // Relative size wasn't exported all, then relativeFrom was "page", not "margin".
      66           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp14:sizeRelH", "relativeFrom", "margin");
      67             : }
      68             : 
      69          28 : DECLARE_OOXMLEXPORT_TEST(testDmlPictureInTextframe, "dml-picture-in-textframe.docx")
      70             : {
      71           4 :     if (!mbExported)
      72           6 :         return;
      73             : 
      74           2 :     uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL());
      75           2 :     CPPUNIT_ASSERT_EQUAL(true, bool(xNameAccess->hasByName("word/media/image1.gif")));
      76             :     // This was also true, image was written twice.
      77           2 :     CPPUNIT_ASSERT_EQUAL(false, bool(xNameAccess->hasByName("word/media/image2.gif")));
      78             : }
      79             : 
      80          28 : DECLARE_OOXMLEXPORT_TEST(testDmlGroupshapeRelsize, "dml-groupshape-relsize.docx")
      81             : {
      82           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
      83           4 :     if (!pXmlDoc)
      84           6 :         return;
      85             :     // Relative size wasn't imported.
      86           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp14:sizeRelH", "relativeFrom", "margin");
      87             : }
      88             : 
      89          28 : DECLARE_OOXMLEXPORT_TEST(testDmlTextshape, "dml-textshape.docx")
      90             : {
      91           4 :     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
      92           6 :     uno::Reference<drawing::XShape> xShape(xGroup->getByIndex(1), uno::UNO_QUERY);
      93             :     // This was drawing::FillStyle_NONE.
      94           4 :     CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xShape, "FillStyle"));
      95             :     // This was drawing::LineStyle_NONE.
      96           4 :     CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID, getProperty<drawing::LineStyle>(xShape, "LineStyle"));
      97             : 
      98           4 :     xmlDocPtr pXmlDocument = parseExport("word/document.xml");
      99           4 :     if (!pXmlDocument)
     100           6 :         return;
     101             :     // This was wrap="none".
     102           2 :     assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wpg:wgp/wps:wsp[2]/wps:bodyPr", "wrap", "square");
     103             : 
     104           2 :     xShape.set(xGroup->getByIndex(3), uno::UNO_QUERY);
     105           4 :     OUString aType = comphelper::SequenceAsHashMap(getProperty<beans::PropertyValues>(xShape, "CustomShapeGeometry"))["Type"].get<OUString>();
     106           2 :     CPPUNIT_ASSERT_EQUAL(OUString("ooxml-bentConnector3"), aType);
     107             :     // Connector was incorrectly shifted towards the top left corner, X was 552, Y was 0.
     108           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(4018), xShape->getPosition().X);
     109           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1256), xShape->getPosition().Y);
     110             : 
     111           2 :     xShape.set(xGroup->getByIndex(5), uno::UNO_QUERY);
     112             :     // This was incorrectly shifted towards the top of the page, Y was 106.
     113           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1016), xShape->getPosition().Y);
     114             : }
     115             : 
     116          28 : DECLARE_OOXMLEXPORT_TEST(testDMLSolidfillAlpha, "dml-solidfill-alpha.docx")
     117             : {
     118             :     // Problem was that the transparency was not exported (a:alpha).
     119             :     // RGB color (a:srgbClr)
     120           4 :     uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);;
     121           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(70), getProperty<sal_Int16>(xShape, "FillTransparence"));
     122             : 
     123             :     // Theme color (a:schemeClr)
     124           4 :     xShape.set(getShape(2), uno::UNO_QUERY);
     125           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(20), getProperty<sal_Int16>(xShape, "FillTransparence"));
     126           4 : }
     127             : 
     128          28 : DECLARE_OOXMLEXPORT_TEST(testDMLCustomGeometry, "dml-customgeometry-cubicbezier.docx")
     129             : {
     130             : 
     131             :     // The problem was that a custom shape was not exported.
     132           4 :     uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(getShape(1), "CustomShapeGeometry");
     133           8 :     uno::Sequence<beans::PropertyValue> aPathProps;
     134          36 :     for (int i = 0; i < aProps.getLength(); ++i)
     135             :     {
     136          32 :         const beans::PropertyValue& rProp = aProps[i];
     137          32 :         if (rProp.Name == "Path")
     138           4 :             rProp.Value >>= aPathProps;
     139             :     }
     140           8 :     uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aPairs;
     141           8 :     uno::Sequence<drawing::EnhancedCustomShapeSegment> aSegments;
     142          20 :     for (int i = 0; i < aPathProps.getLength(); ++i)
     143             :     {
     144          16 :         const beans::PropertyValue& rProp = aPathProps[i];
     145          16 :         if (rProp.Name == "Coordinates")
     146           4 :             rProp.Value >>= aPairs;
     147          12 :         else if (rProp.Name == "Segments")
     148           4 :             rProp.Value >>= aSegments;
     149             :     }
     150             : 
     151             :     // (a:moveTo)
     152           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(1), aSegments[0].Count);
     153           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(drawing::EnhancedCustomShapeSegmentCommand::MOVETO), aSegments[0].Command );
     154             : 
     155             :     // (a:cubicBezTo)
     156           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(5), aSegments[1].Count);
     157           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(drawing::EnhancedCustomShapeSegmentCommand::CURVETO), aSegments[1].Command );
     158             : 
     159             :     // Coordinates
     160           4 :     sal_Int32 nLength = 16;
     161           4 :     CPPUNIT_ASSERT_EQUAL(nLength, aPairs.getLength());
     162             :     std::pair<sal_Int32,sal_Int32> aCoordinates[] =
     163             :     {
     164             :         std::pair<sal_Int32,sal_Int32>(607, 0),
     165             :         std::pair<sal_Int32,sal_Int32>(450, 44),
     166             :         std::pair<sal_Int32,sal_Int32>(300, 57),
     167             :         std::pair<sal_Int32,sal_Int32>(176, 57),
     168             :         std::pair<sal_Int32,sal_Int32>(109, 57),
     169             :         std::pair<sal_Int32,sal_Int32>(49, 53),
     170             :         std::pair<sal_Int32,sal_Int32>(0, 48),
     171             :         std::pair<sal_Int32,sal_Int32>(66, 58),
     172             :         std::pair<sal_Int32,sal_Int32>(152, 66),
     173             :         std::pair<sal_Int32,sal_Int32>(251, 66),
     174             :         std::pair<sal_Int32,sal_Int32>(358, 66),
     175             :         std::pair<sal_Int32,sal_Int32>(480, 56),
     176             :         std::pair<sal_Int32,sal_Int32>(607, 27),
     177             :         std::pair<sal_Int32,sal_Int32>(607, 0),
     178             :         std::pair<sal_Int32,sal_Int32>(607, 0),
     179             :         std::pair<sal_Int32,sal_Int32>(607, 0)
     180           4 :     };
     181             : 
     182          68 :     for( int i = 0; i < nLength; ++i )
     183             :     {
     184          64 :         CPPUNIT_ASSERT_EQUAL(aCoordinates[i].first, aPairs[i].First.Value.get<sal_Int32>());
     185          64 :         CPPUNIT_ASSERT_EQUAL(aCoordinates[i].second, aPairs[i].Second.Value.get<sal_Int32>());
     186           4 :     }
     187           4 : }
     188             : 
     189          28 : DECLARE_OOXMLEXPORT_TEST(testDmlRectangleRelsize, "dml-rectangle-relsize.docx")
     190             : {
     191             :     // This was around 19560, as we did not read wp14:pctHeight for
     192             :     // drawinglayer shapes and the fallback data was invalid.
     193           4 :     OString aMessage("Height is only " + OString::number(getShape(1)->getSize().Height));
     194           4 :     CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), getShape(1)->getSize().Height >= 20967);
     195             : 
     196             :     // This was around 0: relative size of 0% was imported as 0, not "fall back to absolute size".
     197           4 :     CPPUNIT_ASSERT(getShape(2)->getSize().Height > 300);
     198           4 : }
     199             : 
     200          28 : DECLARE_OOXMLEXPORT_TEST(testDMLTextFrameVertAdjust, "dml-textframe-vertadjust.docx")
     201             : {
     202             :     // DOCX textboxes with text are imported as text frames but in Writer text frames did not have
     203             :     // TextVerticalAdjust attribute so far.
     204             : 
     205             :     // 1st frame's context is adjusted to the top
     206           4 :     uno::Reference<beans::XPropertySet> xFrame(getShapeByName("Rectangle 1"), uno::UNO_QUERY);
     207           4 :     CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_TOP, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust"));
     208             :     // 2nd frame's context is adjusted to the center
     209           4 :     xFrame.set(getShapeByName("Rectangle 2"), uno::UNO_QUERY);
     210           4 :     CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_CENTER, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust"));
     211             :     // 3rd frame's context is adjusted to the bottom
     212           4 :     xFrame.set(getShapeByName("Rectangle 3"), uno::UNO_QUERY);
     213           4 :     CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_BOTTOM, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust"));
     214           4 : }
     215             : 
     216          28 : DECLARE_OOXMLEXPORT_TEST(testDMLShapeFillBitmapCrop, "dml-shape-fillbitmapcrop.docx")
     217             : {
     218             :     // Test the new GraphicCrop property which is introduced to define
     219             :     // cropping of shapes filled with a picture in stretch mode.
     220             : 
     221             :     // 1st shape has some cropping
     222           4 :     text::GraphicCrop aGraphicCropStruct = getProperty<text::GraphicCrop>(getShape(1), "GraphicCrop");
     223           4 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(mbExported ? 454 : 455 ), aGraphicCropStruct.Left );
     224           4 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(mbExported ? 367 : 368 ), aGraphicCropStruct.Right );
     225           4 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(mbExported ? -454 : -455 ), aGraphicCropStruct.Top );
     226           4 :     CPPUNIT_ASSERT_EQUAL( sal_Int32(mbExported ? -367 : -368 ), aGraphicCropStruct.Bottom );
     227             : 
     228             :     // 2nd shape has no cropping
     229           4 :     aGraphicCropStruct = getProperty<text::GraphicCrop>(getShape(2), "GraphicCrop");
     230           4 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Left );
     231           4 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Right );
     232           4 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Top );
     233           4 :     CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Bottom );
     234             : 
     235           4 : }
     236             : 
     237          28 : DECLARE_OOXMLEXPORT_TEST(testDMLShapeFillPattern, "dml-shape-fillpattern.docx")
     238             : {
     239             :     // Hatching was ignored by the export.
     240             : 
     241             :     // 1st shape: light horizontal pattern (ltHorz)
     242           4 :     drawing::Hatch aHatch = getProperty<drawing::Hatch>(getShape(1), "FillHatch");
     243           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aHatch.Angle);
     244           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(50), aHatch.Distance);
     245           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x99FF66), aHatch.Color);
     246           4 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_SINGLE, aHatch.Style);
     247             : 
     248             :     // 2nd shape: horizontal pattern (horz)
     249           4 :     aHatch = getProperty<drawing::Hatch>(getShape(2), "FillHatch");
     250           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aHatch.Angle);
     251           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), aHatch.Distance);
     252           4 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_SINGLE, aHatch.Style);
     253             : 
     254             :     // 3rd shape: light vertical pattern (ltVert)
     255           4 :     aHatch = getProperty<drawing::Hatch>(getShape(3), "FillHatch");
     256           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(900), aHatch.Angle);
     257           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(50), aHatch.Distance);
     258           4 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_SINGLE, aHatch.Style);
     259             : 
     260             :     // 4th shape: vertical pattern (vert)
     261           4 :     aHatch = getProperty<drawing::Hatch>(getShape(4), "FillHatch");
     262           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(900), aHatch.Angle);
     263           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), aHatch.Distance);
     264           4 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_SINGLE, aHatch.Style);
     265             : 
     266             :     // 5th shape: light upward diagonal pattern (ltUpDiag)
     267           4 :     aHatch = getProperty<drawing::Hatch>(getShape(5), "FillHatch");
     268           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(450), aHatch.Angle);
     269           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(50), aHatch.Distance);
     270           4 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_SINGLE, aHatch.Style);
     271             : 
     272             :     // 6th shape: wide upward diagonal pattern (wdUpDiag)
     273           4 :     aHatch = getProperty<drawing::Hatch>(getShape(6), "FillHatch");
     274           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(450), aHatch.Angle);
     275           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), aHatch.Distance);
     276           4 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_SINGLE, aHatch.Style);
     277             : 
     278             :     // 7th shape: light downward diagonal pattern (ltDnDiag)
     279           4 :     aHatch = getProperty<drawing::Hatch>(getShape(7), "FillHatch");
     280           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1350), aHatch.Angle);
     281           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(50), aHatch.Distance);
     282           4 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_SINGLE, aHatch.Style);
     283             : 
     284             :     // 8th shape: wide downward diagonal pattern (wdDnDiag)
     285           4 :     aHatch = getProperty<drawing::Hatch>(getShape(8), "FillHatch");
     286           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1350), aHatch.Angle);
     287           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), aHatch.Distance);
     288           4 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_SINGLE, aHatch.Style);
     289             : 
     290             :     // 9th shape: small grid pattern (smGrid)
     291           4 :     aHatch = getProperty<drawing::Hatch>(getShape(9), "FillHatch");
     292           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aHatch.Angle);
     293           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(50), aHatch.Distance);
     294           4 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_DOUBLE, aHatch.Style);
     295             : 
     296             :     // 10th shape: large grid pattern (lgGrid)
     297           4 :     aHatch = getProperty<drawing::Hatch>(getShape(10), "FillHatch");
     298           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aHatch.Angle);
     299           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), aHatch.Distance);
     300           4 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_DOUBLE, aHatch.Style);
     301             : 
     302             :     // 11th shape: small checker board pattern (smCheck)
     303           4 :     aHatch = getProperty<drawing::Hatch>(getShape(11), "FillHatch");
     304           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(450), aHatch.Angle);
     305           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(50), aHatch.Distance);
     306           4 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_DOUBLE, aHatch.Style);
     307             : 
     308             :     // 12th shape: outlined diamond pattern (openDmnd)
     309           4 :     aHatch = getProperty<drawing::Hatch>(getShape(12), "FillHatch");
     310           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(450), aHatch.Angle);
     311           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(100), aHatch.Distance);
     312           4 :     CPPUNIT_ASSERT_EQUAL(drawing::HatchStyle_DOUBLE, aHatch.Style);
     313           4 : }
     314             : 
     315          28 : DECLARE_OOXMLEXPORT_TEST(testDMLGroupShapeChildPosition, "dml-groupshape-childposition.docx")
     316             : {
     317             :     // Problem was parent transformation was ignored fully, but translate component
     318             :     // which specify the position must be also applied for children of the group.
     319             : 
     320           4 :     uno::Reference<drawing::XShapes> xGroup(getShape(1), uno::UNO_QUERY);
     321           8 :     uno::Reference<drawing::XShape> xChildGroup(xGroup->getByIndex(1), uno::UNO_QUERY);
     322           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(mbExported ? -2120 : -2122), xChildGroup->getPosition().X);
     323           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(mbExported ? 11336 : 11333), xChildGroup->getPosition().Y);
     324             : 
     325           4 :     xGroup.set(xChildGroup, uno::UNO_QUERY);
     326           4 :     xChildGroup.set(xGroup->getByIndex(0), uno::UNO_QUERY);
     327           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(mbExported ? -1856 : -1858), xChildGroup->getPosition().X);
     328           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(mbExported ? 11336 : 11333), xChildGroup->getPosition().Y);
     329             : 
     330           4 :     xChildGroup.set(xGroup->getByIndex(1), uno::UNO_QUERY);
     331           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(mbExported ? -2120 : -2122), xChildGroup->getPosition().X);
     332           8 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(mbExported ? 14026 : 14023), xChildGroup->getPosition().Y);
     333           4 : }
     334             : 
     335          28 : DECLARE_OOXMLEXPORT_TEST(testDMLGradientFillTheme, "dml-gradientfill-theme.docx")
     336             : {
     337             :     // Problem was when a fill gradient was imported from a theme, (fillRef in ooxml)
     338             :     // not just the theme was written out but the explicit values too
     339             :     // Besides the duplication of values it causes problems with writing out
     340             :     // <a:schemeClr val="phClr"> into document.xml, while phClr can be used just for theme definitions.
     341           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     342           4 :     if (!pXmlDoc)
     343           6 :         return;
     344             : 
     345             :     // check no explicit gradFill has been exported
     346             :     assertXPath(pXmlDoc,
     347             :             "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill",
     348           2 :             0);
     349             : 
     350             :     // check shape style has been exported
     351             :     assertXPath(pXmlDoc,
     352             :             "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef",
     353           2 :             "idx", "2");
     354             :     assertXPath(pXmlDoc,
     355             :             "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef/a:schemeClr",
     356           2 :             "val", "accent1");
     357             : }
     358             : 
     359          28 : DECLARE_OOXMLEXPORT_TEST(testDMLGroupShapeParaSpacing, "dml-groupshape-paraspacing.docx")
     360             : {
     361             :     // Paragraph spacing (top/bottom margin and line spacing) inside a group shape was not imported
     362           4 :     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
     363           8 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xGroup->getByIndex(1), uno::UNO_QUERY)->getText();
     364             : 
     365             :     // 1st paragraph has 1.5x line spacing but it has no spacing before/after.
     366           8 :     uno::Reference<text::XTextRange> xRun = getRun(getParagraphOfText(1, xText),1);
     367           4 :     style::LineSpacing aLineSpacing = getProperty<style::LineSpacing>(xRun, "ParaLineSpacing");
     368           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::PROP), aLineSpacing.Mode);
     369           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(150), aLineSpacing.Height);
     370           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaTopMargin"));
     371           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaBottomMargin"));
     372             : 
     373             :     // 2nd paragraph has double line spacing but it has no spacing before/after.
     374           4 :     xRun.set(getRun(getParagraphOfText(2, xText),1));
     375           4 :     aLineSpacing = getProperty<style::LineSpacing>(xRun, "ParaLineSpacing");
     376           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::PROP), aLineSpacing.Mode);
     377           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(200), aLineSpacing.Height);
     378           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaTopMargin"));
     379           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaBottomMargin"));
     380             : 
     381             :     // 3rd paragraph has 24 pt line spacing but it has no spacing before/after.
     382           4 :     xRun.set(getRun(getParagraphOfText(3, xText),1));
     383           4 :     aLineSpacing = getProperty<style::LineSpacing>(xRun, "ParaLineSpacing");
     384           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::MINIMUM), aLineSpacing.Mode);
     385           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(847), aLineSpacing.Height);
     386           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaTopMargin"));
     387           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaBottomMargin"));
     388             : 
     389             :     // 4th paragraph has 1.75x line spacing but it has no spacing before/after.
     390           4 :     xRun.set(getRun(getParagraphOfText(4, xText),1));
     391           4 :     aLineSpacing = getProperty<style::LineSpacing>(xRun, "ParaLineSpacing");
     392           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::PROP), aLineSpacing.Mode);
     393           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(175), aLineSpacing.Height);
     394           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaTopMargin"));
     395           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaBottomMargin"));
     396             : 
     397             :     // 5th paragraph has margins which are defined by w:beforeLines and w:afterLines.
     398           4 :     xRun.set(getRun(getParagraphOfText(5, xText),1));
     399           4 :     aLineSpacing = getProperty<style::LineSpacing>(xRun, "ParaLineSpacing");
     400           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::PROP), aLineSpacing.Mode);
     401           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(100), aLineSpacing.Height);
     402           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(635), getProperty<sal_Int32>(xRun, "ParaTopMargin"));
     403           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(741), getProperty<sal_Int32>(xRun, "ParaBottomMargin"));
     404             : 
     405             :     // 6th paragraph has margins which are defined by w:before and w:after.
     406           4 :     xRun.set(getRun(getParagraphOfText(6, xText),1));
     407           4 :     aLineSpacing = getProperty<style::LineSpacing>(xRun, "ParaLineSpacing");
     408           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::LineSpacingMode::PROP), aLineSpacing.Mode);
     409           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int16(100), aLineSpacing.Height);
     410           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(423), getProperty<sal_Int32>(xRun, "ParaTopMargin"));
     411           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(635), getProperty<sal_Int32>(xRun, "ParaBottomMargin"));
     412             : 
     413             :     // 7th paragraph has auto paragraph margins a:afterAutospacing and a:beforeAutospacing, which means margins must be ignored.
     414           4 :     xRun.set(getRun(getParagraphOfText(7, xText),1));
     415           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaTopMargin"));
     416           8 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaBottomMargin"));
     417           4 : }
     418             : 
     419          28 : DECLARE_OOXMLEXPORT_TEST(testTableFloatingMargins, "table-floating-margins.docx")
     420             : {
     421             :     // In case the table had custom left cell margin, the horizontal position was still incorrect (too small, -199).
     422           4 :     uno::Reference<beans::XPropertySet> xFrame(getShape(1), uno::UNO_QUERY);
     423           4 :     sal_Int32 nHoriOrientPosition = getProperty<sal_Int32>(xFrame, "HoriOrientPosition");
     424           4 :     CPPUNIT_ASSERT(nHoriOrientPosition < sal_Int32(-495));
     425             :     // These were 0 as well, due to lack of import.
     426           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1000), getProperty<sal_Int32>(xFrame, "TopMargin"));
     427           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(2000), getProperty<sal_Int32>(xFrame, "BottomMargin"));
     428             : 
     429             :     // Paragraph bottom margin wasn't 0 in the A1 cell of the floating table.
     430           4 :     xmlDocPtr pXmlDoc = parseExport();
     431           4 :     if (!pXmlDoc)
     432           6 :         return;
     433           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:textbox/w:txbxContent/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "after", "0");
     434             : }
     435             : 
     436          28 : DECLARE_OOXMLEXPORT_TEST(testFdo69636, "fdo69636.docx")
     437             : {
     438             :     /*
     439             :      * The problem was that the exporter didn't mirror the workaround of the
     440             :      * importer, regarding the btLr text frame direction: the
     441             :      * mso-layout-flow-alt property was completely missing in the output.
     442             :      */
     443           4 :     xmlDocPtr pXmlDoc = parseExport();
     444           4 :     if (!pXmlDoc)
     445           6 :         return;
     446             :     // VML
     447           2 :     CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:textbox", "style").match("mso-layout-flow-alt:bottom-to-top"));
     448             :     // drawingML
     449           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:bodyPr", "vert", "vert270");
     450             : }
     451             : 
     452          28 : DECLARE_OOXMLEXPORT_TEST(testVMLData, "TestVMLData.docx")
     453             : {
     454             :     // The problem was exporter was exporting vml data for shape in w:rPr element.
     455             :     // vml data should not come under w:rPr element.
     456           4 :     xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
     457           4 :     if (!pXmlDoc)
     458           6 :         return;
     459           2 :     CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "stroked").match("f"));
     460             : }
     461             : 
     462          28 : DECLARE_OOXMLEXPORT_TEST(testImageData, "image_data.docx")
     463             : {
     464             :     // The problem was exporter was exporting v:imagedata data for shape in w:pict as v:fill w element.
     465             : 
     466           4 :     xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
     467           4 :     if (!pXmlDoc)
     468           6 :         return;
     469           2 :     CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:imagedata", "detectmouseclick").match("t"));
     470             : }
     471             : 
     472          28 : DECLARE_OOXMLEXPORT_TEST(testFdo70838, "fdo70838.docx")
     473             : {
     474             :     // The problem was that VMLExport::Commit didn't save the correct width and height,
     475             :     // and ImplEESdrWriter::ImplFlipBoundingBox made a mistake calculating the position
     476             : 
     477           4 :     xmlDocPtr pXmlDocument = parseExport("word/document.xml");
     478           4 :     if (!pXmlDocument)
     479           6 :         return;
     480             : 
     481             :     // Check DML document
     482             : 
     483             :     sal_Int32 aXPos[4], aYPos[4];
     484           2 :     aXPos[0] = getXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/wp:positionH/wp:posOffset").toInt32();
     485           2 :     aXPos[1] = getXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/wp:positionH/wp:posOffset").toInt32();
     486           2 :     aXPos[2] = getXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor/wp:positionH/wp:posOffset").toInt32();
     487           2 :     aXPos[3] = getXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[4]/mc:Choice/w:drawing/wp:anchor/wp:positionH/wp:posOffset").toInt32();
     488             : 
     489           2 :     aYPos[0] = getXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/wp:positionV/wp:posOffset").toInt32();
     490           2 :     aYPos[1] = getXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/wp:positionV/wp:posOffset").toInt32();
     491           2 :     aYPos[2] = getXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor/wp:positionV/wp:posOffset").toInt32();
     492           2 :     aYPos[3] = getXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[4]/mc:Choice/w:drawing/wp:anchor/wp:positionV/wp:posOffset").toInt32();
     493             : 
     494             :     // certain degree of error is tolerated due to rounding in unit conversions
     495           2 :     CPPUNIT_ASSERT(abs(1239520 - aXPos[0]) < 1000);
     496           2 :     CPPUNIT_ASSERT(abs(1239520 - aXPos[1]) < 1000);
     497           2 :     CPPUNIT_ASSERT(abs(1238250 - aXPos[2]) < 1000);
     498           2 :     CPPUNIT_ASSERT(abs(1238885 - aXPos[3]) < 1000);
     499             : 
     500           2 :     CPPUNIT_ASSERT(abs(2095500 - aYPos[0]) < 1000);
     501           2 :     CPPUNIT_ASSERT(abs(2094865 - aYPos[1]) < 1000);
     502           2 :     CPPUNIT_ASSERT(abs(2094230 - aYPos[2]) < 1000);
     503           2 :     CPPUNIT_ASSERT(abs(2094865 - aYPos[3]) < 1000);
     504             : 
     505             :     sal_Int32 aHSize[4], aVSize[4];
     506           2 :     aHSize[0] = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/wp:extent", "cx").toInt32();
     507           2 :     aHSize[1] = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/wp:extent", "cx").toInt32();
     508           2 :     aHSize[2] = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor/wp:extent", "cx").toInt32();
     509           2 :     aHSize[3] = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[4]/mc:Choice/w:drawing/wp:anchor/wp:extent", "cx").toInt32();
     510             : 
     511           2 :     aVSize[0] = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/wp:extent", "cy").toInt32();
     512           2 :     aVSize[1] = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/wp:extent", "cy").toInt32();
     513           2 :     aVSize[2] = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor/wp:extent", "cy").toInt32();
     514           2 :     aVSize[3] = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[4]/mc:Choice/w:drawing/wp:anchor/wp:extent", "cy").toInt32();
     515             : 
     516             :     // certain degree of error is tolerated due to rounding in unit conversions
     517           2 :     CPPUNIT_ASSERT(abs(3599280 - aHSize[0]) < 1000);
     518           2 :     CPPUNIT_ASSERT(abs(3599280 - aHSize[1]) < 1000);
     519           2 :     CPPUNIT_ASSERT(abs(3599280 - aHSize[2]) < 1000);
     520           2 :     CPPUNIT_ASSERT(abs(3599280 - aHSize[3]) < 1000);
     521             : 
     522           2 :     CPPUNIT_ASSERT(abs(1799640 - aVSize[0]) < 1000);
     523           2 :     CPPUNIT_ASSERT(abs(1799640 - aVSize[1]) < 1000);
     524           2 :     CPPUNIT_ASSERT(abs(1799640 - aVSize[2]) < 1000);
     525           2 :     CPPUNIT_ASSERT(abs(1799640 - aVSize[3]) < 1000);
     526             : 
     527             :     // Check VML document
     528             : 
     529             :     // get styles of the four shapes
     530          10 :     OUString aStyles[4];
     531           2 :     aStyles[0] = getXPath( pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Fallback/w:pict/v:rect", "style");
     532             :     // original is: "position:absolute;margin-left:97.6pt;margin-top:165pt;width:283.4pt;height:141.7pt;rotation:285"
     533           2 :     aStyles[1] = getXPath( pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Fallback/w:pict/v:rect", "style");
     534             :     // original is: "position:absolute;margin-left:97.6pt;margin-top:164.95pt;width:283.4pt;height:141.7pt;rotation:255"
     535           2 :     aStyles[2] = getXPath( pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Fallback/w:pict/v:rect", "style");
     536             :     // original is: "position:absolute;margin-left:97.5pt;margin-top:164.9pt;width:283.4pt;height:141.7pt;rotation:105"
     537           2 :     aStyles[3] = getXPath( pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[4]/mc:Fallback/w:pict/v:rect", "style");
     538             :     // original is: "position:absolute;margin-left:97.55pt;margin-top:164.95pt;width:283.4pt;height:141.7pt;rotation:75"
     539             : 
     540             :     //check the size and position of each of the shapes
     541          10 :     for( int i = 0; i < 4; ++i )
     542             :     {
     543           8 :         CPPUNIT_ASSERT(!aStyles[i].isEmpty());
     544             : 
     545           8 :         sal_Int32 nextTokenPos = 0;
     546          48 :         do
     547             :         {
     548          48 :             OUString aStyleCommand = aStyles[i].getToken( 0, ';', nextTokenPos );
     549          48 :             CPPUNIT_ASSERT(!aStyleCommand.isEmpty());
     550             : 
     551          96 :             OUString aStyleCommandName  = aStyleCommand.getToken( 0, ':' );
     552          96 :             OUString aStyleCommandValue = aStyleCommand.getToken( 1, ':' );
     553             : 
     554          48 :             if( aStyleCommandName.equals( "margin-left" ) )
     555             :             {
     556           8 :                 float fValue = aStyleCommandValue.getToken( 0, 'p' ).toFloat();
     557           8 :                 CPPUNIT_ASSERT_DOUBLES_EQUAL(97.6, fValue, 0.1);
     558             :             }
     559          40 :             else if( aStyleCommandName.equals( "margin-top" ) )
     560             :             {
     561           8 :                 float fValue = aStyleCommandValue.getToken( 0, 'p' ).toFloat();
     562           8 :                 CPPUNIT_ASSERT_DOUBLES_EQUAL(165.0, fValue, 0.2);
     563             :             }
     564          32 :             else if( aStyleCommandName.equals( "width" ) )
     565             :             {
     566           8 :                 float fValue = aStyleCommandValue.getToken( 0, 'p' ).toFloat();
     567           8 :                 CPPUNIT_ASSERT_DOUBLES_EQUAL(283.4, fValue, 0.1);
     568             :             }
     569          24 :             else if( aStyleCommandName.equals( "height" ) )
     570             :             {
     571           8 :                 float fValue = aStyleCommandValue.getToken( 0, 'p' ).toFloat();
     572           8 :                 CPPUNIT_ASSERT_DOUBLES_EQUAL(141.7, fValue, 0.1);
     573          48 :             }
     574             : 
     575          48 :         } while( nextTokenPos != -1 );
     576             :     }
     577             : 
     578             :     // Check shape objects
     579             : 
     580           2 :     awt::Point aPos[4];
     581           2 :     aPos[0] = getShape(1)->getPosition();
     582           2 :     aPos[1] = getShape(2)->getPosition();
     583           2 :     aPos[2] = getShape(3)->getPosition();
     584           2 :     aPos[3] = getShape(4)->getPosition();
     585             : 
     586             :     // certain degree of error is tolerated due to rounding in unit conversions
     587           2 :     CPPUNIT_ASSERT(abs(4734 - aPos[0].X) < 10);
     588           2 :     CPPUNIT_ASSERT(abs(4734 - aPos[1].X) < 10);
     589           2 :     CPPUNIT_ASSERT(abs(4731 - aPos[2].X) < 10);
     590           2 :     CPPUNIT_ASSERT(abs(4733 - aPos[3].X) < 10);
     591             : 
     592           2 :     CPPUNIT_ASSERT(abs(2845 - aPos[0].Y) < 10);
     593           2 :     CPPUNIT_ASSERT(abs(2843 - aPos[1].Y) < 10);
     594           2 :     CPPUNIT_ASSERT(abs(2842 - aPos[2].Y) < 10);
     595          10 :     CPPUNIT_ASSERT(abs(2843 - aPos[3].Y) < 10);
     596             : }
     597             : 
     598          28 : DECLARE_OOXMLEXPORT_TEST(testFdo73215, "fdo73215.docx")
     599             : {
     600           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     601           4 :     if (!pXmlDoc)
     602           6 :         return;
     603             :     // 'rect' was 'pictureFrame', which isn't valid.
     604             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:spPr/a:prstGeom",
     605           2 :                 "prst", "rect");
     606             :     // 'adj1' was 'adj', which is not valid for bentConnector3.
     607             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wpg:wgp/wps:wsp[9]/wps:spPr/a:prstGeom/a:avLst/a:gd",
     608           2 :                 "name", "adj1");
     609             : }
     610             : 
     611          28 : DECLARE_OOXMLEXPORT_TEST(testBehinddoc, "behinddoc.docx")
     612             : {
     613           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     614           4 :     if (!pXmlDoc)
     615           6 :         return;
     616             :     // This was "0", shape was in the foreground.
     617           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor", "behindDoc", "1");
     618             : }
     619             : 
     620          28 : DECLARE_OOXMLEXPORT_TEST(testSmartArtAnchoredInline, "fdo73227.docx")
     621             : {
     622             :     /* Given file conatins 3 DrawingML objects as 1Picture,1SmartArt and 1Shape.
     623             :      * Check for SmartArt.
     624             :     *  SmartArt shoould get written as "Floating Object" i.e. inside <wp:anchor> tag.
     625             :     *  Also check for value of attribute "id" of <wp:docPr> . It should be unique for
     626             :     *  all 3 DrawingML objects in a document.
     627             :     */
     628             : 
     629           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     630           4 :     if (!pXmlDoc)
     631           6 :         return;
     632           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing[1]/wp:anchor/wp:docPr","id","1");
     633           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing[1]/wp:anchor/wp:docPr","name","Diagram1");
     634             : 
     635           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp:docPr","id","2");
     636           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp:docPr","name","10-Point Star 3");
     637             : 
     638           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing[2]/wp:anchor/wp:docPr","id","3");
     639           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing[2]/wp:anchor/wp:docPr","name","Picture 1");
     640             : }
     641             : 
     642          28 : DECLARE_OOXMLEXPORT_TEST(testFdo65833, "fdo65833.docx")
     643             : {
     644             :     // The "editas" attribute for vml group shape was not preserved.
     645           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     646           4 :     if (!pXmlDoc)
     647           6 :         return;
     648           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:group", "editas", "canvas");
     649             : }
     650             : 
     651          28 : DECLARE_OOXMLEXPORT_TEST(testFdo73247, "fdo73247.docx")
     652             : {
     653           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     654           4 :     if (!pXmlDoc)
     655           6 :         return;
     656             : 
     657             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:xfrm",
     658           2 :                 "rot", "1969200");
     659             : }
     660             : 
     661          28 : DECLARE_OOXMLEXPORT_TEST(testFdo70942, "fdo70942.docx")
     662             : {
     663           4 :      xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     664           4 :     if (!pXmlDoc)
     665           6 :         return;
     666             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:prstGeom",
     667           2 :                 "prst", "ellipse");
     668             : }
     669             : 
     670          28 : DECLARE_OOXMLEXPORT_TEST(testDrawinglayerPicPos, "drawinglayer-pic-pos.docx")
     671             : {
     672             :     // The problem was that the position of the picture was incorrect, it was shifted towards the bottom right corner.
     673           4 :     xmlDocPtr pXmlDocument = parseExport("word/document.xml");
     674           4 :     if (!pXmlDocument)
     675           6 :         return;
     676             : 
     677           2 :     OString aXPath("/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:xfrm/a:off");
     678             :     // This was 720.
     679           2 :     assertXPath(pXmlDocument, aXPath, "x", "0");
     680             :     // This was 1828800.
     681           2 :     assertXPath(pXmlDocument, aXPath, "y", "0");
     682             : }
     683             : 
     684          28 : DECLARE_OOXMLEXPORT_TEST(testShapeThemePreservation, "shape-theme-preservation.docx")
     685             : {
     686           4 :     xmlDocPtr pXmlDocument = parseExport("word/document.xml");
     687           4 :     if (!pXmlDocument)
     688           6 :         return;
     689             : 
     690             :     // check shape style has been preserved
     691             :     assertXPath(pXmlDocument,
     692             :             "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef",
     693           2 :             "idx", "1");
     694             :     assertXPath(pXmlDocument,
     695             :             "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef/a:schemeClr",
     696           2 :             "val", "accent1");
     697             :     assertXPath(pXmlDocument,
     698             :             "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef",
     699           2 :             "idx", "1");
     700             :     assertXPath(pXmlDocument,
     701             :             "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef/a:schemeClr",
     702           2 :             "val", "accent1");
     703             :     assertXPath(pXmlDocument,
     704             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef",
     705           2 :             "idx", "1");
     706             :     assertXPath(pXmlDocument,
     707             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef/a:schemeClr",
     708           2 :             "val", "accent1");
     709             :     assertXPath(pXmlDocument,
     710             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:lnRef",
     711           2 :             "idx", "2");
     712             :     assertXPath(pXmlDocument,
     713             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:lnRef/a:schemeClr",
     714           2 :             "val", "accent1");
     715             :     assertXPath(pXmlDocument,
     716             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:lnRef/a:schemeClr/a:shade",
     717           2 :             "val", "50000");
     718             :     assertXPath(pXmlDocument,
     719             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:effectRef",
     720           2 :             "idx", "0");
     721             :     assertXPath(pXmlDocument,
     722             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:effectRef/a:schemeClr",
     723           2 :             "val", "accent1");
     724             : 
     725             :     // check shape style hasn't been overwritten
     726             :     assertXPath(pXmlDocument,
     727             :             "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:solidFill",
     728           2 :             0);
     729             :     assertXPath(pXmlDocument,
     730             :             "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill",
     731           2 :             0);
     732             : 
     733             :     // check direct theme assignments have been preserved
     734             :     assertXPath(pXmlDocument,
     735             :             "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:solidFill/a:schemeClr",
     736           2 :             "val", "accent6");
     737             :     assertXPath(pXmlDocument,
     738             :             "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill/a:schemeClr",
     739           2 :             "val", "accent3");
     740             : 
     741             :     // check color transformations applied to theme colors have been preserved
     742             :     assertXPath(pXmlDocument,
     743             :             "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:solidFill/a:schemeClr/a:lumMod",
     744           2 :             "val", "40000");
     745             :     assertXPath(pXmlDocument,
     746             :             "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:solidFill/a:schemeClr/a:lumOff",
     747           2 :             "val", "60000");
     748             :     assertXPath(pXmlDocument,
     749             :             "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill/a:schemeClr/a:lumMod",
     750           2 :             "val", "50000");
     751             : 
     752             :     // check direct color assignments have been preserved
     753             :     OUString sFillColor = getXPath(pXmlDocument,
     754             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:solidFill/a:srgbClr",
     755           2 :             "val");
     756           2 :     CPPUNIT_ASSERT_EQUAL(sFillColor.toInt32(16), sal_Int32(0x00b050));
     757             :     sal_Int32 nLineColor = getXPath(pXmlDocument,
     758             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill/a:srgbClr",
     759           2 :             "val").toInt32(16);
     760           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0xff0000), nLineColor);
     761             : 
     762             :     // check direct line type assignments have been preserved
     763             :     sal_Int32 nLineWidth = getXPath(pXmlDocument,
     764             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln",
     765           2 :             "w").toInt32();
     766           2 :     CPPUNIT_ASSERT(abs(63500 - nLineWidth) < 1000); //some rounding errors in the conversion ooxml -> libo -> ooxml are tolerated
     767             :     assertXPath(pXmlDocument,
     768             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:miter",
     769           2 :             1);
     770             :     assertXPath(pXmlDocument,
     771             :             "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:custDash",
     772           2 :             1);
     773             : 
     774           4 :     uno::Reference<drawing::XShape> xShape1 = getShape(1);
     775           4 :     uno::Reference<drawing::XShape> xShape2 = getShape(2);
     776           4 :     uno::Reference<drawing::XShape> xShape3 = getShape(3);
     777             : 
     778             :     // check colors are properly applied to shapes on import
     779           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f81bd), getProperty<sal_Int32>(xShape1, "FillColor"));
     780           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0xfcd5b5), getProperty<sal_Int32>(xShape2, "FillColor"));
     781           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00b050), getProperty<sal_Int32>(xShape3, "FillColor"));
     782           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x3a5f8b), getProperty<sal_Int32>(xShape1, "LineColor"));
     783           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f6228), getProperty<sal_Int32>(xShape2, "LineColor"));
     784           2 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(0xff0000), getProperty<sal_Int32>(xShape3, "LineColor"));
     785             : 
     786             :     // check line properties are properly applied to shapes on import
     787           2 :     CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID, getProperty<drawing::LineStyle>(xShape1, "LineStyle"));
     788           2 :     CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID, getProperty<drawing::LineStyle>(xShape2, "LineStyle"));
     789           2 :     CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_DASH,  getProperty<drawing::LineStyle>(xShape3, "LineStyle"));
     790           2 :     CPPUNIT_ASSERT_EQUAL(drawing::LineJoint_ROUND, getProperty<drawing::LineJoint>(xShape1, "LineJoint"));
     791           2 :     CPPUNIT_ASSERT_EQUAL(drawing::LineJoint_ROUND, getProperty<drawing::LineJoint>(xShape2, "LineJoint"));
     792           4 :     CPPUNIT_ASSERT_EQUAL(drawing::LineJoint_MITER, getProperty<drawing::LineJoint>(xShape3, "LineJoint"));
     793             : }
     794             : 
     795          28 : DECLARE_OOXMLEXPORT_TEST(testFDO73546, "FDO73546.docx")
     796             : {
     797           4 :     xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
     798           4 :     if (!pXmlDoc)
     799           6 :         return;
     800           2 :     assertXPath(pXmlDoc, "/w:hdr/w:p[1]/w:r[3]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor", "distL","0");
     801             : }
     802             : 
     803          28 : DECLARE_OOXMLEXPORT_TEST(testFdo69616, "fdo69616.docx")
     804             : {
     805           4 :     xmlDocPtr pXmlDoc = parseExport();
     806           4 :     if (!pXmlDoc)
     807           6 :         return;
     808             :     // VML
     809           2 :     CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r[1]/mc:AlternateContent/mc:Fallback/w:pict/v:group", "coordorigin").match("696,725"));
     810             : }
     811             : 
     812          28 : DECLARE_OOXMLEXPORT_TEST(testAlignForShape,"Shape.docx")
     813             : {
     814             :     //fdo73545:Shape Horizontal and vertical orientation is wrong
     815             :     //The wp:align tag is missing after roundtrip
     816           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     817           4 :     if (!pXmlDoc)
     818           6 :         return;
     819           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp:positionH/wp:align","1");
     820             : }
     821             : 
     822          28 : DECLARE_OOXMLEXPORT_TEST(testLineStyle_DashType, "LineStyle_DashType.docx")
     823             : {
     824             :     /* DOCX contatining Shape with LineStyle as Dash Type should get preserved inside
     825             :      * an XMl tag <a:prstDash> with value "dash".
     826             :      */
     827           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     828           4 :     if (!pXmlDoc)
     829           6 :         return;
     830             : 
     831           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", "val", "dash");
     832             : }
     833             : 
     834          28 : DECLARE_OOXMLEXPORT_TEST(testGradientFillPreservation, "gradient-fill-preservation.docx")
     835             : {
     836           4 :     xmlDocPtr pXmlDocument = parseExport("word/document.xml");
     837           4 :     if (!pXmlDocument)
     838           6 :         return;
     839             : 
     840             :     // check rgb colors for every step in the gradient of the first shape
     841             :     assertXPath(pXmlDocument,
     842             :             "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr",
     843           2 :             "val", "ffff00");
     844             :     assertXPath(pXmlDocument,
     845             :             "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[2]/a:srgbClr",
     846           2 :             "val", "ffff33");
     847             :     assertXPath(pXmlDocument,
     848             :             "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[3]/a:srgbClr",
     849           2 :             "val", "ff0000");
     850             : 
     851             :     // check theme colors for every step in the gradient of the second shape
     852             :     assertXPath(pXmlDocument,
     853             :             "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[@pos='0']/a:schemeClr",
     854           2 :             "val", "accent5");
     855             :     assertXPath(pXmlDocument,
     856             :             "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[@pos='50000']/a:schemeClr",
     857           2 :             "val", "accent1");
     858             :     assertXPath(pXmlDocument,
     859             :             "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[@pos='100000']/a:schemeClr",
     860           2 :             "val", "accent1");
     861             : 
     862             :     assertXPath(pXmlDocument,
     863             :             "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[@pos='50000']/a:srgbClr/a:alpha",
     864           2 :             "val", "20000");
     865             :     assertXPath(pXmlDocument,
     866             :             "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[@pos='50000']/a:schemeClr/a:tint",
     867           2 :             "val", "44500");
     868             :     assertXPath(pXmlDocument,
     869             :             "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[@pos='50000']/a:schemeClr/a:satMod",
     870           2 :             "val", "160000");
     871             : }
     872             : 
     873          28 : DECLARE_OOXMLEXPORT_TEST(testLineStyle_DashType_VML, "LineStyle_DashType_VML.docx")
     874             : {
     875             :     /* DOCX contatining "Shape with text inside" having Line Style as "Dash Type" should get
     876             :      * preserved inside an XML tag <v:stroke> with attribute dashstyle having value "dash".
     877             :      */
     878           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     879           4 :     if (!pXmlDoc)
     880           6 :         return;
     881           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[1]/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:stroke", "dashstyle", "dash");
     882             : }
     883             : 
     884          28 : DECLARE_OOXMLEXPORT_TEST(testFdo74110,"fdo74110.docx")
     885             : {
     886             :     /*
     887             :     The File contains word art which is being exported as shape and the mapping is defaulted to
     888             :     shape type rect since the actual shape type(s) is/are commented out for some reason.
     889             :     The actual shape type(s) has/have adjustment value(s) where as rect does not have adjustment value.
     890             :     Hence the following test case.
     891             :     */
     892           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     893           4 :     if (!pXmlDoc)
     894           6 :         return;
     895             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:prstGeom[1]",
     896           2 :                 "prst", "rect");
     897           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:prstGeom[1]/a:avLst[1]/a:gd[1]",0);
     898             : }
     899             : 
     900          28 : DECLARE_OOXMLEXPORT_TEST(testOuterShdw,"testOuterShdw.docx")
     901             : {
     902           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     903           4 :     if (!pXmlDoc)
     904           6 :         return;
     905           2 :     assertXPath(pXmlDoc, "//mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:effectLst[1]/a:outerShdw[1]", "dist", "57811035");
     906             : }
     907             : 
     908          28 : DECLARE_OOXMLEXPORT_TEST(testExtentValue, "fdo74605.docx")
     909             : {
     910           4 :     xmlDocPtr pXmlDoc = parseExport();
     911           4 :     if (!pXmlDoc)
     912           6 :         return;
     913           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:extent","cx","0");
     914             : }
     915             : 
     916          28 : DECLARE_OOXMLEXPORT_TEST( testChildNodesOfCubicBezierTo, "FDO74774.docx")
     917             : {
     918             :     /* Number of children required by cubicBexTo is 3 of type "pt".
     919             :        While exporting, sometimes the child nodes are less than 3.
     920             :        The test case ensures that there are 3 child nodes of type "pt"
     921             :        for cubicBexTo
     922             :      */
     923           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     924           4 :     if (!pXmlDoc)
     925           6 :         return;
     926             : 
     927             :     assertXPath( pXmlDoc,
     928           2 :         "/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent[1]/mc:Choice/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wpg:wgp[1]/wps:wsp[3]/wps:spPr[1]/a:custGeom[1]/a:pathLst[1]/a:path[1]/a:cubicBezTo[2]/a:pt[3]");
     929             : }
     930             : 
     931          28 : DECLARE_OOXMLEXPORT_TEST(testMSwordHang,"test_msword_hang.docx")
     932             : {
     933             :     // fdo#74771:
     934           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     935           4 :     if (!pXmlDoc)
     936           6 :         return;
     937           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p/w:r[2]/w:drawing/wp:inline", "distT", "0");
     938             : }
     939             : 
     940          28 : DECLARE_OOXMLEXPORT_TEST(testGroupshapeThemeFont, "groupshape-theme-font.docx")
     941             : {
     942             :     // Font was specified using a theme reference, which wasn't handled.
     943           4 :     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
     944           8 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xGroup->getByIndex(0), uno::UNO_QUERY)->getText();
     945           8 :     uno::Reference<text::XTextRange> xRun = getRun(getParagraphOfText(1, xText),1);
     946             :     // This was Calibri.
     947           8 :     CPPUNIT_ASSERT_EQUAL(OUString("Cambria"), getProperty<OUString>(xRun, "CharFontName"));
     948           4 : }
     949             : 
     950          28 : DECLARE_OOXMLEXPORT_TEST(testAnchorIdForWP14AndW14, "AnchorId.docx")
     951             : {
     952           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
     953           4 :     if (!pXmlDoc)
     954           6 :         return;
     955             : 
     956           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[3]/mc:AlternateContent/mc:Choice/w:drawing/wp:inline", "anchorId", "78735EFD");
     957           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[3]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "anchorId", "78735EFD");
     958             : 
     959             : 
     960             : }
     961             : 
     962          28 : DECLARE_OOXMLEXPORT_TEST(testDkVert, "dkvert.docx")
     963             : {
     964             :     // <a:pattFill prst="dkVert"> was exported as ltVert.
     965           4 :     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
     966           8 :     uno::Reference<beans::XPropertySet> xShape(xGroup->getByIndex(0), uno::UNO_QUERY);
     967             :     // This was 50.
     968           8 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(25), getProperty<drawing::Hatch>(xShape, "FillHatch").Distance);
     969           4 : }
     970             : 
     971          28 : DECLARE_OOXMLEXPORT_TEST(testTextWatermark, "textWatermark.docx")
     972             : {
     973             :     //The problem was that the watermark ID was not preserved,
     974             :     //and Word uses the object ID to identify if it is a watermark.
     975             :     //It has to have the 'PowerPlusWaterMarkObject' string in it
     976           4 :     xmlDocPtr pXmlHeader1 = parseExport("word/header1.xml");
     977           4 :     if (!pXmlHeader1)
     978           6 :        return;
     979             : 
     980           2 :     assertXPath(pXmlHeader1, "/w:hdr[1]/w:p[1]/w:r[1]/w:pict[1]/v:shape[1]","id","PowerPlusWaterMarkObject93701316");
     981             : }
     982             : 
     983          28 : DECLARE_OOXMLEXPORT_TEST(testPictureWatermark, "pictureWatermark.docx")
     984             : {
     985             :     //The problem was that the watermark ID was not preserved,
     986             :     //and Word uses the object ID to identify if it is a watermark.
     987             :     //It has to have the 'WordPictureWaterMarkObject' string in it
     988             : 
     989           4 :     xmlDocPtr pXmlHeader1 = parseExport("word/header1.xml");
     990           4 :     if (!pXmlHeader1)
     991           6 :        return;
     992             : 
     993             :     // Check the watermark ID
     994           2 :     assertXPath(pXmlHeader1, "/w:hdr[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Fallback[1]/w:pict[1]/v:rect[1]","id","WordPictureWatermark11962361");
     995             : }
     996             : 
     997             : 
     998          28 : DECLARE_OOXMLEXPORT_TEST(testFdo76249, "fdo76249.docx")
     999             : {
    1000             :     /*
    1001             :      * The Locked Canvas is imported correctly, but while exporting
    1002             :      * the drawing element is exported inside a textbox. However a the drawing has to exported
    1003             :      * as a Locked Canvas inside a text-box for the RT file to work in MS Word, as drawing elements
    1004             :      * are not allowed inside the textboxes.
    1005             :      */
    1006           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1007           4 :     if (!pXmlDoc)
    1008           6 :        return;
    1009           2 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Fallback[1]/w:pict[1]/v:rect[1]/v:textbox[1]/w:txbxContent[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/lc:lockedCanvas[1]",1);
    1010             : }
    1011             : 
    1012          28 : DECLARE_OOXMLEXPORT_TEST(testFdo76979, "fdo76979.docx")
    1013             : {
    1014             :     // The problem was that black was exported as "auto" fill color, resulting in well-formed, but invalid XML.
    1015           4 :     xmlDocPtr pXmlDoc = parseExport("word/header2.xml");
    1016           4 :     if (!pXmlDoc)
    1017           6 :        return;
    1018             :     // This was "auto", not "FFFFFF".
    1019           2 :     assertXPath(pXmlDoc, "//wps:spPr/a:solidFill/a:srgbClr", "val", "FFFFFF");
    1020             : }
    1021             : 
    1022          28 : DECLARE_OOXMLEXPORT_TEST(testShapeEffectPreservation, "shape-effect-preservation.docx")
    1023             : {
    1024           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1025           4 :     if (!pXmlDoc)
    1026           6 :        return;
    1027             : 
    1028             :     // first shape with outer shadow, rgb color
    1029             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1030             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
    1031           2 :             "algn", "tl");
    1032             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1033             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
    1034           2 :             "blurRad", "50800");
    1035             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1036             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
    1037           2 :             "dir", "2700000");
    1038             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1039             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
    1040           2 :             "dist", "38100");
    1041             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1042             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
    1043           2 :             "rotWithShape", "0");
    1044             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1045             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw/a:srgbClr",
    1046           2 :             "val", "000000");
    1047             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1048             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw/a:srgbClr/a:alpha",
    1049           2 :             "val", "40000");
    1050             : 
    1051             :     // second shape with outer shadow, scheme color
    1052             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1053             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
    1054           2 :             "algn", "tl");
    1055             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1056             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
    1057           2 :             "blurRad", "114300");
    1058             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1059             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
    1060           2 :             "dir", "2700000");
    1061             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1062             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
    1063           2 :             "dist", "203200");
    1064             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1065             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
    1066           2 :             "rotWithShape", "0");
    1067             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1068             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw/a:schemeClr",
    1069           2 :             "val", "accent1");
    1070             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1071             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw/a:schemeClr/a:lumMod",
    1072           2 :             "val", "40000");
    1073             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1074             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw/a:schemeClr/a:lumOff",
    1075           2 :             "val", "60000");
    1076             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1077             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw/a:schemeClr/a:alpha",
    1078           2 :             "val", "40000");
    1079             : 
    1080             :     // third shape with inner shadow, rgb color
    1081             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1082             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw",
    1083           2 :             "blurRad", "63500");
    1084             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1085             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw",
    1086           2 :             "dir", "16200000");
    1087             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1088             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw",
    1089           2 :             "dist", "50800");
    1090             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1091             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw/a:srgbClr",
    1092           2 :             "val", "ffff00");
    1093             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1094             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw/a:srgbClr/a:alpha",
    1095           2 :             "val", "50000");
    1096             : 
    1097             :     // 4th shape with soft edge
    1098             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1099             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:softEdge",
    1100           2 :             "rad", "127000");
    1101             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1102             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:softEdge/*",
    1103           2 :             0 ); // should not be present
    1104             : 
    1105             :     // 5th shape with glow effect, scheme color
    1106             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1107             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow",
    1108           2 :             "rad", "101600");
    1109             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1110             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:schemeClr",
    1111           2 :             "val", "accent2");
    1112             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1113             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:schemeClr/a:satMod",
    1114           2 :             "val", "175000");
    1115             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1116             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:schemeClr/a:alpha",
    1117           2 :             "val", "40000");
    1118             : 
    1119             :     // 6th shape with reflection
    1120             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1121             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection",
    1122           2 :             "blurRad", "6350");
    1123             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1124             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection",
    1125           2 :             "stA", "50000");
    1126             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1127             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection",
    1128           2 :             "endA", "300");
    1129             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1130             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection",
    1131           2 :             "endPos", "55500");
    1132             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1133             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection/*",
    1134           2 :             0 ); // should not be present
    1135             : 
    1136             :     // 7th shape with several effects: glow, inner shadow and reflection
    1137             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1138             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow",
    1139           2 :             "rad", "63500");
    1140             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1141             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:schemeClr",
    1142           2 :             "val", "accent2");
    1143             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1144             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:schemeClr/*",
    1145           2 :             2);
    1146             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1147             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw",
    1148           2 :             "blurRad", "63500");
    1149             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1150             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw",
    1151           2 :             "dir", "2700000");
    1152             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1153             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw/a:srgbClr",
    1154           2 :             "val", "000000");
    1155             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1156             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw/a:srgbClr/a:alpha",
    1157           2 :             "val", "50000");
    1158             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1159             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection",
    1160           2 :             "blurRad", "6350");
    1161             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1162             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection",
    1163           2 :             "stA", "52000");
    1164             : }
    1165             : 
    1166          28 : DECLARE_OOXMLEXPORT_TEST(testShape3DEffectPreservation, "shape-3d-effect-preservation.docx")
    1167             : {
    1168           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1169           4 :     if (!pXmlDoc)
    1170           6 :        return;
    1171             : 
    1172             :     // first shape: extrusion and shift on z, rotated camera with zoom, rotated light rig
    1173             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1174             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera",
    1175           2 :             "prst", "perspectiveRelaxedModerately");
    1176             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1177             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera",
    1178           2 :             "zoom", "150000");
    1179             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1180             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera/a:rot",
    1181           2 :             "lat", "19490639");
    1182             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1183             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera/a:rot",
    1184           2 :             "lon", "0");
    1185             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1186             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera/a:rot",
    1187           2 :             "rev", "12900001");
    1188             : 
    1189             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1190             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:lightRig",
    1191           2 :             "rig", "threePt");
    1192             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1193             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:lightRig",
    1194           2 :             "dir", "t");
    1195             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1196             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:lightRig/a:rot",
    1197           2 :             "lat", "0");
    1198             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1199             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:lightRig/a:rot",
    1200           2 :             "lon", "0");
    1201             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1202             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:lightRig/a:rot",
    1203           2 :             "rev", "4800000");
    1204             : 
    1205             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1206             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
    1207           2 :             "extrusionH", "63500");
    1208             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1209             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
    1210           2 :             "z", "488950");
    1211             : 
    1212             :     // second shape: extrusion with theme color, no camera or light rotation, metal material
    1213             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1214             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera",
    1215           2 :             "prst", "isometricLeftDown");
    1216             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1217             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera/a:rot",
    1218           2 :             0);
    1219             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1220             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:lightRig",
    1221           2 :             "rig", "threePt");
    1222             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1223             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:lightRig",
    1224           2 :             "dir", "t");
    1225             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1226             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:lightRig/a:rot",
    1227           2 :             0);
    1228             : 
    1229             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1230             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
    1231           2 :             "extrusionH", "25400");
    1232             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1233             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
    1234           2 :             "prstMaterial", "metal");
    1235             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1236             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:extrusionClr/a:schemeClr",
    1237           2 :             "val", "accent5");
    1238             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1239             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:extrusionClr/a:schemeClr/a:lumMod",
    1240           2 :             "val", "40000");
    1241             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1242             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:extrusionClr/a:schemeClr/a:lumOff",
    1243           2 :             "val", "60000");
    1244             : 
    1245             :     // third shape: colored countour and top and bottom bevel, plastic material
    1246             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1247             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
    1248           2 :             "contourW", "50800");
    1249             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1250             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
    1251           2 :             "prstMaterial", "plastic");
    1252             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1253             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:bevelT",
    1254           2 :             "w", "139700");
    1255             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1256             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:bevelT",
    1257           2 :             "h", "88900");
    1258             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1259             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:bevelT",
    1260           2 :             "prst", "cross");
    1261             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1262             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:bevelB",
    1263           2 :             "h", "88900");
    1264             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1265             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:bevelB",
    1266           2 :             "prst", "relaxedInset");
    1267             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1268             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:contourClr/a:srgbClr",
    1269           2 :             "val", "3333ff");
    1270             : 
    1271             :     // fourth shape: wireframe
    1272             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1273             :             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
    1274           2 :             "prstMaterial", "legacyWireframe");
    1275             : }
    1276             : 
    1277          28 : DECLARE_OOXMLEXPORT_TEST(testPictureEffectPreservation, "picture-effects-preservation.docx")
    1278             : {
    1279           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1280           4 :     if (!pXmlDoc)
    1281           6 :        return;
    1282             : 
    1283             :     // first picture: glow effect with theme color and transformations, 3d rotation and extrusion
    1284             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1285             :             "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:glow",
    1286           2 :             "rad", "228600");
    1287             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1288             :             "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:glow/a:schemeClr",
    1289           2 :             "val", "accent1");
    1290             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1291             :             "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:glow/a:schemeClr/*",
    1292           2 :             2);
    1293             : 
    1294             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1295             :             "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:scene3d/a:camera",
    1296           2 :             "prst", "isometricRightUp");
    1297             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1298             :             "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:scene3d/a:lightRig",
    1299           2 :             "rig", "threePt");
    1300             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1301             :             "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:sp3d",
    1302           2 :             "extrusionH", "76200");
    1303             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1304             :             "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:sp3d/a:extrusionClr/a:srgbClr",
    1305           2 :             "val", "92d050");
    1306             : 
    1307             :     // second picture: shadow and reflection effects
    1308             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1309             :             "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:outerShdw",
    1310           2 :             "dir", "8100000");
    1311             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1312             :             "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:outerShdw/a:srgbClr",
    1313           2 :             "val", "000000");
    1314             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1315             :             "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:outerShdw/a:srgbClr/a:alpha",
    1316           2 :             "val", "40000");
    1317             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1318             :             "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:reflection",
    1319           2 :             "dir", "5400000");
    1320             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1321             :             "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:reflection/*",
    1322           2 :             0 ); // should not be present
    1323             : 
    1324             :     // third picture: soft edge effect
    1325             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1326             :             "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:softEdge",
    1327           2 :             "rad", "63500");
    1328             : }
    1329             : 
    1330          28 : DECLARE_OOXMLEXPORT_TEST(testPictureArtisticEffectPreservation, "picture-artistic-effects-preservation.docx")
    1331             : {
    1332           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1333           4 :     xmlDocPtr pRelsDoc = parseExport("word/_rels/document.xml.rels");
    1334           4 :     if (!pXmlDoc || !pRelsDoc)
    1335           6 :        return;
    1336             : 
    1337             :     uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(
    1338           2 :             comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL());
    1339             : 
    1340             :     // 1st picture: marker effect
    1341             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
    1342             :             "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
    1343             :             "a14:artisticMarker",
    1344           2 :             "trans", "14000");
    1345             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
    1346             :             "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
    1347             :             "a14:artisticMarker",
    1348           2 :             "size", "80");
    1349             : 
    1350             :     OUString sEmbedId1 = getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1351             :             "wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer",
    1352           4 :             "embed");
    1353           4 :     OUString sXmlPath = "/rels:Relationships/rels:Relationship[@Id='" + sEmbedId1 + "']";
    1354           4 :     OUString sFile = getXPath(pRelsDoc, OUStringToOString( sXmlPath, RTL_TEXTENCODING_UTF8 ), "Target");
    1355           2 :     CPPUNIT_ASSERT_EQUAL(true, bool(xNameAccess->hasByName("word/" + sFile)));
    1356             : 
    1357             :     // 2nd picture: pencil grayscale
    1358             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
    1359             :             "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
    1360             :             "a14:artisticPencilGrayscale",
    1361           2 :             "trans", "15000");
    1362             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
    1363             :             "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
    1364             :             "a14:artisticPencilGrayscale",
    1365           2 :             "pencilSize", "66");
    1366             : 
    1367             :     OUString sEmbedId2 = getXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1368             :             "wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer",
    1369           4 :             "embed");
    1370           2 :     CPPUNIT_ASSERT_EQUAL(sEmbedId1, sEmbedId2);
    1371             : 
    1372             :     // 3rd picture: pencil sketch
    1373             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
    1374             :             "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
    1375             :             "a14:artisticPencilSketch",
    1376           2 :             "trans", "7000");
    1377             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
    1378             :             "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
    1379             :             "a14:artisticPencilSketch",
    1380           2 :             "pressure", "17");
    1381             : 
    1382             :     OUString sEmbedId3 = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1383             :             "wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer",
    1384           4 :             "embed");
    1385           2 :     CPPUNIT_ASSERT_EQUAL(sEmbedId1, sEmbedId3);
    1386             : 
    1387             :     // 4th picture: light screen
    1388             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
    1389             :             "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
    1390             :             "a14:artisticLightScreen",
    1391           2 :             "trans", "13000");
    1392             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
    1393             :             "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
    1394             :             "a14:artisticLightScreen",
    1395           2 :             "gridSize", "1");
    1396             : 
    1397             :     OUString sEmbedId4 = getXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1398             :             "wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer",
    1399           4 :             "embed");
    1400           2 :     sXmlPath = "/rels:Relationships/rels:Relationship[@Id='" + sEmbedId4 + "']";
    1401           2 :     sFile = getXPath(pRelsDoc, OUStringToOString( sXmlPath, RTL_TEXTENCODING_UTF8 ), "Target");
    1402           2 :     CPPUNIT_ASSERT_EQUAL(true, bool(xNameAccess->hasByName("word/" + sFile)));
    1403             : 
    1404             :     // 5th picture: watercolor sponge
    1405             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
    1406             :             "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
    1407             :             "a14:artisticWatercolorSponge",
    1408           2 :             "brushSize", "4");
    1409             : 
    1410             :     OUString sEmbedId5 = getXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1411             :             "wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer",
    1412           4 :             "embed");
    1413           2 :     CPPUNIT_ASSERT_EQUAL(sEmbedId1, sEmbedId5);
    1414             : 
    1415             :     // 6th picture: photocopy (no attributes)
    1416             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
    1417             :             "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
    1418           2 :             "a14:artisticPhotocopy", 1);
    1419             : 
    1420             :     OUString sEmbedId6 = getXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
    1421             :             "wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer",
    1422           4 :             "embed");
    1423           2 :     CPPUNIT_ASSERT_EQUAL(sEmbedId1, sEmbedId6);
    1424             : 
    1425             :     // no redundant wdp files saved
    1426           4 :     CPPUNIT_ASSERT_EQUAL(false, bool(xNameAccess->hasByName("word/media/hdphoto3.wdp")));
    1427             : }
    1428             : 
    1429          28 : DECLARE_OOXMLEXPORT_TEST(fdo77719, "fdo77719.docx")
    1430             : {
    1431           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1432           4 :     if (!pXmlDoc)
    1433           6 :         return;
    1434           2 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:custGeom[1]", 1);
    1435             : }
    1436             : 
    1437          28 : DECLARE_OOXMLEXPORT_TEST(testNestedAlternateContent, "nestedAlternateContent.docx")
    1438             : {
    1439           4 :      xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1440           4 :      if (!pXmlDoc)
    1441           6 :         return;
    1442             :     // We check alternateContent  could not contains alternateContent (i.e. nested alternateContent)
    1443           2 :     assertXPath(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wpg:wgp[1]/wps:wsp[2]/wps:txbx[1]/w:txbxContent[1]/w:p[1]/w:r[2]/mc:AlternateContent[1]",0);
    1444             : }
    1445             : 
    1446          28 : DECLARE_OOXMLEXPORT_TEST(test76317, "test76317.docx")
    1447             : {
    1448           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1449           8 :     if (!pXmlDoc) return;
    1450           2 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:prstGeom[1]", "prst", "hexagon");
    1451             : }
    1452             : 
    1453          28 : DECLARE_OOXMLEXPORT_TEST(fdo76591, "fdo76591.docx")
    1454             : {
    1455           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1456           4 :     if (!pXmlDoc)
    1457           6 :         return;
    1458           2 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[3]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]", "relativeHeight", "3");
    1459             : }
    1460             : 
    1461          28 : DECLARE_OOXMLEXPORT_TEST(test76317_2K10, "test76317_2K10.docx")
    1462             : {
    1463           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1464           8 :     if (!pXmlDoc) return;
    1465           2 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:prstGeom[1]/a:avLst[1]/a:gd[1]", "name", "adj");
    1466             : }
    1467             : 
    1468          28 : DECLARE_OOXMLEXPORT_TEST(testFDO77122, "LinkedTextBoxes.docx")
    1469             : {
    1470           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1471           4 :     if (!pXmlDoc)
    1472           6 :         return;
    1473             :     //ensure that the text box links are preserved.
    1474           2 :     assertXPath(pXmlDoc, "//wps:txbx[1]", "id", "1");
    1475           2 :     assertXPath(pXmlDoc, "//wps:linkedTxbx[1]", "id", "1");
    1476             : }
    1477             : 
    1478          28 : DECLARE_OOXMLEXPORT_TEST(test76734_2K7, "test76734_2K7.docx")
    1479             : {
    1480           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1481           4 :     if (!pXmlDoc)
    1482           6 :         return;
    1483           2 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[3]/mc:AlternateContent[1]/mc:Choice[1]", "Requires", "wps");
    1484             : }
    1485             : 
    1486          28 : DECLARE_OOXMLEXPORT_TEST(test77219, "test77219.docx")
    1487             : {
    1488           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1489           4 :     if (!pXmlDoc)
    1490           6 :         return;
    1491           2 :     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[6]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]", "behindDoc", "1");
    1492             : }
    1493             : 
    1494          28 : DECLARE_OOXMLEXPORT_TEST(testPresetShape, "preset-shape.docx")
    1495             : {
    1496             :     // Document contains a flowChartMultidocument preset shape, our date for that shape wasn't correct.
    1497           4 :     uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
    1498           8 :     comphelper::SequenceAsHashMap aCustomShapeGeometry(xPropertySet->getPropertyValue("CustomShapeGeometry"));
    1499           8 :     comphelper::SequenceAsHashMap aPath(aCustomShapeGeometry["Path"]);
    1500           8 :     comphelper::SequenceAsVector<awt::Size> aSubViewSize(aPath["SubViewSize"]);
    1501             :     // This was 0.
    1502           8 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(21600), aSubViewSize[0].Height);
    1503           4 : }
    1504             : 
    1505          28 : DECLARE_OOXMLEXPORT_TEST(testFdo76101, "fdo76101.docx")
    1506             : {
    1507           4 :     xmlDocPtr pXmlDoc = parseExport("word/styles.xml");
    1508             : 
    1509           4 :     if (!pXmlDoc)
    1510           6 :        return;
    1511           2 :     xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "/w:styles/w:style");
    1512           2 :     xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
    1513           2 :     CPPUNIT_ASSERT(4091 >= xmlXPathNodeSetGetLength(pXmlNodes));
    1514           2 :     xmlXPathFreeObject(pXmlObj);
    1515             : }
    1516             : 
    1517          28 : DECLARE_OOXMLEXPORT_TEST(testSdtAndShapeOverlapping,"ShapeOverlappingWithSdt.docx")
    1518             : {
    1519           4 :      xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1520           4 :      if (!pXmlDoc)
    1521           6 :          return;
    1522           2 :       assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[1]/mc:AlternateContent");
    1523           2 :       assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt[1]/w:sdtContent[1]/w:r[1]/w:t[1]");
    1524             : }
    1525             : 
    1526          28 : DECLARE_OOXMLEXPORT_TEST(testLockedCanvas, "fdo78658.docx")
    1527             : {
    1528           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1529           4 :     if (!pXmlDoc)
    1530           6 :         return;
    1531             :     // Checking for lockedCanvas tag
    1532           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/lc:lockedCanvas", 1);
    1533             : }
    1534             : 
    1535          28 : DECLARE_OOXMLEXPORT_TEST(fdo78474, "fdo78474.docx")
    1536             : {
    1537           4 :     xmlDocPtr pXmlDoc1 = parseExport("word/document.xml");
    1538           4 :     if (!pXmlDoc1) return;
    1539             :     //docx file after RT is getting corrupted.
    1540           2 :     assertXPath(pXmlDoc1, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:txbx[1]/w:txbxContent[1]/w:p[1]/w:r[1]/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/pic:pic[1]/pic:blipFill[1]/a:blip[1]", "embed", "rId2");
    1541             : 
    1542           2 :     xmlDocPtr pXmlDoc2 = parseExport("word/_rels/document.xml.rels");
    1543           2 :     if (!pXmlDoc2) return;
    1544           2 :     assertXPath(pXmlDoc2,"/rels:Relationships/rels:Relationship[2]","Id","rId2");
    1545             : }
    1546             : 
    1547          28 : DECLARE_OOXMLEXPORT_TEST(testAbsolutePositionOffsetValue,"fdo78432.docx")
    1548             : {
    1549           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1550           4 :     if (!pXmlDoc)
    1551           6 :         return;
    1552             : 
    1553           2 :     sal_Int32 IntMax = SAL_MAX_INT32;
    1554             : 
    1555             :     xmlXPathObjectPtr pXmlObjs[6];
    1556           2 :     pXmlObjs[0] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]");
    1557           2 :     pXmlObjs[1] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]");
    1558             : 
    1559           2 :     pXmlObjs[2] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[2]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]");
    1560           2 :     pXmlObjs[3] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[2]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]");
    1561             : 
    1562           2 :     pXmlObjs[4] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[3]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]");
    1563           2 :     pXmlObjs[5] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[3]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]");
    1564             : 
    1565          14 :     for(sal_Int32 index = 0; index<6; ++index)
    1566             :     {
    1567          12 :         CPPUNIT_ASSERT(pXmlObjs[index]->nodesetval != 0);
    1568          12 :         xmlNodePtr pXmlNode = pXmlObjs[index]->nodesetval->nodeTab[0];
    1569          12 :         OUString contents = OUString::createFromAscii((const char*)((pXmlNode->children[0]).content));
    1570          12 :         CPPUNIT_ASSERT( contents.toInt64() <= IntMax );
    1571          12 :         xmlXPathFreeObject(pXmlObjs[index]);
    1572          12 :     }
    1573             : }
    1574             : 
    1575          28 : DECLARE_OOXMLEXPORT_TEST(testfdo78300,"fdo78300.docx")
    1576             : {
    1577           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1578           4 :     if (!pXmlDoc)
    1579           6 :         return;
    1580             :     assertXPath(pXmlDoc,
    1581             :                 "/w:document/w:body/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing[1]/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p[1]/w:r[1]/w:drawing[1]",
    1582           2 :                 0);
    1583             : }
    1584             : 
    1585          28 : DECLARE_OOXMLEXPORT_TEST(testWordArtWithinDraingtool, "testWordArtWithinDraingtool.docx")
    1586             : {
    1587             : /*   * Within a file, there is a 2007 wordArt enclosed in a drawing tool
    1588             :      * LO was exporting it as below:
    1589             :      * Sample XML as in Original file:
    1590             :      * <p> <r> <ac> <drawing> <txbx> <txbxContent> ..  <pict> </pict> </txbxContent></txbx> </drawing> </ac> </r> </p>
    1591             :      *  After RT :
    1592             :      * <p> <r> <ac> <drawing> <txbx> <txbxContent> ..  <drawing> <txbx> <txbxContent> ..  </txbxContent></txbx> </drawing> .. </txbxContent></txbx> </drawing> </ac> </r> </p>
    1593             :      *  Expected : As there is nesting of a 2007 Word Art within a draing tool, then can be separated in two different runs.
    1594             :      * */
    1595             : 
    1596           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1597           4 :     if (!pXmlDoc)
    1598           6 :        return;
    1599           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent",1);
    1600           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:textbox/w:txbxContent/w:p/w:r/w:pict/v:shape",1);
    1601             :     // Make sure that the shape inside a shape is exported as VML-only, no embedded mc:AlternateContent before w:pict.
    1602           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p/w:r/w:pict",1);
    1603             : }
    1604             : 
    1605          28 : DECLARE_OOXMLEXPORT_TEST(testfdo78663, "fdo78663.docx")
    1606             : {
    1607             : /*     * A 2007 word art tool is enclosed in a 2010 drawing toolWithin a file,
    1608             :      * Originally the file has the following xml tag hierarchy.
    1609             :      *
    1610             :      * <p> <r> <ac> <drawing> <txbx> <txbxContent> <pict><shapetype> <shape> ...</shape></shapetype> </pict> </txbxContent></txbx> </drawing> </ac> </r> </p>
    1611             :      *  After RT :
    1612             :      * <p> <r> <ac> <drawing> <txbx> <txbxContent> <pict><shapetype> <shape> <textbox><txbxContent> ... </txbxContent></textbox></shape></shapetype> </pict> </txbxContent></txbx> </drawing> </ac> </r> </p>
    1613             :      * MSO doesn't allow nesting of txbxContent tags.
    1614             :      * As the text of the wordart tool is written in the tag <v:textpath string="Welcome to... "History is fun and informative"/>
    1615             :      * We shouldn't repeat it again in <shapetype><shape> <textbox><txbxContent>
    1616             :      * */
    1617             : 
    1618           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1619           4 :     if (!pXmlDoc)
    1620           6 :        return;
    1621           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p/w:r/w:pict/v:shape/v:path",1);
    1622           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:textbox/w:txbxContent/w:p/w:r/w:pict/v:shape/v:path",1);
    1623             :     // Make sure that the shape inside a shape is exported as VML-only, no embedded mc:AlternateContent before w:pict.
    1624           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p/w:r/w:pict",1);
    1625             : }
    1626             : 
    1627          28 : DECLARE_OOXMLEXPORT_TEST(testFdo78957, "fdo78957.docx")
    1628             : {
    1629           4 :     xmlDocPtr pXmlHeader = parseExport("word/header2.xml");
    1630             : 
    1631           4 :     if(!pXmlHeader)
    1632           6 :         return;
    1633             : 
    1634           2 :     const sal_Int64 IntMax = SAL_MAX_INT32;
    1635           2 :     sal_Int64 cx = 0, cy = 0;
    1636           2 :     cx = getXPath(pXmlHeader,"/w:hdr[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:extent[1]","cx").toInt64();
    1637           2 :     cy = getXPath(pXmlHeader,"/w:hdr[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:extent[1]","cy").toInt64();
    1638             :     //  Here we check the values of extent width & height
    1639           2 :     CPPUNIT_ASSERT(cx <= IntMax );
    1640           2 :     CPPUNIT_ASSERT(cy >= 0 );
    1641             : }
    1642             : 
    1643          28 : DECLARE_OOXMLEXPORT_TEST(testfdo79256, "fdo79256.docx")
    1644             : {
    1645             :     /* Corruption issue containing Line Style with Long Dashes and Dots
    1646             :      * After RT checking the Dash Length value. Dash Length value should not be greater than 2147483.
    1647             :      */
    1648           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1649           4 :     if (!pXmlDoc)
    1650           6 :         return;
    1651             : 
    1652           2 :     const sal_Int32 maxLimit = 2147483;
    1653           2 :     sal_Int32 d = getXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[1]","d").toInt32();
    1654           2 :     CPPUNIT_ASSERT(d <= maxLimit );
    1655             : }
    1656             : 
    1657          28 : DECLARE_OOXMLEXPORT_TEST(testDashedLinePreset, "dashed_line_preset.docx")
    1658             : {
    1659             :     /* Make sure that preset line is exported correctly as "1000th of a percent".
    1660             :      * This test-file has a PRESET dash-line which will be converted by LO import
    1661             :      * to a custom-dash (dash-dot-dot). This test-case makes sure that the exporter
    1662             :      * outputs the correct values.
    1663             :      */
    1664           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1665           4 :     if (!pXmlDoc)
    1666           6 :         return;
    1667             : 
    1668           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[1]", "d" , "800000");
    1669           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[1]", "sp", "300000");
    1670             : 
    1671           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[2]", "d" , "100000");
    1672           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[2]", "sp", "300000");
    1673             : 
    1674           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[3]", "d" , "100000");
    1675           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[3]", "sp", "300000");
    1676             : }
    1677             : 
    1678          28 : DECLARE_OOXMLEXPORT_TEST(testDashedLine_CustDash1000thOfPercent, "dashed_line_custdash_1000th_of_percent.docx")
    1679             : {
    1680             :     /* Make sure that preset line is exported correctly as "1000th of a percent".
    1681             :      * This test-file has a CUSTOM dash-line that is defined as '1000th of a percent'.
    1682             :      * This should be imported by LO as-is, and exported back with the same values.
    1683             :      */
    1684           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1685           4 :     if (!pXmlDoc)
    1686           6 :         return;
    1687             : 
    1688           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[1]", "d" , "800000");
    1689           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[1]", "sp", "300000");
    1690             : 
    1691           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[2]", "d" , "100000");
    1692           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[2]", "sp", "300000");
    1693             : 
    1694           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[3]", "d" , "100000");
    1695           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[3]", "sp", "300000");
    1696             : }
    1697             : 
    1698          28 : DECLARE_OOXMLEXPORT_TEST(testDashedLine_CustDashPercentage, "dashed_line_custdash_percentage.docx")
    1699             : {
    1700             :     /* Make sure that preset line is exported correctly as "1000th of a percent".
    1701             :      * This test-file has a CUSTOM dash-line that is defined as percentages.
    1702             :      * This should be imported by LO as '1000th of a percent', and exported back
    1703             :      * as '1000th of a percent'.
    1704             :      */
    1705           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1706           4 :     if (!pXmlDoc)
    1707           6 :         return;
    1708             : 
    1709           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[1]", "d" , "800000");
    1710           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[1]", "sp", "300000");
    1711             : 
    1712           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[2]", "d" , "100000");
    1713           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[2]", "sp", "300000");
    1714             : 
    1715           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[3]", "d" , "100000");
    1716           2 :     assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[3]", "sp", "300000");
    1717             : }
    1718             : 
    1719          28 : DECLARE_OOXMLEXPORT_TEST(testTextboxRoundedCorners, "textbox-rounded-corners.docx")
    1720             : {
    1721           4 :     uno::Reference<drawing::XShape> xShape = getShape(1);
    1722           8 :     comphelper::SequenceAsHashMap aCustomShapeGeometry = comphelper::SequenceAsHashMap(getProperty< uno::Sequence<beans::PropertyValue> >(xShape, "CustomShapeGeometry"));
    1723             : 
    1724             :     // Test that the shape is a rounded rectangle.
    1725           4 :     CPPUNIT_ASSERT_EQUAL(OUString("ooxml-roundRect"), aCustomShapeGeometry["Type"].get<OUString>());
    1726             : 
    1727             :     // The shape text should start with a table, with "a" in its A1 cell.
    1728           8 :     uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
    1729           8 :     uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1, xText), uno::UNO_QUERY);
    1730           8 :     uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
    1731           8 :     CPPUNIT_ASSERT_EQUAL(OUString("a"), xCell->getString());
    1732           4 : }
    1733             : 
    1734          28 : DECLARE_OOXMLEXPORT_TEST(testfdo79591, "fdo79591.docx")
    1735             : {
    1736             :     /* Values set for docPr name and shape ID attributes
    1737             :      * in RT file were not valid as per UTF-8 encoding format
    1738             :      * and hence was showing RT document as corrupt with error
    1739             :      * message "invalid character"
    1740             :      */
    1741           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1742           4 :     if (!pXmlDoc)
    1743           6 :       return;
    1744             : 
    1745           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp:docPr", "name", "");
    1746           2 :     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape", "ID", "");
    1747             : }
    1748             : 
    1749          28 : DECLARE_OOXMLEXPORT_TEST(testBnc884615, "bnc884615.docx")
    1750             : {
    1751             :     // The problem was that the shape in the header wasn't in the background.
    1752           4 :     CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(1), "Opaque")));
    1753           4 : }
    1754             : 
    1755          28 : DECLARE_OOXMLEXPORT_TEST(testFdo80894, "TextFrameRotation.docx")
    1756             : {
    1757           4 :     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
    1758           4 :     if (!pXmlDoc)
    1759           6 :        return;
    1760             : 
    1761             :     // Rotation value was not roundtripped for textframe.
    1762             :     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[2]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:xfrm",
    1763           2 :     "rot","16200000");
    1764             : }
    1765             : 
    1766          28 : DECLARE_OOXMLEXPORT_TEST(testfdo80895, "fdo80895.docx")
    1767             : {
    1768             :     // DML shapes in header and footer were not getting rendered in LO and the same were not preserved after RT.
    1769             :     // In actual there was a shape but because of fetching wrong theme for header.xml or footer.xml
    1770             :     // resultant shape was with <a:noFill/> prop in <wps:spPr> hence was not visible.
    1771             :     // Checking there is a shape in header without <a:noFill/> element.
    1772             : 
    1773           4 :     xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
    1774           4 :     if (!pXmlDoc)
    1775           6 :         return;
    1776           2 :     assertXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:noFill",0);
    1777           2 :     assertXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:noFill",0);
    1778             : 
    1779             :     // Check for fallback (required for MSO-2007)
    1780           2 :     assertXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "fillcolor", "#4f81bd");
    1781           2 :     assertXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:fill", "type", "solid");
    1782             : }
    1783             : 
    1784          28 : DECLARE_OOXMLEXPORT_TEST(testWrapTightThrough, "wrap-tight-through.docx")
    1785             : {
    1786             :     // These were wrapSquare without a wrap polygon before.
    1787           4 :     if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
    1788             :     {
    1789             :         // The first shape should be wrapThrough with a wrap polygon (was wrapSquare).
    1790           2 :         assertXPath(pXmlDoc, "//w:drawing/wp:anchor[1]/wp:wrapThrough/wp:wrapPolygon/wp:start", "x", "-1104");
    1791             :         // The second shape should be wrapTight with a wrap polygon (was wrapSquare).
    1792           2 :         assertXPath(pXmlDoc, "//w:drawing/wp:anchor[1]/wp:wrapTight/wp:wrapPolygon/wp:start", "y", "792");
    1793             :     }
    1794           4 : }
    1795             : 
    1796          28 : DECLARE_OOXMLEXPORT_TEST(testPictureWrapPolygon, "picture-wrap-polygon.docx")
    1797             : {
    1798             :     // The problem was that the wrap polygon was ignored during export.
    1799           4 :     drawing::PointSequenceSequence aSeqSeq = getProperty<drawing::PointSequenceSequence>(getShape(1), "ContourPolyPolygon");
    1800             :     // This was 0: the polygon list was empty.
    1801           4 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aSeqSeq.getLength());
    1802             : 
    1803           8 :     drawing::PointSequence aSeq = aSeqSeq[0];
    1804           8 :     CPPUNIT_ASSERT_EQUAL(sal_Int32(11), aSeq.getLength());
    1805           4 : }
    1806             : 
    1807             : #endif
    1808             : 
    1809           8 : CPPUNIT_PLUGIN_IMPLEMENT();
    1810             : 
    1811             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10