Style Management Macros

This page deals with AncientGreek style management Macros. To effectively do so, we have to present how LibreOffice / OpenOffice styles work.

How LibreOffice / OpenOffice styles work ^

A very powerful feature of LibreOffice (and OpenOffice) is using Styles to apply formatting.

A style is a set of properties that can be applied to an object (objects are: characters, paragraphs, pages, text boxes and lists), referred by a name (style name).

LibreOffice / OpenOffice styles can be managed using the Styles and Formatting pane which can be toggled on and off by pressing F11.

styles-and-formatting.jpg
The Styles and Formatting pane on Windows 8.1

Styles have a hierarchy, so each style has a parent style and may have child styles. This way a style inherits its parent's properties and sets its own properties, passing them to its children. Let's see how that works with paragraph styles.

styles.png

When a new text document is created, all styles get their default property values either from LibreOffice / OpenOffice defaults, or the Template Document used to create the document (1). Then the Standard Style (or Default Style) is automatically created, inheriting all these properties (2) and this is why the Standard Style has no parent style.

Let's suppose that: Font Name is Arial, Text justification is Left, Font Style is Normal, and Language is English US. These values are passed to any child style of Standard Style.

Then the user creates a new style called Ancient Greek, based on Standard Style, and changes the Font Name to Verdana and Language to Ancient Greek (3). Text justification is still Left and Font Style is still Normal, since they have been inherited by the parent style.

Then a new style is created, called Ancient Greek Title, based on Ancient Greek, and font style is set to Bold (4).

This new style has:

  1. Font name: Verdana (inherited from style Ancient Greek).
  2. Text justification: Left (inherited from Standard Style).
  3. Font style: Bold (current style setting).
  4. Language: Ancient Greek (current style setting).

It should be noted that:

  1. Changing the Text justification of Standard Style will affect all three styles.
  2. Changing the Text Style of Standard Style will only affect Ancient Greek style.
  3. Changing the Font Name of Ancient Greek style will affect Ancient Greek Title style.
  4. And so on...

Hidden / unnamed styles

Using the Ancient Greek style created above, it's possible to insert and edit ancient greek text. The text style will be Normal (no Bold, no Italics). In case the user wants to give emphasis to a word (for example a name), he would just select the word and press the Bold or Italics button on the toolbar.

How does this work given the whole concept of styles?

LibreOffice / OpenOffice actually creates a new style and applies it to the selected word. This style (a character style) is hidden, it has no name, is linked to the current paragraph and cannot be reused anywhere in the document.

This type of style has the advantage that is easily applied, but makes it difficult to keep a consistent formatting of the document. For example, if the user decides later on that he wants to have words emphasized by underlining them instead of having them in bold or italics, he would have to find all the words the hidden styles have been applied to, and change them one at a time.

The alternative would be to create a new Character Style beforehand, set its properties and apply it at will. Then changing the formatting of all these words would be as easy as changing the properties of the applied Character Style.

Paragraph Styles Management macros ^

AncientGreek provides style management macros (as of 1.3-beta5), in order to make it easier to edit text. These macros are grouped together in module AncientGreekStyles and modStylesManagement.

• ManageStyles Macro

This macro (actually a dialog) will create and edit paragraph styles and optionally apply them either to the current paragraph or to a newly created one.

This macro can be executed either through the AncientGreek dialog, or the AncientGreek Secondary Toolbar and Menu.

When executed, the Styles Management dialog appears:

macro-create-style.jpg
The Styles Management dialog on Windows 8.1

The dialog is modeless (the user can still work on the document while the dialog is visible).

The dialog can be divided in three parts:

  1. The available Styles List
  2. The Properties Section
  3. The Style Creation Section

1. The available Styles List

This list contains by default the styles that are in use by the document. In order to see all the styles that are available to the document, the option Show All can be checked.

When the dialog is opened for the first time the current paragraph style is selected and its properties are loaded in the Properties Section (more on this later), so that style editing is made easier.

