Does OpenOffice.org BASIC have enums?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Will Pittenger
Posts: 45
Joined: Tue Dec 14, 2010 10:43 am
Location: Morton, IL

Does OpenOffice.org BASIC have enums?

Post by Will Pittenger »

I noticed the IDE highlights "enum" as a keyword. But it doesn't like the syntax I used. I tried using standard VBA syntax I found on the web as shown below. But the compiler claims it is expecting a sub at the enum keyword. Did they reserve all keywords used by VBA without implementing some?

Code: Select all

enum Test
  value = 1
  value2 = 2
end enum
Last edited by Will Pittenger on Fri Jun 15, 2012 12:58 pm, edited 1 time in total.
Will Pittenger
I currently use OpenOffice 4.0 32-bit on Windows 7 64-bit (as of August 7th, 2013)
User avatar
RoryOF
Moderator
Posts: 35097
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Does OpenOffice.org BASIC have enums?

Post by RoryOF »

I can't answer your problem in any detail, but you are making a fundamental error in assuming that OpenOffice recognises and honours VBA syntax. The language used is completely different. You need to look at the documentation in detail. Start with
OpenOffice BASIC programming Guide
and the API info linked off
http://www.openoffice.org/api/
Apache OpenOffice 4.1.15 on Xubuntu 22.04.5 LTS
User avatar
Hagar Delest
Moderator
Posts: 33450
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Does OpenOffice.org BASIC have enums?

Post by Hagar Delest »

Plenty of topics with enum in the macro section and the code snippet.
See for example: Close all opened Writer documents.

Please add '[Solved]' at the beginning of your first post title (edit button) if your issue has been fixed.
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE Faye) and 24.8 portable on Windows 11.
User avatar
Charlie Young
Volunteer
Posts: 1559
Joined: Fri May 14, 2010 1:07 am

Re: Does OpenOffice.org BASIC have enums?

Post by Charlie Young »

Hagar Delest wrote:Plenty of topics with enum in the macro section and the code snippet.
See for example: Close all opened Writer documents.

Please add '[Solved]' at the beginning of your first post title (edit button) if your issue has been fixed.
I don't think Will is referring to enumerations of UNO objects, though they are highly useful; I think he wants a named list. I don't think OOBasic implements that directly, though with a certain amount of awkwardness something similar can be done with Array().
Apache OpenOffice 4.1.1
Windows XP
User avatar
Villeroy
Volunteer
Posts: 31348
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Does OpenOffice.org BASIC have enums?

Post by Villeroy »

The primitive StarBasic language does not know any enums. Any mature programming language (Java, Python, JavaScript, ...) knows some type of key:value pairings.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Will Pittenger
Posts: 45
Joined: Tue Dec 14, 2010 10:43 am
Location: Morton, IL

Re: Does OpenOffice.org BASIC have enums?

Post by Will Pittenger »

Villeroy wrote:The primitive StarBasic language does not know any enums. Any mature programming language (Java, Python, JavaScript, ...) knows some type of key:value pairings.
Figures. So why does it treat "enum" as a keyword when it comes to syntax highlighting? :?
Will Pittenger
I currently use OpenOffice 4.0 32-bit on Windows 7 64-bit (as of August 7th, 2013)
RPG
Volunteer
Posts: 2261
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Does OpenOffice.org BASIC have enums?

Post by RPG »

Hello

It is a know fact that it is possible to activate VBA support in Star Basic. It is not clear to me if it a good habit to activate it but for old VBA programmers who really understand that language and also can program maybe it is good to do it. But this group programmers is small.

This is working for me:

Code: Select all

REM  *****  BASIC  *****
option VBAsupport 1

enum Test2
  value = 1
  value2 = 2
end enum

Sub Main
print test.value
End Sub

and also this:

Code: Select all

REM  *****  BASIC  *****
option Compatible
enum Test
  value = 1
  value2 = 2
end enum

Sub Main
CompatibilityMode(True)
print test.value
End Sub
Romke
LibreOffice 24.8.5.2 on openSUSE Leap 15.6
Post Reply