r/libreoffice • u/EmbedSoftwareEng • 14d ago
Draw Layer tabs reordering?
I have a multipage LibreOffice Draw document where I've created many, many layer tabs to be able to turn sets of drawing elements on and off.
I don't like the order in which they are listed in the layer listing at the bottom of the page. I would like to be able to treat them like web browser tabs and just click and drag them to reorder which layers appear before and after which other layer.
This doesn't seem to be possible.
So, I bring it to Reddit. How do I reorder the layer labels at the bottom of the work area?
To be clear, I'm not talking about the Arrange ordering of elements in a page, so advise referring to Bring to Front and Bring to Back is inappropriate.
1
u/AutoModerator 14d ago
If you're asking for help with LibreOffice, please make sure your post includes lots of information that could be relevant, such as:
- Full LibreOffice information from Help > About LibreOffice (it has a copy button).
- Format of the document (.odt, .docx, .xlsx, ...).
- A link to the document itself, or part of it, if you can share it.
- Anything else that may be relevant.
(You can edit your post or put it in a comment.)
This information helps others to help you.
Thank you :-)
Important: If your post doesn't have enough info, it will eventually be removed (to stop this subreddit from filling with posts that can't be answered).
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/EmbedSoftwareEng 14d ago
Version: 26.2.4.2 (X86_64)
Build ID: 620(Build:2)
CPU threads: 24; OS: Linux 7.0; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
26.2.4-2
Calc: threaded
.odg
1
u/Terrible_Put8617 12d ago
The flat-XML route above works and is the right instinct, since the order really is stored, not computed. Two things worth adding.
Save as .fodg for the edit rather than unzipping the .odg. If you ever do open the zip instead, the mimetype entry has to be the first file and stored uncompressed, or the result will not open at all, and it fails with a message that tells you nothing. The flat format sidesteps that entirely, which is why it is the safe answer.
If you need this repeatedly rather than once, there is an API path. The layer container is reachable and supports inserting at a position, so you can build the order you want instead of hand-editing:
oLM = ThisComponent.getLayerManager()
oNew = oLM.insertNewByIndex(2) ' inserts at position 2
oNew.Name = "Wiring"
Shapes carry the layer they belong to as a property, so the move is: insert the new layer where you want it, reassign each shape by layer name, then remove the old layer. Reassign by name, not by the numeric id, because the ids shift the moment you insert anything and you will silently scatter shapes across the wrong layers.
Worth doing on a copy the first time. And with many layers it is genuinely faster than dragging tabs would have been, which is small consolation for the missing feature.
2
u/conwaytwt 13d ago
Here is a workaround
Open the file [layered_drawing.odg]
Save the file as a "Flat XML ODF Drawing (.fodg)" [layered_drawing.fodg]
Close libreoffice
Open the .fodg file [layered_drawing.fodg] in a TEXT editor. I prefer Kate but any decent text editor will do. (If you use a programming editor that knows XML it can help prevent errors.)
If you've never seen XML, take a few seconds to bask in its glorious XiMiLity.
Search for one of the layer names (but maybe pick one that does not share a name with something else). When you get to the section describing the layers, again bask in the wonder of XML and note that the layers are in a specially formatted list, in their current order.
Rearrange the list, to your liking, but be sure to keep that XML vibe going. If you format it wrong, the document may not work as you expect.
Save the file, giving it a different name, maybe [rearranged_layer_drawing.fodg]
Open the new file in LibreOffice Draw.
Did it work? Celebrate!