sw/qa/extras/ooxmlexport/data/tdf133702.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx    |    9 +++++++++
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx     |    2 +-
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx     |   10 +++++-----
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |    4 ++--
 sw/source/filter/ww8/docxattributeoutput.cxx  |   13 +++++++++----
 6 files changed, 26 insertions(+), 12 deletions(-)

New commits:
commit e5f0c4dd632d3c4a9eea36f65974d6004ac07983
Author:     Tibor Nagy <nagy.tib...@nisz.hu>
AuthorDate: Wed Jul 29 11:10:04 2020 +0200
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Fri Aug 7 11:14:46 2020 +0200

    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 <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf133702.docx 
b/sw/qa/extras/ooxmlexport/data/tdf133702.docx
new file mode 100644
index 000000000000..46e08a920ca3
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133702.docx differ
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 );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to