diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-05-17 21:45:02 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-05-20 10:07:01 +0200 |
commit | 0746d6e63aae646818b071c021276d13d3223cd8 (patch) | |
tree | 11685bd31ef3dded08de89e25a4228925ddd3fac /writerfilter | |
parent | 6090dcbdc64e8d950121aad62802d4bf056a70ec (diff) |
writerfilter: make RTFParserState members private, part 8
Change-Id: I1e53b4282daa7ca1a5da4a8cec67a30516449b60
Reviewed-on: https://gerrit.libreoffice.org/72561
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchdestination.cxx | 6 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchflag.cxx | 59 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchsymbol.cxx | 6 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchvalue.cxx | 63 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 82 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.hxx | 11 |
6 files changed, 120 insertions, 107 deletions
diff --git a/writerfilter/source/rtftok/rtfdispatchdestination.cxx b/writerfilter/source/rtftok/rtfdispatchdestination.cxx index a38cfd202363..74f7d5a9454d 100644 --- a/writerfilter/source/rtftok/rtfdispatchdestination.cxx +++ b/writerfilter/source/rtftok/rtfdispatchdestination.cxx @@ -303,10 +303,10 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) } if (bCustomMark) { - m_aStates.top().aCharacterAttributes.clear(); + m_aStates.top().getCharacterAttributes().clear(); m_aStates.top().aCharacterSprms.clear(); auto pValue = new RTFValue(1); - m_aStates.top().aCharacterAttributes.set( + m_aStates.top().getCharacterAttributes().set( NS_ooxml::LN_CT_FtnEdnRef_customMarkFollows, pValue); text(aCustomMark); } @@ -615,7 +615,7 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) break; case RTF_FTNSEP: m_aStates.top().eDestination = Destination::FOOTNOTESEPARATOR; - m_aStates.top().aCharacterAttributes.set( + m_aStates.top().getCharacterAttributes().set( NS_ooxml::LN_CT_FtnEdn_type, new RTFValue(NS_ooxml::LN_Value_doc_ST_FtnEdn_separator)); break; diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx index 76fe64743527..199f3068283b 100644 --- a/writerfilter/source/rtftok/rtfdispatchflag.cxx +++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx @@ -53,7 +53,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) if (nSprm >= 0) { auto pValue = new RTFValue(nSprm); - m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_Underline_val, pValue); + m_aStates.top().getCharacterAttributes().set(NS_ooxml::LN_CT_Underline_val, pValue); return RTFError::OK; } @@ -81,7 +81,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) if (nParam >= 0) { auto pValue = new RTFValue(nParam); - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_jc, pValue); + m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_jc, pValue); m_bNeedPap = true; return RTFError::OK; } @@ -111,7 +111,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) if (nParam >= 0) { auto pValue = new RTFValue(nParam); - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_textAlignment, pValue); + m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_textAlignment, pValue); return RTFError::OK; } @@ -299,8 +299,9 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) if (nParam >= 0) { auto pValue = new RTFValue(nParam); - putNestedSprm(m_aDefaultState.aParagraphSprms, NS_ooxml::LN_EG_SectPrContents_footnotePr, - NS_ooxml::LN_CT_FtnProps_numFmt, pValue); + putNestedSprm(m_aDefaultState.getParagraphSprms(), + NS_ooxml::LN_EG_SectPrContents_footnotePr, NS_ooxml::LN_CT_FtnProps_numFmt, + pValue); return RTFError::OK; } @@ -322,7 +323,8 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) if (nParam >= 0) { auto pValue = new RTFValue(nParam); - putNestedSprm(m_aDefaultState.aParagraphSprms, NS_ooxml::LN_EG_SectPrContents_footnotePr, + putNestedSprm(m_aDefaultState.getParagraphSprms(), + NS_ooxml::LN_EG_SectPrContents_footnotePr, NS_ooxml::LN_EG_FtnEdnNumProps_numRestart, pValue); return RTFError::OK; } @@ -354,7 +356,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) if (nParam >= 0) { auto pValue = new RTFValue(nParam); - putNestedSprm(m_aDefaultState.aParagraphSprms, NS_ooxml::LN_EG_SectPrContents_endnotePr, + putNestedSprm(m_aDefaultState.getParagraphSprms(), NS_ooxml::LN_EG_SectPrContents_endnotePr, NS_ooxml::LN_CT_EdnProps_numFmt, pValue); return RTFError::OK; } @@ -433,8 +435,8 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) if (nParam >= 0) { auto pValue = new RTFValue(1); - m_aStates.top().aParagraphSprms.erase(NS_ooxml::LN_inTbl); - m_aStates.top().aParagraphSprms.set(nParam, pValue); + m_aStates.top().getParagraphSprms().erase(NS_ooxml::LN_inTbl); + m_aStates.top().getParagraphSprms().set(nParam, pValue); return RTFError::OK; } @@ -469,7 +471,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) { m_aStates.top().aCharacterSprms = getDefaultState().aCharacterSprms; m_aStates.top().setCurrentEncoding(getEncoding(getFontIndex(m_nDefaultFontIndex))); - m_aStates.top().aCharacterAttributes = getDefaultState().aCharacterAttributes; + m_aStates.top().getCharacterAttributes() = getDefaultState().getCharacterAttributes(); m_aStates.top().setCurrentCharacterStyleIndex(-1); m_aStates.top().setIsRightToLeft(false); m_aStates.top().setRunType(RTFParserState::RunType::LOCH); @@ -482,9 +484,9 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) // \pard is allowed between \cell and \row, but in that case it should not reset the fact that we're inside a table. // It should not reset the paragraph style, either, so remember the old paragraph style. RTFValue::Pointer_t pOldStyle - = m_aStates.top().aParagraphSprms.find(NS_ooxml::LN_CT_PPrBase_pStyle); - m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms; - m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes; + = m_aStates.top().getParagraphSprms().find(NS_ooxml::LN_CT_PPrBase_pStyle); + m_aStates.top().getParagraphSprms() = m_aDefaultState.getParagraphSprms(); + m_aStates.top().getParagraphAttributes() = m_aDefaultState.getParagraphAttributes(); if (m_nTopLevelCells == 0 && m_nNestedCells == 0) { @@ -494,12 +496,14 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) else { // We are still in a table. - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_inTbl, new RTFValue(1)); + m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_inTbl, new RTFValue(1)); if (m_bAfterCellBeforeRow && pOldStyle) // And we still have the same paragraph style. - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_pStyle, pOldStyle); + m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_pStyle, + pOldStyle); // Ideally getDefaultSPRM() would take care of this, but it would not when we're buffering. - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_tabs, new RTFValue()); + m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_tabs, + new RTFValue()); } resetFrame(); @@ -512,8 +516,8 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) if (!aName.isEmpty() && getStyleType(0) != NS_ooxml::LN_Value_ST_StyleType_character) { - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_pStyle, - new RTFValue(aName)); + m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_pStyle, + new RTFValue(aName)); m_aStates.top().setCurrentStyleIndex(0); } else @@ -545,7 +549,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_NOWIDCTLPAR: { auto pValue = new RTFValue(int(nKeyword == RTF_WIDCTLPAR)); - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_widowControl, pValue); + m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_widowControl, pValue); } break; case RTF_BOX: @@ -553,7 +557,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) RTFSprms aAttributes; auto pValue = new RTFValue(aAttributes); for (int i = 0; i < 4; i++) - m_aStates.top().aParagraphSprms.set(getParagraphBorder(i), pValue); + m_aStates.top().getParagraphSprms().set(getParagraphBorder(i), pValue); m_aStates.top().nBorderState = RTFBorderState::PARAGRAPH_BOX; } break; @@ -561,15 +565,15 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_RTLSECT: { auto pValue = new RTFValue(nKeyword == RTF_LTRSECT ? 0 : 1); - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_EG_SectPrContents_textDirection, - pValue); + m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_EG_SectPrContents_textDirection, + pValue); } break; case RTF_LTRPAR: case RTF_RTLPAR: { auto pValue = new RTFValue(nKeyword == RTF_LTRPAR ? 0 : 1); - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_bidi, pValue); + m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_bidi, pValue); } break; case RTF_LTRROW: @@ -589,7 +593,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_ULNONE: { auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_Underline_none); - m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_Underline_val, pValue); + m_aStates.top().getCharacterAttributes().set(NS_ooxml::LN_CT_Underline_val, pValue); } break; case RTF_NONSHPPICT: @@ -681,7 +685,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) default: break; } - putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_pBdr, nParam, + putNestedSprm(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PrBase_pBdr, nParam, pValue); m_aStates.top().nBorderState = RTFBorderState::PARAGRAPH; } @@ -833,7 +837,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_ENDDOC: { auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_RestartNumber_eachSect); - putNestedSprm(m_aDefaultState.aParagraphSprms, + putNestedSprm(m_aDefaultState.getParagraphSprms(), NS_ooxml::LN_EG_SectPrContents_footnotePr, NS_ooxml::LN_EG_FtnEdnNumProps_numRestart, pValue); } @@ -1063,7 +1067,8 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_CONTEXTUALSPACE: { auto pValue = new RTFValue(1); - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_contextualSpacing, pValue); + m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_contextualSpacing, + pValue); } break; case RTF_LINKSTYLES: diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx index 5faa9a831fde..989bf48829a9 100644 --- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx +++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx @@ -182,10 +182,10 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) if (m_bNeedPap) { // There were no runs in the cell, so we need to send paragraph and character properties here. - auto pPValue = new RTFValue(m_aStates.top().aParagraphAttributes, - m_aStates.top().aParagraphSprms); + auto pPValue = new RTFValue(m_aStates.top().getParagraphAttributes(), + m_aStates.top().getParagraphSprms()); bufferProperties(m_aTableBufferStack.back(), pPValue, nullptr); - auto pCValue = new RTFValue(m_aStates.top().aCharacterAttributes, + auto pCValue = new RTFValue(m_aStates.top().getCharacterAttributes(), m_aStates.top().aCharacterSprms); bufferProperties(m_aTableBufferStack.back(), pCValue, nullptr); } diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx index 7ad595168ce2..f15a505931a1 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -220,8 +220,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) pValue); // Language is a character property, but we should store it at a paragraph level as well for fields. if (nKeyword == RTF_LANG && m_bNeedPap) - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_EG_RPrBase_lang, nSprm, - pValue); + putNestedAttribute(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_EG_RPrBase_lang, + nSprm, pValue); return RTFError::OK; } // Trivial paragraph sprms. @@ -242,7 +242,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) } if (nSprm > 0) { - m_aStates.top().aParagraphSprms.set(nSprm, pIntValue); + m_aStates.top().getParagraphSprms().set(nSprm, pIntValue); if (nKeyword == RTF_ITAP && nParam > 0) { while (m_aTableBufferStack.size() < sal::static_int_cast<std::size_t>(nParam)) @@ -450,8 +450,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_pStyle, new RTFValue(aName)); else - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_pStyle, - new RTFValue(aName)); + m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_pStyle, + new RTFValue(aName)); } } } @@ -528,7 +528,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) if (nParam) { auto pValue = new RTFValue(sal_uInt32(getColorTable(nParam))); - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_shd, + putNestedAttribute(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PrBase_shd, NS_ooxml::LN_CT_Shd_fill, pValue); } break; @@ -554,10 +554,11 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) case RTF_HORZVERT: { auto pValue = new RTFValue(int(true)); - m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_EastAsianLayout_vert, pValue); + m_aStates.top().getCharacterAttributes().set(NS_ooxml::LN_CT_EastAsianLayout_vert, + pValue); if (nParam) // rotate fits to a single line - m_aStates.top().aCharacterAttributes.set( + m_aStates.top().getCharacterAttributes().set( NS_ooxml::LN_CT_EastAsianLayout_vertCompress, pValue); } break; @@ -571,8 +572,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) case RTF_TWOINONE: { auto pValue = new RTFValue(int(true)); - m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_EastAsianLayout_combine, - pValue); + m_aStates.top().getCharacterAttributes().set(NS_ooxml::LN_CT_EastAsianLayout_combine, + pValue); nId = 0; switch (nParam) { @@ -593,7 +594,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; } if (nId > 0) - m_aStates.top().aCharacterAttributes.set( + m_aStates.top().getCharacterAttributes().set( NS_ooxml::LN_CT_EastAsianLayout_combineBrackets, new RTFValue(nId)); } break; @@ -607,15 +608,16 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) pValue = new RTFValue(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_exact); pIntValue = new RTFValue(-nParam); } - m_aStates.top().aParagraphAttributes.set(NS_ooxml::LN_CT_Spacing_lineRule, pValue); - m_aStates.top().aParagraphAttributes.set(NS_ooxml::LN_CT_Spacing_line, pIntValue); + m_aStates.top().getParagraphAttributes().set(NS_ooxml::LN_CT_Spacing_lineRule, pValue); + m_aStates.top().getParagraphAttributes().set(NS_ooxml::LN_CT_Spacing_line, pIntValue); } break; case RTF_SLMULT: if (nParam > 0) { auto pValue = new RTFValue(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_auto); - m_aStates.top().aParagraphAttributes.set(NS_ooxml::LN_CT_Spacing_lineRule, pValue); + m_aStates.top().getParagraphAttributes().set(NS_ooxml::LN_CT_Spacing_lineRule, + pValue); } break; case RTF_BRDRW: @@ -648,13 +650,13 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) 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, + putNestedSprm(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_Tabs_tab, pValue); m_aStates.top().getTabAttributes().clear(); } break; case RTF_ILVL: - putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr, + putNestedSprm(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PPrBase_numPr, NS_ooxml::LN_CT_NumPr_ilvl, pIntValue); break; case RTF_LISTTEMPLATEID: @@ -683,7 +685,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) // can be overridden by direct formatting. But still allow the // case when old-style paragraph numbering is already // tokenized. - putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr, + putNestedSprm(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PPrBase_numPr, NS_ooxml::LN_CT_NumPr_numId, pIntValue, RTFOverwrite::YES_PREPEND); } } @@ -813,8 +815,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) if (pTight) pTight->getAttributes().set(NS_ooxml::LN_CT_WrapTight_wrapText, pValue); else - m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_WrapSquare_wrapText, - pValue); + m_aStates.top().getCharacterAttributes().set(NS_ooxml::LN_CT_WrapSquare_wrapText, + pValue); } break; case RTF_SHPWR: @@ -1172,12 +1174,13 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) // Ignore this for now, later the RTF writer version could be used to add hacks for older buggy writers. break; case RTF_FTNSTART: - putNestedSprm(m_aDefaultState.aParagraphSprms, + putNestedSprm(m_aDefaultState.getParagraphSprms(), NS_ooxml::LN_EG_SectPrContents_footnotePr, NS_ooxml::LN_EG_FtnEdnNumProps_numStart, pIntValue); break; case RTF_AFTNSTART: - putNestedSprm(m_aDefaultState.aParagraphSprms, NS_ooxml::LN_EG_SectPrContents_endnotePr, + putNestedSprm(m_aDefaultState.getParagraphSprms(), + NS_ooxml::LN_EG_SectPrContents_endnotePr, NS_ooxml::LN_EG_FtnEdnNumProps_numStart, pIntValue); break; case RTF_DFRMTXTX: @@ -1216,11 +1219,11 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) m_aStates.top().getPicture().eWMetafile = nParam; break; case RTF_SB: - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, + putNestedAttribute(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_before, pIntValue); break; case RTF_SA: - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, + putNestedAttribute(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_after, pIntValue); break; case RTF_DPX: @@ -1512,7 +1515,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) m_aInvalidListLevelFirstIndents[m_nListLevel] = nParam; } else - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, + putNestedAttribute(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_firstLine, pIntValue); break; } @@ -1526,30 +1529,30 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) } else { - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, + putNestedAttribute(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_left, pIntValue); } // It turns out \li should reset the \fi inherited from the stylesheet. // So set the direct formatting to zero, if we don't have such direct formatting yet. - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, + putNestedAttribute(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_firstLine, new RTFValue(0), RTFOverwrite::NO_IGNORE); } break; case RTF_RI: - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, + putNestedAttribute(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_right, pIntValue); break; case RTF_LIN: - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, + putNestedAttribute(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_start, pIntValue); break; case RTF_RIN: - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, + putNestedAttribute(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_end, pIntValue); break; case RTF_OUTLINELEVEL: - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_outlineLvl, pIntValue); + m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_outlineLvl, pIntValue); break; case RTF_TRGAPH: // Half of the space between the cells of a table row: default left/right table cell margin. diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 30c0e2e337f7..1908fb010adc 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -158,7 +158,7 @@ void putBorderProperty(RTFStack& aStates, Id nId, const RTFValue::Pointer_t& pVa if (aStates.top().nBorderState == RTFBorderState::PARAGRAPH_BOX) for (int i = 0; i < 4; i++) { - RTFValue::Pointer_t p = aStates.top().aParagraphSprms.find(getParagraphBorder(i)); + RTFValue::Pointer_t p = aStates.top().getParagraphSprms().find(getParagraphBorder(i)); if (p) { RTFSprms& rAttributes = p->getAttributes(); @@ -178,7 +178,7 @@ void putBorderProperty(RTFStack& aStates, Id nId, const RTFValue::Pointer_t& pVa // Attributes of the last border type else if (aStates.top().nBorderState == RTFBorderState::PARAGRAPH) pAttributes - = &getLastAttributes(aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_pBdr); + = &getLastAttributes(aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PrBase_pBdr); else if (aStates.top().nBorderState == RTFBorderState::CELL) pAttributes = &getLastAttributes(aStates.top().getTableCellSprms(), NS_ooxml::LN_CT_TcPrBase_tcBorders); @@ -552,16 +552,16 @@ void RTFDocumentImpl::checkNeedPap() if (!m_aStates.top().getCurrentBuffer()) { - writerfilter::Reference<Properties>::Pointer_t const pParagraphProperties( - getProperties(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms, - NS_ooxml::LN_Value_ST_StyleType_paragraph)); + writerfilter::Reference<Properties>::Pointer_t const pParagraphProperties(getProperties( + m_aStates.top().getParagraphAttributes(), m_aStates.top().getParagraphSprms(), + NS_ooxml::LN_Value_ST_StyleType_paragraph)); // Writer will ignore a page break before a text frame, so guard it with empty paragraphs - bool hasBreakBeforeFrame - = m_aStates.top().getFrame().hasProperties() - && m_aStates.top() - .aParagraphSprms.find(NS_ooxml::LN_CT_PPrBase_pageBreakBefore) - .get(); + bool hasBreakBeforeFrame = m_aStates.top().getFrame().hasProperties() + && m_aStates.top() + .getParagraphSprms() + .find(NS_ooxml::LN_CT_PPrBase_pageBreakBefore) + .get(); if (hasBreakBeforeFrame) { dispatchSymbol(RTF_PAR); @@ -580,8 +580,8 @@ void RTFDocumentImpl::checkNeedPap() } else { - auto pValue = new RTFValue(m_aStates.top().aParagraphAttributes, - m_aStates.top().aParagraphSprms); + auto pValue = new RTFValue(m_aStates.top().getParagraphAttributes(), + m_aStates.top().getParagraphSprms()); bufferProperties(*m_aStates.top().getCurrentBuffer(), pValue, nullptr); } } @@ -591,15 +591,15 @@ void RTFDocumentImpl::runProps() { if (!m_aStates.top().getCurrentBuffer()) { - Reference<Properties>::Pointer_t const pProperties - = getProperties(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms, - NS_ooxml::LN_Value_ST_StyleType_character); + Reference<Properties>::Pointer_t const pProperties = getProperties( + m_aStates.top().getCharacterAttributes(), m_aStates.top().aCharacterSprms, + NS_ooxml::LN_Value_ST_StyleType_character); Mapper().props(pProperties); } else { - auto pValue - = new RTFValue(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms); + auto pValue = new RTFValue(m_aStates.top().getCharacterAttributes(), + m_aStates.top().aCharacterSprms); bufferProperties(*m_aStates.top().getCurrentBuffer(), pValue, nullptr); } @@ -1047,7 +1047,7 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS auto pExtentValue = new RTFValue(aExtentAttributes); // docpr sprm RTFSprms aDocprAttributes; - for (auto& rCharacterAttribute : m_aStates.top().aCharacterAttributes) + for (auto& rCharacterAttribute : m_aStates.top().getCharacterAttributes()) if (rCharacterAttribute.first == NS_ooxml::LN_CT_NonVisualDrawingProps_name || rCharacterAttribute.first == NS_ooxml::LN_CT_NonVisualDrawingProps_descr) aDocprAttributes.set(rCharacterAttribute.first, rCharacterAttribute.second); @@ -1075,7 +1075,7 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS NS_ooxml::LN_CT_Anchor_behindDoc, new RTFValue((m_aStates.top().getShape().getInBackground()) ? 1 : 0)); RTFSprms aAnchorSprms; - for (auto& rCharacterAttribute : m_aStates.top().aCharacterAttributes) + for (auto& rCharacterAttribute : m_aStates.top().getCharacterAttributes()) { if (rCharacterAttribute.first == NS_ooxml::LN_CT_WrapSquare_wrapText) aAnchorWrapAttributes.set(rCharacterAttribute.first, rCharacterAttribute.second); @@ -1535,8 +1535,9 @@ void RTFDocumentImpl::prepareProperties( writerfilter::Reference<Properties>::Pointer_t& o_rpTableRowProperties, int const nCells, int const nCurrentCellX) { - o_rpParagraphProperties = getProperties(rState.aParagraphAttributes, rState.aParagraphSprms, - NS_ooxml::LN_Value_ST_StyleType_paragraph); + o_rpParagraphProperties + = getProperties(rState.getParagraphAttributes(), rState.getParagraphSprms(), + NS_ooxml::LN_Value_ST_StyleType_paragraph); if (rState.getFrame().hasProperties()) { @@ -1810,7 +1811,7 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n { auto pValue = new RTFValue((!bParam || nParam != 0) ? nSprm : NS_ooxml::LN_Value_ST_Underline_none); - m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_Underline_val, pValue); + m_aStates.top().getCharacterAttributes().set(NS_ooxml::LN_CT_Underline_val, pValue); return RTFError::OK; } @@ -1895,7 +1896,8 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n switch (nKeyword) { case RTF_ASPALPHA: - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_autoSpaceDE, pBoolValue); + m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_autoSpaceDE, + pBoolValue); break; case RTF_DELETED: case RTF_REVISED: @@ -1906,11 +1908,11 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n } break; case RTF_SBAUTO: - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, + putNestedAttribute(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_beforeAutospacing, pBoolValue); break; case RTF_SAAUTO: - putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, + putNestedAttribute(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_afterAutospacing, pBoolValue); break; case RTF_FACINGP: @@ -1920,8 +1922,8 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_autoHyphenation, pBoolValue); break; case RTF_HYPHPAR: - m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_suppressAutoHyphens, - new RTFValue(int(bParam && nParam == 0))); + m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_suppressAutoHyphens, + new RTFValue(int(bParam && nParam == 0))); break; default: { @@ -2025,18 +2027,18 @@ writerfilter::Reference<Properties>::Pointer_t RTFDocumentImpl::createStylePrope { NS_ooxml::LN_CT_Ind_firstLine, NS_ooxml::LN_CT_Ind_left, NS_ooxml::LN_CT_Ind_right, NS_ooxml::LN_CT_Ind_start, NS_ooxml::LN_CT_Ind_end }) { - RTFValue::Pointer_t pValue = getNestedAttribute(m_aStates.top().aParagraphSprms, + RTFValue::Pointer_t pValue = getNestedAttribute(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PPrBase_ind, nId); if (pValue && pValue->getInt() == 0) - eraseNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, - nId); + eraseNestedAttribute(m_aStates.top().getParagraphSprms(), + NS_ooxml::LN_CT_PPrBase_ind, nId); } } - RTFValue::Pointer_t pParaProps - = new RTFValue(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms); + RTFValue::Pointer_t pParaProps = new RTFValue(m_aStates.top().getParagraphAttributes(), + m_aStates.top().getParagraphSprms()); RTFValue::Pointer_t pCharProps - = new RTFValue(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms); + = new RTFValue(m_aStates.top().getCharacterAttributes(), m_aStates.top().aCharacterSprms); // resetSprms will clean up this modification m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_pPr, pParaProps); @@ -2106,14 +2108,14 @@ void RTFDocumentImpl::resetSprms() { m_aStates.top().aTableSprms.clear(); m_aStates.top().aCharacterSprms.clear(); - m_aStates.top().aParagraphSprms.clear(); + m_aStates.top().getParagraphSprms().clear(); } void RTFDocumentImpl::resetAttributes() { m_aStates.top().aTableAttributes.clear(); - m_aStates.top().aCharacterAttributes.clear(); - m_aStates.top().aParagraphAttributes.clear(); + m_aStates.top().getCharacterAttributes().clear(); + m_aStates.top().getParagraphAttributes().clear(); } static bool lcl_containsProperty(const uno::Sequence<beans::Property>& rProperties, @@ -3257,9 +3259,9 @@ RTFError RTFDocumentImpl::popState() Mapper().table(NS_ooxml::LN_NUMBERING, pTable); // Use it - putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr, + putNestedSprm(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PPrBase_numPr, NS_ooxml::LN_CT_NumPr_ilvl, pIlvlValue); - putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr, + putNestedSprm(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PPrBase_numPr, NS_ooxml::LN_CT_NumPr_numId, pIdValue); } } @@ -3376,7 +3378,7 @@ RTFError RTFDocumentImpl::popState() { m_aStates.top().getShape() = aState.getShape(); m_aStates.top().getPicture() = aState.getPicture(); - m_aStates.top().aCharacterAttributes = aState.aCharacterAttributes; + m_aStates.top().getCharacterAttributes() = aState.getCharacterAttributes(); } break; case Destination::SHAPEINSTRUCTION: @@ -3387,7 +3389,7 @@ RTFError RTFDocumentImpl::popState() m_aStates.top().getShape() = aState.getShape(); m_aStates.top().getPicture() = aState.getPicture(); m_aStates.top().aCharacterSprms = aState.aCharacterSprms; - m_aStates.top().aCharacterAttributes = aState.aCharacterAttributes; + m_aStates.top().getCharacterAttributes() = aState.getCharacterAttributes(); } break; case Destination::FLYMAINCONTENT: diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 853665cdefb9..62c1a520b6da 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -509,6 +509,9 @@ public: RTFSprms& getTableRowSprms() { return m_aTableRowSprms; } RTFSprms& getSectionAttributes() { return m_aSectionAttributes; } RTFSprms& getSectionSprms() { return m_aSectionSprms; } + RTFSprms& getParagraphAttributes() { return m_aParagraphAttributes; } + RTFSprms& getParagraphSprms() { return m_aParagraphSprms; } + RTFSprms& getCharacterAttributes() { return m_aCharacterAttributes; } RTFDocumentImpl* m_pDocumentImpl; RTFInternalState nInternalState; @@ -520,12 +523,12 @@ public: RTFSprms aTableAttributes; // reset by plain RTFSprms aCharacterSprms; - RTFSprms aCharacterAttributes; - // reset by pard - RTFSprms aParagraphSprms; - RTFSprms aParagraphAttributes; private: + RTFSprms m_aCharacterAttributes; + // reset by pard + RTFSprms m_aParagraphSprms; + RTFSprms m_aParagraphAttributes; // reset by sectd RTFSprms m_aSectionSprms; RTFSprms m_aSectionAttributes; |