Kaydet (Commit) 96965fb3 authored tarafından Miklos Vajna's avatar Miklos Vajna

DOCX drawingML export: don't export textboxes of shapes twice

We already had code, so that in case a shape has a textbox, then we
wrote the textbox contents as the shape text, but textboxes were still
exported independently as well.

Build a list of textboxes at the start of the export, and ignore
anything that's on that list during export. In the future, if both RTF
and DOC will support textboxes, then this can be moved to
MSWordExportBase.

Change-Id: I9370b2bbda515ef605281ad398a358b2f24d8f0e
üst 3b8ce44e
...@@ -4415,6 +4415,10 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po ...@@ -4415,6 +4415,10 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
break; break;
case sw::Frame::eTxtBox: case sw::Frame::eTxtBox:
{ {
// If this is a TextBox of a shape, then ignore: it's handled in WriteTextBox().
if (m_rExport.SdrExporter().isTextBox(rFrame.GetFrmFmt()))
break;
// The frame output is postponed to the end of the anchor paragraph // The frame output is postponed to the end of the anchor paragraph
bool bDuplicate = false; bool bDuplicate = false;
const OUString& rName = rFrame.GetFrmFmt().GetName(); const OUString& rName = rFrame.GetFrmFmt().GetName();
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <frmatr.hxx> #include <frmatr.hxx>
#include <frmfmt.hxx> #include <frmfmt.hxx>
#include <textboxhelper.hxx>
#include <fmtanchr.hxx> #include <fmtanchr.hxx>
#include <fmtornt.hxx> #include <fmtornt.hxx>
#include <fmtsrnd.hxx> #include <fmtsrnd.hxx>
...@@ -155,6 +156,8 @@ struct DocxSdrExport::Impl ...@@ -155,6 +156,8 @@ struct DocxSdrExport::Impl
sal_Int32 m_nId ; sal_Int32 m_nId ;
sal_Int32 m_nSeq ; sal_Int32 m_nSeq ;
bool m_bDMLAndVMLDrawingOpen; bool m_bDMLAndVMLDrawingOpen;
/// List of TextBoxes in this document: they are exported as part of their shape, never alone.
std::list<SwFrmFmt*> m_aTextBoxes;
Impl(DocxSdrExport& rSdrExport, DocxExport& rExport, sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML) Impl(DocxSdrExport& rSdrExport, DocxExport& rExport, sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML)
: m_rSdrExport(rSdrExport), : m_rSdrExport(rSdrExport),
...@@ -176,7 +179,8 @@ struct DocxSdrExport::Impl ...@@ -176,7 +179,8 @@ struct DocxSdrExport::Impl
m_pDashLineStyleAttr(0), m_pDashLineStyleAttr(0),
m_nId(0), m_nId(0),
m_nSeq(0), m_nSeq(0),
m_bDMLAndVMLDrawingOpen(false) m_bDMLAndVMLDrawingOpen(false),
m_aTextBoxes(SwTextBoxHelper::findTextBoxes(m_rExport.pDoc))
{ {
} }
...@@ -1522,4 +1526,9 @@ bool DocxSdrExport::checkFrameBtlr(SwNode* pStartNode, sax_fastparser::FastAttri ...@@ -1522,4 +1526,9 @@ bool DocxSdrExport::checkFrameBtlr(SwNode* pStartNode, sax_fastparser::FastAttri
return false; return false;
} }
bool DocxSdrExport::isTextBox(const SwFrmFmt& rFrmFmt)
{
return std::find(m_pImpl->m_aTextBoxes.begin(), m_pImpl->m_aTextBoxes.end(), &rFrmFmt) != m_pImpl->m_aTextBoxes.end();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -97,6 +97,8 @@ public: ...@@ -97,6 +97,8 @@ public:
void writeVMLTextFrame(sw::Frame* pParentFrame); void writeVMLTextFrame(sw::Frame* pParentFrame);
/// Undo the text direction mangling done by the frame btLr handler in writerfilter::dmapper::DomainMapper::lcl_startCharacterGroup() /// Undo the text direction mangling done by the frame btLr handler in writerfilter::dmapper::DomainMapper::lcl_startCharacterGroup()
bool checkFrameBtlr(SwNode* pStartNode, sax_fastparser::FastAttributeList* pTextboxAttrList = 0); bool checkFrameBtlr(SwNode* pStartNode, sax_fastparser::FastAttributeList* pTextboxAttrList = 0);
/// Is this a standalone TextFrame, or used as a TextBox of a shape?
bool isTextBox(const SwFrmFmt& rFrmFmt);
}; };
#endif // INCLUDED_SW_SOURCE_FILTER_WW8_DOCXSDREXPORT_HXX #endif // INCLUDED_SW_SOURCE_FILTER_WW8_DOCXSDREXPORT_HXX
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment