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
|
/* -*- 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/lang/DisposedException.hpp>
#include <com/sun/star/presentation/ClickAction.hpp>
#include <com/sun/star/presentation/FadeEffect.hpp>
#include <com/sun/star/presentation/AnimationEffect.hpp>
#include <com/sun/star/presentation/PresentationRange.hpp>
#include <com/sun/star/presentation/AnimationSpeed.hpp>
#include <com/sun/star/view/PaperOrientation.hpp>
#include <com/sun/star/animations/AnimationNodeType.hpp>
#include <com/sun/star/presentation/EffectNodeType.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <comphelper/processfactory.hxx>
#include <comphelper/servicehelper.hxx>
#include <rtl/ustrbuf.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/metaact.hxx>
#include <toolkit/unohlp.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <unomodel.hxx>
#include <unopage.hxx>
#include <svx/svxids.hrc>
#include <svl/itemset.hxx>
#include <svx/svdmodel.hxx>
#include <sdresid.hxx>
#include <glob.hrc>
#include <sdpage.hxx>
#include <unoprnms.hxx>
#include <sdattr.hxx>
#include <drawdoc.hxx>
#include <svx/unoshape.hxx>
#include <com/sun/star/style/XStyle.hpp>
#include <svx/svdorect.hxx>
#include <osl/mutex.hxx>
#include <svl/style.hxx>
#include <rtl/memory.h>
#include <comphelper/serviceinfohelper.hxx>
#include <comphelper/extract.hxx>
#include <list>
#include <svx/svditer.hxx>
#include <svtools/wmf.hxx>
#include <svx/svdoole2.hxx>
#include <svx/svdpool.hxx>
#include <svx/svdview.hxx>
#include "View.hxx"
#include "DrawDocShell.hxx"
#include "ViewShell.hxx"
#include "DrawViewShell.hxx"
#include "unoobj.hxx"
#include "res_bmp.hrc"
#include "unokywds.hxx"
#include "unopback.hxx"
#include "unohelp.hxx"
using ::com::sun::star::animations::XAnimationNode;
using ::com::sun::star::animations::XAnimationNodeSupplier;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
using namespace ::osl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::drawing;
using namespace ::com::sun::star::office;
namespace sd {
extern Reference< XAnnotation > createAnnotation( const Reference< XComponentContext >& xContext, SdPage* );
extern Reference< XAnnotationEnumeration > createAnnotationEnumeration( const sd::AnnotationVector& );
}
/* this are the ids for page properties */
enum WID_PAGE
{
WID_PAGE_LEFT, WID_PAGE_RIGHT, WID_PAGE_TOP, WID_PAGE_BOTTOM, WID_PAGE_WIDTH,
WID_PAGE_HEIGHT, WID_PAGE_EFFECT, WID_PAGE_CHANGE, WID_PAGE_SPEED, WID_PAGE_NUMBER,
WID_PAGE_ORIENT, WID_PAGE_LAYOUT, WID_PAGE_DURATION, WID_PAGE_LDNAME, WID_PAGE_LDBITMAP,
WID_PAGE_BACK, WID_PAGE_PREVIEW, WID_PAGE_PREVIEWBITMAP, WID_PAGE_VISIBLE, WID_PAGE_SOUNDFILE, WID_PAGE_BACKFULL,
WID_PAGE_BACKVIS, WID_PAGE_BACKOBJVIS, WID_PAGE_USERATTRIBS, WID_PAGE_BOOKMARK, WID_PAGE_ISDARK,
WID_PAGE_HEADERVISIBLE, WID_PAGE_HEADERTEXT, WID_PAGE_FOOTERVISIBLE, WID_PAGE_FOOTERTEXT,
WID_PAGE_PAGENUMBERVISIBLE, WID_PAGE_DATETIMEVISIBLE, WID_PAGE_DATETIMEFIXED,
WID_PAGE_DATETIMETEXT, WID_PAGE_DATETIMEFORMAT, WID_TRANSITION_TYPE, WID_TRANSITION_SUBTYPE,
WID_TRANSITION_DIRECTION, WID_TRANSITION_FADE_COLOR, WID_TRANSITION_DURATION, WID_LOOP_SOUND,
WID_NAVORDER
};
#ifndef SEQTYPE
#if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)
#define SEQTYPE(x) (new ::com::sun::star::uno::Type( x ))
#else
#define SEQTYPE(x) &(x)
#endif
#endif
static sal_Char sEmptyPageName[sizeof("page")] = "page";
/** this function stores the property maps for draw pages in impress and draw */
const SvxItemPropertySet* ImplGetDrawPagePropertySet( sal_Bool bImpress, PageKind ePageKind )
{
static const SfxItemPropertyMapEntry aDrawPagePropertyMap_Impl[] =
{
{ MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, &ITYPE( beans::XPropertySet ), beans::PropertyAttribute::MAYBEVOID,0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_CHANGE), WID_PAGE_CHANGE, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_DURATION), WID_PAGE_DURATION, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_EFFECT), WID_PAGE_EFFECT, &::getCppuType((const presentation::FadeEffect*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, &::getCppuType((const sal_Int16*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, &ITYPE( awt::XBitmap), beans::PropertyAttribute::READONLY, 0},
{ MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, &::getCppuType((const OUString*)0), beans::PropertyAttribute::READONLY, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_SPEED), WID_PAGE_SPEED, &::getCppuType((const presentation::AnimationSpeed*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEW), WID_PAGE_PREVIEW, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEWBITMAP), WID_PAGE_PREVIEWBITMAP, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_VISIBLE), WID_PAGE_VISIBLE, &::getBooleanCppuType(), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_OBJ_SOUNDFILE), WID_PAGE_SOUNDFILE, &::getCppuType((const Any*)0), 0, 0},
{ MAP_CHAR_LEN(sUNO_Prop_IsBackgroundVisible), WID_PAGE_BACKVIS, &::getBooleanCppuType(), 0, 0},
{ MAP_CHAR_LEN(sUNO_Prop_IsBackgroundObjectsVisible), WID_PAGE_BACKOBJVIS, &::getBooleanCppuType(), 0, 0},
{ MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
{ MAP_CHAR_LEN(sUNO_Prop_BookmarkURL), WID_PAGE_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0},
{ MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0},
{ MAP_CHAR_LEN("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE, &::getBooleanCppuType(), 0, 0},
{ MAP_CHAR_LEN("FooterText"), WID_PAGE_FOOTERTEXT, &::getCppuType((const OUString*)0), 0, 0},
{ MAP_CHAR_LEN("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE, &::getBooleanCppuType(), 0, 0},
{ MAP_CHAR_LEN("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE, &::getBooleanCppuType(), 0, 0},
{ MAP_CHAR_LEN("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED, &::getBooleanCppuType(), 0, 0},
{ MAP_CHAR_LEN("DateTimeText"), WID_PAGE_DATETIMETEXT, &::getCppuType((const OUString*)0), 0, 0},
{ MAP_CHAR_LEN("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN("TransitionType"), WID_TRANSITION_TYPE, &::getCppuType((const sal_Int16*)0), 0, 0},
{ MAP_CHAR_LEN("TransitionSubtype"), WID_TRANSITION_SUBTYPE, &::getCppuType((const sal_Int16*)0), 0, 0},
{ MAP_CHAR_LEN("TransitionDirection"), WID_TRANSITION_DIRECTION, &::getCppuType((const sal_Bool*)0), 0, 0},
{ MAP_CHAR_LEN("TransitionFadeColor"), WID_TRANSITION_FADE_COLOR, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN("TransitionDuration"), WID_TRANSITION_DURATION, &::getCppuType((const double*)0), 0, 0},
{ MAP_CHAR_LEN("LoopSound"), WID_LOOP_SOUND, &::getBooleanCppuType(), 0, 0},
{ MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::com::sun::star::container::XIndexAccess::static_type(),0, 0},
{0,0,0,0,0,0}
};
#define DRAW_PAGE_NOTES_PROPERTIES \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, &::getCppuType((const sal_Int16*)0), 0, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, &ITYPE( awt::XBitmap), beans::PropertyAttribute::READONLY, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, &::getCppuType((const OUString*)0), beans::PropertyAttribute::READONLY, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0}, \
{ MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},\
{ MAP_CHAR_LEN("IsHeaderVisible"), WID_PAGE_HEADERVISIBLE, &::getBooleanCppuType(), 0, 0}, \
{ MAP_CHAR_LEN("HeaderText"), WID_PAGE_HEADERTEXT, &::getCppuType((const OUString*)0), 0, 0}, \
{ MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0}, \
{ MAP_CHAR_LEN("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE, &::getBooleanCppuType(), 0, 0}, \
{ MAP_CHAR_LEN("FooterText"), WID_PAGE_FOOTERTEXT, &::getCppuType((const OUString*)0), 0, 0}, \
{ MAP_CHAR_LEN("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE, &::getBooleanCppuType(), 0, 0}, \
{ MAP_CHAR_LEN("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE, &::getBooleanCppuType(), 0, 0}, \
{ MAP_CHAR_LEN("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED, &::getBooleanCppuType(), 0, 0}, \
{ MAP_CHAR_LEN("DateTimeText"), WID_PAGE_DATETIMETEXT, &::getCppuType((const OUString*)0), 0, 0}, \
{ MAP_CHAR_LEN("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
{ MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::com::sun::star::container::XIndexAccess::static_type(),0, 0}, \
{0,0,0,0,0,0}
static const SfxItemPropertyMapEntry aDrawPageNotesHandoutPropertyMap_Impl[] =
{
// this must be the first two entries so they can be excluded for PK_STANDARD
{ MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, &ITYPE( beans::XPropertySet ), beans::PropertyAttribute::MAYBEVOID,0},
DRAW_PAGE_NOTES_PROPERTIES
};
static const SfxItemPropertyMapEntry aDrawPageNotesHandoutPropertyNoBackMap_Impl[] =
{
DRAW_PAGE_NOTES_PROPERTIES
};
#define GRAPHIC_PAGE_PROPERTIES \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, &ITYPE(awt::XBitmap), beans::PropertyAttribute::READONLY, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, &::getCppuType((const OUString*)0), beans::PropertyAttribute::READONLY, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEW), WID_PAGE_PREVIEW, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, \
{ MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEWBITMAP), WID_PAGE_PREVIEWBITMAP, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},\
{ MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0}, \
{ MAP_CHAR_LEN(sUNO_Prop_BookmarkURL), WID_PAGE_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0}, \
{ MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0}, \
{ MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::com::sun::star::container::XIndexAccess::static_type(),0, 0}, \
{0,0,0,0,0,0}
static const SfxItemPropertyMapEntry aGraphicPagePropertyMap_Impl[] =
{
{ MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, &ITYPE( beans::XPropertySet), beans::PropertyAttribute::MAYBEVOID,0},
GRAPHIC_PAGE_PROPERTIES
};
static const SfxItemPropertyMapEntry aGraphicPagePropertyNoBackMap_Impl[] =
{
GRAPHIC_PAGE_PROPERTIES
};
bool bWithoutBackground = ePageKind != PK_STANDARD && ePageKind != PK_HANDOUT;
const SvxItemPropertySet* pRet = 0;
if( bImpress )
{
if( ePageKind == PK_STANDARD )
{
//PK_STANDARD always has a background property
static SvxItemPropertySet aDrawPagePropertySet_Impl( aDrawPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
pRet = &aDrawPagePropertySet_Impl;
}
else
{
if(bWithoutBackground)
{
static SvxItemPropertySet aDrawPageNotesHandoutPropertyNoBackSet_Impl( aDrawPageNotesHandoutPropertyNoBackMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
pRet = &aDrawPageNotesHandoutPropertyNoBackSet_Impl;
}
else
{
static SvxItemPropertySet aDrawPageNotesHandoutPropertySet_Impl( aDrawPageNotesHandoutPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
pRet = &aDrawPageNotesHandoutPropertySet_Impl;
}
}
}
else
{
if(bWithoutBackground)
{
static SvxItemPropertySet aGraphicPagePropertyNoBackSet_Impl( aGraphicPagePropertyNoBackMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
pRet = &aGraphicPagePropertyNoBackSet_Impl;
}
else
{
static SvxItemPropertySet aGraphicPagePropertySet_Impl( aGraphicPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
pRet = &aGraphicPagePropertySet_Impl;
}
}
return pRet;
}
/** this function stores the property map for master pages in impress and draw */
const SvxItemPropertySet* ImplGetMasterPagePropertySet( PageKind ePageKind )
{
static const SfxItemPropertyMapEntry aMasterPagePropertyMap_Impl[] =
{
{ MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND), WID_PAGE_BACK, &ITYPE(beans::XPropertySet), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), WID_PAGE_LDBITMAP, &ITYPE(awt::XBitmap), beans::PropertyAttribute::READONLY, 0},
{ MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), WID_PAGE_LDNAME, &::getCppuType((const OUString*)0), beans::PropertyAttribute::READONLY, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN("BackgroundFullSize"), WID_PAGE_BACKFULL, &::getBooleanCppuType(), 0, 0},
{ MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
{ MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0},
{0,0,0,0,0,0}
};
static const SfxItemPropertyMapEntry aHandoutMasterPagePropertyMap_Impl[] =
{
{ MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM), WID_PAGE_BOTTOM, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT), WID_PAGE_LEFT, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT), WID_PAGE_RIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_TOP), WID_PAGE_TOP, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT), WID_PAGE_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION), WID_PAGE_ORIENT, &::getCppuType((const view::PaperOrientation*)0),0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER), WID_PAGE_NUMBER, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH), WID_PAGE_WIDTH, &::getCppuType((const sal_Int32*)0), 0, 0},
{ MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT), WID_PAGE_LAYOUT, &::getCppuType((const sal_Int16*)0), 0, 0},
{ MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
{ MAP_CHAR_LEN("IsBackgroundDark" ), WID_PAGE_ISDARK, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0},
{ MAP_CHAR_LEN("IsHeaderVisible"), WID_PAGE_HEADERVISIBLE, &::getBooleanCppuType(), 0, 0},
{ MAP_CHAR_LEN("HeaderText"), WID_PAGE_HEADERTEXT, &::getCppuType((const OUString*)0), 0, 0},
{ MAP_CHAR_LEN("IsFooterVisible"), WID_PAGE_FOOTERVISIBLE, &::getBooleanCppuType(), 0, 0},
{ MAP_CHAR_LEN("FooterText"), WID_PAGE_FOOTERTEXT, &::getCppuType((const OUString*)0), 0, 0},
{ MAP_CHAR_LEN("IsPageNumberVisible"), WID_PAGE_PAGENUMBERVISIBLE, &::getBooleanCppuType(), 0, 0},
{ MAP_CHAR_LEN("IsDateTimeVisible"), WID_PAGE_DATETIMEVISIBLE, &::getBooleanCppuType(), 0, 0},
{ MAP_CHAR_LEN("IsDateTimeFixed"), WID_PAGE_DATETIMEFIXED, &::getBooleanCppuType(), 0, 0},
{ MAP_CHAR_LEN("DateTimeText"), WID_PAGE_DATETIMETEXT, &::getCppuType((const OUString*)0), 0, 0},
{ MAP_CHAR_LEN("DateTimeFormat"), WID_PAGE_DATETIMEFORMAT, &::getCppuType((const sal_Int32*)0), 0, 0},
{0,0,0,0,0,0}
};
const SvxItemPropertySet* pRet = 0;
if( ePageKind == PK_HANDOUT )
{
static SvxItemPropertySet aHandoutMasterPagePropertySet_Impl( aHandoutMasterPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
pRet = &aHandoutMasterPagePropertySet_Impl;
}
else
{
static SvxItemPropertySet aMasterPagePropertySet_Impl( aMasterPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
pRet = &aMasterPagePropertySet_Impl;
}
return pRet;
}
namespace
{
class theSdGenericDrawPageUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSdGenericDrawPageUnoTunnelId> {};
}
const ::com::sun::star::uno::Sequence< sal_Int8 > & SdGenericDrawPage::getUnoTunnelId() throw()
{
return theSdGenericDrawPageUnoTunnelId::get().getSeq();
}
sal_Int64 SAL_CALL SdGenericDrawPage::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException)
{
if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
rId.getConstArray(), 16 ) )
{
return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
}
else
{
return SvxFmDrawPage::getSomething( rId );
}
}
SdGenericDrawPage::SdGenericDrawPage( SdXImpressDocument* _pModel, SdPage* pInPage, const SvxItemPropertySet* _pSet ) throw()
: SvxFmDrawPage( (SdrPage*) pInPage ),
SdUnoSearchReplaceShape(this),
mpModel ( _pModel ),
mpSdrModel(0),
mnTempPageNumber(0),
mpPropSet ( _pSet ),
mbIsImpressDocument(false)
{
mpSdrModel = SvxFmDrawPage::mpModel;
if( mpModel )
mbIsImpressDocument = mpModel->IsImpressDocument() ? true : false;
}
SdGenericDrawPage::~SdGenericDrawPage() throw()
{
}
void SdGenericDrawPage::throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException )
{
if( (SvxFmDrawPage::mpModel == 0) || (mpModel == 0) || (SvxFmDrawPage::mpPage == 0) )
throw lang::DisposedException();
}
SdXImpressDocument* SdGenericDrawPage::GetModel() const
{
if( mpSdrModel != SvxFmDrawPage::mpModel )
{
const_cast< SdGenericDrawPage* >(this)->mpSdrModel = SvxFmDrawPage::mpModel;
if( mpSdrModel )
{
uno::Reference< uno::XInterface > xModel( SvxFmDrawPage::mpModel->getUnoModel() );
const_cast< SdGenericDrawPage*>(this)->mpModel = SdXImpressDocument::getImplementation( xModel );
if( mpModel )
const_cast< SdGenericDrawPage*>(this)->mbIsImpressDocument = mpModel->IsImpressDocument() ? true : false;
}
else
{
const_cast< SdGenericDrawPage* >(this)->mpModel = 0;
}
}
return mpModel;
}
// this is called whenever a SdrObject must be created for a empty api shape wrapper
SdrObject * SdGenericDrawPage::_CreateSdrObject( const Reference< drawing::XShape >& xShape ) throw()
{
if( NULL == SvxFmDrawPage::mpPage || !xShape.is() )
return NULL;
String aType( xShape->getShapeType() );
const String aPrefix( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.") );
if( aType.CompareTo( aPrefix, aPrefix.Len() ) != 0 )
{
SdrObject* pObj = SvxFmDrawPage::_CreateSdrObject( xShape );
if( pObj && ( (pObj->GetObjInventor() != SdrInventor) || (pObj->GetObjIdentifier() != OBJ_PAGE) ) )
{
SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
if( pDoc )
pObj->NbcSetStyleSheet( pDoc->GetDefaultStyleSheet(), sal_True );
}
return pObj;
}
aType = aType.Copy( aPrefix.Len() );
PresObjKind eObjKind = PRESOBJ_NONE;
if( aType.EqualsAscii( "TitleTextShape" ) )
{
eObjKind = PRESOBJ_TITLE;
}
else if( aType.EqualsAscii( "OutlinerShape" ) )
{
eObjKind = PRESOBJ_OUTLINE;
}
else if( aType.EqualsAscii( "SubtitleShape" ) )
{
eObjKind = PRESOBJ_TEXT;
}
else if( aType.EqualsAscii( "OLE2Shape" ) )
{
eObjKind = PRESOBJ_OBJECT;
}
else if( aType.EqualsAscii( "ChartShape" ) )
{
eObjKind = PRESOBJ_CHART;
}
else if( aType.EqualsAscii( "CalcShape" ) )
{
eObjKind = PRESOBJ_CALC;
}
else if( aType.EqualsAscii( "TableShape" ) )
{
eObjKind = PRESOBJ_TABLE;
}
else if( aType.EqualsAscii( "GraphicObjectShape" ) )
{
eObjKind = PRESOBJ_GRAPHIC;
}
else if( aType.EqualsAscii( "OrgChartShape" ) )
{
eObjKind = PRESOBJ_ORGCHART;
}
else if( aType.EqualsAscii( "PageShape" ) )
{
if( GetPage()->GetPageKind() == PK_NOTES && GetPage()->IsMasterPage() )
eObjKind = PRESOBJ_TITLE;
else
eObjKind = PRESOBJ_PAGE;
}
else if( aType.EqualsAscii( "NotesShape" ) )
{
eObjKind = PRESOBJ_NOTES;
}
else if( aType.EqualsAscii( "HandoutShape" ) )
{
eObjKind = PRESOBJ_HANDOUT;
}
else if( aType.EqualsAscii( "FooterShape" ) )
{
eObjKind = PRESOBJ_FOOTER;
}
else if( aType.EqualsAscii( "HeaderShape" ) )
{
eObjKind = PRESOBJ_HEADER;
}
else if( aType.EqualsAscii( "SlideNumberShape" ) )
{
eObjKind = PRESOBJ_SLIDENUMBER;
}
else if( aType.EqualsAscii( "DateTimeShape" ) )
{
eObjKind = PRESOBJ_DATETIME;
}
else if( aType.EqualsAscii( "MediaShape" ) )
{
eObjKind = PRESOBJ_MEDIA;
}
Rectangle aRect( eObjKind == PRESOBJ_TITLE ? GetPage()->GetTitleRect() : GetPage()->GetLayoutRect() );
const awt::Point aPos( aRect.Left(), aRect.Top() );
xShape->setPosition( aPos );
const awt::Size aSize( aRect.GetWidth(), aRect.GetHeight() );
xShape->setSize( aSize );
SdrObject *pPresObj = 0;
if( (eObjKind == PRESOBJ_TABLE) || (eObjKind == PRESOBJ_MEDIA) )
{
pPresObj = SvxFmDrawPage::_CreateSdrObject( xShape );
if( pPresObj )
{
SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
if( pDoc )
pPresObj->NbcSetStyleSheet( pDoc->GetDefaultStyleSheet(), sal_True );
GetPage()->InsertPresObj( pPresObj, eObjKind );
}
}
else
{
pPresObj = GetPage()->CreatePresObj( eObjKind, sal_False, aRect, sal_True );
}
if( pPresObj )
pPresObj->SetUserCall( GetPage() );
return pPresObj;
}
// XInterface
Any SAL_CALL SdGenericDrawPage::queryInterface( const uno::Type & rType )
throw(uno::RuntimeException)
{
Any aAny;
QUERYINT( beans::XPropertySet );
else QUERYINT( container::XNamed );
else QUERYINT( util::XReplaceable );
else QUERYINT( util::XSearchable );
else QUERYINT( document::XLinkTargetSupplier );
else QUERYINT( drawing::XShapeCombiner );
else QUERYINT( drawing::XShapeBinder );
else QUERYINT( beans::XMultiPropertySet );
else if( rType == ITYPE( office::XAnnotationAccess ) )
{
return Any( Reference< office::XAnnotationAccess >( this ) );
}
else if( rType == ITYPE( XAnimationNodeSupplier ) )
{
if( mbIsImpressDocument )
{
const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
if( ePageKind == PK_STANDARD )
return makeAny( Reference< XAnimationNodeSupplier >( this ) );
}
}
else
return SvxDrawPage::queryInterface( rType );
return aAny;
}
// XPropertySet
Reference< beans::XPropertySetInfo > SAL_CALL SdGenericDrawPage::getPropertySetInfo()
throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
return mpPropSet->getPropertySetInfo();
}
void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName);
switch( pEntry ? pEntry->nWID : -1 )
{
case WID_NAVORDER:
setNavigationOrder( aValue );
break;
case WID_PAGE_LEFT:
case WID_PAGE_RIGHT:
case WID_PAGE_TOP:
case WID_PAGE_BOTTOM:
case WID_PAGE_LAYOUT:
case WID_PAGE_DURATION:
case WID_PAGE_CHANGE:
{
sal_Int32 nValue = 0;
if(!(aValue >>= nValue))
throw lang::IllegalArgumentException();
switch( pEntry->nWID )
{
case WID_PAGE_LEFT:
SetLftBorder(nValue);
break;
case WID_PAGE_RIGHT:
SetRgtBorder( nValue );
break;
case WID_PAGE_TOP:
SetUppBorder( nValue );
break;
case WID_PAGE_BOTTOM:
SetLwrBorder( nValue );
break;
case WID_PAGE_CHANGE:
GetPage()->SetPresChange( (PresChange)nValue );
break;
case WID_PAGE_LAYOUT:
GetPage()->SetAutoLayout( (AutoLayout)nValue, sal_True );
break;
case WID_PAGE_DURATION:
GetPage()->SetTime((sal_uInt32)nValue);
break;
}
break;
}
case WID_PAGE_WIDTH:
{
sal_Int32 nWidth = 0;
if(!(aValue >>= nWidth))
throw lang::IllegalArgumentException();
SetWidth( nWidth );
break;
}
case WID_PAGE_HEIGHT:
{
sal_Int32 nHeight = 0;
if(!(aValue >>= nHeight))
throw lang::IllegalArgumentException();
SetHeight( nHeight );
break;
}
case WID_PAGE_ORIENT:
{
sal_Int32 nEnum = 0;
if(!::cppu::enum2int( nEnum, aValue ))
throw lang::IllegalArgumentException();
Orientation eOri = (((view::PaperOrientation)nEnum) == view::PaperOrientation_PORTRAIT)?ORIENTATION_PORTRAIT:ORIENTATION_LANDSCAPE;
if( eOri != GetPage()->GetOrientation() )
{
SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
const PageKind ePageKind = GetPage()->GetPageKind();
sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
pPage->SetOrientation( eOri );
}
nPageCnt = pDoc->GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
pPage->SetOrientation( eOri );
}
}
break;
}
case WID_PAGE_EFFECT:
{
sal_Int32 nEnum = 0;
if(!::cppu::enum2int( nEnum, aValue ))
throw lang::IllegalArgumentException();
GetPage()->SetFadeEffect( (presentation::FadeEffect)nEnum );
break;
}
case WID_PAGE_BACK:
setBackground( aValue );
break;
case WID_PAGE_SPEED:
{
sal_Int32 nEnum = 0;
if(!::cppu::enum2int( nEnum, aValue ))
throw lang::IllegalArgumentException();
GetPage()->setTransitionDuration( nEnum == 0 ? 3.0 : (nEnum == 1 ? 2.0 : 1.0 ) );
break;
}
case WID_PAGE_VISIBLE :
{
sal_Bool bVisible = sal_False;
if( ! ( aValue >>= bVisible ) )
throw lang::IllegalArgumentException();
GetPage()->SetExcluded( bVisible == sal_False );
break;
}
case WID_PAGE_SOUNDFILE :
{
OUString aURL;
if( aValue >>= aURL )
{
GetPage()->SetSoundFile( aURL );
GetPage()->SetSound( aURL.getLength() != 0 ? sal_True : sal_False );
break;
}
else
{
sal_Bool bStopSound = sal_False;
if( aValue >>= bStopSound )
{
GetPage()->SetStopSound( bStopSound ? true : false );
break;
}
}
throw lang::IllegalArgumentException();
}
case WID_LOOP_SOUND:
{
sal_Bool bLoop = sal_False;
if( ! (aValue >>= bLoop) )
throw lang::IllegalArgumentException();
GetPage()->SetLoopSound( bLoop ? true : false );
break;
}
case WID_PAGE_BACKFULL:
{
sal_Bool bFullSize = sal_False;
if( ! ( aValue >>= bFullSize ) )
throw lang::IllegalArgumentException();
GetPage()->SetBackgroundFullSize( bFullSize );
break;
}
case WID_PAGE_BACKVIS:
{
sal_Bool bVisible = sal_False;
if( ! ( aValue >>= bVisible ) )
throw lang::IllegalArgumentException();
SdrPage* pPage = GetPage();
if( pPage )
{
SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel();
if( pDoc->GetMasterPageCount() )
{
SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
aVisibleLayers.Set(rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False), bVisible);
pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
}
}
break;
}
case WID_PAGE_BACKOBJVIS:
{
sal_Bool bVisible = sal_False;
if( ! ( aValue >>= bVisible ) )
throw lang::IllegalArgumentException();
SdrPage* pPage = GetPage();
if( pPage )
{
SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel();
if( pDoc->GetMasterPageCount() )
{
SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
aVisibleLayers.Set(rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False), bVisible);
pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
}
}
break;
}
case WID_PAGE_USERATTRIBS:
{
if( !GetPage()->setAlienAttributes( aValue ) )
throw lang::IllegalArgumentException();
break;
}
case WID_PAGE_BOOKMARK:
{
OUString aBookmarkURL;
if( ! ( aValue >>= aBookmarkURL ) )
throw lang::IllegalArgumentException();
setBookmarkURL( aBookmarkURL );
break;
}
case WID_PAGE_HEADERVISIBLE:
case WID_PAGE_HEADERTEXT:
case WID_PAGE_FOOTERVISIBLE:
case WID_PAGE_FOOTERTEXT:
case WID_PAGE_PAGENUMBERVISIBLE:
case WID_PAGE_DATETIMEVISIBLE:
case WID_PAGE_DATETIMEFIXED:
case WID_PAGE_DATETIMETEXT:
case WID_PAGE_DATETIMEFORMAT:
{
sd::HeaderFooterSettings aHeaderFooterSettings( GetPage()->getHeaderFooterSettings() );
switch( pEntry->nWID )
{
case WID_PAGE_HEADERVISIBLE:
{
sal_Bool bVisible = sal_False;
if( ! ( aValue >>= bVisible ) )
throw lang::IllegalArgumentException();
aHeaderFooterSettings.mbHeaderVisible = bVisible;
break;
}
case WID_PAGE_HEADERTEXT:
{
OUString aText;
if( ! ( aValue >>= aText ) )
throw lang::IllegalArgumentException();
aHeaderFooterSettings.maHeaderText = aText;
break;
}
case WID_PAGE_FOOTERVISIBLE:
{
sal_Bool bVisible = sal_False;
if( ! ( aValue >>= bVisible ) )
throw lang::IllegalArgumentException();
aHeaderFooterSettings.mbFooterVisible = bVisible;
break;
}
case WID_PAGE_FOOTERTEXT:
{
OUString aText;
if( ! ( aValue >>= aText ) )
throw lang::IllegalArgumentException();
aHeaderFooterSettings.maFooterText = aText;
break;
}
case WID_PAGE_PAGENUMBERVISIBLE:
{
sal_Bool bVisible = sal_False;
if( ! ( aValue >>= bVisible ) )
throw lang::IllegalArgumentException();
aHeaderFooterSettings.mbSlideNumberVisible = bVisible;
break;
}
case WID_PAGE_DATETIMEVISIBLE:
{
sal_Bool bVisible = sal_False;
if( ! ( aValue >>= bVisible ) )
throw lang::IllegalArgumentException();
aHeaderFooterSettings.mbDateTimeVisible = bVisible;
break;
}
case WID_PAGE_DATETIMEFIXED:
{
sal_Bool bVisible = sal_False;
if( ! ( aValue >>= bVisible ) )
throw lang::IllegalArgumentException();
aHeaderFooterSettings.mbDateTimeIsFixed = bVisible;
break;
}
case WID_PAGE_DATETIMETEXT:
{
OUString aText;
if( ! ( aValue >>= aText ) )
throw lang::IllegalArgumentException();
aHeaderFooterSettings.maDateTimeText = aText;
break;
}
case WID_PAGE_DATETIMEFORMAT:
{
sal_Int32 nValue = 0;
if( ! ( aValue >>= nValue ) )
throw lang::IllegalArgumentException();
aHeaderFooterSettings.meDateTimeFormat = nValue;
break;
}
}
if( !(aHeaderFooterSettings == GetPage()->getHeaderFooterSettings()) )
GetPage()->setHeaderFooterSettings( aHeaderFooterSettings );
break;
}
case WID_PAGE_NUMBER:
if( (GetPage()->GetPageKind() == PK_HANDOUT) && !GetPage()->IsMasterPage() )
{
if( !(aValue >>= mnTempPageNumber) )
throw lang::IllegalArgumentException();
break;
}
throw beans::PropertyVetoException();
case WID_PAGE_LDBITMAP:
case WID_PAGE_LDNAME:
case WID_PAGE_ISDARK:
throw beans::PropertyVetoException();
case WID_TRANSITION_TYPE:
{
sal_Int16 nValue = 0;
if( ! ( aValue >>= nValue ) )
throw lang::IllegalArgumentException();
GetPage()->setTransitionType( nValue );
break;
}
case WID_TRANSITION_SUBTYPE:
{
sal_Int16 nValue = 0;
if( ! ( aValue >>= nValue ) )
throw lang::IllegalArgumentException();
GetPage()->setTransitionSubtype( nValue );
break;
}
case WID_TRANSITION_DIRECTION:
{
sal_Bool bValue = sal_False;
if( ! ( aValue >>= bValue ) )
throw lang::IllegalArgumentException();
GetPage()->setTransitionDirection( bValue );
break;
}
case WID_TRANSITION_FADE_COLOR:
{
sal_Int32 nValue = 0;
if( ! ( aValue >>= nValue ) )
throw lang::IllegalArgumentException();
GetPage()->setTransitionFadeColor( nValue );
break;
}
case WID_TRANSITION_DURATION:
{
double fValue = 0.0;
if( ! ( aValue >>= fValue ) )
throw lang::IllegalArgumentException();
GetPage()->setTransitionDuration( fValue );
break;
}
default:
throw beans::UnknownPropertyException();
}
GetModel()->SetModified();
}
Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
uno::Any aAny;
const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName);
switch( pEntry ? pEntry->nWID : -1 )
{
case WID_NAVORDER:
aAny = getNavigationOrder();
break;
case WID_PAGE_LEFT:
aAny <<= (sal_Int32)( GetPage()->GetLftBorder() );
break;
case WID_PAGE_RIGHT:
aAny <<= (sal_Int32)( GetPage()->GetRgtBorder() );
break;
case WID_PAGE_TOP:
aAny <<= (sal_Int32)( GetPage()->GetUppBorder() );
break;
case WID_PAGE_BOTTOM:
aAny <<= (sal_Int32)( GetPage()->GetLwrBorder() );
break;
case WID_PAGE_WIDTH:
aAny <<= (sal_Int32)( GetPage()->GetSize().getWidth() );
break;
case WID_PAGE_HEIGHT:
aAny <<= (sal_Int32)( GetPage()->GetSize().getHeight() );
break;
case WID_PAGE_ORIENT:
aAny = ::cppu::int2enum( (sal_Int32)((GetPage()->GetOrientation() == ORIENTATION_PORTRAIT)? view::PaperOrientation_PORTRAIT: view::PaperOrientation_LANDSCAPE), ::getCppuType((const view::PaperOrientation*)0) );
break;
case WID_PAGE_EFFECT:
aAny = ::cppu::int2enum( (sal_Int32)GetPage()->GetFadeEffect(), ::getCppuType((const presentation::FadeEffect*)0) );
break;
case WID_PAGE_CHANGE:
aAny <<= (sal_Int32)( GetPage()->GetPresChange() );
break;
case WID_PAGE_SPEED:
{
const double fDuration = GetPage()->getTransitionDuration();
aAny = ::cppu::int2enum( fDuration < 2.0 ? 2 : (fDuration > 2.0 ? 0 : 1), ::getCppuType((const presentation::AnimationSpeed*)0) );
}
break;
case WID_PAGE_LAYOUT:
aAny <<= (sal_Int16)( GetPage()->GetAutoLayout() );
break;
case WID_PAGE_NUMBER:
{
const sal_uInt16 nPageNumber(GetPage()->GetPageNum());
if(nPageNumber > 0)
{
// for all other pages calculate the number
aAny <<= (sal_Int16)((sal_uInt16)((nPageNumber-1)>>1) + 1);
}
else
{
aAny <<= mnTempPageNumber;
}
}
break;
case WID_PAGE_DURATION:
aAny <<= (sal_Int32)(GetPage()->GetTime());
break;
case WID_PAGE_LDNAME:
{
const OUString aName( GetPage()->GetName() );
aAny <<= aName;
break;
}
case WID_PAGE_LDBITMAP:
{
Reference< awt::XBitmap > xBitmap(
VCLUnoHelper::CreateBitmap( BitmapEx( SdResId( BMP_PAGE ) ) ) );
aAny <<= xBitmap;
}
break;
case WID_PAGE_BACK:
getBackground( aAny );
break;
case WID_PAGE_PREVIEW :
{
SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
if ( pDoc )
{
::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
if ( pDocShell )
{
sal_uInt16 nPgNum = 0;
sal_uInt16 nPageCount = pDoc->GetSdPageCount( PK_STANDARD );
sal_uInt16 nPageNumber = (sal_uInt16)( ( GetPage()->GetPageNum() - 1 ) >> 1 );
while( nPgNum < nPageCount )
{
pDoc->SetSelected( pDoc->GetSdPage( nPgNum, PK_STANDARD ), nPgNum == nPageNumber );
nPgNum++;
}
::boost::shared_ptr<GDIMetaFile> pMetaFile =
pDocShell->GetPreviewMetaFile();
if ( pMetaFile )
{
Point aPoint;
Size aSize( GetPage()->GetSize() );
pMetaFile->AddAction( (MetaAction*) new MetaFillColorAction( COL_WHITE, sal_True ), 0 );
pMetaFile->AddAction( (MetaAction*) new MetaRectAction( Rectangle( aPoint, aSize ) ), 1 );
pMetaFile->SetPrefMapMode( MAP_100TH_MM );
pMetaFile->SetPrefSize( aSize );
SvMemoryStream aDestStrm( 65535, 65535 );
ConvertGDIMetaFileToWMF( *pMetaFile, aDestStrm, NULL, sal_False );
Sequence<sal_Int8> aSeq( (sal_Int8*)aDestStrm.GetData(), aDestStrm.Tell() );
aAny <<= aSeq;
}
}
}
}
break;
case WID_PAGE_PREVIEWBITMAP :
{
SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
if ( pDoc )
{
::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
if ( pDocShell )
{
sal_uInt16 nPgNum = 0;
sal_uInt16 nPageCount = pDoc->GetSdPageCount( PK_STANDARD );
sal_uInt16 nPageNumber = (sal_uInt16)( ( GetPage()->GetPageNum() - 1 ) >> 1 );
while( nPgNum < nPageCount )
{
pDoc->SetSelected( pDoc->GetSdPage( nPgNum, PK_STANDARD ), nPgNum == nPageNumber );
nPgNum++;
}
::boost::shared_ptr<GDIMetaFile> pMetaFile =
pDocShell->GetPreviewMetaFile();
BitmapEx aBitmap;
if ( pMetaFile && pMetaFile->CreateThumbnail( 160, /* magic value taken from GraphicHelper::getThumbnailFormatFromGDI_Impl() */
aBitmap ) )
{
SvMemoryStream aMemStream;
aBitmap.GetBitmap().Write( aMemStream, sal_False, sal_False );
uno::Sequence<sal_Int8> aSeq( (sal_Int8*)aMemStream.GetData(), aMemStream.Tell() );
aAny <<= aSeq;
}
}
}
}
break;
case WID_PAGE_VISIBLE :
{
sal_Bool bVisible = GetPage()->IsExcluded() == sal_False;
aAny <<= Any( &bVisible, ::getBooleanCppuType() );
break;
}
case WID_PAGE_SOUNDFILE :
{
if( GetPage()->IsStopSound() )
{
aAny <<= sal_True;
}
else
{
OUString aURL;
if( GetPage()->IsSoundOn() )
aURL = GetPage()->GetSoundFile();
aAny <<= aURL;
}
break;
}
case WID_LOOP_SOUND:
{
aAny <<= (sal_Bool)GetPage()->IsLoopSound();
break;
}
case WID_PAGE_BACKFULL:
{
sal_Bool bFullSize = GetPage()->IsBackgroundFullSize();
aAny = Any( &bFullSize, ::getBooleanCppuType() );
break;
}
case WID_PAGE_BACKVIS:
{
SdrPage* pPage = GetPage();
if( pPage )
{
SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel();
if( pDoc->GetMasterPageCount() )
{
SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
aAny <<= (sal_Bool)aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False));
}
else
{
aAny <<= (sal_Bool)sal_False;
}
}
break;
}
case WID_PAGE_BACKOBJVIS:
{
SdrPage* pPage = GetPage();
if( pPage )
{
SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel();
if( pDoc->GetMasterPageCount() )
{
SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
aAny <<= (sal_Bool)aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False));
}
else
{
aAny <<= (sal_Bool)sal_False;
}
}
break;
}
case WID_PAGE_USERATTRIBS:
{
GetPage()->getAlienAttributes( aAny );
break;
}
case WID_PAGE_BOOKMARK:
{
aAny <<= getBookmarkURL();
break;
}
case WID_PAGE_ISDARK:
{
aAny <<= (sal_Bool)GetPage()->GetPageBackgroundColor().IsDark();
break;
}
case WID_PAGE_HEADERVISIBLE:
aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbHeaderVisible;
break;
case WID_PAGE_HEADERTEXT:
{
const OUString aText( GetPage()->getHeaderFooterSettings().maHeaderText );
aAny <<= aText;
}
break;
case WID_PAGE_FOOTERVISIBLE:
aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbFooterVisible;
break;
case WID_PAGE_FOOTERTEXT:
{
const OUString aText( GetPage()->getHeaderFooterSettings().maFooterText );
aAny <<= aText;
}
break;
case WID_PAGE_PAGENUMBERVISIBLE:
aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbSlideNumberVisible;
break;
case WID_PAGE_DATETIMEVISIBLE:
aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbDateTimeVisible;
break;
case WID_PAGE_DATETIMEFIXED:
aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbDateTimeIsFixed;
break;
case WID_PAGE_DATETIMETEXT:
{
const OUString aText( GetPage()->getHeaderFooterSettings().maDateTimeText );
aAny <<= aText;
}
break;
case WID_PAGE_DATETIMEFORMAT:
aAny <<= (sal_Int32)GetPage()->getHeaderFooterSettings().meDateTimeFormat;
break;
case WID_TRANSITION_TYPE:
aAny <<= GetPage()->getTransitionType();
break;
case WID_TRANSITION_SUBTYPE:
aAny <<= GetPage()->getTransitionSubtype();
break;
case WID_TRANSITION_DIRECTION:
aAny <<= GetPage()->getTransitionDirection();
break;
case WID_TRANSITION_FADE_COLOR:
aAny <<= GetPage()->getTransitionFadeColor();
break;
case WID_TRANSITION_DURATION:
aAny <<= GetPage()->getTransitionDuration();
break;
default:
throw beans::UnknownPropertyException();
}
return aAny;
}
void SAL_CALL SdGenericDrawPage::addPropertyChangeListener( const OUString& , const Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
void SAL_CALL SdGenericDrawPage::removePropertyChangeListener( const OUString& , const Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
void SAL_CALL SdGenericDrawPage::addVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
void SAL_CALL SdGenericDrawPage::removeVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
// XMultiPropertySet
void SAL_CALL SdGenericDrawPage::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues ) throw (beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, RuntimeException )
{
if( aPropertyNames.getLength() != aValues.getLength() )
throw lang::IllegalArgumentException();
const OUString* pNames = aPropertyNames.getConstArray();
const Any* pValues = aValues.getConstArray();
sal_uInt32 nCount = aValues.getLength();
while( nCount-- )
{
try
{
setPropertyValue( *pNames++, *pValues++ );
}
catch( beans::UnknownPropertyException& )
{
// ignore for multi property set
// todo: optimize this!
}
}
}
Sequence< Any > SAL_CALL SdGenericDrawPage::getPropertyValues( const Sequence< OUString >& aPropertyNames ) throw (RuntimeException)
{
const OUString* pNames = aPropertyNames.getConstArray();
sal_uInt32 nCount = aPropertyNames.getLength();
Sequence< Any > aValues( nCount );
Any* pValues = aValues.getArray();
while( nCount-- )
{
Any aValue;
try
{
aValue = getPropertyValue( *pNames++ );
}
catch( beans::UnknownPropertyException& )
{
// ignore for multi property set
// todo: optimize this!
}
*pValues++ = aValue;
}
return aValues;
}
void SAL_CALL SdGenericDrawPage::addPropertiesChangeListener( const Sequence< OUString >& , const Reference< beans::XPropertiesChangeListener >& ) throw (RuntimeException)
{
}
void SAL_CALL SdGenericDrawPage::removePropertiesChangeListener( const Reference< beans::XPropertiesChangeListener >& ) throw (RuntimeException)
{
}
void SAL_CALL SdGenericDrawPage::firePropertiesChangeEvent( const Sequence< OUString >& , const Reference< beans::XPropertiesChangeListener >& ) throw (RuntimeException)
{
}
Reference< drawing::XShape > SdGenericDrawPage::_CreateShape( SdrObject *pObj ) const throw()
{
DBG_ASSERT( GetPage(), "SdGenericDrawPage::_CreateShape(), can't create shape for disposed page!" );
DBG_ASSERT( pObj, "SdGenericDrawPage::_CreateShape(), invalid call with pObj == 0!" );
if( GetPage() && pObj )
{
PresObjKind eKind = GetPage()->GetPresObjKind(pObj);
SvxShape* pShape = NULL;
if(pObj->GetObjInventor() == SdrInventor)
{
sal_uInt32 nInventor = pObj->GetObjIdentifier();
switch( nInventor )
{
case OBJ_TITLETEXT:
pShape = new SvxShapeText( pObj );
if( GetPage()->GetPageKind() == PK_NOTES && GetPage()->IsMasterPage() )
{
// fake a empty PageShape if its a title shape on the master page
pShape->SetShapeType(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PageShape")));
}
else
{
pShape->SetShapeType(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TitleTextShape")));
}
eKind = PRESOBJ_NONE;
break;
case OBJ_OUTLINETEXT:
pShape = new SvxShapeText( pObj );
pShape->SetShapeType(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OutlinerShape")));
eKind = PRESOBJ_NONE;
break;
}
}
Reference< drawing::XShape > xShape( pShape );
if(!xShape.is())
xShape = SvxFmDrawPage::_CreateShape( pObj );
if( eKind != PRESOBJ_NONE )
{
String aShapeType( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation."));
switch( eKind )
{
case PRESOBJ_TITLE:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("TitleTextShape") );
break;
case PRESOBJ_OUTLINE:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("OutlinerShape") );
break;
case PRESOBJ_TEXT:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("SubtitleShape") );
break;
case PRESOBJ_GRAPHIC:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("GraphicObjectShape") );
break;
case PRESOBJ_OBJECT:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("OLE2Shape") );
break;
case PRESOBJ_CHART:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("ChartShape") );
break;
case PRESOBJ_ORGCHART:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("OrgChartShape") );
break;
case PRESOBJ_CALC:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("CalcShape") );
break;
case PRESOBJ_TABLE:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("TableShape") );
break;
case PRESOBJ_MEDIA:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("MediaShape") );
break;
case PRESOBJ_PAGE:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("PageShape") );
break;
case PRESOBJ_HANDOUT:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("HandoutShape") );
break;
case PRESOBJ_NOTES:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("NotesShape") );
break;
case PRESOBJ_FOOTER:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("FooterShape") );
break;
case PRESOBJ_HEADER:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("HeaderShape") );
break;
case PRESOBJ_SLIDENUMBER:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("SlideNumberShape") );
break;
case PRESOBJ_DATETIME:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("DateTimeShape") );
break;
case PRESOBJ_NONE:
case PRESOBJ_IMAGE:
case PRESOBJ_MAX:
break;
}
if( !pShape )
pShape = SvxShape::getImplementation( xShape );
if( pShape )
pShape->SetShapeType( aShapeType );
}
// SdXShape aggregiert SvxShape
new SdXShape( SvxShape::getImplementation( xShape ), GetModel() );
return xShape;
}
else
{
return SvxFmDrawPage::_CreateShape( pObj );
}
}
//----------------------------------------------------------------------
// XServiceInfo
Sequence< OUString > SAL_CALL SdGenericDrawPage::getSupportedServiceNames()
throw(uno::RuntimeException)
{
Sequence< OUString > aSeq( SvxFmDrawPage::getSupportedServiceNames() );
comphelper::ServiceInfoHelper::addToSequence( aSeq, 3, "com.sun.star.drawing.GenericDrawPage",
"com.sun.star.document.LinkTarget",
"com.sun.star.document.LinkTargetSupplier");
return aSeq;
}
//----------------------------------------------------------------------
// XLinkTargetSupplier
Reference< container::XNameAccess > SAL_CALL SdGenericDrawPage::getLinks( )
throw(uno::RuntimeException)
{
return new SdPageLinkTargets( (SdGenericDrawPage*)this );
}
//----------------------------------------------------------------------
void SdGenericDrawPage::setBackground( const Any& ) throw(lang::IllegalArgumentException)
{
OSL_FAIL( "Don't call me, I'm useless!" );
}
//----------------------------------------------------------------------
void SdGenericDrawPage::getBackground( Any& ) throw()
{
OSL_FAIL( "Don't call me, I'm useless!" );
}
//----------------------------------------------------------------------
OUString SdGenericDrawPage::getBookmarkURL() const
{
OUStringBuffer aRet;
if( SvxFmDrawPage::mpPage )
{
OUString aFileName( static_cast<SdPage*>(SvxFmDrawPage::mpPage)->GetFileName() );
if( aFileName.getLength() )
{
const OUString aBookmarkName( SdDrawPage::getPageApiNameFromUiName( static_cast<SdPage*>(SvxFmDrawPage::mpPage)->GetBookmarkName() ) );
aRet.append( aFileName );
aRet.append( (sal_Unicode)'#' );
aRet.append( aBookmarkName );
}
}
return aRet.makeStringAndClear();
}
//----------------------------------------------------------------------
void SdGenericDrawPage::setBookmarkURL( rtl::OUString& rURL )
{
if( SvxFmDrawPage::mpPage )
{
sal_Int32 nIndex = rURL.indexOf( (sal_Unicode)'#' );
if( nIndex != -1 )
{
const String aFileName( rURL.copy( 0, nIndex ) );
const String aBookmarkName( SdDrawPage::getUiNameFromPageApiName( rURL.copy( nIndex+1 ) ) );
if( aFileName.Len() && aBookmarkName.Len() )
{
static_cast<SdPage*>(SvxFmDrawPage::mpPage)->DisconnectLink();
static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetFileName( aFileName );
static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetBookmarkName( aBookmarkName );
static_cast<SdPage*>(SvxFmDrawPage::mpPage)->ConnectLink();
}
}
}
}
//----------------------------------------------------------------------
Reference< drawing::XShape > SAL_CALL SdGenericDrawPage::combine( const Reference< drawing::XShapes >& xShapes )
throw( uno::RuntimeException )
{
::SolarMutexGuard aGuard;
throwIfDisposed();
DBG_ASSERT(SvxFmDrawPage::mpPage,"SdrPage ist NULL! [CL]");
DBG_ASSERT(mpView, "SdrView ist NULL! [CL]");
Reference< drawing::XShape > xShape;
if(mpView==NULL||!xShapes.is()||GetPage()==NULL)
return xShape;
SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
_SelectObjectsInView( xShapes, pPageView );
mpView->CombineMarkedObjects( sal_False );
mpView->AdjustMarkHdl();
const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
if( rMarkList.GetMarkCount() == 1 )
{
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
if( pObj )
xShape = Reference< drawing::XShape >::query( pObj->getUnoShape() );
}
mpView->HideSdrPage();
GetModel()->SetModified();
return xShape;
}
//----------------------------------------------------------------------
void SAL_CALL SdGenericDrawPage::split( const Reference< drawing::XShape >& xGroup )
throw( uno::RuntimeException )
{
::SolarMutexGuard aGuard;
throwIfDisposed();
if(mpView==NULL||!xGroup.is()||GetPage()==NULL)
return;
SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
_SelectObjectInView( xGroup, pPageView );
mpView->DismantleMarkedObjects( sal_False );
mpView->HideSdrPage();
GetModel()->SetModified();
}
//----------------------------------------------------------------------
Reference< drawing::XShape > SAL_CALL SdGenericDrawPage::bind( const Reference< drawing::XShapes >& xShapes )
throw( uno::RuntimeException )
{
::SolarMutexGuard aGuard;
throwIfDisposed();
uno::Reference< drawing::XShape > xShape;
if(mpView==NULL||!xShapes.is()||GetPage()==NULL)
return xShape;
SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
_SelectObjectsInView( xShapes, pPageView );
mpView->CombineMarkedObjects( sal_True );
mpView->AdjustMarkHdl();
const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
if( rMarkList.GetMarkCount() == 1 )
{
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
if( pObj )
xShape = Reference< drawing::XShape >::query( pObj->getUnoShape() );
}
mpView->HideSdrPage();
GetModel()->SetModified();
return xShape;
}
//----------------------------------------------------------------------
void SAL_CALL SdGenericDrawPage::unbind( const Reference< drawing::XShape >& xShape )
throw( uno::RuntimeException )
{
::SolarMutexGuard aGuard;
throwIfDisposed();
if(mpView==NULL||!xShape.is()||GetPage()==NULL)
return;
SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
_SelectObjectInView( xShape, pPageView );
mpView->DismantleMarkedObjects( sal_True );
mpView->HideSdrPage();
GetModel()->SetModified();
}
void SdGenericDrawPage::SetLftBorder( sal_Int32 nValue )
{
if( nValue != GetPage()->GetLftBorder() )
{
SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
const PageKind ePageKind = GetPage()->GetPageKind();
sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
pPage->SetLftBorder( nValue );
}
nPageCnt = pDoc->GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
pPage->SetLftBorder( nValue );
}
}
}
void SdGenericDrawPage::SetRgtBorder( sal_Int32 nValue )
{
if( nValue != GetPage()->GetRgtBorder() )
{
SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
const PageKind ePageKind = GetPage()->GetPageKind();
sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
pPage->SetRgtBorder( nValue );
}
nPageCnt = pDoc->GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
pPage->SetRgtBorder( nValue );
}
}
}
void SdGenericDrawPage::SetUppBorder( sal_Int32 nValue )
{
if( nValue != GetPage()->GetUppBorder() )
{
SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
const PageKind ePageKind = GetPage()->GetPageKind();
sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
pPage->SetUppBorder( nValue );
}
nPageCnt = pDoc->GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
pPage->SetUppBorder( nValue );
}
}
}
void SdGenericDrawPage::SetLwrBorder( sal_Int32 nValue )
{
if( nValue != GetPage()->GetLwrBorder() )
{
SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
const PageKind ePageKind = GetPage()->GetPageKind();
sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
pPage->SetLwrBorder( nValue );
}
nPageCnt = pDoc->GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
pPage->SetLwrBorder( nValue );
}
}
}
static void refreshpage( SdDrawDocument* pDoc, const PageKind ePageKind )
{
::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
if ( pDocShell )
{
::sd::ViewShell* pViewSh = pDocShell->GetViewShell();
if( pViewSh )
{
if( pViewSh->ISA(::sd::DrawViewShell ) )
static_cast< ::sd::DrawViewShell*>(pViewSh)->ResetActualPage();
Size aPageSize = pDoc->GetSdPage(0, ePageKind)->GetSize();
const long nWidth = aPageSize.Width();
const long nHeight = aPageSize.Height();
Point aPageOrg = Point(nWidth, nHeight / 2);
Size aViewSize = Size(nWidth * 3, nHeight * 2);
pDoc->SetMaxObjSize(aViewSize);
pViewSh->InitWindows(aPageOrg, aViewSize, Point(-1, -1), sal_True);
pViewSh->UpdateScrollBars();
}
}
}
void SdGenericDrawPage::SetWidth( sal_Int32 nWidth )
{
Size aSize( GetPage()->GetSize() );
if( aSize.getWidth() != nWidth )
{
aSize.setWidth( nWidth );
SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
const PageKind ePageKind = GetPage()->GetPageKind();
sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
pPage->SetSize(aSize);
}
nPageCnt = pDoc->GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
pPage->SetSize(aSize);
}
refreshpage( pDoc, ePageKind );
}
}
void SdGenericDrawPage::SetHeight( sal_Int32 nHeight )
{
Size aSize( GetPage()->GetSize() );
if( aSize.getHeight() != nHeight )
{
aSize.setHeight( nHeight );
SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
const PageKind ePageKind = GetPage()->GetPageKind();
sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
pPage->SetSize(aSize);
}
nPageCnt = pDoc->GetSdPageCount(ePageKind);
for (i = 0; i < nPageCnt; i++)
{
SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
pPage->SetSize(aSize);
}
refreshpage( pDoc, ePageKind );
}
}
// XInterface
void SdGenericDrawPage::release() throw()
{
OWeakAggObject::release();
}
// XComponent
void SdGenericDrawPage::disposing() throw()
{
mpModel = 0;
SvxFmDrawPage::disposing();
}
// XAnimationNodeSupplier
Reference< XAnimationNode > SAL_CALL SdGenericDrawPage::getAnimationNode() throw (uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
SdPage *pSdPage = static_cast<SdPage*>(SvxFmDrawPage::mpPage);
return pSdPage->getAnimationNode();
}
//========================================================================
// SdPageLinkTargets
//========================================================================
SdPageLinkTargets::SdPageLinkTargets( SdGenericDrawPage* pUnoPage ) throw()
{
mxPage = pUnoPage;
mpUnoPage = pUnoPage;
}
SdPageLinkTargets::~SdPageLinkTargets() throw()
{
}
// XElementAccess
uno::Type SAL_CALL SdPageLinkTargets::getElementType()
throw(uno::RuntimeException)
{
return ITYPE(beans::XPropertySet);
}
sal_Bool SAL_CALL SdPageLinkTargets::hasElements()
throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
SdPage* pPage = mpUnoPage->GetPage();
if( pPage != NULL )
{
SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
while( aIter.IsMore() )
{
SdrObject* pObj = aIter.Next();
String aStr( pObj->GetName() );
if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) )
aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
if( aStr.Len() )
return sal_True;
}
}
return sal_False;
}
// container::XNameAccess
// XNameAccess
Any SAL_CALL SdPageLinkTargets::getByName( const OUString& aName )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
::SolarMutexGuard aGuard;
SdPage* pPage = mpUnoPage->GetPage();
if( pPage != NULL )
{
SdrObject* pObj = FindObject( aName );
if( pObj )
{
Reference< beans::XPropertySet > aRef( pObj->getUnoShape(), uno::UNO_QUERY );
return makeAny( aRef );
}
}
throw container::NoSuchElementException();
}
Sequence< OUString > SAL_CALL SdPageLinkTargets::getElementNames()
throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
sal_uInt32 nObjCount = 0;
SdPage* pPage = mpUnoPage->GetPage();
if( pPage != NULL )
{
SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
while( aIter.IsMore() )
{
SdrObject* pObj = aIter.Next();
String aStr( pObj->GetName() );
if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) )
aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
if( aStr.Len() )
nObjCount++;
}
}
Sequence< OUString > aSeq( nObjCount );
if( nObjCount > 0 )
{
OUString* pStr = aSeq.getArray();
SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
while( aIter.IsMore() )
{
SdrObject* pObj = aIter.Next();
String aStr( pObj->GetName() );
if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) )
aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
if( aStr.Len() )
*pStr++ = aStr;
}
}
return aSeq;
}
sal_Bool SAL_CALL SdPageLinkTargets::hasByName( const OUString& aName )
throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
return FindObject( aName ) != NULL;
}
SdrObject* SdPageLinkTargets::FindObject( const String& rName ) const throw()
{
SdPage* pPage = mpUnoPage->GetPage();
if( pPage == NULL )
return NULL;
SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
while( aIter.IsMore() )
{
SdrObject* pObj = aIter.Next();
String aStr( pObj->GetName() );
if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) )
aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
if( aStr.Len() && (aStr == rName) )
return pObj;
}
return NULL;
}
// XServiceInfo
OUString SAL_CALL SdPageLinkTargets::getImplementationName()
throw(uno::RuntimeException)
{
return OUString( RTL_CONSTASCII_USTRINGPARAM("SdPageLinkTargets") );
}
sal_Bool SAL_CALL SdPageLinkTargets::supportsService( const OUString& ServiceName )
throw(uno::RuntimeException)
{
return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
}
Sequence< OUString > SAL_CALL SdPageLinkTargets::getSupportedServiceNames()
throw(uno::RuntimeException)
{
const OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.LinkTargets") );
Sequence< OUString > aSeq( &aSN, 1);
return aSeq;
}
//========================================================================
// SdDrawPage
//========================================================================
SdDrawPage::SdDrawPage( SdXImpressDocument* pModel, SdPage* pPage ) throw()
: SdGenericDrawPage( pModel, pPage, ImplGetDrawPagePropertySet( pModel->IsImpressDocument(), pPage->GetPageKind() ) )
{
}
SdDrawPage::~SdDrawPage() throw()
{
}
// XInterface
Any SAL_CALL SdDrawPage::queryInterface( const uno::Type & rType )
throw(uno::RuntimeException)
{
if( rType == ITYPE( drawing::XMasterPageTarget ) )
{
return makeAny( Reference< drawing::XMasterPageTarget >( this ) );
}
else
{
if( mbIsImpressDocument )
{
const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
if( ePageKind != PK_HANDOUT && rType == ITYPE( presentation::XPresentationPage ) )
{
return makeAny( Reference< presentation::XPresentationPage >( this ) );
}
}
}
return SdGenericDrawPage::queryInterface( rType );
}
void SAL_CALL SdDrawPage::acquire() throw()
{
SvxDrawPage::acquire();
}
void SAL_CALL SdDrawPage::release() throw()
{
SvxDrawPage::release();
}
UNO3_GETIMPLEMENTATION2_IMPL( SdDrawPage, SdGenericDrawPage );
// XTypeProvider
Sequence< uno::Type > SAL_CALL SdDrawPage::getTypes() throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
if( maTypeSequence.getLength() == 0 )
{
const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
sal_Bool bPresPage = mbIsImpressDocument && ePageKind != PK_HANDOUT;
// Collect the types of this class.
::std::vector<uno::Type> aTypes;
aTypes.reserve(13);
aTypes.push_back(ITYPE(drawing::XDrawPage));
aTypes.push_back(ITYPE(beans::XPropertySet));
aTypes.push_back(ITYPE(container::XNamed));
aTypes.push_back(ITYPE(drawing::XMasterPageTarget));
aTypes.push_back(ITYPE(lang::XServiceInfo));
aTypes.push_back(ITYPE(util::XReplaceable));
aTypes.push_back(ITYPE(document::XLinkTargetSupplier));
aTypes.push_back(ITYPE( drawing::XShapeCombiner ));
aTypes.push_back(ITYPE( drawing::XShapeBinder ));
aTypes.push_back(ITYPE( office::XAnnotationAccess ));
aTypes.push_back(ITYPE( beans::XMultiPropertySet ));
if( bPresPage )
aTypes.push_back(ITYPE(presentation::XPresentationPage));
if( bPresPage && ePageKind == PK_STANDARD )
aTypes.push_back(ITYPE(XAnimationNodeSupplier));
// Get types of base class.
const Sequence< uno::Type > aBaseTypes( SdGenericDrawPage::getTypes() );
const sal_Int32 nBaseTypes = aBaseTypes.getLength();
const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
// Join those types in a sequence.
maTypeSequence.realloc(aTypes.size() + nBaseTypes);
uno::Type* pTypes = maTypeSequence.getArray();
::std::vector<uno::Type>::const_iterator iType;
for (iType=aTypes.begin(); iType!=aTypes.end(); ++iType)
*pTypes++ = *iType;
for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
*pTypes++ = *pBaseTypes++;
}
return maTypeSequence;
}
namespace
{
class theSdDrawPageImplementationId : public rtl::Static< UnoTunnelIdInit, theSdDrawPageImplementationId > {};
}
Sequence< sal_Int8 > SAL_CALL SdDrawPage::getImplementationId() throw(uno::RuntimeException)
{
return theSdDrawPageImplementationId::get().getSeq();
}
OUString SdDrawPage::getPageApiName( SdPage* pPage )
{
return ::getPageApiName( pPage );
}
OUString getPageApiName( SdPage* pPage )
{
OUString aPageName;
if(pPage)
{
aPageName = pPage->GetRealName();
if( aPageName.getLength() == 0 )
{
OUStringBuffer sBuffer;
sBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( sEmptyPageName ) );
const sal_Int32 nPageNum = ( ( pPage->GetPageNum() - 1 ) >> 1 ) + 1;
sBuffer.append( nPageNum );
aPageName = sBuffer.makeStringAndClear();
}
}
return aPageName;
}
OUString getPageApiNameFromUiName( const String& rUIName )
{
OUString aApiName;
String aDefPageName(SdResId(STR_PAGE));
aDefPageName += sal_Unicode( ' ' );
if( rUIName.Equals( aDefPageName, 0, aDefPageName.Len() ) )
{
aApiName = OUString( RTL_CONSTASCII_USTRINGPARAM( sEmptyPageName ) );
aApiName += rUIName.Copy( aDefPageName.Len() );
}
else
{
aApiName = rUIName;
}
return aApiName;
}
OUString SdDrawPage::getPageApiNameFromUiName( const String& rUIName )
{
return ::getPageApiNameFromUiName( rUIName );
}
String getUiNameFromPageApiNameImpl( const OUString& rApiName )
{
const String aDefPageName(RTL_CONSTASCII_USTRINGPARAM( sEmptyPageName ));
if( rApiName.compareTo( aDefPageName, aDefPageName.Len() ) == 0 )
{
OUString aNumber( rApiName.copy( sizeof( sEmptyPageName ) - 1 ) );
// create the page number
sal_Int32 nPageNumber = aNumber.toInt32();
// check if there are non number characters in the number part
const sal_Int32 nChars = aNumber.getLength();
const sal_Unicode* pString = aNumber.getStr();
sal_Int32 nChar;
for( nChar = 0; nChar < nChars; nChar++, pString++ )
{
if((*pString < sal_Unicode('0')) || (*pString > sal_Unicode('9')))
{
// found a non number character, so this is not the default
// name for this page
nPageNumber = -1;
break;
}
}
if( nPageNumber != -1)
{
OUStringBuffer sBuffer;
sBuffer.append( String(SdResId(STR_PAGE)) );
sBuffer.append( sal_Unicode( ' ' ) );
sBuffer.append( aNumber );
return sBuffer.makeStringAndClear();
}
}
return rApiName;
}
String SdDrawPage::getUiNameFromPageApiName( const OUString& rApiName )
{
return getUiNameFromPageApiNameImpl( rApiName );
}
// XServiceInfo
OUString SAL_CALL SdDrawPage::getImplementationName() throw(uno::RuntimeException)
{
return OUString( RTL_CONSTASCII_USTRINGPARAM("SdDrawPage") );
}
Sequence< OUString > SAL_CALL SdDrawPage::getSupportedServiceNames() throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() );
comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.DrawPage" );
if( mbIsImpressDocument )
comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.DrawPage" );
return aSeq;
}
sal_Bool SAL_CALL SdDrawPage::supportsService( const OUString& ServiceName )
throw(uno::RuntimeException)
{
return SdGenericDrawPage::supportsService( ServiceName );
}
// XNamed
void SAL_CALL SdDrawPage::setName( const OUString& rName )
throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
DBG_ASSERT( GetPage() && !GetPage()->IsMasterPage(), "Don't call base implementation for masterpages!" );
OUString aName( rName );
if(GetPage() && GetPage()->GetPageKind() != PK_NOTES)
{
// check if this is the default 'page1234' name
if(aName.compareToAscii( sEmptyPageName, sizeof( sEmptyPageName ) - 1 ) == 0)
{
// ok, it maybe is, first get the number part after 'page'
OUString aNumber( aName.copy( sizeof( sEmptyPageName ) - 1 ) );
// create the page number
sal_Int32 nPageNumber = aNumber.toInt32();
// check if there are non number characters in the number part
const sal_Int32 nChars = aNumber.getLength();
const sal_Unicode* pString = aNumber.getStr();
sal_Int32 nChar;
for( nChar = 0; nChar < nChars; nChar++, pString++ )
{
if((*pString < '0') || (*pString > '9'))
{
// found a non number character, so this is not the default
// name for this page
nPageNumber = -1;
break;
}
}
if( nPageNumber == ( ( GetPage()->GetPageNum() - 1 ) >> 1 ) + 1 )
aName = OUString();
}
else
{
String aDefaultPageName( SdResId(STR_PAGE) );
aDefaultPageName += sal_Unicode( ' ' );
if( aName.compareTo( aDefaultPageName, aDefaultPageName.Len() ) == 0 )
aName = OUString();
}
GetPage()->SetName( aName );
sal_uInt16 nNotesPageNum = (GetPage()->GetPageNum()-1)>>1;
if( GetModel()->GetDoc()->GetSdPageCount( PK_NOTES ) > nNotesPageNum )
{
SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( nNotesPageNum, PK_NOTES );
if( pNotesPage )
pNotesPage->SetName(aName);
}
// fake a mode change to repaint the page tab bar
::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell();
::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : NULL;
if( pViewSh && pViewSh->ISA(::sd::DrawViewShell))
{
::sd::DrawViewShell* pDrawViewSh = static_cast<
::sd::DrawViewShell*>(pViewSh);
EditMode eMode = pDrawViewSh->GetEditMode();
if( eMode == EM_PAGE )
{
sal_Bool bLayer = pDrawViewSh->IsLayerModeActive();
pDrawViewSh->ChangeEditMode( eMode, !bLayer );
pDrawViewSh->ChangeEditMode( eMode, bLayer );
}
}
GetModel()->SetModified();
}
}
OUString SAL_CALL SdDrawPage::getName()
throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
return getPageApiName( GetPage() );
}
// XMasterPageTarget
Reference< drawing::XDrawPage > SAL_CALL SdDrawPage::getMasterPage( )
throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
if(GetPage())
{
Reference< drawing::XDrawPages > xPages( GetModel()->getMasterPages() );
Reference< drawing::XDrawPage > xPage;
if(SvxFmDrawPage::mpPage->TRG_HasMasterPage())
{
SdrPage& rMasterPage = SvxFmDrawPage::mpPage->TRG_GetMasterPage();
xPage = uno::Reference< drawing::XDrawPage >( rMasterPage.getUnoPage(), uno::UNO_QUERY );
}
return xPage;
}
return NULL;
}
void SAL_CALL SdDrawPage::setMasterPage( const Reference< drawing::XDrawPage >& xMasterPage )
throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
if(SvxFmDrawPage::mpPage)
{
SdMasterPage* pMasterPage = SdMasterPage::getImplementation( xMasterPage );
if( pMasterPage && pMasterPage->isValid() )
{
SvxFmDrawPage::mpPage->TRG_ClearMasterPage();
SdPage* pSdPage = (SdPage*) pMasterPage->GetSdrPage();
SvxFmDrawPage::mpPage->TRG_SetMasterPage(*pSdPage);
SvxFmDrawPage::mpPage->SetBorder(pSdPage->GetLftBorder(),pSdPage->GetUppBorder(),
pSdPage->GetRgtBorder(),pSdPage->GetLwrBorder() );
SvxFmDrawPage::mpPage->SetSize( pSdPage->GetSize() );
SvxFmDrawPage::mpPage->SetOrientation( pSdPage->GetOrientation() );
((SdPage*)SvxFmDrawPage::mpPage)->SetLayoutName( ( (SdPage*)pSdPage )->GetLayoutName() );
// set notes master also
SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PK_NOTES );
pNotesPage->TRG_ClearMasterPage();
sal_uInt16 nNum = (SvxFmDrawPage::mpPage->TRG_GetMasterPage()).GetPageNum() + 1;
pNotesPage->TRG_SetMasterPage(*SvxFmDrawPage::mpPage->GetModel()->GetMasterPage(nNum));
pNotesPage->SetLayoutName( ( (SdPage*)pSdPage )->GetLayoutName() );
GetModel()->SetModified();
}
}
}
// XPresentationPage
Reference< drawing::XDrawPage > SAL_CALL SdDrawPage::getNotesPage()
throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
if(SvxFmDrawPage::mpPage && GetModel()->GetDoc() && SvxFmDrawPage::mpPage->GetPageNum() )
{
SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PK_NOTES );
if( pNotesPage )
{
Reference< drawing::XDrawPage > xPage( pNotesPage->getUnoPage(), uno::UNO_QUERY );
return xPage;
}
}
return NULL;
}
// XIndexAccess
sal_Int32 SAL_CALL SdDrawPage::getCount()
throw(uno::RuntimeException)
{
return SdGenericDrawPage::getCount();
}
Any SAL_CALL SdDrawPage::getByIndex( sal_Int32 Index )
throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
{
return SdGenericDrawPage::getByIndex( Index );
}
// XElementAccess
uno::Type SAL_CALL SdDrawPage::getElementType()
throw(uno::RuntimeException)
{
return SdGenericDrawPage::getElementType();
}
sal_Bool SAL_CALL SdDrawPage::hasElements()
throw(uno::RuntimeException)
{
return SdGenericDrawPage::hasElements();
}
// XShapes
void SAL_CALL SdDrawPage::add( const Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException)
{
SdGenericDrawPage::add( xShape );
}
void SAL_CALL SdDrawPage::remove( const Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
SvxShape* pShape = SvxShape::getImplementation( xShape );
if( pShape )
{
SdrObject* pObj = pShape->GetSdrObject();
if( pObj )
{
GetPage()->RemovePresObj(pObj);
pObj->SetUserCall(NULL);
}
}
SdGenericDrawPage::remove( xShape );
}
void SdDrawPage::setBackground( const Any& rValue )
throw( lang::IllegalArgumentException )
{
Reference< beans::XPropertySet > xSet;
if( !(rValue >>= xSet) && !rValue.hasValue() )
throw lang::IllegalArgumentException();
if( !xSet.is() )
{
// the easy case, no background set. Set XFILL_NONE to represent this
GetPage()->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
return;
}
// is it our own implementation?
SdUnoPageBackground* pBack = SdUnoPageBackground::getImplementation( xSet );
SfxItemSet aSet( GetModel()->GetDoc()->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
if( pBack )
{
pBack->fillItemSet( (SdDrawDocument*)GetPage()->GetModel(), aSet );
}
else
{
SdUnoPageBackground* pBackground = new SdUnoPageBackground();
Reference< beans::XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() );
Reference< beans::XPropertySet > xDestSet( (beans::XPropertySet*)pBackground );
Reference< beans::XPropertySetInfo > xDestSetInfo( xDestSet->getPropertySetInfo() );
Sequence< beans::Property > aProperties( xDestSetInfo->getProperties() );
sal_Int32 nCount = aProperties.getLength();
beans::Property* pProp = aProperties.getArray();
while( nCount-- )
{
const OUString aPropName( pProp->Name );
if( xSetInfo->hasPropertyByName( aPropName ) )
xDestSet->setPropertyValue( aPropName,
xSet->getPropertyValue( aPropName ) );
pProp++;
}
pBackground->fillItemSet( (SdDrawDocument*)GetPage()->GetModel(), aSet );
}
if( aSet.Count() == 0 )
{
// no background fill, represent by setting XFILL_NONE
GetPage()->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
}
else
{
// background fill, set at page (not sure if ClearItem is needed)
GetPage()->getSdrPageProperties().ClearItem();
GetPage()->getSdrPageProperties().PutItemSet(aSet);
}
// repaint only
SvxFmDrawPage::mpPage->ActionChanged();
}
// XAnnotationAccess:
Reference< XAnnotation > SAL_CALL SdGenericDrawPage::createAndInsertAnnotation() throw (RuntimeException)
{
if( !GetPage() )
throw DisposedException();
Reference< XAnnotation > xRet;
GetPage()->createAnnotation(xRet);
return xRet;
}
void SAL_CALL SdGenericDrawPage::removeAnnotation(const Reference< XAnnotation > & annotation) throw (RuntimeException, IllegalArgumentException)
{
GetPage()->removeAnnotation(annotation);
}
Reference< XAnnotationEnumeration > SAL_CALL SdGenericDrawPage::createAnnotationEnumeration() throw (RuntimeException)
{
return ::sd::createAnnotationEnumeration( GetPage()->getAnnotations() );
}
void SdDrawPage::getBackground( Any& rValue ) throw()
{
const SfxItemSet& rFillAttributes = GetPage()->getSdrPageProperties().GetItemSet();
if(XFILL_NONE == ((const XFillStyleItem&)rFillAttributes.Get(XATTR_FILLSTYLE)).GetValue())
{
// no fill set (switched off by XFILL_NONE), clear rValue to represent this
rValue.clear();
}
else
{
// there is a fill set, export to rValue
Reference< beans::XPropertySet > xSet(new SdUnoPageBackground(
GetModel()->GetDoc(),
&GetPage()->getSdrPageProperties().GetItemSet()));
rValue <<= xSet;
}
}
void SdGenericDrawPage::setNavigationOrder( const Any& rValue )
{
Reference< XIndexAccess > xIA( rValue, UNO_QUERY );
if( xIA.is() )
{
if( dynamic_cast< SdDrawPage* >( xIA.get() ) == this )
{
if( GetPage()->HasObjectNavigationOrder() )
GetPage()->ClearObjectNavigationOrder();
return;
}
else if( xIA->getCount() == static_cast< sal_Int32 >( GetPage()->GetObjCount() ) )
{
GetPage()->SetNavigationOrder(xIA);
return;
}
}
throw IllegalArgumentException();
}
class NavigationOrderAccess : public ::cppu::WeakImplHelper1< XIndexAccess >
{
public:
NavigationOrderAccess( SdrPage* pPage );
// XIndexAccess
virtual sal_Int32 SAL_CALL getCount( ) throw (RuntimeException);
virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException);
// XElementAccess
virtual Type SAL_CALL getElementType( ) throw (RuntimeException);
virtual sal_Bool SAL_CALL hasElements( ) throw (RuntimeException);
private:
std::vector< Reference< XShape > > maShapes;
};
NavigationOrderAccess::NavigationOrderAccess( SdrPage* pPage )
: maShapes( static_cast< sal_uInt32 >( pPage ? pPage->GetObjCount() : 0 ) )
{
if( pPage )
{
sal_uInt32 nIndex;
const sal_uInt32 nCount = static_cast< sal_uInt32 >( pPage->GetObjCount() );
for( nIndex = 0; nIndex < nCount; ++nIndex )
{
SdrObject* pObj = pPage->GetObj( nIndex );
sal_uInt32 nNavPos = pObj->GetNavigationPosition();
DBG_ASSERT( !maShapes[nNavPos].is(), "sd::NavigationOrderAccess::NavigationOrderAccess(), duplicate navigation positions from core!" );
maShapes[nNavPos] = Reference< XShape >( pObj->getUnoShape(), UNO_QUERY );
}
}
}
// XIndexAccess
sal_Int32 SAL_CALL NavigationOrderAccess::getCount( ) throw (RuntimeException)
{
return static_cast< sal_Int32 >( maShapes.size() );
}
Any SAL_CALL NavigationOrderAccess::getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
{
if( (Index < 0) || (Index > getCount()) )
throw IndexOutOfBoundsException();
return Any( maShapes[Index] );
}
// XElementAccess
Type SAL_CALL NavigationOrderAccess::getElementType( ) throw (RuntimeException)
{
return XShape::static_type();
}
sal_Bool SAL_CALL NavigationOrderAccess::hasElements( ) throw (RuntimeException)
{
return maShapes.empty() ? sal_False : sal_True;
}
Any SdGenericDrawPage::getNavigationOrder()
{
if( GetPage()->HasObjectNavigationOrder() )
{
return Any( Reference< XIndexAccess >( new NavigationOrderAccess( GetPage() ) ) );
}
else
{
return Any( Reference< XIndexAccess >( this ) );
}
}
//========================================================================
// class SdMasterPage
//========================================================================
SdMasterPage::SdMasterPage( SdXImpressDocument* pModel, SdPage* pPage ) throw()
: SdGenericDrawPage( pModel, pPage, ImplGetMasterPagePropertySet( pPage ? pPage->GetPageKind() : PK_STANDARD ) )
{
}
SdMasterPage::~SdMasterPage() throw()
{
}
// XInterface
Any SAL_CALL SdMasterPage::queryInterface( const uno::Type & rType )
throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
uno::Any aAny;
if( rType == ITYPE( container::XIndexAccess ) )
aAny <<= Reference< container::XIndexAccess >((presentation::XPresentationPage*)(this));
else if( rType == ITYPE( container::XElementAccess ) )
aAny <<= Reference< container::XElementAccess >((presentation::XPresentationPage*)(this));
else if( rType == ITYPE( container::XNamed ) )
aAny <<= Reference< container::XNamed >(this);
else if( rType == ITYPE( presentation::XPresentationPage ) &&
( mbIsImpressDocument &&
GetPage() && GetPage()->GetPageKind() != PK_HANDOUT) )
aAny <<= Reference< presentation::XPresentationPage >( this );
else
return SdGenericDrawPage::queryInterface( rType );
return aAny;
}
void SAL_CALL SdMasterPage::acquire() throw()
{
SvxDrawPage::acquire();
}
void SAL_CALL SdMasterPage::release() throw()
{
SvxDrawPage::release();
}
UNO3_GETIMPLEMENTATION2_IMPL( SdMasterPage, SdGenericDrawPage );
// XTypeProvider
Sequence< uno::Type > SAL_CALL SdMasterPage::getTypes() throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
if( maTypeSequence.getLength() == 0 )
{
const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
sal_Bool bPresPage = mbIsImpressDocument && SvxFmDrawPage::mpPage && ePageKind != PK_HANDOUT;
// Collect the types of this class.
::std::vector<uno::Type> aTypes;
aTypes.reserve(12);
aTypes.push_back(ITYPE(drawing::XDrawPage));
aTypes.push_back(ITYPE(beans::XPropertySet));
aTypes.push_back(ITYPE(container::XNamed));
aTypes.push_back(ITYPE(lang::XServiceInfo));
aTypes.push_back(ITYPE(util::XReplaceable));
aTypes.push_back(ITYPE(document::XLinkTargetSupplier));
aTypes.push_back(ITYPE( drawing::XShapeCombiner ));
aTypes.push_back(ITYPE( drawing::XShapeBinder ));
aTypes.push_back(ITYPE( office::XAnnotationAccess ));
aTypes.push_back(ITYPE( beans::XMultiPropertySet ));
if( bPresPage )
aTypes.push_back(ITYPE(presentation::XPresentationPage));
if( bPresPage && ePageKind == PK_STANDARD )
aTypes.push_back(ITYPE(XAnimationNodeSupplier));
// Get types of base class.
const Sequence< uno::Type > aBaseTypes( SdGenericDrawPage::getTypes() );
const sal_Int32 nBaseTypes = aBaseTypes.getLength();
const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
// Join those types in a sequence.
maTypeSequence.realloc(aTypes.size() + nBaseTypes);
uno::Type* pTypes = maTypeSequence.getArray();
::std::vector<uno::Type>::const_iterator iType;
for (iType=aTypes.begin(); iType!=aTypes.end(); ++iType)
*pTypes++ = *iType;
for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
*pTypes++ = *pBaseTypes++;
}
return maTypeSequence;
}
namespace
{
class theSdMasterPageImplementationId : public rtl::Static< UnoTunnelIdInit, theSdMasterPageImplementationId > {};
}
Sequence< sal_Int8 > SAL_CALL SdMasterPage::getImplementationId() throw(uno::RuntimeException)
{
return theSdMasterPageImplementationId::get().getSeq();
}
// XServiceInfo
OUString SAL_CALL SdMasterPage::getImplementationName() throw(uno::RuntimeException)
{
return OUString( RTL_CONSTASCII_USTRINGPARAM("SdMasterPage") );
}
Sequence< OUString > SAL_CALL SdMasterPage::getSupportedServiceNames() throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() );
comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.MasterPage" );
if( SvxFmDrawPage::mpPage && ((SdPage*)SvxFmDrawPage::mpPage)->GetPageKind() == PK_HANDOUT )
comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.HandoutMasterPage" );
return aSeq;
}
sal_Bool SAL_CALL SdMasterPage::supportsService( const OUString& ServiceName )
throw(uno::RuntimeException)
{
return SdGenericDrawPage::supportsService( ServiceName );
}
// XElementAccess
sal_Bool SAL_CALL SdMasterPage::hasElements() throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
if( SvxFmDrawPage::mpPage == NULL )
return sal_False;
return SvxFmDrawPage::mpPage->GetObjCount() > 0;
}
uno::Type SAL_CALL SdMasterPage::getElementType()
throw(uno::RuntimeException)
{
return SdGenericDrawPage::getElementType();
}
// XIndexAccess
sal_Int32 SAL_CALL SdMasterPage::getCount()
throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
return SdGenericDrawPage::getCount();
}
Any SAL_CALL SdMasterPage::getByIndex( sal_Int32 Index )
throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
return SdGenericDrawPage::getByIndex(Index);
}
// intern
void SdMasterPage::setBackground( const Any& rValue )
throw( lang::IllegalArgumentException )
{
// we need at least an beans::XPropertySet
Reference< beans::XPropertySet > xInputSet( rValue, UNO_QUERY );
if( !xInputSet.is() )
throw lang::IllegalArgumentException();
try
{
if( GetModel() && mbIsImpressDocument )
{
Reference< container::XNameAccess > xFamilies( GetModel()->getStyleFamilies(), UNO_QUERY_THROW );
Reference< container::XNameAccess > xFamily( xFamilies->getByName( getName() ), UNO_QUERY_THROW ) ;
if( xFamily.is() )
{
OUString aStyleName( OUString::createFromAscii(sUNO_PseudoSheet_Background) );
Reference< beans::XPropertySet > xStyleSet( xFamily->getByName( aStyleName ), UNO_QUERY_THROW );
Reference< beans::XPropertySetInfo > xSetInfo( xInputSet->getPropertySetInfo(), UNO_QUERY_THROW );
Reference< beans::XPropertyState > xSetStates( xInputSet, UNO_QUERY );
PropertyEntryVector_t aBackgroundProperties = ImplGetPageBackgroundPropertySet()->getPropertyMap()->getPropertyEntries();
PropertyEntryVector_t::const_iterator aIt = aBackgroundProperties.begin();
while( aIt != aBackgroundProperties.end() )
{
if( xSetInfo->hasPropertyByName( aIt->sName ) )
{
if( !xSetStates.is() || xSetStates->getPropertyState( aIt->sName ) == beans::PropertyState_DIRECT_VALUE )
xStyleSet->setPropertyValue( aIt->sName, xInputSet->getPropertyValue( aIt->sName ) );
else
xSetStates->setPropertyToDefault( aIt->sName );
}
++aIt;
}
}
}
else
{
// first fill an item set
// is it our own implementation?
SdUnoPageBackground* pBack = SdUnoPageBackground::getImplementation( xInputSet );
SfxItemSet aSet( GetModel()->GetDoc()->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
if( pBack )
{
pBack->fillItemSet( (SdDrawDocument*)GetPage()->GetModel(), aSet );
}
else
{
SdUnoPageBackground* pBackground = new SdUnoPageBackground();
Reference< beans::XPropertySetInfo > xInputSetInfo( xInputSet->getPropertySetInfo(), UNO_QUERY_THROW );
Reference< beans::XPropertySet > xDestSet( (beans::XPropertySet*)pBackground );
Reference< beans::XPropertySetInfo > xDestSetInfo( xDestSet->getPropertySetInfo(), UNO_QUERY_THROW );
uno::Sequence< beans::Property> aProperties( xDestSetInfo->getProperties() );
sal_Int32 nCount = aProperties.getLength();
beans::Property* pProp = aProperties.getArray();
while( nCount-- )
{
const OUString aPropName( pProp->Name );
if( xInputSetInfo->hasPropertyByName( aPropName ) )
xDestSet->setPropertyValue( aPropName, xInputSet->getPropertyValue( aPropName ) );
pProp++;
}
pBackground->fillItemSet( (SdDrawDocument*)SvxFmDrawPage::mpPage->GetModel(), aSet );
}
// if we find the background style, copy the set to the background
SdDrawDocument* pDoc = (SdDrawDocument*)SvxFmDrawPage::mpPage->GetModel();
SfxStyleSheetBasePool* pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool();
if(pSSPool)
{
String aLayoutName( static_cast< SdPage* >( SvxFmDrawPage::mpPage )->GetLayoutName() );
aLayoutName.Erase(aLayoutName.Search(String(RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR)))+4);
aLayoutName += String(SdResId(STR_LAYOUT_BACKGROUND));
SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, SD_STYLE_FAMILY_MASTERPAGE );
if( pStyleSheet )
{
pStyleSheet->GetItemSet().Put( aSet );
// repaint only
SvxFmDrawPage::mpPage->ActionChanged();
return;
}
}
// if no background style is available, set at page directly. This
// is an error and should NOT happen (and will be asserted from the SdrPage)
GetPage()->getSdrPageProperties().PutItemSet(aSet);
}
}
catch( Exception& )
{
OSL_FAIL("sd::SdMasterPage::setBackground(), exception caught!");
}
}
void SdMasterPage::getBackground( Any& rValue ) throw()
{
if( GetModel() ) try
{
if( mbIsImpressDocument )
{
Reference< container::XNameAccess > xFamilies( GetModel()->getStyleFamilies(), UNO_QUERY_THROW );
Reference< container::XNameAccess > xFamily( xFamilies->getByName( getName() ), UNO_QUERY_THROW );
const OUString aStyleName( OUString::createFromAscii(sUNO_PseudoSheet_Background) );
rValue <<= Reference< beans::XPropertySet >( xFamily->getByName( aStyleName ), UNO_QUERY_THROW );
}
else
{
SdDrawDocument* pDoc = (SdDrawDocument*)SvxFmDrawPage::mpPage->GetModel();
SfxStyleSheetBasePool* pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool();
if(pSSPool)
{
String aLayoutName( static_cast< SdPage* >(SvxFmDrawPage::mpPage)->GetLayoutName() );
aLayoutName.Erase( aLayoutName.Search(String(RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR)))+4);
aLayoutName += String(SdResId(STR_LAYOUT_BACKGROUND));
SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, SD_STYLE_FAMILY_MASTERPAGE );
if( pStyleSheet )
{
SfxItemSet aStyleSet( pStyleSheet->GetItemSet());
if( aStyleSet.Count() )
{
rValue <<= Reference< beans::XPropertySet >( new SdUnoPageBackground( pDoc, &aStyleSet ) );
return;
}
}
}
// No style found, use fill attributes from page background. This
// should NOT happen and is an error
const SfxItemSet& rFallbackItemSet(SvxFmDrawPage::mpPage->getSdrPageProperties().GetItemSet());
if(XFILL_NONE == ((const XFillStyleItem&)rFallbackItemSet.Get(XATTR_FILLSTYLE)).GetValue())
{
rValue <<= Reference< beans::XPropertySet >(
new SdUnoPageBackground(GetModel()->GetDoc(), &rFallbackItemSet));
}
else
{
rValue.clear();
}
}
}
catch( Exception& )
{
rValue.clear();
OSL_FAIL("sd::SdMasterPage::getBackground(), exception caught!");
}
}
// XNamed
void SAL_CALL SdMasterPage::setName( const OUString& rName )
throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
if(SvxFmDrawPage::mpPage && GetPage()->GetPageKind() != PK_NOTES)
{
SdDrawDocument* pDoc = GetModel()->GetDoc();
sal_Bool bOutDummy;
String aNewName( rName );
// Slide Name has to be unique
if( pDoc && pDoc->GetPageByName( aNewName, bOutDummy ) != SDRPAGE_NOTFOUND )
return; // throw Exception ?
GetPage()->SetName( aNewName );
if( pDoc )
pDoc->RenameLayoutTemplate( GetPage()->GetLayoutName(), aNewName );
// fake a mode change to repaint the page tab bar
::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell();
::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : NULL;
if( pViewSh && pViewSh->ISA(::sd::DrawViewShell ) )
{
::sd::DrawViewShell* pDrawViewSh =
static_cast< ::sd::DrawViewShell*>(pViewSh);
EditMode eMode = pDrawViewSh->GetEditMode();
if( eMode == EM_MASTERPAGE )
{
sal_Bool bLayer = pDrawViewSh->IsLayerModeActive();
pDrawViewSh->ChangeEditMode( eMode, !bLayer );
pDrawViewSh->ChangeEditMode( eMode, bLayer );
}
}
GetModel()->SetModified();
}
}
OUString SAL_CALL SdMasterPage::getName( )
throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
if(SvxFmDrawPage::mpPage)
{
String aLayoutName( GetPage()->GetLayoutName() );
aLayoutName = aLayoutName.Erase(aLayoutName.Search( String( RTL_CONSTASCII_USTRINGPARAM((SD_LT_SEPARATOR)))));
return aLayoutName;
}
return OUString();
}
// XPresentationPage
Reference< drawing::XDrawPage > SAL_CALL SdMasterPage::getNotesPage()
throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
if(SvxFmDrawPage::mpPage && GetModel()->GetDoc() )
{
SdPage* pNotesPage = GetModel()->GetDoc()->GetMasterSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PK_NOTES );
if( pNotesPage )
{
Reference< drawing::XDrawPage > xPage( pNotesPage->getUnoPage(), uno::UNO_QUERY );
return xPage;
}
}
return NULL;
}
// XShapes
void SAL_CALL SdMasterPage::add( const Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException)
{
SdGenericDrawPage::add( xShape );
}
void SAL_CALL SdMasterPage::remove( const Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException)
{
::SolarMutexGuard aGuard;
throwIfDisposed();
SvxShape* pShape = SvxShape::getImplementation( xShape );
if( pShape )
{
SdrObject* pObj = pShape->GetSdrObject();
if( pObj )
{
if( GetPage()->IsPresObj( pObj ) )
GetPage()->RemovePresObj(pObj);
}
}
SdGenericDrawPage::remove( xShape );
}
Reference< uno::XInterface > createUnoPageImpl( SdPage* pPage )
{
Reference< uno::XInterface > xPage;
if( pPage && pPage->GetModel() )
{
SdXImpressDocument* pModel = SdXImpressDocument::getImplementation( pPage->GetModel()->getUnoModel() );
if( pModel )
{
if( pPage->IsMasterPage() )
{
xPage = (::cppu::OWeakObject*)new SdMasterPage( pModel, pPage );
}
else
{
xPage = (::cppu::OWeakObject*)new SdDrawPage( pModel, pPage );
}
}
}
return xPage;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|