Exemple #1
0
static  void    gml_li_ul( const gmltag * entry )
{
    char        *   p;
    char            bullet[3];
    int32_t         t_align         = 0;
    int32_t         t_left_indent_1 = 0;
    int32_t         t_left_indent_2 = 0;
    int32_t         t_right_indent  = 0;

    scan_err = false;
    p = scan_start;

    if( nest_cb == NULL ) {
        xx_nest_err( err_li_lp_no_list );   // tag must be in a list
        scan_start = scan_stop + 1;
        return;
    }

    if( ((ul_lay_level *)(nest_cb->lay_tag))->bullet_translate ) {
        bullet[0] = cop_in_trans( ((ul_lay_level *)(nest_cb->lay_tag))->bullet,
                            ((ul_lay_level *)(nest_cb->lay_tag))->bullet_font );
    } else {
        bullet[0] = ((ul_lay_level *)(nest_cb->lay_tag))->bullet;
    }
    bullet[1] = ' ';                    // 1 trailing space as wgml4 does
    bullet[2] = 0;

    scr_process_break();

    if( ProcFlags.need_li_lp ) {        // first :li for this list
        set_skip_vars( &nest_cb->xl_pre_skip, NULL, NULL, 1, g_curr_font );
    } else if( !nest_cb->compact ) {
        set_skip_vars( &((ul_lay_level *)(nest_cb->lay_tag))->skip, NULL,
                       NULL, 1, g_curr_font );
    } else {                            // compact
        set_skip_vars( NULL, NULL, NULL, 1, g_curr_font );
    }

    g_curr_font = ((ul_lay_level *)(nest_cb->lay_tag))->bullet_font;
    post_space = 0;

    /* Use original indents, not values possibly modified by IN */

    if( g_indent > 0 ) {
        t_left_indent_1  = conv_hor_unit( &((ul_lay_level *)(nest_cb->lay_tag))->left_indent, g_curr_font )
                            + nest_cb->prev->left_indent + nest_cb->prev->align;
    } else {
        t_left_indent_1  = conv_hor_unit( &((ul_lay_level *)(nest_cb->lay_tag))->left_indent, g_curr_font )
                            + nest_cb->prev->left_indent;
    }
    t_left_indent_2  = conv_hor_unit( &((ul_lay_level *)(nest_cb->lay_tag))->left_indent, g_curr_font );
    t_right_indent = -1 * conv_hor_unit( &((ul_lay_level *)(nest_cb->lay_tag))->right_indent, g_curr_font )
                            + nest_cb->prev->right_indent;
    g_cur_left = nest_cb->lm + t_left_indent_2;
    g_page_right = nest_cb->rm + t_right_indent;

    g_cur_h_start = g_cur_left;
    ProcFlags.keep_left_margin = true;  // keep special Note indent
    start_line_with_string( bullet, g_curr_font, true );

    t_align = conv_hor_unit( &((ul_lay_level *)(nest_cb->lay_tag))->align, g_curr_font );
    g_cur_h_start = g_cur_left + t_align;

    if( t_line != NULL ) {
        if( t_line->last != NULL ) {
            g_cur_left += t_line->last->width + post_space;
        }
    }
    post_space = 0;
    if( g_cur_h_start > g_cur_left ) {
        g_cur_left = g_cur_h_start;
    }
    g_cur_h_start = g_cur_left;
    ju_x_start = g_cur_h_start;

    g_curr_font = ((ul_lay_level *)(nest_cb->lay_tag))->font;
    if( *p == '.' ) p++;                // over '.'
    while( *p == ' ' ) p++;             // skip initial spaces
    ProcFlags.need_li_lp = false;
    if( *p ) {
        process_text( p, g_curr_font ); // if text fullows
    }
    nest_cb->align = t_align;

    g_cur_left = nest_cb->lm + t_left_indent_2 + nest_cb->align;

    /* Set indents to their original values for the next LI */

    if( g_indent > 0 ) {
        nest_cb->left_indent = t_left_indent_1;
    } else {
        nest_cb->left_indent = t_left_indent_1 + nest_cb->prev->align;
    }
    nest_cb->right_indent = t_right_indent;

    scan_start = scan_stop + 1;
    return;
}
Exemple #2
0
static  void    gml_li_ul( const gmltag * entry )
{
    char        *   p;
    char            bullet[3];

    entry = entry;
    scan_err = false;
    p = scan_start;

    if( nest_cb == NULL ) {
        xx_nest_err( err_li_lp_no_list );   // tag must be in a list
        scan_start = scan_stop + 1;
        return;
    }

    if( ((ul_lay_tag *)(nest_cb->lay_tag))->bullet_translate ) {
        bullet[0] = cop_in_trans( ((ul_lay_tag *)(nest_cb->lay_tag))->bullet,
                            ((ul_lay_tag *)(nest_cb->lay_tag))->bullet_font );
    } else {
        bullet[0] = ((ul_lay_tag *)(nest_cb->lay_tag))->bullet;
    }
    bullet[1] = ' ';                    // 1 trailing space as wgml4 does
    bullet[2] = 0;

    scr_process_break();

    if( ProcFlags.need_li_lp ) {        // first :li for this list
        set_skip_vars( &((ul_lay_tag *)(nest_cb->lay_tag))->pre_skip, NULL, NULL, 1, g_curr_font );
    } else if( !nest_cb->compact ) {
        set_skip_vars( &((ul_lay_tag *)(nest_cb->lay_tag))->skip, NULL, NULL, 1, g_curr_font );
    } else {                            // compact
        set_skip_vars( NULL, NULL, NULL, 1, g_curr_font );
    }


    spacing = ((ul_lay_tag *)(nest_cb->lay_tag))->spacing;
    g_curr_font = ((ul_lay_tag *)(nest_cb->lay_tag))->bullet_font;
    post_space = 0;

    g_cur_left = nest_cb->lm + nest_cb->left_indent;
    g_cur_h_start = g_cur_left;
    g_page_right = nest_cb->rm - nest_cb->right_indent;

    ProcFlags.keep_left_margin = true;  // keep special Note indent

    start_line_with_string( bullet, g_curr_font, true );
    g_cur_h_start = g_cur_left +
        conv_hor_unit( &(((ul_lay_tag *)(nest_cb->lay_tag))->align) );

    if( t_line != NULL ) {
        if( t_line->last != NULL ) {
            g_cur_left += t_line->last->width + post_space;
        }
    }
    post_space = 0;
    if( g_cur_h_start > g_cur_left ) {
        g_cur_left = g_cur_h_start;
    }
    g_cur_h_start = g_cur_left;
    ju_x_start = g_cur_h_start;

    spacing = ((ul_lay_tag *)(nest_cb->lay_tag))->spacing;
    g_curr_font = ((ul_lay_tag *)(nest_cb->lay_tag))->font;
    if( *p == '.' ) p++;                // over '.'
    while( *p == ' ' ) p++;             // skip initial spaces
    ProcFlags.need_li_lp = false;
    if( *p ) {
        process_text( p, g_curr_font ); // if text fullows
    }

    scan_start = scan_stop + 1;
    return;
}