~ubuntu-branches/ubuntu/precise/cuneiform/precise

« back to all changes in this revision

Viewing changes to cuneiform_src/Kern/ced/sources/main/ced_func_rtf.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jakub Wilk, c-assert.diff, slovenian-slv.diff
  • Date: 2011-01-26 21:53:07 UTC
  • mfrom: (5.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20110126215307-62x61mcesr607qb7
Tags: 1.0.0+dfsg-2
* Upload to unstable.
* Explicitly build-depend on pkg-config. Thanks to Stefano Rivera for the
  bug report.
* Add Vcs-* fields.
* Use the standard C assert() macro, rather than custom Cuneiform one.
  [c-assert.diff]
* Pass CFLAGS, CXXFLAGS and LDFLAGS (get from dpkg-buildflags) to cmake
  (closes: #608345). Thanks to Sami Liedes for the bug report.
  + Build depend on dpkg-dev (>= 1.15.7).
* Pass --parallel to dh.
  + Bump debhelper minimum version to 7.4.10.
* Update debian/copyright to the latest DEP-5 version.
* Bump year in debian/copyright.
* Explicitly link to GraphicsMagick (rather than via the ImageMagick
  compatibility layer).
* Don't ship /usr/lib/cuneiform/*.so symlinks. These libraries are
  considered private, at least until #598616 is fixed.
* Rename some private variables in debian/rules to make them lowercase.
* Update patch headers.
* Provide proper ‘build-arch’ and ‘build-indep’ targets in debian/rules.
* Document input format in the manual page (closes: #572061). Thanks to
  Janusz S. Bień for the bug report.
* Use ‘slv’ (rather than ‘slo’) as language code for Slovenian.
  [slovenian-slv.diff]
* Fix package description: Slovenian is supported, Slovak is not.
* Improve documentation of the language (-l) option (closes: #602512).
  Thanks to Jari Aalto for the bug report.
* Install reasons file for vrms.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
Copyright (c) 1993-2008, Cognitive Technologies
3
3
All rights reserved.
4
4
 
5
 
����������� ��������� ��������������� � ������������� ��� � ���� ��������� ����,
6
 
��� � � �������� �����, � ����������� ��� ���, ��� ���������� ��������� �������:
7
 
 
8
 
      * ��� ��������� ��������������� ��������� ���� ������ ���������� ���������
9
 
        ���� ����������� �� ��������� �����, ���� ������ ������� � �����������
10
 
        ����� �� ��������.
11
 
      * ��� ��������� ��������������� ��������� ���� � ������������ �/��� �
12
 
        ������ ����������, ������������ ��� ���������������, ������ �����������
13
 
        ��������� ���� ���������� �� ��������� �����, ���� ������ ������� �
14
 
        ����������� ����� �� ��������.
15
 
      * �� �������� Cognitive Technologies, �� ����� �� ����������� �� �����
16
 
        ���� ������������ � �������� �������� ��������� �/��� �����������
17
 
        ���������, ���������� �� ���� ��, ��� ���������������� �����������
18
 
        ����������.
19
 
 
20
 
��� ��������� ������������� ����������� ��������� ���� �/��� ������� ������ "���
21
 
��� ����" ��� ������-���� ���� ��������, ���������� ���� ��� ���������������,
22
 
������� �������� ������������ �������� � ����������� ��� ���������� ����, �� ��
23
 
������������� ���. �� �������� ��������� ���� � �� ���� ������ ����, �������
24
 
����� �������� �/��� �������� �������������� ���������, �� � ���� ������ ��
25
 
��Ѩ� ���������������, ������� ����� �����, ���������, ����������� ���
26
 
������������� ������, ��������� � �������������� ��� ���������� ����������
27
 
������������� ������������� ��������� (������� ������ ������, ��� ������,
28
 
������� ���������, ��� ������ �/��� ������ �������, ���������� ��-�� ��������
29
 
������� ��� �/��� ������ ��������� �������� ��������� � ������� �����������,
30
 
�� �� ������������� ����� ��������), �� �� ������������� ���, ���� ���� �����
31
 
�������� ��� ������ ���� ���� �������� � ����������� ����� ������� � ������.
 
5
Разрешается повторное распространение и использование как в виде исходного кода,
 
6
так и в двоичной форме, с изменениями или без, при соблюдении следующих условий:
 
7
 
 
8
      * При повторном распространении исходного кода должны оставаться указанное
 
9
        выше уведомление об авторском праве, этот список условий и последующий
 
10
        отказ от гарантий.
 
11
      * При повторном распространении двоичного кода в документации и/или в
 
12
        других материалах, поставляемых при распространении, должны сохраняться
 
13
        указанная выше информация об авторском праве, этот список условий и
 
14
        последующий отказ от гарантий.
 
15
      * Ни название Cognitive Technologies, ни имена ее сотрудников не могут
 
16
        быть использованы в качестве средства поддержки и/или продвижения
 
17
        продуктов, основанных на этом ПО, без предварительного письменного
 
18
        разрешения.
 
19
 
 
20
ЭТА ПРОГРАММА ПРЕДОСТАВЛЕНА ВЛАДЕЛЬЦАМИ АВТОРСКИХ ПРАВ И/ИЛИ ДРУГИМИ ЛИЦАМИ "КАК
 
21
ОНА ЕСТЬ" БЕЗ КАКОГО-ЛИБО ВИДА ГАРАНТИЙ, ВЫРАЖЕННЫХ ЯВНО ИЛИ ПОДРАЗУМЕВАЕМЫХ,
 
22
ВКЛЮЧАЯ ГАРАНТИИ КОММЕРЧЕСКОЙ ЦЕННОСТИ И ПРИГОДНОСТИ ДЛЯ КОНКРЕТНОЙ ЦЕЛИ, НО НЕ
 
23
ОГРАНИЧИВАЯСЬ ИМИ. НИ ВЛАДЕЛЕЦ АВТОРСКИХ ПРАВ И НИ ОДНО ДРУГОЕ ЛИЦО, КОТОРОЕ
 
24
МОЖЕТ ИЗМЕНЯТЬ И/ИЛИ ПОВТОРНО РАСПРОСТРАНЯТЬ ПРОГРАММУ, НИ В КОЕМ СЛУЧАЕ НЕ
 
25
НЕСЁТ ОТВЕТСТВЕННОСТИ, ВКЛЮЧАЯ ЛЮБЫЕ ОБЩИЕ, СЛУЧАЙНЫЕ, СПЕЦИАЛЬНЫЕ ИЛИ
 
26
ПОСЛЕДОВАВШИЕ УБЫТКИ, СВЯЗАННЫЕ С ИСПОЛЬЗОВАНИЕМ ИЛИ ПОНЕСЕННЫЕ ВСЛЕДСТВИЕ
 
27
НЕВОЗМОЖНОСТИ ИСПОЛЬЗОВАНИЯ ПРОГРАММЫ (ВКЛЮЧАЯ ПОТЕРИ ДАННЫХ, ИЛИ ДАННЫЕ,
 
28
СТАВШИЕ НЕГОДНЫМИ, ИЛИ УБЫТКИ И/ИЛИ ПОТЕРИ ДОХОДОВ, ПОНЕСЕННЫЕ ИЗ-ЗА ДЕЙСТВИЙ
 
29
ТРЕТЬИХ ЛИЦ И/ИЛИ ОТКАЗА ПРОГРАММЫ РАБОТАТЬ СОВМЕСТНО С ДРУГИМИ ПРОГРАММАМИ,
 
30
НО НЕ ОГРАНИЧИВАЯСЬ ЭТИМИ СЛУЧАЯМИ), НО НЕ ОГРАНИЧИВАЯСЬ ИМИ, ДАЖЕ ЕСЛИ ТАКОЙ
 
31
ВЛАДЕЛЕЦ ИЛИ ДРУГОЕ ЛИЦО БЫЛИ ИЗВЕЩЕНЫ О ВОЗМОЖНОСТИ ТАКИХ УБЫТКОВ И ПОТЕРЬ.
32
32
 
33
33
Redistribution and use in source and binary forms, with or without modification,
34
34
are permitted provided that the following conditions are met:
69
69
 
70
70
#define far
71
71
 
72
 
Bool32  CEDPage::FormattedWriteRtf(const char * fileName, BOOL merge)
 
72
Bool32  CEDPage::FormattedWriteRtf(const char * fileName, Bool merge)
73
73
{
74
 
        BOOL ret;
 
74
        Bool ret;
75
75
    struct StrRtfOut far *rtf=NULL;
76
76
    struct StrRtfColor far *color=NULL;
77
77
//    long WriteBegRow,WriteEndRow;
79
79
    int  j;
80
80
    CEDSection* sect;
81
81
 
82
 
//      BOOL inFrm=FALSE;
 
82
//      Bool inFrm=FALSE;
83
83
 
84
 
//      BOOL result;
85
 
//    UINT AllocType;
 
84
//      Bool result;
 
85
//    uint AllocType;
86
86
//    OFSTRUCT OpenBuf;
87
87
 
88
88
//       WriteBegRow=0;
89
89
//       WriteBegCol=0;
90
90
//       WriteEndRow=TotalLines-1;
91
 
//       WriteEndCol=LineLen(WriteEndRow);     // last BYTE not included
 
91
//       WriteEndCol=LineLen(WriteEndRow);     // last uchar not included
92
92
 
93
93
    // allocate space for the Strrtf info structure
94
94
    if (NULL==(rtf=new StrRtfOut))
104
104
        HANDLE oldRtfHndl;
105
105
        if (merge)
106
106
        {
107
 
                rtf->oldFileLen=MemFromFile((PInt8)fileName,&oldRtfHndl);
 
107
                rtf->oldFileLen=MemFromFile((pchar)fileName,&oldRtfHndl);
108
108
                if (rtf->oldFileLen==0)
109
109
                {
110
110
                        SetReturnCode_ced(CFIO_GetReturnCode());
123
123
        else
124
124
        {
125
125
                //open new rtf
126
 
                rtf->hFile=Open(0, (PInt8)fileName,OSF_CREATE|OSF_BINARY);
 
126
                rtf->hFile=Open(0, (pchar)fileName,OSF_CREATE|OSF_BINARY);
127
127
 
128
128
                if (!rtf->hFile)
129
129
                {
155
155
       if (output==RTF_BUF) AllocType=GMEM_MOVEABLE;
156
156
       else                 AllocType=GMEM_MOVEABLE|GMEM_DDESHARE;   // clipboard data needs to be shareable
157
157
       if ( NULL==(rtf->hBuf=GlobalAlloc(AllocType,rtf->BufLen))
158
 
         || NULL==(rtf->buf=(BYTE *)GlobalLock(rtf->hBuf)) ){
 
158
         || NULL==(rtf->buf=(uchar *)GlobalLock(rtf->hBuf)) ){
159
159
          PrintError(w,MSG_OUT_OF_MEM,"RtfWrite(buf)");
160
160
          return FALSE;
161
161
       }
220
220
                {
221
221
                        CEDParagraph* col=sect->GetColumn(colNum);
222
222
 
223
 
                        BOOL firstParaGraph=TRUE;//process first element in a row - for correct paragraph convertation
 
223
                        Bool firstParaGraph=TRUE;//process first element in a row - for correct paragraph convertation
224
224
                        CEDParagraph* para=col->GetFirstObject();
225
225
                        while (para)
226
226
                        {
356
356
 
357
357
char* GetLiteralBorderType(int type);
358
358
 
359
 
BOOL WriteRtfPara(struct StrRtfOut far *rtf,CEDParagraph* p, BOOL brk)
 
359
Bool WriteRtfPara(struct StrRtfOut far *rtf,CEDParagraph* p, Bool brk)
360
360
{
361
361
        CEDLine * lastLin=0;
362
362
        CEDLine* l;
431
431
                        lastLin=l;
432
432
                        // determine the column range to write
433
433
                        FirstCol=0;
434
 
                        LastCol=CED_GetCountChar(l);                // last BYTE not included
 
434
                        LastCol=CED_GetCountChar(l);                // last uchar not included
435
435
                        if (FirstCol>=LastCol) goto LINE_END;  // nothing to write
436
436
 
437
437
//       ptr=pText(l);                   // lock the text
574
574
    BeginRtfGroup:
575
575
    Write the rtf 'begin group' character to output
576
576
******************************************************************************/
577
 
BOOL BeginRtfGroup(struct StrRtfOut far *rtf)
 
577
Bool BeginRtfGroup(struct StrRtfOut far *rtf)
578
578
{
579
579
    rtf->SpacePending=FALSE;          // delimit the last control by '{' character
580
580
    rtf->GroupLevel++;
585
585
    PutRtfChar:
586
586
    Write a character to rtf output
587
587
******************************************************************************/
588
 
BOOL PutRtfChar(struct StrRtfOut far *rtf,BYTE CurChar)
 
588
Bool PutRtfChar(struct StrRtfOut far *rtf,uchar CurChar)
589
589
{
590
 
    BOOL IgnoreSlash=rtf->flags&ROFLAG_IGNORE_SLASH;
 
590
    Bool IgnoreSlash=rtf->flags&ROFLAG_IGNORE_SLASH;
591
591
 
592
592
    if (rtf->SpacePending) {
593
593
       rtf->text[rtf->TextLen]=' ';       // append the pending space
612
612
    Write the rtf control text to rtf output device.  The control text should
613
613
    be NULL terminated.  The next argument provide control parameter type.
614
614
******************************************************************************/
615
 
BOOL WriteRtfControl(struct StrRtfOut far *rtf, const char* control, int type, double val)
 
615
Bool WriteRtfControl(struct StrRtfOut far *rtf, const char* control, int type, double val)
616
616
{
617
617
    char string[20];
618
618
 
649
649
    FlustRtfLine:
650
650
    Write the current line to the RTF file or output buffer
651
651
******************************************************************************/
652
 
BOOL FlushRtfLine(struct StrRtfOut far *rtf)
 
652
Bool FlushRtfLine(struct StrRtfOut far *rtf)
653
653
{
654
654
    if (rtf->TextLen==0) return TRUE;    // nothing to flush
655
655
 
661
661
 
662
662
 
663
663
    if (rtf->hFile) {    // write to file
664
 
       if (HFILE_ERROR==(HFILE)Write(rtf->hFile,(Int8*)rtf->text,rtf->TextLen)) {
 
664
       if (HFILE_ERROR==(HFILE)Write(rtf->hFile,(char*)rtf->text,rtf->TextLen)) {
665
665
          return 0;//PrintError(w,MSG_ERR_FILE_WRITE,"FlushRtfLine");
666
666
       }
667
667
    }
672
672
 
673
673
          GlobalUnlock(rtf->hBuf);
674
674
          if ( NULL==(rtf->hBuf=GlobalReAlloc(rtf->hBuf,rtf->BufLen+1, 0))
675
 
            || NULL==(rtf->buf=(BYTE *)GlobalLock(rtf->hBuf)) ){
 
675
            || NULL==(rtf->buf=(uchar *)GlobalLock(rtf->hBuf)) ){
676
676
             return PrintError(w,MSG_OUT_OF_MEM,"FlushRtfLine");
677
677
          }
678
678
       }
690
690
    WriteRtfFont:
691
691
    Write the font table to the rtf output device.
692
692
******************************************************************************/
693
 
BOOL WriteRtfFont(struct StrRtfOut far *rtf, BOOL head)
 
693
Bool WriteRtfFont(struct StrRtfOut far *rtf, Bool head)
694
694
{
695
695
//    int i;
696
696
        char /*name[32],*/family[32];
697
 
//    BYTE FontFamily,DefFamily;
 
697
//    uchar FontFamily,DefFamily;
698
698
 
699
699
        if (head)
700
700
        {
796
796
    WriteRtfMargin:
797
797
    Write default document margins
798
798
******************************************************************************/
799
 
BOOL WriteRtfMargin(struct StrRtfOut far *rtf)
 
799
Bool WriteRtfMargin(struct StrRtfOut far *rtf)
800
800
{
801
801
//    float PaperHeight,PaperWidth;
802
802
        CEDPage * page=rtf->page;
822
822
    WriteRtfSection:
823
823
    Write the section properties for a given section
824
824
******************************************************************************/
825
 
BOOL WriteRtfSection(struct StrRtfOut far *rtf, CEDSection* sect)
 
825
Bool WriteRtfSection(struct StrRtfOut far *rtf, CEDSection* sect)
826
826
{
827
827
    if (!WriteRtfControl(rtf,"sectd",PARAM_NONE,0)) return FALSE;  // set to default
828
828
 
880
880
    Write the character formatting info when the attributes change from
881
881
    the previsous font selection
882
882
******************************************************************************/
883
 
BOOL WriteRtfCharFmt(struct StrRtfOut far *rtf,CEDChar* curChar)
 
883
Bool WriteRtfCharFmt(struct StrRtfOut far *rtf,CEDChar* curChar)
884
884
{
885
 
//    BYTE CurTypeFace[32],PrevTypeFace[32];
886
 
    BYTE CurFamily,PrevFamily;
887
 
    UINT CurStyle,PrevStyle;
 
885
//    uchar CurTypeFace[32],PrevTypeFace[32];
 
886
    uchar CurFamily,PrevFamily;
 
887
    uint CurStyle,PrevStyle;
888
888
//    int  CurCharSID,PrevCharSID;
889
889
    int  /*i,*/CurPointSize,PrevPointSize/*,CurFieldId,PrevFieldId*/;
890
 
    BOOL result;
 
890
    Bool result;
891
891
    COLORREF PrevTextColor,CurTextColor;
892
892
    COLORREF PrevTextBkColor,CurTextBkColor;
893
 
//      BYTE CurCharSet,PrevCharSet;
 
893
//      uchar CurCharSet,PrevCharSet;
894
894
 
895
895
        CEDChar* prevChar=&(rtf->PrevChar);//curChar->prev;
896
896
    if (curChar==0) return TRUE;
1005
1005
      && CurPointSize==24
1006
1006
      && (CurTextColor==0||CurTextColor==-1)
1007
1007
      && (CurTextBkColor==TextDefBkColor||CurTextBkColor==-1)
1008
 
      && CurStyle/*&(~((UINT)(FNOTEALL)))*/==0
 
1008
      && CurStyle/*&(~((uint)(FNOTEALL)))*/==0
1009
1009
//      && CurFieldId==0
1010
1010
//      && CurCharSID==1
1011
1011
/*        && CurCharSet==0*/)
1131
1131
    EndRtfGroup:
1132
1132
    Write the rtf 'end group' character to output
1133
1133
******************************************************************************/
1134
 
BOOL EndRtfGroup(struct StrRtfOut far *rtf)
 
1134
Bool EndRtfGroup(struct StrRtfOut far *rtf)
1135
1135
{
1136
1136
    rtf->SpacePending=FALSE;          // delimit the last control by '}' character
1137
1137
    rtf->GroupLevel--;
1143
1143
    Write the paragraph formatting info when the attributes change from
1144
1144
    the previsous paragraph selection
1145
1145
******************************************************************************/
1146
 
BOOL WriteRtfParaFmt(struct StrRtfOut far *rtf,CEDParagraph* NewPfmt,CEDParagraph* PrevPfmt/*, int NewCell, int PrevCell, int NewFID, int PrevFID*/)
 
1146
Bool WriteRtfParaFmt(struct StrRtfOut far *rtf,CEDParagraph* NewPfmt,CEDParagraph* PrevPfmt/*, int NewCell, int PrevCell, int NewFID, int PrevFID*/)
1147
1147
{
1148
1148
    int CurLeftIndent,PrevLeftIndent=0;
1149
1149
    int CurRightIndent,PrevRightIndent=0;
1150
1150
    int CurFirstIndent,PrevFirstIndent=0;
1151
1151
//    int CurTabId,PrevTabId=0;
1152
 
//    UINT CurFlags,PrevFlags=0,NoValueFlags;
 
1152
//    uint CurFlags,PrevFlags=0,NoValueFlags;
1153
1153
//    int CurCellId,PrevCellId=0;
1154
1154
//    int CurRowId,PrevRowId=0;
1155
1155
    int CurShading,PrevShading=0;
1171
1171
        int CurLbw,PrevLbw=0;
1172
1172
        int CurBrdrBtw,PrevBrdrBtw=0;
1173
1173
 
1174
 
    BOOL result;
 
1174
    Bool result;
1175
1175
 
1176
1176
    if (!NewPfmt) return TRUE;
1177
1177
 
1422
1422
    Write the rtf text to output.  This routine scans the text stream. If
1423
1423
    any special character are found, they are preceede with a '\' character.
1424
1424
******************************************************************************/
1425
 
BOOL WriteRtfText(struct StrRtfOut far *rtf, const char* text, int TextLen)
 
1425
Bool WriteRtfText(struct StrRtfOut far *rtf, const char* text, int TextLen)
1426
1426
{
1427
1427
    int i;
1428
 
    BYTE CurChar;
1429
 
    BOOL IgnoreSlash=rtf->flags&ROFLAG_IGNORE_SLASH;
 
1428
    uchar CurChar;
 
1429
    Bool IgnoreSlash=rtf->flags&ROFLAG_IGNORE_SLASH;
1430
1430
 
1431
1431
    if (TextLen==0) return TRUE;
1432
1432
 
1454
1454
    WriteRtfRow:
1455
1455
    Write the table row information to the file
1456
1456
******************************************************************************/
1457
 
BOOL WriteRtfRow(struct StrRtfOut far *rtf, CEDParagraph* NewCell,CEDParagraph * prevRow)
 
1457
Bool WriteRtfRow(struct StrRtfOut far *rtf, CEDParagraph* NewCell,CEDParagraph * prevRow)
1458
1458
{
1459
 
    BOOL result;
 
1459
    Bool result;
1460
1460
    CEDParagraph*  CellId,*PrevCellId;
1461
1461
        int c;
1462
1462
 
1605
1605
    WriteRtfCell:
1606
1606
    Write the table cell information to the file
1607
1607
******************************************************************************/
1608
 
BOOL WriteRtfCell(struct StrRtfOut far *rtf, CEDParagraph* NewCell)
 
1608
Bool WriteRtfCell(struct StrRtfOut far *rtf, CEDParagraph* NewCell)
1609
1609
{
1610
1610
        EDCELLDESCR* cd=(EDCELLDESCR*)NewCell->descriptor;
1611
1611
 
1676
1676
    WriteFrmPos:
1677
1677
    Write the frame position information to the file
1678
1678
******************************************************************************/
1679
 
BOOL WriteFrmPos(struct StrRtfOut far *rtf, CEDParagraph* frm,BOOL writeWidth)
 
1679
Bool WriteFrmPos(struct StrRtfOut far *rtf, CEDParagraph* frm,Bool writeWidth)
1680
1680
{
1681
1681
        EDFRAMEDESCR* fd=(EDFRAMEDESCR*)(frm->descriptor);
1682
1682
        EDBOX bx=fd->rec;
1727
1727
    (see ter_def.h), the function imbeds the DIB into a metafile, and
1728
1728
    then writes the metafile to the rtf file.
1729
1729
******************************************************************************/
1730
 
BOOL WriteRtfDIB(struct StrRtfOut far *rtf,int pict)
 
1730
Bool WriteRtfDIB(struct StrRtfOut far *rtf,int pict)
1731
1731
{
1732
 
   BOOL result=TRUE;
 
1732
   Bool result=TRUE;
1733
1733
 
1734
1734
   // Write the actual DIB to the rtf file
1735
1735
 
1736
1736
   long height,width,width_bytes;
1737
 
   BYTE *pMem;
 
1737
   uchar *pMem;
1738
1738
   LPBITMAPINFO pInfo;
1739
1739
 
1740
1740
   // get picture height/width
1764
1764
   // write picture alignment
1765
1765
   if (!WriteRtfControl(rtf,"sspicalign",PARAM_INT,(int)(rtf->page->picsTable[pict].pictAlign) )) return FALSE;  // write picture format
1766
1766
 
1767
 
  pMem=(BYTE *)rtf->page->picsTable[pict].data;
 
1767
  pMem=(uchar *)rtf->page->picsTable[pict].data;
1768
1768
   // write the picture information
1769
 
   for (DWORD l(0); l < rtf->page->picsTable[pict].len; ++l) {
 
1769
   for (uint32_t l(0); l < rtf->page->picsTable[pict].len; ++l) {
1770
1770
      if (!(result=PutRtfHexChar(rtf,pMem[l]))) break;
1771
1771
   }
1772
1772
 
1778
1778
    PutRtfHexChar:
1779
1779
    Write a character to rtf output in hex format
1780
1780
******************************************************************************/
1781
 
BOOL PutRtfHexChar(struct StrRtfOut far *rtf,BYTE CurChar)
 
1781
Bool PutRtfHexChar(struct StrRtfOut far *rtf,uchar CurChar)
1782
1782
{
1783
 
    BYTE HiChar,LoChar,HexChar;
 
1783
    uchar HiChar,LoChar,HexChar;
1784
1784
    int SaveFlag;
1785
1785
 
1786
1786
    HiChar=(char)((CurChar&0xF0)>>4);
1810
1810
    WriteRtfMetafile:
1811
1811
    Write the metafile group and picture data for the specified picture.
1812
1812
******************************************************************************/
1813
 
BOOL WriteRtfMetafile(struct StrRtfOut far *rtf,int pict)
 
1813
Bool WriteRtfMetafile(struct StrRtfOut far *rtf,int pict)
1814
1814
{
1815
1815
   long l;//,bmHeight,bmWidth;
1816
1816
//   HGLOBAL hMem;
1817
 
   BYTE *pMem;
1818
 
   BOOL result=TRUE;
 
1817
   uchar *pMem;
 
1818
   Bool result=TRUE;
1819
1819
 
1820
1820
   // get picture height/width
1821
1821
//   bmHeight=ScrToTwipsY(TerFont[pict].bmHeight);  // picture height in twips
1860
1860
 
1861
1861
 
1862
1862
   // retrieve picture handle
1863
 
        pMem=(BYTE *)rtf->page->picsTable[pict].data;
 
1863
        pMem=(uchar *)rtf->page->picsTable[pict].data;
1864
1864
 
1865
1865
        for (l=0;l<(long)rtf->page->picsTable[pict].len;l++) {
1866
1866
      result=PutRtfHexChar(rtf,pMem[l]);
1879
1879
 
1880
1880
int ReadRtfFontTable(struct StrRtfOut far *rtf, int * maxFontNum);
1881
1881
int ReadRtfColorTable(struct StrRtfOut far *rtf);
1882
 
BOOL WriteRtfMergedHeader(struct StrRtfOut far *rtf, const char * name)
 
1882
Bool WriteRtfMergedHeader(struct StrRtfOut far *rtf, const char * name)
1883
1883
{
1884
1884
        int oldIndex;
1885
 
        BOOL head;
 
1885
        Bool head;
1886
1886
        char * ptr=rtf->oldFile;
1887
1887
        int len=rtf->oldFileLen;
1888
1888
        int i;
1914
1914
                        m++;
1915
1915
                }
1916
1916
        }
1917
 
    BOOL ret=TRUE;
 
1917
    Bool ret=TRUE;
1918
1918
        //remove old file - it is similar to rtf
1919
 
        rtf->hFile=Open(0, (PInt8)name,OSF_CREATE|OSF_BINARY);
 
1919
        rtf->hFile=Open(0, (pchar)name,OSF_CREATE|OSF_BINARY);
1920
1920
        if (!rtf->hFile) goto END_HDR;
1921
1921
 
1922
 
        if (HFILE_ERROR==(HFILE)Write(rtf->hFile,(Int8*)rtf->oldFile,rtf->TextIndex-1)) goto END_HDR;
 
1922
        if (HFILE_ERROR==(HFILE)Write(rtf->hFile,(char*)rtf->oldFile,rtf->TextIndex-1)) goto END_HDR;
1923
1923
        if (!WriteRtfFont(rtf,FALSE)) goto END_HDR;
1924
1924
    if (!FlushRtfLine(rtf)) goto END_HDR;    // flush the rtf line to the output
1925
1925
 
1947
1947
                rtf->TextIndex++;
1948
1948
                head=TRUE;
1949
1949
        }
1950
 
    if (HFILE_ERROR==(HFILE)Write(rtf->hFile,((Int8*)rtf->oldFile)+oldIndex-1,rtf->TextIndex-oldIndex)) goto END_HDR;
 
1950
    if (HFILE_ERROR==(HFILE)Write(rtf->hFile,((char*)rtf->oldFile)+oldIndex-1,rtf->TextIndex-oldIndex)) goto END_HDR;
1951
1951
        if (!WriteRtfColor(rtf,head)) goto END_HDR;
1952
1952
    if (!FlushRtfLine(rtf)) goto END_HDR;    // flush the rtf line to the output
1953
1953
 
1954
 
    if (HFILE_ERROR==(HFILE)Write(rtf->hFile,((Int8*)rtf->oldFile)+rtf->TextIndex-1,rtf->oldFileLen-(rtf->TextIndex+2))) goto END_HDR;
 
1954
    if (HFILE_ERROR==(HFILE)Write(rtf->hFile,((char*)rtf->oldFile)+rtf->TextIndex-1,rtf->oldFileLen-(rtf->TextIndex+2))) goto END_HDR;
1955
1955
 
1956
1956
        // end the previous section
1957
1957
        if (!WriteRtfControl(rtf,"sect",PARAM_NONE,0)) goto END_HDR;
1969
1969
        return ret;
1970
1970
}
1971
1971
 
1972
 
BOOL GetRtfWord(struct StrRtfOut far *rtf);
 
1972
Bool GetRtfWord(struct StrRtfOut far *rtf);
1973
1973
int nameCmp(char* s1,char* s2);
1974
1974
void StrTrim(char* string);
1975
1975
/******************************************************************************
1981
1981
{
1982
1982
    struct StrRtfFont font;
1983
1983
    int    len,FontId,CurFont,ControlGroupLevel=0,CurGroupLevel,WordLen;
1984
 
    BOOL   ExtractingName,NameWordRead;
 
1984
    Bool   ExtractingName,NameWordRead;
1985
1985
        int maxNum=-1;
1986
1986
//    font=rtf->font;
1987
1987
    ControlGroupLevel=rtf->GroupLevel=2;
2124
2124
        return 1;
2125
2125
}
2126
2126
 
2127
 
BOOL GetRtfChar(struct StrRtfOut far *rtf);
2128
 
BOOL PushRtfChar(struct StrRtfOut far *rtf);
 
2127
Bool GetRtfChar(struct StrRtfOut far *rtf);
 
2128
Bool PushRtfChar(struct StrRtfOut far *rtf);
2129
2129
/*****************************************************************************
2130
2130
    GetRtfWord:
2131
2131
    Reads the next word from the input file or the input buffer.
2132
2132
******************************************************************************/
2133
 
BOOL GetRtfWord(struct StrRtfOut far *rtf)
 
2133
Bool GetRtfWord(struct StrRtfOut far *rtf)
2134
2134
{
2135
 
    BYTE CurChar,TempChar;
2136
 
    BYTE line[MAX_WIDTH+1];
 
2135
    uchar CurChar,TempChar;
 
2136
    uchar line[MAX_WIDTH+1];
2137
2137
        char TempString[MAX_WIDTH+1];
2138
2138
    int  len,i,j,k,temp,GroupLevel;
2139
 
    BOOL SpecialChar,NumParamFound,NumFound;
2140
 
//    BOOL IgnoreSlash=rtf->flags&RFLAG_IGNORE_SLASH;
 
2139
    Bool SpecialChar,NumParamFound,NumFound;
 
2140
//    Bool IgnoreSlash=rtf->flags&RFLAG_IGNORE_SLASH;
2141
2141
 
2142
2142
    NEXT_WORD:
2143
2143
 
2402
2402
    When the InSteam is NULL, the characters are read from the buffer.
2403
2403
    Returns FALSE when no more characters available.
2404
2404
******************************************************************************/
2405
 
BOOL GetRtfChar(struct StrRtfOut far *rtf)
 
2405
Bool GetRtfChar(struct StrRtfOut far *rtf)
2406
2406
{
2407
2407
    // get the character from the character stack if available
2408
2408
    if (rtf->StackLen>0) {
2454
2454
    PushRtfChar:
2455
2455
    Push the lastly read character onto stack.
2456
2456
******************************************************************************/
2457
 
BOOL PushRtfChar(struct StrRtfOut far *rtf)
 
2457
Bool PushRtfChar(struct StrRtfOut far *rtf)
2458
2458
{
2459
2459
    if (rtf->StackLen>=MAX_WIDTH) return FALSE;//PrintError(w,MSG_OUT_OF_CHAR_STACK,"PushRtfChar");
2460
2460
 
2468
2468
    WriteRtfParaBorder:
2469
2469
    Write paragraph border controls
2470
2470
******************************************************************************/
2471
 
BOOL WriteRtfParaBorder(struct StrRtfOut far *rtf, CEDParagraph * para)
 
2471
Bool WriteRtfParaBorder(struct StrRtfOut far *rtf, CEDParagraph * para)
2472
2472
{
2473
2473
    if (para->leftBrdrType!=0&&
2474
2474
                para->leftBrdrType==para->rightBrdrType&&para->rightBrdrType==para->topBrdrType&&
2539
2539
    WriteRtfColor:
2540
2540
    Fill the RTF color table and write the color table to the rtf output device.
2541
2541
******************************************************************************/
2542
 
BOOL WriteRtfColor(struct StrRtfOut far *rtf,BOOL head)
 
2542
Bool WriteRtfColor(struct StrRtfOut far *rtf,Bool head)
2543
2543
{
2544
2544
    int i,j,TotalColors;
2545
 
    BYTE red,green,blue;
 
2545
    uchar red,green,blue;
2546
2546
    struct StrRtfColor far *color;
2547
2547
        int oldColors=rtf->TotalColors;
2548
2548
 
2634
2634
{
2635
2635
    struct StrRtfColor far *color;
2636
2636
    int    i,CurColor=0,ControlGroupLevel=0;
2637
 
    BYTE   red,green,blue;
 
2637
    uchar   red,green,blue;
2638
2638
 
2639
2639
    color=rtf->color;
2640
2640
    for (i=0;i<MAX_RTF_COLORS;i++) color->color=-1;   // initialize colors
2661
2661
          green=GetGValue(color[CurColor].color);
2662
2662
          blue=GetBValue(color[CurColor].color);
2663
2663
 
2664
 
          if      (lstrcmpi(rtf->CurWord,"red")==0)   red=(BYTE)(rtf->IntParam);
2665
 
          else if (lstrcmpi(rtf->CurWord,"green")==0) green=(BYTE)(rtf->IntParam);
2666
 
          else if (lstrcmpi(rtf->CurWord,"blue")==0)  blue=(BYTE)(rtf->IntParam);
 
2664
          if      (lstrcmpi(rtf->CurWord,"red")==0)   red=(uchar)(rtf->IntParam);
 
2665
          else if (lstrcmpi(rtf->CurWord,"green")==0) green=(uchar)(rtf->IntParam);
 
2666
          else if (lstrcmpi(rtf->CurWord,"blue")==0)  blue=(uchar)(rtf->IntParam);
2667
2667
          color[CurColor].color=RGB(red,green,blue);   // extracted color
2668
2668
       }
2669
2669
       else {