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
|
/* -*- 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 <ctype.h>
#include <tools/diagnose_ex.h>
#include <rtl/tencinfo.h>
#include <svl/itemiter.hxx>
#include <svl/whiter.hxx>
#include <svtools/rtftoken.h>
#include <svl/itempool.hxx>
#include <comphelper/string.hxx>
#include <com/sun/star/lang/Locale.hpp>
#include <editeng/scriptspaceitem.hxx>
#include <editeng/fontitem.hxx>
#include <editeng/colritem.hxx>
#include <editeng/svxrtf.hxx>
#include <editeng/editids.hrc>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <com/sun/star/document/XDocumentProperties.hpp>
using namespace ::com::sun::star;
static rtl_TextEncoding lcl_GetDefaultTextEncodingForRTF()
{
OUString aLangString( Application::GetSettings().GetLanguageTag().getLanguage());
if ( aLangString == "ru" || aLangString == "uk" )
return RTL_TEXTENCODING_MS_1251;
if ( aLangString == "tr" )
return RTL_TEXTENCODING_MS_1254;
else
return RTL_TEXTENCODING_MS_1252;
}
// -------------- Methods --------------------
SvxRTFParser::SvxRTFParser( SfxItemPool& rPool, SvStream& rIn,
uno::Reference<document::XDocumentProperties> i_xDocProps,
bool const bReadNewDoc )
: SvRTFParser( rIn, 5 )
, rStrm(rIn)
, aPlainMap(rPool)
, aPardMap(rPool)
, pInsPos( 0 )
, pAttrPool( &rPool )
, m_xDocProps( i_xDocProps )
, pRTFDefaults( 0 )
, nVersionNo( 0 )
, nDfltFont( 0)
, bNewDoc( bReadNewDoc )
, bNewGroup( false)
, bIsSetDfltTab( false)
, bChkStyleAttr( false )
, bCalcValue( false )
, bPardTokenRead( false)
, bReadDocInfo( false )
, bIsLeftToRightDef( true)
, bIsInReadStyleTab( false)
{
pDfltFont = new vcl::Font;
pDfltColor = new Color;
}
SvxRTFParser::~SvxRTFParser()
{
if( !aColorTbl.empty() )
ClearColorTbl();
if( !aAttrStack.empty() )
ClearAttrStack();
delete pRTFDefaults;
delete pInsPos;
delete pDfltFont;
delete pDfltColor;
}
void SvxRTFParser::SetInsPos( const SvxPosition& rNew )
{
if( pInsPos )
delete pInsPos;
pInsPos = rNew.Clone();
}
SvParserState SvxRTFParser::CallParser()
{
DBG_ASSERT( pInsPos, "no insertion position");
if( !pInsPos )
return SVPAR_ERROR;
if( !aColorTbl.empty() )
ClearColorTbl();
if( !aFontTbl.empty() )
ClearFontTbl();
if( !aStyleTbl.empty() )
ClearStyleTbl();
if( !aAttrStack.empty() )
ClearAttrStack();
bIsSetDfltTab = false;
bNewGroup = false;
nDfltFont = 0;
sBaseURL.clear();
// generate the correct WhichId table from the set WhichIds.
BuildWhichTable();
return SvRTFParser::CallParser();
}
void SvxRTFParser::Continue( int nToken )
{
SvRTFParser::Continue( nToken );
if( SVPAR_PENDING != GetStatus() )
{
SetAllAttrOfStk();
//Regardless of what "color 0" is, word defaults to auto as the default colour.
//e.g. see #i7713#
}
}
// is called for each token that is recognized in CallParser
void SvxRTFParser::NextToken( int nToken )
{
sal_Unicode cCh;
switch( nToken )
{
case RTF_COLORTBL: ReadColorTable(); break;
case RTF_FONTTBL: ReadFontTable(); break;
case RTF_STYLESHEET: ReadStyleTable(); break;
case RTF_DEFF:
if( bNewDoc )
{
if( !aFontTbl.empty() )
// Can immediately be set
SetDefault( nToken, nTokenValue );
else
// is set after reading the font table
nDfltFont = int(nTokenValue);
}
break;
case RTF_DEFTAB:
case RTF_DEFLANG:
if( bNewDoc )
SetDefault( nToken, nTokenValue );
break;
case RTF_PICT: ReadBitmapData(); break;
case RTF_LINE: cCh = '\n'; goto INSINGLECHAR;
case RTF_TAB: cCh = '\t'; goto INSINGLECHAR;
case RTF_SUBENTRYINDEX: cCh = ':'; goto INSINGLECHAR;
case RTF_EMDASH: cCh = 0x2014; goto INSINGLECHAR;
case RTF_ENDASH: cCh = 0x2013; goto INSINGLECHAR;
case RTF_BULLET: cCh = 0x2022; goto INSINGLECHAR;
case RTF_LQUOTE: cCh = 0x2018; goto INSINGLECHAR;
case RTF_RQUOTE: cCh = 0x2019; goto INSINGLECHAR;
case RTF_LDBLQUOTE: cCh = 0x201C; goto INSINGLECHAR;
case RTF_RDBLQUOTE: cCh = 0x201D; goto INSINGLECHAR;
INSINGLECHAR:
aToken = OUString(cCh);
// no Break, aToken is set as Text
case RTF_TEXTTOKEN:
{
InsertText();
// all collected Attributes are set
for( sal_uInt16 n = aAttrSetList.size(); n; )
{
SvxRTFItemStackType* pStkSet = &aAttrSetList[--n];
SetAttrSet( *pStkSet );
aAttrSetList.pop_back();
}
}
break;
case RTF_PAR:
InsertPara();
break;
case '{':
if (bNewGroup) // Nesting!
_GetAttrSet();
bNewGroup = true;
break;
case '}':
if( !bNewGroup ) // Empty Group ??
AttrGroupEnd();
bNewGroup = false;
break;
case RTF_INFO:
if (bReadDocInfo && bNewDoc && m_xDocProps.is())
ReadInfo();
else
SkipGroup();
break;
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// First overwrite all (all have to be in one group!!)
// Could also appear in the RTF-filewithout the IGNORE-Flag; all Groups
// with the IGNORE-Flag are overwritten in the default branch.
case RTF_SWG_PRTDATA:
case RTF_FIELD:
case RTF_ATNID:
case RTF_ANNOTATION:
case RTF_BKMKSTART:
case RTF_BKMKEND:
case RTF_BKMK_KEY:
case RTF_XE:
case RTF_TC:
case RTF_NEXTFILE:
case RTF_TEMPLATE:
// RTF_SHPRSLT disabled for #i19718#
SkipGroup();
break;
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
case RTF_PGDSCNO:
case RTF_PGBRK:
case RTF_SHADOW:
if( RTF_IGNOREFLAG != GetStackPtr( -1 )->nTokenId )
break;
nToken = SkipToken( -1 );
if( '{' == GetStackPtr( -1 )->nTokenId )
nToken = SkipToken( -1 );
ReadAttr( nToken, &GetAttrSet() );
break;
default:
switch( nToken & ~(0xff | RTF_SWGDEFS) )
{
case RTF_PARFMT: // hier gibts keine Swg-Defines
ReadAttr( nToken, &GetAttrSet() );
break;
case RTF_CHRFMT:
case RTF_BRDRDEF:
case RTF_TABSTOPDEF:
if( RTF_SWGDEFS & nToken)
{
if( RTF_IGNOREFLAG != GetStackPtr( -1 )->nTokenId )
break;
nToken = SkipToken( -1 );
if( '{' == GetStackPtr( -1 )->nTokenId )
{
nToken = SkipToken( -1 );
}
}
ReadAttr( nToken, &GetAttrSet() );
break;
default:
{
if( /*( '{' == GetStackPtr( -1 )->nTokenId ) ||*/
( RTF_IGNOREFLAG == GetStackPtr( -1 )->nTokenId &&
'{' == GetStackPtr( -2 )->nTokenId ) )
SkipGroup();
}
break;
}
break;
}
}
void SvxRTFParser::ReadStyleTable()
{
int nToken, bSaveChkStyleAttr = bChkStyleAttr ? 1 : 0;
sal_uInt16 nStyleNo = 0;
int _nOpenBrakets = 1; // the first was already detected earlier!!
SvxRTFStyleType* pStyle = new SvxRTFStyleType( *pAttrPool, &aWhichMap[0] );
pStyle->aAttrSet.Put( GetRTFDefaults() );
bIsInReadStyleTab = true;
bChkStyleAttr = false; // Do not check Attribute against the Styles
while( _nOpenBrakets && IsParserWorking() )
{
switch( nToken = GetNextToken() )
{
case '}': if( --_nOpenBrakets && IsParserWorking() )
// Style has been completely read,
// so this is still a stable status
SaveState( RTF_STYLESHEET );
break;
case '{':
{
if( RTF_IGNOREFLAG != GetNextToken() )
nToken = SkipToken( -1 );
else if( RTF_UNKNOWNCONTROL != ( nToken = GetNextToken() ) &&
RTF_PN != nToken )
nToken = SkipToken( -2 );
else
{
// filter out at once
ReadUnknownData();
nToken = GetNextToken();
if( '}' != nToken )
eState = SVPAR_ERROR;
break;
}
++_nOpenBrakets;
}
break;
case RTF_SBASEDON: pStyle->nBasedOn = sal_uInt16(nTokenValue); pStyle->bBasedOnIsSet=true; break;
case RTF_SNEXT: pStyle->nNext = sal_uInt16(nTokenValue); break;
case RTF_OUTLINELEVEL:
case RTF_SOUTLVL: pStyle->nOutlineNo = sal_uInt8(nTokenValue); break;
case RTF_S: nStyleNo = (short)nTokenValue; break;
case RTF_CS: nStyleNo = (short)nTokenValue;
pStyle->bIsCharFmt = true;
break;
case RTF_TEXTTOKEN:
{
pStyle->sName = DelCharAtEnd( aToken, ';' );
if( !aStyleTbl.empty() )
{
aStyleTbl.erase(nStyleNo);
}
// All data from the font is available, so off to the table
aStyleTbl.insert( nStyleNo , pStyle);
pStyle = new SvxRTFStyleType( *pAttrPool, &aWhichMap[0] );
pStyle->aAttrSet.Put( GetRTFDefaults() );
nStyleNo = 0;
}
break;
default:
switch( nToken & ~(0xff | RTF_SWGDEFS) )
{
case RTF_PARFMT: // hier gibts keine Swg-Defines
ReadAttr( nToken, &pStyle->aAttrSet );
break;
case RTF_CHRFMT:
case RTF_BRDRDEF:
case RTF_TABSTOPDEF:
if( RTF_SWGDEFS & nToken)
{
if( RTF_IGNOREFLAG != GetStackPtr( -1 )->nTokenId )
break;
nToken = SkipToken( -1 );
if( '{' == GetStackPtr( -1 )->nTokenId )
{
nToken = SkipToken( -1 );
}
}
ReadAttr( nToken, &pStyle->aAttrSet );
break;
}
break;
}
}
delete pStyle; // Delete the Last Style
SkipToken( -1 ); // the closing brace is evaluated "above"
// Flag back to old state
bChkStyleAttr = bSaveChkStyleAttr;
bIsInReadStyleTab = false;
}
void SvxRTFParser::ReadColorTable()
{
int nToken;
sal_uInt8 nRed = 0xff, nGreen = 0xff, nBlue = 0xff;
while( '}' != ( nToken = GetNextToken() ) && IsParserWorking() )
{
switch( nToken )
{
case RTF_RED: nRed = sal_uInt8(nTokenValue); break;
case RTF_GREEN: nGreen = sal_uInt8(nTokenValue); break;
case RTF_BLUE: nBlue = sal_uInt8(nTokenValue); break;
case RTF_TEXTTOKEN:
if( 1 == aToken.getLength()
? aToken[ 0 ] != ';'
: -1 == aToken.indexOf( ";" ) )
break; // At least the ';' must be found
// else no break !!
case ';':
if( IsParserWorking() )
{
// one color is finished, fill in the table
// try to map the values to SV internal names
ColorPtr pColor = new Color( nRed, nGreen, nBlue );
if( aColorTbl.empty() &&
sal_uInt8(-1) == nRed && sal_uInt8(-1) == nGreen && sal_uInt8(-1) == nBlue )
pColor->SetColor( COL_AUTO );
aColorTbl.push_back( pColor );
nRed = 0, nGreen = 0, nBlue = 0;
// Color has been completely read,
// so this is still a stable status
SaveState( RTF_COLORTBL );
}
break;
}
}
SkipToken( -1 ); // the closing brace is evaluated "above"
}
void SvxRTFParser::ReadFontTable()
{
int nToken = 0;
int _nOpenBrakets = 1; // the first was already detected earlier!!
vcl::Font* pFont = new vcl::Font();
short nFontNo(0), nInsFontNo (0);
OUString sAltNm, sFntNm;
bool bIsAltFntNm = false;
rtl_TextEncoding nSystemChar = lcl_GetDefaultTextEncodingForRTF();
pFont->SetCharSet( nSystemChar );
SetEncoding( nSystemChar );
while( _nOpenBrakets && IsParserWorking() )
{
bool bCheckNewFont = false;
switch( ( nToken = GetNextToken() ))
{
case '}':
bIsAltFntNm = false;
// Style has been completely read,
// so this is still a stable status
if( --_nOpenBrakets <= 1 && IsParserWorking() )
SaveState( RTF_FONTTBL );
bCheckNewFont = true;
nInsFontNo = nFontNo;
break;
case '{':
if( RTF_IGNOREFLAG != GetNextToken() )
nToken = SkipToken( -1 );
// immediately skip unknown and all known but non-evaluated
// groups
else if( RTF_UNKNOWNCONTROL != ( nToken = GetNextToken() ) &&
RTF_PANOSE != nToken && RTF_FNAME != nToken &&
RTF_FONTEMB != nToken && RTF_FONTFILE != nToken )
nToken = SkipToken( -2 );
else
{
// filter out at once
ReadUnknownData();
nToken = GetNextToken();
if( '}' != nToken )
eState = SVPAR_ERROR;
break;
}
++_nOpenBrakets;
break;
case RTF_FROMAN:
pFont->SetFamily( FAMILY_ROMAN );
break;
case RTF_FSWISS:
pFont->SetFamily( FAMILY_SWISS );
break;
case RTF_FMODERN:
pFont->SetFamily( FAMILY_MODERN );
break;
case RTF_FSCRIPT:
pFont->SetFamily( FAMILY_SCRIPT );
break;
case RTF_FDECOR:
pFont->SetFamily( FAMILY_DECORATIVE );
break;
// for technical/symbolic font of the rtl_TextEncoding is changed!
case RTF_FTECH:
pFont->SetCharSet( RTL_TEXTENCODING_SYMBOL );
// deliberate fall through
case RTF_FNIL:
pFont->SetFamily( FAMILY_DONTKNOW );
break;
case RTF_FCHARSET:
if (-1 != nTokenValue)
{
rtl_TextEncoding nrtl_TextEncoding = rtl_getTextEncodingFromWindowsCharset(
(sal_uInt8)nTokenValue);
pFont->SetCharSet(nrtl_TextEncoding);
//When we're in a font, the fontname is in the font
//charset, except for symbol fonts I believe
if (nrtl_TextEncoding == RTL_TEXTENCODING_SYMBOL)
nrtl_TextEncoding = RTL_TEXTENCODING_DONTKNOW;
SetEncoding(nrtl_TextEncoding);
}
break;
case RTF_FPRQ:
switch( nTokenValue )
{
case 1:
pFont->SetPitch( PITCH_FIXED );
break;
case 2:
pFont->SetPitch( PITCH_VARIABLE );
break;
}
break;
case RTF_F:
bCheckNewFont = true;
nInsFontNo = nFontNo;
nFontNo = (short)nTokenValue;
break;
case RTF_FALT:
bIsAltFntNm = true;
break;
case RTF_TEXTTOKEN:
DelCharAtEnd( aToken, ';' );
if ( !aToken.isEmpty() )
{
if( bIsAltFntNm )
sAltNm = aToken;
else
sFntNm = aToken;
}
break;
}
if( bCheckNewFont && 1 >= _nOpenBrakets && !sFntNm.isEmpty() ) // one font is ready
{
// All data from the font is available, so off to the table
if (!sAltNm.isEmpty())
sFntNm = sFntNm + ";" + sAltNm;
pFont->SetName( sFntNm );
aFontTbl.insert( nInsFontNo, pFont );
pFont = new vcl::Font();
pFont->SetCharSet( nSystemChar );
sAltNm.clear();
sFntNm.clear();
}
}
// the last one we have to delete manually
delete pFont;
SkipToken( -1 ); // the closing brace is evaluated "above"
// set the default font in the Document
if( bNewDoc && IsParserWorking() )
SetDefault( RTF_DEFF, nDfltFont );
}
void SvxRTFParser::ReadBitmapData()
{
SvRTFParser::ReadBitmapData();
}
void SvxRTFParser::ReadOLEData()
{
SvRTFParser::ReadOLEData();
}
OUString& SvxRTFParser::GetTextToEndGroup( OUString& rStr )
{
rStr.clear();
int _nOpenBrakets = 1, nToken = 0; // the first was already detected earlier!!
while( _nOpenBrakets && IsParserWorking() )
{
switch( nToken = GetNextToken() )
{
case '}': --_nOpenBrakets; break;
case '{':
{
if( RTF_IGNOREFLAG != GetNextToken() )
nToken = SkipToken( -1 );
else if( RTF_UNKNOWNCONTROL != GetNextToken() )
nToken = SkipToken( -2 );
else
{
// filter out at once
ReadUnknownData();
nToken = GetNextToken();
if( '}' != nToken )
eState = SVPAR_ERROR;
break;
}
++_nOpenBrakets;
}
break;
case RTF_TEXTTOKEN:
rStr += aToken;
break;
}
}
SkipToken( -1 ); // the closing brace is evaluated "above"
return rStr;
}
util::DateTime SvxRTFParser::GetDateTimeStamp( )
{
util::DateTime aDT;
bool bContinue = true;
while( bContinue && IsParserWorking() )
{
int nToken = GetNextToken();
switch( nToken )
{
case RTF_YR: aDT.Year = (sal_uInt16)nTokenValue; break;
case RTF_MO: aDT.Month = (sal_uInt16)nTokenValue; break;
case RTF_DY: aDT.Day = (sal_uInt16)nTokenValue; break;
case RTF_HR: aDT.Hours = (sal_uInt16)nTokenValue; break;
case RTF_MIN: aDT.Minutes = (sal_uInt16)nTokenValue; break;
default:
bContinue = false;
}
}
SkipToken( -1 ); // the closing brace is evaluated "above"
return aDT;
}
void SvxRTFParser::ReadInfo( const sal_Char* pChkForVerNo )
{
int _nOpenBrakets = 1, nToken = 0; // the first was already detected earlier!!
DBG_ASSERT(m_xDocProps.is(),
"SvxRTFParser::ReadInfo: no DocumentProperties");
OUString sStr, sComment;
long nVersNo = 0;
while( _nOpenBrakets && IsParserWorking() )
{
switch( nToken = GetNextToken() )
{
case '}': --_nOpenBrakets; break;
case '{':
{
if( RTF_IGNOREFLAG != GetNextToken() )
nToken = SkipToken( -1 );
else if( RTF_UNKNOWNCONTROL != GetNextToken() )
nToken = SkipToken( -2 );
else
{
// filter out at once
ReadUnknownData();
nToken = GetNextToken();
if( '}' != nToken )
eState = SVPAR_ERROR;
break;
}
++_nOpenBrakets;
}
break;
case RTF_TITLE:
m_xDocProps->setTitle( GetTextToEndGroup( sStr ) );
break;
case RTF_SUBJECT:
m_xDocProps->setSubject( GetTextToEndGroup( sStr ) );
break;
case RTF_AUTHOR:
m_xDocProps->setAuthor( GetTextToEndGroup( sStr ) );
break;
case RTF_OPERATOR:
m_xDocProps->setModifiedBy( GetTextToEndGroup( sStr ) );
break;
case RTF_KEYWORDS:
{
OUString sTemp = GetTextToEndGroup( sStr );
m_xDocProps->setKeywords(
::comphelper::string::convertCommaSeparated(sTemp) );
break;
}
case RTF_DOCCOMM:
m_xDocProps->setDescription( GetTextToEndGroup( sStr ) );
break;
case RTF_HLINKBASE:
sBaseURL = GetTextToEndGroup( sStr ) ;
break;
case RTF_CREATIM:
m_xDocProps->setCreationDate( GetDateTimeStamp() );
break;
case RTF_REVTIM:
m_xDocProps->setModificationDate( GetDateTimeStamp() );
break;
case RTF_PRINTIM:
m_xDocProps->setPrintDate( GetDateTimeStamp() );
break;
case RTF_COMMENT:
GetTextToEndGroup( sComment );
break;
case RTF_BUPTIM:
SkipGroup();
break;
case RTF_VERN:
nVersNo = nTokenValue;
break;
case RTF_EDMINS:
case RTF_ID:
case RTF_VERSION:
case RTF_NOFPAGES:
case RTF_NOFWORDS:
case RTF_NOFCHARS:
NextToken( nToken );
break;
// default:
}
}
if( pChkForVerNo &&
sComment == OUString::createFromAscii( pChkForVerNo ) )
nVersionNo = nVersNo;
SkipToken( -1 ); // the closing brace is evaluated "above"
}
void SvxRTFParser::ClearColorTbl()
{
while ( !aColorTbl.empty() )
{
delete aColorTbl.back();
aColorTbl.pop_back();
}
}
void SvxRTFParser::ClearFontTbl()
{
aFontTbl.clear();
}
void SvxRTFParser::ClearStyleTbl()
{
aStyleTbl.clear();
}
void SvxRTFParser::ClearAttrStack()
{
SvxRTFItemStackType* pTmp;
for( size_t nCnt = aAttrStack.size(); nCnt; --nCnt )
{
pTmp = aAttrStack.back();
aAttrStack.pop_back();
delete pTmp;
}
}
OUString& SvxRTFParser::DelCharAtEnd( OUString& rStr, const sal_Unicode cDel )
{
if( !rStr.isEmpty() && ' ' == rStr[ 0 ])
rStr = comphelper::string::stripStart(rStr, ' ');
if( !rStr.isEmpty() && ' ' == rStr[ rStr.getLength()-1 ])
rStr = comphelper::string::stripEnd(rStr, ' ');
if( !rStr.isEmpty() && cDel == rStr[ rStr.getLength()-1 ])
rStr = rStr.copy( 0, rStr.getLength()-1 );
return rStr;
}
const vcl::Font& SvxRTFParser::GetFont( sal_uInt16 nId )
{
SvxRTFFontTbl::const_iterator it = aFontTbl.find( nId );
const vcl::Font* pFont;
if( it == aFontTbl.end() )
{
const SvxFontItem& rDfltFont = static_cast<const SvxFontItem&>(
pAttrPool->GetDefaultItem( aPlainMap.nFont ));
pDfltFont->SetName( rDfltFont.GetStyleName() );
pDfltFont->SetFamily( rDfltFont.GetFamily() );
pFont = pDfltFont;
}
else
pFont = it->second;
return *pFont;
}
SvxRTFItemStackType* SvxRTFParser::_GetAttrSet( bool const bCopyAttr )
{
SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back();
SvxRTFItemStackType* pNew;
if( pAkt )
pNew = new SvxRTFItemStackType( *pAkt, *pInsPos, bCopyAttr );
else
pNew = new SvxRTFItemStackType( *pAttrPool, &aWhichMap[0],
*pInsPos );
pNew->SetRTFDefaults( GetRTFDefaults() );
aAttrStack.push_back( pNew );
bNewGroup = false;
return pNew;
}
void SvxRTFParser::_ClearStyleAttr( SvxRTFItemStackType& rStkType )
{
// check attributes to the attributes of the stylesheet or to
// the default attrs of the document
SfxItemSet &rSet = rStkType.GetAttrSet();
const SfxItemPool& rPool = *rSet.GetPool();
const SfxPoolItem* pItem;
SfxWhichIter aIter( rSet );
if( !IsChkStyleAttr() ||
!rStkType.GetAttrSet().Count() ||
aStyleTbl.count( rStkType.nStyleNo ) == 0 )
{
for( sal_uInt16 nWhich = aIter.GetCurWhich(); nWhich; nWhich = aIter.NextWhich() )
{
if( SFX_WHICH_MAX > nWhich &&
SfxItemState::SET == rSet.GetItemState( nWhich, false, &pItem ) &&
rPool.GetDefaultItem( nWhich ) == *pItem )
rSet.ClearItem( nWhich ); // delete
}
}
else
{
// Delete all Attributes, which are already defined in the Style,
// from the current AttrSet.
SvxRTFStyleType* pStyle = aStyleTbl.find( rStkType.nStyleNo )->second;
SfxItemSet &rStyleSet = pStyle->aAttrSet;
const SfxPoolItem* pSItem;
for( sal_uInt16 nWhich = aIter.GetCurWhich(); nWhich; nWhich = aIter.NextWhich() )
{
if( SfxItemState::SET == rStyleSet.GetItemState( nWhich, true, &pSItem ))
{
if( SfxItemState::SET == rSet.GetItemState( nWhich, false, &pItem )
&& *pItem == *pSItem )
rSet.ClearItem( nWhich ); // delete
}
else if( SFX_WHICH_MAX > nWhich &&
SfxItemState::SET == rSet.GetItemState( nWhich, false, &pItem ) &&
rPool.GetDefaultItem( nWhich ) == *pItem )
rSet.ClearItem( nWhich ); // delete
}
}
}
void SvxRTFParser::AttrGroupEnd() // process the current, delete from Stack
{
if( !aAttrStack.empty() )
{
SvxRTFItemStackType *pOld = aAttrStack.empty() ? 0 : aAttrStack.back();
aAttrStack.pop_back();
SvxRTFItemStackType *pAkt = aAttrStack.empty() ? 0 : aAttrStack.back();
do { // middle check loop
sal_Int32 nOldSttNdIdx = pOld->pSttNd->GetIdx();
if( !pOld->pChildList &&
((!pOld->aAttrSet.Count() && !pOld->nStyleNo ) ||
(nOldSttNdIdx == pInsPos->GetNodeIdx() &&
pOld->nSttCnt == pInsPos->GetCntIdx() )))
break; // no attributes or Area
// set only the attributes that are different from the parent
if( pAkt && pOld->aAttrSet.Count() )
{
SfxItemIter aIter( pOld->aAttrSet );
const SfxPoolItem* pItem = aIter.GetCurItem(), *pGet;
while( true )
{
if( SfxItemState::SET == pAkt->aAttrSet.GetItemState(
pItem->Which(), false, &pGet ) &&
*pItem == *pGet )
pOld->aAttrSet.ClearItem( pItem->Which() );
if( aIter.IsAtEnd() )
break;
pItem = aIter.NextItem();
}
if( !pOld->aAttrSet.Count() && !pOld->pChildList &&
!pOld->nStyleNo )
break;
}
// Set all attributes which have been defined from start until here
bool bCrsrBack = !pInsPos->GetCntIdx();
if( bCrsrBack )
{
// at the beginning of a paragraph? Move back one position
sal_Int32 nNd = pInsPos->GetNodeIdx();
MovePos(false);
// if can not move backward then later dont move forward !
bCrsrBack = nNd != pInsPos->GetNodeIdx();
}
if( ( pOld->pSttNd->GetIdx() < pInsPos->GetNodeIdx() ||
( pOld->pSttNd->GetIdx() == pInsPos->GetNodeIdx() &&
pOld->nSttCnt <= pInsPos->GetCntIdx() ))
)
{
if( !bCrsrBack )
{
// all pard attributes are only valid until the previous
// paragraph !!
if( nOldSttNdIdx == pInsPos->GetNodeIdx() )
{
}
else
{
// Now it gets complicated:
// - all character attributes sre keep the area
// - all paragraph attributes to get the area
// up to the previous paragraph
SvxRTFItemStackType* pNew = new SvxRTFItemStackType(
*pOld, *pInsPos, true );
pNew->aAttrSet.SetParent( pOld->aAttrSet.GetParent() );
// Delete all paragraph attributes from pNew
for( sal_uInt16 n = 0; n < (sizeof(aPardMap) / sizeof(sal_uInt16)) &&
pNew->aAttrSet.Count(); ++n )
if( reinterpret_cast<sal_uInt16*>(&aPardMap)[n] )
pNew->aAttrSet.ClearItem( reinterpret_cast<sal_uInt16*>(&aPardMap)[n] );
pNew->SetRTFDefaults( GetRTFDefaults() );
// Were there any?
if( pNew->aAttrSet.Count() == pOld->aAttrSet.Count() )
delete pNew;
else
{
pNew->nStyleNo = 0;
// Now span the real area of pNew from old
SetEndPrevPara( pOld->pEndNd, pOld->nEndCnt );
pNew->nSttCnt = 0;
if( IsChkStyleAttr() )
{
_ClearStyleAttr( *pOld );
_ClearStyleAttr( *pNew ); //#i10381#, methinks.
}
if( pAkt )
{
pAkt->Add( pOld );
pAkt->Add( pNew );
}
else
{
// Last off the stack, thus cache it until the next text was
// read. (Span no attributes!)
aAttrSetList.push_back( pOld );
aAttrSetList.push_back( pNew );
}
pOld = 0; // Do not delete pOld
break;
}
}
}
pOld->pEndNd = pInsPos->MakeNodeIdx();
pOld->nEndCnt = pInsPos->GetCntIdx();
/*
#i21422#
If the parent (pAkt) sets something e.g. , and the child (pOld)
unsets it and the style both are based on has it unset then
clearing the pOld by looking at the style is clearly a disaster
as the text ends up with pAkts bold and not pOlds no bold, this
should be rethought out. For the moment its safest to just do
the clean if we have no parent, all we suffer is too many
redundant properties.
*/
if (IsChkStyleAttr() && !pAkt)
_ClearStyleAttr( *pOld );
if( pAkt )
{
pAkt->Add( pOld );
// split up and create new entry, because it make no sense
// to create a "so long" depend list. Bug 95010
if( bCrsrBack && 50 < pAkt->pChildList->size() )
{
// at the beginning of a paragraph? Move back one position
MovePos(true);
bCrsrBack = false;
// Open a new Group.
SvxRTFItemStackType* pNew = new SvxRTFItemStackType(
*pAkt, *pInsPos, true );
pNew->SetRTFDefaults( GetRTFDefaults() );
// Set all until here valid Attributes
AttrGroupEnd();
pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); // can be changed after AttrGroupEnd!
pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 );
aAttrStack.push_back( pNew );
pAkt = pNew;
}
}
else
// Last off the stack, thus cache it until the next text was
// read. (Span no attributes!)
aAttrSetList.push_back( pOld );
pOld = 0;
}
if( bCrsrBack )
// at the beginning of a paragraph? Move back one position
MovePos(true);
} while( false );
if( pOld )
delete pOld;
bNewGroup = false;
}
}
void SvxRTFParser::SetAllAttrOfStk() // end all Attr. and set it into doc
{
// repeat until all attributes will be taken from stack
while( !aAttrStack.empty() )
AttrGroupEnd();
for( sal_uInt16 n = aAttrSetList.size(); n; )
{
SvxRTFItemStackType* pStkSet = &aAttrSetList[--n];
SetAttrSet( *pStkSet );
aAttrSetList.pop_back();
}
}
// sets all the attributes that are different from the current
void SvxRTFParser::SetAttrSet( SvxRTFItemStackType &rSet )
{
// Was DefTab never read? then set to default
if( !bIsSetDfltTab )
SetDefault( RTF_DEFTAB, 720 );
if( rSet.pChildList )
rSet.Compress( *this );
if( rSet.aAttrSet.Count() || rSet.nStyleNo )
SetAttrInDoc( rSet );
// then process all the children
if( rSet.pChildList )
for( sal_uInt16 n = 0; n < rSet.pChildList->size(); ++n )
SetAttrSet( (*rSet.pChildList)[ n ] );
}
// Has no text been inserted yet? (SttPos from the top Stack entry!)
bool SvxRTFParser::IsAttrSttPos()
{
SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back();
return !pAkt || (pAkt->pSttNd->GetIdx() == pInsPos->GetNodeIdx() &&
pAkt->nSttCnt == pInsPos->GetCntIdx());
}
void SvxRTFParser::SetAttrInDoc( SvxRTFItemStackType & )
{
}
void SvxRTFParser::BuildWhichTable()
{
aWhichMap.clear();
aWhichMap.push_back( 0 );
// Building a Which-Map 'rWhichMap' from an array of
// 'pWhichIds' from Which-Ids. It has the long 'nWhichIds'.
// The Which-Map is not going to be deleted.
SvParser::BuildWhichTable( aWhichMap, reinterpret_cast<sal_uInt16*>(&aPardMap), sizeof(aPardMap) / sizeof(sal_uInt16) );
SvParser::BuildWhichTable( aWhichMap, reinterpret_cast<sal_uInt16*>(&aPlainMap), sizeof(aPlainMap) / sizeof(sal_uInt16) );
}
const SfxItemSet& SvxRTFParser::GetRTFDefaults()
{
if( !pRTFDefaults )
{
pRTFDefaults = new SfxItemSet( *pAttrPool, &aWhichMap[0] );
sal_uInt16 nId;
if( 0 != ( nId = aPardMap.nScriptSpace ))
{
SvxScriptSpaceItem aItem( false, nId );
if( bNewDoc )
pAttrPool->SetPoolDefaultItem( aItem );
else
pRTFDefaults->Put( aItem );
}
}
return *pRTFDefaults;
}
SvxRTFStyleType::SvxRTFStyleType( SfxItemPool& rPool, const sal_uInt16* pWhichRange )
: aAttrSet( rPool, pWhichRange )
{
nOutlineNo = sal_uInt8(-1); // not set
nBasedOn = 0;
bBasedOnIsSet = false; //$flr #117411#
nNext = 0;
bIsCharFmt = false;
}
SvxRTFItemStackType::SvxRTFItemStackType(
SfxItemPool& rPool, const sal_uInt16* pWhichRange,
const SvxPosition& rPos )
: aAttrSet( rPool, pWhichRange ),
pChildList( 0 ),
nStyleNo( 0 )
{
pSttNd = rPos.MakeNodeIdx();
nSttCnt = rPos.GetCntIdx();
pEndNd = pSttNd;
nEndCnt = nSttCnt;
}
SvxRTFItemStackType::SvxRTFItemStackType(
const SvxRTFItemStackType& rCpy,
const SvxPosition& rPos,
bool const bCopyAttr )
: aAttrSet( *rCpy.aAttrSet.GetPool(), rCpy.aAttrSet.GetRanges() ),
pChildList( 0 ),
nStyleNo( rCpy.nStyleNo )
{
pSttNd = rPos.MakeNodeIdx();
nSttCnt = rPos.GetCntIdx();
pEndNd = pSttNd;
nEndCnt = nSttCnt;
aAttrSet.SetParent( &rCpy.aAttrSet );
if( bCopyAttr )
aAttrSet.Put( rCpy.aAttrSet );
}
SvxRTFItemStackType::~SvxRTFItemStackType()
{
if( pChildList )
delete pChildList;
if( pSttNd != pEndNd )
delete pEndNd;
delete pSttNd;
}
void SvxRTFItemStackType::Add( SvxRTFItemStackType* pIns )
{
if( !pChildList )
pChildList = new SvxRTFItemStackList();
pChildList->push_back( pIns );
}
void SvxRTFItemStackType::SetStartPos( const SvxPosition& rPos )
{
if (pSttNd != pEndNd)
delete pEndNd;
delete pSttNd;
pSttNd = rPos.MakeNodeIdx();
pEndNd = pSttNd;
nSttCnt = rPos.GetCntIdx();
}
void SvxRTFItemStackType::MoveFullNode(const SvxNodeIdx &rOldNode,
const SvxNodeIdx &rNewNode)
{
bool bSameEndAsStart = (pSttNd == pEndNd);
if (GetSttNodeIdx() == rOldNode.GetIdx())
{
delete pSttNd;
pSttNd = rNewNode.Clone();
if (bSameEndAsStart)
pEndNd = pSttNd;
}
if (!bSameEndAsStart && GetEndNodeIdx() == rOldNode.GetIdx())
{
delete pEndNd;
pEndNd = rNewNode.Clone();
}
//And the same for all the children
sal_Int32 nCount = pChildList ? pChildList->size() : 0;
for (sal_Int32 i = 0; i < nCount; ++i)
{
SvxRTFItemStackType* pStk = &(*pChildList)[i];
pStk->MoveFullNode(rOldNode, rNewNode);
}
}
void SvxRTFItemStackType::Compress( const SvxRTFParser& rParser )
{
ENSURE_OR_RETURN_VOID(pChildList, "Compress: no ChildList" );
ENSURE_OR_RETURN_VOID(!pChildList->empty(), "Compress: ChildList empty");
sal_uInt16 n;
SvxRTFItemStackType* pTmp = &(*pChildList)[0];
if( !pTmp->aAttrSet.Count() ||
pSttNd->GetIdx() != pTmp->pSttNd->GetIdx() ||
nSttCnt != pTmp->nSttCnt )
return;
SvxNodeIdx* pLastNd = pTmp->pEndNd;
sal_Int32 nLastCnt = pTmp->nEndCnt;
SfxItemSet aMrgSet( pTmp->aAttrSet );
for( n = 1; n < pChildList->size(); ++n )
{
pTmp = &(*pChildList)[n];
if( pTmp->pChildList )
pTmp->Compress( rParser );
if( !pTmp->nSttCnt
? (pLastNd->GetIdx()+1 != pTmp->pSttNd->GetIdx() ||
!rParser.IsEndPara( pLastNd, nLastCnt ) )
: ( pTmp->nSttCnt != nLastCnt ||
pLastNd->GetIdx() != pTmp->pSttNd->GetIdx() ))
{
while( ++n < pChildList->size() )
if( (pTmp = &(*pChildList)[n])->pChildList )
pTmp->Compress( rParser );
return;
}
if( n )
{
// Search for all which are set over the whole area
SfxItemIter aIter( aMrgSet );
const SfxPoolItem* pItem;
do {
sal_uInt16 nWhich = aIter.GetCurItem()->Which();
if( SfxItemState::SET != pTmp->aAttrSet.GetItemState( nWhich,
false, &pItem ) || *pItem != *aIter.GetCurItem() )
aMrgSet.ClearItem( nWhich );
if( aIter.IsAtEnd() )
break;
aIter.NextItem();
} while( true );
if( !aMrgSet.Count() )
return;
}
pLastNd = pTmp->pEndNd;
nLastCnt = pTmp->nEndCnt;
}
if( pEndNd->GetIdx() != pLastNd->GetIdx() || nEndCnt != nLastCnt )
return;
// It can be merged
aAttrSet.Put( aMrgSet );
for( n = 0; n < pChildList->size(); ++n )
{
pTmp = &(*pChildList)[n];
pTmp->aAttrSet.Differentiate( aMrgSet );
if( !pTmp->pChildList && !pTmp->aAttrSet.Count() && !pTmp->nStyleNo )
{
pChildList->erase( pChildList->begin() + n );
--n;
}
}
if( pChildList->empty() )
{
delete pChildList;
pChildList = 0;
}
}
void SvxRTFItemStackType::SetRTFDefaults( const SfxItemSet& rDefaults )
{
if( rDefaults.Count() )
{
SfxItemIter aIter( rDefaults );
do {
sal_uInt16 nWhich = aIter.GetCurItem()->Which();
if( SfxItemState::SET != aAttrSet.GetItemState( nWhich, false ))
aAttrSet.Put( *aIter.GetCurItem() );
if( aIter.IsAtEnd() )
break;
aIter.NextItem();
} while( true );
}
}
RTFPlainAttrMapIds::RTFPlainAttrMapIds( const SfxItemPool& rPool )
{
nCaseMap = rPool.GetTrueWhich( SID_ATTR_CHAR_CASEMAP, false );
nBgColor = rPool.GetTrueWhich( SID_ATTR_BRUSH_CHAR, false );
nColor = rPool.GetTrueWhich( SID_ATTR_CHAR_COLOR, false );
nContour = rPool.GetTrueWhich( SID_ATTR_CHAR_CONTOUR, false );
nCrossedOut = rPool.GetTrueWhich( SID_ATTR_CHAR_STRIKEOUT, false );
nEscapement = rPool.GetTrueWhich( SID_ATTR_CHAR_ESCAPEMENT, false );
nFont = rPool.GetTrueWhich( SID_ATTR_CHAR_FONT, false );
nFontHeight = rPool.GetTrueWhich( SID_ATTR_CHAR_FONTHEIGHT, false );
nKering = rPool.GetTrueWhich( SID_ATTR_CHAR_KERNING, false );
nLanguage = rPool.GetTrueWhich( SID_ATTR_CHAR_LANGUAGE, false );
nPosture = rPool.GetTrueWhich( SID_ATTR_CHAR_POSTURE, false );
nShadowed = rPool.GetTrueWhich( SID_ATTR_CHAR_SHADOWED, false );
nUnderline = rPool.GetTrueWhich( SID_ATTR_CHAR_UNDERLINE, false );
nOverline = rPool.GetTrueWhich( SID_ATTR_CHAR_OVERLINE, false );
nWeight = rPool.GetTrueWhich( SID_ATTR_CHAR_WEIGHT, false );
nWordlineMode = rPool.GetTrueWhich( SID_ATTR_CHAR_WORDLINEMODE, false );
nAutoKerning = rPool.GetTrueWhich( SID_ATTR_CHAR_AUTOKERN, false );
nCJKFont = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_FONT, false );
nCJKFontHeight = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT, false );
nCJKLanguage = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_LANGUAGE, false );
nCJKPosture = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_POSTURE, false );
nCJKWeight = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_WEIGHT, false );
nCTLFont = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_FONT, false );
nCTLFontHeight = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT, false );
nCTLLanguage = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_LANGUAGE, false );
nCTLPosture = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_POSTURE, false );
nCTLWeight = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_WEIGHT, false );
nEmphasis = rPool.GetTrueWhich( SID_ATTR_CHAR_EMPHASISMARK, false );
nTwoLines = rPool.GetTrueWhich( SID_ATTR_CHAR_TWO_LINES, false );
nRuby = 0; //rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_RUBY, sal_False );
nCharScaleX = rPool.GetTrueWhich( SID_ATTR_CHAR_SCALEWIDTH, false );
nHorzVert = rPool.GetTrueWhich( SID_ATTR_CHAR_ROTATED, false );
nRelief = rPool.GetTrueWhich( SID_ATTR_CHAR_RELIEF, false );
nHidden = rPool.GetTrueWhich( SID_ATTR_CHAR_HIDDEN, false );
}
RTFPardAttrMapIds ::RTFPardAttrMapIds ( const SfxItemPool& rPool )
{
nLinespacing = rPool.GetTrueWhich( SID_ATTR_PARA_LINESPACE, false );
nAdjust = rPool.GetTrueWhich( SID_ATTR_PARA_ADJUST, false );
nTabStop = rPool.GetTrueWhich( SID_ATTR_TABSTOP, false );
nHyphenzone = rPool.GetTrueWhich( SID_ATTR_PARA_HYPHENZONE, false );
nLRSpace = rPool.GetTrueWhich( SID_ATTR_LRSPACE, false );
nULSpace = rPool.GetTrueWhich( SID_ATTR_ULSPACE, false );
nBrush = rPool.GetTrueWhich( SID_ATTR_BRUSH, false );
nBox = rPool.GetTrueWhich( SID_ATTR_BORDER_OUTER, false );
nShadow = rPool.GetTrueWhich( SID_ATTR_BORDER_SHADOW, false );
nOutlineLvl = rPool.GetTrueWhich( SID_ATTR_PARA_OUTLLEVEL, false );
nSplit = rPool.GetTrueWhich( SID_ATTR_PARA_SPLIT, false );
nKeep = rPool.GetTrueWhich( SID_ATTR_PARA_KEEP, false );
nFontAlign = rPool.GetTrueWhich( SID_PARA_VERTALIGN, false );
nScriptSpace = rPool.GetTrueWhich( SID_ATTR_PARA_SCRIPTSPACE, false );
nHangPunct = rPool.GetTrueWhich( SID_ATTR_PARA_HANGPUNCTUATION, false );
nForbRule = rPool.GetTrueWhich( SID_ATTR_PARA_FORBIDDEN_RULES, false );
nDirection = rPool.GetTrueWhich( SID_ATTR_FRAMEDIRECTION, false );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|