[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 1 12:21:15 UTC 2020


 sw/source/filter/ww8/docxsdrexport.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit b3a0a93154cb5bc4008605df536f5bbc507be149
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Mar 31 14:37:14 2020 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Apr 1 14:20:45 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.stahl at cib.de>
    (cherry picked from commit 0dd48d1a9a716456ff1ebe67e19881ad2f56939b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91397
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index b8329e9eb299..573db097a2b4 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -1110,6 +1110,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();
 }
 
@@ -1365,6 +1369,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())
             {
@@ -1514,6 +1522,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())
         {


More information about the Libreoffice-commits mailing list