Bug 92722 - Fileopen: RTF Qualifiers on field SEQ not translated.
Summary: Fileopen: RTF Qualifiers on field SEQ not translated.
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.5.2 release
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: interoperability
Keywords: filter:rtf
Depends on:
Blocks: RTF MSO-External-Producers
  Show dependency treegraph
 
Reported: 2015-07-14 07:49 UTC by Richard Wordingham
Modified: 2022-07-09 23:49 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Wordingham 2015-07-14 07:49:01 UTC
The /h and /r0 qualifiers on the Word SEQ field are being ignored.  /h hides the field code result and /r0 resets the sequence to zero.

The RTF content:

{\rtf1\ansi\deflang2057
{\fonttbl{\f0\fswiss Arial}{\f1\fmodern Courier New}}
{\stylesheet
{\s0\f0\qj\fs24\sa120 Normal;}
{\s1\f1\ql\fs18\sa0\lang1024 Fixed;}
{\s5\f0\gj\fi-1077\li1077\b1\keep\keepn\tx1080\fs24\sa120\sb120 Heading 2;}
{\s2\f0\gj\fi-1077\li1077\b1\keep\keepn\tx1080\fs24\sa120\sb120 Heading 3;}
{\s3\f0\gj\fi-1077\li1077\i1\keep\keepn\tx1080\fs24\sa120\sb120 Heading 4;}
{\s4\f1\ql\fs11\sa0\lang1024 Fixed Long;}
{\s6\f0\qj\fs11\sa60 Micro;}
}
\s0\f0\qj\fs24\sa120
{\s5\f0\gj\fi-1077\li1077\b1\keep\keepn\tx1080\fs24\sa120\sb120
{\field{\*\fldinst { SEQ lev1\\c\\* MERGEFORMAT}}{\*\fldrslt {1}}}
.{\field{\*\fldinst { SEQ lev3\\h\\r0\\* MERGEFORMAT}}{\*\fldrslt {}}}
{\field{\*\fldinst { SEQ lev2\\* MERGEFORMAT}}{\*\fldrslt {1}}}
\tab
Module int_set\par}
}

renders as 

0.11	Module int_set

in plain text, not bold text.  (Being plain, not bold, might be a separate bug.)

The second digit should not appear, and if it did, it should be '0'.

The file appears to import correctly into Windows 2007 and 2010, and StarOffice 7.0.  It may also have displayed properly in OpenOffice 3.3 and 3.4, but my notes from 2012 are unclear.

The RTF is generated by my own program, so a small change to the RTF would be an acceptable solution.
Comment 1 Richard Wordingham 2015-07-14 22:37:33 UTC
The version the problem was most recently observed in was the Ubuntu build of Version 4.4.4.3.

This appears not to be solely a bug in the RTF filter.  The apparent translation is of 

{\field{\*\fldinst { SEQ lev3\\h\\r0\\* MERGEFORMAT}}{\*\fldrslt {}}}

to

<text:sequence text:ref-name="reflev30" text:name="lev3" text:formula="ooow:lev3+1" style:num-format="1">1</text:sequence>

The correct translation would be to:

<text:sequence text:ref-name="reflev30" text:name="lev3" text:formula="ooow:0" style:num-format="">1</text:sequence>

Note the empty string as the value of the num-format attribute in accordance with Section 19.500 of the V1.2 ODF specification.  However, if this is entered manually, LibreOffice spontaneously replaces the empty string by "1".  On loading an RTF file, I have also seen the unwanted digit appear after the surrounding text had already been rendered.  Omitting the num-format attribute has the same problem.  It may be that the main bug is that LibreOffice does not support Section 19.500 of the ODF specification.  Note, however, that the formula attribute is not being calculated correctly.

A work around to the ignoring of the SEQ field's /r qualifier is to put the value to be reset to in the fldrslt destination.  This offers a possible work around - make the resetting field codes into tiny white text.
Comment 2 Aron Budea 2016-12-16 23:06:44 UTC
Let's confirm this, based on the different look in Writer and Wordpad.
Not only it displays as mentioned in the description, font is also wrong (and font selector displays 0 instead of Arial).

Tested with LO 5.3beta2 / Windows 7.
Comment 3 QA Administrators 2018-07-19 02:42:28 UTC Comment hidden (obsolete)
Comment 4 QA Administrators 2020-07-19 03:35:21 UTC Comment hidden (obsolete)
Comment 5 Julien Nabet 2022-07-09 11:11:37 UTC
On pc Debian x86-64 with master sources updated today, I see !
1.1 Module int_set
the whole line in bold.
I got the same with Wordpad.

It seems ok to me, could someone give a try with a recent LO version (minimum 7.2.7) ?
Comment 6 Aron Budea 2022-07-09 23:49:16 UTC
Yes, seems fine to me, too in LO 7.5.0.0.alpha0+ (dcdf970684131cd60af3c5b927a1e05ba6c7ba81) / Windows. Let's close as WFM.