diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-10-15 11:31:20 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-10-15 13:19:08 +0200 |
commit | f57ed7edd498d62ca0ed9a8cedd72218985b4daf (patch) | |
tree | 23e3ab0bbcd11ccb724ca7cfe11f5e0b0e51ffd1 /sw/source | |
parent | d9fa1247be9d3a3d559adbbf9e1ed12395744738 (diff) |
fdo#82860 RTF export: don't export textboxes of shapes twice
See 96965fb39d6d376e91030a01c11f16f9428ddf2e (DOCX drawingML export:
don't export textboxes of shapes twice, 2014-06-06).
Change-Id: I89c039debeca5f88f172479b9f8ecbaec2dc7bc4
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfsdrexport.cxx | 9 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfsdrexport.hxx | 8 |
3 files changed, 20 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index a7eecbca3f0c..0a26834dcc51 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -1601,6 +1601,10 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const sw::Frame& rFrame, const Poin { case sw::Frame::eTxtBox: { + // If this is a TextBox of a shape, then ignore: it's handled in RtfSdrExport::StartShape(). + if (m_rExport.SdrExporter().isTextBox(rFrame.GetFrmFmt())) + break; + OSL_ENSURE(m_aRunText.getLength() == 0, "m_aRunText is not empty"); m_rExport.mpParentFrame = &rFrame; diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx index 2b8e5fb9f9cc..e25ba1d0ed03 100644 --- a/sw/source/filter/ww8/rtfsdrexport.cxx +++ b/sw/source/filter/ww8/rtfsdrexport.cxx @@ -27,6 +27,7 @@ #include <svx/svdotext.hxx> #include <svx/unoapi.hxx> #include <vcl/cvtgrf.hxx> +#include <textboxhelper.hxx> #include <algorithm> @@ -41,7 +42,8 @@ RtfSdrExport::RtfSdrExport(RtfExport& rExport) m_nShapeType(ESCHER_ShpInst_Nil), m_nShapeFlags(0) , m_pShapeStyle(new OStringBuffer(200)), - m_pShapeTypeWritten(new bool[ ESCHER_ShpInst_COUNT ]) + m_pShapeTypeWritten(new bool[ ESCHER_ShpInst_COUNT ]), + m_aTextBoxes(SwTextBoxHelper::findTextBoxes(m_rExport.pDoc)) { mnGroupLevel = 1; memset(m_pShapeTypeWritten, 0, ESCHER_ShpInst_COUNT * sizeof(bool)); @@ -596,4 +598,9 @@ sal_uInt32 RtfSdrExport::AddSdrObject(const SdrObject& rObj) return EscherEx::AddSdrObject(rObj); } +bool RtfSdrExport::isTextBox(const SwFrmFmt& rFrmFmt) +{ + return m_aTextBoxes.find(&rFrmFmt) != m_aTextBoxes.end(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfsdrexport.hxx b/sw/source/filter/ww8/rtfsdrexport.hxx index 449a53850f7a..026a6017d4de 100644 --- a/sw/source/filter/ww8/rtfsdrexport.hxx +++ b/sw/source/filter/ww8/rtfsdrexport.hxx @@ -25,9 +25,11 @@ #include <rtl/strbuf.hxx> #include <map> +#include <set> class RtfExport; class RtfAttributeOutput; +class SwFrmFmt; /// Handles export of drawings using RTF markup class RtfSdrExport : public EscherEx @@ -52,6 +54,9 @@ class RtfSdrExport : public EscherEx /// Remember which shape types we had already written. bool* m_pShapeTypeWritten; + /// List of TextBoxes in this document: they are exported as part of their shape, never alone. + std::set<const SwFrmFmt*> m_aTextBoxes; + public: RtfSdrExport(RtfExport& rExport); virtual ~RtfSdrExport(); @@ -61,6 +66,9 @@ public: /// Call this when you need to export the object as Sdr in RTF. sal_uInt32 AddSdrObject(const SdrObject& rObj); + /// Is this a standalone TextFrame, or used as a TextBox of a shape? + bool isTextBox(const SwFrmFmt& rFrmFmt); + protected: /// Start the shape for which we just collected the information. /// |