xCellFormatSupplier.getCellFormatRanges() );
XEnumeration xRanges = xEnumerationAccess.createEnumeration();
// create an AnyConverter for later use
AnyConverter aAnyConv = new AnyConverter();
while( xRanges.hasMoreElements() ) {
// the enumeration returns a cellrange
XCellRange xCellRange = (XCellRange) UnoRuntime.queryInterface(
XCellRange.class, xRanges.nextElement());
// the PropertySet the get and set the properties from the cellrange
XPropertySet xCellProp = (XPropertySet)UnoRuntime.queryInterface(
XPropertySet.class, xCellRange );
// getPropertyValue returns an Object, you have to cast it to
// type that you need
Object oNumberObject = xCellProp.getPropertyValue( "NumberFormat" );
int iNumberFormat = aAnyConv.toInt(oNumberObject);
// get the properties from the cellrange numberformat
XPropertySet xFormat = (XPropertySet)
xNumberFormats.getByKey(iNumberFormat );
short fType = aAnyConv.toShort(xFormat.getPropertyValue("Type"));
String sCurrencySymbol = aAnyConv.toString(
xFormat.getPropertyValue("CurrencySymbol"));
// change the numberformat only on cellranges with a
// currency numberformat
if( ( (fType & com.sun.star.util.NumberFormat.CURRENCY) > 0) &&
( sCurrencySymbol.compareTo( sOldSymbol ) == 0 ) ) {
boolean bThousandSep = aAnyConv.toBoolean(
xFormat.getPropertyValue("ThousandsSeparator"));
boolean bNegativeRed = aAnyConv.toBoolean(
xFormat.getPropertyValue("NegativeRed"));
short fDecimals = aAnyConv.toShort(
xFormat.getPropertyValue("Decimals"));
short fLeadingZeros = aAnyConv.toShort(
xFormat.getPropertyValue("LeadingZeros"));
Locale oLocale = (Locale) aAnyConv.toObject(
new com.sun.star.uno.Type(Locale.class),
xFormat.getPropertyValue("Locale"));
// create a new numberformat string
String sNew = xNumberFormats.generateFormat( iSimpleKey,