On Wed, Feb 27, 2008 at 4:59 PM, Noelson Duarte <[EMAIL PROTECTED]> wrote:
>  If you want to use enum names, perhaps this will help you:
>  http://www.oooforum.org/forum/viewtopic.phtml?t=11922
Sub enumValue
' OK for OOo Basic
   oCR = createUnoService("com.sun.star.reflection.CoreReflection")
   oIdlCampos = oCR.forName("com.sun.star.text.PageNumberType")
   aCampos = oIdlCampos.getFields()
   For i=LBound(aCampos) To Ubound(aCampos)
      oField = aCampos(i)
      Print oField.Name; " - "; oField.get(Null)
   Next i
End Sub

He retrieves reference to enum type with method that returns XIdlClass
interface and
list members of enumeration with XIdlClass::getFields(). That's awesome!
Here's excerpt from docs:

>If the reflected type is an interface, struct or union, then you get
a sequence of XIdlField interfaces reflecting all fields (/interface
attributes). This also includes all inherited fields (/interface
attributes) of the interface, struct of union.
If the reflected type is not an interface, struct or union or the
interface, struct or union does not have any field (/interface
attribute), then an empty sequence is returned.

Their code works and mine doesn't. I guess it means either api or
documentation is a bit outdated.

Big thanks for this link!

From: "Bernard Marcelly" <[EMAIL PROTECTED]>
>  To: <[email protected]>
>  Sent: Wednesday, February 27, 2008 10:19 AM
>  Subject: Re: [api-dev] Enums and COM/Automation
>  > the simplest way to find the value is to use a simple Basic program.
>  > Example :
>  >
>  > Sub Main
>  >    print com.sun.star.sheet.Border.LEFT
>  > End Sub

Thanks. I guess it's the simplest way.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to