Developing plugin(s) for code developers

Hello everyone. I am hoping to squish a mole hill into a flat surface in making this request. Basically, I am hoping to use LibreOffice’s word document’s outline to allow for camel case. If necessary, it would be great if I could create a c++ plugin so when I am wearing my programmer’s hat, I can easily create flowcharts and outlines for when I decide to write code. Even better would be to allow this plugin to enable voice commands. Even at 43 years of age my hands grow weary from all the typing I put them through.

The first step would be to learn how to enable and disable autocorrect, so when I type bFullScreen it recognizes this as what I claim. Then when I wish to enable autocorrect it goes back to converting bFullScreen to Bfullscreen.

Eventually, I hope to know LibreOffice to know how to create my own plugin that:

  1. Shows the enable/disable autocorrect on the main toolbar.
  2. Perhaps allows the user to create their own enable/disable sets of and/or specific features.
  3. Allows for voice recognition. Inside of voice recognition it allows the user to recalibrate, because if it is anything like smartphones which somehow think when I say OutPost, I am saying how to post. The recaliberate would include a feature for writing down something, then reading it out loud. The program would be forced to admit the user knows best that no matter how badly the writings and orals disagree, they are in fact the same thing.

More than likely, I am the only one interested in creating this sort of plug in. Even if I am, please be courteous in telling me how to accomplish these steps.

Office pros work with templates and styles. https://www.pitonyak.org/AndrewMacro.odt is a book about coding written with OpenOffice. The author used a template with his own set of styles. The book contains code snippets formatted by means of character styles with text language “[None]” which turns off spell checking and auto-correct features for the text portions formatte with these styles. For the syntax highlighting he ran a macro. WIthin the text portions having a code style, the macro distinguishes between keywords, identifiers and contstants and applies the corresponding style variant. This way you can use auto-correct and spell checking any way you want without affecting any program code. By turning the auto-correct on and off while writing, you won’t get any “meaningful” (well structured) text.

First of all, here is Basic code that turns on or off AutoCorrect. It uses the dispatcher, which is an inelegant type of macro code that is needed for certain special operations. (There is already a built-in menu option .uno:StartAutoCorrect but I couldn’t get it to work, or maybe it does something different.)

Sub TurnOnAutoCorrect
	TurnOnOffAutoCorrect(True)
End Sub

Sub TurnOffAutoCorrect
	TurnOnOffAutoCorrect(False)
End Sub

Sub TurnOnOffAutoCorrect(enable As Boolean)
	Dim args(0) As New com.sun.star.beans.PropertyValue
	args(0).Name = "OnlineAutoFormat"
	args(0).Value = enable
	oFrame = ThisComponent.CurrentController.Frame
	oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
	oDispatcher.executeDispatch(_
		oFrame, ".uno:OnlineAutoFormat", "", 0, args())
End Sub

You can go to Tools > Macros > Organize Macros > Basic and add this code under My Macros.Standard.Module1. Then go to Tools > Customize and create toolbar buttons that call those routines.

Now, about extensions. Yes, you can write this in C++ and put it into an extension, both the code and the toolbar modifications. However, C++ extensions aren’t the easiest, and there is not a lot of support for developing such extensions. Consider Java or Python instead, for which you can more easily get questions answered on this site. Personally I prefer Python extensions because there is no need for queryInterface calls to get the exact UNO interface as in Java or C++. This cuts down on code length significantly.

However there are C++ examples in the LibreOffice SDK that I have gotten to work, so it is possible. Be prepared to mess with a lot of environment variables to get the compiler to do what you need.

One huge downside of a C++ extension is that it requires separate binaries for different platforms. Even on Linux running on the same architecture, you will fight e.g. different baselines.

Would you include links to tutorials on creating python or java plugins?

Have you tried the links above ? They are not restricted to C++
.
Also easy to find:
https://wiki.documentfoundation.org/Development/Extension_Development

But usually no “tutorial” style here…

I just waited for as long as it took me to type this message for the new page to load. It is still hanging. I am not that fast a typist, where it should take this long for the links above to load.

Blockquote
“Have you tried the links above ? They are not restricted to C++”

All 3 links load here without problem.