1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
|
/* -*- 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.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_toolkit.hxx"
#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
#include <vcl/wall.hxx>
#include <osl/mutex.hxx>
#include <toolkit/controls/dialogcontrol.hxx>
#include <toolkit/helper/property.hxx>
#include <toolkit/helper/unopropertyarrayhelper.hxx>
#include <toolkit/controls/geometrycontrolmodel.hxx>
#include <toolkit/controls/unocontrols.hxx>
#include "toolkit/controls/formattedcontrol.hxx"
#include "toolkit/controls/roadmapcontrol.hxx"
#include "toolkit/controls/tkscrollbar.hxx"
#include <toolkit/controls/stdtabcontroller.hxx>
#include <toolkit/controls/tksimpleanimation.hxx>
#include <toolkit/controls/tkthrobber.hxx>
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/awt/WindowAttribute.hpp>
#include <com/sun/star/resource/XStringResourceResolver.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
#include <tools/list.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
#include <comphelper/processfactory.hxx>
#include <vcl/svapp.hxx>
#include <vcl/outdev.hxx>
#include <comphelper/types.hxx>
#include <comphelper/componentcontext.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <vcl/graph.hxx>
#include <vcl/image.hxx>
#include "tree/treecontrol.hxx"
#include "grid/gridcontrol.hxx"
#include <map>
#include <boost/unordered_map.hpp>
#include <algorithm>
#include <o3tl/compat_functional.hxx>
#include "tools/urlobj.hxx"
#include "osl/file.hxx"
#include <com/sun/star/awt/XSimpleTabController.hpp>
#include <vcl/tabctrl.hxx>
#include <vcl/tabpage.hxx>
#include <vcl/button.hxx>
#include <toolkit/awt/vclxwindows.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::script;
using namespace toolkit;
#define PROPERTY_RESOURCERESOLVER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ))
#define PROPERTY_DIALOGSOURCEURL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogSourceURL" ))
#define PROPERTY_IMAGEURL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ImageURL" ))
#define PROPERTY_GRAPHIC ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Graphic" ))
//HELPER
::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl );
uno::Reference< graphic::XGraphic > getGraphicFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& rxGrfObj, const ::rtl::OUString& _rURL );
struct LanguageDependentProp
{
const char* pPropName;
sal_Int32 nPropNameLength;
};
// ----------------------------------------------------------------------------
namespace
{
static const Sequence< ::rtl::OUString >& lcl_getLanguageDependentProperties()
{
static Sequence< ::rtl::OUString > s_aLanguageDependentProperties;
if ( s_aLanguageDependentProperties.getLength() == 0 )
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
if ( s_aLanguageDependentProperties.getLength() == 0 )
{
s_aLanguageDependentProperties.realloc( 2 );
s_aLanguageDependentProperties[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) );
s_aLanguageDependentProperties[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) );
// note: properties must be sorted
}
}
return s_aLanguageDependentProperties;
}
static ::rtl::OUString lcl_GetStringProperty( const ::rtl::OUString& sProperty, const Reference< XPropertySet >& xSet )
{
::rtl::OUString sValue;
Reference< XPropertySetInfo > xPSI;
if (xSet.is() && (xPSI = xSet->getPropertySetInfo()).is() &&
xPSI->hasPropertyByName( sProperty ) )
{
xSet->getPropertyValue( sProperty ) >>= sValue;
}
return sValue;
}
}
// ----------------------------------------------------------------------------
// functor for disposing a control model
struct DisposeControlModel : public ::std::unary_function< Reference< XControlModel >, void >
{
void operator()( Reference< XControlModel >& _rxModel )
{
try
{
::comphelper::disposeComponent( _rxModel );
}
catch( const Exception& )
{
DBG_ERROR( "DisposeControlModel::(): caught an exception while disposing a component!" );
}
}
};
// ----------------------------------------------------------------------------
// functor for searching control model by name
struct FindControlModel : public ::std::unary_function< UnoControlDialogModel::UnoControlModelHolder, bool >
{
private:
const ::rtl::OUString& m_rName;
public:
FindControlModel( const ::rtl::OUString& _rName ) : m_rName( _rName ) { }
bool operator()( const UnoControlDialogModel::UnoControlModelHolder& _rCompare )
{
return ( _rCompare.second == m_rName ) ? true : false;
}
};
// ----------------------------------------------------------------------------
// functor for cloning a control model, and insertion into a target list
struct CloneControlModel : public ::std::unary_function< UnoControlDialogModel::UnoControlModelHolder, void >
{
private:
UnoControlDialogModel::UnoControlModelHolderList& m_rTargetList;
public:
CloneControlModel( UnoControlDialogModel::UnoControlModelHolderList& _rTargetList )
:m_rTargetList( _rTargetList )
{
}
void operator()( const UnoControlDialogModel::UnoControlModelHolder& _rSource )
{
// clone the source object
Reference< XCloneable > xCloneSource( _rSource.first, UNO_QUERY );
Reference< XControlModel > xClone( xCloneSource->createClone(), UNO_QUERY );
// add to target list
m_rTargetList.push_back( UnoControlDialogModel::UnoControlModelHolder( xClone, _rSource.second ) );
}
};
// ----------------------------------------------------------------------------
// functor for comparing a XControlModel with a given reference
struct CompareControlModel : public ::std::unary_function< UnoControlDialogModel::UnoControlModelHolder, bool >
{
private:
Reference< XControlModel > m_xReference;
public:
CompareControlModel( const Reference< XControlModel >& _rxReference ) : m_xReference( _rxReference ) { }
bool operator()( const UnoControlDialogModel::UnoControlModelHolder& _rCompare )
{
return ( _rCompare.first.get() == m_xReference.get() ) ? true : false;
}
};
// ----------------------------------------------------------------------------
static void lcl_throwIllegalArgumentException( )
{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
throw IllegalArgumentException();
}
// ----------------------------------------------------------------------------
static void lcl_throwNoSuchElementException( )
{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
throw NoSuchElementException();
}
// ----------------------------------------------------------------------------
static void lcl_throwElementExistException( )
{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
throw ElementExistException();
}
// ----------------------------------------------------------------------------
static const ::rtl::OUString& getTabIndexPropertyName( )
{
static const ::rtl::OUString s_sTabIndexProperty( RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) );
return s_sTabIndexProperty;
}
// ----------------------------------------------------------------------------
static const ::rtl::OUString& getStepPropertyName( )
{
static const ::rtl::OUString s_sStepProperty( RTL_CONSTASCII_USTRINGPARAM( "Step" ) );
return s_sStepProperty;
}
// we probably will need both a hash of control models and hash of controls
// => use some template magic
typedef ::cppu::WeakImplHelper1< container::XNameContainer > SimpleNameContainer_BASE;
template< typename T >
class SimpleNamedThingContainer : public SimpleNameContainer_BASE
{
typedef boost::unordered_map< rtl::OUString, Reference< T >, ::rtl::OUStringHash,
::std::equal_to< ::rtl::OUString > > NamedThingsHash;
NamedThingsHash things;
::osl::Mutex m_aMutex;
public:
// ::com::sun::star::container::XNameContainer, XNameReplace, XNameAccess
virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
if ( !hasByName( aName ) )
throw NoSuchElementException();
Reference< T > xElement;
if ( ! ( aElement >>= xElement ) )
throw IllegalArgumentException();
things[ aName ] = xElement;
}
virtual Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
if ( !hasByName( aName ) )
throw NoSuchElementException();
return uno::makeAny( things[ aName ] );
}
virtual Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
Sequence< ::rtl::OUString > aResult( things.size() );
typename NamedThingsHash::iterator it = things.begin();
typename NamedThingsHash::iterator it_end = things.end();
rtl::OUString* pName = aResult.getArray();
for (; it != it_end; ++it, ++pName )
*pName = it->first;
return aResult;
}
virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
return ( things.find( aName ) != things.end() );
}
virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
if ( hasByName( aName ) )
throw ElementExistException();
Reference< T > xElement;
if ( ! ( aElement >>= xElement ) )
throw IllegalArgumentException();
things[ aName ] = xElement;
}
virtual void SAL_CALL removeByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
if ( !hasByName( aName ) )
throw NoSuchElementException();
things.erase( things.find( aName ) );
}
virtual Type SAL_CALL getElementType( ) throw (RuntimeException)
{
return T::static_type( NULL );
}
virtual ::sal_Bool SAL_CALL hasElements( ) throw (RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
return ( things.size() > 0 );
}
};
// ----------------------------------------------------
// class UnoControlDialogModel
// ----------------------------------------------------
UnoControlDialogModel::UnoControlDialogModel( bool regProps )
:maContainerListeners( *this )
,maChangeListeners ( GetMutex() )
,mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
{
if ( !regProps ) // Register properties elsewhere ( probably in class derived from this )
return;
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
// ImplRegisterProperty( BASEPROPERTY_BORDER );
ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
ImplRegisterProperty( BASEPROPERTY_ENABLED );
ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
// ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
ImplRegisterProperty( BASEPROPERTY_HELPURL );
ImplRegisterProperty( BASEPROPERTY_TITLE );
ImplRegisterProperty( BASEPROPERTY_SIZEABLE );
ImplRegisterProperty( BASEPROPERTY_DESKTOP_AS_PARENT );
ImplRegisterProperty( BASEPROPERTY_DECORATION );
ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
ImplRegisterProperty( BASEPROPERTY_GRAPHIC );
ImplRegisterProperty( BASEPROPERTY_IMAGEURL );
Any aBool;
aBool <<= (sal_Bool) sal_True;
ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
// #TODO separate class for 'UserForm' ( instead of re-using Dialog ? )
uno::Reference< XNameContainer > xNameCont = new SimpleNamedThingContainer< XControlModel >();
ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES, uno::makeAny( xNameCont ) );
}
UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel )
: UnoControlDialogModel_IBase( rModel )
, UnoControlDialogModel_Base( rModel )
, maContainerListeners( *this )
, maChangeListeners ( GetMutex() )
, mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
{
}
UnoControlDialogModel::~UnoControlDialogModel()
{
maModels.clear();
mbGroupsUpToDate = sal_False;
}
Any UnoControlDialogModel::queryAggregation( const Type & rType ) throw(RuntimeException)
{
Any aRet( UnoControlDialogModel_IBase::queryInterface( rType ) );
return (aRet.hasValue() ? aRet : UnoControlDialogModel_Base::queryAggregation( rType ));
}
// XTypeProvider
IMPL_IMPLEMENTATION_ID( UnoControlDialogModel )
Sequence< Type > UnoControlDialogModel::getTypes() throw(RuntimeException)
{
return ::comphelper::concatSequences(
UnoControlDialogModel_IBase::getTypes(),
UnoControlDialogModel_Base::getTypes()
);
}
::rtl::OUString UnoControlDialogModel::getServiceName( ) throw(RuntimeException)
{
return ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialogModel );
}
void SAL_CALL UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
{
UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
try
{
switch ( nHandle )
{
case BASEPROPERTY_IMAGEURL:
if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_GRAPHIC ) )
{
mbAdjustingGraphic = true;
::rtl::OUString sImageURL;
OSL_VERIFY( rValue >>= sImageURL );
setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( ImageHelper::getGraphicAndGraphicObjectFromURL_nothrow( mxGrfObj, sImageURL ) ) );
mbAdjustingGraphic = false;
}
break;
case BASEPROPERTY_GRAPHIC:
if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_IMAGEURL ) )
{
mbAdjustingGraphic = true;
setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ), uno::makeAny( ::rtl::OUString() ) );
mbAdjustingGraphic = false;
}
break;
}
}
catch( const ::com::sun::star::uno::Exception& )
{
OSL_ENSURE( sal_False, "UnoControlDialogModel::setFastPropertyValue_NoBroadcast: caught an exception while setting Graphic/ImageURL properties!" );
}
}
Any UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
{
Any aAny;
switch ( nPropId )
{
case BASEPROPERTY_DEFAULTCONTROL:
aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialog );
break;
default:
aAny = UnoControlModel::ImplGetDefaultValue( nPropId );
}
return aAny;
}
::cppu::IPropertyArrayHelper& UnoControlDialogModel::getInfoHelper()
{
static UnoPropertyArrayHelper* pHelper = NULL;
if ( !pHelper )
{
Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
pHelper = new UnoPropertyArrayHelper( aIDs );
}
return *pHelper;
}
void SAL_CALL UnoControlDialogModel::dispose( ) throw(RuntimeException)
{
// ====================================================================
// tell our listeners
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
EventObject aDisposeEvent;
aDisposeEvent.Source = static_cast< XAggregation* >( static_cast< ::cppu::OWeakAggObject* >( this ) );
maContainerListeners.disposeAndClear( aDisposeEvent );
maChangeListeners.disposeAndClear( aDisposeEvent );
}
// ====================================================================
// call the base class
UnoControlModel::dispose();
// ====================================================================
// dispose our child models
// for this, collect the models (we collect them from maModels, and this is modified when disposing children)
::std::vector< Reference< XControlModel > > aChildModels( maModels.size() );
::std::transform(
maModels.begin(), maModels.end(), // source range
aChildModels.begin(), // target location
::o3tl::select1st< UnoControlModelHolder >( ) // operation to apply -> select the XControlModel part
);
// now dispose
::std::for_each( aChildModels.begin(), aChildModels.end(), DisposeControlModel() );
aChildModels.clear();
mbGroupsUpToDate = sal_False;
}
// XMultiPropertySet
Reference< XPropertySetInfo > UnoControlDialogModel::getPropertySetInfo( ) throw(RuntimeException)
{
static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
UnoControlModel* UnoControlDialogModel::Clone() const
{
// clone the container itself
UnoControlDialogModel* pClone = new UnoControlDialogModel( *this );
// clone all children
::std::for_each(
maModels.begin(), maModels.end(),
CloneControlModel( pClone->maModels )
);
return pClone;
}
UnoControlDialogModel::UnoControlModelHolderList::iterator UnoControlDialogModel::ImplFindElement( const ::rtl::OUString& rName )
{
return ::std::find_if( maModels.begin(), maModels.end(), FindControlModel( rName ) );
}
// ::XMultiServiceFactory
Reference< XInterface > UnoControlDialogModel::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(Exception, RuntimeException)
{
SolarMutexGuard aSolarGuard;
OGeometryControlModel_Base* pNewModel = NULL;
if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlEditModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlEditModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFormattedFieldModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlFormattedFieldModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFileControlModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlFileControlModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlButtonModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlButtonModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlImageControlModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlImageControlModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRadioButtonModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlRadioButtonModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCheckBoxModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlCheckBoxModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlFixedHyperlinkModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlFixedHyperlinkModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlFixedTextModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlFixedTextModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlGroupBoxModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlGroupBoxModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlListBoxModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlListBoxModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlComboBoxModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlComboBoxModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlDateFieldModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlDateFieldModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlTimeFieldModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlTimeFieldModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlNumericFieldModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlNumericFieldModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCurrencyFieldModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlCurrencyFieldModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlPatternFieldModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlPatternFieldModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlProgressBarModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlProgressBarModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlScrollBarModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlScrollBarModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFixedLineModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlFixedLineModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRoadmapModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoControlRoadmapModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName_TreeControlModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoTreeModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName_GridControlModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoGridModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoMultiPageModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoMultiPageModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoFrameModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoFrameModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoSimpleAnimationControlModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoSimpleAnimationControlModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoThrobberControlModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoThrobberControlModel >;
if ( !pNewModel )
{
Reference< XMultiServiceFactory > xORB( ::comphelper::getProcessServiceFactory() );
if ( xORB.is() )
{
Reference< XInterface > xObject = xORB->createInstance( aServiceSpecifier );
Reference< XServiceInfo > xSI( xObject, UNO_QUERY );
Reference< XCloneable > xCloneAccess( xSI, UNO_QUERY );
Reference< XAggregation > xAgg( xCloneAccess, UNO_QUERY );
if ( xAgg.is() )
{
if ( xSI->supportsService( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlModel")) ) )
{
// release 3 of the 4 references we have to the object
xAgg.clear();
xSI.clear();
xObject.clear();
pNewModel = new OCommonGeometryControlModel( xCloneAccess, aServiceSpecifier );
}
}
}
}
Reference< XInterface > xNewModel = (::cppu::OWeakObject*)pNewModel;
return xNewModel;
}
Reference< XInterface > UnoControlDialogModel::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const Sequence< Any >& /* Arguments */ ) throw(Exception, RuntimeException)
{
return createInstance( ServiceSpecifier );
}
Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() throw(RuntimeException)
{
static Sequence< ::rtl::OUString >* pNamesSeq = NULL;
if ( !pNamesSeq )
{
pNamesSeq = new Sequence< ::rtl::OUString >( 26 );
::rtl::OUString* pNames = pNamesSeq->getArray();
pNames[0] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel );
pNames[1] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel );
pNames[2] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControlModel );
pNames[3] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButtonModel );
pNames[4] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControlModel );
pNames[5] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel );
pNames[6] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBoxModel );
pNames[7] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedTextModel );
pNames[8] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBoxModel );
pNames[9] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBoxModel );
pNames[10] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBoxModel );
pNames[11] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateFieldModel );
pNames[12] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeFieldModel );
pNames[13] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericFieldModel );
pNames[14] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyFieldModel );
pNames[15] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternFieldModel );
pNames[16] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlProgressBarModel );
pNames[17] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlScrollBarModel );
pNames[18] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedLineModel );
pNames[19] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRoadmapModel );
pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_TreeControlModel );
pNames[21] = ::rtl::OUString::createFromAscii( szServiceName_GridControlModel );
pNames[22] = ::rtl::OUString::createFromAscii( szServiceName2_UnoSimpleAnimationControlModel );
pNames[23] = ::rtl::OUString::createFromAscii( szServiceName2_UnoThrobberControlModel );
pNames[24] = ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageModel );
pNames[25] = ::rtl::OUString::createFromAscii( szServiceName_UnoFrameModel );
}
return *pNamesSeq;
}
// XContainer
void UnoControlDialogModel::addContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
{
maContainerListeners.addInterface( l );
}
void UnoControlDialogModel::removeContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
{
maContainerListeners.removeInterface( l );
}
// XElementAcces
Type UnoControlDialogModel::getElementType() throw(RuntimeException)
{
Type aType = getCppuType( ( Reference< XControlModel>* ) NULL );
return aType;
}
void UnoControlDialogModel::updateUserFormChildren( const Reference< XNameContainer >& xAllChildren, const rtl::OUString& aName, ChildOperation Operation, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xTarget ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
{
if ( Operation < Insert || Operation > Remove )
throw IllegalArgumentException();
if ( xAllChildren.is() )
{
if ( Operation == Remove )
{
Reference< XControlModel > xOldModel( xAllChildren->getByName( aName ), UNO_QUERY );
xAllChildren->removeByName( aName );
Reference< XNameContainer > xChildContainer( xOldModel, UNO_QUERY );
if ( xChildContainer.is() )
{
Reference< XPropertySet > xProps( xChildContainer, UNO_QUERY );
// container control is being removed from this container, reset the
// global list of containees
if ( xProps.is() )
xProps->setPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ), uno::makeAny( uno::Reference< XNameContainer >() ) );
Sequence< rtl::OUString > aChildNames = xChildContainer->getElementNames();
for ( sal_Int32 index=0; index< aChildNames.getLength(); ++index )
updateUserFormChildren( xAllChildren, aChildNames[ index ], Operation, Reference< XControlModel > () );
}
}
else if ( Operation == Insert )
{
xAllChildren->insertByName( aName, uno::makeAny( xTarget ) );
Reference< XNameContainer > xChildContainer( xTarget, UNO_QUERY );
if ( xChildContainer.is() )
{
// container control is being added from this container, reset the
// global list of containees to point to the correct global list
Reference< XPropertySet > xProps( xChildContainer, UNO_QUERY );
if ( xProps.is() )
xProps->setPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ), uno::makeAny( xAllChildren ) );
Sequence< rtl::OUString > aChildNames = xChildContainer->getElementNames();
for ( sal_Int32 index=0; index< aChildNames.getLength(); ++index )
{
Reference< XControlModel > xChildTarget( xChildContainer->getByName( aChildNames[ index ] ), UNO_QUERY );
updateUserFormChildren( xAllChildren, aChildNames[ index ], Operation, xChildTarget );
}
}
}
}
else
throw IllegalArgumentException();
}
sal_Bool UnoControlDialogModel::hasElements() throw(RuntimeException)
{
return !maModels.empty();
}
// XNameContainer, XNameReplace, XNameAccess
void UnoControlDialogModel::replaceByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
{
SolarMutexGuard aSolarGuard;
Reference< XControlModel > xNewModel;
aElement >>= xNewModel;
if ( !xNewModel.is() )
lcl_throwIllegalArgumentException();
UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
if ( maModels.end() == aElementPos )
lcl_throwNoSuchElementException();
// Dialog behaviour is to have all containee names unique ( MSO Userform is the same )
// With container controls you could have constructed an existing hierachy and are now
// add this to an existing container, in this case a name nested in the containment
// hierachy of the added control could contain a name clash, if we have access to the
// list of global names then recursively check for previously existing names ( we need
// to do this obviously before the 'this' objects container is updated
Reference< XNameContainer > xAllChildren( getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY );
if ( xAllChildren.is() )
{
// remove old control ( and children ) from global list of containees
updateUserFormChildren( xAllChildren, aName, Remove, uno::Reference< XControlModel >() );
// Add new control ( and containees if they exist )
updateUserFormChildren( xAllChildren, aName, Insert, xNewModel );
}
// stop listening at the old model
stopControlListening( aElementPos->first );
Reference< XControlModel > xReplaced( aElementPos->first );
// remember the new model, and start listening
aElementPos->first = xNewModel;
startControlListening( xNewModel );
ContainerEvent aEvent;
aEvent.Source = *this;
aEvent.Element = aElement;
aEvent.ReplacedElement <<= xReplaced;
aEvent.Accessor <<= aName;
// notify the container listener
maContainerListeners.elementReplaced( aEvent );
// our "tab controller model" has potentially changed -> notify this
implNotifyTabModelChange( aName );
}
Any UnoControlDialogModel::getByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
{
UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
if ( maModels.end() == aElementPos )
lcl_throwNoSuchElementException();
return makeAny( aElementPos->first );
}
Sequence< ::rtl::OUString > UnoControlDialogModel::getElementNames() throw(RuntimeException)
{
Sequence< ::rtl::OUString > aNames( maModels.size() );
::std::transform(
maModels.begin(), maModels.end(), // source range
aNames.getArray(), // target range
::o3tl::select2nd< UnoControlModelHolder >() // operator to apply: select the second element (the name)
);
return aNames;
}
sal_Bool UnoControlDialogModel::hasByName( const ::rtl::OUString& aName ) throw(RuntimeException)
{
return maModels.end() != ImplFindElement( aName );
}
void UnoControlDialogModel::insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
{
SolarMutexGuard aSolarGuard;
Reference< XControlModel > xM;
aElement >>= xM;
if ( xM.is() )
{
Reference< beans::XPropertySet > xProps( xM, UNO_QUERY );
if ( xProps.is() )
{
Reference< beans::XPropertySetInfo > xPropInfo = xProps.get()->getPropertySetInfo();
::rtl::OUString sImageSourceProperty = GetPropertyName( BASEPROPERTY_IMAGEURL );
if ( xPropInfo.get()->hasPropertyByName( sImageSourceProperty ))
{
Any aUrl = xProps.get()->getPropertyValue( sImageSourceProperty );
::rtl::OUString absoluteUrl;
aUrl >>= absoluteUrl;
if ( absoluteUrl.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 )
xProps.get()->setPropertyValue( sImageSourceProperty , aUrl );
// Now we inherit from this class, no all containers have
// DialogSourceURL
else if ( getPropertySetInfo()->hasPropertyByName( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL ) ) )
getPhysicalLocation( getPropertyValue( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL ) ), aUrl );
aUrl <<= absoluteUrl;
xProps.get()->setPropertyValue( sImageSourceProperty , aUrl );
}
}
}
if ( !aName.getLength() || !xM.is() )
lcl_throwIllegalArgumentException();
UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
if ( maModels.end() != aElementPos )
lcl_throwElementExistException();
// Dialog behaviour is to have all containee names unique ( MSO Userform is the same )
// With container controls you could have constructed an existing hierachy and are now
// add this to an existing container, in this case a name nested in the containment
// hierachy of the added control could contain a name clash, if we have access to the
// list of global names then we need to recursively check for previously existing
// names ( we need to do this obviously before the 'this' objects container is updated
// remove old control ( and children ) from global list of containees
Reference< XNameContainer > xAllChildren( getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY );
if ( xAllChildren.is() )
updateUserFormChildren( xAllChildren, aName, Insert, xM );
maModels.push_back( UnoControlModelHolder( xM, aName ) );
mbGroupsUpToDate = sal_False;
startControlListening( xM );
ContainerEvent aEvent;
aEvent.Source = *this;
aEvent.Element <<= aElement;
aEvent.Accessor <<= aName;
maContainerListeners.elementInserted( aEvent );
// our "tab controller model" has potentially changed -> notify this
implNotifyTabModelChange( aName );
}
void UnoControlDialogModel::removeByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
{
SolarMutexGuard aSolarGuard;
UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
if ( maModels.end() == aElementPos )
lcl_throwNoSuchElementException();
// Dialog behaviour is to have all containee names unique ( MSO Userform is the same )
// With container controls you could have constructed an existing hierachy and are now
// removing this control from an existing container, in this case all nested names in
// the containment hierachy of the control to be removed need to be removed from the global
// names cache ( we need to do this obviously before the 'this' objects container is updated )
Reference< XNameContainer > xAllChildren( getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY );
if ( xAllChildren.is() )
updateUserFormChildren( xAllChildren, aName, Remove, uno::Reference< XControlModel >() );
ContainerEvent aEvent;
aEvent.Source = *this;
aEvent.Element <<= aElementPos->first;
aEvent.Accessor <<= aName;
maContainerListeners.elementRemoved( aEvent );
stopControlListening( aElementPos->first );
Reference< XPropertySet > xPS( aElementPos->first, UNO_QUERY );
maModels.erase( aElementPos );
mbGroupsUpToDate = sal_False;
if ( xPS.is() )
try
{
xPS->setPropertyValue( PROPERTY_RESOURCERESOLVER, makeAny( Reference< resource::XStringResourceResolver >() ) );
}
catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); }
// our "tab controller model" has potentially changed -> notify this
implNotifyTabModelChange( aName );
}
// ----------------------------------------------------------------------------
sal_Bool SAL_CALL UnoControlDialogModel::getGroupControl( ) throw (RuntimeException)
{
return sal_True;
}
// ----------------------------------------------------------------------------
void SAL_CALL UnoControlDialogModel::setGroupControl( sal_Bool ) throw (RuntimeException)
{
DBG_ERROR( "UnoControlDialogModel::setGroupControl: explicit grouping not supported" );
}
// ----------------------------------------------------------------------------
void SAL_CALL UnoControlDialogModel::setControlModels( const Sequence< Reference< XControlModel > >& _rControls ) throw (RuntimeException)
{
SolarMutexGuard aSolarGuard;
// set the tab indexes according to the order of models in the sequence
const Reference< XControlModel >* pControls = _rControls.getConstArray( );
const Reference< XControlModel >* pControlsEnd = _rControls.getConstArray( ) + _rControls.getLength();
sal_Int16 nTabIndex = 1;
for ( ; pControls != pControlsEnd; ++pControls )
{
// look up the control in our own structure. This is to prevent invalid arguments
UnoControlModelHolderList::const_iterator aPos =
::std::find_if(
maModels.begin(), maModels.end(),
CompareControlModel( *pControls )
);
if ( maModels.end() != aPos )
{
// okay, this is an existent model
// now set the TabIndex property (if applicable)
Reference< XPropertySet > xProps( aPos->first, UNO_QUERY );
Reference< XPropertySetInfo > xPSI;
if ( xProps.is() )
xPSI = xProps->getPropertySetInfo();
if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
xProps->setPropertyValue( getTabIndexPropertyName(), makeAny( nTabIndex++ ) );
}
mbGroupsUpToDate = sal_False;
}
}
typedef ::std::multimap< sal_Int32, Reference< XControlModel >, ::std::less< sal_Int32 > > MapIndexToModel;
// ----------------------------------------------------------------------------
Sequence< Reference< XControlModel > > SAL_CALL UnoControlDialogModel::getControlModels( ) throw (RuntimeException)
{
SolarMutexGuard aSolarGuard;
MapIndexToModel aSortedModels;
// will be the sorted container of all models which have a tab index property
::std::vector< Reference< XControlModel > > aUnindexedModels;
// will be the container of all models which do not have a tab index property
UnoControlModelHolderList::const_iterator aLoop = maModels.begin();
for ( ; aLoop != maModels.end(); ++aLoop )
{
Reference< XControlModel > xModel( aLoop->first );
// see if the model has a TabIndex property
Reference< XPropertySet > xControlProps( xModel, UNO_QUERY );
Reference< XPropertySetInfo > xPSI;
if ( xControlProps.is() )
xPSI = xControlProps->getPropertySetInfo( );
DBG_ASSERT( xPSI.is(), "UnoControlDialogModel::getControlModels: invalid child model!" );
// has it?
if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
{ // yes
sal_Int32 nTabIndex = -1;
xControlProps->getPropertyValue( getTabIndexPropertyName() ) >>= nTabIndex;
aSortedModels.insert( MapIndexToModel::value_type( nTabIndex, xModel ) );
}
else if ( xModel.is() )
// no, it hasn't, but we have to include it, anyway
aUnindexedModels.push_back( xModel );
}
// okay, here we have a container of all our models, sorted by tab index,
// plus a container of "unindexed" models
// -> merge them
Sequence< Reference< XControlModel > > aReturn( aUnindexedModels.size() + aSortedModels.size() );
::std::transform(
aSortedModels.begin(), aSortedModels.end(),
::std::copy( aUnindexedModels.begin(), aUnindexedModels.end(), aReturn.getArray() ),
::o3tl::select2nd< MapIndexToModel::value_type >( )
);
return aReturn;
}
// ----------------------------------------------------------------------------
void SAL_CALL UnoControlDialogModel::setGroup( const Sequence< Reference< XControlModel > >&, const ::rtl::OUString& ) throw (RuntimeException)
{
// not supported. We have only implicit grouping:
// We only have a sequence of control models, and we _know_ (yes, that's a HACK relying on
// implementation details) that VCL does grouping according to the order of controls automatically
// At least VCL does this for all we're interested in: Radio buttons.
DBG_ERROR( "UnoControlDialogModel::setGroup: grouping not supported" );
}
// ----------------------------------------------------------------------------
namespace
{
enum GroupingMachineState
{
eLookingForGroup,
eExpandingGroup
};
// ........................................................................
static sal_Int32 lcl_getDialogStep( const Reference< XControlModel >& _rxModel )
{
sal_Int32 nStep = 0;
try
{
Reference< XPropertySet > xModelProps( _rxModel, UNO_QUERY );
xModelProps->getPropertyValue( getStepPropertyName() ) >>= nStep;
}
catch( const Exception& )
{
DBG_ERROR( "lcl_getDialogStep: caught an exception while determining the dialog page!" );
}
return nStep;
}
}
// ----------------------------------------------------------------------------
sal_Int32 SAL_CALL UnoControlDialogModel::getGroupCount( ) throw (RuntimeException)
{
SolarMutexGuard aSolarGuard;
implUpdateGroupStructure();
return maGroups.size();
}
// ----------------------------------------------------------------------------
void SAL_CALL UnoControlDialogModel::getGroup( sal_Int32 _nGroup, Sequence< Reference< XControlModel > >& _rGroup, ::rtl::OUString& _rName ) throw (RuntimeException)
{
SolarMutexGuard aSolarGuard;
implUpdateGroupStructure();
if ( ( _nGroup < 0 ) || ( _nGroup >= (sal_Int32)maGroups.size() ) )
{
DBG_ERROR( "UnoControlDialogModel::getGroup: invalid argument and I am not allowed to throw an exception!" );
_rGroup.realloc( 0 );
_rName = ::rtl::OUString();
}
else
{
AllGroups::const_iterator aGroupPos = maGroups.begin() + _nGroup;
_rGroup.realloc( aGroupPos->size() );
// copy the models
::std::copy( aGroupPos->begin(), aGroupPos->end(), _rGroup.getArray() );
// give the group a name
_rName = ::rtl::OUString::valueOf( _nGroup );
}
}
// ----------------------------------------------------------------------------
void SAL_CALL UnoControlDialogModel::getGroupByName( const ::rtl::OUString& _rName, Sequence< Reference< XControlModel > >& _rGroup ) throw (RuntimeException)
{
SolarMutexGuard aSolarGuard;
::rtl::OUString sDummyName;
getGroup( _rName.toInt32( ), _rGroup, sDummyName );
}
// ----------------------------------------------------------------------------
void SAL_CALL UnoControlDialogModel::addChangesListener( const Reference< XChangesListener >& _rxListener ) throw (RuntimeException)
{
maChangeListeners.addInterface( _rxListener );
}
// ----------------------------------------------------------------------------
void SAL_CALL UnoControlDialogModel::removeChangesListener( const Reference< XChangesListener >& _rxListener ) throw (RuntimeException)
{
maChangeListeners.removeInterface( _rxListener );
}
// ----------------------------------------------------------------------------
void UnoControlDialogModel::implNotifyTabModelChange( const ::rtl::OUString& _rAccessor )
{
// multiplex to our change listeners:
// the changes event
ChangesEvent aEvent;
aEvent.Source = *this;
aEvent.Base <<= aEvent.Source; // the "base of the changes root" is also ourself
aEvent.Changes.realloc( 1 ); // exactly one change
aEvent.Changes[ 0 ].Accessor <<= _rAccessor;
Sequence< Reference< XInterface > > aChangeListeners( maChangeListeners.getElements() );
const Reference< XInterface >* pListener = aChangeListeners.getConstArray();
const Reference< XInterface >* pListenerEnd = aChangeListeners.getConstArray() + aChangeListeners.getLength();
for ( ; pListener != pListenerEnd; ++pListener )
{
if ( pListener->is() )
static_cast< XChangesListener* >( pListener->get() )->changesOccurred( aEvent );
}
}
// ----------------------------------------------------------------------------
void UnoControlDialogModel::AddRadioButtonGroup (
::std::map< ::rtl::OUString, ModelGroup >& rNamedGroups )
{
if ( rNamedGroups.size() == 0 )
return;
size_t nGroups = maGroups.size();
maGroups.reserve( nGroups + rNamedGroups.size() );
::std::map< ::rtl::OUString, ModelGroup >::const_iterator i = rNamedGroups.begin(), e = rNamedGroups.end();
for( ; i != e; ++i)
{
maGroups.push_back( i->second );
}
rNamedGroups.clear();
}
void UnoControlDialogModel::AddRadioButtonToGroup (
const Reference< XControlModel >& rControlModel,
const ::rtl::OUString& rPropertyName,
::std::map< ::rtl::OUString, ModelGroup >& rNamedGroups,
ModelGroup*& rpCurrentGroup )
{
Reference< XPropertySet > xCurProps( rControlModel, UNO_QUERY );
::rtl::OUString sGroup = lcl_GetStringProperty( rPropertyName, xCurProps );
const sal_Int32 nControlModelStep = lcl_getDialogStep( rControlModel );
if ( sGroup.getLength() == 0 )
{
// Create a new group if:
if ( maGroups.size() == 0 || // no groups
rpCurrentGroup == NULL || // previous group was closed
(nControlModelStep != 0 && // control step matches current group
maGroups.back().size() > 0 && // (group 0 == display everywhere)
nControlModelStep != lcl_getDialogStep( maGroups.back().back() ) ) )
{
size_t nGroups = maGroups.size();
maGroups.resize( nGroups + 1 );
}
rpCurrentGroup = &maGroups.back();
}
else
{
// Different steps get different sets of named groups
if ( rNamedGroups.size() > 0 &&
rNamedGroups.begin()->second.size() > 0 )
{
const sal_Int32 nPrevStep = lcl_getDialogStep( rNamedGroups.begin()->second.front() );
if ( nControlModelStep != nPrevStep )
AddRadioButtonGroup( rNamedGroups );
}
rpCurrentGroup = &rNamedGroups[ sGroup ];
}
rpCurrentGroup->push_back( rControlModel );
}
// ----------------------------------------------------------------------------
void UnoControlDialogModel::implUpdateGroupStructure()
{
if ( mbGroupsUpToDate )
// nothing to do
return;
// conditions for a group:
// * all elements of the group are radio buttons
// * all elements of the group are on the same dialog page
// * in the overall control order (determined by the tab index), all elements are subsequent
maGroups.clear();
Sequence< Reference< XControlModel > > aControlModels = getControlModels();
const Reference< XControlModel >* pControlModels = aControlModels.getConstArray();
const Reference< XControlModel >* pControlModelsEnd = pControlModels + aControlModels.getLength();
// in extreme we have as much groups as controls
maGroups.reserve( aControlModels.getLength() );
GroupingMachineState eState = eLookingForGroup; // the current state of our machine
Reference< XServiceInfo > xModelSI; // for checking for a radion button
ModelGroup* aCurrentGroup = NULL; // the group which we're currently building
sal_Bool bIsRadioButton; // is it a radio button?
const ::rtl::OUString GROUP_NAME( RTL_CONSTASCII_USTRINGPARAM( "GroupName" ) );
::std::map< ::rtl::OUString, ModelGroup > aNamedGroups;
#if OSL_DEBUG_LEVEL > 1
::std::vector< ::rtl::OUString > aCurrentGroupLabels;
#endif
for ( ; pControlModels != pControlModelsEnd; ++pControlModels )
{
// we'll need this in every state
xModelSI = xModelSI.query( *pControlModels );
bIsRadioButton = xModelSI.is() && xModelSI->supportsService( ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel ) );
switch ( eState )
{
case eLookingForGroup:
{
if ( !bIsRadioButton )
// this is no radio button -> still looking for the beginning of a group
continue;
// the current model is a radio button
// -> we found the beginning of a new group
// create the place for this group
AddRadioButtonToGroup( *pControlModels, GROUP_NAME, aNamedGroups, aCurrentGroup );
// new state: looking for further members
eState = eExpandingGroup;
#if OSL_DEBUG_LEVEL > 1
Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
::rtl::OUString sLabel;
if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")) ) )
xModelProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")) ) >>= sLabel;
aCurrentGroupLabels.push_back( sLabel );
#endif
}
break;
case eExpandingGroup:
{
if ( !bIsRadioButton )
{ // no radio button -> the group is done
aCurrentGroup = NULL;
eState = eLookingForGroup;
#if OSL_DEBUG_LEVEL > 1
aCurrentGroupLabels.clear();
#endif
continue;
}
AddRadioButtonToGroup( *pControlModels, GROUP_NAME, aNamedGroups, aCurrentGroup );
#if OSL_DEBUG_LEVEL > 1
Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
::rtl::OUString sLabel;
if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")) ) )
xModelProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")) ) >>= sLabel;
aCurrentGroupLabels.push_back( sLabel );
#endif
}
break;
}
}
AddRadioButtonGroup( aNamedGroups );
mbGroupsUpToDate = sal_True;
}
// ----------------------------------------------------------------------------
void SAL_CALL UnoControlDialogModel::propertyChange( const PropertyChangeEvent& _rEvent ) throw (RuntimeException)
{
SolarMutexGuard aSolarGuard;
DBG_ASSERT( 0 == _rEvent.PropertyName.compareToAscii( "TabIndex" ),
"UnoControlDialogModel::propertyChange: not listening for this property!" );
// the accessor for the changed element
::rtl::OUString sAccessor;
UnoControlModelHolderList::const_iterator aPos =
::std::find_if(
maModels.begin(), maModels.end(),
CompareControlModel( Reference< XControlModel >( _rEvent.Source, UNO_QUERY ) )
);
OSL_ENSURE( maModels.end() != aPos, "UnoControlDialogModel::propertyChange: don't know this model!" );
if ( maModels.end() != aPos )
sAccessor = aPos->second;
// our groups are not up-to-date
mbGroupsUpToDate = sal_False;
// notify
implNotifyTabModelChange( sAccessor );
}
// ----------------------------------------------------------------------------
void SAL_CALL UnoControlDialogModel::disposing( const EventObject& /*rEvent*/ ) throw (RuntimeException)
{
}
// ----------------------------------------------------------------------------
void UnoControlDialogModel::startControlListening( const Reference< XControlModel >& _rxChildModel )
{
SolarMutexGuard aSolarGuard;
Reference< XPropertySet > xModelProps( _rxChildModel, UNO_QUERY );
Reference< XPropertySetInfo > xPSI;
if ( xModelProps.is() )
xPSI = xModelProps->getPropertySetInfo();
if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
xModelProps->addPropertyChangeListener( getTabIndexPropertyName(), this );
}
// ----------------------------------------------------------------------------
void UnoControlDialogModel::stopControlListening( const Reference< XControlModel >& _rxChildModel )
{
SolarMutexGuard aSolarGuard;
Reference< XPropertySet > xModelProps( _rxChildModel, UNO_QUERY );
Reference< XPropertySetInfo > xPSI;
if ( xModelProps.is() )
xPSI = xModelProps->getPropertySetInfo();
if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
xModelProps->removePropertyChangeListener( getTabIndexPropertyName(), this );
}
// ============================================================================
// = class ResourceListener
// ============================================================================
ResourceListener::ResourceListener(
const Reference< util::XModifyListener >& rListener ) :
OWeakObject(),
m_xListener( rListener ),
m_bListening( false )
{
}
ResourceListener::~ResourceListener()
{
}
// XInterface
Any SAL_CALL ResourceListener::queryInterface( const Type& rType )
throw ( RuntimeException )
{
Any a = ::cppu::queryInterface(
rType ,
static_cast< XModifyListener* >( this ),
static_cast< XEventListener* >( this ));
if ( a.hasValue() )
return a;
return OWeakObject::queryInterface( rType );
}
void SAL_CALL ResourceListener::acquire() throw ()
{
OWeakObject::acquire();
}
void SAL_CALL ResourceListener::release() throw ()
{
OWeakObject::release();
}
void ResourceListener::startListening(
const Reference< resource::XStringResourceResolver >& rResource )
{
Reference< util::XModifyBroadcaster > xModifyBroadcaster( rResource, UNO_QUERY );
{
// --- SAFE ---
::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
bool bListening( m_bListening );
bool bResourceSet( m_xResource.is() );
aGuard.clear();
// --- SAFE ---
if ( bListening && bResourceSet )
stopListening();
// --- SAFE ---
aGuard.reset();
m_xResource = rResource;
aGuard.clear();
// --- SAFE ---
}
Reference< util::XModifyListener > xThis( static_cast<OWeakObject*>( this ), UNO_QUERY );
if ( xModifyBroadcaster.is() )
{
try
{
xModifyBroadcaster->addModifyListener( xThis );
// --- SAFE ---
::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
m_bListening = true;
// --- SAFE ---
}
catch ( RuntimeException& )
{
throw;
}
catch ( Exception& )
{
}
}
}
void ResourceListener::stopListening()
{
Reference< util::XModifyBroadcaster > xModifyBroadcaster;
// --- SAFE ---
::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
if ( m_bListening && m_xResource.is() )
xModifyBroadcaster = Reference< util::XModifyBroadcaster >( m_xResource, UNO_QUERY );
aGuard.clear();
// --- SAFE ---
Reference< util::XModifyListener > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
if ( xModifyBroadcaster.is() )
{
try
{
// --- SAFE ---
aGuard.reset();
m_bListening = false;
m_xResource.clear();
aGuard.clear();
// --- SAFE ---
xModifyBroadcaster->removeModifyListener( xThis );
}
catch ( RuntimeException& )
{
throw;
}
catch ( Exception& )
{
}
}
}
// XModifyListener
void SAL_CALL ResourceListener::modified(
const lang::EventObject& aEvent )
throw ( RuntimeException )
{
Reference< util::XModifyListener > xListener;
// --- SAFE ---
::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
xListener = m_xListener;
aGuard.clear();
// --- SAFE ---
if ( xListener.is() )
{
try
{
xListener->modified( aEvent );
}
catch ( RuntimeException& )
{
throw;
}
catch ( Exception& )
{
}
}
}
// XEventListener
void SAL_CALL ResourceListener::disposing(
const EventObject& Source )
throw ( RuntimeException )
{
Reference< lang::XEventListener > xListener;
Reference< resource::XStringResourceResolver > xResource;
// --- SAFE ---
::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
Reference< XInterface > xIfacRes( m_xResource, UNO_QUERY );
Reference< XInterface > xIfacList( m_xListener, UNO_QUERY );
aGuard.clear();
// --- SAFE ---
if ( Source.Source == xIfacRes )
{
// --- SAFE ---
aGuard.reset();
m_bListening = false;
xResource = m_xResource;
xListener = Reference< lang::XEventListener >( m_xListener, UNO_QUERY );
m_xResource.clear();
aGuard.clear();
// --- SAFE ---
if ( xListener.is() )
{
try
{
xListener->disposing( Source );
}
catch ( RuntimeException& )
{
throw;
}
catch ( Exception& )
{
}
}
}
else if ( Source.Source == xIfacList )
{
// --- SAFE ---
aGuard.reset();
m_bListening = false;
xListener = Reference< lang::XEventListener >( m_xListener, UNO_QUERY );
xResource = m_xResource;
m_xResource.clear();
m_xListener.clear();
aGuard.clear();
// --- SAFE ---
// Remove ourself as listener from resource resolver
Reference< util::XModifyBroadcaster > xModifyBroadcaster( xResource, UNO_QUERY );
Reference< util::XModifyListener > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
if ( xModifyBroadcaster.is() )
{
try
{
xModifyBroadcaster->removeModifyListener( xThis );
}
catch ( RuntimeException& )
{
throw;
}
catch ( Exception& )
{
}
}
}
}
// ============================================================================
// = class UnoDialogControl
// ============================================================================
UnoDialogControl::UnoDialogControl() :
maTopWindowListeners( *this ),
mbWindowListener(false),
mbSizeModified(false),
mbPosModified(false)
{
maComponentInfos.nWidth = 300;
maComponentInfos.nHeight = 450;
mxListener = new ResourceListener( Reference< util::XModifyListener >(
static_cast< OWeakObject* >( this ), UNO_QUERY ));
}
::rtl::OUString UnoDialogControl::GetComponentServiceName()
{
sal_Bool bDecoration( sal_True );
ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
if ( bDecoration )
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Dialog"));
else
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TabPage"));
}
// XInterface
Any UnoDialogControl::queryAggregation( const Type & rType ) throw(RuntimeException)
{
Any aRet( UnoDialogControl_IBase::queryInterface( rType ) );
return (aRet.hasValue() ? aRet : UnoControlContainer::queryAggregation( rType ));
}
// XTypeProvider
IMPL_IMPLEMENTATION_ID( UnoDialogControl )
Sequence< Type > UnoDialogControl::getTypes() throw(RuntimeException)
{
return ::comphelper::concatSequences(
UnoDialogControl_IBase::getTypes(),
UnoControlContainer::getTypes()
);
}
void UnoDialogControl::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
{
Reference< XPropertySet > xP( rxModel, UNO_QUERY );
::rtl::OUString aDefCtrl;
xP->getPropertyValue( GetPropertyName( BASEPROPERTY_DEFAULTCONTROL ) ) >>= aDefCtrl;
// Add our own resource resolver to a newly created control
Reference< resource::XStringResourceResolver > xStringResourceResolver;
rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
Any aAny;
ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
aAny <<= xStringResourceResolver;
xP->setPropertyValue( aPropName, aAny );
Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
Reference < XControl > xCtrl( xMSF->createInstance( aDefCtrl ), UNO_QUERY );
DBG_ASSERT( xCtrl.is(), "UnoDialogControl::ImplInsertControl: could not create the control!" );
if ( xCtrl.is() )
{
xCtrl->setModel( rxModel );
addControl( rName, xCtrl );
// will implicitly call addingControl, where we can add the PropertiesChangeListener to the model
// (which we formerly did herein)
// 08.01.2001 - 96008 - fs@openoffice.org
ImplSetPosSize( xCtrl );
}
}
void UnoDialogControl::ImplRemoveControl( Reference< XControlModel >& rxModel )
{
Sequence< Reference< XControl > > aControls = getControls();
Reference< XControl > xCtrl = StdTabController::FindControl( aControls, rxModel );
if ( xCtrl.is() )
removeControl( xCtrl );
}
void UnoDialogControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
{
Reference< XPropertySet > xP( rxCtrl->getModel(), UNO_QUERY );
sal_Int32 nX = 0, nY = 0, nWidth = 0, nHeight = 0;
xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ) ) >>= nX;
xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) ) ) >>= nY;
xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nWidth;
xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nHeight;
// Currentley we are simply using MAP_APPFONT
OutputDevice*pOutDev = Application::GetDefaultDevice();
DBG_ASSERT( pOutDev, "Missing Default Device!" );
if ( pOutDev )
{
::Size aTmp( nX, nY );
aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
nX = aTmp.Width();
nY = aTmp.Height();
aTmp = ::Size( nWidth, nHeight );
aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
nWidth = aTmp.Width();
nHeight = aTmp.Height();
}
else
{
Reference< XWindowPeer > xPeer = ImplGetCompatiblePeer( sal_True );
Reference< XDevice > xD( xPeer, UNO_QUERY );
SimpleFontMetric aFM;
FontDescriptor aFD;
Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) );
aVal >>= aFD;
if ( aFD.StyleName.getLength() )
{
Reference< XFont > xFont = xD->getFont( aFD );
aFM = xFont->getFontMetric();
}
else
{
Reference< XGraphics > xG = xD->createGraphics();
aFM = xG->getFontMetric();
}
sal_Int16 nH = aFM.Ascent + aFM.Descent;
sal_Int16 nW = nH/2; // calculate avarage width?!
nX *= nW;
nX /= 4;
nWidth *= nW;
nWidth /= 4;
nY *= nH;
nY /= 8;
nHeight *= nH;
nHeight /= 8;
}
Reference < XWindow > xW( rxCtrl, UNO_QUERY );
xW->setPosSize( nX, nY, nWidth, nHeight, PosSize::POSSIZE );
}
void UnoDialogControl::dispose() throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
EventObject aEvt;
aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
maTopWindowListeners.disposeAndClear( aEvt );
// Notify our listener helper about dispose
// --- SAFE ---
::osl::ResettableGuard< ::osl::Mutex > aGuard( GetMutex() );
Reference< XEventListener > xListener( mxListener, UNO_QUERY );
mxListener.clear();
aGuard.clear();
// --- SAFE ---
if ( xListener.is() )
xListener->disposing( aEvt );
UnoControlContainer::dispose();
}
void SAL_CALL UnoDialogControl::disposing(
const EventObject& Source )
throw(RuntimeException)
{
rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
Reference< resource::XStringResourceResolver > xStringResourceResolver;
ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
Reference< XInterface > xIfac( xStringResourceResolver, UNO_QUERY );
if ( Source.Source == xIfac )
{
Any aAny;
// Reset resource resolver reference
ImplSetPropertyValue( aPropName, aAny, sal_True );
ImplUpdateResourceResolver();
}
else
{
UnoControlContainer::disposing( Source );
}
}
sal_Bool UnoDialogControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
// destroy the old tab controller, if existent
if ( mxTabController.is() )
{
mxTabController->setModel( NULL ); // just to be sure, should not be necessary
removeTabController( mxTabController );
::comphelper::disposeComponent( mxTabController ); // just to be sure, should not be necessary
mxTabController.clear();
}
if ( getModel().is() )
{
Sequence< Reference< XControl > > aControls = getControls();
const Reference< XControl >* pCtrls = aControls.getConstArray();
const Reference< XControl >* pCtrlsEnd = pCtrls + aControls.getLength();
for ( ; pCtrls < pCtrlsEnd; ++pCtrls )
removeControl( *pCtrls );
// will implicitly call removingControl, which will remove the PropertyChangeListener
// (which we formerly did herein)
// 08.01.2001 - 96008 - fs@openoffice.org
Reference< XContainer > xC( getModel(), UNO_QUERY );
if ( xC.is() )
xC->removeContainerListener( this );
Reference< XChangesNotifier > xChangeNotifier( getModel(), UNO_QUERY );
if ( xChangeNotifier.is() )
xChangeNotifier->removeChangesListener( this );
}
sal_Bool bRet = UnoControl::setModel( rxModel );
if ( getModel().is() )
{
Reference< XNameAccess > xNA( getModel(), UNO_QUERY );
if ( xNA.is() )
{
Sequence< ::rtl::OUString > aNames = xNA->getElementNames();
const ::rtl::OUString* pNames = aNames.getConstArray();
sal_uInt32 nCtrls = aNames.getLength();
Reference< XControlModel > xCtrlModel;
for( sal_uInt32 n = 0; n < nCtrls; ++n, ++pNames )
{
xNA->getByName( *pNames ) >>= xCtrlModel;
ImplInsertControl( xCtrlModel, *pNames );
}
}
Reference< XContainer > xC( getModel(), UNO_QUERY );
if ( xC.is() )
xC->addContainerListener( this );
Reference< XChangesNotifier > xChangeNotifier( getModel(), UNO_QUERY );
if ( xChangeNotifier.is() )
xChangeNotifier->addChangesListener( this );
}
Reference< XTabControllerModel > xTabbing( getModel(), UNO_QUERY );
if ( xTabbing.is() )
{
mxTabController = new StdTabController;
mxTabController->setModel( xTabbing );
addTabController( mxTabController );
}
ImplStartListingForResourceEvents();
return bRet;
}
void UnoDialogControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
UnoControl::setDesignMode( bOn );
Sequence< Reference< XControl > > xCtrls = getControls();
sal_Int32 nControls = xCtrls.getLength();
Reference< XControl >* pControls = xCtrls.getArray();
for ( sal_Int32 n = 0; n < nControls; n++ )
pControls[n]->setDesignMode( bOn );
// #109067# in design mode the tab controller is not notified about
// tab index changes, therefore the tab order must be activated
// when switching from design mode to live mode
if ( mxTabController.is() && !bOn )
mxTabController->activateTabOrder();
}
void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
UnoControlContainer::createPeer( rxToolkit, rParentPeer );
Reference < XTopWindow > xTW( getPeer(), UNO_QUERY );
if ( xTW.is() )
{
xTW->setMenuBar( mxMenuBar );
if ( !mbWindowListener )
{
Reference< XWindowListener > xWL( static_cast< cppu::OWeakObject*>( this ), UNO_QUERY );
addWindowListener( xWL );
mbWindowListener = true;
}
if ( maTopWindowListeners.getLength() )
xTW->addTopWindowListener( &maTopWindowListeners );
}
}
void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc )
{
sal_Bool bDecoration( sal_True );
ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
if ( !bDecoration )
{
// Now we have to manipulate the WindowDescriptor
rDesc.WindowAttributes = rDesc.WindowAttributes | ::com::sun::star::awt::WindowAttribute::NODECORATION;
}
// We have to set the graphic property before the peer
// will be created. Otherwise the properties will be copied
// into the peer via propertiesChangeEvents. As the order of
// can lead to overwrites we have to set the graphic property
// before the propertiesChangeEvents are sent!
::rtl::OUString aImageURL;
if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
( aImageURL.getLength() > 0 ))
{
rtl::OUString absoluteUrl( aImageURL );
if ( aImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
absoluteUrl =
getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
ImplGetPropertyValue( PROPERTY_IMAGEURL ));
ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( absoluteUrl ), sal_True );
}
}
void UnoDialogControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
Reference< XControlModel > xModel;
::rtl::OUString aName;
Event.Accessor >>= aName;
Event.Element >>= xModel;
ImplInsertControl( xModel, aName );
}
void UnoDialogControl::elementRemoved( const ContainerEvent& Event ) throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
Reference< XControlModel > xModel;
Event.Element >>= xModel;
if ( xModel.is() )
ImplRemoveControl( xModel );
}
void UnoDialogControl::elementReplaced( const ContainerEvent& Event ) throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
Reference< XControlModel > xModel;
Event.ReplacedElement >>= xModel;
if ( xModel.is() )
ImplRemoveControl( xModel );
::rtl::OUString aName;
Event.Accessor >>= aName;
Event.Element >>= xModel;
ImplInsertControl( xModel, aName );
}
void UnoDialogControl::addTopWindowListener( const Reference< XTopWindowListener >& rxListener ) throw (RuntimeException)
{
maTopWindowListeners.addInterface( rxListener );
if( getPeer().is() && maTopWindowListeners.getLength() == 1 )
{
Reference < XTopWindow > xTW( getPeer(), UNO_QUERY );
xTW->addTopWindowListener( &maTopWindowListeners );
}
}
void UnoDialogControl::removeTopWindowListener( const Reference< XTopWindowListener >& rxListener ) throw (RuntimeException)
{
if( getPeer().is() && maTopWindowListeners.getLength() == 1 )
{
Reference < XTopWindow > xTW( getPeer(), UNO_QUERY );
xTW->removeTopWindowListener( &maTopWindowListeners );
}
maTopWindowListeners.removeInterface( rxListener );
}
void UnoDialogControl::toFront( ) throw (RuntimeException)
{
SolarMutexGuard aSolarGuard;
if ( getPeer().is() )
{
Reference< XTopWindow > xTW( getPeer(), UNO_QUERY );
if( xTW.is() )
xTW->toFront();
}
}
void UnoDialogControl::toBack( ) throw (RuntimeException)
{
SolarMutexGuard aSolarGuard;
if ( getPeer().is() )
{
Reference< XTopWindow > xTW( getPeer(), UNO_QUERY );
if( xTW.is() )
xTW->toBack();
}
}
void UnoDialogControl::setMenuBar( const Reference< XMenuBar >& rxMenuBar ) throw (RuntimeException)
{
SolarMutexGuard aSolarGuard;
mxMenuBar = rxMenuBar;
if ( getPeer().is() )
{
Reference< XTopWindow > xTW( getPeer(), UNO_QUERY );
if( xTW.is() )
xTW->setMenuBar( mxMenuBar );
}
}
static ::Size ImplMapPixelToAppFont( OutputDevice* pOutDev, const ::Size& aSize )
{
::Size aTmp = pOutDev->PixelToLogic( aSize, MAP_APPFONT );
return aTmp;
}
// ::com::sun::star::awt::XWindowListener
void SAL_CALL UnoDialogControl::windowResized( const ::com::sun::star::awt::WindowEvent& e )
throw (::com::sun::star::uno::RuntimeException)
{
OutputDevice*pOutDev = Application::GetDefaultDevice();
DBG_ASSERT( pOutDev, "Missing Default Device!" );
if ( pOutDev && !mbSizeModified )
{
// Currentley we are simply using MAP_APPFONT
::Size aAppFontSize( e.Width, e.Height );
Reference< XControl > xDialogControl( *this, UNO_QUERY_THROW );
Reference< XDevice > xDialogDevice( xDialogControl->getPeer(), UNO_QUERY );
OSL_ENSURE( xDialogDevice.is(), "UnoDialogControl::windowResized: no peer, but a windowResized event?" );
if ( xDialogDevice.is() )
{
DeviceInfo aDeviceInfo( xDialogDevice->getInfo() );
aAppFontSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset;
aAppFontSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset;
}
aAppFontSize = ImplMapPixelToAppFont( pOutDev, aAppFontSize );
// Remember that changes have been done by listener. No need to
// update the position because of property change event.
mbSizeModified = true;
Sequence< rtl::OUString > aProps( 2 );
Sequence< Any > aValues( 2 );
// Properties in a sequence must be sorted!
aProps[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ));
aProps[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ));
aValues[0] <<= aAppFontSize.Height();
aValues[1] <<= aAppFontSize.Width();
ImplSetPropertyValues( aProps, aValues, true );
mbSizeModified = false;
}
}
void SAL_CALL UnoDialogControl::windowMoved( const ::com::sun::star::awt::WindowEvent& e )
throw (::com::sun::star::uno::RuntimeException)
{
OutputDevice*pOutDev = Application::GetDefaultDevice();
DBG_ASSERT( pOutDev, "Missing Default Device!" );
if ( pOutDev && !mbPosModified )
{
// Currentley we are simply using MAP_APPFONT
Any aAny;
::Size aTmp( e.X, e.Y );
aTmp = ImplMapPixelToAppFont( pOutDev, aTmp );
// Remember that changes have been done by listener. No need to
// update the position because of property change event.
mbPosModified = true;
Sequence< rtl::OUString > aProps( 2 );
Sequence< Any > aValues( 2 );
aProps[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ));
aProps[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ));
aValues[0] <<= aTmp.Width();
aValues[1] <<= aTmp.Height();
ImplSetPropertyValues( aProps, aValues, true );
mbPosModified = false;
}
}
void SAL_CALL UnoDialogControl::windowShown( const ::com::sun::star::lang::EventObject& e )
throw (::com::sun::star::uno::RuntimeException)
{
(void)e;
}
void SAL_CALL UnoDialogControl::windowHidden( const ::com::sun::star::lang::EventObject& e )
throw (::com::sun::star::uno::RuntimeException)
{
(void)e;
}
// XPropertiesChangeListener
void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
{
if( !isDesignMode() && !mbCreatingCompatiblePeer )
{
::rtl::OUString s1( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) );
::rtl::OUString s2( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) );
::rtl::OUString s3( RTL_CONSTASCII_USTRINGPARAM( "Width" ) );
::rtl::OUString s4( RTL_CONSTASCII_USTRINGPARAM( "Height" ) );
sal_Int32 nLen = rEvents.getLength();
for( sal_Int32 i = 0; i < nLen; i++ )
{
const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
if ( ( rEvt.PropertyName == s1 ) ||
( rEvt.PropertyName == s2 ) ||
( rEvt.PropertyName == s3 ) ||
( rEvt.PropertyName == s4 ) )
{
if ( bOwnModel )
{
if ( !mbPosModified && !mbSizeModified )
{
// Don't set new pos/size if we get new values from window listener
Reference< XControl > xThis( (XAggregation*)(::cppu::OWeakAggObject*)this, UNO_QUERY );
ImplSetPosSize( xThis );
}
}
else
{
Sequence<Reference<XControl> > aControlSequence(getControls());
Reference<XControl> aControlRef( StdTabController::FindControl( aControlSequence, xModel ) );
ImplSetPosSize( aControlRef );
}
break;
}
else if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ResourceResolver", 16 ))
{
ImplStartListingForResourceEvents();
}
}
}
sal_Int32 nLen = rEvents.getLength();
for( sal_Int32 i = 0; i < nLen; i++ )
{
const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ImageURL", 8 ))
{
::rtl::OUString aImageURL;
::rtl::OUString absoluteUrl( aImageURL );
// Ignore GraphicObject urls
if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
( aImageURL.getLength() > 0 ))
{
absoluteUrl = aImageURL;
if ( aImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
absoluteUrl =
getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
ImplGetPropertyValue( PROPERTY_IMAGEURL ));
ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( absoluteUrl ), sal_True );
}
break;
}
}
UnoControlContainer::ImplModelPropertiesChanged( rEvents );
}
void UnoDialogControl::ImplStartListingForResourceEvents()
{
Reference< resource::XStringResourceResolver > xStringResourceResolver;
ImplGetPropertyValue( PROPERTY_RESOURCERESOLVER ) >>= xStringResourceResolver;
// Add our helper as listener to retrieve notifications about changes
Reference< util::XModifyListener > rListener( mxListener );
ResourceListener* pResourceListener = static_cast< ResourceListener* >( rListener.get() );
// resource listener will stop listening if resolver reference is empty
if ( pResourceListener )
pResourceListener->startListening( xStringResourceResolver );
ImplUpdateResourceResolver();
}
void UnoDialogControl::ImplUpdateResourceResolver()
{
rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
Reference< resource::XStringResourceResolver > xStringResourceResolver;
ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
if ( !xStringResourceResolver.is() )
return;
Any xNewStringResourceResolver; xNewStringResourceResolver <<= xStringResourceResolver;
Sequence< rtl::OUString > aPropNames(1);
aPropNames[0] = aPropName;
const Sequence< Reference< awt::XControl > > aSeq = getControls();
for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
{
Reference< XControl > xControl( aSeq[i] );
Reference< XPropertySet > xPropertySet;
if ( xControl.is() )
xPropertySet = Reference< XPropertySet >( xControl->getModel(), UNO_QUERY );
if ( !xPropertySet.is() )
continue;
try
{
Reference< resource::XStringResourceResolver > xCurrStringResourceResolver;
Any aOldValue = xPropertySet->getPropertyValue( aPropName );
if ( ( aOldValue >>= xCurrStringResourceResolver )
&& ( xStringResourceResolver == xCurrStringResourceResolver )
)
{
Reference< XMultiPropertySet > xMultiPropSet( xPropertySet, UNO_QUERY );
Reference< XPropertiesChangeListener > xListener( xPropertySet, UNO_QUERY );
xMultiPropSet->firePropertiesChangeEvent( aPropNames, xListener );
}
else
xPropertySet->setPropertyValue( aPropName, xNewStringResourceResolver );
}
/*catch ( NoSuchElementException& )*/ // that's nonsense, this is never thrown above ...
catch ( const Exception& )
{
}
}
// propagate resource resolver changes to language dependent props of the dialog
Reference< XPropertySet > xPropertySet( getModel(), UNO_QUERY );
if ( xPropertySet.is() )
{
Reference< XMultiPropertySet > xMultiPropSet( xPropertySet, UNO_QUERY );
Reference< XPropertiesChangeListener > xListener( xPropertySet, UNO_QUERY );
xMultiPropSet->firePropertiesChangeEvent( lcl_getLanguageDependentProperties(), xListener );
}
}
void SAL_CALL UnoDialogControl::endDialog( ::sal_Int32 i_result ) throw (RuntimeException)
{
Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY );
if ( xPeerDialog.is() )
xPeerDialog->endDialog( i_result );
}
void SAL_CALL UnoDialogControl::setHelpId( ::sal_Int32 i_id ) throw (RuntimeException)
{
Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY );
if ( xPeerDialog.is() )
xPeerDialog->setHelpId( i_id );
}
void UnoDialogControl::setTitle( const ::rtl::OUString& Title ) throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
Any aAny;
aAny <<= Title;
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ), aAny, sal_True );
}
::rtl::OUString UnoDialogControl::getTitle() throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
return ImplGetPropertyValue_UString( BASEPROPERTY_TITLE );
}
sal_Int16 UnoDialogControl::execute() throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
sal_Int16 nDone = -1;
if ( getPeer().is() )
{
Reference< XDialog > xDlg( getPeer(), UNO_QUERY );
if( xDlg.is() )
{
GetComponentInfos().bVisible = sal_True;
nDone = xDlg->execute();
GetComponentInfos().bVisible = sal_False;
}
}
return nDone;
}
void UnoDialogControl::endExecute() throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
if ( getPeer().is() )
{
Reference< XDialog > xDlg( getPeer(), UNO_QUERY );
if( xDlg.is() )
{
xDlg->endExecute();
GetComponentInfos().bVisible = sal_False;
}
}
}
void UnoDialogControl::addingControl( const Reference< XControl >& _rxControl )
{
SolarMutexGuard aSolarGuard;
UnoControlContainer::addingControl( _rxControl );
if ( _rxControl.is() )
{
Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
if ( xProps.is() )
{
Sequence< ::rtl::OUString > aNames( 4 );
::rtl::OUString* pNames = aNames.getArray();
*pNames++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PositionX"));
*pNames++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PositionY"));
*pNames++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Width"));
*pNames++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Height"));
xProps->addPropertiesChangeListener( aNames, this );
}
}
}
void UnoDialogControl::removingControl( const Reference< XControl >& _rxControl )
{
SolarMutexGuard aSolarGuard;
UnoControlContainer::removingControl( _rxControl );
if ( _rxControl.is() )
{
Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
if ( xProps.is() )
xProps->removePropertiesChangeListener( this );
}
}
void SAL_CALL UnoDialogControl::changesOccurred( const ChangesEvent& ) throw (RuntimeException)
{
SolarMutexGuard aSolarGuard;
// a tab controller model may have changed
// #109067# in design mode don't notify the tab controller
// about tab index changes
if ( mxTabController.is() && !mbDesignMode )
mxTabController->activateTabOrder();
}
// XModifyListener
void SAL_CALL UnoDialogControl::modified(
const lang::EventObject& /*rEvent*/ )
throw (RuntimeException)
{
ImplUpdateResourceResolver();
}
// ----------------------------------------------------
// Helper Method to convert relative url to physical location
// ----------------------------------------------------
::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl )
{
::rtl::OUString ret;
::rtl::OUString baseLocation;
::rtl::OUString url;
rbase >>= baseLocation;
rUrl >>= url;
::rtl::OUString absoluteURL( url );
if ( url.getLength() > 0 )
{
// Don't adjust GraphicObject url(s)
if ( url.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
{
INetURLObject urlObj(baseLocation);
urlObj.removeSegment();
baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
::osl::FileBase::getAbsoluteFileURL( baseLocation, url, ret );
}
else
ret = url;
const INetURLObject protocolCheck( url );
const INetProtocol protocol = protocolCheck.GetProtocol();
if ( protocol == INET_PROT_NOT_VALID )
{
::rtl::OUString testAbsoluteURL;
if ( ::osl::FileBase::E_None == ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, testAbsoluteURL ) )
absoluteURL = testAbsoluteURL;
}
}
return absoluteURL;
}
UnoParentControl::UnoParentControl() :
mbSizeModified(false),
mbPosModified(false)
{
maComponentInfos.nWidth = 280;
maComponentInfos.nHeight = 400;
// #TODO Do we need the ResourceListener foo ?
}
UnoParentControl::~UnoParentControl()
{
}
// XInterface
Any UnoParentControl::queryAggregation( const Type & rType ) throw(RuntimeException)
{
Any aRet( UnoParentControl_IBase::queryInterface( rType ) );
return (aRet.hasValue() ? aRet : UnoControlContainer::queryAggregation( rType ));
}
// XTypeProvider
IMPL_IMPLEMENTATION_ID( UnoParentControl )
Sequence< Type >
UnoParentControl::getTypes() throw(RuntimeException)
{
return ::comphelper::concatSequences(
UnoParentControl_IBase::getTypes(),
UnoControlContainer::getTypes()
);
}
void UnoParentControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
UnoControlContainer::createPeer( rxToolkit, rParentPeer );
}
void UnoParentControl::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
{
Reference< XPropertySet > xP( rxModel, UNO_QUERY );
::rtl::OUString aDefCtrl;
xP->getPropertyValue( GetPropertyName( BASEPROPERTY_DEFAULTCONTROL ) ) >>= aDefCtrl;
Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
Reference < XControl > xCtrl( xMSF->createInstance( aDefCtrl ), UNO_QUERY );
DBG_ASSERT( xCtrl.is(), "UnoDialogControl::ImplInsertControl: could not create the control!" );
if ( xCtrl.is() )
{
xCtrl->setModel( rxModel );
addControl( rName, xCtrl );
// will implicitly call addingControl, where we can add the PropertiesChangeListener to the model
// (which we formerly did herein)
// 08.01.2001 - 96008 - fs@openoffice.org
ImplSetPosSize( xCtrl );
}
}
void UnoParentControl::ImplRemoveControl( Reference< XControlModel >& rxModel )
{
Sequence< Reference< XControl > > aControls = getControls();
Reference< XControl > xCtrl = StdTabController::FindControl( aControls, rxModel );
if ( xCtrl.is() )
removeControl( xCtrl );
}
void UnoParentControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
{
Reference< XPropertySet > xP( rxCtrl->getModel(), UNO_QUERY );
sal_Int32 nX = 0, nY = 0, nWidth = 0, nHeight = 0;
xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ) ) >>= nX;
xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) ) ) >>= nY;
xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nWidth;
xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nHeight;
MapMode aMode( MAP_APPFONT );
OutputDevice*pOutDev = Application::GetDefaultDevice();
if ( pOutDev )
{
::Size aTmp( nX, nY );
aTmp = pOutDev->LogicToPixel( aTmp, aMode );
nX = aTmp.Width();
nY = aTmp.Height();
aTmp = ::Size( nWidth, nHeight );
aTmp = pOutDev->LogicToPixel( aTmp, aMode );
nWidth = aTmp.Width();
nHeight = aTmp.Height();
}
else
{
Reference< XWindowPeer > xPeer = ImplGetCompatiblePeer( sal_True );
Reference< XDevice > xD( xPeer, UNO_QUERY );
SimpleFontMetric aFM;
FontDescriptor aFD;
Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) );
aVal >>= aFD;
if ( aFD.StyleName.getLength() )
{
Reference< XFont > xFont = xD->getFont( aFD );
aFM = xFont->getFontMetric();
}
else
{
Reference< XGraphics > xG = xD->createGraphics();
aFM = xG->getFontMetric();
}
sal_Int16 nH = aFM.Ascent + aFM.Descent;
sal_Int16 nW = nH/2; // calculate avarage width?!
nX *= nW;
nX /= 4;
nWidth *= nW;
nWidth /= 4;
nY *= nH;
nY /= 8;
nHeight *= nH;
nHeight /= 8;
}
Reference < XWindow > xW( rxCtrl, UNO_QUERY );
xW->setPosSize( nX, nY, nWidth, nHeight, PosSize::POSSIZE );
}
void UnoParentControl::dispose() throw(RuntimeException)
{
UnoControlContainer::dispose();
}
void SAL_CALL UnoParentControl::disposing(
const EventObject& Source )
throw(RuntimeException)
{
UnoControlContainer::disposing( Source );
}
sal_Bool UnoParentControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
// destroy the old tab controller, if existent
if ( mxTabController.is() )
{
mxTabController->setModel( NULL ); // just to be sure, should not be necessary
removeTabController( mxTabController );
::comphelper::disposeComponent( mxTabController ); // just to be sure, should not be necessary
mxTabController.clear();
}
if ( getModel().is() )
{
Sequence< Reference< XControl > > aControls = getControls();
const Reference< XControl >* pCtrls = aControls.getConstArray();
const Reference< XControl >* pCtrlsEnd = pCtrls + aControls.getLength();
for ( ; pCtrls < pCtrlsEnd; ++pCtrls )
removeControl( *pCtrls );
// will implicitly call removingControl, which will remove the PropertyChangeListener
// (which we formerly did herein)
// 08.01.2001 - 96008 - fs@openoffice.org
Reference< XContainer > xC( getModel(), UNO_QUERY );
if ( xC.is() )
xC->removeContainerListener( this );
Reference< XChangesNotifier > xChangeNotifier( getModel(), UNO_QUERY );
if ( xChangeNotifier.is() )
xChangeNotifier->removeChangesListener( this );
}
sal_Bool bRet = UnoControl::setModel( rxModel );
if ( getModel().is() )
{
Reference< XNameAccess > xNA( getModel(), UNO_QUERY );
if ( xNA.is() )
{
Sequence< ::rtl::OUString > aNames = xNA->getElementNames();
const ::rtl::OUString* pNames = aNames.getConstArray();
sal_uInt32 nCtrls = aNames.getLength();
Reference< XControlModel > xCtrlModel;
for( sal_uInt32 n = 0; n < nCtrls; ++n, ++pNames )
{
xNA->getByName( *pNames ) >>= xCtrlModel;
ImplInsertControl( xCtrlModel, *pNames );
}
}
Reference< XContainer > xC( getModel(), UNO_QUERY );
if ( xC.is() )
xC->addContainerListener( this );
Reference< XChangesNotifier > xChangeNotifier( getModel(), UNO_QUERY );
if ( xChangeNotifier.is() )
xChangeNotifier->addChangesListener( this );
}
Reference< XTabControllerModel > xTabbing( getModel(), UNO_QUERY );
if ( xTabbing.is() )
{
mxTabController = new StdTabController;
mxTabController->setModel( xTabbing );
addTabController( mxTabController );
}
// ImplStartListingForResourceEvents();
return bRet;
}
void UnoParentControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
UnoControl::setDesignMode( bOn );
Sequence< Reference< XControl > > xCtrls = getControls();
sal_Int32 nControls = xCtrls.getLength();
Reference< XControl >* pControls = xCtrls.getArray();
for ( sal_Int32 n = 0; n < nControls; n++ )
pControls[n]->setDesignMode( bOn );
// #109067# in design mode the tab controller is not notified about
// tab index changes, therefore the tab order must be activated
// when switching from design mode to live mode
if ( mxTabController.is() && !bOn )
mxTabController->activateTabOrder();
}
void UnoParentControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
Reference< XControlModel > xModel;
::rtl::OUString aName;
Event.Accessor >>= aName;
Event.Element >>= xModel;
ImplInsertControl( xModel, aName );
}
void UnoParentControl::elementRemoved( const ContainerEvent& Event ) throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
Reference< XControlModel > xModel;
Event.Element >>= xModel;
if ( xModel.is() )
ImplRemoveControl( xModel );
}
void UnoParentControl::elementReplaced( const ContainerEvent& Event ) throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
Reference< XControlModel > xModel;
Event.ReplacedElement >>= xModel;
if ( xModel.is() )
ImplRemoveControl( xModel );
::rtl::OUString aName;
Event.Accessor >>= aName;
Event.Element >>= xModel;
ImplInsertControl( xModel, aName );
}
// XPropertiesChangeListener
void UnoParentControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
{
if( !isDesignMode() && !mbCreatingCompatiblePeer )
{
::rtl::OUString s1( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) );
::rtl::OUString s2( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) );
::rtl::OUString s3( RTL_CONSTASCII_USTRINGPARAM( "Width" ) );
::rtl::OUString s4( RTL_CONSTASCII_USTRINGPARAM( "Height" ) );
sal_Int32 nLen = rEvents.getLength();
for( sal_Int32 i = 0; i < nLen; i++ )
{
const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
if ( ( rEvt.PropertyName == s1 ) ||
( rEvt.PropertyName == s2 ) ||
( rEvt.PropertyName == s3 ) ||
( rEvt.PropertyName == s4 ) )
{
if ( bOwnModel )
{
if ( !mbPosModified && !mbSizeModified )
{
// Don't set new pos/size if we get new values from window listener
Reference< XControl > xThis( (XAggregation*)(::cppu::OWeakAggObject*)this, UNO_QUERY );
ImplSetPosSize( xThis );
}
}
else
{
Sequence<Reference<XControl> > aControlSequence(getControls());
Reference<XControl> aControlRef( StdTabController::FindControl( aControlSequence, xModel ) );
ImplSetPosSize( aControlRef );
}
break;
}
}
}
UnoControlContainer::ImplModelPropertiesChanged( rEvents );
}
void UnoParentControl::addingControl( const Reference< XControl >& _rxControl )
{
SolarMutexGuard aSolarGuard;
UnoControlContainer::addingControl( _rxControl );
if ( _rxControl.is() )
{
Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
if ( xProps.is() )
{
Sequence< ::rtl::OUString > aNames( 4 );
::rtl::OUString* pNames = aNames.getArray();
*pNames++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PositionX"));
*pNames++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PositionY"));
*pNames++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Width"));
*pNames++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Height"));
xProps->addPropertiesChangeListener( aNames, this );
}
}
}
void UnoParentControl::removingControl( const Reference< XControl >& _rxControl )
{
SolarMutexGuard aSolarGuard;
UnoControlContainer::removingControl( _rxControl );
if ( _rxControl.is() )
{
Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
if ( xProps.is() )
xProps->removePropertiesChangeListener( this );
}
}
void SAL_CALL UnoParentControl::changesOccurred( const ChangesEvent& ) throw (RuntimeException)
{
SolarMutexGuard aSolarGuard;
// a tab controller model may have changed
// #109067# in design mode don't notify the tab controller
// about tab index changes
if ( mxTabController.is() && !mbDesignMode )
mxTabController->activateTabOrder();
}
// ----------------------------------------------------
// class MultiPageControl
// ----------------------------------------------------
UnoMultiPageControl::UnoMultiPageControl() : maTabListeners( *this )
{
maComponentInfos.nWidth = 280;
maComponentInfos.nHeight = 400;
}
UnoMultiPageControl::~UnoMultiPageControl()
{
}
// XTabListener
void SAL_CALL UnoMultiPageControl::inserted( ::sal_Int32 /*ID*/ ) throw (RuntimeException)
{
}
void SAL_CALL UnoMultiPageControl::removed( ::sal_Int32 /*ID*/ ) throw (RuntimeException)
{
}
void SAL_CALL UnoMultiPageControl::changed( ::sal_Int32 /*ID*/, const Sequence< NamedValue >& /*Properties*/ ) throw (RuntimeException)
{
}
void SAL_CALL UnoMultiPageControl::activated( ::sal_Int32 ID ) throw (RuntimeException)
{
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( ID ), sal_False );
}
void SAL_CALL UnoMultiPageControl::deactivated( ::sal_Int32 /*ID*/ ) throw (RuntimeException)
{
}
void SAL_CALL UnoMultiPageControl::disposing(const EventObject&) throw (RuntimeException)
{
}
void SAL_CALL UnoMultiPageControl::dispose() throw (RuntimeException)
{
lang::EventObject aEvt;
aEvt.Source = (::cppu::OWeakObject*)this;
maTabListeners.disposeAndClear( aEvt );
UnoParentControl::dispose();
}
// com::sun::star::awt::XSimpleTabController
::sal_Int32 SAL_CALL UnoMultiPageControl::insertTab() throw (RuntimeException)
{
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
if ( !xMultiPage.is() )
throw RuntimeException();
return xMultiPage->insertTab();
}
void SAL_CALL UnoMultiPageControl::removeTab( ::sal_Int32 ID ) throw (IndexOutOfBoundsException, RuntimeException)
{
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
if ( !xMultiPage.is() )
throw RuntimeException();
xMultiPage->removeTab( ID );
}
void SAL_CALL UnoMultiPageControl::setTabProps( ::sal_Int32 ID, const Sequence< NamedValue >& Properties ) throw (IndexOutOfBoundsException, RuntimeException)
{
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
if ( !xMultiPage.is() )
throw RuntimeException();
xMultiPage->setTabProps( ID, Properties );
}
Sequence< NamedValue > SAL_CALL UnoMultiPageControl::getTabProps( ::sal_Int32 ID ) throw (IndexOutOfBoundsException, RuntimeException)
{
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
if ( !xMultiPage.is() )
throw RuntimeException();
return xMultiPage->getTabProps( ID );
}
void SAL_CALL UnoMultiPageControl::activateTab( ::sal_Int32 ID ) throw (IndexOutOfBoundsException, RuntimeException)
{
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
if ( !xMultiPage.is() )
throw RuntimeException();
xMultiPage->activateTab( ID );
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( ID ), sal_True );
}
::sal_Int32 SAL_CALL UnoMultiPageControl::getActiveTabID() throw (RuntimeException)
{
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
if ( !xMultiPage.is() )
throw RuntimeException();
return xMultiPage->getActiveTabID();
}
void SAL_CALL UnoMultiPageControl::addTabListener( const Reference< XTabListener >& Listener ) throw (RuntimeException)
{
maTabListeners.addInterface( Listener );
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
if ( xMultiPage.is() && maTabListeners.getLength() == 1 )
xMultiPage->addTabListener( &maTabListeners );
}
void SAL_CALL UnoMultiPageControl::removeTabListener( const Reference< XTabListener >& Listener ) throw (RuntimeException)
{
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
if ( xMultiPage.is() && maTabListeners.getLength() == 1 )
xMultiPage->removeTabListener( &maTabListeners );
maTabListeners.removeInterface( Listener );
}
// lang::XTypeProvider
IMPL_XTYPEPROVIDER_START( UnoMultiPageControl )
getCppuType( ( uno::Reference< awt::XSimpleTabController>* ) NULL ),
getCppuType( ( uno::Reference< awt::XTabListener>* ) NULL ),
UnoParentControl::getTypes()
IMPL_XTYPEPROVIDER_END
// uno::XInterface
uno::Any UnoMultiPageControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
{
uno::Any aRet = ::cppu::queryInterface( rType,
SAL_STATIC_CAST( awt::XTabListener*, this ), SAL_STATIC_CAST( awt::XSimpleTabController*, this ) );
return (aRet.hasValue() ? aRet : UnoParentControl::queryAggregation( rType ));
}
::rtl::OUString UnoMultiPageControl::GetComponentServiceName()
{
sal_Bool bDecoration( sal_True );
ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
if ( bDecoration )
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("tabcontrol"));
// Hopefully we can tweak the tabcontrol to display without tabs
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("tabcontrolnotabs"));
}
void UnoMultiPageControl::bindPage( const uno::Reference< awt::XControl >& _rxControl )
{
uno::Reference< awt::XWindowPeer > xPage( _rxControl->getPeer() );
uno::Reference< awt::XSimpleTabController > xTabCntrl( getPeer(), uno::UNO_QUERY );
uno::Reference< beans::XPropertySet > xProps( _rxControl->getModel(), uno::UNO_QUERY );
VCLXTabPage* pXPage = dynamic_cast< VCLXTabPage* >( xPage.get() );
TabPage* pPage = pXPage ? pXPage->getTabPage() : NULL;
if ( xTabCntrl.is() && pPage )
{
VCLXMultiPage* pXTab = dynamic_cast< VCLXMultiPage* >( xTabCntrl.get() );
if ( pXTab )
{
rtl::OUString sTitle;
xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ) ) >>= sTitle;
pXTab->insertTab( pPage, sTitle);
}
}
}
void UnoMultiPageControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
UnoControlContainer::createPeer( rxToolkit, rParentPeer );
uno::Sequence< uno::Reference< awt::XControl > > aCtrls = getControls();
sal_uInt32 nCtrls = aCtrls.getLength();
for( sal_uInt32 n = 0; n < nCtrls; n++ )
bindPage( aCtrls[ n ] );
sal_Int32 nActiveTab(0);
Reference< XPropertySet > xMultiProps( getModel(), UNO_QUERY );
xMultiProps->getPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ) ) >>= nActiveTab;
uno::Reference< awt::XSimpleTabController > xTabCntrl( getPeer(), uno::UNO_QUERY );
if ( xTabCntrl.is() )
{
xTabCntrl->addTabListener( this );
if ( nActiveTab && nCtrls ) // Ensure peer is initialise with correct activated tab
{
xTabCntrl->activateTab( nActiveTab );
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( nActiveTab ), sal_True );
}
}
}
void UnoMultiPageControl::impl_createControlPeerIfNecessary( const uno::Reference< awt::XControl >& _rxControl)
{
OSL_PRECOND( _rxControl.is(), "UnoMultiPageControl::impl_createControlPeerIfNecessary: invalid control, this will crash!" );
// if the container already has a peer, then also create a peer for the control
uno::Reference< awt::XWindowPeer > xMyPeer( getPeer() );
if( xMyPeer.is() )
{
_rxControl->createPeer( NULL, xMyPeer );
bindPage( _rxControl );
ImplActivateTabControllers();
}
}
// ------------- UnoMultiPageModel -----------------
UnoMultiPageModel::UnoMultiPageModel() : UnoControlDialogModel( false )
{
ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
ImplRegisterProperty( BASEPROPERTY_ENABLED );
ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
ImplRegisterProperty( BASEPROPERTY_HELPURL );
ImplRegisterProperty( BASEPROPERTY_SIZEABLE );
//ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
ImplRegisterProperty( BASEPROPERTY_MULTIPAGEVALUE );
ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES );
Any aBool;
aBool <<= (sal_Bool) sal_True;
ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
ImplRegisterProperty( BASEPROPERTY_DECORATION, aBool );
// MultiPage Control has the tab stop property. And the default value is True.
ImplRegisterProperty( BASEPROPERTY_TABSTOP, aBool );
}
UnoMultiPageModel::UnoMultiPageModel( const UnoMultiPageModel& rModel )
: UnoControlDialogModel( rModel )
{
}
UnoMultiPageModel::~UnoMultiPageModel()
{
}
UnoControlModel*
UnoMultiPageModel::Clone() const
{
// clone the container itself
UnoMultiPageModel* pClone = new UnoMultiPageModel( *this );
// clone all children
::std::for_each(
maModels.begin(), maModels.end(),
CloneControlModel( pClone->maModels )
);
return pClone;
}
::rtl::OUString UnoMultiPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
{
return ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageModel );
}
uno::Any UnoMultiPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
{
if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
{
uno::Any aAny;
aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageControl );
return aAny;
}
return UnoControlDialogModel::ImplGetDefaultValue( nPropId );
}
::cppu::IPropertyArrayHelper& UnoMultiPageModel::getInfoHelper()
{
static UnoPropertyArrayHelper* pHelper = NULL;
if ( !pHelper )
{
uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
pHelper = new UnoPropertyArrayHelper( aIDs );
}
return *pHelper;
}
// beans::XMultiPropertySet
uno::Reference< beans::XPropertySetInfo > UnoMultiPageModel::getPropertySetInfo( ) throw(uno::RuntimeException)
{
static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
void UnoMultiPageModel::insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
{
Reference< XServiceInfo > xInfo;
aElement >>= xInfo;
if ( !xInfo.is() )
throw IllegalArgumentException();
// Only a Page model can be inserted into the multipage
if ( !xInfo->supportsService( rtl::OUString::createFromAscii( szServiceName_UnoPageModel ) ) )
throw IllegalArgumentException();
return UnoControlDialogModel::insertByName( aName, aElement );
}
// ----------------------------------------------------------------------------
sal_Bool SAL_CALL UnoMultiPageModel::getGroupControl( ) throw (RuntimeException)
{
return sal_True;
}
// ----------------------------------------------------
// class UnoPageControl
// ----------------------------------------------------
UnoPageControl::UnoPageControl()
{
maComponentInfos.nWidth = 280;
maComponentInfos.nHeight = 400;
}
UnoPageControl::~UnoPageControl()
{
}
::rtl::OUString UnoPageControl::GetComponentServiceName()
{
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("tabpage"));
}
// ------------- UnoPageModel -----------------
UnoPageModel::UnoPageModel() : UnoControlDialogModel( false )
{
ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
ImplRegisterProperty( BASEPROPERTY_ENABLED );
ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
ImplRegisterProperty( BASEPROPERTY_HELPURL );
ImplRegisterProperty( BASEPROPERTY_TITLE );
ImplRegisterProperty( BASEPROPERTY_SIZEABLE );
ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES );
// ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
Any aBool;
aBool <<= (sal_Bool) sal_True;
ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
//ImplRegisterProperty( BASEPROPERTY_TABSTOP, aBool );
}
UnoPageModel::UnoPageModel( const UnoPageModel& rModel )
: UnoControlDialogModel( rModel )
{
}
UnoPageModel::~UnoPageModel()
{
}
UnoControlModel*
UnoPageModel::Clone() const
{
// clone the container itself
UnoPageModel* pClone = new UnoPageModel( *this );
// clone all children
::std::for_each(
maModels.begin(), maModels.end(),
CloneControlModel( pClone->maModels )
);
return pClone;
}
::rtl::OUString UnoPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
{
return ::rtl::OUString::createFromAscii( szServiceName_UnoPageModel );
}
uno::Any UnoPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
{
if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
{
uno::Any aAny;
aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoPageControl );
return aAny;
}
return UnoControlDialogModel::ImplGetDefaultValue( nPropId );
}
::cppu::IPropertyArrayHelper& UnoPageModel::getInfoHelper()
{
static UnoPropertyArrayHelper* pHelper = NULL;
if ( !pHelper )
{
uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
pHelper = new UnoPropertyArrayHelper( aIDs );
}
return *pHelper;
}
// beans::XMultiPropertySet
uno::Reference< beans::XPropertySetInfo > UnoPageModel::getPropertySetInfo( ) throw(uno::RuntimeException)
{
static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
// ----------------------------------------------------------------------------
sal_Bool SAL_CALL UnoPageModel::getGroupControl( ) throw (RuntimeException)
{
return sal_False;
}
// Frame control
// ----------------------------------------------------
// class UnoFrameControl
// ----------------------------------------------------
UnoFrameControl::UnoFrameControl()
{
maComponentInfos.nWidth = 280;
maComponentInfos.nHeight = 400;
}
UnoFrameControl::~UnoFrameControl()
{
}
::rtl::OUString UnoFrameControl::GetComponentServiceName()
{
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("frame"));
}
void UnoFrameControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
{
bool bOwnCtrl = false;
rtl::OUString sTitle;
if ( rxCtrl.get() == Reference<XControl>( this ).get() )
bOwnCtrl = true;
Reference< XPropertySet > xProps( getModel(), UNO_QUERY );
//xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ) ) >>= sTitle;
xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ) ) >>= sTitle;
UnoParentControl::ImplSetPosSize( rxCtrl );
Reference < XWindow > xW( rxCtrl, UNO_QUERY );
if ( !bOwnCtrl && xW.is() && sTitle.getLength() )
{
awt::Rectangle aSizePos = xW->getPosSize();
sal_Int32 nX = aSizePos.X, nY = aSizePos.Y, nWidth = aSizePos.Width, nHeight = aSizePos.Height;
// Retrieve the values set by the base class
OutputDevice*pOutDev = Application::GetDefaultDevice();
if ( pOutDev )
{
if ( !bOwnCtrl && sTitle.getLength() )
{
// Adjust Y based on height of Title
::Rectangle aRect = pOutDev->GetTextRect( aRect, sTitle );
nY = nY + ( aRect.GetHeight() / 2 );
}
}
else
{
Reference< XWindowPeer > xPeer = ImplGetCompatiblePeer( sal_True );
Reference< XDevice > xD( xPeer, UNO_QUERY );
SimpleFontMetric aFM;
FontDescriptor aFD;
Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) );
aVal >>= aFD;
if ( aFD.StyleName.getLength() )
{
Reference< XFont > xFont = xD->getFont( aFD );
aFM = xFont->getFontMetric();
}
else
{
Reference< XGraphics > xG = xD->createGraphics();
aFM = xG->getFontMetric();
}
sal_Int16 nH = aFM.Ascent + aFM.Descent;
if ( !bOwnCtrl && sTitle.getLength() )
// offset y based on height of font ( not sure if my guess at the correct calculation is correct here )
nY = nY + ( nH / 8); // how do I test this
}
xW->setPosSize( nX, nY, nWidth, nHeight, PosSize::POSSIZE );
}
}
// ------------- UnoFrameModel -----------------
UnoFrameModel::UnoFrameModel() : UnoControlDialogModel( false )
{
ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
ImplRegisterProperty( BASEPROPERTY_ENABLED );
ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
ImplRegisterProperty( BASEPROPERTY_HELPURL );
ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
ImplRegisterProperty( BASEPROPERTY_LABEL );
ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES );
}
UnoFrameModel::UnoFrameModel( const UnoFrameModel& rModel )
: UnoControlDialogModel( rModel )
{
}
UnoFrameModel::~UnoFrameModel()
{
}
UnoControlModel*
UnoFrameModel::Clone() const
{
// clone the container itself
UnoFrameModel* pClone = new UnoFrameModel( *this );
// clone all children
::std::for_each(
maModels.begin(), maModels.end(),
CloneControlModel( pClone->maModels )
);
return pClone;
}
::rtl::OUString UnoFrameModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
{
return ::rtl::OUString::createFromAscii( szServiceName_UnoFrameModel );
}
uno::Any UnoFrameModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
{
if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
{
uno::Any aAny;
aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoFrameControl );
return aAny;
}
return UnoControlDialogModel::ImplGetDefaultValue( nPropId );
}
::cppu::IPropertyArrayHelper& UnoFrameModel::getInfoHelper()
{
static UnoPropertyArrayHelper* pHelper = NULL;
if ( !pHelper )
{
uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
pHelper = new UnoPropertyArrayHelper( aIDs );
}
return *pHelper;
}
// beans::XMultiPropertySet
uno::Reference< beans::XPropertySetInfo > UnoFrameModel::getPropertySetInfo( ) throw(uno::RuntimeException)
{
static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|