priint:comet placeholders in documents.
priint:comet placeholders in documents. The placeholders can be found using linklist::collect and similar functions.
static int link::classid(Link lk)
Get the ClassID of the placeholder.
| Name | Type | Default | Description |
| Return | int | ClassID of the placeholder 0 : Error or placeholder not linked |
|
| lk | Link | - | Valid Link object of a linklist |
static int link::id(Link lk)
Get the ID(1) of the RecordID of the product linked to the placeholder.
| Name | Type | Default | Description |
| Return | int | ID(1) of the RecordID of the product to which the placeholder is linked 0 : Error or placeholder not linked |
|
| lk | Link | - | Valid Link object of a linklist |
static int link::id2(Link lk)
Get the ID2 of the RecordID of the product linked to the placeholder.
| Name | Type | Default | Description |
| Return | int | ID2 of the RecordID of the product to which the placeholder is linked 0 : Error or placeholder not linked |
|
| lk | Link | - | Valid Link object of a linklist |
static int link::id3(Link lk)
Get the ID3 of the RecordID of the product linked to the placeholder.
| Name | Type | Default | Description |
| Return | int | ID3 of the RecordID of the product to which the placeholder is linked 0 : Error or placeholder not linked |
|
| lk | Link | - | Valid Link object of a linklist |
static char* link::sid(Link lk)
Get the ID3 of the RecordID of the product linked to the placeholder.
| Name | Type | Default | Description |
| Return | int | StringID of the RecordID of the product to which the placeholder is linked.
The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
| lk | Link | - | Valid Link object of a linklist |
static int link::placeholderid(Link lk)
Get the placeholder ID of the placeholder. The placeholder ID is the unique ID of the placeholder itself, not the RecordID of the product linked to the placeholder.
| Name | Type | Default | Description |
| Return | int | II of the placeholder itself. The placeholder ID is the unique ID of the placeholder itself, not the RecordID
of the product linked to the placeholder. 0 : Error |
|
| lk | Link | - | Valid Link object of a linklist |
static int link::sync(Link lk)
Get the 'Sync Styte' of the placeholder. The value is only defined in the results lists of linklist::sync and linklist::collect.
| Name | Type | Default | Description | ||||||||||||||||||||||||||||||||||||||||
| Return | int | Sync State of the placeholder
|
|||||||||||||||||||||||||||||||||||||||||
| lk | Link | - | Valid Link object of a linklist |
static char* (
Link lk,
int fmt = 0,
int pos = 0,
int len = -1)
Determine the text content of a placeholder. The placeholder text can only be determined after calling the linklist::collect.
If the text contains InDesign® variables, the internal code used in the document (and not the current value) is exported on pure text formats like kExportPlain. Use the ~Plus~-Formats (available since v3.3 R2883) to replace InDesign® variables by their current values.
| Name | Type | Default | Description |
| Return | char* | Text content of the placeholder. For frame placeholders the text content of the frame is
returned. If there is no text available, the function returns 0.
The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
| lk | Link | - | Valid Link object one with a linklist loaded by collect |
| fmt | int | kExportPlain | Export format, see here |
| position | int | 0 | Start position. The parameter is used only for frame placeholders (isframe () == 1).
|
| len | int | kEnd | Number of letters to be fetched. The parameter is used only for frame placeholders (isframe () == 1).
|
static int link::clear_content(Link lk)
Delete the internal representation of the text content of a placeholder. Placeholder texts can be very long, in this case it is advantageous to delete the data from the memory. the document text remains unchanged by this action.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| lk | Link | - | Valid Link object linklist |
static int (Link lk, String result)
DEPRECATED! Please use the function link::content instead.
| Name | Type | Default | Description |
| Return | char* | Text content of the placeholder in the document. The returned pointer can be used in the functions, which expect a char*s tring as parameter. The result may not be changed with regards to its length. | |
| lk | Link | - | Valid Link object of a linklist |
| result | String | - | valid string object. |
static int (Link lk, int len = -1)
DEPRECATED! The function no longer has any meaning.
| Name | Type | Default | Description |
| Return | int | 0 or Error | |
| lk | Link | - | Valid Link object of a linklist |
| len | int | -1 | New maximum length for text contents of placeholders
|
static int link::pos(Link lk)
On text placeholder the start position of the placeholder. For frames the value is -1. The value is only defined in the result lists of linklist::sync and linklist::collect.
| Name | Type | Default | Description |
| Return | int | At what point in the associated text frame does the placeholder begin?
|
|
| lk | Link | - | Valid Link object of a linklist |
static int link::length(Link lk)
Length of the placeholder text in the document. For frames the value is -1. The value is only defined in the result lists of linklist::sync and linklist::collect.
| Name | Type | Default | Description |
| Return | int | Text length of the placeholder in the document
|
|
| lk | Link | - | Valid Link object of a linklist |
static int link::content_length(Link lk)
Length of the text (in bytes) of the placeholder. The value is defined only after a call to link::content and gives the length of the exported string in respect to the given export format. The length determined here therefore usually differs from the text length of the placeholder determined with link::length.
| Name | Type | Default | Description |
| Return | int | Text length of the placeholder in bytes -1 : Frame placeholder |
|
| lk | Link | - | Valid Link object of a linklist |
static int link::pagenum(Link lk)
Page number (0 based) of the placeholder in the document. The value is only defined in the result lists of linklist::sync and linklist::collect.
| Name | Type | Default | Description |
| Return | int | Page number of the placeholder in the document | |
| lk | Link | - | Valid Link object of a linklist |
static int link::pagestr(Link lk, char* result)
Page name of the placeholder in the document. The page name is not necessarily the same as the page number as a string, take care to allocate enough memory for the result when using char*. The value is only defined in the result lists of linklist::sync and linklist::collect.
| Name | Type | Default | Description |
| Return | String or char* | (Depends on parameter result) Page name of the placeholder in the document, same as parameter result | |
| lk | Link | - | Valid Link object of a linklist |
| result | String or char* | - | Reserved memory for the result |
static int link::prefix(Link lk, char* result)
Get the current prefix of the placeholder in the document. The value is only defined in the result lists of linklist::sync and linklist::collect.
You can configure prefixes and postfixes for a placeholder in the document in the panel Placeholder Option.
| Name | Type | Default | Description |
| Return | String or char* | value | |
| lk | Link | - | Valid Link object of a linklist |
| result | String or char* | - | Reserved memory for the result |
static int link::prefix_if_empty(Link lk, char* result)
Get the current prefix of the placeholder if its content is empty. The value is only defined in the result lists of linklist::sync and linklist::collect.
You can configure prefixes and postfixes for a placeholder in the document in the panel Placeholder Option.
| Name | Type | Default | Description |
| Return | String or char* | value | |
| lk | Link | - | Valid Link object of a linklist |
| result | String or char* | - | Reserved memory for the result |
static int link::postfix(Link lk, char* result)
Get the current postfix of the placeholder in the document. The value is only defined in the result lists of linklist::sync and linklist::collect.
You can configure prefixes and postfixes for a placeholder in the document in the panel Placeholder Option.
| Name | Type | Default | Description |
| Return | String or char* | value | |
| lk | Link | - | Valid Link object of a linklist |
| result | String or char* | - | Reserved memory for the result |
static int link::postfix_if_empty(Link lk, char* result)
Get the current prefix of the placeholder if its content is empty. The value is only defined in the result lists of linklist::sync and linklist::collect.
You can configure prefixes and postfixes for a placeholder in the document in the panel Placeholder Option.
| Name | Type | Default | Description |
| Return | String or char* | value | |
| lk | Link | - | Valid Link object of a linklist |
| result | String or char* | - | Reserved memory for the result |
static int link::isframe(Link lk)
Is the placeholder a frame placeholder? The value is only defined in the result lists of linklist::sync and linklist::collect.
| Name | Type | Default | Description |
| Return | int |
|
|
| lk | Link | - | Valid Link object of a linklist |
static char* link::layer(Link lk)
Name of the layer on which the placeholder is located.
| Name | Type | Default | Description |
| Return | char* |
The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
| lk | Link | - | Valid Link object of a linklist |
Rapid use of the layer name
li = linklist::first (lli);
while (li) { showmessage ("%s", link::layer (li)); li = linklist::next (lli); }
static char* link::imagepath(Link lk)
Image of a frame placeholder or empty if the frame does not have a frame image.
| Name | Type | Default | Description |
| Return | char* |
The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
| lk | Link | - | Valid Link object of a linklist |
Rapid use of the image path¬
li = linklist::first (lli);
while (li) { showmessage ("%s", link::imagepath (li)); li = linklist::next (lli); }
static float link::left(Link lk)
The value is only defined in the result list linklist::collect.The function collect defines the surrounding frame for each detected frameholder. For frame placeholders this consists of the frame itself. For text placeholders, the frame will be detected which directly surrounds the actual text. Both frame specifications are ascertained page-relative in points (1/72 dpi).
| Name | Type | Default | Description |
| Return | float | X-position of the frame -10000.0 in the case of error |
|
| lk | Link | - | Valid Link object of a linklist |
static float link::top(Link lk)
static float link::right(Link lk)
static float link::bottom(Link lk)
static float link::width(Link lk)
static float link::height(Link lk)
static ItemRef link::frame(Link lk)
Returns the frame of frame placeholders. For text placeholders, the text-frame will be returned. If a text placeholder is (partial) in overset, the fuction returns the first frame of the frames chain. The value is only defined in the result list linklist::collect.
| Name | Type | Default | Description |
| Return | ItemRef | Frames or (for text placeholders) text frames of a placeholder The return variable may not be already be allocated. It may not be deleted with item::release. The contents of the variable will become invalid, if the object is deleted. |
|
| lk | Link | - | Valid Link object of a linklist |
static int link::set_ui_value(
Link lk,
int index,
char* value)
Set the text to display in the dialog sortlinks_dialog.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| lk | Link | - | Valid Link object |
| index | int | - | Which column of the dialog should be set?
|
| value | char* oder String | - | Text to display. Please note that numbers have to be converted into strings beforehand (see itoa et al.). |
static char* link::get_ui_value(Link lk, int index)
Get the display text of a link in the dialog sortlinks_dialog. The text must have been set before with set_ui_value.
| Name | Type | Default | Description |
| Return | char* | Text content
The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
| lk | Link | - | Valid Link object |
| index | int | - | Which column text of the dialog should be determined?
|
static int link::override_sync(Link lk)
Overwrite the synchronization status stored in the placeholder with the status "override." This stores the current value in the document (text content for text placeholders rfesp. the image path for image placeholders) together with the currnt value in the data source in the document. If either of the two values changes, the synchronization status is marked as changed again during the next synchronization. Here you will find more information on the “Overwritten” status.
This function may only be called when gNewValue is not defined, else it will lead to endless recursion!
This function has no effect when the ID of the sync-action of placeholder is greater than -1.| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| lk | Link | - | Valid Link object of a linklist |
static int link::remove_override_sync(Link lk)
Remove the "override" sync status which is stored in the placeholder. The stored values from the document and datasource will be removed. Here you will find more information on the “Overwritten” status.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| lk | Link | - | Valid Link object of a linklist |
static int link::count_funcvars(Link lk, int actionType)
Count the number of defined function variables of a script action of a placeholder.
The function returns valid values for objects from LinkList lists filled by a prior call to linklist::collect
| Name | Type | Default | Description |
| Return | int | Number of defined function variables of a script action of a placeholder. | |
| lk | Link | - | Valid Link object The function returns valid values for objects from LinkList lists filled by a prior call to linklist::collect! |
| actionType | int | - | Script of function variable
|
static int link::get_nth_funcvar(
Link lk,
int actionType,
int nth,
String name = 0,
String value = 0)
Get the name and the current value of a function variable of a placeholders action script.
The function returns valid values for objects from LinkList lists filled by a prior call to linklist::collect
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| lk | Link | - | Valid Link object The function returns valid values for objects from LinkList lists filled by a prior call to linklist::collect! |
| actionType | int | - | Script of function variable
|
| index | int | - | Index of the variable |
| name | String oder char* | 0 | Allocated String (string::alloc, char[N], alloc ()) for the name of the nth variable |
| value | String oder char* | 0 | Allocated String (string::alloc, char[N], alloc ()) for the current value of the nth variable |
Collect all placeholder of the first page of a document and write their current function variables of the load action to the log.¬
#include "internal/types.h" #include "internal/text.h"
int main () { LinkList lli = linklist::alloc (); Link lk; int i; char name [512]; String value = string::alloc ();
linklist::collect (lli, 1, "", kFirstIgnore, kSortNo); for (lk = linklist::first (lli); lk; lk = linklist::next (lli)) { wlog ("", "Placeholder [%d, %d] with %d load funcvars\n", link::pos (lk), link::pos (lk) + link::length (lk), link::count_funcvars (lk, 1)); for (i = 0; i < link::count_funcvars (lk, 1); i++) { link::get_nth_funcvar (lk, 1, i, name, value); wlog ("", " %d : '%s', '%s'\n", i+1, name, value); } }
return 0; }
static char* link::crossref::document(Link lk, int what = 1)
Document name (folder, path) of the cross reference destination. The result is only defined after a call to hyperlink::find. See also in Cross reference placeholder.
| Name | Type | Default | Description |
| Return | char* | Document name (folder, path) of the cross reference destination "" : Error The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
| lk | Link | - | Link containing the information |
| what | int | 0 |
|
static int link::crossref::page(Link lk, int what = 0)
Page number of the cross reference destination. The result is only defined after a call to hyperlink::find. See also in Cross reference placeholder.
| Name | Type | Default | Description |
| Return | int | Page number of the cross reference destination (1-based) 0 : Error |
|
| lk | Link | - | Link containing the information |
| what | int | 0 |
|
static char* link::crossref::pagename(Link lk, int what = 0)
Page name of the cross reference destination. The result is only defined after a call to hyperlink::find. See also in Cross reference placeholder.
| Name | Type | Default | Description |
| Return | char* | Page name of the cross reference destination "" : Error The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
| lk | Link | - | Link containing the information |
| what | int | 0 |
|
static char* link::crossref::name(Link lk)
Name of the cross reference destination (may append by a number). The result is only defined after a call to hyperlink::find. See also in Cross reference placeholder.
| Name | Type | Default | Description |
| Return | char* | Name of the cross reference destination (may append by a number) "" : Error The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
| lk | Link | - | Link containing the information |
static char* link::crossref::destination(Link lk)
Comet ID of the cross reference destination (may append by a number). The result is only defined after a call to hyperlink::find. See also in Cross reference placeholder.
| Name | Type | Default | Description |
| Return | char* | Comet ID of the cross reference destination (may append by a number) "" : Error The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
| lk | Link | - | Link containing the information |
static float link::crossref::x(Link lk)
X coordinate of the of the cross reference destinations text position. The result is only defined after a call to hyperlink::find. See also in Cross reference placeholder.
| Name | Type | Default | Description |
| Return | float | X coordinate of the of the cross reference destinations text position in points -10000.0 : Error |
|
| lk | Link | - | Link containing the information |
static float link::crossref::y(Link lk)
Y coordinate of the of the cross reference destinations text position (baseline). The result is only defined after a call to hyperlink::find. See also in Cross reference placeholder.
| Name | Type | Default | Description |
| Return | float | Y coordinate of the of the cross reference destinations text position (baseline) in points -10000.0 : Error |
|
| lk | Link | - | Link containing the information |
static float link::crossref::left(Link lk)
Left coordinate of the of the cross reference destinations text frame. The result is only defined after a call to hyperlink::find. See also in Cross reference placeholder.
| Name | Type | Default | Description |
| Return | float | Left coordinate of the of the cross reference destinations text frame in points -10000.0 : Error |
|
| lk | Link | - | Link containing the information |
static float link::crossref::top(Link lk)
Top coordinate of the of the cross reference destinations text frame. The result is only defined after a call to hyperlink::find. See also in Cross reference placeholder.
| Name | Type | Default | Description |
| Return | float | Top coordinate of the of the cross reference destinations text frame in points -10000.0 : Error |
|
| lk | Link | - | Link containing the information |
static float link::crossref::right(Link lk)
Right coordinate of the of the cross reference destinations text frame. The result is only defined after a call to hyperlink::find. See also in Cross reference placeholder.
| Name | Type | Default | Description |
| Return | float | Right coordinate of the of the cross reference destinations text frame in points -10000.0 : Error |
|
| lk | Link | - | Link containing the information |
static float link::crossref::bottom(Link lk)
Bottom coordinate of the of the cross reference destinations text frame. The result is only defined after a call to hyperlink::find. See also in Cross reference placeholder.
| Name | Type | Default | Description |
| Return | float | Bottom coordinate of the of the cross reference destinations text frame in points -10000.0 : Error |
|
| lk | Link | - | Link containing the information |
static int link::crossref::pos(Link lk)
Anchor text position of the cross reference destination. The result is only defined after a call to hyperlink::find. See also in Cross reference placeholder.
| Name | Type | Default | Description |
| Return | int | text position of the anchor 0 : Error |
|
| lk | Link | - | Link containing the information |
static int link::crossref::frame(Link lk)
Text frame reference of the cross reference destination. The result is only defined after a call to hyperlink::find. See also in Cross reference placeholder.
| Name | Type | Default | Description |
| Return | ItemRef | frame of text anchor 0 : Error |
|
| lk | Link | - | Link containing the information |
static ItemRef link::crossref::src_frame(Link lk)
Frame of hyperlink source.
| Name | Type | Default | Description |
| Return | ItemRef | Frame of hyperlink source. 0 : Error |
|
| lk | Link | - | Link containing the information |
static int link::crossref::src_textpos(Link lk)
Text position of start of hyperlink source.
| Name | Type | Default | Description |
| Return | int | Text position of start of hyperlink source. -1 : Error |
|
| lk | Link | - | Link containing the information |
static int link::crossref::src_textlen(Link lk)
Text length of hyperlink source.
| Name | Type | Default | Description |
| Return | int | Text length of hyperlink source. -1 : Error |
|
| lk | Link | - | Link containing the information |
static ItemRef link::crossref::hyperlink_ref(Link lk)
Document reference of hyperlink.
| Name | Type | Default | Description |
| Return | ItemRef | Document reference of hyperlink. 0 : Error |
|
| lk | Link | - | Link containing the information |
static ItemRef link::crossref::anchor_ref(Link lk)
Document reference of hyperlink destination.
| Name | Type | Default | Description |
| Return | ItemRef | Document reference of hyperlink destination. 0 : Error |
|
| lk | Link | - | Link containing the information |
static int link::crossref::type(Link lk)
Type of hyperlink destination.
| Name | Type | Default | Description |
| Return | int |
|
|
| lk | Link | - | Link containing the information |
static char* link::crossref::info(Link lk)
Information about the hyperlink destination (url, email, ...).
| Name | Type | Default | Description |
| Return | char* | Information about the hyperlink destination (url, email, ...). 0 : error |
|
| lk | Link | - | Link containing the information |
static int link::crossref::key(Link lk)
Key of the hyperlink destination definition. The function only returns a defined value after calling hyperlink::find with the crossRefName prefixes "defns" and "defns_info".
| Name | Type | Default | Description |
| Return | int | Key of the definition of the hyperlink destination -1 : Error |
|
| lk | Link | - | HyperlinkDestinationDef object from a call to hyperlink::find with the crossRefName perfixes "defns" or "defns_info" |
Write all HyperlinkDestinationDefs of the current document to the logfile.
int main ()
{
LinkList lks = linklist::alloc ();
Link lk;
wlog ("", "HyperlinkDestDefns by name:\n");
hyperlink::find (lks, 0, "defn:'*'");
for (lk = linklist::first (lks); lk; lk = linklist::next (lks))
{
wlog ("", "'%s' [%d], type %d--> '%s'\n",
link::crossref::name (lk),
link::crossref::key (lk),
link::crossref::type (lk),
link::crossref::destination (lk));
}
wlog ("", "\nHyperlinkDestDefns by info:\n");
linklist::clear (lks);
hyperlink::find (lks, 0, "defn_info:'*'");
for (lk = linklist::first (lks); lk; lk = linklist::next (lks))
{
wlog ("", "'%s' [%d], type %d--> '%s'\n",
link::crossref::name (lk),
link::crossref::key (lk),
link::crossref::type (lk),
link::crossref::destination (lk));
}
return 0;
}
Alphabetic index HTML hierarchy of classes or Java