Bug 84714 - ODF filter: <table:table> inside <draw:custom-shape> is not valid
Summary: ODF filter: <table:table> inside <draw:custom-shape> is not valid
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version: 4.4.0.0.alpha0+ Master
Hardware: Other All
: medium enhancement
Assignee: Miklos Vajna
QA Contact:
URL:
Whiteboard: target:4.5.0 target:4.4.1
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-06 12:55 UTC by Regina Henschel
Modified: 2015-01-19 22:51 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
<table:table> in <draw:frame>, valid but not supported. (9.65 KB, text/plain)
2014-10-06 12:55 UTC, Regina Henschel
Details

Description Regina Henschel 2014-10-06 12:55:48 UTC
Created attachment 107420 [details]
<table:table> in <draw:frame>, valid but not supported.

ODF1.2 allows a <table:table> element as direct child of a <draw:frame> element.
See http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html
Section 9.1.2 <table:table> and 10.4.2<draw:frame>

Currently LibreOffice writes <table:table> as child of <draw:text-box> or as sibling of <text:p>.

This leads to problems, when using a table in a shape with added textbox. Currently the <table:table> element is written as child of <draw:custom-shape>. But that is invalid. <table:table> can not be a child of <draw:custom-shape>.
http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#element-draw_custom-shape.

But a <text:p> element is allowed as child of <draw:custom-shape> and of other shapes as well. See the list of valid parents of <text:p> in 
http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#element-text_p

And on the other hand the <text:p> element can have a <draw:frame> child.

So a valid storage of a table in a textbox added to a shape would be:
<draw:custom-shape>
...
   <text:p>
       <draw:frame>
          <table:table>
               ...
          </table:table>
       </draw:frame>
   </text:p>
...
</draw:custom-shape>

That would be the same way, currently <draw:object> elements (for Math-OLE) and <draw:image> elements are used in this textbox in a shape.

Unfortunately, LibreOffice does not accept <table:table> as direct child of <draw:frame> and drops it when it reads such a file. Try attached document. Calligra Words and Softmaker Textmaker can at least read files with <table:table> as child of <draw:frame>.
Comment 1 Miklos Vajna 2014-10-06 14:21:01 UTC
Isn't it possible that ODF doesn't allow <table:table> inside <draw:custom-shape> because ODF is based on OOoXML, and in OOo's codebase, the contents of draw:custom-shape had to be always rendered by editeng, which is not capable of doing that?

If so, I think it would be better to file a proposal at OASIS to allow table:table inside draw:custom-shape.

I agree that in the meantime, we should not write table:table as a child of draw:custom-shape, e.g. we could write loext:table instead, till the proposal is accepted. How does that sound?

Adding fake paragraphs and frames to ODF, which is our #1 format sounds like a bad idea to me.
Comment 2 Regina Henschel 2014-10-06 16:38:20 UTC
This request goes beyond the example to use it for the textbox in shapes.

Here another use case: There exists already the structure
<draw:frame><table:table>...</table:table></draw:fame>
in a Draw document, when you insert a table in a Draw document. If you currently copy such table and paste it into a Writer document, you can get the table as image or as OLE but not in "Drawing format", because Writer does not support this structure.
Comment 3 Regina Henschel 2014-10-12 19:18:17 UTC
(In reply to Miklos Vajna from comment #1)
> I agree that in the meantime, we should not write table:table as a child of
> draw:custom-shape, e.g. we could write loext:table instead, till the
> proposal is accepted. How does that sound?

I have ask in AOO-dev. There is no strong preference for one solution. Armins answer from a development point of view might be interesting for you. http://markmail.org/message/dimqg5pktyngizjg
Comment 4 Commit Notification 2014-12-27 11:14:57 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=62391c28fae5099dd1f67c322867933fcb05bc9f

fdo#84714 ODT import: read <loext:table> inside <draw:custom-shape>

It will be available in 4.5.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2014-12-27 11:15:01 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e4de5b40eb7220da2d337eb98d7905a98dc12c72

fdo#84714 ODT export: write <loext:table> inside <draw:custom-shape>

It will be available in 4.5.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 6 Commit Notification 2015-01-19 22:28:30 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-4-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=a4f907edbc1f6ce375bbf71c44733bb85f67a74f&h=libreoffice-4-4

fdo#84714 ODT import: read <loext:table> inside <draw:custom-shape>

It will be available in 4.4.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 7 Commit Notification 2015-01-19 22:28:33 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-4-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e15e4d3888c1ebd229acd8e676d28115edf622e3&h=libreoffice-4-4

fdo#84714 ODT export: write <loext:table> inside <draw:custom-shape>

It will be available in 4.4.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2015-01-19 22:51:53 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-4-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=0657176b3e42886c4ae14f9991c52b4d61bbe116&h=libreoffice-4-4

fdo#84714 SwTextBoxHelper::findTextBoxes: optimize unnecessary O(n^2)

It will be available in 4.4.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.