Issue 103339

Summary: Parts of drawing groups missing after adding via "Insert.File"
Product: Writer Reporter: frank_markesteijn <frank.markesteijn>
Component: codeAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: issues
Version: OOO310m14   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
A text document containing draw groups and an image.
none
inserted original.odt
none
grouped objects with z-index
none
inserted z-index.odt
none
Replacement for original.odt
none
Replacement for inserted.odt none

Description frank_markesteijn 2009-07-05 20:30:26 UTC
When an odt document containing grouped draw graphics gets inserted into another
odt document, in writer, by choosing "Insert" from the menu and then "File..."
then, pixel images inside the <draw:g> element are not preserved, <draw:frame>
elements containing <draw:image> elements are copied correctly but, the
xlink:href property is not copied, after insertion it contains an empty string,
and the pixel image itself is not copied either, it is not copied to the zip
archive of the document into which it got inserted. As far as I can tell
original.odt conforms to the ODF 1.0 specification, iso/iec 26300, and the PNG
image is fine too, if anyone thinks otherwise, do let me know.

A similar thing happens when inserting a drawing with OLE, issue 103336.

To illustrate the matter, I attached two documents "original.odt" and
"inserted.odt", the former got inserted into the latter. The abbreviated
contents of the content.xml files of the attached documents are shown here:

A paragraph/page of the original file:

<text:p text:style-name="Standard">
	<draw:g>
		<draw:frame svg:x="0pt" svg:y="0pt" svg:width="595pt" svg:height="842pt">
			<draw:image xlink:href="Pictures/1.png"/>
		</draw:frame>

		...All other objects on this page...

	</draw:g>
</text:p>


The same paragraph/page after insertion:

<text:p text:style-name="Standard">
	<draw:g text:anchor-type="paragraph" draw:z-index="0" draw:style-name="gr1">
		<draw:frame draw:style-name="gr2" svg:width="20.989cm" svg:height="29.705cm"
svg:x="0cm" svg:y="0cm">
			<draw:image xlink:href="">
				<text:p/>
			</draw:image>
		</draw:frame>

		...All other objects on this page...

	</draw:g>
</text:p>


Note that the grouping is preserved and the order of appearance and the z-axis
ordering of objects within a draw group are preserved, when importing a
document, no draw:z-index properties will be added if none are present, objects
will be rendered in order of appearance.

There are two more attachments: z-index.odt, it is similar to original.odt but
all draw objects now have a draw:z-index property and the order of appearance of
the objects in the content.xml file was mixed up. This document was then
inserted into another odt document, z-index-inserted.odt, the order in which
objects are rendered is the same for both z-index.odt and z-index-inserted.odt.
If you unzip the latter then, in content.xml you will see that the objects
within a draw group are now sorted according to the z-index number and the
draw:z-index property has been stripped of.

Why does this z-index stuff matter?

If the issue of the lost picture gets fixed that would offer developers of ODF
producing applications a workaround for the z-axis ordering problem, issue
62094, issue 95948, issue 103338 and perhaps issue 77355, all developers would
need to do is to group the drawing objects! The same would hold true for users
of OpenOffice if (in Writer) they could select multiple drawing objects and
group them.

Why does this missing picture issue matter? You can copy and paste a drawing
from "Draw" to "Writer" or you could insert it as an OLE object.

Yes that may work, for single page documents but, not for multi page documents,
not if you wish to append a large number of (automatically generated) pages as
an appendix to a report.


Workaround

There is indeed a workaround for the problems above, hum:
Save the odt document that is to be inserted (original.odt in this case) in the
word 97/2000/xp format and insert that. This works for all versions of
OpenOffice, the earliest version I tried (with an sxw document) is 1.1.3.
However, if you thus create an odt document and insert that into another odt
document the picture is missing again.

if anyone knows of a better workaround, changes to the xml code, that would be
much appreciated.

Perhaps this issue is easier to fix than the z-axis ordering problem, good luck.

Frank.
Comment 1 frank_markesteijn 2009-07-05 20:32:08 UTC
Created attachment 63380 [details]
A text document containing draw groups and an image.
Comment 2 frank_markesteijn 2009-07-05 20:32:59 UTC
Created attachment 63381 [details]
inserted original.odt
Comment 3 frank_markesteijn 2009-07-05 20:34:05 UTC
Created attachment 63382 [details]
grouped objects with z-index
Comment 4 frank_markesteijn 2009-07-05 20:34:48 UTC
Created attachment 63383 [details]
inserted z-index.odt
Comment 5 michael.ruess 2009-07-06 11:15:18 UTC
MRU->OD: create a new document and via Insert.File inset the contents of
"original.odt" -> parts of the drawing groups are missing.
Comment 6 frank_markesteijn 2009-07-06 18:27:55 UTC
I made the xml code of original.odt a little bit too pretty, resulting in a
number of blank pages between the drawings, I added two new documents,
original-2.odt and inserted-2.odt without these blank pages.
Comment 7 frank_markesteijn 2009-07-06 18:30:00 UTC
Created attachment 63403 [details]
Replacement for original.odt
Comment 8 frank_markesteijn 2009-07-06 18:30:49 UTC
Created attachment 63404 [details]
Replacement for inserted.odt
Comment 9 Marcus 2017-05-20 11:17:51 UTC
Reset assigne to the default "issues@openoffice.apache.org".