[Libreoffice-commits] core.git: sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Fri Jun 6 05:54:52 PDT 2014
sw/source/filter/ww8/docxattributeoutput.cxx | 4 ++++
sw/source/filter/ww8/docxsdrexport.cxx | 11 ++++++++++-
sw/source/filter/ww8/docxsdrexport.hxx | 2 ++
3 files changed, 16 insertions(+), 1 deletion(-)
New commits:
commit 96965fb39d6d376e91030a01c11f16f9428ddf2e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Jun 6 14:46:21 2014 +0200
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
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 41630d4..34b0c06 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4415,6 +4415,10 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
break;
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
bool bDuplicate = false;
const OUString& rName = rFrame.GetFrmFmt().GetName();
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 5aaeb2e..b86fc6e 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -29,6 +29,7 @@
#include <frmatr.hxx>
#include <frmfmt.hxx>
+#include <textboxhelper.hxx>
#include <fmtanchr.hxx>
#include <fmtornt.hxx>
#include <fmtsrnd.hxx>
@@ -155,6 +156,8 @@ struct DocxSdrExport::Impl
sal_Int32 m_nId ;
sal_Int32 m_nSeq ;
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)
: m_rSdrExport(rSdrExport),
@@ -176,7 +179,8 @@ struct DocxSdrExport::Impl
m_pDashLineStyleAttr(0),
m_nId(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
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: */
diff --git a/sw/source/filter/ww8/docxsdrexport.hxx b/sw/source/filter/ww8/docxsdrexport.hxx
index c05979f..5cda344 100644
--- a/sw/source/filter/ww8/docxsdrexport.hxx
+++ b/sw/source/filter/ww8/docxsdrexport.hxx
@@ -97,6 +97,8 @@ public:
void writeVMLTextFrame(sw::Frame* pParentFrame);
/// 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);
+ /// 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
More information about the Libreoffice-commits
mailing list