Hallo zusammen,
mit dem Service
kann man auf die aktuell in Calc verwendeten Funktionen zugreifen.
Über den Service
unter Verwendung von
kann man erst die aktuellen
LastFunctions auslesen um sie dann mit dem
Code: Alles auswählen
"com.sun.star.configuration.ConfigurationUpdateAccess"
zu ändern.
Ich habe das ganze in ein Makro mit
Laufzeitdialog gepackt, da braucht man nur die wegzuklicken, die man beim nächsten Start von OpenOffice nicht mehr haben möchte.

- lstF.png (30.91 KiB) 5512 mal betrachtet
Hier der Code mit Laufzeitdialog:
Code: Alles auswählen
Sub S_dialog_LastFunctions
Dim objConfigProvider as Object
Dim objRegistryKeyContent as Object
Dim argProperty(0) as new com.sun.star.beans.PropertyValue
dim alf (1,0) as variant
oFunctionDescriptions = createUnoService("com.sun.star.sheet.FunctionDescriptions")
'Initialisierung
objConfigProvider = createUnoService("com.sun.star.configuration.ConfigurationProvider")
argProperty(0).Name = "nodepath"
argProperty(0).Value = "org.openoffice.Office.Calc"
objRegistryKeyContent = objConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess" , argProperty())
aLastFunctions = objRegistryKeyContent.Input.LastFunctions
for i = 0 to ubound (aLastFunctions)
redim preserve alf (1,i)
afunction = oFunctionDescriptions.getbyiD(aLastFunctions(i))
alf (0,i) = aLastFunctions(i)'ID
alf (1,i) = afunction(2).value'Name
next i
odlgLFModel = CreateUnoService("com.sun.star.awt.UnoControlDialogModel")
With odlgLFModel
.setPropertyValue("PositionX", 286)
.setPropertyValue("PositionY", 155 )
.setPropertyValue("FontName", Font)
.setPropertyValue("Width", 90)
.setPropertyValue("Height", 146)
.setPropertyValue("Title", "aktuelle lastfunctions")
.setPropertyValue("Name", "dlgLF")
'.setPropertyValue("DesktopAsParent", True )
End With
odlgLF = CreateUnoService("com.sun.star.awt.UnoControlDialog")
for i = 0 to ubound(alf,2)
REM ********** Textlabel erzeugen
oMod = odlgLFModel.createInstance("com.sun.star.awt.UnoControlFixedTextModel")
With oMod
.setPropertyValue("Label", alf(1,i))
.setPropertyValue("Name", "lbl"+i)
.setPropertyValue("PositionX", 10)
.setPropertyValue("PositionY", (10*i)+15)
.setPropertyValue("Height",8)
.setPropertyValue("Width", 50)
End With
odlgLFModel.insertByName("lbl"+i, oMod)
oMod = odlgLFModel.createInstance( "com.sun.star.awt.UnoControlCheckBoxModel")
With oMod
.setPropertyValue("Name", "chk"+i)
.setPropertyValue("PositionX", 65)
.setPropertyValue("PositionY", (10*i)+15)
.setPropertyValue("Height",8)
.setPropertyValue("Width", 8)
.setPropertyValue("State", 0)
End With
odlgLFModel.insertByName("chk"+i, oMod)
next i
odlgLFModel.Height = (i*10)+50
oMod = odlgLFModel.createInstance("com.sun.star.awt.UnoControlButtonModel")
With oMod
.setPropertyValue("Label", "OK ausgewählte"+chr(13)+"löschen")
.setPropertyValue("Name", "cmd1")
.setPropertyValue("PositionX", 10)
.setPropertyValue("PositionY", (i*10)+20)
.setPropertyValue("Height", 20)
.setPropertyValue("Width", 70)
.setPropertyValue("FontHeight",9)
.setPropertyValue("FocusOnClick",false)
.setPropertyValue("PushButtonType",1)
End With
odlgLFModel.insertByName("cmd1", oMod)
odlgLF.setModel(odlgLFModel)
ocmd1 = odlgLF.getcontrol("cmd1")
oWindow = CreateUnoService("com.sun.star.awt.Toolkit")
odlgLF.createPeer(oWindow, null)
odlgLF.execute
REM ********** Mittels des Modells den Dialog anzeigen
redim preserve alf (2,i-1)
for k = 0 to i-1
ochk = odlgLF.getcontrol("chk"+k)
alf(2,k) = ochk.state
next k
objRegistryKeyContent = objConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess" , argProperty())
ncounter = 0
for l = 0 to ubound(alf,2)
if alf(2,l) = 0 then
redim preserve aLastFunctions(ncounter)
aLastFunctions(ncounter) = alf(0,l)
ncounter = ncounter + 1
else
bchanged = true
endif
next l
if bchanged then
With objRegistryKeyContent
.Input.LastFunctions = aLastFunctions
.CommitChanges
End With
msgbox ("Damit die Änderung wirksam wird,"+chr(13)+"ist ein Neustart von OpenOffice/LibreOffice erforderlich.",64,"Ausgewählte ""lastFunctions"" gelöscht !")
endif
end sub
Gruß R