Bug 66575

Summary: Incorrect removal of last line in SmXMLExport::ExportTable
Product: LibreOffice Reporter: Frédéric Wang <fred.wang>
Component: Formula EditorAssignee: Frédéric Wang <fred.wang>
Status: RESOLVED FIXED    
Severity: normal CC: caolan.mcnamara
Priority: medium    
Version: 4.2.0.0.alpha0+ Master   
Hardware: All   
OS: All   
Whiteboard: target:4.2.0
Crash report or crash signature: Regression By:
Attachments: patch

Description Frédéric Wang 2013-07-04 07:54:02 UTC
SmXMLExport::ExportTable contains some code to remove the last line:

    //If the list ends in newline then the last entry has
    //no subnodes, the newline is superfulous so we just drop
    //the last node, inclusion would create a bad MathML
    //table
    if (nSize >= 1 && pNode->GetSubNode(nSize-1)->GetNumSubNodes() == 0)
        --nSize;

This seems to be to avoid adding a row when doing e.g

"a newline
 b newline"

but that does not seem to work in 4.0 and master... Worse, it breaks things like

"binom a b"

In 4.0, you can do "binom {a} {b}" to avoid that, but after bug 66081 the two markup are equivalent.

Similarly, MathML export of

"stack{x ## y}"

is now broken in master (before bug 66081, the { } added to each cell was hiding that bug).
Comment 1 Frédéric Wang 2013-07-04 09:07:15 UTC
I've submitted a patch for review:

https://gerrit.libreoffice.org/#/c/4712/

> This seems to be to avoid adding a row when doing e.g
> 
> "a newline
>  b newline"
> 
> but that does not seem to work

It turned out that a dummy row was added for the sake of the visual editor and so this empty row was exported in the MathML output. The patch should fix that and avoids removing the line with binom/stack.

Tetscase for the visual editor (enable the "experimental features"): when doing

a newline
b newline

you should be able to move the cursor to a third line.
Comment 2 Frédéric Wang 2013-07-04 09:42:48 UTC
(In reply to comment #1)
> I've submitted a patch for review:
> 
> https://gerrit.libreoffice.org/#/c/4712/

The patch seems to break other things with single line formulas... please do not approve.

(I don't know how to comment or edit something on gerrit)
Comment 3 Commit Notification 2013-07-04 15:10:51 UTC
Frederic Wang committed a patch related to this issue.
It has been pushed to "master":

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

 fdo#66575 - MathML export: fix errors with newline, binom and stack.



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 4 Frédéric Wang 2013-07-04 15:18:41 UTC
Created attachment 82031 [details]
patch

Correct version that should have been pushed (sorry!)
Comment 5 Commit Notification 2013-07-04 19:33:42 UTC
Frederic Wang committed a patch related to this issue.
It has been pushed to "master":

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

fdo#66575 - MathML export: fix errors with newline, binom and stack.



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.