Logo Search packages:      
Sourcecode: djvulibre version File versions

void DjVuDocument::write ( const GP< ByteStream > &  str,
bool  force_djvm = false 
) [virtual]

Saves the document in the {new bundled} format. All the data is "bundled" into one file and this file is written into the passed stream.

If force_djvm# is TRUE# then even one page documents will be saved in the DJVM BUNDLED# format (inside a FORM:DJVM#);

{ Plugin Warning}. This function will read contents of the whole document. Thus, if you call it from the main thread (the thread, which transfers data from Netscape), the plugin will block.

Reimplemented in DjVuDocEditor.

Definition at line 1739 of file DjVuDocument.cpp.

References ByteStream::copy(), get_djvm_doc(), and ByteStream::writall().

Referenced by save_as(), and DjVuDocEditor::write().

{
  DEBUG_MSG("DjVuDocument::write(): storing DjVmDoc into ByteStream\n");
  DEBUG_MAKE_INDENT(3);
   
  GP<DjVmDoc> doc=get_djvm_doc();
  GP<DjVmDir> dir=doc->get_djvm_dir();
  if (force_djvm || dir->get_files_num()>1)
  {
    doc->write(gstr);
  }else
  {
    GPList<DjVmDir::File> files_list=dir->resolve_duplicates(false);
    GP<DataPool> pool=doc->get_data(files_list[files_list]->get_load_name());
    GP<ByteStream> pool_str=pool->get_stream();
    ByteStream &str=*gstr;
    str.writall(octets,4);
    str.copy(*pool_str);
  }
}


Generated by  Doxygen 1.6.0   Back to index