LibreOffice Module editeng (master) 1
rtfitem.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20
21#include <editeng/fontitem.hxx>
22#include <editeng/postitem.hxx>
23#include <editeng/wghtitem.hxx>
24#include <editeng/fhgtitem.hxx>
25#include <editeng/udlnitem.hxx>
27#include <editeng/shdditem.hxx>
29#include <editeng/wrlmitem.hxx>
31#include <editeng/colritem.hxx>
32#include <editeng/kernitem.hxx>
33#include <editeng/cmapitem.hxx>
35#include <editeng/langitem.hxx>
38#include <editeng/lrspitem.hxx>
39#include <editeng/ulspitem.hxx>
40#include <editeng/shaditem.hxx>
42#include <editeng/boxitem.hxx>
43#include <editeng/keepitem.hxx>
44#include <editeng/brushitem.hxx>
45#include <editeng/lspcitem.hxx>
47#include <editeng/tstpitem.hxx>
48#include <editeng/spltitem.hxx>
59
60#include <svtools/rtftoken.h>
61#include <svl/itempool.hxx>
62#include <svl/itemiter.hxx>
63#include <sal/log.hxx>
64#include <vcl/font.hxx>
65
66#include <editeng/svxrtf.hxx>
67#include <editeng/editids.hrc>
68
69#include <limits.h>
70
71#define BRACELEFT '{'
72#define BRACERIGHT '}'
73
74using namespace ::com::sun::star;
75using namespace editeng;
76
78 SfxPoolItem& rItem )
79{
80 std::optional<sal_uInt16> pNormal;
81 std::optional<sal_uInt16> pCJK;
82 std::optional<sal_uInt16> pCTL;
83 switch( rItem.Which() )
84 {
85 case SID_ATTR_CHAR_FONT:
86 pNormal = aPlainMap[SID_ATTR_CHAR_FONT];
87 pCJK = aPlainMap[SID_ATTR_CHAR_CJK_FONT];
88 pCTL = aPlainMap[SID_ATTR_CHAR_CTL_FONT];
89 break;
90
91 case SID_ATTR_CHAR_FONTHEIGHT:
92 pNormal = aPlainMap[SID_ATTR_CHAR_FONTHEIGHT];
93 pCJK = aPlainMap[SID_ATTR_CHAR_CJK_FONTHEIGHT];
94 pCTL = aPlainMap[SID_ATTR_CHAR_CTL_FONTHEIGHT];
95 break;
96
97 case SID_ATTR_CHAR_POSTURE:
98 pNormal = aPlainMap[SID_ATTR_CHAR_POSTURE];
99 pCJK = aPlainMap[SID_ATTR_CHAR_CJK_POSTURE];
100 pCTL = aPlainMap[SID_ATTR_CHAR_CTL_POSTURE];
101 break;
102
103 case SID_ATTR_CHAR_WEIGHT:
104 pNormal = aPlainMap[SID_ATTR_CHAR_WEIGHT];
105 pCJK = aPlainMap[SID_ATTR_CHAR_CJK_WEIGHT];
106 pCTL = aPlainMap[SID_ATTR_CHAR_CTL_WEIGHT];
107 break;
108
109 case SID_ATTR_CHAR_LANGUAGE:
110 pNormal = aPlainMap[SID_ATTR_CHAR_LANGUAGE];
111 pCJK = aPlainMap[SID_ATTR_CHAR_CJK_LANGUAGE];
112 pCTL = aPlainMap[SID_ATTR_CHAR_CTL_LANGUAGE];
113 break;
114
115 case 0:
116 // it exist no WhichId - don't set this item
117 break;
118
119 default:
120 rSet.Put( rItem );
121 break;
122 }
123
125 {
126 if( bIsLeftToRightDef && pCJK )
127 {
128 rItem.SetWhich( *pCJK );
129 rSet.Put( rItem );
130 }
131 }
132 else if( !bIsLeftToRightDef )
133 {
134 if( pCTL )
135 {
136 rItem.SetWhich( *pCTL );
137 rSet.Put( rItem );
138 }
139 }
140 else
141 {
142 if( LOW_CHARTYPE == eType )
143 {
144 if( pNormal )
145 {
146 rItem.SetWhich( *pNormal );
147 rSet.Put( rItem );
148 }
149 }
150 else if( HIGH_CHARTYPE == eType )
151 {
152 if( pCTL )
153 {
154 rItem.SetWhich( *pCTL );
155 rSet.Put( rItem );
156 }
157 }
158 else
159 {
160 if( pCJK )
161 {
162 rItem.SetWhich( *pCJK );
163 rSet.Put( rItem );
164 }
165 if( pCTL )
166 {
167 rItem.SetWhich( *pCTL );
168 rSet.Put( rItem );
169 }
170 if( pNormal )
171 {
172 rItem.SetWhich( *pNormal );
173 rSet.Put( rItem );
174 }
175 }
176 }
177}
178
179
180void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
181{
182 DBG_ASSERT( pSet, "A SfxItemSet has to be provided as argument!" );
183 bool bFirstToken = true;
184 bool bContinue = true;
185 FontLineStyle eUnderline;
186 FontLineStyle eOverline;
187 FontEmphasisMark eEmphasis;
190
191 bool bChkStkPos = !bNewGroup && !aAttrStack.empty();
192
193 while( bContinue && IsParserWorking() ) // as long as known Attribute are recognized
194 {
195 switch( nToken )
196 {
197 case RTF_PARD:
198 RTFPardPlain( true, &pSet );
199 break;
200
201 case RTF_PLAIN:
202 RTFPardPlain( false, &pSet );
203 break;
204
205 default:
206 do { // middle checked loop
207 if( !bChkStkPos )
208 break;
209
210 SvxRTFItemStackType* pCurrent = aAttrStack.empty() ? nullptr : aAttrStack.back().get();
211 if( !pCurrent || (pCurrent->mxStartNodeIdx->GetIdx() == mxInsertPosition->GetNodeIdx() &&
212 pCurrent->nSttCnt == mxInsertPosition->GetCntIdx() ))
213 break;
214
215 int nLastToken = GetStackPtr(-1)->nTokenId;
216 if( RTF_PARD == nLastToken || RTF_PLAIN == nLastToken )
217 break;
218
219 if (pCurrent->aAttrSet.Count() || !pCurrent->maChildList.empty() ||
220 pCurrent->nStyleNo )
221 {
222 // Open a new Group
223 auto xNew(std::make_unique<SvxRTFItemStackType>(*pCurrent, *mxInsertPosition, true));
224 xNew->SetRTFDefaults( GetRTFDefaults() );
225
226 // "Set" all valid attributes up until this point
227 AttrGroupEnd();
228 pCurrent = aAttrStack.empty() ? nullptr : aAttrStack.back().get(); // can be changed after AttrGroupEnd!
229 xNew->aAttrSet.SetParent( pCurrent ? &pCurrent->aAttrSet : nullptr );
230
231 aAttrStack.push_back( std::move(xNew) );
232 pCurrent = aAttrStack.back().get();
233 }
234 else
235 // continue to use this entry as a new one
236 pCurrent->SetStartPos( *mxInsertPosition );
237
238 pSet = &pCurrent->aAttrSet;
239 } while( false );
240
241 switch( nToken )
242 {
243 case RTF_INTBL:
244 case RTF_PAGEBB:
245 case RTF_SBYS:
246 case RTF_CS:
247 case RTF_LS:
248 case RTF_ILVL:
250 break;
251
252 case RTF_S:
254 {
255 if( !bFirstToken )
256 SkipToken();
257 bContinue = false;
258 }
259 else
260 {
261 sal_uInt16 nStyleNo = -1 == nTokenValue ? 0 : sal_uInt16(nTokenValue);
262 // set StyleNo to the current style on the AttrStack
263 SvxRTFItemStackType* pCurrent = aAttrStack.empty() ? nullptr : aAttrStack.back().get();
264 if( !pCurrent )
265 break;
266
267 pCurrent->nStyleNo = nStyleNo;
268 }
269 break;
270
271 case RTF_KEEP:
272 if (const TypedWhichId<SvxFormatSplitItem> wid = aPardMap[SID_ATTR_PARA_SPLIT])
273 {
274 pSet->Put(SvxFormatSplitItem(false, wid));
275 }
276 break;
277
278 case RTF_KEEPN:
279 if (const TypedWhichId<SvxFormatKeepItem> wid = aPardMap[SID_ATTR_PARA_KEEP])
280 {
281 pSet->Put(SvxFormatKeepItem(true, wid));
282 }
283 break;
284
285 case RTF_LEVEL:
286 if (const TypedWhichId<SfxInt16Item> wid = aPardMap[SID_ATTR_PARA_OUTLLEVEL])
287 {
288 pSet->Put(SfxInt16Item(wid, static_cast<sal_uInt16>(nTokenValue)));
289 }
290 break;
291
292 case RTF_QL:
293 if (const TypedWhichId<SvxAdjustItem> wid = aPardMap[SID_ATTR_PARA_ADJUST])
294 {
295 pSet->Put(SvxAdjustItem(SvxAdjust::Left, wid));
296 }
297 break;
298 case RTF_QR:
299 if (const TypedWhichId<SvxAdjustItem> wid = aPardMap[SID_ATTR_PARA_ADJUST])
300 {
302 }
303 break;
304 case RTF_QJ:
305 if (const TypedWhichId<SvxAdjustItem> wid = aPardMap[SID_ATTR_PARA_ADJUST])
306 {
308 }
309 break;
310 case RTF_QC:
311 if (const TypedWhichId<SvxAdjustItem> wid = aPardMap[SID_ATTR_PARA_ADJUST])
312 {
314 }
315 break;
316
317 case RTF_FI:
318 if (const TypedWhichId<SvxLRSpaceItem> wid = aPardMap[SID_ATTR_LRSPACE])
319 {
320 SvxLRSpaceItem aLR(pSet->Get(wid));
321 sal_uInt16 nSz = 0;
322 if( -1 != nTokenValue )
323 {
324 if( IsCalcValue() )
325 CalcValue();
326 nSz = sal_uInt16(nTokenValue);
327 }
328 aLR.SetTextFirstLineOffset( nSz );
329 pSet->Put( aLR );
330 }
331 break;
332
333 case RTF_LI:
334 case RTF_LIN:
335 if (const TypedWhichId<SvxLRSpaceItem> wid = aPardMap[SID_ATTR_LRSPACE])
336 {
337 SvxLRSpaceItem aLR(pSet->Get(wid));
338 sal_uInt16 nSz = 0;
339 if( 0 < nTokenValue )
340 {
341 if( IsCalcValue() )
342 CalcValue();
343 nSz = sal_uInt16(nTokenValue);
344 }
345 aLR.SetTextLeft( nSz );
346 pSet->Put( aLR );
347 }
348 break;
349
350 case RTF_RI:
351 case RTF_RIN:
352 if (const TypedWhichId<SvxLRSpaceItem> wid = aPardMap[SID_ATTR_LRSPACE])
353 {
354 SvxLRSpaceItem aLR(pSet->Get(wid));
355 sal_uInt16 nSz = 0;
356 if( 0 < nTokenValue )
357 {
358 if( IsCalcValue() )
359 CalcValue();
360 nSz = sal_uInt16(nTokenValue);
361 }
362 aLR.SetRight( nSz );
363 pSet->Put( aLR );
364 }
365 break;
366
367 case RTF_SB:
368 if (const TypedWhichId<SvxULSpaceItem> wid = aPardMap[SID_ATTR_ULSPACE])
369 {
370 SvxULSpaceItem aUL(pSet->Get(wid));
371 sal_uInt16 nSz = 0;
372 if( 0 < nTokenValue )
373 {
374 if( IsCalcValue() )
375 CalcValue();
376 nSz = sal_uInt16(nTokenValue);
377 }
378 aUL.SetUpper( nSz );
379 pSet->Put( aUL );
380 }
381 break;
382
383 case RTF_SA:
384 if (const TypedWhichId<SvxULSpaceItem> wid = aPardMap[SID_ATTR_ULSPACE])
385 {
386 SvxULSpaceItem aUL(pSet->Get(wid));
387 sal_uInt16 nSz = 0;
388 if( 0 < nTokenValue )
389 {
390 if( IsCalcValue() )
391 CalcValue();
392 nSz = sal_uInt16(nTokenValue);
393 }
394 aUL.SetLower( nSz );
395 pSet->Put( aUL );
396 }
397 break;
398
399 case RTF_SLMULT:
400 if (const TypedWhichId<SvxLineSpacingItem> wid = aPardMap[SID_ATTR_PARA_LINESPACE];
401 wid && 1 == nTokenValue)
402 {
403 // then switches to multi-line!
404 SvxLineSpacingItem aLSpace(pSet->Get(wid, false));
405
406 // how much do you get from the line height value?
407
408 // Proportional-Size:
409 // Ie, the ratio is (n / 240) twips
410
411 nTokenValue = 240;
412 if( IsCalcValue() )
413 CalcValue();
414
415 nTokenValue = short( 100 * aLSpace.GetLineHeight() / nTokenValue );
416
417 aLSpace.SetPropLineSpace( static_cast<sal_uInt16>(nTokenValue) );
419
420 pSet->Put( aLSpace );
421 }
422 break;
423
424 case RTF_SL:
425 if (const TypedWhichId<SvxLineSpacingItem> wid = aPardMap[SID_ATTR_PARA_LINESPACE])
426 {
427 // Calculate the ratio between the default font and the
428 // specified size. The distance consists of the line height
429 // (100%) and the space above the line (20%).
430 SvxLineSpacingItem aLSpace(0, wid);
431
433 if (1000 == nTokenValue )
434 nTokenValue = 240;
435
436 SvxLineSpaceRule eLnSpc;
437 if (nTokenValue < 0)
438 {
439 eLnSpc = SvxLineSpaceRule::Fix;
441 }
442 else if (nTokenValue == 0)
443 {
444 //if \sl0 is used, the line spacing is automatically
445 //determined
446 eLnSpc = SvxLineSpaceRule::Auto;
447 }
448 else
449 eLnSpc = SvxLineSpaceRule::Min;
450
451 if (IsCalcValue())
452 CalcValue();
453
454 if (eLnSpc != SvxLineSpaceRule::Auto)
455 aLSpace.SetLineHeight( static_cast<sal_uInt16>(nTokenValue) );
456
457 aLSpace.SetLineSpaceRule(eLnSpc);
458 pSet->Put(aLSpace);
459 }
460 break;
461
462 case RTF_NOCWRAP:
463 if (const TypedWhichId<SvxForbiddenRuleItem> wid = aPardMap[SID_ATTR_PARA_FORBIDDEN_RULES])
464 {
465 pSet->Put(SvxForbiddenRuleItem(false, wid));
466 }
467 break;
468 case RTF_NOOVERFLOW:
469 if (const TypedWhichId<SvxHangingPunctuationItem> wid = aPardMap[SID_ATTR_PARA_HANGPUNCTUATION])
470 {
471 pSet->Put(SvxHangingPunctuationItem(false, wid));
472 }
473 break;
474
475 case RTF_ASPALPHA:
476 if (const TypedWhichId<SvxScriptSpaceItem> wid = aPardMap[SID_ATTR_PARA_SCRIPTSPACE])
477 {
478 pSet->Put(SvxScriptSpaceItem(true, wid));
479 }
480 break;
481
482 case RTF_FAFIXED:
484 goto SET_FONTALIGNMENT;
486 goto SET_FONTALIGNMENT;
488 goto SET_FONTALIGNMENT;
490 goto SET_FONTALIGNMENT;
492 goto SET_FONTALIGNMENT;
493SET_FONTALIGNMENT:
494 if (const TypedWhichId<SvxParaVertAlignItem> wid = aPardMap[SID_PARA_VERTALIGN])
495 {
496 pSet->Put(SvxParaVertAlignItem(nFontAlign, wid));
497 }
498 break;
499
500 case RTF_B:
501 case RTF_AB:
502 if( IsAttrSttPos() ) // not in the text flow?
503 {
504
505 SvxWeightItem aTmpItem(
507 SID_ATTR_CHAR_WEIGHT );
508 SetScriptAttr( eCharType, *pSet, aTmpItem);
509 }
510 break;
511
512 case RTF_CAPS:
513 case RTF_SCAPS:
514 if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_CASEMAP];
515 wid && IsAttrSttPos()) // not in the text flow?
516 {
517 SvxCaseMap eCaseMap;
518 if( !nTokenValue )
519 eCaseMap = SvxCaseMap::NotMapped;
520 else if( RTF_CAPS == nToken )
521 eCaseMap = SvxCaseMap::Uppercase;
522 else
523 eCaseMap = SvxCaseMap::SmallCaps;
524
525 pSet->Put(SvxCaseMapItem(eCaseMap, wid));
526 }
527 break;
528
529 case RTF_DN:
530 case RTF_SUB:
531 if (const sal_uInt16 nEsc = aPlainMap[SID_ATTR_CHAR_ESCAPEMENT])
532 {
533 if( -1 == nTokenValue )
534 nTokenValue = 6; //RTF default \dn value in half-points
535 if( IsCalcValue() )
536 CalcValue();
537 const SvxEscapementItem& rOld =
538 static_cast<const SvxEscapementItem&>(pSet->Get( nEsc,false));
539 sal_Int16 nEs;
540 sal_uInt8 nProp;
541 if( DFLT_ESC_AUTO_SUPER == rOld.GetEsc() )
542 {
543 nEs = DFLT_ESC_AUTO_SUB;
544 nProp = rOld.GetProportionalHeight();
545 }
546 else
547 {
549 nProp = (nToken == RTF_SUB) ? DFLT_ESC_PROP : 100;
550 }
551 pSet->Put( SvxEscapementItem( nEs, nProp, nEsc ));
552 }
553 break;
554
555 case RTF_NOSUPERSUB:
556 if (const sal_uInt16 nEsc = aPlainMap[SID_ATTR_CHAR_ESCAPEMENT])
557 {
558 pSet->Put( SvxEscapementItem( nEsc ));
559 }
560 break;
561
562 case RTF_EXPND:
563 if (TypedWhichId<SvxKerningItem> wid = aPlainMap[SID_ATTR_CHAR_KERNING])
564 {
565 if( -1 == nTokenValue )
566 nTokenValue = 0;
567 else
568 nTokenValue *= 5;
569 if( IsCalcValue() )
570 CalcValue();
571 pSet->Put(SvxKerningItem(static_cast<short>(nTokenValue), wid));
572 }
573 break;
574
575 case RTF_KERNING:
576 if (const TypedWhichId<SvxAutoKernItem> wid = aPlainMap[SID_ATTR_CHAR_AUTOKERN])
577 {
578 if( -1 == nTokenValue )
579 nTokenValue = 0;
580 else
581 nTokenValue *= 10;
582 if( IsCalcValue() )
583 CalcValue();
584 pSet->Put(SvxAutoKernItem(0 != nTokenValue, wid));
585 }
586 break;
587
588 case RTF_EXPNDTW:
589 if (TypedWhichId<SvxKerningItem> wid = aPlainMap[SID_ATTR_CHAR_KERNING])
590 {
591 if( -1 == nTokenValue )
592 nTokenValue = 0;
593 if( IsCalcValue() )
594 CalcValue();
595 pSet->Put(SvxKerningItem(static_cast<short>(nTokenValue), wid));
596 }
597 break;
598
599 case RTF_F:
600 case RTF_AF:
601 {
602 const vcl::Font& rSVFont = GetFont( sal_uInt16(nTokenValue) );
603 SvxFontItem aTmpItem( rSVFont.GetFamilyType(),
604 rSVFont.GetFamilyName(), rSVFont.GetStyleName(),
605 rSVFont.GetPitch(), rSVFont.GetCharSet(),
606 SID_ATTR_CHAR_FONT );
607 SetScriptAttr( eCharType, *pSet, aTmpItem );
608 if( RTF_F == nToken )
609 {
610 SetEncoding( rSVFont.GetCharSet() );
612 }
613 }
614 break;
615
616 case RTF_FS:
617 case RTF_AFS:
618 {
619 if( -1 == nTokenValue )
620 nTokenValue = 240;
621 else
622 nTokenValue *= 10;
623// #i66167#
624// for the SwRTFParser 'IsCalcValue' will be false and for the EditRTFParser
625// the conversion takes now place in EditRTFParser since for other reasons
626// the wrong MapUnit might still be use there
627// if( IsCalcValue() )
628// CalcValue();
629 SvxFontHeightItem aTmpItem(
630 static_cast<sal_uInt16>(nTokenValue), 100,
631 SID_ATTR_CHAR_FONTHEIGHT );
632 SetScriptAttr( eCharType, *pSet, aTmpItem );
633 }
634 break;
635
636 case RTF_I:
637 case RTF_AI:
638 if( IsAttrSttPos() ) // not in the text flow?
639 {
640 SvxPostureItem aTmpItem(
642 SID_ATTR_CHAR_POSTURE );
643 SetScriptAttr( eCharType, *pSet, aTmpItem );
644 }
645 break;
646
647 case RTF_OUTL:
648 if (const TypedWhichId<SvxContourItem> wid = aPlainMap[SID_ATTR_CHAR_CONTOUR];
649 wid && IsAttrSttPos()) // not in the text flow?
650 {
651 pSet->Put(SvxContourItem(nTokenValue != 0, wid));
652 }
653 break;
654
655 case RTF_SHAD:
656 if (const TypedWhichId<SvxShadowedItem> wid = aPlainMap[SID_ATTR_CHAR_SHADOWED];
657 wid && IsAttrSttPos()) // not in the text flow?
658 {
659 pSet->Put(SvxShadowedItem(nTokenValue != 0, wid));
660 }
661 break;
662
663 case RTF_STRIKE:
664 if (const TypedWhichId<SvxCrossedOutItem> wid = aPlainMap[SID_ATTR_CHAR_STRIKEOUT];
665 wid && IsAttrSttPos()) // not in the text flow?
666 {
667 pSet->Put( SvxCrossedOutItem(
669 wid ));
670 }
671 break;
672
673 case RTF_STRIKED:
674 if (const TypedWhichId<SvxCrossedOutItem> wid = aPlainMap[SID_ATTR_CHAR_STRIKEOUT]) // not in the text flow?
675 {
676 pSet->Put( SvxCrossedOutItem(
678 wid ));
679 }
680 break;
681
682 case RTF_UL:
683 if( !IsAttrSttPos() )
684 break;
686 goto ATTR_SETUNDERLINE;
687
688 case RTF_ULD:
689 eUnderline = LINESTYLE_DOTTED;
690 goto ATTR_SETUNDERLINE;
691 case RTF_ULDASH:
692 eUnderline = LINESTYLE_DASH;
693 goto ATTR_SETUNDERLINE;
694 case RTF_ULDASHD:
695 eUnderline = LINESTYLE_DASHDOT;
696 goto ATTR_SETUNDERLINE;
697 case RTF_ULDASHDD:
698 eUnderline = LINESTYLE_DASHDOTDOT;
699 goto ATTR_SETUNDERLINE;
700 case RTF_ULDB:
701 eUnderline = LINESTYLE_DOUBLE;
702 goto ATTR_SETUNDERLINE;
703 case RTF_ULNONE:
704 eUnderline = LINESTYLE_NONE;
705 goto ATTR_SETUNDERLINE;
706 case RTF_ULTH:
707 eUnderline = LINESTYLE_BOLD;
708 goto ATTR_SETUNDERLINE;
709 case RTF_ULWAVE:
710 eUnderline = LINESTYLE_WAVE;
711 goto ATTR_SETUNDERLINE;
712 case RTF_ULTHD:
713 eUnderline = LINESTYLE_BOLDDOTTED;
714 goto ATTR_SETUNDERLINE;
715 case RTF_ULTHDASH:
716 eUnderline = LINESTYLE_BOLDDASH;
717 goto ATTR_SETUNDERLINE;
718 case RTF_ULLDASH:
719 eUnderline = LINESTYLE_LONGDASH;
720 goto ATTR_SETUNDERLINE;
721 case RTF_ULTHLDASH:
722 eUnderline = LINESTYLE_BOLDLONGDASH;
723 goto ATTR_SETUNDERLINE;
724 case RTF_ULTHDASHD:
725 eUnderline = LINESTYLE_BOLDDASHDOT;
726 goto ATTR_SETUNDERLINE;
727 case RTF_ULTHDASHDD:
728 eUnderline = LINESTYLE_BOLDDASHDOTDOT;
729 goto ATTR_SETUNDERLINE;
730 case RTF_ULHWAVE:
731 eUnderline = LINESTYLE_BOLDWAVE;
732 goto ATTR_SETUNDERLINE;
733 case RTF_ULULDBWAVE:
734 eUnderline = LINESTYLE_DOUBLEWAVE;
735 goto ATTR_SETUNDERLINE;
736
737 case RTF_ULW:
738 eUnderline = LINESTYLE_SINGLE;
739
740 if (const TypedWhichId<SvxWordLineModeItem> wid = aPlainMap[SID_ATTR_CHAR_WORDLINEMODE])
741 {
742 pSet->Put(SvxWordLineModeItem(true, wid));
743 }
744 goto ATTR_SETUNDERLINE;
745
746ATTR_SETUNDERLINE:
747 if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_UNDERLINE])
748 {
749 pSet->Put(SvxUnderlineItem(eUnderline, wid));
750 }
751 break;
752
753 case RTF_ULC:
754 if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_UNDERLINE])
755 {
756 std::unique_ptr<SvxUnderlineItem> aUL(std::make_unique<SvxUnderlineItem>(LINESTYLE_SINGLE, wid));
757 const SfxPoolItem* pItem(nullptr);
758
759 if (SfxItemState::SET == pSet->GetItemState(wid, false, &pItem))
760 {
761 // is switched off ?
762 if( LINESTYLE_NONE == static_cast<const SvxUnderlineItem*>(pItem)->GetLineStyle() )
763 break;
764
765 aUL.reset(static_cast<SvxUnderlineItem*>(pItem->Clone()));
766 }
767 else
768 {
769 aUL.reset(static_cast<SvxUnderlineItem*>(pSet->Get(wid, false).Clone()));
770 }
771
772 if(LINESTYLE_NONE == aUL->GetLineStyle())
773 {
774 aUL->SetLineStyle(LINESTYLE_SINGLE);
775 }
776
777 aUL->SetColor(GetColor(sal_uInt16(nTokenValue)));
778
779 pSet->Put(std::move(aUL));
780 }
781 break;
782
783 case RTF_OL:
784 if( !IsAttrSttPos() )
785 break;
787 goto ATTR_SETOVERLINE;
788
789 case RTF_OLD:
790 eOverline = LINESTYLE_DOTTED;
791 goto ATTR_SETOVERLINE;
792 case RTF_OLDASH:
793 eOverline = LINESTYLE_DASH;
794 goto ATTR_SETOVERLINE;
795 case RTF_OLDASHD:
796 eOverline = LINESTYLE_DASHDOT;
797 goto ATTR_SETOVERLINE;
798 case RTF_OLDASHDD:
799 eOverline = LINESTYLE_DASHDOTDOT;
800 goto ATTR_SETOVERLINE;
801 case RTF_OLDB:
802 eOverline = LINESTYLE_DOUBLE;
803 goto ATTR_SETOVERLINE;
804 case RTF_OLNONE:
805 eOverline = LINESTYLE_NONE;
806 goto ATTR_SETOVERLINE;
807 case RTF_OLTH:
808 eOverline = LINESTYLE_BOLD;
809 goto ATTR_SETOVERLINE;
810 case RTF_OLWAVE:
811 eOverline = LINESTYLE_WAVE;
812 goto ATTR_SETOVERLINE;
813 case RTF_OLTHD:
814 eOverline = LINESTYLE_BOLDDOTTED;
815 goto ATTR_SETOVERLINE;
816 case RTF_OLTHDASH:
817 eOverline = LINESTYLE_BOLDDASH;
818 goto ATTR_SETOVERLINE;
819 case RTF_OLLDASH:
820 eOverline = LINESTYLE_LONGDASH;
821 goto ATTR_SETOVERLINE;
822 case RTF_OLTHLDASH:
823 eOverline = LINESTYLE_BOLDLONGDASH;
824 goto ATTR_SETOVERLINE;
825 case RTF_OLTHDASHD:
826 eOverline = LINESTYLE_BOLDDASHDOT;
827 goto ATTR_SETOVERLINE;
828 case RTF_OLTHDASHDD:
829 eOverline = LINESTYLE_BOLDDASHDOTDOT;
830 goto ATTR_SETOVERLINE;
831 case RTF_OLHWAVE:
832 eOverline = LINESTYLE_BOLDWAVE;
833 goto ATTR_SETOVERLINE;
834 case RTF_OLOLDBWAVE:
835 eOverline = LINESTYLE_DOUBLEWAVE;
836 goto ATTR_SETOVERLINE;
837
838 case RTF_OLW:
839 eOverline = LINESTYLE_SINGLE;
840
841 if (const TypedWhichId<SvxWordLineModeItem> wid = aPlainMap[SID_ATTR_CHAR_WORDLINEMODE])
842 {
843 pSet->Put(SvxWordLineModeItem(true, wid));
844 }
845 goto ATTR_SETOVERLINE;
846
847ATTR_SETOVERLINE:
848 if (const TypedWhichId<SvxOverlineItem> wid = aPlainMap[SID_ATTR_CHAR_OVERLINE])
849 {
850 pSet->Put(SvxOverlineItem(eOverline, wid));
851 }
852 break;
853
854 case RTF_OLC:
855 if (const TypedWhichId<SvxOverlineItem> wid = aPlainMap[SID_ATTR_CHAR_OVERLINE])
856 {
857 std::unique_ptr<SvxOverlineItem> aOL(std::make_unique<SvxOverlineItem>(LINESTYLE_SINGLE, wid));
858 const SfxPoolItem* pItem(nullptr);
859
860 if (SfxItemState::SET == pSet->GetItemState(wid, false, &pItem))
861 {
862 // is switched off ?
863 if( LINESTYLE_NONE == static_cast<const SvxOverlineItem*>(pItem)->GetLineStyle() )
864 break;
865
866 aOL.reset(static_cast<SvxOverlineItem*>(pItem->Clone()));
867 }
868 else
869 {
870 aOL.reset(pSet->Get(wid, false).Clone());
871 }
872
873 if(LINESTYLE_NONE == aOL->GetLineStyle())
874 {
875 aOL->SetLineStyle(LINESTYLE_SINGLE);
876 }
877
878 aOL->SetColor(GetColor(sal_uInt16(nTokenValue)));
879
880 pSet->Put(std::move(aOL));
881 }
882 break;
883
884 case RTF_UP:
885 case RTF_SUPER:
886 if (const sal_uInt16 nEsc = aPlainMap[SID_ATTR_CHAR_ESCAPEMENT])
887 {
888 if( -1 == nTokenValue )
889 nTokenValue = 6; //RTF default \up value in half-points
890 if( IsCalcValue() )
891 CalcValue();
892 const SvxEscapementItem& rOld =
893 static_cast<const SvxEscapementItem&>(pSet->Get( nEsc,false));
894 sal_Int16 nEs;
895 sal_uInt8 nProp;
896 if( DFLT_ESC_AUTO_SUB == rOld.GetEsc() )
897 {
899 nProp = rOld.GetProportionalHeight();
900 }
901 else
902 {
904 nProp = (nToken == RTF_SUPER) ? DFLT_ESC_PROP : 100;
905 }
906 pSet->Put( SvxEscapementItem( nEs, nProp, nEsc ));
907 }
908 break;
909
910 case RTF_CF:
911 if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_COLOR])
912 {
913 pSet->Put(SvxColorItem(GetColor(sal_uInt16(nTokenValue)), wid));
914 }
915 break;
916 //#i12501# While cb is clearly documented in the rtf spec, word
917 //doesn't accept it at all
918#if 0
919 case RTF_CB:
920 if (const sal_uInt16 wid = aPlainMap[SID_ATTR_BRUSH_CHAR])
921 {
922 pSet->Put(SvxBrushItem(GetColor(sal_uInt16(nTokenValue)), wid));
923 }
924 break;
925#endif
926
927 case RTF_LANG:
928 if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_LANGUAGE])
929 {
931 }
932 break;
933
934 case RTF_LANGFE:
935 if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_CJK_LANGUAGE])
936 {
938 }
939 break;
940 case RTF_ALANG:
941 {
943 SID_ATTR_CHAR_LANGUAGE );
944 SetScriptAttr( eCharType, *pSet, aTmpItem );
945 }
946 break;
947
948 case RTF_RTLCH:
949 bIsLeftToRightDef = false;
950 break;
951 case RTF_LTRCH:
952 bIsLeftToRightDef = true;
953 break;
954 case RTF_RTLPAR:
955 if (const TypedWhichId<SvxFrameDirectionItem> wid = aPardMap[SID_ATTR_FRAMEDIRECTION])
956 {
958 }
959 break;
960 case RTF_LTRPAR:
961 if (const TypedWhichId<SvxFrameDirectionItem> wid = aPardMap[SID_ATTR_FRAMEDIRECTION])
962 {
964 }
965 break;
966 case RTF_LOCH: eCharType = LOW_CHARTYPE; break;
967 case RTF_HICH: eCharType = HIGH_CHARTYPE; break;
968 case RTF_DBCH: eCharType = DOUBLEBYTE_CHARTYPE; break;
969
970
971 case RTF_ACCNONE:
972 eEmphasis = FontEmphasisMark::NONE;
973 goto ATTR_SETEMPHASIS;
974 case RTF_ACCDOT:
975 eEmphasis = (FontEmphasisMark::Dot | FontEmphasisMark::PosAbove);
976 goto ATTR_SETEMPHASIS;
977
978 case RTF_ACCCOMMA:
979 eEmphasis = (FontEmphasisMark::Accent | FontEmphasisMark::PosAbove);
980ATTR_SETEMPHASIS:
981 if (const TypedWhichId<SvxEmphasisMarkItem> wid = aPlainMap[SID_ATTR_CHAR_EMPHASISMARK])
982 {
983 pSet->Put(SvxEmphasisMarkItem(eEmphasis, wid));
984 }
985 break;
986
987 case RTF_TWOINONE:
988 if (const TypedWhichId<SvxTwoLinesItem> wid = aPlainMap[SID_ATTR_CHAR_TWO_LINES])
989 {
990 sal_Unicode cStt, cEnd;
991 switch ( nTokenValue )
992 {
993 case 1: cStt = '('; cEnd = ')'; break;
994 case 2: cStt = '['; cEnd = ']'; break;
995 case 3: cStt = '<'; cEnd = '>'; break;
996 case 4: cStt = '{'; cEnd = '}'; break;
997 default: cStt = 0; cEnd = 0; break;
998 }
999
1000 pSet->Put(SvxTwoLinesItem(true, cStt, cEnd, wid));
1001 }
1002 break;
1003
1004 case RTF_CHARSCALEX :
1005 if (const TypedWhichId<SvxCharScaleWidthItem> wid = aPlainMap[SID_ATTR_CHAR_SCALEWIDTH])
1006 {
1007 //i21372
1008 if (nTokenValue < 1 || nTokenValue > 600)
1009 nTokenValue = 100;
1010 pSet->Put(SvxCharScaleWidthItem(sal_uInt16(nTokenValue), wid));
1011 }
1012 break;
1013
1014 case RTF_HORZVERT:
1015 if (const TypedWhichId<SvxCharRotateItem> wid = aPlainMap[SID_ATTR_CHAR_ROTATED])
1016 {
1017 // RTF knows only 90deg
1018 pSet->Put(SvxCharRotateItem(900_deg10, 1 == nTokenValue, wid));
1019 }
1020 break;
1021
1022 case RTF_EMBO:
1023 if (const TypedWhichId<SvxCharReliefItem> wid = aPlainMap[SID_ATTR_CHAR_RELIEF])
1024 {
1025 pSet->Put(SvxCharReliefItem(FontRelief::Embossed, wid));
1026 }
1027 break;
1028 case RTF_IMPR:
1029 if (const TypedWhichId<SvxCharReliefItem> wid = aPlainMap[SID_ATTR_CHAR_RELIEF])
1030 {
1031 pSet->Put(SvxCharReliefItem(FontRelief::Engraved, wid));
1032 }
1033 break;
1034 case RTF_V:
1035 if (const TypedWhichId<SvxCharHiddenItem> wid = aPlainMap[SID_ATTR_CHAR_HIDDEN])
1036 {
1037 pSet->Put(SvxCharHiddenItem(nTokenValue != 0, wid));
1038 }
1039 break;
1040 case RTF_CHBGFDIAG:
1041 case RTF_CHBGDKVERT:
1042 case RTF_CHBGDKHORIZ:
1043 case RTF_CHBGVERT:
1044 case RTF_CHBGHORIZ:
1045 case RTF_CHBGDKFDIAG:
1046 case RTF_CHBGDCROSS:
1047 case RTF_CHBGCROSS:
1048 case RTF_CHBGBDIAG:
1049 case RTF_CHBGDKDCROSS:
1050 case RTF_CHBGDKCROSS:
1051 case RTF_CHBGDKBDIAG:
1052 case RTF_CHCBPAT:
1053 case RTF_CHCFPAT:
1054 case RTF_CHSHDNG:
1055 if (aPlainMap[SID_ATTR_BRUSH_CHAR])
1056 ReadBackgroundAttr( nToken, *pSet );
1057 break;
1058
1059 case BRACELEFT:
1060 {
1061 // tests on Swg internal tokens
1062 bool bHandled = false;
1063 short nSkip = 0;
1065 nSkip = -1;
1066 else if( (nToken = GetNextToken() ) & RTF_SWGDEFS )
1067 {
1068 bHandled = true;
1069 switch( nToken )
1070 {
1071 case RTF_PGDSCNO:
1072 case RTF_PGBRK:
1073 case RTF_SOUTLVL:
1075 // overwrite the closing parenthesis
1076 break;
1077
1078 case RTF_SWG_ESCPROP:
1079 {
1080 // Store percentage change!
1081 sal_uInt8 nProp = sal_uInt8( nTokenValue / 100 );
1082 short nEsc = 0;
1083 if( 1 == ( nTokenValue % 100 ))
1084 // Recognize own auto-flags!
1085 nEsc = DFLT_ESC_AUTO_SUPER;
1086
1087 if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_ESCAPEMENT])
1088 pSet->Put(SvxEscapementItem(nEsc, nProp, wid));
1089 }
1090 break;
1091
1092 case RTF_HYPHEN:
1093 {
1094 SvxHyphenZoneItem aHypenZone(
1095 (nTokenValue & 1) != 0,
1096 aPardMap[SID_ATTR_PARA_HYPHENZONE]);
1097 aHypenZone.SetPageEnd((nTokenValue & 2) != 0);
1098
1099 if( aPardMap[SID_ATTR_PARA_HYPHENZONE] &&
1103 {
1104 aHypenZone.GetMinLead() =
1106 aHypenZone.GetMinTrail() =
1108 aHypenZone.GetMaxHyphens() =
1110
1111 pSet->Put( aHypenZone );
1112 }
1113 else
1114 SkipGroup(); // at the end of the group
1115 }
1116 break;
1117
1118 // We expect these to be preceded by a RTF_HYPHEN and
1119 // so normally are handled by the RTF_HYPHEN case, but
1120 // if they appear 'bare' in a document then safely skip
1121 // them here
1122 case RTF_HYPHLEAD:
1123 case RTF_HYPHTRAIL:
1124 case RTF_HYPHMAX:
1125 SkipGroup();
1126 break;
1127
1128 case RTF_SHADOW:
1129 {
1130 bool bSkip = true;
1131 do { // middle check loop
1133 if( RTF_SHDW_DIST != GetNextToken() )
1134 break;
1135 sal_uInt16 nDist = sal_uInt16( nTokenValue );
1136
1137 if( RTF_SHDW_STYLE != GetNextToken() )
1138 break;
1139
1140 if( RTF_SHDW_COL != GetNextToken() )
1141 break;
1142 sal_uInt16 nCol = sal_uInt16( nTokenValue );
1143
1144 if( RTF_SHDW_FCOL != GetNextToken() )
1145 break;
1146
1147 Color aColor = GetColor( nCol );
1148
1149 if (const TypedWhichId<SvxShadowItem> wid = aPardMap[SID_ATTR_BORDER_SHADOW])
1150 pSet->Put(SvxShadowItem(wid, &aColor, nDist, eSL));
1151
1152 bSkip = false;
1153 } while( false );
1154
1155 if( bSkip )
1156 SkipGroup(); // at the end of the group
1157 }
1158 break;
1159
1160 default:
1161 bHandled = false;
1162 if( (nToken & ~(0xff | RTF_SWGDEFS)) == RTF_TABSTOPDEF )
1163 {
1164 nToken = SkipToken( -2 );
1165 ReadTabAttr( nToken, *pSet );
1166
1167 /*
1168 cmc: #i76140, he who consumed the { must consume the }
1169 We rewound to a state of { being the current
1170 token so it is our responsibility to consume the }
1171 token if we consumed the {. We will not have consumed
1172 the { if it belonged to our caller, i.e. if the { we
1173 are handling is the "firsttoken" passed to us then
1174 the *caller* must consume it, not us. Otherwise *we*
1175 should consume it.
1176 */
1177 if (nToken == BRACELEFT && !bFirstToken)
1178 {
1179 nToken = GetNextToken();
1181 "editeng",
1182 "} did not follow { as expected");
1183 }
1184 }
1185 else if( (nToken & ~(0xff| RTF_SWGDEFS)) == RTF_BRDRDEF)
1186 {
1187 nToken = SkipToken( -2 );
1188 ReadBorderAttr( nToken, *pSet );
1189 }
1190 else // so no more attribute
1191 nSkip = -2;
1192 break;
1193 }
1194
1195#if 1
1196 /*
1197 cmc: #i4727# / #i12713# Who owns this closing bracket?
1198 If we read the opening one, we must read this one, if
1199 other is counting the brackets so as to push/pop off
1200 the correct environment then we will have pushed a new
1201 environment for the start { of this, but will not see
1202 the } and so is out of sync for the rest of the
1203 document.
1204 */
1205 if (bHandled && !bFirstToken)
1206 GetNextToken();
1207#endif
1208 }
1209 else
1210 nSkip = -2;
1211
1212 if( nSkip ) // all completely unknown
1213 {
1214 if (!bFirstToken)
1215 --nSkip; // BRACELEFT: is the next token
1216 SkipToken( nSkip );
1217 bContinue = false;
1218 }
1219 }
1220 break;
1221 default:
1222 if( (nToken & ~0xff ) == RTF_TABSTOPDEF )
1223 ReadTabAttr( nToken, *pSet );
1224 else if( (nToken & ~0xff ) == RTF_BRDRDEF )
1225 ReadBorderAttr( nToken, *pSet );
1226 else if( (nToken & ~0xff ) == RTF_SHADINGDEF )
1227 ReadBackgroundAttr( nToken, *pSet );
1228 else
1229 {
1230 // unknown token, so token "returned in Parser"
1231 if( !bFirstToken )
1232 SkipToken();
1233 bContinue = false;
1234 }
1235 }
1236 }
1237 if( bContinue )
1238 {
1239 nToken = GetNextToken();
1240 }
1241 bFirstToken = false;
1242 }
1243}
1244
1245void SvxRTFParser::ReadTabAttr( int nToken, SfxItemSet& rSet )
1246{
1247 bool bMethodOwnsToken = false; // #i52542# patch from cmc.
1248// then read all the TabStops
1249 SvxTabStop aTabStop;
1250 SvxTabStopItem aAttr(0, 0, SvxTabAdjust::Default, aPardMap[SID_ATTR_TABSTOP]);
1251 bool bContinue = true;
1252 do {
1253 switch( nToken )
1254 {
1255 case RTF_TB: // BarTab ???
1256 case RTF_TX:
1257 {
1258 if( IsCalcValue() )
1259 CalcValue();
1260 aTabStop.GetTabPos() = nTokenValue;
1261 aAttr.Insert( aTabStop );
1262 aTabStop = SvxTabStop(); // all values default
1263 }
1264 break;
1265
1266 case RTF_TQL:
1267 aTabStop.GetAdjustment() = SvxTabAdjust::Left;
1268 break;
1269 case RTF_TQR:
1271 break;
1272 case RTF_TQC:
1274 break;
1275 case RTF_TQDEC:
1277 break;
1278
1279 case RTF_TLDOT: aTabStop.GetFill() = '.'; break;
1280 case RTF_TLHYPH: aTabStop.GetFill() = ' '; break;
1281 case RTF_TLUL: aTabStop.GetFill() = '_'; break;
1282 case RTF_TLTH: aTabStop.GetFill() = '-'; break;
1283 case RTF_TLEQ: aTabStop.GetFill() = '='; break;
1284
1285 case BRACELEFT:
1286 {
1287 // Swg - control BRACELEFT RTF_IGNOREFLAG RTF_TLSWG BRACERIGHT
1288 short nSkip = 0;
1289 if( RTF_IGNOREFLAG != GetNextToken() )
1290 nSkip = -1;
1291 else if( RTF_TLSWG != ( nToken = GetNextToken() ))
1292 nSkip = -2;
1293 else
1294 {
1295 aTabStop.GetDecimal() = sal_uInt8(nTokenValue & 0xff);
1296 aTabStop.GetFill() = sal_uInt8((nTokenValue >> 8) & 0xff);
1297 // overwrite the closing parenthesis
1298 if (bMethodOwnsToken)
1299 GetNextToken();
1300 }
1301 if( nSkip )
1302 {
1303 SkipToken( nSkip ); // Ignore back again
1304 bContinue = false;
1305 }
1306 }
1307 break;
1308
1309 default:
1310 bContinue = false;
1311 }
1312 if( bContinue )
1313 {
1314 nToken = GetNextToken();
1315 bMethodOwnsToken = true;
1316 }
1317 } while( bContinue );
1318
1319 // Fill with defaults is still missing!
1320 rSet.Put( aAttr );
1321 SkipToken();
1322}
1323
1324static void SetBorderLine( int nBorderTyp, SvxBoxItem& rItem,
1325 const SvxBorderLine& rBorder )
1326{
1327 switch( nBorderTyp )
1328 {
1329 case RTF_BOX: // run through all levels
1330 case RTF_BRDRT:
1331 rItem.SetLine( &rBorder, SvxBoxItemLine::TOP );
1332 if( RTF_BOX != nBorderTyp )
1333 return;
1334 [[fallthrough]];
1335 case RTF_BRDRB:
1336 rItem.SetLine( &rBorder, SvxBoxItemLine::BOTTOM );
1337 if( RTF_BOX != nBorderTyp )
1338 return;
1339 [[fallthrough]];
1340 case RTF_BRDRL:
1341 rItem.SetLine( &rBorder, SvxBoxItemLine::LEFT );
1342 if( RTF_BOX != nBorderTyp )
1343 return;
1344 [[fallthrough]];
1345 case RTF_BRDRR:
1346 rItem.SetLine( &rBorder, SvxBoxItemLine::RIGHT );
1347 if( RTF_BOX != nBorderTyp )
1348 return;
1349 }
1350}
1351
1353 bool bTableDef )
1354{
1355 // then read the border attribute
1356 std::unique_ptr<SvxBoxItem> aAttr(std::make_unique<SvxBoxItem>(aPardMap[SID_ATTR_BORDER_OUTER]));
1357 const SfxPoolItem* pItem(nullptr);
1358
1359 if (SfxItemState::SET == rSet.GetItemState(aPardMap[SID_ATTR_BORDER_OUTER], false, &pItem))
1360 {
1361 aAttr.reset(static_cast<SvxBoxItem*>(pItem->Clone()));
1362 }
1363
1365 bool bContinue = true;
1366 int nBorderTyp = 0;
1367
1368 tools::Long nWidth = 1;
1369 bool bDoubleWidth = false;
1370
1371 do {
1372 switch( nToken )
1373 {
1374 case RTF_BOX:
1375 case RTF_BRDRT:
1376 case RTF_BRDRB:
1377 case RTF_BRDRL:
1378 case RTF_BRDRR:
1379 nBorderTyp = nToken;
1380 break;
1381
1382 case RTF_CLBRDRT: // Cell top border
1383 {
1384 if( bTableDef )
1385 {
1386 if (nBorderTyp != 0)
1387 SetBorderLine( nBorderTyp, *aAttr, aBrd );
1388 nBorderTyp = RTF_BRDRT;
1389 }
1390 break;
1391 }
1392 case RTF_CLBRDRB: // Cell bottom border
1393 {
1394 if( bTableDef )
1395 {
1396 if (nBorderTyp != 0)
1397 SetBorderLine( nBorderTyp, *aAttr, aBrd );
1398 nBorderTyp = RTF_BRDRB;
1399 }
1400 break;
1401 }
1402 case RTF_CLBRDRL: // Cell left border
1403 {
1404 if( bTableDef )
1405 {
1406 if (nBorderTyp != 0)
1407 SetBorderLine( nBorderTyp, *aAttr, aBrd );
1408 nBorderTyp = RTF_BRDRL;
1409 }
1410 break;
1411 }
1412 case RTF_CLBRDRR: // Cell right border
1413 {
1414 if( bTableDef )
1415 {
1416 if (nBorderTyp != 0)
1417 SetBorderLine( nBorderTyp, *aAttr, aBrd );
1418 nBorderTyp = RTF_BRDRR;
1419 }
1420 break;
1421 }
1422
1423 case RTF_BRDRDOT: // dotted border
1425 break;
1426 case RTF_BRDRDASH: // dashed border
1428 break;
1429 case RTF_BRDRHAIR: // hairline border
1430 {
1433 }
1434 break;
1435 case RTF_BRDRDB: // Double border
1437 break;
1438 case RTF_BRDRINSET: // inset border
1440 break;
1441 case RTF_BRDROUTSET: // outset border
1443 break;
1444 case RTF_BRDRTNTHSG: // ThinThick Small gap
1446 break;
1447 case RTF_BRDRTNTHMG: // ThinThick Medium gap
1449 break;
1450 case RTF_BRDRTNTHLG: // ThinThick Large gap
1452 break;
1453 case RTF_BRDRTHTNSG: // ThickThin Small gap
1455 break;
1456 case RTF_BRDRTHTNMG: // ThickThin Medium gap
1458 break;
1459 case RTF_BRDRTHTNLG: // ThickThin Large gap
1461 break;
1462 case RTF_BRDREMBOSS: // Embossed border
1464 break;
1465 case RTF_BRDRENGRAVE: // Engraved border
1467 break;
1468
1469 case RTF_BRDRS: // single thickness border
1470 bDoubleWidth = false;
1471 break;
1472 case RTF_BRDRTH: // double thickness border width*2
1473 bDoubleWidth = true;
1474 break;
1475 case RTF_BRDRW: // border width <255
1476 nWidth = nTokenValue;
1477 break;
1478
1479 case RTF_BRDRCF: // Border color
1480 aBrd.SetColor( GetColor( sal_uInt16(nTokenValue) ) );
1481 break;
1482
1483 case RTF_BRDRSH: // Shadowed border
1484 rSet.Put( SvxShadowItem( aPardMap[SID_ATTR_BORDER_SHADOW], nullptr, 60 /*3pt*/,
1486 break;
1487
1488 case RTF_BRSP: // Spacing to content in twip
1489 {
1490 switch( nBorderTyp )
1491 {
1492 case RTF_BRDRB:
1493 aAttr->SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::BOTTOM );
1494 break;
1495
1496 case RTF_BRDRT:
1497 aAttr->SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::TOP );
1498 break;
1499
1500 case RTF_BRDRL:
1501 aAttr->SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::LEFT );
1502 break;
1503
1504 case RTF_BRDRR:
1505 aAttr->SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::RIGHT );
1506 break;
1507
1508 case RTF_BOX:
1509 aAttr->SetAllDistances( static_cast<sal_uInt16>(nTokenValue) );
1510 break;
1511 }
1512 }
1513 break;
1514
1515 case RTF_BRDRBTW: // Border formatting group
1516 case RTF_BRDRBAR: // Border outside
1517 // TODO unhandled ATM
1518 break;
1519
1520 default:
1521 bContinue = (nToken & ~(0xff| RTF_SWGDEFS)) == RTF_BRDRDEF;
1522 }
1523 if( bContinue )
1524 nToken = GetNextToken();
1525 } while( bContinue );
1526
1527 // Finally compute the border width
1528 if ( bDoubleWidth ) nWidth *= 2;
1529 aBrd.SetWidth( nWidth );
1530
1531 SetBorderLine( nBorderTyp, *aAttr, aBrd );
1532
1533 rSet.Put( std::move(aAttr) );
1534 SkipToken();
1535}
1536
1537static sal_uInt32 CalcShading( sal_uInt32 nColor, sal_uInt32 nFillColor, sal_uInt8 nShading )
1538{
1539 nColor = (nColor * nShading) / 100;
1540 nFillColor = (nFillColor * ( 100 - nShading )) / 100;
1541 return nColor + nFillColor;
1542}
1543
1545 bool bTableDef )
1546{
1547 // then read the border attribute
1548 bool bContinue = true;
1549 sal_uInt16 nColor = USHRT_MAX, nFillColor = USHRT_MAX;
1550 sal_uInt8 nFillValue = 0;
1551
1552 sal_uInt16 nWh = ( nToken & ~0xff ) == RTF_CHRFMT
1553 ? aPlainMap[SID_ATTR_BRUSH_CHAR]
1554 : aPardMap[SID_ATTR_BRUSH];
1555
1556 do {
1557 switch( nToken )
1558 {
1559 case RTF_CLCBPAT:
1560 case RTF_CHCBPAT:
1561 case RTF_CBPAT:
1562 nFillColor = sal_uInt16( nTokenValue );
1563 break;
1564
1565 case RTF_CLCFPAT:
1566 case RTF_CHCFPAT:
1567 case RTF_CFPAT:
1568 nColor = sal_uInt16( nTokenValue );
1569 break;
1570
1571 case RTF_CLSHDNG:
1572 case RTF_CHSHDNG:
1573 case RTF_SHADING:
1574 nFillValue = static_cast<sal_uInt8>( nTokenValue / 100 );
1575 break;
1576
1577 case RTF_CLBGDKHOR:
1578 case RTF_CHBGDKHORIZ:
1579 case RTF_BGDKHORIZ:
1580 case RTF_CLBGDKVERT:
1581 case RTF_CHBGDKVERT:
1582 case RTF_BGDKVERT:
1583 case RTF_CLBGDKBDIAG:
1584 case RTF_CHBGDKBDIAG:
1585 case RTF_BGDKBDIAG:
1586 case RTF_CLBGDKFDIAG:
1587 case RTF_CHBGDKFDIAG:
1588 case RTF_BGDKFDIAG:
1589 case RTF_CLBGDKCROSS:
1590 case RTF_CHBGDKCROSS:
1591 case RTF_BGDKCROSS:
1592 case RTF_CLBGDKDCROSS:
1593 case RTF_CHBGDKDCROSS:
1594 case RTF_BGDKDCROSS:
1595 // dark -> 60%
1596 nFillValue = 60;
1597 break;
1598
1599 case RTF_CLBGHORIZ:
1600 case RTF_CHBGHORIZ:
1601 case RTF_BGHORIZ:
1602 case RTF_CLBGVERT:
1603 case RTF_CHBGVERT:
1604 case RTF_BGVERT:
1605 case RTF_CLBGBDIAG:
1606 case RTF_CHBGBDIAG:
1607 case RTF_BGBDIAG:
1608 case RTF_CLBGFDIAG:
1609 case RTF_CHBGFDIAG:
1610 case RTF_BGFDIAG:
1611 case RTF_CLBGCROSS:
1612 case RTF_CHBGCROSS:
1613 case RTF_BGCROSS:
1614 case RTF_CLBGDCROSS:
1615 case RTF_CHBGDCROSS:
1616 case RTF_BGDCROSS:
1617 // light -> 20%
1618 nFillValue = 20;
1619 break;
1620
1621 default:
1622 if( bTableDef )
1623 bContinue = (nToken & ~(0xff | RTF_TABLEDEF) ) == RTF_SHADINGDEF;
1624 else
1625 bContinue = (nToken & ~0xff) == RTF_SHADINGDEF;
1626 }
1627 if( bContinue )
1628 nToken = GetNextToken();
1629 } while( bContinue );
1630
1631 Color aCol( COL_WHITE ), aFCol;
1632 if( !nFillValue )
1633 {
1634 // there was only one of two colors specified or no BrushType
1635 if( USHRT_MAX != nFillColor )
1636 {
1637 nFillValue = 100;
1638 aCol = GetColor( nFillColor );
1639 }
1640 else if( USHRT_MAX != nColor )
1641 aFCol = GetColor( nColor );
1642 }
1643 else
1644 {
1645 if( USHRT_MAX != nColor )
1646 aCol = GetColor( nColor );
1647 else
1648 aCol = COL_BLACK;
1649
1650 if( USHRT_MAX != nFillColor )
1651 aFCol = GetColor( nFillColor );
1652 else
1653 aFCol = COL_WHITE;
1654 }
1655
1656 Color aColor;
1657 if( 0 == nFillValue || 100 == nFillValue )
1658 aColor = aCol;
1659 else
1660 aColor = Color(
1661 static_cast<sal_uInt8>(CalcShading( aCol.GetRed(), aFCol.GetRed(), nFillValue )),
1662 static_cast<sal_uInt8>(CalcShading( aCol.GetGreen(), aFCol.GetGreen(), nFillValue )),
1663 static_cast<sal_uInt8>(CalcShading( aCol.GetBlue(), aFCol.GetBlue(), nFillValue )) );
1664
1665 rSet.Put( SvxBrushItem( aColor, nWh ) );
1666 SkipToken();
1667}
1668
1669
1670// pard / plain handling
1671void SvxRTFParser::RTFPardPlain( bool const bPard, SfxItemSet** ppSet )
1672{
1673 if( bNewGroup || aAttrStack.empty() ) // not at the beginning of a new group
1674 return;
1675
1676 SvxRTFItemStackType* pCurrent = aAttrStack.back().get();
1677
1678 int nLastToken = GetStackPtr(-1)->nTokenId;
1679 bool bNewStkEntry = true;
1680 if( RTF_PARD != nLastToken &&
1681 RTF_PLAIN != nLastToken &&
1682 BRACELEFT != nLastToken )
1683 {
1684 if (pCurrent->aAttrSet.Count() || !pCurrent->maChildList.empty() || pCurrent->nStyleNo)
1685 {
1686 // open a new group
1687 auto xNew(std::make_unique<SvxRTFItemStackType>(*pCurrent, *mxInsertPosition, true));
1688 xNew->SetRTFDefaults( GetRTFDefaults() );
1689
1690 // Set all until here valid attributes
1691 AttrGroupEnd();
1692 pCurrent = aAttrStack.empty() ? nullptr : aAttrStack.back().get(); // can be changed after AttrGroupEnd!
1693 xNew->aAttrSet.SetParent( pCurrent ? &pCurrent->aAttrSet : nullptr );
1694 aAttrStack.push_back( std::move(xNew) );
1695 pCurrent = aAttrStack.back().get();
1696 }
1697 else
1698 {
1699 // continue to use this entry as new
1700 pCurrent->SetStartPos( *mxInsertPosition );
1701 bNewStkEntry = false;
1702 }
1703 }
1704
1705 // now reset all to default
1706 if( bNewStkEntry &&
1707 ( pCurrent->aAttrSet.GetParent() || pCurrent->aAttrSet.Count() ))
1708 {
1709 const SfxPoolItem *pItem, *pDef;
1710 std::map<sal_uInt16, sal_uInt16>::const_iterator aIt;
1711 std::map<sal_uInt16, sal_uInt16>::const_iterator aEnd;
1712 const SfxItemSet* pDfltSet = &GetRTFDefaults();
1713 if( bPard )
1714 {
1715 pCurrent->nStyleNo = 0;
1716 aIt = aPardMap.data.begin();
1717 aEnd = aPardMap.data.end();
1718 }
1719 else
1720 {
1721 aIt = aPlainMap.data.begin();
1722 aEnd = aPlainMap.data.end();
1723 }
1724
1725 for (; aIt != aEnd; ++aIt)
1726 {
1727 const sal_uInt16 wid = aIt->second;
1728 // Item set and different -> Set the Default Pool
1729 if (!wid)
1730 ;
1731 else if (SfxItemPool::IsSlot(wid))
1732 pCurrent->aAttrSet.ClearItem(wid);
1733 else if( IsChkStyleAttr() )
1734 pCurrent->aAttrSet.Put(pDfltSet->Get(wid));
1735 else if( !pCurrent->aAttrSet.GetParent() )
1736 {
1737 if (SfxItemState::SET == pDfltSet->GetItemState(wid, false, &pDef))
1738 pCurrent->aAttrSet.Put( *pDef );
1739 else
1740 pCurrent->aAttrSet.ClearItem(wid);
1741 }
1742 else if( SfxItemState::SET == pCurrent->aAttrSet.GetParent()->
1743 GetItemState(wid, true, &pItem) &&
1744 *( pDef = &pDfltSet->Get(wid)) != *pItem )
1745 pCurrent->aAttrSet.Put( *pDef );
1746 else
1747 {
1748 if (SfxItemState::SET == pDfltSet->GetItemState(wid, false, &pDef))
1749 pCurrent->aAttrSet.Put( *pDef );
1750 else
1751 pCurrent->aAttrSet.ClearItem(wid);
1752 }
1753 }
1754 }
1755 else if( bPard )
1756 pCurrent->nStyleNo = 0; // reset Style number
1757
1758 *ppSet = &pCurrent->aAttrSet;
1759
1760 if (bPard)
1761 return;
1762
1763 //Once we have a default font, then any text without a font specifier is
1764 //in the default font, and thus has the default font charset, otherwise
1765 //we can fall back to the ansicpg set codeset
1766 if (nDfltFont != -1)
1767 {
1768 const vcl::Font& rSVFont = GetFont(sal_uInt16(nDfltFont));
1769 SetEncoding(rSVFont.GetCharSet());
1770 }
1771 else
1773}
1774
1775void SvxRTFParser::SetDefault( int nToken, int nValue )
1776{
1777 if( !bNewDoc )
1778 return;
1779
1781 bool bOldFlag = bIsLeftToRightDef;
1782 bIsLeftToRightDef = true;
1783 switch( nToken )
1784 {
1785 case RTF_ADEFF:
1786 bIsLeftToRightDef = false;
1787 [[fallthrough]];
1788 case RTF_DEFF:
1789 {
1790 if( -1 == nValue )
1791 nValue = 0;
1792 const vcl::Font& rSVFont = GetFont( sal_uInt16(nValue) );
1793 SvxFontItem aTmpItem(
1794 rSVFont.GetFamilyType(), rSVFont.GetFamilyName(),
1795 rSVFont.GetStyleName(), rSVFont.GetPitch(),
1796 rSVFont.GetCharSet(), SID_ATTR_CHAR_FONT );
1797 SetScriptAttr( NOTDEF_CHARTYPE, aTmp, aTmpItem );
1798 }
1799 break;
1800
1801 case RTF_ADEFLANG:
1802 bIsLeftToRightDef = false;
1803 [[fallthrough]];
1804 case RTF_DEFLANG:
1805 // store default Language
1806 if( -1 != nValue )
1807 {
1808 SvxLanguageItem aTmpItem( LanguageType(nValue), SID_ATTR_CHAR_LANGUAGE );
1809 SetScriptAttr( NOTDEF_CHARTYPE, aTmp, aTmpItem );
1810 }
1811 break;
1812
1813 case RTF_DEFTAB:
1814 if (const sal_uInt16 wid = aPardMap[SID_ATTR_TABSTOP])
1815 {
1816 // RTF defines 720 twips as default
1817 bIsSetDfltTab = true;
1818 if( -1 == nValue || !nValue )
1819 nValue = 720;
1820
1821 // who would like to have no twips ...
1822 if( IsCalcValue() )
1823 {
1825 CalcValue();
1827 }
1828
1829 // Calculate the ratio of default TabWidth / Tabs and
1830 // calculate the corresponding new number.
1831 // ?? how did one come up with 13 ??
1832 sal_uInt16 nTabCount = (SVX_TAB_DEFDIST * 13 ) / sal_uInt16(nValue);
1833 /*
1834 cmc, make sure we have at least one, or all hell breaks loose in
1835 everybody exporters, #i8247#
1836 */
1837 if (nTabCount < 1)
1838 nTabCount = 1;
1839
1840 // we want Defaulttabs
1841 SvxTabStopItem aNewTab(nTabCount, sal_uInt16(nValue), SvxTabAdjust::Default, wid);
1842 while( nTabCount )
1843 const_cast<SvxTabStop&>(aNewTab[ --nTabCount ]).GetAdjustment() = SvxTabAdjust::Default;
1844
1845 pAttrPool->SetPoolDefaultItem( aNewTab );
1846 }
1847 break;
1848 }
1849 bIsLeftToRightDef = bOldFlag;
1850
1851 if( aTmp.Count() )
1852 {
1853 SfxItemIter aIter( aTmp );
1854 const SfxPoolItem* pItem = aIter.GetCurItem();
1855 do
1856 {
1857 pAttrPool->SetPoolDefaultItem( *pItem );
1858 pItem = aIter.NextItem();
1859 } while (pItem);
1860 }
1861}
1862
1863// default: no conversion, leaving everything in twips.
1865{
1866}
1867
1868// for tokens that are not evaluated in ReadAttr
1870{
1871}
1872
1873/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ THICKTHIN_MEDIUMGAP
Double border line with a thick line outside and a thin line inside separated by a medium gap.
@ INSET
Inset border line.
@ EMBOSSED
3D embossed border line.
@ ENGRAVED
3D engraved border line.
@ THINTHICK_SMALLGAP
Double border line with a thin line outside and a thick line inside separated by a small gap.
@ DASHED
Dashed border line.
@ THICKTHIN_LARGEGAP
Double border line with a thick line outside and a thin line inside separated by a large gap.
@ OUTSET
Outset border line.
@ THINTHICK_MEDIUMGAP
Double border line with a thin line outside and a thick line inside separated by a medium gap.
@ SOLID
Solid border line.
@ THICKTHIN_SMALLGAP
Double border line with a thick line outside and a thin line inside separated by a small gap.
@ THINTHICK_LARGEGAP
Double border line with a thin line outside and a thick line inside separated by a large gap.
@ DOTTED
Dotted border line.
@ DOUBLE
Double border line.
sal_uInt8 GetBlue() const
sal_uInt8 GetRed() const
sal_uInt8 GetGreen() const
const SfxPoolItem * GetCurItem() const
const SfxPoolItem * NextItem()
void SetPoolDefaultItem(const SfxPoolItem &)
static bool IsSlot(sal_uInt16 nId)
sal_uInt16 Count() const
const SfxItemSet * GetParent() const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 Which() const
void SetWhich(sal_uInt16 nId)
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
void RereadLookahead()
TokenStackType * GetStackPtr(short nCnt)
tools::Long nTokenValue
bool IsParserWorking() const
T SkipToken(short nCnt=-1)
rtl_TextEncoding GetCodeSet() const
void SkipGroup()
void SetEncoding(rtl_TextEncoding eEnc)
static const sal_Int16 Hairline
Definition: borderline.hxx:40
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
Definition: frmitems.cxx:3061
SvxColorItem item describes a color.
Definition: colritem.hxx:32
sal_uInt8 & GetProportionalHeight()
This item describes a Font.
Definition: fontitem.hxx:30
sal_uInt8 & GetMinLead()
sal_uInt8 & GetMaxHyphens()
void SetPageEnd(const bool bNew)
sal_uInt8 & GetMinTrail()
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
Definition: frmitems.cxx:487
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
Definition: frmitems.cxx:539
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
Definition: frmitems.cxx:504
void SetPropLineSpace(const sal_uInt16 nProp)
Definition: lspcitem.hxx:82
sal_uInt16 GetLineHeight() const
Definition: lspcitem.hxx:73
void SetLineSpaceRule(SvxLineSpaceRule e)
Definition: lspcitem.hxx:88
void SetLineHeight(const sal_uInt16 nHeight)
Definition: lspcitem.hxx:74
SvxRTFItemStackList maChildList
Definition: svxrtf.hxx:238
sal_uInt16 nStyleNo
Definition: svxrtf.hxx:239
SfxItemSet aAttrSet
Definition: svxrtf.hxx:234
sal_Int32 nSttCnt
Definition: svxrtf.hxx:237
std::optional< EditNodeIdx > mxStartNodeIdx
Definition: svxrtf.hxx:235
void SetStartPos(const EditPosition &rPos)
Definition: svxrtf.cxx:1059
bool bNewGroup
Definition: svxrtf.hxx:118
SfxItemPool * pAttrPool
Definition: svxrtf.hxx:110
void AttrGroupEnd()
Definition: svxrtf.cxx:683
bool bIsSetDfltTab
Definition: svxrtf.hxx:119
virtual void CalcValue()
Definition: rtfitem.cxx:1864
PlainOrPardMap aPlainMap
Definition: svxrtf.hxx:105
void ReadBackgroundAttr(int nToken, SfxItemSet &rSet, bool bTableDef=false)
Definition: rtfitem.cxx:1544
WhichRangesContainer aWhichMap
Definition: svxrtf.hxx:107
@ DOUBLEBYTE_CHARTYPE
Definition: svxrtf.hxx:149
@ NOTDEF_CHARTYPE
Definition: svxrtf.hxx:146
bool IsChkStyleAttr() const
Definition: svxrtf.hxx:192
bool IsAttrSttPos()
Definition: svxrtf.cxx:880
std::optional< EditPosition > mxInsertPosition
Definition: svxrtf.hxx:109
bool bIsLeftToRightDef
Definition: svxrtf.hxx:122
int nDfltFont
Definition: svxrtf.hxx:115
void ReadAttr(int nToken, SfxItemSet *pSet)
Definition: rtfitem.cxx:180
void ReadBorderAttr(int nToken, SfxItemSet &rSet, bool bTableDef=false)
Definition: rtfitem.cxx:1352
const vcl::Font & GetFont(sal_uInt16 nId)
Definition: svxrtf.cxx:593
void RTFPardPlain(bool bPard, SfxItemSet **ppSet)
Definition: rtfitem.cxx:1671
bool bIsInReadStyleTab
Definition: svxrtf.hxx:124
const SfxItemSet & GetRTFDefaults()
Definition: svxrtf.cxx:953
PlainOrPardMap aPardMap
Definition: svxrtf.hxx:106
void SetDefault(int nToken, int nValue)
Definition: rtfitem.cxx:1775
virtual void UnknownAttrToken(int nToken)
Definition: rtfitem.cxx:1869
const Color & GetColor(size_t nId) const
Definition: svxrtf.hxx:280
bool IsCalcValue() const
Definition: svxrtf.hxx:194
void SetScriptAttr(RTF_CharTypeDef eType, SfxItemSet &rSet, SfxPoolItem &rItem)
Definition: rtfitem.cxx:77
std::deque< std::unique_ptr< SvxRTFItemStackType > > aAttrStack
Definition: svxrtf.hxx:94
bool bNewDoc
Definition: svxrtf.hxx:117
void ReadTabAttr(int nToken, SfxItemSet &rSet)
Definition: rtfitem.cxx:1245
bool Insert(const SvxTabStop &rTab)
Definition: paraitem.cxx:1045
sal_Unicode & GetFill()
Definition: tstpitem.hxx:62
sal_Int32 & GetTabPos()
Definition: tstpitem.hxx:53
sal_Unicode & GetDecimal()
Definition: tstpitem.hxx:59
SvxTabAdjust & GetAdjustment()
Definition: tstpitem.hxx:56
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
Definition: ulspitem.hxx:86
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
Definition: ulspitem.hxx:82
void SetWidth(tools::Long nWidth)
Definition: borderline.cxx:634
void SetColor(const Color &rColor)
Definition: borderline.hxx:171
void SetBorderLineStyle(SvxBorderLineStyle nNew)
Definition: borderline.cxx:552
FontFamily GetFamilyType()
const OUString & GetStyleName() const
const OUString & GetFamilyName() const
FontPitch GetPitch()
rtl_TextEncoding GetCharSet() const
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
#define DBG_ASSERT(sCon, aError)
#define DFLT_ESC_PROP
#define DFLT_ESC_AUTO_SUB
#define DFLT_ESC_AUTO_SUPER
DocumentType eType
sal_Int16 nValue
FontLineStyle
LINESTYLE_BOLDDASHDOT
LINESTYLE_BOLDDASHDOTDOT
LINESTYLE_SINGLE
LINESTYLE_BOLDLONGDASH
LINESTYLE_BOLDWAVE
LINESTYLE_DASHDOTDOT
LINESTYLE_BOLDDASH
LINESTYLE_BOLDDOTTED
LINESTYLE_DOUBLEWAVE
LINESTYLE_DOUBLE
LINESTYLE_NONE
LINESTYLE_DASH
LINESTYLE_DASHDOT
LINESTYLE_DOTTED
LINESTYLE_WAVE
LINESTYLE_LONGDASH
LINESTYLE_BOLD
STRIKEOUT_DOUBLE
STRIKEOUT_SINGLE
STRIKEOUT_NONE
ITALIC_NORMAL
ITALIC_NONE
FontEmphasisMark
WEIGHT_BOLD
WEIGHT_NORMAL
@ Horizontal_RL_TB
Horizontal, from right to left, from top to bottom (typical for arabic/hebrew languages).
@ Horizontal_LR_TB
Horizontal, from left to right, from top to bottom (typical for western languages).
#define SAL_WARN_IF(condition, area, stream)
long Long
DefTokenId nToken
#define BRACERIGHT
Definition: rtfitem.cxx:72
static void SetBorderLine(int nBorderTyp, SvxBoxItem &rItem, const SvxBorderLine &rBorder)
Definition: rtfitem.cxx:1324
#define BRACELEFT
Definition: rtfitem.cxx:71
static sal_uInt32 CalcShading(sal_uInt32 nColor, sal_uInt32 nFillColor, sal_uInt8 nShading)
Definition: rtfitem.cxx:1537
RTF_CHRFMT
RTF_SWGDEFS
RTF_TABSTOPDEF
RTF_BRDRDEF
RTF_TABLEDEF
RTF_SHADINGDEF
RTF_BGFDIAG
RTF_CHBGDKFDIAG
RTF_PGBRK
RTF_SA
RTF_OL
RTF_BRDRTNTHSG
RTF_FAHANG
RTF_PLAIN
RTF_CAPS
RTF_SBYS
RTF_BGHORIZ
RTF_TLDOT
RTF_FAFIXED
RTF_SOUTLVL
RTF_CLBGFDIAG
RTF_ULNONE
RTF_SHDW_COL
RTF_BRDREMBOSS
RTF_STRIKED
RTF_ULDASHD
RTF_ILVL
RTF_OLWAVE
RTF_ULTHDASH
RTF_BRDRBAR
RTF_ULWAVE
RTF_OLNONE
RTF_ACCDOT
RTF_ULHWAVE
RTF_NOOVERFLOW
RTF_TLHYPH
RTF_CHCFPAT
RTF_ULDASHDD
RTF_SL
RTF_CLBGDKVERT
RTF_LTRPAR
RTF_BRDRDASH
RTF_CHSHDNG
RTF_RIN
RTF_BGDKHORIZ
RTF_TQDEC
RTF_ULTHDASHD
RTF_CLBRDRL
RTF_FI
RTF_HICH
RTF_LEVEL
RTF_OLTHD
RTF_BGVERT
RTF_SB
RTF_FAVAR
RTF_ALANG
RTF_INTBL
RTF_B
RTF_SHADING
RTF_PARD
RTF_QL
RTF_BRDRCF
RTF_CLCBPAT
RTF_ULTHLDASH
RTF_TLEQ
RTF_PGDSCNO
RTF_AI
RTF_SHDW_STYLE
RTF_BRDRHAIR
RTF_CLBGDCROSS
RTF_OLLDASH
RTF_OLW
RTF_I
RTF_V
RTF_CHBGDKDCROSS
RTF_FS
RTF_CHBGDKBDIAG
RTF_CLBGDKFDIAG
RTF_CLBGVERT
RTF_DEFTAB
RTF_DEFLANG
RTF_ACCNONE
RTF_BRDRENGRAVE
RTF_ULD
RTF_BRDRBTW
RTF_UP
RTF_RTLPAR
RTF_QJ
RTF_ASPALPHA
RTF_FAROMAN
RTF_ULDASH
RTF_BRDRTH
RTF_F
RTF_CLBGBDIAG
RTF_OLD
RTF_TQC
RTF_SHAD
RTF_EMBO
RTF_TWOINONE
RTF_RI
RTF_OLTH
RTF_CLBGDKCROSS
RTF_TB
RTF_OLDASHD
RTF_CHARSCALEX
RTF_BRDRTHTNMG
RTF_HYPHMAX
RTF_KEEPN
RTF_CLBRDRT
RTF_ADEFF
RTF_OUTL
RTF_BRDRTNTHLG
RTF_OLDASH
RTF_UL
RTF_SLMULT
RTF_LTRCH
RTF_TLTH
RTF_AB
RTF_BRDRR
RTF_DEFF
RTF_S
RTF_CLBGHORIZ
RTF_ULLDASH
RTF_CFPAT
RTF_SWG_ESCPROP
RTF_DBCH
RTF_BRDRS
RTF_BRDRTNTHMG
RTF_CHCBPAT
RTF_BRDRINSET
RTF_TX
RTF_BGDKFDIAG
RTF_CLBGDKBDIAG
RTF_CLBGCROSS
RTF_ULULDBWAVE
RTF_CLCFPAT
RTF_CHBGBDIAG
RTF_BGDKDCROSS
RTF_ULTH
RTF_CLBRDRB
RTF_OLC
RTF_OLTHDASHD
RTF_BGBDIAG
RTF_OLTHDASHDD
RTF_CHBGDKHORIZ
RTF_HORZVERT
RTF_SHDW_DIST
RTF_AFS
RTF_SCAPS
RTF_NOSUPERSUB
RTF_QC
RTF_CB
RTF_DN
RTF_FACENTER
RTF_OLTHLDASH
RTF_TQR
RTF_CHBGVERT
RTF_ADEFLANG
RTF_TQL
RTF_STRIKE
RTF_ACCCOMMA
RTF_CHBGCROSS
RTF_BRDRSH
RTF_HYPHEN
RTF_AF
RTF_HYPHLEAD
RTF_BRDRB
RTF_BGCROSS
RTF_TLSWG
RTF_BRDRTHTNSG
RTF_RTLCH
RTF_BRDRL
RTF_CLBGDKHOR
RTF_ULW
RTF_CHBGDKVERT
RTF_ULTHDASHDD
RTF_LANG
RTF_FAAUTO
RTF_BRDRT
RTF_BRDROUTSET
RTF_EXPNDTW
RTF_OLOLDBWAVE
RTF_BRDRTHTNLG
RTF_TLUL
RTF_SHDW_FCOL
RTF_LANGFE
RTF_BOX
RTF_SHADOW
RTF_LI
RTF_CF
RTF_ULTHD
RTF_BGDKBDIAG
RTF_QR
RTF_OLTHDASH
RTF_LIN
RTF_BRDRDOT
RTF_OLHWAVE
RTF_SUB
RTF_HYPHTRAIL
RTF_IGNOREFLAG
RTF_PAGEBB
RTF_LS
RTF_SUPER
RTF_BRSP
RTF_CBPAT
RTF_KERNING
RTF_BRDRDB
RTF_KEEP
RTF_CLBGDKDCROSS
RTF_OLDB
RTF_BRDRW
RTF_OLDASHDD
RTF_CS
RTF_EXPND
RTF_CHBGDKCROSS
RTF_ULC
RTF_CHBGHORIZ
RTF_NOCWRAP
RTF_CLBRDRR
RTF_BGDKVERT
RTF_BGDCROSS
RTF_CHBGDCROSS
RTF_IMPR
RTF_ULDB
RTF_CHBGFDIAG
RTF_LOCH
RTF_CLSHDNG
RTF_BGDKCROSS
static SfxItemSet & rSet
std::map< sal_uInt16, sal_uInt16 > data
Definition: svxrtf.hxx:99
SvxLineSpaceRule
Definition: svxenum.hxx:63
SvxShadowLocation
Definition: svxenum.hxx:43
SvxCaseMap
Definition: svxenum.hxx:25
#define SVX_TAB_DEFDIST
Definition: tstpitem.hxx:30
unsigned char sal_uInt8
sal_uInt16 sal_Unicode