Logo Search packages:      
Sourcecode: djvulibre version File versions

DjVuDocEditor Class Reference

#include <DjVuDocEditor.h>

Inheritance diagram for DjVuDocEditor:

DjVuDocument DjVuPort GPEnabled

List of all members.

Detailed Description

DjVuDocEditor# is an extension of {DjVuDocument} class with additional capabilities for editing the document contents.

It can be used to: {enumerate} Create (compose) new multipage DjVu documents using single page DjVu documents. The class does { not} do compression. Insert and remove different pages of multipage DjVu documents. Change attributes ({names}, {IDs} and {titles}) of files composing the DjVu document. Generate thumbnail images and integrate them into the document. {enumerate}

Definition at line 104 of file DjVuDocEditor.h.


Files #"DjVuDocument.h"# and #"DjVuDocument.cpp"# contain implementation of the {DjVuDocument} class - the ideal tool for opening, decoding and saving DjVu single page and multi page documents.

DjVu document class.

Andrei Erofeev <eaf@geocities.com>
DjVuDocument.h,v 1.9 2003/11/07 22:08:20 leonb Exp

static GP< DjVuDocumentcreate (const GURL &url, GP< DjVuPort > xport=0, DjVuFileCache *const xcache=0)
bool can_compress (void) const
DjVuFileCacheget_cache (void) const
 Returns cache being used.
GP< DjVmDirget_djvm_dir (void) const
GP< DjVmDir0get_djvm_dir0 (void) const
long get_doc_flags (void) const
int get_doc_type (void) const
GP< DataPoolget_init_data_pool (void) const
GURL get_init_url (void) const
 Returns the URL passed to the {init}() function.
GP< DjVuNavDirget_nav_dir (void) const
void init (const GURL &url, GP< DjVuPort > port=0, DjVuFileCache *cache=0)
bool is_bundled (void) const
bool is_init_complete (void) const
bool is_init_failed (void) const
bool is_init_ok (void) const
bool needs_compression (void) const
bool needs_rename (void) const
void set_needs_compression (void)
virtual void set_recover_errors (ErrorRecoveryAction=ABORT)
virtual void set_verbose_eof (bool=true)


These virtual functions may be overridden by the subclasses of DjVuPort#. They are called by the {DjVuPortcaster} when the port is alive and when there is a route between the source of the notification and this port.

virtual void notify_chunk_done (const DjVuPort *source, const GUTF8String &name)
virtual void notify_decode_progress (const DjVuPort *source, float done)
virtual void notify_doc_flags_changed (const class DjVuDocument *source, long set_mask, long clr_mask)
virtual bool notify_error (const DjVuPort *source, const GUTF8String &msg)
virtual void notify_file_flags_changed (const class DjVuFile *source, long set_mask, long clr_mask)
virtual void notify_redisplay (const class DjVuImage *source)
virtual void notify_relayout (const class DjVuImage *source)
virtual bool notify_status (const DjVuPort *source, const GUTF8String &msg)
enum  ErrorRecoveryAction { ABORT = 0, SKIP_PAGES = 1, SKIP_CHUNKS = 2, KEEP_ALL = 3 }

Public Types

