* @author Markus Kr�ger
* @date 25.07.2007
*/
public INumberFormat[] getNumberFormats(short type) throws UtilException {
try {
XNumberFormats xNumberFormats = xNumberFormatsSupplier
.getNumberFormats();
XPropertySet docProps = (XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class, textDocument.getXTextDocument());
Locale docLocale = (Locale) docProps.getPropertyValue("CharLocale");
// XNumberFormatTypes numberFormatTypes =
// (XNumberFormatTypes)UnoRuntime.queryInterface(XNumberFormatTypes.class,
// xNumberFormats);
int[] keys = xNumberFormats.queryKeys(type, docLocale, true);
List<INumberFormat> formats = new ArrayList<INumberFormat>();
boolean additionalCurrenciesSet = false;
for (int i = 0; i < keys.length; i++) {
int key = keys[i];
XPropertySet xProp = xNumberFormats.getByKey(key);
if (((Short) xProp.getPropertyValue("Type")).equals(new Short(
com.sun.star.util.NumberFormat.CURRENCY))
&& !additionalCurrenciesSet) {
for (int j = 0; j < ADDITIONAL_CURRENCY_KEYS.length; j++) {
XPropertySet xPropAdd = xNumberFormats
.getByKey(ADDITIONAL_CURRENCY_KEYS[j]);
formats.add(new NumberFormat(
ADDITIONAL_CURRENCY_KEYS[j], xPropAdd, this));
}
additionalCurrenciesSet = true;