diff options
68 files changed, 1242 insertions, 1234 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 91fad970586e..571a0da80132 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -305,7 +305,7 @@ protected: * xml stream, and asserting an XPath expression. This method returns the * xml stream, so that you can do the asserting. */ - xmlDocPtr parseExport(const OUString& rDir, const OUString& rFilterFormat); + xmlDocUniquePtr parseExport(const OUString& rDir, const OUString& rFilterFormat); }; @@ -343,7 +343,7 @@ OUString findChartFile(const OUString& rDir, uno::Reference< container::XNameAcc } -xmlDocPtr Chart2ExportTest::parseExport(const OUString& rDir, const OUString& rFilterFormat) +xmlDocUniquePtr Chart2ExportTest::parseExport(const OUString& rDir, const OUString& rFilterFormat) { std::shared_ptr<utl::TempFile> pTempFile = save(rFilterFormat); @@ -578,7 +578,7 @@ void Chart2ExportTest::testErrorBarXLSX() void Chart2ExportTest::testErrorBarPropXLSX() { load("/chart2/qa/extras/data/xlsx/", "testErrorBarProp.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); // test y error bars property @@ -631,7 +631,7 @@ void Chart2ExportTest::testStockChart() */ load("/chart2/qa/extras/data/docx/", "testStockChart.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); if (!pXmlDoc) return; @@ -646,7 +646,7 @@ void Chart2ExportTest::testStockChart() void Chart2ExportTest::testBarChart() { load("/chart2/qa/extras/data/docx/", "testBarChart.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); if (!pXmlDoc) return; @@ -656,7 +656,7 @@ void Chart2ExportTest::testBarChart() void Chart2ExportTest::testCrosses() { load("/chart2/qa/extras/data/docx/", "Bar_horizontal_cone.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:crosses", "val", "autoZero"); } @@ -703,7 +703,7 @@ void Chart2ExportTest::testScatterChartTextXValues() CPPUNIT_ASSERT_EQUAL(5.0, aYValues[2][3]); // Test the export. - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); if (!pXmlDoc) return; @@ -714,7 +714,7 @@ void Chart2ExportTest::testScatterXAxisValues() { load("/chart2/qa/extras/data/odt/", "tdf114657.odt"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "//c:scatterChart/c:ser/c:xVal/c:numRef/c:numCache/c:ptCount", "val", "5"); @@ -728,7 +728,7 @@ void Chart2ExportTest::testScatterXAxisCategories() { load("/chart2/qa/extras/data/odt/", "tdf131143.odt"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "//c:scatterChart/c:ser[1]/c:xVal/c:strRef/c:strCache/c:ptCount", "val", "4"); assertXPathContent(pXmlDoc, "//c:scatterChart/c:ser[1]/c:xVal/c:strRef/c:strCache/c:pt[1]/c:v", "Row 1"); @@ -739,7 +739,7 @@ void Chart2ExportTest::testChartDataTable() { load("/chart2/qa/extras/data/docx/", "testChartDataTable.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:dTable/c:showHorzBorder", "val", "1"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:dTable/c:showVertBorder", "val", "1"); @@ -750,7 +750,7 @@ void Chart2ExportTest::testChartExternalData() { load("/chart2/qa/extras/data/docx/", "testMultipleChart.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); xmlXPathObjectPtr pXmlPathObj = getXPathNode(pXmlDoc, "/c:chartSpace/c:externalData"); xmlNodeSetPtr pXmlNodes = pXmlPathObj->nodesetval; @@ -799,7 +799,7 @@ void Chart2ExportTest::testEmbeddingsGrabBag() void Chart2ExportTest::testAreaChartLoad() { load ("/chart2/qa/extras/data/docx/", "testAreaChartLoad.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:areaChart/c:ser/c:dLbls/c:showVal", "val", "1"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:areaChart/c:ser/c:dLbls/c:dLbl", 0); @@ -809,7 +809,7 @@ void Chart2ExportTest::testUpDownBars() { /* load("/chart2/qa/extras/data/docx/", "UpDownBars.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:upDownBars"); */ @@ -818,7 +818,7 @@ void Chart2ExportTest::testUpDownBars() void Chart2ExportTest::testDoughnutChart() { load("/chart2/qa/extras/data/docx/", "doughnutChart.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart"); @@ -827,7 +827,7 @@ void Chart2ExportTest::testDoughnutChart() void Chart2ExportTest::testDisplayUnits() { load("/chart2/qa/extras/data/docx/", "DisplayUnits.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:dispUnits/c:builtInUnit", "val", "billions"); @@ -836,7 +836,7 @@ void Chart2ExportTest::testDisplayUnits() // void Chart2ExportTest::testFdo74115WallGradientFill() // { // load("/chart2/qa/extras/data/docx/", "fdo74115_WallGradientFill.docx"); -// xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); +// xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); // CPPUNIT_ASSERT(pXmlDoc); // // assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill"); @@ -845,7 +845,7 @@ void Chart2ExportTest::testDisplayUnits() void Chart2ExportTest::testFdo74115WallBitmapFill() { load("/chart2/qa/extras/data/docx/", "fdo74115_WallBitmapFill.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:blipFill"); } @@ -853,7 +853,7 @@ void Chart2ExportTest::testFdo74115WallBitmapFill() void Chart2ExportTest::testPieChartWallLineStyle() { load("/chart2/qa/extras/data/odt/", "testPieChartWallLineStyle.odt"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:ln/a:noFill"); } @@ -863,7 +863,7 @@ void Chart2ExportTest::testPieChartWallLineStyle() void Chart2ExportTest::testFdo78290LineChartMarkerX() { load("/chart2/qa/extras/data/docx/", "fdo78290_Line_Chart_Marker_x.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:lineChart[1]/c:ser[1]/c:marker[1]/c:symbol[1]","val","x"); assertXPath(pXmlDoc, "/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:lineChart[1]/c:ser[1]/c:marker[1]/c:size[1]","val","7"); @@ -874,7 +874,7 @@ void Chart2ExportTest::testFdo78290LineChartMarkerX() void Chart2ExportTest::testFdo78290ScatterChartMarkerX() { load("/chart2/qa/extras/data/docx/", "fdo78290_Scatter_Chart_Marker_x.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:scatterChart[1]/c:ser[1]/c:marker[1]/c:symbol[1]","val","x"); assertXPath(pXmlDoc, "/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:scatterChart[1]/c:ser[1]/c:marker[1]/c:size[1]","val","7"); @@ -886,7 +886,7 @@ void Chart2ExportTest::testFdo78290ScatterChartMarkerX() void Chart2ExportTest::testFdo78290CombinationChartMarkerX() { load("/chart2/qa/extras/data/docx/", "fdo78290_Combination_Chart_Marker_x.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:lineChart[1]/c:ser[1]/c:marker[1]/c:symbol[1]","val","x"); assertXPath(pXmlDoc, "/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:lineChart[1]/c:ser[1]/c:marker[1]/c:size[1]","val","7"); @@ -896,7 +896,7 @@ void Chart2ExportTest::testTdf126115IndividualMarker() { // Check individual marker properties. load("/chart2/qa/extras/data/xlsx/", "tdf126115.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); // 1. series assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[1]/c:dPt/c:marker/c:symbol", "val", "square"); @@ -1133,7 +1133,7 @@ void Chart2ExportTest::testDataLabel3DChartDOCX() Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY); CPPUNIT_ASSERT(xChartDoc.is()); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); // We must not export label position attributes for 3D bar charts. The @@ -1149,7 +1149,7 @@ void Chart2ExportTest::testDataLabelBarChartDOCX() Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY); CPPUNIT_ASSERT(xChartDoc.is()); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:dLbls/c:dLblPos", "val", "ctr"); @@ -1164,7 +1164,7 @@ void Chart2ExportTest::testDataLabelClusteredBarChartDOCX() Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY); CPPUNIT_ASSERT(xChartDoc.is()); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); // This was "t", should be one of the allowed values. @@ -1178,7 +1178,7 @@ void Chart2ExportTest::testDataLabelRadarChartDOCX() Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY); CPPUNIT_ASSERT(xChartDoc.is()); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); // We must not export label position attributes for radar charts. @@ -1193,7 +1193,7 @@ void Chart2ExportTest::testDataLabelDoughnutChartDOCX() Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY); CPPUNIT_ASSERT(xChartDoc.is()); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); // We must not export label position attributes for doughnut charts. @@ -1208,7 +1208,7 @@ void Chart2ExportTest::testDataLabelAreaChartDOCX() Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY); CPPUNIT_ASSERT(xChartDoc.is()); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); // We must not export label position attributes for area charts. @@ -1242,7 +1242,7 @@ void Chart2ExportTest::testDataLabelDefaultLineChartDOCX() void Chart2ExportTest::testIndividualDataLabelProps() { load("/chart2/qa/extras/data/xlsx/", "tdf122915.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[3]/c:dLbls/c:dLbl/c:txPr/a:p/a:pPr/a:defRPr", "b", "1"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[3]/c:dLbls/c:dLbl/c:txPr/a:p/a:pPr/a:defRPr", "sz", "1600"); @@ -1253,7 +1253,7 @@ void Chart2ExportTest::testIndividualDataLabelProps() void Chart2ExportTest::testTdf108107() { load("/chart2/qa/extras/data/xlsx/", "tdf108107.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:dLbl[1]/c:idx", "val", "1"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:dLbl[1]/c:txPr/a:p/a:pPr/a:defRPr", "b", "1"); @@ -1263,7 +1263,7 @@ void Chart2ExportTest::testTdf108107() void Chart2ExportTest::testTdf114139() { load("/chart2/qa/extras/data/xlsx/", "tdf114139.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pie3DChart", 1); @@ -1275,7 +1275,7 @@ void Chart2ExportTest::testTdf114139() void Chart2ExportTest::testTdf64224() { load("/chart2/qa/extras/data/ods/", "tdf64224.ods"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); //no fill @@ -1286,7 +1286,7 @@ void Chart2ExportTest::testTdf64224() void Chart2ExportTest::testChartTitlePropertiesColorFillDOCX() { load("/chart2/qa/extras/data/docx/", "testChartTitlePropertiesColorFill.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:solidFill/a:srgbClr", "val", "ff0000"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 1); @@ -1295,7 +1295,7 @@ void Chart2ExportTest::testChartTitlePropertiesColorFillDOCX() void Chart2ExportTest::testChartTitlePropertiesGradientFillDOCX() { load("/chart2/qa/extras/data/docx/", "testChartTitlePropertiesGradientFill.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr", "val", "cccccc"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:gradFill/a:gsLst/a:gs[2]/a:srgbClr", "val", "666666"); @@ -1305,7 +1305,7 @@ void Chart2ExportTest::testChartTitlePropertiesGradientFillDOCX() void Chart2ExportTest::testChartTitlePropertiesBitmapFillDOCX() { load("/chart2/qa/extras/data/docx/", "testChartTitlePropertiesBitmapFill.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:blipFill/a:blip", "embed", "rId1"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 1); @@ -1315,7 +1315,7 @@ void Chart2ExportTest::testColorGradientWithTransparancyDOCX() { // Test color gradient (two color) with gradient transparency load("/chart2/qa/extras/data/docx/", "testColorGradientWithTransparancy.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); // Test the transparency of the first color assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:spPr/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", "val", "60000"); @@ -1327,7 +1327,7 @@ void Chart2ExportTest::testColorGradientWithTransparancyODS() { // Test color gradient (two color) with simple transparency load("/chart2/qa/extras/data/ods/", "testColorGradientWithTransparancy.ods"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); // Test the transparency of the first color assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:spPr/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", "val", "60000"); @@ -1339,7 +1339,7 @@ void Chart2ExportTest::testColorGradientStopXLSX() { // Test color gradient (two color) stop of the first color load("/chart2/qa/extras/data/xlsx/", "tdf128619.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); // Test the position of the first color assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:spPr/a:gradFill/a:gsLst/a:gs[1]", "pos", "45000"); @@ -1350,7 +1350,7 @@ void Chart2ExportTest::testColorGradientStopXLSX() void Chart2ExportTest::testBarChartDataPointPropDOCX() { load("/chart2/qa/extras/data/docx/", "testBarChartDataPointPropDOCX.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:varyColors", "val", "0"); @@ -1368,7 +1368,7 @@ void Chart2ExportTest::testBarChartDataPointPropDOCX() void Chart2ExportTest::testBarChartRotation() { load ("/chart2/qa/extras/data/docx/", "barChartRotation.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:view3D/c:rotX", "val", "30"); @@ -1383,7 +1383,7 @@ void Chart2ExportTest::testShapeFollowedByChart() docPr Id should be unique, ensuring the same here. */ load("/chart2/qa/extras/data/docx/", "FDO74430.docx"); - xmlDocPtr pXmlDoc = parseExport("word/document", "Office Open XML Text" ); + xmlDocUniquePtr pXmlDoc = parseExport("word/document", "Office Open XML Text" ); CPPUNIT_ASSERT(pXmlDoc); OUString aValueOfFirstDocPR = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/w:drawing[1]/wp:inline[1]/wp:docPr[1]", "id"); @@ -1395,7 +1395,7 @@ void Chart2ExportTest::testShapeFollowedByChart() void Chart2ExportTest::testPieChartDataLabels() { load("/chart2/qa/extras/data/docx/", "PieChartDataLabels.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pie3DChart/c:ser[1]/c:dLbls/c:dLbl[1]/c:dLblPos", "val", "bestFit"); } @@ -1403,7 +1403,7 @@ void Chart2ExportTest::testPieChartDataLabels() void Chart2ExportTest::testSeriesIdxOrder() { load("/chart2/qa/extras/data/docx/", "testSeriesIdxOrder.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:lineChart[1]/c:ser[1]/c:idx[1]", "val", "1"); assertXPath(pXmlDoc, "/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:lineChart[1]/c:ser[1]/c:order[1]", "val", "1"); @@ -1473,14 +1473,14 @@ void Chart2ExportTest::testErrorBarDataRangeODS() void Chart2ExportTest::testChartCrash() { load("/chart2/qa/extras/data/docx/", "FDO75975.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); } void Chart2ExportTest::testPieChartRotation() { load ("/chart2/qa/extras/data/docx/", "pieChartRotation.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:view3D/c:rotX", "val", "40"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:view3D/c:rotY", "val", "30"); @@ -1583,7 +1583,7 @@ void Chart2ExportTest::testGapWidthXLSX() void Chart2ExportTest::testSmoothedLines() { load("/chart2/qa/extras/data/ods/", "smoothedLines.ods"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser[1]/c:smooth", "val", "0"); } @@ -1613,7 +1613,7 @@ void Chart2ExportTest::testLabelStringODS() void Chart2ExportTest::testFdo83058dlblPos() { load ("/chart2/qa/extras/data/docx/", "fdo83058_dlblPos.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:dLbls[1]/c:dLbl[2]/c:dLblPos", "val", "outEnd"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:dLbls[1]/c:dLbl[3]/c:dLblPos", "val", "outEnd"); @@ -1624,7 +1624,7 @@ void Chart2ExportTest::testFdo83058dlblPos() void Chart2ExportTest::testAutoTitleDelXLSX() { load("/chart2/qa/extras/data/xlsx/", "autotitledel_2007.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:autoTitleDeleted", "val", "0"); } @@ -1632,7 +1632,7 @@ void Chart2ExportTest::testAutoTitleDelXLSX() void Chart2ExportTest::testDispBlanksAsXLSX() { load("/chart2/qa/extras/data/xlsx/", "dispBlanksAs_2007.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:dispBlanksAs", "val", "gap"); } @@ -1640,7 +1640,7 @@ void Chart2ExportTest::testDispBlanksAsXLSX() void Chart2ExportTest::testMarkerColorXLSX() { load("/chart2/qa/extras/data/xlsx/", "markerColor.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser/c:marker/c:spPr/a:solidFill/a:srgbClr", "val", "92d050"); } @@ -1648,7 +1648,7 @@ void Chart2ExportTest::testMarkerColorXLSX() void Chart2ExportTest::testRoundedCornersXLSX() { load("/chart2/qa/extras/data/xlsx/", "markerColor.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:roundedCorners", "val", "0"); } @@ -1656,7 +1656,7 @@ void Chart2ExportTest::testRoundedCornersXLSX() void Chart2ExportTest::testAxisNumberFormatXLSX() { load("/chart2/qa/extras/data/ods/", "axis_number_format.ods"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx", 2); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[1]/c:numFmt", "formatCode", "0.00E+000"); @@ -1670,7 +1670,7 @@ void Chart2ExportTest::testDataPointLabelNumberFormatXLSX() { load("/chart2/qa/extras/data/ods/", "tdf123774.ods"); { - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:numFmt", "formatCode", "[$-40E]0.00%"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:numFmt", "sourceLinked", "0"); @@ -1681,7 +1681,7 @@ void Chart2ExportTest::testDataPointLabelNumberFormatXLSX() load("/chart2/qa/extras/data/xlsx/", "tdf130986.xlsx"); { - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl/c:idx", "val", "1"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl/c:numFmt", "formatCode", "0.00E+00"); @@ -1700,7 +1700,7 @@ void Chart2ExportTest::testDataLabelDefaultValuesXLSX() CPPUNIT_ASSERT(aAny >>= aLabel); CPPUNIT_ASSERT(aLabel.ShowNumber); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:showVal", "val", "1"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLblPos", "val", "outEnd"); @@ -1709,7 +1709,7 @@ void Chart2ExportTest::testDataLabelDefaultValuesXLSX() void Chart2ExportTest::testTitleOverlayXLSX() { load("/chart2/qa/extras/data/xlsx/", "chart_title.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:overlay", "val", "0"); } @@ -1717,7 +1717,7 @@ void Chart2ExportTest::testTitleOverlayXLSX() void Chart2ExportTest::testInvertIfNegativeXLSX() { load("/chart2/qa/extras/data/xlsx/", "bar_chart_simple.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:invertIfNegative", "val", "0"); } @@ -1725,7 +1725,7 @@ void Chart2ExportTest::testInvertIfNegativeXLSX() void Chart2ExportTest::testBubble3DXLSX() { load("/chart2/qa/extras/data/xlsx/", "bubble_chart_simple.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:bubbleChart/c:ser[1]/c:bubble3D", "val", "0"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:bubbleChart/c:ser[2]/c:bubble3D", "val", "0"); @@ -1735,7 +1735,7 @@ void Chart2ExportTest::testBubble3DXLSX() void Chart2ExportTest::testNoMarkerXLSX() { load("/chart2/qa/extras/data/xlsx/", "no_marker.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser[1]/c:marker/c:symbol", "val", "none"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser[2]/c:marker/c:symbol", "val", "none"); @@ -1745,7 +1745,7 @@ void Chart2ExportTest::testNoMarkerXLSX() void Chart2ExportTest::testTitleManualLayoutXLSX() { load("/chart2/qa/extras/data/xlsx/", "title_manual_layout.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:layout/c:manualLayout/c:layoutTarget", 0); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:layout/c:manualLayout/c:xMode", "val", "edge"); @@ -1766,7 +1766,7 @@ void Chart2ExportTest::testTitleManualLayoutXLSX() void Chart2ExportTest::testPlotAreaManualLayoutXLSX() { load("/chart2/qa/extras/data/xlsx/", "plot_area_manual_layout.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:layout/c:manualLayout/c:layoutTarget", "val", "inner"); @@ -1795,7 +1795,7 @@ void Chart2ExportTest::testPlotAreaManualLayoutXLSX() void Chart2ExportTest::testLegendManualLayoutXLSX() { load("/chart2/qa/extras/data/xlsx/", "legend_manual_layout.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:layout/c:manualLayout/c:layoutTarget", 0); @@ -1827,7 +1827,7 @@ void Chart2ExportTest::testLegendManualLayoutXLSX() void Chart2ExportTest::testChartSubTitle() { load("/chart2/qa/extras/data/ods/", "testChartSubTitle.ods"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); // test properties of subtitle assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:pPr/a:defRPr", "sz", "1100"); @@ -1841,7 +1841,7 @@ void Chart2ExportTest::testChartSubTitle() void Chart2ExportTest::testChartMainWithSubTitle() { load("/chart2/qa/extras/data/ods/", "testChartMainWithSubTitle.ods"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); // test properties of title assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:pPr/a:defRPr", "sz", "1300"); @@ -1856,7 +1856,7 @@ void Chart2ExportTest::testChartMainWithSubTitle() void Chart2ExportTest::testAutoTitleDeleted() { load("/chart2/qa/extras/data/xlsx/", "testAutoTitleDeleted.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:autoTitleDeleted", "val", "1"); } @@ -1864,7 +1864,7 @@ void Chart2ExportTest::testAutoTitleDeleted() void Chart2ExportTest::testChartTitlePropertiesColorFillXLSX() { load("/chart2/qa/extras/data/xlsx/", "testChartTitlePropertiesColorFill.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:solidFill/a:srgbClr", "val", "ff0000"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 1); @@ -1873,7 +1873,7 @@ void Chart2ExportTest::testChartTitlePropertiesColorFillXLSX() void Chart2ExportTest::testChartTitlePropertiesGradientFillXLSX() { load("/chart2/qa/extras/data/xlsx/", "testChartTitlePropertiesGradientFill.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr", "val", "cccccc"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:gradFill/a:gsLst/a:gs[2]/a:srgbClr", "val", "666666"); @@ -1883,7 +1883,7 @@ void Chart2ExportTest::testChartTitlePropertiesGradientFillXLSX() void Chart2ExportTest::testChartTitlePropertiesBitmapFillXLSX() { load("/chart2/qa/extras/data/xlsx/", "testChartTitlePropertiesBitmapFill.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:blipFill/a:blip", "embed", "rId1"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 1); @@ -1892,7 +1892,7 @@ void Chart2ExportTest::testChartTitlePropertiesBitmapFillXLSX() void Chart2ExportTest::testBarChartDataPointPropXLSX() { load("/chart2/qa/extras/data/xlsx/", "testBarChartDataPointPropXLSX.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:varyColors", "val", "0"); @@ -1931,7 +1931,7 @@ void Chart2ExportTest::testDataseriesOverlapStackedChartXLSX() void Chart2ExportTest::testAxisCharacterPropertiesXLSX() { load("/chart2/qa/extras/data/xlsx/", "axis_character_properties.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:txPr/a:p/a:pPr/a:defRPr", "sz", "1000"); @@ -1948,7 +1948,7 @@ void Chart2ExportTest::testAxisCharacterPropertiesXLSX() void Chart2ExportTest::testTitleCharacterPropertiesXLSX() { load("/chart2/qa/extras/data/xlsx/", "title_character_properties.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:pPr/a:defRPr", "sz", "2400"); @@ -1961,7 +1961,7 @@ void Chart2ExportTest::testTitleCharacterPropertiesXLSX() void Chart2ExportTest::testPlotVisOnlyXLSX() { load("/chart2/qa/extras/data/xlsx/", "hidden_cells.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotVisOnly", "val", "0"); @@ -1970,7 +1970,7 @@ void Chart2ExportTest::testPlotVisOnlyXLSX() void Chart2ExportTest::testBarChartVaryColorsXLSX() { load("/chart2/qa/extras/data/xlsx/", "tdf90876.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:varyColors", "val", "0"); @@ -1979,7 +1979,7 @@ void Chart2ExportTest::testBarChartVaryColorsXLSX() void Chart2ExportTest::testMultipleAxisXLSX() { load("/chart2/qa/extras/data/ods/", "multiple_axis.ods"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart", 2); @@ -1994,7 +1994,7 @@ void Chart2ExportTest::testMultipleAxisXLSX() void Chart2ExportTest::testSecondaryAxisXLSX() { load("/chart2/qa/extras/data/ods/", "secondary_axis.ods"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart", 2); @@ -2020,7 +2020,7 @@ void Chart2ExportTest::testSetSeriesToSecondaryAxisXLSX() // Attach the second series to the secondary axis. (The third series is already attached.) xPropSet->setPropertyValue("AttachedAxisIndex", uno::Any(AxisIndex)); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); // Check there are only two <lineChart> tag in the XML, one for the primary and one for the secondary axis. assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart", 2); @@ -2030,7 +2030,7 @@ void Chart2ExportTest::testCombinedChartSecondaryAxisXLSX() { // Original file was created with MS Office load("/chart2/qa/extras/data/xlsx/", "combined_chart_secondary_axis.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); // Collect barchart axID on secondary Axis OUString XValueIdOfBarchart = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:axId[1]", "val"); @@ -2049,7 +2049,7 @@ void Chart2ExportTest::testCombinedChartSecondaryAxisODS() { // Original file was created with LibreOffice load("/chart2/qa/extras/data/ods/", "combined_chart_secondary_axis.ods"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); // Collect barchart axID on secondary Axis OUString XValueIdOfBarchart = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:axId[1]", "val"); @@ -2071,13 +2071,13 @@ void Chart2ExportTest::testCrossBetweenXLSX() // Original files were created with MS Office { load("/chart2/qa/extras/data/xlsx/", "tdf127777.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:crossBetween", "val", "between"); } { load("/chart2/qa/extras/data/xlsx/", "tdf132076.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:crossBetween", "val", "between"); } @@ -2087,7 +2087,7 @@ void Chart2ExportTest::testCrossBetweenWithDeletedAxis() { // Original file was created with MS Office (the category axis is deleted in the file) load("/chart2/qa/extras/data/xlsx/", "tdf128633.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:crossBetween", "val", "between"); } @@ -2096,7 +2096,7 @@ void Chart2ExportTest::testCrossBetweenODS() { // Original file was created with LibreOffice load("/chart2/qa/extras/data/ods/", "test_CrossBetween.ods"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:crossBetween", "val", "between"); } @@ -2104,7 +2104,7 @@ void Chart2ExportTest::testCrossBetweenODS() void Chart2ExportTest::testAxisTitleRotationXLSX() { load("/chart2/qa/extras/data/xlsx/", "axis_title_rotation.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:title/c:tx/c:rich/a:bodyPr", "rot", "0"); @@ -2113,7 +2113,7 @@ void Chart2ExportTest::testAxisTitleRotationXLSX() void Chart2ExportTest::testAxisTitlePositionDOCX() { load("/chart2/qa/extras/data/docx/", "testAxisTitlePosition.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); // test X Axis title position @@ -2137,14 +2137,14 @@ void Chart2ExportTest::testAxisTitlePositionDOCX() void Chart2ExportTest::testAxisCrossBetweenDOCX() { load("/chart2/qa/extras/data/odt/", "axis-position.odt"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); assertXPath(pXmlDoc, "(//c:crossBetween)[1]", "val", "midCat"); } void Chart2ExportTest::testPieChartDataPointExplosionXLSX() { load("/chart2/qa/extras/data/xlsx/", "pie_chart_datapoint_explosion.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dPt/c:explosion", "val", "28"); @@ -2153,7 +2153,7 @@ void Chart2ExportTest::testPieChartDataPointExplosionXLSX() void Chart2ExportTest::testCustomDataLabel() { load("/chart2/qa/extras/data/pptx/", "tdf115107.pptx"); - xmlDocPtr pXmlDoc = parseExport("ppt/charts/chart1", "Impress MS PowerPoint 2007 XML"); + xmlDocUniquePtr pXmlDoc = parseExport("ppt/charts/chart1", "Impress MS PowerPoint 2007 XML"); CPPUNIT_ASSERT(pXmlDoc); // Check the data labels font color for the complete data series assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr/a:solidFill/a:srgbClr", "val", "404040"); @@ -2252,7 +2252,7 @@ void Chart2ExportTest::testCustomPositionofDataLabel() { load("/chart2/qa/extras/data/xlsx/", "testCustomPosDataLabels.xlsx"); { - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); // test custom position of data label (xlsx) @@ -2268,7 +2268,7 @@ void Chart2ExportTest::testCustomPositionofDataLabel() load("/chart2/qa/extras/data/docx/", "testTdf108110.docx"); { - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); // test custom position of data label (docx) @@ -2286,7 +2286,7 @@ void Chart2ExportTest::testCustomPositionofDataLabel() void Chart2ExportTest::testCustomDataLabelMultipleSeries() { load("/chart2/qa/extras/data/pptx/", "tdf115107-2.pptx"); - xmlDocPtr pXmlDoc = parseExport("ppt/charts/chart2", "Impress MS PowerPoint 2007 XML"); + xmlDocUniquePtr pXmlDoc = parseExport("ppt/charts/chart2", "Impress MS PowerPoint 2007 XML"); CPPUNIT_ASSERT(pXmlDoc); Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY); @@ -2343,7 +2343,7 @@ void Chart2ExportTest::testCustomDataLabelMultipleSeries() void Chart2ExportTest::testLeaderLines() { load("/chart2/qa/extras/data/xlsx/", "testTdf90749.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser[1]/c:dLbls/c:extLst/c:ext/c15:showLeaderLines", "val", "1"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser[2]/c:dLbls/c:extLst/c:ext/c15:showLeaderLines", "val", "1"); @@ -2352,7 +2352,7 @@ void Chart2ExportTest::testLeaderLines() void Chart2ExportTest::testNumberFormatExportPPTX() { load("/chart2/qa/extras/data/pptx/", "tdf115859.pptx"); - xmlDocPtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML"); + xmlDocUniquePtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:numFmt", "formatCode", "#,##0.00,\\K"); @@ -2366,7 +2366,7 @@ void Chart2ExportTest::testLabelSeparatorExportDOCX() Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY); CPPUNIT_ASSERT(xChartDoc.is()); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); // The text separator should be a new line @@ -2380,7 +2380,7 @@ void Chart2ExportTest::testLabelSeparatorExportDOCX() void Chart2ExportTest::testChartTitlePropertiesColorFillPPTX() { load("/chart2/qa/extras/data/pptx/", "testChartTitlePropertiesColorFill.pptx"); - xmlDocPtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML"); + xmlDocUniquePtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:solidFill/a:srgbClr", "val", "ff0000"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 1); @@ -2389,7 +2389,7 @@ void Chart2ExportTest::testChartTitlePropertiesColorFillPPTX() void Chart2ExportTest::testChartTitlePropertiesGradientFillPPTX() { load("/chart2/qa/extras/data/pptx/", "testChartTitlePropertiesGradientFill.pptx"); - xmlDocPtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML"); + xmlDocUniquePtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr", "val", "f6f8fc"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:gradFill/a:gsLst/a:gs[2]/a:srgbClr", "val", "c7d5ed"); @@ -2399,7 +2399,7 @@ void Chart2ExportTest::testChartTitlePropertiesGradientFillPPTX() void Chart2ExportTest::testChartTitlePropertiesBitmapFillPPTX() { load("/chart2/qa/extras/data/pptx/", "testChartTitlePropertiesBitmapFill.pptx"); - xmlDocPtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML"); + xmlDocUniquePtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:blipFill/a:blip", "embed", "rId1"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:ln/a:noFill", 1); @@ -2408,7 +2408,7 @@ void Chart2ExportTest::testChartTitlePropertiesBitmapFillPPTX() void Chart2ExportTest::testxAxisLabelsRotation() { load ("/chart2/qa/extras/data/xlsx/", "xAxisLabelsRotation.xlsx"); - xmlDocPtr pXmlDoc1 = parseExport("xl/charts/chart","Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc1 = parseExport("xl/charts/chart","Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc1); // Chart1 xAxis labels should be 45 degree @@ -2418,7 +2418,7 @@ void Chart2ExportTest::testxAxisLabelsRotation() void Chart2ExportTest::testMultipleCategoryAxisLablesXLSX() { load("/chart2/qa/extras/data/ods/", "multilevelcat.ods"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); // check category axis labels number of first level assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/c:multiLvlStrRef/c:multiLvlStrCache/c:ptCount", "val", "6"); @@ -2435,7 +2435,7 @@ void Chart2ExportTest::testMultipleCategoryAxisLablesXLSX() void Chart2ExportTest::testMultipleCategoryAxisLablesDOCX() { load("/chart2/qa/extras/data/odt/", "multilevelcat.odt"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); // check category axis labels number of first level assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:cat/c:multiLvlStrRef/c:multiLvlStrCache/c:ptCount", "val", "4"); @@ -2452,7 +2452,7 @@ void Chart2ExportTest::testMultipleCategoryAxisLablesDOCX() void Chart2ExportTest::testTdf116163() { load("/chart2/qa/extras/data/pptx/", "tdf116163.pptx"); - xmlDocPtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML"); + xmlDocUniquePtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:txPr/a:bodyPr", "rot", "-5400000"); @@ -2461,7 +2461,7 @@ void Chart2ExportTest::testTdf116163() void Chart2ExportTest::testTdf111824() { load("/chart2/qa/extras/data/xlsx/", "tdf111824.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); // Collect 3D barchart Z axID @@ -2473,7 +2473,7 @@ void Chart2ExportTest::testTdf111824() void Chart2ExportTest::test3DAreaChartZAxis() { load("/chart2/qa/extras/data/xlsx/", "test3DAreaChartZAxis.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); // Collect 3D area chart Z axID @@ -2486,7 +2486,7 @@ void Chart2ExportTest::testTdf119029() { load("/chart2/qa/extras/data/odp/", "tdf119029.odp"); // Only use "chart", without number, because the number depends on the previous tests - xmlDocPtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML"); + xmlDocUniquePtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, @@ -2509,7 +2509,7 @@ void Chart2ExportTest::testTdf108022() void Chart2ExportTest::testTdf121744() { load("/chart2/qa/extras/data/docx/", "tdf121744.docx"); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); OUString XValueId = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:axId[1]", "val"); @@ -2524,7 +2524,7 @@ void Chart2ExportTest::testTdf122031() //Checks pie chart data label format. load("/chart2/qa/extras/data/xlsx/", "tdf122031.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:numFmt", "formatCode", "0.000%"); @@ -2536,7 +2536,7 @@ void Chart2ExportTest::testTdf122031() void Chart2ExportTest::testTdf115012() { load("/chart2/qa/extras/data/xlsx/", "tdf115012.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); // workaround: use-zero instead of leave-gap to show the original line chart assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:dispBlanksAs", "val", "zero"); @@ -2549,7 +2549,7 @@ void Chart2ExportTest::testTdf123206_customLabelText() Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY); CPPUNIT_ASSERT(xChartDoc.is()); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[2]/c:tx/c:rich/a:p/a:r/a:t", "kiscica"); @@ -2562,7 +2562,7 @@ void Chart2ExportTest::testCustomLabelText() Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY); CPPUNIT_ASSERT(xChartDoc.is()); - xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[1]/c:idx", "val", "2"); @@ -2629,7 +2629,7 @@ void Chart2ExportTest::testTdf130225() void Chart2ExportTest::testTdf59857() { load("/chart2/qa/extras/data/ods/", "tdf59857.ods"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:floor/c:spPr/a:ln/a:noFill", 1); @@ -2641,7 +2641,7 @@ void Chart2ExportTest::testTdf59857() void Chart2ExportTest::testTdf126076() { load("/chart2/qa/extras/data/xlsx/", "auto_marker_excel10.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); // This was 12: all series exported with square markers @@ -2679,12 +2679,12 @@ void Chart2ExportTest::testTdf127792() { load("/chart2/qa/extras/data/docx/", "MSO_axis_position.docx"); { - xmlDocPtr pXmlDoc = parseExport("word/charts/chart1", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart1", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:crossBetween", "val", "between"); } { - xmlDocPtr pXmlDoc = parseExport("word/charts/chart2", "Office Open XML Text"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart2", "Office Open XML Text"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:crossBetween", "val", "midCat"); } @@ -2725,14 +2725,14 @@ void Chart2ExportTest::testTdf132076() { { load("/chart2/qa/extras/data/ods/", "tdf132076.ods"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:numFmt", "formatCode", "dd"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:numFmt", "sourceLinked", "0"); } { load("/chart2/qa/extras/data/xlsx/", "tdf132076.xlsx"); - xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:numFmt", "formatCode", "dd"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:numFmt", "sourceLinked", "0"); diff --git a/chart2/qa/extras/xshape/chart2xshape.cxx b/chart2/qa/extras/xshape/chart2xshape.cxx index e68deadc2294..a4f24e666691 100644 --- a/chart2/qa/extras/xshape/chart2xshape.cxx +++ b/chart2/qa/extras/xshape/chart2xshape.cxx @@ -48,7 +48,7 @@ private: void compareAgainstReference(const OUString& rReferenceFile, bool bCreateReference = false); OUString getXShapeDumpString(); - xmlDocPtr getXShapeDumpXmlDoc(); + xmlDocUniquePtr getXShapeDumpXmlDoc(); }; namespace { @@ -73,11 +73,11 @@ OUString Chart2XShapeTest::getXShapeDumpString() return xDumper->dump(); } -xmlDocPtr Chart2XShapeTest::getXShapeDumpXmlDoc() +xmlDocUniquePtr Chart2XShapeTest::getXShapeDumpXmlDoc() { OUString rDump = getXShapeDumpString(); OString aXmlDump = OUStringToOString(rDump, RTL_TEXTENCODING_UTF8); - return xmlParseDoc(reinterpret_cast<const xmlChar*>(aXmlDump.getStr())); + return xmlDocUniquePtr(xmlParseDoc(reinterpret_cast<const xmlChar*>(aXmlDump.getStr()))); } void Chart2XShapeTest::compareAgainstReference(const OUString& rReferenceFile, bool bCreateReference) @@ -173,7 +173,7 @@ void Chart2XShapeTest::testTdf76649TrendLineBug() load("chart2/qa/extras/xshape/data/ods/", "tdf76649_TrendLineBug.ods"); - xmlDocPtr pXmlDoc = getXShapeDumpXmlDoc(); + xmlDocUniquePtr pXmlDoc = getXShapeDumpXmlDoc(); // Check if the regression curve exists (which means a XShape with a certain // name should exist in the dump) @@ -187,7 +187,7 @@ void Chart2XShapeTest::testTdf88154LabelRotatedLayout() uno::Reference< qa::XDumper > xDumper( xChartDoc, UNO_QUERY_THROW ); OUString rDump = xDumper->dump(); OString aXmlDump = OUStringToOString(rDump, RTL_TEXTENCODING_UTF8); - xmlDocPtr pXmlDoc = xmlParseDoc(reinterpret_cast<const xmlChar*>(aXmlDump.getStr())); + xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast<const xmlChar*>(aXmlDump.getStr()))); { OString aPath( "//XShape[@text='Oct-12']/Transformation" ); diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx b/drawinglayer/source/tools/primitive2dxmldump.cxx index 489161736b19..5ba531d1b1de 100644 --- a/drawinglayer/source/tools/primitive2dxmldump.cxx +++ b/drawinglayer/source/tools/primitive2dxmldump.cxx @@ -119,7 +119,7 @@ void Primitive2dXmlDump::dump( pStream->Seek(STREAM_SEEK_TO_BEGIN); } -xmlDocPtr Primitive2dXmlDump::dumpAndParse( +xmlDocUniquePtr Primitive2dXmlDump::dumpAndParse( const drawinglayer::primitive2d::Primitive2DContainer& rPrimitive2DSequence, const OUString& rStreamName) { @@ -146,9 +146,8 @@ xmlDocPtr Primitive2dXmlDump::dumpAndParse( pStream->ReadBytes(pBuffer.get(), nSize); pBuffer[nSize] = 0; SAL_INFO("drawinglayer", "Parsed XML: " << pBuffer.get()); - xmlDocPtr pDoc = xmlParseDoc(reinterpret_cast<xmlChar*>(pBuffer.get())); - return pDoc; + return xmlDocUniquePtr(xmlParseDoc(reinterpret_cast<xmlChar*>(pBuffer.get()))); } void Primitive2dXmlDump::decomposeAndWrite( diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx index 636216a79fc2..ac435905d570 100644 --- a/emfio/qa/cppunit/emf/EmfImportTest.cxx +++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx @@ -77,7 +77,7 @@ Primitive2DSequence Test::parseEmf(const OUString& aSource) void Test::checkRectPrimitive(Primitive2DSequence const & rPrimitive) { drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(rPrimitive)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(rPrimitive)); CPPUNIT_ASSERT (pDocument); @@ -104,7 +104,7 @@ void Test::TestDrawString() Primitive2DSequence aSequence = parseEmf("/emfio/qa/cppunit/emf/data/TestDrawString.emf"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence)); CPPUNIT_ASSERT (pDocument); // check correct import of the DrawString: height, position, text, color and font @@ -126,7 +126,7 @@ void Test::TestDrawStringTransparent() Primitive2DSequence aSequence = parseEmf("/emfio/qa/cppunit/emf/data/TestDrawStringTransparent.emf"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence)); CPPUNIT_ASSERT (pDocument); assertXPath(pDocument, "/primitive2D/metafile/transform/mask/transform/unifiedtransparence", "transparence", "0.498039215686275"); @@ -149,7 +149,7 @@ void Test::TestDrawLine() Primitive2DSequence aSequence = parseEmf("/emfio/qa/cppunit/emf/data/TestDrawLine.emf"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence)); CPPUNIT_ASSERT (pDocument); // check correct import of the DrawLine: color and width of the line @@ -163,7 +163,7 @@ void Test::TestLinearGradient() Primitive2DSequence aSequence = parseEmf("/emfio/qa/cppunit/emf/data/TestLinearGradient.emf"); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence)); CPPUNIT_ASSERT (pDocument); assertXPath(pDocument, "/primitive2D/metafile/transform", "xy11", "1.0000656512605"); diff --git a/emfio/qa/cppunit/wmf/wmfimporttest.cxx b/emfio/qa/cppunit/wmf/wmfimporttest.cxx index 5d3c3b772de5..5dfcfdad2041 100644 --- a/emfio/qa/cppunit/wmf/wmfimporttest.cxx +++ b/emfio/qa/cppunit/wmf/wmfimporttest.cxx @@ -73,7 +73,7 @@ void WmfTest::testNonPlaceableWmf() MetafileXmlDump dumper; dumper.filterAllActionTypes(); dumper.filterActionType(MetaActionType::POLYLINE, false); - xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile); + xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile); CPPUNIT_ASSERT(pDoc); @@ -102,7 +102,7 @@ void WmfTest::testSine() MetafileXmlDump dumper; dumper.filterAllActionTypes(); dumper.filterActionType(MetaActionType::ISECTRECTCLIPREGION, false); - xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile); + xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile); CPPUNIT_ASSERT(pDoc); @@ -118,7 +118,7 @@ void WmfTest::testEmfProblem() MetafileXmlDump dumper; dumper.filterAllActionTypes(); dumper.filterActionType(MetaActionType::ISECTRECTCLIPREGION, false); - xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile); + xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile); CPPUNIT_ASSERT(pDoc); @@ -138,7 +138,7 @@ void WmfTest::testEmfLineStyles() dumper.filterAllActionTypes(); dumper.filterActionType(MetaActionType::LINE, false); dumper.filterActionType(MetaActionType::LINECOLOR, false); - xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile); + xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile); CPPUNIT_ASSERT(pDoc); @@ -197,7 +197,7 @@ void WmfTest::testWorldTransformFontSize() MetafileXmlDump dumper; dumper.filterAllActionTypes(); dumper.filterActionType(MetaActionType::FONT, false); - xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile); + xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile); CPPUNIT_ASSERT(pDoc); @@ -225,7 +225,7 @@ void WmfTest::testTdf93750() ReadWindowMetafile(aFileStream, aGDIMetaFile); MetafileXmlDump dumper; - xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile); + xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile); CPPUNIT_ASSERT(pDoc); @@ -264,7 +264,7 @@ void WmfTest::testTdf39894() ReadWindowMetafile(aFileStream, aGDIMetaFile); MetafileXmlDump dumper; - xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile); + xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile); CPPUNIT_ASSERT(pDoc); @@ -285,7 +285,7 @@ void WmfTest::testETO_PDY() ReadWindowMetafile(aFileStream, aGDIMetaFile); MetafileXmlDump dumper; - xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile); + xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile); CPPUNIT_ASSERT(pDoc); diff --git a/filter/qa/cppunit/filters-pict-test.cxx b/filter/qa/cppunit/filters-pict-test.cxx index 1fd6ae8e37a0..7b62c71b9d32 100644 --- a/filter/qa/cppunit/filters-pict-test.cxx +++ b/filter/qa/cppunit/filters-pict-test.cxx @@ -83,7 +83,7 @@ void PictFilterTest::testDontClipTooMuch() MetafileXmlDump dumper; dumper.filterAllActionTypes(); dumper.filterActionType(MetaActionType::CLIPREGION, false); - xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile); + xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile); CPPUNIT_ASSERT (pDoc); diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx index 8e6524c688ba..9651881826c9 100644 --- a/filter/qa/unit/svg.cxx +++ b/filter/qa/unit/svg.cxx @@ -83,7 +83,7 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testPreserveJpg) aStream.Seek(STREAM_SEEK_TO_BEGIN); // Make sure that the original JPG data is reused and we don't perform a PNG re-compress. - xmlDocPtr pXmlDoc = parseXmlStream(&aStream); + xmlDocUniquePtr pXmlDoc = parseXmlStream(&aStream); OUString aAttributeValue = getXPath(pXmlDoc, "//svg:image", "href"); // Without the accompanying fix in place, this test would have failed with: @@ -110,7 +110,7 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentLine) aStream.Seek(STREAM_SEEK_TO_BEGIN); // Get the style of the group around the actual <path> element. - xmlDocPtr pXmlDoc = parseXmlStream(&aStream); + xmlDocUniquePtr pXmlDoc = parseXmlStream(&aStream); OUString aStyle = getXPath( pXmlDoc, "//svg:g[@class='com.sun.star.drawing.LineShape']/svg:g/svg:g", "style"); OUString aPrefix("opacity: "); diff --git a/include/drawinglayer/tools/primitive2dxmldump.hxx b/include/drawinglayer/tools/primitive2dxmldump.hxx index 3158f537262e..f8712db35fb2 100644 --- a/include/drawinglayer/tools/primitive2dxmldump.hxx +++ b/include/drawinglayer/tools/primitive2dxmldump.hxx @@ -14,6 +14,7 @@ #include <drawinglayer/drawinglayerdllapi.h> #include <libxml/tree.h> #include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <test/xmldocptr.hxx> #include <vector> namespace tools { class XmlWriter; } @@ -38,7 +39,7 @@ public: * into a memory stream. * */ - xmlDocPtr dumpAndParse(const drawinglayer::primitive2d::Primitive2DContainer& aPrimitive2DSequence, const OUString& rStreamName = OUString()); + xmlDocUniquePtr dumpAndParse(const drawinglayer::primitive2d::Primitive2DContainer& aPrimitive2DSequence, const OUString& rStreamName = OUString()); /** Dumps the input primitive sequence to xml into a file. */ void dump(const drawinglayer::primitive2d::Primitive2DContainer& rPrimitive2DSequence, const OUString& rStreamName); diff --git a/include/test/htmltesttools.hxx b/include/test/htmltesttools.hxx index e7bb85305227..fa5722075f87 100644 --- a/include/test/htmltesttools.hxx +++ b/include/test/htmltesttools.hxx @@ -12,17 +12,20 @@ #include <sal/config.h> #include <test/testdllapi.hxx> +#include <test/xmltesttools.hxx> #include <libxml/HTMLparser.h> #include <libxml/HTMLtree.h> #include <unotools/tempfile.hxx> +using htmlDocUniquePtr = xmlDocUniquePtr; + class OOO_DLLPUBLIC_TEST HtmlTestTools { protected: - static htmlDocPtr parseHtml(utl::TempFile const & aTempFile); - static htmlDocPtr parseHtmlStream(SvStream* pStream); + static htmlDocUniquePtr parseHtml(utl::TempFile const & aTempFile); + static htmlDocUniquePtr parseHtmlStream(SvStream* pStream); }; #endif diff --git a/include/test/xmldocptr.hxx b/include/test/xmldocptr.hxx new file mode 100644 index 000000000000..abca72633c61 --- /dev/null +++ b/include/test/xmldocptr.hxx @@ -0,0 +1,19 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#pragma once + +#include <memory> + +struct xmlDocDeleter +{ + void operator()(xmlDoc* p) { xmlFreeDoc(p); } +}; +using xmlDocUniquePtr = std::unique_ptr<xmlDoc, xmlDocDeleter>; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/test/xmltesttools.hxx b/include/test/xmltesttools.hxx index f8f10da387bd..a2c08d7dc0e8 100644 --- a/include/test/xmltesttools.hxx +++ b/include/test/xmltesttools.hxx @@ -23,6 +23,7 @@ #include <rtl/ustring.hxx> #include <unotools/tempfile.hxx> #include <vcl/mtfxmldump.hxx> +#include <test/xmldocptr.hxx> #include <cppunit/TestAssert.h> @@ -32,68 +33,68 @@ class OOO_DLLPUBLIC_TEST XmlTestTools { public: /// Return xmlDocPtr representation of the XML stream read from pStream. - static xmlDocPtr parseXmlStream(SvStream* pStream); + static xmlDocUniquePtr parseXmlStream(SvStream* pStream); - static xmlDocPtr dumpAndParse(MetafileXmlDump& rDumper, const GDIMetaFile& rGDIMetaFile); + static xmlDocUniquePtr dumpAndParse(MetafileXmlDump& rDumper, const GDIMetaFile& rGDIMetaFile); protected: XmlTestTools(); virtual ~XmlTestTools(); - static xmlDocPtr parseXml(utl::TempFile const & aTempFile); + static xmlDocUniquePtr parseXml(utl::TempFile const & aTempFile); virtual void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx); // Caller must call xmlXPathFreeObject: - xmlXPathObjectPtr getXPathNode(xmlDocPtr pXmlDoc, const OString& rXPath); + xmlXPathObjectPtr getXPathNode(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath); /** * Same as the assertXPath(), but don't assert: return the string instead. */ - OUString getXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rAttribute); + OUString getXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OString& rAttribute); /** * Same as the assertXPathContent(), but don't assert: return the string instead. */ - OUString getXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath); + OUString getXPathContent(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath); /** * Get the position of the child named rName of the parent node specified by rXPath. * Useful for checking relative order of elements. */ - int getXPathPosition(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rChildName); + int getXPathPosition(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OString& rChildName); /** * Assert that rXPath exists, and returns exactly one node. */ - void assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath); + void assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath); /** * Assert that rXPath exists, returns exactly one node, and the rXPath's attribute's value * equals to the rExpected value. */ - void assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rAttribute, + void assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OString& rAttribute, const OUString& rExpectedValue); - void assertXPathAttrs(xmlDocPtr pXmlDoc, const OString& rXPath, + void assertXPathAttrs(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const std::vector<std::pair<OString, OUString>>& aPairVector); /** * Assert that rXPath exists, and returns exactly nNumberOfNodes nodes. * Useful for checking that we do _not_ export some node (nNumberOfNodes == 0). */ - void assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, int nNumberOfNodes); + void assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, int nNumberOfNodes); /** * Assert that rXPath exists, and its content equals rContent. */ - void assertXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath, const OUString& rContent); + void assertXPathContent(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OUString& rContent); /** * Assert that rXPath exists and it has an rNSPrefix=rNSHref namespace definition. */ - void assertXPathNSDef(xmlDocPtr pXmlDoc, const OString& rXPath, const OUString& rNSPrefix, + void assertXPathNSDef(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OUString& rNSPrefix, const OUString& rNSHref); /** * Assert that rXPath exists, and has exactly nNumberOfChildNodes child nodes. * Useful for checking that we do have a no child nodes to a specific node (nNumberOfChildNodes == 0). */ - void assertXPathChildren(xmlDocPtr pXmlDoc, const OString& rXPath, int nNumberOfChildNodes); + void assertXPathChildren(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, int nNumberOfChildNodes); /** * Assert that rXPath exists, has exactly 1 child node and does *not* have an attribute named rAttribute. */ - void assertXPathNoAttribute(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rAttribute); + void assertXPathNoAttribute(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OString& rAttribute); }; diff --git a/sc/qa/extras/htmlexporttest.cxx b/sc/qa/extras/htmlexporttest.cxx index 37aa69e4a4f9..d7bbb7038fa4 100644 --- a/sc/qa/extras/htmlexporttest.cxx +++ b/sc/qa/extras/htmlexporttest.cxx @@ -73,7 +73,7 @@ public: OUString const url(aTempDir.GetURL()); TempFile aTempFile(&url, false); - htmlDocPtr pDoc; + htmlDocUniquePtr pDoc; load("/sc/qa/extras/testdocuments/", "BaseForHTMLExport.ods"); save("HTML (StarCalc)", aTempFile); diff --git a/sc/qa/unit/helper/xpath.cxx b/sc/qa/unit/helper/xpath.cxx index 99095798939d..39f9b36e9ed0 100644 --- a/sc/qa/unit/helper/xpath.cxx +++ b/sc/qa/unit/helper/xpath.cxx @@ -19,7 +19,7 @@ #include <com/sun/star/packages/zip/ZipFileAccess.hpp> -xmlDocPtr XPathHelper::parseExport2(ScBootstrapFixture & rFixture, ScDocShell& rShell, uno::Reference<lang::XMultiServiceFactory> const & xSFactory, const OUString& rFile, sal_Int32 nFormat) +xmlDocUniquePtr XPathHelper::parseExport2(ScBootstrapFixture & rFixture, ScDocShell& rShell, uno::Reference<lang::XMultiServiceFactory> const & xSFactory, const OUString& rFile, sal_Int32 nFormat) { std::shared_ptr<utl::TempFile> pTempFile = rFixture.exportTo(&rShell, nFormat); @@ -36,7 +36,7 @@ std::unique_ptr<SvStream> XPathHelper::parseExportStream(std::shared_ptr<utl::Te return pStream; } -xmlDocPtr XPathHelper::parseExport(std::shared_ptr<utl::TempFile> const & pTempFile, uno::Reference<lang::XMultiServiceFactory> const & xSFactory, const OUString& rFile) +xmlDocUniquePtr XPathHelper::parseExport(std::shared_ptr<utl::TempFile> const & pTempFile, uno::Reference<lang::XMultiServiceFactory> const & xSFactory, const OUString& rFile) { std::unique_ptr<SvStream> pStream = parseExportStream(pTempFile, xSFactory, rFile); return XmlTestTools::parseXmlStream(pStream.get()); diff --git a/sc/qa/unit/helper/xpath.hxx b/sc/qa/unit/helper/xpath.hxx index d46e2e85da80..6ef4e01a67cf 100644 --- a/sc/qa/unit/helper/xpath.hxx +++ b/sc/qa/unit/helper/xpath.hxx @@ -15,6 +15,7 @@ #include <rtl/ustring.hxx> #include <sal/types.h> #include "scqahelperdllapi.h" +#include <test/xmltesttools.hxx> #include <memory> @@ -40,7 +41,7 @@ namespace XPathHelper * test several files in the same exported xml file you need to export the file manually * and call the parseExport method that takes a TempFile */ - SCQAHELPER_DLLPUBLIC xmlDocPtr parseExport2(ScBootstrapFixture &, ScDocShell& rShell, uno::Reference< lang::XMultiServiceFactory> const & xSFactory, + SCQAHELPER_DLLPUBLIC xmlDocUniquePtr parseExport2(ScBootstrapFixture &, ScDocShell& rShell, uno::Reference< lang::XMultiServiceFactory> const & xSFactory, const OUString& rFile, sal_Int32 nFormat); /** @@ -55,7 +56,7 @@ namespace XPathHelper * Should be used when the same exported file is used for testing different files in * the same zip file. */ - SCQAHELPER_DLLPUBLIC xmlDocPtr parseExport(std::shared_ptr<utl::TempFile> const & pTempFile, uno::Reference< lang::XMultiServiceFactory> const & xSFactory, + SCQAHELPER_DLLPUBLIC xmlDocUniquePtr parseExport(std::shared_ptr<utl::TempFile> const & pTempFile, uno::Reference< lang::XMultiServiceFactory> const & xSFactory, const OUString& rFile); } diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index 5e4efe06a447..ff9df79980b5 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -780,7 +780,7 @@ void ScPivotTableFiltersTest::testPivotTableExportXLSX() std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pTable + xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); @@ -800,7 +800,7 @@ void ScPivotTableFiltersTest::testPivotTableExportXLSXSingleDataField() std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pTable + xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); @@ -824,7 +824,7 @@ void ScPivotTableFiltersTest::testPivotTableExportXLSXMultipleDataFields() std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pTable + xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); @@ -859,7 +859,7 @@ void ScPivotTableFiltersTest::testPivotCacheExportXLSX() std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pCacheDef = XPathHelper::parseExport(pXPathFile, m_xSFactory, + xmlDocUniquePtr pCacheDef = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pCacheDef); @@ -1949,7 +1949,7 @@ void ScPivotTableFiltersTest::testPivotTableFirstHeaderRowXLSX() std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pTable + xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstHeaderRow", "1"); @@ -2332,7 +2332,7 @@ void ScPivotTableFiltersTest::testPivotTableOutlineModeXLSX() std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pTable + xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); @@ -2353,7 +2353,7 @@ void ScPivotTableFiltersTest::testPivotTableDuplicatedMemberFilterXLSX() std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pTable + xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); @@ -2373,7 +2373,7 @@ void ScPivotTableFiltersTest::testPivotTableTabularModeXLSX() std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pTable + xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); @@ -2395,7 +2395,7 @@ void ScPivotTableFiltersTest::testPivotTableDuplicateFields() std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pCacheDef + xmlDocUniquePtr pCacheDef = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pCacheDef); @@ -2448,7 +2448,7 @@ void ScPivotTableFiltersTest::testTdf123923() std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, + xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pTable); @@ -2465,7 +2465,7 @@ void ScPivotTableFiltersTest::testTdf123939() std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, + xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pTable); @@ -2488,7 +2488,7 @@ void ScPivotTableFiltersTest::testTdf124651() ScDocShellRef xDocSh = loadDoc("tdf124651_simplePivotTable.", FORMAT_ODS); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/pivotTables/pivotTable1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); // We have to export name attribute, even though it's optional according to ECMA-376 standard, @@ -2506,7 +2506,7 @@ void ScPivotTableFiltersTest::testTdf124736() = ScBootstrapFixture::exportTo(xDocSh.get(), FORMAT_XLSX); xDocSh->DoClose(); - xmlDocPtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, + xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pTable); @@ -2560,7 +2560,7 @@ void ScPivotTableFiltersTest::tesTtdf124772NumFmt() = ScBootstrapFixture::exportTo(xDocSh.get(), FORMAT_XLSX); xDocSh->DoClose(); - xmlDocPtr pTable + xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); @@ -2583,7 +2583,7 @@ void ScPivotTableFiltersTest::testTdf124810() ScDocShellRef xDocSh = loadDoc("pivot_dark1.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pTable = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, + xmlDocUniquePtr pTable = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/pivotTables/pivotTable1.xml", FORMAT_XLSX); xDocSh->DoClose(); CPPUNIT_ASSERT(pTable); @@ -2605,7 +2605,7 @@ void ScPivotTableFiltersTest::testTdf124810() ScDocShellRef xDocSh = loadDoc("tdf124651_simplePivotTable.", FORMAT_ODS); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pTable = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, + xmlDocUniquePtr pTable = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/pivotTables/pivotTable1.xml", FORMAT_XLSX); xDocSh->DoClose(); CPPUNIT_ASSERT(pTable); @@ -2626,7 +2626,7 @@ void ScPivotTableFiltersTest::testTdf124883() ScDocShellRef xDocSh = loadDoc("pivot-table/two-data-fields.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pTable = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, + xmlDocUniquePtr pTable = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/pivotTables/pivotTable1.xml", FORMAT_XLSX); xDocSh->DoClose(); CPPUNIT_ASSERT(pTable); @@ -2643,7 +2643,7 @@ void ScPivotTableFiltersTest::testTdf125046() ScDocShellRef xDocSh = loadDoc("pivottable_long_text.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2( + xmlDocUniquePtr pDoc = XPathHelper::parseExport2( *this, *xDocSh, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", @@ -2655,7 +2655,7 @@ void ScPivotTableFiltersTest::testTdf125055() ScDocShellRef xDocSh = loadDoc("pivottable_1s_difference.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2( + xmlDocUniquePtr pDoc = XPathHelper::parseExport2( *this, *xDocSh, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); @@ -2691,7 +2691,7 @@ void ScPivotTableFiltersTest::testTdf125086() ScDocShellRef xDocSh = loadDoc("pivottable_fieldInRowsAndData.", FORMAT_ODS); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/pivotTables/pivotTable1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[2]", "axis", "axisRow"); diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 260a353884d1..4a7a3d5172ac 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -498,7 +498,7 @@ void ScExportTest::testTdf111876() ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/_rels/sheet1.xml.rels", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/_rels/sheet1.xml.rels", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); OUString sTarget = getXPath(pDoc, "/r:Relationships/r:Relationship", "Target"); @@ -643,7 +643,7 @@ void ScExportTest::testProtectionKeyODS_UTF16LErtlSHA1() // we can't assume that the user entered the password; check that we // round-trip the password as-is std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_ODS); - xmlDocPtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); + xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); assertXPath(pXmlDoc, "//office:spreadsheet[@table:structure-protected='true' and @table:protection-key='vbnhxyBKtPHCA1wB21zG1Oha8ZA=' and @table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"); assertXPath(pXmlDoc, "//table:table[@table:protected='true' and @table:protection-key='vbnhxyBKtPHCA1wB21zG1Oha8ZA=' and @table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"); @@ -666,7 +666,7 @@ void ScExportTest::testProtectionKeyODS_UTF8SHA1() // we can't assume that the user entered the password; check that we // round-trip the password as-is std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_ODS); - xmlDocPtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); + xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); assertXPath(pXmlDoc, "//office:spreadsheet[@table:structure-protected='true' and @table:protection-key='nLHas0RIwepGDaH4c2hpyIUvIS8=' and @table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"); assertXPath(pXmlDoc, "//table:table[@table:protected='true' and @table:protection-key='nLHas0RIwepGDaH4c2hpyIUvIS8=' and @table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha1']"); @@ -689,7 +689,7 @@ void ScExportTest::testProtectionKeyODS_UTF8SHA256ODF12() // we can't assume that the user entered the password; check that we // round-trip the password as-is std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_ODS); - xmlDocPtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); + xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); assertXPath(pXmlDoc, "//office:spreadsheet[@table:structure-protected='true' and @table:protection-key='1tnJohagR2T0yF/v69hLPuumSTsj32CumW97nkKGuSQ=' and @table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"); assertXPath(pXmlDoc, "//table:table[@table:protected='true' and @table:protection-key='1tnJohagR2T0yF/v69hLPuumSTsj32CumW97nkKGuSQ=' and @table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"); @@ -712,7 +712,7 @@ void ScExportTest::testProtectionKeyODS_UTF8SHA256W3C() // we can't assume that the user entered the password; check that we // round-trip the password as-is std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_ODS); - xmlDocPtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); + xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); assertXPath(pXmlDoc, "//office:spreadsheet[@table:structure-protected='true' and @table:protection-key='1tnJohagR2T0yF/v69hLPuumSTsj32CumW97nkKGuSQ=' and @table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"); assertXPath(pXmlDoc, "//table:table[@table:protected='true' and @table:protection-key='1tnJohagR2T0yF/v69hLPuumSTsj32CumW97nkKGuSQ=' and @table:protection-key-digest-algorithm='http://www.w3.org/2000/09/xmldsig#sha256']"); @@ -735,7 +735,7 @@ void ScExportTest::testProtectionKeyODS_XL_SHA1() // we can't assume that the user entered the password; check that we // round-trip the password as-is std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_ODS); - xmlDocPtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); + xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); assertXPath(pXmlDoc, "//office:spreadsheet[@table:structure-protected='true' and @table:protection-key='OX3WkEe79fv1PE+FUmfOLdwVoqI=' and @table:protection-key-digest-algorithm='http://docs.oasis-open.org/office/ns/table/legacy-hash-excel' and @loext:protection-key-digest-algorithm-2='http://www.w3.org/2000/09/xmldsig#sha1']"); assertXPath(pXmlDoc, "//table:table[@table:protected='true' and @table:protection-key='OX3WkEe79fv1PE+FUmfOLdwVoqI=' and @table:protection-key-digest-algorithm='http://docs.oasis-open.org/office/ns/table/legacy-hash-excel' and @loext:protection-key-digest-algorithm-2='http://www.w3.org/2000/09/xmldsig#sha1']"); @@ -812,7 +812,7 @@ void ScExportTest::testCommentExportXLSX() std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - const xmlDocPtr pComments + xmlDocUniquePtr pComments = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/comments1.xml"); CPPUNIT_ASSERT(pComments); @@ -822,7 +822,7 @@ void ScExportTest::testCommentExportXLSX() assertXPathContent(pComments, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t", "Komentarz"); - const xmlDocPtr pVmlDrawing + xmlDocUniquePtr pVmlDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/vmlDrawing1.vml"); CPPUNIT_ASSERT(pVmlDrawing); @@ -860,14 +860,14 @@ void ScExportTest::testCommentExportXLSX_2_XLSX() std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - const xmlDocPtr pComments + xmlDocUniquePtr pComments = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/comments1.xml"); CPPUNIT_ASSERT(pComments); assertXPathContent(pComments, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t", "visible comment"); - const xmlDocPtr pVmlDrawing + xmlDocUniquePtr pVmlDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/vmlDrawing1.vml"); CPPUNIT_ASSERT(pVmlDrawing); @@ -884,7 +884,7 @@ void ScExportTest::testCustomColumnWidthExportXLSX() CPPUNIT_ASSERT(xShell.is()); std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); // tdf#124741: check that we export default width, otherwise the skipped columns would have @@ -959,7 +959,7 @@ void ScExportTest::testXfDefaultValuesXLSX() CPPUNIT_ASSERT(xShell.is()); std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/styles.xml"); + xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/styles.xml"); CPPUNIT_ASSERT(pSheet); // cellStyleXfs don't need xfId, so we need to make sure it is not saved @@ -986,7 +986,7 @@ void ScExportTest::testColumnWidthResaveXLSX() CPPUNIT_ASSERT(xShell.is()); std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); // In original Excel document the width is "24" @@ -1088,7 +1088,7 @@ void ScExportTest::testOutlineExportXLSX() CPPUNIT_ASSERT(xShell.is()); std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); // Maximum Outline Row is 4 for this document @@ -1235,7 +1235,7 @@ void ScExportTest::testAllRowsHiddenXLSX() CPPUNIT_ASSERT(xOrigDocSh.is()); std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xOrigDocSh), FORMAT_XLSX); - xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); assertXPath(pSheet, "/x:worksheet/x:sheetFormatPr", "zeroHeight", "true" ); assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row", 0); @@ -1250,7 +1250,7 @@ void ScExportTest::testHiddenEmptyRowsXLSX() CPPUNIT_ASSERT(xShell.is()); std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); assertXPath(pSheet, "/x:worksheet/x:sheetFormatPr", "zeroHeight", "false" ); @@ -1269,7 +1269,7 @@ void ScExportTest::testLandscapeOrientationXLSX() CPPUNIT_ASSERT(xShell.is()); std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); // the usePrinterDefaults cannot be saved to allow opening sheets in Landscape mode via MS Excel @@ -1454,7 +1454,7 @@ void ScExportTest::testBuiltinRangesXLSX() CPPUNIT_ASSERT(xDocSh.is()); xShell->DoClose(); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/workbook.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/workbook.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); //assert the existing OOXML built-in names are still there @@ -1931,14 +1931,14 @@ void ScExportTest::testRichTextCellFormatXLSX() CPPUNIT_ASSERT(xDocSh.is()); std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); - xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); // make sure the only cell in this doc is assigned some formatting record OUString aCellFormat = getXPath(pSheet, "/x:worksheet/x:sheetData/x:row/x:c", "s"); CPPUNIT_ASSERT_MESSAGE("Cell format is missing", !aCellFormat.isEmpty()); - xmlDocPtr pStyles = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/styles.xml"); + xmlDocUniquePtr pStyles = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/styles.xml"); CPPUNIT_ASSERT(pStyles); OString nFormatIdx = OString::number( aCellFormat.toInt32() + 1 ); @@ -2184,7 +2184,7 @@ void ScExportTest::testEmbeddedChartODS() std::shared_ptr<utl::TempFile> pTempFile( ScBootstrapFixture::exportTo(xShell.get(), FORMAT_ODS)); - xmlDocPtr pDoc = XPathHelper::parseExport(pTempFile, m_xSFactory, "content.xml"); + xmlDocUniquePtr pDoc = XPathHelper::parseExport(pTempFile, m_xSFactory, "content.xml"); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/office:document-content/office:body/office:spreadsheet/table:table[2]/table:table-row[7]/table:table-cell[2]/draw:frame/draw:object", @@ -3105,7 +3105,7 @@ void ScExportTest::testCeilingFloorODSToXLSX() CPPUNIT_ASSERT_MESSAGE("Failed to load the document.", xShell.is()); std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/workbook.xml"); + xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/workbook.xml"); CPPUNIT_ASSERT(pSheet); // there shouldn't be any defined names during export of FLOOR and CEILING functions to .xlsx @@ -3131,9 +3131,9 @@ void ScExportTest::testCustomXml() CPPUNIT_ASSERT_MESSAGE("Failed to load the document.", xShell.is()); std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "customXml/item1.xml"); + xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "customXml/item1.xml"); CPPUNIT_ASSERT(pXmlDoc); - xmlDocPtr pRelsDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "customXml/_rels/item1.xml.rels"); + xmlDocUniquePtr pRelsDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "customXml/_rels/item1.xml.rels"); CPPUNIT_ASSERT(pRelsDoc); // Check there is a relation to itemProps1.xml. @@ -3163,7 +3163,7 @@ void ScExportTest::testRelativePathsODS() CPPUNIT_ASSERT(xDocSh.is()); std::shared_ptr<utl::TempFile> pTempFile = exportTo(xDocSh.get(), FORMAT_ODS); - xmlDocPtr pDoc = XPathHelper::parseExport(pTempFile, m_xSFactory, "content.xml"); + xmlDocUniquePtr pDoc = XPathHelper::parseExport(pTempFile, m_xSFactory, "content.xml"); CPPUNIT_ASSERT(pDoc); OUString aURL = getXPath(pDoc, "/office:document-content/office:body/office:spreadsheet/table:table/table:table-row[2]/table:table-cell[2]/text:p/text:a", "href"); @@ -3522,7 +3522,7 @@ void ScExportTest::testSheetTextBoxHyperlinkXLSX() ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/xdr:wsDr[1]/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:nvSpPr[1]/xdr:cNvPr[1]/a:hlinkClick[1]", 1); @@ -3535,7 +3535,7 @@ void ScExportTest::testFontSizeXLSX() ScDocShellRef xDocSh = loadDoc("fontSize.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); OUString fontSize = getXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr", "sz"); @@ -3553,7 +3553,7 @@ void ScExportTest::testSheetCharacterKerningSpaceXLSX() ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); OUString CharKerningSpace = getXPath(pDoc, @@ -3573,7 +3573,7 @@ void ScExportTest::testSheetCondensedCharacterSpaceXLSX() ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); OUString CondensedCharSpace = getXPath(pDoc, @@ -3590,7 +3590,7 @@ void ScExportTest::testTextUnderlineColorXLSX() ScDocShellRef xDocSh = loadDoc("underlineColor.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); // Make sure the underline type is double line assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr", "u", "dbl"); @@ -3617,7 +3617,7 @@ void ScExportTest::testSheetRunParagraphPropertyXLSX() ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/sharedStrings.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/sharedStrings.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); OUString aColor = getXPath(pDoc, "/x:sst/x:si/x:r[1]/x:rPr[1]/x:color", "rgb"); @@ -3632,7 +3632,7 @@ void ScExportTest::testPreserveTextWhitespaceXLSX() ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/sharedStrings.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/sharedStrings.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:sst/x:si/x:t", "space", "preserve"); xDocSh->DoClose(); @@ -3644,7 +3644,7 @@ void ScExportTest::testPreserveTextWhitespace2XLSX() ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/sharedStrings.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/sharedStrings.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:sst/x:si[1]/x:t", "space", "preserve"); assertXPath(pDoc, "/x:sst/x:si[2]/x:r[1]/x:t", "space", "preserve"); @@ -3684,7 +3684,7 @@ void ScExportTest::testHiddenShapeXLSX() CPPUNIT_ASSERT_MESSAGE("Drawing object should not be visible.", !pObj->IsVisible()); CPPUNIT_ASSERT_MESSAGE("Drawing object should not be printable.", !pObj->IsPrintable()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:nvSpPr/xdr:cNvPr", "hidden", "1"); xDocSh->DoClose(); @@ -3695,7 +3695,7 @@ void ScExportTest::testShapeAutofitXLSX() ScDocShellRef xDocSh = loadDoc("testShapeAutofit.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); // TextAutoGrowHeight --> "Fit height to text" / "Resize shape to fit text" --> true @@ -3711,7 +3711,7 @@ void ScExportTest::testHyperlinkXLSX() ScDocShellRef xDocSh = loadDoc("hyperlink.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/_rels/drawing1.xml.rels", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/_rels/drawing1.xml.rels", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/r:Relationships/r:Relationship", "Target", "#Sheet2!A1"); @@ -3889,7 +3889,7 @@ void ScExportTest::testMatrixMultiplicationXLSX() ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); OUString CellFormulaRange = getXPath(pDoc, @@ -4015,7 +4015,7 @@ void ScExportTest::testTextDirectionXLSX() ScDocShellRef xDocSh = loadDoc("writingMode.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", "readingOrder", "1");//LTR @@ -4030,7 +4030,7 @@ void ScExportTest::testTdf66668() ScDocShellRef xDocSh = loadDoc("tdf66668.", FORMAT_XLSX); CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); xDocSh->DoClose(); } @@ -4040,7 +4040,7 @@ void ScExportTest::testTdf130108() ScDocShellRef xDocSh = loadDoc("tdf130108.", FORMAT_ODS); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:font/x:b", "val", "1"); @@ -4057,7 +4057,7 @@ void ScExportTest::testTdf55417() ScDocShellRef xDocSh = loadDoc("tdf55417.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[1]/x:alignment", 1); assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", 1); @@ -4070,7 +4070,7 @@ void ScExportTest::testTdf129985() ScDocShellRef xDocSh = loadDoc("tdf129985.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", "m/d/yyyy"); @@ -4083,7 +4083,7 @@ void ScExportTest::testTdf73063() ScDocShellRef xDocSh = loadDoc("tdf73063.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", "[$-1C1A]dddd\", \"d\". \"mmmm\\ yyyy;@"); @@ -4096,7 +4096,7 @@ void ScExportTest::testTdf88657ODS() ScDocShellRef xDocSh = loadDoc("tdf88657.", FORMAT_ODS); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "styles.xml", FORMAT_ODS); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "styles.xml", FORMAT_ODS); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "//number:fraction", "min-denominator-digits", "3"); @@ -4109,7 +4109,7 @@ void ScExportTest::testConditionalFormatRangeListXLSX() ScDocShellRef xDocSh = loadDoc("conditionalformat_rangelist.", FORMAT_ODS); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "//x:conditionalFormatting", "sqref", "F4 F10"); @@ -4122,7 +4122,7 @@ void ScExportTest::testConditionalFormatContainsTextXLSX() ScDocShellRef xDocSh = loadDoc("conditionalformat_containstext.", FORMAT_ODS); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPathContent(pDoc, "//x:conditionalFormatting/x:cfRule/x:formula", "NOT(ISERROR(SEARCH(\"test\",A1)))"); @@ -4135,7 +4135,7 @@ void ScExportTest::testConditionalFormatPriorityCheckXLSX() ScDocShellRef xDocSh = loadDoc("conditional_fmt_checkpriority.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); constexpr bool bHighPriorityExtensionA1 = true; // Should A1's extension cfRule has higher priority than normal cfRule ? @@ -4181,7 +4181,7 @@ void ScExportTest::testConditionalFormatOriginXLSX() ScDocShellRef xDocSh = loadDoc("conditional_fmt_origin.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); // tdf#124953 : The range-list is B3:C6 F1:G2, origin address in the formula should be B1, not B3. @@ -4196,7 +4196,7 @@ void ScExportTest::testTdf41722() ScDocShellRef xDocSh = loadDoc("tdf41722.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "//x:conditionalFormatting/x:cfRule[1]", "operator", "containsText"); @@ -4211,7 +4211,7 @@ void ScExportTest::testTdf113621() ScDocShellRef xDocSh = loadDoc("tdf113621.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "//x:conditionalFormatting", "sqref", "A1:A1048576"); @@ -4226,7 +4226,7 @@ void ScExportTest::testEscapeCharInNumberFormatXLSX() xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX); CPPUNIT_ASSERT( xDocSh.is() ); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); const sal_Unicode cEuro (8364); // € symbol @@ -4253,7 +4253,7 @@ void ScExportTest::testNatNumInNumberFormatXLSX() xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX); // Convert [NatNum5] to [DBNum2] in Chinese CPPUNIT_ASSERT( xDocSh.is() ); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[3]", "formatCode", "[DBNum2][$-804]General;[RED][DBNum2][$-804]General"); @@ -4290,7 +4290,7 @@ void ScExportTest::testExtendedLCIDXLSX() xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX); CPPUNIT_ASSERT( xDocSh.is() ); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); // Check export assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", "[$-107041E]dd\\-mm\\-yyyy"); @@ -4361,7 +4361,7 @@ void ScExportTest::testHyperlinkTargetFrameODS() OUString aTargetFrame = pURLData->GetTargetFrame(); CPPUNIT_ASSERT_EQUAL(OUString("_blank"), aTargetFrame); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "content.xml", FORMAT_ODS); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "content.xml", FORMAT_ODS); CPPUNIT_ASSERT(pDoc); OUString aTargetFrameExport = getXPath(pDoc, "/office:document-content/office:body/office:spreadsheet/table:table/table:table-row[2]/table:table-cell[2]/text:p/text:a", "target-frame-name"); @@ -4386,7 +4386,7 @@ void ScExportTest::testKeepSettingsOfBlankRows() CPPUNIT_ASSERT(xDocSh.is()); std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); - xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); // saved blank row with not default setting in A2 @@ -4457,7 +4457,7 @@ void ScExportTest::testTdf112936() ScDocShellRef xDocSh = loadDoc("tdf112936.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "//x:pivotCacheDefinition", "recordCount", "4"); @@ -4476,7 +4476,7 @@ void ScExportTest::testXltxExport() pShell->DoInitNew(); // Export as template and check content type - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *pShell, m_xSFactory, "[Content_Types].xml", FORMAT_XLTX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *pShell, m_xSFactory, "[Content_Types].xml", FORMAT_XLTX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/ContentType:Types/ContentType:Override[@PartName='/xl/workbook.xml']", "ContentType", "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"); @@ -4516,7 +4516,7 @@ void ScExportTest::testTdf114969XLSX() ScDocShellRef xDocSh = loadDoc("sheet_name_with_dots.", FORMAT_ODS); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[1]", "location", "'1.1.1.1'!C1"); assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[2]", "location", "'1.1.1.1'!C2"); @@ -4529,7 +4529,7 @@ void ScExportTest::testTdf115192XLSX() ScDocShellRef xDocSh = loadDoc("test_115192.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/_rels/drawing1.xml.rels", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/_rels/drawing1.xml.rels", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/r:Relationships/r:Relationship[@Id='rId1']", "TargetMode", "External"); assertXPathNoAttribute(pDoc, "/r:Relationships/r:Relationship[@Id='rId2']", "TargetMode"); @@ -4544,11 +4544,11 @@ void ScExportTest::testTdf91634XLSX() CPPUNIT_ASSERT(xDocSh.is()); std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); - xmlDocPtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); + xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:pic/xdr:nvPicPr/xdr:cNvPr/a:hlinkClick", 1); - xmlDocPtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/_rels/drawing1.xml.rels"); + xmlDocUniquePtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/_rels/drawing1.xml.rels"); CPPUNIT_ASSERT(pXmlRels); assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", "Target", "https://www.google.com/"); assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", "TargetMode", "External"); @@ -4564,7 +4564,7 @@ void ScExportTest::testTdf115159() CPPUNIT_ASSERT(xDocSh.is()); xShell->DoClose(); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/workbook.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/workbook.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); //assert the existing OOXML built-in name is not duplicated @@ -4591,7 +4591,7 @@ void ScExportTest::testTdf112567() CPPUNIT_ASSERT(xDocSh.is()); xShell->DoClose(); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/workbook.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/workbook.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); //assert the existing OOXML built-in name is not duplicated @@ -4618,7 +4618,7 @@ void ScExportTest::testTdf112567b() CPPUNIT_ASSERT(xDocSh.is()); xShell->DoClose(); - xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/workbook.xml", FORMAT_XLSX); + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/workbook.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); //assert the existing OOXML built-in name is not duplicated @@ -4636,13 +4636,13 @@ void ScExportTest::testTdf123645XLSX() CPPUNIT_ASSERT(xDocSh.is()); std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); - xmlDocPtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); + xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:graphicFrame/xdr:nvGraphicFramePr/xdr:cNvPr/a:hlinkClick", 1); assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:graphicFrame/xdr:nvGraphicFramePr/xdr:cNvPr/a:hlinkClick", 1); assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[3]/xdr:graphicFrame/xdr:nvGraphicFramePr/xdr:cNvPr/a:hlinkClick", 1); - xmlDocPtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/_rels/drawing1.xml.rels"); + xmlDocUniquePtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/_rels/drawing1.xml.rels"); CPPUNIT_ASSERT(pXmlRels); assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", "TargetMode", "External"); assertXPathNoAttribute(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId3']", "TargetMode"); @@ -4660,11 +4660,11 @@ void ScExportTest::testTdf125173XLSX() CPPUNIT_ASSERT(xDocSh.is()); std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); - xmlDocPtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); + xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:nvSpPr/xdr:cNvPr/a:hlinkClick", 1); - xmlDocPtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/_rels/drawing1.xml.rels"); + xmlDocUniquePtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/_rels/drawing1.xml.rels"); CPPUNIT_ASSERT(pXmlRels); assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", "Target", "http://www.google.com/"); assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", "TargetMode", "External"); @@ -4678,11 +4678,11 @@ void ScExportTest::testTdf79972XLSX() CPPUNIT_ASSERT(xDocSh.is()); std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); - xmlDocPtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink", "ref", "A1"); - xmlDocPtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/_rels/sheet1.xml.rels"); + xmlDocUniquePtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/_rels/sheet1.xml.rels"); CPPUNIT_ASSERT(pXmlRels); assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "Target", "https://bugs.documentfoundation.org/show_bug.cgi?id=79972"); assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "TargetMode", "External"); @@ -4696,11 +4696,11 @@ void ScExportTest::testTdf126024XLSX() CPPUNIT_ASSERT(xDocSh.is()); std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); - xmlDocPtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink", "ref", "A2"); - xmlDocPtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/_rels/sheet1.xml.rels"); + xmlDocUniquePtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/_rels/sheet1.xml.rels"); CPPUNIT_ASSERT(pXmlRels); assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "Target", "https://bugs.documentfoundation.org/"); assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "TargetMode", "External"); @@ -4714,11 +4714,11 @@ void ScExportTest::testTdf126177XLSX() CPPUNIT_ASSERT(xDocSh.is()); std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); - xmlDocPtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink", "location", "Munka1!A5"); - xmlDocPtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/_rels/sheet1.xml.rels"); + xmlDocUniquePtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/_rels/sheet1.xml.rels"); CPPUNIT_ASSERT(pXmlRels); OUString aTarget = getXPath(pXmlRels, "/r:Relationships/r:Relationship", "Target"); CPPUNIT_ASSERT(aTarget.endsWith("test.xlsx")); @@ -4736,7 +4736,7 @@ void ScExportTest::testCommentTextVAlignment() std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - const xmlDocPtr pVmlDrawing + xmlDocUniquePtr pVmlDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/vmlDrawing1.vml"); CPPUNIT_ASSERT(pVmlDrawing); @@ -4754,7 +4754,7 @@ void ScExportTest::testCommentTextHAlignment() std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - const xmlDocPtr pVmlDrawing + xmlDocUniquePtr pVmlDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/vmlDrawing1.vml"); CPPUNIT_ASSERT(pVmlDrawing); @@ -4776,7 +4776,7 @@ void ScExportTest::testRotatedImageODS() std::shared_ptr<utl::TempFile> pTemp = saveAs(xDocSh.get(), FORMAT_ODS); CPPUNIT_ASSERT(pTemp); - const xmlDocPtr pXmlDoc = XPathHelper::parseExport(pTemp, m_xSFactory, "content.xml"); + xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pTemp, m_xSFactory, "content.xml"); CPPUNIT_ASSERT(pXmlDoc); const OString sPathStart = "/office:document-content/office:body/office:spreadsheet/" @@ -4846,7 +4846,7 @@ void ScExportTest::testTdf120502() std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); xShell->DoClose(); - const xmlDocPtr pSheet1 + xmlDocUniquePtr pSheet1 = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet1); @@ -4861,7 +4861,7 @@ void ScExportTest::testTdf131372() auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); assertXPathContent(pSheet, "/x:worksheet/x:sheetData/x:row/x:c[1]/x:f", "NA()"); @@ -4877,7 +4877,7 @@ void ScExportTest::testTdf122331() auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); assertXPath(pSheet, "/x:worksheet/x:sheetPr", "filterMode", "true"); @@ -4895,7 +4895,7 @@ void ScExportTest::testTdf83779() auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); - const xmlDocPtr pVmlDrawing + xmlDocUniquePtr pVmlDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pVmlDrawing); diff --git a/sd/qa/unit/HtmlExportTest.cxx b/sd/qa/unit/HtmlExportTest.cxx index 914ccb00981b..551433c13843 100644 --- a/sd/qa/unit/HtmlExportTest.cxx +++ b/sd/qa/unit/HtmlExportTest.cxx @@ -17,7 +17,7 @@ using namespace css; class SdHTMLFilterTest : public SdModelTestBase, public XmlTestTools, public HtmlTestTools { private: - htmlDocPtr exportAndParseHtml(sd::DrawDocShellRef const& xDocShRef) + htmlDocUniquePtr exportAndParseHtml(sd::DrawDocShellRef const& xDocShRef) { FileFormat* pFormat = getFormat(HTML); OUString aExt = "." + OUString::createFromAscii(pFormat->pName); @@ -32,7 +32,7 @@ public: { sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/HtmlExportTestDocument.odp"), ODP); - htmlDocPtr htmlDoc = exportAndParseHtml(xDocShRef); + htmlDocUniquePtr htmlDoc = exportAndParseHtml(xDocShRef); assertXPath(htmlDoc, "/html", 1); assertXPath(htmlDoc, "/html/body", 1); diff --git a/sd/qa/unit/SVGExportTests.cxx b/sd/qa/unit/SVGExportTests.cxx index f94581cf21c7..35adb1ea0684 100644 --- a/sd/qa/unit/SVGExportTests.cxx +++ b/sd/qa/unit/SVGExportTests.cxx @@ -90,7 +90,7 @@ public: { executeExport( "svg-export-text-decorations.odp" ); - xmlDocPtr svgDoc = parseXml(maTempFile); + xmlDocUniquePtr svgDoc = parseXml(maTempFile); CPPUNIT_ASSERT(svgDoc); svgDoc->name = reinterpret_cast<char *>(xmlStrdup(reinterpret_cast<xmlChar const *>(OUStringToOString(maTempFile.GetURL(), RTL_TEXTENCODING_UTF8).getStr()))); @@ -112,7 +112,7 @@ public: { executeExport("textbox-link-javascript.odp"); - xmlDocPtr svgDoc = parseXml(maTempFile); + xmlDocUniquePtr svgDoc = parseXml(maTempFile); CPPUNIT_ASSERT(svgDoc); // There should be only one child (no link to javascript url) diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index bb5d2add3f52..9ed04b1a4c53 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -818,8 +818,8 @@ void SdOOXMLExportTest1::testTdf112633() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); - xmlDocPtr pRelsDoc = parseExport(tempFile, "ppt/slides/_rels/slide1.xml.rels"); + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pRelsDoc = parseExport(tempFile, "ppt/slides/_rels/slide1.xml.rels"); // Check image with artistic effect exists in the slide assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/" @@ -845,7 +845,7 @@ void SdOOXMLExportTest1::testTdf128952() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:xfrm/a:off", "x", "360"); assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:xfrm/a:off", "y", "-360"); @@ -860,7 +860,7 @@ void SdOOXMLExportTest1::testTdf127090() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr", "rot", "-5400000"); } @@ -873,9 +873,9 @@ void SdOOXMLExportTest1::testCustomXml() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDoc = parseExport(tempFile, "customXml/item1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "customXml/item1.xml"); CPPUNIT_ASSERT(pXmlDoc); - xmlDocPtr pRelsDoc = parseExport(tempFile, "customXml/_rels/item1.xml.rels"); + xmlDocUniquePtr pRelsDoc = parseExport(tempFile, "customXml/_rels/item1.xml.rels"); CPPUNIT_ASSERT(pRelsDoc); // Check there is a relation to itemProps1.xml. @@ -1027,7 +1027,7 @@ void SdOOXMLExportTest1::testRoundtripPrstDash() "sysDashDotDot", "sysDot" }; - xmlDocPtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); const OString sStart = "/p:sld/p:cSld/p:spTree/p:sp["; const OString sEnd = "]/p:spPr/a:ln/a:prstDash"; for (sal_uInt16 i = 0; i < 10; i++) @@ -1066,7 +1066,7 @@ void SdOOXMLExportTest1::testDashOnHairline() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); const OString sXmlPath = "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:ln/a:custDash/a:ds"; assertXPath(pXmlDoc, sXmlPath, 11); } diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index c006772ae302..a530631761a4 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -362,19 +362,19 @@ void SdOOXMLExportTest2::testBnc822341() // Export an LO specific ole object (imported from an ODP document) { - xmlDocPtr pXmlDocCT = parseExport(tempFile1, "[Content_Types].xml"); + xmlDocUniquePtr pXmlDocCT = parseExport(tempFile1, "[Content_Types].xml"); assertXPath(pXmlDocCT, "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.openxmlformats-officedocument.wordprocessingml.document']", "PartName", "/ppt/embeddings/oleObject1.docx"); - xmlDocPtr pXmlDocRels = parseExport(tempFile1, "ppt/slides/_rels/slide1.xml.rels"); + xmlDocUniquePtr pXmlDocRels = parseExport(tempFile1, "ppt/slides/_rels/slide1.xml.rels"); assertXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship[@Target='../embeddings/oleObject1.docx']", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); - xmlDocPtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/p:oleObj", "progId", @@ -392,19 +392,19 @@ void SdOOXMLExportTest2::testBnc822341() // Export an MS specific ole object (imported from a PPTX document) { - xmlDocPtr pXmlDocCT = parseExport(tempFile2, "[Content_Types].xml"); + xmlDocUniquePtr pXmlDocCT = parseExport(tempFile2, "[Content_Types].xml"); assertXPath(pXmlDocCT, "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.openxmlformats-officedocument.wordprocessingml.document']", "PartName", "/ppt/embeddings/oleObject1.docx"); - xmlDocPtr pXmlDocRels = parseExport(tempFile2, "ppt/slides/_rels/slide1.xml.rels"); + xmlDocUniquePtr pXmlDocRels = parseExport(tempFile2, "ppt/slides/_rels/slide1.xml.rels"); assertXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship[@Target='../embeddings/oleObject1.docx']", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); - xmlDocPtr pXmlDocContent = parseExport(tempFile2, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile2, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/p:oleObj", "progId", @@ -432,7 +432,7 @@ void SdOOXMLExportTest2::testMathObject() // Export an LO specific ole object (imported from an ODP document) { - xmlDocPtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice", "Requires", @@ -452,7 +452,7 @@ void SdOOXMLExportTest2::testMathObject() // Export an MS specific ole object (imported from a PPTX document) { - xmlDocPtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice", "Requires", @@ -479,7 +479,7 @@ void SdOOXMLExportTest2::testMathObjectPPT2010() // Export an MS specific ole object (imported from a PPTX document) { - xmlDocPtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice", "Requires", @@ -754,7 +754,7 @@ void SdOOXMLExportTest2::testPresetShapesExport() utl::TempFile tempFile; xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile ); - xmlDocPtr pXmlDocCT = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocCT = parseExport(tempFile, "ppt/slides/slide1.xml"); const OString sPattern( "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom[@prst='_T_']/a:avLst/a:gd[_N_]" ); const OString sT( "_T_" ); const OString sN( "_N_" ); @@ -1000,7 +1000,7 @@ void SdOOXMLExportTest2::testTdf59046() utl::TempFile tempFile; xShell = saveAndReload(xShell.get(), PPTX, &tempFile); xShell->DoClose(); - xmlDocPtr pXmlDocRels = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocRels = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocRels, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path", 1); } @@ -1067,7 +1067,7 @@ void SdOOXMLExportTest2::testPptmContentType() xDocShRef = saveAndReload(xDocShRef.get(), PPTM, &tempFile); // Assert that the content type is the one of PPTM - xmlDocPtr pXmlContentType = parseExport(tempFile, "[Content_Types].xml"); + xmlDocUniquePtr pXmlContentType = parseExport(tempFile, "[Content_Types].xml"); assertXPath(pXmlContentType, "/ContentType:Types/ContentType:Override[@PartName='/ppt/presentation.xml']", "ContentType", @@ -1082,7 +1082,7 @@ void SdOOXMLExportTest2::testTdf111798() utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); const OUString data[][29] = { @@ -1154,7 +1154,7 @@ void SdOOXMLExportTest2::testTdf111863() xDocShRef->DoClose(); // check that transition attribute didn't change from 'out' to 'in' - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animEffect", "transition", "out"); } @@ -1167,7 +1167,7 @@ void SdOOXMLExportTest2::testTdf111518() xShell = saveAndReload(xShell.get(), PPTX, &tempFile); xShell->DoClose(); - xmlDocPtr pXmlDocRels = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocRels = parseExport(tempFile, "ppt/slides/slide1.xml"); OUString sExpect = "M -3.54167E-6 -4.81481E-6 L 0.39037 -0.00069 E"; OUString sActual = getXPath(pXmlDocRels, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animMotion", @@ -1182,7 +1182,7 @@ void SdOOXMLExportTest2::testTdf100387() utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn", "dur", "indefinite"); assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[1]/p:cTn", "fill", "hold"); @@ -1211,7 +1211,7 @@ void SdOOXMLExportTest2::testClosingShapesAndLineCaps() utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo/a:pt", 1); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:lnTo[1]/a:pt", 1); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:lnTo[2]/a:pt", 1); @@ -1246,7 +1246,7 @@ void SdOOXMLExportTest2::testRotateFlip() utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); const OUString data[][4] = {// flipH flipV x y @@ -1307,7 +1307,7 @@ void SdOOXMLExportTest2::testTdf106867() CPPUNIT_ASSERT(xNameAccess->hasByName("ppt/media/media1.avi")); // both the ooxml and the extended markup - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:videoFile"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/p:extLst/p:ext/p14:media"); @@ -1324,7 +1324,7 @@ void SdOOXMLExportTest2::testTdf112280() xDocShRef->DoClose(); // check the animRot value - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animRot", "by", "21600000"); } @@ -1337,7 +1337,7 @@ void SdOOXMLExportTest2::testTdf112088() xDocShRef->DoClose(); // check gradient stops - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPathChildren(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:gradFill/a:gsLst", 2); } @@ -1348,7 +1348,7 @@ void SdOOXMLExportTest2::testTdf112333() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); OUString sTo = getXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set[1]/p:to/p:strVal", "val"); CPPUNIT_ASSERT_EQUAL(OUString("solid"), sTo); @@ -1376,7 +1376,7 @@ void SdOOXMLExportTest2::testTdf112552() utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path", "w", "21600"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path", "h", "21600"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path/a:lnTo[1]/a:pt", "x", "21600"); @@ -1391,7 +1391,7 @@ void SdOOXMLExportTest2::testTdf112557() utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slideMasters/slideMaster1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slideMasters/slideMaster1.xml"); assertXPath(pXmlDocContent, "/p:sldMaster/p:cSld/p:spTree/p:sp", 2); // title and object xDocShRef->DoClose(); } @@ -1402,7 +1402,7 @@ void SdOOXMLExportTest2::testTdf128049() utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom", 0); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:prstGeom", "prst", "noSmoking"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:prstGeom/a:avLst/a:gd", "name", "adj"); @@ -1416,7 +1416,7 @@ void SdOOXMLExportTest2::testTdf106026() utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlMasterContent = parseExport(tempFile, "ppt/slideMasters/slideMaster1.xml"); + xmlDocUniquePtr pXmlMasterContent = parseExport(tempFile, "ppt/slideMasters/slideMaster1.xml"); assertXPath(pXmlMasterContent, "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[1]/a:pPr/a:spcBef/a:spcPts", "val", "1417"); assertXPath(pXmlMasterContent, "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[2]/a:pPr/a:spcBef/a:spcPts", "val", "1134"); assertXPath(pXmlMasterContent, "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[3]/a:pPr/a:spcBef/a:spcPts", "val", "850"); @@ -1425,7 +1425,7 @@ void SdOOXMLExportTest2::testTdf106026() assertXPath(pXmlMasterContent, "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[6]/a:pPr/a:spcBef/a:spcPts", "val", "283"); assertXPath(pXmlMasterContent, "/p:sldMaster/p:cSld/p:spTree/p:sp/p:txBody/a:p[7]/a:pPr/a:spcBef/a:spcPts", "val", "283"); - xmlDocPtr pXmlSlideContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlSlideContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlSlideContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[1]/a:pPr/a:spcAft/a:spcPts", "val", "11339"); assertXPath(pXmlSlideContent, @@ -1442,7 +1442,7 @@ void SdOOXMLExportTest2::testTdf112334() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); OUString sAttributeName = getXPathContent(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animClr[1]/p:cBhvr/p:attrNameLst/p:attrName"); CPPUNIT_ASSERT_EQUAL(OUString("style.color"), sAttributeName); @@ -1455,7 +1455,7 @@ void SdOOXMLExportTest2::testTdf112089() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); OUString sID = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr", "id"); OUString sTarget = getXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt", "spid"); @@ -1469,7 +1469,7 @@ void SdOOXMLExportTest2::testTdf112086() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); OUString sVal = getXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:anim[2]/p:tavLst/p:tav/p:val/p:fltVal", "val"); CPPUNIT_ASSERT_EQUAL(OUString("0"), sVal); @@ -1507,7 +1507,7 @@ void SdOOXMLExportTest2::testGroupRotation() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPathNoAttribute(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:grpSpPr/a:xfrm", "rot"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[1]/p:spPr/a:xfrm", "rot", "20400000"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[2]/p:spPr/a:xfrm", "rot", "20400000"); @@ -1520,7 +1520,7 @@ void SdOOXMLExportTest2::testTdf104788() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide6.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide6.xml"); OUString sVal = getXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par[2]/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:anim[2]", "to"); CPPUNIT_ASSERT_EQUAL(-1.0, sVal.toDouble()); @@ -1543,7 +1543,7 @@ void SdOOXMLExportTest2::testSmartartRotation2() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPathContent(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:txBody/a:p/a:r/a:t", "Text"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[4]/p:txBody/a:bodyPr", "rot", "10800000"); @@ -1560,7 +1560,7 @@ void SdOOXMLExportTest2::testTdf91999_rotateShape() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:nvSpPr/p:cNvPr", "name", "CustomShape 2"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:xfrm", "rot", "10800000"); double dX = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:xfrm/a:off", "x").toDouble(); @@ -1576,7 +1576,7 @@ void SdOOXMLExportTest2::testTdf114845_rotateShape() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:nvSpPr/p:cNvPr", "name", "CustomShape 5"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:xfrm", "flipV", "1"); double dX = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:xfrm/a:off", "x").toDouble(); @@ -1592,7 +1592,7 @@ void SdOOXMLExportTest2::testGroupsPosition() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[1]/p:spPr/a:xfrm/a:off", "x", "5004000"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[1]/p:spPr/a:xfrm/a:off", "y", "3310560"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp[1]/p:sp[3]/p:spPr/a:xfrm/a:off", "x", "7760160"); @@ -1606,7 +1606,7 @@ void SdOOXMLExportTest2::testGroupsRotatedPosition() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "x", "2857320"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:spPr/a:xfrm/a:off", "y", "4026960"); } @@ -1618,13 +1618,13 @@ void SdOOXMLExportTest2::testAccentColor() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent1 = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent1 = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:sp/p:style/a:fillRef/a:schemeClr", "val", "accent6"); - xmlDocPtr pXmlDocContent2 = parseExport(tempFile, "ppt/slides/slide2.xml"); + xmlDocUniquePtr pXmlDocContent2 = parseExport(tempFile, "ppt/slides/slide2.xml"); assertXPath(pXmlDocContent2, "/p:sld/p:cSld/p:spTree/p:sp/p:style/a:fillRef/a:schemeClr", "val", "accent6"); - xmlDocPtr pXmlDocTheme1 = parseExport(tempFile, "ppt/theme/theme1.xml"); + xmlDocUniquePtr pXmlDocTheme1 = parseExport(tempFile, "ppt/theme/theme1.xml"); assertXPath(pXmlDocTheme1, "/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr", "val", "70ad47"); - xmlDocPtr pXmlDocTheme2 = parseExport(tempFile, "ppt/theme/theme2.xml"); + xmlDocUniquePtr pXmlDocTheme2 = parseExport(tempFile, "ppt/theme/theme2.xml"); assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr", "val", "deb340"); } @@ -1635,7 +1635,7 @@ void SdOOXMLExportTest2::testThemeColors() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocTheme2 = parseExport(tempFile, "ppt/theme/theme2.xml"); + xmlDocUniquePtr pXmlDocTheme2 = parseExport(tempFile, "ppt/theme/theme2.xml"); assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val", "44546a"); assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:accent3/a:srgbClr", "val", "a5a5a5"); } @@ -1647,9 +1647,9 @@ void SdOOXMLExportTest2::testTdf114848() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocTheme1 = parseExport(tempFile, "ppt/theme/theme1.xml"); + xmlDocUniquePtr pXmlDocTheme1 = parseExport(tempFile, "ppt/theme/theme1.xml"); assertXPath(pXmlDocTheme1, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val", "1f497d"); - xmlDocPtr pXmlDocTheme2 = parseExport(tempFile, "ppt/theme/theme2.xml"); + xmlDocUniquePtr pXmlDocTheme2 = parseExport(tempFile, "ppt/theme/theme2.xml"); assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val", "1f497d"); } @@ -1660,7 +1660,7 @@ void SdOOXMLExportTest2::testTdf68759() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[1]/p:spPr/a:xfrm/a:off", "x", "1687320"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[1]/p:spPr/a:xfrm/a:off", "y", "1615320"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:spPr/a:xfrm", "flipH", "1"); @@ -1680,14 +1680,14 @@ void SdOOXMLExportTest2::testTdf127901() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent1 = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent1 = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:lum", "bright", "70000"); assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:lum", "contrast", "-70000"); - xmlDocPtr pXmlDocContent2 = parseExport(tempFile, "ppt/slides/slide2.xml"); + xmlDocUniquePtr pXmlDocContent2 = parseExport(tempFile, "ppt/slides/slide2.xml"); assertXPath(pXmlDocContent2, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:grayscl", 1); - xmlDocPtr pXmlDocContent3 = parseExport(tempFile, "ppt/slides/slide3.xml"); + xmlDocUniquePtr pXmlDocContent3 = parseExport(tempFile, "ppt/slides/slide3.xml"); assertXPath(pXmlDocContent3, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:biLevel", "thresh", "50000"); } @@ -1699,7 +1699,7 @@ void SdOOXMLExportTest2::testTdf48735() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent1 = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent1 = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:srcRect", "b", "23627"); assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:srcRect", "l", "23627"); assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:srcRect", "r", "23627"); @@ -1713,7 +1713,7 @@ void SdOOXMLExportTest2::testTdf90626() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[1]/a:pPr/a:buSzPct", "val", "100000"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr/a:buSzPct", "val", "150568"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[3]/a:pPr/a:buSzPct", "val", "100000"); @@ -1770,7 +1770,7 @@ void SdOOXMLExportTest2::testFontScale() sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/font-scale.pptx"), PPTX); utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); // Rounding errors possible, approximate value OUString sScale = getXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr/a:normAutofit", "fontScale"); @@ -1785,7 +1785,7 @@ void SdOOXMLExportTest2::testShapeAutofitPPTX() sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/testShapeAutofit.pptx"), PPTX); utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); CPPUNIT_ASSERT(pXmlDocContent); // TextAutoGrowHeight --> "Resize shape to fit text" --> true @@ -1799,7 +1799,7 @@ void SdOOXMLExportTest2::testLegacyShapeAutofitPPTX() sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/testLegacyShapeAutofit.odp"), ODP); utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); CPPUNIT_ASSERT(pXmlDocContent); // Text in a legacy rectangle @@ -1933,7 +1933,7 @@ void SdOOXMLExportTest2::testTdf118806() utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "//p:animMotion", "origin", "layout"); xDocShRef->DoClose(); @@ -1983,7 +1983,7 @@ void SdOOXMLExportTest2::testTdf104792() utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst[1]/p:seq/p:cTn/p:childTnLst[1]/p:par[1]/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:set/p:cBhvr/p:tgtEl/p:spTgt", 1); xDocShRef->DoClose(); @@ -1995,7 +1995,7 @@ void SdOOXMLExportTest2::testTdf90627() utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); // Don't export empty endCondLst without cond. assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst[1]/p:seq/p:cTn/p:childTnLst[1]/p:par[2]/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:endCondLst[not(*)]", 0); @@ -2008,7 +2008,7 @@ void SdOOXMLExportTest2::testTdf104786() utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide2.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide2.xml"); // Don't export empty 'to' assertXPath(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst[1]/p:seq/p:cTn/p:childTnLst[1]/p:par[2]/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst[1]/p:par/p:cTn/p:childTnLst/p:set[2]/p:to", 0); @@ -2022,7 +2022,7 @@ void SdOOXMLExportTest2::testTdf118783() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); OUString sAttributeName = getXPathContent(pXmlDocContent, "//p:animRot/p:cBhvr/p:attrNameLst/p:attrName"); CPPUNIT_ASSERT_EQUAL(OUString("r"), sAttributeName); xDocShRef->DoClose(); @@ -2034,7 +2034,7 @@ void SdOOXMLExportTest2::testTdf104789() utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); OUString sAttributeName = getXPathContent(pXmlDocContent, "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:attrNameLst/p:attrName"); CPPUNIT_ASSERT_EQUAL(OUString("style.opacity"), sAttributeName); @@ -2057,7 +2057,7 @@ void SdOOXMLExportTest2::testTdf118835() utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "(//p:animClr)[1]", "clrSpc", "rgb"); assertXPathContent(pXmlDocContent, "(//p:animClr)[1]//p:attrName", "style.color"); assertXPath(pXmlDocContent, "(//p:animClr)[1]//p:to/a:srgbClr", "val", "ed1c24"); @@ -2085,7 +2085,7 @@ void SdOOXMLExportTest2::testTdf118768() utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "//p:anim[1]", "from", "(-#ppt_w/2)"); assertXPath(pXmlDocContent, "//p:anim[1]", "to", "(#ppt_x)"); assertXPath(pXmlDocContent, "//p:anim[2]", "from", "0"); @@ -2104,7 +2104,7 @@ void SdOOXMLExportTest2::testTdf118836() utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "//p:animScale/p:by", "x", "250000"); assertXPath(pXmlDocContent, "//p:animScale/p:by", "y", "250000"); xDocShRef->DoClose(); @@ -2200,7 +2200,7 @@ void SdOOXMLExportTest2::testTdf116350TextEffects() utl::TempFile tempFile; xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile ); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "//p:sp[1]/p:txBody/a:bodyPr/a:prstTxWarp", "prst", "textArchUp"); assertXPath(pXmlDocContent, "//p:sp[14]/p:txBody/a:bodyPr/a:prstTxWarp", "prst", "textCircle"); assertXPath(pXmlDocContent, "//p:sp[14]/p:spPr/a:solidFill/a:srgbClr", 0); @@ -2215,11 +2215,11 @@ void SdOOXMLExportTest2::testTdf128096() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); - xmlDocPtr pXmlDocContent1 = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent1 = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent1, "//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:highlight/a:srgbClr", "val", "ffff00"); // Check that underlined content is also highlighted - xmlDocPtr pXmlDocContent2 = parseExport(tempFile, "ppt/slides/slide2.xml"); + xmlDocUniquePtr pXmlDocContent2 = parseExport(tempFile, "ppt/slides/slide2.xml"); assertXPath(pXmlDocContent2, "//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:highlight/a:srgbClr", "val", "ffff00"); } void SdOOXMLExportTest2::testTdf120573() @@ -2228,17 +2228,17 @@ void SdOOXMLExportTest2::testTdf120573() utl::TempFile tempFile; xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile ); - xmlDocPtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:audioFile", 1); assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:pic/p:nvPicPr/p:nvPr/a:videoFile", 0); - xmlDocPtr pXmlDocRels = parseExport(tempFile, "ppt/slides/_rels/slide1.xml.rels"); + xmlDocUniquePtr pXmlDocRels = parseExport(tempFile, "ppt/slides/_rels/slide1.xml.rels"); assertXPath(pXmlDocRels, "(/rels:Relationships/rels:Relationship[@Target='../media/media1.wav'])[1]", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio"); - xmlDocPtr pXmlContentType = parseExport(tempFile, "[Content_Types].xml"); + xmlDocUniquePtr pXmlContentType = parseExport(tempFile, "[Content_Types].xml"); assertXPath(pXmlContentType, "/ContentType:Types/ContentType:Override[@PartName='/ppt/media/media1.wav']", "ContentType", @@ -2258,7 +2258,7 @@ void SdOOXMLExportTest2::testTdf118825() ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf118825-motionpath.odp"), ODP); utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); CPPUNIT_ASSERT_MOTIONPATH(sPath1, getXPath(pXmlDocContent, "(//p:animMotion)[1]", "path")); @@ -2273,7 +2273,7 @@ void SdOOXMLExportTest2::testTdf119118() ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc( "sd/qa/unit/data/pptx/tdf119118.pptx" ), PPTX); utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "//p:iterate", "type", "lt"); assertXPath(pXmlDocContent, "//p:tmAbs", "val", "200"); xDocShRef->DoClose(); @@ -2284,7 +2284,7 @@ void SdOOXMLExportTest2::testTdf99213() ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc( "sd/qa/unit/data/odp/tdf99213-target-missing.odp" ), ODP); utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); // Number of nodes with p:attrNameLst was 3, including one that missed tgtEl assertXPath(pXmlDocContent, "//p:attrNameLst", 2); // Timenode that miss its target element should be filtered. @@ -2307,7 +2307,7 @@ void SdOOXMLExportTest2::testPotxExport() xDocShRef->DoClose(); // Load and check content type - xmlDocPtr pContentTypes = parseExport(tempFile, "[Content_Types].xml"); + xmlDocUniquePtr pContentTypes = parseExport(tempFile, "[Content_Types].xml"); CPPUNIT_ASSERT(pContentTypes); assertXPath(pContentTypes, "/ContentType:Types/ContentType:Override[@PartName='/ppt/presentation.xml']", "ContentType", "application/vnd.openxmlformats-officedocument.presentationml.template.main+xml"); @@ -2326,7 +2326,7 @@ void SdOOXMLExportTest2::testTdf44223() std::unique_ptr<SvStream> const pStream2(parseExportStream(tempFile, "ppt/media/audio2.wav")); CPPUNIT_ASSERT_EQUAL(sal_uInt64(28074), pStream2->remainingSize()); - xmlDocPtr pXmlContentType = parseExport(tempFile, "[Content_Types].xml"); + xmlDocUniquePtr pXmlContentType = parseExport(tempFile, "[Content_Types].xml"); assertXPath(pXmlContentType, "/ContentType:Types/ContentType:Override[@PartName='/ppt/media/audio1.wav']", "ContentType", @@ -2337,17 +2337,17 @@ void SdOOXMLExportTest2::testTdf44223() "ContentType", "audio/x-wav"); - xmlDocPtr pDoc1 = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pDoc1 = parseExport(tempFile, "ppt/slides/slide1.xml"); // Start condition: 0s after timenode id 5 begins. assertXPath(pDoc1 , "//p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond", "evt", "begin"); assertXPath(pDoc1 , "//p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond", "delay", "0"); assertXPath(pDoc1 , "//p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond/p:tn", "val", "5"); - xmlDocPtr pDoc2 = parseExport(tempFile, "ppt/slides/slide2.xml"); + xmlDocUniquePtr pDoc2 = parseExport(tempFile, "ppt/slides/slide2.xml"); assertXPath(pDoc2 , "//p:transition/p:sndAc/p:stSnd/p:snd[@r:embed]", 2); - xmlDocPtr pRels1 = parseExport(tempFile, "ppt/slides/_rels/slide1.xml.rels"); + xmlDocUniquePtr pRels1 = parseExport(tempFile, "ppt/slides/_rels/slide1.xml.rels"); assertXPath(pRels1, "//rels:Relationship[@Id='rId1']", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio"); assertXPath(pRels1, "//rels:Relationship[@Id='rId1']", "Target", "../media/audio1.wav"); @@ -2362,14 +2362,14 @@ void SdOOXMLExportTest2::testSmartArtPreserve() utl::TempFile tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); - xmlDocPtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr"); assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/dgm:relIds"); assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:nvPr/p:extLst/p:ext", "uri", "{D42A27DB-BD31-4B8C-83A1-F6EECF244321}"); assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:nvPr/p:extLst/p:ext/p14:modId"); - xmlDocPtr pXmlDocRels = parseExport(tempFile, "ppt/slides/_rels/slide1.xml.rels"); + xmlDocUniquePtr pXmlDocRels = parseExport(tempFile, "ppt/slides/_rels/slide1.xml.rels"); assertXPath(pXmlDocRels, "(/rels:Relationships/rels:Relationship[@Target='../diagrams/layout1.xml'])[1]", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout"); @@ -2383,7 +2383,7 @@ void SdOOXMLExportTest2::testSmartArtPreserve() "(/rels:Relationships/rels:Relationship[@Target='../diagrams/quickStyle1.xml'])[1]", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle"); - xmlDocPtr pXmlContentType = parseExport(tempFile, "[Content_Types].xml"); + xmlDocUniquePtr pXmlContentType = parseExport(tempFile, "[Content_Types].xml"); assertXPath(pXmlContentType, "/ContentType:Types/ContentType:Override[@PartName='/ppt/diagrams/layout1.xml']", "ContentType", "application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml"); @@ -2564,7 +2564,7 @@ void SdOOXMLExportTest2::testTdf100348_convert_Fontwork2TextWarp() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); // Resulting pptx has to contain the TextWarp shape - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); const OString sPathStart("/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:prstTxWarp"); assertXPath(pXmlDocContent, sPathStart + "[@prst='textWave1']"); const OString sPathAdj(sPathStart + "/a:avLst/a:gd"); @@ -2621,7 +2621,7 @@ void SdOOXMLExportTest2::testTdf1225573_FontWorkScaleX() // Error was, that attribute 'fromWordArt' was ignored // ensure, resulting pptx has fromWordArt="1" on textArchDown shape - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); const OString sPathStart("/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr"); assertXPath(pXmlDocContent, sPathStart + "[@fromWordArt='1']"); @@ -2702,7 +2702,7 @@ void SdOOXMLExportTest2::testTdf99497_keepAppearanceOfCircleKind() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); // slide 1 45° -> adj1 = 20493903, 270° -> adj2 = 5400000, <a:noFill/> exists - xmlDocPtr pXmlDocContent1 = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent1 = parseExport(tempFile, "ppt/slides/slide1.xml"); const OString sPathStart1("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom"); assertXPath(pXmlDocContent1, sPathStart1 + "[@prst='arc']"); const OString sPathAdj1(sPathStart1 + "/a:avLst/a:gd"); @@ -2711,7 +2711,7 @@ void SdOOXMLExportTest2::testTdf99497_keepAppearanceOfCircleKind() assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:noFill"); // slide 2 270° -> adj1 = 5400000, 180° -> adj2 = 10800000 - xmlDocPtr pXmlDocContent2 = parseExport(tempFile, "ppt/slides/slide2.xml"); + xmlDocUniquePtr pXmlDocContent2 = parseExport(tempFile, "ppt/slides/slide2.xml"); const OString sPathStart2("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom"); assertXPath(pXmlDocContent2, sPathStart2 + "[@prst='chord']"); const OString sPathAdj2(sPathStart2 + "/a:avLst/a:gd"); @@ -2719,7 +2719,7 @@ void SdOOXMLExportTest2::testTdf99497_keepAppearanceOfCircleKind() assertXPath(pXmlDocContent2, sPathAdj2 + "[@name='adj2' and @fmla='val 10800000']"); // slide 3 120° -> adj1 = 12600000, 30° -> adj2 = 20946396 - xmlDocPtr pXmlDocContent3 = parseExport(tempFile, "ppt/slides/slide3.xml"); + xmlDocUniquePtr pXmlDocContent3 = parseExport(tempFile, "ppt/slides/slide3.xml"); const OString sPathStart3("/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom"); assertXPath(pXmlDocContent3, sPathStart3 + "[@prst='pie']"); const OString sPathAdj3(sPathStart3 + "/a:avLst/a:gd"); @@ -2786,7 +2786,7 @@ void SdOOXMLExportTest2::testTdf79082() utl::TempFile tempFile; xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile ); - xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr/a:tabLst/a:tab[1]", "pos", diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index d82d9ba52932..285294bca8ea 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -392,7 +392,7 @@ void SdExportTest::testTdf97630() #endif } - xmlDocPtr pXmlDoc = parseExport(aTempFile, "content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(aTempFile, "content.xml"); // text shapes assertXPath(pXmlDoc, "//style:style[@style:family='presentation']/style:graphic-properties[@draw:fit-to-size='false' and @style:shrink-to-fit='false']", 1); #if 1 @@ -505,7 +505,7 @@ void SdExportTest::testOOoXMLAnimations() // the problem was that legacy OOoXML animations were lost if store // immediately follows load because they were "converted" async by a timer - xmlDocPtr pXmlDoc = parseExport(aTempFile, "content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(aTempFile, "content.xml"); assertXPath(pXmlDoc, "//anim:par[@presentation:node-type='timing-root']", 26); // currently getting 52 of these without the fix (depends on timing) assertXPath(pXmlDoc, "//anim:par", 223); @@ -579,7 +579,7 @@ void SdExportTest::testUnknownAttributes() xDocShRef->DoClose(); - xmlDocPtr pXmlDoc = parseExport(aTempFile, "content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(aTempFile, "content.xml"); assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:name='gr1']/style:graphic-properties[@foo:non-existent-att='bar']"); // TODO: if the namespace is *known*, the attribute is not preserved, but that seems to be a pre-existing problem, or maybe it's even intentional? // assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:name='gr1']/style:graphic-properties[@svg:non-existent-att='blah']"); @@ -679,7 +679,7 @@ void SdExportTest::testTdf79082() utl::TempFile tempFile; tempFile.EnableKillingFile(); xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); - xmlDocPtr pXmlDoc = parseExport(tempFile, "content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "content.xml"); // P1 should have 6 tab stops defined assertXPathChildren( @@ -917,7 +917,7 @@ void SdExportTest::testTdf98477() xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); - xmlDocPtr pXmlDoc = parseExport(tempFile, "content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "content.xml"); assertXPath(pXmlDoc, "//anim:animateTransform", "by", "0.5,0.5"); xDocShRef->DoClose(); } @@ -946,7 +946,7 @@ void SdExportTest::testTdf50499() xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); - xmlDocPtr pXmlDoc = parseExport(tempFile, "content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "content.xml"); assertXPath(pXmlDoc, "//anim:animate[1]", "from", "(-width/2)"); assertXPath(pXmlDoc, "//anim:animate[1]", "to", "(x)"); assertXPath(pXmlDoc, "//anim:animate[3]", "by", "(height/3+width*0.1)"); @@ -1167,7 +1167,7 @@ void SdExportTest::testTdf113822() // Was unable to import iterate container (tdf#113822). xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); - xmlDocPtr pXmlDoc = parseExport(tempFile, "content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "content.xml"); // IterateContainer was created as ParallelTimeContainer before, so // the iterate type is not set too. @@ -1188,7 +1188,7 @@ void SdExportTest::testTdf113818() xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); - xmlDocPtr pXmlDoc = parseExport(tempFile, "content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "content.xml"); assertXPath(pXmlDoc, "//anim:animate[1]", "formula", "width*sin(2.5*pi*$)"); assertXPath(pXmlDoc, "//anim:animate[1]", "values", "0;1"); xDocShRef->DoClose(); @@ -1201,7 +1201,7 @@ void SdExportTest::testTdf119629() xDocShRef = saveAndReload(xDocShRef.get(), PPT); xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); - xmlDocPtr pXmlDoc = parseExport(tempFile, "content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "content.xml"); // MSO's effect node type Click parallel node, with group node, after group node // were missing. @@ -1221,7 +1221,7 @@ void SdExportTest::testTdf123557() sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/trigger.pptx"), PPTX); xDocShRef = saveAndReload(xDocShRef.get(), PPTX); xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); - xmlDocPtr pXmlDoc = parseExport(tempFile, "content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "content.xml"); // Contains 2 interactive sequences and 3 triggered effects. assertXPath(pXmlDoc, "//draw:page", 1); diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx index 53707a5676a2..216bdb7d08b0 100644 --- a/sd/qa/unit/misc-tests.cxx +++ b/sd/qa/unit/misc-tests.cxx @@ -517,7 +517,7 @@ void SdMiscTest::testTdf101242_ODF_add_settings() save(xDocShRef.get(), getFormat(ODG), aTempFile ); // Verify, that the saved document still has the ODF attributes - xmlDocPtr pXmlDoc = parseExport(aTempFile, "styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(aTempFile, "styles.xml"); CPPUNIT_ASSERT_MESSAGE("Failed to get 'styles.xml'", pXmlDoc); const OString sPathStart("/office:document-styles/office:master-styles/draw:layer-set/draw:layer"); assertXPath(pXmlDoc, sPathStart + "[@draw:name='backgroundobjects' and @draw:protected='true']"); @@ -525,7 +525,7 @@ void SdMiscTest::testTdf101242_ODF_add_settings() assertXPath(pXmlDoc, sPathStart + "[@draw:name='measurelines' and @draw:display='printer']"); // Verify, that the saved document has got the items in settings.xml - xmlDocPtr pXmlDoc2 = parseExport(aTempFile, "settings.xml"); + xmlDocUniquePtr pXmlDoc2 = parseExport(aTempFile, "settings.xml"); CPPUNIT_ASSERT_MESSAGE("Failed to get 'settings.xml'", pXmlDoc2); const OString sPathStart2("/office:document-settings/office:settings/config:config-item-set[@config:name='ooo:view-settings']/config:config-item-map-indexed[@config:name='Views']/config:config-item-map-entry"); // Value is a bitfield with first Byte in order '* * * measurelines controls backgroundobjects background layout' @@ -567,7 +567,7 @@ void SdMiscTest::testTdf101242_ODF_no_settings() save(xDocShRef.get(), getFormat(ODG), aTempFile ); // Verify, that the saved document still has the ODF attributes - xmlDocPtr pXmlDoc = parseExport(aTempFile, "styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(aTempFile, "styles.xml"); CPPUNIT_ASSERT_MESSAGE("Failed to get 'styles.xml'", pXmlDoc); const OString sPathStart("/office:document-styles/office:master-styles/draw:layer-set/draw:layer"); assertXPath(pXmlDoc, sPathStart + "[@draw:name='backgroundobjects' and @draw:protected='true']"); @@ -575,7 +575,7 @@ void SdMiscTest::testTdf101242_ODF_no_settings() assertXPath(pXmlDoc, sPathStart + "[@draw:name='measurelines' and @draw:display='printer']"); // Verify, that the saved document has no layer items in settings.xml - xmlDocPtr pXmlDoc2 = parseExport(aTempFile, "settings.xml"); + xmlDocUniquePtr pXmlDoc2 = parseExport(aTempFile, "settings.xml"); CPPUNIT_ASSERT_MESSAGE("Failed to get 'settings.xml'", pXmlDoc2); const OString sPathStart2("/office:document-settings/office:settings/config:config-item-set[@config:name='ooo:view-settings']/config:config-item-map-indexed[@config:name='Views']/config:config-item-map-entry"); xmlXPathObjectPtr pXmlObj=getXPathNode(pXmlDoc2, sPathStart2 + "/config:config-item[@config:name='VisibleLayers']"); @@ -609,7 +609,7 @@ void SdMiscTest::testTdf101242_settings_keep() save(xDocShRef.get(), getFormat(ODG), aTempFile ); // Verify, that the saved document has the ODF attributes - xmlDocPtr pXmlDoc = parseExport(aTempFile, "styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(aTempFile, "styles.xml"); CPPUNIT_ASSERT_MESSAGE("Failed to get 'styles.xml'", pXmlDoc); const OString sPathStart("/office:document-styles/office:master-styles/draw:layer-set/draw:layer"); assertXPath(pXmlDoc, sPathStart + "[@draw:name='backgroundobjects' and @draw:protected='true']"); @@ -617,7 +617,7 @@ void SdMiscTest::testTdf101242_settings_keep() assertXPath(pXmlDoc, sPathStart + "[@draw:name='measurelines' and @draw:display='printer']"); // Verify, that the saved document still has the items in settings.xml - xmlDocPtr pXmlDoc2 = parseExport(aTempFile, "settings.xml"); + xmlDocUniquePtr pXmlDoc2 = parseExport(aTempFile, "settings.xml"); CPPUNIT_ASSERT_MESSAGE("Failed to get 'settings.xml'", pXmlDoc2); const OString sPathStart2("/office:document-settings/office:settings/config:config-item-set[@config:name='ooo:view-settings']/config:config-item-map-indexed[@config:name='Views']/config:config-item-map-entry"); // Value is a bitfield with first Byte in order '* * * measurelines controls backgroundobjects background layout' @@ -660,7 +660,7 @@ void SdMiscTest::testTdf101242_settings_remove() save(xDocShRef.get(), getFormat(ODG), aTempFile ); // Verify, that the saved document has the ODF attributes - xmlDocPtr pXmlDoc = parseExport(aTempFile, "styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(aTempFile, "styles.xml"); CPPUNIT_ASSERT_MESSAGE("Failed to get 'styles.xml'", pXmlDoc); const OString sPathStart("/office:document-styles/office:master-styles/draw:layer-set/draw:layer"); assertXPath(pXmlDoc, sPathStart + "[@draw:name='backgroundobjects' and @draw:protected='true']"); @@ -668,7 +668,7 @@ void SdMiscTest::testTdf101242_settings_remove() assertXPath(pXmlDoc, sPathStart + "[@draw:name='measurelines' and @draw:display='printer']"); // Verify, that the saved document has no layer items in settings.xml - xmlDocPtr pXmlDoc2 = parseExport(aTempFile, "settings.xml"); + xmlDocUniquePtr pXmlDoc2 = parseExport(aTempFile, "settings.xml"); CPPUNIT_ASSERT_MESSAGE("Failed to get 'settings.xml'", pXmlDoc2); const OString sPathStart2("/office:document-settings/office:settings/config:config-item-set[@config:name='ooo:view-settings']/config:config-item-map-indexed[@config:name='Views']/config:config-item-map-entry"); xmlXPathObjectPtr pXmlObj=getXPathNode(pXmlDoc2, sPathStart2 + "/config:config-item[@config:name='VisibleLayers']"); @@ -707,7 +707,7 @@ void SdMiscTest::testTdf119392() save(xDocShRef.get(), getFormat(ODG), aTempFile ); // Verify correct bit order in bitfield in the config items in settings.xml - xmlDocPtr pXmlDoc = parseExport(aTempFile, "settings.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(aTempFile, "settings.xml"); CPPUNIT_ASSERT_MESSAGE("Failed to get 'settings.xml'", pXmlDoc); const OString sPathStart("/office:document-settings/office:settings/config:config-item-set[@config:name='ooo:view-settings']/config:config-item-map-indexed[@config:name='Views']/config:config-item-map-entry"); // First Byte is in order 'V-L -P- V-- measurelines controls backgroundobjects background layout' @@ -798,7 +798,7 @@ void SdMiscTest::testTdf98839_ShearVFlipH() utl::TempFile aTempFile; aTempFile.EnableKillingFile(); save(xDocShRef.get(), getFormat(ODG), aTempFile); - xmlDocPtr pXmlDoc = parseExport(aTempFile, "content.xml"); + xmlDocUniquePtr pXmlDoc = parseExport(aTempFile, "content.xml"); CPPUNIT_ASSERT_MESSAGE("Failed to get 'content.xml'", pXmlDoc); const OString sPathStart("/office:document-content/office:body/office:drawing/draw:page"); assertXPath(pXmlDoc, sPathStart); diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx index b97313ffec6d..9cdb3214f353 100644 --- a/sd/qa/unit/sdmodeltestbase.hxx +++ b/sd/qa/unit/sdmodeltestbase.hxx @@ -454,10 +454,10 @@ public: return pStream; } - xmlDocPtr parseExport(utl::TempFile const & rTempFile, OUString const& rStreamName) + xmlDocUniquePtr parseExport(utl::TempFile const & rTempFile, OUString const& rStreamName) { std::unique_ptr<SvStream> const pStream(parseExportStream(rTempFile, rStreamName)); - xmlDocPtr const pXmlDoc = parseXmlStream(pStream.get()); + xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); OUString const url(rTempFile.GetURL()); pXmlDoc->name = reinterpret_cast<char *>(xmlStrdup( reinterpret_cast<xmlChar const *>(OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr()))); diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 9bf4a5acb47f..2bd405ff6b26 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -191,7 +191,7 @@ private: SdXImpressDocument* createDoc(const char* pName, const uno::Sequence<beans::PropertyValue>& rArguments = uno::Sequence<beans::PropertyValue>()); static void callback(int nType, const char* pPayload, void* pData); void callbackImpl(int nType, const char* pPayload); - xmlDocPtr parseXmlDump(); + xmlDocUniquePtr parseXmlDump(); uno::Reference<lang::XComponent> mxComponent; ::tools::Rectangle m_aInvalidation; @@ -344,7 +344,7 @@ void SdTiledRenderingTest::callbackImpl(int nType, const char* pPayload) } } -xmlDocPtr SdTiledRenderingTest::parseXmlDump() +xmlDocUniquePtr SdTiledRenderingTest::parseXmlDump() { if (m_pXmlBuffer) xmlBufferFree(m_pXmlBuffer); @@ -363,7 +363,7 @@ xmlDocPtr SdTiledRenderingTest::parseXmlDump() xmlTextWriterEndDocument(pXmlWriter); xmlFreeTextWriter(pXmlWriter); - return xmlParseMemory(reinterpret_cast<const char*>(xmlBufferContent(m_pXmlBuffer)), xmlBufferLength(m_pXmlBuffer)); + return xmlDocUniquePtr(xmlParseMemory(reinterpret_cast<const char*>(xmlBufferContent(m_pXmlBuffer)), xmlBufferLength(m_pXmlBuffer))); } void SdTiledRenderingTest::testCreateDestroy() @@ -920,11 +920,10 @@ void SdTiledRenderingTest::testResizeTableColumn() pView->SdrEndTextEdit(); // Remember the original cell widths. - xmlDocPtr pXmlDoc = parseXmlDump(); + xmlDocUniquePtr pXmlDoc = parseXmlDump(); OString aPrefix = "/SdDrawDocument/SdrModel/SdPage/SdrObjList/SdrTableObj/SdrTableObjImpl/TableLayouter/columns/"; sal_Int32 nExpectedColumn1 = getXPath(pXmlDoc, aPrefix + "TableLayouter_Layout[1]", "size").toInt32(); sal_Int32 nExpectedColumn2 = getXPath(pXmlDoc, aPrefix + "TableLayouter_Layout[2]", "size").toInt32(); - xmlFreeDoc(pXmlDoc); pXmlDoc = nullptr; // Resize the left column, decrease its width by 1 cm. @@ -938,7 +937,6 @@ void SdTiledRenderingTest::testResizeTableColumn() CPPUNIT_ASSERT(nResizedColumn1 < nExpectedColumn1); sal_Int32 nResizedColumn2 = getXPath(pXmlDoc, aPrefix + "TableLayouter_Layout[2]", "size").toInt32(); CPPUNIT_ASSERT(nResizedColumn2 > nExpectedColumn2); - xmlFreeDoc(pXmlDoc); pXmlDoc = nullptr; // Now undo the resize. @@ -951,7 +949,6 @@ void SdTiledRenderingTest::testResizeTableColumn() CPPUNIT_ASSERT_EQUAL(nExpectedColumn1, nActualColumn1); sal_Int32 nActualColumn2 = getXPath(pXmlDoc, aPrefix + "TableLayouter_Layout[2]", "size").toInt32(); CPPUNIT_ASSERT_EQUAL(nExpectedColumn2, nActualColumn2); - xmlFreeDoc(pXmlDoc); pXmlDoc = nullptr; } @@ -1726,12 +1723,11 @@ void SdTiledRenderingTest::testTdf104405() Scheduler::ProcessEventsToIdle(); // check that the first cell has acquired the resulting vertical style - xmlDocPtr pXmlDoc = parseXmlDump(); + xmlDocUniquePtr pXmlDoc = parseXmlDump(); OString aPrefix = "/SdDrawDocument/SdrModel/SdPage/SdrObjList/SdrTableObj/SdrTableObjImpl" "/TableModel/Cell[1]/DefaultProperties/SfxItemSet/SdrTextVertAdjustItem"; // the following name has a compiler-dependent part CPPUNIT_ASSERT_EQUAL(OUString("2"), getXPath(pXmlDoc, aPrefix, "value")); - xmlFreeDoc(pXmlDoc); } void SdTiledRenderingTest::testTdf81754() @@ -1804,7 +1800,7 @@ void SdTiledRenderingTest::testTdf105502() // Assert that the selected A1 has now a larger font than the unselected // A2. - xmlDocPtr pXmlDoc = parseXmlDump(); + xmlDocUniquePtr pXmlDoc = parseXmlDump(); sal_Int32 nA1Height = getXPath(pXmlDoc, "//Cell[1]/SdrText/OutlinerParaObject/EditTextObject/ContentInfo/SfxItemSet/SvxFontHeightItem[1]", "height").toInt32(); sal_Int32 nA2Height = getXPath(pXmlDoc, "//Cell[3]/SdrText/OutlinerParaObject/EditTextObject/ContentInfo/attribs[1]/SvxFontHeightItem", "height").toInt32(); // This failed when FuText::ChangeFontSize() never did "continue" in the @@ -1818,8 +1814,6 @@ void SdTiledRenderingTest::testTdf105502() CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), aFirstCell.mnRow); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), aLastCell.mnCol); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), aLastCell.mnRow); - - xmlFreeDoc(pXmlDoc); } void SdTiledRenderingTest::testCommentCallbacks() diff --git a/sfx2/qa/cppunit/test_misc.cxx b/sfx2/qa/cppunit/test_misc.cxx index f616b3e8cea2..4ed4ba1fb11a 100644 --- a/sfx2/qa/cppunit/test_misc.cxx +++ b/sfx2/qa/cppunit/test_misc.cxx @@ -88,7 +88,7 @@ CPPUNIT_TEST_FIXTURE(MiscTest, testODFCustomMetadata) packages::zip::ZipFileAccess::createWithURL(m_xContext, aTempFile.GetURL())); uno::Reference<io::XInputStream> const xInputStream(xZip->getByName("meta.xml"), uno::UNO_QUERY); std::unique_ptr<SvStream> const pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); - xmlDocPtr pXmlDoc = parseXmlStream(pStream.get()); + xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); assertXPathContent(pXmlDoc, "/office:document-meta/office:meta/bork", "bork"); assertXPath(pXmlDoc, "/office:document-meta/office:meta/foo:bar", 1); assertXPath(pXmlDoc, "/office:document-meta/office:meta/foo:bar/baz:foo", 1); diff --git a/starmath/qa/extras/mmlexport-test.cxx b/starmath/qa/extras/mmlexport-test.cxx index 737885d5f73e..18732e09abb1 100644 --- a/starmath/qa/extras/mmlexport-test.cxx +++ b/starmath/qa/extras/mmlexport-test.cxx @@ -49,7 +49,7 @@ protected: virtual void registerNamespaces(xmlXPathContextPtr &pXmlXPathCtx) override; private: - xmlDocPtr exportAndParse(); + xmlDocUniquePtr exportAndParse(); SmDocShellRef mxDocShell; }; @@ -75,7 +75,7 @@ void MathMLExportTest::registerNamespaces(xmlXPathContextPtr &pXmlXPathCtx) xmlXPathRegisterNs(pXmlXPathCtx, BAD_CAST("m"), BAD_CAST("http://www.w3.org/1998/Math/MathML")); } -xmlDocPtr MathMLExportTest::exportAndParse() +xmlDocUniquePtr MathMLExportTest::exportAndParse() { utl::TempFile aTempFile; aTempFile.EnableKillingFile(); @@ -84,7 +84,7 @@ xmlDocPtr MathMLExportTest::exportAndParse() aStoreMedium.SetFilter(pExportFilter); CPPUNIT_ASSERT(mxDocShell->ConvertTo(aStoreMedium)); aStoreMedium.Commit(); - xmlDocPtr pDoc = parseXml(aTempFile); + xmlDocUniquePtr pDoc = parseXml(aTempFile); CPPUNIT_ASSERT(pDoc); return pDoc; } @@ -92,7 +92,7 @@ xmlDocPtr MathMLExportTest::exportAndParse() void MathMLExportTest::testBlank() { mxDocShell->SetText("x`y~~z"); - xmlDocPtr pDoc = exportAndParse(); + xmlDocUniquePtr pDoc = exportAndParse(); assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mspace[1]", "width", "0.5em"); assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mspace[2]", "width", "4em"); } @@ -100,7 +100,7 @@ void MathMLExportTest::testBlank() void MathMLExportTest::testTdf97049() { mxDocShell->SetText("intd {{1 over x} dx}"); - xmlDocPtr pDoc = exportAndParse(); + xmlDocUniquePtr pDoc = exportAndParse(); assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mo[1]", "stretchy", "true"); auto aContent = getXPathContent(pDoc, "/m:math/m:semantics/m:mrow/m:mo[1]"); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aContent.getLength()); @@ -113,7 +113,7 @@ void MathMLExportTest::testTdf101022() { \ mxDocShell->SetText("%GAMMA %iGAMMA {ital %GAMMA} {nitalic %iGAMMA} " \ "%gamma %igamma {ital %gamma} {nitalic %igamma}"); \ - xmlDocPtr pDoc = exportAndParse(); \ + xmlDocUniquePtr pDoc = exportAndParse(); \ if (capital) \ assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mi[1]", "mathvariant"); \ else \ diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 9f09f9bda6e9..8120241e227a 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -128,7 +128,7 @@ Primitive2DSequence Test::parseSvg(const OUString& aSource) void Test::checkRectPrimitive(Primitive2DSequence const & rPrimitive) { drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(rPrimitive)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(rPrimitive)); CPPUNIT_ASSERT (pDocument); @@ -184,7 +184,7 @@ void Test::testTdf87309() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf87309.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf87309)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf87309)); CPPUNIT_ASSERT (pDocument); @@ -203,7 +203,7 @@ void Test::testFontsizeKeywords() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceFontsizeKeywords.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceFontsizeKeywords)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceFontsizeKeywords)); CPPUNIT_ASSERT (pDocument); @@ -266,7 +266,7 @@ void Test::testFontsizePercentage() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceFontsizePercentage.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceFontsizePercentage)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceFontsizePercentage)); CPPUNIT_ASSERT (pDocument); @@ -283,7 +283,7 @@ void Test::testFontsizeRelative() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceFontsizeRelative.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceFontsizeRelative)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceFontsizeRelative)); CPPUNIT_ASSERT (pDocument); @@ -305,7 +305,7 @@ void Test::testTdf45771() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf45771.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf45771)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf45771)); CPPUNIT_ASSERT (pDocument); @@ -322,7 +322,7 @@ void Test::testTdf97941() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97941.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97941)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97941)); CPPUNIT_ASSERT (pDocument); @@ -338,7 +338,7 @@ void Test::testTdf104339() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf104339.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf104339)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf104339)); CPPUNIT_ASSERT (pDocument); assertXPath(pDocument, "/primitive2D/transform/transform/transform/transform/transform/polypolygoncolor", "color", "#000000"); @@ -350,7 +350,7 @@ void Test::testTdf85770() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf85770.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf85770)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf85770)); CPPUNIT_ASSERT (pDocument); @@ -376,7 +376,7 @@ void Test::testTdf79163() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf79163.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf79163)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf79163)); CPPUNIT_ASSERT (pDocument); @@ -389,7 +389,7 @@ void Test::testTdf97542_1() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97542_1.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97542_1)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97542_1)); CPPUNIT_ASSERT (pDocument); @@ -405,7 +405,7 @@ void Test::testTdf97542_2() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97542_2.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97542_2)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97542_2)); CPPUNIT_ASSERT (pDocument); @@ -421,7 +421,7 @@ void Test::testTdf97543() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97543.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97543)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97543)); CPPUNIT_ASSERT (pDocument); @@ -440,7 +440,7 @@ void Test::testRGBColor() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRGBColor.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceRGBColor)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceRGBColor)); CPPUNIT_ASSERT (pDocument); @@ -459,7 +459,7 @@ void Test::testRGBAColor() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRGBAColor.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceRGBAColor)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceRGBAColor)); CPPUNIT_ASSERT (pDocument); @@ -472,7 +472,7 @@ void Test::testNoneColor() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRGBAColor.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceRGBAColor)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceRGBAColor)); CPPUNIT_ASSERT (pDocument); @@ -489,7 +489,7 @@ void Test::testTdf97936() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97936.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97936)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97936)); CPPUNIT_ASSERT (pDocument); @@ -517,7 +517,7 @@ void Test::testClipPathAndParentStyle() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndParentStyle.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceClipPathAndParentStyle)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceClipPathAndParentStyle)); CPPUNIT_ASSERT (pDocument); @@ -535,7 +535,7 @@ void Test::testClipPathAndStyle() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndStyle.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceClipPathAndStyle)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceClipPathAndStyle)); CPPUNIT_ASSERT (pDocument); @@ -552,7 +552,7 @@ void Test::testi125329() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequencei125329.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequencei125329)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequencei125329)); CPPUNIT_ASSERT (pDocument); @@ -575,7 +575,7 @@ void Test::testMaskingPath07b() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceMaskingPath07b.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceMaskingPath07b)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceMaskingPath07b)); CPPUNIT_ASSERT (pDocument); @@ -587,7 +587,7 @@ void Test::test123926() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence123926.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence123926)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence123926)); CPPUNIT_ASSERT (pDocument); @@ -601,7 +601,7 @@ void Test::test47446() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence47446.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence47446)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence47446)); CPPUNIT_ASSERT (pDocument); @@ -616,7 +616,7 @@ void Test::test47446b() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence47446b.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence47446b)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence47446b)); CPPUNIT_ASSERT (pDocument); @@ -631,7 +631,7 @@ void Test::testMaskText() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceMaskText.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceMaskText)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceMaskText)); CPPUNIT_ASSERT (pDocument); @@ -649,7 +649,7 @@ void Test::testTdf99994() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf99994.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf99994)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf99994)); CPPUNIT_ASSERT (pDocument); @@ -666,7 +666,7 @@ void Test::testTdf99115() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf99115.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf99115) ); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf99115) ); CPPUNIT_ASSERT (pDocument); @@ -715,7 +715,7 @@ void Test::testTdf101237() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf101237.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf101237)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf101237)); CPPUNIT_ASSERT (pDocument); @@ -730,7 +730,7 @@ void Test::testTdf94765() CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf94765.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf94765)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf94765)); CPPUNIT_ASSERT (pDocument); diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx index b7fa853005c4..5a0f46bba995 100644 --- a/svx/qa/unit/svdraw.cxx +++ b/svx/qa/unit/svdraw.cxx @@ -94,7 +94,7 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testSemiTransparentText) // Make sure the text is semi-transparent. drawinglayer::tools::Primitive2dXmlDump aDumper; - xmlDocPtr pDocument = aDumper.dumpAndParse(xPrimitiveSequence); + xmlDocUniquePtr pDocument = aDumper.dumpAndParse(xPrimitiveSequence); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 diff --git a/sw/qa/core/frmedt/frmedt.cxx b/sw/qa/core/frmedt/frmedt.cxx index 3c6ff01af925..87d482eaa09e 100644 --- a/sw/qa/core/frmedt/frmedt.cxx +++ b/sw/qa/core/frmedt/frmedt.cxx @@ -79,7 +79,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testVertPosFromBottomBoundingBox) xDrawPageSupplier->getDrawPage()->add(xShape); // Get the absolute position of the top of the page bottom margin area. - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); SwTwips nPagePrintAreaBottom = getXPath(pXmlDoc, "//page/infos/prtBounds", "bottom").toInt32(); // Calculate the allowed bounding box of the shape, e.g. the shape's position & size dialog uses diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index 73e6114ff924..8a3a3b5369e6 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -48,7 +48,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBorderCollapseCompat) SwDocShell* pShell = pTextDoc->GetDocShell(); std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump aDumper; - xmlDocPtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile); // Make sure the solid border has priority. // Without the accompanying fix in place, this test would have failed with: @@ -68,7 +68,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrTableRowSpan) SwDocShell* pShell = pTextDoc->GetDocShell(); std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump aDumper; - xmlDocPtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile); // Without the accompanying fix in place, this test would have failed with: // - Expected: USA @@ -109,7 +109,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTablesMoveBackwards) // Calc the layout and check the number of pages. pWrtShell->CalcLayout(); - xmlDocPtr pLayout = parseLayoutDump(); + xmlDocUniquePtr pLayout = parseLayoutDump(); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 // - Actual : 2 diff --git a/sw/qa/core/objectpositioning/objectpositioning.cxx b/sw/qa/core/objectpositioning/objectpositioning.cxx index e240f7f84926..a000f1c80634 100644 --- a/sw/qa/core/objectpositioning/objectpositioning.cxx +++ b/sw/qa/core/objectpositioning/objectpositioning.cxx @@ -70,7 +70,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreObjectpositioningTest, testVertPosFromBottom) xDrawPageSupplier->getDrawPage()->add(xShape); // Verify that the distance between the body and anchored object bottom is indeed around 1cm. - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nBodyBottom = getXPath(pXmlDoc, "//body/infos/bounds", "bottom").toInt32(); sal_Int32 nAnchoredBottom = getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "bottom").toInt32(); diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx index 4e6d4fcdb14e..3f7cfb5272dd 100644 --- a/sw/qa/core/text/text.cxx +++ b/sw/qa/core/text/text.cxx @@ -73,7 +73,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testSemiTransparentText) // Make sure that DrawTransparent() was used during rendering. MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "//floattransparent"); } diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx index b6af5230faf8..c51bdefcfb42 100644 --- a/sw/qa/core/txtnode/txtnode.cxx +++ b/sw/qa/core/txtnode/txtnode.cxx @@ -40,7 +40,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testBtlrCellChinese) SwDocShell* pShell = pTextDoc->GetDocShell(); std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); assertXPath(pXmlDoc, "//font[1]", "orientation", "900"); // Without the accompanying fix in place, this test would have failed with: // - Expected: false diff --git a/sw/qa/extras/docbookexport/docbookexport.cxx b/sw/qa/extras/docbookexport/docbookexport.cxx index 98edee213018..74241d353d33 100644 --- a/sw/qa/extras/docbookexport/docbookexport.cxx +++ b/sw/qa/extras/docbookexport/docbookexport.cxx @@ -21,7 +21,7 @@ public: DECLARE_DOCBOOKEXPORT_TEST(testsimple, "simple.docx") { - xmlDocPtr pDoc = parseXml(maTempFile); + xmlDocUniquePtr pDoc = parseXml(maTempFile); CPPUNIT_ASSERT(pDoc); assertXPathContent(pDoc, "/article/para", "aaaa"); @@ -30,7 +30,7 @@ DECLARE_DOCBOOKEXPORT_TEST(testsimple, "simple.docx") /* the test actually should crash with this file */ DECLARE_DOCBOOKEXPORT_TEST(testtdf91095, "tdf91095.docx") { - xmlDocPtr pDoc = parseXml(maTempFile); + xmlDocUniquePtr pDoc = parseXml(maTempFile); CPPUNIT_ASSERT(pDoc); } diff --git a/sw/qa/extras/fodfexport/fodfexport.cxx b/sw/qa/extras/fodfexport/fodfexport.cxx index c79d0f35b420..f46003ab6e10 100644 --- a/sw/qa/extras/fodfexport/fodfexport.cxx +++ b/sw/qa/extras/fodfexport/fodfexport.cxx @@ -31,7 +31,7 @@ DECLARE_FODFEXPORT_TEST(testTdf113696, "tdf113696.odt") { // Test that an image which is written in svm format (image/x-vclgraphic) // is accompanied by a png fallback graphic. - if (xmlDocPtr pXmlDoc = parseExportedFile()) + if (xmlDocUniquePtr pXmlDoc = parseExportedFile()) { assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/" "draw:image[@loext:mime-type='image/x-vclgraphic']"); @@ -44,7 +44,7 @@ DECLARE_FODFEXPORT_TEST(testTdf113696WriterImage, "tdf113696-writerimage.odt") { // Same as testTdf113696, but with a writer image instead of a draw image // (they use different code paths). - if (xmlDocPtr pXmlDoc = parseExportedFile()) + if (xmlDocUniquePtr pXmlDoc = parseExportedFile()) { assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/" "draw:image[@loext:mime-type='image/x-vclgraphic']"); diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index d05da8ad4943..29d1ced8db80 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -181,7 +181,7 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testCharacterBorder, "charborder.odt") DECLARE_HTMLEXPORT_TEST(testExportOfImages, "textAndImage.docx") { - htmlDocPtr pDoc = parseHtml(maTempFile); + htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/html/body", 1); @@ -190,7 +190,7 @@ DECLARE_HTMLEXPORT_TEST(testExportOfImages, "textAndImage.docx") DECLARE_HTMLEXPORT_TEST(testExportOfImagesWithSkipImagesEnabled, "textAndImage.docx") { - htmlDocPtr pDoc = parseHtml(maTempFile); + htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/html/body", 1); @@ -201,7 +201,7 @@ DECLARE_HTMLEXPORT_TEST(testSkipImagesEmbedded, "skipimage-embedded.doc") { // Embedded spreadsheet was exported as image, so content was lost. Make // sure it's exported as HTML instead. - htmlDocPtr pDoc = parseHtml(maTempFile); + htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pDoc); // This was 0. @@ -216,7 +216,7 @@ DECLARE_HTMLEXPORT_TEST(testSkipImagesEmbeddedDocument, "skipimage-embedded-docu { // Similar to testSkipImagesEmbedded, but with an embedded Writer object, // not a Calc one, and this time OOXML, not WW8. - htmlDocPtr pDoc = parseHtml(maTempFile); + htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pDoc); // This was 2, the HTML header was in the document two times. @@ -227,7 +227,7 @@ DECLARE_HTMLEXPORT_TEST(testSkipImagesEmbeddedDocument, "skipimage-embedded-docu DECLARE_HTMLEXPORT_TEST(testExportImageProperties, "HTMLImage.odt") { - htmlDocPtr pDoc = parseHtml(maTempFile); + htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/html/body", 1); @@ -267,7 +267,7 @@ DECLARE_HTMLEXPORT_TEST(testExportImageProperties, "HTMLImage.odt") DECLARE_HTMLEXPORT_TEST(testExportCheckboxRadioButtonState, "checkbox-radiobutton.doc") { - htmlDocPtr pDoc = parseHtml(maTempFile); + htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/html/body", 1); @@ -287,7 +287,7 @@ DECLARE_HTMLEXPORT_TEST(testExportCheckboxRadioButtonState, "checkbox-radiobutto DECLARE_HTMLEXPORT_TEST(testExportUrlEncoding, "tdf76291.odt") { - htmlDocPtr pDoc = parseHtml(maTempFile); + htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pDoc); // Test URI encoded hyperlink with Chinese characters @@ -296,7 +296,7 @@ DECLARE_HTMLEXPORT_TEST(testExportUrlEncoding, "tdf76291.odt") DECLARE_HTMLEXPORT_TEST(testExportInternalUrl, "tdf90905.odt") { - htmlDocPtr pDoc = parseHtml(maTempFile); + htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pDoc); // Internal url should be valid @@ -306,7 +306,7 @@ DECLARE_HTMLEXPORT_TEST(testExportInternalUrl, "tdf90905.odt") DECLARE_HTMLEXPORT_TEST(testExportImageBulletList, "tdf66822.odt") { - htmlDocPtr pDoc = parseHtml(maTempFile); + htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pDoc); // Encoded base64 SVG bullet should match and render on browser @@ -316,7 +316,7 @@ DECLARE_HTMLEXPORT_TEST(testExportImageBulletList, "tdf66822.odt") DECLARE_HTMLEXPORT_TEST(testTdf83890, "tdf83890.odt") { - htmlDocPtr pDoc = parseHtml(maTempFile); + htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/html/body/ol[2]/ol", "start", "2"); @@ -337,7 +337,7 @@ DECLARE_HTMLEXPORT_TEST(testExtbChars, "extb.html") DECLARE_HTMLEXPORT_TEST(testNormalImageExport, "textAndImage.docx") { - htmlDocPtr pDoc = parseHtml(maTempFile); + htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/html/body", 1); @@ -347,7 +347,7 @@ DECLARE_HTMLEXPORT_TEST(testNormalImageExport, "textAndImage.docx") DECLARE_HTMLEXPORT_TEST(testEmbedImagesEnabled, "textAndImage.docx") { - htmlDocPtr pDoc = parseHtml(maTempFile); + htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/html/body", 1); @@ -363,7 +363,7 @@ DECLARE_HTMLEXPORT_TEST(testXHTML, "hello.html") // This was HTML, not XHTML. CPPUNIT_ASSERT_EQUAL(aExpected, aActual); - htmlDocPtr pDoc = parseHtml(maTempFile); + htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pDoc); // This was lang, not xml:lang. assertXPath(pDoc, "/html/body", "xml:lang", "en-US"); @@ -505,7 +505,7 @@ DECLARE_HTMLEXPORT_TEST(testReqIfJpgImg, "reqif-jpg-img.xhtml") DECLARE_HTMLEXPORT_TEST(testReqIfTable, "reqif-table.xhtml") { - htmlDocPtr pDoc = parseHtml(maTempFile); + htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pDoc); // <div> was missing, so the XHTML fragment wasn't a valid @@ -582,7 +582,7 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOle2, "reqif-ole2.xhtml") // Check that the replacement graphic is exported at RTF level. SvMemoryStream aStream; wrapFragment(maTempFile, aStream); - xmlDocPtr pDoc = parseXmlStream(&aStream); + xmlDocUniquePtr pDoc = parseXmlStream(&aStream); CPPUNIT_ASSERT(pDoc); // Get the path of the RTF data. OUString aOlePath = getXPath( @@ -632,7 +632,7 @@ DECLARE_HTMLEXPORT_TEST(testList, "list.html") DECLARE_HTMLEXPORT_TEST(testTransparentImage, "transparent-image.odt") { - htmlDocPtr pDoc = parseHtml(maTempFile); + htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pDoc); OUString aSource = getXPath(pDoc, "/html/body/p/img", "src"); @@ -645,7 +645,7 @@ DECLARE_HTMLEXPORT_TEST(testTransparentImageReqIf, "transparent-image.odt") { SvMemoryStream aStream; wrapFragment(maTempFile, aStream); - xmlDocPtr pDoc = parseXmlStream(&aStream); + xmlDocUniquePtr pDoc = parseXmlStream(&aStream); CPPUNIT_ASSERT(pDoc); OUString aSource = getXPath( @@ -662,7 +662,7 @@ DECLARE_HTMLEXPORT_TEST(testOleNodataReqIf, "reqif-ole-nodata.odt") // This failed, io::IOException was thrown during the filter() call. SvMemoryStream aStream; wrapFragment(maTempFile, aStream); - xmlDocPtr pDoc = parseXmlStream(&aStream); + xmlDocUniquePtr pDoc = parseXmlStream(&aStream); CPPUNIT_ASSERT(pDoc); // Make sure the native <object> element has the required data attribute. @@ -677,7 +677,7 @@ DECLARE_HTMLEXPORT_TEST(testNoLangReqIf, "reqif-no-lang.odt") { SvMemoryStream aStream; wrapFragment(maTempFile, aStream); - xmlDocPtr pDoc = parseXmlStream(&aStream); + xmlDocUniquePtr pDoc = parseXmlStream(&aStream); CPPUNIT_ASSERT(pDoc); // Make sure that xml:lang is not written in ReqIF mode. @@ -686,7 +686,7 @@ DECLARE_HTMLEXPORT_TEST(testNoLangReqIf, "reqif-no-lang.odt") DECLARE_HTMLEXPORT_TEST(testFieldShade, "field-shade.odt") { - htmlDocPtr pDoc = parseHtml(maTempFile); + htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pDoc); // Without the accompanying fix in place, this test would have failed with 'Expected: 1; Actual: @@ -702,7 +702,7 @@ DECLARE_HTMLEXPORT_TEST(testFieldShade, "field-shade.odt") DECLARE_HTMLEXPORT_TEST(testFieldShadeReqIf, "field-shade-reqif.odt") { - htmlDocPtr pDoc = parseHtml(maTempFile); + htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pDoc); // Without the accompanying fix in place, this test would have failed with: @@ -729,7 +729,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testBlockQuoteReqIf) xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); SvMemoryStream aStream; HtmlExportTest::wrapFragment(maTempFile, aStream); - xmlDocPtr pDoc = parseXmlStream(&aStream); + xmlDocUniquePtr pDoc = parseXmlStream(&aStream); CPPUNIT_ASSERT(pDoc); // Without the accompanying fix in place, this test would have failed with: @@ -760,7 +760,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testRTFOLEMimeType) xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties); SvMemoryStream aStream; HtmlExportTest::wrapFragment(maTempFile, aStream); - xmlDocPtr pDoc = parseXmlStream(&aStream); + xmlDocUniquePtr pDoc = parseXmlStream(&aStream); CPPUNIT_ASSERT(pDoc); // Without the accompanying fix in place, this test would have failed with: @@ -792,7 +792,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testChinese) xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties); SvMemoryStream aStream; HtmlExportTest::wrapFragment(maTempFile, aStream); - xmlDocPtr pDoc = parseXmlStream(&aStream); + xmlDocUniquePtr pDoc = parseXmlStream(&aStream); // Without the accompanying fix in place, this test would have failed as the output was not // well-formed. @@ -820,7 +820,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifComment) xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties); SvMemoryStream aStream; HtmlExportTest::wrapFragment(maTempFile, aStream); - xmlDocPtr pDoc = parseXmlStream(&aStream); + xmlDocUniquePtr pDoc = parseXmlStream(&aStream); // Without the accompanying fix in place, this test would have failed as the output was not // well-formed. @@ -849,7 +849,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifFontNameSize) xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties); SvMemoryStream aStream; HtmlExportTest::wrapFragment(maTempFile, aStream); - xmlDocPtr pDoc = parseXmlStream(&aStream); + xmlDocUniquePtr pDoc = parseXmlStream(&aStream); // Make sure the output is well-formed. CPPUNIT_ASSERT(pDoc); @@ -877,7 +877,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifParagraphAlignment) xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties); SvMemoryStream aStream; HtmlExportTest::wrapFragment(maTempFile, aStream); - xmlDocPtr pDoc = parseXmlStream(&aStream); + xmlDocUniquePtr pDoc = parseXmlStream(&aStream); // Make sure the output is well-formed. CPPUNIT_ASSERT(pDoc); @@ -976,7 +976,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PDF) // Get the .ole path. SvMemoryStream aStream; HtmlExportTest::wrapFragment(maTempFile, aStream); - xmlDocPtr pDoc = parseXmlStream(&aStream); + xmlDocUniquePtr pDoc = parseXmlStream(&aStream); CPPUNIT_ASSERT(pDoc); OUString aOlePath = getXPath( pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p/reqif-xhtml:object", "data"); diff --git a/sw/qa/extras/htmlexport/xhtmlexport.cxx b/sw/qa/extras/htmlexport/xhtmlexport.cxx index 1fdb1fd2cfee..85adfa2b7b49 100644 --- a/sw/qa/extras/htmlexport/xhtmlexport.cxx +++ b/sw/qa/extras/htmlexport/xhtmlexport.cxx @@ -33,7 +33,7 @@ private: DECLARE_HTMLEXPORT_TEST(testImageEmbedding, "image-mimetype.odt") { - htmlDocPtr pDoc = parseHtml(maTempFile); + htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/html/body", 1); diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index b05edef7ee4d..ea6ac4089a0b 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -65,7 +65,7 @@ SwDoc* SwLayoutWriter::createDoc(const char* pName) void SwLayoutWriter::CheckRedlineFootnotesHidden() { discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "24"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Special[1]", "nType", "PortionType::Footnote"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Special[1]", "rText", "1"); @@ -104,7 +104,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFootnotes) dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // show: nothing is merged xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); @@ -243,7 +243,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody) dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(pLayout->IsHideRedlines()); discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "14"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", "PortionType::Para"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", "foaz"); @@ -319,7 +319,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody) dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(pLayout->IsHideRedlines()); discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "14"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", "PortionType::Para"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", "foaz"); @@ -395,7 +395,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody) dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(pLayout->IsHideRedlines()); discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "14"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", "PortionType::Para"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", "foaz"); @@ -513,7 +513,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader) dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(pLayout->IsHideRedlines()); discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", "PortionType::Para"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nLength", "0"); assertXPath(pXmlDoc, "/root/page[1]/header/txt[1]/merged", "paraPropsNodeIndex", "6"); @@ -593,7 +593,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader) dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(pLayout->IsHideRedlines()); discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // now the frame has no Text portion? not sure why it's a 0-length one first and now none? // assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", "PortionType::Para"); // assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nLength", "0"); @@ -674,7 +674,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInHeader) dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(pLayout->IsHideRedlines()); discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", "PortionType::Para"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nLength", "0"); assertXPath(pXmlDoc, "/root/page[1]/header/txt[1]/merged", "paraPropsNodeIndex", "6"); @@ -816,7 +816,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote) dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(pLayout->IsHideRedlines()); discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "25"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Special[1]", "nType", "PortionType::Footnote"); @@ -921,7 +921,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote) dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(pLayout->IsHideRedlines()); discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "25"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Special[1]", "nType", @@ -1029,7 +1029,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote) dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(pLayout->IsHideRedlines()); discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "25"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Special[1]", "nType", "PortionType::Footnote"); @@ -1195,7 +1195,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys) dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(pLayout->IsHideRedlines()); discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "19"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged", "paraPropsNodeIndex", "6"); @@ -1337,7 +1337,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys) dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(pLayout->IsHideRedlines()); discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "19"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", "PortionType::Para"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", "foaz"); @@ -1464,7 +1464,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys) dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(pLayout->IsHideRedlines()); discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "19"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged", "paraPropsNodeIndex", "6"); @@ -1644,7 +1644,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysAtFlys) dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); CPPUNIT_ASSERT(pLayout->IsHideRedlines()); discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "19"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/anchored/fly[1]/txt[1]/merged", "paraPropsNodeIndex", "6"); @@ -1842,7 +1842,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysAtFlys) void SwLayoutWriter::CheckRedlineSectionsHidden() { discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "12"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", "PortionType::Para"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", "folah"); @@ -1869,7 +1869,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineSections) // why is this needed explicitly? pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // show: nothing is merged xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); @@ -1931,7 +1931,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineTables) // verify after load discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "12"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", "PortionType::Para"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", "foar"); @@ -1988,7 +1988,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineTables) void SwLayoutWriter::CheckRedlineCharAttributesHidden() { discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/merged", "paraPropsNodeIndex", "9"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "nType", "PortionType::Para"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/Text[1]", "Portion", "foobaz"); @@ -2057,7 +2057,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineCharAttributes) // why is this needed explicitly? pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // show: nothing is merged xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//merged"); @@ -2158,7 +2158,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineShowHideFootnotePagination) SwRootFrame* pLayout(pDoc->getIDocumentLayoutAccess().GetCurrentLayout()); CPPUNIT_ASSERT(!pLayout->IsHideRedlines()); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // check footnotes assertXPath(pXmlDoc, "/root/page[1]/ftncont/ftn", 6); @@ -2203,7 +2203,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineNumberInNumbering) std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // Assert the tracked deletion of the number of joined list item and @@ -2220,7 +2220,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf125300) std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // Keep line spacing before bottom cell border (it was 1892) @@ -2242,7 +2242,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116830) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // Assert that the yellow rectangle (cell background) is painted after the @@ -2269,7 +2269,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf114163) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); assertXPathContent( @@ -2282,7 +2282,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf114163) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf131707) { createDoc("tdf131707_flyWrap.doc"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "//body/tab/row[3]/cell[2]/txt/infos/bounds", "top", "2185"); // the image should be inside of the cell boundary - so the same top or higher @@ -2297,7 +2297,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf125335) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); assertXPathContent( @@ -2315,7 +2315,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf75659) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); assertXPathContent( @@ -2337,7 +2337,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf123268) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // Without the accompanying fix in place, this test would have failed with: // - Expected: 41 @@ -2355,7 +2355,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf115630) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // Test wide of inner chart area. @@ -2380,7 +2380,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf108021) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); assertXPath( @@ -2398,7 +2398,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf125334) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); assertXPath( @@ -2416,7 +2416,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122800) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); assertXPath( @@ -2434,7 +2434,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTruncatedAxisLabel) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // test the X axis label visibility @@ -2458,7 +2458,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128996) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); assertXPathContent(pXmlDoc, @@ -2474,7 +2474,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf126244) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // Test the first level of vertical category axis labels orientation. The first level orientation should be horizontal. assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/font[1]", "orientation", @@ -2500,7 +2500,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf127304) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // Test the first level of horizontal category axis labels orientation. The first level orientation should be vertical. sal_Int32 nRotation @@ -2524,7 +2524,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testHorizontal_multilevel) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // Test the Y position of horizontal category axis label. sal_Int32 nYposition @@ -2541,7 +2541,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124796) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // This failed, if the minimum value of Y axis is not -10. @@ -2565,7 +2565,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf130969) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // This failed, if the minimum value of Y axis is not 0.35781 @@ -2581,7 +2581,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf129054) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // Test the size of diameter of Pie chart. @@ -2607,7 +2607,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf129173) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // Check the first data label of area chart. @@ -2623,7 +2623,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf130031) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); sal_Int32 nY = getXPath(pXmlDoc, "//textarray[11]", "y").toInt32(); // Without the accompanying fix in place, this test would have failed with: @@ -2642,7 +2642,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf130242) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); sal_Int32 nY = getXPath(pXmlDoc, "//textarray[11]", "y").toInt32(); // Without the accompanying fix in place, this test would have failed with: @@ -2669,7 +2669,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf130380) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); sal_Int32 nY = getXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/push[1]/polypolygon/" @@ -2692,7 +2692,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf129095) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // check the inner chart area visibility with testing the X axis label @@ -2708,7 +2708,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116925) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); assertXPathContent(pXmlDoc, @@ -2728,7 +2728,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117028) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // The only polypolygon in the rendering result was the white background we @@ -2750,7 +2750,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf106390) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); sal_Int32 nBottom = getXPath(pXmlDoc, "//sectrectclipregion", "bottom").toInt32(); @@ -2768,7 +2768,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableExtrusion1) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); sal_Int32 nRight = getXPath(pXmlDoc, "//sectrectclipregion", "right").toInt32(); sal_Int32 nLeft = static_cast<sal_Int32>(nRight * 0.95); @@ -2788,7 +2788,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableExtrusion2) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // End point position of the outer table. sal_Int32 nX = getXPath(pXmlDoc, "(//polyline[1]/point)[2]", "x").toInt32(); @@ -2809,7 +2809,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116848) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117245) { createDoc("tdf117245.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was 2, TabOverMargin did not use a single line when there was // enough space for the text. assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak", 1); @@ -2821,7 +2821,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117245) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118672) { createDoc("tdf118672.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Check if we have hyphenation support, otherwise can't test SwHyphPortion. uno::Reference<linguistic2::XHyphenator> xHyphenator = LinguMgr::GetHyphenator(); @@ -2848,7 +2848,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117923) CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Check that we actually test the line we need assertXPathContent(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]", "GHI GHI GHI GHI"); @@ -2870,7 +2870,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf127606) CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Check that we actually test the line we need assertXPathContent(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]", "GHI GHI GHI GHI"); @@ -2893,7 +2893,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf127606) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf109077) { createDoc("tdf109077.docx"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nShapeTop = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject/bounds", "top").toInt32(); sal_Int32 nTextBoxTop = getXPath(pXmlDoc, "//anchored/fly/infos/bounds", "top").toInt32(); @@ -2917,7 +2917,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testUserFieldTypeLanguage) SwDoc* pDoc = createDoc("user-field-type-language.fodt"); SwViewShell* pViewShell = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); pViewShell->UpdateFields(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was "123,456.00", via a buggy 1234.56 -> 1234,56 -> 123456 -> // 123,456.00 transform chain. assertXPath(pXmlDoc, "/root/page/body/txt/Special[@nType='PortionType::Field']", "rText", @@ -2935,7 +2935,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf109137) })); xStorable->storeToURL(aTempFile.GetURL(), aDescriptor); loadURL(aTempFile.GetURL(), "tdf109137.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was 0, the blue rectangle moved from the 1st to the 2nd page. assertXPath(pXmlDoc, "/root/page[1]/body/txt/anchored/fly/notxt", /*nNumberOfNodes=*/1); @@ -2966,7 +2966,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118058) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128611) { createDoc("tdf128611.fodt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 @@ -2987,7 +2987,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117188) })); xStorable->storeToURL(aTempFile.GetURL(), aDescriptor); loadURL(aTempFile.GetURL(), "tdf117188.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); OUString sWidth = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/bounds", "width"); OUString sHeight = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/bounds", "height"); // The text box must have zero border distances @@ -3000,7 +3000,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117188) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117187) { createDoc("tdf117187.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // there should be no fly portions assertXPath(pXmlDoc, "/root/page/body/txt/Special[@nType='PortionType::Fly']", 0); @@ -3009,7 +3009,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117187) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf119875) { createDoc("tdf119875.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nFirstTop = getXPath(pXmlDoc, "/root/page[2]/body/section[1]/infos/bounds", "top").toInt32(); sal_Int32 nSecondTop @@ -3022,7 +3022,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf119875) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf120287) { createDoc("tdf120287.fodt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was 2, TabOverMargin Word-specific compat flag did not imply // default-in-Word printer-independent layout, resulting in an additional // line break. @@ -3032,7 +3032,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf120287) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf120287b) { createDoc("tdf120287b.fodt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was 1418, TabOverMargin did the right split of the paragraph to two // lines, but then calculated a too large tab portion size on the first // line. @@ -3043,7 +3043,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf120287b) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf120287c) { createDoc("tdf120287c.fodt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was 2, the second line was not broken into a 2nd and a 3rd one, // rendering text outside the paragraph frame. assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak", 3); @@ -3052,7 +3052,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf120287c) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122878) { createDoc("tdf122878.docx"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // FIXME: the XPath should be adjusted when the proper floating table would be imported const sal_Int32 nTblTop = getXPath(pXmlDoc, "/root/page[1]/footer/txt/anchored/fly/tab/infos/bounds", "top") @@ -3074,7 +3074,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122878) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf115094) { createDoc("tdf115094.docx"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nTopOfD1 = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/tab/row[1]/cell[4]/infos/bounds", @@ -3101,7 +3101,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf115094) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122607) { createDoc("tdf122607.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page[1]/anchored/fly/txt[1]/anchored/fly/tab/row[2]/cell/txt[7]/anchored/" "fly/txt/Text[1]", @@ -3148,7 +3148,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122607_regression) uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); xStorable->storeToURL(aTempFile.GetURL(), props); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // somehow these 2 rows overlapped in the PDF unless CalcLayout() runs assertXPath(pXmlDoc, "/root/page[1]/anchored/fly/tab[1]/row[1]/infos/bounds", "mbFixSize", "false"); @@ -3171,7 +3171,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testBtlrCell) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // Without the accompanying fix in place, this test would have failed, as @@ -3332,7 +3332,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf123898) // Make sure spellchecker has done its job already Scheduler::ProcessEventsToIdle(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Make sure that the arrow on the left is not there (there are 43 children if it's there) assertXPathChildren(pXmlDoc, "/root/page/body/txt/anchored/fly/txt", 42); } @@ -3340,7 +3340,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf123898) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf123651) { createDoc("tdf123651.docx"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Without the accompanying fix in place, this test would have failed with 'Expected: 7639; // Actual: 12926'. The shape was below the second "Lorem ipsum" text, not above it. assertXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "top", "7639"); @@ -3377,7 +3377,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118719) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTabOverMargin) { createDoc("tab-over-margin.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // 2nd paragraph has a tab over the right margin, and with the TabOverMargin compat option, // there is enough space to have all content in a single line. @@ -3423,7 +3423,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testImageComment) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf64222) { createDoc("tdf64222.docx"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page/body/txt[2]/Special", "nHeight", "560"); } @@ -3435,7 +3435,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf113014) // Dump the rendering of the first page as an XML file. std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); CPPUNIT_ASSERT(pXmlDoc); // This failed, if numbering of cell A1 is missing @@ -3562,7 +3562,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testShapeAllowOverlapWrap) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124600) { createDoc("tdf124600.docx"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 @@ -3578,7 +3578,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124601) // The document has 2 pages, the endnote anchor is on the first page. // The endnote should be on the 2nd page together with the last page content. createDoc("tdf124601.doc"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Without the accompanying fix in place, this test would have failed with: // - Expected: 2 @@ -3597,7 +3597,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124601b) // Also the horizontal position should be in the last column, even if the anchor is in the // last-but-one column. createDoc("tdf124601b.doc"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nFlyTop = getXPath(pXmlDoc, "//fly/infos/bounds", "top").toInt32(); sal_Int32 nFlyLeft = getXPath(pXmlDoc, "//fly/infos/bounds", "left").toInt32(); @@ -3659,7 +3659,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124770) // Insert the text. pWrtShell->Insert2("HHH"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 // - Actual : 2 @@ -3684,7 +3684,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testContinuousEndnotesInsertPageAtStart) pWrtShell->InsertPageBreak(); // Make sure that the endnote is moved from the 2nd page to the 3rd one. - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page", 3); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 @@ -3710,7 +3710,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testContinuousEndnotesDeletePageAtStart) pWrtShell->DelRight(); // Make sure that the endnote is moved from the 2nd page to the 1st one. - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Without the accompanying fix in place, this test would have failed with: // - Expected: 1 // - Actual : 2 @@ -3749,7 +3749,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128399) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf105481) { createDoc("tdf105481.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); // Without the accompanying fix in place, this test would have failed @@ -3815,7 +3815,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117982) SwDocShell* pShell = pDocument->GetDocShell(); std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); assertXPathContent(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/textarray[1]/text", "FOO AAA"); //The first cell must be "FOO AAA". If not, this means the first cell content not visible in //the source document. @@ -3827,7 +3827,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128959) SwDoc* pDocument = createDoc("tdf128959.docx"); CPPUNIT_ASSERT(pDocument); discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // first two lines of the paragraph in the split table cell on the first page // (these lines were completely lost) @@ -3849,7 +3849,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf121658) return; createDoc("tdf121658.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Only 2 hyphenated words should appear in the document (in the lowercase words). // Uppercase words should not be hyphenated. @@ -3859,7 +3859,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf121658) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testWriterImageNoCapture) { createDoc("writer-image-no-capture.docx"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); sal_Int32 nPageLeft = getXPath(pXmlDoc, "//page/infos/bounds", "left").toInt32(); sal_Int32 nImageLeft = getXPath(pXmlDoc, "//fly/infos/bounds", "left").toInt32(); diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx b/sw/qa/extras/mailmerge/mailmerge.cxx index 40d32634ad9a..223646303cb3 100644 --- a/sw/qa/extras/mailmerge/mailmerge.cxx +++ b/sw/qa/extras/mailmerge/mailmerge.cxx @@ -224,7 +224,7 @@ public: /** * Like parseExport(), but for given mail merge document. */ - xmlDocPtr parseMailMergeExport(const OUString& rStreamName) + xmlDocUniquePtr parseMailMergeExport(const OUString& rStreamName) { if (mnCurOutputType != text::MailMergeType::FILE) return nullptr; @@ -409,7 +409,7 @@ DECLARE_FILE_MAILMERGE_TEST(testMissingDefaultLineColor, "missing-default-line-c // And the default value is black (wasn't copied properly by mailmerge). CPPUNIT_ASSERT_EQUAL( COL_BLACK, lineColor ); // And check that the resulting file has the proper default. - xmlDocPtr pXmlDoc = parseMailMergeExport( "styles.xml" ); + xmlDocUniquePtr pXmlDoc = parseMailMergeExport( "styles.xml" ); CPPUNIT_ASSERT_EQUAL( OUString( "graphic" ), getXPath(pXmlDoc, "/office:document-styles/office:styles/style:default-style[1]", "family")); CPPUNIT_ASSERT_EQUAL( OUString( "#000000" ), getXPath(pXmlDoc, "/office:document-styles/office:styles/style:default-style[1]/style:graphic-properties", "stroke-color")); } diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 1b8bc8a57728..6614e1642efc 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -257,7 +257,7 @@ DECLARE_ODFEXPORT_TEST(testTdf103567, "tdf103567.odt") DECLARE_ODFEXPORT_TEST(testUserFieldDecl, "user-field-decl.odt") { - if (xmlDocPtr pXmlDoc = parseExport("styles.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("styles.xml")) // Without the accompanying fix in place, this test would have failed with 'Expected: 2; // Actual: 1', i.e. the in-table field had no declaration (in the header), while the // outside-table one had the declaration. @@ -266,7 +266,7 @@ DECLARE_ODFEXPORT_TEST(testUserFieldDecl, "user-field-decl.odt") DECLARE_ODFEXPORT_TEST(testUserFieldDeclFly, "user-field-decl-fly.odt") { - if (xmlDocPtr pXmlDoc = parseExport("styles.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("styles.xml")) // Without the accompanying fix in place, this test would have failed with 'Expected: 2; // Actual: 1', i.e. the in-textframe field had no declaration (in the header), while the // outside-textframe one had the declaration. @@ -387,7 +387,7 @@ DECLARE_ODFEXPORT_TEST(testFramebackgrounds, "framebackgrounds.odt") aGradientxTextFrame = getProperty<awt::Gradient>(xTextFrame, "FillTransparenceGradient"); CPPUNIT_ASSERT_EQUAL(css::awt::GradientStyle_LINEAR, aGradientxTextFrame.Style); - if (xmlDocPtr pXmlDoc = parseExport("content.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("content.xml")) { // check that there are 3 background-image elements assertXPath(pXmlDoc, "//style:style[@style:parent-style-name='Frame' and @style:family='graphic']/style:graphic-properties[@draw:fill='bitmap']/style:background-image[@style:repeat='stretch']", 3); @@ -535,7 +535,7 @@ DECLARE_ODFEXPORT_TEST(testTdf92379, "tdf92379.fodt") // CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xFrameStyle2, "FillColor")); // CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xFrameStyle2, "FillTransparence")); - if (xmlDocPtr pXmlDoc = parseExport("styles.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("styles.xml")) { // check that fo:background-color attribute is exported properly assertXPath(pXmlDoc, "//style:style[@style:family='graphic' and @style:name='encarts']/style:graphic-properties[@fo:background-color='#ffcc99']", 1); @@ -583,7 +583,7 @@ DECLARE_ODFEXPORT_TEST(testTdf92379, "tdf92379.fodt") // CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xStyle32, "FillTransparence")); CPPUNIT_ASSERT_EQUAL(sal_Int32(0x461900), getProperty<sal_Int32>(xStyle32, "CharColor")); - if (xmlDocPtr pXmlDoc = parseExport("styles.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("styles.xml")) { // check that fo:background-color attribute is exported properly assertXPath(pXmlDoc, "//style:style[@style:family='paragraph' and @style:display-name='Titre Avis expert']/style:paragraph-properties[@fo:background-color='#661900']", 1); @@ -948,7 +948,7 @@ DECLARE_ODFEXPORT_TEST(testProtectionKey, "protection-key.fodt") // we can't assume that the user entered the password; check that we // round-trip the password as-is - if (xmlDocPtr pXmlDoc = parseExport("content.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("content.xml")) { assertXPath(pXmlDoc, "//text:section[@text:name='Section0' and @text:protected='true' and @text:protection-key='vbnhxyBKtPHCA1wB21zG1Oha8ZA=']"); assertXPath(pXmlDoc, "//text:section[@text:name='Section1' and @text:protected='true' and @text:protection-key='nLHas0RIwepGDaH4c2hpyIUvIS8=']"); @@ -1143,7 +1143,7 @@ DECLARE_ODFEXPORT_TEST(testTextboxRoundedCorners, "textbox-rounded-corners.odt") CPPUNIT_ASSERT_EQUAL(OUString("a"), xCell->getString()); // Table inside a textbox should be in the extension namespace. - if (xmlDocPtr pXmlDoc = parseExport("content.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("content.xml")) // This failed, as draw:custom-shape had a table:table child. assertXPath(pXmlDoc, "//draw:custom-shape/loext:table", "name", "Table1"); } @@ -1561,7 +1561,7 @@ DECLARE_ODFEXPORT_TEST(testTdf118393, "tdf118393.odt") // First page has no header/footer { - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // check first page xmlXPathObjectPtr pXmlPage1Header = getXPathNode(pXmlDoc, "/root/page[1]/header"); @@ -1932,7 +1932,7 @@ DECLARE_ODFEXPORT_TEST(testTableStyles2, "table_styles_2.odt") DECLARE_ODFEXPORT_TEST(testTableStyles3, "table_styles_3.odt") { // This test checks if default valued attributes aren't exported. - xmlDocPtr pXmlDoc = parseExport("styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); if (!pXmlDoc) return; @@ -2006,7 +2006,7 @@ DECLARE_ODFIMPORT_TEST(testTableStyles4, "table_styles_4.odt") DECLARE_ODFEXPORT_TEST(testTableStyles5, "table_styles_5.odt") { // Test if cell styles doesn't have a style:parent-style-name attribute. - xmlDocPtr pXmlDoc = parseExport("styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); if (!pXmlDoc) return; @@ -2055,7 +2055,7 @@ DECLARE_ODFEXPORT_TEST(testTdf129568ui, "tdf129568-ui.fodt") DECLARE_ODFEXPORT_TEST(testImageMimetype, "image-mimetype.odt") { // Test that the loext:mimetype attribute is written for exported images, tdf#109202 - if (xmlDocPtr pXmlDoc = parseExport("content.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("content.xml")) { // Original image (svg) assertXPath(pXmlDoc, "/office:document-content/office:body/office:text/text:p/draw:frame/draw:image[@loext:mime-type='image/svg+xml']"); @@ -2067,7 +2067,7 @@ DECLARE_ODFEXPORT_TEST(testEmbeddedFontProps, "embedded-font-props.odt") #if !defined(MACOSX) // Test that font style/weight of embedded fonts is exposed. // Test file is a normal ODT, except EmbedFonts is set to true in settings.xml. - if (xmlDocPtr pXmlDoc = parseExport("content.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("content.xml")) { // These failed, the attributes were missing. assertXPath(pXmlDoc, "//style:font-face[@style:name='Liberation Serif']/svg:font-face-src/svg:font-face-uri[1]", "font-style", "normal"); @@ -2105,7 +2105,7 @@ DECLARE_ODFEXPORT_TEST(testTdf100492, "tdf100492.odt") // Reason of such behavior unclear. So XPATH assert fails. // Parse resulting SVG as XML file. - // xmlDocPtr pXmlDoc = parseXmlStream(&aStream); + // xmlDocUniquePtr pXmlDoc = parseXmlStream(&aStream); // Check amount of paths required to draw an arrow. // Since there are still some empty paths in output test can fail later. There are just two @@ -2156,7 +2156,7 @@ DECLARE_ODFEXPORT_TEST(testReferenceLanguage, "referencelanguage.odt") DECLARE_ODFEXPORT_TEST(testRubyPosition, "ruby-position.odt") { - if (xmlDocPtr pXmlDoc = parseExport("content.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("content.xml")) { assertXPath(pXmlDoc, "//style:style[@style:family='ruby']/style:ruby-properties[@loext:ruby-position='inter-character']", 1); assertXPath(pXmlDoc, "//style:style[@style:family='ruby']/style:ruby-properties[@style:ruby-position='below']", 1); @@ -2335,13 +2335,13 @@ DECLARE_ODFEXPORT_TEST(tdf118502, "tdf118502.odt") DECLARE_ODFEXPORT_TEST(tdf99631, "tdf99631.docx") { // check import of VisualArea settings of the embedded XLSX OLE objects - xmlDocPtr pXmlDoc = parseExport("Object 1/settings.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("Object 1/settings.xml"); if (!pXmlDoc) return; assertXPathContent(pXmlDoc, "//config:config-item[@config:name='VisibleAreaWidth']", "4515"); assertXPathContent(pXmlDoc, "//config:config-item[@config:name='VisibleAreaHeight']", "903"); - xmlDocPtr pXmlDoc2 = parseExport("Object 2/settings.xml"); + xmlDocUniquePtr pXmlDoc2 = parseExport("Object 2/settings.xml"); if (!pXmlDoc2) return; assertXPathContent(pXmlDoc2, "//config:config-item[@config:name='VisibleAreaWidth']", "4515"); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 65036bbbc3bc..ac1c714348d9 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -58,13 +58,13 @@ protected: DECLARE_OOXMLEXPORT_TEST(testfdo81381, "fdo81381.docx") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:object[1]/o:OLEObject[1]", "DrawAspect", "Icon"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSdtAlias, "sdt-alias.docx") { - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); // <w:alias> was completely missing. assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:alias", "val", "Subtitle"); @@ -72,7 +72,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSdtAlias, "sdt-alias.docx") DECLARE_OOXMLEXPORT_TEST(testFooterBodyDistance, "footer-body-distance.docx") { - if (xmlDocPtr pXmlDoc = parseExport()) + if (xmlDocUniquePtr pXmlDoc = parseExport()) // Page break was exported as section break, this was 0 assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:br", 1); } @@ -86,7 +86,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf118393, "tdf118393.odt") // First page has no header/footer { - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // check first page xmlXPathObjectPtr pXmlPage1Header = getXPathNode(pXmlDoc, "/root/page[1]/header"); @@ -141,7 +141,7 @@ DECLARE_OOXMLEXPORT_TEST(testfdo81031, "fdo81031.docx") DECLARE_OOXMLEXPORT_TEST(testPlausableBorder, "plausable-border.docx") { // sw::util::IsPlausableSingleWordSection() did not merge two page styles due to borders. - if (xmlDocPtr pXmlDoc = parseExport()) + if (xmlDocUniquePtr pXmlDoc = parseExport()) // Page break was exported as section break, this was 0 assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:br", 1); @@ -150,14 +150,14 @@ DECLARE_OOXMLEXPORT_TEST(testPlausableBorder, "plausable-border.docx") DECLARE_OOXMLEXPORT_TEST(testUnwantedSectionBreak, "unwanted-section-break.docx") { - if (xmlDocPtr pXmlDoc = parseExport()) + if (xmlDocUniquePtr pXmlDoc = parseExport()) // This was 2: an additional sectPr was added to the document. assertXPath(pXmlDoc, "//w:sectPr", 1); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80897 , "fdo80897.docx") { - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); 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/a:prstTxWarp", "prst", "textTriangle"); } @@ -172,7 +172,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo80997, "fdo80997.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo80902, "fdo80902.docx") { // The problem was that the docGrid type was set as default so fix it for other grid type - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:docGrid", "type", "lines"); } @@ -180,7 +180,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo80902, "fdo80902.docx") DECLARE_OOXMLEXPORT_TEST(testParaShading, "para-shading.docx") { // Make sure the themeColor attribute is not written when it would be empty. - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:shd", "themeColor"); } @@ -209,7 +209,7 @@ DECLARE_OOXMLEXPORT_TEST(testFirstHeaderFooter, "first-header-footer.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO83044, "fdo83044.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:text", 1); } @@ -224,7 +224,7 @@ DECLARE_OOXMLEXPORT_TEST(testfdo83428, "fdo83428.docx") DECLARE_OOXMLEXPORT_TEST(testShapeInFloattable, "shape-in-floattable.docx") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { // No nested drawingML w:txbxContent. assertXPath(pXmlDoc, "//mc:Choice//w:txbxContent//w:txbxContent", 0); @@ -246,7 +246,7 @@ DECLARE_OOXMLEXPORT_TEST(testEmptyAnnotationMark, "empty-annotation-mark.docx") xStorable->store(); // Then inspect the OOXML markup of the modified document model. - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // There were two commentReference nodes. assertXPath(pXmlDoc, "//w:commentReference", "id", "0"); // Empty comment range was not ignored on export, this was 1. @@ -283,7 +283,7 @@ DECLARE_OOXMLEXPORT_TEST(testTableAlignment, "table-alignment.docx") DECLARE_OOXMLEXPORT_TEST(testSdtIgnoredFooter, "sdt-ignored-footer.docx") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { // This was 1, make sure no w:sdt sneaks into the main document from the footer. assertXPath(pXmlDoc, "//w:sdt", 0); @@ -293,7 +293,7 @@ DECLARE_OOXMLEXPORT_TEST(testSdtIgnoredFooter, "sdt-ignored-footer.docx") DECLARE_OOXMLEXPORT_TEST(testSdtRunPicture, "sdt-run-picture.docx") { // SDT around run was exported as SDT around paragraph - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { // This was 1: there was an SDT around w:p. assertXPath(pXmlDoc, "//w:body/w:sdt", 0); @@ -310,7 +310,7 @@ DECLARE_OOXMLEXPORT_TEST(testChartDupe, "chart-dupe.docx") // This was 2, on second import we got a duplicated chart copy. CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xEmbeddedObjects->getCount()); - xmlDocPtr pXmlDocCT = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDocCT = parseExport("[Content_Types].xml"); if (!pXmlDocCT) return; // initial import @@ -322,13 +322,13 @@ DECLARE_OOXMLEXPORT_TEST(testChartDupe, "chart-dupe.docx") assertXPath(pXmlDocCT, "/ContentType:Types/ContentType:Override[@PartName='/word/embeddings/Microsoft_Excel_Worksheet1.xlsx']", "ContentType", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); // check the rels too - xmlDocPtr pXmlDocRels = parseExport("word/charts/_rels/chart1.xml.rels"); + xmlDocUniquePtr pXmlDocRels = parseExport("word/charts/_rels/chart1.xml.rels"); assertXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship[@Target='../embeddings/Microsoft_Excel_Worksheet1.xlsx']", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); // check the content too - xmlDocPtr pXmlDocChart1 = parseExport("word/charts/chart1.xml"); + xmlDocUniquePtr pXmlDocChart1 = parseExport("word/charts/chart1.xml"); assertXPath(pXmlDocChart1, "/c:chartSpace/c:externalData", "id", @@ -379,7 +379,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf106541_noinheritChapterNumbering, "tdf106541_noi OUString sPara3NumberingStyle = getProperty<OUString>(getParagraph(3), "NumberingStyleName"); CPPUNIT_ASSERT_EQUAL(sPara3NumberingStyle, getProperty<OUString>(getParagraph(4), "NumberingStyleName")); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "//body/txt/Special", 3); //three of the four paragraphs have numbering assertXPath(pXmlDoc, "//body/txt[1]/Special", "rText", "1"); assertXPath(pXmlDoc, "//body/txt[2]/Special", 0); //second paragraph style disables numbering @@ -409,14 +409,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104713_undefinedStyles, "tdf104713_undefinedStyl DECLARE_OOXMLEXPORT_TEST(testDrawingmlFlipv, "drawingml-flipv.docx") { // The problem was that the shape had vertical flip only, but then we added rotation as well on export. - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) assertXPathNoAttribute(pXmlDoc, "//a:xfrm", "rot"); } DECLARE_OOXMLEXPORT_TEST(testRot90Fliph, "rot90-fliph.docx") { // The problem was that a shape rotation of 90° got turned into 270° after roundtrip. - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { assertXPath(pXmlDoc, "//a:xfrm", "flipH", "1"); // This was 16200000 (270 * 60000). @@ -427,7 +427,7 @@ DECLARE_OOXMLEXPORT_TEST(testRot90Fliph, "rot90-fliph.docx") DECLARE_OOXMLEXPORT_TEST(testRot180Flipv, "rot180-flipv.docx") { // 180° rotation got lost after roundtrip. - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { assertXPath(pXmlDoc, "//a:xfrm", "flipV", "1"); // This attribute was completely missing. @@ -438,7 +438,7 @@ DECLARE_OOXMLEXPORT_TEST(testRot180Flipv, "rot180-flipv.docx") DECLARE_OOXMLEXPORT_TEST(testRot270Flipv, "rot270-flipv.docx") { // 270° rotation got turned into 90° after roundtrip. - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { assertXPath(pXmlDoc, "//a:xfrm", "flipV", "1"); // This was 5400000. @@ -448,7 +448,7 @@ DECLARE_OOXMLEXPORT_TEST(testRot270Flipv, "rot270-flipv.docx") DECLARE_OOXMLEXPORT_TEST(testMsoPosition, "bnc884615-mso-position.docx") { - if(xmlDocPtr doc = parseExport("word/footer1.xml")) + if(xmlDocUniquePtr doc = parseExport("word/footer1.xml")) { // We write the frames out in different order than they were read, so check it's the correct // textbox first by checking width. These tests may need reordering if that gets fixed. @@ -467,7 +467,7 @@ DECLARE_OOXMLEXPORT_TEST(testMsoPosition, "bnc884615-mso-position.docx") CPPUNIT_ASSERT( style3.indexOf( ";mso-position-vertical-relative:text" ) >= 0 ); } - xmlDocPtr doc = parseExport("word/header1.xml"); + xmlDocUniquePtr doc = parseExport("word/header1.xml"); if(!doc) return; @@ -565,7 +565,7 @@ DECLARE_OOXMLEXPORT_TEST(testCropPixel, "crop-pixel.docx") { // If map mode of the graphic is in pixels, then we used to handle original // size of the graphic as mm100, but it was in pixels. - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { // This is 17667 in the original document, was 504666 (so the image // become invisible), now is around 19072. @@ -577,7 +577,7 @@ DECLARE_OOXMLEXPORT_TEST(testEffectExtent, "effect-extent.docx") { // The problem was that in case there were no shadows on the picture, we // wrote a <wp:effectExtent> full or zeros. - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) // E.g. this was 0. assertXPath(pXmlDoc, "//wp:effectExtent", "l", "114300"); } @@ -586,7 +586,7 @@ DECLARE_OOXMLEXPORT_TEST(testEffectExtentInline, "effect-extent-inline.docx") { // The problem was that in case there was inline rotated picture, we // wrote a <wp:effectExtent> full or zeros. - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { // E.g. this was 0. assertXPath(pXmlDoc, "//wp:effectExtent", "l", "609600"); @@ -634,7 +634,7 @@ DECLARE_OOXMLEXPORT_TEST(testParagraphMark, "paragraph-mark.docx") DECLARE_OOXMLEXPORT_TEST(testParagraphMarkNonempty, "paragraph-mark-nonempty.odt") { - if (xmlDocPtr pXmlDoc = parseExport()) + if (xmlDocUniquePtr pXmlDoc = parseExport()) // There were two <w:sz> elements, make sure the 40 one is dropped and the 20 one is kept. assertXPath(pXmlDoc, "//w:p/w:pPr/w:rPr/w:sz", "val", "20"); } @@ -710,21 +710,21 @@ DECLARE_OOXMLEXPORT_TEST(testOoxmlSymbolChicagoList, "symbol_chicago_list.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOoxmlNumListZHTW, "numlist-zhtw.odt") { - xmlDocPtr pXmlDoc = parseExport("word/numbering.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/numbering.xml"); assertXPath ( pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:numFmt","val","taiwaneseCountingThousand" ); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOoxmlNumListZHCN, "numlist-zhcn.odt") { - xmlDocPtr pXmlDoc = parseExport("word/numbering.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/numbering.xml"); assertXPath ( pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:numFmt","val","chineseCountingThousand" ); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOOxmlOutlineNumberTypes, "outline-number-types.odt") { - xmlDocPtr pXmlDoc = parseExport("word/numbering.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/numbering.xml"); assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:pStyle", "val", "Heading1"); assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:numFmt", "val", "none"); @@ -946,7 +946,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf106953, "tdf106953.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf115094v3, "tdf115094v3.docx") { // floating table is now exported directly without surrounding frame - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblpPr", "tblpX", "1996"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblpPr", "tblpY", "1064"); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index d8eafc1d60b1..4ba57fabc25f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -172,7 +172,7 @@ DECLARE_OOXMLEXPORT_TEST(testWpgNested, "wpg-nested.docx") // This failed, the right edge of the shape was outside the page // boundaries. - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nPageLeft = getXPath(pXmlDoc, "/root/page[1]/infos/bounds", "left").toInt32(); sal_Int32 nPageWidth = getXPath(pXmlDoc, "/root/page[1]/infos/bounds", "width").toInt32(); sal_Int32 nShapeLeft @@ -215,7 +215,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf120412_400PercentSubscript, "tdf120412_400Percen DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFontEsc, "test_tdf120412.docx") { - xmlDocPtr pXmlDoc =parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc =parseExport("word/document.xml"); // don't lose the run with superscript formatting assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r", 2); // Superscript should be raised by 100% (11pt). Was 110% (12pt) @@ -373,7 +373,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73389,"fdo73389.docx") // The width of the inner table was too large. The first fix still converted // the "auto" table width to a fixed one. The second fix used variable width. // The recent fix uses fixed width again, according to the fixed width cells. - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tbl/w:tblPr/w:tblW","type","dxa"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tbl/w:tblPr/w:tblW","w","1611"); @@ -382,7 +382,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73389,"fdo73389.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf59274, "tdf59274.docx") { // Table with "auto" table width and incomplete grid: 11 columns, but only 4 gridCol elements. - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblW", "type", "dxa"); // This was 7349: sum of the cell widths in first row, but the table width is determined by a longer row later. @@ -608,7 +608,7 @@ DECLARE_OOXMLEXPORT_TEST(testGridBefore, "gridbefore.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf116194, "tdf116194.docx") { // The problem was that the importer lost consecutive tables with w:gridBefore - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl", 2); } @@ -993,7 +993,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf95377, "tdf95377.docx") CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, xParagraph->getPropertyState("ParaFirstLineIndent")); //default style has numbering enabled. Styles inherit numbering unless specifically disabled - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "//body/txt/Special", 3); //first three paragraphs have numbering assertXPath(pXmlDoc, "//body/txt[1]/Special", "rText", "a."); assertXPath(pXmlDoc, "//body/txt[2]/Special", "rText", "b."); @@ -1181,7 +1181,7 @@ DECLARE_OOXMLEXPORT_TEST(testTableMarginAdjustment, "table.fodt") // since LO is exporting in the NEW way now instead of the OLD way. // This was 55 when using 2007's compatibilityMode of 12 (old) - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "//w:tbl[1]/w:tblPr[1]/w:tblInd[1]", "type", "dxa"); assertXPath(pXmlDoc, "//w:tbl[1]/w:tblPr[1]/w:tblInd[1]", "w", "0"); @@ -1191,7 +1191,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf119760_tableInTablePosition, "tdf119760_tableInT { if ( mbExported ) { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "//w:tbl[1]/w:tr[1]/w:tc[1]/w:tbl[1]/w:tblPr[1]/w:tblInd[1]", "type", "dxa"); assertXPath(pXmlDoc, "//w:tbl[1]/w:tr[1]/w:tc[1]/w:tbl[1]//w:tblPr[1]/w:tblInd[1]", "w", "0"); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 51395c0f1b54..1e9e55da8958 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -154,7 +154,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121456_tabsOffset, "tdf121456_tabsOffset.odt") // tdf#121561: make sure w:sdt/w:sdtContent around TOC is written during ODT->DOCX conversion DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf121561_tocTitle, "tdf121456_tabsOffset.odt") { - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p/w:r/w:t", "Inhaltsverzeichnis"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p/w:r/w:instrText", " TOC \\f \\o \"1-9\" \\h"); assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:docPartObj/w:docPartGallery", "val", "Table of Contents"); @@ -163,7 +163,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf121561_tocTitle, "tdf121456_tabsOffse DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf129525, "tdf129525.rtf") { - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r[4]/w:t", "Overview"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r[5]/w:t", "3"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[2]/w:r[1]/w:t", "More detailed description"); @@ -182,7 +182,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf124106, "tdf121456.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf121561_tocTitleDocx, "tdf121456_tabsOffset.odt") { - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); // get TOC node uno::Reference<text::XDocumentIndexesSupplier> xIndexSupplier(mxComponent, uno::UNO_QUERY); @@ -238,7 +238,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf82065_Ind_start_strict, "tdf82065_Ind_start_stri DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf76683_negativeTwipsMeasure, "tdf76683_negativeTwipsMeasure.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:cols/w:col", 2); sal_uInt32 nColumn1 = getXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:cols/w:col[1]", "w").toUInt32(); sal_uInt32 nColumn2 = getXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:cols/w:col[2]", "w").toUInt32(); @@ -361,7 +361,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf94801, "tdf94801.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testParagraphSplitOnSectionBorder, "parasplit-on-section-border.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Test document has only two paragraphs. After splitting, it should contain // three of them. @@ -371,7 +371,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testParagraphSplitOnSectionBorder, "paraspli DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf44832_testSectionWithDifferentHeader, "tdf44832_section_new_header.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:headerReference", 1); } @@ -430,7 +430,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf113183, "tdf113183.docx") { // The horizontal positioning of the star shape affected the positioning of // the triangle one, so the triangle was outside the page frame. - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nPageLeft = getXPath(pXmlDoc, "/root/page[1]/infos/bounds", "left").toInt32(); sal_Int32 nPageWidth = getXPath(pXmlDoc, "/root/page[1]/infos/bounds", "width").toInt32(); sal_Int32 nShapeLeft @@ -530,7 +530,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf113258_noBeforeAutospacing, "tdf113258_noBeforeA DECLARE_OOXMLEXPORT_TEST(testTdf120511_eatenSection, "tdf120511_eatenSection.docx") { - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nHeight = getXPath(pXmlDoc, "/root/page[1]/infos/prtBounds", "height").toInt32(); sal_Int32 nWidth = getXPath(pXmlDoc, "/root/page[1]/infos/prtBounds", "width").toInt32(); CPPUNIT_ASSERT_MESSAGE( "Page1 is portrait", nWidth < nHeight ); @@ -564,7 +564,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104354_firstParaInSection, "tdf104354_firstParaI DECLARE_OOXMLEXPORT_TEST(testPageBreak_after, "pageBreak_after.odt") { // The problem was that the page breakAfter put the empty page BEFORE the table - xmlDocPtr pDump = parseLayoutDump(); + xmlDocUniquePtr pDump = parseLayoutDump(); assertXPath(pDump, "/root/page[1]/body/tab", 1); // There should be two pages actually - a blank page after a page break. CPPUNIT_ASSERT_EQUAL_MESSAGE("Did you fix?? Table should be on page one of two", 1, getPages()); @@ -863,7 +863,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testChart_BorderLine_Style, "Chart_BorderLin /* DOCX containing Chart with BorderLine Style as Dash Type should get preserved * inside an XML tag <a:prstDash> with value "dash", "sysDot, "lgDot", etc. */ - xmlDocPtr pXmlDoc = parseExport("word/charts/chart1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart1.xml"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:spPr/a:ln/a:prstDash", "val", "sysDot"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[2]/c:spPr/a:ln/a:prstDash", "val", "sysDash"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[3]/c:spPr/a:ln/a:prstDash", "val", "dash"); @@ -874,7 +874,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testChart_Plot_BorderLine_Style, "Chart_Plot /* DOCX containing Chart wall (plot area) and Chart Page with BorderLine Style as Dash Type * should get preserved inside an XML tag <a:prstDash> with value "dash", "sysDot, "lgDot", etc. */ - xmlDocPtr pXmlDoc = parseExport("word/charts/chart1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart1.xml"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:ln/a:prstDash", "val", "lgDashDot"); assertXPath(pXmlDoc, "/c:chartSpace/c:spPr/a:ln/a:prstDash", "val", "sysDash"); @@ -882,20 +882,20 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testChart_Plot_BorderLine_Style, "Chart_Plot DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTrackChangesDeletedEmptyParagraph, "testTrackChangesDeletedEmptyParagraph.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:pPr/w:rPr/w:del"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTrackChangesEmptyParagraphsInADeletion, "testTrackChangesEmptyParagraphsInADeletion.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); for (int i = 1; i < 12; ++i) assertXPath(pXmlDoc, "/w:document/w:body/w:p[" + OString::number(i) + "]/w:pPr/w:rPr/w:del"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf70234, "tdf70234.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // import field with tracked deletion assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:del/w:r[1]/w:fldChar"); @@ -908,28 +908,28 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf70234, "tdf70234.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf115212, "tdf115212.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // export field with tracked deletion assertXPath(pXmlDoc, "//w:p[2]/w:del[1]/w:r[1]/w:fldChar"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf126243, "tdf120338.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // export change tracking rejection data for tracked paragraph style change assertXPath(pXmlDoc, "/w:document/w:body/w:p[11]/w:pPr/w:pPrChange/w:pPr/w:pStyle", "val", "Heading3"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf126245, "tdf126245.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // export change tracking rejection data for tracked numbering change assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pPrChange/w:pPr/w:numPr/w:numId", "val", "1"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf124491, "tdf124491.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // import format change of empty lines, FIXME: change w:r with w:pPr in export assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/*/w:rPr/w:rPrChange"); // empty line without format change @@ -939,14 +939,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf124491, "tdf124491.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf105485, "tdf105485.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // import change tracking of deleted comments assertXPath(pXmlDoc, "//w:del/w:r/w:commentReference"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf125894, "tdf125894.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // import change tracking in frames assertXPath(pXmlDoc, "//w:del", 2); assertXPath(pXmlDoc, "//w:ins"); @@ -954,21 +954,21 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf125894, "tdf125894.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128156, "tdf128156.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // import change tracking in frames assertXPath(pXmlDoc, "//w:ins"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf125546, "tdf125546.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // compress redlines (it was 15) assertXPath(pXmlDoc, "//w:rPrChange", 2); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testLabelWidthAndPosition_Left_FirstLineIndent, "Hau_min_list2.fodt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // list is LABEL_WIDTH_AND_POSITION with SvxAdjust::Left // I) LTR // a) all LTR cases with no number text look good in Word @@ -1070,14 +1070,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testLabelWidthAndPosition_Left_FirstLineInde DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf124604, "tdf124604.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // If the numbering comes from a base style, indentation of the base style has also priority. assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:pPr/w:ind", "start", "0"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf95374, "tdf95374.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Numbering disabled by non-existent numId=0, disabling also inheritance of indentation of parent styles assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:ind", "hanging", "0"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:ind", "start", "1136"); @@ -1085,7 +1085,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf95374, "tdf95374.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf108493, "tdf108493.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // set in the paragraph assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:pPr/w:ind", "start", "709"); // set in the numbering style (this was 0) @@ -1108,7 +1108,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf64264, "tdf64264.docx") { // DOCX table rows with tblHeader setting mustn't modify the count of the // repeated table header rows, when there is rows before them without tblHeader settings. - xmlDocPtr pDump = parseLayoutDump(); + xmlDocUniquePtr pDump = parseLayoutDump(); CPPUNIT_ASSERT_EQUAL(2, getPages()); // table starts on page 1 and finished on page 2 @@ -1125,7 +1125,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf58944RepeatingTableHeader, "tdf58944-repeating-t { // DOCX tables with more than 10 repeating header lines imported without repeating header lines // as a workaround for MSO's limitation of header line repetition - xmlDocPtr pDump = parseLayoutDump(); + xmlDocUniquePtr pDump = parseLayoutDump(); CPPUNIT_ASSERT_EQUAL(2, getPages()); // table starts on page 1 and finished on page 2 @@ -1140,12 +1140,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf58944RepeatingTableHeader, "tdf58944-repeating-t DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf81100, "tdf81100.docx") { - xmlDocPtr pXmlDoc = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/styles.xml"); CPPUNIT_ASSERT(pXmlDoc); // keep "repeat table header" setting of table styles assertXPath(pXmlDoc, "/w:styles/w:style/w:tblStylePr/w:trPr/w:tblHeader", 4); - xmlDocPtr pDump = parseLayoutDump(); + xmlDocUniquePtr pDump = parseLayoutDump(); CPPUNIT_ASSERT_EQUAL(3, getPages()); // table starts on page 1 and finished on page 2 @@ -1174,7 +1174,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf77417, "tdf77417.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf130494, "tdf130494.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:pPr/w:rPr/w:highlight", "val", "yellow"); // keep direct formatting of table cell paragraph with removed highlighting assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r/w:rPr/w:highlight", 0); @@ -1182,7 +1182,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf130494, "tdf130494.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf130690, "tdf130690.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:pPr/w:rPr/w:highlight", "val", "yellow"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[1]/w:rPr/w:highlight", 1); // keep direct formatting of table cell paragraph with removed highlighting @@ -1191,7 +1191,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf130690, "tdf130690.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf105215, "tdf105215.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:pPr/w:rPr/w:rFonts", "ascii", "Linux Libertine G"); // These were "Linux Libertine G" @@ -1205,7 +1205,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf105215, "tdf105215.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf121597TrackedDeletionOfMultipleParagraphs, "tdf121597.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // check paragraphs with removed paragraph mark assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:rPr/w:del"); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index bdaac7d64ad6..a8a55bd56e6c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -676,7 +676,7 @@ DECLARE_OOXMLEXPORT_TEST(testObjectCrossReference, "object_cross_reference.odt") DECLARE_OOXMLEXPORT_TEST(testTdf112202, "090716_Studentische_Arbeit_VWS.docx") { - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // page 1 header: 1 paragraph, 2 flys, 1 draw object assertXPath(pXmlDoc, "/root/page[1]/header/txt", 1); @@ -855,7 +855,7 @@ DECLARE_OOXMLEXPORT_TEST(testWatermarkTrim, "tdf114308.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf73547, "tdf73547-dash.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); double nD = getXPath(pXmlDoc, "//a:custDash/a:ds[1]", "d").toDouble(); CPPUNIT_ASSERT_DOUBLES_EQUAL(105000.0, nD, 5000.0); // was 100000 double nSp = getXPath(pXmlDoc, "//a:custDash/a:ds[1]", "sp").toDouble(); @@ -884,7 +884,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf119143, "tdf119143.docx") DECLARE_OOXMLEXPORT_TEST(testTdf105444, "tdf105444.docx") { - xmlDocPtr pXmlComm = parseExport("word/comments.xml"); + xmlDocUniquePtr pXmlComm = parseExport("word/comments.xml"); if (!pXmlComm) return; // there is no extra paragraph on Win32, only a single one. @@ -909,7 +909,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf117137, "tdf117137.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf99631, "tdf99631.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "//w:object", 2); assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/w:object", 2); @@ -923,7 +923,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf99631, "tdf99631.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf122563, "tdf122563.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/w:object", 1); // Size of the embedded OLE spreadsheet was the bad "width:28.35pt;height:28.35pt" @@ -992,7 +992,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf122594, "tdf122594.docx") DECLARE_OOXMLEXPORT_TEST(testLanguageInGroupShape, "tdf131922_LanguageInGroupShape.docx") { // tdf#131922: Check if good language is used in shape group texts - xmlDocPtr pXml = parseExport("word/document.xml"); + xmlDocUniquePtr pXml = parseExport("word/document.xml"); if (!pXml) return; assertXPath(pXml, diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index f3ae46531c2b..d7102f0631ee 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -388,7 +388,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak3, "tdf123636_newlinePage CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Paragraphs", 5, getParagraphs() ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 2, getPages() ); - xmlDocPtr pDump = parseLayoutDump(); + xmlDocUniquePtr pDump = parseLayoutDump(); assertXPath(pDump, "/root/page[1]/body/txt[3]/Text[1]", "Portion", "Last line on page 1"); } @@ -399,7 +399,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak4, "tdf123636_newlinePage CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Paragraphs", 3, getParagraphs() ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 2, getPages() ); - xmlDocPtr pDump = parseLayoutDump(); + xmlDocUniquePtr pDump = parseLayoutDump(); assertXPath(pDump, "/root/page[2]/body/txt[1]/Text", 0); } @@ -593,7 +593,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf116371, "tdf116371.odt") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFrameSizeExport, "floating-tables-anchor.docx") { // Make sure the table width is 4000 - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tblPr/w:tblW", "w", "4000"); } @@ -613,7 +613,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf119201, "tdf119201.docx") DECLARE_OOXMLEXPORT_TEST(testTdf124594, "tdf124594.docx") { - xmlDocPtr pDump = parseLayoutDump(); + xmlDocUniquePtr pDump = parseLayoutDump(); // Without the accompanying fix in place, this test would have failed, as the portion text was // only "Er horte leise Schritte hinter", which means the 1st line of the 2nd paragraph was // split into two by a Special portion, i.e. the top margin of the shape was too large. @@ -623,7 +623,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf124594, "tdf124594.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTextInput, "textinput.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // test the exported DOCX @@ -714,7 +714,7 @@ DECLARE_OOXMLIMPORT_TEST(testTdf123460, "tdf123460.docx") //tdf#125298: fix charlimit restrictions in bookmarknames and field references if they contain non-ascii characters DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf125298, "tdf125298_crossreflink_nonascii_charlimit.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // check whether test file keeps non-ascii values or not OUString bookmarkName1 = getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:bookmarkStart[1]", "name"); CPPUNIT_ASSERT_EQUAL(OUString::fromUtf8("\u00e1rv\u00edzt\u0171r\u0151_t\u00fck\u00f6rf\u00far\u00f3g\u00e9p"), bookmarkName1); @@ -771,7 +771,7 @@ DECLARE_OOXMLEXPORT_TEST(testTbrlFrameVml, "tbrl-frame-vml.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf119037, "tdf119037.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pBdr/w:top", "val", "single"); @@ -827,7 +827,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf119037, "tdf119037.odt") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf125657, "tdf125657.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); CPPUNIT_ASSERT(pXmlDoc); auto checkAttrIsInt = [&](const OString& sAttrName) { OUString sAttr = getXPath(pXmlDoc, @@ -853,14 +853,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf125657, "tdf125657.docx") DECLARE_OOXMLEXPORT_TEST(testTdf125324, "tdf125324.docx") { discardDumpedLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page/body/txt[2]/anchored/fly/tab/infos/bounds", "top", "4193"); } DECLARE_OOXMLEXPORT_TEST(testTdf78657, "tdf78657_picture_hyperlink.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); - xmlDocPtr pXmlRels = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlRels = parseExport("word/_rels/document.xml.rels"); if (!pXmlDoc || !pXmlRels) return; assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing/wp:inline/wp:docPr/a:hlinkClick", 1); @@ -880,7 +880,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testBtlrFrame, "btlr-frame.odt") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf125518, "tdf125518.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // First diagram is anchored @@ -919,14 +919,14 @@ DECLARE_OOXMLEXPORT_TEST(testImageCommentAtChar, "image-comment-at-char.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf131594, "tdf131594.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // lnNumType should not be exported if w:countBy="0" assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:lnNumType", 0); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf121663, "tdf121663.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // auto distance of line numbering is 0.5 cm assertXPath(pXmlDoc, "//w:lnNumType", "distance", "283"); } @@ -1037,7 +1037,7 @@ DECLARE_OOXMLEXPORT_TEST(tdf118169, "tdf118169.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf127116, "tdf127116.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); OUString bookmarkName = getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:bookmarkStart", "name"); @@ -1047,7 +1047,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf127116, "tdf127116.odt") DECLARE_OOXMLEXPORT_TEST(testTdf127339, "tdf127339.docx") { - xmlDocPtr pXmlRels = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlRels = parseExport("word/_rels/document.xml.rels"); if (!pXmlRels) return; @@ -1056,9 +1056,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf127339, "tdf127339.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf127362, "tdf127362.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); - xmlDocPtr pXmlRels = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlRels = parseExport("word/_rels/document.xml.rels"); if (!pXmlRels) return; @@ -1069,7 +1069,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf127362, "tdf127362.odt") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf127605, "tdf127605.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); OUString bookmarkName = getXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:bookmarkStart", "name"); OUString anchor = getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink", "anchor"); @@ -1078,7 +1078,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf127605, "tdf127605.odt") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf127732, "internal_hyperlink_frame.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); OUString bookmarkName = getXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:textbox/w:txbxContent/w:p/w:bookmarkStart", "name"); OUString anchor = getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink", "anchor"); @@ -1087,7 +1087,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf127732, "internal_hyperlink_frame.odt DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf127733, "internal_hyperlink_ole.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); OUString bookmarkName = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:bookmarkStart", "name"); @@ -1097,7 +1097,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf127733, "internal_hyperlink_ole.odt") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf127734, "internal_hyperlink_region.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); OUString bookmarkName = getXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:bookmarkStart", "name"); OUString anchor = getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink", "anchor"); @@ -1106,7 +1106,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf127734, "internal_hyperlink_region.od DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf127735, "internal_hyperlink_table.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); OUString bookmarkName = getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p/w:bookmarkStart", "name"); OUString anchor = getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink", "anchor"); @@ -1115,9 +1115,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf127735, "internal_hyperlink_table.odt DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf123628, "tdf123628.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); - xmlDocPtr pXmlStyles = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"); if (!pXmlStyles) return; @@ -1137,7 +1137,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf127741, "tdf127741.docx") DECLARE_OOXMLEXPORT_TEST(testTdf127925, "tdf127925.odt") { - xmlDocPtr pXmlStyles = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"); if (!pXmlStyles) return; @@ -1146,7 +1146,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf127925, "tdf127925.odt") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf127579, "tdf127579.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:hyperlink/w:r/w:rPr/w:rStyle", "val", "InternetLink"); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index d751393800ec..9bceb4c32cbe 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -84,7 +84,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf78749, "tdf78749.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128207, "tdf128207.docx") { //There was the charts on each other, because their horizontal and vertical position was 0! - xmlDocPtr p_XmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr p_XmlDoc = parseExport("word/document.xml"); CPPUNIT_ASSERT(p_XmlDoc); assertXPathContent(p_XmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor/wp:positionH/wp:posOffset", "4445"); } @@ -92,7 +92,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128207, "tdf128207.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf123873, "tdf123873.docx") { //OLE Object were overlapped due to missing wrap import - xmlDocPtr p_XmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr p_XmlDoc = parseExport("word/document.xml"); CPPUNIT_ASSERT(p_XmlDoc); assertXPath( p_XmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:drawing/wp:anchor/wp:wrapTopAndBottom"); @@ -109,7 +109,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf130814model, "tdf130814.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf107020, "tdf107020.docx") { - xmlDocPtr p_XmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr p_XmlDoc = parseExport("word/document.xml"); CPPUNIT_ASSERT(p_XmlDoc); assertXPath( p_XmlDoc, "/w:document/w:body/w:p/w:r/w:drawing/wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:srcRect", "l", "4910"); @@ -123,7 +123,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf107020, "tdf107020.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf130814ooxml, "tdf130814.docx") { - xmlDocPtr p_XmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr p_XmlDoc = parseExport("word/document.xml"); CPPUNIT_ASSERT(p_XmlDoc); assertXPath( p_XmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/w:rPr/w:rFonts", "eastAsia", "Arial Unicode MS"); @@ -172,7 +172,7 @@ DECLARE_OOXMLIMPORT_TEST(testTdf129888dml, "tdf129888dml.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf130120, "tdf130120.docx") { //Text for exporting the allowincell attribute: - xmlDocPtr p_XmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr p_XmlDoc = parseExport("word/document.xml"); assertXPath(p_XmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:r/mc:AlternateContent/" "mc:Choice/w:drawing/wp:anchor", "layoutInCell", "0"); } @@ -261,7 +261,7 @@ CPPUNIT_TEST_FIXTURE(Test, testArabicZeroNumberingFootnote) reload("Office Open XML Text", ""); - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Without the accompanying fix in place, this test would have failed with: // XPath '/w:document/w:body/w:sectPr/w:footnotePr/w:numFmt' number of nodes is incorrect // because the exporter had no idea what markup to use for ARABIC_ZERO. @@ -289,7 +289,7 @@ CPPUNIT_TEST_FIXTURE(Test, testChicagoNumberingFootnote) reload("Office Open XML Text", ""); - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Without the accompanying fix in place, this test would have failed with: // XPath '/w:document/w:body/w:sectPr/w:footnotePr/w:numFmt' number of nodes is incorrect // because the exporter had no idea what markup to use for SYMBOL_CHICAGO. @@ -326,7 +326,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf130610, "tdf130610_bold_in_2_styles.ott") // check inline text properties { - xmlDocPtr pXmlDoc =parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc =parseExport("word/document.xml"); if (pXmlDoc) { assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/w:rPr/w:b"); @@ -336,7 +336,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf130610, "tdf130610_bold_in_2_styles.ott") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf121045, "tdf121045.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:pPr/w:rPr/w:sz", "val", "20"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:pPr/w:rPr/w:szCs", "val", "20"); @@ -357,7 +357,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf121045, "tdf121045.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf92472, "tdf92472.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:rPr/w:sz", "val", "20"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:rPr/w:szCs", "val", "20"); @@ -525,7 +525,7 @@ DECLARE_OOXMLIMPORT_TEST(testTdf125038c, "tdf125038c.docx") DECLARE_OOXMLEXPORT_TEST(testTdf121661, "tdf121661.docx") { - xmlDocPtr pXmlSettings = parseExport("word/settings.xml"); + xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml"); if (!pXmlSettings) return; assertXPath(pXmlSettings, "/w:settings/w:hyphenationZone", "val", "851"); @@ -533,7 +533,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121661, "tdf121661.docx") DECLARE_OOXMLEXPORT_TEST(testTdf121658, "tdf121658.docx") { - xmlDocPtr pXmlSettings = parseExport("word/settings.xml"); + xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml"); if (!pXmlSettings) return; assertXPath(pXmlSettings, "/w:settings/w:doNotHyphenateCaps"); @@ -552,7 +552,7 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testTableStyleConfNested) xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); validate(maTempFile.GetFileName(), test::OOXML); mbExported = true; - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); CPPUNIT_ASSERT(pXmlDoc); // Without the accompanying fix in place, this test would have failed, as the custom table cell // border properties were lost, so the outer A2 cell started to have borders, not present in the @@ -576,7 +576,7 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testZeroLineSpacing) aMediaDescriptor["FilterName"] <<= OUString("Office Open XML Text"); xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); mbExported = true; - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); CPPUNIT_ASSERT(pXmlDoc); // Without the accompanying fix in place, this test would have failed with: @@ -607,7 +607,7 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testSemiTransparentText) aMediaDescriptor["FilterName"] <<= OUString("Office Open XML Text"); xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); mbExported = true; - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); CPPUNIT_ASSERT(pXmlDoc); OString aXPath = "/w:document/w:body/w:p/w:r/w:rPr/w14:textFill/w14:solidFill/w14:srgbClr/w14:alpha"; @@ -642,7 +642,7 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testUserField) xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); validate(maTempFile.GetFileName(), test::OOXML); mbExported = true; - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); CPPUNIT_ASSERT(pXmlDoc); // Without the accompanying fix in place, this test would have failed, the user field was @@ -675,7 +675,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128820, "tdf128820.fodt") { // Import of exported DOCX failed because of wrong namespace used for wsp element // Now test the exported XML, in case we stop failing opening invalid files - xmlDocPtr pXml = parseExport("word/document.xml"); + xmlDocUniquePtr pXml = parseExport("word/document.xml"); CPPUNIT_ASSERT(pXml); // The parent wpg:wgp element has three children: wpg:cNvGrpSpPr, wpg:grpSpPr, and wpg:wsp // (if we start legitimately exporting additional children, this needs to be adjusted to check @@ -698,7 +698,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128820, "tdf128820.fodt") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128889, "tdf128889.fodt") { - xmlDocPtr pXml = parseExport("word/document.xml"); + xmlDocUniquePtr pXml = parseExport("word/document.xml"); CPPUNIT_ASSERT(pXml); // There was an w:r (with w:br) as an invalid child of first paragraph's w:pPr assertXPath(pXml, "/w:document/w:body/w:p[1]/w:pPr/w:r", 0); @@ -736,7 +736,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf129353, "tdf129353.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf77796, "tdf77796.docx") { - xmlDocPtr pXml = parseExport("word/document.xml"); + xmlDocUniquePtr pXml = parseExport("word/document.xml"); CPPUNIT_ASSERT(pXml); // cell paddings from table style assertXPath(pXml, "/w:document/w:body/w:tbl/w:tblPr/w:tblCellMar/w:start", "w", "5"); @@ -748,14 +748,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf77796, "tdf77796.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128290, "tdf128290.odt") { - xmlDocPtr pXml = parseExport("word/document.xml"); + xmlDocUniquePtr pXml = parseExport("word/document.xml"); CPPUNIT_ASSERT(pXml); assertXPath(pXml, "/w:document/w:body/w:tbl/w:tblPr/w:tblLayout", "type", "fixed"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf123757, "tdf123757.docx") { - xmlDocPtr pXml = parseExport("word/document.xml"); + xmlDocUniquePtr pXml = parseExport("word/document.xml"); CPPUNIT_ASSERT(pXml); assertXPath(pXml, "/w:document/w:body/w:tbl", 2); } @@ -793,7 +793,7 @@ DECLARE_OOXMLEXPORT_TEST(testContSectBreakHeaderFooter, "cont-sect-break-header- // Additional problem: top margin on page 3 was wrong. if (mbExported) { - xmlDocPtr pXml = parseExport("word/document.xml"); + xmlDocUniquePtr pXml = parseExport("word/document.xml"); // Without the accompanying fix in place, this test would have failed with: // - Expected: 2200 // - Actual : 2574 @@ -806,17 +806,17 @@ DECLARE_OOXMLEXPORT_TEST(testContSectBreakHeaderFooter, "cont-sect-break-header- DECLARE_OOXMLEXPORT_TEST(testHyphenationAuto, "hyphenation.odt") { // Explicitly set hyphenation=auto on document level - xmlDocPtr pXmlSettings = parseExport("word/settings.xml"); + xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml"); CPPUNIT_ASSERT(pXmlSettings); assertXPath(pXmlSettings, "/w:settings/w:autoHyphenation", "val", "true"); // Second paragraph has explicitly enabled hyphenation - xmlDocPtr pXml = parseExport("word/document.xml"); + xmlDocUniquePtr pXml = parseExport("word/document.xml"); CPPUNIT_ASSERT(pXml); assertXPath(pXml, "/w:document/w:body/w:p[2]/w:pPr/w:suppressAutoHyphens", "val", "false"); // Default paragraph style explicitly disables hyphens - xmlDocPtr pXmlStyles = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"); CPPUNIT_ASSERT(pXmlStyles); assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:pPrDefault/w:pPr/w:suppressAutoHyphens", "val", "true"); } @@ -824,7 +824,7 @@ DECLARE_OOXMLEXPORT_TEST(testHyphenationAuto, "hyphenation.odt") DECLARE_OOXMLEXPORT_TEST(testStrikeoutGroupShapeText, "tdf131776_StrikeoutGroupShapeText.docx") { // tdf#131776: Check if strikeout is used in shape group texts - xmlDocPtr pXml = parseExport("word/document.xml"); + xmlDocUniquePtr pXml = parseExport("word/document.xml"); if (!pXml) return; @@ -864,7 +864,7 @@ DECLARE_OOXMLEXPORT_TEST(testStrikeoutGroupShapeText, "tdf131776_StrikeoutGroupS DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf131539, "tdf131539.odt") { //The positions of OLE objects were not exported, check if now it is exported correctly - xmlDocPtr p_XmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr p_XmlDoc = parseExport("word/document.xml"); CPPUNIT_ASSERT(p_XmlDoc); OUString aXmlVal = getXPath(p_XmlDoc, "/w:document/w:body/w:p[4]/w:r[1]/w:object/v:shape", "style"); // This data was missing diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx index ef9ae951edeb..49012edce050 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx @@ -87,7 +87,7 @@ DECLARE_OOXMLEXPORT_TEST(testZoom, "zoom.docx") CPPUNIT_ASSERT_EQUAL(sal_Int16(42), nValue); // Validation test: order of elements were wrong. - xmlDocPtr pXmlDoc = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/styles.xml"); if (!pXmlDoc) return; // Order was: rsid, next. @@ -324,7 +324,7 @@ DECLARE_OOXMLEXPORT_TEST(testMathVerticalStacks, "math-vertical_stacks.docx") DECLARE_OOXMLEXPORT_TEST(testTable, "table.odt") { // Make sure we write qFormat for well-known style names. - xmlDocPtr pXmlDocCT = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlDocCT = parseExport("word/styles.xml"); CPPUNIT_ASSERT(pXmlDocCT); assertXPath(pXmlDocCT, "//w:style[@w:styleId='Normal']/w:qFormat", 1); } @@ -411,7 +411,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo51550, "fdo51550.odt") uno::Reference<container::XIndexAccess> xEmbeddedObjects(xTextEmbeddedObjectsSupplier->getEmbeddedObjects(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xEmbeddedObjects->getCount()); - xmlDocPtr pXmlDocCT = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDocCT = parseExport("[Content_Types].xml"); if (!pXmlDocCT) return; // initial import @@ -419,13 +419,13 @@ DECLARE_OOXMLEXPORT_TEST(testFdo51550, "fdo51550.odt") assertXPath(pXmlDocCT, "/ContentType:Types/ContentType:Override[@PartName='/word/embeddings/oleObject1.xlsx']", "ContentType", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); // check the rels too - xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); assertXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.xlsx']", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); // check the content too - xmlDocPtr pXmlDocContent = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport("word/document.xml"); assertXPath(pXmlDocContent, "/w:document/w:body/w:p/w:r/w:object/o:OLEObject", "ProgID", @@ -516,7 +516,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCellBtlr, "cell-btlr.docx") * w:val="btLr"/> token was completely missing in the output. */ - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:textDirection", "val", "btLr"); } @@ -586,7 +586,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo64826, "fdo64826.docx") // 'Track-Changes' (Track Revisions) wasn't exported. CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(mxComponent, "RecordChanges")); // 'Show-Changes' should not be exported - default is true. - if (xmlDocPtr pXmlSettings = parseExport("word/settings.xml")) + if (xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml")) { assertXPath(pXmlSettings, "/w:settings/w:revisionView", 0); } @@ -862,7 +862,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPageBorderSpacingExportCase2, "page-bord // The exporter ALWAYS exported 'w:offsetFrom="text"' even when the spacing values where too large // for Word to handle (larger than 31 points) - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); // Assert the XPath expression - page borders assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:pgBorders", "offsetFrom", "page"); @@ -890,7 +890,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo66145, "fdo66145.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testGrabBag, "grabbag.docx") { // w:mirrorIndents was lost on roundtrip, now should be handled as a grab bag property - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:mirrorIndents"); } @@ -1075,7 +1075,7 @@ DECLARE_OOXMLEXPORT_TEST(testTransparentShadow, "transparent-shadow.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(NoFillAttrInImagedata, "NoFillAttrInImagedata.docx") { //problem was that type and color2 which are v:fill attributes were written in 'v:imagedata' - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Fallback/w:pict/v:rect/v:imagedata", "type"); assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Fallback/w:pict/v:rect/v:imagedata", "color2"); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 447bbb1236e8..a1e572fed89f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -139,7 +139,7 @@ DECLARE_OOXMLEXPORT_TEST(testCharacterBorder, "charborder.odt") CPPUNIT_ASSERT_EQUAL(sal_Int16(318), aShadow.ShadowWidth); } - if (xmlDocPtr pXmlStyles = parseExport("word/styles.xml")) + if (xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml")) { // Make sure we write qFormat for custom style names. assertXPath(pXmlStyles, "//w:style[@w:styleId='Heading']/w:qFormat", 1); @@ -149,7 +149,7 @@ DECLARE_OOXMLEXPORT_TEST(testCharacterBorder, "charborder.odt") DECLARE_OOXMLEXPORT_TEST(testStyleInheritance, "style-inheritance.docx") { // Check that now styleId's are more like what MSO produces - xmlDocPtr pXmlStyles = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"); if (!pXmlStyles) return; // the 1st style always must be Normal @@ -249,7 +249,7 @@ DECLARE_OOXMLEXPORT_TEST(testStyleInheritance, "style-inheritance.docx") DECLARE_OOXMLEXPORT_TEST(testCalendar1, "calendar1.docx") { // Document has a non-trivial table style, test the roundtrip of it. - xmlDocPtr pXmlStyles = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"); if (!pXmlStyles) return; assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:basedOn", "val", "TableNormal"); @@ -270,7 +270,7 @@ DECLARE_OOXMLEXPORT_TEST(testCalendar1, "calendar1.docx") assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:tblStylePr[@w:type='band2Horz']/w:tcPr/w:tcBorders/w:top", "themeColor", "text1"); // w:tblLook element and its attributes were missing. - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblLook", "firstRow", "1"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblLook", "lastRow", "0"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblLook", "lastColumn", "0"); @@ -294,7 +294,7 @@ DECLARE_OOXMLEXPORT_TEST(testCalendar2, "calendar2.docx") CPPUNIT_ASSERT_EQUAL(14.f, getProperty<float>(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharHeight")); // This paragraph property was missing in table style. - xmlDocPtr pXmlStyles = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"); if (!pXmlStyles) return; assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar2']/w:pPr/w:jc", "val", "center"); @@ -354,7 +354,7 @@ DECLARE_OOXMLEXPORT_TEST(testTcBorders, "testTcBorders.docx") { //fdo#76635 : Table borders are not getting preserved. - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; @@ -371,7 +371,7 @@ DECLARE_OOXMLEXPORT_TEST(testTcBorders, "testTcBorders.docx") DECLARE_OOXMLEXPORT_TEST(testQuicktables, "quicktables.docx") { - xmlDocPtr pXmlStyles = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"); if (!pXmlStyles) return; @@ -401,7 +401,7 @@ DECLARE_OOXMLEXPORT_TEST(testQuicktables, "quicktables.docx") DECLARE_OOXMLEXPORT_TEST(testFdo71302, "fdo71302.docx") { - xmlDocPtr pXmlStyles = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"); if (!pXmlStyles) return; @@ -496,7 +496,7 @@ DECLARE_OOXMLEXPORT_TEST(testFontNameIsEmpty, "font-name-is-empty.docx") // Check no empty font name is exported // This test does not fail, if the document contains a font with empty name. - xmlDocPtr pXmlFontTable = parseExport("word/fontTable.xml"); + xmlDocUniquePtr pXmlFontTable = parseExport("word/fontTable.xml"); if (!pXmlFontTable) return; xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlFontTable, "/w:fonts/w:font"); @@ -515,7 +515,7 @@ DECLARE_OOXMLEXPORT_TEST(testFontNameIsEmpty, "font-name-is-empty.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testMultiColumnLineSeparator, "multi-column-line-separator-SAVED.docx") { // Check for the Column Separator value.It should be FALSE as the document does not contain separator line. - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:pPr/w:sectPr/w:cols","sep","false"); } @@ -550,7 +550,7 @@ DECLARE_OOXMLEXPORT_TEST(testCustomXmlGrabBag, "customxml.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCustomXmlRelationships, "customxml.docx") { - xmlDocPtr pXmlDoc = parseExport("customXml/_rels/item1.xml.rels"); + xmlDocUniquePtr pXmlDoc = parseExport("customXml/_rels/item1.xml.rels"); // Check there is a relation to itemProps1.xml. assertXPath(pXmlDoc, "/rels:Relationships/rels:Relationship", 1); @@ -562,7 +562,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo69644, "fdo69644.docx") // The problem was that the exporter exported the table definition // with only 3 columns, instead of 5 columns. // Check that the table grid is exported with 5 columns - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol", 5); } @@ -574,7 +574,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo70812, "fdo70812.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPgMargin, "testPgMargin.docx") { - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:pgMar", "left", "1440"); } @@ -691,7 +691,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCellGridSpan, "cell-grid-span.docx") // The problem was during export gridSpan value for 1st & 2nd cells for test document // used to get set wrongly to 5 and 65532 respectively which was the reason for crash during save operation // Verifying gridSpan element is not present in RoundTripped Document (As it's Default value is 1). - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:tcPr/w:gridSpan",0); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[2]/w:tcPr/w:gridSpan",0); } @@ -710,7 +710,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo71646, "fdo71646.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testParaAutoSpacing, "para-auto-spacing.docx") { - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:spacing", "beforeAutospacing","1"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:spacing", "afterAutospacing","1"); @@ -786,7 +786,7 @@ DECLARE_OOXMLEXPORT_TEST(testFootnoteParagraphTag, "testFootnote.docx") /* In footnotes.xml, the paragraph tag inside <w:footnote w:id="2"> was getting written into document.xml. * Check for, paragraph tag is correctly written into footnotes.xml. */ - xmlDocPtr pXmlFootnotes = parseExport("word/footnotes.xml"); + xmlDocUniquePtr pXmlFootnotes = parseExport("word/footnotes.xml"); if (!pXmlFootnotes) return; assertXPath(pXmlFootnotes, "/w:footnotes/w:footnote[3]","id","2"); @@ -795,13 +795,13 @@ DECLARE_OOXMLEXPORT_TEST(testFootnoteParagraphTag, "testFootnote.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSpacingLineRule,"table_lineRule.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "lineRule", "auto"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTableLineSpacing, "table_atleast.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:pPr/w:spacing", "line", "320"); } @@ -821,7 +821,7 @@ DECLARE_OOXMLEXPORT_TEST(testMce, "mce.docx") DECLARE_OOXMLEXPORT_TEST(testThemePreservation, "theme-preservation.docx") { // check default font theme values have been preserved - xmlDocPtr pXmlStyles = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"); if (!pXmlStyles) return; assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:rPrDefault/w:rPr/w:rFonts", "asciiTheme", "minorHAnsi"); @@ -835,7 +835,7 @@ DECLARE_OOXMLEXPORT_TEST(testThemePreservation, "theme-preservation.docx") assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Custom1']/w:rPr/w:color", "themeTint", "99"); // check direct format font theme values have been preserved - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; assertXPath(pXmlDocument, "/w:document/w:body/w:p[5]/w:r[1]/w:rPr/w:rFonts", "hAnsiTheme", "majorHAnsi"); @@ -847,7 +847,7 @@ DECLARE_OOXMLEXPORT_TEST(testThemePreservation, "theme-preservation.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(0xbf), sThemeShade.toInt32(16)); // check the themeFontLang values in settings file - xmlDocPtr pXmlSettings = parseExport("word/settings.xml"); + xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml"); if (!pXmlSettings) return; assertXPath(pXmlSettings, "/w:settings/w:themeFontLang", "val", "en-US"); @@ -878,7 +878,7 @@ DECLARE_OOXMLEXPORT_TEST(testThemePreservation, "theme-preservation.docx") DECLARE_OOXMLEXPORT_TEST(testTableThemePreservation, "table-theme-preservation.docx") { - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; @@ -935,7 +935,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testcantSplit, "2_table_doc.docx") // if Split table value is true for a table then during export do not write <w:cantSplit w:val="false"/> // in table row property,As default row prop is allow row to break across page. // writing <w:cantSplit w:val="false"/> during export was causing problem that all the cell data used to come on same page - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr/w:trPr/w:cantSplit",0); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[2]/w:tr/w:trPr/w:cantSplit","val","true"); } @@ -970,13 +970,13 @@ DECLARE_OOXMLEXPORT_TEST(testExtraSectionBreak, "1_page.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testcolumnbreak, "columnbreak.docx") { CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, getProperty<style::BreakType>(getParagraph(5, "This is first line after col brk."), "BreakType")); - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:r[1]/w:br", "type", "column"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testGlossary, "testGlossary.docx") { - xmlDocPtr pXmlDoc = parseExport("word/glossary/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/glossary/document.xml"); assertXPath(pXmlDoc, "/w:glossaryDocument", "Ignorable", "w14 wp14"); } @@ -987,14 +987,14 @@ DECLARE_OOXMLEXPORT_TEST(testFdo71785, "fdo71785.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCrashWhileSave, "testCrashWhileSave.docx") { - xmlDocPtr pXmlDoc = parseExport("word/footer1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/footer1.xml"); CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:ftr/w:tbl/w:tr/w:tc[1]/w:p[1]/w:pPr/w:pStyle", "val").match("Normal")); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFileOpenInputOutputError,"floatingtbl_with_formula.docx") { // Docx containing Floating table with formula was giving "General input/output error" while opening in LibreOffice - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pStyle", "val", "Normal"); // let's also assert that the formula was exported properly @@ -1005,7 +1005,7 @@ DECLARE_OOXMLEXPORT_TEST(testSingleCellTableBorders, "tdf124399_SingleCellTableB { // tdf#124399: Extra borders on single cell tables fixed. - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:tcBorders/w:top [@w:val = 'nil']", 1); @@ -1016,7 +1016,7 @@ DECLARE_OOXMLEXPORT_TEST(testInsideBorders, "tdf129242_InsideBorders.docx") { // tdf#129242: Don't remove inside borders if the table has more than one cells. - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; @@ -1028,7 +1028,7 @@ DECLARE_OOXMLEXPORT_TEST(testRightBorder, "tdf129442_RightBorder.docx") { // tdf#129442: Right border of a one column table was missing. - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; @@ -1040,7 +1040,7 @@ DECLARE_OOXMLEXPORT_TEST(testBottomBorder, "tdf129450_BottomBorder.docx") { // tdf#129450: Missing bottom border in one row table. - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; @@ -1053,7 +1053,7 @@ DECLARE_OOXMLEXPORT_TEST(testBottomBorders, "tdf129452_BottomBorders.docx") // tdf#129452: Do not omit bottom borders when a column in a table is vertically merged and // the inside borders are turned off. - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; @@ -1066,13 +1066,13 @@ DECLARE_OOXMLEXPORT_TEST(testFontTypes, "tdf120344_FontTypes.docx") // tdf#120344: Font type of numbering symbols can be different than the font type of the text. // Check the font type of the text, should be Consolas. - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:r/w:rPr/w:rFonts [@w:ascii='Consolas']", 1); // Now the font type of the numbering symbols, should be Arial Black. - xmlDocPtr qXmlDocument = parseExport("word/numbering.xml"); + xmlDocUniquePtr qXmlDocument = parseExport("word/numbering.xml"); if (!qXmlDocument) return; assertXPath(qXmlDocument, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:rPr/w:rFonts [@w:ascii='Arial Black']", 1); @@ -1080,7 +1080,7 @@ DECLARE_OOXMLEXPORT_TEST(testFontTypes, "tdf120344_FontTypes.docx") DECLARE_OOXMLEXPORT_TEST(testNumberingLevels, "tdf95495.docx") { - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; @@ -1092,7 +1092,7 @@ DECLARE_OOXMLEXPORT_TEST(testVerticalBorders, "calendar3.docx") { // tdf#130799: Inside vertical borders of a table should not be missing. - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; // Left and right borders. @@ -1103,7 +1103,7 @@ DECLARE_OOXMLEXPORT_TEST(testArrowFlipXY, "tdf100751_arrowBothFlip.docx") { // tdf#100751: Both x and y flip should happen. - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; @@ -1114,7 +1114,7 @@ DECLARE_OOXMLEXPORT_TEST(testArrowFlipXY, "tdf100751_arrowBothFlip.docx") DECLARE_OOXMLEXPORT_TEST(testArrowPosition, "tdf104565_ArrowPosition.docx") { // tdf#104565: Test correct position. - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; @@ -1127,7 +1127,7 @@ DECLARE_OOXMLEXPORT_TEST(testArrowMarker, "tdf123346_ArrowMarker.docx") { // tdf#123346: Check arrow marker. - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index a6352c767335..9e0e23b3c723 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -100,37 +100,37 @@ DECLARE_OOXMLEXPORT_TEST(testAutofit, "autofit.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTrackChangesDeletedParagraphMark, "testTrackChangesDeletedParagraphMark.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:rPr/w:del"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTrackChangesInsertedParagraphMark, "testTrackChangesInsertedParagraphMark.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:rPr/w:ins"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTrackChangesDeletedTableRow, "testTrackChangesDeletedTableRow.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[2]/w:trPr/w:del"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTrackChangesInsertedTableRow, "testTrackChangesInsertedTableRow.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[2]/w:trPr/w:ins"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTrackChangesDeletedTableCell, "testTrackChangesDeletedTableCell.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[3]/w:tc/w:tcPr/w:cellDel"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTrackChangesInsertedTableCell, "testTrackChangesInsertedTableCell.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[3]/w:tc/w:tcPr/w:cellIns"); } @@ -151,19 +151,19 @@ DECLARE_OOXMLEXPORT_TEST(testTextBoxPictureFill, "textbox_picturefill.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO73034, "FDO73034.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:rPr/w:u", "val").match("single")); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO71834, "fdo71834.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr[2]/w:tc[1]/w:tcPr[1]/w:tcW[1]","type", "dxa"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTrackChangesParagraphProperties, "testTrackChangesParagraphProperties.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathChildren(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pPrChange", 0); } @@ -184,7 +184,7 @@ DECLARE_OOXMLEXPORT_TEST(testMsoSpt180, "mso-spt180.docx") DECLARE_OOXMLEXPORT_TEST(testFdo73550, "fdo73550.docx") { - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; // This was wrap="none". @@ -234,7 +234,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73556,"fdo73556.docx") * the table width was calculated as 2820 from cells instead * of 3751 from the Grid. */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol", 3); sal_Int32 tableWidth = 0; tableWidth += getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[1]", "w").toInt32(); @@ -246,7 +246,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73556,"fdo73556.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSegFaultWhileSave, "test_segfault_while_save.docx") { // fdo#74499 - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(6137), getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").toInt32()); // tdf#106572 - preventative test matching danger conditions, but imported OK anyway @@ -263,7 +263,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(fdo69656, "Table_cell_auto_width_fdo69656.do // After changes for fdo76741 the fixed width is exported as "dxa" for DOCX // Check for the width type of table and its cells. - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblW","type","dxa"); } @@ -274,7 +274,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo76741, "fdo76741.docx") // - the table alignment in saved file is "left" instead of "center" // - the table width type in properties is "auto" instead of "dxa" - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "//w:jc", "val", "center"); assertXPath(pXmlDoc, "//w:tblW", "w", "10081"); @@ -285,25 +285,25 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73541,"fdo73541.docx") { // fdo#73541: The mirrored margins were not imported and mapped correctly in Page Layout // Hence <w:mirrorMargins /> tag was not exported back in settings.xml - xmlDocPtr pXmlDoc = parseExport("word/settings.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/settings.xml"); assertXPath(pXmlDoc, "/w:settings/w:mirrorMargins"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo106029,"fdo106029.docx") { - xmlDocPtr pXmlDoc = parseExport("word/settings.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/settings.xml"); assertXPath(pXmlDoc, "/w:settings/w:compat/w:doNotExpandShiftReturn"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO74106, "FDO74106.docx") { - xmlDocPtr pXmlDoc = parseExport("word/numbering.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/numbering.xml"); assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:numFmt", "val","hebrew1"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO74215, "FDO74215.docx") { - xmlDocPtr pXmlDoc = parseExport("word/numbering.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/numbering.xml"); // tdf#106849 NumPicBullet xShape should not be resized. // This is dependent on the running system: see MSWordExportBase::BulletDefinitions @@ -339,7 +339,7 @@ DECLARE_OOXMLEXPORT_TEST(testColumnBreak_ColumnCountIsZero,"fdo74153.docx") /* fdo73545: Column Break with Column_count = 0 was not getting preserved. * The <w:br w:type="column" /> was missing after roundtrip */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); if (pXmlDoc) assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/w:br","type","column"); @@ -368,7 +368,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testIndentation, "test_indentation.docx") // fdo#74141 :There was a problem that in style.xml and document.xml in <w:ind> tag "right" & "left" margin // attributes gets added(w:right=0 & w:left=0) if these attributes are not set in original document. // This test is to verify <w:ind> does not contain w:right attribute. - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:ind", "end"); } @@ -377,7 +377,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testChartInFooter, "chart-in-footer.docx") // fdo#73872: document contains chart in footer. // The problem was that footer1.xml.rels files for footer1.xml // files were missing from docx file after roundtrip. - xmlDocPtr pXmlDoc = parseExport("word/_rels/footer1.xml.rels"); + xmlDocUniquePtr pXmlDoc = parseExport("word/_rels/footer1.xml.rels"); // Check footer1.xml.rels contains in doc after roundtrip. // Check Id = rId1 in footer1.xml.rels @@ -387,14 +387,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testChartInFooter, "chart-in-footer.docx") "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"); - xmlDocPtr pXmlDocCT = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDocCT = parseExport("[Content_Types].xml"); assertXPath(pXmlDocCT, "/ContentType:Types/ContentType:Override[@PartName='/word/charts/chart1.xml']", "ContentType", "application/vnd.openxmlformats-officedocument.drawingml.chart+xml"); // check the content too - xmlDocPtr pXmlDocFooter1 = parseExport("word/footer1.xml"); + xmlDocUniquePtr pXmlDocFooter1 = parseExport("word/footer1.xml"); assertXPath(pXmlDocFooter1, "/w:ftr/w:p[1]/w:r/w:drawing/wp:inline/a:graphic/a:graphicData", "uri", @@ -448,7 +448,7 @@ DECLARE_OOXMLEXPORT_TEST(testFloatingTablePosition, "floating-table-position.doc DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAbi11739, "abi11739.docx") { // Validation test: order of elements were wrong. - xmlDocPtr pXmlDoc = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/styles.xml"); // Order was: uiPriority, link, basedOn. CPPUNIT_ASSERT(getXPathPosition(pXmlDoc, "/w:styles/w:style[3]", "basedOn") < getXPathPosition(pXmlDoc, "/w:styles/w:style[3]", "link")); CPPUNIT_ASSERT(getXPathPosition(pXmlDoc, "/w:styles/w:style[3]", "link") < getXPathPosition(pXmlDoc, "/w:styles/w:style[3]", "uiPriority")); @@ -466,7 +466,7 @@ DECLARE_OOXMLEXPORT_TEST(testEmbeddedXlsx, "embedded-xlsx.docx") CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), getShape(2)->getShapeType()); // check the objects are present in the exported document.xml - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/w:object", 2); @@ -494,7 +494,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testNumberedLists_StartingWithZero, "FDO7410 * the Numbered list should start from 0. * Problem was LO was writing <w:start> for all levels 0-8 with default value "1". */ - xmlDocPtr pXmlDoc = parseExport("word/numbering.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/numbering.xml"); // Check that we do _not_ export w:start for <w:lvl w:ilvl="0">. assertXPath(pXmlDoc, "w:numbering/w:abstractNum[1]/w:lvl[1]/w:start", 0); @@ -507,7 +507,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPageBreak,"fdo74566.docx") * Now after fix , LO writes Page Break as the new paragraph and also * preserves the xml tag <w:br>. */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); uno::Reference<text::XTextRange> xParagraph2 = getParagraph(2); uno::Reference<text::XTextRange> xParagraph4 = getParagraph(4); @@ -519,7 +519,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPageBreak,"fdo74566.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOleObject, "test_ole_object.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/w:object/v:shape/v:imagedata", "o:title"); @@ -530,13 +530,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOleObject, "test_ole_object.docx") // TODO: ProgID="Package" - what is this? Zip with 10k extra header? // check the rels too - xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); assertXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.bin']", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"); // check the media type too - xmlDocPtr pXmlDocCT = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDocCT = parseExport("[Content_Types].xml"); assertXPath(pXmlDocCT, "/ContentType:Types/ContentType:Override[@PartName='/word/embeddings/oleObject1.bin']", "ContentType", @@ -551,7 +551,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo74792, "fdo74792.docx") * were not preserved on exporting to DOCX format * Added support to grabbag the rels, with associated images. */ - xmlDocPtr pXmlDoc = parseExport("word/diagrams/_rels/data1.xml.rels"); + xmlDocUniquePtr pXmlDoc = parseExport("word/diagrams/_rels/data1.xml.rels"); if(!pXmlDoc) return; assertXPath(pXmlDoc,"/rels:Relationships/rels:Relationship", 4); @@ -570,11 +570,11 @@ DECLARE_OOXMLEXPORT_TEST(testFdo77718, "fdo77718.docx") //repeated and thereby causing a data loss as the binary stream was //getting over written. This test case ensures that unique names are //given for images in different smart arts. - xmlDocPtr pXmlDataRels1 = parseExport("word/diagrams/_rels/data1.xml.rels"); + xmlDocUniquePtr pXmlDataRels1 = parseExport("word/diagrams/_rels/data1.xml.rels"); if( !pXmlDataRels1 ) return; - xmlDocPtr pXmlDataRels2 = parseExport("word/diagrams/_rels/data2.xml.rels"); + xmlDocUniquePtr pXmlDataRels2 = parseExport("word/diagrams/_rels/data2.xml.rels"); if( !pXmlDataRels2 ) return; @@ -598,7 +598,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo77718, "fdo77718.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTableCurruption, "tableCurrupt.docx") { - xmlDocPtr pXmlDoc = parseExport("word/header2.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/header2.xml"); CPPUNIT_ASSERT(pXmlDoc) ; assertXPath(pXmlDoc, "/w:hdr/w:tbl[1]/w:tr[1]/w:tc[1]",1); @@ -611,7 +611,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTableCurruption, "tableCurrupt.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDateControl, "date-control.docx") { // check XML - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:date", "fullDate", "2014-03-05T00:00:00Z"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:date/w:dateFormat", "val", "dddd, dd' de 'MMMM' de 'yyyy"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:date/w:lid", "val", "es-ES"); @@ -620,7 +620,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDateControl, "date-control.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test_Tdf115030, "tdf115030.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); sal_Unicode aDot = {0x02D9}; sal_Unicode aDobleDot = {0x00A8}; assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/m:oMath[1]/m:acc/m:accPr/m:chr", "val", OUString(aDot)); @@ -630,14 +630,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test_Tdf115030, "tdf115030.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test_OpeningBrace, "2120112713_OpenBrace.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Checking for OpeningBrace tag assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/m:oMath[1]/m:d[1]/m:dPr[1]/m:begChr[1]","val",""); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test_Tdf132305, "tdf132305.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/m:oMath[1]/m:bar/m:barPr/m:pos","val","top"); } @@ -678,7 +678,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test_Tdf132305, "tdf132305.docx") // See, tdf#38778 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf38778, "tdf38778_properties_in_run_for_field.doc") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); const OUString psz("20"); const OUString pszCs("20"); @@ -712,7 +712,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf38778, "tdf38778_properties_in_run_fo DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO76312, "FDO76312.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr[1]/w:tc[1]"); } @@ -720,7 +720,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO76312, "FDO76312.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testComboBoxControl, "combobox-control.docx") { // check XML - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:dropDownList/w:listItem[1]", "value", "manolo"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:dropDownList/w:listItem[2]", "value", "pepito"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r/w:t", "Manolo"); @@ -739,7 +739,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testComboBoxControl, "combobox-control.docx" DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCheckBoxControl, "checkbox-control.docx") { // check XML - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w14:checkbox/w14:checked", "val", "1"); assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w14:checkbox/w14:checkedState", "val", "2612"); assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w14:checkbox/w14:uncheckedState", "val", "2610"); @@ -753,8 +753,8 @@ DECLARE_OOXMLEXPORT_TEST(testParagraphWithComments, "paragraphWithComments.docx" which was causing a mismatch in the relationship for comment id's in document.xml and comment.xml */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); - xmlDocPtr pXmlComm = parseExport("word/comments.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlComm = parseExport("word/comments.xml"); if(!pXmlDoc) return; @@ -783,11 +783,11 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOLEObjectinHeader, "2129393649.docx") // Problem was relationship entry for oleobject from header was // exported into document.xml.rels file because of this rels file // for headers were missing from document/word/rels. - xmlDocPtr pXmlDoc = parseExport("word/_rels/header1.xml.rels"); + xmlDocUniquePtr pXmlDoc = parseExport("word/_rels/header1.xml.rels"); assertXPath(pXmlDoc,"/rels:Relationships/rels:Relationship[1]","Id","rId1"); - xmlDocPtr pXmlDocCT = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDocCT = parseExport("[Content_Types].xml"); // check the media type too assertXPath(pXmlDocCT, @@ -796,12 +796,12 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOLEObjectinHeader, "2129393649.docx") "application/vnd.openxmlformats-officedocument.oleObject"); // check the content too - xmlDocPtr pXmlDocHeader1 = parseExport("word/header1.xml"); + xmlDocUniquePtr pXmlDocHeader1 = parseExport("word/header1.xml"); assertXPath(pXmlDocHeader1, "/w:hdr/w:tbl/w:tr[1]/w:tc[2]/w:p[1]/w:r/w:object/o:OLEObject", "ProgID", "Word.Picture.8"); - xmlDocPtr pXmlDocHeader2 = parseExport("word/header2.xml"); + xmlDocUniquePtr pXmlDocHeader2 = parseExport("word/header2.xml"); assertXPath(pXmlDocHeader2, "/w:hdr/w:tbl/w:tr[1]/w:tc[2]/w:p[1]/w:r/w:object/o:OLEObject", "ProgID", @@ -810,20 +810,20 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOLEObjectinHeader, "2129393649.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test_ClosingBrace, "2120112713.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Checking for ClosingBrace tag assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/m:oMath[1]/m:d[2]/m:dPr[1]/m:endChr[1]","val",""); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testlvlPicBulletId, "lvlPicBulletId.docx") { - xmlDocPtr pXmlDoc = parseExport("word/numbering.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/numbering.xml"); assertXPath(pXmlDoc, "/w:numbering[1]/w:abstractNum[1]/w:lvl[1]/w:lvlPicBulletId[1]", 0); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSdtContent, "SdtContent.docx") { - xmlDocPtr pXmlDoc = parseExport("word/header1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/header1.xml"); assertXPath(pXmlDoc, "/w:hdr[1]/w:sdt[1]/w:sdtContent[1]/w:p[1]/w:del[1]"); } @@ -834,7 +834,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSdtContent, "SdtContent.docx") DECLARE_OOXMLEXPORT_TEST(testFdo76016, "fdo76016.docx") { // check XML - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); if (!pXmlDoc) return; assertXPath(pXmlDoc, "//a:graphic/a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]", "name", "adj1"); @@ -848,7 +848,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFileWithInvalidImageLink, "FileWithInval invalid, then the RT file used to result in corruption since the exported image would be an empty image. */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:drawing[1]/wp:inline[1]/" @@ -858,20 +858,20 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFileWithInvalidImageLink, "FileWithInval DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testContentTypeDOCX, "fdo80410.docx") { - xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml"); assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[@PartName='/word/embeddings/oleObject1.docx']", "ContentType", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"); // check the rels too - xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); assertXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.docx']", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); // check the content too - xmlDocPtr pXmlDocContent = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport("word/document.xml"); assertXPath(pXmlDocContent, "/w:document/w:body/w:p[6]/w:r/w:object/o:OLEObject", "ProgID", @@ -880,18 +880,18 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testContentTypeDOCX, "fdo80410.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testContentTypeXLSM, "fdo76098.docx") { - xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml"); assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[@PartName='/word/embeddings/Microsoft_Excel_Macro-Enabled_Worksheet1.xlsm']", "ContentType", "application/vnd.ms-excel.sheet.macroEnabled.12"); // check the rels too - xmlDocPtr pXmlDocRels = parseExport("word/charts/_rels/chart1.xml.rels"); + xmlDocUniquePtr pXmlDocRels = parseExport("word/charts/_rels/chart1.xml.rels"); assertXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship[@Target='../embeddings/Microsoft_Excel_Macro-Enabled_Worksheet1.xlsm']", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); // check the content too - xmlDocPtr pXmlDocChart1 = parseExport("word/charts/chart1.xml"); + xmlDocUniquePtr pXmlDocChart1 = parseExport("word/charts/chart1.xml"); assertXPath(pXmlDocChart1, "/c:chartSpace/c:externalData", "id", @@ -900,7 +900,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testContentTypeXLSM, "fdo76098.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test76108, "test76108.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); //docx file after RT is getting corrupted. assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/w:fldChar[1]", "fldCharType", "begin"); } @@ -910,7 +910,7 @@ DECLARE_OOXMLEXPORT_TEST(testTCTagMisMatch, "TCTagMisMatch.docx") // TCTagMisMatch.docx : This document contains an empty table with borders. // there was a TC tag mismatch which resulted into a crash. - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); if(!pXmlDoc) return; assertXPath(pXmlDoc,"/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tbl[1]/w:tr[1]/w:tc[1]",0); @@ -920,13 +920,13 @@ DECLARE_OOXMLEXPORT_TEST(testTCTagMisMatch, "TCTagMisMatch.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78292, "FDO78292.docx") { //text node is a leaf node, it should not have any children - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc,"/w:document/w:body/w:p[14]/w:sdt[3]/w:sdtPr[1]/w:text/w14:checked",0); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSimpleSdts, "simple-sdts.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:text", 1); assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:id", 3); @@ -937,7 +937,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSimpleSdts, "simple-sdts.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testEmbeddedExcelChart, "EmbeddedExcelChart.docx") { - xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml"); assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[@PartName='/word/embeddings/oleObject1.xls']", @@ -945,14 +945,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testEmbeddedExcelChart, "EmbeddedExcelChart. "application/vnd.ms-excel"); // check the rels too - xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); assertXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.xls']", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"); // check the content too - xmlDocPtr pXmlDocContent = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport("word/document.xml"); assertXPath(pXmlDocContent, "/w:document/w:body/w:p/w:r/w:object/o:OLEObject", "ProgID", @@ -986,7 +986,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103001, "tdf103001.docx") DECLARE_OOXMLEXPORT_TEST(testTdf92521, "tdf92521.odt") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) // There should be a section break that's in the middle of the document: right after the table. assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:sectPr", 1); } @@ -996,7 +996,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf102466, "tdf102466.docx") // the problem was: file is truncated: the first page is missing. // More precisely, the table in the first page was clipped. { - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nFlyPrtHeight = getXPath(pXmlDoc, "(/root/page[1]//fly)[1]/infos/prtBounds", "height").toInt32(); sal_Int32 nTableHeight = getXPath(pXmlDoc, "(/root/page[1]//fly)[1]/tab/infos/bounds", "height").toInt32(); CPPUNIT_ASSERT_MESSAGE("The table is clipped in a fly frame.", nFlyPrtHeight >= nTableHeight); @@ -1032,7 +1032,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf102466, "tdf102466.docx") DECLARE_OOXMLEXPORT_TEST(testTdf99090_pgbrkAfterTable, "tdf99090_pgbrkAfterTable.docx") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) // There should be a regular page break that's in the middle of the document: right after the table. assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:br", 1); } @@ -1137,7 +1137,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf81345_045Original,"tdf81345.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDocxTablePosition, "floating-table-position.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // the exported positions were wrong due to some missing shifting in the export code assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblpPr", "tblpX", "3494"); @@ -1147,7 +1147,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDocxTablePosition, "floating-table-posit DECLARE_OOXMLEXPORT_TEST(testUnderlineGroupShapeText, "tdf123351_UnderlineGroupSapeText.docx") { // tdf#123351: Check if correct underline is used. - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; @@ -1201,7 +1201,7 @@ DECLARE_OOXMLEXPORT_TEST(testUnderlineGroupShapeText, "tdf123351_UnderlineGroupS DECLARE_OOXMLEXPORT_TEST(testUnderlineColorGroupedShapes, "tdf132491_UnderlineColorGroupedShapes.docx") { // tdf#132491 : Check if correct color is used for underline. - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor" diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 534eb7f34f0f..a8e4f3d5fc5b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -47,7 +47,7 @@ protected: DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO76248, "FDO76248.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // In two cases the a:graphicData elements had no children, which is invalid. assertXPath(pXmlDoc, "//a:graphicData[not(*)]", 0); } @@ -98,7 +98,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo76589 , "fdo76589.docx") * w:val of w:lvlText was empty. * It should be <w:lvlText w:val="%1" /> */ - xmlDocPtr pXmlDoc = parseExport("word/numbering.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/numbering.xml"); assertXPath ( pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:lvlText","val","%1" ); } @@ -106,7 +106,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo76589 , "fdo76589.docx") DECLARE_OOXMLEXPORT_TEST(testDecimalNumberingNoLeveltext, "decimal-numbering-no-leveltext.docx") { // This was "%1", not empty: we turned a kind-of-none numbering into a decimal one. - if (xmlDocPtr pXmlDoc = parseExport("word/numbering.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/numbering.xml")) assertXPath (pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:lvlText","val", ""); } @@ -131,7 +131,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79008, "fdo79008.docx") DECLARE_OOXMLEXPORT_TEST(testTdf120852_readOnlyProtection, "tdf120852_readOnlyProtection.docx") { - if (xmlDocPtr pXmlSettings = parseExport("word/settings.xml")) + if (xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml")) { assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "enforcement", "1"); assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "edit", "readOnly"); @@ -164,7 +164,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf120852_readOnlyUnProtected, "tdf120852_readOnlyU else { CPPUNIT_ASSERT_MESSAGE("Section is protected", getProperty<bool>(xSect, "IsProtected")); - xmlDocPtr pXmlSettings = parseExport("word/settings.xml"); + xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml"); assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "edit", "forms"); assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "enforcement", "true"); } @@ -172,7 +172,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf120852_readOnlyUnProtected, "tdf120852_readOnlyU DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAuthorPropertySdt, "author-property.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:dataBinding", "xpath", "/ns1:coreProperties[1]/ns0:creator[1]"); assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:dataBinding", "storeItemID","{6C3C8BC8-F283-45AE-878A-BAB7291924A1}"); @@ -188,7 +188,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO76586, "fdo76586.docx") * while there are two cells in a table row. * So the table was not imported with the correct cell widths */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // there is only one table in the test file assertXPath(pXmlDoc, "//w:tblGrid/w:gridCol[1]", "w", "1601"); @@ -197,7 +197,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO76586, "fdo76586.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO76587 , "fdo76587.docx") { - xmlDocPtr pXmlDoc = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/styles.xml"); assertXPath(pXmlDoc, "/w:styles/w:style[8]/w:pPr/w:spacing", "line", "240"); assertXPath(pXmlDoc, "/w:styles/w:style[8]/w:pPr/w:spacing", "lineRule", "auto"); } @@ -209,14 +209,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO77890 , "fdo77890.docx") if the different first page is set for the pages in the document. For additional comments please refer to https://www.libreoffice.org/bugzilla/show_bug.cgi?id=77890#c2 */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:br", "type", "page"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testNumberedList,"NumberedList.docx") { //fdo74150:In document.xml, for pStyle = "NumberedList1", iLvl and numId was not preserved - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr[1]/w:pStyle", "val", "NumberedList1"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr[1]/w:numPr/w:ilvl","val", "0"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr[1]/w:numPr/w:numId","val", "0"); @@ -229,7 +229,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testNumberedList,"NumberedList.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf131819, "NumberedList.docx") { // keep width of fixed size cells in the nested table - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // These were 4030 and 4249. assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblGrid/w:gridCol[1]", "w", "3841"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblGrid/w:gridCol[2]", "w", "4049"); @@ -238,7 +238,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf131819, "NumberedList.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf131959, "NumberedList.docx") { // import tblInd from table style - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // These were 0. assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblInd", "w", "360"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblInd", "w", "360"); @@ -247,14 +247,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf131959, "NumberedList.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO76597, "fdo76597.docx") { // check XML - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:pPr/w:spacing", "before", "96"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:pPr/w:spacing", "after", "120"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testContentTypeTIF, "fdo77476.docx") { - xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml"); assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[@ContentType='image/tiff']", "PartName", "/word/media/image1.tif"); } @@ -269,7 +269,7 @@ DECLARE_OOXMLEXPORT_TEST(testFDO77117, "fdo77117.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFloatingTable, "fdo77887.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblpPr[1]", "horzAnchor", "margin"); assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblpPr[1]", "leftFromText", "141"); @@ -284,7 +284,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFloatingTable, "fdo77887.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOldComplexMergeRight, "tdf90681-1.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[2]/w:tcPr/w:vMerge", "val", "restart"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[2]/w:tcPr/w:vMerge", "val", "continue"); @@ -294,7 +294,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOldComplexMergeRight, "tdf90681-1.odt") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOldComplexMergeleft, "tdf90681-2.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:vMerge", "val", "restart"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:vMerge", "val", "continue"); @@ -312,7 +312,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testHyperlinkContainingPlaceholderField, "hy DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTablePreferredWidth, "tablePreferredWidth.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Problem :If the table preferred width is in percent, then after RT it changes to 0 & width type changes // to 'auto' instead of 'pct'. @@ -322,7 +322,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTablePreferredWidth, "tablePreferredWidt DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO75431, "fdo75431.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "//w:tbl", 2); assertXPath(pXmlDoc, "//w:p/w:pPr/w:sectPr/w:type", "val", "nextPage"); @@ -330,7 +330,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO75431, "fdo75431.docx") DECLARE_OOXMLEXPORT_TEST(testFDO77725, "fdo77725.docx") { - xmlDocPtr pXmlFootnotes = parseExport("word/footnotes.xml"); + xmlDocUniquePtr pXmlFootnotes = parseExport("word/footnotes.xml"); if (!pXmlFootnotes) return; @@ -353,7 +353,7 @@ DECLARE_OOXMLEXPORT_TEST(testFieldRotation, "field-rotated.fodt") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFootnoteSeparator, "footnotesep.fodt") { // footnote separator definitions - taken from default page style - xmlDocPtr pXmlFootnotes = parseExport("word/footnotes.xml"); + xmlDocUniquePtr pXmlFootnotes = parseExport("word/footnotes.xml"); assertXPath(pXmlFootnotes, "/w:footnotes[1]/w:footnote[1]", "id", "0"); assertXPath(pXmlFootnotes, "/w:footnotes[1]/w:footnote[1]", "type", "separator"); assertXPath(pXmlFootnotes, "/w:footnotes[1]/w:footnote[1]/w:p[1]/w:r[1]/w:separator", 0); @@ -364,19 +364,19 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFootnoteSeparator, "footnotesep.fodt") assertXPath(pXmlFootnotes, "/w:footnotes[1]/w:footnote[2]/w:p[1]/w:r[1]/w:continuationSeparator", 0); assertXPath(pXmlFootnotes, "/w:footnotes[1]/w:footnote[2]/w:p[1]/w:pPr[1]/w:rPr[1]/w:sz", "val", "12"); - xmlDocPtr pXmlSettings = parseExport("word/settings.xml"); + xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml"); assertXPath(pXmlSettings, "/w:settings[1]/w:footnotePr[1]/w:footnote[1]", "id", "0"); assertXPath(pXmlSettings, "/w:settings[1]/w:footnotePr[1]/w:footnote[2]", "id", "1"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf121441, "tdf121441.docx") { - xmlDocPtr pXmlFootnotes = parseExport("word/footnotes.xml"); + xmlDocUniquePtr pXmlFootnotes = parseExport("word/footnotes.xml"); assertXPath(pXmlFootnotes, "/w:footnotes/w:footnote[3]/w:p/w:r[1]/w:rPr/w:rStyle", 1); assertXPath(pXmlFootnotes, "/w:footnotes/w:footnote[3]/w:p/w:r[2]/w:rPr/w:rStyle", 0); assertXPath(pXmlFootnotes, "/w:footnotes/w:footnote[3]/w:p/w:r[2]/w:rPr/w:rFonts", 0); - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:rPr/w:rFonts", "eastAsia", "Symbol"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:rPr/w:rFonts", "cs", "Symbol"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:rPr/w:rFonts", "ascii", "Symbol"); @@ -388,7 +388,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO77812, "fdo77812.docx") /* Additional sectPr was getting inserted and hence Column properties * were getting added into this additional sectPr instead of Default setPr. */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Check no additional section break is inserted. assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:pPr/w:sectPr", 0); @@ -401,7 +401,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO77812, "fdo77812.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testContentTypeOLE, "fdo77759.docx") { - xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml"); assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']", @@ -409,13 +409,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testContentTypeOLE, "fdo77759.docx") "/word/embeddings/oleObject1.xlsx"); // check the rels too - xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); assertXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.xlsx']", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); // check the content too - xmlDocPtr pXmlDocContent = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport("word/document.xml"); assertXPath(pXmlDocContent, "/w:document/w:body/w:p[1]/w:r/w:object/o:OLEObject", "ProgID", @@ -424,12 +424,12 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testContentTypeOLE, "fdo77759.docx") DECLARE_OOXMLEXPORT_TEST(testfdo78420, "fdo78420.docx") { - xmlDocPtr pXmlHeader = parseExport("word/header2.xml"); + xmlDocUniquePtr pXmlHeader = parseExport("word/header2.xml"); if (!pXmlHeader) return; - xmlDocPtr pXmlHeaderRels = parseExport("word/_rels/header2.xml.rels"); + xmlDocUniquePtr pXmlHeaderRels = parseExport("word/_rels/header2.xml.rels"); if(!pXmlHeaderRels) return; @@ -442,14 +442,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPageBreakInFirstPara,"fdo77727.docx") /* Break to next page was not exported if it is in first paragraph of the section. * Now after fix , LO writes Next Page Break and also preserves <w:br> tag. */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[2]/w:br","type","page"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78284, "fdo78284.docx") { - xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml"); assertXPath(pXmlDoc,"/ContentType:Types/ContentType:Override[@PartName='/word/media/OOXDiagramDataRels1_0.png']", "ContentType", "image/png"); @@ -457,13 +457,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78284, "fdo78284.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78384,"fdo78384.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w:rFonts","ascii","Wingdings"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo78469, "fdo78469.docx") { - xmlDocPtr pXmlDoc = parseExport("word/header1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/header1.xml"); // make sure dataBinding & text tags not present in sdtcontent assertXPath(pXmlDoc, "/w:hdr[1]/w:tbl[1]/w:tr[1]/w:tc[2]/w:p[1]/w:sdt[2]/w:sdtPr[1]/w:dataBinding[1]",0); assertXPath(pXmlDoc, "/w:hdr[1]/w:tbl[1]/w:tr[1]/w:tc[2]/w:p[1]/w:sdt[2]/w:sdtPr[1]/w:text[1]",0); @@ -471,7 +471,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo78469, "fdo78469.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78887, "fdo78887.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/w:br[1]", 1); assertXPathContent(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/w:t[1]", "Lyrics: "); @@ -480,7 +480,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78887, "fdo78887.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78887b, "missing_newline.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[2]/w:br[1]", 1); assertXPathContent(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/w:t[1]", "Tab and line break"); @@ -490,14 +490,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78887b, "missing_newline.odt") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo78651, "fdo78651.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // ensure that there are only two tables assertXPath(pXmlDoc, "//w:tbl", 2); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo78882, "fdo78882.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Ensure that Section Break is getting written inside second paragraph assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[2]/w:pPr[1]/w:sectPr[1]",1); @@ -512,7 +512,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo76934, "fdo76934.docx") * preserve it. */ - xmlDocPtr pXmlDoc = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/styles.xml"); // Ensure that after fix LO is preserving AutoSpacing property in styles.xml assertXPath ( pXmlDoc, "/w:styles[1]/w:style[@w:styleId='Title']/w:pPr[1]/w:spacing[1]", "beforeAutospacing", "1" ); @@ -525,7 +525,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79540, "fdo79540.docx") * MS Office does not allow nesting of drawing tags. */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Ensure that two separate w:drawing tags are written and they are not nested. assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing", 1); @@ -534,12 +534,12 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79540, "fdo79540.docx") DECLARE_OOXMLEXPORT_TEST(testFDO79062, "fdo79062.docx") { - xmlDocPtr pXmlFootNotes = parseExport("word/footnotes.xml"); + xmlDocUniquePtr pXmlFootNotes = parseExport("word/footnotes.xml"); if (!pXmlFootNotes) return; assertXPath(pXmlFootNotes, "/w:footnotes", "Ignorable", "w14 wp14"); - xmlDocPtr pXmlEndNotes = parseExport("word/endnotes.xml"); + xmlDocUniquePtr pXmlEndNotes = parseExport("word/endnotes.xml"); if (!pXmlEndNotes) return; assertXPath(pXmlEndNotes, "/w:endnotes", "Ignorable", "w14 wp14"); @@ -581,7 +581,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79668,"fdo79668.docx") { // fdo#79668: Document was Crashing on DebugUtil build while Saving // because of repeated attribute value in same element. - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // w:pPr's w:shd attributes were getting added to w:pPrChange/w:pPr's w:shd hence checking // w:fill for both shd elements assertXPath ( pXmlDoc, "/w:document/w:body/w:p[9]/w:pPr/w:shd", "fill", "FFFFFF" ); @@ -590,10 +590,10 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79668,"fdo79668.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo78907,"fdo78907.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:r[2]/w:br", "type", "page" ); - xmlDocPtr pXmlDoc1 = parseExport("word/footer1.xml"); + xmlDocUniquePtr pXmlDoc1 = parseExport("word/footer1.xml"); if (!pXmlDoc1) return; assertXPath ( pXmlDoc1, "/w:ftr[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tbl", 0 ); @@ -601,7 +601,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo78907,"fdo78907.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(tdf118702,"tdf118702.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:sectPr/w:type", "val", "nextPage" ); assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:sectPr/w:pgSz", "orient", "landscape" ); } @@ -616,14 +616,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79822, "fdo79822.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO79915, "fdo79915.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[10]/w:t", "How much buoyancy does the water provide?"); } DECLARE_OOXMLEXPORT_TEST(testfdo79817, "fdo79817.docx") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:dataBinding", "storeItemID", "{9222E47B-A68B-4AEB-9855-21C912B9D3D2}"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:dataBinding", "xpath", "/ns0:properties[1]/documentManagement[1]/ns2:Responsible_x0020_Officer_x0020_Title[1]"); @@ -634,7 +634,7 @@ DECLARE_OOXMLEXPORT_TEST(testfdo79817, "fdo79817.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79968_sldx, "fdo79968.docx") { // This UT for DOCX embedded with powerpoint slide - xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml"); assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.openxmlformats-officedocument.presentationml.slide']", @@ -642,13 +642,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79968_sldx, "fdo79968.docx") "/word/embeddings/oleObject1.sldx"); // check the rels too - xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); assertXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.sldx']", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); // check the content too - xmlDocPtr pXmlDocContent = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport("word/document.xml"); assertXPath(pXmlDocContent, "/w:document/w:body/w:p[1]/w:r/w:object/o:OLEObject", "ProgID", @@ -658,7 +658,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79968_sldx, "fdo79968.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79969_xlsb, "fdo79969_xlsb.docx") { // This UT for DOCX embedded with binary excel work sheet. - xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml"); assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.ms-excel.sheet.binary.macroEnabled.12']", @@ -666,13 +666,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79969_xlsb, "fdo79969_xlsb.docx") "/word/embeddings/oleObject1.xlsb"); // check the rels too - xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); assertXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.xlsb']", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); // check the content too - xmlDocPtr pXmlDocContent = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport("word/document.xml"); assertXPath(pXmlDocContent, "/w:document/w:body/w:p[1]/w:r/w:object/o:OLEObject", "ProgID", @@ -683,7 +683,7 @@ DECLARE_OOXMLEXPORT_TEST(testfdo80097, "fdo80097.docx") { //fdo#76635 : Table borders are not getting preserved. - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; @@ -706,7 +706,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf95033, "tdf95033.docx") { //tdf#95033 : Table borders defined by row-level tblPrEx are not getting preserved. - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; @@ -722,7 +722,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf95033, "tdf95033.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128646, "tdf128646.docx") { // The problem was that not hidden shapes anchored to empty hidden paragraphs were imported as hidden. - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc,"/w:document/w:body/w:tbl/w:tr/w:tc/w:p[7]/w:pPr/w:rPr/w:vanish", 1); if (!mbExported) @@ -737,7 +737,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf119800, "tdf119800.docx") { // The problem was that not hidden shapes anchored to empty hidden paragraphs were imported as hidden. // (tdf#128646 solved the same only for table paragraphs) - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc,"/w:document/w:body/w:p[2]/w:pPr/w:rPr/w:vanish", 1); if (!mbExported) @@ -751,7 +751,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf119800, "tdf119800.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo77129, "fdo77129.docx") { // The problem was that text after TOC field was missing if footer reference comes in field. - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Data was lost from this paragraph. assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[4]/w:r[1]/w:t", "Abstract"); @@ -787,7 +787,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf129402, "fdo77129.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79969_xlsm, "fdo79969_xlsm.docx") { // This UT for DOCX embedded with excel work sheet. - xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml"); assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.ms-excel.sheet.macroEnabled.12']", @@ -795,13 +795,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79969_xlsm, "fdo79969_xlsm.docx") "/word/embeddings/oleObject1.xlsm"); // check the rels too - xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); assertXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.xlsm']", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); // check the content too - xmlDocPtr pXmlDocContent = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport("word/document.xml"); assertXPath(pXmlDocContent, "/w:document/w:body/w:p[1]/w:r/w:object/o:OLEObject", "ProgID", @@ -810,7 +810,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79969_xlsm, "fdo79969_xlsm.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80522,"fdo80522.docx") { - xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml"); assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.ms-word.document.macroEnabled.12']", @@ -818,13 +818,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80522,"fdo80522.docx") "/word/embeddings/oleObject1.docm"); // check the rels too - xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); assertXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.docm']", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); // check the content too - xmlDocPtr pXmlDocContent = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport("word/document.xml"); assertXPath(pXmlDocContent, "/w:document/w:body/w:p[1]/w:r/w:object/o:OLEObject", "ProgID", @@ -833,7 +833,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80522,"fdo80522.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80523_pptm,"fdo80523_pptm.docx") { - xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml"); assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.ms-powerpoint.presentation.macroEnabled.12']", @@ -841,13 +841,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80523_pptm,"fdo80523_pptm.docx") "/word/embeddings/oleObject1.pptm"); // check the rels too - xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); assertXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.pptm']", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); // check the content too - xmlDocPtr pXmlDocContent = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport("word/document.xml"); assertXPath(pXmlDocContent, "/w:document/w:body/w:p[1]/w:r/w:object/o:OLEObject", "ProgID", @@ -856,7 +856,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80523_pptm,"fdo80523_pptm.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80523_sldm,"fdo80523_sldm.docx") { - xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml"); assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.ms-powerpoint.slide.macroEnabled.12']", @@ -864,13 +864,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80523_sldm,"fdo80523_sldm.docx") "/word/embeddings/oleObject1.sldm"); // check the rels too - xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); assertXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.sldm']", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); // check the content too - xmlDocPtr pXmlDocContent = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport("word/document.xml"); assertXPath(pXmlDocContent, "/w:document/w:body/w:p[1]/w:r/w:object/o:OLEObject", "ProgID", @@ -880,7 +880,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80523_sldm,"fdo80523_sldm.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80898, "fdo80898.docx") { // This UT for DOCX embedded with binary excel work sheet. - xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml"); assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[@ContentType='application/msword']", @@ -888,13 +888,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80898, "fdo80898.docx") "/word/embeddings/oleObject1.doc"); // check the rels too - xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); assertXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.doc']", "Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"); // check the content too - xmlDocPtr pXmlDocContent = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocContent = parseExport("word/document.xml"); assertXPath(pXmlDocContent, "/w:document/w:body/w:p[1]/w:r/w:object/o:OLEObject", "ProgID", @@ -905,7 +905,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTableCellWithDirectFormatting, "fdo80800 { // Issue was Direct Formatting for non-first Table cells was not getting preserved. - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Ensure that for Third Table cell Direct Formatting is preserved. // In file, Direct Formatting used for Third Table cell is Line Spacing="1.5 lines" @@ -981,7 +981,7 @@ DECLARE_OOXMLEXPORT_TEST(test2colHeader, "2col-header.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo83048, "fdo83048.docx") { // Issue was wrong SDT properties were getting exported for Date SDT - xmlDocPtr pXmlDoc = parseExport("word/footer1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/footer1.xml"); // Make sure Date is inside SDT tag. // This will happen only if right SDT properties are exported. @@ -991,7 +991,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo83048, "fdo83048.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSdt2Run, "sdt-2-run.docx") { - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); // The problem was that <w:sdt> was closed after "first", not after "second", so the second assert failed. assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r[1]/w:t", "first"); @@ -1002,7 +1002,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSdt2Run, "sdt-2-run.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFD083057, "fdo83057.docx") { - xmlDocPtr pXmlDoc = parseExport("word/header1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/header1.xml"); // A fly frame was attached to a para which started with a hint (run) containing an SDT. // This SDT was handled while exporting the FLYFRAME and also the text of the run. @@ -1016,7 +1016,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFD083057, "fdo83057.docx") DECLARE_OOXMLEXPORT_TEST(testHeaderBorder, "header-border.docx") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { // This was 0, as header margin was lost during import. assertXPath(pXmlDoc, "//w:pgMar", "header", "720"); @@ -1043,20 +1043,20 @@ DECLARE_OOXMLEXPORT_TEST(testImageNoborder, "image-noborder.docx") DECLARE_OOXMLEXPORT_TEST(testTdf89774, "tdf89774.fodt") { - if (xmlDocPtr pXmlDoc = parseExport("docProps/app.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("docProps/app.xml")) // This was 65, as unit was seconds instead of minutes. assertXPathContent(pXmlDoc, "/extended-properties:Properties/extended-properties:TotalTime", "1"); } DECLARE_OOXMLEXPORT_TEST(testSectionProtection, "sectionprot.odt") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:sectPr/w:formProt", "val", "true"); assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:formProt", "val", "false"); } - if (xmlDocPtr pXmlSettings = parseExport("word/settings.xml")) + if (xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml")) { assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "enforcement", "true"); assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "edit", "forms"); @@ -1072,7 +1072,7 @@ DECLARE_OOXMLEXPORT_TEST(testSectionProtection, "sectionprot.odt") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSectionProtection2, "sectionprot2.odt") { - if (xmlDocPtr pXmlSettings = parseExport("word/settings.xml")) + if (xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml")) { assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "enforcement", "true"); assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "edit", "forms"); @@ -1087,7 +1087,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSectionProtection2, "sectionprot2.odt") DECLARE_OOXMLEXPORT_TEST(tdf66398_permissions, "tdf66398_permissions.docx") { // check document permission settings for the whole document - if (xmlDocPtr pXmlSettings = parseExport("word/settings.xml")) + if (xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml")) { assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "edit", "readOnly"); assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "enforcement", "1"); @@ -1114,7 +1114,7 @@ DECLARE_OOXMLEXPORT_TEST(tdf66398_permissions, "tdf66398_permissions.docx") DECLARE_OOXMLEXPORT_TEST(tdf106843, "tdf106843.fodt") { // check Track Changes permission set in Writer/OpenDocument (password: "test", encoded by default encoding of Writer) - if (xmlDocPtr pXmlSettings = parseExport("word/settings.xml")) + if (xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml")) { assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "edit", "trackedChanges"); assertXPath(pXmlSettings, "/w:settings/w:documentProtection", "enforcement", "1"); @@ -1130,7 +1130,7 @@ DECLARE_OOXMLEXPORT_TEST(tdf106843, "tdf106843.fodt") DECLARE_OOXMLEXPORT_TEST(tdf89991_revisionView, "tdf89991.docx") { // check revisionView (Show Changes) import and export - if (xmlDocPtr pXmlSettings = parseExport("word/settings.xml")) + if (xmlDocUniquePtr pXmlSettings = parseExport("word/settings.xml")) { assertXPath(pXmlSettings, "/w:settings/w:revisionView", "insDel", "0"); assertXPath(pXmlSettings, "/w:settings/w:revisionView", "formatting", "0"); @@ -1167,7 +1167,7 @@ DECLARE_OOXMLEXPORT_TEST(tdf122201_editUnprotectedText, "tdf122201_editUnprotect DECLARE_OOXMLEXPORT_TEST(testSectionHeader, "sectionprot.odt") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { // this test must not be zero assertXPath(pXmlDoc, "//w:headerReference", 2); @@ -1176,13 +1176,13 @@ DECLARE_OOXMLEXPORT_TEST(testSectionHeader, "sectionprot.odt") DECLARE_OOXMLEXPORT_TEST(testOO47778_1, "ooo47778-3.odt") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) assertXPathContent(pXmlDoc, "(//w:t)[3]", "c"); } DECLARE_OOXMLEXPORT_TEST(testOO47778_2, "ooo47778-4.odt") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) assertXPathContent(pXmlDoc, "(//w:t)[4]", "c"); // tdf116436: The problem was that the table background was undefined, not white. @@ -1195,25 +1195,25 @@ DECLARE_OOXMLEXPORT_TEST(testOO47778_2, "ooo47778-4.odt") DECLARE_OOXMLEXPORT_TEST(testOO67471, "ooo67471-2.odt") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) assertXPathContent(pXmlDoc, "(//w:t)[2]", "B"); } DECLARE_OOXMLEXPORT_TEST(testKDE302504, "kde302504-1.odt") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) assertXPath(pXmlDoc, "//v:shape", "ID", "KoPathShape"); } DECLARE_OOXMLEXPORT_TEST(testKDE216114, "kde216114-1.odt") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) assertXPath(pXmlDoc, "//w:pict", 1); } DECLARE_OOXMLEXPORT_TEST(testOO72950, "ooo72950-1.odt") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) assertXPath(pXmlDoc, "//w:tbl", 1); } @@ -1222,7 +1222,7 @@ DECLARE_OOXMLEXPORT_TEST(testOO72950, "ooo72950-1.odt") //considered the same table DECLARE_OOXMLEXPORT_TEST(fdo60957, "fdo60957-2.docx") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) assertXPath(pXmlDoc, "//w:tbl", 2); } @@ -1230,7 +1230,7 @@ DECLARE_OOXMLEXPORT_TEST(fdo60957, "fdo60957-2.docx") //number of cell start and ends DECLARE_OOXMLEXPORT_TEST(testOO106020, "ooo106020-1.odt") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) assertXPath(pXmlDoc, "//w:tbl", 1); } @@ -1247,7 +1247,7 @@ DECLARE_OOXMLEXPORT_TEST(testSpacingGroupShapeText, "tdf131775_SpacingGroupShape { // tdf#131775: Check if correct spacing. - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index e262303d1dee..4bfa75ed28eb 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -49,14 +49,14 @@ DECLARE_OOXMLEXPORT_TEST(testDmlShapeTitle, "dml-shape-title.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDmlZorder, "dml-zorder.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // This was "0": causing that in Word, the second shape was on top, while in the original odt the first shape is on top. assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor", "relativeHeight", "2"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDmlShapeRelsize, "dml-shape-relsize.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Relative size wasn't exported all, then relativeFrom was "page", not "margin". assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp14:sizeRelH", "relativeFrom", "margin"); } @@ -74,7 +74,7 @@ DECLARE_OOXMLEXPORT_TEST(testDmlPictureInTextframe, "dml-picture-in-textframe.do DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDmlGroupshapeRelsize, "dml-groupshape-relsize.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Relative size wasn't imported. assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp14:sizeRelH", "relativeFrom", "margin"); } @@ -89,7 +89,7 @@ DECLARE_OOXMLEXPORT_TEST(testDmlTextshape, "dml-textshape.docx") // This was drawing::LineStyle_NONE. CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID, getProperty<drawing::LineStyle>(xShape, "LineStyle")); - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; // This was wrap="none". @@ -110,7 +110,7 @@ DECLARE_OOXMLEXPORT_TEST(testDmlTextshape, "dml-textshape.docx") DECLARE_OOXMLEXPORT_TEST(testDmlTextshapeB, "dml-textshapeB.docx") { uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY); - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; @@ -349,7 +349,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDMLGradientFillTheme, "dml-gradientfill- // not just the theme was written out but the explicit values too // Besides the duplication of values it causes problems with writing out // <a:schemeClr val="phClr"> into document.xml, while phClr can be used just for theme definitions. - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // check no explicit gradFill has been exported assertXPath(pXmlDoc, @@ -438,27 +438,27 @@ DECLARE_OOXMLEXPORT_TEST(testTableFloatingMargins, "table-floating-margins.docx" if (!mbExported) return; // Paragraph bottom margin wasn't 0 in the A1 cell of the floating table. - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "after", "0"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf127814, "tdf127814.docx") { // Paragraph top margin was 0 in a table started on a new page - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "before", "0"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128752, "tdf128752.docx") { // Paragraph bottom margin was 200, docDefault instead of table style setting - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "after", "0"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf119054, "tdf119054.docx") { - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); // Don't overwrite before and after spacing of Heading2 by table style. // Heading2 overrides table style's values from DocDefaults. assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "before", "0"); @@ -469,14 +469,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf119054, "tdf119054.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf131258, "tdf131258.docx") { - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); // Use table style based bottom margin instead of the docDefaults in empty tables, too assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "after", "0"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf132514, "tdf132514.docx") { - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); // Keep table style setting, when the footer also contain a table assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[2]/w:p[2]/w:pPr/w:spacing", "before", "0"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[2]/w:p[2]/w:pPr/w:spacing", "after", "0"); @@ -489,7 +489,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo69636, "fdo69636.docx") * importer, regarding the btLr text frame direction: the * mso-layout-flow-alt property was completely missing in the output. */ - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); // VML 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")); // drawingML @@ -500,7 +500,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testVMLData, "TestVMLData.docx") { // The problem was exporter was exporting vml data for shape in w:rPr element. // vml data should not come under w:rPr element. - xmlDocPtr pXmlDoc = parseExport("word/header2.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/header2.xml"); CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape", "stroked").match("f")); } @@ -508,7 +508,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testImageData, "image_data.docx") { // The problem was exporter was exporting v:imagedata data for shape in w:pict as v:fill w element. - xmlDocPtr pXmlDoc = parseExport("word/header2.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/header2.xml"); CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape/v:imagedata", "detectmouseclick").match("t")); } @@ -517,7 +517,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo70838, "fdo70838.docx") // The problem was that VMLExport::Commit didn't save the correct width and height, // and ImplEESdrWriter::ImplFlipBoundingBox made a mistake calculating the position - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; @@ -640,7 +640,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo70838, "fdo70838.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73215, "fdo73215.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // 'rect' was 'pictureFrame', which isn't valid. 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", "prst", "rect"); @@ -651,7 +651,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73215, "fdo73215.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testBehinddoc, "behinddoc.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // This was "0", shape was in the foreground. assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor", "behindDoc", "1"); } @@ -665,7 +665,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSmartArtAnchoredInline, "fdo73227.docx") * all 3 DrawingML objects in a document. */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing[1]/wp:anchor/wp:docPr","id","1"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing[1]/wp:anchor/wp:docPr","name","Diagram1"); @@ -679,13 +679,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSmartArtAnchoredInline, "fdo73227.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo65833, "fdo65833.docx") { // The "editas" attribute for vml group shape was not preserved. - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:group", "editas", "canvas"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73247, "fdo73247.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); 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", "rot", "1969200"); @@ -693,7 +693,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73247, "fdo73247.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo70942, "fdo70942.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); 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", "prst", "ellipse"); } @@ -701,7 +701,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo70942, "fdo70942.docx") DECLARE_OOXMLEXPORT_TEST(testDrawinglayerPicPos, "drawinglayer-pic-pos.docx") { // The problem was that the position of the picture was incorrect, it was shifted towards the bottom right corner. - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; @@ -714,7 +714,7 @@ DECLARE_OOXMLEXPORT_TEST(testDrawinglayerPicPos, "drawinglayer-pic-pos.docx") DECLARE_OOXMLEXPORT_TEST(testShapeThemePreservation, "shape-theme-preservation.docx") { - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; @@ -825,13 +825,13 @@ DECLARE_OOXMLEXPORT_TEST(testShapeThemePreservation, "shape-theme-preservation.d DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO73546, "FDO73546.docx") { - xmlDocPtr pXmlDoc = parseExport("word/header1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/header1.xml"); assertXPath(pXmlDoc, "/w:hdr/w:p[1]/w:r[3]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor", "distL","0"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo69616, "fdo69616.docx") { - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); // VML 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")); } @@ -840,7 +840,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlignForShape,"Shape.docx") { //fdo73545:Shape Horizontal and vertical orientation is wrong //The wp:align tag is missing after roundtrip - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/wp:positionH/wp:align"); } @@ -850,7 +850,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testLineStyle_DashType, "LineStyle_DashType. /* DOCX contatining Shape with LineStyle as Dash Type should get preserved inside * an XML tag <a:prstDash> with value "dash", "sysDot", "lgDot", etc. */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[7]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", "val", "lgDashDotDot"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[6]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", "val", "lgDashDot"); @@ -863,7 +863,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testLineStyle_DashType, "LineStyle_DashType. DECLARE_OOXMLEXPORT_TEST(testGradientFillPreservation, "gradient-fill-preservation.docx") { - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; @@ -905,7 +905,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testLineStyle_DashType_VML, "LineStyle_DashT /* DOCX contatining "Shape with text inside" having Line Style as "Dash Type" should get * preserved inside an XML tag <v:stroke> with attribute dashstyle having value "dash". */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[1]/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:stroke", "dashstyle", "dash"); } @@ -917,7 +917,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo74110,"fdo74110.docx") The actual shape type(s) has/have adjustment value(s) where as rect does not have adjustment value. Hence the following test case. */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); 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]", "prst", "rect"); 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); @@ -925,13 +925,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo74110,"fdo74110.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOuterShdw,"testOuterShdw.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); 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", "1041400"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testExtentValue, "fdo74605.docx") { - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); sal_Int32 nX = getXPath(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").toInt32(); // This was negative. CPPUNIT_ASSERT(nX >= 0); @@ -945,7 +945,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testExtentValue, "fdo74605.docx") // other dimension. DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSyncedRelativePercent, "tdf93676-1.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // check no explicit pctHeight has been exported, all we care // about at this point is that it's not 255000 diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index 5de79ca5ddfa..e52e250046a4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -41,7 +41,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST( testChildNodesOfCubicBezierTo, "FDO74774.do The test case ensures that there are 3 child nodes of type "pt" for cubicBexTo */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath( pXmlDoc, "/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]"); @@ -50,7 +50,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST( testChildNodesOfCubicBezierTo, "FDO74774.do DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testMSwordHang,"test_msword_hang.docx") { // fdo#74771: - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); 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"); } @@ -66,7 +66,7 @@ DECLARE_OOXMLEXPORT_TEST(testGroupshapeThemeFont, "groupshape-theme-font.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAnchorIdForWP14AndW14, "AnchorId.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[3]/mc:AlternateContent/mc:Choice/w:drawing/wp:inline", "anchorId", "78735EFD"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[3]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "anchorId", "78735EFD"); @@ -88,7 +88,7 @@ DECLARE_OOXMLEXPORT_TEST(testTextWatermark, "textWatermark.docx") //The problem was that the watermark ID was not preserved, //and Word uses the object ID to identify if it is a watermark. //It has to have the 'PowerPlusWaterMarkObject' string in it - xmlDocPtr pXmlHeader1 = parseExport("word/header1.xml"); + xmlDocUniquePtr pXmlHeader1 = parseExport("word/header1.xml"); if (!pXmlHeader1) return; @@ -105,7 +105,7 @@ DECLARE_OOXMLEXPORT_TEST(testPictureWatermark, "pictureWatermark.docx") //and Word uses the object ID to identify if it is a watermark. //It has to have the 'WordPictureWaterMarkObject' string in it - xmlDocPtr pXmlHeader1 = parseExport("word/header1.xml"); + xmlDocUniquePtr pXmlHeader1 = parseExport("word/header1.xml"); if (!pXmlHeader1) return; @@ -122,21 +122,21 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo76249, "fdo76249.docx") * as a Locked Canvas inside a text-box for the RT file to work in MS Word, as drawing elements * are not allowed inside the textboxes. */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); 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); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo76979, "fdo76979.docx") { // The problem was that black was exported as "auto" fill color, resulting in well-formed, but invalid XML. - xmlDocPtr pXmlDoc = parseExport("word/header2.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/header2.xml"); // This was "auto", not "FFFFFF". assertXPath(pXmlDoc, "//wps:spPr/a:solidFill/a:srgbClr", "val", "FFFFFF"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf104539, "tdf104539.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:inline/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw", "dir", "13500000"); @@ -144,7 +144,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf104539, "tdf104539.odt") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testShapeEffectPreservation, "shape-effect-preservation.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // first shape with outer shadow, rgb color assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" @@ -275,7 +275,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testShapeEffectPreservation, "shape-effect-p DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testShape3DEffectPreservation, "shape-3d-effect-preservation.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // first shape: extrusion and shift on z, rotated camera with zoom, rotated light rig assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" @@ -384,7 +384,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testShape3DEffectPreservation, "shape-3d-eff DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPictureEffectPreservation, "picture-effects-preservation.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:scene3d/a:camera", @@ -424,8 +424,8 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPictureEffectPreservation, "picture-effe DECLARE_OOXMLEXPORT_TEST(testPictureArtisticEffectPreservation, "picture-artistic-effects-preservation.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); - xmlDocPtr pRelsDoc = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pRelsDoc = parseExport("word/_rels/document.xml.rels"); if (!pXmlDoc || !pRelsDoc) return; @@ -523,13 +523,13 @@ DECLARE_OOXMLEXPORT_TEST(testPictureArtisticEffectPreservation, "picture-artisti DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(fdo77719, "fdo77719.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); 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); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testNestedAlternateContent, "nestedAlternateContent.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // We check alternateContent could not contains alternateContent (i.e. nested alternateContent) 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); } @@ -540,7 +540,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testNestedAlternateContent, "nestedAlternate DECLARE_OOXMLEXPORT_TEST(test76317, "test76317.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); if (!pXmlDoc) return; 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"); } @@ -549,19 +549,19 @@ DECLARE_OOXMLEXPORT_TEST(test76317, "test76317.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(fdo76591, "fdo76591.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); 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"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test76317_2K10, "test76317_2K10.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); 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"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO77122, "LinkedTextBoxes.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); //ensure that the text box links are preserved. assertXPath(pXmlDoc, "//wps:txbx[1]", "id", "1"); assertXPath(pXmlDoc, "//wps:linkedTxbx[1]", "id", "1"); @@ -569,13 +569,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO77122, "LinkedTextBoxes.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test76734_2K7, "test76734_2K7.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[3]/mc:AlternateContent[1]/mc:Choice[1]", "Requires", "wps"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test77219, "test77219.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); 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"); } @@ -613,7 +613,7 @@ DECLARE_OOXMLEXPORT_TEST(testPresetShape, "preset-shape.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo76101, "fdo76101.docx") { - xmlDocPtr pXmlDoc = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/styles.xml"); xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "/w:styles/w:style"); xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; CPPUNIT_ASSERT(4091 >= xmlXPathNodeSetGetLength(pXmlNodes)); @@ -622,33 +622,33 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo76101, "fdo76101.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSdtAndShapeOverlapping,"ShapeOverlappingWithSdt.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[1]/mc:AlternateContent"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt[1]/w:sdtContent[1]/w:r[1]/w:t[1]"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testLockedCanvas, "fdo78658.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Checking for lockedCanvas tag 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); } DECLARE_OOXMLEXPORT_TEST(fdo78474, "fdo78474.docx") { - xmlDocPtr pXmlDoc1 = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc1 = parseExport("word/document.xml"); if (!pXmlDoc1) return; //docx file after RT is getting corrupted. 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"); - xmlDocPtr pXmlDoc2 = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDoc2 = parseExport("word/_rels/document.xml.rels"); if (!pXmlDoc2) return; assertXPath(pXmlDoc2,"/rels:Relationships/rels:Relationship[2]","Id","rId2"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAbsolutePositionOffsetValue,"fdo78432.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); xmlXPathObjectPtr pXmlObjs[6]; 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]"); @@ -677,7 +677,7 @@ DECLARE_OOXMLEXPORT_TEST(testRubyHyperlink, "rubyhyperlink.fodt") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo78300,"fdo78300.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/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]", 0); @@ -694,7 +694,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testWordArtWithinDraingtool, "testWordArtWit * Expected : as there is nesting of a 2007 Word Art within a drawing tool, then can be separated in two different runs. * */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); 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); 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); // Make sure that the shape inside a shape is exported as VML-only, no embedded mc:AlternateContent before w:pict. @@ -714,7 +714,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo78663, "fdo78663.docx") * We shouldn't repeat it again in <shapetype><shape> <textbox><txbxContent> * */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); 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); 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); // Make sure that the shape inside a shape is exported as VML-only, no embedded mc:AlternateContent before w:pict. @@ -723,7 +723,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo78663, "fdo78663.docx") DECLARE_OOXMLEXPORT_TEST(testFdo78957, "fdo78957.docx") { - xmlDocPtr pXmlHeader = parseExport("word/header2.xml"); + xmlDocUniquePtr pXmlHeader = parseExport("word/header2.xml"); if(!pXmlHeader) return; @@ -742,7 +742,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79256, "fdo79256.docx") /* corruption issue also solved by fixing tdf#108064: * since that LO keeps MSO preset dash styles during OOXML export */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); 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/a:prstDash", "val", "lgDash"); } @@ -753,7 +753,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDashedLine_CustDash1000thOfPercent, "das * This test-file has a CUSTOM dash-line that is defined as '1000th of a percent'. * This should be imported by LO as-is, and exported back with the same values. */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); 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"); 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"); @@ -772,7 +772,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDashedLine_CustDashPercentage, "dashed_l * This should be imported by LO as '1000th of a percent', and exported back * as '1000th of a percent'. */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); 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"); 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"); @@ -786,7 +786,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDashedLine_CustDashPercentage, "dashed_l DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCommentInitials, "comment_initials.odt") { - xmlDocPtr pXmlDoc = parseExport("word/comments.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/comments.xml"); assertXPath(pXmlDoc,"/w:comments/w:comment[1]", "initials", "initials"); } @@ -813,7 +813,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo79591, "fdo79591.docx") * and hence was showing RT document as corrupt with error * message "invalid character" */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp:docPr", "name", ""); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape", "ID", ""); @@ -827,7 +827,7 @@ DECLARE_OOXMLEXPORT_TEST(testBnc884615, "bnc884615.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo80894, "TextFrameRotation.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Rotation value was not roundtripped for textframe. 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", @@ -846,7 +846,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80895, "fdo80895.docx") // resultant shape was with <a:noFill/> prop in <wps:spPr> hence was not visible. // Checking there is a shape in header without <a:noFill/> element. - xmlDocPtr pXmlDoc = parseExport("word/header1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/header1.xml"); 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); 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); @@ -858,7 +858,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80895, "fdo80895.docx") DECLARE_OOXMLEXPORT_TEST(testWrapTightThrough, "wrap-tight-through.docx") { // These were wrapSquare without a wrap polygon before. - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { // The first shape should be wrapThrough with a wrap polygon (was wrapSquare). assertXPath(pXmlDoc, "//w:drawing/wp:anchor[1]/wp:wrapThrough/wp:wrapPolygon/wp:start", "x", "-1104"); @@ -881,21 +881,21 @@ DECLARE_OOXMLEXPORT_TEST(testPictureWrapPolygon, "picture-wrap-polygon.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPictureColormodeGrayscale, "picture_colormode_grayscale.docx") { // The problem was that the grayscale was not exported - xmlDocPtr pXmlDoc = parseExport ("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport ("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing/wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:grayscl", 1); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPictureColormodeBlackWhite, "picture_colormode_black_white.odt") { - xmlDocPtr pXmlDoc = parseExport ("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport ("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:biLevel", "thresh", "50000"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPictureColormodeWatermark, "picture_colormode_watermark.odt") { - xmlDocPtr pXmlDoc = parseExport ("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport ("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:lum", "bright", "70000"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:lum", "contrast", "-70000"); } @@ -904,7 +904,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPictureColormodeWatermark, "picture_colo DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testExportShadow, "bnc637947.odt") { // The problem was that shadows of shapes from non-OOXML origin were not exported to DrawingML - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:spPr/a:effectLst/a:outerShdw", "dist" , "109865"); assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:spPr/a:effectLst/a:outerShdw", "dir" , "634411"); @@ -914,7 +914,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testExportShadow, "bnc637947.odt") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testExportAdjustmentValue, "tdf91429.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); 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:prstGeom/a:avLst/a:gd", "fmla", "val 50000"); } @@ -1011,7 +1011,7 @@ DECLARE_OOXMLEXPORT_TEST(testTDF87348, "tdf87348_linkedTextboxes.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTDF93675, "no-numlevel-but-indented.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "//w:ind", "start", "1418"); } @@ -1019,7 +1019,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTDF93675, "no-numlevel-but-indented.odt" DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFlipAndRotateCustomShape, "flip_and_rotate.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // there should be no flipH and flipV attributes in this case assertXPathNoAttribute(pXmlDoc, "//a:xfrm", "flipH"); assertXPathNoAttribute(pXmlDoc, "//a:xfrm", "flipV"); @@ -1043,7 +1043,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFlipAndRotateCustomShape, "flip_and_rota DECLARE_OOXMLEXPORT_TEST(testTdf92335, "tdf92335.docx") { // Don't export redundant ListLabel character styles - xmlDocPtr pXmlStyles = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"); if (!pXmlStyles) return; diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 1baabd612269..4227765975de 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -73,7 +73,7 @@ DECLARE_OOXMLEXPORT_TEST(testDocm, "hello.docm") // Make sure that we check the name of the export filter. // This was application/vnd.ms-word.document.macroEnabled.main+xml when the // name of the import filter was checked. - if (xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml")) assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[@PartName='/word/document.xml']", "ContentType", @@ -82,7 +82,7 @@ DECLARE_OOXMLEXPORT_TEST(testDocm, "hello.docm") DECLARE_OOXMLEXPORT_TEST(testDefaultContentTypes, "fdo55381.docx") { - if (xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml")) { assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Default[@Extension='xml']", @@ -111,7 +111,7 @@ DECLARE_SW_ROUNDTRIP_TEST(testDocmSave, "hello.docm", nullptr, DocmTest) // This was // application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml, // we used the wrong content type for .docm files. - if (xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml")) assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[@PartName='/word/document.xml']", "ContentType", @@ -257,7 +257,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf129575_docDefault, "tdf129575-docDefault.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf118812, "tdf118812_tableStyles-comprehensive.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // cell A1 assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc/w:p/w:pPr/w:pStyle", "val", "Normal"); assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc/w:p/w:pPr/w:spacing", "lineRule"); @@ -333,7 +333,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf118812, "tdf118812_tableStyles-compre DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf107626, "tdf107626.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // This was 2 (missing trailing cell in merged cell range) assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[3]/w:tc", 3); } @@ -353,7 +353,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf79272_strictDxa, "tdf79272_strictDxa.docx") uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(4318), getProperty<sal_Int32>(xTables->getByIndex(0), "Width")); - xmlDocPtr pXmlDoc = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/styles.xml"); if (!pXmlDoc) return; // Validation test: order of elements was wrong. Order was: insideH, end, insideV. @@ -664,7 +664,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf112352_nextPageColumns, "tdf112352_nextPageColum DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf109310_endnoteStyleForMSO, "tdf109310_endnoteStyleForMSO.docx") { - xmlDocPtr pXmlDoc = parseExport("word/endnotes.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/endnotes.xml"); // Check w:rStyle element has w:val attribute - note that w: is not specified for attribute assertXPath(pXmlDoc, "/w:endnotes/w:endnote[@w:id='2']/w:p/w:r[1]/w:rPr/w:rStyle", "val", "EndnoteCharacters"); @@ -672,7 +672,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf109310_endnoteStyleForMSO, "tdf109310 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf103389, "tdf103389.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // No geometry was exported for the second canvas // Check both canvases' geometry assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wpg:wgp/wps:wsp/wps:spPr/a:prstGeom", "prst", "rect"); @@ -762,7 +762,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf79329, "tdf79329.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf103982, "tdf103982.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); sal_Int32 nDistB = getXPath(pXmlDoc, "//wp:anchor", "distB").toInt32(); // This was -260350, which is not a valid value for an unsigned type. CPPUNIT_ASSERT(nDistB >= 0); @@ -774,7 +774,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf103982, "tdf103982.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf104115, "tdf104115.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // This found 0 nodes: the custom geometry was not written for the Bezier // curve -> Word refused to open the document. assertXPath(pXmlDoc, "//a:custGeom", 1); @@ -798,7 +798,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf99227, "tdf99227.docx") // After that, importing after export failed with // SAXParseException: '[word/document.xml line 2]: Extra content at the end of the document', Stream 'word / document.xml', // and before commit ebf767eeb2a169ba533e1b2ffccf16f41d95df35, the drawing was silently lost. - xmlDocPtr pXmlDoc = parseExport("word/footnotes.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/footnotes.xml"); assertXPath(pXmlDoc, "//w:footnote/w:p/w:r/w:drawing", 1); } @@ -813,7 +813,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf37153, "tdf37153_considerWrapOnObjPos.docx") CPPUNIT_ASSERT_EQUAL(text::VertOrientation::BOTTOM, getProperty<sal_Int16>(xTable->getCellByName("A1"), "VertOrient")); //For MSO compatibility, the textbox should be at the top of the cell, not at the bottom - despite VertOrientation::BOTTOM - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nFlyTop = getXPath(pXmlDoc, "/root/page/body/tab/row/cell[1]/txt/anchored/fly/infos/bounds", "top").toInt32(); CPPUNIT_ASSERT_MESSAGE("FlyTop should be 2865, not 5649", nFlyTop < sal_Int32(3000)); sal_Int32 nTextTop = getXPath(pXmlDoc, "/root/page/body/tab/row/cell[2]/txt[1]/infos/bounds", "top").toInt32(); @@ -970,7 +970,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf106001_2, "tdf106001-2.odt") { // In test ODT CharScaleWidth = 900, this was not changed upon OOXML export to stay in [1..600], now it's clamped to 600 // Note: we disregard what's set in pPr / rPr and only care about r / rPr - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:rPr/w:w","val","600"); } @@ -1043,7 +1043,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121670_columnsInSectionsOnly, "tdf121670_columns DECLARE_OOXMLEXPORT_TEST(testTdf106492, "tdf106492.docx") { - if (xmlDocPtr pXmlDoc = parseExport()) + if (xmlDocUniquePtr pXmlDoc = parseExport()) // This was 4: an additional sectPr was added to the document. assertXPath(pXmlDoc, "//w:sectPr", 3); } @@ -1083,7 +1083,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf107837, "tdf107837.odt") DECLARE_OOXMLEXPORT_TEST(testTdf107684, "tdf107684.odt") { - if (xmlDocPtr pXmlDoc = parseExport("word/styles.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/styles.xml")) // This was 1, <w:outlineLvl> was duplicated for Heading1. assertXPath(pXmlDoc, "//w:style[@w:styleId='Heading1']/w:pPr/w:outlineLvl", 1); } @@ -1244,7 +1244,7 @@ DECLARE_OOXMLEXPORT_TEST(testActiveXControlAlign, "activex_control_align.odt") CPPUNIT_ASSERT_EQUAL(sal_Int32(-1085), xShape->getPosition().Y); // Also check the specific OOXML elements - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); CPPUNIT_ASSERT(pXmlDoc); // For inline controls use w:object as parent element and pictureFrame shapetype assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:object", 1); @@ -1279,7 +1279,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf109184, "tdf109184.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf111964, "tdf111964.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Unicode spaces that are not XML whitespace must not be trimmed const sal_Unicode sWSReference [] { 0x2002, 0x2002, 0x2002, 0x2002, 0x2002, 0 }; assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[6]/w:t", sWSReference); @@ -1354,14 +1354,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(tdf112169, "tdf112169.odt") // LO crashed while export because of character background color handling //tdf76683 - Cannot be negative number - use firstLine instead of hanging - xmlDocPtr pXmlDoc = parseExport("word/numbering.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/numbering.xml"); assertXPathNoAttribute(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:pPr/w:ind", "hanging"); assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:pPr/w:ind", "firstLine","360"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf103090, "tdf103090.odt") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Get bookmark name OUString bookmarkName = getXPath(pXmlDoc, "/w:document/w:body/w:p/w:bookmarkStart", "name"); @@ -1379,7 +1379,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf103090, "tdf103090.odt") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf107111, "tdf107111.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Ensure that hyperlink and its properties are in place. assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:hyperlink/w:r/w:rPr", 1); @@ -1460,7 +1460,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104354_2, "tdf104354-2.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf115557, "tdf115557.docx") { // A chart anchored to a footnote multiplied during import - xmlDocPtr pXmlDoc = parseExport("word/footnotes.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/footnotes.xml"); assertXPath(pXmlDoc, "//w:footnote/w:p/w:r/w:drawing", 1); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport_template.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport_template.cxx index d901af1ed886..a6a5b37af52e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport_template.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport_template.cxx @@ -26,7 +26,7 @@ protected: DECLARE_OOXMLEXPORT_TEST(testSaveAsDotX, "sample.dotx") { - xmlDocPtr pXmlDocCT = parseExport("[Content_Types].xml"); + xmlDocUniquePtr pXmlDocCT = parseExport("[Content_Types].xml"); if (!pXmlDocCT) return; diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index cd5177010af2..8ac7b706d1da 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx @@ -61,7 +61,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testBnc834035, "bnc834035.odt") { // Illustration index had wrong hyperlinks: anchor was using Writer's // <seqname>!<index>|sequence syntax, not a bookmark name. - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); // This was Figure!1|sequence. assertXPath(pXmlDoc, "/w:document/w:body/w:p[10]/w:hyperlink", "anchor", "_Toc363553908"); } @@ -76,7 +76,7 @@ DECLARE_OOXMLEXPORT_TEST(testCp1000015, "cp1000015.odt") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testHyperlineIsEnd, "hyperlink.docx") { // Check that the document.xml contents all the tag properly closed. - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // If document.xml miss any ending tag then parseExport() returns NULL which fail the test case. CPPUNIT_ASSERT(pXmlDoc) ; // Check hyperlink is properly open. @@ -86,7 +86,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testHyperlineIsEnd, "hyperlink.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo69649, "fdo69649.docx") { // The DOCX containing the Table of Contents was not exported with correct page nos - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[21]/w:hyperlink/w:r[5]/w:t", "15"); } @@ -94,7 +94,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo69649, "fdo69649.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFieldFlagO,"TOC_field_f.docx") { // This test case is to verify \o flag should come once. - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); // FIXME "p[2]" will have to be "p[1]", once the TOC import code is fixed // not to insert an empty paragraph before TOC. @@ -109,7 +109,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTOCFlag_f, "toc_doc.docx") // \o \h \n used to come after RoundTrip. // This test case is to verify even if there is no \f flag in original doc, \h flag is getting // preserved after RT. - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); // FIXME "p[2]" will have to be "p[1]", once the TOC import code is fixed // not to insert an empty paragraph before TOC. @@ -118,14 +118,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTOCFlag_f, "toc_doc.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPreserveZfield,"preserve_Z_field_TOC.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r[2]/w:instrText", " TOC \\z \\f \\o \"1-3\" \\h"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPreserveWfieldTOC, "PreserveWfieldTOC.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p/w:r[2]/w:instrText", " TOC \\z \\w \\f \\o \"1-3\" \\h"); } @@ -133,7 +133,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPreserveWfieldTOC, "PreserveWfieldTOC.do DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFieldFlagB,"TOC_field_b.docx") { // This test case is to verify \b flag. - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); // FIXME "p[2]" will have to be "p[1]", once the TOC import code is fixed // not to insert an empty paragraph before TOC. @@ -142,14 +142,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFieldFlagB,"TOC_field_b.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPreserveXfieldTOC, "PreserveXfieldTOC.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p/w:r[2]/w:instrText", " TOC \\x \\f \\o \"1-3\" \\h"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO77715,"FDO77715.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[2]/w:instrText[1]", " TOC \\c "); } @@ -157,7 +157,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO77715,"FDO77715.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTOCFlag_u,"testTOCFlag_u.docx") { // DOCX containing TOC should preserve code field '\u'. - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // FIXME "p[2]" will have to be "p[1]", once the TOC import code is fixed // not to insert an empty paragraph before TOC. @@ -167,7 +167,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTOCFlag_u,"testTOCFlag_u.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo73596_RunInStyle,"fdo73596_RunInStyle.docx") { // INDEX should be preserved. - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:instrText[1]", " INDEX \\e \""); } @@ -175,7 +175,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo73596_RunInStyle,"fdo73596_RunInStyle DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo73596_AlphaSeparator,"fdo73596_AlphaSeparator.docx") { // INDEX flag \h "A" should be preserved. - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:instrText[1]", " INDEX \\h \"A\" \\e \""); } @@ -185,7 +185,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCaption1, "EquationAsScientificNumbering // fdo#74431 : This test case is to verify the Captions are coming properly // earlier it was coming as "SEQ "scientific"\*ROMAN now it is SEQ scientific\* ROMAN" - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[3]/w:instrText", " SEQ scientific \\* ROMAN "); } @@ -194,7 +194,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCaption2, "EquationWithAboveAndBelowCapt { // fdo#72563 : There was a problem that in case of TOC,PAGEREF field tag was not preserved during Roundtrip // This test case is to verify that PAGEREF tag is coming with proper values inside <hyperlink> tag. - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[5]/w:r[3]/w:instrText", " SEQ Equation \\* ARABIC "); } @@ -203,7 +203,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCaption3, "FigureAsLabelPicture.docx") { // fdo#72563 : There was a problem that in case of TOC,PAGEREF field tag was not preserved during Roundtrip // This test case is to verify that PAGEREF tag is coming with proper values inside <hyperlink> tag. - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[3]/w:instrText", " SEQ picture \\* ARABIC "); } @@ -212,7 +212,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCaption4, "TableWithAboveCaptions.docx") { // fdo#72563 : There was a problem that in case of TOC,PAGEREF field tag was not preserved during Roundtrip // This test case is to verify that PAGEREF tag is coming with proper values inside <hyperlink> tag. - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[3]/w:instrText", " SEQ Table \\* ARABIC "); } @@ -223,7 +223,7 @@ DECLARE_OOXMLEXPORT_TEST(testFooterContainHyperlink,"footer-contain-hyperlink.do // Target due to which the file get corrupted // in MS Office 2007. // Check for footer1.xml.rels file. - xmlDocPtr pXmlRels = parseExport("word/_rels/footer1.xml.rels"); + xmlDocUniquePtr pXmlRels = parseExport("word/_rels/footer1.xml.rels"); if (!pXmlRels) return; // Check the value of Target which is http://www.google.com/. @@ -240,7 +240,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlphabeticalIndex_MultipleColumns,"alpha * If the column count is explicitly specified, * MS Office adds section breaks before and after the Index. */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[2]/w:instrText", " INDEX \\c \"4\"\\e \""); @@ -255,7 +255,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPageref, "testPageref.docx") { // fdo#72563 : There was a problem that in case of TOC,PAGEREF field tag was not preserved during Roundtrip // This test case is to verify that PAGEREF tag is coming with proper values inside <hyperlink> tag. - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[2]/w:hyperlink/w:r[3]/w:instrText", "PAGEREF _Toc355095261 \\h"); } @@ -268,7 +268,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlphabeticalIndex_AutoColumn,"alphabetic * "\c" switch, don't write back '\c "0"' or the section breaks * before and after the Index Context */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:instrText", " INDEX \\e \""); @@ -280,14 +280,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testIndexFieldFlagF,"IndexFieldFlagF.docx") { // This test case is to verify the Index field flag '\f' with some // Specific Entry Type (ex. "Syn" in our case). - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // We check the Index field flag '\f'. assertXPathContent(pXmlDoc, "/w:document[1]/w:body[1]/w:p[4]/w:r[2]/w:instrText[1]", " INDEX \\c \"2\"\\f \"Syn\" \" \\e \""); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testBibliography,"FDO75133.docx") { - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p/w:r[2]/w:instrText", " BIBLIOGRAPHY "); assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:docPartObj/w:docPartGallery", "val", "Bibliographies"); @@ -298,7 +298,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testGenericTextField, "Unsupportedtextfields { // fdo#75158 : This test case is to verify the unsupported textfields are exported properly. - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc,"/w:document/w:body/w:p[2]/w:r[2]/w:instrText"); xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; @@ -309,7 +309,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testGenericTextField, "Unsupportedtextfields DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test_FieldType, "99_Fields.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Checking for three field types (BIBLIOGRAPHY, BIDIOUTLINE, CITATION) in sequence assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:instrText"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[2]/w:instrText"); @@ -318,7 +318,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test_FieldType, "99_Fields.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCitation,"FDO74775.docx") { - xmlDocPtr pXmlDoc = parseExport(); + xmlDocUniquePtr pXmlDoc = parseExport(); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[1]/w:sdt/w:sdtContent/w:r[2]/w:instrText", " CITATION Kra06 \\l 1033 "); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[1]/w:sdt/w:sdtContent/w:r[4]/w:t", "(Kramer & Chen, 2006)"); } @@ -328,7 +328,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testHyperLinkTagEnded, "fdo76316.docx") /* XML tag <w:hyperlink> was not getting closed when its inside another * <w:hyperlink> tag. */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); CPPUNIT_ASSERT(pXmlDoc); assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tr[2]/w:tc[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tbl[1]/w:tr[7]/w:tc[1]/w:tbl[1]/w:tr[2]/w:tc[6]/w:tbl[1]/w:tr[1]/w:tc[1]/w:p[1]/w:hyperlink[1]/w:hyperlink[1]",1); @@ -336,21 +336,21 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testHyperLinkTagEnded, "fdo76316.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO76163 , "fdo76163.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); //docx file after RT is getting corrupted. assertXPath ( pXmlDoc, "/w:document/w:body/w:p[2]/w:hyperlink/w:r[10]/w:fldChar", "fldCharType", "end" ); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78659, "fdo78659.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:p[1]/w:hyperlink[1]/w:r[3]/w:fldChar[1]", 0); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78654 , "fdo78654.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // In case of two "Hyperlink" tags in one paragraph and one of them // contains "PAGEREF" field then field end tag was missing from hyperlink. assertXPath ( pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[2]/w:hyperlink[3]/w:r[5]/w:fldChar", "fldCharType", "end" ); @@ -359,26 +359,26 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78654 , "fdo78654.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo78599,"fdo78599.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); //docx file after RT is getting corrupted. assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink/w:r[6]/w:fldChar", "fldCharType", "end" ); // Check for automatic hyphenation - if (xmlDocPtr pSettingsXml = parseExport("word/settings.xml")) + if (xmlDocUniquePtr pSettingsXml = parseExport("word/settings.xml")) // This failed as w:settings had no w:autoHyphenation child. assertXPath(pSettingsXml, "/w:settings/w:autoHyphenation"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo78886, "fdo78886.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[2]/w:tr[1]/w:tc[1]/w:p[1]/w:hyperlink[1]/w:r[2]/w:fldChar[1]", 0); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo78910, "fdo78910.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // This is to ensure that the fld starts and ends inside a hyperlink... assertXPath ( pXmlDoc, "//w:hyperlink[2]/w:r[1]/w:fldChar", "fldCharType", "begin" ); @@ -387,7 +387,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo78910, "fdo78910.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78590, "FDO78590.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // This is to ensure that the fld starts and ends inside a hyperlink... assertXPath ( pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:framePr", "w", "9851" ); @@ -397,7 +397,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78590, "FDO78590.docx") DECLARE_OOXMLEXPORT_TEST(testSdtCitationRun, "sdt-citation-run.docx") { // The problem was that the SDT was around the whole paragraph, not only around the citation field. - if (xmlDocPtr pXmlDoc = parseExport()) + if (xmlDocUniquePtr pXmlDoc = parseExport()) { assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[1]/w:t", "Before sdt."); assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r/w:instrText", " CITATION BBC11 \\l 1033 "); @@ -408,7 +408,7 @@ DECLARE_OOXMLEXPORT_TEST(testSdtCitationRun, "sdt-citation-run.docx") DECLARE_OOXMLEXPORT_TEST(testParagraphSdt, "paragraph-sdt.docx") { // The problem was that the SDT was around the run only, not the whole paragraph. - if (xmlDocPtr pXmlDoc = parseExport()) + if (xmlDocUniquePtr pXmlDoc = parseExport()) { // The path to w:sdt contained a w:p. assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:sdt"); @@ -417,7 +417,7 @@ DECLARE_OOXMLEXPORT_TEST(testParagraphSdt, "paragraph-sdt.docx") DECLARE_OOXMLEXPORT_TEST(testSdt2Run, "sdt-2-para.docx") { - if (xmlDocPtr pXmlDoc = parseExport()) + if (xmlDocUniquePtr pXmlDoc = parseExport()) { // The problem was that <w:sdt> was closed after "first", not after "second", so the second assert failed. assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r/w:t", "first"); @@ -429,7 +429,7 @@ DECLARE_OOXMLEXPORT_TEST(testSdt2Run, "sdt-2-para.docx") DECLARE_OOXMLEXPORT_TEST(test2Id, "2-id.docx") { - if (xmlDocPtr pXmlDoc = parseExport()) + if (xmlDocUniquePtr pXmlDoc = parseExport()) { // This was 2, but only one w:id is allowed. assertXPath(pXmlDoc, "//w:sdtPr/w:id", 1); @@ -438,7 +438,7 @@ DECLARE_OOXMLEXPORT_TEST(test2Id, "2-id.docx") DECLARE_OOXMLEXPORT_TEST(testTableStart2Sdt, "table-start-2-sdt.docx") { - if (xmlDocPtr pXmlDoc = parseExport()) + if (xmlDocUniquePtr pXmlDoc = parseExport()) { // w:docPartGallery should be a child of <w:docPartObj>, make sure it's not a child of w:text. assertXPath(pXmlDoc, "//w:sdt/w:sdtPr/w:text/w:docPartGallery", 0); @@ -447,7 +447,7 @@ DECLARE_OOXMLEXPORT_TEST(testTableStart2Sdt, "table-start-2-sdt.docx") DECLARE_OOXMLEXPORT_TEST(testSdtDateDuplicate, "sdt-date-duplicate.docx") { - if (xmlDocPtr pXmlDoc = parseExport()) + if (xmlDocUniquePtr pXmlDoc = parseExport()) { // Single <w:sdt> was exported as 2 <w:sdt> elements. assertXPath(pXmlDoc, "//w:sdt", 1); @@ -468,7 +468,7 @@ DECLARE_OOXMLEXPORT_TEST(testSdtDateDuplicate, "sdt-date-duplicate.docx") DECLARE_OOXMLEXPORT_TEST(testFdo81492, "fdo81492.docx") { - if (xmlDocPtr pXmlDoc = parseExport()) + if (xmlDocUniquePtr pXmlDoc = parseExport()) assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[6]/w:instrText", "ADDIN EN.CITE.DATA"); } @@ -479,7 +479,7 @@ DECLARE_OOXMLEXPORT_TEST(testEditTime, "fdo81341.docx") * then LO was not able to display time in "HH:MM:SS" format. * While exporting LO was writing plain text instead of field entry. */ - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { //Ensure that EditTime is written inside w:fldChar in "HH:MM:SS" format. assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[1]/w:fldChar", "fldCharType", "begin"); @@ -491,14 +491,14 @@ DECLARE_OOXMLEXPORT_TEST(testEditTime, "fdo81341.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo81945, "fdo81945.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "//w:sdt//w:sdt", 0); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo82123, "fdo82123.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // make sure there is only one run inside first SDT after RT as in the Original file. assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[2]/w:p/w:sdt[1]/w:sdtContent/w:r",1); @@ -506,7 +506,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo82123, "fdo82123.docx") DECLARE_OOXMLEXPORT_TEST(testSdtBeforeField, "sdt-before-field.docx") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { // Make sure the field doesn't sneak inside the SDT: the SDT should contain only a single run (there were 6 ones). assertXPath(pXmlDoc, "//w:sdt/w:sdtContent/w:r", 1); @@ -515,14 +515,14 @@ DECLARE_OOXMLEXPORT_TEST(testSdtBeforeField, "sdt-before-field.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo81946, "fdo81946.docx") { - xmlDocPtr pXmlDoc = parseExport("word/header1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/header1.xml"); // make sure AlternateContent should not present in sdt assertXPath(pXmlDoc, "/w:hdr[1]/w:p[1]/w:sdt[1]/w:sdtContent[1]/w:r[2]/mc:AlternateContent[1]",0); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo82492, "fdo82492.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // make sure there is only one run inside first SDT after RT as in the Original file. assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt[1]/w:sdtContent/w:r",1); @@ -531,14 +531,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo82492, "fdo82492.docx") DECLARE_OOXMLEXPORT_TEST(testSdtHeader, "sdt-header.docx") { // Problem was that w:sdt elements in headers were lost on import. - if (xmlDocPtr pXmlDoc = parseExport("word/header1.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/header1.xml")) // This was 0, w:sdt (and then w:date) was missing. assertXPath(pXmlDoc, "//w:sdt/w:sdtPr/w:date", 1); } DECLARE_OOXMLEXPORT_TEST(testSdtCompanyMultipara, "sdt-company-multipara.docx") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { // This was 3, but multiple paragraphs inside "Company" SDT is now allowed. assertXPath(pXmlDoc, "//w:sdtContent/w:p", 1); @@ -559,7 +559,7 @@ DECLARE_OOXMLEXPORT_TEST(testFixedDateFields, "fixed-date-field.docx") CPPUNIT_ASSERT_EQUAL(sal_uInt16(7), date.Month); CPPUNIT_ASSERT_EQUAL(sal_Int16(2014), date.Year); - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { // Previously, fixed fields were exported as static text ("Date (fixed)") // Check they are now exported correctly as fldChar with fldLock attribute @@ -574,13 +574,13 @@ DECLARE_OOXMLEXPORT_TEST(testToxmarkHyperlink, "toxmarkhyperlink.fodt") DECLARE_OOXMLEXPORT_TEST(testOO34469, "ooo34469-1.odt") { - if (xmlDocPtr pXmlDoc = parseExport()) + if (xmlDocUniquePtr pXmlDoc = parseExport()) assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink[1]", "anchor", "2.9.2.Creating_New_files|outline"); } DECLARE_OOXMLEXPORT_TEST(testOO39845, "ooo39845-7.odt") { - if (xmlDocPtr pXmlDoc = parseExport()) + if (xmlDocUniquePtr pXmlDoc = parseExport()) assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink[1]", "anchor", "Figure4|graphic"); } @@ -592,7 +592,7 @@ DECLARE_OOXMLEXPORT_TEST( testTdf85161, "tdf85161.docx" ) DECLARE_OOXMLEXPORT_TEST( testTdf66401, "tdf66401.docx") { - if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[3]/w:rPr/w:rFonts", 1); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[3]/w:rPr/w:rFonts", "ascii", "Arial Black"); @@ -664,7 +664,7 @@ DECLARE_OOXMLEXPORT_TEST(testDropDownFieldEntryLimit, "tdf126792.odt" ) DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf132185, "tdf132185.docx") { - xmlDocPtr pXmlDoc = parseExport("word/footer1.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/footer1.xml"); // Since the default (without xml:space attribute) is to ignore leading and trailing spaces, // " PAGE \\* roman " will get imported as "PAGE \\* roman". This is also valid, and must be // treated accordingly. "roman" was ignored before the fix, exporting only " PAGE ". diff --git a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx index ba61d24e55c6..1ad0df5fb514 100644 --- a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx @@ -178,7 +178,7 @@ DECLARE_LINKS_IMPORT_TEST(testTdf123627_import, "tdf123627.docx", USE_RELATIVE) DECLARE_LINKS_EXPORT_TEST(testRelativeToRelativeExport, "relative-link.docx", USE_RELATIVE, USE_TEMP_DIR) { - xmlDocPtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); if (!pXmlDoc) return; @@ -189,7 +189,7 @@ DECLARE_LINKS_EXPORT_TEST(testRelativeToRelativeExport, "relative-link.docx", US DECLARE_LINKS_EXPORT_TEST(testRelativeToAbsoluteExport, "relative-link.docx", USE_ABSOLUTE, DONT_MODIFY_LINK) { - xmlDocPtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); if (!pXmlDoc) return; @@ -201,7 +201,7 @@ DECLARE_LINKS_EXPORT_TEST(testRelativeToAbsoluteExport, "relative-link.docx", US DECLARE_LINKS_EXPORT_TEST(testAbsoluteToRelativeExport, "absolute-link.docx", USE_RELATIVE, USE_TEMP_DIR) { - xmlDocPtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); if (!pXmlDoc) return; @@ -211,7 +211,7 @@ DECLARE_LINKS_EXPORT_TEST(testAbsoluteToRelativeExport, "absolute-link.docx", US DECLARE_LINKS_EXPORT_TEST(testAbsoluteToAbsoluteExport, "absolute-link.docx", USE_ABSOLUTE, DONT_MODIFY_LINK) { - xmlDocPtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); if (!pXmlDoc) return; @@ -222,7 +222,7 @@ DECLARE_LINKS_EXPORT_TEST(testAbsoluteToAbsoluteExport, "absolute-link.docx", US DECLARE_LINKS_EXPORT_TEST(testTdf123627_export, "tdf123627.docx", USE_RELATIVE, USE_TEMP_DIR) { - xmlDocPtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); if (!pXmlDoc) return; @@ -232,7 +232,7 @@ DECLARE_LINKS_EXPORT_TEST(testTdf123627_export, "tdf123627.docx", USE_RELATIVE, DECLARE_LINKS_EXPORT_TEST(testTdf126590_export, "tdf126590.docx", USE_ABSOLUTE, DONT_MODIFY_LINK) { - xmlDocPtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); if (!pXmlDoc) return; // in the original file: Target="file:///C:\TEMP\test.docx" => invalid file URI @@ -242,7 +242,7 @@ DECLARE_LINKS_EXPORT_TEST(testTdf126590_export, "tdf126590.docx", USE_ABSOLUTE, DECLARE_LINKS_EXPORT_TEST(testTdf126768_export, "tdf126768.docx", USE_ABSOLUTE, DONT_MODIFY_LINK) { - xmlDocPtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); if (!pXmlDoc) return; // in the original file: "file:///C:\\TEMP\\test.docx" => invalid file URI @@ -253,7 +253,7 @@ DECLARE_LINKS_EXPORT_TEST(testTdf126768_export, "tdf126768.docx", USE_ABSOLUTE, DECLARE_LINKS_EXPORT_TEST(testNon_ascii_link_export, "non_ascii_link.docx", USE_ABSOLUTE, DONT_MODIFY_LINK) { - xmlDocPtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); + xmlDocUniquePtr pXmlDoc = parseExport("word/_rels/document.xml.rels"); if (!pXmlDoc) return; diff --git a/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx b/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx index 0ac181ccbd50..5c2d43698299 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx @@ -26,7 +26,7 @@ protected: DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_GlowShadowReflection, "TextEffects_Glow_Shadow_Reflection.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[1]/w:rPr/w14:glow", "rad").match("63500")); CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[1]/w:rPr/w14:glow/w14:srgbClr", "val").match("00B0F0")); @@ -93,7 +93,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_GlowShadowReflection, "Text DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_TextOutline, "TextEffects_TextOutline.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Paragraph 1 assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w14:textOutline", "w", "50800"); @@ -148,7 +148,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_TextOutline, "TextEffects_T DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_TextFill, "TextEffects_TextFill.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Paragraph 1 has no textFill // Paragraph 2 @@ -185,7 +185,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_TextFill, "TextEffects_Text DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_Props3d_Ligatures_NumForm_NumSpacing, "TextEffects_Props3d_Ligatures_NumForm_NumSpacing.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Paragraph 1 - w14:props3d assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w14:props3d", 1); @@ -230,7 +230,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_Props3d_Ligatures_NumForm_N DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_StylisticSets_CntxtAlts, "TextEffects_StylisticSets_CntxtAlts.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Paragraph 1 - w14:stylisticSets assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w14:stylisticSets/w14:styleSet", 1); @@ -246,13 +246,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_StylisticSets_CntxtAlts, "T DECLARE_OOXMLEXPORT_TEST(Test_McIgnorable, "TextEffects_StylisticSets_CntxtAlts.docx") { - xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); if (!pXmlDocument) return; assertXPath(pXmlDocument, "/w:document", "Ignorable", "w14 wp14"); - xmlDocPtr pXmlStyles = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"); if (!pXmlStyles) return; @@ -261,7 +261,7 @@ DECLARE_OOXMLEXPORT_TEST(Test_McIgnorable, "TextEffects_StylisticSets_CntxtAlts. DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_CompatSettingsForW14, "TextEffects_StylisticSets_CntxtAlts.docx") { - xmlDocPtr pXmlDoc = parseExport("word/settings.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/settings.xml"); assertXPath(pXmlDoc, "/w:settings/w:compat/w:compatSetting", 5); @@ -288,7 +288,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_CompatSettingsForW14, "TextEffects_Styl DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_Groupshapes, "TextEffects_Groupshapes.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); OString sPathToWGP = "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp"; @@ -401,7 +401,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_Groupshapes, "TextEffects_G DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_InStyleXml, "TextEffects_InStyle.docx") { - xmlDocPtr pXmlDoc = parseExport("word/styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/styles.xml"); OString sPathToCharacterStyle = "/w:styles/w:style[3]"; @@ -628,7 +628,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_TextEffects_InStyleXml, "TextEffects_In DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_no_tag_if_no_fill, "tdf112103_tablebgnofill.docx") { - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:shd", 0); } diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 773b5c457a73..14d0d2797f8b 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -361,7 +361,7 @@ DECLARE_OOXMLIMPORT_TEST(testN758883, "n758883.docx") * The problem was that direct formatting of the paragraph was not applied * to the numbering. This is easier to test using a layout dump. */ - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page/body/txt/Special[1]", "nHeight", "220"); // check the bookmark portions are of the expected height @@ -1384,7 +1384,7 @@ DECLARE_OOXMLIMPORT_TEST(testTdf100072, "tdf100072.docx") ReadGraphic(aStream, aGraphic); const GDIMetaFile& rMetaFile = aGraphic.GetGDIMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, rMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, rMetaFile); // Get first polyline rightside x coordinate sal_Int32 nFirstEnd = getXPath(pXmlDoc, "(//polyline)[1]/point[2]", "x").toInt32(); diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 6f7abeaa1bfe..f5c4344a1e8f 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -1807,7 +1807,7 @@ void SwUiWriterTest::testFdo87448() ReadGraphic(aStream, aGraphic); const GDIMetaFile& rMetaFile = aGraphic.GetGDIMetaFile(); MetafileXmlDump dumper; - xmlDocPtr pXmlDoc = dumpAndParse(dumper, rMetaFile); + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, rMetaFile); // The first polyline in the document has a number of points to draw arcs, // the last one jumps back to the start, so we call "end" the last but one. @@ -1867,7 +1867,7 @@ void SwUiWriterTest::testTdf68183() void SwUiWriterTest::testCp1000115() { createDoc("cp1000115.fodt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "/root/page[2]/body/tab/row/cell[2]/txt"); xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; // This was 1: the long paragraph in the B1 cell did flow over to the @@ -1907,7 +1907,7 @@ void SwUiWriterTest::testTdf63214() void SwUiWriterTest::testTdf90003() { createDoc("tdf90003.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); // This was 1: an unexpected fly portion was created, resulting in too // large x position for the empty paragraph marker. @@ -3279,7 +3279,7 @@ void SwUiWriterTest::testTdf74230() xStorable->storeToURL(aTempFile.GetURL(), aDescriptor); CPPUNIT_ASSERT(aTempFile.IsValid()); //loading an XML DOM of the "styles.xml" of the TempFile - xmlDocPtr pXmlDoc = parseExportInternal(aTempFile.GetURL(),"styles.xml"); + xmlDocUniquePtr pXmlDoc = parseExportInternal(aTempFile.GetURL(),"styles.xml"); //pXmlDoc should not be null CPPUNIT_ASSERT(pXmlDoc); //asserting XPath in loaded XML DOM @@ -4848,7 +4848,7 @@ void SwUiWriterTest::testBookmarkCollapsed() save("writer8", aTempFile); // load only content.xml from the resaved document - if (xmlDocPtr pXmlDoc = parseExportInternal(aTempFile.GetURL(), "content.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExportInternal(aTempFile.GetURL(), "content.xml")) { const OString aPath("/office:document-content/office:body/office:text/text:p"); @@ -4925,7 +4925,7 @@ void SwUiWriterTest::testRemoveBookmarkText() save("writer8", aTempFile); // load only content.xml from the resaved document - if (xmlDocPtr pXmlDoc = parseExportInternal(aTempFile.GetURL(), "content.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExportInternal(aTempFile.GetURL(), "content.xml")) { const OString aPath("/office:document-content/office:body/office:text/text:p"); @@ -5030,7 +5030,7 @@ void SwUiWriterTest::testRemoveBookmarkTextAndAddNew() save("writer8", aTempFile); // load only content.xml from the resaved document - if (xmlDocPtr pXmlDoc = parseExportInternal(aTempFile.GetURL(), "content.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExportInternal(aTempFile.GetURL(), "content.xml")) { const OString aPath("/office:document-content/office:body/office:text/text:p"); @@ -5095,7 +5095,7 @@ void SwUiWriterTest::testRemoveBookmarkTextAndAddNewAfterReload() save("writer8", aTempFile); // load only content.xml from the resaved document - if (xmlDocPtr pXmlDoc = parseExportInternal(aTempFile.GetURL(), "content.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExportInternal(aTempFile.GetURL(), "content.xml")) { const OString aPath("/office:document-content/office:body/office:text/text:p"); @@ -5134,7 +5134,7 @@ void SwUiWriterTest::testTdf88453() { createDoc("tdf88453.odt"); calcLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was 0: the table does not fit the first page, but it wasn't split // to continue on the second page. assertXPath(pXmlDoc, "/root/page[2]/body/tab", 1); @@ -5204,7 +5204,7 @@ void SwUiWriterTest::testTdf98987() { createDoc("tdf98987.docx"); calcLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[2]/SdrObject", "name", "Rectangle 1"); sal_Int32 nRectangle1 = getXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[2]/bounds", "top").toInt32(); assertXPath(pXmlDoc, "/root/page/body/txt/anchored/SwAnchoredDrawObject[1]/SdrObject", "name", "Rectangle 2"); @@ -5221,7 +5221,7 @@ void SwUiWriterTest::testTdf99004() { createDoc("tdf99004.docx"); calcLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nTextbox1Top = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/bounds", "top").toInt32(); sal_Int32 nTextBox1Height = getXPath(pXmlDoc, "/root/page/body/txt/anchored/fly/infos/bounds", "height").toInt32(); sal_Int32 nTextBox1Bottom = nTextbox1Top + nTextBox1Height; @@ -5634,7 +5634,7 @@ void SwUiWriterTest::testTdf104032() void SwUiWriterTest::testTdf104440() { createDoc("tdf104440.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//page[2]/body/txt/anchored"); xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; // This was 0: both Text Frames in the document were anchored to a @@ -5647,7 +5647,7 @@ void SwUiWriterTest::testTdf104440() void SwUiWriterTest::testTdf104425() { createDoc("tdf104425.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // The document contains one top-level 1-cell table with minimum row height set to 70 cm, // and the cell contents does not exceed the minimum row height. // It should span over 3 pages. @@ -5709,7 +5709,7 @@ void SwUiWriterTest::testTdf35021_tabOverMarginDemo() #if HAVE_MORE_FONTS createDoc("tdf35021_tabOverMarginDemo.doc"); calcLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Tabs should go past the margin @ ~3381 sal_Int32 nMargin = getXPath(pXmlDoc, "//body/txt[1]/infos/prtBounds", "width").toInt32(); // left tab was 3381 because it got its own full line @@ -5731,7 +5731,7 @@ void SwUiWriterTest::testTdf106701_tabOverMarginAutotab() { createDoc("tdf106701_tabOverMarginAutotab.doc"); calcLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // The right margin is ~3378 sal_Int32 nRightMargin = getXPath(pXmlDoc, "//body/txt[1]/infos/prtBounds", "width").toInt32(); // Automatic tabstops should never be affected by tabOverMargin compatibility @@ -5743,7 +5743,7 @@ void SwUiWriterTest::testTdf106701_tabOverMarginAutotab() void SwUiWriterTest::testTdf104492() { createDoc("tdf104492.docx"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // The document should split table over 3 pages. assertXPath(pXmlDoc, "//page", 3); } @@ -5755,7 +5755,7 @@ void SwUiWriterTest::testTdf107025() // break into multiple lines because of overflow. // The test document uses DFKAI-SB shipped with Windows. createDoc("tdf107025.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Verify the number of characters in each line. CPPUNIT_ASSERT_EQUAL( sal_Int32(1), getXPath(pXmlDoc, "(//Text[@nType='PortionType::Text'])[1]", "nLength").toInt32()); CPPUNIT_ASSERT_EQUAL( sal_Int32(9), getXPath(pXmlDoc, "(//Text[@nType='PortionType::Text'])[2]", "nLength").toInt32()); @@ -5776,7 +5776,7 @@ void SwUiWriterTest::testTdf107025() void SwUiWriterTest::testTdf107362() { createDoc("tdf107362.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nHeight = getXPath(pXmlDoc, "(//Text[@nType='PortionType::Text'])[1]" , "nHeight").toInt32(); sal_Int32 nWidth1 = getXPath(pXmlDoc, "(//Text[@nType='PortionType::Text'])[1]" , "nWidth").toInt32(); sal_Int32 nWidth2 = getXPath(pXmlDoc, "(//Text[@nType='PortionType::Text'])[2]" , "nWidth").toInt32(); @@ -5884,7 +5884,7 @@ void SwUiWriterTest::testTdf125151_protectedB() void SwUiWriterTest::testTdf106736() { createDoc("tdf106736-grid.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nWidth = getXPath(pXmlDoc, "(//Text[@nType='PortionType::TabLeft'])[1]", "nWidth").toInt32(); // In tdf106736, width of tab overflow so that it got // width value around 9200, expected value is around 103 @@ -6032,7 +6032,7 @@ void SwUiWriterTest::testTdf72942() void SwUiWriterTest::testTdf114306() { load(DATA_DIRECTORY, "fdo114306.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // There are 2 long paragraphs in cell A1. // A part of paragraph 2 should flow over to the second page but @@ -6206,7 +6206,7 @@ void SwUiWriterTest::testRhbz1810732() void SwUiWriterTest::testTdf108524() { createDoc("tdf108524.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // In total we expect two cells containing a section. assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/section", 2); @@ -6222,7 +6222,7 @@ void SwUiWriterTest::testLinesInSectionInTable() // the middle of a multi-line paragraph: the section only contains oneliner // paragraphs instead. createDoc("lines-in-section-in-table.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // In total we expect two cells containing a section. assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/section", 2); @@ -6237,7 +6237,7 @@ void SwUiWriterTest::testLinesMoveBackwardsInSectionInTable() #if HAVE_MORE_FONTS // Assert that paragraph "4" is on page 1 and "5" is on page 2. SwDoc* pDoc = createDoc("lines-in-section-in-table.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page", 2); sal_uInt32 nPara4Node = getXPath(pXmlDoc, "/root/page[1]/body/tab/row/cell[1]/section/txt[last()]", "txtNodeIndex").toUInt32(); CPPUNIT_ASSERT_EQUAL(OUString("4"), pDoc->GetNodes()[nPara4Node]->GetTextNode()->GetText()); @@ -6266,7 +6266,7 @@ void SwUiWriterTest::testTableInSection() #if HAVE_MORE_FONTS // The document has a section, containing a table that spans over 2 pages. createDoc("table-in-sect.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // In total we expect 4 cells. assertXPath(pXmlDoc, "/root/page/body/section/tab/row/cell", 4); @@ -6282,7 +6282,7 @@ void SwUiWriterTest::testTableInNestedSection() // The document has a nested section, containing a table that spans over 2 pages. // This crashed the layout. createDoc("rhbz739252-3.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Make sure the table is inside a section and spans over 2 pages. assertXPath(pXmlDoc, "//page[1]//section/tab", 1); assertXPath(pXmlDoc, "//page[2]//section/tab", 1); @@ -6293,7 +6293,7 @@ void SwUiWriterTest::testTdf112741() { #if HAVE_MORE_FONTS createDoc("tdf112741.fodt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was 5 pages. assertXPath(pXmlDoc, "//page", 4); assertXPath(pXmlDoc, "//page[1]/body/tab/row/cell/tab/row/cell/section", 1); @@ -6318,7 +6318,7 @@ void SwUiWriterTest::testTdf113287() { #if HAVE_MORE_FONTS createDoc("tdf113287.fodt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "//page", 2); sal_uInt32 nCellTop = getXPath(pXmlDoc, "//page[2]/body/tab/row/cell[1]/infos/bounds", "top").toUInt32(); sal_uInt32 nSectionTop = getXPath(pXmlDoc, "//page[2]/body/tab/row/cell[1]/section/infos/bounds", "top").toUInt32(); @@ -6338,7 +6338,7 @@ void SwUiWriterTest::testTdf113445() pView->SetViewLayout(/*nColumns=*/2, /*bBookMode=*/false); calcLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "//page", 2); sal_uInt32 nPage1Left = getXPath(pXmlDoc, "//page[1]/infos/bounds", "left").toUInt32(); sal_uInt32 nPage2Left = getXPath(pXmlDoc, "//page[2]/infos/bounds", "left").toUInt32(); @@ -6369,7 +6369,7 @@ void SwUiWriterTest::testTdf113686() { #if HAVE_MORE_FONTS SwDoc* pDoc = createDoc("tdf113686.fodt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page", 2); sal_uInt32 nPage1LastNode = getXPath(pXmlDoc, "/root/page[1]/body/tab/row/cell[1]/tab/row/cell[1]/txt[last()]", "txtNodeIndex").toUInt32(); CPPUNIT_ASSERT_EQUAL(OUString("Table2:A1-P10"), pDoc->GetNodes()[nPage1LastNode]->GetTextNode()->GetText()); @@ -6417,7 +6417,7 @@ void SwUiWriterTest::testSectionInTableInTable2() { #if HAVE_MORE_FONTS createDoc("split-section-in-nested-table.fodt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_uInt32 nSection1 = getXPath(pXmlDoc, "//page[1]//body/tab/row/cell/tab/row/cell/section", "id").toUInt32(); sal_uInt32 nSection1Follow = getXPath(pXmlDoc, "//page[1]//body/tab/row/cell/tab/row/cell/section", "follow").toUInt32(); // This failed, the section wasn't split inside a nested table. @@ -6447,7 +6447,7 @@ void SwUiWriterTest::testSectionInTableInTable3() // This never returned. calcLayout(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_uInt32 nTable1 = getXPath(pXmlDoc, "//page[1]//body/tab", "id").toUInt32(); sal_uInt32 nTable1Follow = getXPath(pXmlDoc, "//page[1]//body/tab", "follow").toUInt32(); sal_uInt32 nTable2 = getXPath(pXmlDoc, "//page[2]//body/tab", "id").toUInt32(); @@ -6468,7 +6468,7 @@ void SwUiWriterTest::testSectionInTableInTable4() { #if HAVE_MORE_FONTS SwDoc* pDoc = createDoc("tdf113520.fodt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page", 3); sal_uInt32 nPage1LastNode = getXPath(pXmlDoc, "/root/page[1]/body/tab/row/cell[1]/tab/row/cell[1]/section/txt[last()]", "txtNodeIndex").toUInt32(); CPPUNIT_ASSERT_EQUAL(OUString("Section1:P10"), pDoc->GetNodes()[nPage1LastNode]->GetTextNode()->GetText()); @@ -6506,7 +6506,7 @@ void SwUiWriterTest::testTdf112160() #if HAVE_MORE_FONTS // Assert that the A2 cell is on page 1. SwDoc* pDoc = createDoc("tdf112160.fodt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_uInt32 nA2CellNode = getXPath(pXmlDoc, "/root/page[1]/body/tab/row[2]/cell[1]/section/txt[last()]", "txtNodeIndex").toUInt32(); CPPUNIT_ASSERT_EQUAL(OUString("Table1.A2"), pDoc->GetNodes()[nA2CellNode]->GetTextNode()->GetText()); @@ -6563,7 +6563,7 @@ void SwUiWriterTest::testTdf112448() createDoc("tdf112448.odt"); // check actual number of line breaks in the paragraph - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "/root/page/body/txt/LineBreak", 2); } @@ -6837,7 +6837,7 @@ void SwUiWriterTest::testHtmlCopyImages() SwWriter aWrt(aStream, *pDoc); aWrt.Write(xWrt); } - htmlDocPtr pHtmlDoc = parseHtml(maTempFile); + htmlDocUniquePtr pHtmlDoc = parseHtml(maTempFile); CPPUNIT_ASSERT(pHtmlDoc); // This failed, image was lost during HTML copy. @@ -6922,7 +6922,7 @@ void SwUiWriterTest::testFontEmbedding() OString aContentBaseXpath("/office:document-content/office:font-face-decls"); OString aSettingsBaseXpath("/office:document-settings/office:settings/config:config-item-set"); - xmlDocPtr pXmlDoc = nullptr; + xmlDocUniquePtr pXmlDoc; uno::Sequence<beans::PropertyValue> aDescriptor; utl::TempFile aTempFile; aTempFile.EnableKillingFile(); @@ -7092,7 +7092,7 @@ void SwUiWriterTest::testInconsistentBookmark() save("writer8", aTempFile); // load only content.xml - if (xmlDocPtr pXmlDoc = parseExportInternal(aTempFile.GetURL(), "content.xml")) + if (xmlDocUniquePtr pXmlDoc = parseExportInternal(aTempFile.GetURL(), "content.xml")) { const OString aPath("/office:document-content/office:body/office:text/text:p"); diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 7eb427901bf2..086a9122ba98 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -136,7 +136,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdfChangeNumberingListAutoFormat) CPPUNIT_ASSERT(pViewShell); pViewShell->Reformat(); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Check that we actually test the line we need assertXPathContent(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]", "GHI GHI GHI GHI"); @@ -980,7 +980,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf123102) createDoc("tdf123102.odt"); // insert a new row after a vertically merged cell dispatchCommand(mxComponent, ".uno:InsertRowsAfter", {}); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // This was "3." - caused by the hidden numbered paragraph of the new merged cell assertXPath(pXmlDoc, "/root/page/body/tab/row[6]/cell[1]/txt/Special", "rText", "2."); } @@ -2355,7 +2355,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf118311) // .uno:Cut doesn't remove the table, only the selected content of the first cell dispatchCommand(mxComponent, ".uno:Cut", {}); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "//page[1]//body/tab"); // .uno:SelectAll selects the whole table, and UNO command Cut cuts it @@ -2486,7 +2486,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf90069) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf129655) { createDoc("tdf129655-vtextbox.odt"); - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "//fly/txt[@WritingMode='Vertical']", 1); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index 9375b589b06f..0f0f9bebd713 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -99,7 +99,7 @@ DECLARE_WW8EXPORT_TEST(testTdf37153, "tdf37153_considerWrapOnObjPos.doc") CPPUNIT_ASSERT_EQUAL(text::VertOrientation::BOTTOM, getProperty<sal_Int16>(xTable->getCellByName("A1"), "VertOrient")); //For MSO compatibility, the image should be at the top of the cell, not at the bottom - despite VertOrientation::BOTTOM - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nFlyTop = getXPath(pXmlDoc, "/root/page/body/tab/row/cell[1]/txt/anchored/fly/infos/bounds", "top").toInt32(); CPPUNIT_ASSERT_MESSAGE("FlyTop should be 3820, not 6623", nFlyTop < 4000); sal_Int32 nTextTop = getXPath(pXmlDoc, "/root/page/body/tab/row/cell[2]/txt[1]/infos/bounds", "top").toInt32(); @@ -979,7 +979,7 @@ DECLARE_WW8EXPORT_TEST(testTdf117503, "tdf117503.docx") DECLARE_WW8EXPORT_TEST(testTdf117885, "tdf117885.doc") { - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); /* Get the vertical position of the paragraph containing the text "Start" */ sal_Int32 nParaA_Top = getXPath(pXmlDoc, diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx index 60b652c59b77..44bfe8158cec 100644 --- a/sw/qa/inc/swmodeltestbase.hxx +++ b/sw/qa/inc/swmodeltestbase.hxx @@ -451,12 +451,12 @@ protected: } /// Similar to parseExport(), but this gives the xmlDocPtr of the layout dump. - xmlDocPtr parseLayoutDump() + xmlDocUniquePtr parseLayoutDump() { if (!mpXmlBuffer) dumpLayout(mxComponent); - return xmlParseMemory(reinterpret_cast<const char*>(xmlBufferContent(mpXmlBuffer)), xmlBufferLength(mpXmlBuffer)); + return xmlDocUniquePtr(xmlParseMemory(reinterpret_cast<const char*>(xmlBufferContent(mpXmlBuffer)), xmlBufferLength(mpXmlBuffer))); } /** @@ -466,9 +466,9 @@ protected: */ OUString parseDump(const OString& aXPath, const OString& aAttribute = OString()) { - xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - xmlXPathContextPtr pXmlXpathCtx = xmlXPathNewContext(pXmlDoc); + xmlXPathContextPtr pXmlXpathCtx = xmlXPathNewContext(pXmlDoc.get()); xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST(aXPath.getStr()), pXmlXpathCtx); CPPUNIT_ASSERT_MESSAGE("xpath evaluation failed", pXmlXpathObj); xmlChar *pXpathStrResult; @@ -499,7 +499,6 @@ protected: xmlFree(pXpathStrResult); xmlFree(pXmlXpathObj); xmlFree(pXmlXpathCtx); - xmlFreeDoc(pXmlDoc); return aRet; } @@ -919,7 +918,7 @@ protected: * xml stream, and asserting an XPath expression. This method returns the * xml stream, so that you can do the asserting. */ - xmlDocPtr parseExport(const OUString& rStreamName = OUString("word/document.xml")) + xmlDocUniquePtr parseExport(const OUString& rStreamName = OUString("word/document.xml")) { if (!mbExported) return nullptr; @@ -932,7 +931,7 @@ protected: * To be used when the exporter doesn't create zip archives, but single files * (like Flat ODF Export) */ - xmlDocPtr parseExportedFile() + xmlDocUniquePtr parseExportedFile() { return parseXmlStream(maTempFile.GetStream(StreamMode::READ)); } @@ -947,11 +946,11 @@ protected: return pStream; } - xmlDocPtr parseExportInternal(const OUString& url, const OUString& rStreamName) + xmlDocUniquePtr parseExportInternal(const OUString& url, const OUString& rStreamName) { std::unique_ptr<SvStream> pStream(parseExportStream(url, rStreamName)); - xmlDocPtr pXmlDoc = parseXmlStream(pStream.get()); + xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); pXmlDoc->name = reinterpret_cast<char *>(xmlStrdup(reinterpret_cast<xmlChar const *>(OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr()))); return pXmlDoc; } diff --git a/test/qa/cppunit/test_xpath.cxx b/test/qa/cppunit/test_xpath.cxx index a5693d1c9f76..12852fc7dc6e 100644 --- a/test/qa/cppunit/test_xpath.cxx +++ b/test/qa/cppunit/test_xpath.cxx @@ -19,7 +19,7 @@ CPPUNIT_TEST_FIXTURE(TestXPath, test_getXPath) { const xmlChar s_xml[] = "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" "<xml><item attrib='val'>text</item></xml>"; - xmlDocPtr pTable = xmlParseDoc(s_xml); + xmlDocUniquePtr pTable(xmlParseDoc(s_xml)); CPPUNIT_ASSERT(pTable); // Must get existing element content without errors CPPUNIT_ASSERT_ASSERTION_PASS(getXPath(pTable, "/xml/item", "")); diff --git a/test/source/htmltesttools.cxx b/test/source/htmltesttools.cxx index cf4c25cf808a..9f9a1bbddfc6 100644 --- a/test/source/htmltesttools.cxx +++ b/test/source/htmltesttools.cxx @@ -11,10 +11,10 @@ #include <memory> -htmlDocPtr HtmlTestTools::parseHtml(utl::TempFile const & aTempFile) +htmlDocUniquePtr HtmlTestTools::parseHtml(utl::TempFile const & aTempFile) { SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ); - htmlDocPtr doc = parseHtmlStream(&aFileStream); + htmlDocUniquePtr doc = parseHtmlStream(&aFileStream); xmlFree(doc->name); doc->name = reinterpret_cast<char *>( xmlStrdup( @@ -24,13 +24,13 @@ htmlDocPtr HtmlTestTools::parseHtml(utl::TempFile const & aTempFile) return doc; } -htmlDocPtr HtmlTestTools::parseHtmlStream(SvStream* pStream) +htmlDocUniquePtr HtmlTestTools::parseHtmlStream(SvStream* pStream) { std::size_t nSize = pStream->remainingSize(); std::unique_ptr<sal_uInt8[]> pBuffer(new sal_uInt8[nSize + 1]); pStream->ReadBytes(pBuffer.get(), nSize); pBuffer[nSize] = 0; - return htmlParseDoc(reinterpret_cast<xmlChar*>(pBuffer.get()), nullptr); + return htmlDocUniquePtr(htmlParseDoc(reinterpret_cast<xmlChar*>(pBuffer.get()), nullptr)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx index f89c127171bd..fc739ab479a8 100644 --- a/test/source/xmltesttools.cxx +++ b/test/source/xmltesttools.cxx @@ -42,13 +42,13 @@ XmlTestTools::XmlTestTools() XmlTestTools::~XmlTestTools() {} -xmlDocPtr XmlTestTools::parseXml(utl::TempFile const & aTempFile) +xmlDocUniquePtr XmlTestTools::parseXml(utl::TempFile const & aTempFile) { SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ); return parseXmlStream(&aFileStream); } -xmlDocPtr XmlTestTools::parseXmlStream(SvStream* pStream) +xmlDocUniquePtr XmlTestTools::parseXmlStream(SvStream* pStream) { std::size_t nSize = pStream->remainingSize(); std::unique_ptr<sal_uInt8[]> pBuffer(new sal_uInt8[nSize + 1]); @@ -56,10 +56,10 @@ xmlDocPtr XmlTestTools::parseXmlStream(SvStream* pStream) pBuffer[nSize] = 0; auto pCharBuffer = reinterpret_cast<xmlChar*>(pBuffer.get()); SAL_INFO("test", "XmlTestTools::parseXmlStream: pBuffer is '" << pCharBuffer << "'"); - return xmlParseDoc(pCharBuffer); + return xmlDocUniquePtr(xmlParseDoc(pCharBuffer)); } -xmlDocPtr XmlTestTools::dumpAndParse(MetafileXmlDump& rDumper, const GDIMetaFile& rGDIMetaFile) +xmlDocUniquePtr XmlTestTools::dumpAndParse(MetafileXmlDump& rDumper, const GDIMetaFile& rGDIMetaFile) { SvMemoryStream aStream; rDumper.dump(rGDIMetaFile, aStream); @@ -67,9 +67,9 @@ xmlDocPtr XmlTestTools::dumpAndParse(MetafileXmlDump& rDumper, const GDIMetaFile return XmlTestTools::parseXmlStream(&aStream); } -xmlXPathObjectPtr XmlTestTools::getXPathNode(xmlDocPtr pXmlDoc, const OString& rXPath) +xmlXPathObjectPtr XmlTestTools::getXPathNode(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath) { - xmlXPathContextPtr pXmlXpathCtx = xmlXPathNewContext(pXmlDoc); + xmlXPathContextPtr pXmlXpathCtx = xmlXPathNewContext(pXmlDoc.get()); registerNamespaces(pXmlXpathCtx); xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST(rXPath.getStr()), pXmlXpathCtx); xmlXPathFreeContext(pXmlXpathCtx); @@ -80,7 +80,7 @@ void XmlTestTools::registerNamespaces(xmlXPathContextPtr& /*pXmlXpathCtx*/) { } -OUString XmlTestTools::getXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rAttribute) +OUString XmlTestTools::getXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OString& rAttribute) { CPPUNIT_ASSERT(pXmlDoc); xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath); @@ -103,7 +103,7 @@ OUString XmlTestTools::getXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const return s; } -OUString XmlTestTools::getXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath) +OUString XmlTestTools::getXPathContent(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath) { xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath); switch (pXmlObj->type) @@ -159,19 +159,19 @@ OUString XmlTestTools::getXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath) CPPUNIT_FAIL("Invalid XPath type"); } -void XmlTestTools::assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath) +void XmlTestTools::assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath) { getXPath(pXmlDoc, rXPath, ""); // it asserts that rXPath exists, and returns exactly one node } -void XmlTestTools::assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rAttribute, const OUString& rExpectedValue) +void XmlTestTools::assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OString& rAttribute, const OUString& rExpectedValue) { OUString aValue = getXPath(pXmlDoc, rXPath, rAttribute); CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OStringLiteral("In <") + pXmlDoc->name + ">, attribute '" + rAttribute + "' of '" + rXPath + "' incorrect value.").getStr(), rExpectedValue, aValue); } -void XmlTestTools::assertXPathAttrs(xmlDocPtr pXmlDoc, const OString& rXPath, +void XmlTestTools::assertXPathAttrs(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const std::vector<std::pair<OString, OUString>>& aPairVector) { for (auto& rPair : aPairVector) @@ -180,7 +180,7 @@ void XmlTestTools::assertXPathAttrs(xmlDocPtr pXmlDoc, const OString& rXPath, } } -void XmlTestTools::assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, int nNumberOfNodes) +void XmlTestTools::assertXPath(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, int nNumberOfNodes) { xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath); xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; @@ -191,12 +191,12 @@ void XmlTestTools::assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, int nNu xmlXPathFreeObject(pXmlObj); } -void XmlTestTools::assertXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath, const OUString& rContent) +void XmlTestTools::assertXPathContent(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OUString& rContent) { CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OStringLiteral("In <") + pXmlDoc->name + ">, XPath contents of child does not match").getStr(), rContent, getXPathContent(pXmlDoc, rXPath)); } -void XmlTestTools::assertXPathNSDef(xmlDocPtr pXmlDoc, const OString& rXPath, +void XmlTestTools::assertXPathNSDef(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OUString& rNSPrefix, const OUString& rNSHref) { xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath); @@ -223,7 +223,7 @@ void XmlTestTools::assertXPathNSDef(xmlDocPtr pXmlDoc, const OString& rXPath, CPPUNIT_ASSERT(bFound); } -void XmlTestTools::assertXPathChildren(xmlDocPtr pXmlDoc, const OString& rXPath, int nNumberOfChildNodes) +void XmlTestTools::assertXPathChildren(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, int nNumberOfChildNodes) { #if LIBXML_VERSION >= 20703 /* xmlChildElementCount is only available in libxml2 >= 2.7.3 */ xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath); @@ -241,7 +241,7 @@ void XmlTestTools::assertXPathChildren(xmlDocPtr pXmlDoc, const OString& rXPath, #endif } -void XmlTestTools::assertXPathNoAttribute(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rAttribute) +void XmlTestTools::assertXPathNoAttribute(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OString& rAttribute) { xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath); xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; @@ -253,7 +253,7 @@ void XmlTestTools::assertXPathNoAttribute(xmlDocPtr pXmlDoc, const OString& rXPa xmlXPathFreeObject(pXmlObj); } -int XmlTestTools::getXPathPosition(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rChildName) +int XmlTestTools::getXPathPosition(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OString& rChildName) { xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath); xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx index ec53523c34e9..9f2629960cf5 100644 --- a/vcl/qa/cppunit/svm/svmtest.cxx +++ b/vcl/qa/cppunit/svm/svmtest.cxx @@ -45,10 +45,10 @@ class SvmTest : public test::BootstrapFixture, public XmlTestTools GDIMetaFile readFile(const OUString& sName); - xmlDocPtr dumpMeta(const GDIMetaFile& rMetaFile); + xmlDocUniquePtr dumpMeta(const GDIMetaFile& rMetaFile); - void checkVirtualDevice(xmlDocPtr pDoc); - void checkErase(xmlDocPtr pDoc); + void checkVirtualDevice(const xmlDocUniquePtr& pDoc); + void checkErase(const xmlDocUniquePtr& pDoc); void checkPixel(const GDIMetaFile& rMetaFile); void testPixel(); @@ -327,10 +327,10 @@ GDIMetaFile SvmTest::readFile(const OUString& sName) return readMetafile(sFilePath); } -xmlDocPtr SvmTest::dumpMeta(const GDIMetaFile& rMetaFile) +xmlDocUniquePtr SvmTest::dumpMeta(const GDIMetaFile& rMetaFile) { MetafileXmlDump dumper; - xmlDocPtr pDoc = dumpAndParse(dumper, rMetaFile); + xmlDocUniquePtr pDoc = dumpAndParse(dumper, rMetaFile); CPPUNIT_ASSERT (pDoc); checkVirtualDevice(pDoc); @@ -339,7 +339,7 @@ xmlDocPtr SvmTest::dumpMeta(const GDIMetaFile& rMetaFile) return pDoc; } -void SvmTest::checkVirtualDevice(xmlDocPtr pDoc) +void SvmTest::checkVirtualDevice(const xmlDocUniquePtr& pDoc) { assertXPath(pDoc, "/metafile/linecolor[1]", "color", "#000000"); assertXPath(pDoc, "/metafile/fillcolor[1]", "color", "#ffffff"); @@ -353,7 +353,7 @@ void SvmTest::checkVirtualDevice(xmlDocPtr pDoc) assertXPath(pDoc, "/metafile/fillcolor[2]", "color", "#ffffff"); } -void SvmTest::checkErase(xmlDocPtr pDoc) +void SvmTest::checkErase(const xmlDocUniquePtr& pDoc) { assertXPath(pDoc, "/metafile/linecolor[3]", "color", "#000000"); assertXPath(pDoc, "/metafile/fillcolor[3]", "color", "#ff0000"); @@ -366,7 +366,7 @@ void SvmTest::checkErase(xmlDocPtr pDoc) void SvmTest::checkPixel(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/pixel[1]", { {"x", "8"}, {"y", "1"}, {"color", "#008000"}, @@ -392,7 +392,7 @@ void SvmTest::testPixel() void SvmTest::checkPoint(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/point[1]", { {"x", "4"}, {"y", "4"} @@ -413,7 +413,7 @@ void SvmTest::testPoint() void SvmTest::checkLine(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/line[1]", { {"startx", "1"}, {"starty", "1"}, @@ -466,7 +466,7 @@ void SvmTest::testLine() void SvmTest::checkRect(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPath(pDoc, "/metafile/linecolor[5]", "color", "#123456"); assertXPath(pDoc, "/metafile/fillcolor[5]", "color", "#654321"); @@ -494,7 +494,7 @@ void SvmTest::testRect() void SvmTest::checkRoundRect(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPath(pDoc, "/metafile/linecolor[5]", "color", "#123456"); assertXPath(pDoc, "/metafile/fillcolor[5]", "color", "#654321"); @@ -523,7 +523,7 @@ void SvmTest::testRoundRect() void SvmTest::checkEllipse(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPath(pDoc, "/metafile/linecolor[5]", "color", "#123456"); assertXPath(pDoc, "/metafile/fillcolor[5]", "color", "#654321"); @@ -551,7 +551,7 @@ void SvmTest::testEllipse() void SvmTest::checkArc(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPath(pDoc, "/metafile/linecolor[5]", "color", "#123456"); assertXPath(pDoc, "/metafile/fillcolor[5]", "color", "#654321"); @@ -582,7 +582,7 @@ void SvmTest::testArc() void SvmTest::checkPie(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPath(pDoc, "/metafile/linecolor[5]", "color", "#123456"); assertXPath(pDoc, "/metafile/fillcolor[5]", "color", "#654321"); @@ -613,7 +613,7 @@ void SvmTest::testPie() void SvmTest::checkChord(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPath(pDoc, "/metafile/linecolor[5]", "color", "#123456"); assertXPath(pDoc, "/metafile/fillcolor[5]", "color", "#654321"); @@ -644,7 +644,7 @@ void SvmTest::testChord() void SvmTest::checkPolyLine(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/polyline[1]", { {"style", "solid"}, {"width", "0"}, @@ -712,7 +712,7 @@ void SvmTest::testPolyLine() void SvmTest::checkPolygon(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/polygon[1]/point[1]", {{"x", "1"}, {"y", "8"}}); assertXPathAttrs(pDoc, "/metafile/polygon[1]/point[2]", {{"x", "2"}, {"y", "7"}}); @@ -756,7 +756,7 @@ void SvmTest::testPolygon() void SvmTest::checkPolyPolygon(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/polypolygon[1]/polygon[1]/point[1]", {{"x", "1"}, {"y", "8"}}); assertXPathAttrs(pDoc, "/metafile/polypolygon[1]/polygon[1]/point[2]", {{"x", "2"}, {"y", "7"}}); @@ -802,7 +802,7 @@ void SvmTest::testPolyPolygon() void SvmTest::checkText(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/text[1]", { {"x", "4"}, {"y", "6"}, {"index", "1"}, {"length", "2"}, @@ -825,7 +825,7 @@ void SvmTest::testText() void SvmTest::checkTextArray(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/textarray[1]", { {"x", "4"}, {"y", "6"}, {"index", "1"}, {"length", "4"}, @@ -848,7 +848,7 @@ void SvmTest::testTextArray() void SvmTest::checkStrechText(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/stretchtext[1]", { {"x", "4"}, {"y", "6"}, {"index", "1"}, {"length", "4"}, {"width", "10"} @@ -870,7 +870,7 @@ void SvmTest::testStrechText() void SvmTest::checkTextRect(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/textrect[1]", { {"left", "0"}, {"top", "0"}, {"right", "4"}, {"bottom", "4"} @@ -892,7 +892,7 @@ void SvmTest::testTextRect() void SvmTest::checkTextLine(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/textline[1]", { {"x", "4"}, {"y", "6"}, {"width", "10"}, @@ -913,7 +913,7 @@ void SvmTest::testTextLine() void SvmTest::checkBitmaps(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); if (SkiaHelper::isVCLSkiaEnabled()) return; // TODO SKIA using CRCs is broken (the idea of it) @@ -981,7 +981,7 @@ void SvmTest::testBitmaps() void SvmTest::checkBitmapExs(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); if (SkiaHelper::isVCLSkiaEnabled()) return; // TODO SKIA using CRCs is broken (the idea of it) @@ -1160,7 +1160,7 @@ void SvmTest::testBitmapExs() void SvmTest::checkMasks(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/mask[1]", { {"x", "1"}, {"y", "2"}, @@ -1212,7 +1212,7 @@ void SvmTest::testMasks() void SvmTest::checkGradient(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/gradient[1]", { {"style", "Linear"}, @@ -1288,7 +1288,7 @@ void SvmTest::testGradientEx() void SvmTest::checkHatch(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/hatch[1]/polygon/point[1]", { {"x", "1"}, {"y", "8"}, @@ -1332,7 +1332,7 @@ void SvmTest::testHatch() void SvmTest::checkWallpaper(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); // Funny enough - we don't serialize the rectangle of the wallpaper so it's always EMPTY assertXPathAttrs(pDoc, "/metafile/wallpaper[1]", @@ -1367,7 +1367,7 @@ void SvmTest::testWallpaper() void SvmTest::checkClipRegion(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/clipregion[1]", { {"left", "2"}, @@ -1404,7 +1404,7 @@ void SvmTest::testMoveClipRegion() void SvmTest::checkLineColor(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/push/linecolor[1]", { {"color", "#654321"}, @@ -1427,7 +1427,7 @@ void SvmTest::testLineColor() void SvmTest::checkFillColor(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/push/fillcolor[1]", { {"color", "#456789"}, @@ -1450,7 +1450,7 @@ void SvmTest::testFillColor() void SvmTest::checkTextColor(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/textcolor[1]", { {"color", "#123456"}, @@ -1471,7 +1471,7 @@ void SvmTest::testTextColor() void SvmTest::checkTextFillColor(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/textfillcolor[1]", { {"color", "#234567"}, @@ -1492,7 +1492,7 @@ void SvmTest::testTextFillColor() void SvmTest::checkTextLineColor(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/textlinecolor[1]", { {"color", "#345678"}, @@ -1513,7 +1513,7 @@ void SvmTest::testTextLineColor() void SvmTest::checkOverLineColor(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/push/overlinecolor[1]", { {"color", "#345678"}, @@ -1536,7 +1536,7 @@ void SvmTest::testOverLineColor() void SvmTest::checkTextAlign(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/textalign[1]", { {"align", "bottom"}, @@ -1562,7 +1562,7 @@ void SvmTest::testFont() void SvmTest::checkPushPop(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/push[1]", {{"flags", "PushAll"}}); assertXPathAttrs(pDoc, "/metafile/push[1]/linecolor[1]", {{"color", "#800000"}}); @@ -1600,7 +1600,7 @@ void SvmTest::testPushPop() void SvmTest::checkRasterOp(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/rasterop[1]", { {"operation", "xor"}, @@ -1621,7 +1621,7 @@ void SvmTest::testRasterOp() void SvmTest::checkTransparent(const GDIMetaFile& rMetaFile) { - xmlDocPtr pDoc = dumpMeta(rMetaFile); + xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); assertXPathAttrs(pDoc, "/metafile/transparent[1]", { {"transparence", "50"}, diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx index cf50d2d9da52..e6ca36fed947 100644 --- a/writerperfect/qa/unit/EPUBExportTest.cxx +++ b/writerperfect/qa/unit/EPUBExportTest.cxx @@ -40,7 +40,7 @@ class EPUBExportTest : public test::BootstrapFixture, protected: uno::Reference<lang::XComponent> mxComponent; utl::TempFile maTempFile; - xmlDocPtr mpXmlDoc = nullptr; + xmlDocUniquePtr mpXmlDoc; uno::Reference<packages::zip::XZipFileAccess2> mxZipFile; OUString maFilterOptions; @@ -50,7 +50,7 @@ public: void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override; void createDoc(const OUString& rFile, const uno::Sequence<beans::PropertyValue>& rFilterData); /// Returns an XML representation of the stream named rName in the exported package. - xmlDocPtr parseExport(const OUString& rName); + xmlDocUniquePtr parseExport(const OUString& rName); /// Parses a CSS representation of the stream named rName and returns it. std::map<OUString, std::vector<OUString>> parseCss(const OUString& rName); /// Looks up a key of a class in rCss. @@ -70,11 +70,7 @@ void EPUBExportTest::tearDown() if (mxComponent.is()) mxComponent->dispose(); - if (mpXmlDoc) - { - xmlFreeDoc(mpXmlDoc); - mpXmlDoc = nullptr; - } + mpXmlDoc.reset(); test::BootstrapFixture::tearDown(); } @@ -108,7 +104,7 @@ void EPUBExportTest::createDoc(const OUString& rFile, = packages::zip::ZipFileAccess::createWithURL(mxComponentContext, maTempFile.GetURL()); } -xmlDocPtr EPUBExportTest::parseExport(const OUString& rName) +xmlDocUniquePtr EPUBExportTest::parseExport(const OUString& rName) { uno::Reference<io::XInputStream> xInputStream(mxZipFile->getByName(rName), uno::UNO_QUERY); std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); @@ -780,7 +776,6 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testPageSize) assertXPath(mpXmlDoc, "/xhtml:html/xhtml:head/xhtml:meta[@name='viewport']", "content", "width=816, height=1056"); - xmlFreeDoc(mpXmlDoc); mpXmlDoc = parseExport("OEBPS/images/image0001.svg"); // This was 288mm, logic->logic conversion input was a pixel value. assertXPath(mpXmlDoc, "/svg:svg", "width", "216mm"); @@ -835,8 +830,6 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTdf115623SplitByChapter) OUString aClass = getXPath(mpXmlDoc, "//xhtml:body", "class"); CPPUNIT_ASSERT_EQUAL(OUString("vertical-rl"), EPUBExportTest::getCss(aCssDoc, aClass, "writing-mode")); - xmlFreeDoc(mpXmlDoc); - mpXmlDoc = nullptr; } // Split HTML should keep the same writing-mode. { @@ -857,8 +850,6 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testTdf115623ManyPageSpans) OUString aClass = getXPath(mpXmlDoc, "//xhtml:body", "class"); CPPUNIT_ASSERT_EQUAL(OUString("vertical-rl"), EPUBExportTest::getCss(aCssDoc, aClass, "writing-mode")); - xmlFreeDoc(mpXmlDoc); - mpXmlDoc = nullptr; } { mpXmlDoc = parseExport("OEBPS/sections/section0002.xhtml"); diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx index 0475ff966127..eaecd6b7a9e5 100644 --- a/xmlsecurity/qa/unit/signing/signing.cxx +++ b/xmlsecurity/qa/unit/signing/signing.cxx @@ -746,7 +746,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testXAdESNotype) xMetaInf->openStreamElement("documentsignatures.xml", embed::ElementModes::READ), uno::UNO_QUERY); std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); - xmlDocPtr pXmlDoc = parseXmlStream(pStream.get()); + xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // Without the accompanying fix in place, this test would have failed with "unexpected 'Type' // attribute", i.e. the signature without such an attribute was not preserved correctly. @@ -806,7 +806,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testXAdES) xMetaInf->openStreamElement("documentsignatures.xml", embed::ElementModes::READ), uno::UNO_QUERY); std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); - xmlDocPtr pXmlDoc = parseXmlStream(pStream.get()); + xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // Assert that the digest algorithm is SHA-256 in the bAdESCompliant case, not SHA-1. assertXPath(pXmlDoc, |