Bug 60064

Summary: [Feature request] define positional origin for tab stops
Product: LibreOffice Reporter: ajlittoz <page74010-sf>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: NEEDINFO --- QA Contact:
Severity: enhancement    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard: odf ooxml
i915 platform: i915 features:
Attachments: Writer sample document with word flushed at right margin when A4 portait

Description ajlittoz 2013-01-30 09:18:10 UTC
The present semantics for tab stops require extensive manual editing when changing the final document size or orientation to keep the layout in sync with the intended design (e.g. switching from DIN to US format or from portrait to landscape).

A simple example in TOC (table of contents)
A TOC entry has 3 components: section number, title and page number. To nicely align these components, a style with 2 tab stops is defined: the first one as, say, 2cm, left align; the second as 17cm (DIN A4 - two 2cm page margins), right align.
Now, document is switched to landscape. The style must be edited to change the second tab stop to 27.7cm. If the document is transmitted to the US, style must again be updated for US stationery.

This trouble could be avoided if tab stops were relative to some user-defined origin position instead of the default left margin (in left-to-right writing systems; transpose for RTL).

This origin should be user-positioned anywhere between the margins of the current paragraph as a percentage: 0% means left margin, 50% center, 100% right margin, etc. By default, tab stops are relative to origin 0% (compatible with the present design).

TOC example solved as:
first tab stop unchanged at 2cm, origin 0%, left
second tab stop at 0cm, origin 100%, right

I do not think values outside 0-100% should be allowed because you cannot rely on proportions between the current paragraph dimensions and the gutter, page, ... However, this does not preclude tab stops from having negative coordinate or big positive values to set text in the left/right margins or gutter.

With such an attribute, whenever an area (page, table, table cell, paragraph, ...) definition change occurs, absolute tab stop coordinate are recomputed and the intended layout is kept without user intervention.

This feature could even be refined to be document-designer-friendly: if the origin position is itself named (i.e. styled like bullet or numbering styles), experimenting with layout can be very easy. Again an example:
Presenting a list of words in tabular form with a leading term at the left and two associated terms to be set symmetrically from some position. This is solved as:
- tab stop at 1cm, 0%, left (or no tab stop)
- tab stop at -1cm, 75%, right
- tab stop at +1cm, 75%, left
If the 75% origin has a name/style, the 75 number can be adjusted in a single place to try for the value giving the best layout instead of adjusting individual tab stops.

Thank for comments
ajlittoz
Comment 1 foss 2013-11-23 18:27:37 UTC
Can you please provide a test document so this can be tested against and subsequently be confirmed.

Setting to NEEDINFO until more detail is provided.

After providing the requested info, please reset this bug to UNCONFIRMED. Thanks :)
Comment 2 ajlittoz 2013-11-24 10:28:09 UTC
Created attachment 89707 [details]
Writer sample document with word flushed at right margin when A4 portait
Comment 3 ajlittoz 2013-11-24 10:31:02 UTC
What kind of test document do you need?

This is an enhancement request for a feature which is not presently offered by Writer.

A sample document could be built like this:

- create a new A4 portrait document
- insert a line containing A (tab) B
- give this line a named style, e.g. "Custom" based on "Default"
- modify tabs in "Custom" style: create one right-aligned tab at right margin

Result:
"A" is flushed at left margin, "B" at right margin.

Save document, re-open it. Format->Page, change to A4 landscape.

Result:
"B" is no longer at right margin and stays 17cm from left margin, as per definition.

My intent was to keep "B" flushed at right margin, but this is not possible in the present implementation since ALL tabs are relative to left margin. This requires to attach a new property to a tab definition (its coordinate origin).
Comment 4 Owen Genat 2014-02-11 22:30:15 UTC
It is worth noting that for this request to be possible it would require amending ODF and, if interoperability with OOXML is to be maintained, conversion of these percentages to the calculated twentieths of a point equivalent. In ODF v1.2 the style:position attribute in relation to the style:tab-stop element (19.508.3) uses the XSL specification definition for Units of Measure:

http://www.w3.org/TR/2001/REC-xsl-20011015/slice5.html#section-N8185-Definitions-of-Units-of-Measure

i.e., centimetre, millimetre, inch, point, pica, pixel, em

I suppose this could always be augmented somehow to allow percentage values, although these may ultimately need to be calculated in the internal measurement of LO (fractions of millimetre?) anyway. An separate percentage value (in additional to the scalar value) may be an option, although this would seem to increase conversion complexity.

In the OOXML spec the w:pos attribute in relation to w:tab element (17.3.1.37) uses Signed Measurement in Twentieths of a Point (17.18.81 ST_SignedTwipsMeasure) appears to be used. Any percentage value would need to be translated to this unit for export.
Comment 5 Owen Genat 2014-07-18 08:48:50 UTC
Due to comment 4, I feel we need an OOXML / ODF expert to assist with this one. Whiteboard keywords "odf" and "ooxml" added. Status set to NEEDINFO.

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.