problem with vml-shape-types file

Regina Henschel rb.henschel at t-online.de
Mon Jan 30 00:54:01 UTC 2023


Hi Miklos, hi all,

Miklos Vajna schrieb am 09.01.2023 um 10:34:
> Hi Regina,
> 
> On Sat, Jan 07, 2023 at 10:11:46PM +0100, Regina Henschel <rb.henschel at t-online.de> wrote:
>> The vml-shape-types file is used, when a shape is exported to VML. If I
>> understand it correctly, then this file is generated from
>> presetShapeDefinitions.xml and presetTextWarpDefinitions.xml respectively by
>> preset-definitions-to-shape-types.pl script. The file itself is located in
>> <installation directory>/share/filter, not in repository (Why?).
> 
> preset-definitions-to-shape-types.pl generates vml-shape-types from XML
> files which are part of the OOXML spec. It seems logical to generate
> such data only once at build-time (as opposed to generating it every
> time at runtime), but we tend to not add such generated data to git.
> 
>> This file does not work for handles in Fontwork shapes. The problem is the
>> position attribute of a handle:
>> (A) The reference to the adjustment value is made by a reference to a
>> formula (@), but it needs to be a reference to the adjustment value itself
>> (#).
>> (B) The positions left, right, top, bottom, center are written with numbers
>> 0, 10800 and 21600. But it need to be topLeft, center, bottomRight.

It turns out, that there are more problems with this file and Fontwork 
shapes:
(C) There exists 40 OOXML preset TextWarpDefinitions and 8 legacy 
WordArt files. From these 48 shape types 14 have no markup in the 
vml-shape-types file.
(D) Word does not accept the markup from this file as WordArt markup, 
likely because it is generated from the OOXML presets and has parts to 
simulate the OOXML constants. Word treats the <v:shapetype> then as 
custom shapetype when it resaves it. The result is, that 
'id="_x0000_t172" o:spt="172"' written by LO becomes 'id="_x0000_m1027" 
o:spt="100"', for example, when resaved by Word. And having these 
attributes, LO cannot render the shapes at all.

>>
>> VML is needed for export of Fontwork shapes with fill other than solid or
>> gradient, because such fill cannot be expressed with Words "abc Transform".
>> Therefore I need a way to get correct VML shapetype markup for Fontwork
>> shapes. There exist 40 types of Fontwork shapes in
>> presetTextWarpDefinitions.xml. All of them have handles.
>> There are 8 binary WordArt shapes, where the relationship to the shapes in
>> presetTextWarpDefinitions.xml is unclear.
>>
>> I could manually make a file for the markup of the WordArt shapetypes and
>> use that. I'm not familiar with Perl scripts.
>>
>> Better ideas or suggestions?
> 
> I'm not an expert in perl, either, but hopefully with a bit of
> experimenting you can tweak
> oox/source/export/preset-definitions-to-shape-types.pl so that when it's
> invoked with the --vml-shape-types-data switch, then it outputs the
> markup that you would want.
> 
> My expectation is that the tricky part is not perl but to find out how
> the mapping from drawingML presets to VML markup goes wrong.

I have not investigated whether it is possible to generate a better 
vml-shape-types file. But I have now generated the needed markup 
manually. I have uploaded a first version with a map inside a method, 
see https://gerrit.libreoffice.org/c/core/+/146311

Content wise these markups work, i.e. Word recognizes the shapes as 
WordArt and the handles can be moved in Word.

But I'm unsure about the technical part. Please advise me, how I should 
write/use such map.

> 
>> BTW, Word uses VML WordArt, when it opens a doc file with binary WordArt or
>> opens an odt file with custom-shape with textpath on. And it keeps it as
>> VML, when converting the file to docx, even if it would be possible to use
>> "abc Transform". But that is a -not jet fixed- import problem and not
>> effected by the above mentioned file.
> 
> I guess it affects the VML export all the time, just Word >= 2010
> ignores VML if there is drawingML for a shape.

Yes, the Fallback is usually ignored by Word. I have replaced the wps 
namespace with "my" namespace in the docx file and then Word will use 
the VML from the Fallback.

In released LO the Fontwork shapes 'TextPlaintText' (136), 'TextSlantup' 
(172) and 'TextDeflateInflateDeflate' (167) do not generate DML but only 
VML.

I have committed already, that Fontwork with bitmap fill is exported as 
only VML.

When LO is able to import and export custom shapetype Fontwork shapes 
(bottom of my ToDo-list), that will be only VML too, because OOXML does 
not allow custom WordArt shapes.

Kind regards,
Regina




More information about the LibreOffice mailing list