On Mon, 14 Oct 2019 21:02:10 +0200, Johnny Rosenberg <[email protected]>
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
> *SomeRange.createSearchDescriptor()*.
>
> 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.
Best regards
--
To unsubscribe e-mail to: [email protected]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy