Here is the workaround I implemented. I insist on the fact that this is an ugly hack in the absence of a proper reference mechanism. Thanks to all who provided bits of this workaround.
##Picture/icon must be in the margin
This requires a frame so that it can be positioned outside text area. Frame style MarginIcon is created, derived from Graphics so that is anchor mode is To paragraph by default.
Position properties are adjusted to send the frame in the left margin centered vertically against the paragraph.
Size is set for a 1cm square (this is my requirement). Wrap is None with no spacing.
##Picture/icon is a bullet
List style MarginIcon is created where all levels will only differ by the bullet. This allows to manage all pictures/icons with a single style through the use of the Tab
key.
Alignment is left 0cm, indent 0cm, Number followed by Nothing
.
One image/picture is assigned to each level with Number Graphics
, Graphics Select
From file
. In my case, these are .png files.
Due to a bad behaviour of graphics rendering by Writer (already mentioned on this AskLO site: drawings made in Draw are not displayed “as is” by Writer, but there a ~3% size difference; apparently this happens also on .png files), the bullet size needs to be slightly scaled to avoid interpolation resulting in visible distortion. This is fixed by setting Width and Height by trial and error.
##Internal frame content
To display the image/icon inside the frame, a list item paragraph must be entered. A dedicated paragraph style MarginIcon is created. It is derived from Default Paragraph Style so that any modification on other styles has no effect on it. Font size is set to 2pt to make content nearly invisible if any is typed by mistake.
List style MarginIcon is attached to it in Outline & Numbering
tab.
A careful reader will have noticed that all three created user styles have the same name MarginIcon. This is possible because they live in different namespaces: paragraph, frame and list.
##Placing all bits together
-
A frame is created with the cursor in the paragraph to decorate and styled MarginIcon
-
Cursor is put inside the frame and paragraph is styled MarginIcon. Tab
is pressed optionally to select the desired icon.
-
VERY IMPORTANT! Writer does not like empty list items. It may remove the number/bullet because a single bullet in a line does not make sense.
To protect against spurious editing causing the bullet to vanish, Insert
>Formatting Mark
>No-width No Break
is added so that the paragraph is not empty. This character has a zero width; it does not change formatting.
Note this is Unicode nonsense because this WORD JOINER U+2060 is intended to prevent two characters from being separated (no line wrap). Here I use it stand alone.
This tedious set up needs to be done only once. Next time, you just copy and paste the previous frame, eventually changing the list item level to change the bullet.
##Final result
Total file size is reduced, pictures are present only once in the list style definition (I checked on the .fodt).
All margin icons can be changed or tuned simultaneously from the list style.
Everything has been installed in my preferred template because it is too tricky to be repeated reliably by hand