diff options
Diffstat (limited to 'writerfilter/source/rtftok/rtfdocumentimpl.cxx')
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 136 |
1 files changed, 70 insertions, 66 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 1908fb010adc..dfb4338c711e 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -168,7 +168,7 @@ void putBorderProperty(RTFStack& aStates, Id nId, const RTFValue::Pointer_t& pVa else if (aStates.top().nBorderState == RTFBorderState::CHARACTER) { RTFValue::Pointer_t pPointer - = aStates.top().aCharacterSprms.find(NS_ooxml::LN_EG_RPrBase_bdr); + = aStates.top().getCharacterSprms().find(NS_ooxml::LN_EG_RPrBase_bdr); if (pPointer) { RTFSprms& rAttributes = pPointer->getAttributes(); @@ -394,13 +394,13 @@ void RTFDocumentImpl::checkFirstRun() // set the requested default font, if there are none RTFValue::Pointer_t pFont - = getNestedAttribute(m_aDefaultState.aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, - NS_ooxml::LN_CT_Fonts_ascii); + = getNestedAttribute(m_aDefaultState.getCharacterSprms(), + NS_ooxml::LN_EG_RPrBase_rFonts, NS_ooxml::LN_CT_Fonts_ascii); RTFValue::Pointer_t pCurrentFont - = getNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, - NS_ooxml::LN_CT_Fonts_ascii); + = getNestedAttribute(m_aStates.top().getCharacterSprms(), + NS_ooxml::LN_EG_RPrBase_rFonts, NS_ooxml::LN_CT_Fonts_ascii); if (pFont && !pCurrentFont) - putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, + putNestedAttribute(m_aStates.top().getCharacterSprms(), NS_ooxml::LN_EG_RPrBase_rFonts, NS_ooxml::LN_CT_Fonts_ascii, pFont); } } @@ -592,25 +592,25 @@ void RTFDocumentImpl::runProps() if (!m_aStates.top().getCurrentBuffer()) { Reference<Properties>::Pointer_t const pProperties = getProperties( - m_aStates.top().getCharacterAttributes(), m_aStates.top().aCharacterSprms, + m_aStates.top().getCharacterAttributes(), m_aStates.top().getCharacterSprms(), NS_ooxml::LN_Value_ST_StyleType_character); Mapper().props(pProperties); } else { auto pValue = new RTFValue(m_aStates.top().getCharacterAttributes(), - m_aStates.top().aCharacterSprms); + m_aStates.top().getCharacterSprms()); bufferProperties(*m_aStates.top().getCurrentBuffer(), pValue, nullptr); } // Delete the sprm, so the trackchange range will be started only once. // OTOH set a boolean flag, so we'll know we need to end the range later. RTFValue::Pointer_t pTrackchange - = m_aStates.top().aCharacterSprms.find(NS_ooxml::LN_trackchange); + = m_aStates.top().getCharacterSprms().find(NS_ooxml::LN_trackchange); if (pTrackchange) { m_aStates.top().setStartedTrackchange(true); - m_aStates.top().aCharacterSprms.erase(NS_ooxml::LN_trackchange); + m_aStates.top().getCharacterSprms().erase(NS_ooxml::LN_trackchange); } } @@ -1081,7 +1081,7 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS aAnchorWrapAttributes.set(rCharacterAttribute.first, rCharacterAttribute.second); } sal_Int32 nWrap = -1; - for (auto& rCharacterSprm : m_aStates.top().aCharacterSprms) + for (auto& rCharacterSprm : m_aStates.top().getCharacterSprms()) { if (rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapNone || rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapTight) @@ -1360,12 +1360,12 @@ void RTFDocumentImpl::text(OUString& rString) m_aFontEncodings[m_nCurrentFontIndex] = m_nCurrentEncoding; m_nCurrentEncoding = -1; } - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Font_name, - new RTFValue(aName)); + m_aStates.top().getTableAttributes().set(NS_ooxml::LN_CT_Font_name, + new RTFValue(aName)); writerfilter::Reference<Properties>::Pointer_t const pProp( - new RTFReferenceProperties(m_aStates.top().aTableAttributes, - m_aStates.top().aTableSprms)); + new RTFReferenceProperties(m_aStates.top().getTableAttributes(), + m_aStates.top().getTableSprms())); //See fdo#47347 initial invalid font entry properties are inserted first, //so when we attempt to insert the correct ones, there's already an @@ -1382,16 +1382,16 @@ void RTFDocumentImpl::text(OUString& rString) case Destination::STYLEENTRY: { RTFValue::Pointer_t pType - = m_aStates.top().aTableAttributes.find(NS_ooxml::LN_CT_Style_type); + = m_aStates.top().getTableAttributes().find(NS_ooxml::LN_CT_Style_type); if (pType) { // Word strips whitespace around style names. m_aStyleNames[m_nCurrentStyleIndex] = aName.trim(); m_aStyleTypes[m_nCurrentStyleIndex] = pType->getInt(); auto pValue = new RTFValue(aName.trim()); - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_styleId, - pValue); - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_name, pValue); + m_aStates.top().getTableAttributes().set(NS_ooxml::LN_CT_Style_styleId, + pValue); + m_aStates.top().getTableSprms().set(NS_ooxml::LN_CT_Style_name, pValue); writerfilter::Reference<Properties>::Pointer_t const pProp( createStyleProperties()); @@ -1839,7 +1839,7 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n if (nSprm >= 0) { auto pValue = new RTFValue((!bParam || nParam != 0) ? nSprm : 0); - m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_em, pValue); + m_aStates.top().getCharacterSprms().set(NS_ooxml::LN_EG_RPrBase_em, pValue); return RTFError::OK; } @@ -1889,7 +1889,7 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n } if (nSprm >= 0) { - m_aStates.top().aCharacterSprms.set(nSprm, pBoolValue); + m_aStates.top().getCharacterSprms().set(nSprm, pBoolValue); return RTFError::OK; } @@ -1903,7 +1903,7 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n case RTF_REVISED: { auto pValue = new RTFValue(nKeyword == RTF_DELETED ? oox::XML_del : oox::XML_ins); - putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_trackchange, + putNestedAttribute(m_aStates.top().getCharacterSprms(), NS_ooxml::LN_trackchange, NS_ooxml::LN_token, pValue); } break; @@ -1975,7 +1975,7 @@ RTFError RTFDocumentImpl::pushState() // this will be overwritten by \sN \csN \dsN \tsN m_nCurrentStyleIndex = 0; auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_StyleType_paragraph); - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); + m_aStates.top().getTableAttributes().set(NS_ooxml::LN_CT_Style_type, pValue); } break; case Destination::FIELDRESULT: @@ -2016,7 +2016,8 @@ RTFError RTFDocumentImpl::pushState() writerfilter::Reference<Properties>::Pointer_t RTFDocumentImpl::createStyleProperties() { int nBasedOn = 0; - RTFValue::Pointer_t pBasedOn = m_aStates.top().aTableSprms.find(NS_ooxml::LN_CT_Style_basedOn); + RTFValue::Pointer_t pBasedOn + = m_aStates.top().getTableSprms().find(NS_ooxml::LN_CT_Style_basedOn); if (pBasedOn) nBasedOn = pBasedOn->getInt(); if (nBasedOn == 0) @@ -2037,15 +2038,15 @@ writerfilter::Reference<Properties>::Pointer_t RTFDocumentImpl::createStylePrope RTFValue::Pointer_t pParaProps = new RTFValue(m_aStates.top().getParagraphAttributes(), m_aStates.top().getParagraphSprms()); - RTFValue::Pointer_t pCharProps - = new RTFValue(m_aStates.top().getCharacterAttributes(), m_aStates.top().aCharacterSprms); + RTFValue::Pointer_t pCharProps = new RTFValue(m_aStates.top().getCharacterAttributes(), + m_aStates.top().getCharacterSprms()); // resetSprms will clean up this modification - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_pPr, pParaProps); - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_rPr, pCharProps); + m_aStates.top().getTableSprms().set(NS_ooxml::LN_CT_Style_pPr, pParaProps); + m_aStates.top().getTableSprms().set(NS_ooxml::LN_CT_Style_rPr, pCharProps); - writerfilter::Reference<Properties>::Pointer_t const pProps( - new RTFReferenceProperties(m_aStates.top().aTableAttributes, m_aStates.top().aTableSprms)); + writerfilter::Reference<Properties>::Pointer_t const pProps(new RTFReferenceProperties( + m_aStates.top().getTableAttributes(), m_aStates.top().getTableSprms())); return pProps; } @@ -2106,14 +2107,14 @@ RTFReferenceTable::Entries_t RTFDocumentImpl::deduplicateStyleTable() void RTFDocumentImpl::resetSprms() { - m_aStates.top().aTableSprms.clear(); - m_aStates.top().aCharacterSprms.clear(); + m_aStates.top().getTableSprms().clear(); + m_aStates.top().getCharacterSprms().clear(); m_aStates.top().getParagraphSprms().clear(); } void RTFDocumentImpl::resetAttributes() { - m_aStates.top().aTableAttributes.clear(); + m_aStates.top().getTableAttributes().clear(); m_aStates.top().getCharacterAttributes().clear(); m_aStates.top().getParagraphAttributes().clear(); } @@ -2160,8 +2161,9 @@ RTFError RTFDocumentImpl::popState() if (m_nDefaultFontIndex >= 0) { auto pValue = new RTFValue(m_aFontNames[getFontIndex(m_nDefaultFontIndex)]); - putNestedAttribute(m_aDefaultState.aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, - NS_ooxml::LN_CT_Fonts_ascii, pValue); + putNestedAttribute(m_aDefaultState.getCharacterSprms(), + NS_ooxml::LN_EG_RPrBase_rFonts, NS_ooxml::LN_CT_Fonts_ascii, + pValue); } } break; @@ -2187,8 +2189,8 @@ RTFError RTFDocumentImpl::popState() break; case Destination::LISTENTRY: for (auto& rListLevelEntry : aState.getListLevelEntries()) - aState.aTableSprms.set(rListLevelEntry.first, rListLevelEntry.second, - RTFOverwrite::NO_APPEND); + aState.getTableSprms().set(rListLevelEntry.first, rListLevelEntry.second, + RTFOverwrite::NO_APPEND); break; case Destination::FIELDINSTRUCTION: { @@ -2272,7 +2274,7 @@ RTFError RTFDocumentImpl::popState() else aValue = aStr; auto pValue = new RTFValue(aValue, true); - aState.aTableAttributes.set(NS_ooxml::LN_CT_LevelText_val, pValue); + aState.getTableAttributes().set(NS_ooxml::LN_CT_LevelText_val, pValue); } break; case Destination::LEVELNUMBERS: @@ -2282,10 +2284,10 @@ RTFError RTFDocumentImpl::popState() // Current destination is levelnumbers and parent destination is levelnumbers as well. bNestedLevelNumbers = m_aStates[m_aStates.size() - 2].eDestination == Destination::LEVELNUMBERS; - if (!bNestedLevelNumbers && aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_lvlText)) + if (!bNestedLevelNumbers && aState.getTableSprms().find(NS_ooxml::LN_CT_Lvl_lvlText)) { RTFSprms& rAttributes - = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_lvlText)->getAttributes(); + = aState.getTableSprms().find(NS_ooxml::LN_CT_Lvl_lvlText)->getAttributes(); RTFValue::Pointer_t pValue = rAttributes.find(NS_ooxml::LN_CT_LevelText_val); if (pValue && aState.getLevelNumbersValid()) { @@ -2368,7 +2370,7 @@ RTFError RTFDocumentImpl::popState() auto pValue = new RTFValue(m_aStates.top().getShape()); // Buffer wrap type. - for (auto& rCharacterSprm : m_aStates.top().aCharacterSprms) + for (auto& rCharacterSprm : m_aStates.top().getCharacterSprms()) { if (rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapNone || rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapTight) @@ -2732,7 +2734,7 @@ RTFError RTFDocumentImpl::popState() break; // not for nested group OUString aStr(m_aStates.top().getCurrentDestinationText()->makeStringAndClear()); auto pValue = new RTFValue(aStr); - aState.aTableSprms.set(NS_ooxml::LN_CT_Font_altName, pValue); + aState.getTableSprms().set(NS_ooxml::LN_CT_Font_altName, pValue); } break; case Destination::DRAWINGOBJECT: @@ -3174,7 +3176,7 @@ RTFError RTFDocumentImpl::popState() { case Destination::LISTENTRY: { - auto pValue = new RTFValue(aState.aTableAttributes, aState.aTableSprms); + auto pValue = new RTFValue(aState.getTableAttributes(), aState.getTableSprms()); m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_abstractNum, pValue, RTFOverwrite::NO_APPEND); m_aListTable[aState.getCurrentListIndex()] = pValue; @@ -3187,19 +3189,19 @@ RTFError RTFDocumentImpl::popState() case Destination::PARAGRAPHNUMBERING: { RTFValue::Pointer_t pIdValue - = aState.aTableAttributes.find(NS_ooxml::LN_CT_AbstractNum_nsid); + = aState.getTableAttributes().find(NS_ooxml::LN_CT_AbstractNum_nsid); if (pIdValue.get() && !m_aStates.empty()) { // Abstract numbering RTFSprms aLeveltextAttributes; OUString aTextValue; RTFValue::Pointer_t pTextBefore - = aState.aTableAttributes.find(NS_ooxml::LN_CT_LevelText_val); + = aState.getTableAttributes().find(NS_ooxml::LN_CT_LevelText_val); if (pTextBefore) aTextValue += pTextBefore->getString(); aTextValue += "%1"; RTFValue::Pointer_t pTextAfter - = aState.aTableAttributes.find(NS_ooxml::LN_CT_LevelSuffix_val); + = aState.getTableAttributes().find(NS_ooxml::LN_CT_LevelSuffix_val); if (pTextAfter) aTextValue += pTextAfter->getString(); auto pTextValue = new RTFValue(aTextValue); @@ -3210,18 +3212,20 @@ RTFError RTFDocumentImpl::popState() auto pIlvlValue = new RTFValue(0); aLevelAttributes.set(NS_ooxml::LN_CT_Lvl_ilvl, pIlvlValue); - RTFValue::Pointer_t pFmtValue = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_numFmt); + RTFValue::Pointer_t pFmtValue + = aState.getTableSprms().find(NS_ooxml::LN_CT_Lvl_numFmt); if (pFmtValue) aLevelSprms.set(NS_ooxml::LN_CT_Lvl_numFmt, pFmtValue); RTFValue::Pointer_t pStartatValue - = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_start); + = aState.getTableSprms().find(NS_ooxml::LN_CT_Lvl_start); if (pStartatValue) aLevelSprms.set(NS_ooxml::LN_CT_Lvl_start, pStartatValue); auto pLeveltextValue = new RTFValue(aLeveltextAttributes); aLevelSprms.set(NS_ooxml::LN_CT_Lvl_lvlText, pLeveltextValue); - RTFValue::Pointer_t pRunProps = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_rPr); + RTFValue::Pointer_t pRunProps + = aState.getTableSprms().find(NS_ooxml::LN_CT_Lvl_rPr); if (pRunProps) aLevelSprms.set(NS_ooxml::LN_CT_Lvl_rPr, pRunProps); @@ -3271,7 +3275,7 @@ RTFError RTFDocumentImpl::popState() { // FIXME: don't use pDestinationText, points to popped state auto pValue = new RTFValue(aState.getDestinationText().makeStringAndClear(), true); - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelSuffix_val, pValue); + m_aStates.top().getTableAttributes().set(NS_ooxml::LN_CT_LevelSuffix_val, pValue); } break; case Destination::PARAGRAPHNUMBERING_TEXTBEFORE: @@ -3279,7 +3283,7 @@ RTFError RTFDocumentImpl::popState() { // FIXME: don't use pDestinationText, points to popped state auto pValue = new RTFValue(aState.getDestinationText().makeStringAndClear(), true); - m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelText_val, pValue); + m_aStates.top().getTableAttributes().set(NS_ooxml::LN_CT_LevelText_val, pValue); } break; case Destination::LISTNAME: @@ -3288,25 +3292,25 @@ RTFError RTFDocumentImpl::popState() if (!m_aStates.empty()) { auto pInnerValue = new RTFValue(m_aStates.top().getListLevelNum()++); - aState.aTableAttributes.set(NS_ooxml::LN_CT_Lvl_ilvl, pInnerValue); + aState.getTableAttributes().set(NS_ooxml::LN_CT_Lvl_ilvl, pInnerValue); - auto pValue = new RTFValue(aState.aTableAttributes, aState.aTableSprms); + auto pValue = new RTFValue(aState.getTableAttributes(), aState.getTableSprms()); if (m_aStates.top().eDestination != Destination::LFOLEVEL) 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); + m_aStates.top().getTableSprms().set(NS_ooxml::LN_CT_NumLvl_lvl, pValue); } break; case Destination::LFOLEVEL: if (!m_aStates.empty()) { auto pInnerValue = new RTFValue(m_aStates.top().getListLevelNum()++); - aState.aTableAttributes.set(NS_ooxml::LN_CT_NumLvl_ilvl, pInnerValue); + aState.getTableAttributes().set(NS_ooxml::LN_CT_NumLvl_ilvl, pInnerValue); - auto pValue = new RTFValue(aState.aTableAttributes, aState.aTableSprms); - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Num_lvlOverride, pValue, - RTFOverwrite::NO_APPEND); + auto pValue = new RTFValue(aState.getTableAttributes(), aState.getTableSprms()); + m_aStates.top().getTableSprms().set(NS_ooxml::LN_CT_Num_lvlOverride, pValue, + RTFOverwrite::NO_APPEND); } break; // list override table @@ -3316,12 +3320,12 @@ RTFError RTFDocumentImpl::popState() if (m_aStates.top().eDestination == Destination::LISTOVERRIDEENTRY) { // copy properties upwards so upper popState() inserts it - m_aStates.top().aTableAttributes = aState.aTableAttributes; - m_aStates.top().aTableSprms = aState.aTableSprms; + m_aStates.top().getTableAttributes() = aState.getTableAttributes(); + m_aStates.top().getTableSprms() = aState.getTableSprms(); } else { - auto pValue = new RTFValue(aState.aTableAttributes, aState.aTableSprms); + auto pValue = new RTFValue(aState.getTableAttributes(), aState.getTableSprms()); m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_num, pValue, RTFOverwrite::NO_APPEND); m_aListOverrideTable[aState.getCurrentListOverrideIndex()] @@ -3332,14 +3336,14 @@ RTFError RTFDocumentImpl::popState() case Destination::LEVELTEXT: if (!m_aStates.empty()) { - auto pValue = new RTFValue(aState.aTableAttributes); - m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_lvlText, pValue); + auto pValue = new RTFValue(aState.getTableAttributes()); + m_aStates.top().getTableSprms().set(NS_ooxml::LN_CT_Lvl_lvlText, pValue); } break; case Destination::LEVELNUMBERS: if (!m_aStates.empty()) { - m_aStates.top().aTableSprms = aState.aTableSprms; + m_aStates.top().getTableSprms() = aState.getTableSprms(); if (m_aStates.top().eDestination == Destination::LEVELNUMBERS || m_aStates.top().eDestination == Destination::LISTLEVEL) // Parent state is level number or list level, current state is @@ -3369,7 +3373,7 @@ RTFError RTFDocumentImpl::popState() break; case Destination::FALT: if (!m_aStates.empty()) - m_aStates.top().aTableSprms = aState.aTableSprms; + m_aStates.top().getTableSprms() = aState.getTableSprms(); break; case Destination::SHAPEPROPERTYNAME: case Destination::SHAPEPROPERTYVALUE: @@ -3388,7 +3392,7 @@ RTFError RTFDocumentImpl::popState() // it will be resolved on end of topmost shape instruction destination m_aStates.top().getShape() = aState.getShape(); m_aStates.top().getPicture() = aState.getPicture(); - m_aStates.top().aCharacterSprms = aState.aCharacterSprms; + m_aStates.top().getCharacterSprms() = aState.getCharacterSprms(); m_aStates.top().getCharacterAttributes() = aState.getCharacterAttributes(); } break; |