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
|
/* -*- 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 <osl/mutex.hxx>
#include <sfx2/sfxbasecontroller.hxx>
#include <SwXDocumentSettings.hxx>
#include <comphelper/MasterPropertySetInfo.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
#include <com/sun/star/document/PrinterIndependentLayout.hpp>
#include <doc.hxx>
#include <IDocumentSettingAccess.hxx>
#include <IDocumentDeviceAccess.hxx>
#include <IDocumentRedlineAccess.hxx>
#include <docsh.hxx>
#include <fldupde.hxx>
#include <linkenum.hxx>
#include <sfx2/printer.hxx>
#include <editsh.hxx>
#include <drawdoc.hxx>
#include <svl/zforlist.hxx>
#include <unotxdoc.hxx>
#include <cmdid.h>
#include <sfx2/zoomitem.hxx>
#include <unomod.hxx>
#include <vcl/svapp.hxx>
#include <comphelper/servicehelper.hxx>
#include "swmodule.hxx"
#include "cfgitems.hxx"
#include "prtopt.hxx"
#include "dbmgr.hxx"
using namespace comphelper;
using namespace ::com::sun::star;
using namespace css::uno;
using namespace css::beans;
using namespace css::lang;
using namespace css::i18n;
enum SwDocumentSettingsPropertyHandles
{
HANDLE_FORBIDDEN_CHARS,
HANDLE_LINK_UPDATE_MODE,
HANDLE_FIELD_AUTO_UPDATE,
HANDLE_CHART_AUTO_UPDATE,
HANDLE_ADD_PARA_TABLE_SPACING,
HANDLE_ADD_PARA_TABLE_SPACING_AT_START,
HANDLE_ALIGN_TAB_STOP_POSITION,
HANDLE_PRINTER_NAME,
HANDLE_PRINTER_SETUP,
HANDLE_IS_KERN_ASIAN_PUNCTUATION,
HANDLE_CHARACTER_COMPRESSION_TYPE,
HANDLE_APPLY_USER_DATA,
HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS,
HANDLE_CURRENT_DATABASE_DATA_SOURCE,
HANDLE_CURRENT_DATABASE_COMMAND,
HANDLE_CURRENT_DATABASE_COMMAND_TYPE,
HANDLE_EMBEDDED_DATABASE_NAME,
HANDLE_SAVE_VERSION_ON_CLOSE,
HANDLE_IS_GRID_VISIBLE,
HANDLE_IS_SNAP_TO_GRID,
HANDLE_IS_SYNCHRONISE_AXES,
HANDLE_HORIZONTAL_GRID_RESOLUTION,
HANDLE_HORIZONTAL_GRID_SUBDIVISION,
HANDLE_VERTICAL_GRID_RESOLUTION,
HANDLE_VERTICAL_GRID_SUBDIVISION,
HANDLE_UPDATE_FROM_TEMPLATE,
HANDLE_PRINTER_INDEPENDENT_LAYOUT,
HANDLE_IS_LABEL_DOC,
HANDLE_IS_ADD_FLY_OFFSET,
HANDLE_IS_ADD_EXTERNAL_LEADING,
HANDLE_OLD_NUMBERING,
HANDLE_OUTLINELEVEL_YIELDS_NUMBERING,
/* Stampit It disable the print cancel button of the shown progress dialog. */
HANDLE_ALLOW_PRINTJOB_CANCEL,
HANDLE_USE_FORMER_LINE_SPACING,
HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS,
HANDLE_USE_FORMER_OBJECT_POSITIONING,
HANDLE_USE_FORMER_TEXT_WRAPPING,
HANDLE_CHANGES_PASSWORD,
HANDLE_CONSIDER_WRAP_ON_OBJPOS,
HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING,
HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK,
HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT,
HANDLE_TABLE_ROW_KEEP,
HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION,
HANDLE_LOAD_READONLY,
HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE,
HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES,
HANDLE_UNIX_FORCE_ZERO_EXT_LEADING,
HANDLE_USE_OLD_PRINTER_METRICS,
HANDLE_PROTECT_FORM,
HANDLE_TABS_RELATIVE_TO_INDENT,
HANDLE_RSID,
HANDLE_RSID_ROOT,
HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST,
HANDLE_MODIFYPASSWORDINFO,
HANDLE_MATH_BASELINE_ALIGNMENT,
HANDLE_INVERT_BORDER_SPACING,
HANDLE_COLLAPSE_EMPTY_CELL_PARA,
HANDLE_SMALL_CAPS_PERCENTAGE_66,
HANDLE_TAB_OVERFLOW,
HANDLE_UNBREAKABLE_NUMBERINGS,
HANDLE_STYLES_NODEFAULT,
HANDLE_FLOATTABLE_NOMARGINS,
HANDLE_CLIPPED_PICTURES,
HANDLE_BACKGROUND_PARA_OVER_DRAWINGS,
HANDLE_EMBED_FONTS,
HANDLE_EMBED_SYSTEM_FONTS,
HANDLE_TAB_OVER_MARGIN,
HANDLE_SURROUND_TEXT_WRAP_SMALL,
HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING,
HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE,
HANDLE_SUBTRACT_FLYS,
};
static MasterPropertySetInfo * lcl_createSettingsInfo()
{
static PropertyInfo const aWriterSettingsInfoMap[] =
{
{ OUString("ForbiddenCharacters"), HANDLE_FORBIDDEN_CHARS, cppu::UnoType<css::i18n::XForbiddenCharacters>::get(), 0, 0},
{ OUString("LinkUpdateMode"), HANDLE_LINK_UPDATE_MODE, cppu::UnoType<sal_Int16>::get(), 0, 0},
{ OUString("FieldAutoUpdate"), HANDLE_FIELD_AUTO_UPDATE, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("ChartAutoUpdate"), HANDLE_CHART_AUTO_UPDATE, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("AddParaTableSpacing"), HANDLE_ADD_PARA_TABLE_SPACING, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("AddParaTableSpacingAtStart"), HANDLE_ADD_PARA_TABLE_SPACING_AT_START, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("AlignTabStopPosition"), HANDLE_ALIGN_TAB_STOP_POSITION, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("PrinterName"), HANDLE_PRINTER_NAME, cppu::UnoType<OUString>::get(), 0, 0},
{ OUString("PrinterSetup"), HANDLE_PRINTER_SETUP, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0, 0},
{ OUString("IsKernAsianPunctuation"), HANDLE_IS_KERN_ASIAN_PUNCTUATION, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("CharacterCompressionType"), HANDLE_CHARACTER_COMPRESSION_TYPE, cppu::UnoType<sal_Int16>::get(), 0, 0},
{ OUString("ApplyUserData"), HANDLE_APPLY_USER_DATA, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("SaveGlobalDocumentLinks"), HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("CurrentDatabaseDataSource"), HANDLE_CURRENT_DATABASE_DATA_SOURCE, cppu::UnoType<OUString>::get(), 0, 0},
{ OUString("CurrentDatabaseCommand"), HANDLE_CURRENT_DATABASE_COMMAND, cppu::UnoType<OUString>::get(), 0, 0},
{ OUString("CurrentDatabaseCommandType"), HANDLE_CURRENT_DATABASE_COMMAND_TYPE, cppu::UnoType<sal_Int32>::get(), 0, 0},
{ OUString("EmbeddedDatabaseName"), HANDLE_EMBEDDED_DATABASE_NAME, cppu::UnoType<OUString>::get(), 0, 0},
{ OUString("SaveVersionOnClose"), HANDLE_SAVE_VERSION_ON_CLOSE, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("UpdateFromTemplate"), HANDLE_UPDATE_FROM_TEMPLATE, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("PrinterIndependentLayout"), HANDLE_PRINTER_INDEPENDENT_LAYOUT, cppu::UnoType<sal_Int16>::get(), 0, 0},
{ OUString("IsLabelDocument"), HANDLE_IS_LABEL_DOC, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("AddFrameOffsets"), HANDLE_IS_ADD_FLY_OFFSET, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("AddExternalLeading"), HANDLE_IS_ADD_EXTERNAL_LEADING, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("UseOldNumbering"), HANDLE_OLD_NUMBERING, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("OutlineLevelYieldsNumbering"), HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, cppu::UnoType<bool>::get(), 0, 0},
/* Stampit It disable the print cancel button of the shown progress dialog. */
{ OUString("AllowPrintJobCancel"), HANDLE_ALLOW_PRINTJOB_CANCEL, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("UseFormerLineSpacing"), HANDLE_USE_FORMER_LINE_SPACING, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("AddParaSpacingToTableCells"), HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("UseFormerObjectPositioning"), HANDLE_USE_FORMER_OBJECT_POSITIONING, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("UseFormerTextWrapping"), HANDLE_USE_FORMER_TEXT_WRAPPING, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("RedlineProtectionKey"), HANDLE_CHANGES_PASSWORD, cppu::UnoType< cppu::UnoSequenceType<sal_Int8> >::get(), 0, 0},
{ OUString("ConsiderTextWrapOnObjPos"), HANDLE_CONSIDER_WRAP_ON_OBJPOS, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("IgnoreFirstLineIndentInNumbering"), HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("DoNotJustifyLinesWithManualBreak"), HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("DoNotResetParaAttrsForNumFont"), HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("TableRowKeep"), HANDLE_TABLE_ROW_KEEP, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("IgnoreTabsAndBlanksForLineCalculation"), HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("LoadReadonly"), HANDLE_LOAD_READONLY, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("DoNotCaptureDrawObjsOnPage"), HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("ClipAsCharacterAnchoredWriterFlyFrames"), HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("UnxForceZeroExtLeading"), HANDLE_UNIX_FORCE_ZERO_EXT_LEADING, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("UseOldPrinterMetrics"), HANDLE_USE_OLD_PRINTER_METRICS, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("TabsRelativeToIndent"), HANDLE_TABS_RELATIVE_TO_INDENT, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("Rsid"), HANDLE_RSID, cppu::UnoType<sal_Int32>::get(), 0, 0},
{ OUString("RsidRoot"), HANDLE_RSID_ROOT, cppu::UnoType<sal_Int32>::get(), 0, 0},
{ OUString("ProtectForm"), HANDLE_PROTECT_FORM, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("TabAtLeftIndentForParagraphsInList"), HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("ModifyPasswordInfo"), HANDLE_MODIFYPASSWORDINFO, cppu::UnoType< cppu::UnoSequenceType<css::beans::PropertyValue> >::get(), 0, 0},
{ OUString("MathBaselineAlignment"), HANDLE_MATH_BASELINE_ALIGNMENT, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("InvertBorderSpacing"), HANDLE_INVERT_BORDER_SPACING, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("CollapseEmptyCellPara"), HANDLE_COLLAPSE_EMPTY_CELL_PARA, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("SmallCapsPercentage66"), HANDLE_SMALL_CAPS_PERCENTAGE_66, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("TabOverflow"), HANDLE_TAB_OVERFLOW, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("UnbreakableNumberings"), HANDLE_UNBREAKABLE_NUMBERINGS, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("StylesNoDefault"), HANDLE_STYLES_NODEFAULT, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("FloattableNomargins"), HANDLE_FLOATTABLE_NOMARGINS, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("ClippedPictures"), HANDLE_CLIPPED_PICTURES, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("BackgroundParaOverDrawings"), HANDLE_BACKGROUND_PARA_OVER_DRAWINGS, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("EmbedFonts"), HANDLE_EMBED_FONTS, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("EmbedSystemFonts"), HANDLE_EMBED_SYSTEM_FONTS, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("TabOverMargin"), HANDLE_TAB_OVER_MARGIN, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("SurroundTextWrapSmall"), HANDLE_SURROUND_TEXT_WRAP_SMALL, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("ApplyParagraphMarkFormatToNumbering"), HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("PropLineSpacingShrinksFirstLine"), HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("SubtractFlysAnchoredAtFlys"), HANDLE_SUBTRACT_FLYS, cppu::UnoType<bool>::get(), 0, 0},
/*
* As OS said, we don't have a view when we need to set this, so I have to
* find another solution before adding them to this property set - MTG
{ OUString("IsGridVisible"), HANDLE_IS_GRID_VISIBLE, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("IsSnapToGrid"), HANDLE_IS_SNAP_TO_GRID, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("IsSynchroniseAxes"), HANDLE_IS_SYNCHRONISE_AXES, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("HorizontalGridResolution"), HANDLE_HORIZONTAL_GRID_RESOLUTION, cppu::UnoType<sal_Int32>::get(), 0, 0},
{ OUString("HorizontalGridSubdivision"), HANDLE_HORIZONTAL_GRID_SUBDIVISION, cppu::UnoType<sal_Int16>::get(), 0, 0},
{ OUString("VerticalGridResolution"), HANDLE_VERTICAL_GRID_RESOLUTION, cppu::UnoType<sal_Int32>::get(), 0, 0},
{ OUString("VerticalGridSubdivision"), HANDLE_VERTICAL_GRID_SUBDIVISION, cppu::UnoType<sal_Int16>::get(), 0, 0},
{ OUString("ShowParagraphEnd"), HANDLE_SHOW_PARAGRAPH_END, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("ShowOptionalHyphens"), HANDLE_SHOW_OPTIONAL_HYPHENS, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("ShowSpaces"), HANDLE_SHOW_SPACES, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("ShowTabs"), HANDLE_SHOW_TABS, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("ShowBreaks"), HANDLE_SHOW_BREAKS, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("ShowHiddenText"), HANDLE_SHOW_HIDDEN_TEXT, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("ShowHiddenParagraphs"), HANDLE_SHOW_HIDDEN_PARAGRAPHS, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("ShowTextLimitGuide"), HANDLE_SHOW_TEXT_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("ShowTableLimitGuide"), HANDLE_SHOW_TABLE_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("ShowSectionLimitGuide"), HANDLE_SHOW_SECTION_LIMIT_GUIDE, cppu::UnoType<bool>::get(), 0, 0},
{ OUString("ShowGuidesWhileMoving"), HANDLE_SHOW_GUIDES_WHILE_MOVING, cppu::UnoType<bool>::get(), 0, 0},
*/
{ OUString(), 0, css::uno::Type(), 0, 0 }
};
return new MasterPropertySetInfo ( aWriterSettingsInfoMap );
}
SwXDocumentSettings::SwXDocumentSettings ( SwXTextDocument * pModel )
: MasterPropertySet ( lcl_createSettingsInfo (),
&Application::GetSolarMutex () )
, mxModel ( pModel )
, mpModel ( pModel )
, mpDocSh ( NULL )
, mpDoc ( NULL )
, mpPrinter( NULL )
{
registerSlave ( new SwXPrintSettings ( PRINT_SETTINGS_DOCUMENT, mpModel->GetDocShell()->GetDoc() ) );
}
SwXDocumentSettings::~SwXDocumentSettings()
throw()
{
}
Any SAL_CALL SwXDocumentSettings::queryInterface( const Type& rType )
throw(RuntimeException, std::exception)
{
return ::cppu::queryInterface ( rType,
// OWeakObject interfaces
dynamic_cast< XInterface* > ( dynamic_cast< OWeakObject* >(this) ),
dynamic_cast< XWeak* > ( this ),
// my own interfaces
dynamic_cast< XPropertySet* > ( this ),
dynamic_cast< XPropertyState* > ( this ),
dynamic_cast< XMultiPropertySet* > ( this ),
dynamic_cast< XServiceInfo* > ( this ),
dynamic_cast< XTypeProvider* > ( this ) );
}
void SwXDocumentSettings::acquire ()
throw ()
{
OWeakObject::acquire();
}
void SwXDocumentSettings::release ()
throw ()
{
OWeakObject::release();
}
uno::Sequence< uno::Type > SAL_CALL SwXDocumentSettings::getTypes( )
throw (RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
uno::Sequence< uno::Type > aBaseTypes( 5 );
uno::Type* pBaseTypes = aBaseTypes.getArray();
// from MasterPropertySet
pBaseTypes[0] = cppu::UnoType<XPropertySet>::get();
pBaseTypes[1] = cppu::UnoType<XPropertyState>::get();
pBaseTypes[2] = cppu::UnoType<XMultiPropertySet>::get();
pBaseTypes[3] = cppu::UnoType<XServiceInfo>::get();
pBaseTypes[4] = cppu::UnoType<XTypeProvider>::get();
return aBaseTypes;
}
uno::Sequence< sal_Int8 > SAL_CALL SwXDocumentSettings::getImplementationId( )
throw (RuntimeException, std::exception)
{
return css::uno::Sequence<sal_Int8>();
}
void SwXDocumentSettings::_preSetValues ()
throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
{
mpDocSh = mpModel->GetDocShell();
if (NULL == mpDocSh)
throw UnknownPropertyException();
mpDoc = mpDocSh->GetDoc();
if (NULL == mpDoc)
throw UnknownPropertyException();
}
void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, const uno::Any &rValue )
throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
{
if (rInfo.mnAttributes & PropertyAttribute::READONLY)
throw PropertyVetoException ("Property is read-only: " + rInfo.maName, static_cast < cppu::OWeakObject * > ( 0 ) );
switch( rInfo.mnHandle )
{
case HANDLE_FORBIDDEN_CHARS:
break;
case HANDLE_LINK_UPDATE_MODE:
{
sal_Int16 nMode = 0;
rValue >>= nMode;
switch (nMode)
{
case NEVER:
case MANUAL:
case AUTOMATIC:
case GLOBALSETTING:
break;
default:
throw IllegalArgumentException();
}
mpDoc->getIDocumentSettingAccess().setLinkUpdateMode(nMode);
}
break;
case HANDLE_FIELD_AUTO_UPDATE:
{
bool bUpdateField = *static_cast<sal_Bool const *>(rValue.getValue());
SwFieldUpdateFlags nFlag = mpDoc->getIDocumentSettingAccess().getFieldUpdateFlags(true);
mpDoc->getIDocumentSettingAccess().setFieldUpdateFlags( bUpdateField ?
nFlag == AUTOUPD_FIELD_AND_CHARTS ?
AUTOUPD_FIELD_AND_CHARTS :
AUTOUPD_FIELD_ONLY :
AUTOUPD_OFF );
}
break;
case HANDLE_CHART_AUTO_UPDATE:
{
bool bUpdateChart = *static_cast<sal_Bool const *>(rValue.getValue());
SwFieldUpdateFlags nFlag = mpDoc->getIDocumentSettingAccess().getFieldUpdateFlags(true);
mpDoc->getIDocumentSettingAccess().setFieldUpdateFlags( (nFlag == AUTOUPD_FIELD_ONLY || nFlag == AUTOUPD_FIELD_AND_CHARTS ) ?
bUpdateChart ?
AUTOUPD_FIELD_AND_CHARTS :
AUTOUPD_FIELD_ONLY :
AUTOUPD_OFF );
}
break;
case HANDLE_ADD_PARA_TABLE_SPACING:
{
bool bParaSpace = false;
rValue >>= bParaSpace;
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::PARA_SPACE_MAX, bParaSpace );
}
break;
case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
{
bool bParaSpacePage = false;
rValue >>= bParaSpacePage;
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES, bParaSpacePage );
}
break;
case HANDLE_ALIGN_TAB_STOP_POSITION:
{
bool bAlignTab = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TAB_COMPAT, bAlignTab);
}
break;
case HANDLE_PRINTER_NAME:
{
//the printer must be created
OUString sPrinterName;
if( rValue >>= sPrinterName )
{
if( !mpPrinter && !sPrinterName.isEmpty() && mpDocSh->GetCreateMode() != SfxObjectCreateMode::EMBEDDED )
{
SfxPrinter* pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( true );
if ( OUString ( pPrinter->GetName()) != sPrinterName )
{
VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
assert (! pNewPrinter->isDisposed() );
if( pNewPrinter->IsKnown() )
{
// set printer only once; in _postSetValues
mpPrinter = pNewPrinter;
}
else
{
pNewPrinter.disposeAndClear();
}
}
}
}
else
throw IllegalArgumentException();
}
break;
case HANDLE_PRINTER_SETUP:
{
Sequence < sal_Int8 > aSequence;
if ( rValue >>= aSequence )
{
sal_uInt32 nSize = aSequence.getLength();
if( nSize > 0 )
{
SvMemoryStream aStream (aSequence.getArray(), nSize,
StreamMode::READ );
aStream.Seek ( STREAM_SEEK_TO_BEGIN );
static sal_uInt16 const nRange[] =
{
FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
SID_HTML_MODE, SID_HTML_MODE,
SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
0
};
SfxItemSet *pItemSet = new SfxItemSet( mpDoc->GetAttrPool(), nRange );
VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, pItemSet );
assert (! pPrinter->isDisposed() );
// set printer only once; in _postSetValues
mpPrinter.disposeAndClear();
mpPrinter = pPrinter;
}
}
else
throw IllegalArgumentException();
}
break;
case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
{
bool bIsKern = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::KERN_ASIAN_PUNCTUATION, bIsKern);
SwEditShell* pEditSh = mpDoc->GetEditShell();
if(pEditSh)
pEditSh->ChgHyphenation();
}
break;
case HANDLE_CHARACTER_COMPRESSION_TYPE:
{
sal_Int16 nMode = 0;
rValue >>= nMode;
switch (nMode)
{
case CHARCOMPRESS_NONE:
case CHARCOMPRESS_PUNCTUATION:
case CHARCOMPRESS_PUNCTUATION_KANA:
break;
default:
throw IllegalArgumentException();
}
mpDoc->getIDocumentSettingAccess().setCharacterCompressionType(static_cast < SwCharCompressType > (nMode) );
}
break;
case HANDLE_APPLY_USER_DATA:
{
mpDocSh->SetUseUserData( *static_cast<sal_Bool const *>(rValue.getValue()) );
}
break;
case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
{
bool bSaveGlobal = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::GLOBAL_DOCUMENT_SAVE_LINKS, bSaveGlobal );
}
break;
case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
{
SwDBData aData = mpDoc->GetDBData();
if ( rValue >>= aData.sDataSource )
mpDoc->ChgDBData( aData );
}
break;
case HANDLE_CURRENT_DATABASE_COMMAND:
{
SwDBData aData = mpDoc->GetDBData();
if ( rValue >>= aData.sCommand )
mpDoc->ChgDBData( aData );
SAL_WARN_IF( aData.sDataSource.isEmpty() && !aData.sCommand.isEmpty(), "sw.uno",
"\"CurrentDatabaseCommand\" property possibly set before \"CurrentDatabaseDataSource\"" );
}
break;
case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
{
SwDBData aData = mpDoc->GetDBData();
if ( rValue >>= aData.nCommandType )
mpDoc->ChgDBData( aData );
SAL_WARN_IF( aData.nCommandType && aData.sDataSource.isEmpty(), "sw.uno",
"\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseDataSource\"" );
SAL_WARN_IF( aData.nCommandType && aData.sCommand.isEmpty(), "sw.uno",
"\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseCommand\"" );
}
break;
case HANDLE_EMBEDDED_DATABASE_NAME:
{
OUString sEmbeddedName;
if (rValue >>= sEmbeddedName)
mpDoc->GetDBManager()->setEmbeddedName(sEmbeddedName, *mpDocSh);
}
break;
case HANDLE_SAVE_VERSION_ON_CLOSE:
{
mpDocSh->SetSaveVersionOnClose( *static_cast<sal_Bool const *>(rValue.getValue()) );
}
break;
case HANDLE_UPDATE_FROM_TEMPLATE:
{
mpDocSh->SetQueryLoadTemplate( *static_cast<sal_Bool const *>(rValue.getValue()) );
}
break;
case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
{
sal_Int16 nTmp = 0;
rValue >>= nTmp;
bool bUseVirDev = true;
bool bHiResVirDev = true;
if( nTmp == document::PrinterIndependentLayout::DISABLED )
bUseVirDev = false;
else if ( nTmp == document::PrinterIndependentLayout::LOW_RESOLUTION )
bHiResVirDev = false;
else if ( nTmp != document::PrinterIndependentLayout::HIGH_RESOLUTION )
throw IllegalArgumentException();
mpDoc->getIDocumentDeviceAccess().setReferenceDeviceType( bUseVirDev, bHiResVirDev );
}
break;
case HANDLE_IS_LABEL_DOC :
{
bool bSet = false;
if(!(rValue >>= bSet))
throw IllegalArgumentException();
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::LABEL_DOCUMENT, bSet);
}
break;
case HANDLE_IS_ADD_FLY_OFFSET:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_FLY_OFFSETS, bTmp);
}
break;
case HANDLE_IS_ADD_EXTERNAL_LEADING:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_EXT_LEADING, bTmp);
}
break;
case HANDLE_OLD_NUMBERING:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::OLD_NUMBERING, bTmp);
}
break;
case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::OUTLINE_LEVEL_YIELDS_OUTLINE_RULE, bTmp);
}
break;
case HANDLE_ALLOW_PRINTJOB_CANCEL:
{
bool bState = false;
if (!(rValue >>= bState))
throw IllegalArgumentException();
mpDocSh->Stamp_SetPrintCancelState(bState);
}
break;
case HANDLE_USE_FORMER_LINE_SPACING:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::OLD_LINE_SPACING, bTmp);
}
break;
case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS, bTmp);
}
break;
case HANDLE_USE_FORMER_OBJECT_POSITIONING:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::USE_FORMER_OBJECT_POS, bTmp);
}
break;
case HANDLE_USE_FORMER_TEXT_WRAPPING:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::USE_FORMER_TEXT_WRAPPING, bTmp);
}
break;
case HANDLE_CHANGES_PASSWORD:
{
Sequence <sal_Int8> aNew;
if(rValue >>= aNew)
{
mpDoc->getIDocumentRedlineAccess().SetRedlinePassword(aNew);
if(aNew.getLength())
{
sal_uInt16 eMode = mpDoc->getIDocumentRedlineAccess().GetRedlineMode();
eMode = eMode|nsRedlineMode_t::REDLINE_ON;
mpDoc->getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)( eMode ));
}
}
}
break;
case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION, bTmp );
}
break;
case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, bTmp);
}
break;
case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, bTmp);
}
break;
case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, bTmp);
}
break;
case HANDLE_TABLE_ROW_KEEP:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TABLE_ROW_KEEP, bTmp);
}
break;
case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, bTmp);
}
break;
case HANDLE_LOAD_READONLY:
{
mpDocSh->SetLoadReadonly( *static_cast<sal_Bool const *>(rValue.getValue()) );
}
break;
case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, bTmp);
}
break;
case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME, bTmp);
}
break;
case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::UNIX_FORCE_ZERO_EXT_LEADING, bTmp);
}
break;
case HANDLE_USE_OLD_PRINTER_METRICS:
// ignore - this is a dead property
break;
case HANDLE_TABS_RELATIVE_TO_INDENT:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TABS_RELATIVE_TO_INDENT, bTmp);
}
break;
case HANDLE_RSID:
{
sal_uInt32 nTmp = 0;
rValue >>= nTmp;
mpDoc->setRsid( nTmp );
}
break;
case HANDLE_RSID_ROOT:
{
sal_uInt32 nTmp = 0;
rValue >>= nTmp;
mpDoc->setRsidRoot( nTmp );
}
break;
case HANDLE_PROTECT_FORM:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::PROTECT_FORM, bTmp);
}
break;
case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, bTmp);
}
break;
case HANDLE_MODIFYPASSWORDINFO:
{
uno::Sequence< beans::PropertyValue > aInfo;
if ( !( rValue >>= aInfo ) )
throw lang::IllegalArgumentException(
OUString( "Value of type Sequence<PropertyValue> expected!" ),
uno::Reference< uno::XInterface >(),
2 );
if ( !mpDocSh->SetModifyPasswordInfo( aInfo ) )
throw beans::PropertyVetoException(
OUString( "The hash is not allowed to be changed now!" ),
uno::Reference< uno::XInterface >() );
}
break;
case HANDLE_MATH_BASELINE_ALIGNMENT:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set( DocumentSettingId::MATH_BASELINE_ALIGNMENT, bTmp );
}
break;
case HANDLE_INVERT_BORDER_SPACING:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::INVERT_BORDER_SPACING, bTmp);
}
break;
case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::COLLAPSE_EMPTY_CELL_PARA, bTmp);
}
break;
case HANDLE_SMALL_CAPS_PERCENTAGE_66:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::SMALL_CAPS_PERCENTAGE_66, bTmp);
}
break;
case HANDLE_TAB_OVERFLOW:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TAB_OVERFLOW, bTmp);
}
break;
case HANDLE_UNBREAKABLE_NUMBERINGS:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::UNBREAKABLE_NUMBERINGS, bTmp);
}
break;
case HANDLE_STYLES_NODEFAULT:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::STYLES_NODEFAULT, bTmp);
}
break;
case HANDLE_FLOATTABLE_NOMARGINS:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::FLOATTABLE_NOMARGINS, bTmp);
}
break;
case HANDLE_CLIPPED_PICTURES:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::CLIPPED_PICTURES, bTmp);
}
break;
case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::BACKGROUND_PARA_OVER_DRAWINGS, bTmp);
}
break;
case HANDLE_EMBED_FONTS:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::EMBED_FONTS, bTmp);
}
break;
case HANDLE_EMBED_SYSTEM_FONTS:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::EMBED_SYSTEM_FONTS, bTmp);
}
break;
case HANDLE_TAB_OVER_MARGIN:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TAB_OVER_MARGIN, bTmp);
}
break;
case HANDLE_SURROUND_TEXT_WRAP_SMALL:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::SURROUND_TEXT_WRAP_SMALL, bTmp);
}
break;
case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
{
bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, bTmp);
}
break;
case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE:
{
bool bTmp;
if (rValue >>= bTmp)
{
mpDoc->getIDocumentSettingAccess().set(
DocumentSettingId::PROP_LINE_SPACING_SHRINKS_FIRST_LINE, bTmp);
}
}
break;
case HANDLE_SUBTRACT_FLYS:
{
bool bTmp;
if (rValue >>= bTmp)
{
mpDoc->getIDocumentSettingAccess().set(
DocumentSettingId::SUBTRACT_FLYS, bTmp);
}
}
break;
default:
throw UnknownPropertyException();
}
}
void SwXDocumentSettings::_postSetValues ()
throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
{
// set printer only once, namely here!
if( mpPrinter != nullptr )
{
// #i86352# the printer is also used as container for options by sfx
// when setting a printer it should have decent default options
SfxItemSet aOptions( mpPrinter->GetOptions() );
SwPrintData aPrtData( mpDoc->getIDocumentDeviceAccess().getPrintData() );
SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, aPrtData);
aOptions.Put(aAddPrinterItem);
mpPrinter->SetOptions( aOptions );
mpDoc->getIDocumentDeviceAccess().setPrinter( mpPrinter, true, true );
}
mpPrinter = 0;
mpDocSh = 0;
mpDoc = 0;
}
void SwXDocumentSettings::_preGetValues ()
throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
{
mpDocSh = mpModel->GetDocShell();
if (NULL == mpDocSh)
throw UnknownPropertyException();
mpDoc = mpDocSh->GetDoc();
if (NULL == mpDoc)
throw UnknownPropertyException();
}
void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, uno::Any & rValue )
throw (beans::UnknownPropertyException, lang::WrappedTargetException,
uno::RuntimeException)
{
switch( rInfo.mnHandle )
{
case HANDLE_FORBIDDEN_CHARS:
{
Reference<XForbiddenCharacters> xRet(*mpModel->GetPropertyHelper(), UNO_QUERY);
rValue <<= xRet;
}
break;
case HANDLE_LINK_UPDATE_MODE:
{
rValue <<= static_cast < sal_Int16 > ( mpDoc->getIDocumentSettingAccess().getLinkUpdateMode(true) );
}
break;
case HANDLE_FIELD_AUTO_UPDATE:
{
SwFieldUpdateFlags nFlags = mpDoc->getIDocumentSettingAccess().getFieldUpdateFlags(true);
rValue <<= nFlags == AUTOUPD_FIELD_ONLY || nFlags == AUTOUPD_FIELD_AND_CHARTS;
}
break;
case HANDLE_CHART_AUTO_UPDATE:
{
SwFieldUpdateFlags nFlags = mpDoc->getIDocumentSettingAccess().getFieldUpdateFlags(true);
rValue <<= nFlags == AUTOUPD_FIELD_AND_CHARTS;
}
break;
case HANDLE_ADD_PARA_TABLE_SPACING:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX);
}
break;
case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX_AT_PAGES);
}
break;
case HANDLE_ALIGN_TAB_STOP_POSITION:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::TAB_COMPAT);
}
break;
case HANDLE_PRINTER_NAME:
{
SfxPrinter *pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
rValue <<= pPrinter ? OUString ( pPrinter->GetName()) : OUString();
}
break;
case HANDLE_PRINTER_SETUP:
{
SfxPrinter *pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( false );
if (pPrinter)
{
SvMemoryStream aStream;
pPrinter->Store( aStream );
aStream.Seek ( STREAM_SEEK_TO_END );
sal_uInt32 nSize = aStream.Tell();
aStream.Seek ( STREAM_SEEK_TO_BEGIN );
Sequence < sal_Int8 > aSequence( nSize );
aStream.Read ( aSequence.getArray(), nSize );
rValue <<= aSequence;
}
else
{
Sequence < sal_Int8 > aSequence ( 0 );
rValue <<= aSequence;
}
}
break;
case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::KERN_ASIAN_PUNCTUATION);
}
break;
case HANDLE_APPLY_USER_DATA:
{
rValue <<= mpDocSh->IsUseUserData();
}
break;
case HANDLE_CHARACTER_COMPRESSION_TYPE:
{
rValue <<= static_cast < sal_Int16 > (mpDoc->getIDocumentSettingAccess().getCharacterCompressionType());
}
break;
case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::GLOBAL_DOCUMENT_SAVE_LINKS);
}
break;
case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
{
const SwDBData& rData = mpDoc->GetDBDesc();
rValue <<= rData.sDataSource;
}
break;
case HANDLE_CURRENT_DATABASE_COMMAND:
{
const SwDBData& rData = mpDoc->GetDBDesc();
rValue <<= rData.sCommand;
}
break;
case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
{
const SwDBData& rData = mpDoc->GetDBDesc();
rValue <<= rData.nCommandType;
}
break;
case HANDLE_EMBEDDED_DATABASE_NAME:
{
rValue <<= mpDoc->GetDBManager()->getEmbeddedName();
}
break;
case HANDLE_SAVE_VERSION_ON_CLOSE:
{
rValue <<= mpDocSh->IsSaveVersionOnClose();
}
break;
case HANDLE_UPDATE_FROM_TEMPLATE:
{
rValue <<= mpDocSh->IsQueryLoadTemplate();
}
break;
case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
{
// returns short (see css.document.PrinterIndependentLayout)
sal_Int16 nVirDevType = mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::USE_VIRTUAL_DEVICE) ?
( mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::USE_HIRES_VIRTUAL_DEVICE) ?
document::PrinterIndependentLayout::HIGH_RESOLUTION :
document::PrinterIndependentLayout::LOW_RESOLUTION ) :
document::PrinterIndependentLayout::DISABLED;
rValue <<= nVirDevType;
}
break;
case HANDLE_IS_LABEL_DOC:
{
bool bLabel = mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::LABEL_DOCUMENT);
rValue <<= bLabel;
}
break;
case HANDLE_IS_ADD_FLY_OFFSET:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_FLY_OFFSETS);
}
break;
case HANDLE_IS_ADD_EXTERNAL_LEADING:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_EXT_LEADING);
}
break;
case HANDLE_OLD_NUMBERING:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::OLD_NUMBERING);
}
break;
case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::OUTLINE_LEVEL_YIELDS_OUTLINE_RULE);
}
break;
case HANDLE_ALLOW_PRINTJOB_CANCEL:
{
rValue <<= mpDocSh->Stamp_GetPrintCancelState();
}
break;
case HANDLE_USE_FORMER_LINE_SPACING:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::OLD_LINE_SPACING);
}
break;
case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS);
}
break;
case HANDLE_USE_FORMER_OBJECT_POSITIONING:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::USE_FORMER_OBJECT_POS);
}
break;
case HANDLE_USE_FORMER_TEXT_WRAPPING:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING);
}
break;
case HANDLE_CHANGES_PASSWORD:
{
rValue <<= mpDoc->getIDocumentRedlineAccess().GetRedlinePassword();
}
break;
case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION);
}
break;
case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING);
}
break;
case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK);
}
break;
case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT);
}
break;
case HANDLE_TABLE_ROW_KEEP :
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::TABLE_ROW_KEEP);
}
break;
case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION);
}
break;
case HANDLE_LOAD_READONLY:
{
rValue <<= mpDocSh->IsLoadReadonly();
}
break;
case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE);
}
break;
case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME);
}
break;
case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::UNIX_FORCE_ZERO_EXT_LEADING);
}
break;
case HANDLE_USE_OLD_PRINTER_METRICS:
{
rValue <<= false;
}
break;
case HANDLE_TABS_RELATIVE_TO_INDENT:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::TABS_RELATIVE_TO_INDENT);
}
break;
case HANDLE_RSID:
{
rValue <<= static_cast < sal_Int32 > ( mpDoc->getRsid() );
}
break;
case HANDLE_RSID_ROOT:
{
rValue <<= static_cast < sal_Int32 > ( mpDoc->getRsidRoot() );
}
break;
case HANDLE_PROTECT_FORM:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM);
}
break;
case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST);
}
break;
case HANDLE_MODIFYPASSWORDINFO:
{
rValue <<= mpDocSh->GetModifyPasswordInfo();
}
break;
case HANDLE_MATH_BASELINE_ALIGNMENT:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::MATH_BASELINE_ALIGNMENT );
}
break;
case HANDLE_INVERT_BORDER_SPACING:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::INVERT_BORDER_SPACING);
}
break;
case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::COLLAPSE_EMPTY_CELL_PARA );
}
break;
case HANDLE_SMALL_CAPS_PERCENTAGE_66:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::SMALL_CAPS_PERCENTAGE_66 );
}
break;
case HANDLE_TAB_OVERFLOW:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::TAB_OVERFLOW );
}
break;
case HANDLE_UNBREAKABLE_NUMBERINGS:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::UNBREAKABLE_NUMBERINGS );
}
break;
case HANDLE_STYLES_NODEFAULT:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::STYLES_NODEFAULT );
}
break;
case HANDLE_FLOATTABLE_NOMARGINS:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::FLOATTABLE_NOMARGINS );
}
break;
case HANDLE_CLIPPED_PICTURES:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::CLIPPED_PICTURES );
}
break;
case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::BACKGROUND_PARA_OVER_DRAWINGS );
}
break;
case HANDLE_EMBED_FONTS:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS );
}
break;
case HANDLE_EMBED_SYSTEM_FONTS:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_SYSTEM_FONTS );
}
break;
case HANDLE_TAB_OVER_MARGIN:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::TAB_OVER_MARGIN );
}
break;
case HANDLE_SURROUND_TEXT_WRAP_SMALL:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::SURROUND_TEXT_WRAP_SMALL );
}
break;
case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get( DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING );
}
break;
case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::PROP_LINE_SPACING_SHRINKS_FIRST_LINE);
}
break;
case HANDLE_SUBTRACT_FLYS:
{
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::SUBTRACT_FLYS);
}
break;
default:
throw UnknownPropertyException();
}
}
void SwXDocumentSettings::_postGetValues ()
throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
{
mpDocSh = 0;
mpDoc = 0;
}
// XServiceInfo
OUString SAL_CALL SwXDocumentSettings::getImplementationName( )
throw(RuntimeException, std::exception)
{
return OUString("com.sun.star.comp.Writer.DocumentSettings");
}
sal_Bool SAL_CALL SwXDocumentSettings::supportsService( const OUString& ServiceName )
throw(RuntimeException, std::exception)
{
return cppu::supportsService(this, ServiceName);
}
Sequence< OUString > SAL_CALL SwXDocumentSettings::getSupportedServiceNames( )
throw(RuntimeException, std::exception)
{
Sequence< OUString > aSeq( 3 );
aSeq[0] = "com.sun.star.document.Settings";
aSeq[1] = "com.sun.star.text.DocumentSettings";
aSeq[2] = "com.sun.star.text.PrintSettings";
return aSeq;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|