diff options
Diffstat (limited to 'kviewshell/plugins/djvu/libdjvu/DjVuText.cpp')
-rw-r--r-- | kviewshell/plugins/djvu/libdjvu/DjVuText.cpp | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/kviewshell/plugins/djvu/libdjvu/DjVuText.cpp b/kviewshell/plugins/djvu/libdjvu/DjVuText.cpp index b359df41..cac6869b 100644 --- a/kviewshell/plugins/djvu/libdjvu/DjVuText.cpp +++ b/kviewshell/plugins/djvu/libdjvu/DjVuText.cpp @@ -88,7 +88,7 @@ static inline TYPE min(TYPE a,TYPE b) { return (a<b)?a:b; } //******************************** DjVuTXT ********************************** //*************************************************************************** -const char DjVuTXT::end_of_column = 013; // VT: Vertical Tab +const char DjVuTXT::end_of_column = 013; // VT:Qt::Vertical Tab const char DjVuTXT::end_of_region = 035; // GS: Group Separator const char DjVuTXT::end_of_paragraph = 037; // US: Unit Separator const char DjVuTXT::end_of_line = 012; // LF: Line Feed @@ -108,8 +108,8 @@ DjVuTXT::Zone::append_child() empty.text_start = 0; empty.text_length = 0; empty.zone_parent=this; - children.append(empty); - return & children[children.lastpos()]; + tqchildren.append(empty); + return & tqchildren[tqchildren.lastpos()]; } void @@ -117,8 +117,8 @@ DjVuTXT::Zone::cleartext() { text_start = 0; text_length = 0; - for (GPosition i=children; i; ++i) - children[i].cleartext(); + for (GPosition i=tqchildren; i; ++i) + tqchildren[i].cleartext(); } void @@ -128,8 +128,8 @@ DjVuTXT::Zone::normtext(const char *instr, GUTF8String &outstr) { // Descend collecting text below text_start = outstr.length(); - for (GPosition i=children; i; ++i) - children[i].normtext(instr, outstr); + for (GPosition i=tqchildren; i; ++i) + tqchildren[i].normtext(instr, outstr); text_length = outstr.length() - text_start; // Ignore empty zones if (text_length == 0) @@ -142,8 +142,8 @@ DjVuTXT::Zone::normtext(const char *instr, GUTF8String &outstr) outstr = outstr + GUTF8String(instr+text_start, text_length); text_start = new_start; // Clear textual information on lower level nodes - for (GPosition i=children; i; ++i) - children[i].cleartext(); + for (GPosition i=tqchildren; i; ++i) + tqchildren[i].cleartext(); } // Determine standard separator char sep; @@ -174,8 +174,8 @@ unsigned int DjVuTXT::Zone::memuse() const { int memuse = sizeof(*this); - for (GPosition i=children; i; ++i) - memuse += children[i].memuse(); + for (GPosition i=tqchildren; i; ++i) + memuse += tqchildren[i].memuse(); return memuse; } @@ -183,14 +183,14 @@ DjVuTXT::Zone::memuse() const #ifndef NEED_DECODER_ONLY void DjVuTXT::Zone::encode( - const GP<ByteStream> &gbs, const Zone * parent, const Zone * prev) const + const GP<ByteStream> &gbs, const Zone * tqparent, const Zone * prev) const { ByteStream &bs=*gbs; // Encode type bs.write8(ztype); // Modify text_start and bounding rectangle based on the context - // (whether there is a previous non-zero same-level-child or parent) + // (whether there is a previous non-zero same-level-child or tqparent) int start=text_start; int x=rect.xmin, y=rect.ymin; int width=rect.width(), height=rect.height(); @@ -212,13 +212,13 @@ DjVuTXT::Zone::encode( y=y-prev->rect.ymin; } start-=prev->text_start+prev->text_length; - } else if (parent) + } else if (tqparent) { - // Encode offset from the upper left corner of the parent + // Encode offset from the upper left corner of the tqparent // in the coord system in that corner with x to the right and y down - x=x-parent->rect.xmin; - y=parent->rect.ymax-(y+height); - start-=parent->text_start; + x=x-tqparent->rect.xmin; + y=tqparent->rect.ymax-(y+height); + start-=tqparent->text_start; } // Encode rectangle bs.write16(0x8000+x); @@ -228,22 +228,22 @@ DjVuTXT::Zone::encode( // Encode text info bs.write16(0x8000+start); bs.write24(text_length); - // Encode number of children - bs.write24(children.size()); + // Encode number of tqchildren + bs.write24(tqchildren.size()); const Zone * prev_child=0; - // Encode all children - for (GPosition i=children; i; ++i) + // Encode all tqchildren + for (GPosition i=tqchildren; i; ++i) { - children[i].encode(gbs, this, prev_child); - prev_child=&children[i]; + tqchildren[i].encode(gbs, this, prev_child); + prev_child=&tqchildren[i]; } } #endif void DjVuTXT::Zone::decode(const GP<ByteStream> &gbs, int maxtext, - const Zone * parent, const Zone * prev) + const Zone * tqparent, const Zone * prev) { ByteStream &bs=*gbs; // Decode type @@ -273,23 +273,23 @@ DjVuTXT::Zone::decode(const GP<ByteStream> &gbs, int maxtext, y=y+prev->rect.ymin; } text_start+=prev->text_start+prev->text_length; - } else if (parent) + } else if (tqparent) { - x=x+parent->rect.xmin; - y=parent->rect.ymax-(y+height); - text_start+=parent->text_start; + x=x+tqparent->rect.xmin; + y=tqparent->rect.ymax-(y+height); + text_start+=tqparent->text_start; } rect=GRect(x, y, width, height); - // Get children size + // Get tqchildren size int size = bs.read24(); // Checks if (rect.isempty() || text_start<0 || text_start+text_length>maxtext ) G_THROW( ERR_MSG("DjVuText.corrupt_text") ); - // Process children + // Process tqchildren const Zone * prev_child=0; - children.empty(); + tqchildren.empty(); while (size-- > 0) { Zone *z = append_child(); @@ -311,7 +311,7 @@ DjVuTXT::has_valid_zones() const { if (!textUTF8) return false; - if (page_zone.children.isempty() || page_zone.rect.isempty()) + if (page_zone.tqchildren.isempty() || page_zone.rect.isempty()) return false; return true; } @@ -382,8 +382,8 @@ void DjVuTXT::Zone::get_text_with_rect(const GRect &box, int &string_start, int &string_end) const { - GPosition pos=children; - if(pos?box.contains(rect):intersects_zone(box,rect)) + GPosition pos=tqchildren; + if(pos?box.tqcontains(rect):intersects_zone(box,rect)) { const int text_end=text_start+text_length; if(string_start == string_end) @@ -401,7 +401,7 @@ DjVuTXT::Zone::get_text_with_rect(const GRect &box, { do { - children[pos].get_text_with_rect(box,string_start,string_end); + tqchildren[pos].get_text_with_rect(box,string_start,string_end); } while(++pos); } } @@ -419,18 +419,18 @@ DjVuTXT::Zone::find_zones(GList<Zone *> &list, } else if(text_start < string_end) { - if (children.size()) - for (GPosition pos=children; pos; ++pos) - children[pos].find_zones(list,string_start,string_end); + if (tqchildren.size()) + for (GPosition pos=tqchildren; pos; ++pos) + tqchildren[pos].find_zones(list,string_start,string_end); else list.append(const_cast<Zone *>(this)); } } else if( text_end > string_start) { - if (children.size()) - for (GPosition pos=children; pos; ++pos) - children[pos].find_zones(list,string_start,string_end); + if (tqchildren.size()) + for (GPosition pos=tqchildren; pos; ++pos) + tqchildren[pos].find_zones(list,string_start,string_end); else list.append(const_cast<Zone *>(this)); } @@ -439,11 +439,11 @@ DjVuTXT::Zone::find_zones(GList<Zone *> &list, void DjVuTXT::Zone::get_smallest(GList<GRect> &list) const { - GPosition pos=children; + GPosition pos=tqchildren; if(pos) { do { - children[pos].get_smallest(list); + tqchildren[pos].get_smallest(list); } while (++pos); } else @@ -455,11 +455,11 @@ DjVuTXT::Zone::get_smallest(GList<GRect> &list) const void DjVuTXT::Zone::get_smallest(GList<GRect> &list, const int padding) const { - GPosition pos=children; + GPosition pos=tqchildren; if(pos) { do { - children[pos].get_smallest(list,padding); + tqchildren[pos].get_smallest(list,padding); } while (++pos); } else if(zone_parent && zone_parent->ztype >= PARAGRAPH) @@ -484,26 +484,26 @@ DjVuTXT::Zone::get_smallest(GList<GRect> &list, const int padding) const } void -DjVuTXT::get_zones(int zone_type, const Zone *parent, +DjVuTXT::get_zones(int zone_type, const Zone *tqparent, GList<Zone *> & zone_list) const - // get all the zones of type zone_type under zone node parent + // get all the zones of type zone_type under zone node tqparent { - // search all branches under parent - const Zone *zone=parent; + // search all branches under tqparent + const Zone *zone=tqparent; for( int cur_ztype=zone->ztype; cur_ztype<zone_type; ++cur_ztype ) { GPosition pos; - for(pos=zone->children; pos; ++pos) + for(pos=zone->tqchildren; pos; ++pos) { - Zone *zcur=(Zone *)&zone->children[pos]; + Zone *zcur=(Zone *)&zone->tqchildren[pos]; if ( zcur->ztype == zone_type ) { GPosition zpos=zone_list; if ( !zone_list.search(zcur,zpos) ) zone_list.append(zcur); } - else if ( zone->children[pos].ztype < zone_type ) - get_zones(zone_type, &zone->children[pos], zone_list); + else if ( zone->tqchildren[pos].ztype < zone_type ) + get_zones(zone_type, &zone->tqchildren[pos], zone_list); } } } @@ -617,7 +617,7 @@ DjVuTXT::find_text_in_rect(GRect target_rect, GUTF8String &text) const { GRect rect=words[p]->rect; if(rect.intersect(rect,target_rect)) - //if (target_rect.contains(words[p]->rect)) + //if (target_rect.tqcontains(words[p]->rect)) zone_list.append(words[p]); } } else @@ -631,7 +631,7 @@ DjVuTXT::find_text_in_rect(GRect target_rect, GUTF8String &text) const { GRect rect=words[p]->rect; if(rect.intersect(rect,target_rect)) - //if (target_rect.contains(words[p]->rect)) + //if (target_rect.tqcontains(words[p]->rect)) { start=false; zone_list.append(words[p]); @@ -648,7 +648,7 @@ DjVuTXT::find_text_in_rect(GRect target_rect, GUTF8String &text) const { GRect rect=words[p]->rect; if(rect.intersect(rect,target_rect)) - //if(target_rect.contains(words[p]->rect) ) + //if(target_rect.tqcontains(words[p]->rect) ) { end=false; zone_list.append(words[p]); @@ -864,7 +864,7 @@ static void writeText( ByteStream & str_out, const GUTF8String &textUTF8, const DjVuTXT::ZoneType zlayer, - const GList<DjVuTXT::Zone> &children, + const GList<DjVuTXT::Zone> &tqchildren, const int WindowHeight ) { // assert( txt->has_valid_zones() ); @@ -873,12 +873,12 @@ writeText( ByteStream & str_out, // Beginning tags for missing layers int layer=(int)zlayer; // Output the next layer - for(GPosition pos=children ; pos ; ++pos ) + for(GPosition pos=tqchildren ; pos ; ++pos ) { - str_out.writestring(tolayer(layer,children[pos].ztype)); + str_out.writestring(tolayer(layer,tqchildren[pos].ztype)); writeText( str_out, textUTF8, - children[pos], + tqchildren[pos], WindowHeight ); } str_out.writestring(tolayer(layer,zlayer)); @@ -893,7 +893,7 @@ writeText( ByteStream & str_out, // DEBUG_MSG( "--zonetype=" << zone.ztype << "\n" ); const GUTF8String xindent(indent( 2 * zone.ztype + 2 )); - GPosition pos=zone.children; + GPosition pos=zone.tqchildren; // Build attribute string if( ! pos ) { @@ -908,7 +908,7 @@ writeText( ByteStream & str_out, str_out.writestring(end_tag(zone.ztype)); } else { - writeText(str_out,textUTF8,zone.ztype,zone.children,WindowHeight); + writeText(str_out,textUTF8,zone.ztype,zone.tqchildren,WindowHeight); } } @@ -917,7 +917,7 @@ DjVuTXT::writeText(ByteStream &str_out,const int height) const { if(has_valid_zones()) { - ::writeText(str_out,textUTF8,DjVuTXT::PAGE,page_zone.children,height); + ::writeText(str_out,textUTF8,DjVuTXT::PAGE,page_zone.tqchildren,height); }else { str_out.writestring(start_tag(DjVuTXT::PAGE)); |