Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Celartem::DjVu::TextZone Class Referenceabstract

#include <djv_text.h>

Inheritance diagram for Celartem::DjVu::TextZone:
Inheritance graph
[legend]

Public Types

enum  Type {
  Invalid = 0, Page = 1, Column = 2, Region = 3,
  Paragraph = 4, Line = 5, Word = 6, Character = 7
}
 

Public Member Functions

virtual void encode (Stream *inStream, const PageInfo &inPageInfo) const =0
 
virtual AutoPtr< ChunkencodeTXTzChunk (const PageInfo &inPageInfo) const =0
 
virtual AutoPtr< ChunkencodeTXTaChunk (const PageInfo &inPageInfo) const =0
 
virtual Rotation getRotation () const =0
 
virtual void setRotation (Rotation inRotation)=0
 
virtual Rect getMinimumRectRequired () const =0
 
virtual String getFullText () const =0
 
virtual AutoPtr< TextSearchercreateTextSearcher () const =0
 
- Public Member Functions inherited from Celartem::Referable
 Referable ()
 
void addRef () const
 
void releaseRef () const
 
size_t getReferenceCount () const
 

Static Public Member Functions

static AutoPtr< TextZonecreate (const PageInfo &inPageInfo)
 
static AutoPtr< TextZonecreate (Type inType=Page)
 
static AutoPtr< TextZonecreate (const String &inText, Type inType, ssize_t inLeft, ssize_t inTop, ssize_t inWidth, ssize_t inHeight)
 
static AutoPtr< TextZonecreate (const String &inText, Type inType, const Rect &inRect)
 
static AutoPtr< TextZonedecode (Stream *inStream, const PageInfo &inPageInfo)
 
static AutoPtr< TextZonedecode (const Chunk *inChunk, const PageInfo &inPageInfo)
 
static Rect calcUnionRect (const AutoPtr< const TextZone > *inZones, size_t inCount)
 
static Rect calcUnionRect (const AutoPtr< TextZone > *inZones, size_t inCount)
 
static Rect calcUnionRect (const TextZone *const *inZones, size_t inCount)
 
- Static Public Member Functions inherited from Celartem::Referable
static void dumpDbgAllRefCount ()
 

Public Attributes

Type type
 The type of the text block. More...
 
Rect rect
 The rectangle of the text block in pixels. More...
 
String text
 Text of the text block. More...
 
String heading
 Heading text. More...
 
SimpleArray< AutoPtr< TextZone > > children
 Child text blocks. More...
 

Detailed Description

This structure represents a text block.
Unlike the DjVu file format, the coordinations used by the structure are all in left-to-right, top-to-bottom order and the origin (0,0) is the left-top most of the image.
Please note that this structure should not be initialized as auto variable; all the instances may be referenced by AutoPtr and you don't have to manage the lifetime. All the instance should be initialized via create function.

See Also
TextSearcher

Member Enumeration Documentation

This enumeration is used to specify the type of TextZone.

Enumerator
Invalid 

Invalid; reserved.

Page 

Page.

Column 

Column.

Region 

Region.

Paragraph 

Paragraph.

Line 

Line.

Word 

Word.

Character 

Character.

Member Function Documentation

static Rect Celartem::DjVu::TextZone::calcUnionRect ( const AutoPtr< const TextZone > *  inZones,
size_t  inCount 
)
static

Calculate the union rectangle of the specified TextZone instances.

Parameters
inZonesAn array of pointers to TextZone instances.
inCountThe count of TextZone instances in the array.
static Rect Celartem::DjVu::TextZone::calcUnionRect ( const AutoPtr< TextZone > *  inZones,
size_t  inCount 
)
static

Calculate the union rectangle of the specified TextZone instances.

Parameters
inZonesAn array of pointers to TextZone instances.
inCountThe count of TextZone instances in the array.
static Rect Celartem::DjVu::TextZone::calcUnionRect ( const TextZone *const *  inZones,
size_t  inCount 
)
static

Calculate the union rectangle of the specified TextZone instances.

Parameters
inZonesAn array of pointers to TextZone instances.
inCountThe count of TextZone instances in the array.
static AutoPtr<TextZone> Celartem::DjVu::TextZone::create ( const PageInfo inPageInfo)
static

Create the instance with the specified PageInfo.

Parameters
inPageInfoA PageInfo instance which describes the page which manages the newly created TextZone.
Returns
Pointer to the newly created TextZone instance.

Referenced by create().

static AutoPtr<TextZone> Celartem::DjVu::TextZone::create ( Type  inType = Page)
static

Create the instance with the default values.

Parameters
inTypeType of this TextZone instance.
Returns
Pointer to the newly created TextZone instance.
static AutoPtr<TextZone> Celartem::DjVu::TextZone::create ( const String inText,
Type  inType,
ssize_t  inLeft,
ssize_t  inTop,
ssize_t  inWidth,
ssize_t  inHeight 
)
static

Create the instance with the specified parameters.

