diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-05-17 21:43:05 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-05-20 10:06:48 +0200 |
commit | 174e2de4568afa7e3805b8b679d259491633723d (patch) | |
tree | f31d1f22df4d6e82d668e067f2b84063e63ed6e1 /writerfilter | |
parent | 558c6c1161e52f2c5048407fde08c80df9c2186a (diff) |
writerfilter: make RTFParserState members private, part 6
Change-Id: I4a2c89afc38f9df8a956a2fb38a1dc1ea73aea18
Reviewed-on: https://gerrit.libreoffice.org/72559
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchdestination.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchflag.cxx | 24 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchsymbol.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchvalue.cxx | 42 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 74 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.hxx | 47 |
6 files changed, 106 insertions, 85 deletions
diff --git a/writerfilter/source/rtftok/rtfdispatchdestination.cxx b/writerfilter/source/rtftok/rtfdispatchdestination.cxx index 9c65e1317bbf..5e8e46a0ebfe 100644 --- a/writerfilter/source/rtftok/rtfdispatchdestination.cxx +++ b/writerfilter/source/rtftok/rtfdispatchdestination.cxx @@ -184,7 +184,7 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) case RTF_NESTTABLEPROPS: // do not set any properties of outer table at nested table! m_aStates.top().aTableCellSprms = m_aDefaultState.aTableCellSprms; - m_aStates.top().aTableCellAttributes = m_aDefaultState.aTableCellAttributes; + m_aStates.top().getTableCellAttributes() = m_aDefaultState.getTableCellAttributes(); m_aNestedTableCellsSprms.clear(); m_aNestedTableCellsAttributes.clear(); m_nNestedCells = 0; diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx index d51ec80bdfae..d554f312d8d7 100644 --- a/writerfilter/source/rtftok/rtfdispatchflag.cxx +++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx @@ -133,7 +133,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) if (nParam >= 0) { auto pValue = new RTFValue(nParam); - m_aStates.top().aTabAttributes.set(NS_ooxml::LN_CT_TabStop_val, pValue); + m_aStates.top().getTabAttributes().set(NS_ooxml::LN_CT_TabStop_val, pValue); return RTFError::OK; } @@ -164,7 +164,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) if (nParam >= 0) { auto pValue = new RTFValue(nParam); - m_aStates.top().aTabAttributes.set(NS_ooxml::LN_CT_TabStop_leader, pValue); + m_aStates.top().getTabAttributes().set(NS_ooxml::LN_CT_TabStop_leader, pValue); return RTFError::OK; } @@ -451,24 +451,24 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) // TODO ooxml:CT_Font_family seems to be ignored by the domain mapper break; case RTF_ANSI: - m_aStates.top().nCurrentEncoding = RTL_TEXTENCODING_MS_1252; + m_aStates.top().setCurrentEncoding(RTL_TEXTENCODING_MS_1252); break; case RTF_MAC: - m_aDefaultState.nCurrentEncoding = RTL_TEXTENCODING_APPLE_ROMAN; - m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding; + m_aDefaultState.setCurrentEncoding(RTL_TEXTENCODING_APPLE_ROMAN); + m_aStates.top().setCurrentEncoding(m_aDefaultState.getCurrentEncoding()); break; case RTF_PC: - m_aDefaultState.nCurrentEncoding = RTL_TEXTENCODING_IBM_437; - m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding; + m_aDefaultState.setCurrentEncoding(RTL_TEXTENCODING_IBM_437); + m_aStates.top().setCurrentEncoding(m_aDefaultState.getCurrentEncoding()); break; case RTF_PCA: - m_aDefaultState.nCurrentEncoding = RTL_TEXTENCODING_IBM_850; - m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding; + m_aDefaultState.setCurrentEncoding(RTL_TEXTENCODING_IBM_850); + m_aStates.top().setCurrentEncoding(m_aDefaultState.getCurrentEncoding()); break; case RTF_PLAIN: { m_aStates.top().aCharacterSprms = getDefaultState().aCharacterSprms; - m_aStates.top().nCurrentEncoding = getEncoding(getFontIndex(m_nDefaultFontIndex)); + m_aStates.top().setCurrentEncoding(getEncoding(getFontIndex(m_nDefaultFontIndex))); m_aStates.top().aCharacterAttributes = getDefaultState().aCharacterAttributes; m_aStates.top().setCurrentCharacterStyleIndex(-1); m_aStates.top().setIsRightToLeft(false); @@ -583,8 +583,8 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) break; case RTF_RTLCH: m_aStates.top().setIsRightToLeft(true); - if (m_aDefaultState.nCurrentEncoding == RTL_TEXTENCODING_MS_1255) - m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding; + if (m_aDefaultState.getCurrentEncoding() == RTL_TEXTENCODING_MS_1255) + m_aStates.top().setCurrentEncoding(m_aDefaultState.getCurrentEncoding()); break; case RTF_ULNONE: { diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx index ea205bf33a0a..86b9c84485d3 100644 --- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx +++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx @@ -305,7 +305,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) // The scope of the table cell defaults is one row. m_aDefaultState.aTableCellSprms.clear(); m_aStates.top().aTableCellSprms = m_aDefaultState.aTableCellSprms; - m_aStates.top().aTableCellAttributes = m_aDefaultState.aTableCellAttributes; + m_aStates.top().getTableCellAttributes() = m_aDefaultState.getTableCellAttributes(); writerfilter::Reference<Properties>::Pointer_t paraProperties; writerfilter::Reference<Properties>::Pointer_t frameProperties; diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx index bce3a1cf44d6..f2a27759c50c 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -373,17 +373,17 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, nSprm, pValue); if (nKeyword == RTF_F) - m_aStates.top().nCurrentEncoding = getEncoding(m_nCurrentFontIndex); + m_aStates.top().setCurrentEncoding(getEncoding(m_nCurrentFontIndex)); } break; case RTF_RED: - m_aStates.top().aCurrentColor.SetRed(nParam); + m_aStates.top().getCurrentColor().SetRed(nParam); break; case RTF_GREEN: - m_aStates.top().aCurrentColor.SetGreen(nParam); + m_aStates.top().getCurrentColor().SetGreen(nParam); break; case RTF_BLUE: - m_aStates.top().aCurrentColor.SetBlue(nParam); + m_aStates.top().getCurrentColor().SetBlue(nParam); break; case RTF_FCHARSET: { @@ -403,7 +403,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) = aRTFEncodings[i].codepage == 0 // Default (CP_ACP) ? osl_getThreadTextEncoding() : rtl_getTextEncodingFromWindowsCodePage(aRTFEncodings[i].codepage); - m_aStates.top().nCurrentEncoding = m_nCurrentEncoding; + m_aStates.top().setCurrentEncoding(m_nCurrentEncoding); } break; case RTF_ANSICPG: @@ -414,10 +414,10 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ? utl_getWinTextEncodingFromLangStr(getLODefaultLanguage().toUtf8().getStr()) : rtl_getTextEncodingFromWindowsCodePage(nParam); if (nKeyword == RTF_ANSICPG) - m_aDefaultState.nCurrentEncoding = nEncoding; + m_aDefaultState.setCurrentEncoding(nEncoding); else m_nCurrentEncoding = nEncoding; - m_aStates.top().nCurrentEncoding = nEncoding; + m_aStates.top().setCurrentEncoding(nEncoding); } break; case RTF_CF: @@ -642,15 +642,15 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; case RTF_TX: { - m_aStates.top().aTabAttributes.set(NS_ooxml::LN_CT_TabStop_pos, pIntValue); - auto pValue = new RTFValue(m_aStates.top().aTabAttributes); + 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) putNestedSprm(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_Tabs_tab, pValue); else putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_Tabs_tab, pValue); - m_aStates.top().aTabAttributes.clear(); + m_aStates.top().getTabAttributes().clear(); } break; case RTF_ILVL: @@ -690,7 +690,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; case RTF_UC: if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_INT16)) - m_aStates.top().nUc = nParam; + m_aStates.top().setUc(nParam); break; case RTF_U: // sal_Unicode is unsigned 16-bit, RTF may represent that as a @@ -701,14 +701,14 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) if (m_aStates.top().eDestination == Destination::LEVELNUMBERS) { if (nParam != ';') - m_aStates.top().aLevelNumbers.push_back(sal_Int32(nParam)); + m_aStates.top().getLevelNumbers().push_back(sal_Int32(nParam)); else // ';' in \u form is not considered valid. - m_aStates.top().bLevelNumbersValid = false; + m_aStates.top().setLevelNumbersValid(false); } else m_aUnicodeBuffer.append(static_cast<sal_Unicode>(nParam)); - m_aStates.top().nCharsToSkip = m_aStates.top().nUc; + m_aStates.top().getCharsToSkip() = m_aStates.top().getUc(); } break; case RTF_LEVELFOLLOW: @@ -874,18 +874,18 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) m_nNestedCells++; // Push cell properties. m_aNestedTableCellsSprms.push_back(m_aStates.top().aTableCellSprms); - m_aNestedTableCellsAttributes.push_back(m_aStates.top().aTableCellAttributes); + m_aNestedTableCellsAttributes.push_back(m_aStates.top().getTableCellAttributes()); } else { m_nTopLevelCells++; // Push cell properties. m_aTopLevelTableCellsSprms.push_back(m_aStates.top().aTableCellSprms); - m_aTopLevelTableCellsAttributes.push_back(m_aStates.top().aTableCellAttributes); + m_aTopLevelTableCellsAttributes.push_back(m_aStates.top().getTableCellAttributes()); } m_aStates.top().aTableCellSprms = m_aDefaultState.aTableCellSprms; - m_aStates.top().aTableCellAttributes = m_aDefaultState.aTableCellAttributes; + m_aStates.top().getTableCellAttributes() = m_aDefaultState.getTableCellAttributes(); // We assume text after a row definition always belongs to the table, to handle text before the real INTBL token dispatchFlag(RTF_INTBL); if (!m_nCellxMax) @@ -1053,7 +1053,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) case RTF_REVDTTMDEL: { OUString aStr( - OStringToOUString(DTTM22OString(nParam), m_aStates.top().nCurrentEncoding)); + OStringToOUString(DTTM22OString(nParam), m_aStates.top().getCurrentEncoding())); auto pValue = new RTFValue(aStr); putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_trackchange, NS_ooxml::LN_CT_TrackChange_date, pValue); @@ -1235,7 +1235,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) case RTF_BIN: { m_aStates.top().nInternalState = RTFInternalState::BIN; - m_aStates.top().nBinaryToRead = nParam; + m_aStates.top().setBinaryToRead(nParam); } break; case RTF_DPLINECOR: @@ -1486,7 +1486,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) { if (m_aStates.top().eDestination == Destination::LISTLEVEL) { - if (m_aStates.top().bLevelNumbersValid) + if (m_aStates.top().getLevelNumbersValid()) putNestedAttribute(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_firstLine, pIntValue); else @@ -1501,7 +1501,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) { if (m_aStates.top().eDestination == Destination::LISTLEVEL) { - if (m_aStates.top().bLevelNumbersValid) + if (m_aStates.top().getLevelNumbersValid()) putNestedAttribute(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_left, pIntValue); } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 2455ef579a18..a281ad758e02 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -733,9 +733,9 @@ rtl_TextEncoding RTFDocumentImpl::getEncoding(int nFontIndex) if (it != m_aFontEncodings.end()) // We have a font encoding associated to this font. return it->second; - if (m_aDefaultState.nCurrentEncoding != rtl_getTextEncodingFromWindowsCharset(0)) + if (m_aDefaultState.getCurrentEncoding() != rtl_getTextEncodingFromWindowsCharset(0)) // We have a default encoding. - return m_aDefaultState.nCurrentEncoding; + return m_aDefaultState.getCurrentEncoding(); // Guess based on locale. return msfilter::util::getBestTextEncodingFromLocale( Application::GetSettings().GetLanguageTag().getLocale()); @@ -1171,7 +1171,7 @@ RTFError RTFDocumentImpl::resolveChars(char ch) { m_pBinaryData.reset(new SvMemoryStream()); m_pBinaryData->WriteChar(ch); - for (int i = 0; i < m_aStates.top().nBinaryToRead - 1; ++i) + for (int i = 0; i < m_aStates.top().getBinaryToRead() - 1; ++i) { Strm().ReadChar(ch); m_pBinaryData->WriteChar(ch); @@ -1191,7 +1191,7 @@ RTFError RTFDocumentImpl::resolveChars(char ch) { if (m_aStates.top().nInternalState == RTFInternalState::HEX || (ch != 0x0d && ch != 0x0a)) { - if (m_aStates.top().nCharsToSkip == 0) + if (m_aStates.top().getCharsToSkip() == 0) { if (!bUnicodeChecked) { @@ -1203,7 +1203,7 @@ RTFError RTFDocumentImpl::resolveChars(char ch) else { bSkipped = true; - m_aStates.top().nCharsToSkip--; + m_aStates.top().getCharsToSkip()--; } } @@ -1211,14 +1211,14 @@ RTFError RTFDocumentImpl::resolveChars(char ch) if (m_aStates.top().nInternalState == RTFInternalState::HEX) break; - if (RTL_TEXTENCODING_MS_932 == m_aStates.top().nCurrentEncoding) + if (RTL_TEXTENCODING_MS_932 == m_aStates.top().getCurrentEncoding()) { unsigned char uch = ch; if ((uch >= 0x80 && uch <= 0x9F) || uch >= 0xE0) { // read second byte of 2-byte Shift-JIS - may be \ { } Strm().ReadChar(ch); - if (m_aStates.top().nCharsToSkip == 0) + if (m_aStates.top().getCharsToSkip() == 0) { // fdo#79384: Word will reject Shift-JIS following \loch // but apparently OOo could read and (worse) write such documents @@ -1231,7 +1231,7 @@ RTFError RTFDocumentImpl::resolveChars(char ch) { assert(bSkipped); // anybody who uses \ucN with Shift-JIS is insane - m_aStates.top().nCharsToSkip--; + m_aStates.top().getCharsToSkip()--; } } } @@ -1268,19 +1268,19 @@ RTFError RTFDocumentImpl::resolveChars(char ch) if (m_aStates.top().eDestination == Destination::LEVELNUMBERS) { if (aStr.toChar() != ';') - m_aStates.top().aLevelNumbers.push_back(sal_Int32(ch)); + m_aStates.top().getLevelNumbers().push_back(sal_Int32(ch)); return RTFError::OK; } - OUString aOUStr(OStringToOUString(aStr, m_aStates.top().nCurrentEncoding)); + OUString aOUStr(OStringToOUString(aStr, m_aStates.top().getCurrentEncoding())); SAL_INFO("writerfilter.rtf", "RTFDocumentImpl::resolveChars: collected '" << aOUStr << "'"); if (m_aStates.top().eDestination == Destination::COLORTABLE) { // we hit a ';' at the end of each color entry - m_aColorTable.push_back(m_aStates.top().aCurrentColor.GetColor()); + m_aColorTable.push_back(m_aStates.top().getCurrentColor().GetColor()); // set components back to zero - m_aStates.top().aCurrentColor = RTFColorTableEntry(); + m_aStates.top().getCurrentColor() = RTFColorTableEntry(); } else if (!aStr.isEmpty()) m_aHexBuffer.append(aStr); @@ -2183,7 +2183,7 @@ RTFError RTFDocumentImpl::popState() } break; case Destination::LISTENTRY: - for (auto& rListLevelEntry : aState.aListLevelEntries) + for (auto& rListLevelEntry : aState.getListLevelEntries()) aState.aTableSprms.set(rListLevelEntry.first, rListLevelEntry.second, RTFOverwrite::NO_APPEND); break; @@ -2284,7 +2284,7 @@ RTFError RTFDocumentImpl::popState() RTFSprms& rAttributes = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_lvlText)->getAttributes(); RTFValue::Pointer_t pValue = rAttributes.find(NS_ooxml::LN_CT_LevelText_val); - if (pValue && aState.bLevelNumbersValid) + if (pValue && aState.getLevelNumbersValid()) { OUString aOrig = pValue->getString(); @@ -2292,14 +2292,14 @@ RTFError RTFDocumentImpl::popState() sal_Int32 nReplaces = 1; for (int i = 0; i < aOrig.getLength(); i++) { - if (std::find(aState.aLevelNumbers.begin(), aState.aLevelNumbers.end(), - i + 1) - != aState.aLevelNumbers.end()) + if (std::find(aState.getLevelNumbers().begin(), + aState.getLevelNumbers().end(), i + 1) + != aState.getLevelNumbers().end()) { aBuf.append('%'); // '1.1.1' -> '%1.%2.%3', but '1.' (with '2.' prefix omitted) is %2. - aBuf.append(sal_Int32(nReplaces++ + aState.nListLevelNum + 1 - - aState.aLevelNumbers.size())); + aBuf.append(sal_Int32(nReplaces++ + aState.getListLevelNum() + 1 + - aState.getLevelNumbers().size())); } else aBuf.append(std::u16string_view(aOrig).substr(i, 1)); @@ -2465,7 +2465,7 @@ RTFError RTFDocumentImpl::popState() break; // not for nested group OString aStr = OUStringToOString( m_aStates.top().getCurrentDestinationText()->makeStringAndClear(), - aState.nCurrentEncoding); + aState.getCurrentEncoding()); // decode hex dump OStringBuffer aBuf; int b = 0, count = 2; @@ -2507,13 +2507,13 @@ RTFError RTFDocumentImpl::popState() nLength = aStr.toChar(); if (!aStr.isEmpty()) aStr = aStr.copy(1); - auto pNValue = new RTFValue(OStringToOUString(aName, aState.nCurrentEncoding)); + auto pNValue = new RTFValue(OStringToOUString(aName, aState.getCurrentEncoding())); m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pNValue); if (nLength > 0) { OString aDefaultText = aStr.copy(0, std::min(nLength, aStr.getLength())); - auto pDValue - = new RTFValue(OStringToOUString(aDefaultText, aState.nCurrentEncoding)); + auto pDValue = new RTFValue( + OStringToOUString(aDefaultText, aState.getCurrentEncoding())); m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFTextInput_default, pDValue); } @@ -2672,7 +2672,7 @@ RTFError RTFDocumentImpl::popState() OUString aStr(OStringToOUString( DTTM22OString( m_aStates.top().getCurrentDestinationText()->makeStringAndClear().toInt32()), - aState.nCurrentEncoding)); + aState.getCurrentEncoding())); auto pValue = new RTFValue(aStr); RTFSprms aAnnAttributes; aAnnAttributes.set(NS_ooxml::LN_CT_TrackChange_date, pValue); @@ -3284,13 +3284,13 @@ RTFError RTFDocumentImpl::popState() case Destination::LISTLEVEL: if (!m_aStates.empty()) { - auto pInnerValue = new RTFValue(m_aStates.top().nListLevelNum++); + auto pInnerValue = new RTFValue(m_aStates.top().getListLevelNum()++); aState.aTableAttributes.set(NS_ooxml::LN_CT_Lvl_ilvl, pInnerValue); auto pValue = new RTFValue(aState.aTableAttributes, aState.aTableSprms); if (m_aStates.top().eDestination != Destination::LFOLEVEL) - m_aStates.top().aListLevelEntries.set(NS_ooxml::LN_CT_AbstractNum_lvl, pValue, - RTFOverwrite::NO_APPEND); + m_aStates.top().getListLevelEntries().set(NS_ooxml::LN_CT_AbstractNum_lvl, + pValue, RTFOverwrite::NO_APPEND); else m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_NumLvl_lvl, pValue); } @@ -3298,7 +3298,7 @@ RTFError RTFDocumentImpl::popState() case Destination::LFOLEVEL: if (!m_aStates.empty()) { - auto pInnerValue = new RTFValue(m_aStates.top().nListLevelNum++); + auto pInnerValue = new RTFValue(m_aStates.top().getListLevelNum()++); aState.aTableAttributes.set(NS_ooxml::LN_CT_NumLvl_ilvl, pInnerValue); auto pValue = new RTFValue(aState.aTableAttributes, aState.aTableSprms); @@ -3341,7 +3341,7 @@ RTFError RTFDocumentImpl::popState() || m_aStates.top().eDestination == 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().bLevelNumbersValid = aState.bLevelNumbersValid; + m_aStates.top().setLevelNumbersValid(aState.getLevelNumbersValid()); } break; case Destination::FIELDINSTRUCTION: @@ -3531,9 +3531,9 @@ void RTFDocumentImpl::checkUnicode(bool bUnicode, bool bHex) } if (bHex && !m_aHexBuffer.isEmpty()) { - rtl_TextEncoding nEncoding = m_aStates.top().nCurrentEncoding; + rtl_TextEncoding nEncoding = m_aStates.top().getCurrentEncoding(); if (m_aStates.top().eDestination == Destination::FONTENTRY - && m_aStates.top().nCurrentEncoding == RTL_TEXTENCODING_SYMBOL) + && m_aStates.top().getCurrentEncoding() == RTL_TEXTENCODING_SYMBOL) nEncoding = RTL_TEXTENCODING_MS_1252; OUString aString = OStringToOUString(m_aHexBuffer.makeStringAndClear(), nEncoding); text(aString); @@ -3546,12 +3546,12 @@ RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl) , eDestination(Destination::NORMAL) , eFieldStatus(RTFFieldStatus::NONE) , nBorderState(RTFBorderState::NONE) - , nCurrentEncoding(rtl_getTextEncodingFromWindowsCharset(0)) - , nUc(1) - , nCharsToSkip(0) - , nBinaryToRead(0) - , nListLevelNum(0) - , bLevelNumbersValid(true) + , m_nCurrentEncoding(rtl_getTextEncodingFromWindowsCharset(0)) + , m_nUc(1) + , m_nCharsToSkip(0) + , m_nBinaryToRead(0) + , m_nListLevelNum(0) + , m_bLevelNumbersValid(true) , m_aFrame(this) , m_eRunType(RunType::LOCH) , m_bIsRightToLeft(false) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index c6738dcdbfac..b62cf91b6a8a 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -483,6 +483,27 @@ public: RTFDrawingObject& getDrawingObject() { return m_aDrawingObject; } RTFShape& getShape() { return m_aShape; } RTFPicture& getPicture() { return m_aPicture; } + void setLevelNumbersValid(bool bLevelNumbersValid) + { + m_bLevelNumbersValid = bLevelNumbersValid; + } + bool getLevelNumbersValid() const { return m_bLevelNumbersValid; } + std::vector<sal_Int32>& getLevelNumbers() { return m_aLevelNumbers; } + RTFSprms& getListLevelEntries() { return m_aListLevelEntries; } + int& getListLevelNum() { return m_nListLevelNum; } + void setBinaryToRead(int nBinaryToRead) { m_nBinaryToRead = nBinaryToRead; } + int getBinaryToRead() const { return m_nBinaryToRead; } + int& getCharsToSkip() { return m_nCharsToSkip; } + void setUc(int nUc) { m_nUc = nUc; } + int getUc() const { return m_nUc; } + void setCurrentEncoding(rtl_TextEncoding nCurrentEncoding) + { + m_nCurrentEncoding = nCurrentEncoding; + } + rtl_TextEncoding getCurrentEncoding() const { return m_nCurrentEncoding; } + RTFColorTableEntry& getCurrentColor() { return m_aCurrentColor; } + RTFSprms& getTabAttributes() { return m_aTabAttributes; } + RTFSprms& getTableCellAttributes() { return m_aTableCellAttributes; } RTFDocumentImpl* m_pDocumentImpl; RTFInternalState nInternalState; @@ -506,32 +527,32 @@ public: RTFSprms aTableRowAttributes; // reset by cellx RTFSprms aTableCellSprms; - RTFSprms aTableCellAttributes; + +private: + RTFSprms m_aTableCellAttributes; // reset by tx - RTFSprms aTabAttributes; + RTFSprms m_aTabAttributes; - RTFColorTableEntry aCurrentColor; + RTFColorTableEntry m_aCurrentColor; - rtl_TextEncoding nCurrentEncoding; + rtl_TextEncoding m_nCurrentEncoding; /// Current \uc value. - int nUc; + int m_nUc; /// Characters to skip, set to nUc by \u. - int nCharsToSkip; + int m_nCharsToSkip; /// Characters to read, once in binary mode. - int nBinaryToRead; + int m_nBinaryToRead; /// Next list level index to use when parsing list table. - int nListLevelNum; + int m_nListLevelNum; /// List level entries, which will form a list entry later. - RTFSprms aListLevelEntries; - + RTFSprms m_aListLevelEntries; /// List of character positions in leveltext to replace. - std::vector<sal_Int32> aLevelNumbers; + std::vector<sal_Int32> m_aLevelNumbers; /// If aLevelNumbers should be read at all. - bool bLevelNumbersValid; + bool m_bLevelNumbersValid; -private: RTFPicture m_aPicture; RTFShape m_aShape; RTFDrawingObject m_aDrawingObject; |