summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-09-18 11:47:56 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-09-21 11:02:20 +0200
commitfdc8590032b292dcb8152b328401e591fea642a4 (patch)
treec3951fc48c92f69c4c38e3dc2291904d9d4ff94d /sw/source/filter/ww8
parent54bd2266d6e0c8926ecaf0fbb2dbb5ee9d1a802d (diff)
tdf#136620 tdf#136708 filter,oox,sw: fix export of 2 different wraps
This reverts commit 2cb90a5c87fe46737c8d840967d8836284f92ffd. Revert the change to EscherPropertyContainer, which was completely bogus, based on pre-existing bogus code in VMLExport::Commit(). The problem is that ESCHER_Wrap values are for wrapping text *inside* a text box, which is "mso-wrap-style" in VML, whereas VML's w10:wrap element defines how text wraps *around* a shape, doesn't exist as an ESCHER property and is specific to Word formats. Instead, export the w10:wrap element in VMLExport::EndShape(). This has 2 callers, WriteActiveXControl() and writeVMLDrawing(). Furthermore the value "none" wasn't written for WrapTextMode_THROUGH, which caused the wrap element to be omitted in that case. Change-Id: Id4a01fcb2ea73fa9bef4ee8769b5e0680e059f15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103009 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/source/filter/ww8')
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx91
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx6
-rw-r--r--sw/source/filter/ww8/docxsdrexport.cxx6
3 files changed, 69 insertions, 34 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index caaaf440ddc3..59c75c6fa635 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5446,10 +5446,14 @@ void DocxAttributeOutput::WriteActiveXControl(const SdrObject* pObject, const Sw
{
const SwFormatHoriOrient& rHoriOri = rFrameFormat.GetHoriOrient();
const SwFormatVertOrient& rVertOri = rFrameFormat.GetVertOrient();
+ SwFormatSurround const& rSurround(rFrameFormat.GetSurround());
+ std::unique_ptr<sax_fastparser::FastAttributeList> pAttrList(docx::SurroundToVMLWrap(rSurround));
sShapeId = m_rExport.VMLExporter().AddSdrObject(*pObject,
rHoriOri.GetHoriOrient(), rVertOri.GetVertOrient(),
rHoriOri.GetRelationOrient(),
- rVertOri.GetRelationOrient(), true);
+ rVertOri.GetRelationOrient(),
+ std::move(pAttrList),
+ true);
}
// Restore default values
m_rExport.VMLExporter().SetSkipwzName(false);
@@ -8816,43 +8820,64 @@ void DocxAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace )
}
}
-void DocxAttributeOutput::FormatSurround( const SwFormatSurround& rSurround )
+namespace docx {
+
+std::unique_ptr<FastAttributeList> SurroundToVMLWrap(SwFormatSurround const& rSurround)
{
- if (m_rExport.SdrExporter().getTextFrameSyntax())
+ FastAttributeList * pAttrList(nullptr);
+ OString sType;
+ OString sSide;
+ switch (rSurround.GetSurround())
{
- OString sType, sSide;
- switch (rSurround.GetSurround())
+ case css::text::WrapTextMode_NONE:
+ sType = "topAndBottom";
+ break;
+ case css::text::WrapTextMode_PARALLEL:
+ sType = "square";
+ break;
+ case css::text::WrapTextMode_DYNAMIC:
+ sType = "square";
+ sSide = "largest";
+ break;
+ case css::text::WrapTextMode_LEFT:
+ sType = "square";
+ sSide = "left";
+ break;
+ case css::text::WrapTextMode_RIGHT:
+ sType = "square";
+ sSide = "right";
+ break;
+ case css::text::WrapTextMode_THROUGH:
+ /* empty type and side means through */
+ default:
+ sType = "none";
+ break;
+ }
+ if (!sType.isEmpty() || !sSide.isEmpty())
+ {
+ pAttrList = FastSerializerHelper::createAttrList();
+ if (!sType.isEmpty())
{
- case css::text::WrapTextMode_NONE:
- sType = "topAndBottom";
- break;
- case css::text::WrapTextMode_PARALLEL:
- sType = "square";
- break;
- case css::text::WrapTextMode_DYNAMIC:
- sType = "square";
- sSide = "largest";
- break;
- case css::text::WrapTextMode_LEFT:
- sType = "square";
- sSide = "left";
- break;
- case css::text::WrapTextMode_RIGHT:
- sType = "square";
- sSide = "right";
- break;
- case css::text::WrapTextMode_THROUGH:
- /* empty type and side means through */
- default:
- break;
+ pAttrList->add(XML_type, sType);
+ }
+ if (!sSide.isEmpty())
+ {
+ pAttrList->add(XML_side, sSide);
}
- if (!sType.isEmpty() || !sSide.isEmpty())
+ }
+ return std::unique_ptr<FastAttributeList>(pAttrList);
+}
+
+} // namespace docx
+
+void DocxAttributeOutput::FormatSurround( const SwFormatSurround& rSurround )
+{
+ if (m_rExport.SdrExporter().getTextFrameSyntax())
+ {
+ std::unique_ptr<FastAttributeList> pAttrList(docx::SurroundToVMLWrap(rSurround));
+ if (pAttrList)
{
- m_rExport.SdrExporter().setFlyWrapAttrList(FastSerializerHelper::createAttrList());
- if (!sType.isEmpty())
- m_rExport.SdrExporter().getFlyWrapAttrList()->add(XML_type, sType);
- if (!sSide.isEmpty())
- m_rExport.SdrExporter().getFlyWrapAttrList()->add(XML_side, sSide);
+ m_rExport.SdrExporter().setFlyWrapAttrList(pAttrList.release());
}
}
else if (m_rExport.SdrExporter().getDMLTextFrameSyntax())
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index e711d88d23a4..089914ea0b2b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -1054,6 +1054,12 @@ struct DocxTableExportContext
~DocxTableExportContext() { m_rOutput.popFromTableExportContext(*this); }
};
+namespace docx {
+
+std::unique_ptr<sax_fastparser::FastAttributeList> SurroundToVMLWrap(SwFormatSurround const& rSurround);
+
+}
+
#endif // INCLUDED_SW_SOURCE_FILTER_WW8_DOCXATTRIBUTEOUTPUT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index cdae55937a4e..30d08a8cb2e5 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -846,9 +846,13 @@ void DocxSdrExport::writeVMLDrawing(const SdrObject* sdrObj, const SwFrameFormat
const SwFormatHoriOrient& rHoriOri = rFrameFormat.GetHoriOrient();
const SwFormatVertOrient& rVertOri = rFrameFormat.GetVertOrient();
+ SwFormatSurround const& rSurround(rFrameFormat.GetSurround());
+
+ std::unique_ptr<sax_fastparser::FastAttributeList> pAttrList(
+ docx::SurroundToVMLWrap(rSurround));
m_pImpl->getExport().VMLExporter().AddSdrObject(
*sdrObj, rHoriOri.GetHoriOrient(), rVertOri.GetVertOrient(), rHoriOri.GetRelationOrient(),
- rVertOri.GetRelationOrient(), true);
+ rVertOri.GetRelationOrient(), std::move(pAttrList), true);
m_pImpl->getSerializer()->endElementNS(XML_w, XML_pict);
}