File: formatting.c

package info (click to toggle)
abiword 0.7.7-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 20,604 kB
  • ctags: 18,358
  • sloc: cpp: 88,791; ansic: 66,296; sh: 7,777; makefile: 3,397; xml: 687; perl: 361; awk: 273; sed: 36; csh: 28
file content (75 lines) | stat: -rw-r--r-- 1,752 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "wv.h"

extern FILE *erroroutput;
extern FILE *outputfile;
extern int breakcount;
extern int verpadding;

int flushbreaks(int newpap)
    {
    int silent=0,i;
    error(erroroutput,"flushing breaks %d\n",breakcount);

    if (breakcount == 1)
        oprintf(silent,"<br>\n");
    else if (breakcount > 1)
        {
        if (verpadding == 1)
            {
            for (i=0;i<breakcount;i++)
                oprintf(silent,"<br>\n");
            }
        else
            {
            oprintf(silent,"<p>\n");
            if (verpadding != 2)
                if (breakcount > 2)
                    for (i=2;i<breakcount;i++)
                        oprintf(silent,"<br>\n");
            }
        }
    else
        return 0;
    breakcount=0;
    return 1;
    }


void do_indent(pap *apap)
    {
    S16 paraindent;
    static int oldparaindent;
    int i;
    error(erroroutput,"the left margin is %d twirps\n",apap->leftmargin);

    if (apap == NULL)
        return;

    paraindent = apap->leftmargin;
    paraindent /= TWIRPS_PER_BQ;
    error(erroroutput,"no of dirs is %d\n",paraindent);
    if (paraindent < 0)
        paraindent = 0;

    if (paraindent < oldparaindent)
        {
        for(i=paraindent;i<oldparaindent;i++)
            fprintf(outputfile,"\n</dir>");
        }
    else if (paraindent > oldparaindent)
        {
        for (i=oldparaindent;i<paraindent;i++)
            fprintf(outputfile,"\n<dir>");
        }
    oldparaindent = paraindent;
    if (apap->firstline >0)
        {
        fprintf(outputfile,"<img height=1 width=%d src=\"%s/clear.gif\">",apap->firstline/TWIRPS_PER_H_PIXEL,patterndir());
        }
    }