sw/qa/core/layout/layout.cxx | 24 ++++++------ sw/qa/core/objectpositioning/objectpositioning.cxx | 42 ++++++++++++--------- sw/qa/extras/layout/layout2.cxx | 37 +++++++++++------- sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 8 ++-- sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 6 +-- sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 4 +- sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 10 ++--- sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 6 +-- sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 6 +-- sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 2 - sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 4 +- sw/qa/extras/uiwriter/uiwriter2.cxx | 2 - sw/source/core/text/xmldump.cxx | 21 ++++++++++ 13 files changed, 104 insertions(+), 68 deletions(-)
New commits: commit 3d64587c53eea47674d51e84622a167db1635909 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue Apr 13 20:04:27 2021 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Apr 14 18:54:14 2021 +0200 sw: layout dump: sorted_objs of SwPageFrame Change-Id: I2bf8493744d054c513ab9b65136b6e29e9aa07f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114065 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index 794752206035..f1880bffab67 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -163,12 +163,12 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testAnchorPositionBasedOnParagraph) load(DATA_DIRECTORY, "tdf134783_testAnchorPositionBasedOnParagraph.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); CPPUNIT_ASSERT(pXmlDoc); - assertXPath(pXmlDoc, "(//SwAnchoredDrawObject)[1]/bounds", "top", "1671"); - assertXPath(pXmlDoc, "(//SwAnchoredDrawObject)[1]/bounds", "bottom", "1732"); - assertXPath(pXmlDoc, "(//SwAnchoredDrawObject)[2]/bounds", "top", "1947"); - assertXPath(pXmlDoc, "(//SwAnchoredDrawObject)[2]/bounds", "bottom", "2008"); - assertXPath(pXmlDoc, "(//SwAnchoredDrawObject)[3]/bounds", "top", "3783"); - assertXPath(pXmlDoc, "(//SwAnchoredDrawObject)[3]/bounds", "bottom", "3844"); + assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[1]/bounds", "top", "1671"); + assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[1]/bounds", "bottom", "1732"); + assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[2]/bounds", "top", "1947"); + assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[2]/bounds", "bottom", "2008"); + assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[3]/bounds", "top", "3783"); + assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[3]/bounds", "bottom", "3844"); } CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxStaysInsideShape) @@ -181,8 +181,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxStaysInsideShape) // Without the fix in place, this test would have failed with // - Expected: 1932 // - Actual : 7476 - assertXPath(pXmlDoc, "//fly/infos/bounds", "top", "1932"); - assertXPath(pXmlDoc, "//fly/infos/bounds", "bottom", "7184"); + assertXPath(pXmlDoc, "//anchored/fly/infos/bounds", "top", "1932"); + assertXPath(pXmlDoc, "//anchored/fly/infos/bounds", "bottom", "7184"); } CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxNotModifiedOnOpen) @@ -210,10 +210,10 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxAutoGrowVertical) discardDumpedLayout(); xmlDocUniquePtr pLayout = parseLayoutDump(); CPPUNIT_ASSERT(pLayout); - sal_Int32 nFlyLeft = getXPath(pLayout, "//fly/infos/bounds", "left").toInt32(); - sal_Int32 nFlyTop = getXPath(pLayout, "//fly/infos/bounds", "top").toInt32(); - sal_Int32 nFlyRight = getXPath(pLayout, "//fly/infos/bounds", "right").toInt32(); - sal_Int32 nFlyBottom = getXPath(pLayout, "//fly/infos/bounds", "bottom").toInt32(); + sal_Int32 nFlyLeft = getXPath(pLayout, "//anchored/fly/infos/bounds", "left").toInt32(); + sal_Int32 nFlyTop = getXPath(pLayout, "//anchored/fly/infos/bounds", "top").toInt32(); + sal_Int32 nFlyRight = getXPath(pLayout, "//anchored/fly/infos/bounds", "right").toInt32(); + sal_Int32 nFlyBottom = getXPath(pLayout, "//anchored/fly/infos/bounds", "bottom").toInt32(); tools::Rectangle aFlyRect(nFlyLeft, nFlyTop, nFlyRight, nFlyBottom); // Without the accompanying fix in place, this test would have failed, as aFlyRect was too wide, // so it was not inside aShapeRect anymore. diff --git a/sw/qa/core/objectpositioning/objectpositioning.cxx b/sw/qa/core/objectpositioning/objectpositioning.cxx index 9817b9b05233..7c91bc797512 100644 --- a/sw/qa/core/objectpositioning/objectpositioning.cxx +++ b/sw/qa/core/objectpositioning/objectpositioning.cxx @@ -65,7 +65,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreObjectpositioningTest, testVertPosFromBottom) xmlDocUniquePtr pXmlDoc = parseLayoutDump(); sal_Int32 nBodyBottom = getXPath(pXmlDoc, "//body/infos/bounds", "bottom").toInt32(); sal_Int32 nAnchoredBottom - = getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "bottom").toInt32(); + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject/bounds", "bottom").toInt32(); // Without the accompanying fix in place, this test would have failed with: // - Expected: 565 // - Actual : 9035 @@ -124,13 +124,15 @@ CPPUNIT_TEST_FIXTURE(SwCoreObjectpositioningTest, testVertAlignBottomMargin) sal_Int32 nBodyBottom = getXPath(pXmlDoc, "//body/infos/bounds", "bottom").toInt32(); //14989 sal_Int32 nPageBottom = getXPath(pXmlDoc, "//page/infos/bounds", "bottom").toInt32(); //16123 sal_Int32 nFirstShapeBottom - = getXPath(pXmlDoc, "//SwAnchoredDrawObject[1]/bounds", "bottom").toInt32(); //16124 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[1]/bounds", "bottom") + .toInt32(); //16124 sal_Int32 nSecondShapeBottom - = getXPath(pXmlDoc, "//SwAnchoredDrawObject[2]/bounds", "bottom").toInt32(); //15699 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds", "bottom") + .toInt32(); //15699 sal_Int32 nSecondShapeTop - = getXPath(pXmlDoc, "//SwAnchoredDrawObject[2]/bounds", "top").toInt32(); //15414 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds", "top").toInt32(); //15414 sal_Int32 nThirdShapeTop - = getXPath(pXmlDoc, "//SwAnchoredDrawObject[3]/bounds", "top").toInt32(); //14989 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[3]/bounds", "top").toInt32(); //14989 // Verify that the distance between the bottom of page and bottom of first shape is around 0cm. (align=bottom) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), nFirstShapeBottom - nPageBottom); @@ -194,13 +196,15 @@ CPPUNIT_TEST_FIXTURE(SwCoreObjectpositioningTest, testVertAlignBottomMarginWithF sal_Int32 nBodyBottom = getXPath(pXmlDoc, "//body/infos/bounds", "bottom").toInt32(); //14853 sal_Int32 nPageBottom = getXPath(pXmlDoc, "//page/infos/bounds", "bottom").toInt32(); //17121 sal_Int32 nFirstShapeBottom - = getXPath(pXmlDoc, "//SwAnchoredDrawObject[1]/bounds", "bottom").toInt32(); //17122 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[1]/bounds", "bottom") + .toInt32(); //17122 sal_Int32 nSecondShapeTop - = getXPath(pXmlDoc, "//SwAnchoredDrawObject[2]/bounds", "top").toInt32(); //15703 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds", "top").toInt32(); //15703 sal_Int32 nSecondShapeBottom - = getXPath(pXmlDoc, "//SwAnchoredDrawObject[2]/bounds", "bottom").toInt32(); //16272 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds", "bottom") + .toInt32(); //16272 sal_Int32 nThirdShapeTop - = getXPath(pXmlDoc, "//SwAnchoredDrawObject[3]/bounds", "top").toInt32(); //14853 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[3]/bounds", "top").toInt32(); //14853 // Verify that the distance between the bottom of page and bottom of first shape is around 0cm. (align=bottom) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), nFirstShapeBottom - nPageBottom); @@ -222,9 +226,10 @@ CPPUNIT_TEST_FIXTURE(SwCoreObjectpositioningTest, testInsideOutsideVertAlignBott sal_Int32 nBodyBottom = getXPath(pXmlDoc, "//body/infos/bounds", "bottom").toInt32(); //15704 sal_Int32 nPageBottom = getXPath(pXmlDoc, "//page/infos/bounds", "bottom").toInt32(); //17121 sal_Int32 nFirstShapeOutside - = getXPath(pXmlDoc, "//SwAnchoredDrawObject[1]/bounds", "bottom").toInt32(); //17098 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[1]/bounds", "bottom") + .toInt32(); //17098 sal_Int32 nSecondShapeInside - = getXPath(pXmlDoc, "//SwAnchoredDrawObject[2]/bounds", "top").toInt32(); //15694 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds", "top").toInt32(); //15694 // Verify that the distance between the bottom of page and bottom of first shape is around 0cm. (align=outside) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), nPageBottom - nFirstShapeOutside); @@ -245,17 +250,20 @@ CPPUNIT_TEST_FIXTURE(SwCoreObjectpositioningTest, testVMLVertAlignBottomMargin) sal_Int32 nPageBottom = getXPath(pXmlDoc, "//page/infos/bounds", "bottom").toInt32(); //16123 sal_Int32 nFirstVMLShapeInside - = getXPath(pXmlDoc, "//SwAnchoredDrawObject[1]/bounds", "top").toInt32(); //11802 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[1]/bounds", "top").toInt32(); //11802 sal_Int32 nSecondVMLShapeBottom - = getXPath(pXmlDoc, "//SwAnchoredDrawObject[2]/bounds", "bottom").toInt32(); //16124 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds", "bottom") + .toInt32(); //16124 sal_Int32 nThirdVMLShapeCenterBottom - = getXPath(pXmlDoc, "//SwAnchoredDrawObject[3]/bounds", "bottom").toInt32(); //14185 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[3]/bounds", "bottom") + .toInt32(); //14185 sal_Int32 nThirdVMLShapeCenterTop - = getXPath(pXmlDoc, "//SwAnchoredDrawObject[3]/bounds", "top").toInt32(); //13741 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[3]/bounds", "top").toInt32(); //13741 sal_Int32 nFourthVMLShapeTop - = getXPath(pXmlDoc, "//SwAnchoredDrawObject[4]/bounds", "top").toInt32(); //11802 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[4]/bounds", "top").toInt32(); //11802 sal_Int32 nFifthVMLShapeOutside - = getXPath(pXmlDoc, "//SwAnchoredDrawObject[5]/bounds", "bottom").toInt32(); //16124 + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[5]/bounds", "bottom") + .toInt32(); //16124 // Verify that the distance between the bottom of body and top of first VMLshape is around 0cm. (align=inside) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), nBodyBottom - nFirstVMLShapeInside); diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index aff883cff4b8..c8919f155c60 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -1982,7 +1982,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf123651) 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. - const sal_Int32 nTopValue = getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "top").toInt32(); + const sal_Int32 nTopValue + = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject/bounds", "top").toInt32(); CPPUNIT_ASSERT_DOUBLES_EQUAL(7639, nTopValue, 10); } @@ -2402,9 +2403,10 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf124601b) createDoc("tdf124601b.doc"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - sal_Int32 nFlyTop = getXPath(pXmlDoc, "//fly/infos/bounds", "top").toInt32(); - sal_Int32 nFlyLeft = getXPath(pXmlDoc, "//fly/infos/bounds", "left").toInt32(); - sal_Int32 nFlyRight = nFlyLeft + getXPath(pXmlDoc, "//fly/infos/bounds", "width").toInt32(); + sal_Int32 nFlyTop = getXPath(pXmlDoc, "//anchored/fly/infos/bounds", "top").toInt32(); + sal_Int32 nFlyLeft = getXPath(pXmlDoc, "//anchored/fly/infos/bounds", "left").toInt32(); + sal_Int32 nFlyRight + = nFlyLeft + getXPath(pXmlDoc, "//anchored/fly/infos/bounds", "width").toInt32(); sal_Int32 nSecondRowTop = getXPath(pXmlDoc, "//tab/row[2]/infos/bounds", "top").toInt32(); sal_Int32 nLastCellLeft = getXPath(pXmlDoc, "//tab/row[1]/cell[5]/infos/bounds", "left").toInt32(); @@ -2665,7 +2667,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testWriterImageNoCapture) 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(); + sal_Int32 nImageLeft = getXPath(pXmlDoc, "//anchored/fly/infos/bounds", "left").toInt32(); // Without the accompanying fix in place, this test would have failed with: // - Expected less than: 284 // - Actual : 284 @@ -2741,16 +2743,18 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf124423) { createDoc("tdf124423.docx"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - sal_Int32 nFly1Width = getXPath(pXmlDoc, "(//fly)[1]/infos/prtBounds", "width").toInt32(); - sal_Int32 nFly2Width = getXPath(pXmlDoc, "(//fly)[2]/infos/prtBounds", "width").toInt32(); + sal_Int32 nFly1Width + = getXPath(pXmlDoc, "(//anchored/fly)[1]/infos/prtBounds", "width").toInt32(); + sal_Int32 nFly2Width + = getXPath(pXmlDoc, "(//anchored/fly)[2]/infos/prtBounds", "width").toInt32(); sal_Int32 nPageWidth = getXPath(pXmlDoc, "//page/infos/prtBounds", "width").toInt32(); CPPUNIT_ASSERT_EQUAL(nPageWidth, nFly2Width); CPPUNIT_ASSERT_LESS(nPageWidth / 2, nFly1Width); createDoc("tdf124423.odt"); pXmlDoc = parseLayoutDump(); - nFly1Width = getXPath(pXmlDoc, "(//fly)[1]/infos/prtBounds", "width").toInt32(); - nFly2Width = getXPath(pXmlDoc, "(//fly)[2]/infos/prtBounds", "width").toInt32(); + nFly1Width = getXPath(pXmlDoc, "(//anchored/fly)[1]/infos/prtBounds", "width").toInt32(); + nFly2Width = getXPath(pXmlDoc, "(//anchored/fly)[2]/infos/prtBounds", "width").toInt32(); nPageWidth = getXPath(pXmlDoc, "//page/infos/prtBounds", "width").toInt32(); CPPUNIT_ASSERT_LESS(nPageWidth / 2, nFly2Width); CPPUNIT_ASSERT_LESS(nPageWidth / 2, nFly1Width); @@ -2801,9 +2805,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf135035) { createDoc("tdf135035.docx"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - sal_Int32 nFly1Width = getXPath(pXmlDoc, "(//fly)[1]/infos/prtBounds", "width").toInt32(); - sal_Int32 nFly2Width = getXPath(pXmlDoc, "(//fly)[2]/infos/prtBounds", "width").toInt32(); - sal_Int32 nFly3Width = getXPath(pXmlDoc, "(//fly)[3]/infos/prtBounds", "width").toInt32(); + sal_Int32 nFly1Width + = getXPath(pXmlDoc, "(//anchored/fly)[1]/infos/prtBounds", "width").toInt32(); + sal_Int32 nFly2Width + = getXPath(pXmlDoc, "(//anchored/fly)[2]/infos/prtBounds", "width").toInt32(); + sal_Int32 nFly3Width + = getXPath(pXmlDoc, "(//anchored/fly)[3]/infos/prtBounds", "width").toInt32(); sal_Int32 nParentWidth = getXPath(pXmlDoc, "(//txt)[1]/infos/prtBounds", "width").toInt32(); CPPUNIT_ASSERT_EQUAL(nParentWidth, nFly2Width); CPPUNIT_ASSERT_EQUAL(nParentWidth, nFly3Width); @@ -2811,9 +2818,9 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf135035) createDoc("tdf135035.odt"); pXmlDoc = parseLayoutDump(); - nFly1Width = getXPath(pXmlDoc, "(//fly)[1]/infos/prtBounds", "width").toInt32(); - nFly2Width = getXPath(pXmlDoc, "(//fly)[2]/infos/prtBounds", "width").toInt32(); - nFly3Width = getXPath(pXmlDoc, "(//fly)[3]/infos/prtBounds", "width").toInt32(); + nFly1Width = getXPath(pXmlDoc, "(//anchored/fly)[1]/infos/prtBounds", "width").toInt32(); + nFly2Width = getXPath(pXmlDoc, "(//anchored/fly)[2]/infos/prtBounds", "width").toInt32(); + nFly3Width = getXPath(pXmlDoc, "(//anchored/fly)[3]/infos/prtBounds", "width").toInt32(); nParentWidth = getXPath(pXmlDoc, "(//txt)[1]/infos/prtBounds", "width").toInt32(); CPPUNIT_ASSERT_LESS(nParentWidth / 2, nFly2Width); CPPUNIT_ASSERT_LESS(nParentWidth / 2, nFly1Width); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 592699c4f666..e77c741031b3 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -822,10 +822,10 @@ DECLARE_OOXMLEXPORT_TEST(testTextboxRightEdge, "textbox-right-edge.docx") // I'm fairly sure this is not specific to DOCX, but the doc model created // by the ODF import doesn't trigger this bug, so let's test this here // instead of uiwriter. - int nShapeLeft = parseDump("//SwAnchoredDrawObject/bounds", "left").toInt32(); - int nShapeWidth = parseDump("//SwAnchoredDrawObject/bounds", "width").toInt32(); - int nTextboxLeft = parseDump("//fly/infos/bounds", "left").toInt32(); - int nTextboxWidth = parseDump("//fly/infos/bounds", "width").toInt32(); + int nShapeLeft = parseDump("//anchored/SwAnchoredDrawObject/bounds", "left").toInt32(); + int nShapeWidth = parseDump("//anchored/SwAnchoredDrawObject/bounds", "width").toInt32(); + int nTextboxLeft = parseDump("//anchored/fly/infos/bounds", "left").toInt32(); + int nTextboxWidth = parseDump("//anchored/fly/infos/bounds", "width").toInt32(); // This is a rectangle, make sure the right edge of the textbox is still // inside the draw shape. CPPUNIT_ASSERT(nShapeLeft + nShapeWidth >= nTextboxLeft + nTextboxWidth); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 951a4d8650f2..7709c46afb66 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -1318,7 +1318,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testRelativeAnchorHeightFromTopMarginHasHead // Note: page print area top = margin + header height. // In this case the header exists. xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - assertXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "height", "2551"); + assertXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject/bounds", "height", "2551"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testRelativeAnchorHeightFromTopMarginNoHeader, @@ -1333,7 +1333,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testRelativeAnchorHeightFromTopMarginNoHeade // Note: page print area top = margin + header height. // In this case the header does not exist, so OpenDocument and OOXML margins are the same. xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - assertXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "height", "2551"); + assertXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject/bounds", "height", "2551"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf64531,"tdf64531.docx") @@ -1354,7 +1354,7 @@ DECLARE_OOXMLEXPORT_TEST(testVmlShapeTextWordWrap, "tdf97618_testVmlShapeTextWor if (!pXmlDoc) return; // The bound rect of shape will be wider if wrap does not work (the wrong value is 3167). - assertXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "width", "2500"); + assertXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject/bounds", "width", "2500"); } DECLARE_OOXMLEXPORT_TEST(testVmlLineShapeMirroredX, "tdf97517_testVmlLineShapeMirroredX.docx") diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index 3fa4c0f94d93..bacfd0d84fd8 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -893,7 +893,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testRelativeAnchorHeightFromBottomMarginHasF // Note: page print area bottom = margin + footer height. // In this case the footer exists. xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - assertXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "height", "1147"); + assertXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject/bounds", "height", "1147"); } DECLARE_OOXMLEXPORT_TEST(TestTdf132483, "tdf132483.docx") @@ -917,7 +917,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testRelativeAnchorHeightFromBottomMarginNoFo // Note: page print area bottom = margin + footer height. // In this case the footer does not exist, so OpenDocument and OOXML margins are the same. xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - assertXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "height", "1147"); + assertXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject/bounds", "height", "1147"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf133702, "tdf133702.docx") diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index d115f6f5741e..e7daad0b0240 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1140,7 +1140,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testRelativeAnchorWidthFromLeftMargin, "tdf1 // tdf#132976 The size of the width of this shape should come from the size of the left margin. // It was set to the size of the width of the entire page before. xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - assertXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "width", "1133"); + assertXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject/bounds", "width", "1133"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testRelativeAnchorWidthFromInsideOutsideMargin, "tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx") @@ -1149,13 +1149,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testRelativeAnchorWidthFromInsideOutsideMarg // The open book: outside --text-- inside | inside --text-- outside xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Inside - assertXPath(pXmlDoc, "(//SwAnchoredDrawObject)[1]/bounds", "width", "1440"); + assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[1]/bounds", "width", "1440"); // Outside - assertXPath(pXmlDoc, "(//SwAnchoredDrawObject)[2]/bounds", "width", "2552"); + assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[2]/bounds", "width", "2552"); // Outside - assertXPath(pXmlDoc, "(//SwAnchoredDrawObject)[3]/bounds", "width", "2552"); + assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[3]/bounds", "width", "2552"); // Inside - assertXPath(pXmlDoc, "(//SwAnchoredDrawObject)[4]/bounds", "width", "1440"); + assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[4]/bounds", "width", "1440"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testBodyPrUpright, "tdf123610_handle_upright.docx") diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 5289ddf23413..03eff3c65513 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -1044,8 +1044,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf102466, "tdf102466.docx") // More precisely, the table in the first page was clipped. { 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(); + sal_Int32 nFlyPrtHeight = getXPath(pXmlDoc, "(/root/page[1]//anchored/fly)[1]/infos/prtBounds", "height").toInt32(); + sal_Int32 nTableHeight = getXPath(pXmlDoc, "(/root/page[1]//anchored/fly)[1]/tab/infos/bounds", "height").toInt32(); CPPUNIT_ASSERT_MESSAGE("The table is clipped in a fly frame.", nFlyPrtHeight >= nTableHeight); } @@ -1258,7 +1258,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testRelativeAnchorWidthFromRightMargin, "tdf { // tdf#133670 The width was set relative from right margin, but this was handled relative from page width. xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - auto nWidth = getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "width").toInt32(); + auto nWidth = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject/bounds", "width").toInt32(); CPPUNIT_ASSERT_DOUBLES_EQUAL(2408, nWidth, 1); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 935c047dad21..ecc9198caa1c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -1008,9 +1008,9 @@ DECLARE_OOXMLEXPORT_TEST(testRelativeAlignmentFromTopMargin, return; xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - assertXPath(pXmlDoc, "//SwAnchoredDrawObject[1]/bounds", "top", "1502"); // center - assertXPath(pXmlDoc, "//SwAnchoredDrawObject[2]/bounds", "top", "2683"); // bottom - assertXPath(pXmlDoc, "//SwAnchoredDrawObject[3]/bounds", "top", "313"); // top + assertXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[1]/bounds", "top", "1502"); // center + assertXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[2]/bounds", "top", "2683"); // bottom + assertXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject[3]/bounds", "top", "313"); // top } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 59a2688232c8..fe15ef8d94de 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1444,7 +1444,7 @@ DECLARE_OOXMLIMPORT_TEST(testTdf122717, "tdf122717.docx") DECLARE_OOXMLIMPORT_TEST(testTdf98882, "tdf98882.docx") { - sal_Int32 nFlyHeight = parseDump("//fly/infos/bounds", "height").toInt32(); + sal_Int32 nFlyHeight = parseDump("//anchored/fly/infos/bounds", "height").toInt32(); sal_Int32 nContentHeight = parseDump("//notxt/infos/bounds", "height").toInt32(); // The content height was 600, not 360, so the frame and the content height did not match. CPPUNIT_ASSERT_EQUAL(nFlyHeight, nContentHeight); diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index fcfaccafb774..ed3b0cd153dc 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -128,7 +128,7 @@ DECLARE_OOXMLIMPORT_TEST(testTdf114212, "tdf114212.docx") // Without the accompanying fix in place, this test would have failed with: // - Expected: 1427 // - Actual : 387 - OUString aTop = parseDump("//fly[1]/infos/bounds", "top"); + OUString aTop = parseDump("//anchored/fly[1]/infos/bounds", "top"); CPPUNIT_ASSERT_EQUAL(OUString("1427"), aTop); } @@ -446,7 +446,7 @@ DECLARE_OOXMLIMPORT_TEST(testTdf112443, "tdf112443.docx") getShape(1)->getSize().Width, getShape(1)->getSize().Height); CPPUNIT_ASSERT_MESSAGE("The textframe must be off-page!", !aPageRect.IsInside(aShapeRect)); - //OUString aTop = parseDump("//fly[1]/infos/bounds", "top"); + //OUString aTop = parseDump("//anchored/fly[1]/infos/bounds", "top"); //CPPUNIT_ASSERT_EQUAL(sal_Int32(30624), aTop.toInt32() ); } diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 6ffead1dbea9..e017bc2c7077 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -3748,7 +3748,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf129655) { createDoc("tdf129655-vtextbox.odt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - assertXPath(pXmlDoc, "//fly/txt[@WritingMode='Vertical']", 1); + assertXPath(pXmlDoc, "//anchored/fly/txt[@WritingMode='Vertical']", 1); } static uno::Reference<text::XTextRange> getAssociatedTextRange(uno::Any object) diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx index 973df48ea1a6..85b7373ecd31 100644 --- a/sw/source/core/text/xmldump.cxx +++ b/sw/source/core/text/xmldump.cxx @@ -15,6 +15,7 @@ #include <pagefrm.hxx> #include <txtfrm.hxx> #include <cellfrm.hxx> +#include <flyfrm.hxx> #include <hffrm.hxx> #include <rootfrm.hxx> #include <ndtxt.hxx> @@ -399,6 +400,26 @@ void SwFrame::dumpAsXml( xmlTextWriterPtr writer ) const OUString aFormatName = pPageFrame->GetPageDesc()->GetName(); (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST("pageDesc"), "%s", BAD_CAST(OUStringToOString(aFormatName, RTL_TEXTENCODING_UTF8).getStr())); (void)xmlTextWriterEndElement(writer); + if (auto const* pObjs = pPageFrame->GetSortedObjs()) + { + (void)xmlTextWriterStartElement(writer, BAD_CAST("sorted_objs")); + for (SwAnchoredObject const*const pObj : *pObjs) + { // just print pointer, full details will be printed on its anchor frame + // this nonsense is needed because of multiple inheritance + if (SwFlyFrame const*const pFly = dynamic_cast<SwFlyFrame const*>(pObj)) + { + (void)xmlTextWriterStartElement(writer, BAD_CAST("fly")); + (void)xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("ptr"), "%p", pFly); + } + else + { + (void)xmlTextWriterStartElement(writer, BAD_CAST(pObj->getElementName())); + (void)xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("ptr"), "%p", pObj); + } + (void)xmlTextWriterEndElement(writer); + } + (void)xmlTextWriterEndElement(writer); + } } if (IsTextFrame()) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits