XPropertySet xFieldProps = (XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class, mxDocFactory.createInstance (
"com.sun.star.text.TextField.GetReference" ) );
// Get the XReferenceMarksSupplier interface of the document
XReferenceMarksSupplier xRefSupplier = ( XReferenceMarksSupplier )
UnoRuntime.queryInterface( XReferenceMarksSupplier.class, mxDoc );
// Get an XNameAccess which refers to all inserted reference marks
XNameAccess xMarks = ( XNameAccess ) UnoRuntime.queryInterface (
XNameAccess.class, xRefSupplier.getReferenceMarks() );
// Put the names of each reference mark into an array of strings
String[] aNames = xMarks.getElementNames();
// Make sure that at least 1 reference mark actually exists