Logo Search packages:      
Sourcecode: djvulibre version File versions

void DjVuDocEditor::move_page ( int  page_num,
int  new_page_num 
)

Makes page number page_num# to be new_page_num#. If new_page_num# is negative or too big, the function will move page page_num# to the end of the document.

Definition at line 1164 of file DjVuDocEditor.cpp.

References DjVmDir::get_page_pos(), DjVuDocument::get_pages_num(), and page_to_id().

Referenced by move_pages().

{
   DEBUG_MSG("DjVuDocEditor::move_page(): page_num=" << page_num <<
             ", new_page_num=" << new_page_num << "\n");
   DEBUG_MAKE_INDENT(3);

   if (page_num==new_page_num) return;

   int pages_num=get_pages_num();
   if (page_num<0 || page_num>=pages_num)
      G_THROW( ERR_MSG("DjVuDocEditor.bad_page") "\t"+GUTF8String(page_num));

   const GUTF8String id(page_to_id(page_num));
   int file_pos=-1;
   if (new_page_num>=0 && new_page_num<pages_num)
      if (new_page_num>page_num)        // Moving toward the end
      {
         if (new_page_num<pages_num-1)
            file_pos=djvm_dir->get_page_pos(new_page_num+1)-1;
      } else
         file_pos=djvm_dir->get_page_pos(new_page_num);

   GMap<GUTF8String, void *> map;
   move_file(id, file_pos, map);
}


Generated by  Doxygen 1.6.0   Back to index