[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libreoffice-users] Experimental macro features: How to determine object types?
- Subject: Re: [libreoffice-users] Experimental macro features: How to determine object types?
- From: "Mauricio Baeza" <firstname.lastname@example.org>
- Date: Mon, 14 Oct 2019 14:43:42 -0500 (CDT)
- To: "users" <email@example.com>
On Mon, 14 Oct 2019 21:02:10 +0200, Johnny Rosenberg <firstname.lastname@example.org> wrote:
> When using the experimental features in Basic I can declare thing in a more
> specific way, for instance:
> *Dim SomeSheet As com.sun.star.sheet.XSpreadsheet*
> Without the experimental features enabled, I had to write this instead:
> *Dim SomeSheet As Object*
> Is there a way to find out for sure what type some object is supposed to be?
> For instance, if I use Object instead and then look at it with XRay, in the
> field just above the big field with all the
> properties/methods/services/etc, it says *com.sun.star.sheet.XSpreadsheet*,
> so that could be a clue, but it doesn't seem to always be usable.
> For instance, when declaring a range, XRay says
> *com.sun.star.table.XCellRange*, but declaring it like that won't work.
> *com.sun.star.sheet.XSheetCellRange* will. How can I figure this out?
> At the moment I'm struggling with a search descriptor. XRay says
> *com.sun.star.util.XSearchDescriptor*, but that only throws an error at
> In case anyone wonders why I'm not just declaring it as *Object*, the
> answer is because I want to learn these experimental features. I'm not
> solving some kind of problem with it at the moment, just trying to learn
> about it, which is hard since I can't find any examples, since everybody
> declare everything as *Object* and *Variant*…
> I'm obviously looking at this the completely wrong way. Is anyone able to
> point me in the right direction somehow?
> I'm not a coder, so pointing me to the source code is meaningless. I
> wouldn't understand anything of it, or at least not quickly enough to not
> just give up.
For use a type variable, this type should be "exposed" in the core, by example:
Dim s As String
Dim SomeSheet As com.sun.star.sheet.XSpreadsheet
But, if the type it's not present in core, you always get: "Unknown data", for example:
Dim sd As com.sun.start.util.SearchDescriptor
For this cases, we used Object.
Now, some objects, only can be instance from other objects, like SearchDescriptor
Dim sd As Object
doc = ThisComponent
sd = doc.createSearchDescriptor()
I hope clarify your question, and I hope have understand your question.
To unsubscribe e-mail to: email@example.com
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
|[libreoffice-users] Experimental macro features: How to determine object types?||Johnny Rosenberg <firstname.lastname@example.org>|
- Prev by Date: [libreoffice-users] Experimental macro features: How to determine object types?
- Next by Date: Re: [libreoffice-users] Experimental macro features: How to determine object types?
- Previous by thread: [libreoffice-users] Experimental macro features: How to determine object types?
- Next by thread: Re: [libreoffice-users] Experimental macro features: How to determine object types?