Elements of placeholder lists (link list).
Elements of placeholder lists (link list).
static int set_maxlen(Link lk, int len = -1)
Set the maximum length of the text which can be ascertained from a document placeholder.
Name | Type | Default | Description |
Return | int | 0 or Error | |
lk | Link | - | Valid link object of a link list |
len | int | -1 | New maximum length for text contents of placeholders
|
static int classid(Link lk)
Get the class number of the element
Name | Type | Default | Description |
Return | int | id (id2, id3) of the element or 0 | |
lk | Link | - | Valid link object of a link list |
static int id(Link lk)
Get the ID of the link.
Name | Type | Default | Description |
Return | int | id of the element or 0 | |
lk | Link | - | Valid link object of a link list |
static int id2(Link lk)
Get the ID2 of the link.
Name | Type | Default | Description |
Return | int | id2 of the element or 0 | |
lk | Link | - | Valid link object of a link list |
static int id3(Link lk)
Get the ID3 of the link.
Name | Type | Default | Description |
Return | int | id3 of the element or 0 | |
lk | Link | - | Valid link object of a link list |
static char* sid(Link lk)
Get the string ID of the element.
Name | Type | Default | Description |
Return | char* | StringID of the element.
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 link list |
static int placeholderid(Link lk)
Get the placeholder ID of the element.
Name | Type | Default | Description |
Return | int | Placeholder ID of the element or 0 | |
lk | Link | - | Valid link object of a link list |
static int sync(Link lk)
Get the synchron status which is stored in the element. The value is only defined in the results lists of linklist::sync and linklist::collect. It can have the following values:
Sync result | Description | Image |
-6 | Status not defined | |
-5 | Overridden | Equal sign |
-4 | Error in loading | Orange broken square |
-3 | No status marking |   |
-2 | Object not found | yellow/blue square |
-1 | Changed | Red check mark |
-0 | Deleted | Red X |
1 | Okay | Green check mark |
>1 | Object not clear | Orange + |
Name | Type | Default | Description |
Return | int | Synchron status of the placeholder with the corresponding object | |
lk | Link | - | Valid link object of a link list |
static char* content(
Link lk,
int fmt = 0,
int pos = 0,
int len = -1)
Ascertain the text of a placeholder. The placeholder text can only be ascertained 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
ascertained. 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 link list 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 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. After a renewed call on link::content the placeholder will be loaded again.
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
lk | Link | - | Valid link object link list |
static int gettext(Link lk, String result)
DEPRECATED! Get the text content which the placeholder shows in the document. The text is limited to the maximum specified number of characters in set_maxlen or linklist::insert. If the placeholder is linked with a frame, the path of the image will be fetched, that is shown in the frame. The value is only defined in the following cases :
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 link list |
result | String | - | valid string object. |
static int 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 link list |
static int 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 link list |
static int content_length(Link lk)
Length of the text in bytes, which is to be ascertained for the placeholder. Version prior R 668 used the name textlen instead of content_length! 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. This length can differ from the length ascertained by the function link::length.
Name | Type | Default | Description |
Return | int | Text length of the placeholder in bytes
|
|
lk | Link | - | Valid link object of a link list |
static int pagenum(Link lk)
Page number (beginning with 1) 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 link list |
static int 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 link list |
result | String or char* | - | Reserved memory for the result |
static int 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.
Name | Type | Default | Description |
Return | String or char* | value | |
lk | Link | - | Valid link object of a link list |
result | String or char* | - | Reserved memory for the result |
static int 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.
Name | Type | Default | Description |
Return | String or char* | value | |
lk | Link | - | Valid link object of a link list |
result | String or char* | - | Reserved memory for the result |
static int 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.
Name | Type | Default | Description |
Return | String or char* | value | |
lk | Link | - | Valid link object of a link list |
result | String or char* | - | Reserved memory for the result |
static int 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.
Name | Type | Default | Description |
Return | String or char* | value | |
lk | Link | - | Valid link object of a link list |
result | String or char* | - | Reserved memory for the result |
static int isframe(Link lk)
Is the placeholder a frame? 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 link list |
static char* 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 link list |
Rapid use of the layer name
li = linklist::first (lli);
while (li) { showmessage ("%s", link::layer (li)); li = linklist::next (lli); }
static char* 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 link list |
Rapid use of the image path¬
li = linklist::first (lli);
while (li) { showmessage ("%s", link::imagepath (li)); li = linklist::next (lli); }
static float 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 link list |
static float top(Link lk)
static float right(Link lk)
static float bottom(Link lk)
static float width(Link lk)
static float height(Link lk)
static ItemRef 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 link list |
static int 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* 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 override_sync(Link lk)
Override the sync status which is stored in the element by the status "override". The current value of the document (Text content or picture path depending on the placeholder type) is stored together with the value from the datasource in the document. When one changes the sync status will change back to changed on the next sync call.
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 is greater than -1.Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
lk | Link | - | Valid link object of a link list |
static int remove_override_sync(Link lk)
Remove the "override" sync status which is stored in the element. The stored values from the document and datasource will be removed.
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
lk | Link | - | Valid link object of a link list |
static int 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 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* 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 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* 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* 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* 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 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 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 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 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 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 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 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 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 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 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 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 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 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 crossref::type(Link lk)
Type of hyperlink destination.
Name | Type | Default | Description |
Return | int |
|
|
lk | Link | - | Link containing the information |
static char* 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 |
Alphabetic index HTML hierarchy of classes or Java