Bug 163251 - Shape is inserted on locked layer
Summary: Shape is inserted on locked layer
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
7.4.0.3 release
Hardware: All All
: medium normal
Assignee: AshSinc
URL:
Whiteboard:
Keywords: implementationError
Depends on:
Blocks: Layers
  Show dependency treegraph
 
Reported: 2024-10-02 07:50 UTC by Saburo
Modified: 2024-10-03 13:33 UTC (History)
3 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 Saburo 2024-10-02 07:50:44 UTC
Description:
Double clicking when inserting a shape inserts it into a layout layer that should have been locked.

Steps to Reproduce:
1.Insert a new layer (Layer4).
2. Modify the layer “Layout” to “Lock”.
3. "Layer4" active.
4.Select "Rectangle" and double-click it on the page.

Actual Results:
The rectangle was not inserted on Layer 4, but on a locked layout layer.
The layout layer is locked and cannot be selected.

Expected Results:
Rectangles are inserted on Layer 4


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 24.2.6.2 (X86_64) / LibreOffice Community
Build ID: ef66aa7e36a1bb8e65bfbc63aba53045a14d0871
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: ja-JP (ja_JP); UI: en-US
Calc: CL threaded
Comment 1 V Stuart Foote 2024-10-02 14:38:42 UTC
confirmed. Able to draw onto the 'Locked' layer.

Interestingly if rather than the double-click of the STR, if the TB selected draw object is interactively drawn it will be added to the active layer and not the 'Locked' Layout layer.

So this seems an implementation issue against bug 149141 - Allow object creation by clicking if drag size is below threshold in https://gerrit.libreoffice.org/c/core/+/134499 in place for 7.4 release. 

The target layer of the click-paste is not the active layer, and it is written in error to the 'Layout' layer--even if that layer is locked!

=-testing-=

Able to draw onto locked 'Layout' layer:

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 7198c5e49eff0b82cb423424eaed0ee94d66db7d
CPU threads: 8; OS: Windows 10 X86_64 (10.0 build 19045); UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded

Version: 24.8.2.1 (X86_64) / LibreOffice Community
Build ID: 0f794b6e29741098670a3b95d60478a65d05ef13
CPU threads: 8; OS: Windows 10 X86_64 (10.0 build 19045); UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded

Version: 24.2.6.2 (X86_64) / LibreOffice Community
Build ID: ef66aa7e36a1bb8e65bfbc63aba53045a14d0871
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded

Version: 7.6.6.3 (X86_64) / LibreOffice Community
Build ID: d97b2716a9a4a2ce1391dee1765565ea469b0ae7
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded

Version: 7.4.7.2 (x64) / LibreOffice Community
Build ID: 723314e595e8007d3cf785c16538505a1c878ca5
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL
Comment 2 AshSinc 2024-10-02 21:11:28 UTC
Thanks you are both spot on! 

Seems to be that InsertObjectAtView(...) expects SdrInsertFlags::SETDEFLAYER flag. If you don't include it then the new objects' layer is not updated to current layer and it manages to bypass the lock.
Comment 3 Regina Henschel 2024-10-02 22:17:10 UTC
The same happens, when a shape is inserted with Ctrl+Enter. (That is the accessibility short-cut for inserting shapes.) The shape is always inserted into layer "Layout", whether it is locked or not, even if a different layer is active layer.

BTW, insert of a shape happens on single click for me. A double-click inserts and goes immediately in text edit mode for me.
Comment 4 AshSinc 2024-10-02 22:40:47 UTC
Have a fix ready to go once I can get gerrit working. Would like to check with the Ctrl+Enter shortcut to see if it's the same issue/resolution. How would I enable this? If I try Ctrl+Enter at the moment it just creates a new page rather than inserts a shape. Thanks.
Comment 5 Saburo 2024-10-02 23:29:10 UTC
(In reply to Regina Henschel from comment #3)
> BTW, insert of a shape happens on single click for me. A double-click
> inserts and goes immediately in text edit mode for me.

It certainly happened with a single click.
Comment 6 Regina Henschel 2024-10-03 00:10:59 UTC
(In reply to AshSinc from comment #4)
 How
> would I enable this? If I try Ctrl+Enter at the moment it just creates a new
> page rather than inserts a shape. Thanks.

View the Drawing toolbar. Then press F6 till the Drawing toolbar is selected, then go to the desired shape by pressing the arrow keys, then press Ctrl+Enter.
Comment 7 Regina Henschel 2024-10-03 00:17:34 UTC
(In reply to AshSinc from comment #4)
> Would like to check > with the Ctrl+Enter shortcut to see if it's the same issue/resolution.

It might be not related, because this happens already in OpenOffice. Nevertheless it would be good to test, whether your fix has an effect on it.
Comment 8 V Stuart Foote 2024-10-03 12:08:20 UTC
(In reply to AshSinc from comment #4)
patch up as https://gerrit.libreoffice.org/c/core/+/174420
Comment 9 AshSinc 2024-10-03 12:22:21 UTC
So the patch solely fixes this bug by adding missing flags. 

Thanks Regina unfortunately it will not resolve the accessibility ctrl+enter problem. From a quick looking through the code the function InsertObjectAtView(...) is called frequently and sometimes has the layer flags set and other times has nothing set. I'm sure this is intentional in most cases (some things are probably drawn regardless of layers?) but maybe the ctrl+enter shortcut has also omitted the flag when it probably shouldn't have. I'm not sure where to find it though.
Comment 10 Regina Henschel 2024-10-03 13:33:29 UTC
(In reply to AshSinc from comment #9) 
> Thanks Regina unfortunately it will not resolve the accessibility ctrl+enter
> problem. From a quick looking through the code the function
> InsertObjectAtView(...) is called frequently and sometimes has the layer
> flags set and other times has nothing set. I'm sure this is intentional in
> most cases (some things are probably drawn regardless of layers?) but maybe
> the ctrl+enter shortcut has also omitted the flag when it probably shouldn't
> have. I'm not sure where to find it though.

So I would not touch it as this is a special accessibility short cut.