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
|
/* -*- 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_sfx2.hxx"
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
#pragma warning( disable : 4290 )
#endif
#include <com/sun/star/document/UpdateDocMode.hpp>
#include "sal/config.h"
#include <sfx2/appuno.hxx>
#include "appbaslib.hxx"
#include "sfx2/dllapi.h"
#include <basic/sbx.hxx>
#include <svl/itempool.hxx>
#include <svl/rectitem.hxx>
#include <tools/debug.hxx>
#include <tools/wldcrd.hxx>
#include <tools/urlobj.hxx>
#include <tools/config.hxx>
#include <basic/sbxmeth.hxx>
#include <basic/sbmeth.hxx>
#include <basic/sbxobj.hxx>
#include <basic/sberrors.hxx>
#include <basic/basmgr.hxx>
#include <basic/sbuno.hxx>
#include <basic/sbxcore.hxx>
#include <svl/ownlist.hxx>
#include <svl/lckbitem.hxx>
#include <svl/stritem.hxx>
#include <svl/slstitm.hxx>
#include <svl/intitem.hxx>
#include <svl/eitem.hxx>
#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XFrameActionListener.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/FrameActionEvent.hpp>
#include <com/sun/star/frame/FrameAction.hpp>
#include <com/sun/star/container/XContainer.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
#include <com/sun/star/container/XNameReplace.hpp>
#include <com/sun/star/container/XContainerListener.hpp>
#include <com/sun/star/container/XSet.hpp>
#include <com/sun/star/container/ContainerEvent.hpp>
#include <com/sun/star/container/XIndexReplace.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/awt/XTopWindow.hpp>
#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/registry/RegistryValueType.hpp>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/awt/XButton.hpp>
#include <com/sun/star/frame/DispatchResultEvent.hpp>
#include <com/sun/star/frame/DispatchResultState.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/document/MacroExecMode.hpp>
#include <com/sun/star/ucb/XContent.hpp>
#include <tools/cachestr.hxx>
#include <osl/mutex.hxx>
#include <comphelper/sequence.hxx>
#include <framework/documentundoguard.hxx>
#include <rtl/ustrbuf.hxx>
#include <comphelper/interaction.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::registry;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::io;
#include "sfxtypes.hxx"
#include <sfx2/sfxuno.hxx>
#include <sfx2/app.hxx>
#include <sfx2/sfxsids.hrc>
#include <sfx2/msg.hxx>
#include <sfx2/msgpool.hxx>
#include <sfx2/request.hxx>
#include <sfx2/module.hxx>
#include <sfx2/fcontnr.hxx>
#include "frmload.hxx"
#include <sfx2/frame.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/objuno.hxx>
#include <sfx2/unoctitm.hxx>
#include <sfx2/dispatch.hxx>
#include "doctemplates.hxx"
#include "shutdownicon.hxx"
#include "objshimp.hxx"
#include "fltoptint.hxx"
#include <sfx2/docfile.hxx>
#include <sfx2/sfxbasecontroller.hxx>
#include <sfx2/brokenpackageint.hxx>
#include "eventsupplier.hxx"
#include "xpackcreator.hxx"
#include "plugin.hxx"
#include "iframe.hxx"
#include <ownsubfilterservice.hxx>
#include "SfxDocumentMetaData.hxx"
#define PROTOCOLHANDLER_SERVICENAME "com.sun.star.frame.ProtocolHandler"
static char const sTemplateRegionName[] = "TemplateRegionName";
static char const sTemplateName[] = "TemplateName";
static char const sAsTemplate[] = "AsTemplate";
static char const sOpenNewView[] = "OpenNewView";
static char const sViewId[] = "ViewId";
static char const sPluginMode[] = "PluginMode";
static char const sReadOnly[] = "ReadOnly";
static char const sDdeReconnect[] = "DDEReconnect";
static char const sStartPresentation[] = "StartPresentation";
static char const sFrameName[] = "FrameName";
static char const sMediaType[] = "MediaType";
static char const sPostData[] = "PostData";
static char const sCharacterSet[] = "CharacterSet";
static char const sInputStream[] = "InputStream";
static char const sStream[] = "Stream";
static char const sOutputStream[] = "OutputStream";
static char const sHidden[] = "Hidden";
static char const sPreview[] = "Preview";
static char const sViewOnly[] = "ViewOnly";
static char const sDontEdit[] = "DontEdit";
static char const sSilent[] = "Silent";
static char const sJumpMark[] = "JumpMark";
static char const sFileName[] = "FileName";
static char const sSalvagedFile[] = "SalvagedFile";
static char const sStatusInd[] = "StatusIndicator";
static char const sModel[] = "Model";
static char const sFrame[] = "Frame";
static char const sViewData[] = "ViewData";
static char const sFilterData[] = "FilterData";
static char const sSelectionOnly[] = "SelectionOnly";
static char const sFilterFlags[] = "FilterFlags";
static char const sMacroExecMode[] = "MacroExecutionMode";
static char const sUpdateDocMode[] = "UpdateDocMode";
static char const sMinimized[] = "Minimized";
static char const sInteractionHdl[] = "InteractionHandler";
static char const sUCBContent[] = "UCBContent";
static char const sRepairPackage[] = "RepairPackage";
static char const sDocumentTitle[] = "DocumentTitle";
static char const sComponentData[] = "ComponentData";
static char const sComponentContext[] = "ComponentContext";
static char const sDocumentBaseURL[] = "DocumentBaseURL";
static char const sHierarchicalDocumentName[] = "HierarchicalDocumentName";
static char const sCopyStreamIfPossible[] = "CopyStreamIfPossible";
static char const sNoAutoSave[] = "NoAutoSave";
static char const sFolderName[] = "FolderName";
static char const sUseSystemDialog[] = "UseSystemDialog";
static char const sStandardDir[] = "StandardDir";
static char const sBlackList[] = "BlackList";
static char const sModifyPasswordInfo[] = "ModifyPasswordInfo";
static char const sSuggestedSaveAsDir[] = "SuggestedSaveAsDir";
static char const sSuggestedSaveAsName[] = "SuggestedSaveAsName";
static char const sEncryptionData[] = "EncryptionData";
void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot )
{
if ( !pSlot )
pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
if ( !pSlot )
return;
if ( nSlotId == SID_OPENURL )
nSlotId = SID_OPENDOC;
if ( nSlotId == SID_SAVEASURL )
nSlotId = SID_SAVEASDOC;
sal_Int32 nCount = rArgs.getLength();
if ( !nCount )
return;
const ::com::sun::star::beans::PropertyValue* pPropsVal = rArgs.getConstArray();
if ( !pSlot->IsMode(SFX_SLOT_METHOD) )
{
// slot is a property
const SfxType* pType = pSlot->GetType();
SfxPoolItem* pItem = pType->CreateItem();
if ( !pItem )
{
#ifdef DBG_UTIL
ByteString aStr( "No creator method for item: ");
aStr += ByteString::CreateFromInt32( nSlotId );
DBG_ERROR( aStr.GetBuffer() );
#endif
return;
}
sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
pItem->SetWhich( nWhich );
sal_uInt16 nSubCount = pType->nAttribs;
const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[0];
String aName = rProp.Name;
if ( nCount == 1 && aName.CompareToAscii( pSlot->pUnoName ) == COMPARE_EQUAL )
{
// there is only one parameter and its name matches the name of the property,
// so it's either a simple property or a complex property in one single UNO struct
if( pItem->PutValue( rProp.Value, bConvertTwips ? CONVERT_TWIPS : 0 ) )
// only use successfully converted items
rSet.Put( *pItem );
#ifdef DBG_UTIL
else
{
ByteString aStr( "Property not convertable: ");
aStr += pSlot->pUnoName;
DBG_ERROR( aStr.GetBuffer() );
}
#endif
}
#ifdef DBG_UTIL
else if ( nSubCount == 0 )
{
// for a simple property there can be only one parameter and its name *must* match
ByteString aStr( "Property name does not match: ");
aStr += ByteString( aName, RTL_TEXTENCODING_UTF8 );
DBG_ERROR( aStr.GetBuffer() );
}
#endif
else
{
// there is more than one parameter and the property is a complex one
#ifdef DBG_UTIL
// if the dispatch API is used for UI purposes or from the testtool,
// it is possible to skip some or all arguments,
// but it indicates an error for macro recording;
// so this should be notified as a warning only
if ( nCount != nSubCount )
{
ByteString aStr( "MacroPlayer: wrong number of parameters for slot: ");
aStr += ByteString::CreateFromInt32( nSlotId );
DBG_WARNING( aStr.GetBuffer() );
}
#endif
// complex property; collect sub items from the parameter set and reconstruct complex item
sal_uInt16 nFound=0;
for ( sal_uInt16 n=0; n<nCount; n++ )
{
const ::com::sun::star::beans::PropertyValue& rPropValue = pPropsVal[n];
sal_uInt16 nSub;
for ( nSub=0; nSub<nSubCount; nSub++ )
{
// search sub item by name
ByteString aStr( pSlot->pUnoName );
aStr += '.';
aStr += ByteString( pType->aAttrib[nSub].pName );
const char* pName = aStr.GetBuffer();
if ( rPropValue.Name.compareToAscii( pName ) == COMPARE_EQUAL )
{
sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[nSub].nAID;
if ( bConvertTwips )
nSubId |= CONVERT_TWIPS;
if ( pItem->PutValue( rPropValue.Value, nSubId ) )
nFound++;
#ifdef DBG_UTIL
else
{
ByteString aDbgStr( "Property not convertable: ");
aDbgStr += pSlot->pUnoName;
DBG_ERROR( aDbgStr.GetBuffer() );
}
#endif
break;
}
}
#ifdef DBG_UTIL
if ( nSub >= nSubCount )
{
// there was a parameter with a name that didn't match to any of the members
ByteString aStr( "Property name does not match: ");
aStr += ByteString( String(rPropValue.Name), RTL_TEXTENCODING_UTF8 );
DBG_ERROR( aStr.GetBuffer() );
}
#endif
}
// at least one part of the complex item must be present; other parts can have default values
if ( nFound > 0 )
rSet.Put( *pItem );
}
delete pItem;
}
else if ( nCount )
{
#ifdef DBG_UTIL
// detect parameters that don't match to any formal argument or one of its members
sal_Int32 nFoundArgs = 0;
#endif
// slot is a method
for ( sal_uInt16 nArgs=0; nArgs<pSlot->nArgDefCount; nArgs++ )
{
const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArgs );
SfxPoolItem* pItem = rArg.CreateItem();
if ( !pItem )
{
#ifdef DBG_UTIL
ByteString aStr( "No creator method for argument: ");
aStr += rArg.pName;
DBG_ERROR( aStr.GetBuffer() );
#endif
return;
}
sal_uInt16 nWhich = rSet.GetPool()->GetWhich(rArg.nSlotId);
sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
pItem->SetWhich( nWhich );
const SfxType* pType = rArg.pType;
sal_uInt16 nSubCount = pType->nAttribs;
if ( nSubCount == 0 )
{
// "simple" (base type) argument
for ( sal_uInt16 n=0; n<nCount; n++ )
{
const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n];
String aName = rProp.Name;
if ( aName.CompareToAscii(rArg.pName) == COMPARE_EQUAL )
{
#ifdef DBG_UTIL
++nFoundArgs;
#endif
if( pItem->PutValue( rProp.Value ) )
// only use successfully converted items
rSet.Put( *pItem );
#ifdef DBG_UTIL
else
{
ByteString aStr( "Property not convertable: ");
aStr += rArg.pName;
DBG_ERROR( aStr.GetBuffer() );
}
#endif
break;
}
}
}
else
{
// complex argument, could be passed in one struct
sal_Bool bAsWholeItem = sal_False;
for ( sal_uInt16 n=0; n<nCount; n++ )
{
const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n];
String aName = rProp.Name;
if ( aName.CompareToAscii(rArg.pName) == COMPARE_EQUAL )
{
bAsWholeItem = sal_True;
#ifdef DBG_UTIL
++nFoundArgs;
#endif
if( pItem->PutValue( rProp.Value ) )
// only use successfully converted items
rSet.Put( *pItem );
#ifdef DBG_UTIL
else
{
ByteString aStr( "Property not convertable: ");
aStr += rArg.pName;
DBG_ERROR( aStr.GetBuffer() );
}
#endif
}
}
if ( !bAsWholeItem )
{
// complex argument; collect sub items from argument array and reconstruct complex item
// only put item if at least one member was found and had the correct type
// (is this a good idea?! Should we ask for *all* members?)
sal_Bool bRet = sal_False;
for ( sal_uInt16 n=0; n<nCount; n++ )
{
const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n];
for ( sal_uInt16 nSub=0; nSub<nSubCount; nSub++ )
{
// search sub item by name
ByteString aStr( rArg.pName );
aStr += '.';
aStr += pType->aAttrib[nSub].pName;
const char* pName = aStr.GetBuffer();
if ( rProp.Name.compareToAscii( pName ) == COMPARE_EQUAL )
{
// at least one member found ...
bRet = sal_True;
#ifdef DBG_UTIL
++nFoundArgs;
#endif
sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[nSub].nAID;
if ( bConvertTwips )
nSubId |= CONVERT_TWIPS;
if (!pItem->PutValue( rProp.Value, nSubId ) )
{
// ... but it was not convertable
bRet = sal_False;
#ifdef DBG_UTIL
ByteString aDbgStr( "Property not convertable: ");
aDbgStr += rArg.pName;
DBG_ERROR( aDbgStr.GetBuffer() );
#endif
}
break;
}
}
}
if ( bRet )
// only use successfully converted items
rSet.Put( *pItem );
}
}
delete pItem;
}
// special additional parameters for some slots not seen in the slot definitions
// Some of these slots are not considered to be used for macro recording, because they shouldn't be recorded as slots,
// but as dispatching or factory or arbitrary URLs to the frame
// Some also can use additional arguments that are not recordable (will be changed later,
// f.e. "SaveAs" shouldn't support parameters not in the slot definition!)
if ( nSlotId == SID_NEWWINDOW )
{
for ( sal_uInt16 n=0; n<nCount; n++ )
{
const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n];
rtl::OUString aName = rProp.Name;
if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFrame)) )
{
Reference< XFrame > xFrame;
OSL_VERIFY( rProp.Value >>= xFrame );
rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
}
else
if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sHidden)) )
{
sal_Bool bVal = sal_False;
if (rProp.Value >>= bVal)
rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
}
}
}
else if ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC || nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC ||
nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF )
{
for ( sal_uInt16 n=0; n<nCount; n++ )
{
#ifdef DBG_UTIL
++nFoundArgs;
#endif
const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n];
rtl::OUString aName = rProp.Name;
if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sModel)) )
rSet.Put( SfxUnoAnyItem( SID_DOCUMENT, rProp.Value ) );
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sComponentData)) )
{
rSet.Put( SfxUnoAnyItem( SID_COMPONENTDATA, rProp.Value ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sComponentContext)) )
{
rSet.Put( SfxUnoAnyItem( SID_COMPONENTCONTEXT, rProp.Value ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStatusInd)) )
{
Reference< ::com::sun::star::task::XStatusIndicator > xVal;
sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
DBG_ASSERT( bOK, "invalid type for StatusIndicator" );
if (bOK)
rSet.Put( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, rProp.Value ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sInteractionHdl)) )
{
Reference< ::com::sun::star::task::XInteractionHandler > xVal;
sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
DBG_ASSERT( bOK, "invalid type for InteractionHandler" );
if (bOK)
rSet.Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, rProp.Value ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sViewData)) )
rSet.Put( SfxUnoAnyItem( SID_VIEW_DATA, rProp.Value ) );
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFilterData)) )
rSet.Put( SfxUnoAnyItem( SID_FILTER_DATA, rProp.Value ) );
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sInputStream)) )
{
Reference< XInputStream > xVal;
sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
DBG_ASSERT( bOK, "invalid type for InputStream" );
if (bOK)
rSet.Put( SfxUnoAnyItem( SID_INPUTSTREAM, rProp.Value ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStream)) )
{
Reference< XInputStream > xVal;
sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
DBG_ASSERT( bOK, "invalid type for Stream" );
if (bOK)
rSet.Put( SfxUnoAnyItem( SID_STREAM, rProp.Value ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sUCBContent)) )
{
Reference< XContent > xVal;
sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
DBG_ASSERT( bOK, "invalid type for UCBContent" );
if (bOK)
rSet.Put( SfxUnoAnyItem( SID_CONTENT, rProp.Value ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sOutputStream)) )
{
Reference< XOutputStream > xVal;
sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
DBG_ASSERT( bOK, "invalid type for OutputStream" );
if (bOK)
rSet.Put( SfxUnoAnyItem( SID_OUTPUTSTREAM, rProp.Value ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPostData)) )
{
Reference< XInputStream > xVal;
sal_Bool bOK = (rProp.Value >>= xVal);
DBG_ASSERT( bOK, "invalid type for PostData" );
if (bOK)
rSet.Put( SfxUnoAnyItem( SID_POSTDATA, rProp.Value ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFrame)) )
{
Reference< XFrame > xFrame;
sal_Bool bOK = (rProp.Value >>= xFrame);
DBG_ASSERT( bOK, "invalid type for Frame" );
if (bOK)
rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sAsTemplate)) )
{
sal_Bool bVal = sal_False;
sal_Bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for AsTemplate" );
if (bOK)
rSet.Put( SfxBoolItem( SID_TEMPLATE, bVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sOpenNewView)) )
{
sal_Bool bVal = sal_False;
sal_Bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for OpenNewView" );
if (bOK)
rSet.Put( SfxBoolItem( SID_OPEN_NEW_VIEW, bVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sViewId)) )
{
sal_Int16 nVal = -1;
sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
DBG_ASSERT( bOK, "invalid type for ViewId" );
if (bOK)
rSet.Put( SfxUInt16Item( SID_VIEW_ID, nVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPluginMode)) )
{
sal_Int16 nVal = -1;
sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
DBG_ASSERT( bOK, "invalid type for PluginMode" );
if (bOK)
rSet.Put( SfxUInt16Item( SID_PLUGIN_MODE, nVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sReadOnly)) )
{
sal_Bool bVal = sal_False;
sal_Bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for ReadOnly" );
if (bOK)
rSet.Put( SfxBoolItem( SID_DOC_READONLY, bVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDdeReconnect)) )
{
sal_Bool bVal = sal_True;
sal_Bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for DDEReconnect" );
if (bOK)
rSet.Put( SfxBoolItem( SID_DDE_RECONNECT_ONLOAD, bVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStartPresentation)) )
{
sal_Bool bVal = sal_False;
sal_Bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for StartPresentation" );
if (bOK)
rSet.Put( SfxBoolItem( SID_DOC_STARTPRESENTATION, bVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSelectionOnly)) )
{
sal_Bool bVal = sal_False;
sal_Bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for SelectionOnly" );
if (bOK)
rSet.Put( SfxBoolItem( SID_SELECTION, bVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sHidden)) )
{
sal_Bool bVal = sal_False;
sal_Bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for Hidden" );
if (bOK)
rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sMinimized)) )
{
sal_Bool bVal = sal_False;
sal_Bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for Minimized" );
if (bOK)
rSet.Put( SfxBoolItem( SID_MINIMIZED, bVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSilent)) )
{
sal_Bool bVal = sal_False;
sal_Bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for Silent" );
if (bOK)
rSet.Put( SfxBoolItem( SID_SILENT, bVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPreview)) )
{
sal_Bool bVal = sal_False;
sal_Bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for Preview" );
if (bOK)
rSet.Put( SfxBoolItem( SID_PREVIEW, bVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sViewOnly)) )
{
sal_Bool bVal = sal_False;
sal_Bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for ViewOnly" );
if (bOK)
rSet.Put( SfxBoolItem( SID_VIEWONLY, bVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDontEdit)) )
{
sal_Bool bVal = sal_False;
sal_Bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for ViewOnly" );
if (bOK)
rSet.Put( SfxBoolItem( SID_EDITDOC, !bVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sUseSystemDialog)) )
{
sal_Bool bVal = sal_False;
sal_Bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for ViewOnly" );
if (bOK)
rSet.Put( SfxBoolItem( SID_FILE_DIALOG, bVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStandardDir)) )
{
::rtl::OUString sVal;
sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
DBG_ASSERT( bOK, "invalid type or value for StandardDir" );
if (bOK)
rSet.Put( SfxStringItem( SID_STANDARD_DIR, sVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBlackList)) )
{
::com::sun::star::uno::Sequence< ::rtl::OUString > xVal;
sal_Bool bOK = (rProp.Value >>= xVal);
DBG_ASSERT( bOK, "invalid type or value for BlackList" );
if (bOK)
{
SfxStringListItem stringList(SID_BLACK_LIST);
stringList.SetStringList( xVal );
rSet.Put( stringList );
}
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFileName)) )
{
::rtl::OUString sVal;
sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
DBG_ASSERT( bOK, "invalid type or value for FileName" );
if (bOK)
rSet.Put( SfxStringItem( SID_FILE_NAME, sVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSalvagedFile)) )
{
::rtl::OUString sVal;
sal_Bool bOK = (rProp.Value >>= sVal);
DBG_ASSERT( bOK, "invalid type or value for SalvagedFile" );
if (bOK)
rSet.Put( SfxStringItem( SID_DOC_SALVAGE, sVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFolderName)) )
{
::rtl::OUString sVal;
sal_Bool bOK = (rProp.Value >>= sVal);
DBG_ASSERT( bOK, "invalid type or value for FolderName" );
if (bOK)
rSet.Put( SfxStringItem( SID_PATH, sVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFrameName)) )
{
::rtl::OUString sVal;
sal_Bool bOK = (rProp.Value >>= sVal);
DBG_ASSERT( bOK, "invalid type for FrameName" );
if (bOK && sVal.getLength())
rSet.Put( SfxStringItem( SID_TARGETNAME, sVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sMediaType)) )
{
::rtl::OUString sVal;
sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
DBG_ASSERT( bOK, "invalid type or value for MediaType" );
if (bOK)
rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sTemplateName)) )
{
::rtl::OUString sVal;
sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
DBG_ASSERT( bOK, "invalid type or value for TemplateName" );
if (bOK)
rSet.Put( SfxStringItem( SID_TEMPLATE_NAME, sVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sTemplateRegionName)) )
{
::rtl::OUString sVal;
sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
DBG_ASSERT( bOK, "invalid type or value for TemplateRegionName" );
if (bOK)
rSet.Put( SfxStringItem( SID_TEMPLATE_REGIONNAME, sVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sJumpMark)) )
{
::rtl::OUString sVal;
sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
DBG_ASSERT( bOK, "invalid type or value for JumpMark" );
if (bOK)
rSet.Put( SfxStringItem( SID_JUMPMARK, sVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sCharacterSet)) )
{
::rtl::OUString sVal;
sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
DBG_ASSERT( bOK, "invalid type or value for CharacterSet" );
if (bOK)
rSet.Put( SfxStringItem( SID_CHARSET, sVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFilterFlags)) )
{
::rtl::OUString sVal;
sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
DBG_ASSERT( bOK, "invalid type or value for FilterFlags" );
if (bOK)
rSet.Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sMacroExecMode)) )
{
sal_Int16 nVal =-1;
sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
DBG_ASSERT( bOK, "invalid type for MacroExecMode" );
if (bOK)
rSet.Put( SfxUInt16Item( SID_MACROEXECMODE, nVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sUpdateDocMode)) )
{
sal_Int16 nVal =-1;
sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
DBG_ASSERT( bOK, "invalid type for UpdateDocMode" );
if (bOK)
rSet.Put( SfxUInt16Item( SID_UPDATEDOCMODE, nVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sRepairPackage)) )
{
sal_Bool bVal = sal_False;
sal_Bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for RepairPackage" );
if (bOK)
rSet.Put( SfxBoolItem( SID_REPAIRPACKAGE, bVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDocumentTitle)) )
{
::rtl::OUString sVal;
sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
DBG_ASSERT( bOK, "invalid type or value for DocumentTitle" );
if (bOK)
rSet.Put( SfxStringItem( SID_DOCINFO_TITLE, sVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDocumentBaseURL)) )
{
::rtl::OUString sVal;
// the base url can be set to empty ( for embedded objects for example )
sal_Bool bOK = (rProp.Value >>= sVal);
DBG_ASSERT( bOK, "invalid type or value for DocumentBaseURL" );
if (bOK)
rSet.Put( SfxStringItem( SID_DOC_BASEURL, sVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sHierarchicalDocumentName)) )
{
::rtl::OUString sVal;
sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
DBG_ASSERT( bOK, "invalid type or value for HierarchicalDocumentName" );
if (bOK)
rSet.Put( SfxStringItem( SID_DOC_HIERARCHICALNAME, sVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sCopyStreamIfPossible)) )
{
sal_Bool bVal = sal_False;
sal_Bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for CopyStreamIfPossible" );
if (bOK)
rSet.Put( SfxBoolItem( SID_COPY_STREAM_IF_POSSIBLE, bVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sNoAutoSave)) )
{
sal_Bool bVal = sal_False;
sal_Bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for NoAutoSave" );
if (bOK)
rSet.Put( SfxBoolItem( SID_NOAUTOSAVE, bVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sModifyPasswordInfo)) )
{
rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sEncryptionData)) )
{
rSet.Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, rProp.Value ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSuggestedSaveAsDir)) )
{
::rtl::OUString sVal;
sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsDir" );
if (bOK)
rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASDIR, sVal ) );
}
else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSuggestedSaveAsName)) )
{
::rtl::OUString sVal;
sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength());
DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsName" );
if (bOK)
rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASNAME, sVal ) );
}
#ifdef DBG_UTIL
else
--nFoundArgs;
#endif
}
}
// API to raise options dialog with a specified options ab page (#i83757#)
else
{
// transform parameter "OptionsPageURL" of slot "OptionsTreeDialog"
String sSlotName( DEFINE_CONST_UNICODE( "OptionsTreeDialog" ) );
String sPropName( DEFINE_CONST_UNICODE( "OptionsPageURL" ) );
if ( sSlotName.EqualsAscii( pSlot->pUnoName ) )
{
for ( sal_uInt16 n = 0; n < nCount; ++n )
{
const PropertyValue& rProp = pPropsVal[n];
String sName( rProp.Name );
if ( sName == sPropName )
{
::rtl::OUString sURL;
if ( rProp.Value >>= sURL )
rSet.Put( SfxStringItem( SID_OPTIONS_PAGEURL, sURL ) );
break;
}
}
}
}
#ifdef DB_UTIL
if ( nFoundArgs == nCount )
{
// except for the "special" slots: assure that every argument was convertable
ByteString aStr( "MacroPlayer: Some properties didn't match to any formal argument for slot: ");
aStr += pSlot->pUnoName;
DBG_WARNING( aStr.GetBuffer() );
}
#endif
}
}
void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, const SfxSlot* pSlot )
{
if ( !pSlot )
pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
if ( !pSlot)
return;
if ( nSlotId == SID_OPENURL )
nSlotId = SID_OPENDOC;
if ( nSlotId == SID_SAVEASURL )
nSlotId = SID_SAVEASDOC;
// find number of properties to avoid permanent reallocations in the sequence
sal_Int32 nProps=0;
#ifdef DBG_UTIL
// trace number of items and compare with number of properties for debugging purposes
sal_Int32 nItems=0;
#endif
const SfxType *pType = pSlot->GetType();
if ( !pSlot->IsMode(SFX_SLOT_METHOD) )
{
// slot is a property
sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
if ( rSet.GetItemState( nWhich ) == SFX_ITEM_SET ) //???
{
sal_uInt16 nSubCount = pType->nAttribs;
if ( nSubCount )
// it's a complex property, we want it split into simple types
// so we expect to get as many items as we have (sub) members
nProps = nSubCount;
else
// simple property: we expect to get exactly one item
nProps++;
}
#ifdef DBG_UTIL
else
{
// we will not rely on the "toggle" ability of some property slots
ByteString aStr( "Processing property slot without argument: ");
aStr += ByteString::CreateFromInt32( nSlotId );
DBG_ERROR( aStr.GetBuffer() );
}
#endif
#ifdef DBG_UTIL
nItems++;
#endif
}
else
{
// slot is a method
sal_uInt16 nFormalArgs = pSlot->GetFormalArgumentCount();
for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
{
// check every formal argument of the method
const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg );
sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
if ( rSet.GetItemState( nWhich ) == SFX_ITEM_SET ) //???
{
sal_uInt16 nSubCount = rArg.pType->nAttribs;
if ( nSubCount )
// argument has a complex type, we want it split into simple types
// so for this argument we expect to get as many items as we have (sub) members
nProps += nSubCount;
else
// argument of simple type: we expect to get exactly one item for it
nProps++;
#ifdef DBG_UTIL
nItems++;
#endif
}
}
// special treatment for slots that are *not* meant to be recorded as slots (except SaveAs/To)
if ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC || nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC ||
nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF )
{
sal_Int32 nAdditional=0;
if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_INTERACTIONHANDLER ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_DOC_SALVAGE ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_PATH ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_FILE_DIALOG ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_STANDARD_DIR ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_BLACK_LIST ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_CONTENT ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_INPUTSTREAM ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_STREAM ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_OUTPUTSTREAM ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_TEMPLATE ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_OPEN_NEW_VIEW ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_VIEW_ID ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_VIEW_DATA ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_FILTER_DATA ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_PLUGIN_MODE ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_DOC_READONLY ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_SELECTION ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_CONTENTTYPE ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_POSTDATA ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_FILLFRAME ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_CHARSET ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_TARGETNAME ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_TEMPLATE_NAME ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_HIDDEN ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_MINIMIZED ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_PREVIEW ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_VIEWONLY ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_EDITDOC ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_SILENT ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_JUMPMARK ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_DOCUMENT ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_MACROEXECMODE ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_UPDATEDOCMODE ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_REPAIRPACKAGE ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_DOCINFO_TITLE ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_COMPONENTDATA ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_COMPONENTCONTEXT ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_DOC_BASEURL ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_NOAUTOSAVE ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR ) == SFX_ITEM_SET )
nAdditional++;
if ( rSet.GetItemState( SID_ENCRYPTIONDATA ) == SFX_ITEM_SET )
nAdditional++;
nAdditional++;
if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME ) == SFX_ITEM_SET )
nAdditional++;
// consider additional arguments
nProps += nAdditional;
#ifdef DBG_UTIL
nItems += nAdditional;
#endif
}
}
#ifdef DBG_UTIL
// now check the itemset: is there any item that is not convertable using the list of formal arguments
// or the table of additional items?!
if ( rSet.Count() != nItems )
{
// detect unknown item and present error message
const sal_uInt16 *pRanges = rSet.GetRanges();
while ( *pRanges )
{
for(sal_uInt16 nId = *pRanges++; nId <= *pRanges; ++nId)
{
if ( rSet.GetItemState(nId) < SFX_ITEM_SET ) //???
// not really set
continue;
if ( !pSlot->IsMode(SFX_SLOT_METHOD) && nId == rSet.GetPool()->GetWhich( pSlot->GetSlotId() ) )
continue;
sal_uInt16 nFormalArgs = pSlot->GetFormalArgumentCount();
sal_uInt16 nArg;
for ( nArg=0; nArg<nFormalArgs; ++nArg )
{
const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg );
sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
if ( nId == nWhich )
break;
}
if ( nArg<nFormalArgs )
continue;
if ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC || nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC ||
nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF )
{
if ( nId == SID_DOCFRAME )
continue;
if ( nId == SID_PROGRESS_STATUSBAR_CONTROL )
continue;
if ( nId == SID_INTERACTIONHANDLER )
continue;
if ( nId == SID_VIEW_DATA )
continue;
if ( nId == SID_FILTER_DATA )
continue;
if ( nId == SID_DOCUMENT )
continue;
if ( nId == SID_CONTENT )
continue;
if ( nId == SID_INPUTSTREAM )
continue;
if ( nId == SID_STREAM )
continue;
if ( nId == SID_OUTPUTSTREAM )
continue;
if ( nId == SID_POSTDATA )
continue;
if ( nId == SID_FILLFRAME )
continue;
if ( nId == SID_TEMPLATE )
continue;
if ( nId == SID_OPEN_NEW_VIEW )
continue;
if ( nId == SID_VIEW_ID )
continue;
if ( nId == SID_PLUGIN_MODE )
continue;
if ( nId == SID_DOC_READONLY )
continue;
if ( nId == SID_DOC_STARTPRESENTATION )
continue;
if ( nId == SID_SELECTION )
continue;
if ( nId == SID_HIDDEN )
continue;
if ( nId == SID_MINIMIZED )
continue;
if ( nId == SID_SILENT )
continue;
if ( nId == SID_PREVIEW )
continue;
if ( nId == SID_VIEWONLY )
continue;
if ( nId == SID_EDITDOC )
continue;
if ( nId == SID_TARGETNAME )
continue;
if ( nId == SID_DOC_SALVAGE )
continue;
if ( nId == SID_PATH )
continue;
if ( nId == SID_FILE_DIALOG )
continue;
if ( nId == SID_STANDARD_DIR )
continue;
if ( nId == SID_BLACK_LIST )
continue;
if ( nId == SID_CONTENTTYPE )
continue;
if ( nId == SID_TEMPLATE_NAME )
continue;
if ( nId == SID_TEMPLATE_REGIONNAME )
continue;
if ( nId == SID_JUMPMARK )
continue;
if ( nId == SID_CHARSET )
continue;
if ( nId == SID_MACROEXECMODE )
continue;
if ( nId == SID_UPDATEDOCMODE )
continue;
if ( nId == SID_REPAIRPACKAGE )
continue;
if ( nId == SID_DOCINFO_TITLE )
continue;
if ( nId == SID_COMPONENTDATA )
continue;
if ( nId == SID_COMPONENTCONTEXT )
continue;
if ( nId == SID_DOC_BASEURL )
continue;
if ( nId == SID_DOC_HIERARCHICALNAME )
continue;
if ( nId == SID_COPY_STREAM_IF_POSSIBLE )
continue;
if ( nId == SID_NOAUTOSAVE )
continue;
if ( nId == SID_ENCRYPTIONDATA )
continue;
// used only internally
if ( nId == SID_SAVETO )
continue;
if ( nId == SID_MODIFYPASSWORDINFO )
continue;
if ( nId == SID_SUGGESTEDSAVEASDIR )
continue;
if ( nId == SID_SUGGESTEDSAVEASNAME )
continue;
}
ByteString aDbg( "Unknown item detected: ");
aDbg += ByteString::CreateFromInt32( nId );
DBG_ASSERT( nArg<nFormalArgs, aDbg.GetBuffer() );
}
}
}
#endif
if ( !nProps )
return;
// convert every item into a property
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> aSequ( nProps );
::com::sun::star::beans::PropertyValue *pValue = aSequ.getArray();
sal_Int32 nActProp=0;
if ( !pSlot->IsMode(SFX_SLOT_METHOD) )
{
// slot is a property
sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
SFX_ITEMSET_ARG( &rSet, pItem, SfxPoolItem, nWhich, sal_False );
if ( pItem ) //???
{
sal_uInt16 nSubCount = pType->nAttribs;
if ( !nSubCount )
{
pValue[nActProp].Name = String( String::CreateFromAscii( pSlot->pUnoName ) ) ;
if ( !pItem->QueryValue( pValue[nActProp].Value ) )
{
ByteString aStr( "Item not convertable: ");
aStr += ByteString::CreateFromInt32(nSlotId);
DBG_ERROR( aStr.GetBuffer() );
}
}
else
{
// complex type, add a property value for every member of the struct
for ( sal_uInt16 n=1; n<=nSubCount; ++n )
{
sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[n-1].nAID;
if ( bConvertTwips )
nSubId |= CONVERT_TWIPS;
DBG_ASSERT(( pType->aAttrib[n-1].nAID ) <= 127, "Member ID out of range" );
String aName( String::CreateFromAscii( pSlot->pUnoName ) ) ;
aName += '.';
aName += String( String::CreateFromAscii( pType->aAttrib[n-1].pName ) ) ;
pValue[nActProp].Name = aName;
if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
{
ByteString aStr( "Sub item ");
aStr += ByteString::CreateFromInt32( pType->aAttrib[n-1].nAID );
aStr += " not convertable in slot: ";
aStr += ByteString::CreateFromInt32(nSlotId);
DBG_ERROR( aStr.GetBuffer() );
}
}
}
}
}
else
{
// slot is a method
sal_uInt16 nFormalArgs = pSlot->GetFormalArgumentCount();
for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
{
const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg );
sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
SFX_ITEMSET_ARG( &rSet, pItem, SfxPoolItem, nWhich, sal_False );
if ( pItem ) //???
{
sal_uInt16 nSubCount = rArg.pType->nAttribs;
if ( !nSubCount )
{
pValue[nActProp].Name = String( String::CreateFromAscii( rArg.pName ) ) ;
if ( !pItem->QueryValue( pValue[nActProp++].Value ) )
{
ByteString aStr( "Item not convertable: ");
aStr += ByteString::CreateFromInt32(rArg.nSlotId);
DBG_ERROR( aStr.GetBuffer() );
}
}
else
{
// complex type, add a property value for every member of the struct
for ( sal_uInt16 n = 1; n <= nSubCount; ++n )
{
sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) rArg.pType->aAttrib[n-1].nAID;
if ( bConvertTwips )
nSubId |= CONVERT_TWIPS;
DBG_ASSERT((rArg.pType->aAttrib[n-1].nAID) <= 127, "Member ID out of range" );
String aName( String::CreateFromAscii( rArg.pName ) ) ;
aName += '.';
aName += String( String::CreateFromAscii( rArg.pType->aAttrib[n-1].pName ) ) ;
pValue[nActProp].Name = aName;
if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
{
ByteString aStr( "Sub item ");
aStr += ByteString::CreateFromInt32( rArg.pType->aAttrib[n-1].nAID );
aStr += " not convertable in slot: ";
aStr += ByteString::CreateFromInt32(rArg.nSlotId);
DBG_ERROR( aStr.GetBuffer() );
}
}
}
}
}
if ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC || nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC ||
nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF )
{
const SfxPoolItem *pItem=0;
if ( rSet.GetItemState( SID_COMPONENTDATA, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sComponentData));
pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_COMPONENTCONTEXT, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sComponentContext));
pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStatusInd));
pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_INTERACTIONHANDLER, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sInteractionHdl));
pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_VIEW_DATA, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sViewData));
pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_FILTER_DATA, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFilterData));
pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_DOCUMENT, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sModel));
pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_CONTENT, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sUCBContent));
pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_INPUTSTREAM, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sInputStream));
pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_STREAM, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStream));
pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_OUTPUTSTREAM, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sOutputStream));
pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_POSTDATA, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sPostData));
pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_FILLFRAME, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFrame));
if ( pItem->ISA( SfxUsrAnyItem ) )
{
OSL_ENSURE( false, "TransformItems: transporting an XFrame via an SfxUsrAnyItem is not deprecated!" );
pValue[nActProp++].Value = static_cast< const SfxUsrAnyItem* >( pItem )->GetValue();
}
else if ( pItem->ISA( SfxUnoFrameItem ) )
pValue[nActProp++].Value <<= static_cast< const SfxUnoFrameItem* >( pItem )->GetFrame();
else
OSL_ENSURE( false, "TransformItems: invalid item type for SID_FILLFRAME!" );
}
if ( rSet.GetItemState( SID_TEMPLATE, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sAsTemplate));
pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_OPEN_NEW_VIEW, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sOpenNewView));
pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_VIEW_ID, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sViewId));
pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_PLUGIN_MODE, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sPluginMode));
pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_DOC_READONLY, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sReadOnly));
pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDdeReconnect));
pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStartPresentation));
pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_SELECTION, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSelectionOnly));
pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_HIDDEN, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sHidden));
pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_MINIMIZED, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMinimized));
pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_SILENT, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSilent));
pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_PREVIEW, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sPreview));
pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_VIEWONLY, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sViewOnly));
pValue[nActProp++].Value <<= (sal_Bool) (( ((SfxBoolItem*)pItem)->GetValue() ));
}
if ( rSet.GetItemState( SID_EDITDOC, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDontEdit));
pValue[nActProp++].Value <<= (sal_Bool) (!( ((SfxBoolItem*)pItem)->GetValue() ));
}
if ( rSet.GetItemState( SID_FILE_DIALOG, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sUseSystemDialog));
pValue[nActProp++].Value <<= (sal_Bool) ( ((SfxBoolItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_STANDARD_DIR, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStandardDir));
pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
}
if ( rSet.GetItemState( SID_BLACK_LIST, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sBlackList));
com::sun::star::uno::Sequence< rtl::OUString > aList;
((SfxStringListItem*)pItem)->GetStringList( aList );
pValue[nActProp++].Value <<= aList ;
}
if ( rSet.GetItemState( SID_TARGETNAME, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFrameName));
pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
}
if ( rSet.GetItemState( SID_DOC_SALVAGE, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSalvagedFile));
pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
}
if ( rSet.GetItemState( SID_PATH, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFolderName));
pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
}
if ( rSet.GetItemState( SID_CONTENTTYPE, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMediaType));
pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
}
if ( rSet.GetItemState( SID_TEMPLATE_NAME, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sTemplateName));
pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
}
if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sTemplateRegionName));
pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
}
if ( rSet.GetItemState( SID_JUMPMARK, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sJumpMark));
pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
}
if ( rSet.GetItemState( SID_CHARSET, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sCharacterSet));
pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
}
if ( rSet.GetItemState( SID_MACROEXECMODE, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMacroExecMode));
pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_UPDATEDOCMODE, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sUpdateDocMode));
pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_REPAIRPACKAGE, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sRepairPackage));
pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_DOCINFO_TITLE, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDocumentTitle));
pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
}
if ( rSet.GetItemState( SID_DOC_BASEURL, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDocumentBaseURL));
pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
}
if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sHierarchicalDocumentName));
pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
}
if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sCopyStreamIfPossible));
pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_NOAUTOSAVE, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sNoAutoSave));
pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sModifyPasswordInfo));
pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_ENCRYPTIONDATA, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sEncryptionData));
pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
}
if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSuggestedSaveAsDir));
pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
}
if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME, sal_False, &pItem ) == SFX_ITEM_SET )
{
pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSuggestedSaveAsName));
pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
}
}
}
rArgs = aSequ;
}
SFX_IMPL_XINTERFACE_5( SfxMacroLoader, OWeakObject, ::com::sun::star::frame::XDispatchProvider, ::com::sun::star::frame::XNotifyingDispatch, ::com::sun::star::frame::XDispatch, ::com::sun::star::frame::XSynchronousDispatch,::com::sun::star::lang::XInitialization )
SFX_IMPL_XTYPEPROVIDER_5( SfxMacroLoader, ::com::sun::star::frame::XDispatchProvider, ::com::sun::star::frame::XNotifyingDispatch, ::com::sun::star::frame::XDispatch, ::com::sun::star::frame::XSynchronousDispatch,::com::sun::star::lang::XInitialization )
SFX_IMPL_XSERVICEINFO( SfxMacroLoader, PROTOCOLHANDLER_SERVICENAME, "com.sun.star.comp.sfx2.SfxMacroLoader" )
SFX_IMPL_SINGLEFACTORY( SfxMacroLoader )
void SAL_CALL SfxMacroLoader::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
Reference < XFrame > xFrame;
if ( aArguments.getLength() )
{
aArguments[0] >>= xFrame;
m_xFrame = xFrame;
}
}
SfxObjectShell* SfxMacroLoader::GetObjectShell_Impl()
{
SfxObjectShell* pDocShell = NULL;
Reference < XFrame > xFrame( m_xFrame.get(), UNO_QUERY );
if ( xFrame.is() )
{
SfxFrame* pFrame=0;
for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) )
{
if ( pFrame->GetFrameInterface() == xFrame )
break;
}
if ( pFrame )
pDocShell = pFrame->GetCurrentDocument();
}
return pDocShell;
}
// -----------------------------------------------------------------------
::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL SfxMacroLoader::queryDispatch(
const ::com::sun::star::util::URL& aURL ,
const ::rtl::OUString& /*sTargetFrameName*/,
sal_Int32 /*nSearchFlags*/ ) throw( ::com::sun::star::uno::RuntimeException )
{
::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatcher;
if(aURL.Complete.compareToAscii("macro:",6)==0)
xDispatcher = this;
return xDispatcher;
}
// -----------------------------------------------------------------------
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > SAL_CALL
SfxMacroLoader::queryDispatches( const ::com::sun::star::uno::Sequence < ::com::sun::star::frame::DispatchDescriptor >& seqDescriptor )
throw( ::com::sun::star::uno::RuntimeException )
{
sal_Int32 nCount = seqDescriptor.getLength();
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > lDispatcher(nCount);
for( sal_Int32 i=0; i<nCount; ++i )
lDispatcher[i] = this->queryDispatch( seqDescriptor[i].FeatureURL,
seqDescriptor[i].FrameName,
seqDescriptor[i].SearchFlags );
return lDispatcher;
}
// -----------------------------------------------------------------------
void SAL_CALL SfxMacroLoader::dispatchWithNotification( const ::com::sun::star::util::URL& aURL ,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs ,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& xListener )
throw (::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
sal_uInt32 nPropertyCount = lArgs.getLength();
::rtl::OUString aReferer;
for( sal_uInt32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
{
if( lArgs[nProperty].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer")) )
{
lArgs[nProperty].Value >>= aReferer;
break;
}
}
::com::sun::star::uno::Any aAny;
ErrCode nErr = loadMacro( aURL.Complete, aAny, GetObjectShell_Impl() );
if( xListener.is() )
{
// always call dispatchFinished(), because we didn't load a document but
// executed a macro instead!
::com::sun::star::frame::DispatchResultEvent aEvent;
aEvent.Source = static_cast< ::cppu::OWeakObject* >(this);
if( nErr == ERRCODE_NONE )
aEvent.State = ::com::sun::star::frame::DispatchResultState::SUCCESS;
else
aEvent.State = ::com::sun::star::frame::DispatchResultState::FAILURE;
xListener->dispatchFinished( aEvent ) ;
}
}
::com::sun::star::uno::Any SAL_CALL SfxMacroLoader::dispatchWithReturnValue(
const ::com::sun::star::util::URL& aURL,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& ) throw (::com::sun::star::uno::RuntimeException)
{
::com::sun::star::uno::Any aRet;
/*ErrCode nErr = */loadMacro( aURL.Complete, aRet, GetObjectShell_Impl() );
return aRet;
}
// -----------------------------------------------------------------------
void SAL_CALL SfxMacroLoader::dispatch( const ::com::sun::star::util::URL& aURL ,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs )
throw (::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
sal_uInt32 nPropertyCount = lArgs.getLength();
::rtl::OUString aReferer;
for( sal_uInt32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
{
if( lArgs[nProperty].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer")) )
{
lArgs[nProperty].Value >>= aReferer;
break;
}
}
::com::sun::star::uno::Any aAny;
/*ErrCode nErr = */loadMacro( aURL.Complete, aAny, GetObjectShell_Impl() );
}
// -----------------------------------------------------------------------
void SAL_CALL SfxMacroLoader::addStatusListener(
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& ,
const ::com::sun::star::util::URL& )
throw (::com::sun::star::uno::RuntimeException)
{
/* TODO
How we can handle different listener for further coming or currently running dispatch() jobs
without any inconsistency!
*/
}
// -----------------------------------------------------------------------
void SAL_CALL SfxMacroLoader::removeStatusListener(
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >&,
const ::com::sun::star::util::URL& )
throw (::com::sun::star::uno::RuntimeException)
{
}
ErrCode SfxMacroLoader::loadMacro( const ::rtl::OUString& rURL, com::sun::star::uno::Any& rRetval, SfxObjectShell* pSh )
throw ( ::com::sun::star::uno::RuntimeException )
{
SfxObjectShell* pCurrent = pSh;
if ( !pCurrent )
// all not full qualified names use the BASIC of the given or current document
pCurrent = SfxObjectShell::Current();
// 'macro:///lib.mod.proc(args)' => macro of App-BASIC
// 'macro://[docname|.]/lib.mod.proc(args)' => macro of current or qualified document
// 'macro://obj.method(args)' => direct API call, execute it via App-BASIC
String aMacro( rURL );
sal_uInt16 nHashPos = aMacro.Search( '/', 8 );
sal_uInt16 nArgsPos = aMacro.Search( '(' );
BasicManager *pAppMgr = SFX_APP()->GetBasicManager();
BasicManager *pBasMgr = 0;
ErrCode nErr = ERRCODE_NONE;
// should a macro function be executed ( no direct API call)?
if ( STRING_NOTFOUND != nHashPos && nHashPos < nArgsPos )
{
// find BasicManager
SfxObjectShell* pDoc = NULL;
String aBasMgrName( INetURLObject::decode(aMacro.Copy( 8, nHashPos-8 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET) );
if ( !aBasMgrName.Len() )
pBasMgr = pAppMgr;
else if ( aBasMgrName.EqualsAscii(".") )
{
// current/actual document
pDoc = pCurrent;
if (pDoc)
pBasMgr = pDoc->GetBasicManager();
}
else
{
// full qualified name, find document by name
for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst();
pObjSh && !pBasMgr;
pObjSh = SfxObjectShell::GetNext(*pObjSh) )
if ( aBasMgrName == pObjSh->GetTitle(SFX_TITLE_APINAME) )
{
pDoc = pObjSh;
pBasMgr = pDoc->GetBasicManager();
}
}
if ( pBasMgr )
{
const bool bIsAppBasic = ( pBasMgr == pAppMgr );
const bool bIsDocBasic = ( pBasMgr != pAppMgr );
if ( pDoc )
{
// security check for macros from document basic if an SFX doc is given
if ( !pDoc->AdjustMacroMode( String() ) )
// check forbids execution
return ERRCODE_IO_ACCESSDENIED;
}
else if ( pDoc && pDoc->GetMedium() )
{
pDoc->AdjustMacroMode( String() );
SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False);
SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pMacroExecModeItem, SfxUInt16Item, SID_MACROEXECMODE, sal_False);
if ( pUpdateDocItem && pMacroExecModeItem
&& pUpdateDocItem->GetValue() == document::UpdateDocMode::NO_UPDATE
&& pMacroExecModeItem->GetValue() == document::MacroExecMode::NEVER_EXECUTE )
return ERRCODE_IO_ACCESSDENIED;
}
// find BASIC method
String aQualifiedMethod( INetURLObject::decode(aMacro.Copy( nHashPos+1 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET) );
String aArgs;
if ( STRING_NOTFOUND != nArgsPos )
{
// remove arguments from macro name
aArgs = aQualifiedMethod.Copy( nArgsPos - nHashPos - 1 );
aQualifiedMethod.Erase( nArgsPos - nHashPos - 1 );
}
if ( pBasMgr->HasMacro( aQualifiedMethod ) )
{
Any aOldThisComponent;
const bool bSetDocMacroMode = ( pDoc != NULL ) && bIsDocBasic;
const bool bSetGlobalThisComponent = ( pDoc != NULL ) && bIsAppBasic;
if ( bSetDocMacroMode )
{
// mark document: it executes an own macro, so it's in a modal mode
pDoc->SetMacroMode_Impl( sal_True );
}
if ( bSetGlobalThisComponent )
{
// document is executed via AppBASIC, adjust ThisComponent variable
aOldThisComponent = pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( pDoc->GetModel() ) );
}
// just to let the shell be alive
SfxObjectShellRef xKeepDocAlive = pDoc;
{
// attempt to protect the document against the script tampering with its Undo Context
::std::auto_ptr< ::framework::DocumentUndoGuard > pUndoGuard;
if ( bIsDocBasic )
pUndoGuard.reset( new ::framework::DocumentUndoGuard( pDoc->GetModel() ) );
// execute the method
SbxVariableRef retValRef = new SbxVariable;
nErr = pBasMgr->ExecuteMacro( aQualifiedMethod, aArgs, retValRef );
if ( nErr == ERRCODE_NONE )
rRetval = sbxToUnoValue( retValRef );
}
if ( bSetGlobalThisComponent )
{
pAppMgr->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent );
}
if ( bSetDocMacroMode )
{
// remove flag for modal mode
pDoc->SetMacroMode_Impl( sal_False );
}
}
else
nErr = ERRCODE_BASIC_PROC_UNDEFINED;
}
else
nErr = ERRCODE_IO_NOTEXISTS;
}
else
{
// direct API call on a specified object
String aCall( '[' );
aCall += String(INetURLObject::decode(aMacro.Copy(6), INET_HEX_ESCAPE,
INetURLObject::DECODE_WITH_CHARSET));
aCall += ']';
pAppMgr->GetLib(0)->Execute( aCall );
nErr = SbxBase::GetError();
}
SbxBase::ResetError();
return nErr;
}
SFX_IMPL_XSERVICEINFO( SfxAppDispatchProvider, "com.sun.star.frame.DispatchProvider", "com.sun.star.comp.sfx2.AppDispatchProvider" ) \
SFX_IMPL_SINGLEFACTORY( SfxAppDispatchProvider );
void SAL_CALL SfxAppDispatchProvider::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
Reference < XFrame > xFrame;
if ( aArguments.getLength() )
{
aArguments[0] >>= xFrame;
m_xFrame = xFrame;
}
}
Reference < XDispatch > SAL_CALL SfxAppDispatchProvider::queryDispatch(
const ::com::sun::star::util::URL& aURL,
const ::rtl::OUString& /*sTargetFrameName*/,
FrameSearchFlags /*eSearchFlags*/ ) throw( RuntimeException )
{
sal_uInt16 nId( 0 );
sal_Bool bMasterCommand( sal_False );
Reference < XDispatch > xDisp;
const SfxSlot* pSlot = 0;
SfxDispatcher* pAppDisp = SFX_APP()->GetAppDispatcher_Impl();
if ( aURL.Protocol.compareToAscii( "slot:" ) == COMPARE_EQUAL ||
aURL.Protocol.compareToAscii( "commandId:" ) == COMPARE_EQUAL )
{
nId = (sal_uInt16) aURL.Path.toInt32();
SfxShell* pShell;
pAppDisp->GetShellAndSlot_Impl( nId, &pShell, &pSlot, sal_True, sal_True );
}
else if ( aURL.Protocol.compareToAscii( ".uno:" ) == COMPARE_EQUAL )
{
// Support ".uno" commands. Map commands to slotid
bMasterCommand = SfxOfficeDispatch::IsMasterUnoCommand( aURL );
if ( bMasterCommand )
pSlot = pAppDisp->GetSlot( SfxOfficeDispatch::GetMasterUnoCommand( aURL ) );
else
pSlot = pAppDisp->GetSlot( aURL.Main );
}
if ( pSlot )
{
SfxOfficeDispatch* pDispatch = new SfxOfficeDispatch( pAppDisp, pSlot, aURL ) ;
pDispatch->SetFrame(m_xFrame);
pDispatch->SetMasterUnoCommand( bMasterCommand );
xDisp = pDispatch;
}
return xDisp;
}
Sequence< Reference < XDispatch > > SAL_CALL SfxAppDispatchProvider::queryDispatches( const Sequence < DispatchDescriptor >& seqDescriptor )
throw( RuntimeException )
{
sal_Int32 nCount = seqDescriptor.getLength();
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > lDispatcher(nCount);
for( sal_Int32 i=0; i<nCount; ++i )
lDispatcher[i] = this->queryDispatch( seqDescriptor[i].FeatureURL,
seqDescriptor[i].FrameName,
seqDescriptor[i].SearchFlags );
return lDispatcher;
}
Sequence< sal_Int16 > SAL_CALL SfxAppDispatchProvider::getSupportedCommandGroups()
throw (::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
std::list< sal_Int16 > aGroupList;
SfxSlotPool* pAppSlotPool = &SFX_APP()->GetAppSlotPool_Impl();
const sal_uIntPtr nMode( SFX_SLOT_TOOLBOXCONFIG|SFX_SLOT_ACCELCONFIG|SFX_SLOT_MENUCONFIG );
// Gruppe anw"ahlen ( Gruppe 0 ist intern )
for ( sal_uInt16 i=0; i<pAppSlotPool->GetGroupCount(); i++ )
{
String aName = pAppSlotPool->SeekGroup( i );
const SfxSlot* pSfxSlot = pAppSlotPool->FirstSlot();
while ( pSfxSlot )
{
if ( pSfxSlot->GetMode() & nMode )
{
sal_Int16 nCommandGroup = MapGroupIDToCommandGroup( pSfxSlot->GetGroupId() );
aGroupList.push_back( nCommandGroup );
break;
}
pSfxSlot = pAppSlotPool->NextSlot();
}
}
::com::sun::star::uno::Sequence< sal_Int16 > aSeq =
comphelper::containerToSequence< sal_Int16, std::list< sal_Int16 > >( aGroupList );
return aSeq;
}
Sequence< ::com::sun::star::frame::DispatchInformation > SAL_CALL SfxAppDispatchProvider::getConfigurableDispatchInformation( sal_Int16 nCmdGroup )
throw (::com::sun::star::uno::RuntimeException)
{
std::list< ::com::sun::star::frame::DispatchInformation > aCmdList;
SolarMutexGuard aGuard;
SfxSlotPool* pAppSlotPool = &SFX_APP()->GetAppSlotPool_Impl();
if ( pAppSlotPool )
{
const sal_uIntPtr nMode( SFX_SLOT_TOOLBOXCONFIG|SFX_SLOT_ACCELCONFIG|SFX_SLOT_MENUCONFIG );
rtl::OUString aCmdPrefix( RTL_CONSTASCII_USTRINGPARAM( ".uno:" ));
// Gruppe anw"ahlen ( Gruppe 0 ist intern )
for ( sal_uInt16 i=0; i<pAppSlotPool->GetGroupCount(); i++ )
{
String aName = pAppSlotPool->SeekGroup( i );
const SfxSlot* pSfxSlot = pAppSlotPool->FirstSlot();
if ( pSfxSlot )
{
sal_Int16 nCommandGroup = MapGroupIDToCommandGroup( pSfxSlot->GetGroupId() );
if ( nCommandGroup == nCmdGroup )
{
while ( pSfxSlot )
{
if ( pSfxSlot->GetMode() & nMode )
{
::com::sun::star::frame::DispatchInformation aCmdInfo;
::rtl::OUStringBuffer aBuf( aCmdPrefix );
aBuf.appendAscii( pSfxSlot->GetUnoName() );
aCmdInfo.Command = aBuf.makeStringAndClear();
aCmdInfo.GroupId = nCommandGroup;
aCmdList.push_back( aCmdInfo );
}
pSfxSlot = pAppSlotPool->NextSlot();
}
}
}
}
}
::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchInformation > aSeq =
comphelper::containerToSequence< ::com::sun::star::frame::DispatchInformation, std::list< ::com::sun::star::frame::DispatchInformation > >( aCmdList );
return aSeq;
}
#ifdef TEST_HANDLERS
#include <cppuhelper/implbase2.hxx>
#include <com/sun/star/awt/XKeyHandler.hdl>
#include <com/sun/star/awt/XMouseClickHandler.hdl>
class TestKeyHandler: public ::cppu::WeakImplHelper2
<
com::sun::star::awt::XKeyHandler,
com::sun::star::lang::XServiceInfo
>
{
public:
TestKeyHandler( const com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& ){}
SFX_DECL_XSERVICEINFO
virtual sal_Bool SAL_CALL keyPressed( const ::com::sun::star::awt::KeyEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL keyReleased( const ::com::sun::star::awt::KeyEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source)
throw (::com::sun::star::uno::RuntimeException);
};
class TestMouseClickHandler: public ::cppu::WeakImplHelper2
<
com::sun::star::awt::XMouseClickHandler,
com::sun::star::lang::XServiceInfo
>
{
public:
TestMouseClickHandler( const com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& ){}
SFX_DECL_XSERVICEINFO
virtual sal_Bool SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source)
throw (::com::sun::star::uno::RuntimeException);
};
sal_Bool SAL_CALL TestKeyHandler::keyPressed( const ::com::sun::star::awt::KeyEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException)
{
return sal_False;
}
sal_Bool SAL_CALL TestKeyHandler::keyReleased( const ::com::sun::star::awt::KeyEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException)
{
return sal_False;
}
void SAL_CALL TestKeyHandler::disposing( const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException)
{
}
sal_Bool SAL_CALL TestMouseClickHandler::mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException)
{
return sal_False;
}
sal_Bool SAL_CALL TestMouseClickHandler::mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException)
{
return sal_False;
}
void SAL_CALL TestMouseClickHandler::disposing( const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException)
{
}
SFX_IMPL_XSERVICEINFO( TestKeyHandler, "com.sun.star.task.Job", "com.sun.star.comp.Office.KeyHandler");
SFX_IMPL_XSERVICEINFO( TestMouseClickHandler, "com.sun.star.task.Job", "com.sun.star.comp.Office.MouseClickHandler");
SFX_IMPL_SINGLEFACTORY( TestKeyHandler );
SFX_IMPL_SINGLEFACTORY( TestMouseClickHandler );
#endif
// -----------------------------------------------------------------------
extern "C" {
SFX2_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment(
const sal_Char** ppEnvironmentTypeName ,
uno_Environment** )
{
*ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
}
// writer compatable document properties
aImpl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
aImpl += comp_CompatWriterDocProps::_getImplementationName();
aTempStr = aImpl;
aTempStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES"));
xNewKey = xKey->createKey( aTempStr );
xNewKey->createKey( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.writer.DocumentProperties")) );
SFX2_DLLPUBLIC void* SAL_CALL component_getFactory(
const sal_Char* pImplementationName ,
void* pServiceManager ,
void* )
{
// Set default return value for this operation - if it failed.
void* pReturn = NULL ;
if (
( pImplementationName != NULL ) &&
( pServiceManager != NULL )
)
{
// Define variables which are used in following macros.
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
xFactory;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager( reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pServiceManager ) ) ;
//=============================================================================
// Add new macro line to handle new service.
//
// !!! ATTENTION !!!
// Write no ";" at end of line and dont forget "else" ! (see macro)
//=============================================================================
IF_NAME_CREATECOMPONENTFACTORY( SfxGlobalEvents_Impl )
IF_NAME_CREATECOMPONENTFACTORY( SfxFrameLoader_Impl )
IF_NAME_CREATECOMPONENTFACTORY( SfxMacroLoader )
IF_NAME_CREATECOMPONENTFACTORY( SfxStandaloneDocumentInfoObject )
IF_NAME_CREATECOMPONENTFACTORY( SfxAppDispatchProvider )
IF_NAME_CREATECOMPONENTFACTORY( SfxDocTplService )
IF_NAME_CREATECOMPONENTFACTORY( ShutdownIcon )
IF_NAME_CREATECOMPONENTFACTORY( SfxApplicationScriptLibraryContainer )
IF_NAME_CREATECOMPONENTFACTORY( SfxApplicationDialogLibraryContainer )
#ifdef TEST_HANDLERS
IF_NAME_CREATECOMPONENTFACTORY( TestKeyHandler )
IF_NAME_CREATECOMPONENTFACTORY( TestMouseClickHandler )
#endif
IF_NAME_CREATECOMPONENTFACTORY( OPackageStructureCreator )
IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::PluginObject )
IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::IFrameObject )
IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::OwnSubFilterService )
if ( ::comp_SfxDocumentMetaData::_getImplementationName().equals(
::rtl::OUString::createFromAscii( pImplementationName ) ) )
{
xFactory = ::cppu::createSingleComponentFactory(
::comp_SfxDocumentMetaData::_create,
::comp_SfxDocumentMetaData::_getImplementationName(),
::comp_SfxDocumentMetaData::_getSupportedServiceNames());
}
if ( ::comp_CompatWriterDocProps::_getImplementationName().equals(
::rtl::OUString::createFromAscii( pImplementationName ) ) )
{
xFactory = ::cppu::createSingleComponentFactory(
::comp_CompatWriterDocProps::_create,
::comp_CompatWriterDocProps::_getImplementationName(),
::comp_CompatWriterDocProps::_getSupportedServiceNames());
}
// Factory is valid - service was found.
// Factory is valid - service was found.
if ( xFactory.is() )
{
xFactory->acquire();
pReturn = xFactory.get();
}
}
// Return with result of this operation.
return pReturn ;
}
} // extern "C"
//=========================================================================
void SAL_CALL FilterOptionsContinuation::setFilterOptions(
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rProps )
throw (::com::sun::star::uno::RuntimeException)
{
rProperties = rProps;
}
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL
FilterOptionsContinuation::getFilterOptions()
throw (::com::sun::star::uno::RuntimeException)
{
return rProperties;
}
//=========================================================================
RequestFilterOptions::RequestFilterOptions( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > rModel,
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > rProperties )
{
::rtl::OUString temp;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2;
::com::sun::star::document::FilterOptionsRequest aOptionsRequest( temp,
temp2,
rModel,
rProperties );
m_aRequest <<= aOptionsRequest;
m_pAbort = new comphelper::OInteractionAbort;
m_pOptions = new FilterOptionsContinuation;
m_lContinuations.realloc( 2 );
m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort );
m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pOptions );
}
::com::sun::star::uno::Any SAL_CALL RequestFilterOptions::getRequest()
throw( ::com::sun::star::uno::RuntimeException )
{
return m_aRequest;
}
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >
SAL_CALL RequestFilterOptions::getContinuations()
throw( ::com::sun::star::uno::RuntimeException )
{
return m_lContinuations;
}
//=========================================================================
class RequestPackageReparation_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest >
{
::com::sun::star::uno::Any m_aRequest;
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > m_lContinuations;
comphelper::OInteractionApprove* m_pApprove;
comphelper::OInteractionDisapprove* m_pDisapprove;
public:
RequestPackageReparation_Impl( ::rtl::OUString aName );
sal_Bool isApproved();
virtual ::com::sun::star::uno::Any SAL_CALL getRequest() throw( ::com::sun::star::uno::RuntimeException );
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations()
throw( ::com::sun::star::uno::RuntimeException );
};
RequestPackageReparation_Impl::RequestPackageReparation_Impl( ::rtl::OUString aName )
{
::rtl::OUString temp;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2;
::com::sun::star::document::BrokenPackageRequest aBrokenPackageRequest( temp,
temp2,
aName );
m_aRequest <<= aBrokenPackageRequest;
m_pApprove = new comphelper::OInteractionApprove;
m_pDisapprove = new comphelper::OInteractionDisapprove;
m_lContinuations.realloc( 2 );
m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pApprove );
m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pDisapprove );
}
sal_Bool RequestPackageReparation_Impl::isApproved()
{
return m_pApprove->wasSelected();
}
::com::sun::star::uno::Any SAL_CALL RequestPackageReparation_Impl::getRequest()
throw( ::com::sun::star::uno::RuntimeException )
{
return m_aRequest;
}
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >
SAL_CALL RequestPackageReparation_Impl::getContinuations()
throw( ::com::sun::star::uno::RuntimeException )
{
return m_lContinuations;
}
RequestPackageReparation::RequestPackageReparation( ::rtl::OUString aName )
{
pImp = new RequestPackageReparation_Impl( aName );
pImp->acquire();
}
RequestPackageReparation::~RequestPackageReparation()
{
pImp->release();
}
sal_Bool RequestPackageReparation::isApproved()
{
return pImp->isApproved();
}
com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > RequestPackageReparation::GetRequest()
{
return com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest >(pImp);
}
//=========================================================================
class NotifyBrokenPackage_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest >
{
::com::sun::star::uno::Any m_aRequest;
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > m_lContinuations;
comphelper::OInteractionAbort* m_pAbort;
public:
NotifyBrokenPackage_Impl( ::rtl::OUString aName );
sal_Bool isAborted();
virtual ::com::sun::star::uno::Any SAL_CALL getRequest() throw( ::com::sun::star::uno::RuntimeException );
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations()
throw( ::com::sun::star::uno::RuntimeException );
};
NotifyBrokenPackage_Impl::NotifyBrokenPackage_Impl( ::rtl::OUString aName )
{
::rtl::OUString temp;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2;
::com::sun::star::document::BrokenPackageRequest aBrokenPackageRequest( temp,
temp2,
aName );
m_aRequest <<= aBrokenPackageRequest;
m_pAbort = new comphelper::OInteractionAbort;
m_lContinuations.realloc( 1 );
m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort );
}
sal_Bool NotifyBrokenPackage_Impl::isAborted()
{
return m_pAbort->wasSelected();
}
::com::sun::star::uno::Any SAL_CALL NotifyBrokenPackage_Impl::getRequest()
throw( ::com::sun::star::uno::RuntimeException )
{
return m_aRequest;
}
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >
SAL_CALL NotifyBrokenPackage_Impl::getContinuations()
throw( ::com::sun::star::uno::RuntimeException )
{
return m_lContinuations;
}
NotifyBrokenPackage::NotifyBrokenPackage( ::rtl::OUString aName )
{
pImp = new NotifyBrokenPackage_Impl( aName );
pImp->acquire();
}
NotifyBrokenPackage::~NotifyBrokenPackage()
{
pImp->release();
}
sal_Bool NotifyBrokenPackage::isAborted()
{
return pImp->isAborted();
}
com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > NotifyBrokenPackage::GetRequest()
{
return com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest >(pImp);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|