dev/null |binary sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 34 ++------ sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 12 --- sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 49 ------------ sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 22 ++--- sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 2 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 11 +- sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 22 ++--- sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 14 +-- sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 13 ++- sw/source/core/doc/textboxhelper.cxx | 15 +-- sw/source/core/draw/dcontact.cxx | 8 -- writerfilter/inc/dmapper/resourcemodel.hxx | 7 - writerfilter/source/dmapper/DomainMapper.cxx | 11 -- writerfilter/source/dmapper/DomainMapper.hxx | 3 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 69 ------------------ writerfilter/source/dmapper/DomainMapper_Impl.hxx | 10 -- writerfilter/source/dmapper/FontTable.hxx | 2 writerfilter/source/dmapper/GraphicImport.hxx | 2 writerfilter/source/dmapper/LoggedResources.cxx | 4 - writerfilter/source/dmapper/LoggedResources.hxx | 4 - writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 23 ------ writerfilter/source/ooxml/OOXMLFastContextHandler.hxx | 1 23 files changed, 63 insertions(+), 275 deletions(-)
New commits: commit 6593d375d5504e079730f1b448d1d2648c401ebd Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Wed Apr 12 08:19:50 2023 -0400 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Apr 12 21:32:27 2023 +0200 Revert "Related tdf#66039 DOCX import: fix Z-order of group shapes" This reverts commit 0cb370d02bebf6a9d65b5852815e2c617b33a89a. It was added for T38690 and removed for T41585 Change-Id: I2a019d739f91d9aef2765ee5142825da7ca09a32 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150290 Reviewed-by: Justin Luth <jl...@mail.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> diff --git a/sw/qa/extras/ooxmlexport/data/testWPGZOrder.docx b/sw/qa/extras/ooxmlexport/data/testWPGZOrder.docx deleted file mode 100644 index 664f47a0b623..000000000000 Binary files a/sw/qa/extras/ooxmlexport/data/testWPGZOrder.docx and /dev/null differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index 5d2d4c8fe252..42a4b0a234da 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -116,9 +116,9 @@ protected: DECLARE_OOXMLEXPORT_TEST(testWPGtextboxes, "testWPGtextboxes.docx") { - CPPUNIT_ASSERT_EQUAL(2, getShapes()); + CPPUNIT_ASSERT_EQUAL(1, getShapes()); - auto MyShape = getShape(2); + auto MyShape = getShape(1); CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GroupShape"), MyShape->getShapeType()); uno::Reference<drawing::XShapes> xGroup(MyShape, uno::UNO_QUERY_THROW); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index e889b07009ea..39efb4b0b8fc 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -21,7 +21,6 @@ #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/awt/FontSlant.hpp> #include <com/sun/star/awt/FontWeight.hpp> -#include <com/sun/star/drawing/XShapes.hpp> #include <comphelper/configuration.hxx> @@ -30,7 +29,6 @@ #include <officecfg/Office/Common.hxx> #include <comphelper/propertyvalue.hxx> -#include <queue> #include <swmodeltestbase.hxx> #include <unotxdoc.hxx> @@ -393,53 +391,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf126287, "tdf126287.docx") CPPUNIT_ASSERT_EQUAL(2, getPages()); } -DECLARE_OOXMLEXPORT_TEST(TestWPGZOrder, "testWPGZOrder.docx") -{ - // Check if the load failed. - CPPUNIT_ASSERT(mxComponent); - - // Get the WPG - uno::Reference<drawing::XShapes> xGroup(getShape(1), uno::UNO_QUERY_THROW); - uno::Reference<beans::XPropertySet> xGroupProperties(xGroup, uno::UNO_QUERY_THROW); - - // Initialize a queue for subgroups - std::queue<uno::Reference<drawing::XShapes>> xGroupList; - xGroupList.push(xGroup); - - // Every textbox shall be visible. - while (xGroupList.size()) - { - // Get the first group - xGroup = xGroupList.front(); - xGroupList.pop(); - for (sal_Int32 i = 0; i < xGroup->getCount(); ++i) - { - // Get the child shape - uno::Reference<beans::XPropertySet> xChildShapeProperties(xGroup->getByIndex(i), - uno::UNO_QUERY_THROW); - // Check for textbox - if (!xChildShapeProperties->getPropertyValue("TextBox").get<bool>()) - { - // Is this a Group Shape? Put it into the queue. - uno::Reference<drawing::XShapes> xInnerGroup(xGroup->getByIndex(i), uno::UNO_QUERY); - if (xInnerGroup) - xGroupList.push(xInnerGroup); - continue; - } - - // Get the textbox properties - uno::Reference<beans::XPropertySet> xTextBoxFrameProperties( - xChildShapeProperties->getPropertyValue("TextBoxContent"), uno::UNO_QUERY_THROW); - - // Assert that the textbox ZOrder greater than the groupshape - CPPUNIT_ASSERT_GREATER(xGroupProperties->getPropertyValue("ZOrder").get<long>(), - xTextBoxFrameProperties->getPropertyValue("ZOrder").get<long>()); - // Before the fix, this failed because that was less, and the textboxes were covered. - } - - } -} - DECLARE_OOXMLEXPORT_TEST(testTdf123642_BookmarkAtDocEnd, "tdf123642.docx") { // get bookmark interface diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index bb1d6f331dbc..bcdf25002305 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -1432,20 +1432,15 @@ bool SwTextBoxHelper::DoTextBoxZOrderCorrection(SwFrameFormat* pShape, const Sdr { // TODO: do this with group shape textboxes. SdrObject* pShpObj = nullptr; - + //if (pObj) + // pShpObj = pObj; + //else pShpObj = pShape->FindRealSdrObject(); if (pShpObj) { - auto pTextBox = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT, pObj); - SdrObject* pFrmObj = pTextBox->FindRealSdrObject(); - if (!pFrmObj) - { - // During doc-loading there is no ready SdrObj for z-ordering, so create one here and cache it. - pFrmObj - = SwXTextFrame::GetOrCreateSdrObject(*dynamic_cast<SwFlyFrameFormat*>(pTextBox)); - } - if (pFrmObj) + if (SdrObject* pFrmObj + = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT, pObj)->FindRealSdrObject()) { // Get the draw model from the doc SwDrawModel* pDrawModel diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 8a6871373ccf..d9a8bf6d2c70 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -1369,13 +1369,7 @@ void SwDrawContact::Changed_( const SdrObject& rObj, aSet.Put(aSyncSet); aSet.Put(pSdrObj->GetMergedItem(RES_FRM_SIZE)); SwTextBoxHelper::syncFlyFrameAttr(*GetFormat(), aSet, pSdrObj); - - SwTextBoxHelper::synchronizeGroupTextBoxProperty( - &SwTextBoxHelper::changeAnchor, GetFormat(), - GetFormat()->FindRealSdrObject()); - SwTextBoxHelper::synchronizeGroupTextBoxProperty( - &SwTextBoxHelper::syncTextBoxSize, GetFormat(), - GetFormat()->FindRealSdrObject()); + SwTextBoxHelper::changeAnchor(GetFormat(), pSdrObj); } else SwTextBoxHelper::syncFlyFrameAttr(*GetFormat(), aSyncSet, GetFormat()->FindRealSdrObject()); commit 683691928fa0b857c04b132770b464f3cc1d0f24 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Wed Apr 12 08:17:01 2023 -0400 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Apr 12 21:32:17 2023 +0200 Revert "tdf#66039 DOCX: import textboxes (with tables, images etc.) ... in group shapes" This reverts commit c4f3aa127ad33fe691b00336cdc9d6c88a9ebfb9. It was added for T38690 and removed for T41585 Change-Id: I55631e3e2b0035bb133363761d30f2724f6c4741 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150288 Reviewed-by: Justin Luth <jl...@mail.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> diff --git a/sw/qa/extras/ooxmlexport/data/tdf66039.docx b/sw/qa/extras/ooxmlexport/data/tdf66039.docx deleted file mode 100644 index f17032b3f90b..000000000000 Binary files a/sw/qa/extras/ooxmlexport/data/tdf66039.docx and /dev/null differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index 937beb548e6d..5d2d4c8fe252 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -439,13 +439,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf59274) // This was 3674: too wide last cell in first row assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[4]/w:tcPr/w:tcW", "w", "1695"); } -//FIXME: -//DECLARE_OOXMLEXPORT_TEST(testDMLGroupshapeSdt, "dml-groupshape-sdt.docx") -//{ -// uno::Reference<drawing::XShapes> xGroupShape(getShape(1), uno::UNO_QUERY); -// // The text in the groupshape was missing due to the w:sdt and w:sdtContent wrapper around it. -// CPPUNIT_ASSERT_EQUAL(OUString("sdt and sdtContent inside groupshape"), uno::Reference<text::XTextRange>(xGroupShape->getByIndex(1), uno::UNO_QUERY_THROW)->getString()); -//} + +DECLARE_OOXMLEXPORT_TEST(testDMLGroupshapeSdt, "dml-groupshape-sdt.docx") +{ + uno::Reference<drawing::XShapes> xGroupShape(getShape(1), uno::UNO_QUERY); + // The text in the groupshape was missing due to the w:sdt and w:sdtContent wrapper around it. + CPPUNIT_ASSERT_EQUAL(OUString("sdt and sdtContent inside groupshape"), uno::Reference<text::XTextRange>(xGroupShape->getByIndex(1), uno::UNO_QUERY_THROW)->getString()); +} DECLARE_OOXMLEXPORT_TEST(testDmlCharheightDefault, "dml-charheight-default.docx") { @@ -745,21 +745,9 @@ DECLARE_OOXMLEXPORT_TEST(testCaption, "caption.docx") DECLARE_OOXMLEXPORT_TEST(testGroupshapeTrackedchanges, "groupshape-trackedchanges.docx") { uno::Reference<drawing::XShapes> xGroup(getShape(1), uno::UNO_QUERY); - uno::Reference<drawing::XShape> xShape(xGroup->getByIndex(0), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xShape(xGroup->getByIndex(0), uno::UNO_QUERY); // Shape text was completely missing, ensure inserted text is available. - uno::Reference<text::XText> xText - = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY_THROW)->getText(); - auto xParagraph = getParagraphOfText(1, xText); - - CPPUNIT_ASSERT(hasProperty(getRun(xParagraph, 1), "RedlineType")); - CPPUNIT_ASSERT_EQUAL(OUString("Delete"), - getProperty<OUString>(getRun(xParagraph, 1), "RedlineType")); - CPPUNIT_ASSERT_EQUAL(OUString("Deleted"), getRun(xParagraph, 2)->getString()); - - CPPUNIT_ASSERT(hasProperty(getRun(xParagraph, 4), "RedlineType")); - CPPUNIT_ASSERT_EQUAL(OUString("Insert"), - getProperty<OUString>(getRun(xParagraph, 4), "RedlineType")); - CPPUNIT_ASSERT_EQUAL(OUString(" Inserted"), getRun(xParagraph, 5)->getString()); + CPPUNIT_ASSERT_EQUAL(OUString(" Inserted"), xShape->getString()); } DECLARE_OOXMLEXPORT_TEST(testFdo78939, "fdo78939.docx") diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index 3d6e2a94b194..22c3b75c5e87 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -228,18 +228,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf142486_LeftMarginShadowLeft, "tdf142486_LeftMarg CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(953), getProperty<sal_Int32>(xFrame, "LeftMargin"), 1); } -DECLARE_OOXMLEXPORT_TEST(testTdf66039, "tdf66039.docx") -{ - // This bugdoc has a groupshape (WPG) with a table inside its each member shape. - // Before there was no table after import at all. From now, there must be 2 tables. - uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), - uno::UNO_QUERY); - // This was 0 before: - CPPUNIT_ASSERT_EQUAL_MESSAGE("Where are the tables?!", static_cast<sal_Int32>(2), - xTables->getCount()); -} - DECLARE_OOXMLEXPORT_TEST(testTdf142486_FrameShadow, "tdf142486_FrameShadow.odt") { CPPUNIT_ASSERT_EQUAL(1, getShapes()); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index e8b388f37b7f..c36761dec09d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -100,17 +100,17 @@ DECLARE_OOXMLEXPORT_TEST(testBezier, "bezier.odt") // Check that no shape got lost: a bezier, a line and a text shape. CPPUNIT_ASSERT_EQUAL(3, getShapes()); } -// FIXME: -//DECLARE_OOXMLEXPORT_TEST(testGroupshapeTextbox, "groupshape-textbox.docx") -//{ -// uno::Reference<drawing::XShapes> xGroup(getShape(1), uno::UNO_QUERY); -// uno::Reference<text::XTextRange> xShape(xGroup->getByIndex(0), uno::UNO_QUERY); -// // The VML export lost text on textboxes inside groupshapes. -// // The DML export does not, make sure it stays that way. -// CPPUNIT_ASSERT_EQUAL(OUString("first"), xShape->getString()); -// // This was 16, i.e. inheriting doc default char height didn't work. -// CPPUNIT_ASSERT_EQUAL(11.f, getProperty<float>(getParagraphOfText(1, xShape->getText()), "CharHeight")); -//} + +DECLARE_OOXMLEXPORT_TEST(testGroupshapeTextbox, "groupshape-textbox.docx") +{ + uno::Reference<drawing::XShapes> xGroup(getShape(1), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xShape(xGroup->getByIndex(0), uno::UNO_QUERY); + // The VML export lost text on textboxes inside groupshapes. + // The DML export does not, make sure it stays that way. + CPPUNIT_ASSERT_EQUAL(OUString("first"), xShape->getString()); + // This was 16, i.e. inheriting doc default char height didn't work. + CPPUNIT_ASSERT_EQUAL(11.f, getProperty<float>(getParagraphOfText(1, xShape->getText()), "CharHeight")); +} DECLARE_OOXMLEXPORT_TEST(testGroupshapePicture, "groupshape-picture.docx") { diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 9f4eca81b959..11b716f0af55 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -1374,7 +1374,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSpacingGroupShapeText) xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); assertXPath(pXmlDocument, "/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:txbx/w:txbxContent/w:p/w:r/w:rPr/w:spacing", "val", "200"); + "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:spacing", "val", "40"); } CPPUNIT_TEST_FIXTURE(Test, testTdf100581) diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 1f3af5cb8e03..0f5e3b2a540b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -457,11 +457,10 @@ DECLARE_OOXMLEXPORT_TEST(testDMLGroupShapeParaSpacing, "dml-groupshape-paraspaci CPPUNIT_ASSERT_EQUAL(sal_Int32(423), getProperty<sal_Int32>(xRun, "ParaTopMargin")); CPPUNIT_ASSERT_EQUAL(sal_Int32(635), getProperty<sal_Int32>(xRun, "ParaBottomMargin")); - // FIXME: // 7th paragraph has auto paragraph margins a:afterAutospacing and a:beforeAutospacing, which means margins must be ignored. - // xRun.set(getRun(getParagraphOfText(7, xText),1)); - // CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaTopMargin")); - // CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaBottomMargin")); + xRun.set(getRun(getParagraphOfText(7, xText),1)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaTopMargin")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xRun, "ParaBottomMargin")); } DECLARE_OOXMLEXPORT_TEST(testTableFloatingMargins, "table-floating-margins.docx") @@ -886,9 +885,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo69616) loadAndSave("fdo69616.docx"); xmlDocUniquePtr pXmlDoc = parseExport(); // VML - // FIXME: VML needs correction, because DrawingML WPG shapes from now imported as - // shape+textframe pairs. VML implementation still missing. - // 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")); + 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")); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlignForShape,"Shape.docx") diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx index 64cddea1bdde..9f2de7c12dc4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx @@ -707,17 +707,17 @@ DECLARE_OOXMLEXPORT_TEST(testN792778, "n792778.docx") xInnerShape.set(xInnerGroupShape->getByIndex(0), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(11684), xInnerShape->getPosition().Y); } -//FIXME: -//DECLARE_OOXMLEXPORT_TEST(testGroupshapeSmarttag, "groupshape-smarttag.docx") -//{ -// uno::Reference<drawing::XShapes> xGroupShape(getShape(1), uno::UNO_QUERY); -// uno::Reference<text::XTextRange> xShape(xGroupShape->getByIndex(0), uno::UNO_QUERY); -// // First run of shape text was missing due to the w:smartTag wrapper around it. -// CPPUNIT_ASSERT_EQUAL(OUString("Box 2"), xShape->getString()); -// -// // Font size of the shape text was 10. -// CPPUNIT_ASSERT_EQUAL(12.f, getProperty<float>(getParagraphOfText(1, xShape->getText()), "CharHeight")); -//} + +DECLARE_OOXMLEXPORT_TEST(testGroupshapeSmarttag, "groupshape-smarttag.docx") +{ + uno::Reference<drawing::XShapes> xGroupShape(getShape(1), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xShape(xGroupShape->getByIndex(0), uno::UNO_QUERY); + // First run of shape text was missing due to the w:smartTag wrapper around it. + CPPUNIT_ASSERT_EQUAL(OUString("Box 2"), xShape->getString()); + + // Font size of the shape text was 10. + CPPUNIT_ASSERT_EQUAL(12.f, getProperty<float>(getParagraphOfText(1, xShape->getText()), "CharHeight")); +} DECLARE_OOXMLEXPORT_TEST(testN793262, "n793262.docx") { diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index baf7d12383b7..62808b697d49 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1829,14 +1829,14 @@ CPPUNIT_TEST_FIXTURE(Test, testGroupShapeTextHighlight) 0xFF00FFUL, // magenta 0x0000FFUL, // blue 0xFF0000UL, // red - 0x000080UL, // dark blue - 0x008080UL, // dark cyan - 0x008000UL, // dark green + 0x00008BUL, // dark blue + 0x008B8BUL, // dark cyan + 0x006400UL, // dark green 0x800080UL, // dark magenta - 0x800000UL, // dark red + 0x8B0000UL, // dark red 0x808000UL, // dark yellow - 0x808080UL, // dark grey - 0xC0C0C0UL, // light grey + 0xA9A9A9UL, // dark grey + 0xD3D3D3UL, // light grey 0x000000UL // black }; @@ -1852,7 +1852,7 @@ CPPUNIT_TEST_FIXTURE(Test, testGroupShapeTextHighlight) uno::Reference<text::XTextRange> firstRun = getRun(firstParagraph, 1); uno::Reference<beans::XPropertySet> props(firstRun, uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT_EQUAL(xColors[idx], props->getPropertyValue("CharHighlight").get<sal_uInt32>()); + CPPUNIT_ASSERT_EQUAL(xColors[idx], props->getPropertyValue("CharBackColor").get<sal_uInt32>()); } } diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index ac7ef0820b42..2736775b2c81 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -659,10 +659,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf121804) // This failed with a NoSuchElementException, super/subscript property was // lost on import, so the whole paragraph was a single run. uno::Reference<text::XTextRange> xSecondRun = getRun(xFirstPara, 2); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(14000), + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(30), getProperty<sal_Int32>(xSecondRun, "CharEscapement")); uno::Reference<text::XTextRange> xThirdRun = getRun(xFirstPara, 3); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-14000), + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-25), getProperty<sal_Int32>(xThirdRun, "CharEscapement")); } @@ -900,6 +900,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf129912) } } +#if 0 +// TODO: Link import in frames in groupshapes. CPPUNIT_TEST_FIXTURE(Test, testTdf126426) { load(mpTestDocumentPath, "tdf126426.docx"); @@ -909,7 +911,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf126426) // get second shape in group uno::Reference<text::XTextRange> xRange(xGroup->getByIndex(1), uno::UNO_QUERY_THROW); - uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xRange, uno::UNO_QUERY_THROW); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xRange, + uno::UNO_QUERY_THROW); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY_THROW); @@ -925,7 +928,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf126426) // Link and this content was completely missong before uno::Reference<text::XTextRange> xRun(xRunEnum->nextElement(), uno::UNO_QUERY_THROW); CPPUNIT_ASSERT_EQUAL(OUString("Link"), xRun->getString()); - auto aURL = getProperty<OUString>(xRun, "HyperLinkURL"); + auto xURLField = getProperty<uno::Reference<text::XTextField>>(xRun, "TextField"); + auto aURL = getProperty<OUString>(xURLField, "URL"); CPPUNIT_ASSERT_EQUAL(OUString("http://libreoffice.org/"), aURL); } { @@ -941,6 +945,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf152200) load(mpTestDocumentPath, "tdf152200-bad_fldChar_end.docx"); // Should not crash/hang because of wrong placement of ending fldChar } +#endif // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/inc/dmapper/resourcemodel.hxx b/writerfilter/inc/dmapper/resourcemodel.hxx index 489499b2ba48..9e980494b09b 100644 --- a/writerfilter/inc/dmapper/resourcemodel.hxx +++ b/writerfilter/inc/dmapper/resourcemodel.hxx @@ -233,13 +233,6 @@ public: virtual void endShape() = 0; - /** - Receives a text-box-content. - */ - virtual void startTextBoxContent() = 0; - - virtual void endTextBoxContent() = 0; - /** Receives 8-bit per character text. diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index f21a15139cb6..6c5422a747b3 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3578,7 +3578,6 @@ void DomainMapper::lcl_startShape(uno::Reference<drawing::XShape> const& xShape) { assert(xShape.is()); - m_pImpl->AttachTextBoxContentToShape(xShape); if (m_pImpl->GetTopContext()) { // If there is a deferred page break, handle it now, so that the @@ -3626,16 +3625,6 @@ void DomainMapper::lcl_endShape( ) m_pImpl->SetIsOutsideAParagraph(false); } -void DomainMapper::lcl_startTextBoxContent() -{ - m_pImpl->PushTextBoxContent(); -} - -void DomainMapper::lcl_endTextBoxContent() -{ - m_pImpl->PopTextBoxContent(); -} - void DomainMapper::PushStyleSheetProperties( const PropertyMapPtr& pStyleProperties, bool bAffectTableMngr ) { m_pImpl->PushStyleProperties( pStyleProperties ); diff --git a/writerfilter/source/dmapper/DomainMapper.hxx b/writerfilter/source/dmapper/DomainMapper.hxx index 75f5f6b1134d..4ed2cca83526 100644 --- a/writerfilter/source/dmapper/DomainMapper.hxx +++ b/writerfilter/source/dmapper/DomainMapper.hxx @@ -149,8 +149,7 @@ private: virtual void lcl_endCharacterGroup() override; virtual void lcl_startShape(css::uno::Reference<css::drawing::XShape> const& xShape) override; virtual void lcl_endShape( ) override; - virtual void lcl_startTextBoxContent() override; - virtual void lcl_endTextBoxContent() override; + virtual void lcl_text(const sal_uInt8 * data, size_t len) override; virtual void lcl_utext(const sal_uInt8 * data, size_t len) override; virtual void lcl_positionOffset(const OUString& rText, bool bVertical) override; diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 6fbb7b7744b6..8b8bff35e40e 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -373,7 +373,6 @@ DomainMapper_Impl::DomainMapper_Impl( m_aSmartTagHandler(m_xComponentContext, m_xTextDocument), m_xInsertTextRange(rMediaDesc.getUnpackedValueOrDefault("TextInsertModeRange", uno::Reference<text::XTextRange>())), m_xAltChunkStartingRange(rMediaDesc.getUnpackedValueOrDefault("AltChunkStartingRange", uno::Reference<text::XTextRange>())), - m_bIsInTextBox(false), m_bIsNewDoc(!rMediaDesc.getUnpackedValueOrDefault("InsertMode", false)), m_bIsAltChunk(rMediaDesc.getUnpackedValueOrDefault("AltChunkMode", false)), m_bIsReadGlossaries(rMediaDesc.getUnpackedValueOrDefault("ReadGlossaries", false)), @@ -3770,8 +3769,7 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape { try { - uno::Reference<text::XTextRange> xFrame(xShapes->getByIndex(i), uno::UNO_QUERY_THROW); - uno::Reference<beans::XPropertySet> xSyncedPropertySet(xFrame, uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xSyncedPropertySet(xShapes->getByIndex(i), uno::UNO_QUERY_THROW); comphelper::SequenceAsHashMap aGrabBag( xSyncedPropertySet->getPropertyValue("CharInteropGrabBag") ); // only VML import has checked for style. Don't apply default parastyle properties to other imported shapes @@ -4813,71 +4811,6 @@ void DomainMapper_Impl::ChainTextFrames() } } -void DomainMapper_Impl::PushTextBoxContent() -{ - if (m_bIsInTextBox) - return; - - try - { - uno::Reference<text::XTextFrame> xTBoxFrame( - m_xTextFactory->createInstance("com.sun.star.text.TextFrame"), uno::UNO_QUERY_THROW); - uno::Reference<container::XNamed>(xTBoxFrame, uno::UNO_QUERY_THROW) - ->setName("textbox" + OUString::number(m_xPendingTextBoxFrames.size() + 1)); - uno::Reference<text::XTextAppendAndConvert>(m_aTextAppendStack.top().xTextAppend, - uno::UNO_QUERY_THROW) - ->appendTextContent(xTBoxFrame, beans::PropertyValues()); - m_xPendingTextBoxFrames.push(xTBoxFrame); - - m_aTextAppendStack.push(TextAppendContext(uno::Reference<text::XTextAppend>(xTBoxFrame, uno::UNO_QUERY_THROW), {})); - m_bIsInTextBox = true; - - appendTableManager(); - appendTableHandler(); - getTableManager().startLevel(); - } - catch (uno::Exception& e) - { - SAL_WARN("writerfilter.dmapper", "Exception during creating textbox (" + e.Message + ")!"); - } -} - -void DomainMapper_Impl::PopTextBoxContent() -{ - if (!m_bIsInTextBox || m_xPendingTextBoxFrames.empty()) - return; - - if (uno::Reference<text::XTextFrame>(m_aTextAppendStack.top().xTextAppend, uno::UNO_QUERY).is()) - { - if (hasTableManager()) - { - getTableManager().endLevel(); - popTableManager(); - } - m_aTextAppendStack.pop(); - m_bIsInTextBox = false; - } -} - -void DomainMapper_Impl::AttachTextBoxContentToShape(css::uno::Reference<css::drawing::XShape> xShape) -{ - if (m_xPendingTextBoxFrames.empty() || !xShape) - return; - - uno::Reference< drawing::XShapes >xGroup(xShape, uno::UNO_QUERY); - uno::Reference< beans::XPropertySet >xProps(xShape, uno::UNO_QUERY); - - if (xGroup) - for (sal_Int32 i = 0; i < xGroup->getCount(); ++i) - AttachTextBoxContentToShape(uno::Reference<drawing::XShape>(xGroup->getByIndex(i),uno::UNO_QUERY_THROW)); - - if (xProps->getPropertyValue("TextBox").get<bool>()) - { - xProps->setPropertyValue("TextBoxContent", uno::Any(m_xPendingTextBoxFrames.front())); - m_xPendingTextBoxFrames.pop(); - } -} - uno::Reference<beans::XPropertySet> DomainMapper_Impl::FindOrCreateFieldMaster(const char* pFieldMasterService, const OUString& rFieldMasterName) { // query master, create if not available diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index e10a867a011d..fea4972933f7 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -22,7 +22,6 @@ #include <com/sun/star/text/XTextDocument.hpp> #include <com/sun/star/text/XTextCursor.hpp> #include <com/sun/star/text/XTextAppend.hpp> -#include <com/sun/star/text/XTextFrame.hpp> #include <com/sun/star/style/TabStop.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/embed/XStorage.hpp> @@ -65,7 +64,6 @@ namespace com::sun::star{ namespace text { class XTextField; - class XTextFrame; class XFormField; } namespace beans{ class XPropertySet;} @@ -629,13 +627,9 @@ private: css::uno::Reference<css::text::XTextRange> m_xSdtEntryStart; std::stack<BookmarkInsertPosition> m_xSdtStarts; - std::queue< css::uno::Reference< css::text::XTextFrame > > m_xPendingTextBoxFrames; - public: css::uno::Reference<css::text::XTextRange> m_xInsertTextRange; css::uno::Reference<css::text::XTextRange> m_xAltChunkStartingRange; - - bool m_bIsInTextBox; private: bool m_bIsNewDoc; bool m_bIsAltChunk = false; @@ -684,10 +678,6 @@ public: void EndParaMarkerChange( ); void ChainTextFrames(); - void PushTextBoxContent(); - void PopTextBoxContent(); - void AttachTextBoxContentToShape(css::uno::Reference<css::drawing::XShape> xShape); - void RemoveDummyParaForTableInSection(); void AddDummyParaForTableInSection(); void RemoveLastParagraph( ); diff --git a/writerfilter/source/dmapper/FontTable.hxx b/writerfilter/source/dmapper/FontTable.hxx index 5f32776a2819..ff4d11fba83e 100644 --- a/writerfilter/source/dmapper/FontTable.hxx +++ b/writerfilter/source/dmapper/FontTable.hxx @@ -80,8 +80,6 @@ class FontTable : public LoggedProperties, public LoggedTable ::writerfilter::Reference<Stream>::Pointer_t ref) override; virtual void lcl_startShape(css::uno::Reference<css::drawing::XShape> const& xShape) override; virtual void lcl_endShape( ) override; - virtual void lcl_startTextBoxContent() override {}; - virtual void lcl_endTextBoxContent() override {}; }; typedef tools::SvRef< FontTable > FontTablePtr; diff --git a/writerfilter/source/dmapper/GraphicImport.hxx b/writerfilter/source/dmapper/GraphicImport.hxx index 93be2df3f601..3ff83de5b713 100644 --- a/writerfilter/source/dmapper/GraphicImport.hxx +++ b/writerfilter/source/dmapper/GraphicImport.hxx @@ -124,8 +124,6 @@ public: writerfilter::Reference<Table>::Pointer_t ref) override; virtual void lcl_substream(Id name, writerfilter::Reference<Stream>::Pointer_t ref) override; virtual void lcl_startShape(css::uno::Reference<css::drawing::XShape> const& xShape) override; - virtual void lcl_startTextBoxContent() override {}; - virtual void lcl_endTextBoxContent() override {}; virtual void lcl_endShape() override; void handleWrapTextValue(sal_uInt32 nVal); diff --git a/writerfilter/source/dmapper/LoggedResources.cxx b/writerfilter/source/dmapper/LoggedResources.cxx index 661bf17cd1e8..4a0886e44812 100644 --- a/writerfilter/source/dmapper/LoggedResources.cxx +++ b/writerfilter/source/dmapper/LoggedResources.cxx @@ -147,10 +147,6 @@ void LoggedStream::endShape() #endif } -void LoggedStream::startTextBoxContent() { lcl_startTextBoxContent(); } - -void LoggedStream::endTextBoxContent() { lcl_endTextBoxContent(); } - void LoggedStream::text(const sal_uInt8* data, size_t len) { #ifdef DBG_UTIL diff --git a/writerfilter/source/dmapper/LoggedResources.hxx b/writerfilter/source/dmapper/LoggedResources.hxx index 6256665b7280..848d17b68219 100644 --- a/writerfilter/source/dmapper/LoggedResources.hxx +++ b/writerfilter/source/dmapper/LoggedResources.hxx @@ -60,8 +60,6 @@ public: void endCharacterGroup() override; void startShape(css::uno::Reference<css::drawing::XShape> const& xShape) override; void endShape() override; - void startTextBoxContent() override; - void endTextBoxContent() override; void text(const sal_uInt8* data, size_t len) override; void utext(const sal_uInt8* data, size_t len) override; void positionOffset(const OUString& rText, bool bVertical) override; @@ -85,8 +83,6 @@ protected: virtual void lcl_endCharacterGroup() = 0; virtual void lcl_startShape(css::uno::Reference<css::drawing::XShape> const& xShape) = 0; virtual void lcl_endShape() = 0; - virtual void lcl_startTextBoxContent() = 0; - virtual void lcl_endTextBoxContent() = 0; virtual void lcl_text(const sal_uInt8* data, size_t len) = 0; virtual void lcl_utext(const sal_uInt8* data, size_t len) = 0; virtual void lcl_positionOffset(const OUString& /*rText*/, bool /*bVertical*/) {} diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index 7bb453777797..24622e14524a 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -1775,12 +1775,6 @@ void OOXMLFastContextHandlerShape::sendShape( Token_t Element ) } } -bool OOXMLFastContextHandlerShape::isDMLGroupShape() const -{ - return (mrShapeContext->getFullWPGSupport() && - (mrShapeContext->getStartToken() == Token_t(oox::NMSP_wpg | oox::XML_wgp))); -}; - void OOXMLFastContextHandlerShape::lcl_endFastElement (Token_t Element) { @@ -1827,8 +1821,7 @@ OOXMLFastContextHandlerShape::lcl_createFastChildContext bool bGroupShape = Element == Token_t(NMSP_vml | XML_group); // drawingML version also counts as a group shape. - if (!mrShapeContext->getFullWPGSupport()) - bGroupShape |= mrShapeContext->getStartToken() == Token_t(NMSP_wpg | XML_wgp); + bGroupShape |= mrShapeContext->getStartToken() == Token_t(NMSP_wpg | XML_wgp); mbIsVMLfound = (getNamespace(Element) == NMSP_vmlOffice) || (getNamespace(Element) == NMSP_vml); switch (oox::getNamespace(Element)) { @@ -1992,13 +1985,6 @@ void OOXMLFastContextHandlerWrapper::lcl_startFastElement { if (mxWrappedContext.is()) mxWrappedContext->startFastElement(Element, Attribs); - - if (mxShapeHandler->isDMLGroupShape() - && (Element == Token_t(NMSP_wps | XML_txbx) - || Element == Token_t(NMSP_wps | XML_linkedTxbx))) - { - mpStream->startTextBoxContent(); - } } void OOXMLFastContextHandlerWrapper::lcl_endFastElement @@ -2006,13 +1992,6 @@ void OOXMLFastContextHandlerWrapper::lcl_endFastElement { if (mxWrappedContext.is()) mxWrappedContext->endFastElement(Element); - - if (mxShapeHandler->isDMLGroupShape() - && (Element == Token_t(NMSP_wps | XML_txbx) - || Element == Token_t(NMSP_wps | XML_linkedTxbx))) - { - mpStream->endTextBoxContent(); - } } uno::Reference< xml::sax::XFastContextHandler > diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx index 30491f08dc43..d0b1ed791478 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx @@ -469,7 +469,6 @@ public: void sendShape( Token_t Element ); bool isShapeSent( ) const { return m_bShapeSent; } - bool isDMLGroupShape() const; protected: virtual void lcl_startFastElement(Token_t Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;