org.apache.fop.render.intermediate

## Class IFContext

- java.lang.Object
- - org.apache.fop.render.intermediate.IFContext

All Implemented Interfaces:
  PageIndexContext

    public class IFContext
    extends Object
    implements PageIndexContext

This class provides a context object that is valid for a single processing run to create an output file using the intermediate format. It allows access to the user agent and other context information, such as foreign attributes for certain elements in the intermediate format.

Foreign attributes are usually specific to a particular output format implementation. Most implementations will just ignore all foreign attributes for most elements. That's why the main IF interfaces are not burdened with this.

### Constructor Summary

Constructors
Constructor and Description
`IFContext(FOUserAgent ua)` Main constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`Object` `getForeignAttribute(org.apache.xmlgraphics.util.QName qName)` Returns a foreign attribute.
`Map` `getForeignAttributes()` Returns the currently applicable foreign attributes.
`Locale` `getLanguage()` Returns the currently applicable language.
`String` `getLocation()` Returns the location of the object enclosing the current content.
`int` `getPageIndex()` Obtain current page index.
`int` `getPageNumber()`
`String` `getRegionType()`
`StructureTreeElement` `getStructureTreeElement()` Returns the current structure tree element.
`FOUserAgent` `getUserAgent()` Returns the associated user agent.
`boolean` `isHyphenated()` Returns `true` if the last text in the currently processed text area is hyphenated.
`void` `resetForeignAttributes()` Resets the foreign attributes to "no foreign attributes".
`void` `resetStructureTreeElement()` Resets the current structure tree element.
`void` `setForeignAttributes(Map foreignAttributes)` Sets the currently applicable foreign attributes.
`void` `setHyphenated(boolean hyphenated)` Records that the last text in the currently processed text area is hyphenated.
`void` `setLanguage(Locale lang)` Sets the currently applicable language.
`void` `setLocation(String location)` Sets the location of the object enclosing the current content.
`void` `setPageIndex(int pageIndex)` Record current page index.
`void` `setPageNumber(int pageNumber)`
`void` `setRegionType(int type)`
`void` `setRegionType(String type)`
`void` `setStructureTreeElement(StructureTreeElement structureTreeElement)` Sets the structure tree element to which the subsequently painted marks will correspond.
`void` `setUserAgent(FOUserAgent ua)` Set the user agent.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### IFContext

    public IFContext(FOUserAgent ua)

Main constructor.

Parameters:
  `ua` - the user agent

### Method Detail

#### setUserAgent

    public void setUserAgent(FOUserAgent ua)

Set the user agent.

Parameters:
  `ua` - the user agent

#### getUserAgent

    public FOUserAgent getUserAgent()

Returns the associated user agent.

Returns:
  the user agent

#### getForeignAttributes

    public Map getForeignAttributes()

Returns the currently applicable foreign attributes.

Returns:
  a Map<QName, Object>

#### getForeignAttribute

    public Object getForeignAttribute(org.apache.xmlgraphics.util.QName qName)

Returns a foreign attribute.

Parameters:
  `qName` - the qualified name of the foreign attribute
Returns:
  the value of the foreign attribute or null if the attribute isn't specified

#### setForeignAttributes

    public void setForeignAttributes(Map foreignAttributes)

Sets the currently applicable foreign attributes.

Parameters:
  `foreignAttributes` - a Map<QName, Object> or null to reset

#### resetForeignAttributes

    public void resetForeignAttributes()

Resets the foreign attributes to "no foreign attributes".

#### setLanguage

    public void setLanguage(Locale lang)

Sets the currently applicable language.

Parameters:
  `lang` - the language

#### getLanguage

    public Locale getLanguage()

Returns the currently applicable language.

Returns:
  the language (or null if the language is undefined)

#### setStructureTreeElement

    public void setStructureTreeElement(StructureTreeElement structureTreeElement)

Sets the structure tree element to which the subsequently painted marks will correspond. This method is used when accessibility features are enabled.

Parameters:
  `structureTreeElement` - the structure tree element

#### resetStructureTreeElement

    public void resetStructureTreeElement()

Resets the current structure tree element.

See Also:
  `setStructureTreeElement(StructureTreeElement)`

#### getStructureTreeElement

    public StructureTreeElement getStructureTreeElement()

Returns the current structure tree element.

Returns:
  the structure tree element (or null if no element is active)
See Also:
  `setStructureTreeElement(StructureTreeElement)`

#### setLocation

    public void setLocation(String location)

Sets the location of the object enclosing the current content. location the line and column location of the object in the source FO file

#### getLocation

    public String getLocation()

Returns the location of the object enclosing the current content.

Returns:
  the line and column location of the object in the source FO file, `null` if that information is not available

#### setHyphenated

    public void setHyphenated(boolean hyphenated)

Records that the last text in the currently processed text area is hyphenated.

#### isHyphenated

    public boolean isHyphenated()

Returns `true` if the last text in the currently processed text area is hyphenated.

#### setPageIndex

    public void setPageIndex(int pageIndex)

Record current page index.

Parameters:
  `pageIndex` - a zero based page index or -1 (no page)

#### getPageIndex

    public int getPageIndex()

Obtain current page index.

Specified by:
  `getPageIndex` in interface `PageIndexContext`
Returns:
  a zero based page index or -1 (no page)

#### getPageNumber

    public int getPageNumber()

#### setPageNumber

    public void setPageNumber(int pageNumber)

#### getRegionType

    public String getRegionType()

#### setRegionType

    public void setRegionType(String type)

#### setRegionType

    public void setRegionType(int type)