enum  DOC_FLAGS {
enum  DOC_TYPE {

Public Member Functions

bool can_be_saved (void) const
void create_shared_anno_file (void(*progress_cb)(float progress, void *)=0, void *cl_data=0)
int get_count (void) const
GURL get_doc_url (void) const
GList< GUTF8Stringget_id_list (void)
 Returns a listing of id's used by this document.
int get_orig_doc_type (void) const
int get_save_doc_type (void) const
GP< DjVuFileget_shared_anno_file (void)
virtual GList< GURLget_url_names (void)
virtual GP< DjVuFileid_to_file (const DjVuPort *source, const GUTF8String &id)
virtual GURL id_to_url (const DjVuPort *source, const GUTF8String &id)
 Converts the specified id to a URL.
virtual bool inherits (const GUTF8String &class_name) const
GUTF8String insert_file (const GURL &url, const GUTF8String &parent_id, int chunk_num=1, DjVuPort *source=0)
void insert_group (const GList< GURL > &furl_list, int page_num=-1, void(*refresh_cb)(void *)=0, void *cl_data=0)
void insert_page (GP< DataPool > &file_pool, const GURL &fname, int page_num=-1)
void insert_page (const GURL &fname, int page_num=-1)
void map_ids (GMap< GUTF8String, void * > &map)
 Fill the id's into a GMap.
void move_page (int page_num, int new_page_num)
void move_pages (const GList< int > &page_list, int shift)
virtual void notify_file_flags_changed (const DjVuFile *source, long set_mask, long clr_mask)
GUTF8String page_to_id (int page_num) const
void remove_file (const GUTF8String &id, bool remove_unref=true)
void remove_page (int page_num, bool remove_unref=true)
void remove_pages (const GList< int > &page_list, bool remove_unref=true)
virtual GP< DataPoolrequest_data (const DjVuPort *source, const GURL &url)
void save (void)
virtual void save_as (const GURL &where, bool bundled)
void save_pages_as (const GP< ByteStream > &str, const GList< int > &page_list)
void set_file_name (const GUTF8String &id, const GUTF8String &name)
void set_file_title (const GUTF8String &id, const GUTF8String &title)
void set_page_name (int page_num, const GUTF8String &name)
void set_page_title (int page_num, const GUTF8String &title)
void simplify_anno (void(*progress_cb)(float progress, void *)=0, void *cl_data=0)
void start_init (const GURL &url, GP< DjVuPort > port=0, DjVuFileCache *cache=0)
void stop_init (void)
bool wait_for_complete_init (void)
int wait_get_pages_num (void) const
virtual void write (const GP< ByteStream > &str, const GMap< GUTF8String, void * > &reserved)
virtual void write (const GP< ByteStream > &str, bool force_djvm=false)
void writeDjVuXML (const GP< ByteStream > &gstr_out, int flags) const
 Create a complete DjVuXML file.
virtual ~DjVuDocEditor (void)
Saving document to disk

void expand (const GURL &codebase, const GUTF8String &idx_name)
GP< DjVmDocget_djvm_doc (void)

void generate_thumbnails (int thumb_size, bool(*cb)(int page_num, void *)=0, void *cl_data=0)
int generate_thumbnails (int thumb_size, int page_num)
int get_thumbnails_num (void) const
int get_thumbnails_size (void) const
void remove_thumbnails (void)
Accessing pages

GP< DjVuFileget_djvu_file (const GURL &url, bool dont_create=false)
GP< DjVuFileget_djvu_file (const GUTF8String &id, bool dont_create=false)
GP< DjVuFileget_djvu_file (int page_num, bool dont_create=false)
GP< DjVuFileget_djvu_file (int page_num, bool dont_create=false) const
GP< DjVuImageget_page (const GUTF8String &id, bool sync=true, DjVuPort *port=0)
GP< DjVuImageget_page (int page_num, bool sync=true, DjVuPort *port=0)
GP< DjVuImageget_page (int page_num, bool sync=true, DjVuPort *port=0) const
int get_pages_num (void) const
float get_thumbnails_gamma (void) const
int id_to_page (const GUTF8String &id) const
 Find out which page this id is...
GURL id_to_url (const GUTF8String &id) const
GURL page_to_url (int page_num) const
GUTF8String url_to_id (const GURL &url) const
 Map the specified url to it's id.
int url_to_page (const GURL &url) const

Static Public Member Functions

static GP< DjVuDocumentcreate (const GP< ByteStream > &bs, GP< DjVuPort > xport=0, DjVuFileCache *const xcache=0)
static GP< DjVuDocumentcreate (GP< DataPool > pool, GP< DjVuPort > xport=0, DjVuFileCache *const xcache=0)
static GP< DjVuDocumentcreate_noinit (void)
static GP< DjVuDocumentcreate_wait (const GURL &url, GP< DjVuPort > xport=0, DjVuFileCache *const xcache=0)
static GP< DjVuDocEditorcreate_wait (void)
static GP< DjVuDocEditorcreate_wait (const GURL &url)
static DjVuPortcasterget_portcaster (void)
static void operator delete (void *addr)
static void * operator new (size_t sz)
static void set_compress_codec (void(*codec)(GP< ByteStream > &, const GURL &where, bool bundled))
static void set_import_codec (void(*codec)(GP< DataPool > &, const GURL &url, bool &, bool &))

Static Public Attributes

static int thumbnails_per_file = 10

Protected Member Functions

GP< ThumbReq > add_thumb_req (const GP< ThumbReq > &thumb_req)
void add_to_cache (const GP< DjVuFile > &f)
void check () const
void check_unnamed_files (void)
 DjVuDocEditor (void)
 Default constructor.
GUTF8String get_int_prefix (void) const
virtual GP< DataPoolget_thumbnail (int page_num, bool dont_decode)
void init (const GURL &url)
void init (void)
void init_thread (void)
GURL invent_url (const GUTF8String &name) const
void process_threqs (void)
void set_file_aliases (const DjVuFile *file)
virtual GP< DjVuFileurl_to_file (const GURL &url, bool dont_create) const

Static Protected Member Functions

static void static_init_thread (void *)

Protected Attributes

bool can_compress_flag
volatile int count
 The reference counter.
GP< DjVmDirdjvm_dir
GP< DjVmDir0djvm_dir0
int doc_type
GUTF8String first_page_name
GSafeFlags flags
bool has_url_names
GP< DataPoolinit_data_pool
GP< DjVuDocumentinit_life_saver
bool init_started
GThread init_thr
GSafeFlags init_thread_flags
GURL init_url
GP< DjVuNavDirndir
GP< DjVuFilendir_file
bool needs_compression_flag
bool needs_rename_flag
ErrorRecoveryAction recover_errors
GP< DjVuSimplePortsimple_port
GPList< ThumbReq > threqs_list
GCriticalSection threqs_lock
GPList< UnnamedFile > ufiles_list
GCriticalSection ufiles_lock
GList< GURLurl_names
GCriticalSection url_names_lock
bool verbose_eof

Static Protected Attributes

static void(* djvu_compress_codec )(GP< ByteStream > &bs, const GURL &where, bool bundled)
static void(* djvu_import_codec )(GP< DataPool > &pool, const GURL &url, bool &needs_compression, bool &needs_rename)
static const float thumb_gamma = (float)2.20

Private Member Functions

void check (void)
void clean_files_map (void)
void file_thumbnails (void)
GUTF8String find_unique_id (GUTF8String id)
void generate_ref_map (const GP< DjVuFile > &file, GMap< GUTF8String, void * > &ref_map, GMap< GURL, void * > &visit_map)
bool insert_file (const GURL &file_url, bool is_page, int &file_pos, GMap< GUTF8String, GUTF8String > &name2id, DjVuPort *source=0)
bool insert_file (const GP< DataPool > &pool, const GURL &file_url, bool is_page, int &file_pos, GMap< GUTF8String, GUTF8String > &name2id, DjVuPort *source=0)
bool insert_file_type (const GURL &file_url, DjVmDir::File::FILE_TYPE page_type, int &file_pos, GMap< GUTF8String, GUTF8String > &name2id)
void move_file (const GUTF8String &id, int &file_pos, GMap< GUTF8String, void * > &map)
void remove_file (const GUTF8String &id, bool remove_unref, GMap< GUTF8String, void * > &ref_map)
void save_file (const GUTF8String &id, const GURL &codebase, GMap< GUTF8String, GUTF8String > &map)
void save_file (const GUTF8String &id, const GURL &codebase, const bool only_modified, GMap< GUTF8String, GUTF8String > &map)
GP< DataPoolstrip_incl_chunks (const GP< DataPool > &pool)
void unfile_thumbnails (void)

Private Attributes

GP< DataPooldoc_pool
GURL doc_url
GCriticalSection files_lock
GPMap< GUTF8String, File > files_map
bool initialized
int orig_doc_pages
int orig_doc_type
void(* refresh_cb )(void *)
void * refresh_cl_data
GCriticalSection thumb_lock
GPMap< GUTF8String, DataPoolthumb_map
GURL tmp_doc_url


class CThumbNails


class  File

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

Generated by  Doxygen 1.6.0   Back to index