Annotation of Amaya/amaya/HTMLbook.c, revision 1.1
1.1 ! cvs 1: /*
! 2: *
! 3: * (c) COPYRIGHT MIT and INRIA, 1996.
! 4: * Please first read the full copyright statement in file COPYRIGHT.
! 5: *
! 6: */
! 7:
! 8: /*
! 9: * Initialization functions and button functions of Amaya application.
! 10: *
! 11: * Authors: V. Quint, I. Vatton
! 12: */
! 13:
! 14:
! 15: /* Included headerfiles */
! 16: #define THOT_EXPORT
! 17: #include "amaya.h"
! 18: #include "print.h"
! 19:
! 20: #define NumFormPrint 1
! 21: #define NumMenuOptions 2
! 22: #define NumMenuPaperFormat 3
! 23: #define NumMenuSupport 4
! 24: #define NumZonePrinterName 5
! 25: #define PRINT_MAX_REF 6
! 26:
! 27: /* Thot printer variables */
! 28: extern boolean PaperPrint;
! 29: extern boolean ManualFeed;
! 30: extern boolean NewPaperPrint;
! 31: extern char PSdir[MAX_PATH];
! 32: extern char PageSize[];
! 33: extern char pPrinter[MAX_PATH];
! 34:
! 35: static Document docPrint;
! 36: static boolean numberLinks;
! 37: static boolean withToC;
! 38: static int basePrint;
! 39:
! 40: #include "init_f.h"
! 41: #include "HTMLactions_f.h"
! 42: #include "HTMLbook_f.h"
! 43: #include "HTMLedit_f.h"
! 44:
! 45:
! 46: /*----------------------------------------------------------------------
! 47: SetInternalLinks
! 48: Associate a InternalLink attribute with all anchor (A) elements of the
! 49: document which designate another anchor in the same document.
! 50: InternalLink is a Thot reference attribute that links a source and a
! 51: target anchor and that allows P schemas to display and print cross-references
! 52: ----------------------------------------------------------------------*/
! 53: #ifdef __STDC__
! 54: static void SetInternalLinks (Document document)
! 55: #else
! 56: static void SetInternalLinks (document)
! 57: Document document;
! 58: #endif
! 59: {
! 60: Element root, el;
! 61: Element link, target;
! 62: ElementType elType;
! 63: Attribute HrefAttr, IntLinkAttr;
! 64: AttributeType attrType;
! 65: int length;
! 66: char *text;
! 67:
! 68:
! 69: root = TtaGetMainRoot (document);
! 70: elType = TtaGetElementType (root);
! 71: elType.ElTypeNum = HTML_EL_BODY;
! 72: el = TtaSearchTypedElement (elType, SearchForward, root);
! 73:
! 74: elType.ElTypeNum = HTML_EL_Anchor;
! 75: attrType.AttrSSchema = elType.ElSSchema;
! 76: /* looks for all anchors in the document */
! 77: link = el;
! 78: while (link != NULL)
! 79: {
! 80: link = TtaSearchTypedElement (elType, SearchForward, link);
! 81: if (link != NULL)
! 82: /* an anchor has been found */
! 83: {
! 84: attrType.AttrTypeNum = HTML_ATTR_HREF_;
! 85: HrefAttr = TtaGetAttribute (link, attrType);
! 86: if (HrefAttr != NULL)
! 87: /* this anchor has an HREF attribute */
! 88: {
! 89: length = TtaGetTextAttributeLength (HrefAttr);
! 90: text = TtaGetMemory (length + 1);
! 91: TtaGiveTextAttributeValue (HrefAttr, text, &length);
! 92: if (text[0] == '#')
! 93: /* it'a an internal link. Attach an attribute InternalLink to */
! 94: /* the link, if this attribute does not exist yet */
! 95: {
! 96: attrType.AttrTypeNum = HTML_ATTR_InternalLink;
! 97: IntLinkAttr = TtaGetAttribute (link, attrType);
! 98: if (IntLinkAttr == NULL)
! 99: {
! 100: IntLinkAttr = TtaNewAttribute (attrType);
! 101: TtaAttachAttribute (link, IntLinkAttr, document);
! 102: }
! 103: /* looks for the target element */
! 104: target = SearchNAMEattribute (document, &text[1], NULL);
! 105: if (target != NULL)
! 106: /* set the Thot link */
! 107: TtaSetAttributeReference (IntLinkAttr, link, document,
! 108: target, document);
! 109: }
! 110: TtaFreeMemory (text);
! 111: }
! 112: }
! 113: }
! 114: }
! 115:
! 116:
! 117: /*----------------------------------------------------------------------
! 118: CallbackImage manage returns of Picture form.
! 119: ----------------------------------------------------------------------*/
! 120: #ifdef __STDC__
! 121: void CallbackPrint (int ref, int typedata, char *data)
! 122: #else /* __STDC__ */
! 123: void CallbackPrint (ref, typedata, data)
! 124: int ref;
! 125: int typedata;
! 126: char *data;
! 127:
! 128: #endif /* __STDC__ */
! 129: {
! 130: int val;
! 131:
! 132: val = (int) data;
! 133: switch (ref - basePrint)
! 134: {
! 135: case NumFormPrint:
! 136: TtaDestroyDialogue (basePrint+NumFormPrint);
! 137: switch (val)
! 138: {
! 139: case 1:
! 140: /* confirms the paper print option */
! 141: /* the other options are not taken into account without this
! 142: confirmation */
! 143: PaperPrint = NewPaperPrint;
! 144: if (numberLinks)
! 145: SetInternalLinks (docPrint);
! 146: if (withToC)
! 147: TtaPrint (docPrint, "Formatted_view Table_of_contents");
! 148: else
! 149: TtaPrint (docPrint, "Formatted_view");
! 150: break;
! 151: default:
! 152: break;
! 153: }
! 154: break;
! 155: case NumMenuOptions:
! 156: switch (val)
! 157: {
! 158: case 0:
! 159: /* Manual feed option */
! 160: ManualFeed = !ManualFeed;
! 161: break;
! 162: case 1:
! 163: /* Toc option */
! 164: withToC = !withToC;
! 165: break;
! 166: case 2:
! 167: /* Manual feed option */
! 168: numberLinks = !numberLinks;
! 169: break;
! 170: break;
! 171: }
! 172: break;
! 173: case NumMenuPaperFormat:
! 174: /* page size submenu */
! 175: switch (val)
! 176: {
! 177: case 0:
! 178: strcpy (PageSize, "A4");
! 179: break;
! 180: case 1:
! 181: strcpy (PageSize, "US");
! 182: break;
! 183: }
! 184: break;
! 185: case NumMenuSupport:
! 186: /* paper print/save PostScript submenu */
! 187: switch (val)
! 188: {
! 189: case 0:
! 190: if (!NewPaperPrint)
! 191: {
! 192: NewPaperPrint = TRUE;
! 193: TtaSetTextForm (basePrint+NumZonePrinterName, pPrinter);
! 194: }
! 195: break;
! 196: case 1:
! 197: if (NewPaperPrint)
! 198: {
! 199: NewPaperPrint = FALSE;
! 200: TtaSetTextForm (basePrint+NumZonePrinterName, PSdir);
! 201: }
! 202: break;
! 203: }
! 204: break;
! 205: case NumZonePrinterName:
! 206: if (data[0] != '\0')
! 207: if (NewPaperPrint)
! 208: /* text capture zone for the printer name */
! 209: strncpy (pPrinter, data, MAX_PATH);
! 210: else
! 211: /* text capture zone for the name of the PostScript file */
! 212: strncpy (PSdir, data, MAX_PATH);
! 213: break;
! 214: }
! 215: }
! 216:
! 217: /*----------------------------------------------------------------------
! 218: ----------------------------------------------------------------------*/
! 219: #ifdef __STDC__
! 220: void InitPrint (void)
! 221: #else /* __STDC__ */
! 222: void InitPrint ()
! 223: #endif /* __STDC__ */
! 224: {
! 225: char *ptr;
! 226:
! 227: basePrint = TtaSetCallback (CallbackPrint, PRINT_MAX_REF);
! 228: docPrint = 0;
! 229:
! 230: /* init printer variables */
! 231: /* read default printer variable */
! 232: ptr = TtaGetEnvString ("THOTPRINT");
! 233: if (ptr == NULL)
! 234: strcpy (pPrinter, "");
! 235: else
! 236: strcpy (pPrinter, ptr);
! 237: /* read default tmpdir variable */
! 238: ptr = TtaGetEnvString ("TMPDIR");
! 239: if (ptr == NULL)
! 240: strcpy (PSdir, TempFileDirectory);
! 241: else
! 242: strcpy (pPrinter, ptr);
! 243:
! 244: strcpy (PageSize,"A4");
! 245: PaperPrint = TRUE;
! 246: NewPaperPrint = TRUE;
! 247: ManualFeed = FALSE;
! 248: numberLinks = FALSE;
! 249: withToC = FALSE;
! 250: }
! 251:
! 252: /*----------------------------------------------------------------------
! 253: ----------------------------------------------------------------------*/
! 254: #ifdef __STDC__
! 255: void SetupAndPrint (Document document, View view)
! 256: #else
! 257: void SetupAndPrint (document, view)
! 258: Document document;
! 259: View view;
! 260:
! 261: #endif
! 262: {
! 263: int i;
! 264: char bufMenu[MAX_LENGTH];
! 265:
! 266: /* Print form */
! 267: if (docPrint != document)
! 268: docPrint = document;
! 269: /*InitPrintParameters (pDoc);*/
! 270: TtaNewSheet (basePrint+NumFormPrint, TtaGetViewFrame (document, view),
! 271: TtaGetMessage (LIB, TMSG_LIB_PRINT),
! 272: 1, TtaGetMessage (LIB, TMSG_LIB_CONFIRM), FALSE, 2, 'L', D_CANCEL);
! 273: i = 0;
! 274: sprintf (&bufMenu[i], "%s%s", "T", TtaGetMessage (LIB, TMSG_MANUAL_FEED));
! 275: i += strlen (&bufMenu[i]) + 1;
! 276: sprintf (&bufMenu[i], "%s%s", "T", TtaGetMessage (AMAYA, AM_PRINT_TOC));
! 277: i += strlen (&bufMenu[i]) + 1;
! 278: sprintf (&bufMenu[i], "%s%s", "T", TtaGetMessage (AMAYA, AM_NUMBERED_LINKS));
! 279: TtaNewToggleMenu (basePrint+NumMenuOptions, basePrint+NumFormPrint,
! 280: TtaGetMessage (LIB, TMSG_OPTIONS), 3, bufMenu, NULL, FALSE);
! 281: if (ManualFeed)
! 282: TtaSetToggleMenu (basePrint+NumMenuOptions, 0, TRUE);
! 283: if (withToC)
! 284: TtaSetToggleMenu (basePrint+NumMenuOptions, 1, TRUE);
! 285: if (numberLinks)
! 286: TtaSetToggleMenu (basePrint+NumMenuOptions, 2, TRUE);
! 287:
! 288: /* Paper format submenu */
! 289: i = 0;
! 290: sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (LIB, TMSG_A4));
! 291: i += strlen (&bufMenu[i]) + 1;
! 292: sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (LIB, TMSG_US));
! 293: TtaNewSubmenu (basePrint+NumMenuPaperFormat, basePrint+NumFormPrint, 0,
! 294: TtaGetMessage (LIB, TMSG_PAPER_SIZE), 2, bufMenu, NULL, FALSE);
! 295: if (!strcmp (PageSize, "US"))
! 296: TtaSetMenuForm (basePrint+NumMenuPaperFormat, 1);
! 297: else
! 298: TtaSetMenuForm (basePrint+NumMenuPaperFormat, 0);
! 299:
! 300: /* Print to paper/ Print to file submenu */
! 301: i = 0;
! 302: sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (LIB, TMSG_PRINTER));
! 303: i += strlen (&bufMenu[i]) + 1;
! 304: sprintf (&bufMenu[i], "%s%s", "B", TtaGetMessage (LIB, TMSG_PS_FILE));
! 305: TtaNewSubmenu (basePrint+NumMenuSupport, basePrint+NumFormPrint, 0,
! 306: TtaGetMessage (LIB, TMSG_OUTPUT), 2, bufMenu, NULL, TRUE);
! 307: /* text capture zone for the printer name */
! 308: TtaNewTextForm (basePrint+NumZonePrinterName, basePrint+NumFormPrint, NULL, 30, 1, FALSE);
! 309:
! 310: /* initialization of the PaperPrint selector */
! 311: NewPaperPrint = PaperPrint;
! 312: if (PaperPrint)
! 313: {
! 314: TtaSetMenuForm (basePrint+NumMenuSupport, 0);
! 315: TtaSetTextForm (basePrint+NumZonePrinterName, pPrinter);
! 316: }
! 317: else
! 318: {
! 319: TtaSetMenuForm (basePrint+NumMenuSupport, 1);
! 320: TtaSetTextForm (basePrint+NumZonePrinterName, PSdir);
! 321: }
! 322:
! 323: /* activates the Print form */
! 324: TtaShowDialogue (basePrint+NumFormPrint, FALSE);
! 325: }
! 326:
! 327: /*----------------------------------------------------------------------
! 328: SectionNumbering
! 329: Execute the "Section Numbering" command
! 330: ----------------------------------------------------------------------*/
! 331: #ifdef __STDC__
! 332: void SectionNumbering (Document document, View view)
! 333: #else
! 334: void SectionNumbering (document, view)
! 335: Document document;
! 336: View view;
! 337: #endif
! 338: {
! 339: ChangeAttrOnRoot (document, HTML_ATTR_SectionNumbering);
! 340: }
! 341:
! 342: /*----------------------------------------------------------------------
! 343: UpdateURLsInSubtree
! 344: Update NAMEs and URLs in subtree of el element, to take into account
! 345: the move from one document to another.
! 346: If a NAME attribute already exists in the new document, it is changed
! 347: to avoid duplicate names.
! 348: Transform the HREF and SRC attribute to make them independent from their
! 349: former base.
! 350: ----------------------------------------------------------------------*/
! 351: #ifdef __STDC__
! 352: static void UpdateURLsInSubtree (NotifyElement *event, Element el)
! 353: #else
! 354: static void UpdateURLsInSubtree (event, el)
! 355: NotifyElement *event;
! 356: Element el;
! 357: #endif
! 358: {
! 359: Element nextEl;
! 360:
! 361: event->element = el;
! 362: ElementPasted (event);
! 363: nextEl = TtaGetFirstChild (el);
! 364: while (nextEl != NULL)
! 365: {
! 366: UpdateURLsInSubtree (event, nextEl);
! 367: TtaNextSibling (&nextEl);
! 368: }
! 369: }
! 370:
! 371:
! 372: /*----------------------------------------------------------------------
! 373: MoveDocumentBody
! 374: Copy the elements contained in the BODY of document sourceDoc to the
! 375: position of element *el in document destDoc.
! 376: Delete the element containing *el and all its empty ancestors.
! 377: If deleteTree is TRUE, copied elements are deleted from the source
! 378: document.
! 379: ----------------------------------------------------------------------*/
! 380: #ifdef __STDC__
! 381: static void MoveDocumentBody (Element *el, Document destDoc,
! 382: Document sourceDoc, boolean deleteTree)
! 383: #else
! 384: static void MoveDocumentBody (el, destDoc, sourceDoc, deleteTree)
! 385: Element *el;
! 386: Document destDoc;
! 387: Document sourceDoc;
! 388: boolean deleteTree;
! 389: #endif
! 390: {
! 391: Element root, body, ancestor, elem, firstInserted,
! 392: lastInserted, srce, copy, old, parent, sibling;
! 393: ElementType elType;
! 394: NotifyElement event;
! 395:
! 396: firstInserted = NULL;
! 397: /* get the BODY element of source document */
! 398: root = TtaGetMainRoot (sourceDoc);
! 399: elType = TtaGetElementType (root);
! 400: elType.ElTypeNum = HTML_EL_BODY;
! 401: body = TtaSearchTypedElement (elType, SearchForward, root);
! 402: if (body != NULL)
! 403: {
! 404: /* get elem, the ancestor of *el which is a child of a DIV or BODY
! 405: element in the destination document. The copied elements will be
! 406: inserted just before this element. */
! 407: elem = *el;
! 408: do
! 409: {
! 410: ancestor = TtaGetParent (elem);
! 411: if (ancestor != NULL);
! 412: {
! 413: elType = TtaGetElementType (ancestor);
! 414: if (elType.ElTypeNum == HTML_EL_BODY ||
! 415: elType.ElTypeNum == HTML_EL_Division)
! 416: ancestor = NULL;
! 417: else
! 418: elem = ancestor;
! 419: }
! 420: }
! 421: while (ancestor != NULL);
! 422: parent = TtaGetParent (elem);
! 423:
! 424: /* do copy */
! 425: lastInserted = NULL;
! 426: srce = TtaGetFirstChild (body);
! 427: while (srce != NULL)
! 428: {
! 429: copy = TtaCopyTree (srce, sourceDoc, destDoc, parent);
! 430: if (copy != NULL)
! 431: {
! 432: if (lastInserted == NULL)
! 433: /* this is the first copied element. Insert it before elem */
! 434: {
! 435: TtaInsertSibling (copy, elem, TRUE, destDoc);
! 436: firstInserted = copy;
! 437: }
! 438: else
! 439: /* insert the new copied element after the element previously
! 440: copied */
! 441: TtaInsertSibling (copy, lastInserted, FALSE, destDoc);
! 442: lastInserted = copy;
! 443: /* update the NAMEs and URLs in the copied element */
! 444: event.document = destDoc;
! 445: event.position = sourceDoc;
! 446: UpdateURLsInSubtree(&event, copy);
! 447: }
! 448: /* get the next element in the source document */
! 449: old = srce;
! 450: TtaNextSibling (&srce);
! 451: if (deleteTree)
! 452: TtaDeleteTree (old, sourceDoc);
! 453: }
! 454:
! 455: /* delete the element(s) containing the link to the copied document */
! 456: /* delete the parent element of *el and all empty ancestors */
! 457: elem = TtaGetParent (*el);
! 458: do
! 459: {
! 460: sibling = elem;
! 461: TtaNextSibling (&sibling);
! 462: if (sibling == NULL)
! 463: {
! 464: sibling = elem;
! 465: TtaPreviousSibling (&sibling);
! 466: if (sibling == NULL)
! 467: elem = TtaGetParent (elem);
! 468: }
! 469: }
! 470: while (sibling == NULL);
! 471: TtaDeleteTree (elem, destDoc);
! 472: /* return the address of the first copied element */
! 473: *el = firstInserted;
! 474: }
! 475: }
! 476:
! 477: /*----------------------------------------------------------------------
! 478: GetIncludedDocuments
! 479: Look forward, starting from element el, for a link (A) with attribute
! 480: REL="chapter" and replace that link by the contents of the target document.
! 481: ----------------------------------------------------------------------*/
! 482: #ifdef __STDC__
! 483: static Element GetIncludedDocuments (Element el, Document document)
! 484: #else
! 485: static Element GetIncludedDocuments (el, document)
! 486: Element el;
! 487: Document document;
! 488: #endif
! 489: {
! 490: Element link, next;
! 491: Attribute RelAttr, HrefAttr;
! 492: AttributeType attrType;
! 493: int length;
! 494: char *text, *ptr;
! 495: Document includedDocument, newdoc;
! 496:
! 497: attrType.AttrSSchema = TtaGetDocumentSSchema (document);
! 498: attrType.AttrTypeNum = HTML_ATTR_REL;
! 499: link = el;
! 500: RelAttr = NULL;
! 501: /* looks for an anchor having an attribute REL="chapter" */
! 502: while (link != NULL && RelAttr == NULL)
! 503: {
! 504: TtaSearchAttribute (attrType, SearchForward, link, &link, &RelAttr);
! 505: if (link != NULL && RelAttr != NULL)
! 506: {
! 507: length = TtaGetTextAttributeLength (RelAttr);
! 508: text = TtaGetMemory (length + 1);
! 509: TtaGiveTextAttributeValue (RelAttr, text, &length);
! 510: if (strcasecmp (text, "chapter"))
! 511: RelAttr = NULL;
! 512: TtaFreeMemory (text);
! 513: }
! 514: }
! 515:
! 516: if (RelAttr != NULL && link != NULL)
! 517: /* a link with attribute REL="Chapter" has been found */
! 518: {
! 519: next = link;
! 520: attrType.AttrTypeNum = HTML_ATTR_HREF_;
! 521: HrefAttr = TtaGetAttribute (link, attrType);
! 522: if (HrefAttr != NULL)
! 523: /* this link has an attribute HREF */
! 524: {
! 525: length = TtaGetTextAttributeLength (HrefAttr);
! 526: text = TtaGetMemory (length + 1);
! 527: TtaGiveTextAttributeValue (HrefAttr, text, &length);
! 528: /* ignore links to a particular position within a document */
! 529: ptr = strrchr (text, '#');
! 530: if (ptr == NULL)
! 531: /* this link designate the whole document */
! 532: {
! 533: /* create a new document and loads the target document */
! 534: includedDocument = TtaNewDocument ("HTML", "tmp");
! 535: newdoc = GetHTMLDocument (text, NULL, includedDocument,
! 536: document, DC_TRUE);
! 537: if (newdoc != 0 && newdoc != document)
! 538: /* it's not the document itself */
! 539: /* copy the target document at the position of the link */
! 540: MoveDocumentBody (&next, document, newdoc,
! 541: newdoc == includedDocument);
! 542: FreeDocumentResource (includedDocument);
! 543: TtaCloseDocument (includedDocument);
! 544: }
! 545: TtaFreeMemory (text);
! 546: }
! 547: return (next);
! 548: }
! 549: return (NULL);
! 550: }
! 551:
! 552:
! 553: /*----------------------------------------------------------------------
! 554: MakeBook
! 555: Replace all links in a document which have an attribute REL="chapter"
! 556: by the corresponding target document.
! 557: ----------------------------------------------------------------------*/
! 558: #ifdef __STDC__
! 559: void MakeBook (Document document, View view)
! 560: #else
! 561: void MakeBook (document, view)
! 562: Document document;
! 563: View view;
! 564: #endif
! 565: {
! 566: Element root, body, el;
! 567: ElementType elType;
! 568:
! 569: root = TtaGetMainRoot (document);
! 570: elType = TtaGetElementType (root);
! 571: elType.ElTypeNum = HTML_EL_BODY;
! 572: body = TtaSearchTypedElement (elType, SearchForward, root);
! 573: TtaSetDocumentModified (document);
! 574: el = body;
! 575: while (el != NULL)
! 576: el = GetIncludedDocuments (el, document);
! 577: }
! 578:
! 579:
! 580: #ifdef R_HTML
! 581: /*----------------------------------------------------------------------
! 582: ----------------------------------------------------------------------*/
! 583: #ifdef __STDC__
! 584: static void LoadEntity (Document document, char *text)
! 585: #else
! 586: static void LoadEntity (document, text)
! 587: Document document;
! 588: char *text;
! 589: #endif
! 590: {
! 591: Document includedDocument;
! 592: Attribute attr;
! 593: AttributeType attrType;
! 594: Element el, includedEl;
! 595: ElementType elType;
! 596: int length;
! 597:
! 598: /* create the temporary document */
! 599: includedDocument = TtaNewDocument ("HTML", "tmp");
! 600: /* read the temporary document */
! 601: includedDocument = GetHTMLDocument (text, NULL, includedDocument, document, DC_TRUE);
! 602:
! 603: if (includedDocument != 0)
! 604: {
! 605: /* To do: Seach entity in the table */
! 606: /* locate the entity in the document */
! 607: el = TtaGetMainRoot (document);
! 608: elType = TtaGetElementType (el);
! 609: elType.ElTypeNum = HTML_EL_Entity;
! 610: /* TtaSearchElementByLabel (label, el); */
! 611: el = TtaSearchTypedElement (elType, SearchForward, el);
! 612: /* keep the entity name to know where to insert the sub-tree */
! 613: attrType.AttrSSchema = TtaGetDocumentSSchema (document);
! 614: attrType.AttrTypeNum = HTML_ATTR_entity_name;
! 615: attr = TtaGetAttribute (el, attrType);
! 616: if (attr != NULL)
! 617: {
! 618: length = TtaGetTextAttributeLength (attr);
! 619: text = TtaGetMemory (length + 1);
! 620: TtaGiveTextAttributeValue (attr, text, &length);
! 621: }
! 622: /* To do: translate the entity name into element type
! 623: and search this first element type in included document */
! 624: includedEl = TtaGetMainRoot (includedDocument);
! 625: elType = TtaGetElementType (includedEl);
! 626: elType.ElTypeNum = HTML_EL_TEXT_UNIT;
! 627: includedEl = TtaSearchTypedElement (elType, SearchForward, includedEl);
! 628: /* remove Entity */
! 629: /* To do: insert sub-trees */
! 630: FreeDocumentResource (includedDocument);
! 631: TtaCloseDocument (includedDocument);
! 632: }
! 633: }
! 634: #endif /* R_HTML */
! 635:
! 636:
! 637: /*----------------------------------------------------------------------
! 638: ----------------------------------------------------------------------*/
! 639: #ifdef __STDC__
! 640: void RealTimeHTML (Document document, View view)
! 641: #else
! 642: void RealTimeHTML (document, view)
! 643: Document document;
! 644: View view;
! 645: #endif
! 646: {
! 647: #ifdef R_HTML
! 648: Element root, el;
! 649: ElementType elType;
! 650:
! 651: root = TtaGetMainRoot (document);
! 652: elType = TtaGetElementType (root);
! 653: elType.ElTypeNum = HTML_EL_Entity;
! 654: el = TtaSearchTypedElement (elType, SearchForward, root);
! 655: if (el != NULL)
! 656: {
! 657: /* document contains entities */
! 658: /* To do -> build table of entities */
! 659:
! 660: /* simulate reception of different entities */
! 661: LoadEntity (document, "0/0");
! 662: LoadEntity (document, "0/1");
! 663: }
! 664: #endif /* R_HTML */
! 665: }
Webmaster