Where can I find CurrentSelection in the API documentation?

Hi everyone,
.
I was wondering if someone could point me to the documentation for the CurrentSelection object. When I search for CurrentSelection in the API documentation (LibreOffice: Main Page), it doesn’t find it (although there is a method called GetCurrentSelection).
.
As with my other current question, I’m not trying to solve a specific problem, so I don’t need any concrete advice or help, I’d just like to see the documentation.
.
Thanks!

Here it is:

https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1frame_1_1XModel.html#a1ee3a9fe564e0757381e23ef1a401eef

But… the current selection can be many different things for Calc, Writer, etc.
That’s why you won’t see anything else there.

.
Thank you for that information. I gather that the syntax of CurrentSelection would be expression.CurrentSelection, where expression represents a LibreOffice document of some type.
.
Would it be correct to assume that all LibreOffice document types (Calc, Base, Impress, Writer) support the CurrentSelection object, even if each document, and indeed each element within a document, would return a different object type for CurrentSelection?

https://wiki.documentfoundation.org/Macros/Basic/Calc/Ranges#Current_selection

Thank you. I had a look at that, and I see that they use the ImplementationName property to return the object type.
.
Can this property be queried on any object to determine the object type, or are there objects which do not have an ImplementationName property (i.e. where attempting to access this property would result in a runtime error)?
.
Also, I see a lot of the object type names beging with “Sc”, for example “ScCellObj”. Does “Sc” stand for “Star Calc” or something else?

according to Hermenutical keys to a complex code-base - Michael Meeks, yep.

image

1 Like

This needs to be fixed. Implementation names are, well, implementation detail, and are not guaranteed to be stable (even though we don’t change then often - but we still do from time to time: see tdf#111811). You need to use other methods, like supportsService UNO method, or HasUnoInterfaces Basic function.

So it would be best to avoid ImplementationName altogether?

Generally yes; and I already corrected the wiki page.

1 Like

.
Sorry to revive this, but while reading through this again, I realized I don’t even know what an implementation name is, so I had a closer look at the Wiki page and the bug you linked to see if I could figure it out.
.
The previous version of the Wiki page shows that implementation names are like “ScTableColumnsObj”. This seems very similar to “ScTableSheetObj”, which is the object type name that you see when you set a watch on the variable oSheet in the expression oSheet = oController.ActiveSheet. Does this mean that the name of the object type in the watch is identical with the implementation name, and this may actually sometimes change?
.
In the bug you linked, there is the following statement: “This broke backward and forward compatibility in some cases and created a new conflict with AOO”. Do I understand correctly that this means The Document Foundation is trying to keep the LibreOffice API compatible with Apache OpenOffice? I didn’t know this was a concern.

Sorry to be a pain, but I think you may have missed something in the Wiki. The example right above the table of supported service names says:

selection = ThisComponent.CurrentSelection
    MsgBox selection.ImplementationName

Shouldn’t that be MsgBox selection.supportsService(_ServiceName_) ?

Sometimes, this is true. Not always.

This may sometimes change, yes. But the link between the object name and implementation name is not unbreakable.

No, we try to keep the API backward-compatible with OpenOffice.org. Since this is also a concern for AOO, the two APIs are largely compatible, too. An example is the API modified independently for sheet-local named ranges, where an awkward API was introduced in AOO, sometime after we already implemented the access by implementing existing interfaces in sheet objects. See discussion in How to access addNewByScopeName() ; I also mention that in How to determine and use Process IDs of the different LibreOffice programs? - #7 by mikekaganski .

I could of course overlook something. Will take a look - thanks.