/** * djvu_text_page_get_selection: * @page: #DjvuTextPage instance * @rectangle: #EvRectangle of the selection * * Returns: The bounding boxes of the selection */ GList * djvu_text_page_get_selection_region (DjvuTextPage *page, EvRectangle *rectangle) { page->start = miniexp_nil; page->end = miniexp_nil; /* Get page->start and page->end filled from selection rectangle */ djvu_text_page_limits (page, page->text_structure, rectangle); /* Fills page->results with the bouding boxes */ djvu_text_page_selection (DJVU_SELECTION_BOX, page, page->text_structure, 0); return g_list_reverse (page->results); }
char * djvu_text_page_copy (DjvuTextPage *page, EvRectangle *rectangle) { char* text; page->start = miniexp_nil; page->end = miniexp_nil; djvu_text_page_limits (page, page->text_structure, rectangle); djvu_text_page_selection (page, page->text_structure, 0); /* Do not free the string */ text = page->text; page->text = NULL; return text; }
static void djvu_text_page_limits (DjvuTextPage *page, miniexp_t p, EvRectangle *rect) { g_return_if_fail (miniexp_consp (p) && miniexp_symbolp (miniexp_car (p))); miniexp_t deeper = miniexp_cddr (miniexp_cdddr (p)); while (deeper != miniexp_nil) { miniexp_t str = miniexp_car (deeper); if (miniexp_stringp (str)) djvu_text_page_limits_process (page, p, rect); else djvu_text_page_limits (page, str, rect); deeper = miniexp_cdr (deeper); } }