1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698
|
/* $Header: d:/cvsroot/tads/html/htmltags.h,v 1.3 1999/07/11 00:46:40 MJRoberts Exp $ */
/*
* Copyright (c) 1997 by Michael J. Roberts. All Rights Reserved.
*
* Please see the accompanying license file, LICENSE.TXT, for information
* on using and copying this software.
*/
/*
Name
htmltags.h - tag classes
Function
Notes
Modified
08/26/97 MJRoberts - Creation
*/
#ifndef HTMLTAGS_H
#define HTMLTAGS_H
#ifndef TADSHTML_H
#include "tadshtml.h"
#endif
#ifndef HTMLURL_H
#include "htmlurl.h"
#endif
#ifndef HTMLSYS_H
#include "htmlsys.h"
#endif
/* ------------------------------------------------------------------------ */
/*
* Error codes for setting attributes (CHtmlTag::set_attribute)
*/
enum HTML_attrerr
{
HTML_attrerr_ok, /* success */
HTML_attrerr_inv_attr, /* attribute is not valid for this tag */
HTML_attrerr_inv_type, /* value is not of the appropriate type */
HTML_attrerr_inv_enum, /* value doesn't match allowed choices */
HTML_attrerr_out_of_range, /* value is out of range */
HTML_attrerr_too_many_coords, /* too many coordinates */
HTML_attrerr_odd_coords, /* odd number of coordinates in polygon */
HTML_attrerr_missing_delim /* missing delimiter */
};
/* ------------------------------------------------------------------------ */
/*
* Basic tag class
*/
class CHtmlTag
{
public:
CHtmlTag() { nxt_ = 0; container_ = 0; }
virtual ~CHtmlTag();
/*
* Process the end-tag. This is a static function invoked directly
* from the parser to begin processing the </xxx> closing tag. Almost
* all tags are handled the same way here, but a few tag classes need
* to "override" this; for example, the </BODY> tag isn't a real
* container and simply ignores closing tags, so it overrides this to
* do nothing at all.
*
* Note that this is a static, but we can still override it as though
* it were virtual, because the registration table (in htmlreg.h)
* automatically associates each tag name with the proper class's
* static. If this isn't overridden, then the class static will simply
* "inherit" the base class static; otherwise, the class static will be
* the one defined in the specific overriding class.
*/
static void process_end_tag(class CHtmlParser *parser,
const textchar_t *tag, size_t len);
/* format this tag */
virtual void format(class CHtmlSysWin *, class CHtmlFormatter *) { }
/*
* Determine if we can prune this tag. Certain types of tags cannot
* be pruned because they have global effects. By default, we'll
* return true; any tag that cannot be pruned due to global effects
* should return false.
*/
virtual int can_prune_tag() const { return TRUE; }
/*
* If this tag can't be pruned (i.e., can_prune_tag() returns
* false), this method should try to delete any contents of the tag
* that can be safely deleted. In some cases, a container tag (such
* as TITLE) can't be pruned, but the contents of the tag can be
* safely removed. By default, we won't do anything here.
*/
virtual void try_prune_contents(class CHtmlTextArray *) { }
/*
* Perform any work necessary just before deleting this tag as part
* of pruning a tree. Tags with children should call this method on
* all of their children. Tags with text should delete their text
* from the text array.
*/
virtual void prune_pre_delete(class CHtmlTextArray *arr) { }
/*
* Set an attribute value. Each tag must override this routine,
* since by default we don't recognize any attributes. Returns an
* HTML_attr_err error code.
*/
virtual HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
/*
* Immediately after the parser finishes scanning the tag's
* attribute list, it will create a new instance of the tag object,
* then call this method to let the tag take any parse-time action
* necessary. Container start tags, for example, will place
* themselves on the parser tag stack. By default, we'll simply add
* this tag to the current container.
*/
virtual void on_parse(CHtmlParser *parser);
/* get my tag name - must be overridden by each subclass */
virtual const textchar_t *get_tag_name() const = 0;
/* check if my tag name matches a given name */
int tag_name_matches(const textchar_t *nm, size_t nmlen) const;
/* check if two tag names match */
static int tag_names_match(const textchar_t *nm1, size_t len1,
const textchar_t *nm2, size_t len2);
/*
* Determine if a particular tag is allowed while within this
* container. Each time a tag is parsed, the parser will check with
* each enclosing container to make sure that a particular tag is
* allowed by the container. By default, this routine returns true
* to indicate that the tag is allowed. Some container tags will
* want to override this; for example, the <TITLE> tag does not
* allow any markups, and the <PRE> tag does not allow block
* markups.
*/
virtual int allow_tag(CHtmlTag *) const { return TRUE; }
/*
* certain tags are not allowed in lists - these should ovveride
* this and return false
*/
virtual int allowed_in_list() const { return TRUE; }
/*
* Get the list nesting level. Since most elements are not list
* containers, this by default returns the list nesting level of my
* container, or zero if I have no container.
*/
virtual int get_list_nesting_level() const;
/* tags are arranged into lists */
CHtmlTag *get_next_tag() const { return nxt_; }
/* determine if it's okay to proceed into formatting this tag */
virtual int ready_to_format() const { return TRUE; }
/*
* set the next tag to the given tag (used by the parser when
* unlinking tags from trees)
*/
void set_next_tag(CHtmlTag *nxt) { nxt_ = nxt; }
/* each tag has a container */
class CHtmlTagContainer *get_container() const { return container_; }
/* am I a container? */
virtual int is_container_tag() const { return FALSE; }
/* add a new item following this tag */
void append(CHtmlTag *tag) { nxt_ = tag; }
/* set my container */
void set_container(class CHtmlTagContainer *container)
{
container_ = container;
}
/*
* Get this item as a table cell. If it's not a table cell, this
* routine returns null.
*/
virtual class CHtmlTagTableCell *get_as_table_cell() { return 0; }
/*
* Get this item as a table row. If it's not a table row, this
* routine returns null.
*/
virtual class CHtmlTagTR *get_as_table_row() { return 0; }
/*
* Get the next tag in format order. When formatting, we start
* with the top container, then go to the first child of the
* container, then to it's first child, and so on; then to the next
* sibling of that tag, and so on; then to the next sibling of its
* container, then to its first child, and so on. In effect, we do
* a depth-first traversal, but we process the container nodes on
* the way down.
*/
virtual CHtmlTag *get_next_fmt_tag(class CHtmlFormatter *formatter);
/*
* Re-insert this tag's contents into the text array. This is used
* when a tag's display position is different than its position in
* the parsed tag list. Text must appear in the same order in the
* text array that it appears in the display list, so when a tag's
* display items are displayed out of order with respect to the tag,
* we must use this routine to re-insert the tag's contents at the
* proper point. This is used, for example, to put a table's
* caption's text after the table's text when the caption is aligned
* below the table.
*
* The default implementation does nothing, because default tags
* have no contents and no text.
*/
virtual void reinsert_text_array(class CHtmlTextArray *) { }
/* -------------------------------------------------------------------- */
/*
* Debugging methods. These methods are conditionally compiled; if
* debugging is turned off at compile time, these methods will not
* be defined.
*/
HTML_IF_DEBUG(virtual void debug_dump(int indent,
class CHtmlTextArray *arr)
{ debug_dump_name(indent); debug_dump_next(indent, arr); })
HTML_IF_DEBUG(void debug_dump_name(int indent)
{ debug_indent(indent); debug_printf("%s\n", get_tag_name());
debug_dump_attrib(indent); })
HTML_IF_DEBUG(void debug_dump_next(int indent,
class CHtmlTextArray *arr)
{ if (nxt_) nxt_->debug_dump(indent, arr); } )
HTML_IF_DEBUG(virtual void debug_dump_attrib(int /*indent*/) { })
HTML_IF_DEBUG(void debug_indent(int indent);)
HTML_IF_DEBUG(void debug_printf(const char *msg, ...) const;)
protected:
/*
* Most block tags cause a paragraph break. This service routine
* should be called by the on_parse() routine of each tag that
* causes a paragraph break just before themselves, and in the
* on_close() of container tags that cause a paragraph break after
* themselves. This routine tells the parser to insert a paragraph
* break into the text stream, and also has the effect of supplying
* an implicit </P> tag if a <P> tag is on the stack.
*/
void break_paragraph(CHtmlParser *parser, int isexplicit);
/* process a CLEAR attribute */
void format_clear(class CHtmlFormatter *formatter,
HTML_Attrib_id_t clear);
/* service routine to parse a color attribute value */
HTML_attrerr set_color_attr(class CHtmlParser *parser,
HTML_color_t *color_var,
const textchar_t *val, size_t vallen);
/*
* Map a color. If the color is a special parameterized color
* values, we'll map it to the corresponding system RGB color here.
* If the color is already an RGB color, we'll simply return the
* value unchanged. This routine always returns a fully-resolved
* RGB setting.
*/
HTML_color_t map_color(class CHtmlSysWin *win, HTML_color_t color);
/* parse a CLEAR attribute */
HTML_attrerr set_clear_attr(HTML_Attrib_id_t *clear,
class CHtmlParser *parser,
const textchar_t *val, size_t vallen);
/*
* Service routines to parse a numeric decimal/hex attribute value
*/
HTML_attrerr set_number_attr(long *num_var,
const textchar_t *val, size_t vallen);
HTML_attrerr set_float_attr(double *num_var,
const textchar_t *val, size_t vallen);
HTML_attrerr set_hex_attr(long *num_var,
const textchar_t *val, size_t vallen);
/* check an attribute string for a keyword followed by a comma */
int check_comma_kw(const textchar_t **val, size_t *vallen,
const textchar_t *kw);
/*
* Service routine to parse a numeric value that may be either an
* absolute value or a percentage. If the last character is a
* percent sign, it's a percentage, otherwise it's an absolute
* value.
*/
HTML_attrerr set_number_or_pct_attr(long *num_var, int *is_pct,
const textchar_t *val, size_t vallen);
/*
* Set a coordinate attribute. If pct is not null, we'll allow a
* percentage sign, and return in *pct whether or not a percentage
* sign was found. Advances the string pointer to the next comma.
*/
HTML_attrerr set_coord_attr(long *num_var, int *is_pct,
const textchar_t **val, size_t *vallen);
/* find the end of a token in a delimited attribute list */
const textchar_t *find_attr_token(const textchar_t *val, size_t *vallen,
const textchar_t *delim_chars);
private:
/* next tag in my list */
CHtmlTag *nxt_;
/* my container */
class CHtmlTagContainer *container_;
};
/*
* Each final tag subclass must define a static method that returns a
* string giving the name of the tag, and must also define a static
* method that returns a new instance of the class. This macro can be
* used to provide these definitions. This macro also defines the
* virtual tag name retrieval function.
*/
#define HTML_TAG_MAP_NOCONSTRUCTOR(tag_class_name, tag_name_string) \
static const textchar_t *get_tag_name_st() { return tag_name_string; } \
const textchar_t *get_tag_name() const { return tag_name_string; } \
static CHtmlTag *create_tag_instance(class CHtmlParser *prs) \
{ return new tag_class_name(prs); }
#define HTML_TAG_MAP(tag_class_name, tag_name_string) \
tag_class_name(class CHtmlParser *) { } \
HTML_TAG_MAP_NOCONSTRUCTOR(tag_class_name, tag_name_string)
/*
* Note that each final tag subclass that corresponds to a tag name
* must be registered so that the parser can include the tag in its tag
* name table. See htmlreg.h for information.
*/
/* ------------------------------------------------------------------------ */
/*
* Container tag class. This subclass of the basic tag can be used as
* the base class for any tag that acts as a container.
*/
class CHtmlTagContainer: public CHtmlTag
{
public:
CHtmlTagContainer()
{
contents_first_ = 0;
contents_last_ = 0;
closed_ = FALSE;
}
~CHtmlTagContainer();
/* am I a container? */
virtual int is_container_tag() const { return TRUE; }
/*
* Internal processing to exit the formatting of the container. We
* must undo any formatter state changes (such as margin sizes or font
* settings) that we made on entry; by default, we don't do anything,
* but container subclasses that modify formatter state on entry must
* undo those changes on exit.
*/
virtual void format_exit(class CHtmlFormatter *) { }
/* perform pre-deletion work on all of my children */
void prune_pre_delete(class CHtmlTextArray *arr);
/*
* A container tag pushes itself onto the container stack upon
* being parsed
*/
virtual void on_parse(CHtmlParser *parser);
/*
* When we parse a close tag for an open container tag, the parser
* will call this routine before actually closing the tag. This
* gives us a chance to do any implicit closing of other tags that
* may be nested within this tag. The default doesn't do anything.
*/
virtual void pre_close(CHtmlParser *) { }
/*
* When we reach the end of a container, the parser will call on_close
* on the current container to let it know that it's been closed.
* Note that we don't need to pop the container off the parser stack,
* as the parser will always do this automatically. Note also that
* this is called while we're still the active container.
*/
virtual void on_close(CHtmlParser *)
{
/* note that the tag is closed */
closed_ = TRUE;
}
/*
* receive notification that we've just finished closing the tag; the
* immediate container is now re-established as the active container
*/
virtual void post_close(CHtmlParser *) { }
/* determine whether the close tag has been parsed yet */
int is_closed() const { return closed_; }
/*
* Container tags can have sublists, containing the list of data
* and markups within the container. This returns the head of the
* sublist.
*/
CHtmlTag *get_contents() const { return contents_first_; }
/* get the lats item in my sublist */
CHtmlTag *get_last_contents() const { return contents_last_; }
/*
* Set the first child (this is used by the parser when unlinking
* tags from trees)
*/
void set_contents(CHtmlTag *cont) { contents_first_ = cont; }
/* Add a new item at the end of my sublist */
void append_to_sublist(CHtmlTag *tag);
/* Delete all of my contents */
void delete_contents();
/*
* Get the next tag in format order. The next tag after formatting
* a container is the first child of the container.
*/
virtual CHtmlTag *get_next_fmt_tag(class CHtmlFormatter *formatter);
/* re-insert my contents into the text array */
virtual void reinsert_text_array(class CHtmlTextArray *arr);
/*
* If this item is a list container, return this item, otherwise
* return the enclosing container that is a list container. Returns
* null if there is no enclosing list container.
*/
virtual class CHtmlTagListContainer *get_list_container()
{
/*
* default items are not list containers; return my container
* cast to a list container, or null if I have no container
*/
if (get_container() == 0)
return 0;
else
return get_container()->get_list_container();
}
/*
* If this item is a quote tag, return this item, otherwise return
* the enclosing container that is a quote item. Returns null if
* there is no enclosing quote container.
*/
virtual class CHtmlTagQ *get_quote_container()
{
if (get_container() == 0)
return 0;
else
return get_container()->get_quote_container();
}
/*
* If this item is a table/row/cell container, return this item,
* otehrwise return the enclosing container that is a table/row
* container. Returns null if there is no enclosing table/row
* container.
*/
virtual class CHtmlTagTABLE *get_table_container()
{
if (get_container() == 0)
return 0;
else
return get_container()->get_table_container();
}
virtual class CHtmlTagTR *get_table_row_container()
{
if (get_container() == 0)
return 0;
else
return get_container()->get_table_row_container();
}
virtual class CHtmlTagTableCell *get_table_cell_container()
{
if (get_container() == 0)
return 0;
else
return get_container()->get_table_cell_container();
}
HTML_IF_DEBUG(virtual void debug_dump(int indent,
class CHtmlTextArray *arr)
{ debug_dump_name(indent);
if (contents_first_) contents_first_->debug_dump(indent + 1, arr);
debug_dump_next(indent, arr); })
protected:
/* head of sublist of contents of this container */
CHtmlTag *contents_first_;
CHtmlTag *contents_last_;
/* flag indicating that the close tag has been encountered */
int closed_ : 1;
};
/* ------------------------------------------------------------------------ */
/*
* Special "relax" tag - this tag doesn't do anything, but is sometimes
* useful to pad the list.
*/
class CHtmlTagRelax: public CHtmlTag
{
public:
/* this class does not correspond to a named tag */
const textchar_t *get_tag_name() const { return "<!-- Relax -->"; }
/* we have no effect on formatting */
void format(class CHtmlSysWin *, class CHtmlFormatter *) { }
};
/* ------------------------------------------------------------------------ */
/*
* Special outermost container class. This is the container that wraps
* the entire document.
*/
class CHtmlTagOuter: public CHtmlTagContainer
{
public:
/* this class does not correspond to a named tag */
const textchar_t *get_tag_name() const
{
return "<!-- Outer Container -->";
}
/* format the tag */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
};
/* ------------------------------------------------------------------------ */
/*
* Special text tag class. This tag is used to wrap a block of text.
*/
class CHtmlTagText: public CHtmlTag
{
public:
CHtmlTagText(class CHtmlTextArray *arr, class CHtmlTextBuffer *buf);
CHtmlTagText(class CHtmlTextArray *arr, const textchar_t *buf,
size_t buflen);
~CHtmlTagText();
/* delete my text from the text array when pruning the tree */
void prune_pre_delete(class CHtmlTextArray *arr);
const textchar_t *get_tag_name() const { return "<!-- Text -->"; }
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
HTML_IF_DEBUG(virtual void debug_dump(int indent,
class CHtmlTextArray *arr);)
/* get this item's text offset */
unsigned long get_text_ofs() const { return txtofs_; }
/* re-insert my text into the text array */
virtual void reinsert_text_array(class CHtmlTextArray *arr);
protected:
CHtmlTagText() { }
/* memory containing the text */
unsigned long txtofs_;
size_t len_;
};
/*
* Text tag subclass for preformatted text
*/
class CHtmlTagTextPre: public CHtmlTagText
{
public:
CHtmlTagTextPre(int tab_size, class CHtmlTextArray *arr,
class CHtmlTextBuffer *buf);
CHtmlTagTextPre(int tab_size, class CHtmlTextArray *arr,
const textchar_t *buf, size_t buflen);
const textchar_t *get_tag_name() const
{ return "<!-- Preformatted Text -->"; }
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
private:
/* initialize the text buffer - used by the constructors */
void init_text(int tab_size, class CHtmlTextArray *arr,
const textchar_t *buf, size_t buflen);
};
/*
* Text tag subclass for command line input. This class behaves
* largely like a normal text tag, except for some special behavior.
* First, it can be edited through the UI. Second, the text in the
* buffer isn't stored in the text array, but rather in a buffer managed
* by the UI that's handling the input; the UI makes changes to its
* buffer, and notifies the formatter of changes so that the formatter
* can update the display. Once the command is completed, it can be
* committed, which will store it in the text array as usual; after
* being committed, the command can no longer be edited, and behaves
* like a normal text tag.
*/
class CHtmlTagTextInput: public CHtmlTagText
{
public:
CHtmlTagTextInput(class CHtmlTextArray *arr, const textchar_t *buf,
size_t len);
/* format the tag */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
/* commit the command to the text array */
void commit(class CHtmlTextArray *arr);
/*
* Update the length of the text in the buffer. Since the UI
* manages the buffer, it must keep us apprised of changes to the
* buffer's length with this function.
*/
void setlen(class CHtmlFormatterInput *fmt, size_t len);
/* re-insert my text into the text array */
virtual void reinsert_text_array(class CHtmlTextArray *arr);
/* change the underlying UI buffer */
void change_buf(CHtmlFormatterInput *fmt, const textchar_t *buf);
private:
/* the text pointer, when it's still in the UI's buffer */
const textchar_t *buf_;
};
/*
* Text tag subclass for debugger source file lines. In addition to the
* normal information we store for a text item, we store the seek
* location in the source file of the line; this information is used to
* associate the line in memory with the debug information in the .GAM
* file.
*
* This class is used only for the debugger.
*/
class CHtmlTagTextDebugsrc: public CHtmlTagTextPre
{
public:
CHtmlTagTextDebugsrc(unsigned long linenum, int tab_size,
class CHtmlTextArray *arr,
const textchar_t *buf, size_t buflen);
const textchar_t *get_tag_name() const
{ return "<!-- tdb source text -->"; }
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
private:
unsigned long linenum_;
};
/* ------------------------------------------------------------------------ */
/*
* Special tag for a soft hyphen. This indicates a point at which we can
* optionally break the line (to fit the margins) by adding a hyphen.
*/
class CHtmlTagSoftHyphen: public CHtmlTagText
{
public:
CHtmlTagSoftHyphen(class CHtmlTextArray *arr)
: CHtmlTagText(arr, "", 0) { }
const textchar_t *get_tag_name() const { return "­"; }
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
protected:
};
/* ------------------------------------------------------------------------ */
/*
* Special tag for non-breaking spaces.
*/
class CHtmlTagNBSP: public CHtmlTagText
{
public:
CHtmlTagNBSP(class CHtmlTextArray *arr, const textchar_t *buf)
: CHtmlTagText(arr, buf, get_strlen(buf))
{
/* remember my width in spaces */
wid_ = get_strlen(buf);
}
const textchar_t *get_tag_name() const { return " "; }
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
protected:
/* our width, in ordinary space widths */
int wid_;
};
/*
* Special width values for spaces whose sizes depend on font attributes
* other than the em size. We normally represent space widths as a number
* of spaces per em (i.e., as the denominator in the fraction of an em).
* Some space widths are not tied to the em size, though; for these, we
* define some manifest constants that are absurdly outside the range that
* we need for any of the pre-defined fractional-em spaces.
*/
#define HTMLTAG_SPWID_ORDINARY 10000 /* width of an ordinary space (' ') */
#define HTMLTAG_SPWID_FIGURE 10001 /* width of the digit '0' */
#define HTMLTAG_SPWID_PUNCT 10002 /* width of a period ('.') */
/*
* Special tag for explicitly-sized spaces.
*/
class CHtmlTagSpace: public CHtmlTagText
{
public:
/*
* Construct. Note that we store a single space in the text array as
* our plain text representation, unless we're a zero-width space, in
* which case we store nothing at all in the text array.
*/
CHtmlTagSpace(class CHtmlTextArray *arr, int wid, int pre)
: CHtmlTagText(arr, wid != 0 ? " " : "", wid != 0 ? 1 : 0)
{
/* remember my width and preformatted flag */
wid_ = wid;
pre_ = pre;
}
const textchar_t *get_tag_name() const
{ return "<!-- special space -->"; }
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
protected:
/*
* our width, expressed as the denominator of the fractional em (or as
* one of the special HTMLTAG_SPWID_xxx widths, or as zero for a
* zero-width space)
*/
int wid_;
/* are we preformatted? */
int pre_;
};
/* ------------------------------------------------------------------------ */
/*
* BODY tag
*/
/* default color settings */
const HTML_color_t HTML_bgcolor_default = 0xffffff; /* white */
const HTML_color_t HTML_textcolor_default = 0x000000; /* black */
class CHtmlTagBODY: public CHtmlTag
{
public:
CHtmlTagBODY(class CHtmlParser *)
{
use_bgcolor_ = FALSE;
use_textcolor_ = FALSE;
use_inputcolor_ = FALSE;
use_link_color_ = FALSE;
use_vlink_color_ = FALSE;
use_alink_color_ = FALSE;
use_hlink_color_ = FALSE;
bg_image_ = 0;
}
~CHtmlTagBODY();
/* process the end tag */
static void process_end_tag(class CHtmlParser *,
const textchar_t *, size_t)
{
/*
* Unlike in standard HTML, our <BODY> tags aren't containers, so
* we don't need or want an ending </BODY> tag. However, since
* people familiar with HTML often expect <BODY> to require a
* closing </BODY> tag, allow it by simply ignoring it.
*/
}
/* BODY tags have global effect, so they can't be pruned */
virtual int can_prune_tag() const { return FALSE; }
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagBODY, "BODY");
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
private:
/* URL for background image */
class CHtmlUrl background_;
/* the image cache object for the background image */
class CHtmlResCacheObject *bg_image_;
/* background color - ignored if use_bgcolor_ is false */
int use_bgcolor_ : 1;
HTML_color_t bgcolor_;
/* text color - ignored if use_textcolor_ is false */
int use_textcolor_ : 1;
HTML_color_t textcolor_;
/* input text color - ignored if use_inputcolor_ is false */
int use_inputcolor_ : 1;
HTML_color_t inputcolor_;
/*
* link, vlink, alink, and hlink colors - the colors are ignored if the
* corresponding use_xxx_'s are false
*/
int use_link_color_ : 1;
HTML_color_t link_color_;
int use_alink_color_ : 1;
HTML_color_t alink_color_;
int use_vlink_color_ : 1;
HTML_color_t vlink_color_;
int use_hlink_color_ : 1;
HTML_color_t hlink_color_;
};
/* ------------------------------------------------------------------------ */
/*
* TITLE tag
*/
class CHtmlTagTITLE: public CHtmlTagContainer
{
public:
HTML_TAG_MAP(CHtmlTagTITLE, "TITLE");
/* TITLE tags can't be pruned due to global effects */
virtual int can_prune_tag() const { return FALSE; }
/*
* prune the contents - we can always delete the contents of a
* TITLE, even though we can't delete the TITLE itself
*/
virtual void try_prune_contents(class CHtmlTextArray *txtarr);
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
virtual void format_exit(class CHtmlFormatter *formatter);
/*
* set my title text - the formatter calls this when we close our
* tag to inform us of the text of the title
*/
void set_title_text(const textchar_t *txt)
{
/*
* Record the title only if it's non-empty. If the caller is
* attempting to set an empty title string, it's probably
* because we've been pruned; in this case, keep our original
* title string. Note that, in the case we actually have an
* empty title string, this will be harmless, because we'll
* never record a non-empty string internally in the first place
* in this case.
*/
if (txt != 0 && get_strlen(txt) != 0)
title_.set(txt);
}
private:
/* the text of our title */
CStringBuf title_;
};
/* ------------------------------------------------------------------------ */
/*
* Block-level container tag. The block-level tags all have some common
* attributes, such as CLEAR and NOWRAP.
*/
class CHtmlTagBlock: public CHtmlTagContainer
{
public:
CHtmlTagBlock()
{
/* set default attributes */
clear_ = HTML_Attrib_invalid;
nowrap_ = FALSE;
}
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
void format_exit(class CHtmlFormatter *formatter);
protected:
/* CLEAR setting - LEFT, RIGHT, or ALL, if anything is set */
HTML_Attrib_id_t clear_;
/* NOWRAP specified */
int nowrap_ : 1;
/* old line wrap setting */
int old_wrap_ : 1;
};
/* ------------------------------------------------------------------------ */
/*
* Paragraph tag. The paragraph tag is not a container, but simply a
* marker in the text stream.
*/
class CHtmlTagP: public CHtmlTag
{
public:
CHtmlTagP(CHtmlParser *prs) { init(TRUE, prs); }
CHtmlTagP(int isexplicit, CHtmlParser *prs) { init(isexplicit, prs); }
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagP, "P");
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
void on_parse(class CHtmlParser *parser);
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
/* process the end tag */
static void process_end_tag(class CHtmlParser *parser,
const textchar_t *, size_t);
private:
/* initialize */
void init(int isexplicit, CHtmlParser *prs);
/* alignment setting */
HTML_Attrib_id_t align_;
/*
* flag indicating whether this paragraph break was inserted by an
* explicit <P> tag in the source text, or implicitly by another tag
* that causes a paragraph to end
*/
int explicit_ : 1;
/* NOWRAP setting - if true, we won't wrap within the paragraph */
int nowrap_ : 1;
/* CLEAR setting - LEFT, RIGHT, or ALL, if anything is set */
HTML_Attrib_id_t clear_;
};
/* ------------------------------------------------------------------------ */
/*
* Special internal hilite-on and hilite-off tags. These are
* non-container font attribute tags; they act essentially like <B> and
* </B>, but are simply in-line tags that don't contain any other tags:
* they establish the new font settings until the next similar tag.
*/
class CHtmlTagHILITE: public CHtmlTag
{
public:
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
protected:
/*
* set my font attribute in the given font descriptor; returns true if
* anything changed about the font
*/
virtual int set_attr(class CHtmlFontDesc *desc) = 0;
};
class CHtmlTagHILITEON: public CHtmlTagHILITE
{
public:
HTML_TAG_MAP(CHtmlTagHILITEON, "HILITEON");
protected:
virtual int set_attr(class CHtmlFontDesc *desc);
};
class CHtmlTagHILITEOFF: public CHtmlTagHILITE
{
public:
HTML_TAG_MAP(CHtmlTagHILITEOFF, "HILITEOFF");
protected:
virtual int set_attr(class CHtmlFontDesc *desc);
};
/* ------------------------------------------------------------------------ */
/*
* Division tags
*/
/*
* basic DIV-style tag - shared by DIV and CENTER
*/
class CHtmlTagDIV_base: public CHtmlTagBlock
{
public:
/* do a paragraph break on opening and closing a heading */
void on_parse(CHtmlParser *parser);
void on_close(CHtmlParser *parser);
/* do general DIV-style formatting with a given alignment type */
void div_format(class CHtmlFormatter *formatter,
HTML_Attrib_id_t alignment);
/* leave the division - restore old alignment settings */
void format_exit(class CHtmlFormatter *formatter);
private:
/* alignment in effect immediately before this division started */
HTML_Attrib_id_t old_align_;
};
/*
* DIV
*/
class CHtmlTagDIV: public CHtmlTagDIV_base
{
public:
CHtmlTagDIV(CHtmlParser *)
{
align_ = HTML_Attrib_invalid;
start_txtofs_ = 0;
end_txtofs_ = 0;
hover_link_ = FALSE;
use_hover_fg_ = use_hover_bg_ = hover_underline_ = FALSE;
}
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagDIV, "DIV");
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
void on_parse(CHtmlParser *parser);
void on_close(CHtmlParser *parser);
void post_close(class CHtmlParser *parser);
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
void format_exit(class CHtmlFormatter *formatter);
void prune_pre_delete(class CHtmlTextArray *arr);
private:
/* alignment setting */
HTML_Attrib_id_t align_;
/* range of text offsets that this DIV covers */
unsigned long start_txtofs_;
unsigned long end_txtofs_;
/* is there a HOVER=LINK attribute? */
int hover_link_ : 1;
/* HOVER=LINK(fgcolor,bgcolor,decoration) values */
HTML_color_t hover_fg_;
HTML_color_t hover_bg_;
int use_hover_fg_ : 1;
int use_hover_bg_ : 1;
int hover_underline_ : 1;
};
/*
* CENTER
*/
class CHtmlTagCENTER: public CHtmlTagDIV_base
{
public:
HTML_TAG_MAP(CHtmlTagCENTER, "CENTER");
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter)
{
/* do division formatting with center alignment */
div_format(formatter, HTML_Attrib_center);
/* inherit default */
CHtmlTagDIV_base::format(win, formatter);
}
};
/* ------------------------------------------------------------------------ */
/*
* Font container add-in. This class can be multiply inherited by a
* tag class to provide font container attributes. Each final subclass
* that inherits this must implement add_attrs() to add the appropriate
* attributes for the font.
*/
class CHtmlFontContAddin
{
public:
virtual ~CHtmlFontContAddin() {}
protected:
void fontcont_init() { old_font_ = 0; }
/*
* Do font formatting entry and exit. The subclass's format() and
* format_exit() routines, respectively, should call these in the
* course of its processing.
*/
void fontcont_format(class CHtmlSysWin *win,
class CHtmlFormatter *formatter);
void fontcont_format_exit(class CHtmlFormatter *formatter);
/*
* Add my attributes to a font description. Returns true if the
* description was changed, false if not.
*/
virtual int add_attrs(class CHtmlFormatter *,
class CHtmlFontDesc *) = 0;
/* font in effect before we added our attributes */
class CHtmlSysFont *old_font_;
};
/* ------------------------------------------------------------------------ */
class CHtmlTagADDRESS: public CHtmlTagBlock, public CHtmlFontContAddin
{
public:
CHtmlTagADDRESS(class CHtmlParser *) { fontcont_init(); }
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagADDRESS, "ADDRESS");
/* address tags are not allowed in lists */
int allowed_in_list() const { return FALSE; }
/* do a paragraph break on opening and closing a heading */
void on_parse(CHtmlParser *parser);
void on_close(CHtmlParser *parser);
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter)
{ fontcont_format(win, formatter); }
void format_exit(class CHtmlFormatter *formatter)
{ fontcont_format_exit(formatter); }
/* add font attributes */
int add_attrs(class CHtmlFormatter *fmt,
class CHtmlFontDesc *desc);
};
class CHtmlTagBLOCKQUOTE: public CHtmlTagBlock
{
public:
HTML_TAG_MAP(CHtmlTagBLOCKQUOTE, "BLOCKQUOTE");
int allowed_in_list() const { return FALSE; }
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
void format_exit(class CHtmlFormatter *formatter);
private:
/* spacing before and after quoted area - calculated in format() */
int break_ht_;
};
/*
* BQ - HTML 3.0 synonym for BLOCKQUOTE
*/
class CHtmlTagBQ: public CHtmlTagBLOCKQUOTE
{
public:
CHtmlTagBQ(class CHtmlParser *prs) : CHtmlTagBLOCKQUOTE(prs) { }
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagBQ, "BQ");
};
/* ------------------------------------------------------------------------ */
/*
* Basic heading tag class
*/
class CHtmlTagHeading: public CHtmlTagBlock, public CHtmlFontContAddin
{
public:
CHtmlTagHeading()
{
fontcont_init();
align_ = HTML_Attrib_invalid;
}
/* heading tags are not allowed in lists */
int allowed_in_list() const { return FALSE; }
/* do a paragraph break on opening and closing a heading */
void on_parse(CHtmlParser *parser);
void on_close(CHtmlParser *parser);
/* parse attributes */
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
/* format and exit formatting for these fonts */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
void format_exit(class CHtmlFormatter *formatter);
/* add font attributes */
int add_attrs(class CHtmlFormatter *fmt,
class CHtmlFontDesc *desc);
/*
* Get my heading size. All of the heading types behave the same
* way, except that they each have a distinctive size. This routine
* must be overridden by each heading subclass to return the
* appropriate HTML size (1-7) for the heading.
*/
virtual int get_heading_fontsize() = 0;
private:
/*
* size of vertical whitespace around heading - set during
* format(), used again during format_exit()
*/
int break_ht_;
/* alignment */
HTML_Attrib_id_t align_;
};
class CHtmlTagH1: public CHtmlTagHeading
{
public:
HTML_TAG_MAP(CHtmlTagH1, "H1");
int get_heading_fontsize() { return 6; }
};
class CHtmlTagH2: public CHtmlTagHeading
{
public:
HTML_TAG_MAP(CHtmlTagH2, "H2");
int get_heading_fontsize() { return 5; }
};
class CHtmlTagH3: public CHtmlTagHeading
{
public:
HTML_TAG_MAP(CHtmlTagH3, "H3");
int get_heading_fontsize() { return 4; }
};
class CHtmlTagH4: public CHtmlTagHeading
{
public:
HTML_TAG_MAP(CHtmlTagH4, "H4");
int get_heading_fontsize() { return 3; }
};
class CHtmlTagH5: public CHtmlTagHeading
{
public:
HTML_TAG_MAP(CHtmlTagH5, "H5");
int get_heading_fontsize() { return 2; }
};
class CHtmlTagH6: public CHtmlTagHeading
{
public:
HTML_TAG_MAP(CHtmlTagH6, "H6");
int get_heading_fontsize() { return 1; }
};
/* ------------------------------------------------------------------------ */
/*
* Preformatted text tags. All of these tags cause entry into verbatim
* mode, in which whitespace and line breaks in the source text are
* obeyed.
*/
class CHtmlTagVerbatim: public CHtmlTagContainer, public CHtmlFontContAddin
{
public:
CHtmlTagVerbatim() { fontcont_init(); }
void on_parse(CHtmlParser *parser);
void on_close(CHtmlParser *parser);
/* do we translate tags within this type of preformatted block? */
virtual int translate_tags() const = 0;
/* format and exit formatting for these fonts */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
void format_exit(class CHtmlFormatter *formatter);
/* add font attributes */
virtual int add_attrs(class CHtmlFormatter *fmt,
class CHtmlFontDesc *desc);
/* get the font size decrement for this listing type */
virtual int get_font_size_decrement() const { return 1; }
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
private:
/*
* size of vertical whitespace above and below - calculated during
* format(), and used again during format_exit()
*/
int break_ht_;
/*
* WIDTH attribute setting; we ignore this, but read it anyway, for
* compatibility with other renderers and in case we might want to
* use it in the future
*/
long width_;
};
class CHtmlTagPRE: public CHtmlTagVerbatim
{
public:
HTML_TAG_MAP(CHtmlTagPRE, "PRE");
/* we do translate tags within PRE blocks */
int translate_tags() const { return TRUE; }
};
class CHtmlTagLISTING: public CHtmlTagVerbatim
{
public:
HTML_TAG_MAP(CHtmlTagLISTING, "LISTING");
/* we do not translate tags within LISTING blocks */
int translate_tags() const { return FALSE; }
/* use a smaller font size than the default listing font */
int get_font_size_decrement() const { return 2; }
};
class CHtmlTagXMP: public CHtmlTagVerbatim
{
public:
HTML_TAG_MAP(CHtmlTagXMP, "XMP");
/* we do not translate tags within XMP blocks */
int translate_tags() const { return FALSE; }
};
/* ------------------------------------------------------------------------ */
/*
* List elements
*/
class CHtmlTagListContainer: public CHtmlTagBlock, public CHtmlFontContAddin
{
public:
CHtmlTagListContainer()
{
compact_ = FALSE;
list_level_ = 0;
list_started_ = FALSE;
fontcont_init();
}
/* I'm a list container */
CHtmlTagListContainer *get_list_container() { return this; }
/* return the name of the list item tag making up this list */
virtual const textchar_t *get_list_tag_name() const { return "LI"; }
/* pre-close the tag - close any open list item before closing the list */
void pre_close(CHtmlParser *parser);
/* certain tags are not allowed within lists */
int allow_tag(CHtmlTag *tag) const { return tag->allowed_in_list(); }
/* get my list nesting level */
int get_list_nesting_level() const { return list_level_; }
/*
* determine if the list is indented overall; by default, lists are
* indented overall, but some list subtypes (such as definition
* lists) indent some items but not the overall list
*/
virtual int is_list_indented() const { return TRUE; }
/* get the amount to indent the list */
virtual long get_left_indent(class CHtmlSysWin *win,
class CHtmlFormatter *formatter) const;
/* set the bullet for an item */
virtual void set_item_bullet(class CHtmlTagLI *,
class CHtmlFormatter *) { }
/* add the display item for the bullet for a list item */
virtual void add_bullet_disp(class CHtmlSysWin *, class CHtmlFormatter *,
class CHtmlTagLI *, long /*bullet_width*/)
{ }
/* parse the list tag */
void on_parse(CHtmlParser *parser);
/* parse an attribute */
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
/* format the tag */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
void format_exit(class CHtmlFormatter *formatter);
/*
* begin a list item - each list item should call this before
* formatting itself
*/
void begin_list_item(class CHtmlSysWin *win,
class CHtmlFormatter *formatter);
/* add font container attributes */
int add_attrs(class CHtmlFormatter *, class CHtmlFontDesc *);
private:
/* list nesting level */
int list_level_;
/* compact flag */
int compact_ : 1;
/* line spacing - set in format(), used in format_exit() */
int break_ht_;
/* flag: first list item encountered */
int list_started_ : 1;
};
class CHtmlTagUL: public CHtmlTagListContainer
{
public:
CHtmlTagUL(class CHtmlParser *)
{
/* use default bullet type */
type_ = HTML_Attrib_invalid;
}
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagUL, "UL");
/* set the bullet for an item */
void set_item_bullet(class CHtmlTagLI *item,
class CHtmlFormatter *formatter);
/* add the bullet display item */
void add_bullet_disp(class CHtmlSysWin *win,
class CHtmlFormatter *formatter,
class CHtmlTagLI *item, long bullet_width);
/* parse an attribute */
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
/* format the item */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
private:
/* type of bullet to use - disc, square, circle */
HTML_Attrib_id_t type_;
/* source for bullet when given as an image */
CHtmlUrl src_;
};
class CHtmlTagOL: public CHtmlTagListContainer
{
public:
CHtmlTagOL(class CHtmlParser *)
{
/* use default bullet type */
style_ = '\0';
/* start at number 1 unless otherwise specified */
start_ = 1;
/*
* presume we'll start a new list, rather than continue
* numbering from previous ordered list
*/
continue_ = FALSE;
}
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagOL, "OL");
/* set the bullet for an item */
void set_item_bullet(class CHtmlTagLI *item,
class CHtmlFormatter *formatter);
/* add the bullet display item */
void add_bullet_disp(class CHtmlSysWin *win,
class CHtmlFormatter *formatter,
class CHtmlTagLI *item, long bullet_width);
/* parse an attribute */
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
/* format the item */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
/* get the amount to indent the list */
virtual long get_left_indent(class CHtmlSysWin *win,
class CHtmlFormatter *formatter) const;
private:
/* style specifier - '1', 'a', 'A', 'i', 'I' */
textchar_t style_;
/* starting number */
long start_;
/* current value */
long cur_value_;
/* flag: continue numbering from end of previous list */
int continue_ : 1;
};
class CHtmlTagDL: public CHtmlTagListContainer
{
public:
HTML_TAG_MAP(CHtmlTagDL, "DL");
/* definition lists are made up of DD items */
const textchar_t *get_list_tag_name() const { return "DD"; }
/* do not indent the overall list for a definition list */
int is_list_indented() const { return FALSE; }
};
/*
* DIR - treat this as a synonym for UL
*/
class CHtmlTagDIR: public CHtmlTagUL
{
public:
CHtmlTagDIR(class CHtmlParser *parser) : CHtmlTagUL(parser) { }
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagDIR, "DIR");
};
/*
* MENU - treat this as a synonym for UL
*/
class CHtmlTagMENU: public CHtmlTagUL
{
public:
CHtmlTagMENU(class CHtmlParser *parser) : CHtmlTagUL(parser) { }
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagMENU, "MENU");
};
class CHtmlTagLH: public CHtmlTagContainer
{
public:
HTML_TAG_MAP(CHtmlTagLH, "LH");
};
class CHtmlTagLI: public CHtmlTagContainer
{
public:
CHtmlTagLI(class CHtmlParser *)
{
/* no value has been set yet, so use the default */
value_set_ = FALSE;
/* presume we'll inherit bullet type from the list */
type_ = HTML_Attrib_invalid;
/* presume we'll inherit numbering style from the list */
style_ = '\0';
/* no image yet */
image_ = 0;
}
~CHtmlTagLI();
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagLI, "LI");
/* parse the item */
void on_parse(CHtmlParser *parser);
/* parse an attribute */
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
/* format the item */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
/*
* set the default bullet - if a bullet has already been specified,
* leave the specified bullet as it was
*/
void set_default_bullet(HTML_Attrib_id_t type,
const CHtmlUrl *url)
{
/* if we don't have a type set, use the default type for the list */
if (type_ == HTML_Attrib_invalid)
type_ = type;
/* if we don't have a source image, use the default for the list */
if (src_.get_url() == 0 && url != 0 && url->get_url() != 0)
src_.set_url(url);
}
/*
* set the default value - if a value has already been specified,
* leave the value as it was
*/
void set_default_value(long value)
{
if (!value_set_)
{
value_ = value;
value_set_ = TRUE;
}
}
/* set the default number display style */
void set_default_number_style(textchar_t style)
{
if (style_ == '\0')
style_ = style;
}
/*
* add a numeric list header display item, using my current value
* and display style
*/
void add_listhdr_number(class CHtmlSysWin *win,
class CHtmlFormatter *formatter,
long bullet_width);
/*
* add a bullet list header display item, using the bullet type
* previously established for this item
*/
void add_listhdr_bullet(class CHtmlSysWin *win,
class CHtmlFormatter *formatter,
long bullet_width);
/* get my value */
long get_value() const { return value_; }
private:
/* current list item value, and flag indicating it's been set */
long value_;
int value_set_ : 1;
/* list item style */
textchar_t style_;
/* bullet type, if specified */
HTML_Attrib_id_t type_;
/* source for image for use as bullet */
CHtmlUrl src_;
/* image cache object for bullet image */
class CHtmlResCacheObject *image_;
};
class CHtmlTagDT: public CHtmlTagContainer
{
public:
HTML_TAG_MAP(CHtmlTagDT, "DT");
/* parse this item */
void on_parse(CHtmlParser *parser);
/* format it */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
};
class CHtmlTagDD: public CHtmlTagContainer
{
public:
HTML_TAG_MAP(CHtmlTagDD, "DD");
/* parse this item */
void on_parse(CHtmlParser *parser);
/* format it */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
void format_exit(class CHtmlFormatter *formatter);
};
/* ------------------------------------------------------------------------ */
/*
* phrase markup
*/
/* ------------------------------------------------------------------------ */
/*
* Font containers. These items all set a font attribute on entry, and
* remove the font attribute on exit.
*/
class CHtmlTagFontCont: public CHtmlTagContainer, public CHtmlFontContAddin
{
public:
CHtmlTagFontCont() { fontcont_init(); }
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter)
{ fontcont_format(win, formatter); }
void format_exit(class CHtmlFormatter *formatter)
{ fontcont_format_exit(formatter); }
};
/*
* Character set tag - this is a special font tag that the parser
* generates when it needs to switch to a new character set. This
* otherwise leaves the font unchanged.
*/
class CHtmlTagCharset: public CHtmlTagFontCont
{
public:
CHtmlTagCharset(oshtml_charset_id_t charset)
{
charset_ = charset;
}
const textchar_t *get_tag_name() const { return "<!-- Charset -->"; }
/* add font attributes */
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
private:
/* character set identifier */
oshtml_charset_id_t charset_;
};
/*
* CREDIT - HTML 3.0
*/
class CHtmlTagCREDIT: public CHtmlTagFontCont
{
public:
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagCREDIT, "CREDIT");
/* delete my text when pruning the tree */
void prune_pre_delete(class CHtmlTextArray *arr);
CHtmlTagCREDIT(class CHtmlParser *parser);
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
/* add font attributes */
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
private:
unsigned long txtofs_;
};
class CHtmlTagCITE: public CHtmlTagFontCont
{
public:
HTML_TAG_MAP(CHtmlTagCITE, "CITE");
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
};
class CHtmlTagCODE: public CHtmlTagFontCont
{
public:
HTML_TAG_MAP(CHtmlTagCODE, "CODE");
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
};
class CHtmlTagEM: public CHtmlTagFontCont
{
public:
HTML_TAG_MAP(CHtmlTagEM, "EM");
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
};
class CHtmlTagKBD: public CHtmlTagFontCont
{
public:
HTML_TAG_MAP(CHtmlTagKBD, "KBD");
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
};
class CHtmlTagSAMP: public CHtmlTagFontCont
{
public:
HTML_TAG_MAP(CHtmlTagSAMP, "SAMP");
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
};
class CHtmlTagSTRONG: public CHtmlTagFontCont
{
public:
HTML_TAG_MAP(CHtmlTagSTRONG, "STRONG");
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
};
class CHtmlTagBIG: public CHtmlTagFontCont
{
public:
HTML_TAG_MAP(CHtmlTagBIG, "BIG");
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
};
class CHtmlTagSMALL: public CHtmlTagFontCont
{
public:
HTML_TAG_MAP(CHtmlTagSMALL, "SMALL");
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
};
class CHtmlTagDFN: public CHtmlTagFontCont
{
public:
HTML_TAG_MAP(CHtmlTagDFN, "DFN");
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
};
class CHtmlTagVAR: public CHtmlTagFontCont
{
public:
HTML_TAG_MAP(CHtmlTagVAR, "VAR");
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
};
class CHtmlTagB: public CHtmlTagFontCont
{
public:
HTML_TAG_MAP(CHtmlTagB, "B");
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
};
class CHtmlTagI: public CHtmlTagFontCont
{
public:
HTML_TAG_MAP(CHtmlTagI, "I");
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
};
class CHtmlTagU: public CHtmlTagFontCont
{
public:
HTML_TAG_MAP(CHtmlTagU, "U");
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
};
class CHtmlTagSTRIKE: public CHtmlTagFontCont
{
public:
HTML_TAG_MAP(CHtmlTagSTRIKE, "STRIKE");
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
};
/* S is synonymous with STRIKE */
class CHtmlTagS: public CHtmlTagSTRIKE
{
public:
CHtmlTagS(CHtmlParser *prs) : CHtmlTagSTRIKE(prs) { }
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagS, "S");
};
class CHtmlTagTT: public CHtmlTagFontCont
{
public:
HTML_TAG_MAP(CHtmlTagTT, "TT");
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
};
/*
* SUP - superscript - subclass this from SMALL, since we'll use the
* same font as with SMALL, but set it a little differently
*/
class CHtmlTagSUP: public CHtmlTagSMALL
{
public:
CHtmlTagSUP(class CHtmlParser *parser) : CHtmlTagSMALL(parser) { }
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagSUP, "SUP");
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
};
/*
* SUB - subscript - subclass this from SMALL
*/
class CHtmlTagSUB: public CHtmlTagSMALL
{
public:
CHtmlTagSUB(class CHtmlParser *parser) : CHtmlTagSMALL(parser) { }
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagSUB, "SUB");
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
};
/*
* FONT tag
*/
class CHtmlTagFONT: public CHtmlTagFontCont
{
public:
CHtmlTagFONT(class CHtmlParser *)
{
/* by default, leave the size alone */
relative_ = '+';
size_ = 0;
/* by default, do not change the color */
use_color_ = FALSE;
use_bgcolor_ = FALSE;
}
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagFONT, "FONT");
/* parse an attribute */
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
/* add my font attributes to a font descriptor */
int add_attrs(class CHtmlFormatter *fmt, class CHtmlFontDesc *desc);
private:
/* font size */
long size_;
/*
* relative setting - if this is zero, the size is absolute; if
* it's '+', the size is a positive relative setting; if it's '-',
* the size is a negative relative setting
*/
textchar_t relative_;
/* face name list */
CStringBuf face_;
/* color - if use_color_ is false, color_ is ignored */
int use_color_ : 1;
HTML_color_t color_;
/* background color */
int use_bgcolor_ : 1;
HTML_color_t bgcolor_;
};
/* ------------------------------------------------------------------------ */
/*
* Explicit font tag.
*/
class CHtmlTagFontExplicit: public CHtmlTagContainer
{
public:
CHtmlTagFontExplicit(const class CHtmlFontDesc *font)
{
font_ = *font;
}
const textchar_t *get_tag_name() const
{ return "<!-- Explicit Font -->"; }
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
void format_exit(class CHtmlFormatter *formatter);
protected:
/* our font */
class CHtmlFontDesc font_;
/* original font in effect in enclosing scope */
class CHtmlSysFont *old_font_;
};
/* ------------------------------------------------------------------------ */
/*
* NOBR - non-breaking text. This encloses a run of pre-formatted text
* where no automatic line breaking is allowed.
*/
class CHtmlTagNOBR: public CHtmlTagContainer
{
public:
HTML_TAG_MAP(CHtmlTagNOBR, "NOBR");
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
void format_exit(class CHtmlFormatter *formatter);
private:
/* the enclosing break/nobreak status */
int old_wrap_;
};
/* ------------------------------------------------------------------------ */
/*
* WRAP - control the text-wrapping mode. This is an in-line
* non-container tag that lets the document switch between word-wrapping
* mode and character-wrapping mode. In word-wrapping mode, we break
* lines only at defined word boundaries (at spaces, after hyphens, at
* soft hyphens). In character-wrapping mode, we can break lines anywhere
* except at explicit non-breaking boundaries (as marked by the zero-width
* non-breaking space character, \uFEFF).
*/
class CHtmlTagWRAP: public CHtmlTag
{
public:
CHtmlTagWRAP(CHtmlParser *)
{
/* assume word-wrap mode */
char_wrap_mode_ = FALSE;
}
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagWRAP, "WRAP");
/* parse an attribute */
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
/* format this tag */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
private:
/* our wrapping mode */
int char_wrap_mode_;
};
/* ------------------------------------------------------------------------ */
/*
* NOLOG - text hidden from log files. This encloses a run of text that we
* want displayed but not copied to any transcript file. Since we handle
* only regular display streams, this tag has no effect; we simply parse it
* and otherwise ignore it.
*/
class CHtmlTagNOLOG: public CHtmlTagContainer
{
public:
HTML_TAG_MAP(CHtmlTagNOLOG, "NOLOG");
};
/*
* LOG - text hidden *except* in log files. This encloses a run of text
* that we want displayed only in a transcript file, not in the UI. Since
* we handle only regular display streams, this tag effectively hides its
* contents; we simply parse it, but skip its contents during formatting.
*/
class CHtmlTagLOG: public CHtmlTagContainer
{
public:
HTML_TAG_MAP(CHtmlTagLOG, "LOG");
/*
* get the next tag in format order - since we hide our contents, this
* is simply the next tag after us, not our first child
*/
virtual CHtmlTag *get_next_fmt_tag(class CHtmlFormatter *formatter)
{
return CHtmlTag::get_next_fmt_tag(formatter);
}
};
/* ------------------------------------------------------------------------ */
/*
* TAB markup
*/
class CHtmlTagTAB: public CHtmlTag
{
public:
CHtmlTagTAB(CHtmlParser *);
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagTAB, "TAB");
/* delete my text on deleting the tag */
void prune_pre_delete(class CHtmlTextArray *arr);
/* parse the tag */
void on_parse(class CHtmlParser *parser);
/* parse an attribute */
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
/* set the MULTIPLE attribute to the specified value */
void set_multiple_val(int val)
{
indent_ = val;
use_multiple_ = TRUE;
}
/* format the tab */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
/* name of the tab */
CStringBuf id_;
/* true -> define my ID */
int define_ : 1;
/* true -> tab to my ID */
int to_ : 1;
/* alignment */
HTML_Attrib_id_t align_;
/* alignment character (decimal point) */
textchar_t dp_;
/*
* indent amount, and flag specifying if it's to be used as direct
* spacing (use_indent_) or indentation to a multiple of a given tab
* size (use_multiple_)
*/
long indent_;
int use_indent_ : 1;
int use_multiple_ : 1;
/* text offset of our space character */
unsigned long txtofs_;
};
/* ------------------------------------------------------------------------ */
class CHtmlTagA: public CHtmlTagContainer, public CHtmlFontContAddin
{
public:
CHtmlTagA(class CHtmlParser *prs)
{
fontcont_init();
/* presume we'll render with the normal link style */
style_ = LINK_STYLE_NORMAL;
noenter_ = FALSE;
append_ = FALSE;
use_hover_fg_ = use_hover_bg_ = FALSE;
hover_underline_ = FALSE;
}
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagA, "A");
/* don't allow <A> tags to be nested */
int allow_tag(CHtmlTag *tag) const
{
/* allow anything but a nested <A> */
return !tag->tag_name_matches("A", 1);
}
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
void format_exit(class CHtmlFormatter *formatter);
/* add font-cont attributes */
virtual int add_attrs(class CHtmlFormatter *,
class CHtmlFontDesc *);
private:
/* link information */
CHtmlUrl href_;
CStringBuf title_;
/* HOVER foreground and background colors */
HTML_color_t hover_fg_;
HTML_color_t hover_bg_;
/* link style (LINK_STYLE_xxx) */
unsigned int style_ : 2;
/* true -> do not automatically enter the command */
int noenter_ : 1;
/*
* true -> append the href to any existing command line, rather than
* clearing the previous command
*/
int append_ : 1;
/* true -> use hover foreground/background colors */
int use_hover_fg_ : 1;
int use_hover_bg_ : 1;
/*
* Hover decoration: true->underline, false->none. Note that this
* specifies an *added* decoration - so if this is true, we add an
* underline, but if it's false, we don't remove an underline if we'd
* otherwise use one.
*/
int hover_underline_ : 1;
};
class CHtmlTagQ: public CHtmlTagContainer
{
public:
HTML_TAG_MAP(CHtmlTagQ, "Q");
/* delete my quote text when pruning the tree */
void prune_pre_delete(class CHtmlTextArray *arr);
void on_parse(class CHtmlParser *parser);
void on_close(class CHtmlParser *parser);
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
void format_exit(class CHtmlFormatter *formatter);
/* I'm a quote container */
CHtmlTagQ *get_quote_container() { return this; }
/* get my quote nesting level */
int get_quote_nesting_level()
{
CHtmlTagQ *qcont;
/* get my enclosing quote container */
qcont = (get_container() == 0
? 0 : get_container()->get_quote_container());
/* I'm one level deeper than it is */
return (qcont == 0 ? 0 : qcont->get_quote_nesting_level() + 1);
}
private:
/* offset in text array of open and close quotes */
unsigned long open_ofs_;
unsigned long close_ofs_;
/* strings to use for open and close quotes */
textchar_t open_q_[8];
size_t open_q_len_;
textchar_t close_q_[8];
size_t close_q_len_;
};
class CHtmlTagBR: public CHtmlTag
{
public:
CHtmlTagBR(class CHtmlParser *prs);
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagBR, "BR");
void on_parse(class CHtmlParser *parser);
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
private:
/* CLEAR setting - LEFT, RIGHT, or ALL, if anything is set */
HTML_Attrib_id_t clear_;
/* height of the break */
long height_;
};
class CHtmlTagHR: public CHtmlTag
{
public:
CHtmlTagHR(class CHtmlParser *)
{
align_ = HTML_Attrib_center;
shade_ = TRUE;
size_ = 0;
width_ = 100;
width_pct_ = TRUE;
image_ = 0;
}
~CHtmlTagHR();
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagHR, "HR");
void on_parse(CHtmlParser *parser);
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
private:
/* alignment */
HTML_Attrib_id_t align_;
/* shading on or off */
int shade_ : 1;
/* vertical size in pixels */
long size_;
/* width as a percentage or as a pixel size (depending on width_pct_) */
long width_;
/* flag: true -> width is given as a percentage; false -> pixel size */
int width_pct_;
/* image source, if an image is used */
CHtmlUrl src_;
/* the image cache object */
class CHtmlResCacheObject *image_;
};
/* ------------------------------------------------------------------------ */
/*
* IMAGE tag
*/
class CHtmlTagIMG: public CHtmlTag
{
public:
CHtmlTagIMG(class CHtmlParser *)
{
/* initialize all attributes to default values */
image_ = 0;
h_image_ = 0;
a_image_ = 0;
border_ = 1;
ismap_ = FALSE;
align_ = HTML_Attrib_middle;
width_ = height_ = 0;
width_set_ = height_set_ = FALSE;
hspace_ = vspace_ = 0;
alt_txtofs_ = 0;
}
~CHtmlTagIMG();
/* on pruning the tree, delete my ALT text */
void prune_pre_delete(class CHtmlTextArray *arr);
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagIMG, "IMG");
/* parse attributes */
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
/* format the image */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
private:
/* load one of our image resources */
void load_image(class CHtmlSysWin *win, class CHtmlFormatter *formatter,
class CHtmlResCacheObject **image,
const CHtmlUrl *url, const char *attr_name,
int mandatory);
/* the image cache object for the main image */
class CHtmlResCacheObject *image_;
/* for hyperlinked images, the hover/active images */
class CHtmlResCacheObject *h_image_;
class CHtmlResCacheObject *a_image_;
/* image source */
CHtmlUrl src_;
/* for hyperlinked images, the hover/active sources */
CHtmlUrl asrc_;
CHtmlUrl hsrc_;
/* alternate textual description */
CStringBuf alt_;
/* text offset of alt_ text */
unsigned long alt_txtofs_;
/* border size */
long border_;
/* horizontal/vertical whitespace settings */
long hspace_;
long vspace_;
/* width and height settings */
long width_;
long height_;
/* flags indicating whether width and height were explicitly set */
int width_set_ : 1;
int height_set_ : 1;
/* map setting */
CHtmlUrl usemap_;
/* ISMAP setting */
int ismap_ : 1;
/* alignment */
HTML_Attrib_id_t align_;
};
/* ------------------------------------------------------------------------ */
/*
* SOUND tag
*/
class CHtmlTagSOUND: public CHtmlTag
{
public:
CHtmlTagSOUND(class CHtmlParser *)
{
sound_ = 0;
layer_ = HTML_Attrib_invalid;
repeat_ = 1;
has_repeat_ = FALSE;
fadein_ = fadeout_ = 0.0;
crossfade_in_ = crossfade_out_ = FALSE;
vol_ = 100;
random_ = 0;
cancel_ = FALSE;
interrupt_ = FALSE;
sequence_ = HTML_Attrib_invalid;
obsolete_ = FALSE;
prv_sound_ = 0;
gen_id_ = 0;
}
~CHtmlTagSOUND();
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagSOUND, "SOUND");
/* don't allow pruning SOUND tags except when obsolete */
virtual int can_prune_tag() const { return obsolete_; }
/* parse attributes */
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
/* format the sound */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
/* get/set the sound generation ID */
unsigned int get_gen_id() const { return gen_id_; }
void set_gen_id(unsigned int gen_id) { gen_id_ = gen_id; }
/* get the fade parameters */
double get_fade_in() { return fadein_; }
int get_crossfade_in() { return crossfade_in_; }
double get_fade_out() { return fadeout_; }
int get_crossfade_out() { return crossfade_out_; }
/* get the base volume parameter */
int get_volume() { return (int)vol_; }
private:
/*
* Obsolete all previous sounds in the given layer (but not this
* sound itself). This is called for all sounds prior to a CANCEL
* tag in a given layer.
*/
void obsolete_prev_sounds(HTML_Attrib_id_t layer);
/* mark this sound as obsolete */
void make_obsolete();
/* the resource cache object */
class CHtmlResCacheObject *sound_;
/* source */
CHtmlUrl src_;
/* layer (foreground, bgambient, ambient, background) */
HTML_Attrib_id_t layer_;
/* alternate textual description */
CStringBuf alt_;
/* number of times to repeat -- zero indicates looping */
long repeat_;
/* flag indicating that REPEAT was specified */
int has_repeat_ : 1;
/* time in milliseconds to fade in/out */
double fadein_;
double fadeout_;
/* base volume, 0-100 (0 is silence, 100 is unattenuated) */
long vol_;
/*
* probability of starting at any given second; zero indicates that
* the RANDOM attribute is not present
*/
long random_;
/* cancellation - true means that we're cancelling sounds in a layer */
int cancel_ : 1;
/*
* interrupt - true means we start immediately, stopping any sound
* currently playing in the same layer
*/
int interrupt_ : 1;
/*
* Crossfades. These are true if we're doing a crossfade during
* fade-in or fade-out, respectively.
*/
int crossfade_in_ : 1;
int crossfade_out_ : 1;
/* sequence code (replace, random, cycle) */
HTML_Attrib_id_t sequence_;
/*
* Obsolete flag. Once a sound has been removed from its queue by a
* CANCEL, it's unnecessary to ever play that sound again, since
* there's a tag that follows that will cancel the sound. So, we'll
* set this flag whenever we cancel a sound from its queue, and
* we'll ignore any sounds in the playback stream that have this
* flag set.
*/
int obsolete_ : 1;
/*
* Previous sound tag in format list. We use this to keep a chain
* of the sound tags in reverse order. Each time we encounter a
* CANCEL tag, we can go back and obsolete all of the tags in the
* chain prior to the CANCEL tag, since they'll never need to be
* played again.
*/
CHtmlTagSOUND *prv_sound_;
/*
* Sound generation ID. Each time we play a sound, the formatter
* marks it with its current generation ID. If we've played a sound
* before on the current generation, it means that we're just
* reformatting the current page and should leave the current sounds
* playing, so we won't play the same sound again.
*/
unsigned int gen_id_;
};
/* ------------------------------------------------------------------------ */
/*
* MAP and subtags
*/
class CHtmlTagMAP: public CHtmlTagContainer
{
public:
HTML_TAG_MAP(CHtmlTagMAP, "MAP");
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
void format_exit(class CHtmlFormatter *formatter);
private:
CStringBuf name_;
};
class CHtmlTagAREA: public CHtmlTag
{
public:
CHtmlTagAREA(CHtmlParser *)
{
/* no shape yet */
shape_ = HTML_Attrib_invalid;
/* no coordinates yet */
coord_cnt_ = 0;
/* NOHREF not yet seen */
nohref_ = FALSE;
/* APPEND, NOENTER not yet seen */
append_ = FALSE;
noenter_ = FALSE;
}
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagAREA, "AREA");
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
private:
/* shape - rect, circle, poly */
HTML_Attrib_id_t shape_;
/*
* Coordinate list - interpretation depends on the type of shape,
* but we'll always store a flat list of coordinate values.
*/
CHtmlTagAREA_coords_t coords_[CHtmlTagAREA_max_coords];
/* number of coordinates in use */
size_t coord_cnt_;
/* href of this map setting */
CHtmlUrl href_;
/* flag indicating that NOHREF is specified */
int nohref_ : 1;
/* alternate name */
CStringBuf alt_;
/*
* APPEND attribute setting - appends the HREF to the command rather
* than clearing out the old command
*/
int append_ : 1;
/*
* NOENTER - allows the player to continue editing the command after
* adding our HREF
*/
int noenter_ : 1;
};
/* ------------------------------------------------------------------------ */
/*
* BASEFONT
*/
class CHtmlTagBASEFONT: public CHtmlTag
{
public:
CHtmlTagBASEFONT(class CHtmlParser *)
{
size_ = 3;
use_color_ = FALSE;
}
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagBASEFONT, "BASEFONT");
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
/* these tags have global effect, so don't prune them */
virtual int can_prune_tag() const { return FALSE; }
private:
/* SIZE setting */
long size_;
/* face name list */
CStringBuf face_;
/* color - if use_color_ is false, color_ is ignored */
int use_color_ : 1;
HTML_color_t color_;
};
/* ------------------------------------------------------------------------ */
/*
* BANNER tag
*/
class CHtmlTagBANNER: public CHtmlTagContainer
{
public:
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagBANNER, "BANNER");
CHtmlTagBANNER(class CHtmlParser *)
{
/* initialize attributes with defaults */
remove_ = FALSE;
removeall_ = FALSE;
height_set_ = width_set_ = FALSE;
height_pct_ = width_pct_ = FALSE;
height_prev_ = width_prev_ = FALSE;
border_ = FALSE;
alignment_ = HTML_BANNERWIN_POS_TOP;
obsolete_ = FALSE;
/* if ID isn't specified, use an empty name as the default banner */
id_.set("");
/* nothing in the banner sublist yet */
banner_first_ = 0;
}
~CHtmlTagBANNER();
/* pre-delete on pruning the tree */
void prune_pre_delete(class CHtmlTextArray *arr);
/* only allow pruning BANNER tags when they're obsolete */
virtual int can_prune_tag() const { return obsolete_; }
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
void on_parse(class CHtmlParser *parser);
void on_close(class CHtmlParser *parser);
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
void format_exit(class CHtmlFormatter *formatter);
/*
* We can't format a banner until it's finished. (However, note
* that a 'remove' element has no contents, so it's always ready to
* format.)
*/
virtual int ready_to_format() const { return remove_ || is_closed(); }
/*
* Get the first tag in the banner contents. During formatting of
* the banner, the banner's normal contents list is empty, so the
* contents of the banner must instead be obtained with this special
* call.
*/
class CHtmlTag *get_banner_contents() const { return banner_first_; }
/*
* Receive notification that the banner is now obsolete. The
* formatter will call this routine whenever it finds that a
* subsequent BANNER tag in the same format list uses the same
* banner -- when this happens, the banner involved will always be
* overwritten by the subsequent tag. We'll discard our contents
* and skip doing any work to format the banner on future passes
* through the format list.
*/
void notify_obsolete(class CHtmlTextArray *arr);
/*
* Special flag that identifies this tag as an about box rather than
* a regular banner. Since about boxes and banners work almost the
* same way, we share most of the code for the two classes, and use
* this flag to let the formatter know which is which.
*/
virtual int is_about_box() const { return FALSE; }
/*
* Determine if the banner has a border
*/
int has_border() const { return border_; }
/*
* Get the alignment setting
*/
HTML_BannerWin_Pos_t get_alignment() const { return alignment_; }
protected:
/* banner identifier */
CStringBuf id_;
/*
* Height - if not set, we'll use the height of the contents. If
* height_pct_ is set, it indicates that the height is a percentage
* of the overall window height.
*/
long height_;
int height_set_ : 1;
int height_pct_;
/* likewise with width */
long width_;
int width_set_ : 1;
int width_pct_;
/* flag: keep height/width of previous instance of this banner */
int height_prev_ : 1;
int width_prev_ : 1;
/* REMOVE flag - set when REMOVE attribute is present */
int remove_ : 1;
/* REMOVEALL flag - set when REMOVEALL attribute is present */
int removeall_ : 1;
/*
* obsolete flag - we'll set this immediately after we apply any
* REMOVE tag, because doing so will remove previous banners not
* only from the display but also from the formatting list, hence we
* only need to apply one of these a single time
*/
int obsolete_ : 1;
/* BORDER flag */
int border_ : 1;
/* alignment setting */
HTML_BannerWin_Pos_t alignment_;
/*
* banner contents -- we move the normal contents list into this
* special banner contents list when we're first formatted; this
* prevents the banner contents from being formatted into my own
* display list, but still lets us get at the sublist in the banner
* subformatter
*/
CHtmlTag *banner_first_;
};
/* ------------------------------------------------------------------------ */
/*
* The ABOUTBOX tag is a simple subclass of BANNER. It works almost the
* same as BANNER, but has a special flag to the formatter that lets the
* formatter know this is actually an about box.
*/
class CHtmlTagABOUTBOX: public CHtmlTagBANNER
{
public:
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagABOUTBOX, "ABOUTBOX");
CHtmlTagABOUTBOX(class CHtmlParser *parser)
: CHtmlTagBANNER(parser)
{
}
/* set an attribute - we suppress certain BANNER attributes */
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
/* this is the ABOUTBOX tag */
virtual int is_about_box() const { return TRUE; }
};
/* ------------------------------------------------------------------------ */
/*
* Tables
*/
/*
* Table column cell list entry
*/
class CHtmlTag_cell
{
public:
CHtmlTag_cell()
{
/* the cell is not yet occupied */
occupied_ = FALSE;
}
/* determine if the cell is occupied */
int is_occupied() const { return occupied_; }
/* mark the cell as occupied */
void set_occupied() { occupied_ = TRUE; }
private:
/* flag indicating whether the cell has been occupied yet */
int occupied_ : 1;
};
/*
* Table column list entry
*/
class CHtmlTag_column
{
public:
CHtmlTag_column();
~CHtmlTag_column();
/*
* Get the pointer to a cell at a given row (row numbers start at
* zero). If the cell isn't yet allocated, this automatically
* allocates the cell, so this routine always returns a valid cell
* pointer.
*/
CHtmlTag_cell *get_cell(size_t rownum);
/*
* Add a cell's widths to my measurements. This is used during pass
* 1 to determine the sizes needed for the column (and, in turn, for
* the enclosing table). The minimum width is the narrowest that we
* can make the column before we start clipping; in other words,
* it's the width of the largest single item that can't be broken
* across lines. The maximum width is the width of the longest
* line; this is the narrowest that we can make the table before we
* need to start wrapping lines. If either of the parameters to
* this function are greater than the respective values we've
* stored, we'll update the stored values with the new values.
*/
void add_cell_widths(long min_width, long max_width)
{
if (min_width > min_width_)
min_width_ = min_width;
if (max_width > max_width_)
max_width_ = max_width;
}
/*
* Add a cell's explicit pixel width to my measurements. We'll
* accumulate the minimum explicit pixel width that each column wants,
* and then apply this if it exceeds the width we'd otherwise choose
* for the column.
*/
void add_cell_pix_width(long pix_width)
{
if (pix_width > pix_width_)
pix_width_ = pix_width;
}
/*
* Add a cell's percentage-based width to my measurements. We'll
* accumulate the minimum percentage width that each column wants,
* and then apply this if it exceeds the width we'd otherwise choose
* for the column.
*/
void add_cell_pct_width(long pct_width)
{
if (pct_width > pct_width_)
pct_width_ = pct_width;
}
/* get the minimum and maximum sizes for the column */
long get_min_width() const { return min_width_; }
long get_max_width() const { return max_width_; }
/* get the percentage width for the column */
long get_pct_width() const { return pct_width_; }
/* get the explicitly set pixel width for the column */
long get_pix_width() const { return pix_width_; }
/*
* Set the final width of the column. This is called when the table
* is formatted during pass 2, after all of the contents have been
* measured.
*/
void set_width(long wid) { width_ = wid; }
/* get the final width of the column */
long get_width() const { return width_; }
/*
* Get/set the horizontal offset of the column. This is the offset
* from the left edge of the table, and is simply the offset of the
* previous column plus the width of the previous column.
*/
long get_x_offset() const { return x_offset_; }
void set_x_offset(long x_offset) { x_offset_ = x_offset; }
private:
/* cell list - array of cells in the column */
CHtmlTag_cell **cells_;
/* number of cells used in the list */
size_t cells_used_;
/* number of slots for cells allocated in list */
size_t cells_alloced_;
/*
* Minimum width of the column: this is the width of the largest
* item that can't be broken across multiple lines. This is the
* narrowest we can go before we start clipping items within the
* column.
*/
long min_width_;
/*
* Maximum width needed for the column: this is the width of the
* longest line in the column. This is the narrowest that we can go
* before we start wrapping lines within the column.
*/
long max_width_;
/*
* Pixel width. When a cell's WIDTH attribute is given as a pixel
* width, we'll track it here. We record the highest pixel width of
* the cells in this column.
*/
long pix_width_;
/*
* Percentage width. When a cell's width is expressed as a
* percentage of the table width, we'll track it here. We record
* the highest of the percentage widths of the cells in this column.
*/
long pct_width_;
/*
* final width of the column - set during pass 2, after all contents
* are known
*/
long width_;
/* horizontal offset of the column from the left edge of the table */
long x_offset_;
};
/*
* Mix-in class for table background image management.
*/
class CHtmlTableImage
{
public:
CHtmlTableImage()
{
/* no background color setting yet */
use_bgcolor_ = FALSE;
/* no background image yet */
bg_image_ = 0;
}
virtual ~CHtmlTableImage();
/* load the background image during formatting as needed */
void format_load_bg(class CHtmlSysWin *win, class CHtmlFormatter *fmt);
protected:
virtual const textchar_t *get_tag_name() const = 0;
/* our background color */
HTML_color_t bgcolor_;
int use_bgcolor_ : 1;
/* the URL and image cache object for our background image */
class CHtmlUrl background_;
class CHtmlResCacheObject *bg_image_;
};
/*
* TABLE tag
*/
class CHtmlTagTABLE: public CHtmlTagContainer, public CHtmlTableImage
{
public:
CHtmlTagTABLE(class CHtmlParser *);
~CHtmlTagTABLE();
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagTABLE, "TABLE");
/* put paragraph breaks around the table */
void on_parse(class CHtmlParser *parser);
void on_close(class CHtmlParser *parser);
void post_close(class CHtmlParser *parser);
/* before closing the table, close any open cell and row */
void pre_close(class CHtmlParser *parser);
/* parse attributes */
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
/* I'm a TABLE tag */
CHtmlTagTABLE *get_table_container() { return this; }
/*
* get the next format-order tag after the table - this is essentially
* the same as get_next_fmt_tag(), but doesn't trigger any side effects
*/
CHtmlTag *get_post_table_tag();
/* get my display item */
class CHtmlDispTable *get_disp() const { return disp_; }
/* is this a margin-floating item? */
int is_floating() const
{
/* it's a floating item if it's left- or right-aligned */
return (align_ == HTML_Attrib_left
|| align_ == HTML_Attrib_right);
}
/* get the alignment attribute */
HTML_Attrib_id_t get_align() const { return align_; }
/* get/set my current row number */
size_t get_cur_rownum() const { return cur_rownum_; }
void set_cur_rownum(size_t rownum) { cur_rownum_ = rownum; }
/* format the table */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
void format_exit(class CHtmlFormatter *formatter);
/* get the number of columns */
size_t get_column_count() const { return cols_used_; }
/*
* Get the column at a particular column index. Allocates a new
* column entry if this column is not yet allocated, so this routine
* always returns a valid cell pointer.
*/
CHtmlTag_column *get_column(size_t colnum);
/*
* Get a cell at a particular row and column position.
*/
CHtmlTag_cell *get_cell(size_t rownum, size_t colnum)
{
return get_column(colnum)->get_cell(rownum);
}
/*
* Calculate the table width based on the size constraints of the
* columns. width_min and width_max are the minimum and maximum sizes
* calculated for the contents, and win_width is the available space in
* the window.
*/
long calc_table_width(long width_min, long width_max, long win_width);
/*
* calculate the width of the table decorations (borders, cell
* spacing, cell padding)
*/
long calc_decor_width();
/*
* Set column widths.
*
* x_offset is the x position of the left edge of the table.
* table_width is the desired width of the table, which includes all
* decorations (borders, cell spacing, cell padding).
*/
void set_column_widths(long x_offset, long table_width);
/*
* Set row positions. This distributes the vertical space in the
* table according to the row sizes. Each row's size depends on the
* sizes of its member cells; each row's position depends on the
* sizes of the rows above it. When the table is finished after
* pass 2, everything about the cells is determined except the
* vertical sizes of the rows; this routine finishes the job by
* determining row positions and setting everything's final vertical
* location.
*/
void set_row_positions(class CHtmlFormatter *formatter);
/*
* Compute the final height of the table. We'll go through our rows
* and compute their final heights.
*/
void compute_table_height();
/* get the cell padding and spacing settings */
long get_cellpadding() const { return cellpadding_; }
long get_cellspacing() const { return cellspacing_; }
/* get the border size */
long get_border() const { return border_; }
/*
* Set the CAPTION tag. A table may have one CAPTION tag, or no
* caption at all. The CAPTION tag tells us about itself when the
* parser finishes with it.
*/
void set_caption_tag(class CHtmlTagCAPTION *caption_tag)
{
caption_tag_ = caption_tag;
}
/* get my enclosing table */
CHtmlTagTABLE *get_enclosing_table() const { return enclosing_table_; }
private:
/* my display item */
class CHtmlDispTable *disp_;
/* alignment */
HTML_Attrib_id_t align_;
/*
* width; if width_pct_ is true, width_ is a percentage of the space
* between the margins, otherwise it's a pixel size
*/
long width_;
int width_pct_;
/*
* flag indicating if width has been set at all; if not, it defaults
* to the minimum size needed to show the table with all cells at
* maximum, but no more than the greater of 100% of the available
* space between the margins and the minimum table width
*/
int width_set_ : 1;
/* height; works like width */
long height_;
int height_pct_;
/* flag indicating whether height has been specified */
int height_set_ : 1;
/*
* calculated minimum height - we calculate this based on the height
* parameter value when we start formatting the table, and then use
* it when we know all of the row heights to set the minimum table
* height
*/
long calc_height_;
/* border size in pixels */
long border_;
/* cell spacing and padding, in pixels */
long cellspacing_;
long cellpadding_;
/* the enclosing table display item and position */
class CHtmlTagTABLE *enclosing_table_;
CHtmlPoint enclosing_table_pos_;
/* my CAPTION tag, if I have one */
class CHtmlTagCAPTION *caption_tag_;
/*
* Current row number. This starts at zero; each time we finish a
* row, we'll increase this.
*/
size_t cur_rownum_;
/*
* Column list. The table keeps an array of column entries; each
* column entry keeps track of the size metrics for the column, and
* keeps a list of the cells (by row) that are actually occupied in
* that column.
*/
CHtmlTag_column **columns_;
/* number of columns used in column list */
size_t cols_used_;
/* number of column slots allocated in column list */
size_t cols_alloced_;
/*
* Minimum and maximum widths. These aren't known until after we
* complete the first pass. The minimum width is the size of the
* largest single item that can't be broken across lines; the
* maximum width is the width of the longest single line.
*/
long min_width_;
long max_width_;
};
class CHtmlTagCAPTION: public CHtmlTagContainer
{
public:
CHtmlTagCAPTION(class CHtmlParser *)
{
/* no alignment specified yet */
valign_ = HTML_Attrib_invalid;
align_ = HTML_Attrib_invalid;
}
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagCAPTION, "CAPTION");
/*
* Get the next tag in format order. We don't format CAPTION tags
* at the point they're encountered in the tag list; instead, the
* table formats its caption at the appropriate point in laying out
* the table. Hence, when asked for the next tag after the CAPTION
* in format order, we pretend we have no contents.
*/
virtual CHtmlTag *get_next_fmt_tag(class CHtmlFormatter *formatter)
{
/* return the next tag after us, as though we had no contents */
return CHtmlTag::get_next_fmt_tag(formatter);
}
/* parse the tag */
void on_parse(CHtmlParser *parser);
/* close parsing of the tag */
void on_close(class CHtmlParser *parser);
/* after-close processing */
void post_close(class CHtmlParser *parser);
/*
* Format the caption's contents. Normal formatting will skip the
* caption's contents; at the appropriate time, the formatter will
* explicitly call this routine to format the caption.
*/
void format_caption(class CHtmlSysWin *win,
class CHtmlFormatter *formatter);
/* parse attributes */
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
/*
* Determine if the caption is at the top of the table. Returns
* true if the caption is at the top, false if the caption is at the
* bottom.
*/
int is_at_top_of_table() const
{
/* it's at the top if it hasn't been set explicitly to the bottom */
return (valign_ != HTML_Attrib_bottom);
}
/*
* Receive notification that we've finished parsing the table. If
* we're aligned at the bottom of the table, we'll need to re-insert
* our text into the text array here, since the display items for
* our contents will be in the display list after the table.
*/
void on_close_table(class CHtmlParser *parser);
private:
/* horizontal and vertical alignment */
HTML_Attrib_id_t align_;
HTML_Attrib_id_t valign_;
};
class CHtmlTagTR: public CHtmlTagContainer, public CHtmlTableImage
{
public:
CHtmlTagTR(class CHtmlParser *)
: CHtmlTagContainer(), CHtmlTableImage()
{
/* no horizontal alignment set */
align_ = HTML_Attrib_invalid;
/* default to middle vertical alignment */
valign_ = HTML_Attrib_middle;
/* no cells yet, so the maximum height is zero */
max_cell_height_ = 0;
/* no height set yet */
height_set_ = FALSE;
height_star_ = FALSE;
}
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagTR, "TR");
/*
* on opening and closing parsing of tag, implicitly close any open
* cell within this row
*/
void on_parse(class CHtmlParser *parser);
void pre_close(class CHtmlParser *parser);
/* parse attributes */
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
/* I'm a table row (TR) tag */
CHtmlTagTR *get_as_table_row() { return this; }
CHtmlTagTR *get_table_row_container() { return this; }
/*
* Get my row number. The row number is fixed for all cells in the
* row; this is determined by the table when we start this row.
*/
size_t get_rownum() const { return rownum_; }
/*
* Get/set the current column number. We start this at zero when we
* start the row; each cell sets the column number to the next
* available column when it determines where it goes.
*/
size_t get_cur_colnum() const { return cur_colnum_; }
void set_cur_colnum(size_t colnum) { cur_colnum_ = colnum; }
/* format the row */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
void format_exit(class CHtmlFormatter *formatter);
/* get the maximum height of any of my cells */
long get_max_cell_height() const
{
/*
* if we have an explicit minimum height, and it's larger than
* the maximum cell height, use that; otherwise use the
* calculated maximum cell height
*/
if (height_set_ && height_ > max_cell_height_)
return height_;
else
return max_cell_height_;
}
/*
* Compute the maximum cell height. Adds the height contribution
* from each of the cells in this row to all rows the cell spans.
*/
void compute_max_cell_height(size_t rownum, size_t rowcnt, int pass);
/*
* Include the height of a cell in the computation of the row's
* maximum cell height.
*/
void include_cell_height(long height)
{
/* if this is the largest so far, remember it */
if (height > max_cell_height_)
max_cell_height_ = height;
}
/*
* Set the y offset of items in the row. We'll use this after we've
* completed pass 2 to set the final vertical positions of the
* contents of the row.
*/
void set_row_y_pos(class CHtmlFormatter *formatter,
class CHtmlTagTABLE *table,
long y_offset, long height);
/* get my alignment setting */
HTML_Attrib_id_t get_align() const { return align_; }
/* get my background color setting (and whether it's valid) */
HTML_color_t get_bgcolor() const { return bgcolor_; }
int get_use_bgcolor() const { return use_bgcolor_; }
/*
* determine if I my height attribute is '*', which means that I
* should soak up any available extra space in the vertical height
* of the enclosing table
*/
int is_height_star() const { return height_star_; }
private:
/* horizontal and vertical alignment settings */
HTML_Attrib_id_t align_;
HTML_Attrib_id_t valign_;
/* height attribute */
long height_;
unsigned int height_set_ : 1;
unsigned int height_star_ : 1;
/* my row number in the table */
size_t rownum_;
/* current column number */
size_t cur_colnum_;
/* maximum cell height found so far */
long max_cell_height_;
};
/*
* base class for table cells (TD and TH)
*/
class CHtmlTagTableCell: public CHtmlTagContainer, public CHtmlTableImage
{
public:
CHtmlTagTableCell(class CHtmlParser *parser);
/*
* get this item as a table cell - I'm definitely a table cell, so
* return a pointer to myself
*/
class CHtmlTagTableCell *get_table_cell_container() { return this; }
class CHtmlTagTableCell *get_as_table_cell() { return this; }
/*
* Set the cell's metrics. The formatter calls this after it's
* computed the minimum and maximum sizes of our contents during
* pass 1 through our table.
*/
void set_table_cell_metrics(class CHtmlTableMetrics *metrics);
/* compute the column metrics from the previously stored cell metrics */
void compute_column_metrics(int pass);
/*
* Set the cell's height. The formatter calls this after it's
* computed the cell's formatted vertical size during pass 2. If
* the content height is less than the height attribute, we'll use
* the height attribute. base_y_pos is the tentative y position of
* the top of the cell's contents; we'll save this position so that,
* when we later set the final position of each item in the cell's
* contents, we'll be able to set its offset from the final cell
* base position to be the same as its original offset from the
* tentative base position.
*/
void set_table_cell_height(long height, long base_y_pos);
/* get my formatted height */
long get_table_cell_height() const { return content_height_; }
/* get my ROWSPAN setting */
long get_rowspan() const { return rowspan_; }
/*
* Set the cell's vertical position. This is used at the end of the
* second pass, after we know the vertical size and position of the
* row containing this cell, to set the final positions of the items
* in the cell. 'y_offset' is the offset from the top of the table
* to the top of this cell's row.
*/
void set_cell_y_pos(class CHtmlFormatter *formatter,
long y_offset, long height,
HTML_Attrib_id_t row_valign);
/* parse attributes */
HTML_attrerr set_attribute(class CHtmlParser *parser,
HTML_Attrib_id_t attr_id,
const textchar_t *val, size_t vallen);
/* on starting a cell, close any previous cell that's still open */
void on_parse(class CHtmlParser *parser);
/* format the cell */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
void format_exit(class CHtmlFormatter *formatter);
protected:
/*
* Get my default horizontal alignment. This setting is used if
* neither the row nor the cell has an explicit ALIGN setting. The
* value differs for each type of cell, thus this method is pure
* virtual.
*/
virtual HTML_Attrib_id_t get_default_cell_alignment() const = 0;
private:
/* my row and column numbers */
size_t rownum_;
size_t colnum_;
/* flag indicating that we've figured out my row and column position */
int row_col_set_ : 1;
/* true -> don't wrap long lines */
int nowrap_ : 1;
/* number of rows and columns spanned by the cell */
long rowspan_;
long colspan_;
/* horizontal and vertial alignment settings */
HTML_Attrib_id_t align_;
HTML_Attrib_id_t valign_;
/* alignment in effect immediately before this cell started */
HTML_Attrib_id_t old_align_;
/* width and height attributes in pixels */
long width_;
long height_;
/* flag indicating that the width is a percentage of the table width */
int width_pct_;
/*
* Content height in pixels; this is the actual height of the
* contents after formatting the cell on the second pass.
*/
long content_height_;
/*
* Tentative vertical position of the top of the cell's contents.
* This is the position that the formatter puts the contents at
* before the final positions are known; during the final
* positioning pass, we'll use this as the base, so that we know how
* far to put each item from the final vertical position of the
* cell.
*/
long disp_y_base_;
/* flags indicating whether width and height have been specified */
int width_set_ : 1;
int height_set_ : 1;
/*
* My display item. This is only meaningful inside a single table
* formatting pass; we need to keep track of it so that we can
* calculate the cell's metrics when we finish formatting its
* contents in pass 1, and so that we can set the vertical positions
* of the cell's contents in pass 2.
*/
class CHtmlDispTableCell *disp_;
/*
* Last display item in the cell. This is used as a marker so that
* we know the range of the display items contained within the cell.
*/
class CHtmlDisp *disp_last_;
/* min/max width calculated from contents */
long cont_min_width_;
long cont_max_width_;
};
class CHtmlTagTH: public CHtmlTagTableCell
{
public:
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagTH, "TH");
CHtmlTagTH(class CHtmlParser *parser) : CHtmlTagTableCell(parser) { }
protected:
/* header cells are centered by default */
HTML_Attrib_id_t get_default_cell_alignment() const
{
return HTML_Attrib_center;
}
private:
};
class CHtmlTagTD: public CHtmlTagTableCell
{
public:
HTML_TAG_MAP_NOCONSTRUCTOR(CHtmlTagTD, "TD");
CHtmlTagTD(class CHtmlParser *parser) : CHtmlTagTableCell(parser) { }
protected:
/* data cells are aligned left by default */
HTML_Attrib_id_t get_default_cell_alignment() const
{
return HTML_Attrib_left;
}
private:
};
/* ------------------------------------------------------------------------ */
/*
* Special internal processing directive tag for T3 callers. This tells us
* to adjust our parsing rules for T3 programs. When we see this tag, we
* disable the <BANNER> tag, because that tag isn't allowed in T3.
*/
class CHtmlTagQT3: public CHtmlTag
{
public:
HTML_TAG_MAP(CHtmlTagQT3, "?T3");
/* activate our special handling on formatting */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
};
/*
* Special internal processing directive tag for TADS 2 callers. This
* tells us to adjust our parsing rules for TADS 2 programs.
*/
class CHtmlTagQT2: public CHtmlTag
{
public:
HTML_TAG_MAP(CHtmlTagQT2, "?T2");
/* activate our special handling on formatting */
void format(class CHtmlSysWin *win, class CHtmlFormatter *formatter);
};
#endif /* HTMLTAGS_H */
|