/* Returns CR_OK upon successfull completion, an error code otherwise.  */
enum CRStatus cr_cascade_set_sheet(CRCascade *a_this, CRStyleSheet *a_sheet, enum CRStyleOrigin a_origin)
/* Returns CR_OK upon successfull completion, an error code otherwise.  */
enum CRStatus cr_cascade_set_sheet(CRCascade *a_this, CRStyleSheet *a_sheet, enum CRStyleOrigin a_origin)
{
        g_return_val_if_fail (a_this
                              && a_sheet
                              && a_origin >= ORIGIN_UA
                              && a_origin < NB_ORIGINS, CR_BAD_PARAM_ERROR);
        if (PRIVATE (a_this)->sheets[a_origin])
                cr_stylesheet_unref (PRIVATE (a_this)->sheets[a_origin]);
        PRIVATE (a_this)->sheets[a_origin] = a_sheet;
        cr_stylesheet_ref (a_sheet);
        a_sheet->origin = a_origin;
        return CR_OK;
}