String ident = value.getStringValue();
if (ident.equalsIgnoreCase("auto"))
{
return CSSAutoValue.getInstance();
}
final PageSize ps = PageSizeFactory.getInstance().getPageSizeByName(ident);
if (ps == null)
{
return null;
}
value = value.getNextLexicalUnit();
int pageOrientation = PageFormat.PORTRAIT;
if (value != null)
{
if (value.getLexicalUnitType() != LexicalUnit.SAC_IDENT)
{
return null;
}
if (value.getStringValue().equalsIgnoreCase("landscape"))
{
pageOrientation = PageFormat.LANDSCAPE;
}
else if (value.getStringValue().equalsIgnoreCase("reverse-landscape"))
{
pageOrientation = PageFormat.REVERSE_LANDSCAPE;
}
else if (value.getStringValue().equalsIgnoreCase("portrait"))
{
pageOrientation = PageFormat.PORTRAIT;
}
else
{
return null;
}
}
if (pageOrientation == PageFormat.LANDSCAPE ||
pageOrientation == PageFormat.REVERSE_LANDSCAPE)
{
return new CSSValuePair(CSSNumericValue.createPtValue(ps.getHeight()),
CSSNumericValue.createPtValue(ps.getWidth()));
}
else
{
return new CSSValuePair(CSSNumericValue.createPtValue(ps.getWidth()),
CSSNumericValue.createPtValue(ps.getHeight()));
}
}
else
{
final CSSNumericValue horizontalWidth = (CSSNumericValue) parseWidth(value);