Re: Parameter for addShape for a child of a group in oox import

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Miklos,

answer below.

Miklos Vajna schrieb am 03.05.2021 um 15:47:
Hi Regina,

On Fri, Apr 30, 2021 at 04:39:41PM +0200, Regina Henschel <rb.henschel@xxxxxxxxxxx> wrote:
So I still need a way to transport the values from the group to its
children. Besides my first idea to put all group infos into a struct and use
that instead of the aTransformation parameter, I can also think to put them
into the grabbag of each child.

The primary purpose of the grabbag property of shapes is to carry
information from the importer to the exporter, when the document model
doesn't handle some information. So if you can solve this without
grabbags, that would be nice. >
Such transport of information from group to child is also needed, if e.g. 3D
transformations are not made on the individual shapes but on the group.
MSOffice allows to apply attributes to the group and writes it that way to
file, but LibreOffice has no attributes on groups.

Yes, that's what I recall as well, our group shape is just a container
of shapes.

I'm still interested in you opinion how to design it.

oox/ code creates oox::drawing::Shape instances, then once all of them
is created, it turns them into XShapes ("creates and inserts them").

Do you think it would be possible to improve
oox::drawingml::Shape::createAndInsert(), so that it would get not only
the parent transform but also the parent oox::drawing::Shape? If that
would work, then setChildPosition() and setChildSize() already stores
chOff/chExt values on the parent, and you could access the needed
information.

That means, I do not sent the information to the child, but the child fetches it from the parent. I like your idea.

Shape::addChildren() is called with a reference to the group shape. So there the parent shape is known. It does not call Shape::createAndInsert() directly, but calls Shape::addShape(), which then calls Shape::createAndInsert().

So add a pointer to addShape() and to createAndInsert()? If they are called first time, it would be a nullptr. Such pointer could likely replace the 'bInGroup' parameter.

The parameter aTransformation in addShape() is still needed, because it cumulates the transformations in case there are nested groups.


If this doesn't work, then the above grabbag way is also acceptable (I
would say), just less nice: what you set there will stay around even
after the import finished and nobody needs that.

I will try it without grabBag.

I'm confident about the needed calculations themselves in the meantime. At least my manually calculations in a spreadsheet show the correct position and size now for the shapes in case of nested groups too. But it will take me a while to translate the principle solution into code.

Kind regards
Regina

_______________________________________________
LibreOffice mailing list
LibreOffice@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/libreoffice



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux