]>
git.saurik.com Git - wxWidgets.git/blob - utils/tex2rtf/src/table.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Utilities for manipulating tables
4 // Author: Julian Smart
5 // Modified by: Wlodzimiez ABX Skiba 2003/2004 Unicode support
9 // Copyright: (c) Julian Smart
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
14 #pragma implementation
17 // For compilers that support precompilation, includes "wx.h".
18 #include "wx/wxprec.h"
45 ColumnData TableData
[40];
46 bool inTabular
= false;
48 bool startRows
= false;
49 bool tableVerticalLineLeft
= false;
50 bool tableVerticalLineRight
= false;
51 int noColumns
= 0; // Current number of columns in table
54 int currentRowNumber
= 0;
57 * Parse table argument
61 bool ParseTableArgument(wxChar
*value
)
65 int len
= wxStrlen(value
);
66 bool isBorder
= false;
77 TableData
[noColumns
].leftBorder
= isBorder
;
78 TableData
[noColumns
].rightBorder
= false;
79 TableData
[noColumns
].justification
= 'l';
80 TableData
[noColumns
].width
= 2000; // Estimate
81 TableData
[noColumns
].absWidth
= false;
82 // TableData[noColumns].spacing = ??
89 TableData
[noColumns
].leftBorder
= isBorder
;
90 TableData
[noColumns
].rightBorder
= false;
91 TableData
[noColumns
].justification
= 'c';
92 TableData
[noColumns
].width
= defaultTableColumnWidth
; // Estimate
93 TableData
[noColumns
].absWidth
= false;
94 // TableData[noColumns].spacing = ??
101 TableData
[noColumns
].leftBorder
= isBorder
;
102 TableData
[noColumns
].rightBorder
= false;
103 TableData
[noColumns
].justification
= 'r';
104 TableData
[noColumns
].width
= 2000; // Estimate
105 TableData
[noColumns
].absWidth
= false;
106 // TableData[noColumns].spacing = ??
115 wxChar numberBuf
[50];
123 while ((i
< len
) && (isdigit(ch
) || ch
== '.'))
125 numberBuf
[j
] = (wxChar
)ch
;
130 // Assume we have 2 characters for units
131 numberBuf
[j
] = value
[i
];
133 numberBuf
[j
] = value
[i
];
136 if (value
[i
] == '}') i
++;
138 TableData
[noColumns
].leftBorder
= isBorder
;
139 TableData
[noColumns
].rightBorder
= false;
140 TableData
[noColumns
].justification
= 'l';
141 TableData
[noColumns
].width
= 20*ParseUnitArgument(numberBuf
);
142 TableData
[noColumns
].absWidth
= true;
143 // TableData[noColumns].spacing = ??
149 wxChar
*buf
= new wxChar
[wxStrlen(value
) + 80];
150 wxSnprintf(buf
, wxStrlen(value
) + 80, _T("Tabular first argument \"%s\" too complex!"), value
);
157 TableData
[noColumns
-1].rightBorder
= true;