#include <djv_text.h>

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< Chunk > | encodeTXTzChunk (const PageInfo &inPageInfo) const =0 |
| virtual AutoPtr< Chunk > | encodeTXTaChunk (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< TextSearcher > | createTextSearcher () const =0 |
Static Public Member Functions | |
| static AutoPtr< TextZone > | create (const PageInfo &inPageInfo) |
| static AutoPtr< TextZone > | create (Type inType=Page) |
| static AutoPtr< TextZone > | create (const String &inText, Type inType, ssize_t inLeft, ssize_t inTop, ssize_t inWidth, ssize_t inHeight) |
| static AutoPtr< TextZone > | create (const String &inText, Type inType, const Rect &inRect) |
| static AutoPtr< TextZone > | decode (Stream *inStream, const PageInfo &inPageInfo) |
| static AutoPtr< TextZone > | decode (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) |
Public Attributes | |
| Type | type |
| The type of the text block. | |
| Rect | rect |
| The rectangle of the text block in pixels. | |
| String | text |
| Text of the text block. | |
| String | heading |
| Heading text. | |
| SimpleArray< AutoPtr< TextZone > > | children |
| Child text blocks. | |
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.
| static AutoPtr<TextZone> Celartem::DjVu::TextZone::create | ( | const String & | inText, | |
| Type | inType, | |||
| const Rect & | inRect | |||
| ) | [inline, static] |
Create the instance with the specified parameters.
| inText | Text stored in this text block. | |
| inType | The type of the text block. | |
| inRect | The position of the text block. |
| 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.
| inText | Text stored in this text block. | |
| inType | The type of the text block. | |
| inLeft | Left of the text block in pixels. | |
| inTop | Top of the text block in pixels. | |
| inWidth | Width of the text block in pixels. | |
| inHeight | Height of the text block in pixels. |
| virtual AutoPtr<TextSearcher> Celartem::DjVu::TextZone::createTextSearcher | ( | ) | const [pure virtual] |
Create a new instance of TextSearcher.
| 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*).
| inStream | The stream which contains TXTa block. | |
| inPageInfo | The dimensions and rotation status of the page is used during decoding the TXTa string. |
TXTa block. | static AutoPtr<TextZone> Celartem::DjVu::TextZone::decode | ( | const Chunk * | inChunk, | |
| const PageInfo & | inPageInfo | |||
| ) | [static] |
Decode the DjVu's TXTa or TXTz block.
| inChunk | The stream which contains TXTa block. | |
| inPageInfo | The dimensions and rotation status of the page is used during decoding the TXT* string. |
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.
| inStream | The stream to write on. | |
| inPageInfo | The dimensions and rotation status of the page is used during encoding the TXTa string. |
| virtual AutoPtr<Chunk> Celartem::DjVu::TextZone::encodeTXTaChunk | ( | const PageInfo & | inPageInfo | ) | const [pure virtual] |
Encode the instance to the DjVu's TXTa chunk.
| inPageInfo | The dimensions and rotation status of the page is used during encoding the TXTa string. |
TXTa Chunk. | virtual AutoPtr<Chunk> Celartem::DjVu::TextZone::encodeTXTzChunk | ( | const PageInfo & | inPageInfo | ) | const [pure virtual] |
Encode the instance to the DjVu's TXTz chunk.
| inPageInfo | The dimensions and rotation status of the page is used during encoding the TXTz string. |
TXTz Chunk. | virtual String Celartem::DjVu::TextZone::getFullText | ( | ) | const [pure virtual] |
| virtual Rect Celartem::DjVu::TextZone::getMinimumRectRequired | ( | ) | const [pure virtual] |
| virtual Rotation Celartem::DjVu::TextZone::getRotation | ( | ) | const [pure virtual] |
Get the current rotation angle.
| virtual void Celartem::DjVu::TextZone::setRotation | ( | Rotation | inRotation | ) | [pure virtual] |
Child text blocks.
Child text blocks.
text should be empty when the text block has child text blocks (children has any element).
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.
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.
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.
The type of the text block.