summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-06-06 14:46:21 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-06-06 14:54:15 +0200
commit96965fb39d6d376e91030a01c11f16f9428ddf2e (patch)
tree310ab31e5e210d75c2a51e6a4fbdb384da810eef
parent3b8ce44eba33b04773efe4806583a746233a25c9 (diff)
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
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx4
-rw-r--r--sw/source/filter/ww8/docxsdrexport.cxx11
-rw-r--r--sw/source/filter/ww8/docxsdrexport.hxx2
3 files changed, 16 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 41630d4b92cb..34b0c0685d95 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 5aaeb2ef8495..b86fc6e31574 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 c05979fd5ba5..5cda344ba7c0 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