RTF_CELL should alter the cell definition list outside its current group

This commit is contained in:
Miklos Vajna 2011-06-22 13:12:28 +02:00
parent 61f9a54b21
commit 37da7aa99a
2 changed files with 14 additions and 1 deletions

View file

@ -677,6 +677,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
Mapper().props(pTableCellProperties); Mapper().props(pTableCellProperties);
m_aStates.top().aTableCellsAttributes.pop_front(); m_aStates.top().aTableCellsAttributes.pop_front();
m_aStates.top().aTableCellsSprms.pop_front(); m_aStates.top().aTableCellsSprms.pop_front();
m_aStates.top().nTableCellPops++;
} }
if (nKeyword == RTF_CELL) if (nKeyword == RTF_CELL)
@ -1660,6 +1661,7 @@ int RTFDocumentImpl::popState()
std::vector<std::pair<rtl::OUString, rtl::OUString>> aShapeProperties; std::vector<std::pair<rtl::OUString, rtl::OUString>> aShapeProperties;
bool bPopShapeProperties = false; bool bPopShapeProperties = false;
bool bPicPropEnd = false; bool bPicPropEnd = false;
int nTableCellPops = 0;
if (m_aStates.top().nDestinationState == DESTINATION_FONTTABLE) if (m_aStates.top().nDestinationState == DESTINATION_FONTTABLE)
{ {
@ -1773,6 +1775,7 @@ int RTFDocumentImpl::popState()
} }
if (m_aStates.top().nDestinationState == DESTINATION_NESTEDTABLEPROPERTIES) if (m_aStates.top().nDestinationState == DESTINATION_NESTEDTABLEPROPERTIES)
m_aBuffer.clear(); m_aBuffer.clear();
nTableCellPops = m_aStates.top().nTableCellPops;
m_aStates.pop(); m_aStates.pop();
@ -1811,6 +1814,13 @@ int RTFDocumentImpl::popState()
m_aStates.top().aShapeProperties = aShapeProperties; m_aStates.top().aShapeProperties = aShapeProperties;
else if (bPicPropEnd) else if (bPicPropEnd)
resolveShapeProperties(aShapeProperties); resolveShapeProperties(aShapeProperties);
for (int i = 0; i < nTableCellPops; ++i)
{
if (m_aStates.top().aTableCellsAttributes.size())
m_aStates.top().aTableCellsAttributes.pop_front();
if (m_aStates.top().aTableCellsSprms.size())
m_aStates.top().aTableCellsSprms.pop_front();
}
return 0; return 0;
} }
@ -1979,7 +1989,8 @@ RTFParserState::RTFParserState()
aShapeProperties(), aShapeProperties(),
nCellX(0), nCellX(0),
aTableCellsSprms(), aTableCellsSprms(),
aTableCellsAttributes() aTableCellsAttributes(),
nTableCellPops(0)
{ {
} }

View file

@ -151,6 +151,8 @@ namespace writerfilter {
int nCellX; int nCellX;
std::deque<RTFSprms::Pointer_t> aTableCellsSprms; std::deque<RTFSprms::Pointer_t> aTableCellsSprms;
std::deque<RTFSprms::Pointer_t> aTableCellsAttributes; std::deque<RTFSprms::Pointer_t> aTableCellsAttributes;
/// Number of cell definitions which should be popped after leaving the current group.
int nTableCellPops;
}; };
/// Implementation of the RTFDocument interface. /// Implementation of the RTFDocument interface.