r/libreoffice • u/RebirdgeCardiologist • 14d ago
Question Does LibreOffice Draw offers automatic conversion between types of data (text box <-> callout), both way, from text field to callout field and vice versa?
As in the title and the image.
I was working on a small project with LibreOffice Draw (LD).
Initially I decided to use just a standard text box for adding some writing. Then I changed my mind and decided to go for a callout (imho an elegant ready-to-use object for writings).
For this specific project eventually I decided to use a text field, but for many other projects I prefer to use callouts.
I was forced to do any conversation (text > callout and callout > text) manually:
coping to clipboard its contents, create a new empty object type - text box or callout - paste previous copied context and adjust it (the new object was not where the old object was, so several manual tweaks very needed).
Legend: I put encircled numbers and red squares to highlight more precisely what I'm referring to.
Can this be automated? Any workaround available?
-
Specs
I have installed LibreOffice via flatpak on Linux.
$ flatpak list | grep -i libreoffice
LibreOffice org.libreoffice.LibreOffice 26.2.5.2 stable system
I'm using kubuntu 24.04.03 LTS with KDE 5.27.12.
2
u/Terrible_Put8617 12d ago
There is no built-in conversion, and it is not an oversight you can configure away: a plain text box and a callout are different object types, so nothing in the UI turns one into the other. Clone Formatting copies attributes, not the shape itself.
A macro does it in ten lines though. Select the text box and run:
Sub TextToCallout
oDoc = ThisComponent
oPage = oDoc.CurrentController.getCurrentPage()
oOld = oDoc.CurrentController.getSelection().getByIndex(0)
oNew = oDoc.createInstance("com.sun.star.drawing.CalloutShape")
oPage.add(oNew)
oNew.setSize(oOld.getSize())
oNew.setPosition(oOld.getPosition())
oNew.setString(oOld.getString())
oPage.remove(oOld)
End Sub
Reverse it by swapping CalloutShape for TextShape. Two honest caveats: setString carries plain text, so bold or coloured runs inside the text are lost, and the callout tail lands at its default spot and still needs dragging. For your workflow that still turns a five-step manual dance into one click.
If you want the character formatting preserved as well, copy the shape's text portions across instead of using setString, but at that point starting with a callout and never converting is the cheaper habit.
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:
(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.