Parameters
inTextText stored in this text block.
inTypeThe type of the text block.
inLeftLeft of the text block in pixels.
inTopTop of the text block in pixels.
inWidthWidth of the text block in pixels.
inHeightHeight of the text block in pixels.
Returns
Pointer to the newly created TextZone instance.
static AutoPtr<TextZone> Celartem::DjVu::TextZone::create ( const String inText,
Type  inType,
const Rect inRect 
)
inlinestatic

Create the instance with the specified parameters.

Parameters
inTextText stored in this text block.
inTypeThe type of the text block.
inRectThe position of the text block.
Returns
Pointer to the newly created TextZone instance.
virtual AutoPtr<TextSearcher> Celartem::DjVu::TextZone::createTextSearcher ( ) const
pure virtual

Create a new instance of TextSearcher.

Returns
Pointer to the newly created TextSearcher instance.
static AutoPtr<TextZone> Celartem::DjVu::TextZone::decode ( Stream inStream,
const PageInfo inPageInfo 
)
static

Decode the DjVu's TXTa block.
To decode TXTz chunk, you should firstly decompress the chunk using InflateStream. This method is for advanced purpose and for normal purpose, you had better use decode(const Chunk*).

Parameters
inStreamThe stream which contains TXTa block.
inPageInfoThe dimensions and rotation status of the page is used during decoding the TXTa string.
Returns
Pointer to TextZone instance which contains decoded TXTa block.
static AutoPtr<TextZone> Celartem::DjVu::TextZone::decode ( const Chunk inChunk,
const PageInfo inPageInfo 
)
static

Decode the DjVu's TXTa or TXTz block.

Parameters
inChunkThe stream which contains TXTa block.
inPageInfoThe dimensions and rotation status of the page is used during decoding the TXT* string.
Returns
Pointer to TextZone instance which contains decoded TXT* block.
virtual void Celartem::DjVu::TextZone::encode ( Stream inStream,
const PageInfo inPageInfo 
) const
pure virtual

Encode the instance to the DjVu's TXTa block.
This method is for advanced purpose and for normal purpose, you had better use encodeTXTzChunk or encodeTXTaChunk. To encode TXTz chunk, you should compress the returned data using DeflateStream.

Parameters
inStreamThe stream to write on.
inPageInfoThe dimensions and rotation status of the page is used during encoding the TXTa string.
See Also
encodeTXTzChunk, encodeTXTaChunk
virtual AutoPtr<Chunk> Celartem::DjVu::TextZone::encodeTXTaChunk ( const PageInfo inPageInfo) const
pure virtual

Encode the instance to the DjVu's TXTa chunk.

Parameters
inPageInfoThe dimensions and rotation status of the page is used during encoding the TXTa string.
Returns
TXTa Chunk.
virtual AutoPtr<Chunk> Celartem::DjVu::TextZone::encodeTXTzChunk ( const PageInfo inPageInfo) const
pure virtual

Encode the instance to the DjVu's TXTz chunk.

Parameters
inPageInfoThe dimensions and rotation status of the page is used during encoding the TXTz string.
Returns
TXTz Chunk.
virtual String Celartem::DjVu::TextZone::getFullText ( ) const
pure virtual

Get the full text in this TextZone.
If the TextZone does not have any children, return the text member variable directly. Otherwise, if it has any children, return the concatenated full text.

Returns
The full text of this TextZone.
virtual Rect Celartem::DjVu::TextZone::getMinimumRectRequired ( ) const
pure virtual

Calculate and sets the minimum rectangle which is required to this TextZone.
This method simply returns the rect member if the TextZone does not have any children.

virtual Rotation Celartem::DjVu::TextZone::getRotation ( ) const
pure virtual

Get the current rotation angle.

Returns
The current rotation angle.
virtual void Celartem::DjVu::TextZone::setRotation ( Rotation  inRotation)
pure virtual

Rotate the TextZone instance.
Please note that this may take long if there're many TextZone instances.

Parameters
inRotationThe resulting rotation angle.
Please note that this is NOT the degrees to rotate but the absolute rotation destination.

Member Data Documentation

SimpleArray<AutoPtr<TextZone> > Celartem::DjVu::TextZone::children

Child text blocks.

Child text blocks.
text should be empty when the text block has child text blocks (children has any element).

String Celartem::DjVu::TextZone::heading

Heading text.

Heading text.
This text is used to combine words into a line. For example, "Mr. Brown" is actually separated into two TextZones; "Mr." and "Brown" but there should be a separating space between them and heading of the second TextZone ("Brown") is the space.

Rect Celartem::DjVu::TextZone::rect

The rectangle of the text block in pixels.

If the text block has child text blocks, this variable is not used and you had better use getMinimumRectRequired method to get the actual rectangle.

String Celartem::DjVu::TextZone::text

Text of the text block.

Text of the text block.
It should be empty when the text block has child text blocks. To get full text of the subsidiary TextZones instances, use getFullText method.
To search some text from the tree structured TextZone instances, use TextSearcher. It provides a simple interface to deal with searchs.

Type Celartem::DjVu::TextZone::type

The type of the text block.


The documentation for this class was generated from the following file:

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:07.
Cuminas Logo