OdfOfficeStyles styles = getStylesDom().getOfficeStyles();
// get language and country setting from default style setting for
// paragraph
OdfDefaultStyle defaultStyle = styles.getDefaultStyle(OdfStyleFamily.Paragraph);
if (defaultStyle != null) {
if (defaultStyle.hasProperty(countryProp) && defaultStyle.hasProperty(languageProp)) {
ctry = defaultStyle.getProperty(countryProp);
lang = defaultStyle.getProperty(languageProp);
return new Locale(lang, ctry);
}
}
// if no default style setting for paragraph
// get language and country setting from other default style settings
Iterable<OdfDefaultStyle> defaultStyles = styles.getDefaultStyles();
Iterator<OdfDefaultStyle> itera = defaultStyles.iterator();
while (itera.hasNext()) {
OdfDefaultStyle style = itera.next();
if (style.hasProperty(countryProp) && style.hasProperty(languageProp)) {
ctry = style.getProperty(countryProp);
lang = style.getProperty(languageProp);
return new Locale(lang, ctry);
}
}
return null;
}