28#include <tqvaluevector.h>
42template <
class Container>
43inline void qHeapSort2( Container &c )
45 if ( c.begin() == c.end() )
50 qHeapSortHelper( c.begin(), c.end(), *(c.begin()), (uint)c.size() );
53enum ParagraphType {
Body = 0, Header, Footer, Nb_ParagraphTypes };
56enum FontFamily { Times = 0, Helvetica, Courier, Symbol, Nb_Family };
57enum FontStyle { Regular, Bold, Italic, BoldItalic };
59inline FontStyle toStyle(
bool bold,
bool italic) {
60 return (bold ? (italic ? BoldItalic : Bold)
61 : (italic ? Italic : Regular) );
63inline bool isItalic(FontStyle style) {
64 return (style==Italic || style==BoldItalic);
66inline bool isBold(FontStyle style) {
67 return (style==Bold || style==BoldItalic);
71inline double mmToPoint(
double mm) {
return mm * 72 / 25.4; }
73inline bool equal(
double d1,
double d2,
double percent = 0.01) {
74 double delta = percent * (fabs(d1)+fabs(d2)) / 2;
75 return ( fabs(d1 - d2)<delta );
77inline bool more(
double d1,
double d2,
double percent = 0.01) {
78 double delta = percent * (fabs(d1)+fabs(d2)) / 2;
79 return ( (d2-d1)<delta );
81inline bool less(
double d1,
double d2,
double percent = 0.01) {
82 double delta = percent * (fabs(d1)+fabs(d2)) / 2;
83 return ( (d1-d2)<delta );
86TQColor toColor(GfxRGB &);
91 DRect() : _left(0), _right(0), _top(0), _bottom(0) {}
92 DRect(
double left,
double right,
double top,
double bottom)
93 : _left(left), _right(right), _top(top), _bottom(bottom) {}
95 bool isValid()
const {
return ( _right>_left && _bottom>_top ); }
97 void setTop(
double top) { _top = top; }
98 void setBottom(
double bottom) { _bottom = bottom; }
99 void setRight(
double right) { _right = right; }
100 void setLeft(
double left) { _left = left; }
102 double top()
const {
return _top; }
103 double bottom()
const {
return _bottom; }
104 double left()
const {
return _left; }
105 double right()
const {
return _right; }
107 double width()
const {
return _right - _left; }
108 double height()
const {
return _bottom - _top; }
110 bool operator ==(
const DRect &)
const;
111 bool isInside(
const DRect &,
double percent = 0.01)
const;
112 void unite(
const DRect &);
113 TQString toString()
const;
116 double _left, _right, _top, _bottom;
123class DPath :
public TQValueVector<DPoint>
128 bool isSegment()
const {
return size()==2; }
129 bool isHorizontalSegment()
const {
130 return isSegment() && equal(at(0).y, at(1).y);
132 bool isVerticalSegment()
const {
133 return isSegment() && equal(at(0).x, at(1).y);
135 bool isRectangle()
const;
136 DRect boundingRect()
const;
139typedef TQValueVector<DPath> DPathVector;
146 Font(
const GfxState *,
double size);
148 bool operator ==(
const Font &)
const;
149 bool format(TQDomDocument &, TQDomElement &format, uint pos, uint len,
150 bool all =
false)
const;
151 int height()
const {
return _data->height[_pointSize]; }
152 const TQColor &color()
const {
return _color; }
153 bool isLatex()
const {
return _data->latex; }
155 void setFamily(FontFamily);
158 static void cleanup();
161 void init(
const TQString &name);
172 TQMap<int, int> height;
176 static TQDict<Data> *_dict;
177 static const char *FAMILY_DATA[PDFImport::Nb_Family];
184 Link(
const DRect &, LinkAction &, Catalog &);
186 const DRect &rect()
const {
return _rect; }
187 void format(TQDomDocument &, TQDomElement &format,
188 uint pos,
const TQString &text)
const;
190 static TQString pageLinkName(uint i);