Bug 151151 - Block z-order for watermark shapes on opening
Summary: Block z-order for watermark shapes on opening
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.4.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Page-Watermark Z-Order
  Show dependency treegraph
 
Reported: 2022-09-23 16:23 UTC by csongor
Modified: 2024-04-19 09:57 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
shows the issues listed in the initial comment (23.17 KB, application/vnd.oasis.opendocument.text)
2022-09-23 16:23 UTC, csongor
Details
illustrates some of the problems (241.53 KB, image/png)
2022-09-23 16:25 UTC, csongor
Details

Note You need to log in before you can comment on or make changes to this bug.
Description csongor 2022-09-23 16:23:45 UTC
Created attachment 182647 [details]
shows the issues listed in the initial comment

The precedence of the layers 
- of the text, 
- the shapes and 
- the watermark 
is inconsistent. Three years ago, @Thomas Lendo has proposed a work-around in Bug #127331 but it doesn't work anymore. Moreover, it highlights some other bugs.

In order to see the problem, do these steps:
- type a page of random text ("asdf asdf ..."")
- Insert -> Shape -> Basic Shapes -> Rectangle -> Escape
(Shape 1 appears in the Navigator, this is good)
- Format -> Watermark -> Text=CONFIDENTIAL -> OK
(the watermark is _behind_ the object, YUCK)
(in the Navigator, 10 PowerPlusWatermarkObject appears (9 grey and 1 black): ???)
- double-click on the black one
(the top grey one gets selected instead of the black one: ???)
- Format -> Arrange -> To Foreground -> Escape
(the watermark comes in front of the shape: Hooray)
- Insert -> Shape -> Basic Shapes -> Circle -> Escape
(the circle comes _in_front_of_ the watemark: ???)
- double-click on the black PowerPlusWatermarkObject in the navigator
- toggling between "Format" -> "Arrange" -> "To Foreground" and "Format" -> "Arrange" -> "To Background" toggles between T-R-W-C and W-T-R-C, instead of T-R-C-W and W-T-R-C (letters mean Text, Watermark, Rectangle, Circle). I think it should move the Watermark to back and to the front.

Note: I attach demo.odt with which you can see the problem in a slightly different way because double click the Drawing Object of the watermark in the Navigator does not work (???):
- open demo.odt
- click the circle
- press Delete
- click the rectangle
- press Tab (this focuses the watermark object)
- Format -> Arrange -> Bring to front -> Escape (To Background and To Foreground don't work)
- Insert -> Shape -> Basic Shapes -> Circle -> Escape
(You can see that the watermark is not behind everything, nor in front of everything. It is somewhere between the layers of the shapes.)
- File -> Save (Z-inconsistency is still there)
- File -> Reload (Z-inconsistency is confused ever further: watermark goes behind the layers of the shapes but remains in front of the text.)

To summarise the issues:
1. the watermark should be either behind or in front of everything, not somewhere between them (Which one? I comment my opinion into Bug #127331.)
2. Why are there 9 grey "PowerPlusWatermarkObject" items beyond the one black?
3. Why do the grey ones not work and clicking the black one focuses a grey one?
4. Why does toggling between "To Foreground" and "To Background" not toggle the position of the watermark between behind and in front of everything? 
5. Why can't I click the "PowerPlusWatermarkObject" after reloading the document?
6. Why does "To Foreground" not work after reloading the document if it did work beforehand?
7. Why is the z-index of the shapes versus that of the watermark reordered after save and reload?

In a nutshell, instead of this fragile z-index handling, it would be much cleaner to have a pair of radiobuttons in the Format -> Watermark dialog:
(o) as a stamp, ie. above everything else
(o) as a background, ie. behind everything else
Comment 1 csongor 2022-09-23 16:25:34 UTC
Created attachment 182648 [details]
illustrates some of the problems

This attachment is a screenshot how LO 7.4.1.2 shows the watermark on a weird layer compared to the text and different shapes.
Comment 2 Dieter 2022-10-16 10:33:29 UTC
I confirm the behaviour with

Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 8991cbb7986d3967bc6c3719d95254ff04428d1a
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL threaded

Steps
1. Open attachment 182647 [details]. Watermark is in front of text and behind shapes
2. Click the rectangle and press Tab (this focuses the watermark object)
3a. Format -> Arrange -> To Background (Watermark is now behind text and behind shapes)
3b. Format -> Arrange -> Bring to Front / Forward One doesn't work (perhaps O. K.); Back One / Send to Back are active (expected: should be greyed out)
3c. Format -> Arrange -> To Foreground (Watermark is now in front of text and shapes)
3d. Format -> Arrange -> Back One (result: only back of circle) / Send to Back (back of shapes but in front ot text) (Watermark is now in front of text and shapes)

I agree, that improvement is needed here. I think "To Background" and "To Foreground" should be the only options for watermarks. I'm also confinced, that we should distinguish between a "stamp" (in foreground) and a "watermark" (in background). Watermarks I know are images (e. g. logo of organization), that are always in background. Watermarks dialog doesn't offer option to insert an image. Text is more like a stamp, and this is always in foreground.

So it seems we have different aspects here and maybe more than one bug report

cc: Design-Team for further input and decision.
Comment 3 Heiko Tietze 2022-11-02 14:47:52 UTC
The watermark shape can move up/down after opening the document (arrange is available in the properties tab at the sidebar). But once you edit attributes via Format > Watermark like text or color it snaps back to the lowest position and access to the z-order is blocked (actually not working, it should be clearly disabled though). And for new documents the access is blocked as well.

So the issue here is to just block the z-order after the document is opened.

I don't see need to place the watermark in the foreground (nor we have interactions for this).

Version: 7.4.2.3 / LibreOffice Community
Build ID: 40(Build:3)
CPU threads: 8; OS: Linux 6.0; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (en_US.UTF-8); UI: en-US
7.4.2-2
Calc: threaded
Comment 4 Regina Henschel 2022-11-02 17:28:07 UTC
A Watermark shape is a regular Fontwork shape, which is anchored to the header and thus is part of the page style. So z-order works for Watermark shapes the same as for all such header anchored objects.

You need to allow z-ordering because the user needs the ability to determine the position of a Watermark in regard to other objects anchored to the header, e.g. a logo or a frame with enterprise infos.

The only thing which is special about a watermark is its name "PowerPlusWaterMarkObject". That is hard-coded to distinguish a Watermark shape from other shapes anchored to the header. That magic name is needed to trigger, that when using 'Insert Watermark' the existing one can be 'edit'. In fact it is not an edit, but the old one is deleted and the new one is inserted.

The grayed out "PowerPlusWaterMarkObject" shapes in the Navigator belong to the other page styles.
Comment 5 Regina Henschel 2022-11-02 17:37:06 UTC
The quirks with accessing the Watermark shape in Navigator have their reason in the fact, that all Watermark shapes have the same name. To prevent such problems, naming for regular objects has been changed so that their names are unique. Such is missing for Watermark shapes.
Comment 6 csongor 2022-11-03 10:39:22 UTC
(In reply to Heiko Tietze from comment #3)

> I don't see need to place the watermark in the foreground (nor we have
> interactions for this).

I think the need for foreground-watermark is clear. You can see stamp-over labels in several movies, indicating "CONFIDENTIAL", "INVALID", "TOP SECRET", "PREVIEW" and other classification of documents. 

Here are some samples:

http://www.nottinghamremovals.co.uk/confidential-document-destruction/index.php
https://www.gettyimages.ca/detail/photo/document-stamped-with-the-word-confidential-royalty-free-image/93270326
https://www.dreamstime.com/top-secret-document-decreted-confidential-information-secret-text-classified-information-top-secret-document-decreted-confidential-image192576251  

It would be nice to have a native tool for this in Writer and an advanced watermark functionality could do the job very well.
Comment 7 Dieter 2022-11-03 10:54:50 UTC
(In reply to csongor from comment #6)
> I think the need for foreground-watermark is clear. You can see stamp-over
> labels in several movies, indicating "CONFIDENTIAL", "INVALID", "TOP
> SECRET", "PREVIEW" and other classification of documents. 

But these are not watermarks but stamps (as you say yourself). We shouldn't mix it.Perhaps it's a solution to provide stamps as a gallery.
Comment 8 Heiko Tietze 2022-11-03 11:02:01 UTC
(In reply to Regina Henschel from comment #4)
> You need to allow z-ordering because the user needs the ability to determine
> the position of a Watermark in regard to other objects anchored to the
> header, e.g. a logo or a frame with enterprise infos.

Adding z-order to WM shapes makes the interaction much more difficult. And to what I get from the implementation it was not planned. As Dieter noted, stamps are a different thing.
Comment 9 csongor 2022-11-03 11:08:30 UTC
(In reply to Dieter from comment #7)
> (In reply to csongor from comment #6)
> > I think the need for foreground-watermark is clear. You can see stamp-over
> > labels in several movies, indicating "CONFIDENTIAL", "INVALID", "TOP
> > SECRET", "PREVIEW" and other classification of documents. 
> 
> But these are not watermarks but stamps (as you say yourself). We shouldn't
> mix it.Perhaps it's a solution to provide stamps as a gallery.


What is the difference between watermark and stamp? I may be wrong but to me, the only difference is their z-index position: 
- stamp is above everything while 
- watermark is under the text and images but above the background color of the page/paragraph/table/etc. 

As there is no tool for both, I think it would make sense to handle them the same way. A single dialog with a binary switch: should it look like a stamp or like a watermark. 

But if it is easier to develop as a separate tool, I don't mind if there is an Stamp-Over tool as well. But definitely both of them have their own use case.
Comment 10 Dieter 2022-11-04 16:35:47 UTC
(In reply to csongor from comment #9)
> What is the difference between watermark and stamp?
Go back to ancient analog times: Watermark is part of the sheet (so it's behind everything) and you use a stamp to mark a document as confidental, ...

> me, the only difference is their z-index position: 
> - stamp is above everything while 
> - watermark is under the text and images but above the background color of
> the page/paragraph/table/etc.
So yes, I agree

> As there is no tool for both, I think it would make sense to handle them the
> same way. A single dialog with a binary switch: should it look like a stamp
> or like a watermark.
My point is: If we have a tool, that is called "watermark", everything created by this tool should work like a "watermark". We need something different for stamps. I don't have a special opinion about that tool. I assume, there could be several solutions, for example we have an entra "Watermark and Stamps" and the current watermark dialog is renamed to "Watermark & Stamps" and has an additional option "Insert as Watermark / Insert as Stamp". But of course it's up to Design-Team to decide.
Comment 11 csongor 2022-11-05 03:15:10 UTC
(In reply to Dieter from comment #10)
> we have an entra
> "Watermark and Stamps" and the current watermark dialog is renamed to
> "Watermark & Stamps" and has an additional option "Insert as Watermark /
> Insert as Stamp". But of course it's up to Design-Team to decide.

I think this is a good idea. It would be clear to understand, straightforward to use and hopefully, easy to implement.
Comment 12 Heiko Tietze 2022-11-09 09:33:27 UTC
I'd keep the name simple and use radio buttons 

Type: (o) Watermark
      ( ) Stamp