| 1 |
|
| MODULE = PDF::Make PACKAGE = PDF::Make::Outline |
| 2 |
|
| PROTOTYPES: ENABLE |
| 3 |
|
| |
| 4 |
|
| const char * |
| 5 |
|
| title(self) |
| 6 |
|
| SV *self |
| 7 |
|
| PREINIT: |
| 8 |
|
| pdfmake_outline_item_t *item; |
| 9 |
|
| CODE: |
| 10 |
7 |
| item = INT2PTR(pdfmake_outline_item_t *, SvIV(SvRV(self))); |
| 11 |
7 |
▶ | RETVAL = item->title ? item->title : ""; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = item->title ? item->title : ""; |
7 |
0 |
7 |
|
| 12 |
|
| OUTPUT: |
| 13 |
|
| RETVAL |
| 14 |
|
| |
| 15 |
|
| int |
| 16 |
|
| is_open(self) |
| 17 |
|
| SV *self |
| 18 |
|
| PREINIT: |
| 19 |
|
| pdfmake_outline_item_t *item; |
| 20 |
|
| CODE: |
| 21 |
5 |
| item = INT2PTR(pdfmake_outline_item_t *, SvIV(SvRV(self))); |
| 22 |
5 |
▶ | RETVAL = item->open; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = item->open; |
1 |
4 |
5 |
|
| 23 |
|
| OUTPUT: |
| 24 |
|
| RETVAL |
| 25 |
|
| |
| 26 |
|
| void |
| 27 |
|
| set_open(self, open) |
| 28 |
|
| SV *self |
| 29 |
|
| int open |
| 30 |
|
| PREINIT: |
| 31 |
|
| pdfmake_outline_item_t *item; |
| 32 |
|
| CODE: |
| 33 |
4 |
| item = INT2PTR(pdfmake_outline_item_t *, SvIV(SvRV(self))); |
| 34 |
4 |
| pdfmake_outline_set_open(item, open); |
| 35 |
|
| |
| 36 |
|
| int |
| 37 |
|
| count(self) |
| 38 |
|
| SV *self |
| 39 |
|
| PREINIT: |
| 40 |
|
| pdfmake_outline_item_t *item; |
| 41 |
|
| CODE: |
| 42 |
0 |
| item = INT2PTR(pdfmake_outline_item_t *, SvIV(SvRV(self))); |
| 43 |
0 |
▶ | RETVAL = item->count; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = item->count; |
0 |
0 |
0 |
|
| 44 |
|
| OUTPUT: |
| 45 |
|
| RETVAL |
| 46 |
|
| |
| 47 |
|
| UV |
| 48 |
|
| dest_page(self) |
| 49 |
|
| SV *self |
| 50 |
|
| PREINIT: |
| 51 |
|
| pdfmake_outline_item_t *item; |
| 52 |
|
| CODE: |
| 53 |
4 |
| item = INT2PTR(pdfmake_outline_item_t *, SvIV(SvRV(self))); |
| 54 |
4 |
▶ | RETVAL = (UV)item->dest.page_index; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (UV)item->dest.page_index; |
1 |
3 |
4 |
|
| 55 |
|
| OUTPUT: |
| 56 |
|
| RETVAL |
| 57 |
|
| |
| 58 |
|
| SV * |
| 59 |
|
| add_child(self, title, page_index, dest_type = "Fit", left = 0, top = 0, zoom = 0) |
| 60 |
|
| SV *self |
| 61 |
|
| const char *title |
| 62 |
|
| UV page_index |
| 63 |
|
| const char *dest_type |
| 64 |
|
| double left |
| 65 |
|
| double top |
| 66 |
|
| double zoom |
| 67 |
|
| PREINIT: |
| 68 |
|
| pdfmake_dest_t dest; |
| 69 |
|
| pdfmake_outline_item_t *parent_item, *child; |
| 70 |
|
| SV *sv; |
| 71 |
|
| CODE: |
| 72 |
13 |
| parent_item = INT2PTR(pdfmake_outline_item_t *, SvIV(SvRV(self))); |
| 73 |
|
| |
| 74 |
13 |
▶ | if (strEQ(dest_type, "XYZ")) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (strEQ(dest_type, "XYZ")) { |
0 |
13 |
13 |
|
| 75 |
0 |
| dest = pdfmake_dest_xyz((size_t)page_index, left, top, zoom); |
| 76 |
|
| } |
| 77 |
13 |
▶ | else if (strEQ(dest_type, "Fit")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(dest_type, "Fit")) { |
13 |
0 |
13 |
|
| 78 |
13 |
| dest = pdfmake_dest_fit((size_t)page_index); |
| 79 |
|
| } |
| 80 |
0 |
▶ | else if (strEQ(dest_type, "FitH")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(dest_type, "FitH")) { |
0 |
0 |
0 |
|
| 81 |
0 |
| dest = pdfmake_dest_fith((size_t)page_index, top); |
| 82 |
|
| } |
| 83 |
0 |
▶ | else if (strEQ(dest_type, "FitV")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(dest_type, "FitV")) { |
0 |
0 |
0 |
|
| 84 |
0 |
| dest = pdfmake_dest_fitv((size_t)page_index, left); |
| 85 |
|
| } |
| 86 |
0 |
▶ | else if (strEQ(dest_type, "FitB")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(dest_type, "FitB")) { |
0 |
0 |
0 |
|
| 87 |
0 |
| dest = pdfmake_dest_fitb((size_t)page_index); |
| 88 |
|
| } |
| 89 |
0 |
▶ | else if (strEQ(dest_type, "FitBH")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(dest_type, "FitBH")) { |
0 |
0 |
0 |
|
| 90 |
0 |
| dest = pdfmake_dest_fitbh((size_t)page_index, top); |
| 91 |
|
| } |
| 92 |
0 |
▶ | else if (strEQ(dest_type, "FitBV")) { |
Branch: 1 branch
| Branch | True | False | Total |
| else if (strEQ(dest_type, "FitBV")) { |
0 |
0 |
0 |
|
| 93 |
0 |
| dest = pdfmake_dest_fitbv((size_t)page_index, left); |
| 94 |
|
| } |
| 95 |
|
| else { |
| 96 |
0 |
| dest = pdfmake_dest_fit((size_t)page_index); |
| 97 |
|
| } |
| 98 |
|
| |
| 99 |
13 |
| child = pdfmake_outline_add_child(parent_item, title, dest); |
| 100 |
13 |
▶ | if (!child) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!child) |
0 |
13 |
13 |
|
| 101 |
0 |
| croak("PDF::Make::Outline::add_child: failed to create child"); |
| 102 |
|
| |
| 103 |
13 |
| sv = newSV(0); |
| 104 |
13 |
| sv_setref_pv(sv, "PDF::Make::Outline", (void *)child); |
| 105 |
13 |
| RETVAL = sv; |
| 106 |
|
| OUTPUT: |
| 107 |
|
| RETVAL |
| 108 |
|
| |
| 109 |
|
| void |
| 110 |
|
| children(self) |
| 111 |
|
| SV *self |
| 112 |
|
| PPCODE: |
| 113 |
1 |
| pdfmake_outline_item_t *parent_item = INT2PTR(pdfmake_outline_item_t *, SvIV(SvRV(self))); |
| 114 |
1 |
| pdfmake_outline_item_t *child = parent_item->first; |
| 115 |
4 |
▶ | while (child) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (child) { |
3 |
1 |
4 |
|
| 116 |
3 |
| SV *sv = sv_newmortal(); |
| 117 |
3 |
| sv_setref_pv(sv, "PDF::Make::Outline", (void *)child); |
| 118 |
3 |
▶ | XPUSHs(sv); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv); |
0 |
3 |
3 |
|
| 119 |
3 |
| child = child->next; |
| 120 |
|
| } |
| 121 |
|
| |
| 122 |
|
| int |
| 123 |
|
| has_children(self) |
| 124 |
|
| SV *self |
| 125 |
|
| PREINIT: |
| 126 |
|
| pdfmake_outline_item_t *item; |
| 127 |
|
| CODE: |
| 128 |
1 |
| item = INT2PTR(pdfmake_outline_item_t *, SvIV(SvRV(self))); |
| 129 |
1 |
▶ | RETVAL = (item->first != NULL); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (item->first != NULL); |
0 |
1 |
1 |
|
| 130 |
|
| OUTPUT: |
| 131 |
|
| RETVAL |
| 132 |
|
| |
| 133 |
|
| SV * |
| 134 |
|
| parent(self) |
| 135 |
|
| SV *self |
| 136 |
|
| PREINIT: |
| 137 |
|
| pdfmake_outline_item_t *item; |
| 138 |
|
| SV *sv; |
| 139 |
|
| CODE: |
| 140 |
1 |
| item = INT2PTR(pdfmake_outline_item_t *, SvIV(SvRV(self))); |
| 141 |
1 |
▶ | if (!item->parent) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!item->parent) |
0 |
1 |
1 |
|
| 142 |
0 |
| XSRETURN_UNDEF; |
| 143 |
1 |
| sv = newSV(0); |
| 144 |
1 |
| sv_setref_pv(sv, "PDF::Make::Outline", (void *)item->parent); |
| 145 |
1 |
| RETVAL = sv; |
| 146 |
|
| OUTPUT: |
| 147 |
|
| RETVAL |
| 148 |
|
| |
| 149 |
|
| SV * |
| 150 |
|
| next_sibling(self) |
| 151 |
|
| SV *self |
| 152 |
|
| PREINIT: |
| 153 |
|
| pdfmake_outline_item_t *item; |
| 154 |
|
| SV *sv; |
| 155 |
|
| CODE: |
| 156 |
1 |
| item = INT2PTR(pdfmake_outline_item_t *, SvIV(SvRV(self))); |
| 157 |
1 |
▶ | if (!item->next) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!item->next) |
0 |
1 |
1 |
|
| 158 |
0 |
| XSRETURN_UNDEF; |
| 159 |
1 |
| sv = newSV(0); |
| 160 |
1 |
| sv_setref_pv(sv, "PDF::Make::Outline", (void *)item->next); |
| 161 |
1 |
| RETVAL = sv; |
| 162 |
|
| OUTPUT: |
| 163 |
|
| RETVAL |
| 164 |
|
| |
| 165 |
|
| SV * |
| 166 |
|
| prev_sibling(self) |
| 167 |
|
| SV *self |
| 168 |
|
| PREINIT: |
| 169 |
|
| pdfmake_outline_item_t *item; |
| 170 |
|
| SV *sv; |
| 171 |
|
| CODE: |
| 172 |
0 |
| item = INT2PTR(pdfmake_outline_item_t *, SvIV(SvRV(self))); |
| 173 |
0 |
▶ | if (!item->prev) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!item->prev) |
0 |
0 |
0 |
|
| 174 |
0 |
| XSRETURN_UNDEF; |
| 175 |
0 |
| sv = newSV(0); |
| 176 |
0 |
| sv_setref_pv(sv, "PDF::Make::Outline", (void *)item->prev); |
| 177 |
0 |
| RETVAL = sv; |
| 178 |
|
| OUTPUT: |
| 179 |
|
| RETVAL |
| 180 |
|
| |
| 181 |
|
| void |
| 182 |
|
| DESTROY(self) |
| 183 |
|
| SV *self |
| 184 |
|
| CODE: |
| 185 |
|
| /* Item is doc-owned; zero the pointer to prevent stale access */ |
| 186 |
36 |
| SvIV_set(SvRV(self), 0); |