Exemple #1
0
static void
epdf_index_fill(Eina_List **items, pdf_outline *entry)
{
   Epdf_Index_Item *item;

   item = epdf_index_item_new();
   item->title = entry->title;
   item->link = entry->link;

   *items = eina_list_append (*items, item);

   if (entry->child)
     epdf_index_fill(&item->children, entry->child);

   if (entry->next)
     epdf_index_fill(items, entry->next);
}
Exemple #2
0
Eina_List *
epdf_index_new(const Epdf_Document *doc)
{
   Eina_List *index = NULL;

   if (!doc)
     return index;

   if (!doc->outline)
     return index;

   epdf_index_fill(&index, doc->outline);

   return index;
}
static void
epdf_index_fill (Ecore_List *items,
                 GooList    *gitems)
{
  if (!items || !gitems)
    return;

  for (int i = 0; i < gitems->getLength (); i++) {
    Epdf_Index_Item *item;
    OutlineItem     *oitem = (OutlineItem *)gitems->get (i);
    Unicode         *utitle = oitem->getTitle ();

    item = epdf_index_item_new ();
    item->title = unicode_to_char (utitle, oitem->getTitleLength ());
    item->action = oitem->getAction ();
    oitem->open ();
    if (oitem->hasKids () && oitem->getKids ()) {
      item->children = ecore_list_new ();
      epdf_index_fill (item->children, oitem->getKids ());
    }
    ecore_list_append (items, item);
  }
}
Ecore_List *
epdf_index_new (const Epdf_Document *document)
{
  Outline    *outline;
  GooList    *gitems;
  Ecore_List *index = NULL;

  if (!document)
    return index;

  outline = document->pdfdoc->getOutline ();
  if (outline == NULL)
    return index;

  gitems = outline->getItems ();
  if (gitems == NULL)
    return index;

  index = ecore_list_new ();
  epdf_index_fill (index, gitems);

  return index;
}