1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #include <sal/config.h>
12 #include <string_view>
14 #include "rtfdocumentimpl.hxx"
16 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
17 #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
18 #include <com/sun/star/text/RelOrientation.hpp>
19 #include <com/sun/star/text/VertOrientation.hpp>
20 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
22 #include <filter/msfilter/escherex.hxx>
24 #include <ooxml/resourceids.hxx>
26 #include <sal/log.hxx>
28 #include "rtfsdrimport.hxx"
29 #include "rtfskipdestination.hxx"
31 using namespace com::sun::star
;
33 namespace writerfilter::rtftok
35 bool RTFDocumentImpl::dispatchFloatingTableFlag(RTFKeyword nKeyword
)
37 // Positioned Wrapped Tables
41 case RTFKeyword::TPVPARA
:
44 case RTFKeyword::TPVMRG
:
47 case RTFKeyword::TPVPG
:
53 if (!aParam
.isEmpty())
55 putNestedAttribute(m_aStates
.top().getTableRowSprms(), NS_ooxml::LN_CT_TblPrBase_tblpPr
,
56 NS_ooxml::LN_CT_TblPPr_vertAnchor
, new RTFValue(aParam
));
61 case RTFKeyword::TPHCOL
:
64 case RTFKeyword::TPHMRG
:
67 case RTFKeyword::TPHPG
:
73 if (!aParam
.isEmpty())
75 putNestedAttribute(m_aStates
.top().getTableRowSprms(), NS_ooxml::LN_CT_TblPrBase_tblpPr
,
76 NS_ooxml::LN_CT_TblPPr_horzAnchor
, new RTFValue(aParam
));
81 case RTFKeyword::TPOSYC
:
84 case RTFKeyword::TPOSYB
:
90 if (!aParam
.isEmpty())
92 putNestedAttribute(m_aStates
.top().getTableRowSprms(), NS_ooxml::LN_CT_TblPrBase_tblpPr
,
93 NS_ooxml::LN_CT_TblPPr_tblpYSpec
, new RTFValue(aParam
));
98 case RTFKeyword::TPOSXC
:
101 case RTFKeyword::TPOSXR
:
107 if (!aParam
.isEmpty())
109 putNestedAttribute(m_aStates
.top().getTableRowSprms(), NS_ooxml::LN_CT_TblPrBase_tblpPr
,
110 NS_ooxml::LN_CT_TblPPr_tblpXSpec
, new RTFValue(aParam
));
114 if (nKeyword
== RTFKeyword::TABSNOOVRLP
)
116 m_aStates
.top().getTableRowSprms().set(
117 NS_ooxml::LN_CT_TblPrBase_tblOverlap
,
118 new RTFValue(NS_ooxml::LN_Value_ST_TblOverlap_never
));
125 RTFError
RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword
)
128 checkUnicode(/*bUnicode =*/true, /*bHex =*/true);
129 RTFSkipDestination
aSkip(*this);
136 case RTFKeyword::ULD
:
137 nSprm
= NS_ooxml::LN_Value_ST_Underline_dotted
;
139 case RTFKeyword::ULW
:
140 nSprm
= NS_ooxml::LN_Value_ST_Underline_words
;
147 auto pValue
= new RTFValue(nSprm
);
148 m_aStates
.top().getCharacterAttributes().set(NS_ooxml::LN_CT_Underline_val
, pValue
);
156 nParam
= NS_ooxml::LN_Value_ST_Jc_center
;
159 nParam
= NS_ooxml::LN_Value_ST_Jc_both
;
162 nParam
= NS_ooxml::LN_Value_ST_Jc_left
;
165 nParam
= NS_ooxml::LN_Value_ST_Jc_right
;
168 nParam
= NS_ooxml::LN_Value_ST_Jc_distribute
;
175 auto pValue
= new RTFValue(nParam
);
176 m_aStates
.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_jc
, pValue
);
184 case RTFKeyword::FAFIXED
:
185 case RTFKeyword::FAAUTO
:
186 nParam
= NS_ooxml::LN_Value_doc_ST_TextAlignment_auto
;
188 case RTFKeyword::FAHANG
:
189 nParam
= NS_ooxml::LN_Value_doc_ST_TextAlignment_top
;
191 case RTFKeyword::FACENTER
:
192 nParam
= NS_ooxml::LN_Value_doc_ST_TextAlignment_center
;
194 case RTFKeyword::FAROMAN
:
195 nParam
= NS_ooxml::LN_Value_doc_ST_TextAlignment_baseline
;
197 case RTFKeyword::FAVAR
:
198 nParam
= NS_ooxml::LN_Value_doc_ST_TextAlignment_bottom
;
205 auto pValue
= new RTFValue(nParam
);
206 m_aStates
.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_textAlignment
, pValue
);
213 case RTFKeyword::TQR
:
214 nParam
= NS_ooxml::LN_Value_ST_TabJc_right
;
216 case RTFKeyword::TQC
:
217 nParam
= NS_ooxml::LN_Value_ST_TabJc_center
;
219 case RTFKeyword::TQDEC
:
220 nParam
= NS_ooxml::LN_Value_ST_TabJc_decimal
;
227 auto pValue
= new RTFValue(nParam
);
228 m_aStates
.top().getTabAttributes().set(NS_ooxml::LN_CT_TabStop_val
, pValue
);
235 case RTFKeyword::TLDOT
:
236 nParam
= NS_ooxml::LN_Value_ST_TabTlc_dot
;
238 case RTFKeyword::TLMDOT
:
239 nParam
= NS_ooxml::LN_Value_ST_TabTlc_middleDot
;
241 case RTFKeyword::TLHYPH
:
242 nParam
= NS_ooxml::LN_Value_ST_TabTlc_hyphen
;
244 case RTFKeyword::TLUL
:
245 case RTFKeyword::TLTH
:
246 nParam
= NS_ooxml::LN_Value_ST_TabTlc_underscore
;
248 case RTFKeyword::TLEQ
:
254 auto pValue
= new RTFValue(nParam
);
255 m_aStates
.top().getTabAttributes().set(NS_ooxml::LN_CT_TabStop_leader
, pValue
);
263 // brdrhair and brdrs are the same, brdrw will make a difference
264 // map to values in ooxml/model.xml resource ST_Border
265 case RTFKeyword::BRDRHAIR
:
266 case RTFKeyword::BRDRS
:
267 nParam
= NS_ooxml::LN_Value_ST_Border_single
;
269 case RTFKeyword::BRDRDOT
:
270 nParam
= NS_ooxml::LN_Value_ST_Border_dotted
;
272 case RTFKeyword::BRDRDASH
:
273 nParam
= NS_ooxml::LN_Value_ST_Border_dashed
;
275 case RTFKeyword::BRDRDB
:
276 nParam
= NS_ooxml::LN_Value_ST_Border_double
;
278 case RTFKeyword::BRDRTNTHSG
:
279 nParam
= NS_ooxml::LN_Value_ST_Border_thinThickSmallGap
;
281 case RTFKeyword::BRDRTNTHMG
:
282 nParam
= NS_ooxml::LN_Value_ST_Border_thinThickMediumGap
;
284 case RTFKeyword::BRDRTNTHLG
:
285 nParam
= NS_ooxml::LN_Value_ST_Border_thinThickLargeGap
;
287 case RTFKeyword::BRDRTHTNSG
:
288 nParam
= NS_ooxml::LN_Value_ST_Border_thickThinSmallGap
;
290 case RTFKeyword::BRDRTHTNMG
:
291 nParam
= NS_ooxml::LN_Value_ST_Border_thickThinMediumGap
;
293 case RTFKeyword::BRDRTHTNLG
:
294 nParam
= NS_ooxml::LN_Value_ST_Border_thickThinLargeGap
;
296 case RTFKeyword::BRDREMBOSS
:
297 nParam
= NS_ooxml::LN_Value_ST_Border_threeDEmboss
;
299 case RTFKeyword::BRDRENGRAVE
:
300 nParam
= NS_ooxml::LN_Value_ST_Border_threeDEngrave
;
302 case RTFKeyword::BRDROUTSET
:
303 nParam
= NS_ooxml::LN_Value_ST_Border_outset
;
305 case RTFKeyword::BRDRINSET
:
306 nParam
= NS_ooxml::LN_Value_ST_Border_inset
;
308 case RTFKeyword::BRDRDASHSM
:
309 nParam
= NS_ooxml::LN_Value_ST_Border_dashSmallGap
;
311 case RTFKeyword::BRDRDASHD
:
312 nParam
= NS_ooxml::LN_Value_ST_Border_dotDash
;
314 case RTFKeyword::BRDRDASHDD
:
315 nParam
= NS_ooxml::LN_Value_ST_Border_dotDotDash
;
317 case RTFKeyword::BRDRNONE
:
318 nParam
= NS_ooxml::LN_Value_ST_Border_none
;
325 auto pValue
= new RTFValue(nParam
);
326 putBorderProperty(m_aStates
, NS_ooxml::LN_CT_Border_val
, pValue
);
334 case RTFKeyword::SBKNONE
:
335 nParam
= NS_ooxml::LN_Value_ST_SectionMark_continuous
;
337 case RTFKeyword::SBKCOL
:
338 nParam
= NS_ooxml::LN_Value_ST_SectionMark_nextColumn
;
340 case RTFKeyword::SBKPAGE
:
341 nParam
= NS_ooxml::LN_Value_ST_SectionMark_nextPage
;
343 case RTFKeyword::SBKEVEN
:
344 nParam
= NS_ooxml::LN_Value_ST_SectionMark_evenPage
;
346 case RTFKeyword::SBKODD
:
347 nParam
= NS_ooxml::LN_Value_ST_SectionMark_oddPage
;
354 if (m_nResetBreakOnSectBreak
!= RTFKeyword::invalid
)
356 m_nResetBreakOnSectBreak
= nKeyword
;
358 auto pValue
= new RTFValue(nParam
);
359 m_aStates
.top().getSectionSprms().set(NS_ooxml::LN_EG_SectPrContents_type
, pValue
);
363 // Footnote numbering
366 case RTFKeyword::FTNNAR
:
367 nParam
= NS_ooxml::LN_Value_ST_NumberFormat_decimal
;
369 case RTFKeyword::FTNNALC
:
370 nParam
= NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter
;
372 case RTFKeyword::FTNNAUC
:
373 nParam
= NS_ooxml::LN_Value_ST_NumberFormat_upperLetter
;
375 case RTFKeyword::FTNNRLC
:
376 nParam
= NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman
;
378 case RTFKeyword::FTNNRUC
:
379 nParam
= NS_ooxml::LN_Value_ST_NumberFormat_upperRoman
;
381 case RTFKeyword::FTNNCHI
:
382 nParam
= NS_ooxml::LN_Value_ST_NumberFormat_chicago
;
389 auto pInner
= new RTFValue(nParam
);
390 RTFSprms aAttributes
;
391 aAttributes
.set(NS_ooxml::LN_CT_NumFmt_val
, pInner
);
392 auto pOuter
= new RTFValue(aAttributes
);
393 putNestedSprm(m_aDefaultState
.getParagraphSprms(),
394 NS_ooxml::LN_EG_SectPrContents_footnotePr
, NS_ooxml::LN_CT_FtnProps_numFmt
,
399 // Footnote restart type
402 case RTFKeyword::FTNRSTPG
:
403 nParam
= NS_ooxml::LN_Value_ST_RestartNumber_eachPage
;
405 case RTFKeyword::FTNRESTART
:
406 nParam
= NS_ooxml::LN_Value_ST_RestartNumber_eachSect
;
408 case RTFKeyword::FTNRSTCONT
:
409 nParam
= NS_ooxml::LN_Value_ST_RestartNumber_continuous
;
416 auto pValue
= new RTFValue(nParam
);
417 putNestedSprm(m_aDefaultState
.getParagraphSprms(),
418 NS_ooxml::LN_EG_SectPrContents_footnotePr
,
419 NS_ooxml::LN_EG_FtnEdnNumProps_numRestart
, pValue
);
426 case RTFKeyword::AFTNNAR
:
427 nParam
= NS_ooxml::LN_Value_ST_NumberFormat_decimal
;
429 case RTFKeyword::AFTNNALC
:
430 nParam
= NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter
;
432 case RTFKeyword::AFTNNAUC
:
433 nParam
= NS_ooxml::LN_Value_ST_NumberFormat_upperLetter
;
435 case RTFKeyword::AFTNNRLC
:
436 nParam
= NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman
;
438 case RTFKeyword::AFTNNRUC
:
439 nParam
= NS_ooxml::LN_Value_ST_NumberFormat_upperRoman
;
441 case RTFKeyword::AFTNNCHI
:
442 nParam
= NS_ooxml::LN_Value_ST_NumberFormat_chicago
;
449 auto pInner
= new RTFValue(nParam
);
450 RTFSprms aAttributes
;
451 aAttributes
.set(NS_ooxml::LN_CT_NumFmt_val
, pInner
);
452 auto pOuter
= new RTFValue(aAttributes
);
453 putNestedSprm(m_aDefaultState
.getParagraphSprms(), NS_ooxml::LN_EG_SectPrContents_endnotePr
,
454 NS_ooxml::LN_CT_EdnProps_numFmt
, pOuter
);
460 case RTFKeyword::TRQL
:
461 nParam
= NS_ooxml::LN_Value_ST_Jc_left
;
463 case RTFKeyword::TRQC
:
464 nParam
= NS_ooxml::LN_Value_ST_Jc_center
;
466 case RTFKeyword::TRQR
:
467 nParam
= NS_ooxml::LN_Value_ST_Jc_right
;
474 auto pValue
= new RTFValue(nParam
);
475 m_aStates
.top().getTableRowSprms().set(NS_ooxml::LN_CT_TrPrBase_jc
, pValue
);
482 case RTFKeyword::CLTXLRTB
:
483 nParam
= NS_ooxml::LN_Value_ST_TextDirection_lrTb
;
485 case RTFKeyword::CLTXTBRL
:
486 nParam
= NS_ooxml::LN_Value_ST_TextDirection_tbRl
;
488 case RTFKeyword::CLTXBTLR
:
489 nParam
= NS_ooxml::LN_Value_ST_TextDirection_btLr
;
491 case RTFKeyword::CLTXLRTBV
:
492 nParam
= NS_ooxml::LN_Value_ST_TextDirection_lrTbV
;
494 case RTFKeyword::CLTXTBRLV
:
495 nParam
= NS_ooxml::LN_Value_ST_TextDirection_tbRlV
;
502 auto pValue
= new RTFValue(nParam
);
503 m_aStates
.top().getTableCellSprms().set(NS_ooxml::LN_CT_TcPrBase_textDirection
, pValue
);
506 // Trivial paragraph flags
509 case RTFKeyword::KEEP
:
510 if (m_aStates
.top().getCurrentBuffer() != &m_aTableBufferStack
.back())
511 nParam
= NS_ooxml::LN_CT_PPrBase_keepLines
;
513 case RTFKeyword::KEEPN
:
514 nParam
= NS_ooxml::LN_CT_PPrBase_keepNext
;
516 case RTFKeyword::INTBL
:
518 m_aStates
.top().setCurrentBuffer(&m_aTableBufferStack
.back());
519 nParam
= NS_ooxml::LN_inTbl
;
522 case RTFKeyword::PAGEBB
:
523 nParam
= NS_ooxml::LN_CT_PPrBase_pageBreakBefore
;
530 auto pValue
= new RTFValue(1);
531 m_aStates
.top().getParagraphSprms().set(nParam
, pValue
);
535 if (dispatchFloatingTableFlag(nKeyword
))
542 case RTFKeyword::FNIL
:
543 case RTFKeyword::FROMAN
:
544 case RTFKeyword::FSWISS
:
545 case RTFKeyword::FMODERN
:
546 case RTFKeyword::FSCRIPT
:
547 case RTFKeyword::FDECOR
:
548 case RTFKeyword::FTECH
:
549 case RTFKeyword::FBIDI
:
550 // TODO ooxml:CT_Font_family seems to be ignored by the domain mapper
552 case RTFKeyword::ANSI
:
553 m_aStates
.top().setCurrentEncoding(RTL_TEXTENCODING_MS_1252
);
555 case RTFKeyword::MAC
:
556 m_aDefaultState
.setCurrentEncoding(RTL_TEXTENCODING_APPLE_ROMAN
);
557 m_aStates
.top().setCurrentEncoding(m_aDefaultState
.getCurrentEncoding());
560 m_aDefaultState
.setCurrentEncoding(RTL_TEXTENCODING_IBM_437
);
561 m_aStates
.top().setCurrentEncoding(m_aDefaultState
.getCurrentEncoding());
563 case RTFKeyword::PCA
:
564 m_aDefaultState
.setCurrentEncoding(RTL_TEXTENCODING_IBM_850
);
565 m_aStates
.top().setCurrentEncoding(m_aDefaultState
.getCurrentEncoding());
567 case RTFKeyword::PLAIN
:
569 m_aStates
.top().getCharacterSprms() = getDefaultState().getCharacterSprms();
570 m_aStates
.top().setCurrentEncoding(getEncoding(getFontIndex(m_nDefaultFontIndex
)));
571 m_aStates
.top().getCharacterAttributes() = getDefaultState().getCharacterAttributes();
572 m_aStates
.top().setCurrentCharacterStyleIndex(-1);
573 m_aStates
.top().setRunType(RTFParserState::RunType::NONE
);
576 case RTFKeyword::PARD
:
579 dispatchSymbol(RTFKeyword::PAR
);
580 // \pard is allowed between \cell and \row, but in that case it should not reset the fact that we're inside a table.
581 // It should not reset the paragraph style, either, so remember the old paragraph style.
582 RTFValue::Pointer_t pOldStyle
583 = m_aStates
.top().getParagraphSprms().find(NS_ooxml::LN_CT_PPrBase_pStyle
);
584 m_aStates
.top().getParagraphSprms() = m_aDefaultState
.getParagraphSprms();
585 m_aStates
.top().getParagraphAttributes() = m_aDefaultState
.getParagraphAttributes();
587 if (m_nTopLevelCells
== 0 && m_nNestedCells
== 0)
589 // Reset that we're in a table.
590 m_aStates
.top().setCurrentBuffer(nullptr);
594 // We are still in a table.
595 m_aStates
.top().getParagraphSprms().set(NS_ooxml::LN_inTbl
, new RTFValue(1));
596 if (m_bAfterCellBeforeRow
&& pOldStyle
)
597 // And we still have the same paragraph style.
598 m_aStates
.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_pStyle
,
600 // Ideally getDefaultSPRM() would take care of this, but it would not when we're buffering.
601 m_aStates
.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_tabs
,
606 // Reset currently selected paragraph style as well, unless we are in the special "after \cell, before \row" state.
607 // By default the style with index 0 is applied.
608 if (!m_bAfterCellBeforeRow
)
610 OUString
const aName
= getStyleName(0);
611 // But only in case it's not a character style.
613 && getStyleType(0) != NS_ooxml::LN_Value_ST_StyleType_character
)
615 m_aStates
.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_pStyle
,
616 new RTFValue(aName
));
618 m_aStates
.top().setCurrentStyleIndex(0);
620 // Need to send paragraph properties again, if there will be any.
624 case RTFKeyword::SECTD
:
626 m_aStates
.top().getSectionSprms() = m_aDefaultState
.getSectionSprms();
627 m_aStates
.top().getSectionAttributes() = m_aDefaultState
.getSectionAttributes();
630 case RTFKeyword::TROWD
:
632 // Back these up, in case later we still need this info.
633 backupTableRowProperties();
634 resetTableRowProperties();
635 // In case the table definition is in the middle of the row
636 // (invalid), make sure table definition is emitted.
640 case RTFKeyword::WIDCTLPAR
:
641 case RTFKeyword::NOWIDCTLPAR
:
643 auto pValue
= new RTFValue(int(nKeyword
== RTFKeyword::WIDCTLPAR
));
644 m_aStates
.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_widowControl
, pValue
);
647 case RTFKeyword::BOX
:
649 RTFSprms aAttributes
;
650 auto pValue
= new RTFValue(aAttributes
);
651 for (int i
= 0; i
< 4; i
++)
652 m_aStates
.top().getParagraphSprms().set(getParagraphBorder(i
), pValue
);
653 m_aStates
.top().setBorderState(RTFBorderState::PARAGRAPH_BOX
);
656 case RTFKeyword::LTRSECT
:
657 case RTFKeyword::RTLSECT
:
659 auto pValue
= new RTFValue(nKeyword
== RTFKeyword::LTRSECT
? 0 : 1);
660 m_aStates
.top().setRunType(RTFParserState::RunType::NONE
);
661 m_aStates
.top().getParagraphSprms().set(NS_ooxml::LN_EG_SectPrContents_textDirection
,
665 case RTFKeyword::LTRPAR
:
666 case RTFKeyword::RTLPAR
:
668 auto pValue
= new RTFValue(nKeyword
== RTFKeyword::LTRPAR
? 0 : 1);
669 m_aStates
.top().setRunType(RTFParserState::RunType::NONE
);
670 m_aStates
.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_bidi
, pValue
);
673 case RTFKeyword::LTRROW
:
674 case RTFKeyword::RTLROW
:
675 m_aStates
.top().setRunType(RTFParserState::RunType::NONE
);
676 m_aStates
.top().getTableRowSprms().set(
677 NS_ooxml::LN_CT_TblPrBase_bidiVisual
,
678 new RTFValue(int(nKeyword
== RTFKeyword::RTLROW
)));
680 case RTFKeyword::LTRCH
:
681 // dmapper does not support this.
682 if (m_aStates
.top().getRunType() == RTFParserState::RunType::RTLCH_LTRCH_1
)
683 m_aStates
.top().setRunType(RTFParserState::RunType::RTLCH_LTRCH_2
);
685 m_aStates
.top().setRunType(RTFParserState::RunType::LTRCH_RTLCH_1
);
687 case RTFKeyword::RTLCH
:
688 if (m_aStates
.top().getRunType() == RTFParserState::RunType::LTRCH_RTLCH_1
)
689 m_aStates
.top().setRunType(RTFParserState::RunType::LTRCH_RTLCH_2
);
691 m_aStates
.top().setRunType(RTFParserState::RunType::RTLCH_LTRCH_1
);
693 if (m_aDefaultState
.getCurrentEncoding() == RTL_TEXTENCODING_MS_1255
)
694 m_aStates
.top().setCurrentEncoding(m_aDefaultState
.getCurrentEncoding());
696 case RTFKeyword::ULNONE
:
698 auto pValue
= new RTFValue(NS_ooxml::LN_Value_ST_Underline_none
);
699 m_aStates
.top().getCharacterAttributes().set(NS_ooxml::LN_CT_Underline_val
, pValue
);
702 case RTFKeyword::NONSHPPICT
:
703 case RTFKeyword::MMATHPICT
: // Picture group used by readers not understanding \moMath group
704 m_aStates
.top().setDestination(Destination::SKIP
);
706 case RTFKeyword::CLBRDRT
:
707 case RTFKeyword::CLBRDRL
:
708 case RTFKeyword::CLBRDRB
:
709 case RTFKeyword::CLBRDRR
:
711 RTFSprms aAttributes
;
713 auto pValue
= new RTFValue(aAttributes
, aSprms
);
716 case RTFKeyword::CLBRDRT
:
717 nSprm
= NS_ooxml::LN_CT_TcBorders_top
;
719 case RTFKeyword::CLBRDRL
:
720 nSprm
= NS_ooxml::LN_CT_TcBorders_left
;
722 case RTFKeyword::CLBRDRB
:
723 nSprm
= NS_ooxml::LN_CT_TcBorders_bottom
;
725 case RTFKeyword::CLBRDRR
:
726 nSprm
= NS_ooxml::LN_CT_TcBorders_right
;
731 putNestedSprm(m_aStates
.top().getTableCellSprms(), NS_ooxml::LN_CT_TcPrBase_tcBorders
,
733 m_aStates
.top().setBorderState(RTFBorderState::CELL
);
736 case RTFKeyword::PGBRDRT
:
737 case RTFKeyword::PGBRDRL
:
738 case RTFKeyword::PGBRDRB
:
739 case RTFKeyword::PGBRDRR
:
741 RTFSprms aAttributes
;
743 auto pValue
= new RTFValue(aAttributes
, aSprms
);
746 case RTFKeyword::PGBRDRT
:
747 nSprm
= NS_ooxml::LN_CT_PageBorders_top
;
749 case RTFKeyword::PGBRDRL
:
750 nSprm
= NS_ooxml::LN_CT_PageBorders_left
;
752 case RTFKeyword::PGBRDRB
:
753 nSprm
= NS_ooxml::LN_CT_PageBorders_bottom
;
755 case RTFKeyword::PGBRDRR
:
756 nSprm
= NS_ooxml::LN_CT_PageBorders_right
;
761 putNestedSprm(m_aStates
.top().getSectionSprms(),
762 NS_ooxml::LN_EG_SectPrContents_pgBorders
, nSprm
, pValue
);
763 m_aStates
.top().setBorderState(RTFBorderState::PAGE
);
766 case RTFKeyword::BRDRT
:
767 case RTFKeyword::BRDRL
:
768 case RTFKeyword::BRDRB
:
769 case RTFKeyword::BRDRR
:
770 case RTFKeyword::BRDRBTW
:
772 RTFSprms aAttributes
;
774 auto pValue
= new RTFValue(aAttributes
, aSprms
);
777 case RTFKeyword::BRDRT
:
778 nSprm
= getParagraphBorder(0);
780 case RTFKeyword::BRDRL
:
781 nSprm
= getParagraphBorder(1);
783 case RTFKeyword::BRDRB
:
784 nSprm
= getParagraphBorder(2);
786 case RTFKeyword::BRDRR
:
787 nSprm
= getParagraphBorder(3);
789 case RTFKeyword::BRDRBTW
:
790 nSprm
= getParagraphBorder(4);
795 putNestedSprm(m_aStates
.top().getParagraphSprms(), NS_ooxml::LN_CT_PrBase_pBdr
, nSprm
,
797 m_aStates
.top().setBorderState(RTFBorderState::PARAGRAPH
);
800 case RTFKeyword::CHBRDR
:
802 RTFSprms aAttributes
;
803 auto pValue
= new RTFValue(aAttributes
);
804 m_aStates
.top().getCharacterSprms().set(NS_ooxml::LN_EG_RPrBase_bdr
, pValue
);
805 m_aStates
.top().setBorderState(RTFBorderState::CHARACTER
);
808 case RTFKeyword::CLMGF
:
810 auto pValue
= new RTFValue(NS_ooxml::LN_Value_ST_Merge_restart
);
811 m_aStates
.top().getTableCellSprms().set(NS_ooxml::LN_CT_TcPrBase_hMerge
, pValue
);
814 case RTFKeyword::CLMRG
:
816 auto pValue
= new RTFValue(NS_ooxml::LN_Value_ST_Merge_continue
);
817 m_aStates
.top().getTableCellSprms().set(NS_ooxml::LN_CT_TcPrBase_hMerge
, pValue
);
820 case RTFKeyword::CLVMGF
:
822 auto pValue
= new RTFValue(NS_ooxml::LN_Value_ST_Merge_restart
);
823 m_aStates
.top().getTableCellSprms().set(NS_ooxml::LN_CT_TcPrBase_vMerge
, pValue
);
826 case RTFKeyword::CLVMRG
:
828 auto pValue
= new RTFValue(NS_ooxml::LN_Value_ST_Merge_continue
);
829 m_aStates
.top().getTableCellSprms().set(NS_ooxml::LN_CT_TcPrBase_vMerge
, pValue
);
832 case RTFKeyword::CLVERTALT
:
833 case RTFKeyword::CLVERTALC
:
834 case RTFKeyword::CLVERTALB
:
838 case RTFKeyword::CLVERTALT
:
839 nParam
= NS_ooxml::LN_Value_ST_VerticalJc_top
;
841 case RTFKeyword::CLVERTALC
:
842 nParam
= NS_ooxml::LN_Value_ST_VerticalJc_center
;
844 case RTFKeyword::CLVERTALB
:
845 nParam
= NS_ooxml::LN_Value_ST_VerticalJc_bottom
;
850 auto pValue
= new RTFValue(nParam
);
851 m_aStates
.top().getTableCellSprms().set(NS_ooxml::LN_CT_TcPrBase_vAlign
, pValue
);
854 case RTFKeyword::TRKEEP
:
856 auto pValue
= new RTFValue(1);
857 m_aStates
.top().getTableRowSprms().set(NS_ooxml::LN_CT_TrPrBase_cantSplit
, pValue
);
860 case RTFKeyword::SECTUNLOCKED
:
862 auto pValue
= new RTFValue(0);
863 m_aStates
.top().getSectionSprms().set(NS_ooxml::LN_EG_SectPrContents_formProt
, pValue
);
866 case RTFKeyword::PGNBIDIA
:
867 case RTFKeyword::PGNBIDIB
:
868 // These should be mapped to NS_ooxml::LN_EG_SectPrContents_pgNumType, but dmapper has no API for that at the moment.
870 case RTFKeyword::LOCH
:
871 m_aStates
.top().setRunType(RTFParserState::RunType::LOCH
);
873 case RTFKeyword::HICH
:
874 m_aStates
.top().setRunType(RTFParserState::RunType::HICH
);
876 case RTFKeyword::DBCH
:
877 m_aStates
.top().setRunType(RTFParserState::RunType::DBCH
);
879 case RTFKeyword::TITLEPG
:
881 auto pValue
= new RTFValue(1);
882 m_aStates
.top().getSectionSprms().set(NS_ooxml::LN_EG_SectPrContents_titlePg
, pValue
);
885 case RTFKeyword::SUPER
:
887 // Make sure character properties are not lost if the document
888 // starts with a footnote.
889 if (!isStyleSheetImport())
895 if (!m_aStates
.top().getCurrentBuffer())
896 m_aStates
.top().setCurrentBuffer(&m_aSuperBuffer
);
898 auto pValue
= new RTFValue("superscript");
899 m_aStates
.top().getCharacterSprms().set(NS_ooxml::LN_EG_RPrBase_vertAlign
, pValue
);
902 case RTFKeyword::SUB
:
904 auto pValue
= new RTFValue("subscript");
905 m_aStates
.top().getCharacterSprms().set(NS_ooxml::LN_EG_RPrBase_vertAlign
, pValue
);
908 case RTFKeyword::NOSUPERSUB
:
910 if (m_aStates
.top().getCurrentBuffer() == &m_aSuperBuffer
)
912 replayBuffer(m_aSuperBuffer
, nullptr, nullptr);
913 m_aStates
.top().setCurrentBuffer(nullptr);
915 m_aStates
.top().getCharacterSprms().erase(NS_ooxml::LN_EG_RPrBase_vertAlign
);
918 case RTFKeyword::LINEPPAGE
:
919 case RTFKeyword::LINECONT
:
921 auto pValue
= new RTFValue(nKeyword
== RTFKeyword::LINEPPAGE
922 ? NS_ooxml::LN_Value_ST_LineNumberRestart_newPage
923 : NS_ooxml::LN_Value_ST_LineNumberRestart_continuous
);
924 putNestedAttribute(m_aStates
.top().getSectionSprms(),
925 NS_ooxml::LN_EG_SectPrContents_lnNumType
,
926 NS_ooxml::LN_CT_LineNumber_restart
, pValue
);
929 case RTFKeyword::AENDDOC
:
930 // Noop, this is the default in Writer.
931 case RTFKeyword::AENDNOTES
:
933 case RTFKeyword::AFTNRSTCONT
:
934 // Noop, this is the default in Writer.
935 case RTFKeyword::AFTNRESTART
:
937 case RTFKeyword::FTNBJ
:
938 // Noop, this is the default in Writer.
940 case RTFKeyword::ENDDOC
:
942 auto pValue
= new RTFValue(NS_ooxml::LN_Value_ST_RestartNumber_eachSect
);
943 putNestedSprm(m_aDefaultState
.getParagraphSprms(),
944 NS_ooxml::LN_EG_SectPrContents_footnotePr
,
945 NS_ooxml::LN_EG_FtnEdnNumProps_numRestart
, pValue
);
948 case RTFKeyword::NOLINE
:
949 eraseNestedAttribute(m_aStates
.top().getSectionSprms(),
950 NS_ooxml::LN_EG_SectPrContents_lnNumType
,
951 NS_ooxml::LN_CT_LineNumber_distance
);
953 case RTFKeyword::FORMSHADE
:
954 // Noop, this is the default in Writer.
956 case RTFKeyword::PNGBLIP
:
957 m_aStates
.top().getPicture().eStyle
= RTFBmpStyle::PNG
;
959 case RTFKeyword::JPEGBLIP
:
960 m_aStates
.top().getPicture().eStyle
= RTFBmpStyle::JPEG
;
962 case RTFKeyword::POSYT
:
963 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign
,
964 NS_ooxml::LN_Value_doc_ST_YAlign_top
);
966 case RTFKeyword::POSYB
:
967 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign
,
968 NS_ooxml::LN_Value_doc_ST_YAlign_bottom
);
970 case RTFKeyword::POSYC
:
971 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign
,
972 NS_ooxml::LN_Value_doc_ST_YAlign_center
);
974 case RTFKeyword::POSYIN
:
975 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign
,
976 NS_ooxml::LN_Value_doc_ST_YAlign_inside
);
978 case RTFKeyword::POSYOUT
:
979 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign
,
980 NS_ooxml::LN_Value_doc_ST_YAlign_outside
);
982 case RTFKeyword::POSYIL
:
983 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign
,
984 NS_ooxml::LN_Value_doc_ST_YAlign_inline
);
987 case RTFKeyword::PHMRG
:
988 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_hAnchor
,
989 NS_ooxml::LN_Value_doc_ST_HAnchor_margin
);
991 case RTFKeyword::PVMRG
:
992 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_vAnchor
,
993 NS_ooxml::LN_Value_doc_ST_VAnchor_margin
);
995 case RTFKeyword::PHPG
:
996 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_hAnchor
,
997 NS_ooxml::LN_Value_doc_ST_HAnchor_page
);
999 case RTFKeyword::PVPG
:
1000 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_vAnchor
,
1001 NS_ooxml::LN_Value_doc_ST_VAnchor_page
);
1003 case RTFKeyword::PHCOL
:
1004 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_hAnchor
,
1005 NS_ooxml::LN_Value_doc_ST_HAnchor_text
);
1007 case RTFKeyword::PVPARA
:
1008 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_vAnchor
,
1009 NS_ooxml::LN_Value_doc_ST_VAnchor_text
);
1012 case RTFKeyword::POSXC
:
1013 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_xAlign
,
1014 NS_ooxml::LN_Value_doc_ST_XAlign_center
);
1016 case RTFKeyword::POSXI
:
1017 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_xAlign
,
1018 NS_ooxml::LN_Value_doc_ST_XAlign_inside
);
1020 case RTFKeyword::POSXO
:
1021 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_xAlign
,
1022 NS_ooxml::LN_Value_doc_ST_XAlign_outside
);
1024 case RTFKeyword::POSXL
:
1025 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_xAlign
,
1026 NS_ooxml::LN_Value_doc_ST_XAlign_left
);
1028 case RTFKeyword::POSXR
:
1029 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_xAlign
,
1030 NS_ooxml::LN_Value_doc_ST_XAlign_right
);
1033 case RTFKeyword::DPLINE
:
1034 case RTFKeyword::DPRECT
:
1035 case RTFKeyword::DPELLIPSE
:
1036 case RTFKeyword::DPTXBX
:
1037 case RTFKeyword::DPPOLYLINE
:
1038 case RTFKeyword::DPPOLYGON
:
1040 sal_Int32 nType
= 0;
1043 case RTFKeyword::DPLINE
:
1045 uno::Reference
<drawing::XShape
> xShape(
1046 getModelFactory()->createInstance("com.sun.star.drawing.LineShape"),
1048 m_aStates
.top().getDrawingObject().setShape(xShape
);
1051 case RTFKeyword::DPPOLYLINE
:
1053 // The reason this is not a simple CustomShape is that in the old syntax we have no ViewBox info.
1054 uno::Reference
<drawing::XShape
> xShape(
1055 getModelFactory()->createInstance("com.sun.star.drawing.PolyLineShape"),
1057 m_aStates
.top().getDrawingObject().setShape(xShape
);
1060 case RTFKeyword::DPPOLYGON
:
1062 uno::Reference
<drawing::XShape
> xShape(
1063 getModelFactory()->createInstance("com.sun.star.drawing.PolyPolygonShape"),
1065 m_aStates
.top().getDrawingObject().setShape(xShape
);
1068 case RTFKeyword::DPRECT
:
1070 uno::Reference
<drawing::XShape
> xShape(
1071 getModelFactory()->createInstance("com.sun.star.drawing.RectangleShape"),
1073 m_aStates
.top().getDrawingObject().setShape(xShape
);
1076 case RTFKeyword::DPELLIPSE
:
1077 nType
= ESCHER_ShpInst_Ellipse
;
1079 case RTFKeyword::DPTXBX
:
1081 uno::Reference
<drawing::XShape
> xShape(
1082 getModelFactory()->createInstance("com.sun.star.text.TextFrame"),
1084 m_aStates
.top().getDrawingObject().setShape(xShape
);
1085 std::vector
<beans::PropertyValue
> aDefaults
1086 = RTFSdrImport::getTextFrameDefaults(false);
1087 for (const auto& rDefault
: aDefaults
)
1089 if (!findPropertyName(
1090 m_aStates
.top().getDrawingObject().getPendingProperties(),
1092 m_aStates
.top().getDrawingObject().getPendingProperties().push_back(
1096 Mapper().startShape(m_aStates
.top().getDrawingObject().getShape());
1097 m_aStates
.top().getDrawingObject().setHadShapeText(true);
1105 uno::Reference
<drawing::XShape
> xShape(
1106 getModelFactory()->createInstance("com.sun.star.drawing.CustomShape"),
1108 m_aStates
.top().getDrawingObject().setShape(xShape
);
1110 uno::Reference
<drawing::XDrawPageSupplier
> xDrawSupplier(m_xDstDoc
, uno::UNO_QUERY
);
1111 uno::Reference
<beans::XPropertySet
> xPropertySet(
1112 m_aStates
.top().getDrawingObject().getShape(), uno::UNO_QUERY
);
1113 m_aStates
.top().getDrawingObject().setPropertySet(xPropertySet
);
1114 if (xDrawSupplier
.is())
1116 uno::Reference
<drawing::XShapes
> xShapes
= xDrawSupplier
->getDrawPage();
1117 if (xShapes
.is() && nKeyword
!= RTFKeyword::DPTXBX
)
1119 // set default VertOrient before inserting
1120 m_aStates
.top().getDrawingObject().getPropertySet()->setPropertyValue(
1121 "VertOrient", uno::Any(text::VertOrientation::NONE
));
1122 xShapes
->add(m_aStates
.top().getDrawingObject().getShape());
1127 uno::Reference
<drawing::XEnhancedCustomShapeDefaulter
> xDefaulter(
1128 m_aStates
.top().getDrawingObject().getShape(), uno::UNO_QUERY
);
1129 xDefaulter
->createCustomShapeDefaults(OUString::number(nType
));
1131 std::vector
<beans::PropertyValue
>& rPendingProperties
1132 = m_aStates
.top().getDrawingObject().getPendingProperties();
1133 for (const auto& rPendingProperty
: rPendingProperties
)
1134 m_aStates
.top().getDrawingObject().getPropertySet()->setPropertyValue(
1135 rPendingProperty
.Name
, rPendingProperty
.Value
);
1136 m_pSdrImport
->resolveDhgt(m_aStates
.top().getDrawingObject().getPropertySet(),
1137 m_aStates
.top().getDrawingObject().getDhgt(),
1138 /*bOldStyle=*/true);
1141 case RTFKeyword::DOBXMARGIN
:
1142 case RTFKeyword::DOBYMARGIN
:
1144 beans::PropertyValue aPropertyValue
;
1146 = (nKeyword
== RTFKeyword::DOBXMARGIN
? std::u16string_view(u
"HoriOrientRelation")
1147 : std::u16string_view(u
"VertOrientRelation"));
1148 aPropertyValue
.Value
<<= text::RelOrientation::PAGE_PRINT_AREA
;
1149 m_aStates
.top().getDrawingObject().getPendingProperties().push_back(aPropertyValue
);
1152 case RTFKeyword::DOBXPAGE
:
1153 case RTFKeyword::DOBYPAGE
:
1155 beans::PropertyValue aPropertyValue
;
1157 = (nKeyword
== RTFKeyword::DOBXPAGE
? std::u16string_view(u
"HoriOrientRelation")
1158 : std::u16string_view(u
"VertOrientRelation"));
1159 aPropertyValue
.Value
<<= text::RelOrientation::PAGE_FRAME
;
1160 m_aStates
.top().getDrawingObject().getPendingProperties().push_back(aPropertyValue
);
1163 case RTFKeyword::DOBYPARA
:
1165 beans::PropertyValue aPropertyValue
;
1166 aPropertyValue
.Name
= "VertOrientRelation";
1167 aPropertyValue
.Value
<<= text::RelOrientation::FRAME
;
1168 m_aStates
.top().getDrawingObject().getPendingProperties().push_back(aPropertyValue
);
1171 case RTFKeyword::CONTEXTUALSPACE
:
1173 auto pValue
= new RTFValue(1);
1174 m_aStates
.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_contextualSpacing
,
1178 case RTFKeyword::LINKSTYLES
:
1180 auto pValue
= new RTFValue(1);
1181 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Settings_linkStyles
, pValue
);
1184 case RTFKeyword::PNLVLBODY
:
1186 auto pValue
= new RTFValue(2);
1187 m_aStates
.top().getTableAttributes().set(NS_ooxml::LN_CT_AbstractNum_nsid
, pValue
);
1190 case RTFKeyword::PNDEC
:
1192 auto pValue
= new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_decimal
);
1193 putNestedAttribute(m_aStates
.top().getTableSprms(), NS_ooxml::LN_CT_Lvl_numFmt
,
1194 NS_ooxml::LN_CT_NumFmt_val
, pValue
);
1197 case RTFKeyword::PNLVLBLT
:
1199 m_aStates
.top().getTableAttributes().set(NS_ooxml::LN_CT_AbstractNum_nsid
,
1201 putNestedAttribute(m_aStates
.top().getTableSprms(), NS_ooxml::LN_CT_Lvl_numFmt
,
1202 NS_ooxml::LN_CT_NumFmt_val
,
1203 new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_bullet
));
1206 case RTFKeyword::LANDSCAPE
:
1208 auto pValue
= new RTFValue(NS_ooxml::LN_Value_ST_PageOrientation_landscape
);
1209 putNestedAttribute(m_aDefaultState
.getSectionSprms(),
1210 NS_ooxml::LN_EG_SectPrContents_pgSz
, NS_ooxml::LN_CT_PageSz_orient
,
1212 [[fallthrough
]]; // set the default + current value
1214 case RTFKeyword::LNDSCPSXN
:
1216 auto pValue
= new RTFValue(NS_ooxml::LN_Value_ST_PageOrientation_landscape
);
1217 putNestedAttribute(m_aStates
.top().getSectionSprms(),
1218 NS_ooxml::LN_EG_SectPrContents_pgSz
, NS_ooxml::LN_CT_PageSz_orient
,
1222 case RTFKeyword::SHPBXPAGE
:
1223 m_aStates
.top().getShape().setHoriOrientRelation(text::RelOrientation::PAGE_FRAME
);
1224 m_aStates
.top().getShape().setHoriOrientRelationToken(
1225 NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page
);
1227 case RTFKeyword::SHPBYPAGE
:
1228 m_aStates
.top().getShape().setVertOrientRelation(text::RelOrientation::PAGE_FRAME
);
1229 m_aStates
.top().getShape().setVertOrientRelationToken(
1230 NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page
);
1232 case RTFKeyword::DPLINEHOLLOW
:
1233 m_aStates
.top().getDrawingObject().setFLine(0);
1235 case RTFKeyword::DPROUNDR
:
1236 if (m_aStates
.top().getDrawingObject().getPropertySet().is())
1237 // Seems this old syntax has no way to specify a custom radius, and this is the default
1238 m_aStates
.top().getDrawingObject().getPropertySet()->setPropertyValue(
1239 "CornerRadius", uno::Any(sal_Int32(83)));
1241 case RTFKeyword::NOWRAP
:
1242 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap
,
1243 NS_ooxml::LN_Value_doc_ST_Wrap_notBeside
);
1245 case RTFKeyword::MNOR
:
1248 case RTFKeyword::REVISIONS
:
1249 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Settings_trackRevisions
, new RTFValue(1));
1251 case RTFKeyword::BRDRSH
:
1252 putBorderProperty(m_aStates
, NS_ooxml::LN_CT_Border_shadow
, new RTFValue(1));
1254 case RTFKeyword::NOCOLBAL
:
1255 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Compat_noColumnBalance
, new RTFValue(1));
1257 case RTFKeyword::MARGMIRROR
:
1258 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Settings_mirrorMargins
, new RTFValue(1));
1260 case RTFKeyword::SAUTOUPD
:
1261 m_aStates
.top().getTableSprms().set(NS_ooxml::LN_CT_Style_autoRedefine
,
1264 case RTFKeyword::WIDOWCTRL
:
1265 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Settings_widowControl
, new RTFValue(1));
1267 case RTFKeyword::LINEBETCOL
:
1268 putNestedAttribute(m_aStates
.top().getSectionSprms(),
1269 NS_ooxml::LN_EG_SectPrContents_cols
, NS_ooxml::LN_CT_Columns_sep
,
1272 case RTFKeyword::PGNRESTART
:
1273 putNestedAttribute(m_aStates
.top().getSectionSprms(),
1274 NS_ooxml::LN_EG_SectPrContents_pgNumType
,
1275 NS_ooxml::LN_CT_PageNumber_start
, new RTFValue(1));
1277 case RTFKeyword::PGNUCLTR
:
1279 auto pIntValue
= new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_upperLetter
);
1280 putNestedAttribute(m_aStates
.top().getSectionSprms(),
1281 NS_ooxml::LN_EG_SectPrContents_pgNumType
,
1282 NS_ooxml::LN_CT_PageNumber_fmt
, pIntValue
);
1285 case RTFKeyword::PGNLCLTR
:
1287 auto pIntValue
= new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter
);
1288 putNestedAttribute(m_aStates
.top().getSectionSprms(),
1289 NS_ooxml::LN_EG_SectPrContents_pgNumType
,
1290 NS_ooxml::LN_CT_PageNumber_fmt
, pIntValue
);
1293 case RTFKeyword::PGNUCRM
:
1295 auto pIntValue
= new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_upperRoman
);
1296 putNestedAttribute(m_aStates
.top().getSectionSprms(),
1297 NS_ooxml::LN_EG_SectPrContents_pgNumType
,
1298 NS_ooxml::LN_CT_PageNumber_fmt
, pIntValue
);
1301 case RTFKeyword::PGNLCRM
:
1303 auto pIntValue
= new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman
);
1304 putNestedAttribute(m_aStates
.top().getSectionSprms(),
1305 NS_ooxml::LN_EG_SectPrContents_pgNumType
,
1306 NS_ooxml::LN_CT_PageNumber_fmt
, pIntValue
);
1309 case RTFKeyword::PGNDEC
:
1311 auto pIntValue
= new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_decimal
);
1312 putNestedAttribute(m_aStates
.top().getSectionSprms(),
1313 NS_ooxml::LN_EG_SectPrContents_pgNumType
,
1314 NS_ooxml::LN_CT_PageNumber_fmt
, pIntValue
);
1317 case RTFKeyword::HTMAUTSP
:
1318 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Compat_doNotUseHTMLParagraphAutoSpacing
,
1321 case RTFKeyword::DNTBLNSBDB
:
1322 // tdf#128428 switch off longer space sequence
1323 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Settings_longerSpaceSequence
,
1326 case RTFKeyword::GUTTERPRL
:
1327 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Settings_gutterAtTop
, new RTFValue(1));
1329 case RTFKeyword::RTLGUTTER
:
1331 m_aStates
.top().getSectionSprms().set(NS_ooxml::LN_EG_SectPrContents_rtlGutter
,
1335 case RTFKeyword::FLDLOCK
:
1337 if (m_aStates
.top().getDestination() == Destination::FIELD
)
1338 m_aStates
.top().setFieldLocked(true);
1341 case RTFKeyword::NOBRKWRPTBL
:
1343 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Compat_doNotBreakWrappedTables
,
1349 SAL_INFO("writerfilter", "TODO handle flag '" << keywordToString(nKeyword
) << "'");
1350 aSkip
.setParsed(false);
1354 return RTFError::OK
;
1357 } // namespace writerfilter
1359 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */