[Libreoffice-commits] core.git: sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Aug 18 06:52:38 PDT 2014


 sw/qa/core/exportdata/ooxml/pass/sdt-in-shape-with-textbox.docx |binary
 sw/qa/core/filters-test.cxx                                     |    9 +++++++++
 sw/source/filter/ww8/docxsdrexport.cxx                          |    9 +++++++++
 3 files changed, 18 insertions(+)

New commits:
commit f6b681a1360d953ec7a9f2f4f843c0d76d478c2a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Aug 18 15:14:31 2014 +0200

    DOCX export: don't forget to close SDT elements inside the TextBoxes of shapes
    
    A usual problem with SDT is that in case it should end after the last
    paragrah of a container, there is no "next" paragraph that could have
    the relevant "EndSdtBefore" property. This is usually handled by closing
    the SDT tag before the container is closed.
    
    The problem here was that DocxAttributeOutput::WriteSdtBlock() did not
    notify DocxSdrExport about opening the SDT, as it thought there is no
    draw export in progress. This is because in case of "shape with a
    TextBox", the common writeDMLAndVMLDrawing() method is not called,
    instead the separate writeDMLTextFrame() and writeVMLTextFrame() methods
    are invoked.
    
    Fix the problem by adjusting these methods to writeDMLAndVMLDrawing(),
    so that they also set m_bDMLAndVMLDrawingOpen to true during the TextBox
    export.
    
    Change-Id: Ie08b0b955cd2d6a645970da3d485e447abfd6495

diff --git a/sw/qa/core/exportdata/ooxml/fail/.gitignore b/sw/qa/core/exportdata/ooxml/fail/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/sw/qa/core/exportdata/ooxml/indeterminate/.gitignore b/sw/qa/core/exportdata/ooxml/indeterminate/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/sw/qa/core/exportdata/ooxml/pass/sdt-in-shape-with-textbox.docx b/sw/qa/core/exportdata/ooxml/pass/sdt-in-shape-with-textbox.docx
new file mode 100644
index 0000000..be033f1
Binary files /dev/null and b/sw/qa/core/exportdata/ooxml/pass/sdt-in-shape-with-textbox.docx differ
diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx
index 2a80f3ef..8c128c3 100644
--- a/sw/qa/core/filters-test.cxx
+++ b/sw/qa/core/filters-test.cxx
@@ -188,6 +188,15 @@ void SwFiltersTest::testCVEs()
             0,
             0,
             /*bExport=*/true);
+
+    testDir("MS Word 2007 XML",
+            getURLFromSrc("/sw/qa/core/exportdata/ooxml/"),
+            OUString(),
+            SFX_FILTER_STARONEFILTER,
+            0,
+            0,
+            /*bExport=*/true);
+
 }
 
 void SwFiltersTest::setUp()
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index bd34f04..b1aa910 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -1314,6 +1314,9 @@ void DocxSdrExport::writeOnlyTextOfFrame(sw::Frame* pParentFrame)
 
 void DocxSdrExport::writeDMLTextFrame(sw::Frame* pParentFrame, int nAnchorId, bool bTextBoxOnly)
 {
+    bool bDMLAndVMLDrawingOpen = m_pImpl->m_bDMLAndVMLDrawingOpen;
+    m_pImpl->m_bDMLAndVMLDrawingOpen = true;
+
     sax_fastparser::FSHelperPtr pFS = m_pImpl->m_pSerializer;
     const SwFrmFmt& rFrmFmt = pParentFrame->GetFrmFmt();
     const SwNodeIndex* pNodeIndex = rFrmFmt.GetCntnt().GetCntntIdx();
@@ -1542,10 +1545,14 @@ void DocxSdrExport::writeDMLTextFrame(sw::Frame* pParentFrame, int nAnchorId, bo
 
         endDMLAnchorInline(&rFrmFmt);
     }
+    m_pImpl->m_bDMLAndVMLDrawingOpen = bDMLAndVMLDrawingOpen;
 }
 
 void DocxSdrExport::writeVMLTextFrame(sw::Frame* pParentFrame, bool bTextBoxOnly)
 {
+    bool bDMLAndVMLDrawingOpen = m_pImpl->m_bDMLAndVMLDrawingOpen;
+    m_pImpl->m_bDMLAndVMLDrawingOpen = true;
+
     sax_fastparser::FSHelperPtr pFS = m_pImpl->m_pSerializer;
     const SwFrmFmt& rFrmFmt = pParentFrame->GetFrmFmt();
     const SwNodeIndex* pNodeIndex = rFrmFmt.GetCntnt().GetCntntIdx();
@@ -1633,6 +1640,8 @@ void DocxSdrExport::writeVMLTextFrame(sw::Frame* pParentFrame, bool bTextBoxOnly
         pFS->endElementNS(XML_w, XML_pict);
     }
     m_pImpl->m_bFrameBtLr = false;
+
+    m_pImpl->m_bDMLAndVMLDrawingOpen = bDMLAndVMLDrawingOpen;
 }
 
 bool DocxSdrExport::checkFrameBtlr(SwNode* pStartNode, sax_fastparser::FastAttributeList* pTextboxAttrList)


More information about the Libreoffice-commits mailing list