/* This algorithm is mostly documented at XSL-FO Recommendation 1.1,
* Section 5.3.2, but see also Sections 7.11.7 (start-indent property)
* and 7.11.8 (end-indent property). */
/* Find the corresponding absolute margin if it is specified. */
final FoProperty rawMarginPropertyType =
AbstractIndent.rawAbsoluteCorrespondingPropertyType(
fobj, context, direction);
final AbstractMargin abstractMargin = (AbstractMargin)
getProperty(rawMarginPropertyType);
/* The intent of the algorithm seems to be that, if the absolute margin
* is set and the relative indent property is not, and if this FO
* generates a reference area, the relative indent property is
* ignored.*/
if (abstractMargin != null) {
/* The corresponding absolute margin is specified. */
int indent = 0;
if (! fobj.traitIsReferenceArea()) {
/* Start with the inherited relative value. */
indent += AbstractIndent.getValueNoInstance(context, fobj,
direction);
}
indent += abstractMargin.getValue(context, fobj);
/* TODO: Do the padding and border-width values below actually
* qualify as "padding-corresponding" and "border-corresponding" as
* specified? Or do we need to look for the properties using just
* the absolute properties? */
indent += this.getPadding(fobj, context, direction);
indent += this.getBorderWidth(fobj, context, direction);
return indent;
}
/* If we got this far, it means that the corresponding absolute margin
* was not specified, so we just need to find the right relative
* indent value and return it. */
AbstractIndent indent = null;
final FoProperty rawPropertyType = AbstractIndent.rawPropertyType(
direction);
indent = (AbstractIndent) getProperty(rawPropertyType);
if (indent == null) {
return AbstractIndent.getValueNoInstance(context, fobj, direction);
}