Hi,
You can use the following example to listen for slide's name changing.
This is a starbasic example, but the same things can be done with Java.
However it remains a problem : if you add new slides, they are not taken in
account.
option explicit
sub main
dim windows as object
dim slideSorterView as object
dim winIndex as long
dim childIndex as long
dim accessibleContext as object
dim slideListener as object
windows = thisComponent.currentController.frame.componentWindow.windows
winIndex = lbound(windows)
while ((winIndex <= ubound(windows)) and isNull(slideSorterView))
slideSorterView =
_getAccessibleChildByImplementationName(windows(winIndex),
"AccessibleSlideSorterView")
winIndex = winIndex + 1
wend
if (not isNull(slideSorterView)) then
slideListener = createUnoListener("_slideRenamedList_",
"com.sun.star.accessibility.XAccessibleEventListener")
accessibleContext = slideSorterView.accessibleContext
for childIndex = 0 to (accessibleContext.accessibleChildCount -
1)
accessibleContext.getAccessibleChild(childIndex).addEventListener(slideListener)
next
end if
end sub
function _getAccessibleChildByImplementationName(accessibleObject as object,
implementationName as string) as object
dim result as object
dim accessibleContext as object
dim accessibleChildIndex as long
dim accessibleChild as object
dim impName as string
accessibleContext = accessibleObject.accessibleContext
on local error goto errImpName
impName = accessibleContext.implementationName
errImpName:
if (impName = implementationName) then
result = accessibleObject
else
while ((accessibleChildIndex <
accessibleContext.accessibleChildCount) and isNull(result))
result =
_getAccessibleChildByImplementationName(accessibleContext.getAccessibleChild(accessibleChildIndex),
implementationName)
accessibleChildIndex = accessibleChildIndex + 1
wend
end if
_getAccessibleChildByImplementationName = result
end function
sub _slideRenamedList_notifyEvent(event as
com.sun.star.accessibility.AccessibleEventObject)
if (event.eventId =
com.sun.star.accessibility.AccessibleEventId.NAME_CHANGED) then
msgbox("Slide <" & event.oldValue & "> was renamed as <" &
event.newValue & "> !")
end if
end sub
sub _slideRenamedList_disposing(event as com.sun.star.lang.EventObject)
end sub
Regards,
Thibault.
----- Mail Original -----
De: "Marek Kliś" <[email protected]>
À: [email protected]
Envoyé: Mardi 27 Juillet 2010 11:17:21
Objet: [api-dev] Impress - slide change name event
Hi,
How can I listen for slide's name changing. Is it possible?
I use OOoBean in Java. OO 3.2.1 on Windows.
--
Regards
Marek Kliś
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]