Kaydet (Commit) f6b681a1 authored tarafından Miklos Vajna's avatar Miklos Vajna

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
üst aa1d3d5e
...@@ -188,6 +188,15 @@ void SwFiltersTest::testCVEs() ...@@ -188,6 +188,15 @@ void SwFiltersTest::testCVEs()
0, 0,
0, 0,
/*bExport=*/true); /*bExport=*/true);
testDir("MS Word 2007 XML",
getURLFromSrc("/sw/qa/core/exportdata/ooxml/"),
OUString(),
SFX_FILTER_STARONEFILTER,
0,
0,
/*bExport=*/true);
} }
void SwFiltersTest::setUp() void SwFiltersTest::setUp()
......
...@@ -1314,6 +1314,9 @@ void DocxSdrExport::writeOnlyTextOfFrame(sw::Frame* pParentFrame) ...@@ -1314,6 +1314,9 @@ void DocxSdrExport::writeOnlyTextOfFrame(sw::Frame* pParentFrame)
void DocxSdrExport::writeDMLTextFrame(sw::Frame* pParentFrame, int nAnchorId, bool bTextBoxOnly) 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; sax_fastparser::FSHelperPtr pFS = m_pImpl->m_pSerializer;
const SwFrmFmt& rFrmFmt = pParentFrame->GetFrmFmt(); const SwFrmFmt& rFrmFmt = pParentFrame->GetFrmFmt();
const SwNodeIndex* pNodeIndex = rFrmFmt.GetCntnt().GetCntntIdx(); const SwNodeIndex* pNodeIndex = rFrmFmt.GetCntnt().GetCntntIdx();
...@@ -1542,10 +1545,14 @@ void DocxSdrExport::writeDMLTextFrame(sw::Frame* pParentFrame, int nAnchorId, bo ...@@ -1542,10 +1545,14 @@ void DocxSdrExport::writeDMLTextFrame(sw::Frame* pParentFrame, int nAnchorId, bo
endDMLAnchorInline(&rFrmFmt); endDMLAnchorInline(&rFrmFmt);
} }
m_pImpl->m_bDMLAndVMLDrawingOpen = bDMLAndVMLDrawingOpen;
} }
void DocxSdrExport::writeVMLTextFrame(sw::Frame* pParentFrame, bool bTextBoxOnly) 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; sax_fastparser::FSHelperPtr pFS = m_pImpl->m_pSerializer;
const SwFrmFmt& rFrmFmt = pParentFrame->GetFrmFmt(); const SwFrmFmt& rFrmFmt = pParentFrame->GetFrmFmt();
const SwNodeIndex* pNodeIndex = rFrmFmt.GetCntnt().GetCntntIdx(); const SwNodeIndex* pNodeIndex = rFrmFmt.GetCntnt().GetCntntIdx();
...@@ -1633,6 +1640,8 @@ void DocxSdrExport::writeVMLTextFrame(sw::Frame* pParentFrame, bool bTextBoxOnly ...@@ -1633,6 +1640,8 @@ void DocxSdrExport::writeVMLTextFrame(sw::Frame* pParentFrame, bool bTextBoxOnly
pFS->endElementNS(XML_w, XML_pict); pFS->endElementNS(XML_w, XML_pict);
} }
m_pImpl->m_bFrameBtLr = false; m_pImpl->m_bFrameBtLr = false;
m_pImpl->m_bDMLAndVMLDrawingOpen = bDMLAndVMLDrawingOpen;
} }
bool DocxSdrExport::checkFrameBtlr(SwNode* pStartNode, sax_fastparser::FastAttributeList* pTextboxAttrList) bool DocxSdrExport::checkFrameBtlr(SwNode* pStartNode, sax_fastparser::FastAttributeList* pTextboxAttrList)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment