Macro per la gestione degli stili
This page deals with AncientGreek style management Le macro. To effectively do so, we have to present how LibreOffice / OpenOffice styles work.
Come funzionano gli stili in LibreOffice / OpenOffice ^
A very powerful feature of LibreOffice (and OpenOffice) is using Stili 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 Stili and Formatting pane which can be toggled on and off by pressing F11.
The Stili and Formatting pane on Windows 8.1
Stili 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.

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 Stili e formattazione (or Default Stili e formattazione) is automatically created, inheriting all these properties (2) and this is why the Standard Stili e formattazione has no parent style.
Let's suppose that: Nome del tipo di carattere is Arial, Text justification is Left, Font Stili e formattazione is Normal, and Language is English US. These values are passed to any child style of Standard Stili e formattazione.
Then the user creates a new style called Ancient Greek, based on Standard Stili e formattazione, and changes the Nome del tipo di carattere to Verdana and Language to Ancient Greek (3). Text justification is still Left and Font Stili e formattazione 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:
- Font name: Verdana (inherited from style Ancient Greek).
- Text justification: Left (inherited from Standard Stili e formattazione).
- Font style: Bold (current style setting).
- Language: Ancient Greek (current style setting).
It should be noted that:
- Changing the Text justification of Standard Stili e formattazione will affect all three styles.
- Changing the Text Stili e formattazione of Standard Stili e formattazione will only affect Ancient Greek style.
- Changing the Nome del tipo di carattere of Ancient Greek style will affect Ancient Greek Title style.
- And so on...
Stili nascosti / senza nome
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 Tipo di carattere Stili e formattazione 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 Tipo di carattere Stili e formattazione.
Le macro per la gestione degli stili di paragrafo ^
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 AncientGreekStili and modStiliManagement.
• La macro ManageStili
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 Barra degli strumenti secondaria and Menu.
When executed, the Gestione degli stili di paragrafo dialog appears:
The Gestione degli stili di paragrafo 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:
- The available Stili List
- The Properties Section
- The Stili e formattazione Creation Section
1. La lista degli stili disponibili
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. La sezione delle proprietà
This is the set of style properties that the Gestione degli stili di paragrafo 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:
- Based on
The base style (parent style) for the new/selected style. - Font
The font that will be used for the paragraph style. - Size
The font size that will be used for the paragraph style. Absolute or relative values can be set. - Stili e formattazione
The font style that will be used for the paragraph style. - Allineamento
Text alignment applied to the paragraph style. - 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. - Enable Sillabazione
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 Gestione degli stili di paragrafo dialog. These properties are available through the Modify context menu entry of the Stili and Formatting pane.
3. La sezione per la creazione degli stili
When the Create Stili e formattazione label is checked, then the dialog enters the Stili e formattazione 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 Stili 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.
Altre opzioni
- Keep the Dialog Open
When checked, the Dialog will be kept open after applying the changes, making it easier to work on styles.
Impostare la dimensione del carattere in LibreOffice / OpenOffice ^
Setting font size can be done in three ways:
- Absolute value
For example: 12pt. - 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) - 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]%
Rappresentazione della dimensione del carattere nella finestra di dialogo
The Gestione degli stili di paragrafo dialog represents the font size value using the following widgets:
- The
button
- The numeric value field
- The
button
When the font size values is:
- Absolute value
Bothand
are unchecked. The numeric value field holds the font size value in points.
- Relative value
is checked and
is unchecked. The numeric value field holds the font size increment or decrement in points.
- Relative percentage value
is unchecked and
is checked. The numeric value field holds the font size value percentage of the parent style font size setting.
Impostare la dimensione del carattere nella finestra di dialogo
When the Size label is checked, the user can set the font size by checking or unchecking and
and adjust the numeric value field as desired.
Impostare la dimensione del carattere per più stili
When the Create Stili e formattazione label is not checked and more than one style is selected in the Stili 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):
- The first selected style font size is set to the Size setting
- 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