kviewshell
DjVuAnno.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 #ifndef _DJVUANNO_H
00058 #define _DJVUANNO_H
00059 #ifdef HAVE_CONFIG_H
00060 #include "config.h"
00061 #endif
00062 #if NEED_GNUG_PRAGMAS
00063 # pragma interface
00064 #endif
00065
00066
00067
00090
00091
00092 #include "GString.h"
00093
00094 #ifdef HAVE_NAMESPACES
00095 namespace DJVU {
00096 # ifdef NOT_DEFINED // Just to fool emacs c++ mode
00097 }
00098 #endif
00099 #endif
00100
00101 class GMapArea;
00102 class ByteStream;
00103
00104
00105
00113 class DjVuANT : public GPEnabled
00114 {
00115 protected:
00117 DjVuANT(void);
00118
00119 public:
00120 enum { MODE_UNSPEC=0, MODE_COLOR, MODE_FORE, MODE_BACK, MODE_BW };
00121 enum { ZOOM_STRETCH=-4, ZOOM_ONE2ONE=-3, ZOOM_WIDTH=-2,
00122 ZOOM_PAGE=-1, ZOOM_UNSPEC=0 };
00123 enum alignment { ALIGN_UNSPEC=0, ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT,
00124 ALIGN_TOP, ALIGN_BOTTOM };
00125
00127 static GP<DjVuANT> create(void) { return new DjVuANT; }
00128 virtual ~DjVuANT();
00129
00132 unsigned long int bg_color;
00141 int zoom;
00154 int mode;
00157 alignment hor_align;
00160 alignment ver_align;
00164 GPList<GMapArea> map_areas;
00165 #ifndef NO_METADATA_IN_ANT_CHUNK
00166
00167 GMap<GUTF8String,GUTF8String> metadata;
00168 #endif
00169
00171 bool is_empty(void) const;
00172
00177 void decode(ByteStream &bs);
00178
00181 void merge(ByteStream & bs);
00182
00186 void encode(ByteStream &bs);
00187
00189 GUTF8String encode_raw(void) const;
00190
00192 GP<DjVuANT> copy(void) const;
00193
00196 unsigned int get_memory_usage() const;
00197
00199 static unsigned long int cvt_color(const char * color, unsigned long int def);
00201 GUTF8String get_xmlmap(const GUTF8String &name, const int height) const;
00203 void writeMap(
00204 ByteStream &bs,const GUTF8String &name, const int height) const;
00206 GUTF8String get_paramtags(void) const;
00208 void writeParam(ByteStream &out_str) const;
00209 private:
00210 void decode(class GLParser & parser);
00211 static GUTF8String read_raw(ByteStream & str);
00212 static unsigned char decode_comp(char ch1, char ch2);
00213 static unsigned long int get_bg_color(class GLParser & parser);
00214 static int get_zoom(class GLParser & parser);
00215 static int get_mode(class GLParser & parser);
00216 static alignment get_hor_align(class GLParser & parser);
00217 static alignment get_ver_align(class GLParser & parser);
00218 static GPList<GMapArea> get_map_areas(class GLParser & parser);
00219 #ifndef NO_METADATA_IN_ANT_CHUNK
00220 static GMap<GUTF8String, GUTF8String>get_metadata(GLParser & parser);
00221 #endif
00222 static void del_all_items(const char * name, class GLParser & parser);
00223 };
00224
00225
00226
00227
00235 class DjVuAnno : public GPEnabled
00236 {
00237 protected:
00238 DjVuAnno(void) {}
00239 public:
00241 static GP<DjVuAnno> create(void) { return new DjVuAnno; }
00242
00243 GP<DjVuANT> ant;
00244
00249 void decode(const GP<ByteStream> &bs);
00250
00253 void encode(const GP<ByteStream> &bs);
00254
00256 GP<DjVuAnno> copy(void) const;
00257
00260 void merge(const GP<DjVuAnno> & anno);
00261
00264 inline unsigned int get_memory_usage() const;
00266 GUTF8String get_xmlmap(const GUTF8String &name, const int height) const;
00268 void writeMap(
00269 ByteStream &bs,const GUTF8String &name, const int height) const;
00271 GUTF8String get_paramtags(void) const;
00273 void writeParam(ByteStream &out_str) const;
00274 private:
00275 static void decode(ByteStream *);
00276 static void encode(ByteStream *);
00277 };
00278
00280
00281 inline unsigned int
00282 DjVuAnno::get_memory_usage() const
00283 {
00284 return (ant)?(ant->get_memory_usage()):0;
00285 }
00286
00287
00288
00289 #ifdef HAVE_NAMESPACES
00290 }
00291 # ifndef NOT_USING_DJVU_NAMESPACE
00292 using namespace DJVU;
00293 # endif
00294 #endif
00295 #endif