Bug 138628 - ClearDirectFormatting does not remove page break
Summary: ClearDirectFormatting does not remove page break
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Clear-Formatting
  Show dependency treegraph
 
Reported: 2020-12-02 20:38 UTC by TorrAB
Modified: 2023-05-31 06:42 UTC (History)
11 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description TorrAB 2020-12-02 20:38:03 UTC
Description:
By default, style TextBody includes no page break. Put one in (Format>parag>TextFlow>Breaks, Insert). Then, hit ^m (ClearDirectFormatting); page break stays. Why?


Steps to Reproduce:
1.In a parag TextBody, insert a page break
2.hit ^m (ClearDirectFormatting)
3.

Actual Results:
page break stays

Expected Results:
page break should go since it does not belong to the style.


Reproducible: Always


User Profile Reset: No



Additional Info:
none
Comment 1 Heiko Tietze 2020-12-03 10:47:00 UTC
Clear _direct_ formatting does nothing but to remove formats like font weight, size, and color. It's a bit unclear what you mean with "style TextBody includes no page break" but given it's a direct formatting to the paragraph style (context menu > paragraph > paragraph...) this is not direct formatting. There should be a duplicate ticket requesting clear direct formatting to also clear direct paragraph formats but cannot find it, closest are bug 71233 and bug 78371. Mike, any idea?

