diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-05-17 21:47:03 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-05-20 10:07:20 +0200 |
commit | e2aa8f8cb3b93ec3cb14c5c9edc3bbce78c1558f (patch) | |
tree | 24ab40e186a9468c33689dfea592319cc744f08e /writerfilter/source/rtftok | |
parent | 7fc54a819cf558b2c9cbeaaf3213d400c5f11a19 (diff) |
writerfilter: make RTFParserState members private, part 10
Change-Id: Id4445fc8fa1d81f052fd26ea85b661e44fd83be0
Reviewed-on: https://gerrit.libreoffice.org/72563
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter/source/rtftok')
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchdestination.cxx | 202 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchflag.cxx | 12 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchsymbol.cxx | 4 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchvalue.cxx | 49 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 124 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.hxx | 12 |
6 files changed, 207 insertions, 196 deletions
diff --git a/writerfilter/source/rtftok/rtfdispatchdestination.cxx b/writerfilter/source/rtftok/rtfdispatchdestination.cxx index bfb52e741e08..0a6a5fe1d955 100644 --- a/writerfilter/source/rtftok/rtfdispatchdestination.cxx +++ b/writerfilter/source/rtftok/rtfdispatchdestination.cxx @@ -40,9 +40,9 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) checkUnicode(/*bUnicode =*/true, /*bHex =*/true); RTFSkipDestination aSkip(*this); // special case \upr: ignore everything except nested \ud - if (Destination::UPR == m_aStates.top().eDestination && RTF_UD != nKeyword) + if (Destination::UPR == m_aStates.top().getDestination() && RTF_UD != nKeyword) { - m_aStates.top().eDestination = Destination::SKIP; + m_aStates.top().setDestination(Destination::SKIP); aSkip.setParsed(false); } else @@ -51,16 +51,16 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) case RTF_RTF: break; case RTF_FONTTBL: - m_aStates.top().eDestination = Destination::FONTTABLE; + m_aStates.top().setDestination(Destination::FONTTABLE); break; case RTF_COLORTBL: - m_aStates.top().eDestination = Destination::COLORTABLE; + m_aStates.top().setDestination(Destination::COLORTABLE); break; case RTF_STYLESHEET: - m_aStates.top().eDestination = Destination::STYLESHEET; + m_aStates.top().setDestination(Destination::STYLESHEET); break; case RTF_FIELD: - m_aStates.top().eDestination = Destination::FIELD; + m_aStates.top().setDestination(Destination::FIELD); break; case RTF_FLDINST: { @@ -111,75 +111,75 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) m_bFormField = true; singleChar(cFieldStart); - m_aStates.top().eDestination = Destination::FIELDINSTRUCTION; + m_aStates.top().setDestination(Destination::FIELDINSTRUCTION); } break; case RTF_FLDRSLT: - m_aStates.top().eDestination = Destination::FIELDRESULT; + m_aStates.top().setDestination(Destination::FIELDRESULT); break; case RTF_LISTTABLE: - m_aStates.top().eDestination = Destination::LISTTABLE; + m_aStates.top().setDestination(Destination::LISTTABLE); break; case RTF_LISTPICTURE: - m_aStates.top().eDestination = Destination::LISTPICTURE; + m_aStates.top().setDestination(Destination::LISTPICTURE); m_aStates.top().setInListpicture(true); break; case RTF_LIST: - m_aStates.top().eDestination = Destination::LISTENTRY; + m_aStates.top().setDestination(Destination::LISTENTRY); break; case RTF_LISTNAME: - m_aStates.top().eDestination = Destination::LISTNAME; + m_aStates.top().setDestination(Destination::LISTNAME); break; case RTF_LFOLEVEL: - m_aStates.top().eDestination = Destination::LFOLEVEL; + m_aStates.top().setDestination(Destination::LFOLEVEL); m_aStates.top().getTableSprms().clear(); break; case RTF_LISTOVERRIDETABLE: - m_aStates.top().eDestination = Destination::LISTOVERRIDETABLE; + m_aStates.top().setDestination(Destination::LISTOVERRIDETABLE); break; case RTF_LISTOVERRIDE: - m_aStates.top().eDestination = Destination::LISTOVERRIDEENTRY; + m_aStates.top().setDestination(Destination::LISTOVERRIDEENTRY); break; case RTF_LISTLEVEL: - m_aStates.top().eDestination = Destination::LISTLEVEL; + m_aStates.top().setDestination(Destination::LISTLEVEL); ++m_nListLevel; break; case RTF_LEVELTEXT: - m_aStates.top().eDestination = Destination::LEVELTEXT; + m_aStates.top().setDestination(Destination::LEVELTEXT); break; case RTF_LEVELNUMBERS: - m_aStates.top().eDestination = Destination::LEVELNUMBERS; + m_aStates.top().setDestination(Destination::LEVELNUMBERS); break; case RTF_SHPPICT: resetFrame(); - m_aStates.top().eDestination = Destination::SHPPICT; + m_aStates.top().setDestination(Destination::SHPPICT); break; case RTF_PICT: - if (m_aStates.top().eDestination != Destination::SHAPEPROPERTYVALUE) - m_aStates.top().eDestination = Destination::PICT; // as character + if (m_aStates.top().getDestination() != Destination::SHAPEPROPERTYVALUE) + m_aStates.top().setDestination(Destination::PICT); // as character else - m_aStates.top().eDestination - = Destination::SHAPEPROPERTYVALUEPICT; // anchored inside a shape + m_aStates.top().setDestination( + Destination::SHAPEPROPERTYVALUEPICT); // anchored inside a shape break; case RTF_PICPROP: - m_aStates.top().eDestination = Destination::PICPROP; + m_aStates.top().setDestination(Destination::PICPROP); break; case RTF_SP: - m_aStates.top().eDestination = Destination::SHAPEPROPERTY; + m_aStates.top().setDestination(Destination::SHAPEPROPERTY); break; case RTF_SN: - m_aStates.top().eDestination = Destination::SHAPEPROPERTYNAME; + m_aStates.top().setDestination(Destination::SHAPEPROPERTYNAME); break; case RTF_SV: - m_aStates.top().eDestination = Destination::SHAPEPROPERTYVALUE; + m_aStates.top().setDestination(Destination::SHAPEPROPERTYVALUE); break; case RTF_SHP: m_bNeedCrOrig = m_bNeedCr; - m_aStates.top().eDestination = Destination::SHAPE; + m_aStates.top().setDestination(Destination::SHAPE); m_aStates.top().setInShape(true); break; case RTF_SHPINST: - m_aStates.top().eDestination = Destination::SHAPEINSTRUCTION; + m_aStates.top().setDestination(Destination::SHAPEINSTRUCTION); break; case RTF_NESTTABLEPROPS: // do not set any properties of outer table at nested table! @@ -188,7 +188,7 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) m_aNestedTableCellsSprms.clear(); m_aNestedTableCellsAttributes.clear(); m_nNestedCells = 0; - m_aStates.top().eDestination = Destination::NESTEDTABLEPROPERTIES; + m_aStates.top().setDestination(Destination::NESTEDTABLEPROPERTIES); break; case RTF_HEADER: case RTF_FOOTER: @@ -251,7 +251,7 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) if (nId != 0) m_nHeaderFooterPositions.push(std::make_pair(nId, nPos)); - m_aStates.top().eDestination = Destination::SKIP; + m_aStates.top().setDestination(Destination::SKIP); } break; case RTF_FOOTNOTE: @@ -287,7 +287,7 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) } } m_aSuperBuffer.clear(); - m_aStates.top().eDestination = Destination::FOOTNOTE; + m_aStates.top().setDestination(Destination::FOOTNOTE); Mapper().startCharacterGroup(); runProps(); if (!m_aStates.top().getCurrentBuffer()) @@ -311,30 +311,30 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) text(aCustomMark); } Mapper().endCharacterGroup(); - m_aStates.top().eDestination = Destination::SKIP; + m_aStates.top().setDestination(Destination::SKIP); } break; case RTF_BKMKSTART: - m_aStates.top().eDestination = Destination::BOOKMARKSTART; + m_aStates.top().setDestination(Destination::BOOKMARKSTART); break; case RTF_BKMKEND: - m_aStates.top().eDestination = Destination::BOOKMARKEND; + m_aStates.top().setDestination(Destination::BOOKMARKEND); break; case RTF_XE: - m_aStates.top().eDestination = Destination::INDEXENTRY; + m_aStates.top().setDestination(Destination::INDEXENTRY); break; case RTF_TC: case RTF_TCN: - m_aStates.top().eDestination = Destination::TOCENTRY; + m_aStates.top().setDestination(Destination::TOCENTRY); break; case RTF_REVTBL: - m_aStates.top().eDestination = Destination::REVISIONTABLE; + m_aStates.top().setDestination(Destination::REVISIONTABLE); break; case RTF_ANNOTATION: if (!m_pSuperstream) { resolveSubstream(m_nGroupStartPos - 1, NS_ooxml::LN_annotation); - m_aStates.top().eDestination = Destination::SKIP; + m_aStates.top().setDestination(Destination::SKIP); } else { @@ -373,10 +373,10 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) } if (bPictureFrame) // Skip text on picture frames. - m_aStates.top().eDestination = Destination::SKIP; + m_aStates.top().setDestination(Destination::SKIP); else { - m_aStates.top().eDestination = Destination::SHAPETEXT; + m_aStates.top().setDestination(Destination::SHAPETEXT); checkFirstRun(); dispatchFlag(RTF_PARD); m_bNeedPap = true; @@ -396,49 +396,49 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) } break; case RTF_FORMFIELD: - if (m_aStates.top().eDestination == Destination::FIELDINSTRUCTION) - m_aStates.top().eDestination = Destination::FORMFIELD; + if (m_aStates.top().getDestination() == Destination::FIELDINSTRUCTION) + m_aStates.top().setDestination(Destination::FORMFIELD); break; case RTF_FFNAME: - m_aStates.top().eDestination = Destination::FORMFIELDNAME; + m_aStates.top().setDestination(Destination::FORMFIELDNAME); break; case RTF_FFL: - m_aStates.top().eDestination = Destination::FORMFIELDLIST; + m_aStates.top().setDestination(Destination::FORMFIELDLIST); break; case RTF_DATAFIELD: - m_aStates.top().eDestination = Destination::DATAFIELD; + m_aStates.top().setDestination(Destination::DATAFIELD); break; case RTF_INFO: - m_aStates.top().eDestination = Destination::INFO; + m_aStates.top().setDestination(Destination::INFO); break; case RTF_CREATIM: - m_aStates.top().eDestination = Destination::CREATIONTIME; + m_aStates.top().setDestination(Destination::CREATIONTIME); break; case RTF_REVTIM: - m_aStates.top().eDestination = Destination::REVISIONTIME; + m_aStates.top().setDestination(Destination::REVISIONTIME); break; case RTF_PRINTIM: - m_aStates.top().eDestination = Destination::PRINTTIME; + m_aStates.top().setDestination(Destination::PRINTTIME); break; case RTF_AUTHOR: - m_aStates.top().eDestination = Destination::AUTHOR; + m_aStates.top().setDestination(Destination::AUTHOR); break; case RTF_KEYWORDS: - m_aStates.top().eDestination = Destination::KEYWORDS; + m_aStates.top().setDestination(Destination::KEYWORDS); break; case RTF_OPERATOR: - m_aStates.top().eDestination = Destination::OPERATOR; + m_aStates.top().setDestination(Destination::OPERATOR); break; case RTF_COMPANY: - m_aStates.top().eDestination = Destination::COMPANY; + m_aStates.top().setDestination(Destination::COMPANY); break; case RTF_COMMENT: - m_aStates.top().eDestination = Destination::COMMENT; + m_aStates.top().setDestination(Destination::COMMENT); break; case RTF_OBJECT: { // beginning of an OLE Object - m_aStates.top().eDestination = Destination::OBJECT; + m_aStates.top().setDestination(Destination::OBJECT); // check if the object is in a special container (e.g. a table) if (!m_aStates.top().getCurrentBuffer()) @@ -458,133 +458,133 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) // the object is in a table or another container. // Use the \result (RTF_RESULT) element of the object instead, // of the \objdata. - m_aStates.top().eDestination = Destination::SKIP; + m_aStates.top().setDestination(Destination::SKIP); } else { - m_aStates.top().eDestination = Destination::OBJDATA; + m_aStates.top().setDestination(Destination::OBJDATA); } break; case RTF_OBJCLASS: - m_aStates.top().eDestination = Destination::OBJCLASS; + m_aStates.top().setDestination(Destination::OBJCLASS); break; case RTF_RESULT: - m_aStates.top().eDestination = Destination::RESULT; + m_aStates.top().setDestination(Destination::RESULT); break; case RTF_ATNDATE: - m_aStates.top().eDestination = Destination::ANNOTATIONDATE; + m_aStates.top().setDestination(Destination::ANNOTATIONDATE); break; case RTF_ATNAUTHOR: - m_aStates.top().eDestination = Destination::ANNOTATIONAUTHOR; + m_aStates.top().setDestination(Destination::ANNOTATIONAUTHOR); break; case RTF_ATNREF: - m_aStates.top().eDestination = Destination::ANNOTATIONREFERENCE; + m_aStates.top().setDestination(Destination::ANNOTATIONREFERENCE); break; case RTF_FALT: - m_aStates.top().eDestination = Destination::FALT; + m_aStates.top().setDestination(Destination::FALT); break; case RTF_FLYMAINCNT: - m_aStates.top().eDestination = Destination::FLYMAINCONTENT; + m_aStates.top().setDestination(Destination::FLYMAINCONTENT); break; case RTF_LISTTEXT: // Should be ignored by any reader that understands Word 97 through Word 2007 numbering. case RTF_NONESTTABLES: // This destination should be ignored by readers that support nested tables. - m_aStates.top().eDestination = Destination::SKIP; + m_aStates.top().setDestination(Destination::SKIP); break; case RTF_DO: - m_aStates.top().eDestination = Destination::DRAWINGOBJECT; + m_aStates.top().setDestination(Destination::DRAWINGOBJECT); break; case RTF_PN: - m_aStates.top().eDestination = Destination::PARAGRAPHNUMBERING; + m_aStates.top().setDestination(Destination::PARAGRAPHNUMBERING); break; case RTF_PNTEXT: // This destination should be ignored by readers that support paragraph numbering. - m_aStates.top().eDestination = Destination::SKIP; + m_aStates.top().setDestination(Destination::SKIP); break; case RTF_PNTXTA: - m_aStates.top().eDestination = Destination::PARAGRAPHNUMBERING_TEXTAFTER; + m_aStates.top().setDestination(Destination::PARAGRAPHNUMBERING_TEXTAFTER); break; case RTF_PNTXTB: - m_aStates.top().eDestination = Destination::PARAGRAPHNUMBERING_TEXTBEFORE; + m_aStates.top().setDestination(Destination::PARAGRAPHNUMBERING_TEXTBEFORE); break; case RTF_TITLE: - m_aStates.top().eDestination = Destination::TITLE; + m_aStates.top().setDestination(Destination::TITLE); break; case RTF_SUBJECT: - m_aStates.top().eDestination = Destination::SUBJECT; + m_aStates.top().setDestination(Destination::SUBJECT); break; case RTF_DOCCOMM: - m_aStates.top().eDestination = Destination::DOCCOMM; + m_aStates.top().setDestination(Destination::DOCCOMM); break; case RTF_ATRFSTART: - m_aStates.top().eDestination = Destination::ANNOTATIONREFERENCESTART; + m_aStates.top().setDestination(Destination::ANNOTATIONREFERENCESTART); break; case RTF_ATRFEND: - m_aStates.top().eDestination = Destination::ANNOTATIONREFERENCEEND; + m_aStates.top().setDestination(Destination::ANNOTATIONREFERENCEEND); break; case RTF_ATNID: - m_aStates.top().eDestination = Destination::ATNID; + m_aStates.top().setDestination(Destination::ATNID); break; case RTF_MMATH: case RTF_MOMATHPARA: // Nothing to do here (just enter the destination) till RTF_MMATHPR is implemented. break; case RTF_MR: - m_aStates.top().eDestination = Destination::MR; + m_aStates.top().setDestination(Destination::MR); break; case RTF_MCHR: - m_aStates.top().eDestination = Destination::MCHR; + m_aStates.top().setDestination(Destination::MCHR); break; case RTF_MPOS: - m_aStates.top().eDestination = Destination::MPOS; + m_aStates.top().setDestination(Destination::MPOS); break; case RTF_MVERTJC: - m_aStates.top().eDestination = Destination::MVERTJC; + m_aStates.top().setDestination(Destination::MVERTJC); break; case RTF_MSTRIKEH: - m_aStates.top().eDestination = Destination::MSTRIKEH; + m_aStates.top().setDestination(Destination::MSTRIKEH); break; case RTF_MDEGHIDE: - m_aStates.top().eDestination = Destination::MDEGHIDE; + m_aStates.top().setDestination(Destination::MDEGHIDE); break; case RTF_MTYPE: - m_aStates.top().eDestination = Destination::MTYPE; + m_aStates.top().setDestination(Destination::MTYPE); break; case RTF_MGROW: - m_aStates.top().eDestination = Destination::MGROW; + m_aStates.top().setDestination(Destination::MGROW); break; case RTF_MHIDETOP: case RTF_MHIDEBOT: case RTF_MHIDELEFT: case RTF_MHIDERIGHT: // SmOoxmlImport::handleBorderBox will ignore these anyway, so silently ignore for now. - m_aStates.top().eDestination = Destination::SKIP; + m_aStates.top().setDestination(Destination::SKIP); break; case RTF_MSUBHIDE: - m_aStates.top().eDestination = Destination::MSUBHIDE; + m_aStates.top().setDestination(Destination::MSUBHIDE); break; case RTF_MSUPHIDE: - m_aStates.top().eDestination = Destination::MSUPHIDE; + m_aStates.top().setDestination(Destination::MSUPHIDE); break; case RTF_MBEGCHR: - m_aStates.top().eDestination = Destination::MBEGCHR; + m_aStates.top().setDestination(Destination::MBEGCHR); break; case RTF_MSEPCHR: - m_aStates.top().eDestination = Destination::MSEPCHR; + m_aStates.top().setDestination(Destination::MSEPCHR); break; case RTF_MENDCHR: - m_aStates.top().eDestination = Destination::MENDCHR; + m_aStates.top().setDestination(Destination::MENDCHR); break; case RTF_UPR: - m_aStates.top().eDestination = Destination::UPR; + m_aStates.top().setDestination(Destination::UPR); break; case RTF_UD: // Anything inside \ud is just normal Unicode content. - m_aStates.top().eDestination = Destination::NORMAL; + m_aStates.top().setDestination(Destination::NORMAL); break; case RTF_BACKGROUND: - m_aStates.top().eDestination = Destination::BACKGROUND; + m_aStates.top().setDestination(Destination::BACKGROUND); m_aStates.top().setInBackground(true); break; case RTF_SHPGRP: @@ -609,28 +609,28 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) m_pSdrImport->pushParent(xGroupShape); m_aStates.top().setCreatedShapeGroup(true); } - m_aStates.top().eDestination = Destination::SHAPEGROUP; + m_aStates.top().setDestination(Destination::SHAPEGROUP); m_aStates.top().setInShapeGroup(true); } break; case RTF_FTNSEP: - m_aStates.top().eDestination = Destination::FOOTNOTESEPARATOR; + m_aStates.top().setDestination(Destination::FOOTNOTESEPARATOR); m_aStates.top().getCharacterAttributes().set( NS_ooxml::LN_CT_FtnEdn_type, new RTFValue(NS_ooxml::LN_Value_doc_ST_FtnEdn_separator)); break; case RTF_USERPROPS: // Container of all user-defined properties. - m_aStates.top().eDestination = Destination::USERPROPS; + m_aStates.top().setDestination(Destination::USERPROPS); if (m_xDocumentProperties.is()) // Create a custom document properties to be able to process them later all at once. m_xDocumentProperties = document::DocumentProperties::create(m_xContext); break; case RTF_PROPNAME: - m_aStates.top().eDestination = Destination::PROPNAME; + m_aStates.top().setDestination(Destination::PROPNAME); break; case RTF_STATICVAL: - m_aStates.top().eDestination = Destination::STATICVAL; + m_aStates.top().setDestination(Destination::STATICVAL); break; default: { @@ -639,14 +639,14 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) if (RTFTokenizer::lookupMathKeyword(aSymbol)) { m_aMathBuffer.appendOpeningTag(aSymbol.GetToken()); - m_aStates.top().eDestination = aSymbol.GetDestination(); + m_aStates.top().setDestination(aSymbol.GetDestination()); return RTFError::OK; } SAL_INFO("writerfilter", "TODO handle destination '" << keywordToString(nKeyword) << "'"); // Make sure we skip destinations (even without \*) till we don't handle them - m_aStates.top().eDestination = Destination::SKIP; + m_aStates.top().setDestination(Destination::SKIP); aSkip.setParsed(false); } break; diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx index 6f9379b54d30..46592a24105b 100644 --- a/writerfilter/source/rtftok/rtfdispatchflag.cxx +++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx @@ -558,7 +558,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) auto pValue = new RTFValue(aAttributes); for (int i = 0; i < 4; i++) m_aStates.top().getParagraphSprms().set(getParagraphBorder(i), pValue); - m_aStates.top().nBorderState = RTFBorderState::PARAGRAPH_BOX; + m_aStates.top().setBorderState(RTFBorderState::PARAGRAPH_BOX); } break; case RTF_LTRSECT: @@ -598,7 +598,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) break; case RTF_NONSHPPICT: case RTF_MMATHPICT: // Picture group used by readers not understanding \moMath group - m_aStates.top().eDestination = Destination::SKIP; + m_aStates.top().setDestination(Destination::SKIP); break; case RTF_CLBRDRT: case RTF_CLBRDRL: @@ -627,7 +627,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } putNestedSprm(m_aStates.top().getTableCellSprms(), NS_ooxml::LN_CT_TcPrBase_tcBorders, nParam, pValue); - m_aStates.top().nBorderState = RTFBorderState::CELL; + m_aStates.top().setBorderState(RTFBorderState::CELL); } break; case RTF_PGBRDRT: @@ -657,7 +657,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } putNestedSprm(m_aStates.top().getSectionSprms(), NS_ooxml::LN_EG_SectPrContents_pgBorders, nParam, pValue); - m_aStates.top().nBorderState = RTFBorderState::PAGE; + m_aStates.top().setBorderState(RTFBorderState::PAGE); } break; case RTF_BRDRT: @@ -687,7 +687,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } putNestedSprm(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PrBase_pBdr, nParam, pValue); - m_aStates.top().nBorderState = RTFBorderState::PARAGRAPH; + m_aStates.top().setBorderState(RTFBorderState::PARAGRAPH); } break; case RTF_CHBRDR: @@ -695,7 +695,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) RTFSprms aAttributes; auto pValue = new RTFValue(aAttributes); m_aStates.top().getCharacterSprms().set(NS_ooxml::LN_EG_RPrBase_bdr, pValue); - m_aStates.top().nBorderState = RTFBorderState::CHARACTER; + m_aStates.top().setBorderState(RTFBorderState::CHARACTER); } break; case RTF_CLMGF: diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx index 5c8d2c29d401..51e07342d18c 100644 --- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx +++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx @@ -98,7 +98,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) break; case RTF_PAR: { - if (m_aStates.top().eDestination == Destination::FOOTNOTESEPARATOR) + if (m_aStates.top().getDestination() == Destination::FOOTNOTESEPARATOR) break; // just ignore it - only thing we read in here is CHFTNSEP checkFirstRun(); bool bNeedPap = m_bNeedPap; @@ -121,7 +121,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) } m_nCellxMax = 0; } - else if (m_aStates.top().eDestination != Destination::SHAPETEXT) + else if (m_aStates.top().getDestination() != Destination::SHAPETEXT) { RTFValue::Pointer_t pValue; m_aStates.top().getCurrentBuffer()->push_back(Buf_t(BUFFER_PAR, pValue, nullptr)); diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx index bf2a550abe13..57637ce536ea 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -350,13 +350,13 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) assert(m_aStates.top().getRunType() == RTFParserState::RunType::LOCH); nSprm = NS_ooxml::LN_CT_Fonts_ascii; } - if (m_aStates.top().eDestination == Destination::FONTTABLE - || m_aStates.top().eDestination == Destination::FONTENTRY) + if (m_aStates.top().getDestination() == Destination::FONTTABLE + || m_aStates.top().getDestination() == Destination::FONTENTRY) { m_aFontIndexes.push_back(nParam); m_nCurrentFontIndex = getFontIndex(nParam); } - else if (m_aStates.top().eDestination == Destination::LISTLEVEL) + else if (m_aStates.top().getDestination() == Destination::LISTLEVEL) { RTFSprms aFontAttributes; aFontAttributes.set(nSprm, new RTFValue(m_aFontNames[getFontIndex(nParam)])); @@ -433,8 +433,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) { m_aStates.top().setCurrentStyleIndex(nParam); - if (m_aStates.top().eDestination == Destination::STYLESHEET - || m_aStates.top().eDestination == Destination::STYLEENTRY) + if (m_aStates.top().getDestination() == Destination::STYLESHEET + || m_aStates.top().getDestination() == Destination::STYLEENTRY) { m_nCurrentStyleIndex = nParam; auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_StyleType_paragraph); @@ -446,7 +446,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) OUString aName = getStyleName(nParam); if (!aName.isEmpty()) { - if (m_aStates.top().eDestination == Destination::LISTLEVEL) + if (m_aStates.top().getDestination() == Destination::LISTLEVEL) m_aStates.top().getTableSprms().set(NS_ooxml::LN_CT_Lvl_pStyle, new RTFValue(aName)); else @@ -458,8 +458,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; case RTF_CS: m_aStates.top().setCurrentCharacterStyleIndex(nParam); - if (m_aStates.top().eDestination == Destination::STYLESHEET - || m_aStates.top().eDestination == Destination::STYLEENTRY) + if (m_aStates.top().getDestination() == Destination::STYLESHEET + || m_aStates.top().getDestination() == Destination::STYLEENTRY) { m_nCurrentStyleIndex = nParam; auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_StyleType_character); @@ -475,8 +475,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) } break; case RTF_DS: - if (m_aStates.top().eDestination == Destination::STYLESHEET - || m_aStates.top().eDestination == Destination::STYLEENTRY) + if (m_aStates.top().getDestination() == Destination::STYLESHEET + || m_aStates.top().getDestination() == Destination::STYLEENTRY) { m_nCurrentStyleIndex = nParam; auto pValue = new RTFValue(0); // TODO no value in enum StyleType? @@ -485,8 +485,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) } break; case RTF_TS: - if (m_aStates.top().eDestination == Destination::STYLESHEET - || m_aStates.top().eDestination == Destination::STYLEENTRY) + if (m_aStates.top().getDestination() == Destination::STYLESHEET + || m_aStates.top().getDestination() == Destination::STYLEENTRY) { m_nCurrentStyleIndex = nParam; // FIXME the correct value would be NS_ooxml::LN_Value_ST_StyleType_table but maybe table styles mess things up in dmapper, be cautious and disable them for now @@ -646,7 +646,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) { m_aStates.top().getTabAttributes().set(NS_ooxml::LN_CT_TabStop_pos, pIntValue); auto pValue = new RTFValue(m_aStates.top().getTabAttributes()); - if (m_aStates.top().eDestination == Destination::LISTLEVEL) + if (m_aStates.top().getDestination() == Destination::LISTLEVEL) putNestedSprm(m_aStates.top().getTableSprms(), NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_Tabs_tab, pValue); else @@ -664,17 +664,17 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; case RTF_LISTID: { - if (m_aStates.top().eDestination == Destination::LISTENTRY) + if (m_aStates.top().getDestination() == Destination::LISTENTRY) m_aStates.top().getTableAttributes().set(NS_ooxml::LN_CT_AbstractNum_abstractNumId, pIntValue); - else if (m_aStates.top().eDestination == Destination::LISTOVERRIDEENTRY) + else if (m_aStates.top().getDestination() == Destination::LISTOVERRIDEENTRY) m_aStates.top().getTableSprms().set(NS_ooxml::LN_CT_Num_abstractNumId, pIntValue); m_aStates.top().setCurrentListIndex(nParam); } break; case RTF_LS: { - if (m_aStates.top().eDestination == Destination::LISTOVERRIDEENTRY) + if (m_aStates.top().getDestination() == Destination::LISTOVERRIDEENTRY) { m_aStates.top().getTableAttributes().set(NS_ooxml::LN_CT_AbstractNum_nsid, pIntValue); @@ -701,7 +701,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) // static_cast() will do the right thing. if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_UINT16)) { - if (m_aStates.top().eDestination == Destination::LEVELNUMBERS) + if (m_aStates.top().getDestination() == Destination::LEVELNUMBERS) { if (nParam != ';') m_aStates.top().getLevelNumbers().push_back(sal_Int32(nParam)); @@ -848,9 +848,10 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; case RTF_CELLX: { - int& rCurrentCellX((Destination::NESTEDTABLEPROPERTIES == m_aStates.top().eDestination) - ? m_nNestedCurrentCellX - : m_nTopLevelCurrentCellX); + int& rCurrentCellX( + (Destination::NESTEDTABLEPROPERTIES == m_aStates.top().getDestination()) + ? m_nNestedCurrentCellX + : m_nTopLevelCurrentCellX); int nCellX = nParam - rCurrentCellX; const int COL_DFLT_WIDTH = 41; // sw/source/filter/inc/wrtswtbl.hxx, minimal possible width of cells. @@ -872,7 +873,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) auto pXValue = new RTFValue(nCellX); m_aStates.top().getTableRowSprms().set(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue, RTFOverwrite::NO_APPEND); - if (Destination::NESTEDTABLEPROPERTIES == m_aStates.top().eDestination) + if (Destination::NESTEDTABLEPROPERTIES == m_aStates.top().getDestination()) { m_nNestedCells++; // Push cell properties. @@ -935,7 +936,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) new RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa)); putNestedAttribute(m_aStates.top().getTableRowSprms(), NS_ooxml::LN_CT_TblPrBase_tblInd, NS_ooxml::LN_CT_TblWidth_w, new RTFValue(nParam)); - auto const aDestination = m_aStates.top().eDestination; + auto const aDestination = m_aStates.top().getDestination(); int& rCurrentTRLeft((Destination::NESTEDTABLEPROPERTIES == aDestination) ? m_nNestedTRLeft : m_nTopLevelTRLeft); @@ -1507,7 +1508,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; case RTF_FI: { - if (m_aStates.top().eDestination == Destination::LISTLEVEL) + if (m_aStates.top().getDestination() == Destination::LISTLEVEL) { if (m_aStates.top().getLevelNumbersValid()) putNestedAttribute(m_aStates.top().getTableSprms(), NS_ooxml::LN_CT_PPrBase_ind, @@ -1522,7 +1523,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) } case RTF_LI: { - if (m_aStates.top().eDestination == Destination::LISTLEVEL) + if (m_aStates.top().getDestination() == Destination::LISTLEVEL) { if (m_aStates.top().getLevelNumbersValid()) putNestedAttribute(m_aStates.top().getTableSprms(), NS_ooxml::LN_CT_PPrBase_ind, diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index dfb4338c711e..9a49087e5a2f 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -155,7 +155,7 @@ RTFSprms& getLastAttributes(RTFSprms& rSprms, Id nId) void putBorderProperty(RTFStack& aStates, Id nId, const RTFValue::Pointer_t& pValue) { RTFSprms* pAttributes = nullptr; - if (aStates.top().nBorderState == RTFBorderState::PARAGRAPH_BOX) + if (aStates.top().getBorderState() == RTFBorderState::PARAGRAPH_BOX) for (int i = 0; i < 4; i++) { RTFValue::Pointer_t p = aStates.top().getParagraphSprms().find(getParagraphBorder(i)); @@ -165,7 +165,7 @@ void putBorderProperty(RTFStack& aStates, Id nId, const RTFValue::Pointer_t& pVa rAttributes.set(nId, pValue); } } - else if (aStates.top().nBorderState == RTFBorderState::CHARACTER) + else if (aStates.top().getBorderState() == RTFBorderState::CHARACTER) { RTFValue::Pointer_t pPointer = aStates.top().getCharacterSprms().find(NS_ooxml::LN_EG_RPrBase_bdr); @@ -176,13 +176,13 @@ void putBorderProperty(RTFStack& aStates, Id nId, const RTFValue::Pointer_t& pVa } } // Attributes of the last border type - else if (aStates.top().nBorderState == RTFBorderState::PARAGRAPH) + else if (aStates.top().getBorderState() == RTFBorderState::PARAGRAPH) pAttributes = &getLastAttributes(aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PrBase_pBdr); - else if (aStates.top().nBorderState == RTFBorderState::CELL) + else if (aStates.top().getBorderState() == RTFBorderState::CELL) pAttributes = &getLastAttributes(aStates.top().getTableCellSprms(), NS_ooxml::LN_CT_TcPrBase_tcBorders); - else if (aStates.top().nBorderState == RTFBorderState::PAGE) + else if (aStates.top().getBorderState() == RTFBorderState::PAGE) pAttributes = &getLastAttributes(aStates.top().getSectionSprms(), NS_ooxml::LN_EG_SectPrContents_pgBorders); if (pAttributes) @@ -802,7 +802,7 @@ bool RTFDocumentImpl::isStyleSheetImport() { if (m_aStates.empty()) return false; - Destination eDestination = m_aStates.top().eDestination; + Destination eDestination = m_aStates.top().getDestination(); return eDestination == Destination::STYLESHEET || eDestination == Destination::STYLEENTRY; } @@ -1243,14 +1243,15 @@ RTFError RTFDocumentImpl::resolveChars(char ch) Strm().SeekRel(-1); if (m_aStates.top().nInternalState == RTFInternalState::HEX - && m_aStates.top().eDestination != Destination::LEVELNUMBERS) + && m_aStates.top().getDestination() != Destination::LEVELNUMBERS) { if (!bSkipped) { // note: apparently \'0d\'0a is interpreted as 2 breaks, not 1 - if ((ch == '\r' || ch == '\n') && m_aStates.top().eDestination != Destination::DOCCOMM - && m_aStates.top().eDestination != Destination::LEVELNUMBERS - && m_aStates.top().eDestination != Destination::LEVELTEXT) + if ((ch == '\r' || ch == '\n') + && m_aStates.top().getDestination() != Destination::DOCCOMM + && m_aStates.top().getDestination() != Destination::LEVELNUMBERS + && m_aStates.top().getDestination() != Destination::LEVELTEXT) { checkUnicode(/*bUnicode =*/false, /*bHex =*/true); dispatchSymbol(RTF_PAR); @@ -1263,10 +1264,10 @@ RTFError RTFDocumentImpl::resolveChars(char ch) return RTFError::OK; } - if (m_aStates.top().eDestination == Destination::SKIP) + if (m_aStates.top().getDestination() == Destination::SKIP) return RTFError::OK; OString aStr = aBuf.makeStringAndClear(); - if (m_aStates.top().eDestination == Destination::LEVELNUMBERS) + if (m_aStates.top().getDestination() == Destination::LEVELNUMBERS) { if (aStr.toChar() != ';') m_aStates.top().getLevelNumbers().push_back(sal_Int32(ch)); @@ -1276,7 +1277,7 @@ RTFError RTFDocumentImpl::resolveChars(char ch) OUString aOUStr(OStringToOUString(aStr, m_aStates.top().getCurrentEncoding())); SAL_INFO("writerfilter.rtf", "RTFDocumentImpl::resolveChars: collected '" << aOUStr << "'"); - if (m_aStates.top().eDestination == Destination::COLORTABLE) + if (m_aStates.top().getDestination() == Destination::COLORTABLE) { // we hit a ';' at the end of each color entry m_aColorTable.push_back(m_aStates.top().getCurrentColor().GetColor()); @@ -1317,7 +1318,7 @@ void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps) void RTFDocumentImpl::text(OUString& rString) { - if (rString.getLength() == 1 && m_aStates.top().eDestination != Destination::DOCCOMM) + if (rString.getLength() == 1 && m_aStates.top().getDestination() != Destination::DOCCOMM) { // No cheating! Tokenizer ignores bare \r and \n, their hex \'0d / \'0a form doesn't count, either. sal_Unicode ch = rString[0]; @@ -1326,7 +1327,7 @@ void RTFDocumentImpl::text(OUString& rString) } bool bRet = true; - switch (m_aStates.top().eDestination) + switch (m_aStates.top().getDestination()) { // Note: in fonttbl there may or may not be groups; in stylesheet // and revtbl groups are mandatory @@ -1349,7 +1350,7 @@ void RTFDocumentImpl::text(OUString& rString) // always clear, necessary in case of group-less fonttable OUString const aName = m_aStates.top().getCurrentDestinationText()->makeStringAndClear(); - switch (m_aStates.top().eDestination) + switch (m_aStates.top().getDestination()) { case Destination::FONTTABLE: case Destination::FONTENTRY: @@ -1489,7 +1490,7 @@ void RTFDocumentImpl::text(OUString& rString) checkNeedPap(); // Don't return earlier, a bookmark start has to be in a paragraph group. - if (m_aStates.top().eDestination == Destination::BOOKMARKSTART) + if (m_aStates.top().getDestination() == Destination::BOOKMARKSTART) { m_aStates.top().appendDestinationText(rString); return; @@ -1497,7 +1498,7 @@ void RTFDocumentImpl::text(OUString& rString) RTFBuffer_t* pCurrentBuffer = m_aStates.top().getCurrentBuffer(); - if (!pCurrentBuffer && m_aStates.top().eDestination != Destination::FOOTNOTE) + if (!pCurrentBuffer && m_aStates.top().getDestination() != Destination::FOOTNOTE) Mapper().startCharacterGroup(); else if (pCurrentBuffer) { @@ -1505,9 +1506,9 @@ void RTFDocumentImpl::text(OUString& rString) pCurrentBuffer->push_back(Buf_t(BUFFER_STARTRUN, pValue, nullptr)); } - if (m_aStates.top().eDestination == Destination::NORMAL - || m_aStates.top().eDestination == Destination::FIELDRESULT - || m_aStates.top().eDestination == Destination::SHAPETEXT) + if (m_aStates.top().getDestination() == Destination::NORMAL + || m_aStates.top().getDestination() == Destination::FIELDRESULT + || m_aStates.top().getDestination() == Destination::SHAPETEXT) runProps(); if (!pCurrentBuffer) @@ -1520,7 +1521,7 @@ void RTFDocumentImpl::text(OUString& rString) m_bNeedCr = true; - if (!pCurrentBuffer && m_aStates.top().eDestination != Destination::FOOTNOTE) + if (!pCurrentBuffer && m_aStates.top().getDestination() != Destination::FOOTNOTE) Mapper().endCharacterGroup(); else if (pCurrentBuffer) { @@ -1736,7 +1737,7 @@ void RTFDocumentImpl::resetTableRowProperties() m_aStates.top().getTableRowSprms().set(NS_ooxml::LN_CT_TblGridBase_gridCol, new RTFValue(-1), RTFOverwrite::NO_APPEND); m_aStates.top().getTableRowAttributes() = m_aDefaultState.getTableRowAttributes(); - if (Destination::NESTEDTABLEPROPERTIES == m_aStates.top().eDestination) + if (Destination::NESTEDTABLEPROPERTIES == m_aStates.top().getDestination()) { m_nNestedTRLeft = 0; m_nNestedCurrentCellX = 0; @@ -1950,7 +1951,7 @@ RTFError RTFDocumentImpl::pushState() // fdo#85812 group resets run type of _current_ and new state (but not RTL) m_aStates.top().setRunType(RTFParserState::RunType::LOCH); - if (m_aStates.top().eDestination == Destination::MR) + if (m_aStates.top().getDestination() == Destination::MR) lcl_DestinationToMath(m_aStates.top().getCurrentDestinationText(), m_aMathBuffer, m_bMathNor); m_aStates.push(m_aStates.top()); @@ -1959,17 +1960,17 @@ RTFError RTFDocumentImpl::pushState() m_pTokenizer->pushGroup(); - switch (m_aStates.top().eDestination) + switch (m_aStates.top().getDestination()) { case Destination::FONTTABLE: // this is a "faked" destination for the font entry m_aStates.top().setCurrentDestinationText(&m_aStates.top().getDestinationText()); - m_aStates.top().eDestination = Destination::FONTENTRY; + m_aStates.top().setDestination(Destination::FONTENTRY); break; case Destination::STYLESHEET: // this is a "faked" destination for the style sheet entry m_aStates.top().setCurrentDestinationText(&m_aStates.top().getDestinationText()); - m_aStates.top().eDestination = Destination::STYLEENTRY; + m_aStates.top().setDestination(Destination::STYLEENTRY); { // the *default* is \s0 i.e. paragraph style default // this will be overwritten by \sN \csN \dsN \tsN @@ -1983,7 +1984,7 @@ RTFError RTFDocumentImpl::pushState() case Destination::FORMFIELD: case Destination::FIELDINSTRUCTION: case Destination::PICT: - m_aStates.top().eDestination = Destination::NORMAL; + m_aStates.top().setDestination(Destination::NORMAL); break; case Destination::MNUM: case Destination::MDEN: @@ -1994,12 +1995,12 @@ RTFError RTFDocumentImpl::pushState() case Destination::MSUP: case Destination::MDEG: case Destination::MOMATH: - m_aStates.top().eDestination = Destination::MR; + m_aStates.top().setDestination(Destination::MR); break; case Destination::REVISIONTABLE: // this is a "faked" destination for the revision table entry m_aStates.top().setCurrentDestinationText(&m_aStates.top().getDestinationText()); - m_aStates.top().eDestination = Destination::REVISIONENTRY; + m_aStates.top().setDestination(Destination::REVISIONENTRY); break; default: break; @@ -2151,7 +2152,7 @@ RTFError RTFDocumentImpl::popState() } } - switch (aState.eDestination) + switch (aState.getDestination()) { case Destination::FONTTABLE: { @@ -2283,7 +2284,7 @@ RTFError RTFDocumentImpl::popState() if (m_aStates.size() > 1) // Current destination is levelnumbers and parent destination is levelnumbers as well. bNestedLevelNumbers - = m_aStates[m_aStates.size() - 2].eDestination == Destination::LEVELNUMBERS; + = m_aStates[m_aStates.size() - 2].getDestination() == Destination::LEVELNUMBERS; if (!bNestedLevelNumbers && aState.getTableSprms().find(NS_ooxml::LN_CT_Lvl_lvlText)) { RTFSprms& rAttributes @@ -2346,7 +2347,8 @@ RTFError RTFDocumentImpl::popState() case Destination::PICPROP: case Destination::SHAPEINSTRUCTION: if (m_aStates.size() > 1 - && m_aStates[m_aStates.size() - 2].eDestination == Destination::SHAPEINSTRUCTION) + && m_aStates[m_aStates.size() - 2].getDestination() + == Destination::SHAPEINSTRUCTION) { // Do not resolve shape if shape instruction destination is inside other shape instruction } @@ -2355,8 +2357,9 @@ RTFError RTFDocumentImpl::popState() { // Don't trigger a shape import in case we're only leaving the \shpinst of the groupshape itself. RTFSdrImport::ShapeOrPict eType - = (aState.eDestination == Destination::SHAPEINSTRUCTION) ? RTFSdrImport::SHAPE - : RTFSdrImport::PICT; + = (aState.getDestination() == Destination::SHAPEINSTRUCTION) + ? RTFSdrImport::SHAPE + : RTFSdrImport::PICT; if (!m_aStates.top().getCurrentBuffer() || eType != RTFSdrImport::SHAPE) m_pSdrImport->resolve(m_aStates.top().getShape(), true, eType); else @@ -2430,7 +2433,7 @@ RTFError RTFDocumentImpl::popState() break; // not for nested group OUString str(m_aStates.top().getCurrentDestinationText()->makeStringAndClear()); // dmapper expects this as a field, so let's fake something... - OUString const field((Destination::INDEXENTRY == aState.eDestination) + OUString const field((Destination::INDEXENTRY == aState.getDestination()) ? OUStringLiteral("XE") : OUStringLiteral("TC")); str = field + " \"" + str.replaceAll("\"", "\\\"") + "\""; @@ -2595,8 +2598,8 @@ RTFError RTFDocumentImpl::popState() if (&m_aStates.top().getDestinationText() != m_aStates.top().getCurrentDestinationText()) break; // not for nested group - OUString aName = aState.eDestination == Destination::OPERATOR ? OUString("Operator") - : OUString("Company"); + OUString aName = aState.getDestination() == Destination::OPERATOR ? OUString("Operator") + : OUString("Company"); uno::Any aValue = uno::makeAny(m_aStates.top().getCurrentDestinationText()->makeStringAndClear()); if (m_xDocumentProperties.is()) @@ -2707,7 +2710,7 @@ RTFError RTFDocumentImpl::popState() OUString aStr = m_aStates.top().getCurrentDestinationText()->makeStringAndClear(); auto pValue = new RTFValue(aStr.toInt32()); RTFSprms aAttributes; - if (aState.eDestination == Destination::ANNOTATIONREFERENCESTART) + if (aState.getDestination() == Destination::ANNOTATIONREFERENCESTART) aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeStart, pValue); else aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeEnd, pValue); @@ -2878,7 +2881,7 @@ RTFError RTFDocumentImpl::popState() case Destination::MGROW: { sal_Int32 nMathToken = 0; - switch (aState.eDestination) + switch (aState.getDestination()) { case Destination::MCHR: nMathToken = M_TOKEN(chr); @@ -3172,7 +3175,7 @@ RTFError RTFDocumentImpl::popState() m_pTokenizer->popGroup(); // list table - switch (aState.eDestination) + switch (aState.getDestination()) { case Destination::LISTENTRY: { @@ -3295,7 +3298,7 @@ RTFError RTFDocumentImpl::popState() aState.getTableAttributes().set(NS_ooxml::LN_CT_Lvl_ilvl, pInnerValue); auto pValue = new RTFValue(aState.getTableAttributes(), aState.getTableSprms()); - if (m_aStates.top().eDestination != Destination::LFOLEVEL) + if (m_aStates.top().getDestination() != Destination::LFOLEVEL) m_aStates.top().getListLevelEntries().set(NS_ooxml::LN_CT_AbstractNum_lvl, pValue, RTFOverwrite::NO_APPEND); else @@ -3317,7 +3320,7 @@ RTFError RTFDocumentImpl::popState() case Destination::LISTOVERRIDEENTRY: if (!m_aStates.empty()) { - if (m_aStates.top().eDestination == Destination::LISTOVERRIDEENTRY) + if (m_aStates.top().getDestination() == Destination::LISTOVERRIDEENTRY) { // copy properties upwards so upper popState() inserts it m_aStates.top().getTableAttributes() = aState.getTableAttributes(); @@ -3344,8 +3347,8 @@ RTFError RTFDocumentImpl::popState() if (!m_aStates.empty()) { m_aStates.top().getTableSprms() = aState.getTableSprms(); - if (m_aStates.top().eDestination == Destination::LEVELNUMBERS - || m_aStates.top().eDestination == Destination::LISTLEVEL) + if (m_aStates.top().getDestination() == Destination::LEVELNUMBERS + || m_aStates.top().getDestination() == Destination::LISTLEVEL) // Parent state is level number or list level, current state is // level numbers: mark parent as invalid as well if necessary. m_aStates.top().setLevelNumbersValid(aState.getLevelNumbersValid()); @@ -3353,14 +3356,14 @@ RTFError RTFDocumentImpl::popState() break; case Destination::FIELDINSTRUCTION: if (!m_aStates.empty()) - m_aStates.top().eFieldStatus = RTFFieldStatus::INSTRUCTION; + m_aStates.top().setFieldStatus(RTFFieldStatus::INSTRUCTION); break; case Destination::FIELDRESULT: if (!m_aStates.empty()) - m_aStates.top().eFieldStatus = RTFFieldStatus::RESULT; + m_aStates.top().setFieldStatus(RTFFieldStatus::RESULT); break; case Destination::FIELD: - if (aState.eFieldStatus == RTFFieldStatus::INSTRUCTION) + if (aState.getFieldStatus() == RTFFieldStatus::INSTRUCTION) singleChar(cFieldEnd); break; case Destination::SHAPEPROPERTYVALUEPICT: @@ -3386,7 +3389,8 @@ RTFError RTFDocumentImpl::popState() } break; case Destination::SHAPEINSTRUCTION: - if (!m_aStates.empty() && m_aStates.top().eDestination == Destination::SHAPEINSTRUCTION) + if (!m_aStates.empty() + && m_aStates.top().getDestination() == Destination::SHAPEINSTRUCTION) { // Shape instruction inside other shape instruction: just copy new shape settings: // it will be resolved on end of topmost shape instruction destination @@ -3402,8 +3406,8 @@ RTFError RTFDocumentImpl::popState() if (!m_aStates.empty()) { m_aStates.top().getFrame() = aState.getFrame(); - if (aState.eDestination == Destination::SHPPICT - && m_aStates.top().eDestination == Destination::LISTPICTURE) + if (aState.getDestination() == Destination::SHPPICT + && m_aStates.top().getDestination() == Destination::LISTPICTURE) { RTFSprms aAttributes; aAttributes.set(NS_ooxml::LN_CT_NumPicBullet_numPicBulletId, @@ -3421,7 +3425,7 @@ RTFError RTFDocumentImpl::popState() if (!m_aStates.empty()) { // If we're leaving the shapetext group (it may have nested ones) and this is a shape, not an old drawingobject. - if (m_aStates.top().eDestination != Destination::SHAPETEXT + if (m_aStates.top().getDestination() != Destination::SHAPETEXT && !m_aStates.top().getDrawingObject().getHadShapeText()) { m_aStates.top().setHadShapeText(true); @@ -3447,12 +3451,12 @@ RTFError RTFDocumentImpl::popState() } break; case Destination::PROPNAME: - if (m_aStates.top().eDestination == Destination::USERPROPS) + if (m_aStates.top().getDestination() == Destination::USERPROPS) m_aStates.top().setPropName(aState.getPropName()); break; default: { - if (!m_aStates.empty() && m_aStates.top().eDestination == Destination::PICT) + if (!m_aStates.empty() && m_aStates.top().getDestination() == Destination::PICT) m_aStates.top().getPicture() = aState.getPicture(); } break; @@ -3511,11 +3515,11 @@ void RTFDocumentImpl::setInternalState(RTFInternalState nInternalState) m_aStates.top().nInternalState = nInternalState; } -Destination RTFDocumentImpl::getDestination() { return m_aStates.top().eDestination; } +Destination RTFDocumentImpl::getDestination() { return m_aStates.top().getDestination(); } void RTFDocumentImpl::setDestination(Destination eDestination) { - m_aStates.top().eDestination = eDestination; + m_aStates.top().setDestination(eDestination); } // this is a questionably named method that is used only in a very special @@ -3540,7 +3544,7 @@ void RTFDocumentImpl::checkUnicode(bool bUnicode, bool bHex) if (bHex && !m_aHexBuffer.isEmpty()) { rtl_TextEncoding nEncoding = m_aStates.top().getCurrentEncoding(); - if (m_aStates.top().eDestination == Destination::FONTENTRY + if (m_aStates.top().getDestination() == Destination::FONTENTRY && m_aStates.top().getCurrentEncoding() == RTL_TEXTENCODING_SYMBOL) nEncoding = RTL_TEXTENCODING_MS_1252; OUString aString = OStringToOUString(m_aHexBuffer.makeStringAndClear(), nEncoding); @@ -3551,9 +3555,9 @@ void RTFDocumentImpl::checkUnicode(bool bUnicode, bool bHex) RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl) : m_pDocumentImpl(pDocumentImpl) , nInternalState(RTFInternalState::NORMAL) - , eDestination(Destination::NORMAL) - , eFieldStatus(RTFFieldStatus::NONE) - , nBorderState(RTFBorderState::NONE) + , m_eDestination(Destination::NORMAL) + , m_eFieldStatus(RTFFieldStatus::NONE) + , m_nBorderState(RTFBorderState::NONE) , m_nCurrentEncoding(rtl_getTextEncodingFromWindowsCharset(0)) , m_nUc(1) , m_nCharsToSkip(0) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 7e404a765d79..bcbbbdf34227 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -515,14 +515,20 @@ public: RTFSprms& getCharacterSprms() { return m_aCharacterSprms; } RTFSprms& getTableAttributes() { return m_aTableAttributes; } RTFSprms& getTableSprms() { return m_aTableSprms; } + void setBorderState(RTFBorderState nBorderState) { m_nBorderState = nBorderState; } + RTFBorderState getBorderState() const { return m_nBorderState; } + void setFieldStatus(RTFFieldStatus eFieldStatus) { m_eFieldStatus = eFieldStatus; } + RTFFieldStatus getFieldStatus() const { return m_eFieldStatus; } + void setDestination(Destination eDestination) { m_eDestination = eDestination; } + Destination getDestination() const { return m_eDestination; } RTFDocumentImpl* m_pDocumentImpl; RTFInternalState nInternalState; - Destination eDestination; - RTFFieldStatus eFieldStatus; - RTFBorderState nBorderState; private: + Destination m_eDestination; + RTFFieldStatus m_eFieldStatus; + RTFBorderState m_nBorderState; // font table, stylesheet table RTFSprms m_aTableSprms; RTFSprms m_aTableAttributes; |