sw/source/filter/ww8/docxsdrexport.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+)
New commits: commit 0dd48d1a9a716456ff1ebe67e19881ad2f56939b Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Tue Mar 31 14:37:14 2020 +0200 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Tue Mar 31 15:44:56 2020 +0200 sw: DOCX export: avoid section breaks in text frames The problem is that if Word reads a w:sectPr that is inside a w:textbox and has a w:headerReference, then Word throws a confusing error reporting a location inside the headerN.xml file and refuses to open the file. It looks like Word doesn't actually support sections inside text frames, although it doesn't complain if the section break doesn't contain a header/footer reference. The WW8 export appears to avoid this by checking that TXT_MAINTEXT == m_nTextTyp and skipping sections otherwise, but the m_nTextTyp doesn't change when exporting a text frame in DOCX case, so let's change that. Possibly this makes m_bFlyFrameGraphic variable redundant, not sure about that. Change-Id: If862b226254983bb608bbce180f4aa2f41721273 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91421 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index e18cbd532a18..62a35f1ab3b5 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -1129,6 +1129,10 @@ void DocxSdrExport::writeOnlyTextOfFrame(ww8::Frame const* pParentFrame) m_pImpl->setBodyPrAttrList(sax_fastparser::FastSerializerHelper::createAttrList()); ::comphelper::FlagRestorationGuard const g(m_pImpl->m_bFlyFrameGraphic, true); + auto const nTextTyp(m_pImpl->getExport().m_nTextTyp); + m_pImpl->getExport().m_nTextTyp = TXT_TXTBOX; + ::comphelper::ScopeGuard const sg( + [this, nTextTyp]() { m_pImpl->getExport().m_nTextTyp = nTextTyp; }); m_pImpl->getExport().WriteText(); } @@ -1384,6 +1388,10 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho { ::comphelper::FlagRestorationGuard const g(m_pImpl->m_bFlyFrameGraphic, true); + auto const nTextTyp(m_pImpl->getExport().m_nTextTyp); + m_pImpl->getExport().m_nTextTyp = TXT_TXTBOX; + ::comphelper::ScopeGuard const sg( + [this, nTextTyp]() { m_pImpl->getExport().m_nTextTyp = nTextTyp; }); m_pImpl->getExport().WriteText(); if (m_pImpl->getParagraphSdtOpen()) { @@ -1534,6 +1542,10 @@ void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bText pFS->startElementNS(XML_w, XML_txbxContent); { ::comphelper::FlagRestorationGuard const g(m_pImpl->m_bFlyFrameGraphic, true); + auto const nTextTyp(m_pImpl->getExport().m_nTextTyp); + m_pImpl->getExport().m_nTextTyp = TXT_TXTBOX; + ::comphelper::ScopeGuard const sg( + [this, nTextTyp]() { m_pImpl->getExport().m_nTextTyp = nTextTyp; }); m_pImpl->getExport().WriteText(); if (m_pImpl->getParagraphSdtOpen()) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits