## FoFo

FoFo — Base formatting object object

## Synopsis

    struct      FoFo;
    struct      FoFoClass;
    #define     FO_FO_ERROR
    GQuark      fo_fo_error_quark               (void);
    enum        FoFoError;
    struct      FoFoAreaNew2Context;
    struct      FoFoAreaIterator;
    FoFo*       fo_fo_new                       (void);
    void        fo_fo_debug_dump_properties     (FoFo *fo,
                                                 gint depth);
    void        fo_fo_set_context               (FoFo *fo_fo,
                                                 FoContext *new_context);
    FoContext*  fo_fo_get_context               (FoFo *fo_fo);
    void        fo_fo_update_from_context       (FoFo *fo_fo,
                                                 FoContext *context);
    FoFo*       fo_fo_get_flow                  (FoFo *fo_fo);
    FoFo*       fo_fo_get_tree                  (FoFo *fo_fo);
    gboolean    fo_fo_get_generate_reference_area
                                                (FoFo *fo_fo);
    gboolean    fo_fo_get_allow_mixed_content   (FoFo *fo_fo);
    gboolean    fo_fo_validate_content          (FoFo *fo,
                                                 GError **error);
    gboolean    fo_fo_resolve_property_attributes
                                                (FoNode *fo_node,
                                                 gpointer data);
    void        fo_fo_children_properties_resolve
                                                (FoFo *this_fo,
                                                 FoArea *this_fo_parent_area,
                                                 FoArea **new_area,
                                                 GHashTable *prop_eval_hash,
                                                 FoDoc *fo_doc,
                                                 gboolean continue_after_error,
                                                 gint debug_level,
                                                 GError **error);
    void        fo_fo_validate                  (FoFo *fo,
                                                 FoContext *current_context,
                                                 FoContext *parent_context,
                                                 GError **error);
    FoFo*       fo_fo_clone                     (FoFo *original);
    void        fo_fo_area_new                  (FoFo *fo,
                                                 FoDoc *fo_doc,
                                                 FoArea *parent_area,
                                                 FoArea **new_area,
                                                 guint debug_level);
    void        fo_fo_area_new2                 (FoFo *fo,
                                                 FoFoAreaNew2Context *context,
                                                 GError **error);
    void        fo_fo_trim_whitespace_children  (FoFo *fo);
    gboolean    fo_fo_validate_content_empty    (FoFo *fo,
                                                 GError **error);
    gboolean    fo_fo_validate_content_block_plus
                                                (FoFo *fo,
                                                 GError **error);
    void        fo_fo_validate_pcdata_or_inline (FoNode *fo_node,
                                                 gboolean *is_not_pcdata_inline);
    void        fo_fo_validate_block_or_whitespace
                                                (FoNode *fo_node,
                                                 gboolean *is_not_block_or_whitespace);
    void        fo_fo_validate_pcdata_inline_block_neutral
                                                (FoNode *fo_node,
                                                 gboolean *is_not_pcdata_inline_block_neutral);
    FoFoAreaIterator* fo_fo_get_area_iterator   (FoFo *fo);
    FoArea*     fo_fo_area_iterator_get_area    (const FoFoAreaIterator *iterator);
    gboolean    fo_fo_area_iterator_next        (FoFoAreaIterator *iterator);

## Object Hierarchy

      GObject
       +----FoObject
             +----FoNode
                   +----FoFo

## Properties

      "allow-mixed-content"  gboolean             : Read
      "context"              FoContext            : Read
      "flow"                 FoFo                 : Read
      "generate-reference-area" gboolean             : Read
      "tree"                 FoFo                 : Read

## Description

## Details

### struct FoFo

    struct FoFo;

### struct FoFoClass

    struct FoFoClass;

### FO_FO_ERROR

    #define FO_FO_ERROR (fo_fo_error_quark ())

### fo_fo_error_quark ()

    GQuark      fo_fo_error_quark               (void);

Gets the GQuark identifying FoFo errors.

Returns : | GQuark identifying FoFo errors.

### enum FoFoError

    typedef enum
    {
      FO_FO_ERROR_FAILED,            /* Generic error code */
      FO_FO_ERROR_WARNING,	         /* Non-fatal error */
      FO_FO_ERROR_EMPTY,             /* FO should not be empty */
      FO_FO_ERROR_NOT_EMPTY,         /* FO should be empty */
      FO_FO_ERROR_NOT_BLOCK,         /* FO should contain (%block;)+ */
      FO_FO_ERROR_INVALID_CHILD,     /* FO not allowed as child of parent FO */
      FO_FO_ERROR_INVALID_CONTENT,   /* FO content does not match content model */
      FO_FO_ERROR_ENUMERATION_TOKEN, /* Unrecognised enumeration token */
      FO_FO_ERROR_DATATYPE,          /* Invalid datatype value for property */
      FO_FO_ERROR_DATATYPE_REPLACE,  /* Invalid datatype value for property replaced */
      FO_FO_ERROR_DATATYPE_NULL,     /* Invalid datatype value for property: NULL */
      FO_FO_ERROR_LAST
    } FoFoError;

### struct FoFoAreaNew2Context

    struct FoFoAreaNew2Context {

      FoDoc   *fo_doc;
      FoArea  *parent_area;
      FoArea **new_area;
      gboolean continue_after_error;
      guint    debug_level;
    };

### struct FoFoAreaIterator

    struct FoFoAreaIterator;

### fo_fo_new ()

    FoFo*       fo_fo_new                       (void);

Creates a new FoFo initialized to default value.

Returns : | the new FoFo

### fo_fo_debug_dump_properties ()

    void        fo_fo_debug_dump_properties     (FoFo *fo,
                                                 gint depth);

Log debug messages for most of the instance variables and some of the class variables of `fo`.

`fo` : | FoFo whose properties to dump
`depth` : | Indication of relative depth to be applied to the output.

### fo_fo_set_context ()

    void        fo_fo_set_context               (FoFo *fo_fo,
                                                 FoContext *new_context);

Sets the context of `fo_fo` to `new_context`

`fo_fo` : | The FoFo object
`new_context` : | The new context

### fo_fo_get_context ()

    FoContext*  fo_fo_get_context               (FoFo *fo_fo);

Gets the "context" of `fo_fo`

`fo_fo` : | The FoFo object
Returns : | The context

### fo_fo_update_from_context ()

    void        fo_fo_update_from_context       (FoFo *fo_fo,
                                                 FoContext *context);

Calls the FoFo-specific _update_from_context() function to update the FoFo's property values from the larger set of property values maintained in the FoContext.

`fo_fo` : | FoFo to be updated
`context` : | FoContext from which to update the FoFo

### fo_fo_get_flow ()

    FoFo*       fo_fo_get_flow                  (FoFo *fo_fo);

Gets the flow of `fo_fo`

`fo_fo` : | The `FoFo` object
Returns : | The flow

### fo_fo_get_tree ()

    FoFo*       fo_fo_get_tree                  (FoFo *fo_fo);

Gets the tree of `fo_fo`

`fo_fo` : | The `FoFo` object
Returns : | The tree

### fo_fo_get_generate_reference_area ()

    gboolean    fo_fo_get_generate_reference_area
                                                (FoFo *fo_fo);

Gets whether or not the FO generates reference areas.

`fo_fo` : | The `FoFo` object
Returns : | The generate-reference-area class property value

### fo_fo_get_allow_mixed_content ()

    gboolean    fo_fo_get_allow_mixed_content   (FoFo *fo_fo);

Gets whether or not the FO allows mixed content (i.e. text nodes).

`fo_fo` : | The `FoFo` object
Returns : | The allow_mixed_content class property value.

### fo_fo_validate_content ()

    gboolean    fo_fo_validate_content          (FoFo *fo,
                                                 GError **error);

Calls the FoFo-specific _validate_content() function to validate the FoFo's content model and returns the value returned by that function.

`fo` : | FoFo whose content is to be validated
`error` : | GError
Returns : | FALSE if no content model error, otherwise TRUE

### fo_fo_resolve_property_attributes ()

    gboolean    fo_fo_resolve_property_attributes
                                                (FoNode *fo_node,
                                                 gpointer data);

Resolves the values of the properties of `fo_node`.

`fo_node` : | FoNode for which to resolve property attributes.
`data` : | Context in which to resolve the properties.
Returns : | `TRUE` if an error occurred, `FALSE` otherwise.

### fo_fo_children_properties_resolve ()

    void        fo_fo_children_properties_resolve
                                                (FoFo *this_fo,
                                                 FoArea *this_fo_parent_area,
                                                 FoArea **new_area,
                                                 GHashTable *prop_eval_hash,
                                                 FoDoc *fo_doc,
                                                 gboolean continue_after_error,
                                                 gint debug_level,
                                                 GError **error);

Resolves the properties of the children of `this_fo`.

`this_fo` : | FoFo for which to resolve properties.
`this_fo_parent_area` : | Parent FoArea to which to add new areas.
`new_area` : | New area, if any.
`prop_eval_hash` : | Map of property names to property eval functions.
`fo_doc` : | Output FoDoc.
`continue_after_error` : | Whether to continue after any formatting errors.
`debug_level` : | Debug level.
`error` : | Indication of any error that occurred.

### fo_fo_validate ()

    void        fo_fo_validate                  (FoFo *fo,
                                                 FoContext *current_context,
                                                 FoContext *parent_context,
                                                 GError **error);

Validate and/or munge the properties of `fo`.

`fo` : | FoFo to validate.
`current_context` : | FoContext of `fo`.
`parent_context` : | FoContext of parent of `fo`.
`error` : | GError indicating any error that occurs

### fo_fo_clone ()

    FoFo*       fo_fo_clone                     (FoFo *original);

Make a clone of `original` and insert the clone after `original` in the fo tree. Set instance properties of the clone to match `original`.

`original` : | Fo object to be cloned
Returns : | Clone of `original`

### fo_fo_area_new ()

    void        fo_fo_area_new                  (FoFo *fo,
                                                 FoDoc *fo_doc,
                                                 FoArea *parent_area,
                                                 FoArea **new_area,
                                                 guint debug_level);

### Warning

`fo_fo_area_new` is deprecated and should not be used in newly-written code. Use fo_fo_area_new2 in new code.

Creates a new FoArea for `fo` and adds it as the last child of `parent_area`.

`fo` : | FoFo for which to create a new area.
`fo_doc` : | Output FoDoc
`parent_area` : | FoArea to which to add new area.
`new_area` : | New area.
`debug_level` : | Debug level.

### fo_fo_area_new2 ()

    void        fo_fo_area_new2                 (FoFo *fo,
                                                 FoFoAreaNew2Context *context,
                                                 GError **error);

Creates a new FoArea corresponding to `fo`.

`fo` : | FoFo for which to create area.
`context` : | Context in which to create area.
`error` : | Indication of any error that occurred.

### fo_fo_trim_whitespace_children ()

    void        fo_fo_trim_whitespace_children  (FoFo *fo);

Remove any "whitespace" children of `fo`. I.e., unlink and unref any children that are FoText that contain only whitespace or are FoWrapperWhitespace nodes.

Leaves `fo` with no "whitespace" children.

`fo` : | FoFo to trim

### fo_fo_validate_content_empty ()

    gboolean    fo_fo_validate_content_empty    (FoFo *fo,
                                                 GError **error);

Validates that `fo` does not contain any child FoFo

`fo` : | FoFo to validate.
`error` : | GError indicating any error.
Returns : | `FALSE` if `fo` is empty.

### fo_fo_validate_content_block_plus ()

    gboolean    fo_fo_validate_content_block_plus
                                                (FoFo *fo,
                                                 GError **error);

Validates the `fo` contains one or more FoBlockFo formatting objects.

`fo` : | FoFo to validate.
`error` : | GError indicating any error.
Returns : | `FALSE` if content matches.

### fo_fo_validate_pcdata_or_inline ()

    void        fo_fo_validate_pcdata_or_inline (FoNode *fo_node,
                                                 gboolean *is_not_pcdata_inline);

`fo_node` : |
`is_not_pcdata_inline` : |

### fo_fo_validate_block_or_whitespace ()

    void        fo_fo_validate_block_or_whitespace
                                                (FoNode *fo_node,
                                                 gboolean *is_not_block_or_whitespace);

`fo_node` : |
`is_not_block_or_whitespace` : |

### fo_fo_validate_pcdata_inline_block_neutral ()

    void        fo_fo_validate_pcdata_inline_block_neutral
                                                (FoNode *fo_node,
                                                 gboolean *is_not_pcdata_inline_block_neutral);

Validates that the content of `fo_node` is only #PCDATA or FoInline or FoNeutral formatting objects.

`fo_node` : | FoFo to validate
`is_not_pcdata_inline_block_neutral` : | Pointer to gboolean storing result

### fo_fo_get_area_iterator ()

    FoFoAreaIterator* fo_fo_get_area_iterator   (FoFo *fo);

Gets a FoFoAreaIterator for iterating over the areas generated by `fo`.

`fo` : | FoFo for which to get iterator.
Returns : | A FoFoAreaIterator.

### fo_fo_area_iterator_get_area ()

    FoArea*     fo_fo_area_iterator_get_area    (const FoFoAreaIterator *iterator);

Gets the current FoArea pointed to by `iterator`.

`iterator` : | FoFoAreaIterator for which to get current area.
Returns : | The current FoArea.

### fo_fo_area_iterator_next ()

    gboolean    fo_fo_area_iterator_next        (FoFoAreaIterator *iterator);

Makes `iterator` point to the next FoArea in its list.

`iterator` : | FoFoAreaIterator to modify
Returns : | `TRUE` if there is a next FoArea, `FALSE` if not.

## Properties

"`allow-mixed-content`" (gboolean : Read) | Whether or not the formatting object allows mixed content.
"`context`" (FoContext : Read) | Set of current formatting object properties.
"`flow`" (FoFo : Read) | Ancestor fo:flow node in the formatting object tree.
"`generate-reference-area`" (gboolean : Read) | Whether or not the formatting object generates a reference area.
"`tree`" (FoFo : Read) | Top of the formatting object tree.