double width = 0;
double height = 0;
if(size instanceof PageSize)
{
final PageSize pageSize = (PageSize)size;
width = pageSize.getWidth();
height = pageSize.getHeight();
}
else if(RTF_LANDSCAPE.equals(size))
{
if (styleKey.equals(RTF_PAGEWIDTH))
{
height = twipToInt(floatValue);
}
else
{
width = twipToInt(floatValue);
}
}
else
{
if (styleKey.equals(RTF_PAGEWIDTH))
{
width = twipToInt(floatValue);
}
else
{
height = twipToInt(floatValue);
}
}
attr.addAttribute(PAGE_RULE_TYPE, PageStyleKeys.SIZE.getName(), new PageSize(width, height));
}
else if(styleKey.equals(RTF_MARGINLEFT))
{
final float floatValue = ((Float) value).floatValue();
attr.addAttribute(PAGE_RULE_TYPE, BoxStyleKeys.MARGIN_LEFT.getName(), CSSNumericValue.createValue(CSSNumericType.PT, floatValue));
}
else if(styleKey.equals(RTF_MARGINRIGHT))
{
final float floatValue = ((Float) value).floatValue();
attr.addAttribute(PAGE_RULE_TYPE, BoxStyleKeys.MARGIN_RIGHT.getName(), CSSNumericValue.createValue(CSSNumericType.PT, floatValue));
}
else if(styleKey.equals(RTF_MARGINTOP))
{
final float floatValue = ((Float) value).floatValue();
attr.addAttribute(PAGE_RULE_TYPE, BoxStyleKeys.MARGIN_TOP.getName(), CSSNumericValue.createValue(CSSNumericType.PT, floatValue));
}
else if(styleKey.equals(RTF_MARGINBOTTOM))
{
final float floatValue = ((Float) value).floatValue();
attr.addAttribute(PAGE_RULE_TYPE, BoxStyleKeys.MARGIN_BOTTOM.getName(), CSSNumericValue.createValue(CSSNumericType.PT, floatValue));
}
else if(styleKey.equals(RTF_LANDSCAPE))
{
final Object size = cssAttr.getAttribute(PageStyleKeys.SIZE.getName());
if(size instanceof PageSize)
{
final PageSize pageSize = (PageSize)size;
attr.addAttribute(PAGE_RULE_TYPE, PageStyleKeys.SIZE.getName(), new PageSize(pageSize.getHeight(), pageSize.getWidth()));
}
else
{
attr.addAttribute(PAGE_RULE_TYPE, PageStyleKeys.SIZE.getName(), RTF_LANDSCAPE);
}