Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
djvu-text-page.h File Reference
#include "ev-document.h"
#include <string.h>
#include <glib.h>
#include <libdjvu/miniexp.h>
+ Include dependency graph for djvu-text-page.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _DjvuTextPage
 
struct  _DjvuTextLink
 

Typedefs

typedef struct _DjvuTextPage DjvuTextPage
 
typedef struct _DjvuTextLink DjvuTextLink
 

Enumerations

enum  DjvuSelectionType { DJVU_SELECTION_TEXT, DJVU_SELECTION_BOX }
 

Functions

GList * djvu_text_page_get_selection_region (DjvuTextPage *page, EvRectangle *rectangle)
 
char * djvu_text_page_copy (DjvuTextPage *page, EvRectangle *rectangle)
 
void djvu_text_page_index_text (DjvuTextPage *page, gboolean case_sensitive)
 
void djvu_text_page_search (DjvuTextPage *page, const char *text)
 
DjvuTextPagedjvu_text_page_new (miniexp_t text)
 
void djvu_text_page_free (DjvuTextPage *page)
 

Typedef Documentation

typedef struct _DjvuTextLink DjvuTextLink

Definition at line 30 of file djvu-text-page.h.

typedef struct _DjvuTextPage DjvuTextPage

Definition at line 29 of file djvu-text-page.h.

Enumeration Type Documentation

Enumerator
DJVU_SELECTION_TEXT 
DJVU_SELECTION_BOX 

Definition at line 49 of file djvu-text-page.h.

Function Documentation

char* djvu_text_page_copy ( DjvuTextPage page,
EvRectangle rectangle 
)

Definition at line 234 of file djvu-text-page.c.

236 {
237  char* text;
238 
239  page->start = miniexp_nil;
240  page->end = miniexp_nil;
241  djvu_text_page_limits (page, page->text_structure, rectangle);
243  page->text_structure, 0);
244 
245  /* Do not free the string */
246  text = page->text;
247  page->text = NULL;
248 
249  return text;
250 }

+ Here is the caller graph for this function:

void djvu_text_page_free ( DjvuTextPage page)

Definition at line 515 of file djvu-text-page.c.

516 {
517  g_free (page->text);
518  g_array_free (page->links, TRUE);
519  g_free (page);
520 }

+ Here is the caller graph for this function:

GList* djvu_text_page_get_selection_region ( DjvuTextPage page,
EvRectangle rectangle 
)

Definition at line 218 of file djvu-text-page.c.

220 {
221  page->start = miniexp_nil;
222  page->end = miniexp_nil;
223 
224  /* Get page->start and page->end filled from selection rectangle */
225  djvu_text_page_limits (page, page->text_structure, rectangle);
226  /* Fills page->results with the bouding boxes */
228  page, page->text_structure, 0);
229 
230  return g_list_reverse (page->results);
231 }

+ Here is the caller graph for this function:

void djvu_text_page_index_text ( DjvuTextPage page,
gboolean  case_sensitive 
)

Definition at line 480 of file djvu-text-page.c.

482 {
484  case_sensitive, FALSE);
485 }

+ Here is the caller graph for this function:

DjvuTextPage* djvu_text_page_new ( miniexp_t  text)

djvu_text_page_new: : S-expression of the page text

Creates a new page to search.

Returns: new DjvuTextPage instance

Definition at line 496 of file djvu-text-page.c.

497 {
498  DjvuTextPage *page;
499 
500  page = g_new0 (DjvuTextPage, 1);
501  page->links = g_array_new (FALSE, FALSE, sizeof (DjvuTextLink));
502  page->char_symbol = miniexp_symbol ("char");
503  page->word_symbol = miniexp_symbol ("word");
504  page->text_structure = text;
505  return page;
506 }

+ Here is the caller graph for this function:

void djvu_text_page_search ( DjvuTextPage page,
const char *  text 
)

Definition at line 448 of file djvu-text-page.c.

450 {
451  char *haystack = page->text;
452  int search_len;
453  EvRectangle *result;
454  if (page->links->len == 0)
455  return;
456 
457  search_len = strlen (text);
458  while ((haystack = strstr (haystack, text)) != NULL) {
459  int start_p = haystack - page->text;
460  miniexp_t start = djvu_text_page_position (page, start_p);
461  int end_p = start_p + search_len - 1;
462  miniexp_t end = djvu_text_page_position (page, end_p);
463  result = djvu_text_page_box (page, start, end);
464  g_assert (result);
465  page->results = g_list_prepend (page->results, result);
466  haystack = haystack + search_len;
467  }
468  page->results = g_list_reverse (page->results);
469 }

+ Here is the caller graph for this function: