00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef POLYBLK_H
00020 #define POLYBLK_H
00021
00022 #include "rect.h"
00023 #include "points.h"
00024 #include "scrollview.h"
00025 #include "elst.h"
00026
00027 #include "hpddef.h"
00028
00029
00030
00031
00032 enum PolyBlockType {
00033 PT_UNKNOWN,
00034 PT_FLOWING_TEXT,
00035 PT_HEADING_TEXT,
00036 PT_PULLOUT_TEXT,
00037 PT_TABLE,
00038 PT_VERTICAL_TEXT,
00039 PT_FLOWING_IMAGE,
00040 PT_HEADING_IMAGE,
00041 PT_PULLOUT_IMAGE,
00042 PT_FLOWING_LINE,
00043 PT_HEADING_LINE,
00044 PT_PULLOUT_LINE,
00045 PT_NOISE,
00046 PT_COUNT
00047 };
00048
00049 class DLLSYM POLY_BLOCK {
00050 public:
00051 POLY_BLOCK() {
00052 }
00053 POLY_BLOCK(ICOORDELT_LIST *points, PolyBlockType type);
00054 ~POLY_BLOCK () {
00055 }
00056
00057 TBOX *bounding_box() {
00058 return &box;
00059 }
00060
00061 ICOORDELT_LIST *points() {
00062 return &vertices;
00063 }
00064
00065 void compute_bb();
00066
00067 PolyBlockType isA() const {
00068 return type;
00069 }
00070
00071 bool IsText() const {
00072 return IsTextType(type);
00073 }
00074
00075
00076
00077 void rotate(FCOORD rotation);
00078
00079 void move(ICOORD shift);
00080
00081 void plot(ScrollView* window, inT32 num);
00082
00083 void fill(ScrollView* window, ScrollView::Color colour);
00084
00085
00086 bool contains(POLY_BLOCK *other);
00087
00088
00089 bool overlap(POLY_BLOCK *other);
00090
00091
00092
00093
00094 inT16 winding_number(const ICOORD &test_pt);
00095
00096
00097 void prep_serialise() {
00098 vertices.prep_serialise();
00099 }
00100 void dump(FILE *f) {
00101 vertices.dump(f);
00102 }
00103 void de_dump(FILE *f) {
00104 vertices.de_dump(f);
00105 }
00106 make_serialise(POLY_BLOCK)
00107 void serialise_asc(FILE * f);
00108 void de_serialise_asc(FILE *f);
00109
00110
00111
00112
00113 static ScrollView::Color ColorForPolyBlockType(PolyBlockType type);
00114
00115
00116 static bool IsLineType(PolyBlockType type) {
00117 return (type == PT_FLOWING_LINE) || (type == PT_HEADING_LINE) ||
00118 (type == PT_PULLOUT_LINE);
00119 }
00120
00121 static bool IsImageType(PolyBlockType type) {
00122 return (type == PT_FLOWING_IMAGE) || (type == PT_HEADING_IMAGE) ||
00123 (type == PT_PULLOUT_IMAGE);
00124 }
00125
00126 static bool IsTextType(PolyBlockType type) {
00127 return (type == PT_FLOWING_TEXT) || (type == PT_HEADING_TEXT) ||
00128 (type == PT_PULLOUT_TEXT) || (type == PT_TABLE) ||
00129 (type == PT_VERTICAL_TEXT);
00130 }
00131
00132 private:
00133 ICOORDELT_LIST vertices;
00134 TBOX box;
00135 PolyBlockType type;
00136 };
00137
00138
00139 class DLLSYM PB_LINE_IT {
00140 public:
00141 PB_LINE_IT(POLY_BLOCK *blkptr) {
00142 block = blkptr;
00143 }
00144
00145 NEWDELETE2(PB_LINE_IT)
00146
00147 void set_to_block(POLY_BLOCK * blkptr) {
00148 block = blkptr;
00149 }
00150
00151
00152
00153
00154
00155 ICOORDELT_LIST *get_line(inT16 y);
00156
00157 private:
00158 POLY_BLOCK * block;
00159 };
00160 #endif