diff options
author | Tibor Nagy <nagy.tibor2@nisz.hu> | 2020-07-29 11:10:04 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-08-07 11:14:46 +0200 |
commit | e5f0c4dd632d3c4a9eea36f65974d6004ac07983 (patch) | |
tree | 410ab83ff6793bf8a54ebf92da1f3d1915fcc99e | |
parent | 75b45d43b53abd457c98f47078ca7ff3c492ce2c (diff) |
tdf#133702 DOCX export: fix frame anchor position
On saving a frame from Writer the anchor moves to the next
paragraph, moving the whole frame lower in the document.
Co-authored-by: Attila Szűcs (NISZ)
Change-Id: Ic47becb323282500871d825c12330b328f5059d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99673
Tested-by: Jenkins
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf133702.docx | bin | 0 -> 12138 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 9 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 10 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 13 |
6 files changed, 26 insertions, 12 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf133702.docx b/sw/qa/extras/ooxmlexport/data/tdf133702.docx Binary files differnew file mode 100644 index 000000000000..46e08a920ca3 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf133702.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index cd9656c94ef7..8c2899046a3b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -321,6 +321,15 @@ DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginNoFooter, assertXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "height", "1147"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf133702, "tdf133702.docx") +{ + xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); + if (!pXmlDocument) + return; + + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:framePr"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index f3b9d6b2ecf3..53a88a7e8a8b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -1322,7 +1322,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf112287, "tdf112287.docx") xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); - assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:framePr","vAnchor","margin"); + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:framePr","vAnchor","margin"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testZOrderInHeader, "tdf120760_ZOrderInHeader.docx") diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 0e69e4884a43..7435604dcbda 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -49,8 +49,8 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf133701, "tdf133701.docx") if (!pXmlDocument) return; - assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:framePr", "hSpace", "567"); - assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:framePr", "vSpace", "284"); + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:framePr", "hSpace", "567"); + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:framePr", "vSpace", "284"); } DECLARE_OOXMLEXPORT_TEST(testDmlShapeTitle, "dml-shape-title.docx") @@ -978,7 +978,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf133457, "tdf133457.docx") if (!pXmlDocument) return; - assertXPath(pXmlDocument, "/w:document/w:body/w:p[4]/w:pPr/w:framePr", "vAnchor", "text"); + assertXPath(pXmlDocument, "/w:document/w:body/w:p[3]/w:pPr/w:framePr", "vAnchor", "text"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf133924, "tdf133924.docx") @@ -987,8 +987,8 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf133924, "tdf133924.docx") if (!pXmlDocument) return; - assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:framePr", "wrap", "around"); - assertXPath(pXmlDocument, "/w:document/w:body/w:p[3]/w:pPr/w:framePr", "wrap", "notBeside"); + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:framePr", "wrap", "around"); + assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:framePr", "wrap", "notBeside"); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index 08374e532af5..82397edbec02 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx @@ -399,8 +399,8 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78590, "FDO78590.docx") 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" ); - assertXPath ( pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:framePr", "h", "1669" ); + assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:framePr", "w", "9851" ); + assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:framePr", "h", "1669" ); } DECLARE_OOXMLEXPORT_TEST(testSdtCitationRun, "sdt-citation-run.docx") diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index b2ad20685516..4d59477f9d68 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -761,10 +761,7 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT lcl_deleteAndResetTheLists( m_pParagraphSdtPrTokenChildren, m_pParagraphSdtPrDataBindingAttrs, m_aParagraphSdtPrAlias ); } - //sdtcontent is written so Set m_bParagraphHasDrawing to false - m_rExport.SdrExporter().setParagraphHasDrawing( false ); - m_bRunTextIsOn = false; - m_pSerializer->mergeTopMarks(Tag_StartParagraph_1); + m_pSerializer->mark(Tag_StartParagraph_2); // Write framePr for ( const auto & pFrame : aFramePrTextbox ) @@ -774,6 +771,14 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT m_rExport.SdrExporter().writeOnlyTextOfFrame(pFrame.get()); m_pCurrentFrame = nullptr; } + + m_pSerializer->mergeTopMarks(Tag_StartParagraph_2, sax_fastparser::MergeMarks::PREPEND); + + //sdtcontent is written so Set m_bParagraphHasDrawing to false + m_rExport.SdrExporter().setParagraphHasDrawing(false); + m_bRunTextIsOn = false; + m_pSerializer->mergeTopMarks(Tag_StartParagraph_1); + aFramePrTextbox.clear(); // Check for end of cell, rows, tables here FinishTableRowCell( pTextNodeInfoInner ); |