[Date Prev][Date Next] [Thread Prev][Thread Next]
[Date Index] [Thread Index] [New search]

Re: Autoinsertion of graphic in FM+SGML



At 01:00 AM 12/12/98 -0000, Barbara Matuzak wrote:
>Has anyone found a way to do the following?
>
>I'm trying to automatically insert a particular graphic before the text of
a Caution. Here is the DTD fragment:
>
><!ELEMENT Caution - - (Icon, Para)>
>...
><!ELEMENT Icon    - o EMPTY>
>...standard Frame graphic atts here...
>
>In my read/write rules, Icon becomes a graphic element, and the properties
for alignment, size, etc., have values supplied.
>
>When I insert Caution, Icon is autoinserted. If the EDD initial object
format rules are "Anchored Frame," the values supplied in the r/w rules
apply; if the object rule is "import graphic," the graphic gets imported
w/the default properties.
>
>Ideally, I'd like to be able to specify the anchored frame's properties and
automatically import the graphic, so the user doesn't have to choose it.
>
>I would use Frame Above for the Caution to insert the graphic, but
unfortunately the graphic needs to be next to the text, not above or below. 
>
>If anyone knows an elegant solution to this, I'd appreciate it.
********************************************************************
To utilize a paragraph with a Frame Above or a Frame Below to create the
caution icon, with the icon appearing side-by-side with the caution text,
you must create the caution in a 2-column, 1-row table, where the caution
icon is in column 1, and the text is in column 2.

Here's how to do it:

1. In the EDD, specify the Caution element to be a container element, whose
general rule is TABLE (or whatever you are calling the table element in the
EDD). Under the general rule for the Caution element, add an Exclusion line
that specifies TITLE, HEADING, FOOTING, where TITLE, HEADING, and FOOTING
are the names for the table title, table heading, and table footing elements
in the EDD. Also Specify TABLE as the autoinserted child of the Caution
element. Finally, specify in the format rules for the caution element a base
paragraph format tag that is suitable for anchoring tables. 

2. Be sure that the general rule for the table cell element has <TEXT> in it
(it can have other things as well). This will allow you to type text into
any table cell without having to first insert an element in the table cell
element.

3. In the format rules for the TABLE element, add a context rule as follows:

        If context is: * < Caution
                Table format: Caution

This format rule will pre-select the Caution table format (created in step 8
below) in the Insert Table dialog box each time you insert a Caution element.

Now to implement the EDD changes made in steps 1 and 2, you must modify the
template that has the element definitions imported into it. You must perform
steps 4 thru 10 below to accomplish this. 

4. Open both the EDD and the template, and re-import the EDD changes made in
steps 1 thru 3 into the template. This action will create a new table format
named Caution. It will also create a new paragraph tag for the base
paragraph format specified in the format rules for the Caution element (see
step 1 above) if this tag did not already exist.

5. In the template, create a reference frame named CautionIcon on a
reference page, and import by copy into that reference frame the graphic for
the caution icon. Resize the reference frame so that it's the same size as
the graphic.

6. In the template, use the Paragraph Designer to create a new paragraph
format named IconCaution, and specify the CautionIcon reference frame
(created in step 5) in the Frame Below of of the Advanced Properties.
 
7. In the template, choose Table > Insert Table to open the Insert Table
dialog box. Choose Caution from the Table Format listbox, specify a 2-column, 
1-body row table with no heading and footing rows, and click the Insert
button. Size the first column of the resulting table to be slightly wider
than the reference frame created in step 5, and size the second column to
fill the remaining width of the text column in which the table will appear.

8. Put the cursor in the first column of the table created in step 7, and
apply the IconCaution paragraph format to it.

9. With the cursor still in the table created in steps 7 and 8, open the
Table Designer, specify no title and no rulings, and click the Update All
button. This action will change the format definition for table format
Caution, as follows:
        a. The IconCaution paragraph format becomes the default
           paragraph for the table cells
        b. The column widths extablished in step 7 become the default column
           widths for the table.
        c. The table has no title or ruling. 

10. Delete from the template the table created in step 7, and save the
changes made to the template.

Now, with these steps accomplished, inserting the Caution element will
autoinsert the TABLE element, and the Insert Table dialog box will open with
the Caution table format pre-selected. Proceed as follows:

11. Specify 2 columns, 1 body row, 0 heading rows, and 0 footing rows in the
Insert Table dialog box, and click the Insert button. The inserted table
will have the column widths that were specified in step 7, and the format
specified in step 9. Both columns will have the default IconCaution
paragraph in them, thus the caution icon will appear in both columns.

12. Now, all you have to do is put the cursor in column 2, apply the
appropriate paragraph tag (from the paragraph catalog) to it, and type the
text for the caution.

The resulting table is valid, because the general rule for the table cell
element has <TEXT> in its general rule (see step 2 above).

When you export the FM+SGML document to SGML, column 1 of the table will be
empty, and column 2 will have the caution text in it. If you then import the
SGML document instance back into FM+SGML, the caution icon will reappear in
column 1, and column 2 will contain the caution text. However, the icon will
also appear in column 2. To get rid of it, reapply the paragraph tag that
was applied to it in step 12 above. 
     ____________________
     | Nullius in Verba |
     ********************
Dan Emory, Dan Emory & Associates
FrameMaker/FrameMaker+SGML Document Design & Database Publishing
Voice/Fax: 949-722-8971 E-Mail: danemory@primenet.com
10044 Adams Ave. #208, Huntington Beach, CA 92646


** To unsubscribe, send a message to majordomo@omsys.com **
** with "unsubscribe framers" (no quotes) in the body.   **