Logo Search packages:      
Sourcecode: djvulibre version File versions

void DjVuDocEditor::insert_page ( GP< DataPool > &  file_pool,
const GURL fname,
int  page_num = -1 

Inserts a new page with data inside the data_pool# as page number page_num.

data_pool {DataPool} with data for this page.
file_name Name, which will be assigned to this page. If you try to save the document in INDIRECT# format, a file with this name will be created to hold the page's data. If there is already a file in the document with the same name, the function will derive a new unique name from file_name, which will be assigned to the page.
page_num Describes where the page should be inserted. Negative number means "append".

Definition at line 898 of file DjVuDocEditor.cpp.

References GURL::fname(), and DjVuDocument::get_djvm_dir().

   DEBUG_MSG("DjVuDocEditor::insert_page(): pool size='" <<
           _file_pool->get_size() << "'\n");

   const GP<DjVmDir> dir(get_djvm_dir());

      // Strip any INCL chunks (we do not allow to insert hierarchies
      // using this function)
   const GP<DataPool> file_pool(strip_incl_chunks(_file_pool));
      // Now obtain ID for the new file
   const GUTF8String id(find_unique_id(file_url.fname()));

      // Add it into the directory
   const GP<DjVmDir::File> frec(DjVmDir::File::create(
     id, id, id, DjVmDir::File::PAGE));
   int pos=dir->get_page_pos(page_num);
   dir->insert_file(frec, pos);

      // Add it to our "cache"
      GP<File> f=new File;
      GCriticalSectionLock lock(&files_lock);

Generated by  Doxygen 1.6.0   Back to index