Code Colorizer | Apache OpenOffice Extensions (original) (raw)

Primary tabs

Maintainer: pitonyak
Rating: 4.333335 Average: 4.3 (9 votes)
Application: OpenOffice.org
Tags: format, macro, code, highlight
Source code: http://www.pitonyak.org/oo.php
Post date: Saturday, 10 November, 2007 - 18:49
Statistics Week: Not tracked - Month: Not tracked - Year: Not tracked - Timeline

Download extension

System Independent version - All releases

Compatible with OpenOffice 4: Yes

User feedback: Compatible with OpenOffice 4.x?

If you want a response from me, it is faster to send me an email at andrew@pitonyak.org.

This add-on is able to colorize the following languages:

A block of code is assumed to be formatted based on the following paragraph styles: _OOoComputerCode, _OOoComputerCodeLastLine, _code, _code_first_line, _code_last_line, or _code_one_line.

Numerous color code examples are shown in AndrewMacro.odt, along with a complete description of the add-in.

This extension provides the ability to colorize code segments. There are two modes of operation. The first mode (the least used mode for me) is to select the code that you want to colorize, and then use the menu options under: Tools > Add-Ons > MacroFormatterADP

I use a specific paragraph style for my code. I usually use _OOoComputerCodeLastLine for the last line of code in a segment, and _OOoComputerCode for the rest. So, for four lines of code, the first three use _OOoComputerCode and then the last line uses _OOoComputerCodeLastLine. This group then defines an entire code snippet.

Character styles are used for each portion of the code; for example, there is a character style for keywords, and another for literals. This is how color is assigned.

The code that identifies the specific portions is certainly not complete. In other words, I did not write a complete grammar interpreter for each supported language. My intention is to provide something that is "close enough" for regular use.

When I say that I am only looking for "good enough" support, this means that I may fail under strange situations. An example of an untested, but expected failure is as follows:

Create a single line of code such as "a = 1; // line comment".

If you select the code inside the double quotes, I expect that the single line comment will continue to the end of the paragraph without verifying that this runs past the ends of the selected text. If this is tested and found to be in error, I will fix the problem.

Final note: although a later version of OOo is specified as required, this is only because of the method that the extension uses to set menus. If you must use an older version of OOo, feel free to download the extension, use "unzip" to extract the libraries, and then manually import the libraries; they should work just fine on most any version of OOo.

If a language that you desire to color code is not supported, feel free to contact me directly and ask. Some languages are easy to add.

Code Colorizer

Version Operating system Compatibility Release date
5.0.1 System Independent -- 30/09/2020 - 15:06 More information Download
5.0.0 System Independent 3.0, 3.0.1, 3.1, 3.2, 3.3, 3.4, 4.0, 4.1 30/09/2020 - 13:53 More information Download
4.1.1 System Independent 3.4, 4.0, 4.1 31/10/2017 - 16:20 More information Download
4.0.3 System Independent 3.0 08/12/2016 - 15:10 More information Download
4.0.2 System Independent 3.0 02/09/2016 - 01:03 More information Download
3.1.4 System Independent 3.1 28/08/2015 - 16:18 More information Download
3.1.3 System Independent 3.1, 3.2, 3.3, 3.4, 4.0, 4.1 01/03/2015 - 16:57 More information Download
3.1.1 System Independent 3.1 26/02/2015 - 21:23 More information Download
3.0.4 System Independent 3.4, 4.0, 4.1 02/06/2014 - 11:29 More information Download
3.0.1 System Independent 3.1, 3.2, 3.3, 3.4 01/06/2012 - 23:59 More information Download
2.4.7 System Independent 3.1, 3.2, 3.3, 3.4 21/04/2011 - 16:40 More information Download
2.4.6 System Independent 3.1, 3.2, 3.3, 3.4 01/04/2011 - 23:44 More information Download
2.4.4 System Independent 3.1, 3.2, 3.3, 3.4 24/06/2010 - 11:07 More information Download
2.4.2 System Independent 3.1, 3.2, 3.3, 3.4 14/12/2009 - 17:51 More information Download
2.4.1 System Independent 3.1, 3.2, 3.3, 3.4 28/10/2009 - 19:05 More information Download
2.4.0 System Independent 3.1, 3.2, 3.3, 3.4 20/08/2009 - 11:50 More information Download
2.3.7 System Independent 3.1, 3.2, 3.3, 3.4 18/08/2009 - 12:49 More information Download
2.3.6 System Independent 3.1, 3.2, 3.3, 3.4 10/08/2009 - 21:05 More information Download
2.3.0 System Independent 3.1, 3.2, 3.3, 3.4 20/06/2009 - 11:14 More information Download
2.2.2 System Independent 3.1, 3.2, 3.3, 3.4 15/06/2009 - 10:56 More information Download
2.2.1 System Independent 3.1, 3.2, 3.3, 3.4 14/06/2009 - 22:44 More information Download
2.1.1 System Independent 3.1, 3.2, 3.3, 3.4 06/06/2009 - 21:38 More information Download
2.1.0 System Independent 3.1, 3.2, 3.3, 3.4 03/06/2009 - 14:28 More information Download
2.0.0 System Independent 3.1, 3.2, 3.3, 3.4 03/06/2009 - 09:47 More information Download
1.1.0 System Independent 3.4 07/05/2008 - 16:50 More information Download