Why should one add a page break after/before text body?
Comment 2 TorrAB 2020-12-04 02:59:28 UTC
(In reply to Heiko Tietze from comment #1)
> Clear _direct_ formatting does nothing but to remove formats like font
> weight, size, and color. It's a bit unclear what you mean with "style
> TextBody includes no page break"

**	In the styles list, right-click TextBody, choose Modify>TextFlow, Breaks: Insert is NOT checked —at least, after a fresh installation of LO.
	Try the converse with style Heading1: Check TextFlow, Breaks: Insert PageBreak; apply ^1 to any text, make it a Heading1: new page; format it, uncheck Breaks: PageBreak disappears; ^m restores the PageBreak.

> Why should one add a page break after/before text body?
**before. Because the text contains a frame which does not fit in the current page, and LO has trouble displaying it. The page break moves text and frame to a new page.
Comment 3 Mike Kaganski 2020-12-04 06:38:36 UTC
This obviously *is* direct formatting, and I bet there was some explicit processing for page breaks not removed when clearing the direct formatting from paragraphs. Of course we need to look into the code to be absolutely sure, but it's my gut feeling, that this is a "feature" targeted on inexperienced users coming from MS Office, and who are not used to the idea that page break is a property of paragraphs.

Personally I would thing that a configuration would be useful for this, to allow more complete clearing of direct formatting.
Comment 4 Heiko Tietze 2020-12-07 11:45:16 UTC
(In reply to Mike Kaganski from comment #3)
> Personally I would thing that a configuration would be useful for this, to
> allow more complete clearing of direct formatting.

Something like Paste vs. Paste Special?

Clear DF v
-
Clear Character Format
Clear All Formatting
Special Clear...

And special clear allows to 

[ ] All Character Formats
[ ] Font
[ ] Font effects
[ ] Position
[ ] Highlighting

[ ] All Paragraph Formats
[ ] Alignment
[ ] Indents and Spacing
[ ] Text flow
[ ] Background

(using the property dialogs as basis; "All" disabled the other options)
Comment 5 Mike Kaganski 2020-12-07 12:00:07 UTC
(In reply to Heiko Tietze from comment #4)

Well, I don't think we need that complexity. Just some Options section with checkboxes, that controls what Clear DF does for this user. I don't think we need levels of the feature available at any given moment. If a user is not OK with the "helpful" precaution that we have for inexperienced users, there would be no problem for this user to have manual page breaks always cleared at every Clear DF invocation IMO.
Comment 6 Mike Kaganski 2020-12-07 12:02:18 UTC
(In reply to Mike Kaganski from comment #5)
> (In reply to Heiko Tietze from comment #4)

And also we should not add things here, like allowing to not clear something that is cleared now by that function. Only provide checkbox(es) for thing(s) that are *currently* excluded from the function.
Comment 7 S.Zosgornik 2020-12-07 23:45:57 UTC
(In reply to Heiko Tietze from comment #1)
> Clear _direct_ formatting does nothing but to remove formats like font
> weight, size, and color.

No, clear direct formatting not only remove character formatting but also paragraph formatting like text alignment
 
> Why should one add a page break after/before text body?

Because it's a good feature to have to separate long and outstanding paragraphs that spans almost over the entire page

(In reply to Mike Kaganski from comment #3)
>This obviously *is* direct formatting, and I bet there was some explicit processing >for page breaks not removed when clearing the direct formatting from >paragraphs. Of course we need to look into the code to be absolutely sure, but it's >my gut feeling, that this is a "feature" targeted on inexperienced users coming >from MS Office, and who are not used to the idea that page break is a property of >paragraphs.

That is more than just non-sense! LibreOffice is a stand alone office suite with it's own features, behaviour and even remarkable visual efforts of branding! And the users have to bare with this!
No user would be helped by keeping a page-brake that is applied to a paragraph when he clears all formatting for this paragraph as no user is been helped when he wants to remove a page-break while he doesn't understand that it is a paragraph formatting. Learning the application is the key!

(In reply to Heiko Tietze from comment #4)
>Something like Paste vs. Paste Special?

>[ ] All Character Formats
>[ ] Font
>[ ] Font effects
>[ ] Position
>[ ] Highlighting

This is even more non-sense! First the OpenDocument Format allows advanced formatting, than LibreOffice makes exceptions for users of other applications, than we scatter the UI and force the users to mark 10 checkboxes for using a function that is mean to be basic? CLEAR ALL FORMATTING should clear ALL formatting, simple as this!

(In reply to TorrAB from comment #0)
>Expected Results:
>page break should go since it does not belong to the style.

I agree with the opener, page-break applied to paragraphs should be removed by clearing the direct formatting
Comment 8 Mike Kaganski 2020-12-08 06:53:23 UTC
(In reply to Sascha Z from comment #7)
> (In reply to Mike Kaganski from comment #3)
> That is more than just non-sense! LibreOffice is a stand alone office suite ...

There is no "non-sense" when you talk about user experience. You may think that something is (il)logical from some perspective, but please try to accept that there is more than one possible point of view, and there is more than one group of users of LibreOffice in the world.

While I would *personally* like to have "Clear DF" to remove every bit of DF from selection, I know and accept that there are *sufficiently many* users who *want* something that I dislike, and that demand *often* warrants the presence of those things in the programs. E.g., I believe myself rather advanced user, and as such, I *possibly* could advocate changing LO to *remove* DF as a concept from LO (based on "I can live without it; it makes LO inconsistent, and its documents hard to maintain when exchanging with users who use DF, etc., etc..."). But instead I am blocking any attempt to make basic users' LO experience worse (which is suggested now and then by those ex-basic users, e.g. who believe that they know how to fuse DF and style together), because basic users are not second-class users.

Similarly, users who migrate to LO are not second-class users. And until their expectations are not impossible in LibreOffice's paradigm, their wishes are just as important as anyone else's.

It's just a matter of an option to be "strict". It would not hurt anyone.
Comment 9 Mike Kaganski 2020-12-08 09:20:54 UTC
Core pointers:

The entry points for "Clear DF" for Writer are:

SwAnnotationShell::Exec in sw/source/uibase/shells/annotsh.cxx
SwDrawTextShell::ExecDraw in sw/source/uibase/shells/drwtxtsh.cxx
SwTextShell::Execute in sw/source/uibase/shells/textsh1.cxx
(look for FN_FORMAT_RESET in all three)
The last one is relevant for text.

In SwTextShell::Execute, #i78856 and tdf#40496 are handled, excluding language attributes and writing direction.
In SwDoc::ResetAttrs (sw/source/core/doc/docfmt.cxx), which does the actual work, additional things are excluded (e.g., see "not including META here" comment).

Lastly, lcl_RstAttr excludes more, e.g. RES_PAGEDESC and RES_BREAK that define page break and its style, and also numbering rules.

Note that SwDoc::ResetAttrs is used not only in .uno:ResetAttributes, so handle with care.
Comment 10 Octavio Alvarez 2020-12-08 17:47:11 UTC
To add complexity to the matter, the page break formatting attribute can also be set by using Insert > Page Break (Insert menu, not Format menu). Also, they can be removed by either pressing Backspace with the cursor after the page break or Delete with the cursor before the page break. This make page breaks seem like they are inserted objects as opposed to a formatting attribute. Think that formatting attributes like "align left" or "bold" can't typically be erased by pressing Backspace or Delete.

So, internally (content.xml), page breaks are a formatting attribute, but the UI currently offers them under two concepts: as a formatting attribute (Styles, Format > Paragraph...) but also as objects (Insert > Page Break, backspace/delete). Both map to the same thing.

For users that think of them as objects and not as formatting attributes it would be unexpected to have Clear Direct Formatting erase them; much more if they don't use Styles.

This just means that, unfortunately, whatever decision is made will break the expectation of a different set of users.
Comment 11 Heiko Tietze 2020-12-09 08:05:30 UTC
(In reply to Octavio Alvarez from comment #10)
> To add complexity to the matter, the page break formatting attribute can
> also be set by using Insert > Page Break (Insert menu, not Format menu).

Made this mistake myself when asking why setting page break on text body would be required ;-). IMO a very good reason to not include page breaks in Clear DF.
Comment 12 Telesto 2020-12-09 09:05:16 UTC Comment hidden (off-topic)
Comment 13 Mike Kaganski 2020-12-09 09:54:02 UTC Comment hidden (off-topic)
Comment 14 Telesto 2020-12-09 10:31:42 UTC Comment hidden (off-topic)
Comment 15 Mike Kaganski 2020-12-09 10:38:21 UTC Comment hidden (off-topic)
Comment 16 Telesto 2020-12-09 11:06:55 UTC Comment hidden (off-topic)
Comment 17 Mike Kaganski 2020-12-09 11:20:56 UTC Comment hidden (off-topic)
Comment 18 Heiko Tietze 2020-12-09 11:27:11 UTC
(In reply to Mike Kaganski from comment #17)
> A setting allows people to make the job done

Let's come back to the topic. 

This is a solution, another is to have a dedicated UNO command and an entry in the toolbar. Or we just resolve as WF with the argument that most if not all users expect PB to remain when cleaning DF from the document. The topic is on the agenda for the call this evening, input here is welcome.
Comment 19 Mike Kaganski 2020-12-09 11:35:17 UTC
(In reply to Heiko Tietze from comment #18)
> input here is welcome.

I would certainly welcome this *setting*. Especially in the view of coming SI, which would make people see the DF, and then after clearing it, will see the remnants left.

I definitely oppose the idea of more .uno commands, because (1) it is most probably a decision to make once for a user, if they want something cleared or not when using Clear DF; (2) adding such a UI (like Clear only character formatting, clear only paragraph formatting) will inevitably confuse users who do not realize that e.g. paragraph formatting includes character formatting, and so why selecting part of paragraph that was DF-ed to bold, and clearing DF, does not make effect? or changes the whole paragraph? The idea of additional commands is not what is asked here (make the function more self-consistent), it's introducing a new feature with a huge confusion impact in the view of the DF/style relations complexity.
Comment 20 Telesto 2020-12-09 13:49:27 UTC Comment hidden (off-topic)
Comment 21 Eike Rathke 2020-12-09 22:10:26 UTC
Fwiw, I would *never* expect that clearing formatting would remove any page breaks, specifically not if they were created manually. Doing so would be a bug, not a feature.
Comment 22 Mike Kaganski 2020-12-10 07:23:52 UTC Comment hidden (off-topic)
Comment 23 Heiko Tietze 2020-12-10 07:44:37 UTC
We discussed this topic in the design meeting and did not come to a agreement.

Options are:

a) another UNO command that clears also page break (interaction similar to Save/SaveAs)
b) an option that toggles the behavior 
c) always clear the page breaks 
d) reject the enhancement request (btw, MSO behaves similar to LibreOffice)

There seems to be a trend for d).
Comment 24 Mike Kaganski 2020-12-10 07:54:11 UTC
(In reply to Heiko Tietze from comment #23)
> btw, MSO behaves similar to LibreOffice

Note that this is absolutely irrelevant here. It's obvious that current behavior is modelled after the idea in the other tools that don't have the "page break is a property of paragraph" concept; and Word is one of those. The idea of this RFE is to provide a means to (optionally) use the tool *consistently* with *its own* architecture.

FTR, it seems that people overlook comment 9 entirely. And there are many more things in DF that are skipped when clearing DF, both on character and paragraph levels, some of which are listed in the said comment. They include *language*, *direction*, "numbering styles".

I'm OK with closing it WONTFIX ATM; my take is "it will be reopened eventually when it all becomes more prominent in SI in v.7.1".
Comment 25 Mike Kaganski 2020-12-10 07:55:36 UTC
(In reply to Mike Kaganski from comment #24)
> "numbering styles".

Sorry, a thinko. Should had been "numbering rules".
Comment 26 Telesto 2020-12-10 09:03:49 UTC Comment hidden (off-topic)
Comment 27 Octavio Alvarez 2020-12-10 19:36:30 UTC
Interestingly enough, although Clear Direct Formatting does not remove manually inserted page breaks or manually added page breaks as format, it does re-add manually removed page breaks if the paragraph style originally had a page break and then the break was removed from the Format > Paragraph dialog.
Comment 28 Heiko Tietze 2020-12-11 07:29:52 UTC Comment hidden (off-topic)
Comment 29 Telesto 2020-12-20 08:26:57 UTC
Bug 139079 comment 0 (R. Green)
The most natural and fastest way to clear ad hoc formatting from a WRITER file SHOULD be to select ALL and apply "Clear direct formatting". But this cannot be done because the command (inexplicably) deletes page breaks as well.

(Even worse, the deletion of page breaks does not show up until the document is saved and reloaded: see Bug 73483.)

Imagine a book with many chapters, and it has become apparent that there is character formatting applied willy nilly throughout the document. The user wants to remove this leaving only the paragraph and character styles. To avoid losing page breaks, the user has to apply "Clear direct formatting", section by section, skipping the page breaks. A very time-consuming and tedious business.

IMV, the average user is likely to assume (wrongly) that "Clear direct formatting" only applies to text and should leave page breaks alone.

SUGGESTION: "Clear direct formatting" should NOT delete page breaks. Instead there should be another command, "Clear page breaks", to delete the page breaks separately.
Comment 30 Mike Kaganski 2020-12-20 09:56:53 UTC
(In reply to Telesto from comment #29)

Very interesting, and reproducible. Funny. It actually does remove the manual page breaks when saving.

That is definitely a bug: the code does things to *not* clear the breaks, and I assume it still clears *something* unintentionally that relates to the breaks, that prevents the *kept* break from being saved to ODT. Note that it *does* correctly save the "cleared" break to DOCX, so it proves this to be a bug.

So all in all, the "Clear DF breaks saving manual page breaks to ODF" is a separate bug (tdf#73483 correctly mentioned in See Also), and existence of that bug (which clearly shows some people *want* to keep breaks when clearing DF) makes it obvious that "clear manual breaks unconditionally" (c) in comment 23) is not a proper solution.
Comment 31 S.Zosgornik 2020-12-21 09:42:30 UTC
> Bug 139079 comment 0 (R. Green)
> Imagine a book with many chapters, and it has become apparent that there is
> character formatting applied willy nilly throughout the document. The user
> wants to remove this leaving only the paragraph and character styles.

If the user only wants to keep paragraph and character styles than deleting all unsigned page brakes is IMO exactly what Clear direct formatting should do.
An e-book is normally delivered as PDF-file and even if its still work-in-progress should the author use styles on a document this size.
Clear Direct Formatting does not delete page breaks that are applied to a paragraph style but only page break of direct formatted paragraph without any style.
Comment 32 R. Green 2020-12-21 13:25:46 UTC
IME, use of in-paragraph-style page breaks was haphazard due to Bug 134439. However this has now been fixed.
Comment 33 R. Green 2020-12-21 16:47:34 UTC
(In reply to Sascha Z from comment #31)
> Clear Direct Formatting does not delete page breaks that are applied to a
> paragraph style …

Yes, the page breaks are kept, but all the page styles are wiped and revert to default.

IMV, there is a need for a user option to be able to "lock" the page styles in some way, so that you can use "Remove direct formatting" without worrying about losing them.
Comment 34 S.Zosgornik 2020-12-21 23:18:43 UTC
(In reply to R. Green from comment #33)
>all the page styles are wiped and revert to default.

Confirm this (mis)behavior happens to me after saving, closing and reloading the document. In my case it even removed all bake breaks to styled paragraphs.
Would this call another bug.
Comment 35 Cor Nouws 2020-12-27 12:10:30 UTC
thanks for the discussion and insights.
Let me resolve this as NotABug.
Comment 36 S.Zosgornik 2020-12-27 19:38:43 UTC
Why is this bug just closed? We never found any solution but even more bugs!
Comment 37 TorrAB 2020-12-28 19:25:48 UTC
(In reply to Sascha Z from comment #36)
> Why is this bug just closed? We never found any solution but even more bugs!

**Good question. I myself was baffled. What is the conclusion of this lively discussion?
Comment 38 Mike Kaganski 2020-12-28 19:38:08 UTC
I suppose Cor just accidentally pushed the button in the wrong browser tab :-) No need to worry, this is obviously still NEW.
Comment 39 TorrAB 2020-12-29 00:00:32 UTC
(In reply to Telesto from comment #29)

> SUGGESTION: "Clear direct formatting" should NOT delete page breaks. Instead
> there should be another command, "Clear page breaks", to delete the page
> breaks separately.

**Even those who belong to the style, eg, a Heading1 because you want a chapter to begin on a new page?
Comment 40 TorrAB 2020-12-29 03:34:38 UTC
> The most natural and fastest way to clear ad hoc formatting from a WRITER
> file SHOULD be to select ALL and apply "Clear direct formatting".

**Why would one do DF here and there throughout a (large) document, and suddenly decide to remove it all? More likely, "Clear direct formatting" will be applied punctually, one parag at-a-time.
Comment 41 Octavio Alvarez 2020-12-29 06:11:01 UTC
(In reply to TorrAB from comment #40)
> > The most natural and fastest way to clear ad hoc formatting from a WRITER
> > file SHOULD be to select ALL and apply "Clear direct formatting".
> 
> **Why would one do DF here and there throughout a (large) document, and
> suddenly decide to remove it all? More likely, "Clear direct formatting"
> will be applied punctually, one parag at-a-time.

Not at all; I do it all the time for different reasons even for large documents. Examples:

1. Pasted documents from the Internet or imported from other documents will require cleaning. "Clear All Formatting" and "Paste Unformatted" may not be desirable when copying large portions if the formatting is decently applied. Also, existing formatting may be used as visual guides to reapply styles. A full clean up may be needed afterwards.

2. After applying a set of direct formats a formatting pattern may come up which will lead to the creation of a Style. Once the Style is created and applied, Direct Format should be removed to avoid formatting surprises. Character styles can become the most confusing but the most useful sometimes.

3. The user may lose track of direct formatting. Maybe the file was reverted to a saved version or format paintbrush was used throughout the document. A quick clean can be done by issuing "Clear Direct Formatting" to the whole document.

4. If I know that I am keeping the document DF-clean, then it is just way easier and faster to do Ctrl+A, Ctrl+M and going to specific paragraphs to clean DF.

In "surprises" and "losing track" I am including what I have called "hidden Direct Formatting" in the past. Hitting Bold twice does *not* remove direct-format-bold; it instead sets the text as direct-format-regular.

So, yes, this is why cleaning the whole document from DF is sometimes necessary.

To keep it on-topic: it would certainly be a bit confusing if I suddenly lose manually inserted page breaks when doing a document-wide "Clear DF" if I did it using Insert > Break or Ctrl+Enter.
Comment 42 Telesto 2020-12-29 09:44:58 UTC
(In reply to Octavio Alvarez from comment #41)
> To keep it on-topic: it would certainly be a bit confusing if I suddenly
> lose manually inserted page breaks when doing a document-wide "Clear DF" if
> I did it using Insert > Break or Ctrl+Enter.

* People seeing a page break being as object will never consider a page break to be removed by clear formatting
* People seeing page break as formatting, might desire removal or not (depending) on the user case.

Also there is partly a terminology question: clear DF formatting reads as clear all (DF) formatting. In that line obviously all formatting must be removed (including page breaks, as this being formatting in the LibreOffice model).

Obiter dictum: I personally see use case for both types of page breaks, instead of always getting the 'formatting one'; see bug 137151.
Comment 43 TorrAB 2020-12-29 18:32:08 UTC
(In reply to Octavio Alvarez from comment #41)
> (In reply to TorrAB from comment #40)
> > > The most natural and fastest way to clear ad hoc formatting from a WRITER
> > > file SHOULD be to select ALL and apply "Clear direct formatting".
> > 
> > **Why would one do DF here and there throughout a (large) document, and
> > suddenly decide to remove it all? More likely, "Clear direct formatting"
> > will be applied punctually, one parag at-a-time.
> 
> Not at all; I do it all the time for different reasons even for large
> documents. Examples:
> 
> 1. Pasted documents from the Internet or imported from other documents will require cleaning.

**Will these foreign documents contain LO-formated pageBreaks? Would you suffer if those breaks were removed by "Clear direct formatting"? Will you not want to remove some of them, and add your own, as part of the required ‘cleaning’?

> Character styles can become the most confusing […]
**… but they are independent from parag styles, to which pageBreaks belong.

> […] what I have called "hidden
> Direct Formatting" in the past. Hitting Bold twice does *not* remove
> direct-format-bold; it instead sets the text as direct-format-regular.

**not in my test: select a normal (non-bold) word; hitting ^b several times toggles the format bold on and off.
Anyway, this is character formatting, independent from pageBreaks
Comment 44 S.Zosgornik 2020-12-30 02:09:48 UTC
IMO the underlaying bugs needs to be fixed before.

Bug 73483 "Clear direct formatting deletes page breaks but this does not show up until reopened" breaks the feature and gives users unexpected results.

Also I created a report for the bug described by R.Green in comment #33 as
139311 "ClearDirectFormatting removes page styles".

We can still hold endless discussions if or if not page breaks should removed after these bugs got fixed.
Comment 45 Telesto 2020-12-30 10:05:18 UTC Comment hidden (off-topic)
Comment 46 sdc.blanco 2021-01-10 11:16:03 UTC
adding see also to bug 74078, because search on "Page Style" attribute refers exactly to Page Breaks.  Is it possible that the reason why Page Break is not removed from Direct Formatting is the same reason why the "Page Style" search attribute does not work?
Comment 47 Regina Henschel 2022-03-31 11:31:42 UTC
This wish is the opposite to bug 139079.