I have made a macro which cannot work correctly if blank lines are selected at the beginning or end of the selection. Line breaks are expected in the middle of the selection, however.
Since LibreOffice’s string searching and manipulation abilities are pitiful, I can’t just do a nice regex search like “^\n+|\n+$” to remove blank lines at the start or end. I can test if the first or last character is chr(13) and then trim it out, but if there is more than one blank line selected, I would have to have to right some crazy loop to keep checking for blank lines until they are all gone. Surely there must be some better way.
I considered converting the selection to an enumeration using createEnumeration, and then I can check each paragraph to see if it is empty, but I don’t know how to move the start of the selection forward, or the end of the selection backwards.