I'm currently working on an extension (OpenOffice Basic, AOO 4.x, Linux+Windows), that will change some keyboard bindings. The user shall have the option to switch these binding on and off at any time, choosing between the customising feature and the standard behaviour. I need a way to display the current status of that switch, i.e. the user shall be able to see at one glance, if the feature is currently active or not.
The natural choice seems to be to add a custom item to the statusbar, displaying a string like 'Feature On' or 'Feature Off'. I did manage to add a generic item to the statusbar in two ways, either by adding an entry to .openoffice/4/user/config/soffice.cfg/modules/swriter/statusbar/statusbar.xml
Code: Select all
<statusbar:statusbaritem xlink:href="::com::sun::star::statusbar" statusbar:width="100" statusbar:style="in"/>
Code: Select all
Sub createStatusBarEntry()
Dim aSetting(3) as New com.sun.star.beans.PropertyValue
aSetting(0).name = "CommandURL"
aSetting(0).value = "vnd.sun.star.script:StatusBar.StatusBar.onDoubleClick?language=Basic&location=application"
aSetting(1).name = "Width"
aSetting(1).value = 100
aSetting(2).name = "Offset"
aSetting(2).value = 5
aSetting(3).name = "Style"
aSetting(3).value = 10
oStatusBar = ThisComponent.currentcontroller.frame.layoutmanager.getElement("private:resource/statusbar/statusbar")
aSettings = oStatusBar.getSettings(True)
aSettings.insertByIndex(0,aSetting)
oStatusBar.setSettings(aSettings)
oStatusBar.updateSettings()
End Sub
Code: Select all
<statusbar:statusbaritem xlink:href="::com::sun::star::statusbar" statusbar:width="100" statusbar:style="in" text="Feature On" AccessibleName="Feature On" TitledBorderText="Feature On"/>
Code: Select all
Sub createStatusBarEntry()
Dim aSetting(6) as New com.sun.star.beans.PropertyValue
aSetting(0).name = "CommandURL"
aSetting(0).value = "vnd.sun.star.script:StatusBar.StatusBar.onDoubleClick?language=Basic&location=application"
aSetting(1).name = "Width"
aSetting(1).value = 100
aSetting(2).name = "Offset"
aSetting(2).value = 5
aSetting(3).name = "Style"
aSetting(3).value = 10
aSetting(4).name = "Text"
aSetting(4).value = "Feature On"
aSetting(5).name = "AccessibleName"
aSetting(5).value = "Feature On"
aSetting(6).name = "TitledBorderText"
aSetting(6).value = "Feature On"
oStatusBar = ThisComponent.currentcontroller.frame.layoutmanager.getElement("private:resource/statusbar/statusbar")
aSettings = oStatusBar.getSettings(True)
aSettings.insertByIndex(0,aSetting)
oStatusBar.setSettings(aSettings)
oStatusBar.updateSettings()
End Sub
Code: Select all
oStatusBar.realinterface.accessiblecontext.getaccessiblechild(0).Text
The documentation https://wiki.openoffice.org/wiki/Framew ... Controller says, that a generic item is a text field, so there must be a way to fill it.
I browsed through all methods of all reported interfaces, but I couldn't find a suitable candidate to set the text. I also could not find a way to retrieve an object, that supports the XStatusbarItem interface, an interface that, according to the documentation, should allow to set the item text.
Does anybody have idea what I'm missing?
Is it possible, that I have to implement some event handler to set the text for the passed event object? In that case, what would be the correct handler?
Thanks, and best regards,
ah8