Alternative Cycle Case
Tags: Extensions Writer
Alternative Cycle Case command with more intuitive behavior
Adds a LibreOffice Basic macro which re-implements Writer’s Cycle Case command (Shift+F3) in what I consider to be a more intuitive way:
Selection is respected (the built-in Cycle Case command may change the entire sentence or paragraph regardless of the current selection).
The next step applied depends on the current case of the text (the built-in command uses an internal counter instead so it may decide to apply, for example, ALL CAPS when the selection is already in all caps, giving the appearance that it is not working).
Issuing the command after typing a word cycles the case of the word (the built-in command requires the user to select the word they just typed or at least move the cursor back inside it).
This alternative behavior should also be more familiar to users coming from Microsoft Word. Installing the extension adds a Format ► Text ► Cycle Case (Alt.) entry in the main menu but the most convenient way to use the command is to assign a shortcut to the AltCycleCase.Main.CycleCase macro, either replacing the default Shift+F3, or a different one, such as Alt+F3.
WARNING: The macro supports noncontiguous selections using a hack because I could not get the UNO API to remember and restore a multi-range selection. It marks the selected text with a rarely used attribute (flashing characters), then searches for it to restore the selection after changing the text. If you use this attribute for other purposes, you may prefer to assign a shortcut to the AltCycleCase.Main.CycleCaseNoMultiselection macro which disables this hack and supports only contiguous selections.
Release: Initial release –
Initial release of the extension. Noncontiguous selection is supported using a hack with character attributes. Main functionality should already work well but the extension is tested only on LO 7.1 under Windows 10. Feedback is welcome.