• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kviewshell

DjVuText.h

Go to the documentation of this file.
00001 //C-  -*- C++ -*-
00002 //C- -------------------------------------------------------------------
00003 //C- DjVuLibre-3.5
00004 //C- Copyright (c) 2002  Leon Bottou and Yann Le Cun.
00005 //C- Copyright (c) 2001  AT&T
00006 //C-
00007 //C- This software is subject to, and may be distributed under, the
00008 //C- GNU General Public License, Version 2. The license should have
00009 //C- accompanied the software or you may obtain a copy of the license
00010 //C- from the Free Software Foundation at http://www.fsf.org .
00011 //C-
00012 //C- This program is distributed in the hope that it will be useful,
00013 //C- but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //C- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //C- GNU General Public License for more details.
00016 //C- 
00017 //C- DjVuLibre-3.5 is derived from the DjVu(r) Reference Library
00018 //C- distributed by Lizardtech Software.  On July 19th 2002, Lizardtech 
00019 //C- Software authorized us to replace the original DjVu(r) Reference 
00020 //C- Library notice by the following text (see doc/lizard2002.djvu):
00021 //C-
00022 //C-  ------------------------------------------------------------------
00023 //C- | DjVu (r) Reference Library (v. 3.5)
00024 //C- | Copyright (c) 1999-2001 LizardTech, Inc. All Rights Reserved.
00025 //C- | The DjVu Reference Library is protected by U.S. Pat. No.
00026 //C- | 6,058,214 and patents pending.
00027 //C- |
00028 //C- | This software is subject to, and may be distributed under, the
00029 //C- | GNU General Public License, Version 2. The license should have
00030 //C- | accompanied the software or you may obtain a copy of the license
00031 //C- | from the Free Software Foundation at http://www.fsf.org .
00032 //C- |
00033 //C- | The computer code originally released by LizardTech under this
00034 //C- | license and unmodified by other parties is deemed "the LIZARDTECH
00035 //C- | ORIGINAL CODE."  Subject to any third party intellectual property
00036 //C- | claims, LizardTech grants recipient a worldwide, royalty-free, 
00037 //C- | non-exclusive license to make, use, sell, or otherwise dispose of 
00038 //C- | the LIZARDTECH ORIGINAL CODE or of programs derived from the 
00039 //C- | LIZARDTECH ORIGINAL CODE in compliance with the terms of the GNU 
00040 //C- | General Public License.   This grant only confers the right to 
00041 //C- | infringe patent claims underlying the LIZARDTECH ORIGINAL CODE to 
00042 //C- | the extent such infringement is reasonably necessary to enable 
00043 //C- | recipient to make, have made, practice, sell, or otherwise dispose 
00044 //C- | of the LIZARDTECH ORIGINAL CODE (or portions thereof) and not to 
00045 //C- | any greater extent that may be necessary to utilize further 
00046 //C- | modifications or combinations.
00047 //C- |
00048 //C- | The LIZARDTECH ORIGINAL CODE is provided "AS IS" WITHOUT WARRANTY
00049 //C- | OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
00050 //C- | TO ANY WARRANTY OF NON-INFRINGEMENT, OR ANY IMPLIED WARRANTY OF
00051 //C- | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
00052 //C- +------------------------------------------------------------------
00053 // 
00054 // $Id: DjVuText.h,v 1.10 2003/11/07 22:08:21 leonb Exp $
00055 // $Name: release_3_5_15 $
00056 
00057 #ifndef _DJVUTEXT_H
00058 #define _DJVUTEXT_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 
00087 
00088 
00089 #include "GMapAreas.h"
00090 
00091 #ifdef HAVE_NAMESPACES
00092 namespace DJVU {
00093 # ifdef NOT_DEFINED // Just to fool emacs c++ mode
00094 }
00095 #endif
00096 #endif
00097 
00098 
00099 class ByteStream;
00100 
00101 // -------- DJVUTXT --------
00102 
00109 class DjVuTXT : public GPEnabled
00110 {
00111 protected:
00112   DjVuTXT(void) {}
00113 public:
00115   static GP<DjVuTXT> create(void) {return new DjVuTXT();}
00116 
00120   enum ZoneType { PAGE=1, COLUMN=2, REGION=3, PARAGRAPH=4, 
00121                   LINE=5, WORD=6, CHARACTER=7 };
00124   class Zone 
00125   {
00126   public:
00127     Zone();
00129     enum ZoneType ztype;
00131     GRect rect;
00133     int text_start;
00135     int text_length;
00137     GList<Zone> children;
00141     Zone *append_child();
00143     void get_text_with_rect(const GRect &box, 
00144                             int &string_start,int &string_end ) const;
00146     void find_zones(GList<Zone *> &list, 
00147                     const int string_start, const int string_end) const;
00149     void get_smallest(GList<GRect> &list) const;
00153     void get_smallest(GList<GRect> &list,const int padding) const;
00155     const Zone *get_parent(void) const;
00156   private:
00157     friend class DjVuTXT;
00158     const Zone *zone_parent;
00159     void cleartext();
00160     void normtext(const char *instr, GUTF8String &outstr);
00161     unsigned int memuse() const;
00162     static const int version;
00163     void encode(const GP<ByteStream> &bs, 
00164                 const Zone * parent=0, const Zone * prev=0) const;
00165     void decode(const GP<ByteStream> &bs, int maxtext,
00166                 const Zone * parent=0, const Zone * prev=0);
00167   };
00180   GUTF8String textUTF8;
00181   static const char end_of_column    ;      // VT: Vertical Tab
00182   static const char end_of_region    ;      // GS: Group Separator
00183   static const char end_of_paragraph ;      // US: Unit Separator
00184   static const char end_of_line      ;      // LF: Line Feed
00187   Zone page_zone;
00189   int has_valid_zones() const;
00195   void normalize_text();
00197   void encode(const GP<ByteStream> &bs) const;
00199   void decode(const GP<ByteStream> &bs);
00201   GP<DjVuTXT> copy(void) const;
00203   void writeText(ByteStream &bs,const int height) const;
00205   GUTF8String get_xmlText(const int height) const;
00207   GList<Zone*> find_text_in_rect(GRect target_rect, GUTF8String &text) const;
00209   GList<GRect> find_text_with_rect(const GRect &box, GUTF8String &text, const int padding=0) const;
00212   void get_zones(int zone_type, const Zone *parent, GList<Zone *> & zone_list) const;
00215   unsigned int get_memory_usage() const;
00216 };
00217 
00218 inline const DjVuTXT::Zone *
00219 DjVuTXT::Zone::get_parent(void) const
00220 {
00221   return zone_parent;
00222 }
00223 
00224 
00225 class DjVuText : public GPEnabled
00226 {
00227 protected:
00228    DjVuText(void) {}
00229 public:
00231    static GP<DjVuText> create(void) {return new DjVuText();}
00232 
00237    void decode(const GP<ByteStream> &bs);
00238 
00241    void encode(const GP<ByteStream> &bs);
00242 
00244    GP<DjVuText> copy(void) const;
00245 
00248    inline unsigned int get_memory_usage() const;
00249 
00251    void writeText(ByteStream &bs,const int height) const;
00252 
00254    GUTF8String get_xmlText(const int height) const;
00255 
00256    GP<DjVuTXT>  txt;
00257 private: // dummy stuff
00258    static void decode(ByteStream *);
00259    static void  encode(ByteStream *);
00260 };
00261 
00263 
00264 inline unsigned int
00265 DjVuText::get_memory_usage() const
00266 {
00267   return (txt)?(txt->get_memory_usage()):0;
00268 }
00269 
00270 
00271 // ----- THE END
00272 
00273 #ifdef HAVE_NAMESPACES
00274 }
00275 # ifndef NOT_USING_DJVU_NAMESPACE
00276 using namespace DJVU;
00277 # endif
00278 #endif
00279 #endif
00280 
00281 

kviewshell

Skip menu "kviewshell"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • kviewshell
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal