Alternative Cycle Case
Tags: Extensions Writer
last edited: 2023-01-24
Alternative Cycle Case command with more intuitive behavior
Adds a LibreOffice Basic macro which re-implements Writer’s Cycle Case command (Shift+F3) with the following differences:
- Selection is always respected. The built-in command may modify the entire sentence or paragraph regardless of the current selection.
- Without selection, always acts on the current word. Without an existing selection, the built-in command may act either on the word containing the cursor or the entire sentence.
- Redundant steps are skipped. The built-in command ignores the current state of the text and may apply, for example, ALL CAPS to a selection is already in all caps.
- Works on the word you just typed. The built-in command requires the user to select the word or at least move the cursor back inside it.
This 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.
Plinio Hernández Oct 28, 2022, 10:09 PM (7 months ago)
I had been looking for a solution like this for many years. Works fine on W10 and LO7.3 Thank you very much for your work. Your contribution is amazing!
Fulvio Bucci Oct 12, 2021, 6:23 PM (20 months ago)
Installata su Linux.
Estensione indispensabile per rendere funzionale la trasformazione maiuscolo/minuscolo.
Do 5 stelle anche se la selezione non contigua non funziona, perché io non la utilizzo, mentre per il resto è perfetta.
Macro assegnata alla classica combinazione Shift+F3, sostituendo l'assurda implementazione di default.
Filippo Giadrossi May 4, 2021, 10:01 PM (2 years ago)
It does not work at all in MacOS X.
It gives an error "BASIC runtime error.
Property or method not found: getViewCursor."
Anyway...thanks for your kind work :)
pibarnas Feb 18, 2021, 3:36 PM (2 years ago)
I've had success at installing the extension in Windows 10 (LO 7.1) after cleaning my own configs (help>fix libreoffice>safe mode). Thank you once more! Your work is very appreciated!
MIhail Balabanov Feb 28, 2021, 12:17 PM (2 years ago)
Hi, thanks for reporting this. I just found that the extension had somehow disappeared in my Win10/LO7.1 installation and when I tried to re-installed it, I had the same issue. Apparently, LO failed to create one of the temporary directories needed for deployment of the extension. Renaming my UNO packages cache folder (C:\Users\<my name>\AppData\Roaming\LibreOffice\4\user\uno_packages) fixed the problem and allowed the oxt to install correctly. I will try to investigate further when I have more time. Cheers!
pibarnas Feb 18, 2021, 2:42 AM (2 years ago)
Great work!! Thank you very much! Worked as expected in linux (very well, I mean), but couldn't install in Windows (10/LO 7.1), for some reason. I found the otx extension downloaded, but when I click on it, a text box appeared saying it isn't found (an error). Will try with prior version, stable one.