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

RTF import: support shapes inside tables

This is a better fix for fdo#47802, now that shape import is no longer
buffered.

Change-Id: Idce6d11e6774d1fe7fc04b6a52d5b77a3879381e
üst 7a8f720c
...@@ -1197,6 +1197,10 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer) ...@@ -1197,6 +1197,10 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer)
Mapper().endCharacterGroup(); Mapper().endCharacterGroup();
else if (aPair.first == BUFFER_PAR) else if (aPair.first == BUFFER_PAR)
parBreak(); parBreak();
else if (aPair.first == BUFFER_STARTSHAPE)
m_pSdrImport->resolve(aPair.second->getShape(), false);
else if (aPair.first == BUFFER_ENDSHAPE)
m_pSdrImport->close();
else else
SAL_WARN("writerfilter", "should not happen"); SAL_WARN("writerfilter", "should not happen");
} }
...@@ -1313,11 +1317,7 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) ...@@ -1313,11 +1317,7 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
m_aStates.top().nDestinationState = DESTINATION_SHAPE; m_aStates.top().nDestinationState = DESTINATION_SHAPE;
break; break;
case RTF_SHPINST: case RTF_SHPINST:
// Don't try to support shapes inside tables for now. m_aStates.top().nDestinationState = DESTINATION_SHAPEINSTRUCTION;
if (m_aStates.top().pCurrentBuffer != &m_aTableBuffer)
m_aStates.top().nDestinationState = DESTINATION_SHAPEINSTRUCTION;
else
m_aStates.top().nDestinationState = DESTINATION_SKIP;
break; break;
case RTF_NESTTABLEPROPS: case RTF_NESTTABLEPROPS:
// Don't try to support nested tables having table styles for now. // Don't try to support nested tables having table styles for now.
...@@ -1445,7 +1445,15 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) ...@@ -1445,7 +1445,15 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
dispatchFlag(RTF_PARD); dispatchFlag(RTF_PARD);
m_bNeedPap = true; m_bNeedPap = true;
if (nKeyword == RTF_SHPTXT) if (nKeyword == RTF_SHPTXT)
m_pSdrImport->resolve(m_aStates.top().aShape, false); {
if (!m_aStates.top().pCurrentBuffer)
m_pSdrImport->resolve(m_aStates.top().aShape, false);
else
{
RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aShape));
m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_STARTSHAPE, pValue));
}
}
break; break;
case RTF_FORMFIELD: case RTF_FORMFIELD:
if (m_aStates.top().nDestinationState == DESTINATION_FIELDINSTRUCTION) if (m_aStates.top().nDestinationState == DESTINATION_FIELDINSTRUCTION)
...@@ -4602,7 +4610,10 @@ int RTFDocumentImpl::popState() ...@@ -4602,7 +4610,10 @@ int RTFDocumentImpl::popState()
if (m_aStates.top().nDestinationState != DESTINATION_SHAPETEXT && !m_aStates.top().aDrawingObject.bHadShapeText) if (m_aStates.top().nDestinationState != DESTINATION_SHAPETEXT && !m_aStates.top().aDrawingObject.bHadShapeText)
{ {
m_aStates.top().bHadShapeText = true; m_aStates.top().bHadShapeText = true;
m_pSdrImport->close(); if (!m_aStates.top().pCurrentBuffer)
m_pSdrImport->close();
else
m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_ENDSHAPE, RTFValue::Pointer_t()));
} }
break; break;
default: default:
......
...@@ -195,7 +195,9 @@ namespace writerfilter { ...@@ -195,7 +195,9 @@ namespace writerfilter {
BUFFER_TEXT, BUFFER_TEXT,
BUFFER_UTEXT, BUFFER_UTEXT,
BUFFER_ENDRUN, BUFFER_ENDRUN,
BUFFER_PAR BUFFER_PAR,
BUFFER_STARTSHAPE,
BUFFER_ENDSHAPE
}; };
/// Form field types /// Form field types
......
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