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
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <fltoptint.hxx>
#include <sfx2/brokenpackageint.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/frame.hxx>
#include <sfx2/msg.hxx>
#include <sfx2/msgpool.hxx>
#include <sfx2/sfxsids.hrc>
#include <sfx2/sfxuno.hxx>
#include <sfxslots.hxx>
#include <sal/config.h>
#include <sal/log.hxx>
#include <comphelper/interaction.hxx>
#include <osl/diagnose.h>
#include <svl/eitem.hxx>
#include <svl/intitem.hxx>
#include <svl/itempool.hxx>
#include <svl/slstitm.hxx>
#include <svl/stritem.hxx>
#include <tools/debug.hxx>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/document/BrokenPackageRequest.hpp>
#include <com/sun/star/document/FilterOptionsRequest.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/ucb/XContent.hpp>
#include <memory>
using namespace ::com::sun::star;
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::io;
// needs to be converted to a better data structure
SfxFormalArgument const aFormalArgs[] = {
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "SuggestedSaveAsName", SID_DEFAULTFILENAME },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "SuggestedSaveAsDir", SID_DEFAULTFILEPATH },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "VersionAuthor", SID_DOCINFO_AUTHOR },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "VersionComment", SID_DOCINFO_COMMENTS },
{ reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "DontTerminateEdit", FN_PARAM_1 },
{ reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "VersionMajor", SID_DOCINFO_MAJOR },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "FilterOptions", SID_FILE_FILTEROPTIONS },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "FilterName", SID_FILTER_NAME },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Margin1", SID_RULER_MARGIN1 },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Margin2", SID_RULER_MARGIN2 },
// { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "FileName", SID_FILE_NAME },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "URL", SID_FILE_NAME },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "OpenFlags", SID_OPTIONS },
{ reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "Overwrite", SID_OVERWRITE },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Password", SID_PASSWORD },
{ reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "PasswordInteraction", SID_PASSWORDINTERACTION },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Referer", SID_REFERER },
{ reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "SaveTo", SID_SAVETO },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "TemplateName", SID_TEMPLATE_NAME },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "TemplateRegion", SID_TEMPLATE_REGIONNAME },
// { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Region", SID_TEMPLATE_REGIONNAME },
// { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Name", SID_TEMPLATE_NAME },
{ reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "Unpacked", SID_UNPACK },
{ reinterpret_cast<SfxType*>(&aSfxInt16Item_Impl), "Version", SID_VERSION },
{ reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "SaveACopy", SID_SAVEACOPYITEM },
{ reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "NoFileSync", SID_NO_FILE_SYNC },
{ reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "NoThumbnail", SID_NO_THUMBNAIL },
{ reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "NoEmbDataSet", SID_NO_EMBEDDED_DS },
{ reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "IsRedactMode", SID_IS_REDACT_MODE },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "RedactionStyle", SID_REDACTION_STYLE },
{ reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "AdditionsTag", FN_PARAM_ADDITIONS_TAG },
};
sal_uInt16 const nMediaArgsCount = SAL_N_ELEMENTS(aFormalArgs);
constexpr OUStringLiteral sTemplateRegionName = u"TemplateRegionName";
constexpr OUStringLiteral sTemplateName = u"TemplateName";
constexpr OUStringLiteral sAsTemplate = u"AsTemplate";
constexpr OUStringLiteral sOpenNewView = u"OpenNewView";
constexpr OUStringLiteral sViewId = u"ViewId";
constexpr OUStringLiteral sPluginMode = u"PluginMode";
constexpr OUStringLiteral sReadOnly = u"ReadOnly";
constexpr OUStringLiteral sDdeReconnect = u"DDEReconnect";
constexpr OUStringLiteral sStartPresentation = u"StartPresentation";
constexpr OUStringLiteral sFrameName = u"FrameName";
constexpr OUStringLiteral sMediaType = u"MediaType";
constexpr OUStringLiteral sPostData = u"PostData";
constexpr OUStringLiteral sCharacterSet = u"CharacterSet";
constexpr OUStringLiteral sInputStream = u"InputStream";
constexpr OUStringLiteral sStream = u"Stream";
constexpr OUStringLiteral sOutputStream = u"OutputStream";
constexpr OUStringLiteral sHidden = u"Hidden";
constexpr OUStringLiteral sPreview = u"Preview";
constexpr OUStringLiteral sViewOnly = u"ViewOnly";
constexpr OUStringLiteral sDontEdit = u"DontEdit";
constexpr OUStringLiteral sSilent = u"Silent";
constexpr OUStringLiteral sJumpMark = u"JumpMark";
constexpr OUStringLiteral sSalvagedFile = u"SalvagedFile";
constexpr OUStringLiteral sStatusInd = u"StatusIndicator";
constexpr OUStringLiteral sModel = u"Model";
constexpr OUStringLiteral sFrame = u"Frame";
constexpr OUStringLiteral sViewData = u"ViewData";
constexpr OUStringLiteral sFilterData = u"FilterData";
constexpr OUStringLiteral sSelectionOnly = u"SelectionOnly";
constexpr OUStringLiteral sMacroExecMode = u"MacroExecutionMode";
constexpr OUStringLiteral sUpdateDocMode = u"UpdateDocMode";
constexpr OUStringLiteral sMinimized = u"Minimized";
constexpr OUStringLiteral sInteractionHdl = u"InteractionHandler";
constexpr OUStringLiteral sUCBContent = u"UCBContent";
constexpr OUStringLiteral sRepairPackage = u"RepairPackage";
constexpr OUStringLiteral sDocumentTitle = u"DocumentTitle";
constexpr OUStringLiteral sComponentData = u"ComponentData";
constexpr OUStringLiteral sComponentContext = u"ComponentContext";
constexpr OUStringLiteral sDocumentBaseURL = u"DocumentBaseURL";
constexpr OUStringLiteral sHierarchicalDocumentName = u"HierarchicalDocumentName";
constexpr OUStringLiteral sCopyStreamIfPossible = u"CopyStreamIfPossible";
constexpr OUStringLiteral sNoAutoSave = u"NoAutoSave";
constexpr OUStringLiteral sFolderName = u"FolderName";
constexpr OUStringLiteral sUseSystemDialog = u"UseSystemDialog";
constexpr OUStringLiteral sStandardDir = u"StandardDir";
constexpr OUStringLiteral sDenyList = u"DenyList";
constexpr OUStringLiteral sModifyPasswordInfo = u"ModifyPasswordInfo";
constexpr OUStringLiteral sSuggestedSaveAsDir = u"SuggestedSaveAsDir";
constexpr OUStringLiteral sSuggestedSaveAsName = u"SuggestedSaveAsName";
constexpr OUStringLiteral sEncryptionData = u"EncryptionData";
constexpr OUStringLiteral sFailOnWarning = u"FailOnWarning";
constexpr OUStringLiteral sDocumentService = u"DocumentService";
constexpr OUStringLiteral sFilterProvider = u"FilterProvider";
constexpr OUStringLiteral sImageFilter = u"ImageFilter";
constexpr OUStringLiteral sLockContentExtraction = u"LockContentExtraction";
constexpr OUStringLiteral sLockExport = u"LockExport";
constexpr OUStringLiteral sLockPrint = u"LockPrint";
constexpr OUStringLiteral sLockSave = u"LockSave";
constexpr OUStringLiteral sLockEditDoc = u"LockEditDoc";
constexpr OUStringLiteral sReplaceable = u"Replaceable";
static bool isMediaDescriptor( sal_uInt16 nSlotId )
{
return ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC ||
nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC ||
nSlotId == SID_SAVETO || nSlotId == SID_SAVEACOPY ||
nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF ||
nSlotId == SID_EXPORTDOCASEPUB || nSlotId == SID_DIRECTEXPORTDOCASEPUB ||
nSlotId == SID_REDACTDOC || nSlotId == SID_AUTOREDACTDOC ||
nSlotId == SID_SAVEACOPYITEM);
}
void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<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;
const sal_Int32 nCount = rArgs.getLength();
if ( !nCount )
return;
const beans::PropertyValue* pPropsVal = rArgs.getConstArray();
if ( !pSlot->IsMode(SfxSlotMode::METHOD) )
{
// slot is a property
const SfxType* pType = pSlot->GetType();
std::unique_ptr<SfxPoolItem> pItem(pType->CreateItem());
if ( !pItem )
{
SAL_WARN( "sfx", "No creator method for item: " << nSlotId );
return;
}
sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MapUnit::MapTwip );
pItem->SetWhich( nWhich );
sal_uInt16 nSubCount = pType->nAttribs;
const beans::PropertyValue& rProp = pPropsVal[0];
const OUString& rName = rProp.Name;
if ( nCount == 1 && rName == OUString( pSlot->pUnoName, strlen( pSlot->pUnoName ), RTL_TEXTENCODING_UTF8 ) )
{
// 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( std::move(pItem) );
else
{
SAL_WARN( "sfx", "Property not convertible: " << pSlot->pUnoName );
}
}
#ifdef DBG_UTIL
else if ( nSubCount == 0 )
{
// for a simple property there can be only one parameter and its name *must* match
SAL_WARN("sfx.appl", "Property name does not match: " << rName);
}
#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 )
{
SAL_INFO("sfx.appl", "MacroPlayer: wrong number of parameters for slot: " << nSlotId );
}
#endif
// complex property; collect sub items from the parameter set and reconstruct complex item
sal_uInt16 nFound=0;
for ( const beans::PropertyValue& rPropValue : rArgs )
{
sal_uInt16 nSub;
for ( nSub=0; nSub<nSubCount; nSub++ )
{
// search sub item by name
OString aStr = OString::Concat(pSlot->pUnoName) + "." + pType->aAttrib[nSub].pName;
if ( rPropValue.Name.equalsAsciiL(aStr.getStr(), aStr.getLength()) )
{
sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->aAttrib[nSub].nAID));
if ( bConvertTwips )
nSubId |= CONVERT_TWIPS;
if ( pItem->PutValue( rPropValue.Value, nSubId ) )
nFound++;
else
{
SAL_WARN( "sfx.appl", "Property not convertible: " << pSlot->pUnoName);
}
break;
}
}
// there was a parameter with a name that didn't match to any of the members
SAL_WARN_IF( nSub >= nSubCount, "sfx.appl", "Property name does not match: " << rPropValue.Name );
}
// at least one part of the complex item must be present; other parts can have default values
if ( nFound > 0 )
rSet.Put( std::move(pItem) );
}
return;
}
#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
bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
sal_uInt16 nMaxArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->nArgDefCount;
for ( sal_uInt16 nArgs=0; nArgs<nMaxArgs; nArgs++ )
{
const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArgs] : pSlot->GetFormalArgument( nArgs );
std::unique_ptr<SfxPoolItem> pItem(rArg.CreateItem());
if ( !pItem )
{
SAL_WARN( "sfx", "No creator method for argument: " << rArg.pName );
return;
}
sal_uInt16 nWhich = rSet.GetPool()->GetWhich(rArg.nSlotId);
bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MapUnit::MapTwip );
pItem->SetWhich( nWhich );
const SfxType* pType = rArg.pType;
sal_uInt16 nSubCount = pType->nAttribs;
if ( nSubCount == 0 )
{
// "simple" (base type) argument
auto pProp = std::find_if(rArgs.begin(), rArgs.end(),
[&rArg](const beans::PropertyValue& rProp) { return rProp.Name.equalsAscii(rArg.pName); });
if (pProp != rArgs.end())
{
#ifdef DBG_UTIL
++nFoundArgs;
#endif
if( pItem->PutValue( pProp->Value, 0 ) )
// only use successfully converted items
rSet.Put( std::move(pItem) );
else
{
SAL_WARN( "sfx", "Property not convertible: " << rArg.pName );
}
}
}
else
{
// complex argument, could be passed in one struct
bool bAsWholeItem = false;
for ( const beans::PropertyValue& rProp : rArgs )
{
const OUString& rName = rProp.Name;
if ( rName == OUString(rArg.pName, strlen(rArg.pName), RTL_TEXTENCODING_UTF8) )
{
bAsWholeItem = true;
#ifdef DBG_UTIL
++nFoundArgs;
#endif
if( pItem->PutValue( rProp.Value, 0 ) )
// only use successfully converted items
rSet.Put( std::move(pItem) );
else
{
SAL_WARN( "sfx", "Property not convertible: " << rArg.pName );
}
}
}
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?)
bool bRet = false;
for ( const beans::PropertyValue& rProp : rArgs )
{
for ( sal_uInt16 nSub=0; nSub<nSubCount; nSub++ )
{
// search sub item by name
OString aStr = OString::Concat(rArg.pName) + "." + pType->aAttrib[nSub].pName;
if ( rProp.Name.equalsAsciiL(aStr.getStr(), aStr.getLength()) )
{
// at least one member found ...
bRet = true;
#ifdef DBG_UTIL
++nFoundArgs;
#endif
sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->aAttrib[nSub].nAID));
if ( bConvertTwips )
nSubId |= CONVERT_TWIPS;
if (!pItem->PutValue( rProp.Value, nSubId ) )
{
// ... but it was not convertible
bRet = false;
SAL_WARN( "sfx", "Property not convertible: " << rArg.pName );
}
break;
}
}
}
if ( bRet )
// only use successfully converted items
rSet.Put( std::move(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 ( const beans::PropertyValue& rProp : rArgs )
{
const OUString& rName = rProp.Name;
if ( rName == sFrame )
{
Reference< XFrame > xFrame;
OSL_VERIFY( rProp.Value >>= xFrame );
rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
}
else
if ( rName == sHidden )
{
bool bVal = false;
if (rProp.Value >>= bVal)
rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
}
}
}
else if ( bIsMediaDescriptor )
{
for ( const beans::PropertyValue& rProp : rArgs )
{
#ifdef DBG_UTIL
++nFoundArgs;
#endif
const OUString& aName = rProp.Name;
if ( aName == sModel )
rSet.Put( SfxUnoAnyItem( SID_DOCUMENT, rProp.Value ) );
else if ( aName == sComponentData )
{
rSet.Put( SfxUnoAnyItem( SID_COMPONENTDATA, rProp.Value ) );
}
else if ( aName == sComponentContext )
{
rSet.Put( SfxUnoAnyItem( SID_COMPONENTCONTEXT, rProp.Value ) );
}
else if ( aName == sStatusInd )
{
Reference<task::XStatusIndicator> xVal;
bool bOK = (rProp.Value >>= xVal);
DBG_ASSERT( bOK, "invalid type for StatusIndicator" );
if (bOK && xVal.is())
rSet.Put( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, rProp.Value ) );
}
else if ( aName == sInteractionHdl )
{
Reference<task::XInteractionHandler> xVal;
bool bOK = (rProp.Value >>= xVal);
DBG_ASSERT( bOK, "invalid type for InteractionHandler" );
if (bOK && xVal.is())
rSet.Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, rProp.Value ) );
}
else if ( aName == sViewData )
rSet.Put( SfxUnoAnyItem( SID_VIEW_DATA, rProp.Value ) );
else if ( aName == sFilterData )
rSet.Put( SfxUnoAnyItem( SID_FILTER_DATA, rProp.Value ) );
else if ( aName == sInputStream )
{
Reference< XInputStream > xVal;
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 == sStream )
{
Reference< XInputStream > xVal;
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 == sUCBContent )
{
Reference< XContent > xVal;
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 == sOutputStream )
{
Reference< XOutputStream > xVal;
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 == sPostData )
{
Reference< XInputStream > xVal;
bool bOK = (rProp.Value >>= xVal);
DBG_ASSERT( bOK, "invalid type for PostData" );
if (bOK)
rSet.Put( SfxUnoAnyItem( SID_POSTDATA, rProp.Value ) );
}
else if ( aName == sFrame )
{
Reference< XFrame > xFrame;
bool bOK = (rProp.Value >>= xFrame);
DBG_ASSERT( bOK, "invalid type for Frame" );
if (bOK)
rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
}
else if ( aName == sAsTemplate )
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for AsTemplate" );
if (bOK)
rSet.Put( SfxBoolItem( SID_TEMPLATE, bVal ) );
}
else if ( aName == sOpenNewView )
{
bool bVal = false;
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 == sFailOnWarning )
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for FailOnWarning" );
if (bOK)
rSet.Put( SfxBoolItem( SID_FAIL_ON_WARNING, bVal ) );
}
else if ( aName == sViewId )
{
sal_Int16 nVal = -1;
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 == sPluginMode )
{
sal_Int16 nVal = -1;
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 == sReadOnly )
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for ReadOnly" );
if (bOK)
rSet.Put( SfxBoolItem( SID_DOC_READONLY, bVal ) );
}
else if ( aName == sDdeReconnect )
{
bool bVal = true;
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 == sStartPresentation )
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for StartPresentation" );
if (bOK)
rSet.Put( SfxBoolItem( SID_DOC_STARTPRESENTATION, bVal ) );
}
else if ( aName == sSelectionOnly )
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for SelectionOnly" );
if (bOK)
rSet.Put( SfxBoolItem( SID_SELECTION, bVal ) );
}
else if ( aName == sHidden )
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for Hidden" );
if (bOK)
rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
}
else if ( aName == sMinimized )
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for Minimized" );
if (bOK)
rSet.Put( SfxBoolItem( SID_MINIMIZED, bVal ) );
}
else if ( aName == sSilent )
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for Silent" );
if (bOK)
rSet.Put( SfxBoolItem( SID_SILENT, bVal ) );
}
else if ( aName == sPreview )
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for Preview" );
if (bOK)
rSet.Put( SfxBoolItem( SID_PREVIEW, bVal ) );
}
else if ( aName == sViewOnly )
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for ViewOnly" );
if (bOK)
rSet.Put( SfxBoolItem( SID_VIEWONLY, bVal ) );
}
else if ( aName == sDontEdit )
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for ViewOnly" );
if (bOK)
rSet.Put( SfxBoolItem( SID_EDITDOC, !bVal ) );
}
else if ( aName == sUseSystemDialog )
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for ViewOnly" );
if (bOK)
rSet.Put( SfxBoolItem( SID_FILE_DIALOG, bVal ) );
}
else if ( aName == sStandardDir )
{
OUString sVal;
bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for StandardDir" );
if (bOK)
rSet.Put( SfxStringItem( SID_STANDARD_DIR, sVal ) );
}
else if ( aName == sDenyList )
{
uno::Sequence<OUString> xVal;
bool bOK = (rProp.Value >>= xVal);
DBG_ASSERT( bOK, "invalid type or value for DenyList" );
if (bOK)
{
SfxStringListItem stringList(SID_DENY_LIST);
stringList.SetStringList( xVal );
rSet.Put( stringList );
}
}
else if ( aName == "FileName" )
{
OUString sVal;
bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for FileName" );
if (bOK)
rSet.Put( SfxStringItem( SID_FILE_NAME, sVal ) );
}
else if ( aName == sSalvagedFile )
{
OUString sVal;
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 == sFolderName )
{
OUString sVal;
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 == sFrameName )
{
OUString sVal;
bool bOK = (rProp.Value >>= sVal);
DBG_ASSERT( bOK, "invalid type for FrameName" );
if (bOK && !sVal.isEmpty())
rSet.Put( SfxStringItem( SID_TARGETNAME, sVal ) );
}
else if ( aName == sMediaType )
{
OUString sVal;
bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for MediaType" );
if (bOK)
rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) );
}
else if ( aName == sTemplateName )
{
OUString sVal;
bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for TemplateName" );
if (bOK)
rSet.Put( SfxStringItem( SID_TEMPLATE_NAME, sVal ) );
}
else if ( aName == sTemplateRegionName )
{
OUString sVal;
bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for TemplateRegionName" );
if (bOK)
rSet.Put( SfxStringItem( SID_TEMPLATE_REGIONNAME, sVal ) );
}
else if ( aName == sJumpMark )
{
OUString sVal;
bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for JumpMark" );
if (bOK)
rSet.Put( SfxStringItem( SID_JUMPMARK, sVal ) );
}
else if ( aName == sCharacterSet )
{
OUString sVal;
bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for CharacterSet" );
if (bOK)
rSet.Put( SfxStringItem( SID_CHARSET, sVal ) );
}
else if ( aName == "FilterFlags" )
{
OUString sVal;
bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for FilterFlags" );
if (bOK)
rSet.Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sVal ) );
}
else if ( aName == sImageFilter )
{
OUString sVal;
bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for FilterFlags" );
if (bOK)
rSet.Put( SfxStringItem( SID_CONVERT_IMAGES, sVal ) );
}
else if ( aName == sMacroExecMode )
{
sal_Int16 nVal =-1;
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 == sUpdateDocMode )
{
sal_Int16 nVal =-1;
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 == sRepairPackage )
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for RepairPackage" );
if (bOK)
rSet.Put( SfxBoolItem( SID_REPAIRPACKAGE, bVal ) );
}
else if ( aName == sDocumentTitle )
{
OUString sVal;
bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for DocumentTitle" );
if (bOK)
rSet.Put( SfxStringItem( SID_DOCINFO_TITLE, sVal ) );
}
else if ( aName == sDocumentBaseURL )
{
OUString sVal;
// the base url can be set to empty ( for embedded objects for example )
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 == sHierarchicalDocumentName )
{
OUString sVal;
bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for HierarchicalDocumentName" );
if (bOK)
rSet.Put( SfxStringItem( SID_DOC_HIERARCHICALNAME, sVal ) );
}
else if ( aName == sCopyStreamIfPossible )
{
bool bVal = false;
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 == sNoAutoSave )
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for NoAutoSave" );
if (bOK)
rSet.Put( SfxBoolItem( SID_NOAUTOSAVE, bVal ) );
}
else if ( aName == sModifyPasswordInfo )
{
rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) );
}
else if ( aName == sEncryptionData )
{
rSet.Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, rProp.Value ) );
}
else if ( aName == sSuggestedSaveAsDir )
{
OUString sVal;
bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsDir" );
if (bOK)
rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASDIR, sVal ) );
}
else if ( aName == sSuggestedSaveAsName )
{
OUString sVal;
bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsName" );
if (bOK)
rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASNAME, sVal ) );
}
else if (aName == sDocumentService)
{
OUString aVal;
bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty());
if (bOK)
rSet.Put(SfxStringItem(SID_DOC_SERVICE, aVal));
}
else if (aName == sFilterProvider)
{
OUString aVal;
bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty());
if (bOK)
rSet.Put(SfxStringItem(SID_FILTER_PROVIDER, aVal));
}
else if (aName == sLockContentExtraction)
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for LockContentExtraction" );
if (bOK)
rSet.Put( SfxBoolItem( SID_LOCK_CONTENT_EXTRACTION, bVal ) );
}
else if (aName == sLockExport)
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for LockExport" );
if (bOK)
rSet.Put( SfxBoolItem( SID_LOCK_EXPORT, bVal ) );
}
else if (aName == sLockPrint)
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for LockPrint" );
if (bOK)
rSet.Put( SfxBoolItem( SID_LOCK_PRINT, bVal ) );
}
else if (aName == sLockSave)
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for LockSave" );
if (bOK)
rSet.Put( SfxBoolItem( SID_LOCK_SAVE, bVal ) );
}
else if (aName == sLockEditDoc)
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for LockEditDoc" );
if (bOK)
rSet.Put( SfxBoolItem( SID_LOCK_EDITDOC, bVal ) );
}
else if (aName == sReplaceable)
{
bool bVal = false;
bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT(bOK, "invalid type for Replaceable");
if (bOK)
rSet.Put(SfxBoolItem(SID_REPLACEABLE, bVal));
}
#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"
if ( "OptionsTreeDialog" == OUString( pSlot->pUnoName, strlen(pSlot->pUnoName), RTL_TEXTENCODING_UTF8 ) )
{
auto pProp = std::find_if(rArgs.begin(), rArgs.end(),
[](const PropertyValue& rProp) { return rProp.Name == "OptionsPageURL"; });
if (pProp != rArgs.end())
{
OUString sURL;
if ( pProp->Value >>= sURL )
rSet.Put( SfxStringItem( SID_OPTIONS_PAGEURL, sURL ) );
}
}
}
#ifdef DBG_UTIL
if ( nFoundArgs == nCount )
{
// except for the "special" slots: assure that every argument was convertible
SAL_INFO( "sfx.appl", "MacroPlayer: Some properties didn't match to any formal argument for slot: "<< pSlot->pUnoName );
}
#endif
}
void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<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_SAVEASREMOTE )
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(SfxSlotMode::METHOD) )
{
// slot is a property
sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
if ( rSet.GetItemState( nWhich ) == SfxItemState::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++;
}
else
{
// we will not rely on the "toggle" ability of some property slots
SAL_WARN( "sfx", "Processing property slot without argument: " << nSlotId );
}
#ifdef DBG_UTIL
nItems++;
#endif
}
else
{
// slot is a method
bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
sal_uInt16 nFormalArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->GetFormalArgumentCount();
for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
{
// check every formal argument of the method
const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArg] : pSlot->GetFormalArgument( nArg );
sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
if ( rSet.GetItemState( nWhich ) == SfxItemState::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 ( bIsMediaDescriptor )
{
sal_Int32 nAdditional=0;
if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_INTERACTIONHANDLER ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_DOC_SALVAGE ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_PATH ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_FILE_DIALOG ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_STANDARD_DIR ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_DENY_LIST ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_CONTENT ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_INPUTSTREAM ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_STREAM ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_OUTPUTSTREAM ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_TEMPLATE ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_OPEN_NEW_VIEW ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_FAIL_ON_WARNING ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_VIEW_ID ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_VIEW_DATA ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_FILTER_DATA ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_PLUGIN_MODE ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_DOC_READONLY ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_SELECTION ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_CONTENTTYPE ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_POSTDATA ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_FILLFRAME ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_CHARSET ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_TARGETNAME ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_TEMPLATE_NAME ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_HIDDEN ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_MINIMIZED ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_PREVIEW ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_VIEWONLY ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_EDITDOC ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_SILENT ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_JUMPMARK ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_DOCUMENT ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_MACROEXECMODE ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_UPDATEDOCMODE ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_REPAIRPACKAGE ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_DOCINFO_TITLE ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_COMPONENTDATA ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_COMPONENTCONTEXT ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_DOC_BASEURL ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_NOAUTOSAVE ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_ENCRYPTIONDATA ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_DOC_SERVICE ) == SfxItemState::SET )
nAdditional++;
if (rSet.HasItem(SID_FILTER_PROVIDER))
++nAdditional;
if ( rSet.GetItemState( SID_CONVERT_IMAGES ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_LOCK_CONTENT_EXTRACTION ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_LOCK_EXPORT ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_LOCK_PRINT ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_LOCK_SAVE ) == SfxItemState::SET )
nAdditional++;
if ( rSet.GetItemState( SID_LOCK_EDITDOC ) == SfxItemState::SET )
nAdditional++;
if (rSet.GetItemState(SID_REPLACEABLE) == SfxItemState::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 convertible using the list of formal arguments
// or the table of additional items?!
if ( rSet.Count() != nItems )
{
// detect unknown item and present error message
for ( auto const & rPair : rSet.GetRanges() )
{
sal_uInt16 nStartWhich = rPair.first;
sal_uInt16 nEndWhich = rPair.second;
for(sal_uInt16 nId = nStartWhich; nId <= nEndWhich; ++nId)
{
if ( rSet.GetItemState(nId) < SfxItemState::SET ) //???
// not really set
continue;
if ( !pSlot->IsMode(SfxSlotMode::METHOD) && nId == rSet.GetPool()->GetWhich( pSlot->GetSlotId() ) )
continue;
bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
sal_uInt16 nFormalArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->nArgDefCount;
sal_uInt16 nArg;
for ( nArg=0; nArg<nFormalArgs; ++nArg )
{
const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArg] : pSlot->GetFormalArgument( nArg );
sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
if ( nId == nWhich )
break;
}
if ( nArg<nFormalArgs )
continue;
if ( bIsMediaDescriptor )
{
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_DENY_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;
if ( nId == SID_DOC_SERVICE )
continue;
if (nId == SID_FILTER_PROVIDER)
continue;
if ( nId == SID_CONVERT_IMAGES )
continue;
// used only internally
if ( nId == SID_SAVETO )
continue;
if ( nId == SID_SAVEACOPYITEM )
continue;
if ( nId == SID_MODIFYPASSWORDINFO )
continue;
if ( nId == SID_SUGGESTEDSAVEASDIR )
continue;
if ( nId == SID_SUGGESTEDSAVEASNAME )
continue;
if ( nId == SID_LOCK_CONTENT_EXTRACTION )
continue;
if ( nId == SID_LOCK_EXPORT )
continue;
if ( nId == SID_LOCK_PRINT )
continue;
if ( nId == SID_LOCK_SAVE )
continue;
if ( nId == SID_LOCK_EDITDOC )
continue;
if (nId == SID_REPLACEABLE)
continue;
}
OString aDbg = "Unknown item detected: " + OString::number(static_cast<sal_Int32>(nId));
DBG_ASSERT(nArg<nFormalArgs, aDbg.getStr());
}
}
}
#endif
if ( !nProps )
return;
// convert every item into a property
uno::Sequence<beans::PropertyValue> aSequ(nProps);
beans::PropertyValue *pValue = aSequ.getArray();
sal_Int32 nActProp=0;
if ( !pSlot->IsMode(SfxSlotMode::METHOD) )
{
// slot is a property
sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MapUnit::MapTwip );
const SfxPoolItem* pItem = rSet.GetItem<SfxPoolItem>(nWhich, false);
if ( pItem ) //???
{
sal_uInt16 nSubCount = pType->nAttribs;
if ( !nSubCount )
{
pValue[nActProp].Name = OUString::createFromAscii(pSlot->pUnoName) ;
if ( !pItem->QueryValue( pValue[nActProp].Value ) )
{
SAL_WARN( "sfx", "Item not convertible: " << nSlotId );
}
}
else
{
// complex type, add a property value for every member of the struct
for ( sal_uInt16 n=1; n<=nSubCount; ++n )
{
sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<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" );
pValue[nActProp].Name = OUString::createFromAscii( pSlot->pUnoName ) +
"." +
OUString::createFromAscii( pType->aAttrib[n-1].pName );
if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
{
SAL_WARN( "sfx", "Sub item " << pType->aAttrib[n-1].nAID
<< " not convertible in slot: " << nSlotId );
}
}
}
}
rArgs = aSequ;
return;
}
// 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 );
bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MapUnit::MapTwip );
const SfxPoolItem* pItem = rSet.GetItem<SfxPoolItem>(nWhich, false);
if ( pItem ) //???
{
sal_uInt16 nSubCount = rArg.pType->nAttribs;
if ( !nSubCount )
{
pValue[nActProp].Name = OUString::createFromAscii( rArg.pName ) ;
if ( !pItem->QueryValue( pValue[nActProp++].Value ) )
{
SAL_WARN( "sfx", "Item not convertible: " << rArg.nSlotId );
}
}
else
{
// complex type, add a property value for every member of the struct
for ( sal_uInt16 n = 1; n <= nSubCount; ++n )
{
sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<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" );
pValue[nActProp].Name = OUString::createFromAscii( rArg.pName ) +
"." +
OUString::createFromAscii( rArg.pType->aAttrib[n-1].pName ) ;
if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
{
SAL_WARN( "sfx", "Sub item "
<< rArg.pType->aAttrib[n-1].nAID
<< " not convertible in slot: "
<< rArg.nSlotId );
}
}
}
}
}
if ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC || nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC ||
nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF ||
nSlotId == SID_EXPORTDOCASEPUB || nSlotId == SID_DIRECTEXPORTDOCASEPUB ||
nSlotId == SID_REDACTDOC || nSlotId == SID_AUTOREDACTDOC || nSlotId == SID_SAVEACOPY )
{
if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_COMPONENTDATA, false) )
{
pValue[nActProp].Name = sComponentData;
pValue[nActProp++].Value = pItem->GetValue();
}
if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_COMPONENTCONTEXT, false) )
{
pValue[nActProp].Name = sComponentContext;
pValue[nActProp++].Value = pItem->GetValue();
}
if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_PROGRESS_STATUSBAR_CONTROL, false) )
{
pValue[nActProp].Name = sStatusInd;
pValue[nActProp++].Value = pItem->GetValue();
}
if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_INTERACTIONHANDLER, false) )
{
pValue[nActProp].Name = sInteractionHdl;
pValue[nActProp++].Value = pItem->GetValue();
}
if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_VIEW_DATA, false) )
{
pValue[nActProp].Name = sViewData;
pValue[nActProp++].Value = pItem->GetValue();
}
if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_FILTER_DATA, false) )
{
pValue[nActProp].Name = sFilterData;
pValue[nActProp++].Value = pItem->GetValue();
}
if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_DOCUMENT, false) )
{
pValue[nActProp].Name = sModel;
pValue[nActProp++].Value = pItem->GetValue();
}
if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_CONTENT, false) )
{
pValue[nActProp].Name = sUCBContent;
pValue[nActProp++].Value = pItem->GetValue();
}
if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_INPUTSTREAM, false) )
{
pValue[nActProp].Name = sInputStream;
pValue[nActProp++].Value = pItem->GetValue();
}
if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_STREAM, false) )
{
pValue[nActProp].Name = sStream;
pValue[nActProp++].Value = pItem->GetValue();
}
if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_OUTPUTSTREAM, false) )
{
pValue[nActProp].Name = sOutputStream;
pValue[nActProp++].Value = pItem->GetValue();
}
if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_POSTDATA, false) )
{
pValue[nActProp].Name = sPostData;
pValue[nActProp++].Value = pItem->GetValue();
}
if ( const SfxPoolItem *pItem = nullptr; SfxItemState::SET == rSet.GetItemState( SID_FILLFRAME, false, &pItem) )
{
pValue[nActProp].Name = sFrame;
if ( auto pUsrAnyItem = dynamic_cast< const SfxUnoAnyItem *>( pItem ) )
{
OSL_FAIL( "TransformItems: transporting an XFrame via an SfxUnoAnyItem is not deprecated!" );
pValue[nActProp++].Value = pUsrAnyItem->GetValue();
}
else if ( auto pUnoFrameItem = dynamic_cast< const SfxUnoFrameItem *>( pItem ) )
pValue[nActProp++].Value <<= pUnoFrameItem->GetFrame();
else
OSL_FAIL( "TransformItems: invalid item type for SID_FILLFRAME!" );
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_TEMPLATE, false) )
{
pValue[nActProp].Name = sAsTemplate;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_OPEN_NEW_VIEW, false) )
{
pValue[nActProp].Name = sOpenNewView;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_FAIL_ON_WARNING, false) )
{
pValue[nActProp].Name = sFailOnWarning;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( SID_VIEW_ID, false) )
{
pValue[nActProp].Name = sViewId;
pValue[nActProp++].Value <<= static_cast<sal_Int16>(pItem->GetValue());
}
if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( SID_PLUGIN_MODE, false) )
{
pValue[nActProp].Name = sPluginMode;
pValue[nActProp++].Value <<= static_cast<sal_Int16>(pItem->GetValue());
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_DOC_READONLY, false) )
{
pValue[nActProp].Name = sReadOnly;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_DDE_RECONNECT_ONLOAD, false) )
{
pValue[nActProp].Name = sDdeReconnect;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_DOC_STARTPRESENTATION, false) )
{
pValue[nActProp].Name = sStartPresentation;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_SELECTION, false) )
{
pValue[nActProp].Name = sSelectionOnly;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_HIDDEN, false) )
{
pValue[nActProp].Name = sHidden;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_MINIMIZED, false) )
{
pValue[nActProp].Name = sMinimized;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_SILENT, false) )
{
pValue[nActProp].Name = sSilent;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_PREVIEW, false) )
{
pValue[nActProp].Name = sPreview;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_VIEWONLY, false) )
{
pValue[nActProp].Name = sViewOnly;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_EDITDOC, false) )
{
pValue[nActProp].Name = sDontEdit;
pValue[nActProp++].Value <<= !pItem->GetValue();
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_FILE_DIALOG, false) )
{
pValue[nActProp].Name = sUseSystemDialog;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_STANDARD_DIR, false) )
{
pValue[nActProp].Name = sStandardDir;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxStringListItem *pItem = rSet.GetItemIfSet( SID_DENY_LIST, false) )
{
pValue[nActProp].Name = sDenyList;
css::uno::Sequence< OUString > aList;
pItem->GetStringList( aList );
pValue[nActProp++].Value <<= aList ;
}
if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_TARGETNAME, false) )
{
pValue[nActProp].Name = sFrameName;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_SALVAGE, false) )
{
pValue[nActProp].Name = sSalvagedFile;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_PATH, false) )
{
pValue[nActProp].Name = sFolderName;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_CONTENTTYPE, false) )
{
pValue[nActProp].Name = sMediaType;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_TEMPLATE_NAME, false) )
{
pValue[nActProp].Name = sTemplateName;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_TEMPLATE_REGIONNAME, false) )
{
pValue[nActProp].Name = sTemplateRegionName;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_JUMPMARK, false) )
{
pValue[nActProp].Name = sJumpMark;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_CHARSET, false) )
{
pValue[nActProp].Name = sCharacterSet;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( SID_MACROEXECMODE, false) )
{
pValue[nActProp].Name = sMacroExecMode;
pValue[nActProp++].Value <<= static_cast<sal_Int16>(pItem->GetValue());
}
if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( SID_UPDATEDOCMODE, false) )
{
pValue[nActProp].Name = sUpdateDocMode;
pValue[nActProp++].Value <<= static_cast<sal_Int16>(pItem->GetValue());
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_REPAIRPACKAGE, false) )
{
pValue[nActProp].Name = sRepairPackage;
pValue[nActProp++].Value <<= pItem->GetValue() ;
}
if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOCINFO_TITLE, false) )
{
pValue[nActProp].Name = sDocumentTitle;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_BASEURL, false) )
{
pValue[nActProp].Name = sDocumentBaseURL;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_HIERARCHICALNAME, false) )
{
pValue[nActProp].Name = sHierarchicalDocumentName;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_COPY_STREAM_IF_POSSIBLE, false) )
{
pValue[nActProp].Name = sCopyStreamIfPossible;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_NOAUTOSAVE, false) )
{
pValue[nActProp].Name = sNoAutoSave;
pValue[nActProp++].Value <<= pItem->GetValue() ;
}
if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_MODIFYPASSWORDINFO, false) )
{
pValue[nActProp].Name = sModifyPasswordInfo;
pValue[nActProp++].Value = pItem->GetValue();
}
if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_ENCRYPTIONDATA, false) )
{
pValue[nActProp].Name = sEncryptionData;
pValue[nActProp++].Value = pItem->GetValue();
}
if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_SUGGESTEDSAVEASDIR, false) )
{
pValue[nActProp].Name = sSuggestedSaveAsDir;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_SUGGESTEDSAVEASNAME, false) )
{
pValue[nActProp].Name = sSuggestedSaveAsName;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_SERVICE, false) )
{
pValue[nActProp].Name = sDocumentService;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if (const SfxStringItem *pItem = rSet.GetItemIfSet(SID_FILTER_PROVIDER))
{
pValue[nActProp].Name = sFilterProvider;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if (const SfxStringItem *pItem = rSet.GetItemIfSet(SID_CONVERT_IMAGES))
{
pValue[nActProp].Name = sImageFilter;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_CONTENT_EXTRACTION, false) )
{
pValue[nActProp].Name = sLockContentExtraction;
pValue[nActProp++].Value <<= pItem->GetValue() ;
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_EXPORT, false) )
{
pValue[nActProp].Name = sLockExport;
pValue[nActProp++].Value <<= pItem->GetValue() ;
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_PRINT, false) )
{
pValue[nActProp].Name = sLockPrint;
pValue[nActProp++].Value <<= pItem->GetValue() ;
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_SAVE, false) )
{
pValue[nActProp].Name = sLockSave;
pValue[nActProp++].Value <<= pItem->GetValue() ;
}
if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_EDITDOC, false) )
{
pValue[nActProp].Name = sLockEditDoc;
pValue[nActProp++].Value <<= pItem->GetValue();
}
if (const SfxBoolItem *pItem = rSet.GetItemIfSet(SID_REPLACEABLE, false))
{
pValue[nActProp].Name = sReplaceable;
pValue[nActProp++].Value <<= pItem->GetValue();
}
}
rArgs = aSequ;
}
void SAL_CALL FilterOptionsContinuation::setFilterOptions(
const uno::Sequence<beans::PropertyValue>& rProps )
{
rProperties = rProps;
}
uno::Sequence< beans::PropertyValue > SAL_CALL
FilterOptionsContinuation::getFilterOptions()
{
return rProperties;
}
RequestFilterOptions::RequestFilterOptions( uno::Reference< frame::XModel > const & rModel,
const uno::Sequence< beans::PropertyValue >& rProperties )
{
uno::Reference< uno::XInterface > temp2;
document::FilterOptionsRequest aOptionsRequest( OUString(),
temp2,
rModel,
rProperties );
m_aRequest <<= aOptionsRequest;
m_xAbort = new comphelper::OInteractionAbort;
m_xOptions = new FilterOptionsContinuation;
}
uno::Any SAL_CALL RequestFilterOptions::getRequest()
{
return m_aRequest;
}
uno::Sequence< uno::Reference< task::XInteractionContinuation > >
SAL_CALL RequestFilterOptions::getContinuations()
{
return { m_xAbort, m_xOptions };
}
class RequestPackageReparation_Impl : public ::cppu::WeakImplHelper< task::XInteractionRequest >
{
uno::Any m_aRequest;
rtl::Reference<comphelper::OInteractionApprove> m_xApprove;
rtl::Reference<comphelper::OInteractionDisapprove> m_xDisapprove;
public:
explicit RequestPackageReparation_Impl( const OUString& aName );
bool isApproved() const;
virtual uno::Any SAL_CALL getRequest() override;
virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations() override;
};
RequestPackageReparation_Impl::RequestPackageReparation_Impl( const OUString& aName )
{
uno::Reference< uno::XInterface > temp2;
document::BrokenPackageRequest aBrokenPackageRequest( OUString(), temp2, aName );
m_aRequest <<= aBrokenPackageRequest;
m_xApprove = new comphelper::OInteractionApprove;
m_xDisapprove = new comphelper::OInteractionDisapprove;
}
bool RequestPackageReparation_Impl::isApproved() const
{
return m_xApprove->wasSelected();
}
uno::Any SAL_CALL RequestPackageReparation_Impl::getRequest()
{
return m_aRequest;
}
uno::Sequence< uno::Reference< task::XInteractionContinuation > >
SAL_CALL RequestPackageReparation_Impl::getContinuations()
{
return { m_xApprove, m_xDisapprove };
}
RequestPackageReparation::RequestPackageReparation( const OUString& aName )
: mxImpl(new RequestPackageReparation_Impl( aName ))
{
}
RequestPackageReparation::~RequestPackageReparation()
{
}
bool RequestPackageReparation::isApproved() const
{
return mxImpl->isApproved();
}
css::uno::Reference < task::XInteractionRequest > RequestPackageReparation::GetRequest() const
{
return mxImpl;
}
class NotifyBrokenPackage_Impl : public ::cppu::WeakImplHelper< task::XInteractionRequest >
{
uno::Any m_aRequest;
rtl::Reference<comphelper::OInteractionAbort> m_xAbort;
public:
explicit NotifyBrokenPackage_Impl(const OUString& rName);
virtual uno::Any SAL_CALL getRequest() override;
virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations() override;
};
NotifyBrokenPackage_Impl::NotifyBrokenPackage_Impl( const OUString& aName )
{
uno::Reference< uno::XInterface > temp2;
document::BrokenPackageRequest aBrokenPackageRequest( OUString(), temp2, aName );
m_aRequest <<= aBrokenPackageRequest;
m_xAbort = new comphelper::OInteractionAbort;
}
uno::Any SAL_CALL NotifyBrokenPackage_Impl::getRequest()
{
return m_aRequest;
}
uno::Sequence< uno::Reference< task::XInteractionContinuation > >
SAL_CALL NotifyBrokenPackage_Impl::getContinuations()
{
return { m_xAbort };
}
NotifyBrokenPackage::NotifyBrokenPackage( const OUString& aName )
: mxImpl(new NotifyBrokenPackage_Impl( aName ))
{
}
NotifyBrokenPackage::~NotifyBrokenPackage()
{
}
css::uno::Reference < task::XInteractionRequest > NotifyBrokenPackage::GetRequest() const
{
return mxImpl;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|