The list is a multiple selection list (click to select the first item and Ctrl-Click to select consecutive items). This way editing multiple styles is possible. It should be noted that the Properties Section will reflect the first selected item (more on this later).

2. The Properties Section

This is the set of style properties that the Styles Management dialog can change.

Each property can be checked or unchecked.

• When a property name is checked, its value can be set as desired. A checked property will be set when the OK button is clicked; its value will replace the value inherited by the selected or base style.

The value of the property will be "locked", in the sense that when a different style is selected, it will retain its current value (will not reflect the value read from the style settings).

• When a property name is unchecked, its value can no longer be set; it gets its value from the selected or base style and will not be affected when the OK button is clicked.

Available properties:

  1. Based on
    The base style (parent style) for the new/selected style.
  2. Font
    The font that will be used for the paragraph style.
  3. Size
    The font size that will be used for the paragraph style. Absolute or relative values can be set.
  4. Style
    The font style that will be used for the paragraph style.
  5. Justification
    Text alignment applied to the paragraph style.
  6. Set Language to 'Ancient, Greek'
    When checked, the paragraph style language will be set to 'Ancient, Greek'. When unchecked, the language setting will not be affected. Checked by default.
  7. Enable Hyphenation
    When checked, it enables hyphenation for the paragraph style. When unchecked, the hyphenation setting will not be affected. Checked by default.

Paragraph styles have a lot more properties than the ones handled by the Styles Management dialog. These properties are available through the Modify context menu entry of the Styles and Formatting pane.

3. The Style Creation Section

When the Create Style label is checked, then the dialog enters the Style Creation Mode. The new style name can be typed in the text field, and if this style does not already exist, the new style can be created based on the properties checked. In this mode the Styles List functions only as a provider for the starting values for the Properties Section.

If the New paragraph is checked, a new empty paragraph will be inserted after the current paragraph. Its style will be the newly created style. When unchecked, the newly created style will be applied on the current paragraph.

Other Options

  1. Keep the Dialog Open
    When checked, the Dialog will be kept open after applying the changes, making it easier to work on styles.

Setting font size in LibreOffice / OpenOffice ^

Setting font size can be done in three ways:

  1. Absolute value
    For example: 12pt.
  2. Relative value
    For example: +2pt or -4pt
    The font size value is a positive or negative value of points. This value is added (or subtracted) to the value of the font size of the parent style (base style).
    The format of the value is:
    +/-[number]pt (pt may be localized)
  3. Relative percentage value
    For example: 100% or 85%
    The font size value is a percentage of the font size of the parent style (base style). A value over 100 increases the font size, a value below 100 decreases it.
    The format of the value is:
    [number]%

Font size representation on the dialog

The Styles Management dialog represents the font size value using the following widgets:

  1. The plus-minus-icon.png button
  2. The numeric value field
  3. The percent-icon.png button

When the font size values is:

  1. Absolute value
    Both plus-minus-icon.png and percent-icon.png are unchecked. The numeric value field holds the font size value in points.
  2. Relative value
    plus-minus-icon.png is checked and percent-icon.png is unchecked. The numeric value field holds the font size increment or decrement in points.
  3. Relative percentage value
    plus-minus-icon.png is unchecked and percent-icon.png is checked. The numeric value field holds the font size value percentage of the parent style font size setting.

Setting font size on the dialog

When the Size label is checked, the user can set the font size by checking or unchecking plus-minus-icon.png and percent-icon.png and adjust the numeric value field as desired.

Setting font size on multiple styles

When the Create Style label is not checked and more than one style is selected in the Styles List and the Size label is checked, the Modify by label is enabled, making it possible to adjust the size of all selected styles proportionally.

Checking the Modify by label, the numeric field next to it gets enabled, and depending on the size of the first selected style (possibly adjusted by the user):

  1. The first selected style font size is set to the Size setting
  2. All consecutive selected styles font size will be adjusted by adding the Modify by value to the Size value, expressed either in points or percentage
×

Info

If a table is truncated, then you can see all its content by scrolling it to the right and back.