Some of these lists are ordered and some have no predictable order. Consider paragraphs. Every FrameMaker document has a list of paragraphs that is unordered. At first glance, you may be surprised that this list has no order but a bit of reflection reveals that paragraphs have order within flows and not within documents. Thus a script can get the paragraphs within a specific flow in the order in which they appear in the document or it can get the paragraphs in the document (a larger set) in an unpredictable order.
What can you do with paragraphs that are out of order? You can do just about anything that can be done to a paragraph that does not depend upon its specific location within the document.
If you were to look at the Frame Developer Kit (FDK) documentation, you would see that there is no table that separates the ordered and unordered lists. How can you tell which is which? The simplest method is to check to see if the list is linked backward and forward (that is, if there are next and prev properties). Such a list is ordered. A list with only a next property is unordered.
Lets get specific using paragraphs as an example. (To look this up yourself, see the section for FO_Pgf in the FDK Programmer's Reference.) In the FDK the paragraph object has these "object pointer" properties:
FP_NextPgfInDoc //Next paragraph in the unordered list for this doc
FP_NextPgfInFlow //Next paragraph in the ordered list for this flow
FP_PrevPgfInFlow //Previous paragraph in unordered list for this flowSo can you access the start of these lists?
- In the case of the unordered list, the first is a document property, FP_FirstPgfInDoc.
- In the case of the ordered list, the first is the text frame property FP_FirstPgf. There is also a FP_LastPgf property allowing for traversal of the list from last to first as well as first to last. (If you were expecting a flow property, you are likely not alone. Paragraphs within flows will get a more detailed treatment in a later entry.)
Remove the FP_ prefix before using the properties in scripts.FirstPgfInDoc //First paragraph in unordered list for this doc
NextPgfInDoc //Next paragraph in the unordered list for this doc
FirstPgf //First paragraph in ordered list for this flow
LastPgf //Last paragraph in ordered list for this flow
NextPgfInFlow //Next paragraph in the ordered list for this flow
PrevPgfInFlow //Previous paragraph in unordered list for this flowToo many years of FDK programming led me to revert back to FDK docs and remembered knowledge. If you are completely new to all of this, you can skip FDK-think and go directly to the Scripting Guide. Chapter 4 contains the Object Reference. Here you will also learn the important fact that the data type for these properties is Pgf. (In the FDK, it would be F_ObjHandleT.)
No comments:
Post a Comment