The following method works just fine to get a FontDescriptor for a Writer document’s ApplicationFont. However, I can find no documentation that supports getting the ApplicationFont using a getter, i.e. by calling xStyleSettings.getApplicationFont()
. The XStyleSettings Interface Reference says nothing about such a method. The only indication that this is legit, aside from it working, is that the Eclipse IDE automatically displays a popup menu when typing the period following xStyleSettings
that includes it as an option for selection in a long list of getters and setters.
protected FontDescriptor getAppFontDescriptor (XModel xDoc) {
XStyleSettingsSupplier xStyleSettingsSupplier = UnoRuntime.queryInterface(XStyleSettingsSupplier.class, xDoc.getCurrentController().getFrame().getContainerWindow());
XStyleSettings xStyleSettings = xStyleSettingsSupplier.getStyleSettings();
return xStyleSettings.getApplicationFont();
}
This method is something I added three years ago to an extension I’ve recently started working on again. Unfortunately, I can’t remember where I got the method, whether I adapted it from some other code or blundered my way into getting it working on my own with the help of Eclipse. Since I’d like to avoid relying on an undocumented API feature, I’m forced to ask… Can anyone point me to some documentation to support the use of getters with XStyleSettings?