Number layout

From Apache OpenOffice Wiki
Jump to: navigation, search

Writer Icon.png

Writer Project

Please view the guidelines
before contributing.

Popular Subcategories:

Internal Documentation:

API Documentation:

Ongoing Efforts:

Sw.OpenOffice.org

Number Layout capabilities in OD

The layout of numbered paragraphs in ODT is controlled by

a)Paragraphs properties, like indent, etc; and

b)Numbering position and spacing properties: indent (text:space-before), spacing to text (text:min-label-distance), minimum space numbering <-> text(text:min-label-distance) and numbering alignment (fo:text-align).

Properties of category (a) and (b) are “additive”, e.g. the real paragraph indent is calculated by the paragraph indent property and the number indent property and the minimum space numbering <-> text property. The following figure shows, how the layout of a numbered paragraph is influenced by the different parameters. The parameters shown are those defined in the ODT file format:

ODNumLayoutExample.jpg

The spacing l* is calculated by

l*:=max{text:min-label-width, text:min-label-distance+label-width}

The position of the label within the l* space is controlled by the fo:text-align parameter.

Number layout capabilities in WW

In WW the layout of numbered paragraphs is controlled by the paragraph's properties and mainly by the “level follow char”, which is either a tab; a space or nothing. Usually the “level follow char” is a “tab” and the space between the number's label and the paragraph text is given by the defined tab positions:

WWNumLayoutExample.jpg

The justification of the label is set with respect to the paragraph left indent (w:first-line+w:left). Although being “faked” by the GUI no “own” number spacing and position properties exist in Microsoft Word.

The number layout capabilities of WW and the number layout capabilities of ODT do not match. For illustration consider e.g. the following document (which happens to occur in real word). The following screen shot shows a numbered paragraph in Microsoft Word:

NumParSample1Example.jpg

The above paragraph is numbered, the follow char is a tab and the paragraph defines two tab positions. When the number in the above example grows, automatically the next tab position will be chosen:

NumParSample2Example.jpg

This e.g. can not be modelled using the ODT number layout capabilities without knowing the actual labels length at import time.


OD Enhancement

We suggest the introduction of a special min-label-width-suffix flag in the number layout properties. It is used to model WW's “follow char” and the difference between label alignments.

The semantic of the min-label-width-suffix flag is as follows: When min-label-width-suffix is set to “tab”, then l* is set to the next tab position following the label and the label is aligned at the first indent. When min-label-width-suffix is “space” or “nothing” then l* is set in the appropriate way and also the label is aligned with respect to the first indent.

The text:min-tabel-distance, text:space-before and text:min-tabel-width parameters are ignored in case of min-label-width-suffix is set. However they should be set for backward compatibility reasons.

In the ODT file format the min-label-width-suffix property is defined by enhancing the style-list-level-properties-attlist definition in the following way:

<define name="style-list-level-properties-attlist" combine="interleave">
 <optional>
  <attribute name="text:min-label-width-suffix">
   <choice>
    <value>tab</value>
    <value>space</value>
    <value>nothing</value>
   </choice>
  </attribute>
 </optional>
</define>

Change in number alignment

Consider for example the following numbered paragraph created in WW:

NumAlignmentExample.jpg

The red line illustrates the line with respect to which the label is aligned. The number alignment in the above sample is set to “centered”.

So --- when the text:min-label-width-suffix is set the text:fo-align property is interpretet differently.

  • left: Layout the label text as if the "red line" in the above picture is a "left tab";
  • centered: Layout the label text as if the "red line" in the above picture is a "centered tab";
  • right: Layout the label text as if the"red line" in the above picture is a "right tab".

Change in OOo GUI

Bulletsandnumbering position.jpg


list formating properties

To be able to store the tab positions, indents etc we propose to modify the OD spec as follows:

<define name="text-list-style-content" combine="choice">
 <element name="text:list-level-style-number">
  <ref name="text-list-level-style-attr"/>
  <ref name="text-list-level-style-number-attr"/>
  <optional>
   <ref name="style-list-level-properties"/>
  </optional>
  <optional>
   <ref name="style-text-properties"/>
  </optional>
  <!-- change start -->
  <optional>
   <ref name="style-paragraph-properties"/> <!-- stores list tabs, indents, etc -->
  </optional>
  <!-- change end -->
 </element>
</define>
<define name="text-list-style-content" combine="choice">
 <element name="text:list-level-style-bullet">
  <ref name="text-list-level-style-attr"/>
  <ref name="text-list-level-style-bullet-attr"/>
  <optional>
   <ref name="style-list-level-properties"/>
  </optional>
  <optional>
   <ref name="style-text-properties"/>
  </optional>
  <!-- change start -->
  <optional>
   <ref name="style-paragraph-properties"/> <!-- stores list tabs, indents, etc -->
  </optional>
  <!-- change end -->
 </element>
</define>

Additional we need to introduce a text:paragraph-style-name attribute to store a paragraph style:

<define name="text-list-level-style-number-attr" combine="interleave">
  <optional>
    <attribute name="text:paragraph-style-name">
      <ref name="styleNameRef"/>
    </attribute>
  </optional>
</define>

The paragraph attribute will be applied to the paragraph after the paragraphs attributes have been applied.

list tabs

WW has a tabulator type called "list" which -- no surprise -- is often used by lists.

It is yet not clear whether we need such a special "list tab", since it seems that it is a normal "left tab".

Personal tools