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
|
/*************************************************************************
*
* 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_sw.hxx"
#include <swtypes.hxx>
#include <cmdid.h>
#include <hintids.hxx>
#ifndef _SVX_SVXIDS_HRC //autogen
#include <svx/svxids.hrc>
#endif
#include <doc.hxx>
#include <docary.hxx>
#include <fmtcol.hxx>
#include <poolfmt.hxx>
#include <unocoll.hxx>
#include <unosett.hxx>
#include <fmtanchr.hxx>
#include <ndtxt.hxx>
#include <section.hxx>
#include <IMark.hxx>
#include <ftnidx.hxx>
#include <fmtftn.hxx>
#include <txtftn.hxx>
#include <fmtpdsc.hxx>
#include <pagedesc.hxx>
#include <vos/mutex.hxx>
#include <com/sun/star/text/XTextTableCursor.hpp>
#include <com/sun/star/text/XTextTablesSupplier.hpp>
#include <com/sun/star/text/TableColumnSeparator.hpp>
#include <com/sun/star/text/XTextTable.hpp>
#include <svl/PasswordHelper.hxx>
#include <svtools/unoimap.hxx>
#include <svtools/unoevent.hxx>
#include <unotbl.hxx>
#include <unostyle.hxx>
#include <unofield.hxx>
#include <unoidx.hxx>
#include <unoframe.hxx>
#include <unofootnote.hxx>
#include <vcl/svapp.hxx>
#include <fmtcntnt.hxx>
#include <authfld.hxx>
#include <SwXTextDefaults.hxx>
#include <unochart.hxx>
#include <comphelper/makesequence.hxx>
#include <comphelper/sequence.hxx>
#include <slist>
#include <iterator>
#include <unosection.hxx>
#include <unoparagraph.hxx>
#include <unobookmark.hxx>
#include <unorefmark.hxx>
#include <unometa.hxx>
#include "docsh.hxx"
using ::rtl::OUString;
using namespace ::com::sun::star;
using namespace ::com::sun::star::document;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::text;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
/******************************************************************************
*
******************************************************************************/
struct ProvNamesId_Type
{
const char * pName;
sal_uInt16 nType;
};
// note: this thing is indexed as an array, so do not insert/remove entries!
const ProvNamesId_Type __FAR_DATA aProvNamesId[] =
{
{ "com.sun.star.text.TextTable", SW_SERVICE_TYPE_TEXTTABLE },
{ "com.sun.star.text.TextFrame", SW_SERVICE_TYPE_TEXTFRAME },
{ "com.sun.star.text.GraphicObject", SW_SERVICE_TYPE_GRAPHIC },
{ "com.sun.star.text.TextEmbeddedObject", SW_SERVICE_TYPE_OLE },
{ "com.sun.star.text.Bookmark", SW_SERVICE_TYPE_BOOKMARK },
{ "com.sun.star.text.Footnote", SW_SERVICE_TYPE_FOOTNOTE },
{ "com.sun.star.text.Endnote", SW_SERVICE_TYPE_ENDNOTE },
{ "com.sun.star.text.DocumentIndexMark", SW_SERVICE_TYPE_INDEXMARK },
{ "com.sun.star.text.DocumentIndex", SW_SERVICE_TYPE_INDEX },
{ "com.sun.star.text.ReferenceMark", SW_SERVICE_REFERENCE_MARK },
{ "com.sun.star.style.CharacterStyle", SW_SERVICE_STYLE_CHARACTER_STYLE },
{ "com.sun.star.style.ParagraphStyle", SW_SERVICE_STYLE_PARAGRAPH_STYLE },
{ "com.sun.star.style.FrameStyle", SW_SERVICE_STYLE_FRAME_STYLE },
{ "com.sun.star.style.PageStyle", SW_SERVICE_STYLE_PAGE_STYLE },
{ "com.sun.star.style.NumberingStyle", SW_SERVICE_STYLE_NUMBERING_STYLE },
{ "com.sun.star.text.ContentIndexMark", SW_SERVICE_CONTENT_INDEX_MARK },
{ "com.sun.star.text.ContentIndex", SW_SERVICE_CONTENT_INDEX },
{ "com.sun.star.text.UserIndexMark", SW_SERVICE_USER_INDEX_MARK },
{ "com.sun.star.text.UserIndex", SW_SERVICE_USER_INDEX },
{ "com.sun.star.text.TextSection", SW_SERVICE_TEXT_SECTION },
{ "com.sun.star.text.TextField.DateTime", SW_SERVICE_FIELDTYPE_DATETIME },
{ "com.sun.star.text.TextField.User", SW_SERVICE_FIELDTYPE_USER },
{ "com.sun.star.text.TextField.SetExpression", SW_SERVICE_FIELDTYPE_SET_EXP },
{ "com.sun.star.text.TextField.GetExpression", SW_SERVICE_FIELDTYPE_GET_EXP },
{ "com.sun.star.text.TextField.FileName", SW_SERVICE_FIELDTYPE_FILE_NAME },
{ "com.sun.star.text.TextField.PageNumber", SW_SERVICE_FIELDTYPE_PAGE_NUM },
{ "com.sun.star.text.TextField.Author", SW_SERVICE_FIELDTYPE_AUTHOR },
{ "com.sun.star.text.TextField.Chapter", SW_SERVICE_FIELDTYPE_CHAPTER },
{ "", SW_SERVICE_FIELDTYPE_DUMMY_0 },
{ "com.sun.star.text.TextField.GetReference", SW_SERVICE_FIELDTYPE_GET_REFERENCE },
{ "com.sun.star.text.TextField.ConditionalText", SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT },
{ "com.sun.star.text.TextField.Annotation", SW_SERVICE_FIELDTYPE_ANNOTATION },
{ "com.sun.star.text.TextField.Input", SW_SERVICE_FIELDTYPE_INPUT },
{ "com.sun.star.text.TextField.Macro", SW_SERVICE_FIELDTYPE_MACRO },
{ "com.sun.star.text.TextField.DDE", SW_SERVICE_FIELDTYPE_DDE },
{ "com.sun.star.text.TextField.HiddenParagraph", SW_SERVICE_FIELDTYPE_HIDDEN_PARA },
{ "" /*com.sun.star.text.TextField.DocumentInfo"*/, SW_SERVICE_FIELDTYPE_DOC_INFO },
{ "com.sun.star.text.TextField.TemplateName", SW_SERVICE_FIELDTYPE_TEMPLATE_NAME },
{ "com.sun.star.text.TextField.ExtendedUser", SW_SERVICE_FIELDTYPE_USER_EXT },
{ "com.sun.star.text.TextField.ReferencePageSet", SW_SERVICE_FIELDTYPE_REF_PAGE_SET },
{ "com.sun.star.text.TextField.ReferencePageGet", SW_SERVICE_FIELDTYPE_REF_PAGE_GET },
{ "com.sun.star.text.TextField.JumpEdit", SW_SERVICE_FIELDTYPE_JUMP_EDIT },
{ "com.sun.star.text.TextField.Script", SW_SERVICE_FIELDTYPE_SCRIPT },
{ "com.sun.star.text.TextField.DatabaseNextSet", SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET },
{ "com.sun.star.text.TextField.DatabaseNumberOfSet", SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET },
{ "com.sun.star.text.TextField.DatabaseSetNumber", SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM },
{ "com.sun.star.text.TextField.Database", SW_SERVICE_FIELDTYPE_DATABASE },
{ "com.sun.star.text.TextField.DatabaseName", SW_SERVICE_FIELDTYPE_DATABASE_NAME },
{ "com.sun.star.text.TextField.TableFormula", SW_SERVICE_FIELDTYPE_TABLE_FORMULA },
{ "com.sun.star.text.TextField.PageCount", SW_SERVICE_FIELDTYPE_PAGE_COUNT },
{ "com.sun.star.text.TextField.ParagraphCount", SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT },
{ "com.sun.star.text.TextField.WordCount", SW_SERVICE_FIELDTYPE_WORD_COUNT },
{ "com.sun.star.text.TextField.CharacterCount", SW_SERVICE_FIELDTYPE_CHARACTER_COUNT },
{ "com.sun.star.text.TextField.TableCount", SW_SERVICE_FIELDTYPE_TABLE_COUNT },
{ "com.sun.star.text.TextField.GraphicObjectCount", SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT },
{ "com.sun.star.text.TextField.EmbeddedObjectCount", SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT },
{ "com.sun.star.text.TextField.DocInfo.ChangeAuthor", SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR },
{ "com.sun.star.text.TextField.DocInfo.ChangeDateTime", SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME },
{ "com.sun.star.text.TextField.DocInfo.EditTime", SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME },
{ "com.sun.star.text.TextField.DocInfo.Description", SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION },
{ "com.sun.star.text.TextField.DocInfo.CreateAuthor", SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR },
{ "com.sun.star.text.TextField.DocInfo.CreateDateTime", SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME },
{ "", SW_SERVICE_FIELDTYPE_DUMMY_0 },
{ "", SW_SERVICE_FIELDTYPE_DUMMY_1 },
{ "", SW_SERVICE_FIELDTYPE_DUMMY_2 },
{ "", SW_SERVICE_FIELDTYPE_DUMMY_3 },
{ "com.sun.star.text.TextField.DocInfo.Custom", SW_SERVICE_FIELDTYPE_DOCINFO_CUSTOM },
{ "com.sun.star.text.TextField.DocInfo.PrintAuthor", SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR },
{ "com.sun.star.text.TextField.DocInfo.PrintDateTime", SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME },
{ "com.sun.star.text.TextField.DocInfo.KeyWords", SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS },
{ "com.sun.star.text.TextField.DocInfo.Subject", SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT },
{ "com.sun.star.text.TextField.DocInfo.Title", SW_SERVICE_FIELDTYPE_DOCINFO_TITLE },
{ "com.sun.star.text.TextField.DocInfo.Revision", SW_SERVICE_FIELDTYPE_DOCINFO_REVISION },
{ "com.sun.star.text.TextField.Bibliography", SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY },
{ "com.sun.star.text.TextField.CombinedCharacters", SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS },
{ "com.sun.star.text.TextField.DropDown", SW_SERVICE_FIELDTYPE_DROPDOWN },
{ "com.sun.star.text.textfield.MetadataField", SW_SERVICE_FIELDTYPE_METAFIELD },
{ "", SW_SERVICE_FIELDTYPE_DUMMY_4 },
{ "", SW_SERVICE_FIELDTYPE_DUMMY_5 },
{ "", SW_SERVICE_FIELDTYPE_DUMMY_6 },
{ "", SW_SERVICE_FIELDTYPE_DUMMY_7 },
{ "com.sun.star.text.FieldMaster.User", SW_SERVICE_FIELDMASTER_USER },
{ "com.sun.star.text.FieldMaster.DDE", SW_SERVICE_FIELDMASTER_DDE },
{ "com.sun.star.text.FieldMaster.SetExpression", SW_SERVICE_FIELDMASTER_SET_EXP },
{ "com.sun.star.text.FieldMaster.Database", SW_SERVICE_FIELDMASTER_DATABASE },
{ "com.sun.star.text.FieldMaster.Bibliography", SW_SERVICE_FIELDMASTER_BIBLIOGRAPHY },
{ "", SW_SERVICE_FIELDMASTER_DUMMY2 },
{ "", SW_SERVICE_FIELDMASTER_DUMMY3 },
{ "", SW_SERVICE_FIELDMASTER_DUMMY4 },
{ "", SW_SERVICE_FIELDMASTER_DUMMY5 },
{ "com.sun.star.text.IllustrationsIndex", SW_SERVICE_INDEX_ILLUSTRATIONS },
{ "com.sun.star.text.ObjectIndex", SW_SERVICE_INDEX_OBJECTS },
{ "com.sun.star.text.TableIndex", SW_SERVICE_INDEX_TABLES },
{ "com.sun.star.text.Bibliography", SW_SERVICE_INDEX_BIBLIOGRAPHY },
{ "com.sun.star.text.Paragraph", SW_SERVICE_PARAGRAPH },
{ "com.sun.star.text.TextField.InputUser", SW_SERVICE_FIELDTYPE_INPUT_USER },
{ "com.sun.star.text.TextField.HiddenText", SW_SERVICE_FIELDTYPE_HIDDEN_TEXT },
{ "com.sun.star.style.ConditionalParagraphStyle", SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE },
{ "com.sun.star.text.NumberingRules", SW_SERVICE_NUMBERING_RULES },
{ "com.sun.star.text.TextColumns", SW_SERVICE_TEXT_COLUMNS },
{ "com.sun.star.text.IndexHeaderSection", SW_SERVICE_INDEX_HEADER_SECTION },
{ "com.sun.star.text.Defaults", SW_SERVICE_DEFAULTS },
{ "com.sun.star.image.ImageMapRectangleObject", SW_SERVICE_IMAP_RECTANGLE },
{ "com.sun.star.image.ImageMapCircleObject", SW_SERVICE_IMAP_CIRCLE },
{ "com.sun.star.image.ImageMapPolygonObject", SW_SERVICE_IMAP_POLYGON },
{ "com.sun.star.text.TextGraphicObject", SW_SERVICE_TYPE_TEXT_GRAPHIC },
{ "com.sun.star.chart2.data.DataProvider", SW_SERVICE_CHART2_DATA_PROVIDER },
{ "com.sun.star.text.Fieldmark", SW_SERVICE_TYPE_FIELDMARK },
{ "com.sun.star.text.FormFieldmark", SW_SERVICE_TYPE_FORMFIELDMARK },
{ "com.sun.star.text.InContentMetadata", SW_SERVICE_TYPE_META },
// case-correct versions of the service names (see #i67811)
{ CSS_TEXT_TEXTFIELD_DATE_TIME, SW_SERVICE_FIELDTYPE_DATETIME },
{ CSS_TEXT_TEXTFIELD_USER, SW_SERVICE_FIELDTYPE_USER },
{ CSS_TEXT_TEXTFIELD_SET_EXPRESSION, SW_SERVICE_FIELDTYPE_SET_EXP },
{ CSS_TEXT_TEXTFIELD_GET_EXPRESSION, SW_SERVICE_FIELDTYPE_GET_EXP },
{ CSS_TEXT_TEXTFIELD_FILE_NAME, SW_SERVICE_FIELDTYPE_FILE_NAME },
{ CSS_TEXT_TEXTFIELD_PAGE_NUMBER, SW_SERVICE_FIELDTYPE_PAGE_NUM },
{ CSS_TEXT_TEXTFIELD_AUTHOR, SW_SERVICE_FIELDTYPE_AUTHOR },
{ CSS_TEXT_TEXTFIELD_CHAPTER, SW_SERVICE_FIELDTYPE_CHAPTER },
{ CSS_TEXT_TEXTFIELD_GET_REFERENCE, SW_SERVICE_FIELDTYPE_GET_REFERENCE },
{ CSS_TEXT_TEXTFIELD_CONDITIONAL_TEXT, SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT },
{ CSS_TEXT_TEXTFIELD_ANNOTATION, SW_SERVICE_FIELDTYPE_ANNOTATION },
{ CSS_TEXT_TEXTFIELD_INPUT, SW_SERVICE_FIELDTYPE_INPUT },
{ CSS_TEXT_TEXTFIELD_MACRO, SW_SERVICE_FIELDTYPE_MACRO },
{ CSS_TEXT_TEXTFIELD_DDE, SW_SERVICE_FIELDTYPE_DDE },
{ CSS_TEXT_TEXTFIELD_HIDDEN_PARAGRAPH, SW_SERVICE_FIELDTYPE_HIDDEN_PARA },
{ CSS_TEXT_TEXTFIELD_TEMPLATE_NAME, SW_SERVICE_FIELDTYPE_TEMPLATE_NAME },
{ CSS_TEXT_TEXTFIELD_EXTENDED_USER, SW_SERVICE_FIELDTYPE_USER_EXT },
{ CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_SET, SW_SERVICE_FIELDTYPE_REF_PAGE_SET },
{ CSS_TEXT_TEXTFIELD_REFERENCE_PAGE_GET, SW_SERVICE_FIELDTYPE_REF_PAGE_GET },
{ CSS_TEXT_TEXTFIELD_JUMP_EDIT, SW_SERVICE_FIELDTYPE_JUMP_EDIT },
{ CSS_TEXT_TEXTFIELD_SCRIPT, SW_SERVICE_FIELDTYPE_SCRIPT },
{ CSS_TEXT_TEXTFIELD_DATABASE_NEXT_SET, SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET },
{ CSS_TEXT_TEXTFIELD_DATABASE_NUMBER_OF_SET, SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET },
{ CSS_TEXT_TEXTFIELD_DATABASE_SET_NUMBER, SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM },
{ CSS_TEXT_TEXTFIELD_DATABASE, SW_SERVICE_FIELDTYPE_DATABASE },
{ CSS_TEXT_TEXTFIELD_DATABASE_NAME, SW_SERVICE_FIELDTYPE_DATABASE_NAME },
{ CSS_TEXT_TEXTFIELD_TABLE_FORMULA, SW_SERVICE_FIELDTYPE_TABLE_FORMULA },
{ CSS_TEXT_TEXTFIELD_PAGE_COUNT, SW_SERVICE_FIELDTYPE_PAGE_COUNT },
{ CSS_TEXT_TEXTFIELD_PARAGRAPH_COUNT, SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT },
{ CSS_TEXT_TEXTFIELD_WORD_COUNT, SW_SERVICE_FIELDTYPE_WORD_COUNT },
{ CSS_TEXT_TEXTFIELD_CHARACTER_COUNT, SW_SERVICE_FIELDTYPE_CHARACTER_COUNT },
{ CSS_TEXT_TEXTFIELD_TABLE_COUNT, SW_SERVICE_FIELDTYPE_TABLE_COUNT },
{ CSS_TEXT_TEXTFIELD_GRAPHIC_OBJECT_COUNT, SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT },
{ CSS_TEXT_TEXTFIELD_EMBEDDED_OBJECT_COUNT, SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT },
{ CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_AUTHOR, SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR },
{ CSS_TEXT_TEXTFIELD_DOCINFO_CHANGE_DATE_TIME, SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME },
{ CSS_TEXT_TEXTFIELD_DOCINFO_EDIT_TIME, SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME },
{ CSS_TEXT_TEXTFIELD_DOCINFO_DESCRIPTION, SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION },
{ CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_AUTHOR, SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR },
{ CSS_TEXT_TEXTFIELD_DOCINFO_CREATE_DATE_TIME, SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME },
{ CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_AUTHOR, SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR },
{ CSS_TEXT_TEXTFIELD_DOCINFO_PRINT_DATE_TIME, SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME },
{ CSS_TEXT_TEXTFIELD_DOCINFO_KEY_WORDS, SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS },
{ CSS_TEXT_TEXTFIELD_DOCINFO_SUBJECT, SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT },
{ CSS_TEXT_TEXTFIELD_DOCINFO_TITLE, SW_SERVICE_FIELDTYPE_DOCINFO_TITLE },
{ CSS_TEXT_TEXTFIELD_DOCINFO_REVISION, SW_SERVICE_FIELDTYPE_DOCINFO_REVISION },
{ CSS_TEXT_TEXTFIELD_DOCINFO_CUSTOM, SW_SERVICE_FIELDTYPE_DOCINFO_CUSTOM },
{ CSS_TEXT_TEXTFIELD_BIBLIOGRAPHY, SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY },
{ CSS_TEXT_TEXTFIELD_COMBINED_CHARACTERS, SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS },
{ CSS_TEXT_TEXTFIELD_DROP_DOWN, SW_SERVICE_FIELDTYPE_DROPDOWN },
{ CSS_TEXT_TEXTFIELD_INPUT_USER, SW_SERVICE_FIELDTYPE_INPUT_USER },
{ CSS_TEXT_TEXTFIELD_HIDDEN_TEXT, SW_SERVICE_FIELDTYPE_HIDDEN_TEXT },
{ CSS_TEXT_FIELDMASTER_USER, SW_SERVICE_FIELDMASTER_USER },
{ CSS_TEXT_FIELDMASTER_DDE, SW_SERVICE_FIELDMASTER_DDE },
{ CSS_TEXT_FIELDMASTER_SET_EXPRESSION, SW_SERVICE_FIELDMASTER_SET_EXP },
{ CSS_TEXT_FIELDMASTER_DATABASE, SW_SERVICE_FIELDMASTER_DATABASE },
{ CSS_TEXT_FIELDMASTER_BIBLIOGRAPHY, SW_SERVICE_FIELDMASTER_BIBLIOGRAPHY }
};
/* -----------------------------23.03.01 13:38--------------------------------
---------------------------------------------------------------------------*/
const SvEventDescription* lcl_GetSupportedMacroItems()
{
static const SvEventDescription aMacroDescriptionsImpl[] =
{
{ SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
{ SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
{ 0, NULL }
};
return aMacroDescriptionsImpl;
}
/******************************************************************
* SwXServiceProvider
******************************************************************/
/*-- 13.01.99 13:31:44---------------------------------------------------
-----------------------------------------------------------------------*/
OUString SwXServiceProvider::GetProviderName(sal_uInt16 nObjectType)
{
vos::OGuard aGuard(Application::GetSolarMutex());
OUString sRet;
sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
if(nObjectType < nEntries)
sRet = C2U(aProvNamesId[nObjectType].pName);
return sRet;
}
/* -----------------11.03.99 12:05-------------------
*
* --------------------------------------------------*/
uno::Sequence<OUString> SwXServiceProvider::GetAllServiceNames()
{
sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
uno::Sequence<OUString> aRet(nEntries);
OUString* pArray = aRet.getArray();
sal_uInt16 n = 0;
for(sal_uInt16 i = 0; i < nEntries; i++)
{
String sProv(C2U(aProvNamesId[i].pName));
if(sProv.Len())
{
pArray[n] = sProv;
n++;
}
}
aRet.realloc(n);
return aRet;
}
/*-- 13.01.99 13:31:45---------------------------------------------------
-----------------------------------------------------------------------*/
sal_uInt16 SwXServiceProvider::GetProviderType(const OUString& rServiceName)
{
sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
for(sal_uInt16 i = 0; i < nEntries; i++ )
{
if( COMPARE_EQUAL == rServiceName.compareToAscii(aProvNamesId[i].pName))
return aProvNamesId[i].nType;
}
return SW_SERVICE_INVALID;
}
/* -----------------13.01.99 14:37-------------------
*
* --------------------------------------------------*/
uno::Reference< uno::XInterface > SwXServiceProvider::MakeInstance(sal_uInt16 nObjectType, SwDoc* pDoc)
{
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Reference< uno::XInterface > xRet;
switch(nObjectType)
{
case SW_SERVICE_TYPE_TEXTTABLE:
{
SwXTextTable* pTextTable = new SwXTextTable();
xRet = (cppu::OWeakObject*)pTextTable;
}
break;
case SW_SERVICE_TYPE_TEXTFRAME:
{
SwXTextFrame* pTextFrame = new SwXTextFrame( pDoc );
xRet = (cppu::OWeakObject*)(SwXFrame*)pTextFrame;
}
break;
case SW_SERVICE_TYPE_GRAPHIC :
case SW_SERVICE_TYPE_TEXT_GRAPHIC /* #i47503# */ :
{
SwXTextGraphicObject* pGraphic = new SwXTextGraphicObject( pDoc );
xRet = (cppu::OWeakObject*)(SwXFrame*)pGraphic;
}
break;
case SW_SERVICE_TYPE_OLE :
{
SwXTextEmbeddedObject* pOle = new SwXTextEmbeddedObject( pDoc );
xRet = (cppu::OWeakObject*)(SwXFrame*)pOle;
}
break;
case SW_SERVICE_TYPE_BOOKMARK :
{
SwXBookmark* pBookmark = new SwXBookmark;
xRet = (cppu::OWeakObject*)pBookmark;
}
break;
case SW_SERVICE_TYPE_FIELDMARK :
{
SwXFieldmark* pFieldmark = new SwXFieldmark(false);
xRet = (cppu::OWeakObject*)pFieldmark;
}
break;
case SW_SERVICE_TYPE_FORMFIELDMARK :
{
SwXFieldmark* pFieldmark = new SwXFieldmark(true);
xRet = (cppu::OWeakObject*)pFieldmark;
}
break;
case SW_SERVICE_TYPE_FOOTNOTE :
xRet = (cppu::OWeakObject*)new SwXFootnote(sal_False);
break;
case SW_SERVICE_TYPE_ENDNOTE :
xRet = (cppu::OWeakObject*)new SwXFootnote(sal_True);
break;
case SW_SERVICE_CONTENT_INDEX_MARK :
case SW_SERVICE_USER_INDEX_MARK :
case SW_SERVICE_TYPE_INDEXMARK:
{
TOXTypes eType = TOX_INDEX;
if(SW_SERVICE_CONTENT_INDEX_MARK== nObjectType)
eType = TOX_CONTENT;
else if(SW_SERVICE_USER_INDEX_MARK == nObjectType)
eType = TOX_USER;
xRet = (cppu::OWeakObject*)new SwXDocumentIndexMark(eType);
}
break;
case SW_SERVICE_CONTENT_INDEX :
case SW_SERVICE_USER_INDEX :
case SW_SERVICE_TYPE_INDEX :
case SW_SERVICE_INDEX_ILLUSTRATIONS:
case SW_SERVICE_INDEX_OBJECTS :
case SW_SERVICE_INDEX_TABLES:
case SW_SERVICE_INDEX_BIBLIOGRAPHY :
{
TOXTypes eType = TOX_INDEX;
if(SW_SERVICE_CONTENT_INDEX == nObjectType)
eType = TOX_CONTENT;
else if(SW_SERVICE_USER_INDEX == nObjectType)
eType = TOX_USER;
else if(SW_SERVICE_INDEX_ILLUSTRATIONS == nObjectType)
{
eType = TOX_ILLUSTRATIONS;
}
else if(SW_SERVICE_INDEX_OBJECTS == nObjectType)
{
eType = TOX_OBJECTS;
}
else if(SW_SERVICE_INDEX_BIBLIOGRAPHY == nObjectType)
{
eType = TOX_AUTHORITIES;
}
else if(SW_SERVICE_INDEX_TABLES == nObjectType)
{
eType = TOX_TABLES;
}
xRet = (cppu::OWeakObject*)new SwXDocumentIndex(eType, *pDoc);
}
break;
case SW_SERVICE_INDEX_HEADER_SECTION :
case SW_SERVICE_TEXT_SECTION :
xRet = SwXTextSection::CreateXTextSection(0,
(SW_SERVICE_INDEX_HEADER_SECTION == nObjectType));
break;
case SW_SERVICE_REFERENCE_MARK :
xRet = (cppu::OWeakObject*)new SwXReferenceMark(0, 0);
break;
case SW_SERVICE_STYLE_CHARACTER_STYLE:
case SW_SERVICE_STYLE_PARAGRAPH_STYLE:
case SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE:
case SW_SERVICE_STYLE_FRAME_STYLE:
case SW_SERVICE_STYLE_PAGE_STYLE:
case SW_SERVICE_STYLE_NUMBERING_STYLE:
{
SfxStyleFamily eFamily = SFX_STYLE_FAMILY_CHAR;
switch(nObjectType)
{
case SW_SERVICE_STYLE_PARAGRAPH_STYLE:
case SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE:
eFamily = SFX_STYLE_FAMILY_PARA;
break;
case SW_SERVICE_STYLE_FRAME_STYLE:
eFamily = SFX_STYLE_FAMILY_FRAME;
break;
case SW_SERVICE_STYLE_PAGE_STYLE:
eFamily = SFX_STYLE_FAMILY_PAGE;
break;
case SW_SERVICE_STYLE_NUMBERING_STYLE:
eFamily = SFX_STYLE_FAMILY_PSEUDO;
break;
}
SwXStyle* pNewStyle = SFX_STYLE_FAMILY_PAGE == eFamily ?
new SwXPageStyle(pDoc->GetDocShell()) :
eFamily == SFX_STYLE_FAMILY_FRAME ?
new SwXFrameStyle ( pDoc ):
new SwXStyle( pDoc, eFamily, nObjectType == SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE);
xRet = (cppu::OWeakObject*)pNewStyle;
}
break;
// SW_SERVICE_DUMMY_5
// SW_SERVICE_DUMMY_6
// SW_SERVICE_DUMMY_7
// SW_SERVICE_DUMMY_8
// SW_SERVICE_DUMMY_9
case SW_SERVICE_FIELDTYPE_DATETIME:
case SW_SERVICE_FIELDTYPE_USER:
case SW_SERVICE_FIELDTYPE_SET_EXP:
case SW_SERVICE_FIELDTYPE_GET_EXP:
case SW_SERVICE_FIELDTYPE_FILE_NAME:
case SW_SERVICE_FIELDTYPE_PAGE_NUM:
case SW_SERVICE_FIELDTYPE_AUTHOR:
case SW_SERVICE_FIELDTYPE_CHAPTER:
case SW_SERVICE_FIELDTYPE_GET_REFERENCE:
case SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT:
case SW_SERVICE_FIELDTYPE_INPUT:
case SW_SERVICE_FIELDTYPE_MACRO:
case SW_SERVICE_FIELDTYPE_DDE:
case SW_SERVICE_FIELDTYPE_HIDDEN_PARA:
case SW_SERVICE_FIELDTYPE_DOC_INFO:
case SW_SERVICE_FIELDTYPE_TEMPLATE_NAME:
case SW_SERVICE_FIELDTYPE_USER_EXT:
case SW_SERVICE_FIELDTYPE_REF_PAGE_SET:
case SW_SERVICE_FIELDTYPE_REF_PAGE_GET:
case SW_SERVICE_FIELDTYPE_JUMP_EDIT:
case SW_SERVICE_FIELDTYPE_SCRIPT:
case SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET:
case SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET:
case SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM:
case SW_SERVICE_FIELDTYPE_DATABASE:
case SW_SERVICE_FIELDTYPE_DATABASE_NAME:
case SW_SERVICE_FIELDTYPE_PAGE_COUNT :
case SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT :
case SW_SERVICE_FIELDTYPE_WORD_COUNT :
case SW_SERVICE_FIELDTYPE_CHARACTER_COUNT :
case SW_SERVICE_FIELDTYPE_TABLE_COUNT :
case SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT :
case SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT :
case SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR :
case SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME :
case SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME :
case SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION :
case SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR :
case SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME :
case SW_SERVICE_FIELDTYPE_DOCINFO_CUSTOM :
case SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR :
case SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME :
case SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS :
case SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT :
case SW_SERVICE_FIELDTYPE_DOCINFO_TITLE :
case SW_SERVICE_FIELDTYPE_DOCINFO_REVISION :
case SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY:
case SW_SERVICE_FIELDTYPE_INPUT_USER :
case SW_SERVICE_FIELDTYPE_HIDDEN_TEXT :
case SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS :
case SW_SERVICE_FIELDTYPE_DROPDOWN :
case SW_SERVICE_FIELDTYPE_TABLE_FORMULA:
xRet = (cppu::OWeakObject*)new SwXTextField(nObjectType);
break;
case SW_SERVICE_FIELDTYPE_ANNOTATION:
xRet = (cppu::OWeakObject*)new SwXTextField(nObjectType, pDoc);
break;
case SW_SERVICE_FIELDMASTER_USER:
case SW_SERVICE_FIELDMASTER_DDE:
case SW_SERVICE_FIELDMASTER_SET_EXP :
case SW_SERVICE_FIELDMASTER_DATABASE:
{
sal_uInt16 nResId = USHRT_MAX;
switch(nObjectType)
{
case SW_SERVICE_FIELDMASTER_USER: nResId = RES_USERFLD; break;
case SW_SERVICE_FIELDMASTER_DDE: nResId = RES_DDEFLD; break;
case SW_SERVICE_FIELDMASTER_SET_EXP : nResId = RES_SETEXPFLD; break;
case SW_SERVICE_FIELDMASTER_DATABASE: nResId = RES_DBFLD; break;
}
xRet = (cppu::OWeakObject*)new SwXFieldMaster(pDoc, nResId);
}
break;
case SW_SERVICE_FIELDMASTER_BIBLIOGRAPHY:
{
SwFieldType* pType = pDoc->GetFldType(RES_AUTHORITY, aEmptyStr, sal_True);
if(!pType)
{
SwAuthorityFieldType aType(pDoc);
pType = pDoc->InsertFldType(aType);
}
else
{
SwClientIter aIter( *pType );
SwXFieldMaster* pMaster = (SwXFieldMaster*)aIter.First( TYPE( SwXFieldMaster ));
if(pMaster)
xRet = (cppu::OWeakObject*)pMaster;
}
if(!xRet.is())
xRet = (cppu::OWeakObject*)new SwXFieldMaster(*pType, pDoc);
}
break;
case SW_SERVICE_PARAGRAPH :
xRet = (cppu::OWeakObject*)new SwXParagraph();
break;
case SW_SERVICE_NUMBERING_RULES :
xRet = (cppu::OWeakObject*)new SwXNumberingRules(*pDoc);
break;
case SW_SERVICE_TEXT_COLUMNS :
xRet = (cppu::OWeakObject*)new SwXTextColumns(0);
break;
case SW_SERVICE_DEFAULTS:
xRet = (cppu::OWeakObject*)new SwXTextDefaults( pDoc );
break;
case SW_SERVICE_IMAP_RECTANGLE :
xRet = SvUnoImageMapRectangleObject_createInstance( lcl_GetSupportedMacroItems() );
break;
case SW_SERVICE_IMAP_CIRCLE :
xRet = SvUnoImageMapCircleObject_createInstance( lcl_GetSupportedMacroItems() );
break;
case SW_SERVICE_IMAP_POLYGON :
xRet = SvUnoImageMapPolygonObject_createInstance( lcl_GetSupportedMacroItems() );
break;
case SW_SERVICE_CHART2_DATA_PROVIDER :
// #i64497# If a chart is in a temporary document during clipoard
// paste, there should be no data provider, so that own data is used
// This should not happen during copy/paste, as this will unlink
// charts using table data.
OSL_ASSERT( pDoc->GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED );
if( pDoc->GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
xRet = (cppu::OWeakObject*) pDoc->GetChartDataProvider( true /* create - if not yet available */ );
break;
case SW_SERVICE_TYPE_META:
xRet = static_cast< ::cppu::OWeakObject* >( new SwXMeta(pDoc) );
break;
case SW_SERVICE_FIELDTYPE_METAFIELD:
xRet = static_cast< ::cppu::OWeakObject* >(new SwXMetaField(pDoc));
break;
default:
throw uno::RuntimeException();
}
return xRet;
}
/******************************************************************
* SwXTextTables
******************************************************************/
//SMART_UNO_IMPLEMENTATION( SwXTextTables, UsrObject );
/*-- 13.01.99 12:56:24---------------------------------------------------
-----------------------------------------------------------------------*/
SwXTextTables::SwXTextTables(SwDoc* pDc) :
SwUnoCollection(pDc)
{
}
/*-- 13.01.99 12:56:25---------------------------------------------------
-----------------------------------------------------------------------*/
SwXTextTables::~SwXTextTables()
{
}
/*-- 13.01.99 12:56:25---------------------------------------------------
-----------------------------------------------------------------------*/
sal_Int32 SwXTextTables::getCount(void) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
sal_Int32 nRet = 0;
if(IsValid())
nRet = GetDoc()->GetTblFrmFmtCount(sal_True);
return nRet;
}
/*-- 13.01.99 12:56:26---------------------------------------------------
-----------------------------------------------------------------------*/
uno::Any SAL_CALL SwXTextTables::getByIndex(sal_Int32 nIndex)
throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Any aRet;
if(IsValid())
{
if(0 <= nIndex && GetDoc()->GetTblFrmFmtCount(sal_True) > nIndex)
{
SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt( static_cast< xub_StrLen >(nIndex), sal_True);
uno::Reference< XTextTable > xTbl = SwXTextTables::GetObject(rFmt);
aRet.setValue( &xTbl,
::getCppuType((uno::Reference< XTextTable>*)0));
}
else
throw IndexOutOfBoundsException();
}
else
throw uno::RuntimeException();
return aRet;
}
/*-- 13.01.99 12:56:26---------------------------------------------------
-----------------------------------------------------------------------*/
uno::Any SwXTextTables::getByName(const OUString& rItemName)
throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Any aRet;
if(IsValid())
{
sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(sal_True);
uno::Reference< XTextTable > xTbl;
for( sal_uInt16 i = 0; i < nCount; i++)
{
String aName(rItemName);
SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, sal_True);
if(aName == rFmt.GetName())
{
xTbl = SwXTextTables::GetObject(rFmt);
aRet.setValue(&xTbl,
::getCppuType(( uno::Reference< XTextTable >*)0));
break;
}
}
if(!xTbl.is())
throw NoSuchElementException();
}
else
throw uno::RuntimeException();
return aRet;
}
/*-- 13.01.99 12:56:26---------------------------------------------------
-----------------------------------------------------------------------*/
uno::Sequence< OUString > SwXTextTables::getElementNames(void)
throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(sal_True);
uno::Sequence<OUString> aSeq(nCount);
if(nCount)
{
OUString* pArray = aSeq.getArray();
for( sal_uInt16 i = 0; i < nCount; i++)
{
SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, sal_True);
pArray[i] = OUString(rFmt.GetName());
}
}
return aSeq;
}
/*-- 13.01.99 12:56:27---------------------------------------------------
-----------------------------------------------------------------------*/
sal_Bool SwXTextTables::hasByName(const OUString& rName)
throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
sal_Bool bRet= sal_False;
if(IsValid())
{
sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(sal_True);
for( sal_uInt16 i = 0; i < nCount; i++)
{
String aName(rName);
SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, sal_True);
if(aName == rFmt.GetName())
{
bRet = sal_True;
break;
}
}
}
else
throw uno::RuntimeException();
return bRet;
}
/*-- 13.01.99 12:56:27---------------------------------------------------
-----------------------------------------------------------------------*/
uno::Type SAL_CALL
SwXTextTables::getElementType( )
throw(uno::RuntimeException)
{
return ::getCppuType((uno::Reference<XTextTable>*)0);
}
/*-- 13.01.99 12:56:27---------------------------------------------------
-----------------------------------------------------------------------*/
sal_Bool SwXTextTables::hasElements(void) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
return 0 != GetDoc()->GetTblFrmFmtCount(sal_True);
}
/* -----------------25.10.99 16:01-------------------
--------------------------------------------------*/
OUString SwXTextTables::getImplementationName(void) throw( uno::RuntimeException )
{
return C2U("SwXTextTables");
}
/* -----------------25.10.99 16:01-------------------
--------------------------------------------------*/
sal_Bool SwXTextTables::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
{
return rServiceName == C2U("com.sun.star.text.TextTables");
}
/* -----------------25.10.99 16:01-------------------
--------------------------------------------------*/
uno::Sequence< OUString > SwXTextTables::getSupportedServiceNames(void) throw( uno::RuntimeException )
{
uno::Sequence< OUString > aRet(1);
OUString* pArr = aRet.getArray();
pArr[0] = C2U("com.sun.star.text.TextTables");
return aRet;
}
/*-- 13.01.99 12:56:28---------------------------------------------------
-----------------------------------------------------------------------*/
XTextTable* SwXTextTables::GetObject( SwFrmFmt& rFmt )
{
vos::OGuard aGuard(Application::GetSolarMutex());
SwXTextTable* pTbl = (SwXTextTable*)SwClientIter( rFmt ).
First( TYPE( SwXTextTable ));
if( !pTbl )
pTbl = new SwXTextTable(rFmt);
return pTbl ;
}
/******************************************************************
* SwXFrameEnumeration
******************************************************************/
namespace
{
template<FlyCntType T> struct UnoFrameWrap_traits {};
template<>
struct UnoFrameWrap_traits<FLYCNTTYPE_FRM>
{
typedef SwXTextFrame core_frame_t;
typedef XTextFrame uno_frame_t;
static inline bool filter(const SwNode* const pNode) { return !pNode->IsNoTxtNode(); };
};
template<>
struct UnoFrameWrap_traits<FLYCNTTYPE_GRF>
{
typedef SwXTextGraphicObject core_frame_t;
typedef XTextContent uno_frame_t;
static inline bool filter(const SwNode* const pNode) { return pNode->IsGrfNode(); };
};
template<>
struct UnoFrameWrap_traits<FLYCNTTYPE_OLE>
{
typedef SwXTextEmbeddedObject core_frame_t;
typedef XEmbeddedObjectSupplier uno_frame_t;
static inline bool filter(const SwNode* const pNode) { return pNode->IsOLENode(); };
};
template<FlyCntType T>
static uno::Any lcl_UnoWrapFrame(SwFrmFmt* pFmt)
{
SwXFrame* pFrm = static_cast<SwXFrame*>(SwClientIter(*pFmt).First(TYPE(SwXFrame)));
if(!pFrm)
pFrm = new typename UnoFrameWrap_traits<T>::core_frame_t(*pFmt);
Reference< typename UnoFrameWrap_traits<T>::uno_frame_t > xFrm =
static_cast< typename UnoFrameWrap_traits<T>::core_frame_t* >(pFrm);
return uno::makeAny(xFrm);
}
// runtime adapter for lcl_UnoWrapFrame
static uno::Any lcl_UnoWrapFrame(SwFrmFmt* pFmt, FlyCntType eType) throw(uno::RuntimeException())
{
switch(eType)
{
case FLYCNTTYPE_FRM:
return lcl_UnoWrapFrame<FLYCNTTYPE_FRM>(pFmt);
case FLYCNTTYPE_GRF:
return lcl_UnoWrapFrame<FLYCNTTYPE_GRF>(pFmt);
case FLYCNTTYPE_OLE:
return lcl_UnoWrapFrame<FLYCNTTYPE_OLE>(pFmt);
default:
throw uno::RuntimeException();
}
}
template<FlyCntType T>
class SwXFrameEnumeration
: public SwSimpleEnumeration_Base
{
private:
typedef ::std::slist< Any > frmcontainer_t;
frmcontainer_t m_aFrames;
protected:
virtual ~SwXFrameEnumeration() {};
public:
SwXFrameEnumeration(const SwDoc* const pDoc);
//XEnumeration
virtual sal_Bool SAL_CALL hasMoreElements(void) throw( RuntimeException );
virtual Any SAL_CALL nextElement(void) throw( NoSuchElementException, WrappedTargetException, RuntimeException );
//XServiceInfo
virtual OUString SAL_CALL getImplementationName(void) throw( RuntimeException );
virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( RuntimeException );
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw( RuntimeException );
};
}
template<FlyCntType T>
SwXFrameEnumeration<T>::SwXFrameEnumeration(const SwDoc* const pDoc)
: m_aFrames()
{
vos::OGuard aGuard(Application::GetSolarMutex());
const SwSpzFrmFmts* const pFmts = pDoc->GetSpzFrmFmts();
if(!pFmts->Count())
return;
// --> OD 2009-09-10 #i104937#
// const SwFrmFmt* const pFmtsEnd = (*pFmts)[pFmts->Count()];
const USHORT nSize = pFmts->Count();
// <--
::std::insert_iterator<frmcontainer_t> pInserter = ::std::insert_iterator<frmcontainer_t>(m_aFrames, m_aFrames.begin());
// --> OD 2009-09-10 #i104937#
SwFrmFmt* pFmt( 0 );
for( USHORT i = 0; i < nSize; ++i )
// for(SwFrmFmt* pFmt = (*pFmts)[0]; pFmt < pFmtsEnd; ++pFmt)
// <--
{
// --> OD 2009-09-10 #i104937#
pFmt = (*pFmts)[i];
// <--
if(pFmt->Which() != RES_FLYFRMFMT)
continue;
const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
if(!pIdx || !pIdx->GetNodes().IsDocNodes())
continue;
const SwNode* pNd = pDoc->GetNodes()[ pIdx->GetIndex() + 1 ];
if(UnoFrameWrap_traits<T>::filter(pNd))
*pInserter++ = lcl_UnoWrapFrame<T>(pFmt);
}
}
template<FlyCntType T>
sal_Bool SwXFrameEnumeration<T>::hasMoreElements(void) throw( RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
return !m_aFrames.empty();
}
template<FlyCntType T>
Any SwXFrameEnumeration<T>::nextElement(void) throw( NoSuchElementException, WrappedTargetException, RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(m_aFrames.empty())
throw NoSuchElementException();
Any aResult = *m_aFrames.begin();
m_aFrames.pop_front();
return aResult;
}
template<FlyCntType T>
OUString SwXFrameEnumeration<T>::getImplementationName(void) throw( RuntimeException )
{
return C2U("SwXFrameEnumeration");
}
template<FlyCntType T>
sal_Bool SwXFrameEnumeration<T>::supportsService(const OUString& ServiceName) throw( RuntimeException )
{
return C2U("com.sun.star.container.XEnumeration") == ServiceName;
}
template<FlyCntType T>
Sequence< OUString > SwXFrameEnumeration<T>::getSupportedServiceNames(void) throw( RuntimeException )
{
return ::comphelper::makeSequence(C2U("com.sun.star.container.XEnumeration"));
}
/******************************************************************
* SwXFrames
******************************************************************/
OUString SwXFrames::getImplementationName(void) throw( RuntimeException )
{
return C2U("SwXFrames");
}
BOOL SwXFrames::supportsService(const OUString& rServiceName) throw( RuntimeException )
{
return C2U("com.sun.star.text.TextFrames") == rServiceName;
}
Sequence<OUString> SwXFrames::getSupportedServiceNames(void) throw( RuntimeException )
{
return ::comphelper::makeSequence(C2U("com.sun.star.text.TextFrames"));
}
SwXFrames::SwXFrames(SwDoc* _pDoc, FlyCntType eSet) :
SwUnoCollection(_pDoc),
eType(eSet)
{}
SwXFrames::~SwXFrames()
{}
uno::Reference<container::XEnumeration> SwXFrames::createEnumeration(void) throw(uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
switch(eType)
{
case FLYCNTTYPE_FRM:
return uno::Reference< container::XEnumeration >(
new SwXFrameEnumeration<FLYCNTTYPE_FRM>(GetDoc()));
case FLYCNTTYPE_GRF:
return uno::Reference< container::XEnumeration >(
new SwXFrameEnumeration<FLYCNTTYPE_GRF>(GetDoc()));
case FLYCNTTYPE_OLE:
return uno::Reference< container::XEnumeration >(
new SwXFrameEnumeration<FLYCNTTYPE_OLE>(GetDoc()));
default:
throw uno::RuntimeException();
}
}
sal_Int32 SwXFrames::getCount(void) throw(uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
return GetDoc()->GetFlyCount(eType);
}
uno::Any SwXFrames::getByIndex(sal_Int32 nIndex)
throw(IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
if(nIndex < 0 || nIndex >= USHRT_MAX)
throw IndexOutOfBoundsException();
SwFrmFmt* pFmt = GetDoc()->GetFlyNum(static_cast<sal_uInt16>(nIndex), eType);
if(!pFmt)
throw IndexOutOfBoundsException();
return lcl_UnoWrapFrame(pFmt, eType);
}
uno::Any SwXFrames::getByName(const OUString& rName)
throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
const SwFrmFmt* pFmt;
switch(eType)
{
case FLYCNTTYPE_GRF:
pFmt = GetDoc()->FindFlyByName(rName, ND_GRFNODE);
break;
case FLYCNTTYPE_OLE:
pFmt = GetDoc()->FindFlyByName(rName, ND_OLENODE);
break;
default:
pFmt = GetDoc()->FindFlyByName(rName, ND_TEXTNODE);
break;
}
if(!pFmt)
throw NoSuchElementException();
return lcl_UnoWrapFrame(const_cast<SwFrmFmt*>(pFmt), eType);
}
uno::Sequence<OUString> SwXFrames::getElementNames(void) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
const Reference<XEnumeration> xEnum = createEnumeration();
::std::vector<OUString> vNames;
while(xEnum->hasMoreElements())
{
Reference<container::XNamed> xNamed;
xEnum->nextElement() >>= xNamed;
if(xNamed.is())
vNames.push_back(xNamed->getName());
}
return ::comphelper::containerToSequence(vNames);
}
sal_Bool SwXFrames::hasByName(const OUString& rName) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
switch(eType)
{
case FLYCNTTYPE_GRF:
return GetDoc()->FindFlyByName(rName, ND_GRFNODE) != NULL;
case FLYCNTTYPE_OLE:
return GetDoc()->FindFlyByName(rName, ND_OLENODE) != NULL;
default:
return GetDoc()->FindFlyByName(rName, ND_TEXTNODE) != NULL;
}
}
uno::Type SAL_CALL SwXFrames::getElementType() throw(uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
switch(eType)
{
case FLYCNTTYPE_FRM:
return ::getCppuType((uno::Reference<XTextFrame>*)0);
case FLYCNTTYPE_GRF:
return ::getCppuType((uno::Reference<XTextContent>*)0);
case FLYCNTTYPE_OLE:
return ::getCppuType((uno::Reference<XEmbeddedObjectSupplier>*)0);
default:
return uno::Type();
}
}
sal_Bool SwXFrames::hasElements(void) throw(uno::RuntimeException)
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
return GetDoc()->GetFlyCount(eType) > 0;
}
SwXFrame* SwXFrames::GetObject(SwFrmFmt& rFmt, FlyCntType eType)
{
SwXFrame* pFrm = (SwXFrame*)SwClientIter(rFmt).First(TYPE(SwXFrame));
if(pFrm) return pFrm;
switch(eType)
{
case FLYCNTTYPE_FRM:
return new SwXTextFrame(rFmt);
case FLYCNTTYPE_GRF:
return new SwXTextGraphicObject(rFmt);
case FLYCNTTYPE_OLE:
return new SwXTextEmbeddedObject(rFmt);
default:
return NULL;
}
}
/******************************************************************
* SwXTextFrames
******************************************************************/
/* -----------------------------06.04.00 12:44--------------------------------
---------------------------------------------------------------------------*/
OUString SwXTextFrames::getImplementationName(void) throw( RuntimeException )
{
return C2U("SwXTextFrames");
}
/* -----------------------------06.04.00 12:44--------------------------------
---------------------------------------------------------------------------*/
BOOL SwXTextFrames::supportsService(const OUString& rServiceName) throw( RuntimeException )
{
return C2U("com.sun.star.text.TextFrames") == rServiceName;
}
/* -----------------------------06.04.00 12:44--------------------------------
---------------------------------------------------------------------------*/
Sequence< OUString > SwXTextFrames::getSupportedServiceNames(void) throw( RuntimeException )
{
Sequence< OUString > aRet(1);
OUString* pArray = aRet.getArray();
pArray[0] = C2U("com.sun.star.text.TextFrames");
return aRet;
}
/*-- 14.01.99 08:06:16---------------------------------------------------
-----------------------------------------------------------------------*/
SwXTextFrames::SwXTextFrames(SwDoc* _pDoc) :
SwXFrames(_pDoc, FLYCNTTYPE_FRM)
{
}
/*-- 14.01.99 08:06:17---------------------------------------------------
-----------------------------------------------------------------------*/
SwXTextFrames::~SwXTextFrames()
{
}
/******************************************************************
* SwXTextGraphicObjects
******************************************************************/
//SMART_UNO_IMPLEMENTATION( SwXTextGraphicObjects, UsrObject );
/* -----------------------------06.04.00 12:44--------------------------------
---------------------------------------------------------------------------*/
OUString SwXTextGraphicObjects::getImplementationName(void) throw( RuntimeException )
{
return C2U("SwXTextGraphicObjects");
}
/* -----------------------------06.04.00 12:44--------------------------------
---------------------------------------------------------------------------*/
BOOL SwXTextGraphicObjects::supportsService(const OUString& rServiceName) throw( RuntimeException )
{
return C2U("com.sun.star.text.TextGraphicObjects") == rServiceName;
}
/* -----------------------------06.04.00 12:44--------------------------------
---------------------------------------------------------------------------*/
Sequence< OUString > SwXTextGraphicObjects::getSupportedServiceNames(void) throw( RuntimeException )
{
Sequence< OUString > aRet(1);
OUString* pArray = aRet.getArray();
pArray[0] = C2U("com.sun.star.text.TextGraphicObjects");
return aRet;
}
/*-- 14.01.99 08:45:53---------------------------------------------------
-----------------------------------------------------------------------*/
SwXTextGraphicObjects::SwXTextGraphicObjects(SwDoc* _pDoc) :
SwXFrames(_pDoc, FLYCNTTYPE_GRF)
{
}
/*-- 14.01.99 08:45:54---------------------------------------------------
-----------------------------------------------------------------------*/
SwXTextGraphicObjects::~SwXTextGraphicObjects()
{
}
/******************************************************************
* SwXTextEmbeddedObjects
******************************************************************/
/* -----------------------------06.04.00 12:44--------------------------------
---------------------------------------------------------------------------*/
OUString SwXTextEmbeddedObjects::getImplementationName(void) throw( RuntimeException )
{
return C2U("SwXTextEmbeddedObjects");
}
/* -----------------------------06.04.00 12:44--------------------------------
---------------------------------------------------------------------------*/
BOOL SwXTextEmbeddedObjects::supportsService(const OUString& rServiceName) throw( RuntimeException )
{
return C2U("com.sun.star.text.TextEmbeddedObjects") == rServiceName;
}
/* -----------------------------06.04.00 12:44--------------------------------
---------------------------------------------------------------------------*/
Sequence< OUString > SwXTextEmbeddedObjects::getSupportedServiceNames(void) throw( RuntimeException )
{
Sequence< OUString > aRet(1);
OUString* pArray = aRet.getArray();
pArray[0] = C2U("com.sun.star.text.TextEmbeddedObjects");
return aRet;
}
/*-- 14.01.99 08:45:13---------------------------------------------------
-----------------------------------------------------------------------*/
SwXTextEmbeddedObjects::SwXTextEmbeddedObjects(SwDoc* _pDoc) :
SwXFrames(_pDoc, FLYCNTTYPE_OLE)
{
}
/*-- 14.01.99 08:45:31---------------------------------------------------
-----------------------------------------------------------------------*/
SwXTextEmbeddedObjects::~SwXTextEmbeddedObjects()
{
}
/******************************************************************
*
******************************************************************/
#define PASSWORD_STD_TIMEOUT 1000
/* -----------------------------06.04.00 12:44--------------------------------
---------------------------------------------------------------------------*/
OUString SwXTextSections::getImplementationName(void) throw( RuntimeException )
{
return C2U("SwXTextSections");
}
/* -----------------------------06.04.00 12:44--------------------------------
---------------------------------------------------------------------------*/
BOOL SwXTextSections::supportsService(const OUString& rServiceName) throw( RuntimeException )
{
return C2U("com.sun.star.text.TextSections") == rServiceName;
}
/* -----------------------------06.04.00 12:44--------------------------------
---------------------------------------------------------------------------*/
Sequence< OUString > SwXTextSections::getSupportedServiceNames(void) throw( RuntimeException )
{
Sequence< OUString > aRet(1);
OUString* pArray = aRet.getArray();
pArray[0] = C2U("com.sun.star.text.TextSections");
return aRet;
}
/*-- 14.01.99 09:06:05---------------------------------------------------
-----------------------------------------------------------------------*/
SwXTextSections::SwXTextSections(SwDoc* _pDoc) :
SwUnoCollection(_pDoc)
{
}
/*-- 14.01.99 09:06:05---------------------------------------------------
-----------------------------------------------------------------------*/
SwXTextSections::~SwXTextSections()
{
}
/*-- 14.01.99 09:06:05---------------------------------------------------
-----------------------------------------------------------------------*/
sal_Int32 SwXTextSections::getCount(void) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
const SwSectionFmts& rSectFmts = GetDoc()->GetSections();
sal_uInt16 nCount = rSectFmts.Count();
for(sal_uInt16 i = nCount; i; i--)
{
if( !rSectFmts[i - 1]->IsInNodesArr())
nCount--;
}
return nCount;
}
/*-- 14.01.99 09:06:06---------------------------------------------------
-----------------------------------------------------------------------*/
uno::Any SwXTextSections::getByIndex(sal_Int32 nIndex)
throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Reference< XTextSection > xRet;
if(IsValid())
{
SwSectionFmts& rFmts = GetDoc()->GetSections();
const SwSectionFmts& rSectFmts = GetDoc()->GetSections();
sal_uInt16 nCount = rSectFmts.Count();
for(sal_uInt16 i = 0; i < nCount; i++)
{
if( !rSectFmts[i]->IsInNodesArr())
nIndex ++;
else if(nIndex == i)
break;
if(nIndex == i)
break;
}
if(nIndex >= 0 && nIndex < rFmts.Count())
{
SwSectionFmt* pFmt = rFmts[(sal_uInt16)nIndex];
xRet = GetObject(*pFmt);
}
else
throw IndexOutOfBoundsException();
}
else
throw uno::RuntimeException();
return makeAny(xRet);
}
/*-- 14.01.99 09:06:06---------------------------------------------------
-----------------------------------------------------------------------*/
uno::Any SwXTextSections::getByName(const OUString& Name)
throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Any aRet;
if(IsValid())
{
String aName(Name);
SwSectionFmts& rFmts = GetDoc()->GetSections();
uno::Reference< XTextSection > xSect;
for(sal_uInt16 i = 0; i < rFmts.Count(); i++)
{
SwSectionFmt* pFmt = rFmts[i];
if(pFmt->IsInNodesArr() && aName == pFmt->GetSection()->GetName())
{
xSect = GetObject(*pFmt);
aRet.setValue(&xSect, ::getCppuType((uno::Reference<XTextSection>*)0));
break;
}
}
if(!xSect.is())
throw NoSuchElementException();
}
else
throw uno::RuntimeException();
return aRet;
}
/*-- 14.01.99 09:06:06---------------------------------------------------
-----------------------------------------------------------------------*/
uno::Sequence< OUString > SwXTextSections::getElementNames(void)
throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
sal_uInt16 nCount = GetDoc()->GetSections().Count();
SwSectionFmts& rSectFmts = GetDoc()->GetSections();
for(sal_uInt16 i = nCount; i; i--)
{
if( !rSectFmts[i - 1]->IsInNodesArr())
nCount--;
}
uno::Sequence<OUString> aSeq(nCount);
if(nCount)
{
SwSectionFmts& rFmts = GetDoc()->GetSections();
OUString* pArray = aSeq.getArray();
sal_uInt16 nIndex = 0;
for( sal_uInt16 i = 0; i < nCount; i++, nIndex++)
{
const SwSectionFmt* pFmt = rFmts[nIndex];
while(!pFmt->IsInNodesArr())
{
pFmt = rFmts[++nIndex];
}
pArray[i] = pFmt->GetSection()->GetName();
}
}
return aSeq;
}
/*-- 14.01.99 09:06:06---------------------------------------------------
-----------------------------------------------------------------------*/
sal_Bool SwXTextSections::hasByName(const OUString& Name)
throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
sal_Bool bRet = sal_False;
String aName(Name);
if(IsValid())
{
SwSectionFmts& rFmts = GetDoc()->GetSections();
for(sal_uInt16 i = 0; i < rFmts.Count(); i++)
{
const SwSectionFmt* pFmt = rFmts[i];
if(aName == pFmt->GetSection()->GetName())
{
bRet = sal_True;
break;
}
}
}
else
{
//Sonderbehandlung der dbg_ - Methoden
if( COMPARE_EQUAL != aName.CompareToAscii("dbg_", 4))
throw uno::RuntimeException();
}
return bRet;
}
/*-- 14.01.99 09:06:06---------------------------------------------------
-----------------------------------------------------------------------*/
uno::Type SAL_CALL SwXTextSections::getElementType() throw(uno::RuntimeException)
{
return ::getCppuType((uno::Reference<XTextSection>*)0);
}
/*-- 14.01.99 09:06:06---------------------------------------------------
-----------------------------------------------------------------------*/
sal_Bool SwXTextSections::hasElements(void) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
sal_uInt16 nCount = 0;
if(IsValid())
{
SwSectionFmts& rFmts = GetDoc()->GetSections();
nCount = rFmts.Count();
}
else
throw uno::RuntimeException();
return nCount > 0;
}
/*-- 14.01.99 09:06:07---------------------------------------------------
-----------------------------------------------------------------------*/
uno::Reference< XTextSection > SwXTextSections::GetObject( SwSectionFmt& rFmt )
{
return SwXTextSection::CreateXTextSection(&rFmt);
}
OUString SwXBookmarks::getImplementationName(void) throw( RuntimeException )
{
return OUString::createFromAscii("SwXBookmarks");
}
BOOL SwXBookmarks::supportsService(const OUString& rServiceName) throw( RuntimeException )
{
return OUString::createFromAscii("com.sun.star.text.Bookmarks") == rServiceName;
}
Sequence< OUString > SwXBookmarks::getSupportedServiceNames(void) throw( RuntimeException )
{
Sequence< OUString > aRet(1);
aRet[0] = OUString::createFromAscii("com.sun.star.text.Bookmarks");
return aRet;
}
SwXBookmarks::SwXBookmarks(SwDoc* _pDoc) :
SwUnoCollection(_pDoc)
{ }
SwXBookmarks::~SwXBookmarks()
{ }
sal_Int32 SwXBookmarks::getCount(void)
throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
return GetDoc()->getIDocumentMarkAccess()->getBookmarksCount();
}
uno::Any SwXBookmarks::getByIndex(sal_Int32 nIndex)
throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
if(nIndex < 0 || nIndex >= pMarkAccess->getBookmarksCount())
throw IndexOutOfBoundsException();
uno::Any aRet;
::sw::mark::IMark* pBkmk = pMarkAccess->getBookmarksBegin()[nIndex].get();
const uno::Reference< text::XTextContent > xRef =
SwXBookmark::CreateXBookmark(*GetDoc(), *pBkmk);
aRet <<= xRef;
return aRet;
}
uno::Any SwXBookmarks::getByName(const rtl::OUString& rName)
throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findBookmark(rName);
if(ppBkmk == pMarkAccess->getBookmarksEnd())
throw NoSuchElementException();
uno::Any aRet;
const uno::Reference< text::XTextContent > xRef =
SwXBookmark::CreateXBookmark(*GetDoc(), *(ppBkmk->get()));
aRet <<= xRef;
return aRet;
}
uno::Sequence< OUString > SwXBookmarks::getElementNames(void)
throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
uno::Sequence<OUString> aSeq(pMarkAccess->getBookmarksCount());
sal_Int32 nCnt = 0;
for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getBookmarksBegin();
ppMark != pMarkAccess->getBookmarksEnd();)
aSeq[nCnt++] = (*ppMark++)->GetName();
return aSeq;
}
sal_Bool SwXBookmarks::hasByName(const OUString& rName)
throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess();
return pMarkAccess->findBookmark(rName) != pMarkAccess->getBookmarksEnd();
}
uno::Type SAL_CALL SwXBookmarks::getElementType()
throw(uno::RuntimeException)
{
return ::getCppuType((uno::Reference<XTextContent>*)0);
}
sal_Bool SwXBookmarks::hasElements(void)
throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
return GetDoc()->getIDocumentMarkAccess()->getBookmarksCount() != 0;
}
/******************************************************************
*
******************************************************************/
SwXNumberingRulesCollection::SwXNumberingRulesCollection( SwDoc* _pDoc ) :
SwUnoCollection(_pDoc)
{
}
SwXNumberingRulesCollection::~SwXNumberingRulesCollection()
{
}
sal_Int32 SwXNumberingRulesCollection::getCount(void) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
return GetDoc()->GetNumRuleTbl().Count();
}
uno::Any SwXNumberingRulesCollection::getByIndex(sal_Int32 nIndex)
throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Any aRet;
if(IsValid())
{
uno::Reference< XIndexReplace > xRef;
if ( nIndex < GetDoc()->GetNumRuleTbl().Count() )
{
xRef = new SwXNumberingRules( *GetDoc()->GetNumRuleTbl()[ static_cast< USHORT >(nIndex) ] );
aRet.setValue(&xRef, ::getCppuType((uno::Reference<XIndexReplace>*)0));
}
if(!xRef.is())
throw IndexOutOfBoundsException();
}
else
throw uno::RuntimeException();
return aRet;
}
uno::Type SAL_CALL SwXNumberingRulesCollection::getElementType() throw(uno::RuntimeException)
{
return ::getCppuType((uno::Reference<XIndexReplace>*)0);
}
sal_Bool SwXNumberingRulesCollection::hasElements(void) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
return GetDoc()->GetNumRuleTbl().Count() > 0;
}
/* -----------------------------06.04.00 12:44--------------------------------
---------------------------------------------------------------------------*/
OUString SwXFootnotes::getImplementationName(void) throw( RuntimeException )
{
return C2U("SwXFootnotes");
}
/* -----------------------------06.04.00 12:44--------------------------------
---------------------------------------------------------------------------*/
BOOL SwXFootnotes::supportsService(const OUString& rServiceName) throw( RuntimeException )
{
return C2U("com.sun.star.text.Footnotes") == rServiceName;
}
/* -----------------------------06.04.00 12:44--------------------------------
---------------------------------------------------------------------------*/
Sequence< OUString > SwXFootnotes::getSupportedServiceNames(void) throw( RuntimeException )
{
Sequence< OUString > aRet(1);
OUString* pArray = aRet.getArray();
pArray[0] = C2U("com.sun.star.text.Footnotes");
return aRet;
}
/*-- 14.01.99 09:03:52---------------------------------------------------
-----------------------------------------------------------------------*/
SwXFootnotes::SwXFootnotes(sal_Bool bEnd, SwDoc* _pDoc)
: SwUnoCollection(_pDoc)
, m_bEndnote(bEnd)
{
}
/*-- 14.01.99 09:03:52---------------------------------------------------
-----------------------------------------------------------------------*/
SwXFootnotes::~SwXFootnotes()
{
}
/*-- 14.01.99 09:03:53---------------------------------------------------
-----------------------------------------------------------------------*/
sal_Int32 SwXFootnotes::getCount(void) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
sal_Int32 nCount = 0;
sal_uInt16 n, nFtnCnt = GetDoc()->GetFtnIdxs().Count();
SwTxtFtn* pTxtFtn;
for( n = 0; n < nFtnCnt; ++n )
{
pTxtFtn = GetDoc()->GetFtnIdxs()[ n ];
const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
if ( rFtn.IsEndNote() != m_bEndnote )
continue;
nCount++;
}
return nCount;
}
/*-- 14.01.99 09:03:53---------------------------------------------------
-----------------------------------------------------------------------*/
uno::Any SwXFootnotes::getByIndex(sal_Int32 nIndex)
throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Any aRet;
sal_Int32 nCount = 0;
if(IsValid())
{
sal_uInt16 n, nFtnCnt = GetDoc()->GetFtnIdxs().Count();
SwTxtFtn* pTxtFtn;
uno::Reference< XFootnote > xRef;
for( n = 0; n < nFtnCnt; ++n )
{
pTxtFtn = GetDoc()->GetFtnIdxs()[ n ];
const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
if ( rFtn.IsEndNote() != m_bEndnote )
continue;
if(nCount == nIndex)
{
xRef = SwXFootnote::CreateXFootnote(*GetDoc(), rFtn);
aRet <<= xRef;
break;
}
nCount++;
}
if(!xRef.is())
throw IndexOutOfBoundsException();
}
else
throw uno::RuntimeException();
return aRet;
}
/*-- 14.01.99 09:03:53---------------------------------------------------
-----------------------------------------------------------------------*/
uno::Type SAL_CALL SwXFootnotes::getElementType() throw(uno::RuntimeException)
{
return ::getCppuType((uno::Reference<XFootnote>*)0);
}
/*-- 14.01.99 09:03:54---------------------------------------------------
-----------------------------------------------------------------------*/
sal_Bool SwXFootnotes::hasElements(void) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
return GetDoc()->GetFtnIdxs().Count() > 0;
}
/* -----------------------------05.09.00 12:48--------------------------------
---------------------------------------------------------------------------*/
Reference<XFootnote> SwXFootnotes::GetObject( SwDoc& rDoc, const SwFmtFtn& rFmt )
{
return SwXFootnote::CreateXFootnote(rDoc, rFmt);
}
/******************************************************************
*
******************************************************************/
/* -----------------------------06.04.00 12:44--------------------------------
---------------------------------------------------------------------------*/
OUString SwXReferenceMarks::getImplementationName(void) throw( RuntimeException )
{
return C2U("SwXReferenceMarks");
}
/* -----------------------------06.04.00 12:44--------------------------------
---------------------------------------------------------------------------*/
BOOL SwXReferenceMarks::supportsService(const OUString& rServiceName) throw( RuntimeException )
{
return C2U("com.sun.star.text.ReferenceMarks") == rServiceName;
}
/* -----------------------------06.04.00 12:44--------------------------------
---------------------------------------------------------------------------*/
Sequence< OUString > SwXReferenceMarks::getSupportedServiceNames(void) throw( RuntimeException )
{
Sequence< OUString > aRet(1);
OUString* pArray = aRet.getArray();
pArray[0] = C2U("com.sun.star.text.ReferenceMarks");
return aRet;
}
/*-- 14.01.99 09:03:16---------------------------------------------------
-----------------------------------------------------------------------*/
SwXReferenceMarks::SwXReferenceMarks(SwDoc* _pDoc) :
SwUnoCollection(_pDoc)
{
}
/*-- 14.01.99 09:03:16---------------------------------------------------
-----------------------------------------------------------------------*/
SwXReferenceMarks::~SwXReferenceMarks()
{
}
/*-- 14.01.99 09:03:17---------------------------------------------------
-----------------------------------------------------------------------*/
sal_Int32 SwXReferenceMarks::getCount(void) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
return GetDoc()->GetRefMarks();
}
/*-- 14.01.99 09:03:17---------------------------------------------------
-----------------------------------------------------------------------*/
uno::Any SwXReferenceMarks::getByIndex(sal_Int32 nIndex)
throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Any aRet;
if(!IsValid())
throw uno::RuntimeException();
uno::Reference< XTextContent > xRef;
if(0 <= nIndex && nIndex < USHRT_MAX)
{
const SwFmtRefMark* pMark = GetDoc()->GetRefMark( (sal_uInt16) nIndex );
if(pMark)
{
xRef = SwXReferenceMarks::GetObject( GetDoc(), pMark );
aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0));
}
}
if(!xRef.is())
throw IndexOutOfBoundsException();
return aRet;
}
/*-- 14.01.99 09:03:17---------------------------------------------------
-----------------------------------------------------------------------*/
uno::Any SwXReferenceMarks::getByName(const OUString& rName)
throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Any aRet;
if(IsValid())
{
const SwFmtRefMark* pMark = GetDoc()->GetRefMark(rName);
if(pMark)
{
uno::Reference< XTextContent > xRef = SwXReferenceMarks::GetObject( GetDoc(), pMark );
aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0));
}
else
throw NoSuchElementException();
}
else
throw uno::RuntimeException();
return aRet;
}
/*-- 14.01.99 09:03:17---------------------------------------------------
-----------------------------------------------------------------------*/
uno::Sequence< OUString > SwXReferenceMarks::getElementNames(void) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
uno::Sequence<OUString> aRet;
if(IsValid())
{
SvStringsDtor aStrings;
sal_uInt16 nCount = GetDoc()->GetRefMarks( &aStrings );
aRet.realloc(nCount);
OUString* pNames = aRet.getArray();
for(sal_uInt16 i = 0; i < nCount; i++)
pNames[i] = *aStrings.GetObject(i);
}
else
throw uno::RuntimeException();
return aRet;
}
/*-- 14.01.99 09:03:17---------------------------------------------------
-----------------------------------------------------------------------*/
sal_Bool SwXReferenceMarks::hasByName(const OUString& rName) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
return 0 != GetDoc()->GetRefMark( rName);
}
/*-- 14.01.99 09:03:18---------------------------------------------------
-----------------------------------------------------------------------*/
uno::Type SAL_CALL SwXReferenceMarks::getElementType() throw(uno::RuntimeException)
{
return ::getCppuType((uno::Reference<XTextContent>*)0);
}
/*-- 14.01.99 09:03:18---------------------------------------------------
-----------------------------------------------------------------------*/
sal_Bool SwXReferenceMarks::hasElements(void) throw( uno::RuntimeException )
{
vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw uno::RuntimeException();
return 0 != GetDoc()->GetRefMarks();
}
/*-- 14.01.99 09:03:19---------------------------------------------------
-----------------------------------------------------------------------*/
SwXReferenceMark* SwXReferenceMarks::GetObject( SwDoc* pDoc, const SwFmtRefMark* pMark )
{
vos::OGuard aGuard(Application::GetSolarMutex());
return SwXReferenceMark::CreateXReferenceMark(*pDoc, *pMark);
}
/******************************************************************
*
******************************************************************/
/*-----------------11.03.98 11:18-------------------
Gueltigkeitspruefung
--------------------------------------------------*/
void SwUnoCollection::Invalidate()
{
bObjectValid = sal_False;
pDoc = 0;
}
|