pdf-annot-imp.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright (C) 2004-2023 Artifex Software, Inc.
  2. //
  3. // This file is part of MuPDF.
  4. //
  5. // MuPDF is free software: you can redistribute it and/or modify it under the
  6. // terms of the GNU Affero General Public License as published by the Free
  7. // Software Foundation, either version 3 of the License, or (at your option)
  8. // any later version.
  9. //
  10. // MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
  11. // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  12. // FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  13. // details.
  14. //
  15. // You should have received a copy of the GNU Affero General Public License
  16. // along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
  17. //
  18. // Alternative licensing terms are available from the licensor.
  19. // For commercial licensing, see <https://www.artifex.com/> or contact
  20. // Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
  21. // CA 94129, USA, for further information.
  22. #ifndef MUPDF_PDF_ANNOT_IMP_H
  23. #define MUPDF_PDF_ANNOT_IMP_H
  24. #include "mupdf/pdf.h"
  25. struct pdf_annot
  26. {
  27. int refs;
  28. pdf_page *page;
  29. pdf_obj *obj;
  30. int is_hot;
  31. int is_active;
  32. int needs_new_ap; /* If set, then a resynthesis of this annotation has been requested. */
  33. int has_new_ap; /* If set, then the appearance stream has changed since last queried. */
  34. int ignore_trigger_events; /* Avoids triggering events during editing of e.g. text field widgets. */
  35. int hidden_editing; /* Hides annotation from rendering e.g. during editing. */
  36. pdf_annot *next;
  37. };
  38. typedef struct
  39. {
  40. fz_link super;
  41. pdf_page *page;
  42. pdf_obj *obj;
  43. } pdf_link;
  44. void pdf_load_annots(fz_context *ctx, pdf_page *page);
  45. void pdf_drop_annots(fz_context *ctx, pdf_annot *annot_list);
  46. void pdf_drop_widgets(fz_context *ctx, pdf_annot *widget_list);
  47. void pdf_set_annot_has_changed(fz_context *ctx, pdf_annot *annot);
  48. /*
  49. Create a destination object given an internal link URI.
  50. */
  51. pdf_obj *pdf_add_filespec(fz_context *ctx, pdf_document *doc, const char *file, pdf_obj *embedded_file);
  52. pdf_obj *pdf_add_url_filespec(fz_context *ctx, pdf_document *doc, const char *url);
  53. char *pdf_parse_link_dest(fz_context *ctx, pdf_document *doc, pdf_obj *dest);
  54. char *pdf_parse_link_action(fz_context *ctx, pdf_document *doc, pdf_obj *obj, int pagenum);
  55. /* Rect diff is not really a rect! Just returned as such for convenience. */
  56. fz_rect pdf_annot_rect_diff(fz_context *ctx, pdf_annot *annot);
  57. #endif