Bug 146442 - Default anchor value of macro added control to a Base form should be page not character EDITING
Summary: Default anchor value of macro added control to a Base form should be page not...
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
(earliest affected) release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
Keywords: bibisectRequest, regression
Depends on:
Reported: 2021-12-28 04:01 UTC by Leslie
Modified: 2022-06-02 11:20 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:

Base file showing unwanted anchor setting (12.50 KB, application/vnd.sun.xml.base)
2021-12-28 04:03 UTC, Leslie
Anchor will be set to page here. (46.35 KB, image/png)
2022-02-15 08:10 UTC, Robert Großkopf

Note You need to log in before you can comment on or make changes to this bug.
Description Leslie 2021-12-28 04:01:28 UTC
When dynamically adding a control to a Base form via macro, the default anchor type is 'As Character'.  
This causes the control to be locked into a position that cannot be changed using the models/control/shape position settings.   
On a Base form I can't imagine this ever being the desired default.   
I believe the anchor type should be 'to page' thereby allowing the positioning of the control via code.  
This RFE is the directly related to bug 146426: https://bugs.documentfoundation.org/show_bug.cgi?id=146426    

Steps to Reproduce:
1. Write code to add control to base form 
2. Note the anchor type is 'As Character' 
3. Note how the control cannot be positioned via code until the anchor type is changed

Actual Results:
The anchor type is 'As Character' 

Expected Results:
The anchor type is 'At Page' 

Reproducible: Always

User Profile Reset: No

Additional Info:
Version: (x64) / LibreOffice Community
Build ID: d166454616c1632304285822f9c83ce2e660fd92
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded
Comment 1 Leslie 2021-12-28 04:03:11 UTC
Created attachment 177164 [details]
Base file showing unwanted anchor setting

Open the base file and double click on 'testform' and it will add a control to the form.
Comment 2 Alex Thurgood 2021-12-29 11:35:12 UTC
Confirming with

Version: / LibreOffice Community
Build ID: 87b77fad49947c1441b67c559c339af8f3517e22
CPU threads: 8; OS: Mac OS X 10.16; UI render: default; VCL: osx
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded
Comment 3 Robert Großkopf 2021-12-30 07:30:17 UTC
Tried this one:
Opened the form for editing.
Switched Design Mode off.
Pressed the button.
Control appears.
Control Properties → Anchor → To Page will appear.

Tested with LO on OpenSUSE 15.3 64bit rpm Linux.

Couldn't find a buggy behavior here.
Comment 4 Heiko Tietze 2022-02-15 07:11:15 UTC
Anchor is To Paragraph for me. Please test again.

Version: / LibreOffice Community
Build ID: 30(Build:3)
CPU threads: 8; OS: Linux 5.16; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 5 Robert Großkopf 2022-02-15 08:10:06 UTC
Created attachment 178277 [details]
Anchor will be set to page here.

Tested again.
1. Right mouse click on form → Edit
2. Switch Design mode off
3. Press button
4. Switch Design mode on
5. Look at the properties of the field.
→ Field is shown as anchored to page.

Tested with 
Version: / LibreOffice Community
Build ID: 349cd3ad57dce98d6b54b76f8e9f456ac7d7edb7
CPU threads: 6; OS: Linux 5.3; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: en-US
Calc: threaded

on openSuSE 15.3 64bit rpm Linux
Comment 6 Heiko Tietze 2022-02-16 09:41:26 UTC
My scenario in Writer with a new document (same happens with Base):
1. Form > Text Box
2. Form > Control Properties 
=> Anchor = To Paragraph (changing it is possible, of course)

While playing around I managed to reproduce the issue and newly added control went into the document anchored As Character. Happens when the command is still active (checkmark set). Solution is to fix the checked state, which is wrong anyway. It should be active only while drawing the object.

Wonder if this is a regression.
Comment 7 Mike Kaganski 2022-06-02 11:20:29 UTC
I'm sorry, is there an API missing to set the wanted anchoring from macro? I see that it works nicely in the attachment 177164 [details], setting control's AnchorType.
If it's there, what is the reason to change the default here?

Comment 6 is completely irrelevant, since it talks about UI, not macros.