From 7eac3e78abcdece849b8bac61545b0d3ddf5800c Mon Sep 17 00:00:00 2001 From: Regina Henschel Date: Wed, 18 Jan 2023 20:19:51 +0100 Subject: tdf#128568 Improve export to docx of Fontwork with bitmap fill The modern 'abc transform' in Word is not able to use bitmap fill, but it is possible in legacy VML. Thus use VML in such cases. A WordArt shape in VML has the text not in a element but as string='...' attribute in the element. To detect whether a custom shape is a Fontwork in an easy way without cast, I have added the already for custom shapes existing method IsTextPath() to the basis class SdrObject. Using VML for Fontwork with bitmap fill, errors in the VML code become visible: * Using element results in Word in a picture of the shape. The shape itself was lost. A bitmap fill of a shape has to be written with the element. * Mode 'stretched' in LO UI becomes type='frame' attribute in VML. I have adapted the unit test NoFillAttrInImagedata in ooxmlexport2.cxx in sw. The source file has the background image in a v:fill element. If you replace the 'wps' namespace with a 'my' namespace in the file generated by LO and so force Word to use the Fallback, you will see that with v:imagedata Word does not show a background image. Thus the assumption in the test was wrong, that there has to be a v:imagedata element. Change-Id: I6b2b5b8bb19adcee3b41e536419556465e85d135 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145823 Tested-by: Jenkins Reviewed-by: Regina Henschel --- include/svx/svdoashp.hxx | 2 +- include/svx/svdobj.hxx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'include/svx') diff --git a/include/svx/svdoashp.hxx b/include/svx/svdoashp.hxx index 1a7521a2c764..ef84beeb50e2 100644 --- a/include/svx/svdoashp.hxx +++ b/include/svx/svdoashp.hxx @@ -117,7 +117,7 @@ public: const SdrObject* GetSdrObjectFromCustomShape() const; const SdrObject* GetSdrObjectShadowFromCustomShape() const; bool GetTextBounds( tools::Rectangle& rTextBound ) const; - bool IsTextPath() const; + virtual bool IsTextPath() const override; basegfx::B2DPolyPolygon GetLineGeometry( const bool bBezierAllowed ) const; protected: diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 2404060e5936..3efddc78ac0d 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -763,6 +763,7 @@ public: void SetMarkProtect(bool bProt); bool IsMarkProtect() const { return m_bMarkProt;} virtual bool IsSdrTextObj() const { return false; } + virtual bool IsTextPath() const { return false ; } /// Whether the aspect ratio should be kept by default when resizing. virtual bool shouldKeepAspectRatio() const { return false; } -- cgit