diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-05-17 21:39:30 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-05-20 10:06:06 +0200 |
commit | aebe2abe77ab748c5325df82e407663141ce2bf8 (patch) | |
tree | 78f8b23f8640074cf5f3946a2c3f63af7ef6942b | |
parent | 3370752deb902df86cf625c4bc8e63728b5eb27d (diff) |
writerfilter: make RTFParserState members private, part 2
Change-Id: I9d712b227ea39bd63c34e77572f7e3d5ff83aa7e
Reviewed-on: https://gerrit.libreoffice.org/72555
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchdestination.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchflag.cxx | 6 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchvalue.cxx | 8 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 155 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.hxx | 36 |
5 files changed, 120 insertions, 87 deletions
diff --git a/writerfilter/source/rtftok/rtfdispatchdestination.cxx b/writerfilter/source/rtftok/rtfdispatchdestination.cxx index 7b1f84fbe6ae..881096130517 100644 --- a/writerfilter/source/rtftok/rtfdispatchdestination.cxx +++ b/writerfilter/source/rtftok/rtfdispatchdestination.cxx @@ -653,7 +653,7 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) } // new destination => use new destination text - m_aStates.top().pDestinationText = &m_aStates.top().aDestinationText; + m_aStates.top().setCurrentDestinationText(&m_aStates.top().aDestinationText); return RTFError::OK; } diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx index 34e8401bc368..5bc0c75d4171 100644 --- a/writerfilter/source/rtftok/rtfdispatchflag.cxx +++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx @@ -470,7 +470,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) m_aStates.top().aCharacterSprms = getDefaultState().aCharacterSprms; m_aStates.top().nCurrentEncoding = getEncoding(getFontIndex(m_nDefaultFontIndex)); m_aStates.top().aCharacterAttributes = getDefaultState().aCharacterAttributes; - m_aStates.top().nCurrentCharacterStyleIndex = -1; + m_aStates.top().setCurrentCharacterStyleIndex(-1); m_aStates.top().isRightToLeft = false; m_aStates.top().eRunType = RTFParserState::RunType::LOCH; } @@ -514,11 +514,11 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) { m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_pStyle, new RTFValue(aName)); - m_aStates.top().nCurrentStyleIndex = 0; + m_aStates.top().setCurrentStyleIndex(0); } else { - m_aStates.top().nCurrentStyleIndex = -1; + m_aStates.top().setCurrentStyleIndex(-1); } } // Need to send paragraph properties again, if there will be any. diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx index 7f662812cc43..06097845d5dc 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -431,7 +431,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; case RTF_S: { - m_aStates.top().nCurrentStyleIndex = nParam; + m_aStates.top().setCurrentStyleIndex(nParam); if (m_aStates.top().eDestination == Destination::STYLESHEET || m_aStates.top().eDestination == Destination::STYLEENTRY) @@ -457,7 +457,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) } break; case RTF_CS: - m_aStates.top().nCurrentCharacterStyleIndex = nParam; + m_aStates.top().setCurrentCharacterStyleIndex(nParam); if (m_aStates.top().eDestination == Destination::STYLESHEET || m_aStates.top().eDestination == Destination::STYLEENTRY) { @@ -667,7 +667,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) pIntValue); else if (m_aStates.top().eDestination == Destination::LISTOVERRIDEENTRY) m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Num_abstractNumId, pIntValue); - m_aStates.top().nCurrentListIndex = nParam; + m_aStates.top().setCurrentListIndex(nParam); } break; case RTF_LS: @@ -675,7 +675,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) if (m_aStates.top().eDestination == Destination::LISTOVERRIDEENTRY) { m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, pIntValue); - m_aStates.top().nCurrentListOverrideIndex = nParam; + m_aStates.top().setCurrentListOverrideIndex(nParam); } else { diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 764bbf28e960..0d4d4a290041 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -489,7 +489,7 @@ RTFDocumentImpl::getProperties(const RTFSprms& rAttributes, RTFSprms const& rSpr int nStyle = 0; if (!m_aStates.empty()) - nStyle = m_aStates.top().nCurrentStyleIndex; + nStyle = m_aStates.top().getCurrentStyleIndex(); auto it = m_aStyleTableEntries.find(nStyle); if (it != m_aStyleTableEntries.end()) { @@ -498,7 +498,7 @@ RTFDocumentImpl::getProperties(const RTFSprms& rAttributes, RTFSprms const& rSpr auto itChar = m_aStyleTableEntries.end(); if (!m_aStates.empty()) { - int nCharStyle = m_aStates.top().nCurrentCharacterStyleIndex; + int nCharStyle = m_aStates.top().getCurrentCharacterStyleIndex(); itChar = m_aStyleTableEntries.find(nCharStyle); } @@ -1334,7 +1334,8 @@ void RTFDocumentImpl::text(OUString& rString) if (bEnd) { // always clear, necessary in case of group-less fonttable - OUString const aName = m_aStates.top().pDestinationText->makeStringAndClear(); + OUString const aName + = m_aStates.top().getCurrentDestinationText()->makeStringAndClear(); switch (m_aStates.top().eDestination) { case Destination::FONTTABLE: @@ -1681,7 +1682,7 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer, RTFSprms* const pSprms, else if (std::get<0>(aTuple) == BUFFER_SETSTYLE) { if (!m_aStates.empty()) - m_aStates.top().nCurrentStyleIndex = std::get<1>(aTuple)->getInt(); + m_aStates.top().setCurrentStyleIndex(std::get<1>(aTuple)->getInt()); } else assert(false); @@ -1935,7 +1936,8 @@ RTFError RTFDocumentImpl::pushState() m_aStates.top().eRunType = RTFParserState::RunType::LOCH; if (m_aStates.top().eDestination == Destination::MR) - lcl_DestinationToMath(m_aStates.top().pDestinationText, m_aMathBuffer, m_bMathNor); + lcl_DestinationToMath(m_aStates.top().getCurrentDestinationText(), m_aMathBuffer, + m_bMathNor); m_aStates.push(m_aStates.top()); } m_aStates.top().aDestinationText.setLength(0); // was copied: always reset! @@ -1946,12 +1948,12 @@ RTFError RTFDocumentImpl::pushState() { case Destination::FONTTABLE: // this is a "faked" destination for the font entry - m_aStates.top().pDestinationText = &m_aStates.top().aDestinationText; + m_aStates.top().setCurrentDestinationText(&m_aStates.top().aDestinationText); m_aStates.top().eDestination = Destination::FONTENTRY; break; case Destination::STYLESHEET: // this is a "faked" destination for the style sheet entry - m_aStates.top().pDestinationText = &m_aStates.top().aDestinationText; + m_aStates.top().setCurrentDestinationText(&m_aStates.top().aDestinationText); m_aStates.top().eDestination = Destination::STYLEENTRY; { // the *default* is \s0 i.e. paragraph style default @@ -1981,7 +1983,7 @@ RTFError RTFDocumentImpl::pushState() break; case Destination::REVISIONTABLE: // this is a "faked" destination for the revision table entry - m_aStates.top().pDestinationText = &m_aStates.top().aDestinationText; + m_aStates.top().setCurrentDestinationText(&m_aStates.top().aDestinationText); m_aStates.top().eDestination = Destination::REVISIONENTRY; break; default: @@ -2242,9 +2244,9 @@ RTFError RTFDocumentImpl::popState() break; case Destination::LEVELTEXT: { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group - OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); + OUString aStr = m_aStates.top().getCurrentDestinationText()->makeStringAndClear(); // The first character is the length of the string (the rest should be ignored). sal_Int32 nLength(aStr.toChar()); @@ -2299,16 +2301,16 @@ RTFError RTFDocumentImpl::popState() break; } case Destination::SHAPEPROPERTYNAME: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group aState.aShape.getProperties().emplace_back( - m_aStates.top().pDestinationText->makeStringAndClear(), OUString()); + m_aStates.top().getCurrentDestinationText()->makeStringAndClear(), OUString()); break; case Destination::SHAPEPROPERTYVALUE: if (!aState.aShape.getProperties().empty()) { aState.aShape.getProperties().back().second - = m_aStates.top().pDestinationText->makeStringAndClear(); + = m_aStates.top().getCurrentDestinationText()->makeStringAndClear(); if (m_aStates.top().getHadShapeText()) m_pSdrImport->append(aState.aShape.getProperties().back().first, aState.aShape.getProperties().back().second); @@ -2373,9 +2375,9 @@ RTFError RTFDocumentImpl::popState() break; case Destination::BOOKMARKSTART: { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group - OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); + OUString aStr = m_aStates.top().getCurrentDestinationText()->makeStringAndClear(); int nPos = m_aBookmarks.size(); m_aBookmarks[aStr] = nPos; if (!m_aStates.top().getCurrentBuffer()) @@ -2387,9 +2389,9 @@ RTFError RTFDocumentImpl::popState() break; case Destination::BOOKMARKEND: { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group - OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); + OUString aStr = m_aStates.top().getCurrentDestinationText()->makeStringAndClear(); if (!m_aStates.top().getCurrentBuffer()) Mapper().props(new RTFReferenceProperties( lcl_getBookmarkProperties(m_aBookmarks[aStr], aStr))); @@ -2402,9 +2404,9 @@ RTFError RTFDocumentImpl::popState() case Destination::INDEXENTRY: case Destination::TOCENTRY: { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group - OUString str(m_aStates.top().pDestinationText->makeStringAndClear()); + 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) ? OUStringLiteral("XE") @@ -2419,17 +2421,19 @@ RTFError RTFDocumentImpl::popState() break; case Destination::FORMFIELDNAME: { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group - auto pValue = new RTFValue(m_aStates.top().pDestinationText->makeStringAndClear()); + auto pValue + = new RTFValue(m_aStates.top().getCurrentDestinationText()->makeStringAndClear()); m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pValue); } break; case Destination::FORMFIELDLIST: { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group - auto pValue = new RTFValue(m_aStates.top().pDestinationText->makeStringAndClear()); + auto pValue + = new RTFValue(m_aStates.top().getCurrentDestinationText()->makeStringAndClear()); m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_listEntry, pValue); } break; @@ -2437,11 +2441,12 @@ RTFError RTFDocumentImpl::popState() { if (m_bFormField) { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText + != m_aStates.top().getCurrentDestinationText()) break; // not for nested group - OString aStr - = OUStringToOString(m_aStates.top().pDestinationText->makeStringAndClear(), - aState.nCurrentEncoding); + OString aStr = OUStringToOString( + m_aStates.top().getCurrentDestinationText()->makeStringAndClear(), + aState.nCurrentEncoding); // decode hex dump OStringBuffer aBuf; int b = 0, count = 2; @@ -2510,57 +2515,59 @@ RTFError RTFDocumentImpl::popState() m_xDocumentProperties->setPrintDate(lcl_getDateTime(aState)); break; case Destination::AUTHOR: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group if (m_xDocumentProperties.is()) m_xDocumentProperties->setAuthor( - m_aStates.top().pDestinationText->makeStringAndClear()); + m_aStates.top().getCurrentDestinationText()->makeStringAndClear()); break; case Destination::KEYWORDS: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group if (m_xDocumentProperties.is()) m_xDocumentProperties->setKeywords(comphelper::string::convertCommaSeparated( - m_aStates.top().pDestinationText->makeStringAndClear())); + m_aStates.top().getCurrentDestinationText()->makeStringAndClear())); break; case Destination::COMMENT: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group if (m_xDocumentProperties.is()) m_xDocumentProperties->setGenerator( - m_aStates.top().pDestinationText->makeStringAndClear()); + m_aStates.top().getCurrentDestinationText()->makeStringAndClear()); break; case Destination::SUBJECT: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group if (m_xDocumentProperties.is()) m_xDocumentProperties->setSubject( - m_aStates.top().pDestinationText->makeStringAndClear()); + m_aStates.top().getCurrentDestinationText()->makeStringAndClear()); break; case Destination::TITLE: { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group if (m_xDocumentProperties.is()) - m_xDocumentProperties->setTitle(aState.pDestinationText->makeStringAndClear()); + m_xDocumentProperties->setTitle( + aState.getCurrentDestinationText()->makeStringAndClear()); } break; case Destination::DOCCOMM: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group if (m_xDocumentProperties.is()) m_xDocumentProperties->setDescription( - m_aStates.top().pDestinationText->makeStringAndClear()); + m_aStates.top().getCurrentDestinationText()->makeStringAndClear()); break; case Destination::OPERATOR: case Destination::COMPANY: { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group OUString aName = aState.eDestination == Destination::OPERATOR ? OUString("Operator") : OUString("Company"); - uno::Any aValue = uno::makeAny(m_aStates.top().pDestinationText->makeStringAndClear()); + uno::Any aValue + = uno::makeAny(m_aStates.top().getCurrentDestinationText()->makeStringAndClear()); if (m_xDocumentProperties.is()) { uno::Reference<beans::XPropertyContainer> xUserDefinedProperties @@ -2579,7 +2586,7 @@ RTFError RTFDocumentImpl::popState() break; case Destination::OBJDATA: { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group RTFError eError = handleEmbeddedObject(); @@ -2589,7 +2596,8 @@ RTFError RTFDocumentImpl::popState() break; case Destination::OBJCLASS: { - auto pValue = new RTFValue(m_aStates.top().pDestinationText->makeStringAndClear()); + auto pValue + = new RTFValue(m_aStates.top().getCurrentDestinationText()->makeStringAndClear()); m_aOLEAttributes.set(NS_ooxml::LN_CT_OLEObject_ProgID, pValue); break; } @@ -2631,10 +2639,11 @@ RTFError RTFDocumentImpl::popState() break; case Destination::ANNOTATIONDATE: { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group OUString aStr(OStringToOUString( - DTTM22OString(m_aStates.top().pDestinationText->makeStringAndClear().toInt32()), + DTTM22OString( + m_aStates.top().getCurrentDestinationText()->makeStringAndClear().toInt32()), aState.nCurrentEncoding)); auto pValue = new RTFValue(aStr); RTFSprms aAnnAttributes; @@ -2645,21 +2654,21 @@ RTFError RTFDocumentImpl::popState() } break; case Destination::ANNOTATIONAUTHOR: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group - m_aAuthor = m_aStates.top().pDestinationText->makeStringAndClear(); + m_aAuthor = m_aStates.top().getCurrentDestinationText()->makeStringAndClear(); break; case Destination::ATNID: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group - m_aAuthorInitials = m_aStates.top().pDestinationText->makeStringAndClear(); + m_aAuthorInitials = m_aStates.top().getCurrentDestinationText()->makeStringAndClear(); break; case Destination::ANNOTATIONREFERENCESTART: case Destination::ANNOTATIONREFERENCEEND: { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group - OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); + OUString aStr = m_aStates.top().getCurrentDestinationText()->makeStringAndClear(); auto pValue = new RTFValue(aStr.toInt32()); RTFSprms aAttributes; if (aState.eDestination == Destination::ANNOTATIONREFERENCESTART) @@ -2673,9 +2682,9 @@ RTFError RTFDocumentImpl::popState() break; case Destination::ANNOTATIONREFERENCE: { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group - OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear(); + OUString aStr = m_aStates.top().getCurrentDestinationText()->makeStringAndClear(); RTFSprms aAnnAttributes; aAnnAttributes.set(NS_ooxml::LN_CT_Markup_id, new RTFValue(aStr.toInt32())); Mapper().props(new RTFReferenceProperties(aAnnAttributes)); @@ -2683,9 +2692,9 @@ RTFError RTFDocumentImpl::popState() break; case Destination::FALT: { - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group - OUString aStr(m_aStates.top().pDestinationText->makeStringAndClear()); + OUString aStr(m_aStates.top().getCurrentDestinationText()->makeStringAndClear()); auto pValue = new RTFValue(aStr); aState.aTableSprms.set(NS_ooxml::LN_CT_Font_altName, pValue); } @@ -2793,7 +2802,8 @@ RTFError RTFDocumentImpl::popState() } break; case Destination::MR: - lcl_DestinationToMath(m_aStates.top().pDestinationText, m_aMathBuffer, m_bMathNor); + lcl_DestinationToMath(m_aStates.top().getCurrentDestinationText(), m_aMathBuffer, + m_bMathNor); break; case Destination::MF: m_aMathBuffer.appendClosingTag(M_TOKEN(f)); @@ -2873,7 +2883,8 @@ RTFError RTFDocumentImpl::popState() } oox::formulaimport::XmlStream::AttributeList aAttribs; - aAttribs[M_TOKEN(val)] = m_aStates.top().pDestinationText->makeStringAndClear(); + aAttribs[M_TOKEN(val)] + = m_aStates.top().getCurrentDestinationText()->makeStringAndClear(); m_aMathBuffer.appendOpeningTag(nMathToken, aAttribs); m_aMathBuffer.appendClosingTag(nMathToken); } @@ -2994,12 +3005,12 @@ RTFError RTFDocumentImpl::popState() m_pSdrImport->popParent(); break; case Destination::PROPNAME: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group - aState.setPropName(m_aStates.top().pDestinationText->makeStringAndClear()); + aState.setPropName(m_aStates.top().getCurrentDestinationText()->makeStringAndClear()); break; case Destination::STATICVAL: - if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText) + if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText()) break; // not for nested group if (m_xDocumentProperties.is()) { @@ -3007,7 +3018,8 @@ RTFError RTFDocumentImpl::popState() uno::Reference<beans::XPropertyContainer> xPropertyContainer = m_xDocumentProperties->getUserDefinedProperties(); const OUString& rKey = m_aStates.top().getPropName(); - OUString aStaticVal = m_aStates.top().pDestinationText->makeStringAndClear(); + OUString aStaticVal + = m_aStates.top().getCurrentDestinationText()->makeStringAndClear(); uno::Any aAny; if (m_aStates.top().getPropType() == cppu::UnoType<OUString>::get()) aAny <<= aStaticVal; @@ -3127,9 +3139,9 @@ RTFError RTFDocumentImpl::popState() auto pValue = new RTFValue(aState.aTableAttributes, aState.aTableSprms); m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_abstractNum, pValue, RTFOverwrite::NO_APPEND); - m_aListTable[aState.nCurrentListIndex] = pValue; + m_aListTable[aState.getCurrentListIndex()] = pValue; m_nListLevel = -1; - m_aInvalidListTableFirstIndents[aState.nCurrentListIndex] + m_aInvalidListTableFirstIndents[aState.getCurrentListIndex()] = m_aInvalidListLevelFirstIndents; m_aInvalidListLevelFirstIndents.clear(); } @@ -3274,8 +3286,8 @@ RTFError RTFDocumentImpl::popState() auto pValue = new RTFValue(aState.aTableAttributes, aState.aTableSprms); m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_num, pValue, RTFOverwrite::NO_APPEND); - m_aListOverrideTable[aState.nCurrentListOverrideIndex] - = aState.nCurrentListIndex; + m_aListOverrideTable[aState.getCurrentListOverrideIndex()] + = aState.getCurrentListIndex(); } } break; @@ -3430,8 +3442,9 @@ RTFError RTFDocumentImpl::popState() RTFError RTFDocumentImpl::handleEmbeddedObject() { - OString aStr = OUStringToOString(m_aStates.top().pDestinationText->makeStringAndClear(), - RTL_TEXTENCODING_ASCII_US); + OString aStr + = OUStringToOString(m_aStates.top().getCurrentDestinationText()->makeStringAndClear(), + RTL_TEXTENCODING_ASCII_US); std::unique_ptr<SvStream> pStream(new SvMemoryStream()); if (!msfilter::rtfutil::ExtractOLE2FromObjdata(aStr, *pStream)) return RTFError::HEX_INVALID; @@ -3510,9 +3523,9 @@ RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl) , nDay(0) , nHour(0) , nMinute(0) - , pDestinationText(nullptr) - , nCurrentStyleIndex(-1) - , nCurrentCharacterStyleIndex(-1) + , m_pCurrentDestinationText(nullptr) + , m_nCurrentStyleIndex(-1) + , m_nCurrentCharacterStyleIndex(-1) , m_pCurrentBuffer(nullptr) , m_bInListpicture(false) , m_bInBackground(false) @@ -3531,7 +3544,7 @@ void RTFDocumentImpl::bufferProperties(RTFBuffer_t& rBuffer, const RTFValue::Poi const tools::SvRef<TableRowBuffer>& pTableProperties) { rBuffer.emplace_back( - Buf_t(BUFFER_SETSTYLE, new RTFValue(m_aStates.top().nCurrentStyleIndex), nullptr)); + Buf_t(BUFFER_SETSTYLE, new RTFValue(m_aStates.top().getCurrentStyleIndex()), nullptr)); rBuffer.emplace_back(Buf_t(BUFFER_PROPS, pValue, pTableProperties)); } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 2fbf158038c4..a0394ab55414 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -402,8 +402,8 @@ public: void appendDestinationText(const OUString& rString) { - if (pDestinationText) - pDestinationText->append(rString); + if (m_pCurrentDestinationText) + m_pCurrentDestinationText->append(rString); } void setPropName(const OUString& rPropName) { m_aPropName = rPropName; } @@ -437,6 +437,25 @@ public: bool getInListpicture() const { return m_bInListpicture; } void setCurrentBuffer(RTFBuffer_t* pCurrentBuffer) { m_pCurrentBuffer = pCurrentBuffer; } RTFBuffer_t* getCurrentBuffer() const { return m_pCurrentBuffer; } + void setCurrentListOverrideIndex(int nCurrentListOverrideIndex) + { + m_nCurrentListOverrideIndex = nCurrentListOverrideIndex; + } + int getCurrentListOverrideIndex() const { return m_nCurrentListOverrideIndex; } + void setCurrentListIndex(int nCurrentListIndex) { m_nCurrentListIndex = nCurrentListIndex; } + int getCurrentListIndex() const { return m_nCurrentListIndex; } + void setCurrentCharacterStyleIndex(int nCurrentCharacterStyleIndex) + { + m_nCurrentCharacterStyleIndex = nCurrentCharacterStyleIndex; + } + int getCurrentCharacterStyleIndex() const { return m_nCurrentCharacterStyleIndex; } + void setCurrentStyleIndex(int nCurrentStyleIndex) { m_nCurrentStyleIndex = nCurrentStyleIndex; } + int getCurrentStyleIndex() const { return m_nCurrentStyleIndex; } + void setCurrentDestinationText(OUStringBuffer* pDestinationText) + { + m_pCurrentDestinationText = pDestinationText; + } + OUStringBuffer* getCurrentDestinationText() const { return m_pCurrentDestinationText; } RTFDocumentImpl* m_pDocumentImpl; RTFInternalState nInternalState; @@ -510,19 +529,20 @@ public: /// Text from special destinations. OUStringBuffer aDestinationText; + +private: /// point to the buffer of the current destination - OUStringBuffer* pDestinationText; + OUStringBuffer* m_pCurrentDestinationText; /// Index of the current style. - int nCurrentStyleIndex; + int m_nCurrentStyleIndex; /// Index of the current character style. - int nCurrentCharacterStyleIndex; + int m_nCurrentCharacterStyleIndex; /// Current listid, points to a listtable entry. - int nCurrentListIndex = -1; + int m_nCurrentListIndex = -1; /// Current ls, points to a listoverridetable entry. - int nCurrentListOverrideIndex = -1; + int m_nCurrentListOverrideIndex = -1; -private: /// Points to the active buffer, if there is one. RTFBuffer_t* m_pCurrentBuffer; |