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 // ignore a page break that is defined before the document content has even started
525 nParam
= NS_ooxml::LN_CT_PPrBase_pageBreakBefore
;
532 auto pValue
= new RTFValue(1);
533 m_aStates
.top().getParagraphSprms().set(nParam
, pValue
);
537 if (dispatchFloatingTableFlag(nKeyword
))
544 case RTFKeyword::FNIL
:
545 case RTFKeyword::FROMAN
:
546 case RTFKeyword::FSWISS
:
547 case RTFKeyword::FMODERN
:
548 case RTFKeyword::FSCRIPT
:
549 case RTFKeyword::FDECOR
:
550 case RTFKeyword::FTECH
:
551 case RTFKeyword::FBIDI
:
552 // TODO ooxml:CT_Font_family seems to be ignored by the domain mapper
554 case RTFKeyword::ANSI
:
555 m_aStates
.top().setCurrentEncoding(RTL_TEXTENCODING_MS_1252
);
557 case RTFKeyword::MAC
:
558 m_aDefaultState
.setCurrentEncoding(RTL_TEXTENCODING_APPLE_ROMAN
);
559 m_aStates
.top().setCurrentEncoding(m_aDefaultState
.getCurrentEncoding());
562 m_aDefaultState
.setCurrentEncoding(RTL_TEXTENCODING_IBM_437
);
563 m_aStates
.top().setCurrentEncoding(m_aDefaultState
.getCurrentEncoding());
565 case RTFKeyword::PCA
:
566 m_aDefaultState
.setCurrentEncoding(RTL_TEXTENCODING_IBM_850
);
567 m_aStates
.top().setCurrentEncoding(m_aDefaultState
.getCurrentEncoding());
569 case RTFKeyword::PLAIN
:
571 m_aStates
.top().getCharacterSprms() = getDefaultState().getCharacterSprms();
572 m_aStates
.top().setCurrentEncoding(getEncoding(getFontIndex(m_nDefaultFontIndex
)));
573 m_aStates
.top().getCharacterAttributes() = getDefaultState().getCharacterAttributes();
574 m_aStates
.top().setCurrentCharacterStyleIndex(-1);
575 m_aStates
.top().setRunType(RTFParserState::RunType::NONE
);
578 case RTFKeyword::PARD
:
581 dispatchSymbol(RTFKeyword::PAR
);
582 // \pard is allowed between \cell and \row, but in that case it should not reset the fact that we're inside a table.
583 // It should not reset the paragraph style, either, so remember the old paragraph style.
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 // Ideally getDefaultSPRM() would take care of this, but it would not when we're buffering.
597 m_aStates
.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_tabs
,
602 // Reset currently selected paragraph style as well.
603 // By default the style with index 0 is applied.
605 OUString
const aName
= getStyleName(0);
606 // But only in case it's not a character style.
608 && getStyleType(0) != NS_ooxml::LN_Value_ST_StyleType_character
)
610 m_aStates
.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_pStyle
,
611 new RTFValue(aName
));
613 m_aStates
.top().setCurrentStyleIndex(0);
615 // Need to send paragraph properties again, if there will be any.
619 case RTFKeyword::SECTD
:
621 m_aStates
.top().getSectionSprms() = m_aDefaultState
.getSectionSprms();
622 m_aStates
.top().getSectionAttributes() = m_aDefaultState
.getSectionAttributes();
625 case RTFKeyword::TROWD
:
627 // Back these up, in case later we still need this info.
628 backupTableRowProperties();
629 resetTableRowProperties();
630 // In case the table definition is in the middle of the row
631 // (invalid), make sure table definition is emitted.
635 case RTFKeyword::WIDCTLPAR
:
636 case RTFKeyword::NOWIDCTLPAR
:
638 auto pValue
= new RTFValue(int(nKeyword
== RTFKeyword::WIDCTLPAR
));
639 m_aStates
.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_widowControl
, pValue
);
642 case RTFKeyword::BOX
:
644 RTFSprms aAttributes
;
645 auto pValue
= new RTFValue(aAttributes
);
646 for (int i
= 0; i
< 4; i
++)
647 m_aStates
.top().getParagraphSprms().set(getParagraphBorder(i
), pValue
);
648 m_aStates
.top().setBorderState(RTFBorderState::PARAGRAPH_BOX
);
651 case RTFKeyword::LTRSECT
:
652 case RTFKeyword::RTLSECT
:
654 auto pValue
= new RTFValue(nKeyword
== RTFKeyword::LTRSECT
? 0 : 1);
655 m_aStates
.top().setRunType(RTFParserState::RunType::NONE
);
656 m_aStates
.top().getParagraphSprms().set(NS_ooxml::LN_EG_SectPrContents_textDirection
,
660 case RTFKeyword::LTRPAR
:
661 case RTFKeyword::RTLPAR
:
663 auto pValue
= new RTFValue(nKeyword
== RTFKeyword::LTRPAR
? 0 : 1);
664 m_aStates
.top().setRunType(RTFParserState::RunType::NONE
);
665 m_aStates
.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_bidi
, pValue
);
668 case RTFKeyword::LTRROW
:
669 case RTFKeyword::RTLROW
:
670 m_aStates
.top().setRunType(RTFParserState::RunType::NONE
);
671 m_aStates
.top().getTableRowSprms().set(
672 NS_ooxml::LN_CT_TblPrBase_bidiVisual
,
673 new RTFValue(int(nKeyword
== RTFKeyword::RTLROW
)));
675 case RTFKeyword::LTRCH
:
676 // dmapper does not support this.
677 if (m_aStates
.top().getRunType() == RTFParserState::RunType::RTLCH_LTRCH_1
)
678 m_aStates
.top().setRunType(RTFParserState::RunType::RTLCH_LTRCH_2
);
680 m_aStates
.top().setRunType(RTFParserState::RunType::LTRCH_RTLCH_1
);
682 case RTFKeyword::RTLCH
:
683 if (m_aStates
.top().getRunType() == RTFParserState::RunType::LTRCH_RTLCH_1
)
684 m_aStates
.top().setRunType(RTFParserState::RunType::LTRCH_RTLCH_2
);
686 m_aStates
.top().setRunType(RTFParserState::RunType::RTLCH_LTRCH_1
);
688 if (m_aDefaultState
.getCurrentEncoding() == RTL_TEXTENCODING_MS_1255
)
689 m_aStates
.top().setCurrentEncoding(m_aDefaultState
.getCurrentEncoding());
691 case RTFKeyword::ULNONE
:
693 auto pValue
= new RTFValue(NS_ooxml::LN_Value_ST_Underline_none
);
694 m_aStates
.top().getCharacterAttributes().set(NS_ooxml::LN_CT_Underline_val
, pValue
);
697 case RTFKeyword::NONSHPPICT
:
698 case RTFKeyword::MMATHPICT
: // Picture group used by readers not understanding \moMath group
699 m_aStates
.top().setDestination(Destination::SKIP
);
701 case RTFKeyword::CLBRDRT
:
702 case RTFKeyword::CLBRDRL
:
703 case RTFKeyword::CLBRDRB
:
704 case RTFKeyword::CLBRDRR
:
706 RTFSprms aAttributes
;
708 auto pValue
= new RTFValue(aAttributes
, aSprms
);
711 case RTFKeyword::CLBRDRT
:
712 nSprm
= NS_ooxml::LN_CT_TcBorders_top
;
714 case RTFKeyword::CLBRDRL
:
715 nSprm
= NS_ooxml::LN_CT_TcBorders_left
;
717 case RTFKeyword::CLBRDRB
:
718 nSprm
= NS_ooxml::LN_CT_TcBorders_bottom
;
720 case RTFKeyword::CLBRDRR
:
721 nSprm
= NS_ooxml::LN_CT_TcBorders_right
;
726 putNestedSprm(m_aStates
.top().getTableCellSprms(), NS_ooxml::LN_CT_TcPrBase_tcBorders
,
728 m_aStates
.top().setBorderState(RTFBorderState::CELL
);
731 case RTFKeyword::PGBRDRT
:
732 case RTFKeyword::PGBRDRL
:
733 case RTFKeyword::PGBRDRB
:
734 case RTFKeyword::PGBRDRR
:
736 RTFSprms aAttributes
;
738 auto pValue
= new RTFValue(aAttributes
, aSprms
);
741 case RTFKeyword::PGBRDRT
:
742 nSprm
= NS_ooxml::LN_CT_PageBorders_top
;
744 case RTFKeyword::PGBRDRL
:
745 nSprm
= NS_ooxml::LN_CT_PageBorders_left
;
747 case RTFKeyword::PGBRDRB
:
748 nSprm
= NS_ooxml::LN_CT_PageBorders_bottom
;
750 case RTFKeyword::PGBRDRR
:
751 nSprm
= NS_ooxml::LN_CT_PageBorders_right
;
756 putNestedSprm(m_aStates
.top().getSectionSprms(),
757 NS_ooxml::LN_EG_SectPrContents_pgBorders
, nSprm
, pValue
);
758 m_aStates
.top().setBorderState(RTFBorderState::PAGE
);
761 case RTFKeyword::BRDRT
:
762 case RTFKeyword::BRDRL
:
763 case RTFKeyword::BRDRB
:
764 case RTFKeyword::BRDRR
:
765 case RTFKeyword::BRDRBTW
:
767 RTFSprms aAttributes
;
769 auto pValue
= new RTFValue(aAttributes
, aSprms
);
772 case RTFKeyword::BRDRT
:
773 nSprm
= getParagraphBorder(0);
775 case RTFKeyword::BRDRL
:
776 nSprm
= getParagraphBorder(1);
778 case RTFKeyword::BRDRB
:
779 nSprm
= getParagraphBorder(2);
781 case RTFKeyword::BRDRR
:
782 nSprm
= getParagraphBorder(3);
784 case RTFKeyword::BRDRBTW
:
785 nSprm
= getParagraphBorder(4);
790 putNestedSprm(m_aStates
.top().getParagraphSprms(), NS_ooxml::LN_CT_PrBase_pBdr
, nSprm
,
792 m_aStates
.top().setBorderState(RTFBorderState::PARAGRAPH
);
795 case RTFKeyword::CHBRDR
:
797 RTFSprms aAttributes
;
798 auto pValue
= new RTFValue(aAttributes
);
799 m_aStates
.top().getCharacterSprms().set(NS_ooxml::LN_EG_RPrBase_bdr
, pValue
);
800 m_aStates
.top().setBorderState(RTFBorderState::CHARACTER
);
803 case RTFKeyword::CLMGF
:
805 auto pValue
= new RTFValue(NS_ooxml::LN_Value_ST_Merge_restart
);
806 m_aStates
.top().getTableCellSprms().set(NS_ooxml::LN_CT_TcPrBase_hMerge
, pValue
);
809 case RTFKeyword::CLMRG
:
811 auto pValue
= new RTFValue(NS_ooxml::LN_Value_ST_Merge_continue
);
812 m_aStates
.top().getTableCellSprms().set(NS_ooxml::LN_CT_TcPrBase_hMerge
, pValue
);
815 case RTFKeyword::CLVMGF
:
817 auto pValue
= new RTFValue(NS_ooxml::LN_Value_ST_Merge_restart
);
818 m_aStates
.top().getTableCellSprms().set(NS_ooxml::LN_CT_TcPrBase_vMerge
, pValue
);
821 case RTFKeyword::CLVMRG
:
823 auto pValue
= new RTFValue(NS_ooxml::LN_Value_ST_Merge_continue
);
824 m_aStates
.top().getTableCellSprms().set(NS_ooxml::LN_CT_TcPrBase_vMerge
, pValue
);
827 case RTFKeyword::CLVERTALT
:
828 case RTFKeyword::CLVERTALC
:
829 case RTFKeyword::CLVERTALB
:
833 case RTFKeyword::CLVERTALT
:
834 nParam
= NS_ooxml::LN_Value_ST_VerticalJc_top
;
836 case RTFKeyword::CLVERTALC
:
837 nParam
= NS_ooxml::LN_Value_ST_VerticalJc_center
;
839 case RTFKeyword::CLVERTALB
:
840 nParam
= NS_ooxml::LN_Value_ST_VerticalJc_bottom
;
845 auto pValue
= new RTFValue(nParam
);
846 m_aStates
.top().getTableCellSprms().set(NS_ooxml::LN_CT_TcPrBase_vAlign
, pValue
);
849 case RTFKeyword::TRKEEP
:
851 auto pValue
= new RTFValue(1);
852 m_aStates
.top().getTableRowSprms().set(NS_ooxml::LN_CT_TrPrBase_cantSplit
, pValue
);
855 case RTFKeyword::SECTUNLOCKED
:
857 auto pValue
= new RTFValue(0);
858 m_aStates
.top().getSectionSprms().set(NS_ooxml::LN_EG_SectPrContents_formProt
, pValue
);
861 case RTFKeyword::PGNBIDIA
:
862 case RTFKeyword::PGNBIDIB
:
863 // These should be mapped to NS_ooxml::LN_EG_SectPrContents_pgNumType, but dmapper has no API for that at the moment.
865 case RTFKeyword::LOCH
:
866 m_aStates
.top().setRunType(RTFParserState::RunType::LOCH
);
868 case RTFKeyword::HICH
:
869 m_aStates
.top().setRunType(RTFParserState::RunType::HICH
);
871 case RTFKeyword::DBCH
:
872 m_aStates
.top().setRunType(RTFParserState::RunType::DBCH
);
874 case RTFKeyword::TITLEPG
:
876 auto pValue
= new RTFValue(1);
877 m_aStates
.top().getSectionSprms().set(NS_ooxml::LN_EG_SectPrContents_titlePg
, pValue
);
880 case RTFKeyword::SUPER
:
882 // Make sure character properties are not lost if the document
883 // starts with a footnote.
884 if (!isStyleSheetImport())
890 if (!m_aStates
.top().getCurrentBuffer())
891 m_aStates
.top().setCurrentBuffer(&m_aSuperBuffer
);
893 auto pValue
= new RTFValue("superscript");
894 m_aStates
.top().getCharacterSprms().set(NS_ooxml::LN_EG_RPrBase_vertAlign
, pValue
);
897 case RTFKeyword::SUB
:
899 auto pValue
= new RTFValue("subscript");
900 m_aStates
.top().getCharacterSprms().set(NS_ooxml::LN_EG_RPrBase_vertAlign
, pValue
);
903 case RTFKeyword::NOSUPERSUB
:
905 if (m_aStates
.top().getCurrentBuffer() == &m_aSuperBuffer
)
907 replayBuffer(m_aSuperBuffer
, nullptr, nullptr);
908 m_aStates
.top().setCurrentBuffer(nullptr);
910 m_aStates
.top().getCharacterSprms().erase(NS_ooxml::LN_EG_RPrBase_vertAlign
);
913 case RTFKeyword::LINEPPAGE
:
914 case RTFKeyword::LINECONT
:
916 auto pValue
= new RTFValue(nKeyword
== RTFKeyword::LINEPPAGE
917 ? NS_ooxml::LN_Value_ST_LineNumberRestart_newPage
918 : NS_ooxml::LN_Value_ST_LineNumberRestart_continuous
);
919 putNestedAttribute(m_aStates
.top().getSectionSprms(),
920 NS_ooxml::LN_EG_SectPrContents_lnNumType
,
921 NS_ooxml::LN_CT_LineNumber_restart
, pValue
);
924 case RTFKeyword::AENDDOC
:
925 // Noop, this is the default in Writer.
926 case RTFKeyword::AENDNOTES
:
928 case RTFKeyword::AFTNRSTCONT
:
929 // Noop, this is the default in Writer.
930 case RTFKeyword::AFTNRESTART
:
932 case RTFKeyword::FTNBJ
:
933 // Noop, this is the default in Writer.
935 case RTFKeyword::ENDDOC
:
937 auto pValue
= new RTFValue(NS_ooxml::LN_Value_ST_RestartNumber_eachSect
);
938 putNestedSprm(m_aDefaultState
.getParagraphSprms(),
939 NS_ooxml::LN_EG_SectPrContents_footnotePr
,
940 NS_ooxml::LN_EG_FtnEdnNumProps_numRestart
, pValue
);
943 case RTFKeyword::NOLINE
:
944 eraseNestedAttribute(m_aStates
.top().getSectionSprms(),
945 NS_ooxml::LN_EG_SectPrContents_lnNumType
,
946 NS_ooxml::LN_CT_LineNumber_distance
);
948 case RTFKeyword::FORMSHADE
:
949 // Noop, this is the default in Writer.
951 case RTFKeyword::PNGBLIP
:
952 m_aStates
.top().getPicture().eStyle
= RTFBmpStyle::PNG
;
954 case RTFKeyword::JPEGBLIP
:
955 m_aStates
.top().getPicture().eStyle
= RTFBmpStyle::JPEG
;
957 case RTFKeyword::POSYT
:
958 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign
,
959 NS_ooxml::LN_Value_doc_ST_YAlign_top
);
961 case RTFKeyword::POSYB
:
962 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign
,
963 NS_ooxml::LN_Value_doc_ST_YAlign_bottom
);
965 case RTFKeyword::POSYC
:
966 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign
,
967 NS_ooxml::LN_Value_doc_ST_YAlign_center
);
969 case RTFKeyword::POSYIN
:
970 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign
,
971 NS_ooxml::LN_Value_doc_ST_YAlign_inside
);
973 case RTFKeyword::POSYOUT
:
974 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign
,
975 NS_ooxml::LN_Value_doc_ST_YAlign_outside
);
977 case RTFKeyword::POSYIL
:
978 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_yAlign
,
979 NS_ooxml::LN_Value_doc_ST_YAlign_inline
);
982 case RTFKeyword::PHMRG
:
983 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_hAnchor
,
984 NS_ooxml::LN_Value_doc_ST_HAnchor_margin
);
986 case RTFKeyword::PVMRG
:
987 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_vAnchor
,
988 NS_ooxml::LN_Value_doc_ST_VAnchor_margin
);
990 case RTFKeyword::PHPG
:
991 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_hAnchor
,
992 NS_ooxml::LN_Value_doc_ST_HAnchor_page
);
994 case RTFKeyword::PVPG
:
995 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_vAnchor
,
996 NS_ooxml::LN_Value_doc_ST_VAnchor_page
);
998 case RTFKeyword::PHCOL
:
999 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_hAnchor
,
1000 NS_ooxml::LN_Value_doc_ST_HAnchor_text
);
1002 case RTFKeyword::PVPARA
:
1003 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_vAnchor
,
1004 NS_ooxml::LN_Value_doc_ST_VAnchor_text
);
1007 case RTFKeyword::POSXC
:
1008 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_xAlign
,
1009 NS_ooxml::LN_Value_doc_ST_XAlign_center
);
1011 case RTFKeyword::POSXI
:
1012 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_xAlign
,
1013 NS_ooxml::LN_Value_doc_ST_XAlign_inside
);
1015 case RTFKeyword::POSXO
:
1016 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_xAlign
,
1017 NS_ooxml::LN_Value_doc_ST_XAlign_outside
);
1019 case RTFKeyword::POSXL
:
1020 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_xAlign
,
1021 NS_ooxml::LN_Value_doc_ST_XAlign_left
);
1023 case RTFKeyword::POSXR
:
1024 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_xAlign
,
1025 NS_ooxml::LN_Value_doc_ST_XAlign_right
);
1028 case RTFKeyword::DPLINE
:
1029 case RTFKeyword::DPRECT
:
1030 case RTFKeyword::DPELLIPSE
:
1031 case RTFKeyword::DPTXBX
:
1032 case RTFKeyword::DPPOLYLINE
:
1033 case RTFKeyword::DPPOLYGON
:
1035 sal_Int32 nType
= 0;
1038 case RTFKeyword::DPLINE
:
1040 uno::Reference
<drawing::XShape
> xShape(
1041 getModelFactory()->createInstance("com.sun.star.drawing.LineShape"),
1043 m_aStates
.top().getDrawingObject().setShape(xShape
);
1046 case RTFKeyword::DPPOLYLINE
:
1048 // The reason this is not a simple CustomShape is that in the old syntax we have no ViewBox info.
1049 uno::Reference
<drawing::XShape
> xShape(
1050 getModelFactory()->createInstance("com.sun.star.drawing.PolyLineShape"),
1052 m_aStates
.top().getDrawingObject().setShape(xShape
);
1055 case RTFKeyword::DPPOLYGON
:
1057 uno::Reference
<drawing::XShape
> xShape(
1058 getModelFactory()->createInstance("com.sun.star.drawing.PolyPolygonShape"),
1060 m_aStates
.top().getDrawingObject().setShape(xShape
);
1063 case RTFKeyword::DPRECT
:
1065 uno::Reference
<drawing::XShape
> xShape(
1066 getModelFactory()->createInstance("com.sun.star.drawing.RectangleShape"),
1068 m_aStates
.top().getDrawingObject().setShape(xShape
);
1071 case RTFKeyword::DPELLIPSE
:
1072 nType
= ESCHER_ShpInst_Ellipse
;
1074 case RTFKeyword::DPTXBX
:
1076 uno::Reference
<drawing::XShape
> xShape(
1077 getModelFactory()->createInstance("com.sun.star.text.TextFrame"),
1079 m_aStates
.top().getDrawingObject().setShape(xShape
);
1080 std::vector
<beans::PropertyValue
> aDefaults
1081 = RTFSdrImport::getTextFrameDefaults(false);
1082 for (const auto& rDefault
: aDefaults
)
1084 if (!findPropertyName(
1085 m_aStates
.top().getDrawingObject().getPendingProperties(),
1087 m_aStates
.top().getDrawingObject().getPendingProperties().push_back(
1091 Mapper().startShape(m_aStates
.top().getDrawingObject().getShape());
1092 m_aStates
.top().getDrawingObject().setHadShapeText(true);
1100 uno::Reference
<drawing::XShape
> xShape(
1101 getModelFactory()->createInstance("com.sun.star.drawing.CustomShape"),
1103 m_aStates
.top().getDrawingObject().setShape(xShape
);
1105 uno::Reference
<drawing::XDrawPageSupplier
> xDrawSupplier(m_xDstDoc
, uno::UNO_QUERY
);
1106 uno::Reference
<beans::XPropertySet
> xPropertySet(
1107 m_aStates
.top().getDrawingObject().getShape(), uno::UNO_QUERY
);
1108 m_aStates
.top().getDrawingObject().setPropertySet(xPropertySet
);
1109 if (xDrawSupplier
.is())
1111 uno::Reference
<drawing::XShapes
> xShapes
= xDrawSupplier
->getDrawPage();
1112 if (xShapes
.is() && nKeyword
!= RTFKeyword::DPTXBX
)
1114 // set default VertOrient before inserting
1115 m_aStates
.top().getDrawingObject().getPropertySet()->setPropertyValue(
1116 "VertOrient", uno::Any(text::VertOrientation::NONE
));
1117 xShapes
->add(m_aStates
.top().getDrawingObject().getShape());
1122 uno::Reference
<drawing::XEnhancedCustomShapeDefaulter
> xDefaulter(
1123 m_aStates
.top().getDrawingObject().getShape(), uno::UNO_QUERY
);
1124 xDefaulter
->createCustomShapeDefaults(OUString::number(nType
));
1126 std::vector
<beans::PropertyValue
>& rPendingProperties
1127 = m_aStates
.top().getDrawingObject().getPendingProperties();
1128 for (const auto& rPendingProperty
: rPendingProperties
)
1129 m_aStates
.top().getDrawingObject().getPropertySet()->setPropertyValue(
1130 rPendingProperty
.Name
, rPendingProperty
.Value
);
1131 m_pSdrImport
->resolveDhgt(m_aStates
.top().getDrawingObject().getPropertySet(),
1132 m_aStates
.top().getDrawingObject().getDhgt(),
1133 /*bOldStyle=*/true);
1136 case RTFKeyword::DOBXMARGIN
:
1137 case RTFKeyword::DOBYMARGIN
:
1139 beans::PropertyValue aPropertyValue
;
1141 = (nKeyword
== RTFKeyword::DOBXMARGIN
? std::u16string_view(u
"HoriOrientRelation")
1142 : std::u16string_view(u
"VertOrientRelation"));
1143 aPropertyValue
.Value
<<= text::RelOrientation::PAGE_PRINT_AREA
;
1144 m_aStates
.top().getDrawingObject().getPendingProperties().push_back(aPropertyValue
);
1147 case RTFKeyword::DOBXPAGE
:
1148 case RTFKeyword::DOBYPAGE
:
1150 beans::PropertyValue aPropertyValue
;
1152 = (nKeyword
== RTFKeyword::DOBXPAGE
? std::u16string_view(u
"HoriOrientRelation")
1153 : std::u16string_view(u
"VertOrientRelation"));
1154 aPropertyValue
.Value
<<= text::RelOrientation::PAGE_FRAME
;
1155 m_aStates
.top().getDrawingObject().getPendingProperties().push_back(aPropertyValue
);
1158 case RTFKeyword::DOBYPARA
:
1160 beans::PropertyValue aPropertyValue
;
1161 aPropertyValue
.Name
= "VertOrientRelation";
1162 aPropertyValue
.Value
<<= text::RelOrientation::FRAME
;
1163 m_aStates
.top().getDrawingObject().getPendingProperties().push_back(aPropertyValue
);
1166 case RTFKeyword::CONTEXTUALSPACE
:
1168 auto pValue
= new RTFValue(1);
1169 m_aStates
.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_contextualSpacing
,
1173 case RTFKeyword::LINKSTYLES
:
1175 auto pValue
= new RTFValue(1);
1176 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Settings_linkStyles
, pValue
);
1179 case RTFKeyword::PNLVLBODY
:
1181 auto pValue
= new RTFValue(2);
1182 m_aStates
.top().getTableAttributes().set(NS_ooxml::LN_CT_AbstractNum_nsid
, pValue
);
1185 case RTFKeyword::PNDEC
:
1187 auto pValue
= new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_decimal
);
1188 putNestedAttribute(m_aStates
.top().getTableSprms(), NS_ooxml::LN_CT_Lvl_numFmt
,
1189 NS_ooxml::LN_CT_NumFmt_val
, pValue
);
1192 case RTFKeyword::PNLVLBLT
:
1194 m_aStates
.top().getTableAttributes().set(NS_ooxml::LN_CT_AbstractNum_nsid
,
1196 putNestedAttribute(m_aStates
.top().getTableSprms(), NS_ooxml::LN_CT_Lvl_numFmt
,
1197 NS_ooxml::LN_CT_NumFmt_val
,
1198 new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_bullet
));
1201 case RTFKeyword::LANDSCAPE
:
1203 auto pValue
= new RTFValue(NS_ooxml::LN_Value_ST_PageOrientation_landscape
);
1204 putNestedAttribute(m_aDefaultState
.getSectionSprms(),
1205 NS_ooxml::LN_EG_SectPrContents_pgSz
, NS_ooxml::LN_CT_PageSz_orient
,
1207 [[fallthrough
]]; // set the default + current value
1209 case RTFKeyword::LNDSCPSXN
:
1211 auto pValue
= new RTFValue(NS_ooxml::LN_Value_ST_PageOrientation_landscape
);
1212 putNestedAttribute(m_aStates
.top().getSectionSprms(),
1213 NS_ooxml::LN_EG_SectPrContents_pgSz
, NS_ooxml::LN_CT_PageSz_orient
,
1217 case RTFKeyword::SHPBXPAGE
:
1218 m_aStates
.top().getShape().setHoriOrientRelation(text::RelOrientation::PAGE_FRAME
);
1219 m_aStates
.top().getShape().setHoriOrientRelationToken(
1220 NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page
);
1222 case RTFKeyword::SHPBYPAGE
:
1223 m_aStates
.top().getShape().setVertOrientRelation(text::RelOrientation::PAGE_FRAME
);
1224 m_aStates
.top().getShape().setVertOrientRelationToken(
1225 NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page
);
1227 case RTFKeyword::DPLINEHOLLOW
:
1228 m_aStates
.top().getDrawingObject().setFLine(0);
1230 case RTFKeyword::DPROUNDR
:
1231 if (m_aStates
.top().getDrawingObject().getPropertySet().is())
1232 // Seems this old syntax has no way to specify a custom radius, and this is the default
1233 m_aStates
.top().getDrawingObject().getPropertySet()->setPropertyValue(
1234 "CornerRadius", uno::Any(sal_Int32(83)));
1236 case RTFKeyword::NOWRAP
:
1237 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap
,
1238 NS_ooxml::LN_Value_doc_ST_Wrap_notBeside
);
1240 case RTFKeyword::OVERLAY
:
1241 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap
,
1242 NS_ooxml::LN_Value_doc_ST_Wrap_none
);
1244 case RTFKeyword::WRAPAROUND
:
1245 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap
,
1246 NS_ooxml::LN_Value_doc_ST_Wrap_around
);
1248 case RTFKeyword::WRAPTHROUGH
:
1249 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap
,
1250 NS_ooxml::LN_Value_doc_ST_Wrap_through
);
1252 case RTFKeyword::WRAPTIGHT
:
1253 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap
,
1254 NS_ooxml::LN_Value_doc_ST_Wrap_tight
);
1256 case RTFKeyword::WRAPDEFAULT
:
1257 m_aStates
.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap
,
1258 NS_ooxml::LN_Value_doc_ST_Wrap_auto
);
1260 case RTFKeyword::MNOR
:
1263 case RTFKeyword::REVISIONS
:
1264 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Settings_trackRevisions
, new RTFValue(1));
1266 case RTFKeyword::BRDRSH
:
1267 putBorderProperty(m_aStates
, NS_ooxml::LN_CT_Border_shadow
, new RTFValue(1));
1269 case RTFKeyword::NOCOLBAL
:
1270 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Compat_noColumnBalance
, new RTFValue(1));
1272 case RTFKeyword::MARGMIRROR
:
1273 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Settings_mirrorMargins
, new RTFValue(1));
1275 case RTFKeyword::SAUTOUPD
:
1276 m_aStates
.top().getTableSprms().set(NS_ooxml::LN_CT_Style_autoRedefine
,
1279 case RTFKeyword::WIDOWCTRL
:
1280 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Settings_widowControl
, new RTFValue(1));
1282 case RTFKeyword::LINEBETCOL
:
1283 putNestedAttribute(m_aStates
.top().getSectionSprms(),
1284 NS_ooxml::LN_EG_SectPrContents_cols
, NS_ooxml::LN_CT_Columns_sep
,
1287 case RTFKeyword::PGNRESTART
:
1288 putNestedAttribute(m_aStates
.top().getSectionSprms(),
1289 NS_ooxml::LN_EG_SectPrContents_pgNumType
,
1290 NS_ooxml::LN_CT_PageNumber_start
, new RTFValue(1));
1292 case RTFKeyword::PGNUCLTR
:
1294 auto pIntValue
= new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_upperLetter
);
1295 putNestedAttribute(m_aStates
.top().getSectionSprms(),
1296 NS_ooxml::LN_EG_SectPrContents_pgNumType
,
1297 NS_ooxml::LN_CT_PageNumber_fmt
, pIntValue
);
1300 case RTFKeyword::PGNLCLTR
:
1302 auto pIntValue
= new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter
);
1303 putNestedAttribute(m_aStates
.top().getSectionSprms(),
1304 NS_ooxml::LN_EG_SectPrContents_pgNumType
,
1305 NS_ooxml::LN_CT_PageNumber_fmt
, pIntValue
);
1308 case RTFKeyword::PGNUCRM
:
1310 auto pIntValue
= new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_upperRoman
);
1311 putNestedAttribute(m_aStates
.top().getSectionSprms(),
1312 NS_ooxml::LN_EG_SectPrContents_pgNumType
,
1313 NS_ooxml::LN_CT_PageNumber_fmt
, pIntValue
);
1316 case RTFKeyword::PGNLCRM
:
1318 auto pIntValue
= new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman
);
1319 putNestedAttribute(m_aStates
.top().getSectionSprms(),
1320 NS_ooxml::LN_EG_SectPrContents_pgNumType
,
1321 NS_ooxml::LN_CT_PageNumber_fmt
, pIntValue
);
1324 case RTFKeyword::PGNDEC
:
1326 auto pIntValue
= new RTFValue(NS_ooxml::LN_Value_ST_NumberFormat_decimal
);
1327 putNestedAttribute(m_aStates
.top().getSectionSprms(),
1328 NS_ooxml::LN_EG_SectPrContents_pgNumType
,
1329 NS_ooxml::LN_CT_PageNumber_fmt
, pIntValue
);
1332 case RTFKeyword::HTMAUTSP
:
1333 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Compat_doNotUseHTMLParagraphAutoSpacing
,
1336 case RTFKeyword::DNTBLNSBDB
:
1337 // tdf#128428 switch off longer space sequence
1338 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Settings_longerSpaceSequence
,
1341 case RTFKeyword::GUTTERPRL
:
1342 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Settings_gutterAtTop
, new RTFValue(1));
1344 case RTFKeyword::RTLGUTTER
:
1346 m_aStates
.top().getSectionSprms().set(NS_ooxml::LN_EG_SectPrContents_rtlGutter
,
1350 case RTFKeyword::FLDLOCK
:
1352 if (m_aStates
.top().getDestination() == Destination::FIELD
)
1353 m_aStates
.top().setFieldLocked(true);
1356 case RTFKeyword::NOBRKWRPTBL
:
1358 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Compat_doNotBreakWrappedTables
,
1362 case RTFKeyword::SPLTPGPAR
:
1364 // if flag is present, it is turned *off* - opposite to what spec says
1365 m_aSettingsTableSprms
.set(NS_ooxml::LN_CT_Compat_splitPgBreakAndParaMark
,
1371 SAL_INFO("writerfilter", "TODO handle flag '" << keywordToString(nKeyword
) << "'");
1372 aSkip
.setParsed(false);
1376 return RTFError::OK
;
1379 } // namespace writerfilter
1381 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */