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
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#include <com/sun/star/util/SearchOptions.hpp>
#include <com/sun/star/text/XTextRange.hpp>
#include <hintids.hxx>
#include <svx/svdmodel.hxx>
#include <editeng/frmdiritem.hxx>
#include <SwSmartTagMgr.hxx>
#include <doc.hxx>
#include <rootfrm.hxx>
#include <pagefrm.hxx>
#include <cntfrm.hxx>
#include <viewimp.hxx>
#include <pam.hxx>
#include <swselectionlist.hxx>
#include <IBlockCursor.hxx>
#include "BlockCursor.hxx"
#include <ndtxt.hxx>
#include <flyfrm.hxx>
#include <dview.hxx>
#include <viewopt.hxx>
#include <frmtool.hxx>
#include <crsrsh.hxx>
#include <tabfrm.hxx>
#include <txtfrm.hxx>
#include <sectfrm.hxx>
#include <swtable.hxx>
#include <callnk.hxx>
#include <viscrs.hxx>
#include <section.hxx>
#include <docsh.hxx>
#include <scriptinfo.hxx>
#include <globdoc.hxx>
#include <pamtyp.hxx>
#include <mdiexp.hxx> // ...Percent()
#include <fmteiro.hxx>
#include <wrong.hxx> // SMARTTAGS
#include <unotextrange.hxx> // SMARTTAGS
#include <vcl/svapp.hxx>
#include <numrule.hxx>
#include <IGrammarContact.hxx>
#include <globals.hrc>
#include <comcore.hrc>
using namespace com::sun::star;
using namespace util;
TYPEINIT2(SwCrsrShell,ViewShell,SwModify);
// Funktion loescht, alle ueberlappenden Cursor aus einem Cursor-Ring
void CheckRange( SwCursor* );
//-----------------------------------------------------------------------
/*
* Ueberpruefe ob der pCurCrsr in einen schon bestehenden Bereich zeigt.
* Wenn ja, dann hebe den alten Bereich auf.
*/
void CheckRange( SwCursor* pCurCrsr )
{
const SwPosition *pStt = pCurCrsr->Start(),
*pEnd = pCurCrsr->GetPoint() == pStt ? pCurCrsr->GetMark() : pCurCrsr->GetPoint();
SwPaM *pTmpDel = 0,
*pTmp = (SwPaM*)pCurCrsr->GetNext();
// durchsuche den gesamten Ring
while( pTmp != pCurCrsr )
{
const SwPosition *pTmpStt = pTmp->Start(),
*pTmpEnd = pTmp->GetPoint() == pTmpStt ?
pTmp->GetMark() : pTmp->GetPoint();
if( *pStt <= *pTmpStt )
{
if( *pEnd > *pTmpStt ||
( *pEnd == *pTmpStt && *pEnd == *pTmpEnd ))
pTmpDel = pTmp;
}
else
if( *pStt < *pTmpEnd )
pTmpDel = pTmp;
/*
* liegt ein SPoint oder GetMark innerhalb vom Crsr-Bereich
* muss der alte Bereich aufgehoben werden.
* Beim Vergleich ist darauf zu achten, das SPoint nicht mehr zum
* Bereich gehoert !
*/
pTmp = (SwPaM*)pTmp->GetNext();
delete pTmpDel; // hebe alten Bereich auf
pTmpDel = 0;
}
}
// -------------- Methoden von der SwCrsrShell -------------
SwPaM * SwCrsrShell::CreateCrsr()
{
// Innerhalb der Tabellen-SSelection keinen neuen Crsr anlegen
OSL_ENSURE( !IsTableMode(), "in Tabellen SSelection" );
// neuen Cursor als Kopie vom akt. und in den Ring aufnehmen
// Verkettung zeigt immer auf den zuerst erzeugten, also vorwaerts
SwShellCrsr* pNew = new SwShellCrsr( *pCurCrsr );
// hier den akt. Pam nur logisch Hiden, weil sonst die Invertierung
// vom kopierten Pam aufgehoben wird !!
// #i75172#
pNew->swapContent(*pCurCrsr);
pCurCrsr->DeleteMark();
UpdateCrsr( SwCrsrShell::SCROLLWIN );
// return pCurCrsr;
return pNew;
}
// loesche den aktuellen Cursor und der folgende wird zum Aktuellen
sal_Bool SwCrsrShell::DestroyCrsr()
{
// Innerhalb der Tabellen-SSelection keinen neuen Crsr loeschen
OSL_ENSURE( !IsTableMode(), "in Tabellen SSelection" );
// ist ueberhaupt ein naechtser vorhanden ?
if(pCurCrsr->GetNext() == pCurCrsr)
return sal_False;
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
SwCursor* pNextCrsr = (SwCursor*)pCurCrsr->GetNext();
delete pCurCrsr;
pCurCrsr = dynamic_cast<SwShellCrsr*>(pNextCrsr);
UpdateCrsr();
return sal_True;
}
SwPaM & SwCrsrShell::CreateNewShellCursor()
{
if (HasSelection())
{
(void) CreateCrsr(); // n.b. returns old cursor
}
return *GetCrsr();
}
SwPaM & SwCrsrShell::GetCurrentShellCursor()
{
return *GetCrsr();
}
// gebe den aktuellen zurueck
SwPaM* SwCrsrShell::GetCrsr( sal_Bool bMakeTblCrsr ) const
{
if( pTblCrsr )
{
if( bMakeTblCrsr && pTblCrsr->IsCrsrMovedUpdt() )
{
// geparkte Cursor werden nicht wieder erzeugt
const SwCntntNode* pCNd;
if( pTblCrsr->GetPoint()->nNode.GetIndex() &&
pTblCrsr->GetMark()->nNode.GetIndex() &&
0 != ( pCNd = pTblCrsr->GetCntntNode() ) && pCNd->getLayoutFrm( GetLayout() ) &&
0 != ( pCNd = pTblCrsr->GetCntntNode(sal_False) ) && pCNd->getLayoutFrm( GetLayout() ) )
{
SwShellTableCrsr* pTC = (SwShellTableCrsr*)pTblCrsr;
GetLayout()->MakeTblCrsrs( *pTC );
}
}
if( pTblCrsr->IsChgd() )
{
const_cast<SwCrsrShell*>(this)->pCurCrsr =
dynamic_cast<SwShellCrsr*>(pTblCrsr->MakeBoxSels( pCurCrsr ));
}
}
return pCurCrsr;
}
void SwCrsrShell::StartAction()
{
if( !ActionPend() )
{
// fuer das Update des Ribbon-Bars merken
const SwNode& rNd = pCurCrsr->GetPoint()->nNode.GetNode();
nAktNode = rNd.GetIndex();
nAktCntnt = pCurCrsr->GetPoint()->nContent.GetIndex();
nAktNdTyp = rNd.GetNodeType();
bAktSelection = *pCurCrsr->GetPoint() != *pCurCrsr->GetMark();
if( rNd.IsTxtNode() )
nLeftFrmPos = SwCallLink::getLayoutFrm( GetLayout(), (SwTxtNode&)rNd, nAktCntnt, sal_True );
else
nLeftFrmPos = 0;
}
ViewShell::StartAction(); // zur ViewShell
}
void SwCrsrShell::EndAction( const sal_Bool bIdleEnd )
{
sal_Bool bVis = bSVCrsrVis;
// Idle-Formatierung ?
if( bIdleEnd && Imp()->GetRegion() )
{
pCurCrsr->Hide();
}
// vor der letzten Action alle invaliden Numerierungen updaten
if( 1 == nStartAction )
GetDoc()->UpdateNumRule();
// Task: 76923: dont show the cursor in the ViewShell::EndAction() - call.
// Only the UpdateCrsr shows the cursor.
sal_Bool bSavSVCrsrVis = bSVCrsrVis;
bSVCrsrVis = sal_False;
ViewShell::EndAction( bIdleEnd ); //der ViewShell den Vortritt lassen
bSVCrsrVis = bSavSVCrsrVis;
if( ActionPend() )
{
if( bVis ) // auch SV-Cursor wieder anzeigen
pVisCrsr->Show();
// falls noch ein ChgCall vorhanden ist und nur noch die Basic
// Klammerung vorhanden ist, dann rufe ihn. Dadurch wird die interne
// mit der Basic-Klammerung entkoppelt; die Shells werden umgeschaltet
if( !BasicActionPend() )
{
// es muss innerhalb einer BasicAction
// der Cursor geupdatet werden; um z.B. den
// TabellenCursor zu erzeugen. Im UpdateCrsr wird
// das jetzt beruecksichtigt!
UpdateCrsr( SwCrsrShell::CHKRANGE, bIdleEnd );
{
// Crsr-Moves ueberwachen, evt. Link callen
// der DTOR ist das interressante!!
SwCallLink aLk( *this, nAktNode, nAktCntnt, (sal_uInt8)nAktNdTyp,
nLeftFrmPos, bAktSelection );
}
if( bCallChgLnk && bChgCallFlag && aChgLnk.IsSet() )
{
aChgLnk.Call( this );
bChgCallFlag = sal_False; // Flag zuruecksetzen
}
}
return;
}
sal_uInt16 nParm = SwCrsrShell::CHKRANGE;
if ( !bIdleEnd )
nParm |= SwCrsrShell::SCROLLWIN;
// if( !IsViewLocked() )
UpdateCrsr( nParm, bIdleEnd ); // Cursor-Aenderungen anzeigen
{
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
aLk.nNode = nAktNode; // evt. Link callen
aLk.nNdTyp = (sal_uInt8)nAktNdTyp;
aLk.nCntnt = nAktCntnt;
aLk.nLeftFrmPos = nLeftFrmPos;
if( !nCrsrMove ||
( 1 == nCrsrMove && bInCMvVisportChgd ) )
ShowCrsrs( bSVCrsrVis ? sal_True : sal_False ); // Cursor & Selektionen wieder anzeigen
}
// falls noch ein ChgCall vorhanden ist, dann rufe ihn
if( bCallChgLnk && bChgCallFlag && aChgLnk.IsSet() )
{
aChgLnk.Call( this );
bChgCallFlag = sal_False; // Flag zuruecksetzen
}
}
#ifdef DBG_UTIL
void SwCrsrShell::SttCrsrMove()
{
OSL_ENSURE( nCrsrMove < USHRT_MAX, "To many nested CrsrMoves." );
++nCrsrMove;
StartAction();
}
void SwCrsrShell::EndCrsrMove( const sal_Bool bIdleEnd )
{
OSL_ENSURE( nCrsrMove, "EndCrsrMove() ohne SttCrsrMove()." );
EndAction( bIdleEnd );
if( !--nCrsrMove )
bInCMvVisportChgd = sal_False;
}
#endif
sal_Bool SwCrsrShell::LeftRight( sal_Bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode,
sal_Bool bVisualAllowed )
{
if( IsTableMode() )
return bLeft ? GoPrevCell() : GoNextCell();
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
sal_Bool bRet = sal_False;
// #i27615# Handle cursor in front of label.
const SwTxtNode* pTxtNd = 0;
if( pBlockCrsr )
pBlockCrsr->clearPoints();
//
// 1. CASE: Cursor is in front of label. A move to the right
// will simply reset the bInFrontOfLabel flag:
//
SwShellCrsr* pShellCrsr = getShellCrsr( true );
if ( !bLeft && pShellCrsr->IsInFrontOfLabel() )
{
SetInFrontOfLabel( sal_False );
bRet = sal_True;
}
//
// 2. CASE: Cursor is at beginning of numbered paragraph. A move
// to the left will simply set the bInFrontOfLabel flag:
//
else if ( bLeft && 0 == pShellCrsr->GetPoint()->nContent.GetIndex() &&
!pShellCrsr->IsInFrontOfLabel() && !pShellCrsr->HasMark() &&
0 != ( pTxtNd = pShellCrsr->GetNode()->GetTxtNode() ) &&
pTxtNd->HasVisibleNumberingOrBullet() )
{
SetInFrontOfLabel( sal_True );
bRet = sal_True;
}
//
// 3. CASE: Regular cursor move. Reset the bInFrontOfLabel flag:
//
else
{
const sal_Bool bSkipHidden = !GetViewOptions()->IsShowHiddenChar();
// #i107447#
// To avoid loop the reset of <bInFrontOfLabel> flag is no longer
// reflected in the return value <bRet>.
const bool bResetOfInFrontOfLabel = SetInFrontOfLabel( sal_False );
bRet = pShellCrsr->LeftRight( bLeft, nCnt, nMode, bVisualAllowed,
bSkipHidden, !IsOverwriteCrsr() );
if ( !bRet && bLeft && bResetOfInFrontOfLabel )
{
// undo reset of <bInFrontOfLabel> flag
SetInFrontOfLabel( sal_True );
}
}
if( bRet )
{
UpdateCrsr();
}
return bRet;
}
void SwCrsrShell::MarkListLevel( const String& sListId,
const int nListLevel )
{
if ( sListId != sMarkedListId ||
nListLevel != nMarkedListLevel)
{
if ( sMarkedListId.Len() > 0 )
pDoc->MarkListLevel( sMarkedListId, nMarkedListLevel, sal_False );
if ( sListId.Len() > 0 )
{
pDoc->MarkListLevel( sListId, nListLevel, sal_True );
}
sMarkedListId = sListId;
nMarkedListLevel = nListLevel;
}
}
void SwCrsrShell::UpdateMarkedListLevel()
{
SwTxtNode * pTxtNd = _GetCrsr()->GetNode()->GetTxtNode();
if ( pTxtNd )
{
if ( !pTxtNd->IsNumbered() )
{
pCurCrsr->_SetInFrontOfLabel( sal_False );
MarkListLevel( String(), 0 );
}
else if ( pCurCrsr->IsInFrontOfLabel() )
{
if ( pTxtNd->IsInList() )
{
OSL_ENSURE( pTxtNd->GetActualListLevel() >= 0 &&
pTxtNd->GetActualListLevel() < MAXLEVEL, "Which level?");
MarkListLevel( pTxtNd->GetListId(),
pTxtNd->GetActualListLevel() );
}
}
else
{
MarkListLevel( String(), 0 );
}
}
}
sal_Bool SwCrsrShell::UpDown( sal_Bool bUp, sal_uInt16 nCnt )
{
SET_CURR_SHELL( this );
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
sal_Bool bTableMode = IsTableMode();
SwShellCrsr* pTmpCrsr = getShellCrsr( true );
sal_Bool bRet = pTmpCrsr->UpDown( bUp, nCnt );
// #i40019# UpDown should always reset the bInFrontOfLabel flag:
bRet = SetInFrontOfLabel(sal_False) || bRet;
if( pBlockCrsr )
pBlockCrsr->clearPoints();
if( bRet )
{
eMvState = MV_UPDOWN; // Status fuers Crsr-Travelling - GetCrsrOfst
if( !ActionPend() )
{
CrsrFlag eUpdtMode = SwCrsrShell::SCROLLWIN;
if( !bTableMode )
eUpdtMode = (CrsrFlag) (eUpdtMode
| SwCrsrShell::UPDOWN | SwCrsrShell::CHKRANGE);
UpdateCrsr( static_cast<sal_uInt16>(eUpdtMode) );
}
}
return bRet;
}
sal_Bool SwCrsrShell::LRMargin( sal_Bool bLeft, sal_Bool bAPI)
{
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
SET_CURR_SHELL( this );
eMvState = MV_LEFTMARGIN; // Status fuers Crsr-Travelling - GetCrsrOfst
const sal_Bool bTableMode = IsTableMode();
SwShellCrsr* pTmpCrsr = getShellCrsr( true );
if( pBlockCrsr )
pBlockCrsr->clearPoints();
const sal_Bool bWasAtLM =
( 0 == _GetCrsr()->GetPoint()->nContent.GetIndex() );
sal_Bool bRet = pTmpCrsr->LeftRightMargin( bLeft, bAPI );
if ( bLeft && !bTableMode && bRet && bWasAtLM && !_GetCrsr()->HasMark() )
{
const SwTxtNode * pTxtNd = _GetCrsr()->GetNode()->GetTxtNode();
if ( pTxtNd && pTxtNd->HasVisibleNumberingOrBullet() )
SetInFrontOfLabel( sal_True );
}
else if ( !bLeft )
{
bRet = SetInFrontOfLabel( sal_False ) || bRet;
}
if( bRet )
{
UpdateCrsr();
}
return bRet;
}
sal_Bool SwCrsrShell::IsAtLRMargin( sal_Bool bLeft, sal_Bool bAPI ) const
{
const SwShellCrsr* pTmpCrsr = getShellCrsr( true );
return pTmpCrsr->IsAtLeftRightMargin( bLeft, bAPI );
}
sal_Bool SwCrsrShell::SttEndDoc( sal_Bool bStt )
{
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
SwShellCrsr* pTmpCrsr = pBlockCrsr ? &pBlockCrsr->getShellCrsr() : pCurCrsr;
sal_Bool bRet = pTmpCrsr->SttEndDoc( bStt );
if( bRet )
{
if( bStt )
pTmpCrsr->GetPtPos().Y() = 0; // expl. 0 setzen (TabellenHeader)
if( pBlockCrsr )
{
pBlockCrsr->clearPoints();
RefreshBlockCursor();
}
UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
}
return bRet;
}
void SwCrsrShell::ExtendedSelectAll()
{
SwNodes& rNodes = GetDoc()->GetNodes();
SwPosition* pPos = pCurCrsr->GetPoint();
pPos->nNode = rNodes.GetEndOfPostIts();
pPos->nContent.Assign( rNodes.GoNext( &pPos->nNode ), 0 );
pPos = pCurCrsr->GetMark();
pPos->nNode = rNodes.GetEndOfContent();
SwCntntNode* pCNd = rNodes.GoPrevious( &pPos->nNode );
pPos->nContent.Assign( pCNd, pCNd ? pCNd->Len() : 0 );
}
sal_Bool SwCrsrShell::MovePage( SwWhichPage fnWhichPage, SwPosPage fnPosPage )
{
sal_Bool bRet = sal_False;
// Springe beim Selektieren nie ueber Section-Grenzen !!
if( !pCurCrsr->HasMark() || !pCurCrsr->IsNoCntnt() )
{
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
SET_CURR_SHELL( this );
SwCrsrSaveState aSaveState( *pCurCrsr );
Point& rPt = pCurCrsr->GetPtPos();
SwCntntFrm * pFrm = pCurCrsr->GetCntntNode()->
getLayoutFrm( GetLayout(), &rPt, pCurCrsr->GetPoint(), sal_False );
if( pFrm && sal_True == ( bRet = GetFrmInPage( pFrm, fnWhichPage,
fnPosPage, pCurCrsr ) ) &&
!pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ))
UpdateCrsr();
else
bRet = sal_False;
}
return bRet;
}
sal_Bool SwCrsrShell::MovePara(SwWhichPara fnWhichPara, SwPosPara fnPosPara )
{
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
SwCursor* pTmpCrsr = getShellCrsr( true );
sal_Bool bRet = pTmpCrsr->MovePara( fnWhichPara, fnPosPara );
if( bRet )
UpdateCrsr();
return bRet;
}
sal_Bool SwCrsrShell::MoveSection( SwWhichSection fnWhichSect,
SwPosSection fnPosSect)
{
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
SwCursor* pTmpCrsr = getShellCrsr( true );
sal_Bool bRet = pTmpCrsr->MoveSection( fnWhichSect, fnPosSect );
if( bRet )
UpdateCrsr();
return bRet;
}
// Positionieren des Cursors
SwFrm* lcl_IsInHeaderFooter( const SwNodeIndex& rIdx, Point& rPt )
{
SwFrm* pFrm = 0;
SwCntntNode* pCNd = rIdx.GetNode().GetCntntNode();
if( pCNd )
{
SwCntntFrm *pCntFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->GetCurrentLayout(), &rPt, 0, sal_False );
pFrm = pCntFrm ? pCntFrm->GetUpper() : NULL;
while( pFrm && !pFrm->IsHeaderFrm() && !pFrm->IsFooterFrm() )
pFrm = pFrm->IsFlyFrm() ? ((SwFlyFrm*)pFrm)->AnchorFrm()
: pFrm->GetUpper();
}
return pFrm;
}
sal_Bool SwCrsrShell::IsInHeaderFooter( sal_Bool* pbInHeader ) const
{
Point aPt;
SwFrm* pFrm = ::lcl_IsInHeaderFooter( pCurCrsr->GetPoint()->nNode, aPt );
if( pFrm && pbInHeader )
*pbInHeader = pFrm->IsHeaderFrm();
return 0 != pFrm;
}
int SwCrsrShell::SetCrsr( const Point &rLPt, sal_Bool bOnlyText, bool bBlock )
{
SET_CURR_SHELL( this );
SwShellCrsr* pCrsr = getShellCrsr( bBlock );
SwPosition aPos( *pCrsr->GetPoint() );
Point aPt( rLPt );
Point & rAktCrsrPt = pCrsr->GetPtPos();
SwCrsrMoveState aTmpState( IsTableMode() ? MV_TBLSEL :
bOnlyText ? MV_SETONLYTEXT : MV_NONE );
aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
SwTxtNode * pTxtNd = pCrsr->GetNode()->GetTxtNode();
if ( pTxtNd && !IsTableMode() &&
// #i37515# No bInFrontOfLabel during selection
!pCrsr->HasMark() &&
pTxtNd->HasVisibleNumberingOrBullet() )
{
aTmpState.bInFrontOfLabel = sal_True; // #i27615#
}
else
{
aTmpState.bInFrontOfLabel = sal_False;
}
int bRet = CRSR_POSOLD |
( GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState )
? 0 : CRSR_POSCHG );
const bool bOldInFrontOfLabel = IsInFrontOfLabel();
const bool bNewInFrontOfLabel = aTmpState.bInFrontOfLabel;
pCrsr->SetCrsrBidiLevel( aTmpState.nCursorBidiLevel );
if( MV_RIGHTMARGIN == aTmpState.eState )
eMvState = MV_RIGHTMARGIN;
// steht neu Pos im Header/Footer ?
SwFrm* pFrm = lcl_IsInHeaderFooter( aPos.nNode, aPt );
if( IsTableMode() && !pFrm && aPos.nNode.GetNode().StartOfSectionNode() ==
pCrsr->GetPoint()->nNode.GetNode().StartOfSectionNode() )
// gleiche Tabellenzelle und nicht im Header/Footer
// -> zurueck
return bRet;
// Toggle the Header/Footer mode if needed
bool bInHeaderFooter = pFrm && ( pFrm->IsHeaderFrm() || pFrm->IsFooterFrm() );
if ( bInHeaderFooter != IsHeaderFooterEdit() )
ToggleHeaderFooterEdit();
if( pBlockCrsr && bBlock )
{
pBlockCrsr->setEndPoint( rLPt );
if( !pCrsr->HasMark() )
pBlockCrsr->setStartPoint( rLPt );
else if( !pBlockCrsr->getStartPoint() )
pBlockCrsr->setStartPoint( pCrsr->GetMkPos() );
}
if( !pCrsr->HasMark() )
{
// steht an der gleichen Position und wenn im Header/Footer,
// dann im gleichen
if( aPos == *pCrsr->GetPoint() &&
bOldInFrontOfLabel == bNewInFrontOfLabel )
{
if( pFrm )
{
if( pFrm->Frm().IsInside( rAktCrsrPt ))
return bRet;
}
else if( aPos.nNode.GetNode().IsCntntNode() )
{
// im gleichen Frame gelandet?
SwFrm* pOld = ((SwCntntNode&)aPos.nNode.GetNode()).getLayoutFrm(
GetLayout(), &aCharRect.Pos(), 0, sal_False );
SwFrm* pNew = ((SwCntntNode&)aPos.nNode.GetNode()).getLayoutFrm(
GetLayout(), &aPt, 0, sal_False );
if( pNew == pOld )
return bRet;
}
}
}
else
{
// SSelection ueber nicht erlaubte Sections oder wenn im Header/Footer
// dann in verschiedene
if( !CheckNodesRange( aPos.nNode, pCrsr->GetMark()->nNode, sal_True )
|| ( pFrm && !pFrm->Frm().IsInside( pCrsr->GetMkPos() ) ))
return bRet;
// steht an der gleichen Position und nicht im Header/Footer
if( aPos == *pCrsr->GetPoint() )
return bRet;
}
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
SwCrsrSaveState aSaveState( *pCrsr );
*pCrsr->GetPoint() = aPos;
rAktCrsrPt = aPt;
// #i41424# Only update the marked number levels if necessary
// Force update of marked number levels if necessary.
if ( bNewInFrontOfLabel || bOldInFrontOfLabel )
pCurCrsr->_SetInFrontOfLabel( !bNewInFrontOfLabel );
SetInFrontOfLabel( bNewInFrontOfLabel );
if( !pCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ) )
{
sal_uInt16 nFlag = SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE;
UpdateCrsr( nFlag );
bRet &= ~CRSR_POSOLD;
}
else if( bOnlyText && !pCurCrsr->HasMark() )
{
if( FindValidCntntNode( bOnlyText ) )
{
// Cursor in einen gueltigen Content stellen
if( aPos == *pCrsr->GetPoint() )
bRet = CRSR_POSOLD;
else
{
UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE );
bRet &= ~CRSR_POSOLD;
}
}
else
{
// es gibt keinen gueltigen Inhalt -> Cursor verstecken
pVisCrsr->Hide(); // sichtbaren Cursor immer verstecken
eMvState = MV_NONE; // Status fuers Crsr-Travelling
bAllProtect = sal_True;
if( GetDoc()->GetDocShell() )
{
GetDoc()->GetDocShell()->SetReadOnlyUI( sal_True );
CallChgLnk(); // UI bescheid sagen!
}
}
}
return bRet;
}
void SwCrsrShell::TblCrsrToCursor()
{
OSL_ENSURE( pTblCrsr, "TblCrsrToCursor: Why?" );
delete pTblCrsr, pTblCrsr = 0;
}
void SwCrsrShell::BlockCrsrToCrsr()
{
OSL_ENSURE( pBlockCrsr, "BlockCrsrToCrsr: Why?" );
if( pBlockCrsr && !HasSelection() )
{
SwPaM& rPam = pBlockCrsr->getShellCrsr();
pCurCrsr->SetMark();
*pCurCrsr->GetPoint() = *rPam.GetPoint();
if( rPam.HasMark() )
*pCurCrsr->GetMark() = *rPam.GetMark();
else
pCurCrsr->DeleteMark();
}
delete pBlockCrsr, pBlockCrsr = 0;
}
void SwCrsrShell::CrsrToBlockCrsr()
{
if( !pBlockCrsr )
{
SwPosition aPos( *pCurCrsr->GetPoint() );
pBlockCrsr = createBlockCursor( *this, aPos );
SwShellCrsr &rBlock = pBlockCrsr->getShellCrsr();
rBlock.GetPtPos() = pCurCrsr->GetPtPos();
if( pCurCrsr->HasMark() )
{
rBlock.SetMark();
*rBlock.GetMark() = *pCurCrsr->GetMark();
rBlock.GetMkPos() = pCurCrsr->GetMkPos();
}
}
pBlockCrsr->clearPoints();
RefreshBlockCursor();
}
void SwCrsrShell::ClearMark()
{
// ist ueberhaupt ein GetMark gesetzt ?
if( pTblCrsr )
{
while( pCurCrsr->GetNext() != pCurCrsr )
delete pCurCrsr->GetNext();
pTblCrsr->DeleteMark();
if( pCurCrsr->HasMark() )
{
// falls doch nicht alle Indizies richtig verschoben werden
// (z.B.: Kopf-/Fusszeile loeschen) den Content-Anteil vom
// Mark aufs Nodes-Array setzen
SwPosition& rPos = *pCurCrsr->GetMark();
rPos.nNode.Assign( pDoc->GetNodes(), 0 );
rPos.nContent.Assign( 0, 0 );
pCurCrsr->DeleteMark();
}
*pCurCrsr->GetPoint() = *pTblCrsr->GetPoint();
pCurCrsr->GetPtPos() = pTblCrsr->GetPtPos();
delete pTblCrsr, pTblCrsr = 0;
pCurCrsr->SwSelPaintRects::Show();
}
else
{
if( !pCurCrsr->HasMark() )
return;
// falls doch nicht alle Indizies richtig verschoben werden
// (z.B.: Kopf-/Fusszeile loeschen) den Content-Anteil vom
// Mark aufs Nodes-Array setzen
SwPosition& rPos = *pCurCrsr->GetMark();
rPos.nNode.Assign( pDoc->GetNodes(), 0 );
rPos.nContent.Assign( 0, 0 );
pCurCrsr->DeleteMark();
if( !nCrsrMove )
pCurCrsr->SwSelPaintRects::Show();
}
}
void SwCrsrShell::NormalizePam(sal_Bool bPointFirst)
{
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
pCurCrsr->Normalize(bPointFirst);
}
void SwCrsrShell::SwapPam()
{
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
pCurCrsr->Exchange();
}
// suche innerhalb der Selektierten-Bereiche nach einer Selektion, die
// den angebenen SPoint umschliesst
// Ist das Flag bTstOnly gesetzt, dann wird nur getestet, ob dort eine
// SSelection besteht; des akt. Cursr wird nicht umgesetzt!
// Ansonsten wird er auf die gewaehlte SSelection gesetzt.
sal_Bool SwCrsrShell::ChgCurrPam( const Point & rPt,
sal_Bool bTstOnly, sal_Bool bTstHit )
{
SET_CURR_SHELL( this );
// Pruefe ob der SPoint in einer Tabellen-Selektion liegt
if( bTstOnly && pTblCrsr )
return pTblCrsr->IsInside( rPt );
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
// Suche die Position rPt im Dokument
SwPosition aPtPos( *pCurCrsr->GetPoint() );
Point aPt( rPt );
SwCrsrMoveState aTmpState( MV_NONE );
aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
if ( !GetLayout()->GetCrsrOfst( &aPtPos, aPt, &aTmpState ) && bTstHit )
return sal_False;
// suche in allen Selektionen nach dieser Position
SwShellCrsr* pCmp = (SwShellCrsr*)pCurCrsr; // sicher den Pointer auf Cursor
do {
if( pCmp->HasMark() &&
*pCmp->Start() <= aPtPos && *pCmp->End() > aPtPos )
{
if( bTstOnly || pCurCrsr == pCmp ) // ist der aktuelle.
return sal_True; // return ohne Update
pCurCrsr = pCmp;
UpdateCrsr(); // Cursor steht schon richtig
return sal_True;
}
} while( pCurCrsr !=
( pCmp = dynamic_cast<SwShellCrsr*>(pCmp->GetNext()) ) );
return sal_False;
}
void SwCrsrShell::KillPams()
{
// keiner zum loeschen vorhanden?
if( !pTblCrsr && !pBlockCrsr && pCurCrsr->GetNext() == pCurCrsr )
return;
while( pCurCrsr->GetNext() != pCurCrsr )
delete pCurCrsr->GetNext();
pCurCrsr->SetColumnSelection( false );
if( pTblCrsr )
{
// Cursor Ring loeschen
pCurCrsr->DeleteMark();
*pCurCrsr->GetPoint() = *pTblCrsr->GetPoint();
pCurCrsr->GetPtPos() = pTblCrsr->GetPtPos();
delete pTblCrsr;
pTblCrsr = 0;
}
else if( pBlockCrsr )
{
// delete the ring of cursors
pCurCrsr->DeleteMark();
SwShellCrsr &rBlock = pBlockCrsr->getShellCrsr();
*pCurCrsr->GetPoint() = *rBlock.GetPoint();
pCurCrsr->GetPtPos() = rBlock.GetPtPos();
rBlock.DeleteMark();
pBlockCrsr->clearPoints();
}
UpdateCrsr( SwCrsrShell::SCROLLWIN );
}
int SwCrsrShell::CompareCursor( CrsrCompareType eType ) const
{
int nRet = 0;
const SwPosition *pFirst = 0, *pSecond = 0;
const SwPaM *pCur = GetCrsr(), *pStk = pCrsrStk;
if( CurrPtCurrMk != eType && pStk )
{
switch ( eType)
{
case StackPtStackMk:
pFirst = pStk->GetPoint();
pSecond = pStk->GetMark();
break;
case StackPtCurrPt:
pFirst = pStk->GetPoint();
pSecond = pCur->GetPoint();
break;
case StackPtCurrMk:
pFirst = pStk->GetPoint();
pSecond = pCur->GetMark();
break;
case StackMkCurrPt:
pFirst = pStk->GetMark();
pSecond = pCur->GetPoint();
break;
case StackMkCurrMk:
pFirst = pStk->GetMark();
pSecond = pStk->GetMark();
break;
case CurrPtCurrMk:
pFirst = pCur->GetPoint();
pSecond = pCur->GetMark();
break;
}
}
if( !pFirst || !pSecond )
nRet = INT_MAX;
else if( *pFirst < *pSecond )
nRet = -1;
else if( *pFirst == *pSecond )
nRet = 0;
else
nRet = 1;
return nRet;
}
sal_Bool SwCrsrShell::IsSttPara() const
{ return( pCurCrsr->GetPoint()->nContent == 0 ? sal_True : sal_False ); }
sal_Bool SwCrsrShell::IsEndPara() const
{ return( pCurCrsr->GetPoint()->nContent == pCurCrsr->GetCntntNode()->Len() ? sal_True : sal_False ); }
sal_Bool SwCrsrShell::IsInFrontOfLabel() const
{
return pCurCrsr->IsInFrontOfLabel();
}
bool SwCrsrShell::SetInFrontOfLabel( sal_Bool bNew )
{
if ( bNew != IsInFrontOfLabel() )
{
pCurCrsr->_SetInFrontOfLabel( bNew );
UpdateMarkedListLevel();
return true;
}
return false;
}
sal_Bool SwCrsrShell::GotoPage( sal_uInt16 nPage )
{
SET_CURR_SHELL( this );
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
SwCrsrSaveState aSaveState( *pCurCrsr );
sal_Bool bRet = GetLayout()->SetCurrPage( pCurCrsr, nPage ) &&
!pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
nsSwCursorSelOverFlags::SELOVER_CHANGEPOS );
if( bRet )
UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
return bRet;
}
void SwCrsrShell::GetPageNum( sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum,
sal_Bool bAtCrsrPos, const sal_Bool bCalcFrm )
{
SET_CURR_SHELL( this );
// Seitennummer: die erste sichtbare Seite oder die am Cursor
const SwCntntFrm* pCFrm;
const SwPageFrm *pPg = 0;
if( !bAtCrsrPos || 0 == (pCFrm = GetCurrFrm( bCalcFrm )) ||
0 == (pPg = pCFrm->FindPageFrm()) )
{
pPg = Imp()->GetFirstVisPage();
while( pPg && pPg->IsEmptyPage() )
pPg = (const SwPageFrm *)pPg->GetNext();
}
// Abfrage auf pPg muss fuer den Sonderfall Writerstart mit
// standard.vor sein.
rnPhyNum = pPg? pPg->GetPhyPageNum() : 1;
rnVirtNum = pPg? pPg->GetVirtPageNum() : 1;
}
sal_uInt16 SwCrsrShell::GetNextPrevPageNum( sal_Bool bNext )
{
SET_CURR_SHELL( this );
// Seitennummer: die erste sichtbare Seite oder die am Cursor
const SwPageFrm *pPg = Imp()->GetFirstVisPage();
if( pPg )
{
const SwTwips nPageTop = pPg->Frm().Top();
if( bNext )
{
// go to next view layout row:
do
{
pPg = (const SwPageFrm *)pPg->GetNext();
}
while( pPg && pPg->Frm().Top() == nPageTop );
while( pPg && pPg->IsEmptyPage() )
pPg = (const SwPageFrm *)pPg->GetNext();
}
else
{
// go to previous view layout row:
do
{
pPg = (const SwPageFrm *)pPg->GetPrev();
}
while( pPg && pPg->Frm().Top() == nPageTop );
while( pPg && pPg->IsEmptyPage() )
pPg = (const SwPageFrm *)pPg->GetPrev();
}
}
// Abfrage auf pPg muss fuer den Sonderfall Writerstart mit
// standard.vor sein.
return pPg ? pPg->GetPhyPageNum() : USHRT_MAX;
}
sal_uInt16 SwCrsrShell::GetPageCnt()
{
SET_CURR_SHELL( this );
// gebe die Anzahl der Seiten zurueck
return GetLayout()->GetPageNum();
}
// Gehe zur naechsten SSelection
sal_Bool SwCrsrShell::GoNextCrsr()
{
// besteht ueberhaupt ein Ring ?
if( pCurCrsr->GetNext() == pCurCrsr )
return sal_False;
SET_CURR_SHELL( this );
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
pCurCrsr = dynamic_cast<SwShellCrsr*>(pCurCrsr->GetNext());
// Bug 24086: auch alle anderen anzeigen
if( !ActionPend() )
{
UpdateCrsr();
pCurCrsr->Show();
}
return sal_True;
}
// gehe zur vorherigen SSelection
sal_Bool SwCrsrShell::GoPrevCrsr()
{
// besteht ueberhaupt ein Ring ?
if( pCurCrsr->GetNext() == pCurCrsr )
return sal_False;
SET_CURR_SHELL( this );
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
pCurCrsr = dynamic_cast<SwShellCrsr*>(pCurCrsr->GetPrev());
// Bug 24086: auch alle anderen anzeigen
if( !ActionPend() )
{
UpdateCrsr();
pCurCrsr->Show();
}
return sal_True;
}
void SwCrsrShell::Paint( const Rectangle &rRect)
{
SET_CURR_SHELL( this );
// beim Painten immer alle Cursor ausschalten
SwRect aRect( rRect );
sal_Bool bVis = sal_False;
// ist Cursor sichtbar, dann verstecke den SV-Cursor
if( pVisCrsr->IsVisible() && !aRect.IsOver( aCharRect ) ) //JP 18.06.97: ???
{
bVis = sal_True;
pVisCrsr->Hide();
}
// Bereich neu painten
ViewShell::Paint( rRect );
if( bHasFocus && !bBasicHideCrsr )
{
SwShellCrsr* pAktCrsr = pTblCrsr ? pTblCrsr : pCurCrsr;
// pAktCrsr->Invalidate( aRect );
if( !ActionPend() )
{
// damit nicht rechts/unten die Raender abgeschnitten werden
pAktCrsr->Invalidate( VisArea() );
pAktCrsr->Show();
}
else
pAktCrsr->Invalidate( aRect );
}
if( bSVCrsrVis && bVis ) // auch SV-Cursor wieder anzeigen
pVisCrsr->Show();
}
void SwCrsrShell::VisPortChgd( const SwRect & rRect )
{
SET_CURR_SHELL( this );
sal_Bool bVis; // beim Scrollen immer alle Cursor ausschalten
// ist Cursor sichtbar, dann verstecke den SV-Cursor
if( sal_True == ( bVis = pVisCrsr->IsVisible() ))
pVisCrsr->Hide();
bVisPortChgd = sal_True;
aOldRBPos.X() = VisArea().Right();
aOldRBPos.Y() = VisArea().Bottom();
//Damit es es keine Probleme mit dem SV-Cursor gibt, wird in
//ViewShell::VisPo.. ein Update() auf das Window gerufen.
//Waehrend des Paintens duerfen aber nun wieder keine Selectionen
//angezeigt werden, deshalb wird der Aufruf hier geklammert.
ViewShell::VisPortChgd( rRect ); // Bereich verschieben
if( bSVCrsrVis && bVis ) // auch SV-Cursor wieder anzeigen
pVisCrsr->Show();
if( nCrsrMove )
bInCMvVisportChgd = sal_True;
bVisPortChgd = sal_False;
}
// aktualisiere den Crsrs, d.H. setze ihn wieder in den Content.
// Das sollte nur aufgerufen werden, wenn der Cursor z.B. beim
// Loeschen von Rahmen irgendwohin gesetzt wurde. Die Position
// ergibt sich aus seiner aktuellen Position im Layout !!
void SwCrsrShell::UpdateCrsrPos()
{
SET_CURR_SHELL( this );
++nStartAction;
SwShellCrsr* pShellCrsr = getShellCrsr( true );
Size aOldSz( GetDocSize() );
SwCntntNode *pCNode = pShellCrsr->GetCntntNode();
SwCntntFrm *pFrm = pCNode ?
pCNode->getLayoutFrm( GetLayout(), &pShellCrsr->GetPtPos(), pShellCrsr->GetPoint(), sal_False ) :0;
if( !pFrm || (pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsHiddenNow()) )
{
SwCrsrMoveState aTmpState( MV_NONE );
aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
GetLayout()->GetCrsrOfst( pShellCrsr->GetPoint(), pShellCrsr->GetPtPos(),
&aTmpState );
if( pShellCrsr->HasMark())
pShellCrsr->DeleteMark();
}
IGrammarContact *pGrammarContact = GetDoc() ? GetDoc()->getGrammarContact() : 0;
if( pGrammarContact )
pGrammarContact->updateCursorPosition( *pCurCrsr->GetPoint() );
--nStartAction;
if( aOldSz != GetDocSize() )
SizeChgNotify();
}
// JP 30.04.99: Bug 65475 - falls Point/Mark in versteckten Bereichen
// stehen, so mussen diese daraus verschoben werden
static void lcl_CheckHiddenSection( SwNodeIndex& rIdx )
{
const SwSectionNode* pSectNd = rIdx.GetNode().FindSectionNode();
if( pSectNd && pSectNd->GetSection().IsHiddenFlag() )
{
SwNodeIndex aTmp( *pSectNd );
const SwNode* pFrmNd =
rIdx.GetNodes().FindPrvNxtFrmNode( aTmp, pSectNd->EndOfSectionNode() );
#ifndef DBG_UTIL
(void) pFrmNd;
#else
OSL_ENSURE( pFrmNd, "found no Node with Frames" );
#endif
rIdx = aTmp;
}
}
// Try to set the cursor to the next visible content node.
static void lcl_CheckHiddenPara( SwPosition& rPos )
{
SwNodeIndex aTmp( rPos.nNode );
SwTxtNode* pTxtNd = aTmp.GetNode().GetTxtNode();
while( pTxtNd && pTxtNd->HasHiddenCharAttribute( true ) )
{
SwCntntNode* pCntnt = aTmp.GetNodes().GoNext( &aTmp );
if ( pCntnt && pCntnt->IsTxtNode() )
pTxtNd = (SwTxtNode*)pCntnt;
else
pTxtNd = 0;
}
if ( pTxtNd )
rPos = SwPosition( aTmp, SwIndex( pTxtNd, 0 ) );
}
// #i27301# - helper class, which notifies the accessibility about invalid text
// selections in its destructor
class SwNotifyAccAboutInvalidTextSelections
{
private:
SwCrsrShell& mrCrsrSh;
public:
SwNotifyAccAboutInvalidTextSelections( SwCrsrShell& _rCrsrSh )
: mrCrsrSh( _rCrsrSh )
{}
~SwNotifyAccAboutInvalidTextSelections()
{
mrCrsrSh.InvalidateAccessibleParaTextSelection();
}
};
void SwCrsrShell::UpdateCrsr( sal_uInt16 eFlags, sal_Bool bIdleEnd )
{
SET_CURR_SHELL( this );
ClearUpCrsrs();
// es muss innerhalb einer BasicAction der
// Cursor geupdatet werden; um z.B. den TabellenCursor zu
// erzeugen. Im EndAction wird jetzt das UpdateCrsr gerufen!
if( ActionPend() && BasicActionPend() )
{
if ( eFlags & SwCrsrShell::READONLY )
bIgnoreReadonly = sal_True;
return; // wenn nicht, dann kein Update !!
}
sal_Bool bInHeader= sal_True;
if ( IsInHeaderFooter( &bInHeader ) )
{
if ( !bInHeader )
{
SetShowHeaderFooterSeparator( Footer, true );
SetShowHeaderFooterSeparator( Header, false );
}
else
{
SetShowHeaderFooterSeparator( Header, true );
SetShowHeaderFooterSeparator( Footer, false );
}
}
if ( IsInHeaderFooter() != IsHeaderFooterEdit() )
ToggleHeaderFooterEdit();
// #i27301#
SwNotifyAccAboutInvalidTextSelections aInvalidateTextSelections( *this );
if ( bIgnoreReadonly )
{
bIgnoreReadonly = sal_False;
eFlags |= SwCrsrShell::READONLY;
}
if( eFlags & SwCrsrShell::CHKRANGE ) // alle Cursor-Bewegungen auf
CheckRange( pCurCrsr ); // ueberlappende Bereiche testen
if( !bIdleEnd )
CheckTblBoxCntnt();
// steht der akt. Crsr in einer Tabelle und in unterschiedlichen Boxen
// (oder ist noch TabellenMode), dann gilt der Tabellen Mode
SwPaM* pTstCrsr = getShellCrsr( true );
if( pTstCrsr->HasMark() && !pBlockCrsr &&
pDoc->IsIdxInTbl( pTstCrsr->GetPoint()->nNode ) &&
( pTblCrsr ||
pTstCrsr->GetNode( sal_True )->StartOfSectionNode() !=
pTstCrsr->GetNode( sal_False )->StartOfSectionNode() ) )
{
SwShellCrsr* pITmpCrsr = getShellCrsr( true );
Point aTmpPt( pITmpCrsr->GetPtPos() );
Point aTmpMk( pITmpCrsr->GetMkPos() );
SwPosition* pPos = pITmpCrsr->GetPoint();
// JP 30.04.99: Bug 65475 - falls Point/Mark in versteckten Bereichen
// stehen, so mussen diese daraus verschoben werden
lcl_CheckHiddenSection( pPos->nNode );
lcl_CheckHiddenSection( pITmpCrsr->GetMark()->nNode );
// Move cursor out of hidden paragraphs
if ( !GetViewOptions()->IsShowHiddenChar() )
{
lcl_CheckHiddenPara( *pPos );
lcl_CheckHiddenPara( *pITmpCrsr->GetMark() );
}
SwCntntFrm *pTblFrm = pPos->nNode.GetNode().GetCntntNode()->
getLayoutFrm( GetLayout(), &aTmpPt, pPos, sal_False );
OSL_ENSURE( pTblFrm, "Tabelle Crsr nicht im Content ??" );
// --> Make code robust. The table cursor may point
// to a table in a currently inactive header.
SwTabFrm *pTab = pTblFrm ? pTblFrm->FindTabFrm() : 0;
if ( pTab && pTab->GetTable()->GetRowsToRepeat() > 0 )
{
// First check if point is in repeated headline:
bool bInRepeatedHeadline = pTab->IsFollow() && pTab->IsInHeadline( *pTblFrm );
// Second check if mark is in repeated headline:
if ( !bInRepeatedHeadline )
{
SwCntntFrm* pMarkTblFrm = pITmpCrsr->GetCntntNode( sal_False )->
getLayoutFrm( GetLayout(), &aTmpMk, pITmpCrsr->GetMark(), sal_False );
OSL_ENSURE( pMarkTblFrm, "Tabelle Crsr nicht im Content ??" );
if ( pMarkTblFrm )
{
SwTabFrm* pMarkTab = pMarkTblFrm->FindTabFrm();
OSL_ENSURE( pMarkTab, "Tabelle Crsr nicht im Content ??" );
// Make code robust:
if ( pMarkTab )
{
bInRepeatedHeadline = pMarkTab->IsFollow() && pMarkTab->IsInHeadline( *pMarkTblFrm );
}
}
}
// No table cursor in repeaded headlines:
if ( bInRepeatedHeadline )
{
pTblFrm = 0;
SwPosSection fnPosSect = *pPos < *pITmpCrsr->GetMark()
? fnSectionStart
: fnSectionEnd;
// dann nur innerhalb der Box selektieren
if( pTblCrsr )
{
pCurCrsr->SetMark();
*pCurCrsr->GetMark() = *pTblCrsr->GetMark();
pCurCrsr->GetMkPos() = pTblCrsr->GetMkPos();
pTblCrsr->DeleteMark();
pTblCrsr->SwSelPaintRects::Hide();
}
*pCurCrsr->GetPoint() = *pCurCrsr->GetMark();
(*fnSectionCurr)( *pCurCrsr, fnPosSect );
}
}
// wir wollen wirklich eine Tabellen-Selektion
if( pTab && pTblFrm )
{
if( !pTblCrsr )
{
pTblCrsr = new SwShellTableCrsr( *this,
*pCurCrsr->GetMark(), pCurCrsr->GetMkPos(),
*pPos, aTmpPt );
pCurCrsr->DeleteMark();
pCurCrsr->SwSelPaintRects::Hide();
CheckTblBoxCntnt();
}
SwCrsrMoveState aTmpState( MV_NONE );
aTmpState.bRealHeight = sal_True;
if( !pTblFrm->GetCharRect( aCharRect, *pTblCrsr->GetPoint(), &aTmpState ) )
{
Point aCentrPt( aCharRect.Center() );
aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
pTblFrm->GetCrsrOfst( pTblCrsr->GetPoint(), aCentrPt, &aTmpState );
bool const bResult =
pTblFrm->GetCharRect( aCharRect, *pTblCrsr->GetPoint() );
OSL_ENSURE( bResult, "GetCharRect failed." );
(void) bResult; // non-debug: unused
}
pVisCrsr->Hide(); // sichtbaren Cursor immer verstecken
// Curosr in den sichtbaren Bereich scrollen
if( (eFlags & SwCrsrShell::SCROLLWIN) &&
(HasSelection() || eFlags & SwCrsrShell::READONLY ||
!IsCrsrReadonly()) )
{
SwFrm* pBoxFrm = pTblFrm;
while( pBoxFrm && !pBoxFrm->IsCellFrm() )
pBoxFrm = pBoxFrm->GetUpper();
if( pBoxFrm && pBoxFrm->Frm().HasArea() )
MakeVisible( pBoxFrm->Frm() );
else
MakeVisible( aCharRect );
}
// lasse vom Layout die Crsr in den Boxen erzeugen
if( pTblCrsr->IsCrsrMovedUpdt() )
GetLayout()->MakeTblCrsrs( *pTblCrsr );
if( bHasFocus && !bBasicHideCrsr )
pTblCrsr->Show();
// Cursor-Points auf die neuen Positionen setzen
pTblCrsr->GetPtPos().X() = aCharRect.Left();
pTblCrsr->GetPtPos().Y() = aCharRect.Top();
if( bSVCrsrVis )
{
aCrsrHeight.X() = 0;
aCrsrHeight.Y() = aTmpState.aRealHeight.Y() < 0 ?
-aCharRect.Width() : aCharRect.Height();
pVisCrsr->Show(); // wieder anzeigen
}
eMvState = MV_NONE; // Status fuers Crsr-Travelling - GetCrsrOfst
if( pTblFrm && Imp()->IsAccessible() )
Imp()->InvalidateAccessibleCursorPosition( pTblFrm );
return;
}
}
if( pTblCrsr )
{
// Cursor Ring loeschen
while( pCurCrsr->GetNext() != pCurCrsr )
delete pCurCrsr->GetNext();
pCurCrsr->DeleteMark();
*pCurCrsr->GetPoint() = *pTblCrsr->GetPoint();
pCurCrsr->GetPtPos() = pTblCrsr->GetPtPos();
delete pTblCrsr, pTblCrsr = 0;
}
pVisCrsr->Hide(); // sichtbaren Cursor immer verstecken
// sind wir vielleicht in einer geschuetzten/versteckten Section ?
{
SwShellCrsr* pShellCrsr = getShellCrsr( true );
sal_Bool bChgState = sal_True;
const SwSectionNode* pSectNd = pShellCrsr->GetNode()->FindSectionNode();
if( pSectNd && ( pSectNd->GetSection().IsHiddenFlag() ||
( !IsReadOnlyAvailable() &&
pSectNd->GetSection().IsProtectFlag() &&
( !pDoc->GetDocShell() ||
!pDoc->GetDocShell()->IsReadOnly() || bAllProtect )) ) )
{
if( !FindValidCntntNode( !HasDrawView() ||
0 == Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount()))
{
// alles ist geschuetzt / versteckt -> besonderer Mode
if( bAllProtect && !IsReadOnlyAvailable() &&
pSectNd->GetSection().IsProtectFlag() )
bChgState = sal_False;
else
{
eMvState = MV_NONE; // Status fuers Crsr-Travelling
bAllProtect = sal_True;
if( GetDoc()->GetDocShell() )
{
GetDoc()->GetDocShell()->SetReadOnlyUI( sal_True );
CallChgLnk(); // UI bescheid sagen!
}
return;
}
}
}
if( bChgState )
{
sal_Bool bWasAllProtect = bAllProtect;
bAllProtect = sal_False;
if( bWasAllProtect && GetDoc()->GetDocShell() &&
GetDoc()->GetDocShell()->IsReadOnlyUI() )
{
GetDoc()->GetDocShell()->SetReadOnlyUI( sal_False );
CallChgLnk(); // UI bescheid sagen!
}
}
}
UpdateCrsrPos();
// The cursor must always point into content; there's some code
// that relies on this. (E.g. in SwEditShell::GetScriptType, which always
// loops _behind_ the last node in the selection, which always works if you
// are in content.) To achieve this, we'll force cursor(s) to point into
// content, if UpdateCrsrPos() hasn't already done so.
SwPaM* pCmp = pCurCrsr;
do
{
// start will move forwards, end will move backwards
bool bPointIsStart = ( pCmp->Start() == pCmp->GetPoint() );
// move point; forward if it's the start, backwards if it's the end
if( ! pCmp->GetPoint()->nNode.GetNode().IsCntntNode() )
pCmp->Move( bPointIsStart ? fnMoveForward : fnMoveBackward,
fnGoCntnt );
// move mark (if exists); forward if it's the start, else backwards
if( pCmp->HasMark() )
{
if( ! pCmp->GetMark()->nNode.GetNode().IsCntntNode() )
{
pCmp->Exchange();
pCmp->Move( !bPointIsStart ? fnMoveForward : fnMoveBackward,
fnGoCntnt );
pCmp->Exchange();
}
}
// iterate to next PaM in ring
pCmp = static_cast<SwPaM*>( pCmp->GetNext() );
}
while( pCmp != pCurCrsr );
SwRect aOld( aCharRect );
sal_Bool bFirst = sal_True;
SwCntntFrm *pFrm;
int nLoopCnt = 100;
SwShellCrsr* pShellCrsr = getShellCrsr( true );
do {
sal_Bool bAgainst;
do {
bAgainst = sal_False;
pFrm = pShellCrsr->GetCntntNode()->getLayoutFrm( GetLayout(),
&pShellCrsr->GetPtPos(), pShellCrsr->GetPoint(), sal_False );
// ist der Frm nicht mehr vorhanden, dann muss das gesamte Layout
// erzeugt werden, weil ja mal hier einer vorhanden war !!
if ( !pFrm )
{
do
{
CalcLayout();
pFrm = pShellCrsr->GetCntntNode()->getLayoutFrm( GetLayout(),
&pShellCrsr->GetPtPos(), pShellCrsr->GetPoint(), sal_False );
} while( !pFrm );
}
else if ( Imp()->IsIdleAction() )
//Wir stellen sicher, dass anstaendig Formatiert wurde
pFrm->PrepareCrsr();
// im geschuetzten Fly? aber bei Rahmenselektion ignorieren
if( !IsReadOnlyAvailable() && pFrm->IsProtected() &&
( !Imp()->GetDrawView() ||
!Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount() ) &&
(!pDoc->GetDocShell() ||
!pDoc->GetDocShell()->IsReadOnly() || bAllProtect ) )
{
// dann suche eine gueltige Position
sal_Bool bChgState = sal_True;
if( !FindValidCntntNode(!HasDrawView() ||
0 == Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount()))
{
// alles ist geschuetzt / versteckt -> besonderer Mode
if( bAllProtect )
bChgState = sal_False;
else
{
eMvState = MV_NONE; // Status fuers Crsr-Travelling
bAllProtect = sal_True;
if( GetDoc()->GetDocShell() )
{
GetDoc()->GetDocShell()->SetReadOnlyUI( sal_True );
CallChgLnk(); // UI bescheid sagen!
}
return;
}
}
if( bChgState )
{
sal_Bool bWasAllProtect = bAllProtect;
bAllProtect = sal_False;
if( bWasAllProtect && GetDoc()->GetDocShell() &&
GetDoc()->GetDocShell()->IsReadOnlyUI() )
{
GetDoc()->GetDocShell()->SetReadOnlyUI( sal_False );
CallChgLnk(); // UI bescheid sagen!
}
bAllProtect = sal_False;
bAgainst = sal_True; // nochmal den richigen Frm suchen
}
}
} while( bAgainst );
if( !( eFlags & SwCrsrShell::NOCALRECT ))
{
SwCrsrMoveState aTmpState( eMvState );
aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
aTmpState.bRealHeight = sal_True;
aTmpState.bRealWidth = IsOverwriteCrsr();
aTmpState.nCursorBidiLevel = pShellCrsr->GetCrsrBidiLevel();
// #i27615#,#i30453#
SwSpecialPos aSpecialPos;
aSpecialPos.nExtendRange = SP_EXTEND_RANGE_BEFORE;
if (pShellCrsr->IsInFrontOfLabel())
{
aTmpState.pSpecialPos = &aSpecialPos;
}
if( !pFrm->GetCharRect( aCharRect, *pShellCrsr->GetPoint(), &aTmpState ) )
{
Point& rPt = pShellCrsr->GetPtPos();
rPt = aCharRect.Center();
pFrm->GetCrsrOfst( pShellCrsr->GetPoint(), rPt, &aTmpState );
}
if( !pShellCrsr->HasMark() )
aCrsrHeight = aTmpState.aRealHeight;
else
{
aCrsrHeight.X() = 0;
aCrsrHeight.Y() = aTmpState.aRealHeight.Y() < 0 ?
-aCharRect.Width() : aCharRect.Height();
}
}
else
{
aCrsrHeight.X() = 0;
aCrsrHeight.Y() = aCharRect.Height();
}
if( !bFirst && aOld == aCharRect )
break;
// falls das Layout meint, nach dem 100 durchlauf ist man immer noch
// im Fluss, sollte man die akt. Pos. als gegeben hinnehmen!
// siehe Bug: 29658
if( !--nLoopCnt )
{
OSL_ENSURE( !this, "Endlosschleife? CharRect != OldCharRect ");
break;
}
aOld = aCharRect;
bFirst = sal_False;
// Cursor-Points auf die neuen Positionen setzen
pShellCrsr->GetPtPos().X() = aCharRect.Left();
pShellCrsr->GetPtPos().Y() = aCharRect.Top();
if( !(eFlags & SwCrsrShell::UPDOWN )) // alte Pos. von Up/Down loeschen
{
pFrm->Calc();
nUpDownX = pFrm->IsVertical() ?
aCharRect.Top() - pFrm->Frm().Top() :
aCharRect.Left() - pFrm->Frm().Left();
}
// Curosr in den sichtbaren Bereich scrollen
if( bHasFocus && eFlags & SwCrsrShell::SCROLLWIN &&
(HasSelection() || eFlags & SwCrsrShell::READONLY ||
!IsCrsrReadonly() || GetViewOptions()->IsSelectionInReadonly()) )
{
//JP 30.04.99: damit das EndAction, beim evtuellen Scrollen, den
// SV-Crsr nicht wieder sichtbar macht, wird hier das Flag
// gesichert und zurueckgesetzt.
sal_Bool bSav = bSVCrsrVis; bSVCrsrVis = sal_False;
MakeSelVisible();
bSVCrsrVis = bSav;
}
} while( eFlags & SwCrsrShell::SCROLLWIN );
if( pBlockCrsr )
RefreshBlockCursor();
if( !bIdleEnd && bHasFocus && !bBasicHideCrsr )
{
if( pTblCrsr )
pTblCrsr->SwSelPaintRects::Show();
else
{
pCurCrsr->SwSelPaintRects::Show();
if( pBlockCrsr )
{
SwShellCrsr* pNxt = dynamic_cast<SwShellCrsr*>(pCurCrsr->GetNext());
while( pNxt && pNxt != pCurCrsr )
{
pNxt->SwSelPaintRects::Show();
pNxt = dynamic_cast<SwShellCrsr*>(pNxt->GetNext());
}
}
}
}
eMvState = MV_NONE; // Status fuers Crsr-Travelling - GetCrsrOfst
if( pFrm && Imp()->IsAccessible() )
Imp()->InvalidateAccessibleCursorPosition( pFrm );
// switch from blinking cursor to read-only-text-selection cursor
static const long nNoBlinkTime = STYLE_CURSOR_NOBLINKTIME;
const long nBlinkTime = GetOut()->GetSettings().GetStyleSettings().
GetCursorBlinkTime();
if ( (IsCrsrReadonly() && GetViewOptions()->IsSelectionInReadonly()) ==
( nBlinkTime != nNoBlinkTime ) )
{
// non blinking cursor in read only - text selection mode
AllSettings aSettings = GetOut()->GetSettings();
StyleSettings aStyleSettings = aSettings.GetStyleSettings();
const long nNewBlinkTime = nBlinkTime == nNoBlinkTime ?
Application::GetSettings().GetStyleSettings().GetCursorBlinkTime() :
nNoBlinkTime;
aStyleSettings.SetCursorBlinkTime( nNewBlinkTime );
aSettings.SetStyleSettings( aStyleSettings );
GetOut()->SetSettings( aSettings );
}
if( bSVCrsrVis )
pVisCrsr->Show(); // wieder anzeigen
}
void SwCrsrShell::RefreshBlockCursor()
{
OSL_ENSURE( pBlockCrsr, "Don't call me without a block cursor" );
SwShellCrsr &rBlock = pBlockCrsr->getShellCrsr();
Point aPt = rBlock.GetPtPos();
SwCntntFrm* pFrm = rBlock.GetCntntNode()->getLayoutFrm( GetLayout(), &aPt, rBlock.GetPoint(), sal_False );
Point aMk;
if( pBlockCrsr->getEndPoint() && pBlockCrsr->getStartPoint() )
{
aPt = *pBlockCrsr->getStartPoint();
aMk = *pBlockCrsr->getEndPoint();
}
else
{
aPt = rBlock.GetPtPos();
if( pFrm )
{
if( pFrm->IsVertical() )
aPt.Y() = pFrm->Frm().Top() + GetUpDownX();
else
aPt.X() = pFrm->Frm().Left() + GetUpDownX();
}
aMk = rBlock.GetMkPos();
}
SwRect aRect( aMk, aPt );
aRect.Justify();
SwSelectionList aSelList( pFrm );
if( GetLayout()->FillSelection( aSelList, aRect ) )
{
SwCursor* pNxt = (SwCursor*)pCurCrsr->GetNext();
while( pNxt != pCurCrsr )
{
delete pNxt;
pNxt = (SwCursor*)pCurCrsr->GetNext();
}
std::list<SwPaM*>::iterator pStart = aSelList.getStart();
std::list<SwPaM*>::iterator pPam = aSelList.getEnd();
OSL_ENSURE( pPam != pStart, "FillSelection should deliver at least one PaM" );
pCurCrsr->SetMark();
--pPam;
// If there is only one text portion inside the rectangle, a simple
// selection is created
if( pPam == pStart )
{
*pCurCrsr->GetPoint() = *(*pPam)->GetPoint();
if( (*pPam)->HasMark() )
*pCurCrsr->GetMark() = *(*pPam)->GetMark();
else
pCurCrsr->DeleteMark();
delete *pPam;
pCurCrsr->SetColumnSelection( false );
}
else
{
// The order of the SwSelectionList has to be preserved but
// the order inside the ring created by CreateCrsr() is not like
// exspected => First create the selections before the last one
// downto the first selection.
// At least create the cursor for the last selection
--pPam;
*pCurCrsr->GetPoint() = *(*pPam)->GetPoint(); // n-1 (if n == number of selections)
if( (*pPam)->HasMark() )
*pCurCrsr->GetMark() = *(*pPam)->GetMark();
else
pCurCrsr->DeleteMark();
delete *pPam;
pCurCrsr->SetColumnSelection( true );
while( pPam != pStart )
{
--pPam;
SwShellCrsr* pNew = new SwShellCrsr( *pCurCrsr );
pNew->Insert( pCurCrsr, 0 );
pCurCrsr->Remove( 0, pCurCrsr->Count() );
pCurCrsr->DeleteMark();
*pCurCrsr->GetPoint() = *(*pPam)->GetPoint(); // n-2, n-3, .., 2, 1
if( (*pPam)->HasMark() )
{
pCurCrsr->SetMark();
*pCurCrsr->GetMark() = *(*pPam)->GetMark();
}
else
pCurCrsr->DeleteMark();
pCurCrsr->SetColumnSelection( true );
delete *pPam;
}
{
SwShellCrsr* pNew = new SwShellCrsr( *pCurCrsr );
pNew->Insert( pCurCrsr, 0 );
pCurCrsr->Remove( 0, pCurCrsr->Count() );
pCurCrsr->DeleteMark();
}
pPam = aSelList.getEnd();
--pPam;
*pCurCrsr->GetPoint() = *(*pPam)->GetPoint(); // n, the last selection
if( (*pPam)->HasMark() )
{
pCurCrsr->SetMark();
*pCurCrsr->GetMark() = *(*pPam)->GetMark();
}
else
pCurCrsr->DeleteMark();
pCurCrsr->SetColumnSelection( true );
delete *pPam;
}
}
}
// erzeuge eine Kopie vom Cursor und speicher diese im Stack
void SwCrsrShell::Push()
{
pCrsrStk = new SwShellCrsr( *this, *pCurCrsr->GetPoint(),
pCurCrsr->GetPtPos(), pCrsrStk );
if( pCurCrsr->HasMark() )
{
pCrsrStk->SetMark();
*pCrsrStk->GetMark() = *pCurCrsr->GetMark();
}
}
/*
* Loescht einen Cursor (gesteuert durch bOldCrsr)
* - vom Stack oder ( bOldCrsr = sal_True )
* - den aktuellen und der auf dem Stack stehende wird zum aktuellen
*
* Return: es war auf dem Stack noch einer vorhanden
*/
sal_Bool SwCrsrShell::Pop( sal_Bool bOldCrsr )
{
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
// noch weitere vorhanden ?
if( 0 == pCrsrStk )
return sal_False;
SwShellCrsr *pTmp = 0, *pOldStk = pCrsrStk;
// der Nachfolger wird der Aktuelle
if( pCrsrStk->GetNext() != pCrsrStk )
{
pTmp = dynamic_cast<SwShellCrsr*>(pCrsrStk->GetNext());
}
if( bOldCrsr ) // loesche vom Stack
delete pCrsrStk; //
pCrsrStk = pTmp; // neu zuweisen
if( !bOldCrsr )
{
SwCrsrSaveState aSaveState( *pCurCrsr );
// wurde die sichtbare SSelection nicht veraendert
if( pOldStk->GetPtPos() == pCurCrsr->GetPtPos() ||
pOldStk->GetPtPos() == pCurCrsr->GetMkPos() )
{
// "Selektions-Rechtecke" verschieben
pCurCrsr->Insert( pOldStk, 0 );
pOldStk->Remove( 0, pOldStk->Count() );
}
if( pOldStk->HasMark() )
{
pCurCrsr->SetMark();
*pCurCrsr->GetMark() = *pOldStk->GetMark();
pCurCrsr->GetMkPos() = pOldStk->GetMkPos();
}
else
// keine Selection also alte aufheben und auf die alte Pos setzen
pCurCrsr->DeleteMark();
*pCurCrsr->GetPoint() = *pOldStk->GetPoint();
pCurCrsr->GetPtPos() = pOldStk->GetPtPos();
delete pOldStk;
if( !pCurCrsr->IsInProtectTable( sal_True ) &&
!pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ) )
UpdateCrsr(); // akt. Cursor Updaten
}
return sal_True;
}
/*
* Verbinde zwei Cursor miteinander.
* Loesche vom Stack den obersten und setzen dessen GetMark im Aktuellen.
*/
void SwCrsrShell::Combine()
{
// noch weitere vorhanden ?
if( 0 == pCrsrStk )
return;
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
SwCrsrSaveState aSaveState( *pCurCrsr );
if( pCrsrStk->HasMark() ) // nur wenn GetMark gesetzt wurde
{
bool const bResult =
CheckNodesRange( pCrsrStk->GetMark()->nNode, pCurCrsr->GetPoint()->nNode, sal_True );
OSL_ENSURE(bResult, "StackCrsr & act. Crsr not in same Section.");
(void) bResult; // non-debug: unused
// kopiere das GetMark
if( !pCurCrsr->HasMark() )
pCurCrsr->SetMark();
*pCurCrsr->GetMark() = *pCrsrStk->GetMark();
pCurCrsr->GetMkPos() = pCrsrStk->GetMkPos();
}
SwShellCrsr * pTmp = 0;
if( pCrsrStk->GetNext() != pCrsrStk )
{
pTmp = dynamic_cast<SwShellCrsr*>(pCrsrStk->GetNext());
}
delete pCrsrStk;
pCrsrStk = pTmp;
if( !pCurCrsr->IsInProtectTable( sal_True ) &&
!pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE |
nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ) )
UpdateCrsr(); // akt. Cursor Updaten
}
void SwCrsrShell::HideCrsrs()
{
if( !bHasFocus || bBasicHideCrsr )
return;
// ist Cursor sichtbar, dann verstecke den SV-Cursor
if( pVisCrsr->IsVisible() )
{
SET_CURR_SHELL( this );
pVisCrsr->Hide();
}
// hebe die Invertierung der SSelection auf
SwShellCrsr* pAktCrsr = pTblCrsr ? pTblCrsr : pCurCrsr;
pAktCrsr->Hide();
}
void SwCrsrShell::ShowCrsrs( sal_Bool bCrsrVis )
{
if( !bHasFocus || bAllProtect || bBasicHideCrsr )
return;
SET_CURR_SHELL( this );
SwShellCrsr* pAktCrsr = pTblCrsr ? pTblCrsr : pCurCrsr;
pAktCrsr->Show();
if( bSVCrsrVis && bCrsrVis ) // auch SV-Cursor wieder anzeigen
pVisCrsr->Show();
}
// Methoden zum Anzeigen bzw. Verstecken des sichtbaren Text-Cursors
void SwCrsrShell::ShowCrsr()
{
if( !bBasicHideCrsr )
{
bSVCrsrVis = sal_True;
UpdateCrsr();
}
}
void SwCrsrShell::HideCrsr()
{
if( !bBasicHideCrsr )
{
bSVCrsrVis = sal_False;
// evt. die sel. Bereiche aufheben !!
SET_CURR_SHELL( this );
pVisCrsr->Hide();
}
}
void SwCrsrShell::ShLooseFcs()
{
if( !bBasicHideCrsr )
HideCrsrs();
bHasFocus = sal_False;
}
void SwCrsrShell::ShGetFcs( sal_Bool bUpdate )
{
bHasFocus = sal_True;
if( !bBasicHideCrsr && VisArea().Width() )
{
UpdateCrsr( static_cast<sal_uInt16>( bUpdate ?
SwCrsrShell::CHKRANGE|SwCrsrShell::SCROLLWIN
: SwCrsrShell::CHKRANGE ) );
ShowCrsrs( bSVCrsrVis ? sal_True : sal_False );
}
}
// gebe den aktuellen Frame, in dem der Cursor steht, zurueck
SwCntntFrm *SwCrsrShell::GetCurrFrm( const sal_Bool bCalcFrm ) const
{
SET_CURR_SHELL( (ViewShell*)this );
SwCntntFrm *pRet = 0;
SwCntntNode *pNd = pCurCrsr->GetCntntNode();
if ( pNd )
{
if ( bCalcFrm )
{
const sal_uInt16* pST = &nStartAction;
++(*((sal_uInt16*)pST));
const Size aOldSz( GetDocSize() );
pRet = pNd->getLayoutFrm( GetLayout(), &pCurCrsr->GetPtPos(), pCurCrsr->GetPoint() );
--(*((sal_uInt16*)pST));
if( aOldSz != GetDocSize() )
((SwCrsrShell*)this)->SizeChgNotify();
}
else
pRet = pNd->getLayoutFrm( GetLayout(), &pCurCrsr->GetPtPos(), pCurCrsr->GetPoint(), sal_False);
}
return pRet;
}
// alle Attribut/Format-Aenderungen am akt. Node werden an den
// Link weitergeleitet.
void SwCrsrShell::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
{
const sal_uInt16 nWhich = pOld ?
pOld->Which() :
pNew ?
pNew->Which() :
sal::static_int_cast<sal_uInt16>(RES_MSG_BEGIN);
if( bCallChgLnk &&
( nWhich < RES_MSG_BEGIN || nWhich >= RES_MSG_END ||
nWhich == RES_FMT_CHG || nWhich == RES_UPDATE_ATTR ||
nWhich == RES_ATTRSET_CHG ))
// die Messages werden nicht weitergemeldet
//MA 07. Apr. 94 fix(6681): RES_UPDATE_ATTR wird implizit vom
//SwTxtNode::Insert(SwTxtHint*, sal_uInt16) abgesetzt; hier wird reagiert und
//vom Insert brauch nicht mehr die Keule RES_FMT_CHG versandt werden.
CallChgLnk();
if( aGrfArrivedLnk.IsSet() &&
( RES_GRAPHIC_ARRIVED == nWhich || RES_GRAPHIC_SWAPIN == nWhich ))
aGrfArrivedLnk.Call( this );
}
// Abfrage, ob der aktuelle Cursor eine Selektion aufspannt,
// also, ob GetMark gesetzt und SPoint und GetMark unterschiedlich sind.
sal_Bool SwCrsrShell::HasSelection() const
{
const SwPaM* pCrsr = getShellCrsr( true );
return( IsTableMode() || ( pCrsr->HasMark() &&
*pCrsr->GetPoint() != *pCrsr->GetMark())
? sal_True : sal_False );
}
void SwCrsrShell::CallChgLnk()
{
// innerhalb von Start-/End-Action kein Call, sondern nur merken,
// das sich etwas geaendert hat. Wird bei EndAction beachtet.
if( BasicActionPend() )
bChgCallFlag = sal_True; // das Change merken
else if( aChgLnk.IsSet() )
{
if( bCallChgLnk )
aChgLnk.Call( this );
bChgCallFlag = sal_False; // Flag zuruecksetzen
}
}
// returne den am akt.Cursor selektierten Text eines Nodes.
String SwCrsrShell::GetSelTxt() const
{
String aTxt;
if( pCurCrsr->GetPoint()->nNode.GetIndex() ==
pCurCrsr->GetMark()->nNode.GetIndex() )
{
SwTxtNode* pTxtNd = pCurCrsr->GetNode()->GetTxtNode();
if( pTxtNd )
{
xub_StrLen nStt = pCurCrsr->Start()->nContent.GetIndex();
aTxt = pTxtNd->GetExpandTxt( nStt,
pCurCrsr->End()->nContent.GetIndex() - nStt );
}
}
return aTxt;
}
// gebe nur den Text ab der akt. Cursor Position zurueck (bis zum NodeEnde)
String SwCrsrShell::GetText() const
{
String aTxt;
if( pCurCrsr->GetPoint()->nNode.GetIndex() ==
pCurCrsr->GetMark()->nNode.GetIndex() )
{
SwTxtNode* pTxtNd = pCurCrsr->GetNode()->GetTxtNode();
if( pTxtNd )
aTxt = pTxtNd->GetTxt().Copy(
pCurCrsr->GetPoint()->nContent.GetIndex() );
}
return aTxt;
}
// hole vom Start/Ende der akt. SSelection das nte Zeichen
sal_Unicode SwCrsrShell::GetChar( sal_Bool bEnd, long nOffset )
{
if( IsTableMode() ) // im TabelleMode nicht moeglich
return 0;
const SwPosition* pPos = !pCurCrsr->HasMark() ? pCurCrsr->GetPoint()
: bEnd ? pCurCrsr->End() : pCurCrsr->Start();
SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode();
if( !pTxtNd )
return 0;
xub_StrLen nPos = pPos->nContent.GetIndex();
const String& rStr = pTxtNd->GetTxt();
sal_Unicode cCh = 0;
if( ((nPos+nOffset) >= 0 ) && (nPos+nOffset) < rStr.Len() )
cCh = rStr.GetChar( static_cast<xub_StrLen>(nPos+nOffset) );
return cCh;
}
// erweiter die akt. SSelection am Anfang/Ende um n Zeichen
sal_Bool SwCrsrShell::ExtendSelection( sal_Bool bEnd, xub_StrLen nCount )
{
if( !pCurCrsr->HasMark() || IsTableMode() )
return sal_False; // keine Selektion
SwPosition* pPos = bEnd ? pCurCrsr->End() : pCurCrsr->Start();
SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode();
OSL_ENSURE( pTxtNd, "kein TextNode, wie soll erweitert werden?" );
xub_StrLen nPos = pPos->nContent.GetIndex();
if( bEnd )
{
if( ( nPos + nCount ) <= pTxtNd->GetTxt().Len() )
nPos = nPos + nCount;
else
return sal_False; // nicht mehr moeglich
}
else if( nPos >= nCount )
nPos = nPos - nCount;
else
return sal_False; // nicht mehr moeglich
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
pPos->nContent = nPos;
UpdateCrsr();
return sal_True;
}
// setze nur den sichtbaren Cursor an die angegebene Dokument-Pos.
// returnt sal_False: wenn der SPoint vom Layout korrigiert wurde.
sal_Bool SwCrsrShell::SetVisCrsr( const Point &rPt )
{
SET_CURR_SHELL( this );
Point aPt( rPt );
SwPosition aPos( *pCurCrsr->GetPoint() );
SwCrsrMoveState aTmpState( MV_SETONLYTEXT );
aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
aTmpState.bRealHeight = sal_True;
sal_Bool bRet = GetLayout()->GetCrsrOfst( &aPos, aPt /*, &aTmpState*/ );
SetInFrontOfLabel( sal_False ); // #i27615#
// nur in TextNodes anzeigen !!
SwTxtNode* pTxtNd = aPos.nNode.GetNode().GetTxtNode();
if( !pTxtNd )
return sal_False;
const SwSectionNode* pSectNd = pTxtNd->FindSectionNode();
if( pSectNd && (pSectNd->GetSection().IsHiddenFlag() ||
( !IsReadOnlyAvailable() &&
pSectNd->GetSection().IsProtectFlag())) )
return sal_False;
SwCntntFrm *pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt, &aPos );
if ( Imp()->IsIdleAction() )
pFrm->PrepareCrsr();
SwRect aTmp( aCharRect );
pFrm->GetCharRect( aCharRect, aPos, &aTmpState );
if( aTmp == aCharRect && // BUG 10137: bleibt der Cursor auf der
pVisCrsr->IsVisible() ) // Position nicht hidden & showen
return sal_True;
pVisCrsr->Hide(); // sichtbaren Cursor immer verstecken
if( IsScrollMDI( this, aCharRect ))
{
MakeVisible( aCharRect );
pCurCrsr->Show();
}
{
if( aTmpState.bRealHeight )
aCrsrHeight = aTmpState.aRealHeight;
else
{
aCrsrHeight.X() = 0;
aCrsrHeight.Y() = aCharRect.Height();
}
pVisCrsr->SetDragCrsr( sal_True );
pVisCrsr->Show(); // wieder anzeigen
}
return bRet;
}
sal_Bool SwCrsrShell::IsOverReadOnlyPos( const Point& rPt ) const
{
Point aPt( rPt );
SwPaM aPam( *pCurCrsr->GetPoint() );
GetLayout()->GetCrsrOfst( aPam.GetPoint(), aPt );
// Formular view
return aPam.HasReadonlySel( GetViewOptions()->IsFormView() );
}
sal_Bool SwCrsrShell::IsOverHeaderFooterPos( const Point& rPt ) const
{
Point aPt( rPt );
SwPaM aPam( *pCurCrsr->GetPoint() );
GetLayout()->GetCrsrOfst( aPam.GetPoint(), aPt );
return GetDoc()->IsInHeaderFooter( aPam.GetPoint()->nNode );
}
// returne die Anzahl der Cursor im Ring (Flag besagt ob man nur
// aufgepspannte haben will - sprich etwas selektiert ist (Basic))
sal_uInt16 SwCrsrShell::GetCrsrCnt( sal_Bool bAll ) const
{
Ring* pTmp = GetCrsr()->GetNext();
sal_uInt16 n = (bAll || ( pCurCrsr->HasMark() &&
*pCurCrsr->GetPoint() != *pCurCrsr->GetMark())) ? 1 : 0;
while( pTmp != pCurCrsr )
{
if( bAll || ( ((SwPaM*)pTmp)->HasMark() &&
*((SwPaM*)pTmp)->GetPoint() != *((SwPaM*)pTmp)->GetMark()))
++n;
pTmp = pTmp->GetNext();
}
return n;
}
sal_Bool SwCrsrShell::IsStartOfDoc() const
{
if( pCurCrsr->GetPoint()->nContent.GetIndex() )
return sal_False;
// Hinter EndOfIcons kommt die Content-Section (EndNd+StNd+CntntNd)
SwNodeIndex aIdx( GetDoc()->GetNodes().GetEndOfExtras(), 2 );
if( !aIdx.GetNode().IsCntntNode() )
GetDoc()->GetNodes().GoNext( &aIdx );
return aIdx == pCurCrsr->GetPoint()->nNode;
}
sal_Bool SwCrsrShell::IsEndOfDoc() const
{
SwNodeIndex aIdx( GetDoc()->GetNodes().GetEndOfContent(), -1 );
SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
if( !pCNd )
pCNd = GetDoc()->GetNodes().GoPrevious( &aIdx );
return aIdx == pCurCrsr->GetPoint()->nNode &&
pCNd->Len() == pCurCrsr->GetPoint()->nContent.GetIndex();
}
// loesche alle erzeugten Crsr, setze den Tabellen-Crsr und den letzten
// Cursor auf seinen TextNode (oder StartNode?).
// Beim naechsten ::GetCrsr werden sie wieder alle erzeugt
// Wird fuers Drag&Drop / ClipBorad-Paste in Tabellen benoetigt.
sal_Bool SwCrsrShell::ParkTblCrsr()
{
if( !pTblCrsr )
return sal_False;
pTblCrsr->ParkCrsr();
while( pCurCrsr->GetNext() != pCurCrsr )
delete pCurCrsr->GetNext();
// vom Cursor !immer! SPoint und Mark umsetzen
pCurCrsr->SetMark();
*pCurCrsr->GetMark() = *pCurCrsr->GetPoint() = *pTblCrsr->GetPoint();
pCurCrsr->DeleteMark();
return sal_True;
}
/***********************************************************************
#* Class : SwCrsrShell
#* Methode : ParkCrsr
#* Beschreibung: Vernichtet Selektionen und zus. Crsr aller Shell der
#* verbleibende Crsr der Shell wird geparkt.
#***********************************************************************/
void SwCrsrShell::_ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing )
{
const SwPosition *pStt = pDelRg->Start(),
*pEnd = pDelRg->GetPoint() == pStt ? pDelRg->GetMark() : pDelRg->GetPoint();
SwPaM *pTmpDel = 0, *pTmp = *ppDelRing;
// durchsuche den gesamten Ring
sal_Bool bGoNext;
do {
const SwPosition *pTmpStt = pTmp->Start(),
*pTmpEnd = pTmp->GetPoint() == pTmpStt ?
pTmp->GetMark() : pTmp->GetPoint();
/*
* liegt ein SPoint oder GetMark innerhalb vom Crsr-Bereich
* muss der alte Bereich aufgehoben werden.
* Beim Vergleich ist darauf zu achten, das End() nicht mehr zum
* Bereich gehoert !
*/
if( *pStt <= *pTmpStt )
{
if( *pEnd > *pTmpStt ||
( *pEnd == *pTmpStt && *pEnd == *pTmpEnd ))
pTmpDel = pTmp;
}
else
if( *pStt < *pTmpEnd )
pTmpDel = pTmp;
bGoNext = sal_True;
if( pTmpDel ) // ist der Pam im Bereich ?? loesche ihn
{
sal_Bool bDelete = sal_True;
if( *ppDelRing == pTmpDel )
{
if( *ppDelRing == pCurCrsr )
{
if( sal_True == ( bDelete = GoNextCrsr() ))
{
bGoNext = sal_False;
pTmp = (SwPaM*)pTmp->GetNext();
}
}
else
bDelete = sal_False; // StackCrsr nie loeschen !!
}
if( bDelete )
delete pTmpDel; // hebe alten Bereich auf
else
{
pTmpDel->GetPoint()->nContent.Assign( 0, 0 );
pTmpDel->GetPoint()->nNode = 0;
pTmpDel->SetMark();
pTmpDel->DeleteMark();
}
pTmpDel = 0;
}
else if( !pTmp->HasMark() ) // sorge auf jedenfall dafuer, das
{ // nicht benutzte Indizies beachtet werden!
pTmp->SetMark(); // SPoint liegt nicht im Bereich,
pTmp->DeleteMark(); // aber vielleicht GetMark, also setzen
}
if( bGoNext )
pTmp = (SwPaM*)pTmp->GetNext();
} while( !bGoNext || *ppDelRing != pTmp );
}
void SwCrsrShell::ParkCrsr( const SwNodeIndex &rIdx )
{
SwNode *pNode = &rIdx.GetNode();
// erzeuge einen neuen Pam
SwPaM * pNew = new SwPaM( *GetCrsr()->GetPoint() );
if( pNode->GetStartNode() )
{
if( ( pNode = pNode->StartOfSectionNode())->IsTableNode() )
{
// der angegebene Node steht in einer Tabelle, also Parke
// den Crsr auf dem Tabellen-Node (ausserhalb der Tabelle)
pNew->GetPoint()->nNode = *pNode->StartOfSectionNode();
}
else // also auf dem StartNode selbst.
// Dann immer ueber seinen EndNode den StartNode erfragen !!!
// (StartOfSection vom StartNode ist der Parent !)
pNew->GetPoint()->nNode = *pNode->EndOfSectionNode()->StartOfSectionNode();
}
else
pNew->GetPoint()->nNode = *pNode->StartOfSectionNode();
pNew->SetMark();
pNew->GetPoint()->nNode = *pNode->EndOfSectionNode();
//Alle Shells wollen etwas davon haben.
ViewShell *pTmp = this;
do {
if( pTmp->IsA( TYPE( SwCrsrShell )))
{
SwCrsrShell* pSh = (SwCrsrShell*)pTmp;
if( pSh->pCrsrStk )
pSh->_ParkPams( pNew, &pSh->pCrsrStk );
pSh->_ParkPams( pNew, &pSh->pCurCrsr );
if( pSh->pTblCrsr )
{
// setze den Tabellen Cursor immer auf 0, den aktuellen
// immer auf den Anfang der Tabelle
SwPaM* pTCrsr = pSh->GetTblCrs();
SwNode* pTblNd = pTCrsr->GetPoint()->nNode.GetNode().FindTableNode();
if ( pTblNd )
{
pTCrsr->GetPoint()->nContent.Assign( 0, 0 );
pTCrsr->GetPoint()->nNode = 0;
pTCrsr->SetMark();
pTCrsr->DeleteMark();
pSh->pCurCrsr->GetPoint()->nNode = *pTblNd;
}
}
}
} while ( this != (pTmp = (ViewShell*)pTmp->GetNext() ));
delete pNew;
}
//=========================================================================
/*
* der Copy-Constructor
* Cursor-Position kopieren, in den Ring eingetragen.
* Alle Ansichten eines Dokumentes stehen im Ring der Shells.
*/
SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin )
: ViewShell( rShell, pInitWin ),
SwModify( 0 ), pCrsrStk( 0 ), pBlockCrsr( 0 ), pTblCrsr( 0 ),
pBoxIdx( 0 ), pBoxPtr( 0 ), nCrsrMove( 0 ), nBasicActionCnt( 0 ),
eMvState( MV_NONE ),
sMarkedListId(),
nMarkedListLevel( 0 )
{
SET_CURR_SHELL( this );
// Nur die Position vom aktuellen Cursor aus der Copy-Shell uebernehmen
pCurCrsr = new SwShellCrsr( *this, *(rShell.pCurCrsr->GetPoint()) );
pCurCrsr->GetCntntNode()->Add( this );
bAllProtect = bVisPortChgd = bChgCallFlag = bInCMvVisportChgd =
bGCAttr = bIgnoreReadonly = bSelTblCells = bBasicHideCrsr =
bOverwriteCrsr = sal_False;
bCallChgLnk = bHasFocus = bSVCrsrVis = bAutoUpdateCells = sal_True;
bSetCrsrInReadOnly = sal_True;
pVisCrsr = new SwVisCrsr( this );
mbMacroExecAllowed = rShell.IsMacroExecAllowed();
}
/*
* der normale Constructor
*/
SwCrsrShell::SwCrsrShell( SwDoc& rDoc, Window *pInitWin,
const SwViewOption *pInitOpt )
: ViewShell( rDoc, pInitWin, pInitOpt ),
SwModify( 0 ), pCrsrStk( 0 ), pBlockCrsr( 0 ), pTblCrsr( 0 ),
pBoxIdx( 0 ), pBoxPtr( 0 ), nCrsrMove( 0 ), nBasicActionCnt( 0 ),
eMvState( MV_NONE ), // state for crsr-travelling - GetCrsrOfst
sMarkedListId(),
nMarkedListLevel( 0 )
{
SET_CURR_SHELL( this );
/*
* Erzeugen des initialen Cursors, wird auf die erste
* Inhaltsposition gesetzt
*/
SwNodes& rNds = rDoc.GetNodes();
SwNodeIndex aNodeIdx( *rNds.GetEndOfContent().StartOfSectionNode() );
SwCntntNode* pCNd = rNds.GoNext( &aNodeIdx ); // gehe zum 1. ContentNode
pCurCrsr = new SwShellCrsr( *this, SwPosition( aNodeIdx, SwIndex( pCNd, 0 )));
// melde die Shell beim akt. Node als abhaengig an, dadurch koennen alle
// Attribut-Aenderungen ueber den Link weiter gemeldet werden.
pCNd->Add( this );
bAllProtect = bVisPortChgd = bChgCallFlag = bInCMvVisportChgd =
bGCAttr = bIgnoreReadonly = bSelTblCells = bBasicHideCrsr =
bOverwriteCrsr = sal_False;
bCallChgLnk = bHasFocus = bSVCrsrVis = bAutoUpdateCells = sal_True;
bSetCrsrInReadOnly = sal_True;
pVisCrsr = new SwVisCrsr( this );
mbMacroExecAllowed = true;
}
SwCrsrShell::~SwCrsrShell()
{
// wenn es nicht die letzte View so sollte zu mindest das
// Feld noch geupdatet werden.
if( GetNext() != this )
CheckTblBoxCntnt( pCurCrsr->GetPoint() );
else
ClearTblBoxCntnt();
delete pVisCrsr;
delete pBlockCrsr;
delete pTblCrsr;
/*
* Freigabe der Cursor
*/
while(pCurCrsr->GetNext() != pCurCrsr)
delete pCurCrsr->GetNext();
delete pCurCrsr;
// Stack freigeben
if( pCrsrStk )
{
while( pCrsrStk->GetNext() != pCrsrStk )
delete pCrsrStk->GetNext();
delete pCrsrStk;
}
// JP 27.07.98: Bug 54025 - ggfs. den HTML-Parser, der als Client in
// der CursorShell haengt keine Chance geben, sich an den
// TextNode zu haengen.
if( GetRegisteredIn() )
GetRegisteredInNonConst()->Remove( this );
}
SwShellCrsr* SwCrsrShell::getShellCrsr( bool bBlock )
{
if( pTblCrsr )
return pTblCrsr;
if( pBlockCrsr && bBlock )
return &pBlockCrsr->getShellCrsr();
return pCurCrsr;
}
//Sollte fuer das Clipboard der WaitPtr geschaltet werden?
//Warten bei TableMode, Mehrfachselektion und mehr als x Selektieren Absaetzen.
sal_Bool SwCrsrShell::ShouldWait() const
{
if ( IsTableMode() || GetCrsrCnt() > 1 )
return sal_True;
if( HasDrawView() && GetDrawView()->GetMarkedObjectList().GetMarkCount() )
return sal_True;
SwPaM* pPam = GetCrsr();
return pPam->Start()->nNode.GetIndex() + 10 <
pPam->End()->nNode.GetIndex();
}
sal_uInt16 SwCrsrShell::UpdateTblSelBoxes()
{
if( pTblCrsr && ( pTblCrsr->IsChgd() || !pTblCrsr->GetBoxesCount() ))
GetLayout()->MakeTblCrsrs( *pTblCrsr );
return pTblCrsr ? pTblCrsr->GetBoxesCount() : 0;
}
// zeige das akt. selektierte "Object" an
void SwCrsrShell::MakeSelVisible()
{
OSL_ENSURE( bHasFocus, "kein Focus aber Cursor sichtbar machen?" );
if( aCrsrHeight.Y() < aCharRect.Height() && aCharRect.Height() > VisArea().Height() )
{
SwRect aTmp( aCharRect );
long nDiff = aCharRect.Height() - VisArea().Height();
if( nDiff < aCrsrHeight.X() )
aTmp.Top( nDiff + aCharRect.Top() );
else
{
aTmp.Top( aCrsrHeight.X() + aCharRect.Top() );
aTmp.Height( aCrsrHeight.Y() );
}
if( !aTmp.HasArea() )
{
aTmp.SSize().Height() += 1;
aTmp.SSize().Width() += 1;
}
MakeVisible( aTmp );
}
else
{
if( aCharRect.HasArea() )
MakeVisible( aCharRect );
else
{
SwRect aTmp( aCharRect );
aTmp.SSize().Height() += 1; aTmp.SSize().Width() += 1;
MakeVisible( aTmp );
}
}
}
// suche eine gueltige ContentPosition (nicht geschuetzt/nicht versteckt)
sal_Bool SwCrsrShell::FindValidCntntNode( sal_Bool bOnlyText )
{
if( pTblCrsr ) // was soll ich jetzt machen ??
{
OSL_ENSURE( !this, "TabellenSelection nicht aufgehoben!" );
return sal_False;
}
//JP 28.10.97: Bug 45129 - im UI-ReadOnly ist alles erlaubt
if( !bAllProtect && GetDoc()->GetDocShell() &&
GetDoc()->GetDocShell()->IsReadOnlyUI() )
return sal_True;
// dann raus da!
if( pCurCrsr->HasMark() )
ClearMark();
// als erstes mal auf Rahmen abpruefen
SwNodeIndex& rNdIdx = pCurCrsr->GetPoint()->nNode;
sal_uLong nNdIdx = rNdIdx.GetIndex(); // sichern
SwNodes& rNds = pDoc->GetNodes();
SwCntntNode* pCNd = rNdIdx.GetNode().GetCntntNode();
const SwCntntFrm * pFrm;
if( pCNd && 0 != (pFrm = pCNd->getLayoutFrm( GetLayout(),0,pCurCrsr->GetPoint(),sal_False)) &&
!IsReadOnlyAvailable() && pFrm->IsProtected() &&
nNdIdx < rNds.GetEndOfExtras().GetIndex() )
{
// geschuetzter Rahmen ueberspringen
SwPaM aPam( *pCurCrsr->GetPoint() );
aPam.SetMark();
aPam.GetMark()->nNode = rNds.GetEndOfContent();
aPam.GetPoint()->nNode = *pCNd->EndOfSectionNode();
sal_Bool bFirst = sal_False;
if( 0 == (pCNd = ::GetNode( aPam, bFirst, fnMoveForward, sal_False )))
{
aPam.GetMark()->nNode = *rNds.GetEndOfPostIts().StartOfSectionNode();
pCNd = ::GetNode( aPam, bFirst, fnMoveBackward, sal_False );
}
if( !pCNd ) // sollte nie passieren !!!
{
rNdIdx = nNdIdx; // alten Node zurueck
return sal_False;
}
*pCurCrsr->GetPoint() = *aPam.GetPoint();
}
else if( bOnlyText && pCNd && pCNd->IsNoTxtNode() )
{
// dann auf den Anfang vom Doc stellen
rNdIdx = pDoc->GetNodes().GetEndOfExtras();
pCurCrsr->GetPoint()->nContent.Assign( pDoc->GetNodes().GoNext(
&rNdIdx ), 0 );
nNdIdx = rNdIdx.GetIndex();
}
sal_Bool bOk = sal_True;
// #i9059# cursor may not stand in protected cells
// (unless cursor in protected areas is OK.)
const SwTableNode* pTableNode = rNdIdx.GetNode().FindTableNode();
if( !IsReadOnlyAvailable() &&
pTableNode != NULL && rNdIdx.GetNode().IsProtect() )
{
// we're in a table, and we're in a protected area, so we're
// probably in a protected cell.
// move forward into non-protected area.
SwPaM aPam( rNdIdx.GetNode(), 0 );
while( aPam.GetNode()->IsProtect() &&
aPam.Move( fnMoveForward, fnGoCntnt ) )
; // nothing to do in the loop; the aPam.Move does the moving!
// didn't work? then go backwards!
if( aPam.GetNode()->IsProtect() )
{
SwPaM aTmpPaM( rNdIdx.GetNode(), 0 );
aPam = aTmpPaM;
while( aPam.GetNode()->IsProtect() &&
aPam.Move( fnMoveBackward, fnGoCntnt ) )
; // nothing to do in the loop; the aPam.Move does the moving!
}
// if we're successful, set the new position
if( ! aPam.GetNode()->IsProtect() )
{
*pCurCrsr->GetPoint() = *aPam.GetPoint();
}
}
// in einem geschuetzten Bereich
const SwSectionNode* pSectNd = rNdIdx.GetNode().FindSectionNode();
if( pSectNd && ( pSectNd->GetSection().IsHiddenFlag() ||
( !IsReadOnlyAvailable() &&
pSectNd->GetSection().IsProtectFlag() )) )
{
typedef SwCntntNode* (SwNodes:: *FNGoSection)( SwNodeIndex *, int, int ) const;
FNGoSection funcGoSection = &SwNodes::GoNextSection;
bOk = sal_False;
for( int nLoopCnt = 0; !bOk && nLoopCnt < 2; ++nLoopCnt )
{
sal_Bool bWeiter;
do {
bWeiter = sal_False;
while( 0 != ( pCNd = (rNds.*funcGoSection)( &rNdIdx,
sal_True, !IsReadOnlyAvailable() )) )
{
// in eine Tabelle verschoben -> pruefe ob die
// vielleicht geschuetzt ist
if( pCNd->FindTableNode() )
{
SwCallLink aTmp( *this );
SwCrsrSaveState aSaveState( *pCurCrsr );
aTmp.nNdTyp = 0; // im DTOR nichts machen!
if( !pCurCrsr->IsInProtectTable( sal_True, sal_True ) )
{
const SwSectionNode* pSNd = pCNd->FindSectionNode();
if( !pSNd || !pSNd->GetSection().IsHiddenFlag()
|| (!IsReadOnlyAvailable() &&
pSNd->GetSection().IsProtectFlag() ))
{
bOk = sal_True;
break; // eine nicht geschuetzte Zelle gef.
}
continue; // dann weiter suchen
}
}
else
{
bOk = sal_True;
break; // eine nicht geschuetzte Zelle gef.
}
}
if( bOk && rNdIdx.GetIndex() < rNds.GetEndOfExtras().GetIndex() )
{
// Teste mal auf Fly - kann auch noch geschuetzt sein!!
if( 0 == (pFrm = pCNd->getLayoutFrm( GetLayout(),0,0,sal_False)) ||
( !IsReadOnlyAvailable() && pFrm->IsProtected() ) ||
( bOnlyText && pCNd->IsNoTxtNode() ) )
{
// dann weiter suchen!
bOk = sal_False;
bWeiter = sal_True;
}
}
} while( bWeiter );
if( !bOk )
{
if( !nLoopCnt )
funcGoSection = &SwNodes::GoPrevSection;
rNdIdx = nNdIdx;
}
}
}
if( bOk )
{
pCNd = rNdIdx.GetNode().GetCntntNode();
xub_StrLen nCntnt = rNdIdx.GetIndex() < nNdIdx ? pCNd->Len() : 0;
pCurCrsr->GetPoint()->nContent.Assign( pCNd, nCntnt );
}
else
{
pCNd = rNdIdx.GetNode().GetCntntNode();
// falls Cursor im versteckten Bereich ist, auf jedenfall schon mal
// verschieben!!
if( !pCNd || !pCNd->getLayoutFrm( GetLayout(),0,0,sal_False) )
{
SwCrsrMoveState aTmpState( MV_NONE );
aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
GetLayout()->GetCrsrOfst( pCurCrsr->GetPoint(), pCurCrsr->GetPtPos(),
&aTmpState );
}
}
return bOk;
}
void SwCrsrShell::NewCoreSelection()
{
}
sal_Bool SwCrsrShell::IsCrsrReadonly() const
{
if ( GetViewOptions()->IsReadonly() ||
// Formular view
GetViewOptions()->IsFormView() )
{
SwFrm *pFrm = GetCurrFrm( sal_False );
const SwFlyFrm* pFly;
const SwSection* pSection;
if( pFrm && pFrm->IsInFly() &&
(pFly = pFrm->FindFlyFrm())->GetFmt()->GetEditInReadonly().GetValue() &&
pFly->Lower() &&
!pFly->Lower()->IsNoTxtFrm() &&
!GetDrawView()->GetMarkedObjectList().GetMarkCount() )
{
return sal_False;
}
// edit in readonly sections
else if ( pFrm && pFrm->IsInSct() &&
0 != ( pSection = pFrm->FindSctFrm()->GetSection() ) &&
pSection->IsEditInReadonlyFlag() )
{
return sal_False;
}
return sal_True;
}
return sal_False;
}
// darf der Cursor in ReadOnlyBereiche?
void SwCrsrShell::SetReadOnlyAvailable( sal_Bool bFlag )
{
// im GlobalDoc darf NIE umgeschaltet werden
if( (!GetDoc()->GetDocShell() ||
!GetDoc()->GetDocShell()->IsA( SwGlobalDocShell::StaticType() )) &&
bFlag != bSetCrsrInReadOnly )
{
// wenn das Flag ausgeschaltet wird, dann muessen erstmal alle
// Selektionen aufgehoben werden. Denn sonst wird sich darauf
// verlassen, das nichts geschuetztes selektiert ist!
if( !bFlag )
{
ClearMark();
}
bSetCrsrInReadOnly = bFlag;
UpdateCrsr();
}
}
sal_Bool SwCrsrShell::HasReadonlySel() const
{
sal_Bool bRet = sal_False;
if( IsReadOnlyAvailable() || GetViewOptions()->IsFormView() )
{
if( pTblCrsr )
bRet = pTblCrsr->HasReadOnlyBoxSel() ||
pTblCrsr->HasReadonlySel( GetViewOptions()->IsFormView() );
else
{
const SwPaM* pCrsr = pCurCrsr;
do {
if( pCrsr->HasReadonlySel( GetViewOptions()->IsFormView() ) )
bRet = sal_True;
} while( !bRet && pCurCrsr != ( pCrsr = (SwPaM*)pCrsr->GetNext() ));
}
}
return bRet;
}
sal_Bool SwCrsrShell::IsSelFullPara() const
{
sal_Bool bRet = sal_False;
if( pCurCrsr->GetPoint()->nNode.GetIndex() ==
pCurCrsr->GetMark()->nNode.GetIndex() && pCurCrsr == pCurCrsr->GetNext() )
{
xub_StrLen nStt = pCurCrsr->GetPoint()->nContent.GetIndex(),
nEnd = pCurCrsr->GetMark()->nContent.GetIndex();
if( nStt > nEnd )
{
xub_StrLen nTmp = nStt;
nStt = nEnd;
nEnd = nTmp;
}
const SwCntntNode* pCNd = pCurCrsr->GetCntntNode();
bRet = pCNd && !nStt && nEnd == pCNd->Len();
}
return bRet;
}
short SwCrsrShell::GetTextDirection( const Point* pPt ) const
{
SwPosition aPos( *pCurCrsr->GetPoint() );
Point aPt( pPt ? *pPt : pCurCrsr->GetPtPos() );
if( pPt )
{
SwCrsrMoveState aTmpState( MV_NONE );
aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState );
}
return pDoc->GetTextDirection( aPos, &aPt );
}
sal_Bool SwCrsrShell::IsInVerticalText( const Point* pPt ) const
{
const short nDir = GetTextDirection( pPt );
return FRMDIR_VERT_TOP_RIGHT == nDir || FRMDIR_VERT_TOP_LEFT == nDir;
}
sal_Bool SwCrsrShell::IsInRightToLeftText( const Point* pPt ) const
{
const short nDir = GetTextDirection( pPt );
// GetTextDirection uses FRMDIR_VERT_TOP_LEFT to indicate RTL in
// vertical environment
return FRMDIR_VERT_TOP_LEFT == nDir || FRMDIR_HORI_RIGHT_TOP == nDir;
}
//
// If the current cursor position is inside a hidden range, the hidden range
// is selected:
//
bool SwCrsrShell::SelectHiddenRange()
{
bool bRet = false;
if ( !GetViewOptions()->IsShowHiddenChar() && !pCurCrsr->HasMark() )
{
SwPosition& rPt = *(SwPosition*)pCurCrsr->GetPoint();
const SwTxtNode* pNode = rPt.nNode.GetNode().GetTxtNode();
if ( pNode )
{
const xub_StrLen nPos = rPt.nContent.GetIndex();
// check if nPos is in hidden range
xub_StrLen nHiddenStart;
xub_StrLen nHiddenEnd;
SwScriptInfo::GetBoundsOfHiddenRange( *pNode, nPos, nHiddenStart, nHiddenEnd );
if ( STRING_LEN != nHiddenStart )
{
// make selection:
pCurCrsr->SetMark();
pCurCrsr->GetMark()->nContent = nHiddenEnd;
bRet = true;
}
}
}
return bRet;
}
// die Suchfunktionen
sal_uLong SwCrsrShell::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes,
SwDocPositions eStart, SwDocPositions eEnde,
sal_Bool& bCancel,
FindRanges eRng, int bReplace )
{
if( pTblCrsr )
GetCrsr();
delete pTblCrsr, pTblCrsr = 0;
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
sal_uLong nRet = pCurCrsr->Find( rSearchOpt, bSearchInNotes, eStart, eEnde, bCancel, eRng, bReplace );
if( nRet || bCancel )
UpdateCrsr();
return nRet;
}
sal_uLong SwCrsrShell::Find( const SwTxtFmtColl& rFmtColl,
SwDocPositions eStart, SwDocPositions eEnde,
sal_Bool& bCancel,
FindRanges eRng, const SwTxtFmtColl* pReplFmt )
{
if( pTblCrsr )
GetCrsr();
delete pTblCrsr, pTblCrsr = 0;
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
sal_uLong nRet = pCurCrsr->Find( rFmtColl, eStart, eEnde, bCancel, eRng, pReplFmt );
if( nRet )
UpdateCrsr();
return nRet;
}
sal_uLong SwCrsrShell::Find( const SfxItemSet& rSet, sal_Bool bNoCollections,
SwDocPositions eStart, SwDocPositions eEnde,
sal_Bool& bCancel,
FindRanges eRng, const SearchOptions* pSearchOpt,
const SfxItemSet* rReplSet )
{
if( pTblCrsr )
GetCrsr();
delete pTblCrsr, pTblCrsr = 0;
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
sal_uLong nRet = pCurCrsr->Find( rSet, bNoCollections, eStart, eEnde, bCancel,
eRng, pSearchOpt, rReplSet );
if( nRet )
UpdateCrsr();
return nRet;
}
void SwCrsrShell::SetSelection( const SwPaM& rCrsr )
{
StartAction();
SwPaM* pCrsr = GetCrsr();
*pCrsr->GetPoint() = *rCrsr.GetPoint();
if(rCrsr.HasMark())
{
pCrsr->SetMark();
*pCrsr->GetMark() = *rCrsr.GetMark();
}
if((SwPaM*)rCrsr.GetNext() != &rCrsr)
{
const SwPaM *_pStartCrsr = (SwPaM*)rCrsr.GetNext();
do
{
SwPaM* pCurrentCrsr = CreateCrsr();
*pCurrentCrsr->GetPoint() = *_pStartCrsr->GetPoint();
if(_pStartCrsr->HasMark())
{
pCurrentCrsr->SetMark();
*pCurrentCrsr->GetMark() = *_pStartCrsr->GetMark();
}
} while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != &rCrsr );
}
EndAction();
}
void lcl_RemoveMark( SwPaM* pPam )
{
OSL_ENSURE( pPam->HasMark(), "Don't remove pPoint!" );
pPam->GetMark()->nContent.Assign( 0, 0 );
pPam->GetMark()->nNode = 0;
pPam->DeleteMark();
}
const SwStartNode* lcl_NodeContext( const SwNode& rNode )
{
const SwStartNode *pRet = rNode.StartOfSectionNode();
while( pRet->IsSectionNode() || pRet->IsTableNode() ||
pRet->GetStartNodeType() == SwTableBoxStartNode )
{
pRet = pRet->StartOfSectionNode();
}
return pRet;
}
/**
Checks if a position is valid. To be valid the position's node must
be a content node and the content must not be unregistered.
@param aPos the position to check.
*/
bool lcl_PosOk(const SwPosition & aPos)
{
return NULL != aPos.nNode.GetNode().GetCntntNode() &&
aPos.nContent.GetIdxReg();
}
/**
Checks if a PaM is valid. For a PaM to be valid its point must be
valid. Additionaly if the PaM has a mark this has to be valid, too.
@param aPam the PaM to check
*/
static bool lcl_CrsrOk(SwPaM & aPam)
{
return lcl_PosOk(*aPam.GetPoint()) && (! aPam.HasMark()
|| lcl_PosOk(*aPam.GetMark()));
}
void SwCrsrShell::ClearUpCrsrs()
{
// start of the ring
SwPaM * pStartCrsr = GetCrsr();
// start loop with second entry of the ring
SwPaM * pCrsr = (SwPaM *) pStartCrsr->GetNext();
SwPaM * pTmpCrsr;
bool bChanged = false;
/*
For all entries in the ring except the start entry delete the
entry if it is invalid.
*/
while (pCrsr != pStartCrsr)
{
pTmpCrsr = (SwPaM *) pCrsr->GetNext();
if ( ! lcl_CrsrOk(*pCrsr))
{
delete pCrsr;
bChanged = true;
}
pCrsr = pTmpCrsr;
}
if( pStartCrsr->HasMark() && !lcl_PosOk( *pStartCrsr->GetMark() ) )
{
lcl_RemoveMark( pStartCrsr );
bChanged = true;
}
if( !lcl_PosOk( *pStartCrsr->GetPoint() ) )
{
SwNodes & aNodes = GetDoc()->GetNodes();
const SwNode* pStart = lcl_NodeContext( pStartCrsr->GetPoint()->nNode.GetNode() );
SwNodeIndex aIdx( pStartCrsr->GetPoint()->nNode );
SwNode * pNode = aNodes.GoPrevious(&aIdx);
if( pNode == NULL || lcl_NodeContext( *pNode ) != pStart )
aNodes.GoNext( &aIdx );
if( pNode == NULL || lcl_NodeContext( *pNode ) != pStart )
{
/*
If the start entry of the ring is invalid replace it with a
cursor pointing to the beginning of the first content node in
the document.
*/
aIdx = (*(aNodes.GetEndOfContent().StartOfSectionNode()));
pNode = aNodes.GoNext( &aIdx );
}
bool bFound = (pNode != NULL);
OSL_ENSURE(bFound, "no content node found");
if (bFound)
{
SwPaM aTmpPam(*pNode);
*pStartCrsr = aTmpPam;
}
bChanged = true;
}
/*
If at least one of the cursors in the ring have been deleted or
replaced, remove the table cursor.
*/
if (pTblCrsr != NULL && bChanged)
TblCrsrToCursor();
}
String SwCrsrShell::GetCrsrDescr() const
{
String aResult;
if (IsMultiSelection())
aResult += String(SW_RES(STR_MULTISEL));
else
aResult = GetDoc()->GetPaMDescr(*GetCrsr());
return aResult;
}
// SMARTTAGS
void lcl_FillRecognizerData( uno::Sequence< rtl::OUString >& rSmartTagTypes,
uno::Sequence< uno::Reference< container::XStringKeyMap > >& rStringKeyMaps,
const SwWrongList& rSmartTagList, xub_StrLen nCurrent )
{
// Insert smart tag information
std::vector< rtl::OUString > aSmartTagTypes;
std::vector< uno::Reference< container::XStringKeyMap > > aStringKeyMaps;
for ( sal_uInt16 i = 0; i < rSmartTagList.Count(); ++i )
{
const xub_StrLen nSTPos = rSmartTagList.Pos( i );
const xub_StrLen nSTLen = rSmartTagList.Len( i );
if ( nSTPos <= nCurrent && nCurrent < nSTPos + nSTLen )
{
const SwWrongArea* pArea = rSmartTagList.GetElement( i );
if ( pArea )
{
aSmartTagTypes.push_back( pArea->maType );
aStringKeyMaps.push_back( pArea->mxPropertyBag );
}
}
}
if ( !aSmartTagTypes.empty() )
{
rSmartTagTypes.realloc( aSmartTagTypes.size() );
rStringKeyMaps.realloc( aSmartTagTypes.size() );
std::vector< rtl::OUString >::const_iterator aTypesIter = aSmartTagTypes.begin();
sal_uInt16 i = 0;
for ( aTypesIter = aSmartTagTypes.begin(); aTypesIter != aSmartTagTypes.end(); ++aTypesIter )
rSmartTagTypes[i++] = *aTypesIter;
std::vector< uno::Reference< container::XStringKeyMap > >::const_iterator aMapsIter = aStringKeyMaps.begin();
i = 0;
for ( aMapsIter = aStringKeyMaps.begin(); aMapsIter != aStringKeyMaps.end(); ++aMapsIter )
rStringKeyMaps[i++] = *aMapsIter;
}
}
void lcl_FillTextRange( uno::Reference<text::XTextRange>& rRange,
SwTxtNode& rNode, xub_StrLen nBegin, xub_StrLen nLen )
{
// create SwPosition for nStartIndex
SwIndex aIndex( &rNode, nBegin );
SwPosition aStartPos( rNode, aIndex );
// create SwPosition for nEndIndex
SwPosition aEndPos( aStartPos );
aEndPos.nContent = nBegin + nLen;
const uno::Reference<text::XTextRange> xRange =
SwXTextRange::CreateXTextRange(*rNode.GetDoc(), aStartPos, &aEndPos);
rRange = xRange;
}
void SwCrsrShell::GetSmartTagTerm( uno::Sequence< rtl::OUString >& rSmartTagTypes,
uno::Sequence< uno::Reference< container::XStringKeyMap > >& rStringKeyMaps,
uno::Reference< text::XTextRange>& rRange ) const
{
if ( !SwSmartTagMgr::Get().IsSmartTagsEnabled() )
return;
SwPaM* pCrsr = GetCrsr();
SwPosition aPos( *pCrsr->GetPoint() );
SwTxtNode *pNode = aPos.nNode.GetNode().GetTxtNode();
if ( pNode && !pNode->IsInProtectSect() )
{
const SwWrongList *pSmartTagList = pNode->GetSmartTags();
if ( pSmartTagList )
{
xub_StrLen nCurrent = aPos.nContent.GetIndex();
xub_StrLen nBegin = nCurrent;
xub_StrLen nLen = 1;
if( pSmartTagList->InWrongWord( nBegin, nLen ) && !pNode->IsSymbol(nBegin) )
{
const sal_uInt16 nIndex = pSmartTagList->GetWrongPos( nBegin );
const SwWrongList* pSubList = pSmartTagList->SubList( nIndex );
if ( pSubList )
{
pSmartTagList = pSubList;
nCurrent = 0;
}
lcl_FillRecognizerData( rSmartTagTypes, rStringKeyMaps, *pSmartTagList, nCurrent );
lcl_FillTextRange( rRange, *pNode, nBegin, nLen );
}
}
}
}
// see also SwEditShell::GetCorrection( const Point* pPt, SwRect& rSelectRect )
void SwCrsrShell::GetSmartTagTerm( const Point& rPt, SwRect& rSelectRect,
uno::Sequence< rtl::OUString >& rSmartTagTypes,
uno::Sequence< uno::Reference< container::XStringKeyMap > >& rStringKeyMaps,
uno::Reference<text::XTextRange>& rRange )
{
if ( !SwSmartTagMgr::Get().IsSmartTagsEnabled() )
return;
SwPaM* pCrsr = GetCrsr();
SwPosition aPos( *pCrsr->GetPoint() );
Point aPt( rPt );
SwCrsrMoveState eTmpState( MV_SETONLYTEXT );
SwSpecialPos aSpecialPos;
eTmpState.pSpecialPos = &aSpecialPos;
SwTxtNode *pNode;
const SwWrongList *pSmartTagList;
if( GetLayout()->GetCrsrOfst( &aPos, aPt, &eTmpState ) &&
0 != (pNode = aPos.nNode.GetNode().GetTxtNode()) &&
0 != (pSmartTagList = pNode->GetSmartTags()) &&
!pNode->IsInProtectSect() )
{
xub_StrLen nCurrent = aPos.nContent.GetIndex();
xub_StrLen nBegin = nCurrent;
xub_StrLen nLen = 1;
if( pSmartTagList->InWrongWord( nBegin, nLen ) && !pNode->IsSymbol(nBegin) )
{
const sal_uInt16 nIndex = pSmartTagList->GetWrongPos( nBegin );
const SwWrongList* pSubList = pSmartTagList->SubList( nIndex );
if ( pSubList )
{
pSmartTagList = pSubList;
nCurrent = eTmpState.pSpecialPos->nCharOfst;
}
lcl_FillRecognizerData( rSmartTagTypes, rStringKeyMaps, *pSmartTagList, nCurrent );
lcl_FillTextRange( rRange, *pNode, nBegin, nLen );
// get smarttag word
String aText( pNode->GetTxt().Copy( nBegin, nLen ) );
//save the start and end positons of the line and the starting point
Push();
LeftMargin();
xub_StrLen nLineStart = GetCrsr()->GetPoint()->nContent.GetIndex();
RightMargin();
xub_StrLen nLineEnd = GetCrsr()->GetPoint()->nContent.GetIndex();
Pop(sal_False);
// make sure the selection build later from the
// data below does not include footnotes and other
// "in word" character to the left and right in order
// to preserve those. Therefore count those "in words"
// in order to modify the selection accordingly.
const sal_Unicode* pChar = aText.GetBuffer();
xub_StrLen nLeft = 0;
while (pChar && *pChar++ == CH_TXTATR_INWORD)
++nLeft;
pChar = aText.Len() ? aText.GetBuffer() + aText.Len() - 1 : 0;
xub_StrLen nRight = 0;
while (pChar && *pChar-- == CH_TXTATR_INWORD)
++nRight;
aPos.nContent = nBegin + nLeft;
pCrsr = GetCrsr();
*pCrsr->GetPoint() = aPos;
pCrsr->SetMark();
ExtendSelection( sal_True, nLen - nLeft - nRight );
//no determine the rectangle in the current line
xub_StrLen nWordStart = (nBegin + nLeft) < nLineStart ? nLineStart : nBegin + nLeft;
//take one less than the line end - otherwise the next line would be calculated
xub_StrLen nWordEnd = (nBegin + nLen - nLeft - nRight) > nLineEnd ? nLineEnd : (nBegin + nLen - nLeft - nRight);
Push();
pCrsr->DeleteMark();
SwIndex& rContent = GetCrsr()->GetPoint()->nContent;
rContent = nWordStart;
SwRect aStartRect;
SwCrsrMoveState aState;
aState.bRealWidth = sal_True;
SwCntntNode* pCntntNode = pCrsr->GetCntntNode();
SwCntntFrm *pCntntFrame = pCntntNode->getLayoutFrm( GetLayout(), &rPt, pCrsr->GetPoint(), sal_False);
pCntntFrame->GetCharRect( aStartRect, *pCrsr->GetPoint(), &aState );
rContent = nWordEnd - 1;
SwRect aEndRect;
pCntntFrame->GetCharRect( aEndRect, *pCrsr->GetPoint(),&aState );
rSelectRect = aStartRect.Union( aEndRect );
Pop(sal_False);
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|