summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-03-31 14:37:14 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-03-31 15:44:56 +0200
commit0dd48d1a9a716456ff1ebe67e19881ad2f56939b (patch)
tree3193911ab047cda9e8eac6befa63f143514ec679
parentfd7e4706d80d1769803b7b4ac57df4c80a5c80f2 (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>
-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 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())
{