Which method should we used in place of getDocumentInfo() in libreoffice 4?

This works fine with openoffice to save data in custom properties but failed in libreoffice4.
XDocumentInfoSupplier is depricated for libreoffice4.
Which method should I use to save data in custom properties of libreoffice4?

xDocumentInfoSupplier = (XDocumentInfoSupplier) UnoRuntime.queryInterface(XDocumentInfoSupplier.class, IDSManager.xSpreadsheetDocument);
docInfo = xDocumentInfoSupplier.getDocumentInfo();

See relevant release notes.

Thanks, Mike.

But my problem is XDocumentProperties interface does not contain any method which saves the data in custom properties of LibreOffice like getDocumentInfo() do in OpenOffice.

It gives you access to them via getUserDefinedProperties().

But how should we add them in custom properties?

This code in StarBASIC works for me:

d = ThisComponent
dp = d.getDocumentProperties()
up = dp.getUserDefinedProperties()
If (Not up.getPropertySetInfo().hasPropertyByName("MyPropName")) Then
  up.addProperty("MyPropName", 1, "")
EndIf
up.setPropertyValue("MyPropName", "5")

The changed value isn’t visible until save-and-reload though.