diff options
author | Justin Luth <jluth@mail.com> | 2024-08-10 14:57:54 +0200 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2024-08-10 16:27:17 +0200 |
commit | e21cea677e787b4580cdc14e8b8aaea35bf9574c (patch) | |
tree | c363baeeb0b60069edcb01ef8d94d183845ff086 /sw | |
parent | 5111caa82918ce02f12abfd02cd61ab9942a3392 (diff) |
Revert "tdf#91632 doc import layoutInCell: vert page->margin, *->top"
This reverts commit 183f4e8f1b8dc405e3febd2f0a82769403730a4d.
Reason for revert:build failures. Must be dependent on something the DOCX one is not dependent on.
Change-Id: I81fe415c6ef82d7d100a2c7b99e47c49c4d6423e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171680
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ww8export/data/tdf91632_layoutInCellD.doc | bin | 167936 -> 0 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export4.cxx | 65 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8graf.cxx | 20 |
3 files changed, 3 insertions, 82 deletions
diff --git a/sw/qa/extras/ww8export/data/tdf91632_layoutInCellD.doc b/sw/qa/extras/ww8export/data/tdf91632_layoutInCellD.doc Binary files differdeleted file mode 100644 index 106d172c38f4..000000000000 --- a/sw/qa/extras/ww8export/data/tdf91632_layoutInCellD.doc +++ /dev/null diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx index 507f51c874a9..798e3e52da75 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -125,71 +125,6 @@ DECLARE_WW8EXPORT_TEST(testTdf141649_conditionalText, "tdf141649_conditionalText getParagraph(1, u"trueResult"_ustr); } -DECLARE_WW8EXPORT_TEST(testTdf91632_layoutInCellD, "tdf91632_layoutInCellD.doc") -{ - // given a table with two layoutInCell images, and cell A1 has 1/2 inch border padding (margin) - // - A1 contains an image, vertically aligned to the outside of the page (aka cell) - // - B1 contains an image, vertically aligned from top of the page (aka cell) - - // In Microsoft's layoutInCell implementation, vertical "page" is identical to "margin", - // and everything (including center/bottom) actually is oriented to the top of the margin. - - xmlDocUniquePtr pDump = parseLayoutDump(); - // Cell A1 - sal_Int32 nShapeTop - = getXPath(pDump, "//tab/row[1]/cell[1]/txt[1]/anchored/fly/SwAnchoredObject/bounds"_ostr, - "top"_ostr) - .toInt32(); - sal_Int32 nShapeBottom - = getXPath(pDump, "//tab/row[1]/cell[1]/txt[1]/anchored/fly/SwAnchoredObject/bounds"_ostr, - "bottom"_ostr) - .toInt32(); - // use paragraph 1 to indicate where the cell spacing/padding ends, and the text starts. - sal_Int32 nPara1Top - = getXPath(pDump, "//tab/row[1]/cell[1]/txt[1]/infos/bounds"_ostr, "top"_ostr).toInt32(); - // use paragraph 5 to prove the image is not at the bottom. - CPPUNIT_ASSERT_EQUAL(OUString("Below logo"), - getXPathContent(pDump, "//tab/row[1]/cell[1]/txt[5]"_ostr)); - sal_Int32 nPara5Top - = getXPath(pDump, "//tab/row[1]/cell[1]/txt[5]/infos/bounds"_ostr, "top"_ostr).toInt32(); - CPPUNIT_ASSERT_EQUAL(nShapeTop, nPara1Top); - CPPUNIT_ASSERT(nPara5Top > nShapeBottom); // ShapeBottom is higher than Para5Top - - // In the file it is specified as "page" (PAGE_FRAME), but implemented as if it were "margin" - // so on import we intentionally changed it to match the closest setting to the implementation. - const auto& xShape = getShape(1); - CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PAGE_PRINT_AREA, - getProperty<sal_Int16>(xShape, u"VertOrientRelation"_ustr)); - - CPPUNIT_ASSERT(getProperty<bool>(xShape, u"IsFollowingTextFlow"_ustr)); - - // Cell B1 - nShapeTop - = getXPath(pDump, "//tab/row[1]/cell[2]/txt[1]/anchored/fly/SwAnchoredObject/bounds"_ostr, - "top"_ostr) - .toInt32(); - nShapeBottom - = getXPath(pDump, "//tab/row[1]/cell[2]/txt[1]/anchored/fly/SwAnchoredObject/bounds"_ostr, - "bottom"_ostr) - .toInt32(); - // use paragraph 1 to indicate where the cell spacing/padding ends, and the text starts. - nPara1Top - = getXPath(pDump, "//tab/row[1]/cell[2]/txt[1]/infos/bounds"_ostr, "top"_ostr).toInt32(); - // use paragraph 5 to prove the image is not at the bottom. - CPPUNIT_ASSERT_EQUAL(OUString("Below image"), - getXPathContent(pDump, "//tab/row[1]/cell[2]/txt[5]"_ostr)); - nPara5Top - = getXPath(pDump, "//tab[1]/row/cell[2]/txt[5]/infos/bounds"_ostr, "top"_ostr).toInt32(); - CPPUNIT_ASSERT_EQUAL(nShapeTop, nPara1Top); - CPPUNIT_ASSERT(nPara5Top > nShapeBottom); // ShapeBottom is higher than Para5Top - - const auto& xShape2 = getShape(2); - CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PAGE_PRINT_AREA, - getProperty<sal_Int16>(xShape2, u"VertOrientRelation"_ustr)); - - CPPUNIT_ASSERT(getProperty<bool>(xShape2, u"IsFollowingTextFlow"_ustr)); -} - CPPUNIT_TEST_FIXTURE(Test, testEndnotesAtSectEndDOC) { // Given a document, endnotes at collected at section end: diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 8e520c8a5ea1..71906dea342e 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -2466,11 +2466,10 @@ RndStdIds SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec& rRecord, WW8_FS // at frame|character and has wrap through, but its attribute // 'layout in table cell' isn't set, convert its horizontal alignment to page text area. // #i84783# - use new method <IsObjectLayoutInTableCell()> - const bool bIsObjectLayoutInTableCell - = m_nInTable && IsObjectLayoutInTableCell(rRecord.nGroupShapeBooleanProperties); - if (!bIsObjectLayoutInTableCell && m_nInTable && + if (m_nInTable && (eHoriRel == text::RelOrientation::FRAME || eHoriRel == text::RelOrientation::CHAR) && - rFSPA.nwr == 3) + rFSPA.nwr == 3 && + !IsObjectLayoutInTableCell(rRecord.nGroupShapeBooleanProperties)) { eHoriRel = text::RelOrientation::PAGE_PRINT_AREA; } @@ -2498,19 +2497,6 @@ RndStdIds SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec& rRecord, WW8_FS eVertOri = aVertOriTab[ nYAlign ]; } - if (bIsObjectLayoutInTableCell && eAnchor == RndStdIds::FLY_AT_CHAR) - { - // Microsoft is buggy and inconsistent in how they handle layoutInCell. - // Map wrongly-implemented settings to the closest implemented setting - - // "page" is implemented as if it was "margin" - to cell spacing, not edge - if (eVertRel == text::RelOrientation::PAGE_FRAME) - eVertRel = text::RelOrientation::PAGE_PRINT_AREA; - // only "from top" and "top" are appropriate. Others are implemented as Top - if (eVertOri != text::VertOrientation::NONE) - eVertOri = text::VertOrientation::TOP; - } - // Below line in word is a positive value, while in writer its // negative tools::Long nYPos = rFSPA.nYaTop; |