summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-03-31 14:37:14 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-04-01 14:20:45 +0200
commitb3a0a93154cb5bc4008605df536f5bbc507be149 (patch)
tree53521c20accd89e43c7ae0ea009400750e0445f9 /sw/source/filter/ww8
parent72b0f1df2c3dce641f65ae845c425cd3fa92f6d2 (diff)
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@cib.de> (cherry picked from commit 0dd48d1a9a716456ff1ebe67e19881ad2f56939b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91397 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sw/source/filter/ww8')
-rw-r--r--sw/source/filter/ww8/docxsdrexport.cxx12
1 files changed, 12 insertions, 0 deletions
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())
{