ImplementationID

Creating a macro - Writing a Script - Using the API

ImplementationID

Postby JeJe » Sun Jan 31, 2021 4:53 pm

Is the implementationID unique to every instance of an object?

There looks to be no way of identifying an object like a controller or a component window from its properties (ie which controller or which component window)... except possibly the implementationID if its unique to the object?

The documentation just says this... does anyone understand it enough to answer my query?

getImplementationId
sequence< byte >
getImplementationId();

Description
returns a sequence of bytes with length > 0 that is used as an Id to distinguish unambiguously between two sets of types, e.g. to realise hashing functionality when the object is introspected. Two objects that return the same UUID also have to return the same set of types in getTypes(). If a unique implementation Id cannot be provided this method has to return an empty sequence. Important: If the object aggregates other objects the UUID has to be unique for the whole combination of objects.




https://www.openoffice.org/api/docs/com ... vider.html
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1498
Joined: Wed Mar 09, 2016 2:40 pm

Re: ImplementationID

Postby JeJe » Sun Jan 31, 2021 5:14 pm

Saying a little more... I can create a non-modal dialog setting a component window as the parent. But when I examine the window it gives void as the parent. So, I'm looking for an identifier for the component window or controller which I can store in a hidden label or something in the dialog so I can find which controller the dialog belongs to. getImplementationId is the only candidate.

Edit:
(There will be more complicated workarounds, but a unique identifier would be simple, if the ImplementationId is one)

Edit2: there's the frame title but that can change eg when Page Preview is shown making that complicated.

Edit 3: As is storing global variables when I might have a number of these dialogs.
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1498
Joined: Wed Mar 09, 2016 2:40 pm

Re: ImplementationID

Postby Villeroy » Sun Jan 31, 2021 8:00 pm

There is a frame name.
objFrame.setName(strName)
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
User avatar
Villeroy
Volunteer
 
Posts: 29554
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: ImplementationID

Postby JeJe » Sun Jan 31, 2021 8:30 pm

Great thanks, that seems to work! How did I miss that!

I'll leave the thread open in case anyone can answer the original query



Code: Select all   Expand viewCollapse view
'NOTE:incomplete code
'framename = whatever
thiscomponent.currentcontroller.frame.setname framename
'create non model dialog and set a label to the frame name
dlg.getcontrol("Label1").model.label =framename

'**************************************************
'later find the dialog again for the currentcontroller by going through all
'the top windows and looking for one with the right title and then a label with the framename

framename = thiscomponent.currentcontroller.frame.getname
t= thiscomponent.currentcontroller.frame.containerwindow.gettoolkit
for i = 0 to t.gettopwindowcount -1
if t.gettopwindow(i).accessiblecontext.gettitledbordertext = "Find" then  'get dialog title here is find
if t.gettopwindow(i).windows(5).accessiblecontext.text  = framename then 'the label is window 5 in the dialog
msgbox "found" & framename
exit for
end if
end if
next



Edit: There might be an issue if something else changes the frame name - say someone else using the same trick in an extension.
I'm guessing that's very unlikely though.
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1498
Joined: Wed Mar 09, 2016 2:40 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 9 guests