[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - include/sax sax/source sw/qa sw/source

Tamás Zolnai tamas.zolnai at collabora.com
Fri Nov 11 15:33:28 UTC 2016


 include/sax/fshelper.hxx                      |    2 +-
 sax/source/tools/fastserializer.cxx           |    6 +-----
 sw/qa/extras/ooxmlexport/data/tdf103544.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport7.cxx     |   14 ++++++++++++++
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |    4 ++--
 sw/source/filter/ww8/docxattributeoutput.cxx  |    5 +----
 6 files changed, 19 insertions(+), 12 deletions(-)

New commits:
commit d3d714f7a16df13b97a06ec68234d08d57a09479
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Sun Nov 6 18:42:30 2016 +0000

    tdf#103544: DOCX exp.: Image loss when have a frame anchored to the same para.
    
    Regression from:
    83d51e5e52688c4c9bc0ad70a511458bb06a242d
    
    Partly revert the commit causes this regression.
    I checked the related bugs (tdf#78590,tdf#80748)
    intended to be fixed by this commit and reverting
    this part does not bring back the corruption.
    I guess something changed in frames' and text boxes'
    import in the meantime, because this MergeMarks::IGNORE
    is useless now.
    
    Reviewed-on: https://gerrit.libreoffice.org/30351
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    
    Conflicts:
    	sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
    
    Change-Id: If17776e8628561961c7ce2a2994e3fc609f75639
    Reviewed-on: https://gerrit.libreoffice.org/30358
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
index 4c79a36..599aae1 100644
--- a/include/sax/fshelper.hxx
+++ b/include/sax/fshelper.hxx
@@ -60,7 +60,7 @@ const sal_Int32 FSEND_internal = -1; // same as XML_TOKEN_INVALID
 
 namespace sax_fastparser {
 
-enum class MergeMarks { APPEND = 0, PREPEND = 1, POSTPONE = 2, IGNORE = 3 };
+enum class MergeMarks { APPEND = 0, PREPEND = 1, POSTPONE = 2};
 
 typedef css::uno::Reference< css::xml::sax::XFastAttributeList > XFastAttributeListRef;
 
diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx
index 49ed24b..620fe68 100644
--- a/sax/source/tools/fastserializer.cxx
+++ b/sax/source/tools/fastserializer.cxx
@@ -405,7 +405,7 @@ namespace sax_fastparser {
         // flush, so that we get everything in getData()
         maCachedOutputStream.flush();
 
-        if (maMarkStack.size() == 1 && eMergeType != MergeMarks::IGNORE)
+        if (maMarkStack.size() == 1)
         {
 #ifdef DBG_UTIL
             while (!maMarkStack.top()->m_DebugEndedElements.empty())
@@ -469,8 +469,6 @@ namespace sax_fastparser {
                     topDebugEndedElements,
                     topDebugStartedElements);
                 break;
-            case MergeMarks::IGNORE:
-                break;
         }
 #endif
         if (maMarkStack.empty())
@@ -488,8 +486,6 @@ namespace sax_fastparser {
             case MergeMarks::APPEND:   maMarkStack.top()->append( aMerge );   break;
             case MergeMarks::PREPEND:  maMarkStack.top()->prepend( aMerge );  break;
             case MergeMarks::POSTPONE: maMarkStack.top()->postpone( aMerge ); break;
-            case MergeMarks::IGNORE:   break;
-
         }
     }
 
diff --git a/sw/qa/extras/ooxmlexport/data/tdf103544.docx b/sw/qa/extras/ooxmlexport/data/tdf103544.docx
new file mode 100644
index 0000000..2e18f21
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf103544.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
index c3b94a7..d7c1f22 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
@@ -25,6 +25,7 @@
 #include <com/sun/star/text/GraphicCrop.hpp>
 #include <com/sun/star/text/HoriOrientation.hpp>
 #include <com/sun/star/text/RelOrientation.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
 #include <pagedesc.hxx>
 
 #include <comphelper/sequenceashashmap.hxx>
@@ -1171,6 +1172,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103573, "tdf103573.docx")
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered horizontally relatively to right page border", text::RelOrientation::PAGE_RIGHT, nValue);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf103544, "tdf103544.docx")
+{
+    // We have two shapes: a frame and an image
+    uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xDrawPage->getCount());
+
+    // Image was lost because of the frame export
+    uno::Reference<beans::XPropertySet> xImage(getShape(1), uno::UNO_QUERY);
+    auto xGraphic = getProperty<uno::Reference<graphic::XGraphic> >(xImage, "Graphic");
+    CPPUNIT_ASSERT(xGraphic.is());
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 9af064c..3552546 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -498,8 +498,8 @@ DECLARE_OOXMLEXPORT_TEST(testFDO78590, "FDO78590.docx")
         return;
 
     // This is to ensure that the fld starts and ends inside a hyperlink...
-    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" );
+    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" );
 }
 
 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 da5f181..bdfaac4 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -579,10 +579,7 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
     //sdtcontent is written so Set m_bParagraphHasDrawing to false
     m_rExport.SdrExporter().setParagraphHasDrawing( false );
     m_bRunTextIsOn = false;
-    if(aFramePrTextbox.empty())
-        m_pSerializer->mergeTopMarks(Tag_StartParagraph_1);
-    else
-        m_pSerializer->mergeTopMarks(Tag_StartParagraph_1, sax_fastparser::MergeMarks::IGNORE);
+    m_pSerializer->mergeTopMarks(Tag_StartParagraph_1);
 
     // Write framePr
     if(!aFramePrTextbox.empty())


More information about the Libreoffice-commits mailing list