Bug Hunting Session
Bug 101773 - link frame style to paragraph style so applying paragraph style also applies frame style to current (or selected) paragraph
Summary: link frame style to paragraph style so applying paragraph style also applies ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
Hardware: All All
: medium enhancement
Assignee: Not Assigned
Depends on:
Blocks: 48457 Writer-Styles-Paragraph Writer-Styles-Frame
  Show dependency treegraph
Reported: 2016-08-29 12:55 UTC by Zenaan Harkness
Modified: 2018-07-26 13:34 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Zenaan Harkness 2016-08-29 12:55:17 UTC
In WordXP (and presumably newer) one can create a paragraph style, and one of the styles tabs is "Frame" (edit style, choose:
 Format -> Frame...

Note is WordXP, there is also a "Remove Frame" button.

So, a para style should have "Add frame" and "Remove frame" buttons/ ability/ UI.

Then, when cursor is in an existing paragraph, and I double click the paragraph style that has an attached frame style, that para style is applied to the text, and the frame style is also applied to the content of that paragraph - i.e., the text of that paragraph is now inside the corresponding frame.

Then afterwards, if my cursor is in the framed paragraph, and I double click a different para style with no frame attached, that paragraph goes back to a "normal" non-framed paragraph!

Again, this is how WordXP works. This functionality was expressly added to MSWord, by Microsoft, at the request of Legal firms (MS wanted to make their software effective enough to replace the entrenched WordPerfect, and this was a specific enhancement requested).

This feature makes editing of legal documents, which make extensive use of marginalia, much easier.

See the attachments to bug #101753 for example files which demonstrate marginalia in a legal document context.

See also bug #62071, and especially bug #101765, which both relate quite closely to this bug.

Finally, there is a fundamental UX issue that arises - connecting styles, e.g. para style with character style. Similarly when a table is constituted a para, or a list, and someone assumes that will be treated as a para and allowed to be "double clicked" by a para style into an attached frame (as above). Similarly list styles and character styles - each element of the list where styling is applicable, should just be a link to a character style.

This is subroutineing, or the DRY or Don't Repeat Yourself principle.

Because of my volunteer work, this bug is considered by its author as priority "high", but he awaits the wisdom of a more experienced bug curator :)
Comment 1 Heiko Tietze 2016-08-29 19:38:49 UTC
Sorry, I cannot follow you. WordXP means Microsoft Word for Windows XP? LibreOffice has a lot of style features. Where do you think is room to improve your workflow?
Comment 2 Zenaan Harkness 2016-08-30 00:07:01 UTC
Yes, I mean "Microsoft Office XP" - which is also called version 10.0, and occasionally called "2002" since that is the year it was introduced. See:

My workflow:
I am editing a >1000 page book for a human rights association in Australia, and it requires many styles.

Since it is a law related book, every paragraph has a marginalia "paragraph number". Please refer bug #101753 for a very small two page example of legal marginalia paragraph numbering.

Inserting these is very easy in Microsoft Word, and currently quite awkward in LO:

- In MS Word, I define a paragraph style to which I am able to attach a frame style, which correctly places the marginalia "legal paragraph number" (which is for the subsequent paragraph)
- then to insert a new legal paragraph marginalia number, I go to the beginning of the paragraph that needs this new legal number
- then insert a new paragraph containing this number - this is very easy
- finally, I simply double-click the "legalNumMarginalia" style I created above and voi la! I have an instant legal paragraph number, perfectly placed

In contrast, in LO, when I want to create this new legal paragraph marginalia number, I have to do the following:
- create a paragraph style for the formatting of the legal number
- separately create a correspoding frame style for the placement of the legal number
- go to start of required paragraph
[- do not insert a new paragraph]
- instead insert a new frame
- now enter the required legal number into the frame
- double click the required paragraph style for formatting of the legal number in the new frame
- next carefully click the edge of the frame so it is selected
- finally double-click the required frame style to apply the needed frame properties

This is the quickest sequence I have been able to determine so far in LO. I really wish there were an easier way to do this.

Sometimes, in some legal documents, I can and do use numbered lists in LO, but sometimes I have to do things the manual way and in LO this is very time consuming and not enjoyable.
Comment 3 Heiko Tietze 2016-10-12 13:41:51 UTC
So lets discuss improvements to this workflow.
Comment 4 Cor Nouws 2017-08-18 06:19:48 UTC
Hi Zenaan,
What type of frame is it? Floating? Size? ..
Thanks - Cor
Comment 5 Regina Henschel 2018-07-25 14:58:01 UTC
"Styles" are stored in a <style:style> element in ODF. Such style belongs to a "family". In this context the families "graphic"  and "paragraph" and "text" are relevant. A <style:style> of family "paragraph" can have "paragraph-properties" and "text-properties" but no "graphic-properties". But a style of family "graphic" can have not only "graphic-properties" but it can have "paragraph-properties" and "text-properties" too.

A <style:style> element has no attribute to link to a style other than its parent in the inheritance chain. The properties are all directly contained in the element. You know this from paragraph styles. They have a tab "Font" where you can set text properties, but you cannot link to a character style.

So what would be possible is, to extend the frame style with tabs for paragraph and text properties, which were used as default, if a property is not set in the actual paragraph of the inserted frame.


A frame has a structure
Currently the paragraph style for the <text:p> element is "Frame Contents" as default. We can make it user defined, but it can only be stored in user settings, not in the file.


The workflow contains the steps "convert an existing text into a frame" and the other way round "convert a frame into an ordinary text". That is independent of styles and has no effects on file format. Such enhancement of the UI would be possible.


@Zenaan: For your use case and a quick solution, I suggest you write a paragraph and a marginalia frame with all the needed style settings and then generate an AutoText from it. For the AutoText you need to select till the start of the paragraph, which is after the paragraph, to which the frame is anchored.
Comment 6 Regina Henschel 2018-07-25 20:59:50 UTC
I have to correct me. There is an attribute draw:text-style-name, which refers a paragraph-style. It can be used as attribute in a <draw:frame> element and in most other graphic objects. But LibreOffice has not implemented the use of this attribute with common styles (=styles in UI). It uses it only for automatic style (=hard formatting in UI) of graphic objects.

So it would be possible to include a reference to a paragraph style into a frame style from point of file format.
Comment 7 Regina Henschel 2018-07-25 21:20:17 UTC
(In reply to Regina Henschel from comment #6)
> So it would be possible to include a reference to a paragraph style into a
> frame style from point of file format.

not "into a frame style" but "into a frame object". So linking paragraph style to frame style or the other way round is not possible on _style_ level.
Comment 8 Heiko Tietze 2018-07-26 10:20:50 UTC
(In reply to Regina Henschel from comment #6)
> But LibreOffice has not implemented the use of this attribute...

Do you recommend to do that? It sounds to me like over-engineering with disadvantage to the UX because of the complicated workflow. In comment 5 you give an alternative suggestion how to deal with the problem...
Comment 9 Regina Henschel 2018-07-26 12:11:55 UTC
I have only tried to analyze effected areas. Besides the tip to use an AutoText, I have no strong opinion in what direction to go. The current handling of frames in Writer is very problematic from file format point of view (*), so a total new design would likely be necessary.
(*) LibreOffice makes for Writer a distinction, whether a <draw:frame> element is to be handled as Writer-frame or as graphic text box object, dependent on the existence of a parent style attribute. Such distinction does not exist in file format.
Comment 10 Heiko Tietze 2018-07-26 13:34:35 UTC
So lets first get input from the development.