summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-08-14 12:35:51 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2019-08-14 16:51:19 +0200
commiteceace1f688ef2a50dc298cb4149c5a84fcaa34e (patch)
tree64b97e5ebe9483174ee9a883d20e876f8748ac70 /sw/source
parentf8fdf1df6415dfb3a82e6e632c9d26166984a3d2 (diff)
sw: fix assert on export of ooo39250-1.rtf to DOCX
The problem is that a fly anchored at-char inside a text frame is being exported; in DocxSdrExport::startDMLAnchorInline() the m_bFlyFrameGraphic is true so an "inline" element is written but then DocxSdrExport::writeDMLTextFrame() sets the flag to true then false, so in endDMLAnchorInline() it's false and "anchor" results. Remove the pointless information hiding between DocxSdrExport and its own pImpl class so that the previous flag can be restored. (regression from commit 28b77c89dfcafae82cf2a6d85731b643ff9290e5 which changed things somehow so that the anchor is inside the text frame instead of the body as it was before; Word has it also in the text frame so we can consider it an improvement) Change-Id: I2df20b5cc336251f1c20cf81b6d68153c0c6ff46 Reviewed-on: https://gerrit.libreoffice.org/77454 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/filter/ww8/docxsdrexport.cxx36
1 files changed, 18 insertions, 18 deletions
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index b65ca4a383f7..8fa71a663bc9 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -26,6 +26,7 @@
#include <frmatr.hxx>
#include "docxattributeoutput.hxx"
#include "docxexportfilter.hxx"
+#include <comphelper/flagguard.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <sal/log.hxx>
@@ -138,7 +139,6 @@ private:
bool m_bDrawingOpen;
bool m_bParagraphSdtOpen;
bool m_bParagraphHasDrawing; ///Flag for checking drawing in a paragraph.
- bool m_bFlyFrameGraphic;
rtl::Reference<sax_fastparser::FastAttributeList> m_pFlyFillAttrList;
sax_fastparser::FastAttributeList* m_pFlyWrapAttrList;
sax_fastparser::FastAttributeList* m_pBodyPrAttrList;
@@ -149,6 +149,8 @@ private:
sal_Int32 m_nDMLandVMLTextFrameRotation;
public:
+ bool m_bFlyFrameGraphic = false;
+
Impl(DocxExport& rExport, sax_fastparser::FSHelperPtr pSerializer,
oox::drawingml::DrawingML* pDrawingML)
: m_rExport(rExport)
@@ -160,7 +162,6 @@ public:
, m_bDrawingOpen(false)
, m_bParagraphSdtOpen(false)
, m_bParagraphHasDrawing(false)
- , m_bFlyFrameGraphic(false)
, m_pFlyWrapAttrList(nullptr)
, m_pBodyPrAttrList(nullptr)
, m_bDMLAndVMLDrawingOpen(false)
@@ -261,8 +262,6 @@ public:
return m_pDashLineStyleAttr;
}
- void setFlyFrameGraphic(bool bFlyFrameGraphic) { m_bFlyFrameGraphic = bFlyFrameGraphic; }
-
bool getFlyFrameGraphic() const { return m_bFlyFrameGraphic; }
oox::drawingml::DrawingML* getDrawingML() const { return m_pDrawingML; }
@@ -1112,9 +1111,8 @@ void DocxSdrExport::writeOnlyTextOfFrame(ww8::Frame const* pParentFrame)
ExportDataSaveRestore aDataGuard(m_pImpl->getExport(), nStt, nEnd, pParentFrame);
m_pImpl->setBodyPrAttrList(sax_fastparser::FastSerializerHelper::createAttrList());
- m_pImpl->setFlyFrameGraphic(true);
+ ::comphelper::FlagRestorationGuard const g(m_pImpl->m_bFlyFrameGraphic, true);
m_pImpl->getExport().WriteText();
- m_pImpl->setFlyFrameGraphic(false);
}
void DocxSdrExport::writeBoxItemLine(const SvxBoxItem& rBox)
@@ -1367,14 +1365,15 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
else if (rDirection.GetValue() == SvxFrameDirection::Vertical_LR_BT)
m_pImpl->getBodyPrAttrList()->add(XML_vert, "vert270");
- m_pImpl->setFlyFrameGraphic(true);
- m_pImpl->getExport().WriteText();
- if (m_pImpl->getParagraphSdtOpen())
{
- m_pImpl->getExport().DocxAttrOutput().EndParaSdtBlock();
- m_pImpl->setParagraphSdtOpen(false);
+ ::comphelper::FlagRestorationGuard const g(m_pImpl->m_bFlyFrameGraphic, true);
+ m_pImpl->getExport().WriteText();
+ if (m_pImpl->getParagraphSdtOpen())
+ {
+ m_pImpl->getExport().DocxAttrOutput().EndParaSdtBlock();
+ m_pImpl->setParagraphSdtOpen(false);
+ }
}
- m_pImpl->setFlyFrameGraphic(false);
pFS->endElementNS(XML_w, XML_txbxContent);
pFS->endElementNS(XML_wps, XML_txbx);
@@ -1515,14 +1514,15 @@ void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bText
pFS->startElementNS(XML_v, XML_textbox, xTextboxAttrList);
}
pFS->startElementNS(XML_w, XML_txbxContent);
- m_pImpl->setFlyFrameGraphic(true);
- m_pImpl->getExport().WriteText();
- if (m_pImpl->getParagraphSdtOpen())
{
- m_pImpl->getExport().DocxAttrOutput().EndParaSdtBlock();
- m_pImpl->setParagraphSdtOpen(false);
+ ::comphelper::FlagRestorationGuard const g(m_pImpl->m_bFlyFrameGraphic, true);
+ m_pImpl->getExport().WriteText();
+ if (m_pImpl->getParagraphSdtOpen())
+ {
+ m_pImpl->getExport().DocxAttrOutput().EndParaSdtBlock();
+ m_pImpl->setParagraphSdtOpen(false);
+ }
}
- m_pImpl->setFlyFrameGraphic(false);
pFS->endElementNS(XML_w, XML_txbxContent);
if (!bTextBoxOnly)
{