Kaydet (Commit) e2aa8f8c authored tarafından Miklos Vajna's avatar Miklos Vajna

writerfilter: make RTFParserState members private, part 10

Change-Id: Id4445fc8fa1d81f052fd26ea85b661e44fd83be0
Reviewed-on: https://gerrit.libreoffice.org/72563
Tested-by: Jenkins
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.com>
üst 7fc54a81
...@@ -558,7 +558,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) ...@@ -558,7 +558,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
auto pValue = new RTFValue(aAttributes); auto pValue = new RTFValue(aAttributes);
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
m_aStates.top().getParagraphSprms().set(getParagraphBorder(i), pValue); m_aStates.top().getParagraphSprms().set(getParagraphBorder(i), pValue);
m_aStates.top().nBorderState = RTFBorderState::PARAGRAPH_BOX; m_aStates.top().setBorderState(RTFBorderState::PARAGRAPH_BOX);
} }
break; break;
case RTF_LTRSECT: case RTF_LTRSECT:
...@@ -598,7 +598,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) ...@@ -598,7 +598,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
break; break;
case RTF_NONSHPPICT: case RTF_NONSHPPICT:
case RTF_MMATHPICT: // Picture group used by readers not understanding \moMath group case RTF_MMATHPICT: // Picture group used by readers not understanding \moMath group
m_aStates.top().eDestination = Destination::SKIP; m_aStates.top().setDestination(Destination::SKIP);
break; break;
case RTF_CLBRDRT: case RTF_CLBRDRT:
case RTF_CLBRDRL: case RTF_CLBRDRL:
...@@ -627,7 +627,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) ...@@ -627,7 +627,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
} }
putNestedSprm(m_aStates.top().getTableCellSprms(), NS_ooxml::LN_CT_TcPrBase_tcBorders, putNestedSprm(m_aStates.top().getTableCellSprms(), NS_ooxml::LN_CT_TcPrBase_tcBorders,
nParam, pValue); nParam, pValue);
m_aStates.top().nBorderState = RTFBorderState::CELL; m_aStates.top().setBorderState(RTFBorderState::CELL);
} }
break; break;
case RTF_PGBRDRT: case RTF_PGBRDRT:
...@@ -657,7 +657,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) ...@@ -657,7 +657,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
} }
putNestedSprm(m_aStates.top().getSectionSprms(), putNestedSprm(m_aStates.top().getSectionSprms(),
NS_ooxml::LN_EG_SectPrContents_pgBorders, nParam, pValue); NS_ooxml::LN_EG_SectPrContents_pgBorders, nParam, pValue);
m_aStates.top().nBorderState = RTFBorderState::PAGE; m_aStates.top().setBorderState(RTFBorderState::PAGE);
} }
break; break;
case RTF_BRDRT: case RTF_BRDRT:
...@@ -687,7 +687,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) ...@@ -687,7 +687,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
} }
putNestedSprm(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PrBase_pBdr, nParam, putNestedSprm(m_aStates.top().getParagraphSprms(), NS_ooxml::LN_CT_PrBase_pBdr, nParam,
pValue); pValue);
m_aStates.top().nBorderState = RTFBorderState::PARAGRAPH; m_aStates.top().setBorderState(RTFBorderState::PARAGRAPH);
} }
break; break;
case RTF_CHBRDR: case RTF_CHBRDR:
...@@ -695,7 +695,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) ...@@ -695,7 +695,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
RTFSprms aAttributes; RTFSprms aAttributes;
auto pValue = new RTFValue(aAttributes); auto pValue = new RTFValue(aAttributes);
m_aStates.top().getCharacterSprms().set(NS_ooxml::LN_EG_RPrBase_bdr, pValue); m_aStates.top().getCharacterSprms().set(NS_ooxml::LN_EG_RPrBase_bdr, pValue);
m_aStates.top().nBorderState = RTFBorderState::CHARACTER; m_aStates.top().setBorderState(RTFBorderState::CHARACTER);
} }
break; break;
case RTF_CLMGF: case RTF_CLMGF:
......
...@@ -98,7 +98,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) ...@@ -98,7 +98,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
break; break;
case RTF_PAR: case RTF_PAR:
{ {
if (m_aStates.top().eDestination == Destination::FOOTNOTESEPARATOR) if (m_aStates.top().getDestination() == Destination::FOOTNOTESEPARATOR)
break; // just ignore it - only thing we read in here is CHFTNSEP break; // just ignore it - only thing we read in here is CHFTNSEP
checkFirstRun(); checkFirstRun();
bool bNeedPap = m_bNeedPap; bool bNeedPap = m_bNeedPap;
...@@ -121,7 +121,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) ...@@ -121,7 +121,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
} }
m_nCellxMax = 0; m_nCellxMax = 0;
} }
else if (m_aStates.top().eDestination != Destination::SHAPETEXT) else if (m_aStates.top().getDestination() != Destination::SHAPETEXT)
{ {
RTFValue::Pointer_t pValue; RTFValue::Pointer_t pValue;
m_aStates.top().getCurrentBuffer()->push_back(Buf_t(BUFFER_PAR, pValue, nullptr)); m_aStates.top().getCurrentBuffer()->push_back(Buf_t(BUFFER_PAR, pValue, nullptr));
......
...@@ -350,13 +350,13 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -350,13 +350,13 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
assert(m_aStates.top().getRunType() == RTFParserState::RunType::LOCH); assert(m_aStates.top().getRunType() == RTFParserState::RunType::LOCH);
nSprm = NS_ooxml::LN_CT_Fonts_ascii; nSprm = NS_ooxml::LN_CT_Fonts_ascii;
} }
if (m_aStates.top().eDestination == Destination::FONTTABLE if (m_aStates.top().getDestination() == Destination::FONTTABLE
|| m_aStates.top().eDestination == Destination::FONTENTRY) || m_aStates.top().getDestination() == Destination::FONTENTRY)
{ {
m_aFontIndexes.push_back(nParam); m_aFontIndexes.push_back(nParam);
m_nCurrentFontIndex = getFontIndex(nParam); m_nCurrentFontIndex = getFontIndex(nParam);
} }
else if (m_aStates.top().eDestination == Destination::LISTLEVEL) else if (m_aStates.top().getDestination() == Destination::LISTLEVEL)
{ {
RTFSprms aFontAttributes; RTFSprms aFontAttributes;
aFontAttributes.set(nSprm, new RTFValue(m_aFontNames[getFontIndex(nParam)])); aFontAttributes.set(nSprm, new RTFValue(m_aFontNames[getFontIndex(nParam)]));
...@@ -433,8 +433,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -433,8 +433,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
{ {
m_aStates.top().setCurrentStyleIndex(nParam); m_aStates.top().setCurrentStyleIndex(nParam);
if (m_aStates.top().eDestination == Destination::STYLESHEET if (m_aStates.top().getDestination() == Destination::STYLESHEET
|| m_aStates.top().eDestination == Destination::STYLEENTRY) || m_aStates.top().getDestination() == Destination::STYLEENTRY)
{ {
m_nCurrentStyleIndex = nParam; m_nCurrentStyleIndex = nParam;
auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_StyleType_paragraph); auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_StyleType_paragraph);
...@@ -446,7 +446,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -446,7 +446,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
OUString aName = getStyleName(nParam); OUString aName = getStyleName(nParam);
if (!aName.isEmpty()) if (!aName.isEmpty())
{ {
if (m_aStates.top().eDestination == Destination::LISTLEVEL) if (m_aStates.top().getDestination() == Destination::LISTLEVEL)
m_aStates.top().getTableSprms().set(NS_ooxml::LN_CT_Lvl_pStyle, m_aStates.top().getTableSprms().set(NS_ooxml::LN_CT_Lvl_pStyle,
new RTFValue(aName)); new RTFValue(aName));
else else
...@@ -458,8 +458,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -458,8 +458,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
break; break;
case RTF_CS: case RTF_CS:
m_aStates.top().setCurrentCharacterStyleIndex(nParam); m_aStates.top().setCurrentCharacterStyleIndex(nParam);
if (m_aStates.top().eDestination == Destination::STYLESHEET if (m_aStates.top().getDestination() == Destination::STYLESHEET
|| m_aStates.top().eDestination == Destination::STYLEENTRY) || m_aStates.top().getDestination() == Destination::STYLEENTRY)
{ {
m_nCurrentStyleIndex = nParam; m_nCurrentStyleIndex = nParam;
auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_StyleType_character); auto pValue = new RTFValue(NS_ooxml::LN_Value_ST_StyleType_character);
...@@ -475,8 +475,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -475,8 +475,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
} }
break; break;
case RTF_DS: case RTF_DS:
if (m_aStates.top().eDestination == Destination::STYLESHEET if (m_aStates.top().getDestination() == Destination::STYLESHEET
|| m_aStates.top().eDestination == Destination::STYLEENTRY) || m_aStates.top().getDestination() == Destination::STYLEENTRY)
{ {
m_nCurrentStyleIndex = nParam; m_nCurrentStyleIndex = nParam;
auto pValue = new RTFValue(0); // TODO no value in enum StyleType? auto pValue = new RTFValue(0); // TODO no value in enum StyleType?
...@@ -485,8 +485,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -485,8 +485,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
} }
break; break;
case RTF_TS: case RTF_TS:
if (m_aStates.top().eDestination == Destination::STYLESHEET if (m_aStates.top().getDestination() == Destination::STYLESHEET
|| m_aStates.top().eDestination == Destination::STYLEENTRY) || m_aStates.top().getDestination() == Destination::STYLEENTRY)
{ {
m_nCurrentStyleIndex = nParam; m_nCurrentStyleIndex = nParam;
// FIXME the correct value would be NS_ooxml::LN_Value_ST_StyleType_table but maybe table styles mess things up in dmapper, be cautious and disable them for now // FIXME the correct value would be NS_ooxml::LN_Value_ST_StyleType_table but maybe table styles mess things up in dmapper, be cautious and disable them for now
...@@ -646,7 +646,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -646,7 +646,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
{ {
m_aStates.top().getTabAttributes().set(NS_ooxml::LN_CT_TabStop_pos, pIntValue); m_aStates.top().getTabAttributes().set(NS_ooxml::LN_CT_TabStop_pos, pIntValue);
auto pValue = new RTFValue(m_aStates.top().getTabAttributes()); auto pValue = new RTFValue(m_aStates.top().getTabAttributes());
if (m_aStates.top().eDestination == Destination::LISTLEVEL) if (m_aStates.top().getDestination() == Destination::LISTLEVEL)
putNestedSprm(m_aStates.top().getTableSprms(), NS_ooxml::LN_CT_PPrBase_tabs, putNestedSprm(m_aStates.top().getTableSprms(), NS_ooxml::LN_CT_PPrBase_tabs,
NS_ooxml::LN_CT_Tabs_tab, pValue); NS_ooxml::LN_CT_Tabs_tab, pValue);
else else
...@@ -664,17 +664,17 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -664,17 +664,17 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
break; break;
case RTF_LISTID: case RTF_LISTID:
{ {
if (m_aStates.top().eDestination == Destination::LISTENTRY) if (m_aStates.top().getDestination() == Destination::LISTENTRY)
m_aStates.top().getTableAttributes().set(NS_ooxml::LN_CT_AbstractNum_abstractNumId, m_aStates.top().getTableAttributes().set(NS_ooxml::LN_CT_AbstractNum_abstractNumId,
pIntValue); pIntValue);
else if (m_aStates.top().eDestination == Destination::LISTOVERRIDEENTRY) else if (m_aStates.top().getDestination() == Destination::LISTOVERRIDEENTRY)
m_aStates.top().getTableSprms().set(NS_ooxml::LN_CT_Num_abstractNumId, pIntValue); m_aStates.top().getTableSprms().set(NS_ooxml::LN_CT_Num_abstractNumId, pIntValue);
m_aStates.top().setCurrentListIndex(nParam); m_aStates.top().setCurrentListIndex(nParam);
} }
break; break;
case RTF_LS: case RTF_LS:
{ {
if (m_aStates.top().eDestination == Destination::LISTOVERRIDEENTRY) if (m_aStates.top().getDestination() == Destination::LISTOVERRIDEENTRY)
{ {
m_aStates.top().getTableAttributes().set(NS_ooxml::LN_CT_AbstractNum_nsid, m_aStates.top().getTableAttributes().set(NS_ooxml::LN_CT_AbstractNum_nsid,
pIntValue); pIntValue);
...@@ -701,7 +701,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -701,7 +701,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
// static_cast() will do the right thing. // static_cast() will do the right thing.
if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_UINT16)) if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_UINT16))
{ {
if (m_aStates.top().eDestination == Destination::LEVELNUMBERS) if (m_aStates.top().getDestination() == Destination::LEVELNUMBERS)
{ {
if (nParam != ';') if (nParam != ';')
m_aStates.top().getLevelNumbers().push_back(sal_Int32(nParam)); m_aStates.top().getLevelNumbers().push_back(sal_Int32(nParam));
...@@ -848,9 +848,10 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -848,9 +848,10 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
break; break;
case RTF_CELLX: case RTF_CELLX:
{ {
int& rCurrentCellX((Destination::NESTEDTABLEPROPERTIES == m_aStates.top().eDestination) int& rCurrentCellX(
? m_nNestedCurrentCellX (Destination::NESTEDTABLEPROPERTIES == m_aStates.top().getDestination())
: m_nTopLevelCurrentCellX); ? m_nNestedCurrentCellX
: m_nTopLevelCurrentCellX);
int nCellX = nParam - rCurrentCellX; int nCellX = nParam - rCurrentCellX;
const int COL_DFLT_WIDTH const int COL_DFLT_WIDTH
= 41; // sw/source/filter/inc/wrtswtbl.hxx, minimal possible width of cells. = 41; // sw/source/filter/inc/wrtswtbl.hxx, minimal possible width of cells.
...@@ -872,7 +873,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -872,7 +873,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
auto pXValue = new RTFValue(nCellX); auto pXValue = new RTFValue(nCellX);
m_aStates.top().getTableRowSprms().set(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue, m_aStates.top().getTableRowSprms().set(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue,
RTFOverwrite::NO_APPEND); RTFOverwrite::NO_APPEND);
if (Destination::NESTEDTABLEPROPERTIES == m_aStates.top().eDestination) if (Destination::NESTEDTABLEPROPERTIES == m_aStates.top().getDestination())
{ {
m_nNestedCells++; m_nNestedCells++;
// Push cell properties. // Push cell properties.
...@@ -935,7 +936,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -935,7 +936,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
new RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa)); new RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa));
putNestedAttribute(m_aStates.top().getTableRowSprms(), NS_ooxml::LN_CT_TblPrBase_tblInd, putNestedAttribute(m_aStates.top().getTableRowSprms(), NS_ooxml::LN_CT_TblPrBase_tblInd,
NS_ooxml::LN_CT_TblWidth_w, new RTFValue(nParam)); NS_ooxml::LN_CT_TblWidth_w, new RTFValue(nParam));
auto const aDestination = m_aStates.top().eDestination; auto const aDestination = m_aStates.top().getDestination();
int& rCurrentTRLeft((Destination::NESTEDTABLEPROPERTIES == aDestination) int& rCurrentTRLeft((Destination::NESTEDTABLEPROPERTIES == aDestination)
? m_nNestedTRLeft ? m_nNestedTRLeft
: m_nTopLevelTRLeft); : m_nTopLevelTRLeft);
...@@ -1507,7 +1508,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -1507,7 +1508,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
break; break;
case RTF_FI: case RTF_FI:
{ {
if (m_aStates.top().eDestination == Destination::LISTLEVEL) if (m_aStates.top().getDestination() == Destination::LISTLEVEL)
{ {
if (m_aStates.top().getLevelNumbersValid()) if (m_aStates.top().getLevelNumbersValid())
putNestedAttribute(m_aStates.top().getTableSprms(), NS_ooxml::LN_CT_PPrBase_ind, putNestedAttribute(m_aStates.top().getTableSprms(), NS_ooxml::LN_CT_PPrBase_ind,
...@@ -1522,7 +1523,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -1522,7 +1523,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
} }
case RTF_LI: case RTF_LI:
{ {
if (m_aStates.top().eDestination == Destination::LISTLEVEL) if (m_aStates.top().getDestination() == Destination::LISTLEVEL)
{ {
if (m_aStates.top().getLevelNumbersValid()) if (m_aStates.top().getLevelNumbersValid())
putNestedAttribute(m_aStates.top().getTableSprms(), NS_ooxml::LN_CT_PPrBase_ind, putNestedAttribute(m_aStates.top().getTableSprms(), NS_ooxml::LN_CT_PPrBase_ind,
......
...@@ -515,14 +515,20 @@ public: ...@@ -515,14 +515,20 @@ public:
RTFSprms& getCharacterSprms() { return m_aCharacterSprms; } RTFSprms& getCharacterSprms() { return m_aCharacterSprms; }
RTFSprms& getTableAttributes() { return m_aTableAttributes; } RTFSprms& getTableAttributes() { return m_aTableAttributes; }
RTFSprms& getTableSprms() { return m_aTableSprms; } RTFSprms& getTableSprms() { return m_aTableSprms; }
void setBorderState(RTFBorderState nBorderState) { m_nBorderState = nBorderState; }
RTFBorderState getBorderState() const { return m_nBorderState; }
void setFieldStatus(RTFFieldStatus eFieldStatus) { m_eFieldStatus = eFieldStatus; }
RTFFieldStatus getFieldStatus() const { return m_eFieldStatus; }
void setDestination(Destination eDestination) { m_eDestination = eDestination; }
Destination getDestination() const { return m_eDestination; }
RTFDocumentImpl* m_pDocumentImpl; RTFDocumentImpl* m_pDocumentImpl;
RTFInternalState nInternalState; RTFInternalState nInternalState;
Destination eDestination;
RTFFieldStatus eFieldStatus;
RTFBorderState nBorderState;
private: private:
Destination m_eDestination;
RTFFieldStatus m_eFieldStatus;
RTFBorderState m_nBorderState;
// font table, stylesheet table // font table, stylesheet table
RTFSprms m_aTableSprms; RTFSprms m_aTableSprms;
RTFSprms m_aTableAttributes; RTFSprms m_aTableAttributes;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment