Changeset 307 for trunk/src/PDFDocument.cxx
- Timestamp:
- 04/11/08 10:08:07 (8 months ago)
- Files:
-
- 1 modified
-
trunk/src/PDFDocument.cxx (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/PDFDocument.cxx
r286 r307 192 192 /// path. 193 193 /// @param password The password to use to open @a filename. 194 /// @param error Location to store the error occurring or NULL to ignore 194 /// @param error Location to store the error occurring or NULL to ignore 195 195 /// errors. 196 196 /// … … 258 258 { 259 259 // OK, the glib's wrapper don't pass the error code directly 260 // from Poppler. Instead returns G_FILE_ERROR_FAILED and a 260 // from Poppler. Instead returns G_FILE_ERROR_FAILED and a 261 261 // non translated string. 262 262 // Maybe I'm wrong (very probable) but that's a wrong way. … … 413 413 // We'll already calculate the positions scaled. 414 414 gdouble scale = getZoom (); 415 GList *pageLinks = poppler_page_get_link_mapping (popplerPage); 415 GList *pageLinks = poppler_page_get_link_mapping (popplerPage); 416 416 for (GList *pageLink = g_list_first (pageLinks) ; 417 417 NULL != pageLink ; … … 441 441 /// 442 442 void 443 PDFDocument::setOutline (DocumentOutline *outline, 443 PDFDocument::setOutline (DocumentOutline *outline, 444 444 PopplerIndexIter *childrenList) 445 445 { … … 475 475 476 476 outline->addChild (child); 477 PopplerIndexIter *childIter = 477 PopplerIndexIter *childIter = 478 478 poppler_index_iter_get_child (childrenList); 479 479 setOutline (child, childIter); 480 480 } 481 } 481 } 482 482 while ( poppler_index_iter_next (childrenList) ); 483 483 … … 491 491 /// Retrieves the width and height of a document's page before to scale, but 492 492 /// after rotation. 493 /// 493 /// 494 494 /// @param pageNum The page to get its size. 495 495 /// @param width The output pointer to save the page's width. … … 667 667 } 668 668 669 void 669 void 670 670 PDFDocument::setTextSelection (DocumentRectangle *rect) 671 671 { … … 678 678 gdouble pageWidth, pageHeight; 679 679 poppler_page_get_size(page, &pageWidth, &pageHeight); 680 680 681 681 //for get text we must exchange y coordinate, don't ask me where logic here. 682 682 PopplerRectangle textRect = { rect->getX1() / getZoom(), … … 694 694 if(!text) 695 695 goto cleanup; 696 696 697 697 for ( GList *obs = g_list_first (m_Observers) ; 698 698 NULL != obs ; … … 723 723 rect.y1 = r->getY1() / getZoom(); 724 724 rect.x2 = r->getX2() / getZoom(); 725 rect.y2 = r->getY2() / getZoom(); 725 rect.y2 = r->getY2() / getZoom(); 726 726 repairEmpty(rect); 727 727 728 728 //calc selection size 729 #if defined (HAVE_POPPLER_0_6_0) 729 #if defined (HAVE_POPPLER_0_8_0) 730 GList *selections = poppler_page_get_selection_region(page, getZoom(), 731 POPPLER_SELECTION_GLYPH, &rect); 732 res = gdk_region_new(); 733 for (GList *selection = g_list_first (selections) ; 734 NULL != selection ; selection = g_list_next (selection)) { 735 PopplerRectangle *rectangle = (PopplerRectangle *)selection->data; 736 GdkRectangle rect; 737 738 rect.x = (gint)rectangle->x1; 739 rect.y = (gint)rectangle->y1; 740 rect.width = (gint) (rectangle->x2 - rectangle->x1); 741 rect.height = (gint) (rectangle->y2 - rectangle->y1); 742 743 gdk_region_union_with_rect (res, &rect); 744 } 745 poppler_page_selection_region_free (selections); 746 #elif defined (HAVE_POPPLER_0_6_0) 730 747 res = poppler_page_get_selection_region(page, getZoom(), 731 748 POPPLER_SELECTION_GLYPH, &rect); … … 733 750 res = poppler_page_get_selection_region(page, getZoom(), &rect); 734 751 #endif // HAVE_POPPLER_0_6_0 735 752 736 753 //free some local data 737 754 g_object_unref(page);
