On Friday 16 December 2011 Dec, Silvio Heinrich wrote: > There is a problem when saving a text document that contains anchored > images. > In the saving process the saveOdf method of the shape (the pictureshape > in this case) is called twice because the shape itself exists twice in > the document. > The shape is added to the KWDocument and if it is anchored it is also > passed to a KoTextAnchor instance that is added as an inline object. > Now when saving it seems as if first all the shapes and then all the > inline objects will be saved. > That leads to an odf output like this: > > // 1. pictureshape is saves > <frame ...><image .../></frame> > // 2. inline object (the KoTextAnchor) is saved > // it puts a paragraph tag around the image and calls the safeOdf method > of the imageshape again > <p ...><frame ...><image .../></frame></p> > > So for me it seems when the shape is anchored it should be removed from > the KWDocument > but on the other hand it needs to be present in the KWDocument to render > and interact with the shape. > > Does anyone have a guess how to solve this problem?
I've gone through the code as well, and I'm beginning to think that there are two options: 1) mark the shape as anchored and if so, not save except through KoTextAnchor 2) on saving, get a list of anchored shapes from the text document, add that to the shapesavingcontext as a list of do-not-save-shapes, and make all shapes check that list. That would be more generic, but also slower. -- Boudewijn Rempt http://www.valdyas.org, http://www.krita.org, http://www.boudewijnrempt.nl _______________________________________________ calligra-devel mailing list calligra-devel@kde.org https://mail.kde.org/mailman/listinfo/calligra-devel