words: images with anchoring enabled will be saved twice to odf.

Silvio Heinrich plassy at web.de
Fri Dec 16 09:54:22 GMT 2011


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?



More information about the calligra-devel mailing list