| 1 | | None yet. |
| | 1 | = Lucide Plugin API = |
| | 2 | [[PageOutline]] |
| | 3 | A bird's eye view of how a plugin is constructed may be seen in plugins/ludoc/ludoc.idl. |
| | 4 | |
| | 5 | == Available methods == |
| | 6 | NB: All page numbers are zero-based. |
| | 7 | |
| | 8 | === loadFile() === |
| | 9 | Description: |
| | 10 | Loads the specified file. |
| | 11 | Parameters: |
| | 12 | ||filename||filename of the file to load|| |
| | 13 | ||password||password if necessary, or NULL|| |
| | 14 | ||errorCode||return location for an error code, or NULL|| |
| | 15 | ||error||return location for an error, or NULL|| |
| | 16 | Return value: |
| | 17 | TRUE if file has loaded, FALSE otherwise. |
| | 18 | Default return value: |
| | 19 | FALSE |
| | 20 | Note: |
| | 21 | Error string is allocated using SOMMalloc(), use SOMFree() to free. |
| | 22 | Syntax: |
| | 23 | {{{loadFile( in string filename, in string password, out long errorCode, inout string error );}}} |
| | 24 | |
| | 25 | === getBpp() === |
| | 26 | Description: |
| | 27 | Get the number of bytes per pixel used for drawing. |
| | 28 | Return value: |
| | 29 | Number of bytes per pixel used for drawing. Allowed values are 3 (24 bit) or 4 (32 bit). 4 bytes per pixel is the same as 3, but padded with a dummy byte. |
| | 30 | Default |
| | 31 | return value: |
| | 32 | 0 |
| | 33 | Type: |
| | 34 | short |
| | 35 | Syntax: |
| | 36 | {{{getBpp();}}} |
| | 37 | |
| | 38 | === isScalable() === |
| | 39 | Description: |
| | 40 | See: [#renderPageToPixbuf renderPageToPixbuf()], scale. |
| | 41 | Return value: |
| | 42 | TRUE if document is scalable, FALSE otherwise. |
| | 43 | Default return value: |
| | 44 | FALSE |
| | 45 | Type: |
| | 46 | boolean |
| | 47 | Syntax: |
| | 48 | {{{isScalable();}}} |
| | 49 | |
| | 50 | === isFixedImage() === |
| | 51 | |
| | 52 | Description: |
| | 53 | Determines if upscaling improves image quality. Must return TRUE for fixed-size images/bitmaps. Must return FALSE for documents which render fonts/vector images, to indicate that upscaling improves the quality of the rendered image. Used to determine better printing parameters. |
| | 54 | Return value: |
| | 55 | TRUE if document is fixed-size, FALSE otherwise. |
| | 56 | Default return value: |
| | 57 | TRUE |
| | 58 | Type: |
| | 59 | boolean |
| | 60 | Syntax: |
| | 61 | {{{isFixedImage();}}} |
| | 62 | |
| | 63 | === isRotable() === |
| | 64 | |
| | 65 | Description: |
| | 66 | See: [=#renderPageToPixbuf renderPageToPixbuf()], rotation. |
| | 67 | Return value: |
| | 68 | TRUE if document can be rotated, FALSE otherwise. |
| | 69 | Default return value: |
| | 70 | FALSE |
| | 71 | Type: |
| | 72 | boolean |
| | 73 | Syntax: |
| | 74 | {{{isRotable();}}} |
| | 75 | |
| | 76 | === getPageCount() === |
| | 77 | |
| | 78 | Description: Returns the number of pages in the loaded document. |
| | 79 | |
| | 80 | Return value: Number of pages. |
| | 81 | Default |
| | 82 | return value: 0 |
| | 83 | |
| | 84 | long: getPageCount(); |
| | 85 | |
| | 86 | |
| | 87 | |
| | 88 | === getPageSize() === |
| | 89 | |
| | 90 | Description: Gets the size of the specified page. |
| | 91 | |
| | 92 | Parameters: pagenum: page number |
| | 93 | width: return the width of the page |
| | 94 | (NULL if width is not needed) |
| | 95 | height: return the height of the page |
| | 96 | (NULL if height is not needed) |
| | 97 | |
| | 98 | void: getPageSize( in long pagenum, inout double width, inout double height ); |
| | 99 | |
| | 100 | |
| | 101 | [=#renderPageToPixbuf ] |
| | 102 | === renderPageToPixbuf() === |
| | 103 | |
| | 104 | Description: First, scale the document to match the specified pixels per point, |
| | 105 | then render the rectangle given by the upper left corner at |
| | 106 | (src_x, src_y) and src_width by src_height. |
| | 107 | |
| | 108 | Parameters: pagenum: the page from which we are to render |
| | 109 | src_x: x coordinate of upper left corner |
| | 110 | src_y: y coordinate of upper left corner |
| | 111 | src_width: width of rectangle to render |
| | 112 | src_height: height of rectangle to render |
| | 113 | scale: scale specified as pixels per point |
| | 114 | (if isScalable() is FALSE, scale is ignored and assumed to be 1.0) |
| | 115 | rotation: rotate the document by the specified degree |
| | 116 | (allowed values are 0, 90, 180, 270) |
| | 117 | (if isRotable() is FALSE, rotation is ignored and assumed to be 0) |
| | 118 | pixbuf: pixbuf into which we are to render |
| | 119 | errorCode: return location for an error/warning code, or NULL |
| | 120 | error: return location for an error/warning, or NULL |
| | 121 | |
| | 122 | Syntax: renderPageToPixbuf( in long pagenum, in long src_x, in long src_y, |
| | 123 | in long src_width, in long src_height, |
| | 124 | in double scale, in long rotation, |
| | 125 | in LuPixbuf pixbuf, |
| | 126 | out long errorCode, inout string error ); |
| | 127 | |
| | 128 | |
| | 129 | === isAsynchRenderingSupported() === |
| | 130 | |
| | 131 | Description: See renderPageToPixbufAsynch(). |
| | 132 | |
| | 133 | Return value: TRUE if document can be rendered asynchronously. |
| | 134 | Default |
| | 135 | return value: FALSE |
| | 136 | |
| | 137 | boolean: isAsynchRenderingSupported(); |
| | 138 | |
| | 139 | |
| | 140 | === renderPageToPixbufAsynch() === |
| | 141 | |
| | 142 | Description: Same as renderPageToPixbuf(), but received pointers to |
| | 143 | draw function, abort function and functions data. |
| | 144 | Callback functions must be defined as |
| | 145 | long _System *asynchCallbackFn( void *data ); |
| | 146 | |
| | 147 | Parameters: errorCode: return location for an error/warning code, or NULL |
| | 148 | error: return location for an error/warning, or NULL |
| | 149 | |
| | 150 | Note: You must implement renderPageToPixbuf() also, as |
| | 151 | it is used for printing. |
| | 152 | |
| | 153 | void: renderPageToPixbufAsynch( in long pagenum, in long src_x, |
| | 154 | in long src_y, in long src_width, in long src_height, |
| | 155 | in double scale, in long rotation, in LuPixbuf pixbuf, |
| | 156 | in asynchCallbackFn fnd, in asynchCallbackFn fna, |
| | 157 | in somToken fndata, |
| | 158 | out long errorCode, inout string error ); |
| | 159 | |
| | 160 | |
| | 161 | === isRenderIntoPS() === |
| | 162 | |
| | 163 | Description: See: renderPageToPS(). |
| | 164 | |
| | 165 | Return value: TRUE if document will render directly into |
| | 166 | presentation space using renderPageToPS(). |
| | 167 | Default |
| | 168 | return value: FALSE |
| | 169 | |
| | 170 | Note: You may not implement renderPageToPixbuf() if |
| | 171 | isRenderIntoPS() is TRUE. |
| | 172 | |
| | 173 | boolean: isRenderIntoPS(); |
| | 174 | |
| | 175 | |
| | 176 | === renderPageToPS() === |
| | 177 | |
| | 178 | Description: First scale the document to match the specified pixels per point, |
| | 179 | then render the rectangle given by the upper left corner at |
| | 180 | (src_x, src_y) and src_width and src_height. |
| | 181 | |
| | 182 | Parameters: pagenum: the page from which we are to render |
| | 183 | src_x: x coordinate of upper left corner |
| | 184 | src_y: y coordinate of upper left corner |
| | 185 | src_width: width of rectangle to render |
| | 186 | src_height: height of rectangle to render |
| | 187 | scale: scale specified as pixels per point |
| | 188 | (if isScalable() is FALSE, scale is ignored and assumed to be 1.0) |
| | 189 | rotation: rotate the document by the specified degree |
| | 190 | (allowed values are 0, 90, 180, 270) |
| | 191 | (if isRotable() is FALSE, rotation is ignored and assumed to be 0) |
| | 192 | hps: handle of presentation space into which we are to render |
| | 193 | rect: pointer to RECTL structure, defines render area on HPS |
| | 194 | errorCode: return location for an error/warning code, or NULL |
| | 195 | error: return location for an error/warning, or NULL |
| | 196 | |
| | 197 | Syntax: renderPageToPS( in long pagenum, in long src_x, in long src_y, |
| | 198 | in long src_width, in long src_height, |
| | 199 | in double scale, in long rotation, |
| | 200 | in unsigned long hps, in somMToken rect, |
| | 201 | out long errorCode, inout string error ); |
| | 202 | |
| | 203 | |
| | 204 | === isHaveText() === |
| | 205 | |
| | 206 | Description: See: getSelectionRectangles(), searchText(). |
| | 207 | |
| | 208 | Return value: TRUE if the document contains text, which |
| | 209 | can be selected by the user, searched, etc.; |
| | 210 | FALSE otherwise. |
| | 211 | Default |
| | 212 | return value: FALSE |
| | 213 | |
| | 214 | boolean: isHaveText(); |
| | 215 | |
| | 216 | |
| | 217 | === getSelectionRectangles() === |
| | 218 | |
| | 219 | Description: Returns a sequence of rectangles containing the area that would |
| | 220 | be rendered as "selected." |
| | 221 | The returned sequence must be freed with freeRectangles(). |
| | 222 | |
| | 223 | Note: SOMMalloc() must be used for all memory allocations. |
| | 224 | |
| | 225 | Parameters: pagenum: page number |
| | 226 | selection: start and end point of selection as a rectangle |
| | 227 | |
| | 228 | Return value: A newly allocated LuRectSequence, or NULL if |
| | 229 | nothing is selected or the document doesn't have |
| | 230 | selectable text. |
| | 231 | Default |
| | 232 | return value: NULL |
| | 233 | |
| | 234 | |
| | 235 | Syntax: LuRectSequence *getSelectionRectangles( in long pagenum, |
| | 236 | in LuRectangle selection ); |
| | 237 | |
| | 238 | |
| | 239 | === freeRectangles() === |
| | 240 | |
| | 241 | Description: Deallocates a sequence of rectangles |
| | 242 | allocated by getSelectionRectangles() or searchText(). |
| | 243 | |
| | 244 | void: freeRectangles( in LuRectSequence rectangles ); |
| | 245 | |
| | 246 | |
| | 247 | === getText() === |
| | 248 | |
| | 249 | Description: Retrieves the contents of the specified rectangle as text. |
| | 250 | |
| | 251 | Parameters: pagenum: page number |
| | 252 | selection: the rectangle including the text |
| | 253 | |
| | 254 | Return value: A pointer to the contents of the rectangle |
| | 255 | as a string or NULL. |
| | 256 | The pointer is valid until next getText() call, |
| | 257 | or until LuDocument object is destroyed. |
| | 258 | Default |
| | 259 | return value: NULL |
| | 260 | |
| | 261 | Note: Charset of returned string must be UTF-8 |
| | 262 | |
| | 263 | string: getText( in long pagenum, in LuRectangle selection ); |
| | 264 | |
| | 265 | |
| | 266 | === isHaveLinks() === |
| | 267 | |
| | 268 | Description: See: getLinkMapping(). |
| | 269 | |
| | 270 | Return value: TRUE if document may contain navigable links, |
| | 271 | FALSE otherwise. |
| | 272 | Default |
| | 273 | return value: FALSE |
| | 274 | |
| | 275 | boolean: isHaveLinks(); |
| | 276 | |
| | 277 | |
| | 278 | === getLinkMapping() === |
| | 279 | |
| | 280 | Description: Returns a sequence of LuLinkMapping items. |
| | 281 | This sequence must be freed |
| | 282 | with freeLinkMapping() when done. |
| | 283 | |
| | 284 | Parameters: pagenum: page number |
| | 285 | |
| | 286 | Return value: A pointer to sequence of LuLinkMapping. |
| | 287 | Default |
| | 288 | return value: A pointer to an empty LuLinkMapSequence. |
| | 289 | |
| | 290 | Note: SOMMalloc() must be used for all memory allocations. |
| | 291 | |
| | 292 | Syntax: LuLinkMapSequence *getLinkMapping( in long pagenum ); |
| | 293 | |
| | 294 | |
| | 295 | === freeLinkMapping() === |
| | 296 | |
| | 297 | Description: Frees a sequence of LuLinkMapping allocated by |
| | 298 | getLinkMapping(). |
| | 299 | |
| | 300 | Parameters: mapping: A sequence of LuLinkMapping |
| | 301 | |
| | 302 | void: freeLinkMapping( in LuLinkMapSequence mapping ); |
| | 303 | |
| | 304 | |
| | 305 | |
| | 306 | === isSaveable() === |
| | 307 | |
| | 308 | Description: Describes whether the current document may be saved. |
| | 309 | |
| | 310 | Return value: TRUE if document can be saved in same format |
| | 311 | as original, FALSE otherwise. |
| | 312 | Default |
| | 313 | return value: FALSE |
| | 314 | |
| | 315 | boolean: isSaveable(); |
| | 316 | |
| | 317 | |
| | 318 | === saveAs() === |
| | 319 | |
| | 320 | Description: Saves the current document. |
| | 321 | |
| | 322 | Parameters: filename: name of file to save |
| | 323 | |
| | 324 | Return value: TRUE, if the document was successfully saved, |
| | 325 | FALSE otherwise. |
| | 326 | Default |
| | 327 | return value: FALSE |
| | 328 | |
| | 329 | Syntax: saveAs( in string filename ); |
| | 330 | |
| | 331 | |
| | 332 | |
| | 333 | === isPostScriptExportable() === |
| | 334 | |
| | 335 | Description: Describes whether the current document may be |
| | 336 | exported to PostScript. |
| | 337 | |
| | 338 | Return value: TRUE if document can be exported to |
| | 339 | PostScript, FALSE otherwise. |
| | 340 | Default |
| | 341 | return value: FALSE |
| | 342 | |
| | 343 | boolean: isPostScriptExportable(); |
| | 344 | |
| | 345 | |
| | 346 | === exportToPostScript() === |
| | 347 | |
| | 348 | Description: Create a new postscript file and generate the document to it. |
| | 349 | |
| | 350 | Parameters: filename: the path of the output filename |
| | 351 | first_page: the first page to print |
| | 352 | last_page: the last page to print |
| | 353 | width: the paper width in 1/72 inch |
| | 354 | height: the paper height in 1/72 inch |
| | 355 | (These values will end up in the DocumentMedia, the |
| | 356 | BoundingBox DSC comments, and other places in the |
| | 357 | generated PostScript.) |
| | 358 | brkExport: pointer to boolean variable which must be checked |
| | 359 | during generating postscript, if it's TRUE - interrupt |
| | 360 | generation process. |
| | 361 | |
| | 362 | Return value: TRUE if PS document was generated successfully or |
| | 363 | generation was interrupted, FALSE otherwise. |
| | 364 | Default |
| | 365 | return value: FALSE |
| | 366 | |
| | 367 | Syntax: exportToPostScript( in string filename, |
| | 368 | in long first_page, in long last_page, |
| | 369 | in double width, in double height, |
| | 370 | inout boolean brkExport ); |
| | 371 | |
| | 372 | |
| | 373 | === isHaveFontInfo() === |
| | 374 | |
| | 375 | Description: See: getFontInfo(). |
| | 376 | |
| | 377 | Return value: TRUE if getFontInfo() can return information about |
| | 378 | fonts used in document, FALSE otherwise. |
| | 379 | Default |
| | 380 | return value: FALSE |
| | 381 | |
| | 382 | boolean: isHaveFontInfo(); |
| | 383 | |
| | 384 | |
| | 385 | === getFontInfo() === |
| | 386 | |
| | 387 | Description: Returns information about fonts used in document. |
| | 388 | Returned sequence must be freed with freeFontInfo() when done. |
| | 389 | |
| | 390 | Return value: A pointer to the sequence of LuFontInfo |
| | 391 | or NULL if no font information. |
| | 392 | Default |
| | 393 | return value: NULL |
| | 394 | |
| | 395 | Note: SOMMalloc() must be used for all memory allocations. |
| | 396 | |
| | 397 | Syntax: LuFontInfoSequence *getFontInfo(); |
| | 398 | |
| | 399 | |
| | 400 | === freeFontInfo() === |
| | 401 | |
| | 402 | Description: Frees a sequence of LuFontInfo allocated by |
| | 403 | getFontInfo(). |
| | 404 | |
| | 405 | Parameters: fonts: A sequence of LuFontInfo |
| | 406 | |
| | 407 | |
| | 408 | void: freeFontInfo( in LuFontInfoSequence fonts ); |
| | 409 | |
| | 410 | |
| | 411 | === isHaveIndex() === |
| | 412 | |
| | 413 | Description: Determines if the document has an index associated with it. |
| | 414 | See getIndex() |
| | 415 | |
| | 416 | Return value: TRUE if the document has an index, FALSE otherwise. |
| | 417 | Default |
| | 418 | return value: FALSE |
| | 419 | |
| | 420 | boolean: isHaveIndex(); |
| | 421 | |
| | 422 | |
| | 423 | === getIndex() === |
| | 424 | |
| | 425 | Description: Certain documents have an index associated with them. |
| | 426 | This index can be used to help the user navigate the document, |
| | 427 | and is similar to a table of contents. Each node in the index will |
| | 428 | contain a LuLink which can be displayed to the user. |
| | 429 | |
| | 430 | Here is a simple example of some code that walks the full index: |
| | 431 | |
| | 432 | void viewTree( int level, LuIndexNode *n ) |
| | 433 | { |
| | 434 | if ( n == NULL ) { |
| | 435 | return; |
| | 436 | } |
| | 437 | |
| | 438 | somLPrintf( level, "title: %s\n", n->getLink(ev)->title ); |
| | 439 | |
| | 440 | LuIndexNode *cn = n->getFirstChild( ev ); |
| | 441 | while ( cn != NULL ) { |
| | 442 | viewTree( level + 1, cn ); |
| | 443 | cn = n->getNextChild( ev ); |
| | 444 | } |
| | 445 | } |
| | 446 | |
| | 447 | Return value: A new LuIndexNode, which represents an index root, |
| | 448 | or NULL, if the document doesn't have an index. |
| | 449 | Default |
| | 450 | return value: NULL |
| | 451 | |
| | 452 | Syntax: LuIndexNode getIndex(); |
| | 453 | |
| | 454 | |
| | 455 | === getDocumentInfo() === |
| | 456 | |
| | 457 | Description: Returns information about the current document. |
| | 458 | Returned sequence must be freed with freeDocumentInfo() when done. |
| | 459 | |
| | 460 | Return value: A pointer to the sequence of LuDocumentInfo |
| | 461 | or NULL if no information is available. |
| | 462 | Default |
| | 463 | return value: NULL |
| | 464 | |
| | 465 | |
| | 466 | Syntax: LuDocumentInfo *getDocumentInfo(); |
| | 467 | |
| | 468 | |
| | 469 | |
| | 470 | === freeDocumentInfo() === |
| | 471 | |
| | 472 | Description: Frees a LuDocumentInfo structure allocated by getDocumentInfo(). |
| | 473 | |
| | 474 | Parameters: info: LuDocumentInfo structure allocated by getDocumentInfo() |
| | 475 | |
| | 476 | void: freeDocumentInfo( in LuDocumentInfo info ); |
| | 477 | |
| | 478 | |
| | 479 | |
| | 480 | === getThumbnailSize() === |
| | 481 | |
| | 482 | Description: Returns TRUE if the page has a thumbnail associated with it. It also |
| | 483 | fills the width and height with the those of the thumbnail. |
| | 484 | The values of width and height are not changed if no |
| | 485 | appropriate thumbnail exists. |
| | 486 | |
| | 487 | Parameters: pagenum: page number |
| | 488 | suggested_width: if thumbnail doesn't have a predefined width, |
| | 489 | it will be created with suggested_width. |
| | 490 | width: value for width |
| | 491 | height: value for height |
| | 492 | |
| | 493 | Return value: TRUE, if the page has a thumbnail associated with it, FALSE otherwise. |
| | 494 | Default |
| | 495 | return value: FALSE |
| | 496 | |
| | 497 | Syntax: getThumbnailSize( in long pagenum, in short suggested_width, inout short width, inout short height ); |
| | 498 | |
| | 499 | |
| | 500 | === getThumbnail() === |
| | 501 | |
| | 502 | Description: Returns pointer to LuPixbuf |
| | 503 | |
| | 504 | Parameters: pagenum: page number |
| | 505 | suggested_width: if thumbnail doesn't have a predefined width, |
| | 506 | it will be created with suggested_width. |
| | 507 | |
| | 508 | Return value: pointer to LuPixbuf, if page has a thumbnail associated with it, |
| | 509 | or NULL. |
| | 510 | Default |
| | 511 | return value: NULL |
| | 512 | |
| | 513 | Syntax: LuPixbuf getThumbnail( in long pagenum, in short suggested_width ); |
| | 514 | |
| | 515 | |
| | 516 | |
| | 517 | === searchText() === |
| | 518 | |
| | 519 | Description: Returns a sequence of rectangles for each occurrence of the text |
| | 520 | found on the page. |
| | 521 | The returned sequence must be freed with freeRectangles() |
| | 522 | |
| | 523 | Parameters: pagenum: page number |
| | 524 | text: the text to find (in system encoding) |
| | 525 | |
| | 526 | Return value: A newly allocated LuRectSequence, or NULL if nothing found |
| | 527 | Default |
| | 528 | return value: NULL |
| | 529 | |
| | 530 | Note: SOMMalloc() must be used for all memory allocations. |
| | 531 | |
| | 532 | Syntax: LuRectSequence *searchText( in long pagenum, in string text, |
| | 533 | in boolean caseSensitive, in boolean findBack ); |
| | 534 | |
| | 535 | |
| | 536 | === isCreateFileThumbnail() === |
| | 537 | |
| | 538 | Description: If this method returns TRUE, then GUI may create thumbnail for |
| | 539 | this file and write it into EAs. |
| | 540 | |
| | 541 | Return value: TRUE, if thumbnail may be created, FALSE otherwise. |
| | 542 | Default |
| | 543 | return value: FALSE |
| | 544 | |
| | 545 | boolean: isCreateFileThumbnail(); |
| | 546 | |
| | 547 | |
| | 548 | === isHaveInputFields() === |
| | 549 | |
| | 550 | Description: Returns TRUE if the document contains input fields, FALSE otherwise. |
| | 551 | See: getInputFields(). |
| | 552 | |
| | 553 | Return value: TRUE, if the document contains input fields, FALSE otherwise. |
| | 554 | Default |
| | 555 | return value: FALSE |
| | 556 | |
| | 557 | boolean: isHaveInputFields(); |
| | 558 | |
| | 559 | |
| | 560 | === getInputFields() === |
| | 561 | |
| | 562 | Description: Returns a sequence of LuInputField items that may be used to enter |
| | 563 | data into the document. |
| | 564 | This sequence must be freed with freeInputFields() when done. |
| | 565 | |
| | 566 | Parameters: pagenum: page number |
| | 567 | |
| | 568 | Return value: A pointer to sequence of valid LuInputField items. |
| | 569 | Default |
| | 570 | return value: A pointer to an empty LuInputFieldSequence. |
| | 571 | |
| | 572 | Note: The returned sequence must be allocated with SOMMalloc(), |
| | 573 | each element must be a newly created SOM object. |
| | 574 | |
| | 575 | Syntax: {{{LuInputFieldSequence *getInputFields( in long pagenum );}}} |
| | 576 | |
| | 577 | |
| | 578 | === freeInputFields() === |
| | 579 | |
| | 580 | Description: Frees the input field sequence returned by getInputFields(). |
| | 581 | Subclasses should never override this method. |
| | 582 | |
| | 583 | void: {{{freeInputFields(in LuInputFieldSequence aInputFields);}}} |