https://ask.libreoffice.org/uploads/short-url/juTp24fvbcTPD42OhmPNiVXEkI3.odt
I produced this demo for another topic. The form button on a Writer document performs some action, changes the label and performs another action on next click.
The code distinguishes between the runtime control oButton and its model oModel, reads the current label string from the model and then calls oButton.setLabel(s). To my surprise, the document status becomes modified, so I have to do this:
oButton = ev.Source
oModel = oButton.getModel()
[...]
ThisComponent.disableSetModified()
oButton.setLabel(s)
ThisComponent.enableSetModified()
IMHO, this should not be necessary, because I don’t change anything that needs to be stored. As far as I understand the matter, only the model properties are stored.