Code: Alles auswählen
' ms777 Mon Mar 20, 2006 11:47 pm
' http://www.oooforum.org/forum/viewtopic.phtml?t=33521
' AcceptAllChanges
'
' lauffähig mit den deutschen Übersetzungen von OOo 2.4.1
sub writer_akzeptierenAenderungen
oFrame = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(oFrame, ".uno:AcceptTrackedChanges", "", 0, Array())
'oWin = GetWindowOpen("Accept")
' 2008-10-12 deutsch
oWin = GetWindowOpen("Änderungen akzeptieren oder verwerfen")
with com.sun.star.accessibility.AccessibleRole
oACPanel = SearchOneSecForChild(oWin.AccessibleContext, "", "", .PANEL)
oACPanelTab = SearchOneSecForChild(oACPanel, "", "", .PAGE_TAB_LIST)
' 2008-10-12 deutsch
' List
oACPanelTabPage = SearchOneSecForChild(oACPanelTab, "Liste", "", .PAGE_TAB)
oACPanelTabPagePanel = SearchOneSecForChild(oACPanelTabPage, "", "", com.sun.star.accessibility.AccessibleRole.PANEL )
' 2008-10-12 deutsch
' Accept All
oACPanelTabPagePanelAcceptAll = SearchOneSecForChild(oACPanelTabPagePanel, "Alle akzeptieren", "", com.sun.star.accessibility.AccessibleRole.PUSH_BUTTON )
end with
oACPanelTabPagePanelAcceptAll.doAccessibleAction(0)
dispatcher.executeDispatch(oFrame, ".uno:AcceptTrackedChanges", "", 0, Array())
end sub
function SearchOneSecForChild(oAC as Object, sName as String, sDescription as String, lRole as Long) as Object
for k=1 to 50
oRes = SearchForChild(oAC, sName, sDescription, lRole)
if not IsNull(oRes) then
SearchOneSecForChild = oRes
exit function
endif
wait(20)
next k
end function
function SearchForChild(oAC as Object, sName as String, sDescription as String, lRole as Long) as Object
for k=0 to oAC.AccessibleChildCount-1
oACChild = ACRealChild(oAC.getAccessibleChild(k))
boFound = true
if sName<>"" then boFound = boFound and (oACChild.AccessibleName = sName)
if sDescription<>"" then boFound = boFound and (oACChild.AccessibleDescription = sDescription)
if lRole > -1 then boFound = boFound and (oACChild.AccessibleRole = lRole)
if boFound then
SearchForChild = oACChild
exit function
endif
next k
end function
function ACRealChild(oACChild as Object) as Object
if HasUnoInterfaces(oACChild, "com.sun.star.accessibility.XAccessibleContext") then
ACRealChild = oACChild
exit function
endif
if not HasUnoInterfaces(oACChild, "com.sun.star.accessibility.XAccessibleContext") then
if HasUnoInterfaces(oACChild, "com.sun.star.accessibility.XAccessible") then
ACRealChild = oACChild.AccessibleContext
else
exit function ' unexpected situation, maybe caused by some intermediate state
endif
endif
end function
function GetWindowOpen(sTitle as String) as Object
oToolkit = Stardesktop.ActiveFrame.ContainerWindow.Toolkit
lCount = oToolkit.TopWindowCount
for k=0 to lCount -1
oWin = oToolkit.getTopWindow(k)
if HasUnoInterfaces(oWin, "com.sun.star.awt.XDialog") then
if left(oWin.Title, len(sTitle)) = sTitle then
GetWindowOpen = oWin
exit function
endif
endif
next k
end function
Viel Erfolg, Michael!