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

implement import of RTF_{MD,MDPR,MBEGCHR,MENDCHR}

Change-Id: Ie671977d523e1fb7142f62ca2d8d47e65082d3fd
üst 43e4ae79
...@@ -952,6 +952,8 @@ void RTFDocumentImpl::text(OUString& rString) ...@@ -952,6 +952,8 @@ void RTFDocumentImpl::text(OUString& rString)
case DESTINATION_ATNID: case DESTINATION_ATNID:
case DESTINATION_MR: case DESTINATION_MR:
case DESTINATION_MCHR: case DESTINATION_MCHR:
case DESTINATION_MBEGCHR:
case DESTINATION_MENDCHR:
m_aStates.top().aDestinationText.append(rString); m_aStates.top().aDestinationText.append(rString);
break; break;
case DESTINATION_EQINSTRUCTION: case DESTINATION_EQINSTRUCTION:
...@@ -1449,10 +1451,24 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) ...@@ -1449,10 +1451,24 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
case RTF_MCHR: case RTF_MCHR:
m_aStates.top().nDestinationState = DESTINATION_MCHR; m_aStates.top().nDestinationState = DESTINATION_MCHR;
break; break;
case RTF_MBEGCHR:
m_aStates.top().nDestinationState = DESTINATION_MBEGCHR;
break;
case RTF_MENDCHR:
m_aStates.top().nDestinationState = DESTINATION_MENDCHR;
break;
case RTF_ME: case RTF_ME:
m_aMathBuffer.appendOpeningTag(M_TOKEN(e)); m_aMathBuffer.appendOpeningTag(M_TOKEN(e));
m_aStates.top().nDestinationState = DESTINATION_ME; m_aStates.top().nDestinationState = DESTINATION_ME;
break; break;
case RTF_MD:
m_aMathBuffer.appendOpeningTag(M_TOKEN(d));
m_aStates.top().nDestinationState = DESTINATION_MD;
break;
case RTF_MDPR:
m_aMathBuffer.appendOpeningTag(M_TOKEN(dPr));
m_aStates.top().nDestinationState = DESTINATION_MDPR;
break;
default: default:
SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle destination '" << lcl_RtfToString(nKeyword) << "'"); SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle destination '" << lcl_RtfToString(nKeyword) << "'");
// Make sure we skip destinations (even without \*) till we don't handle them // Make sure we skip destinations (even without \*) till we don't handle them
...@@ -3550,12 +3566,22 @@ int RTFDocumentImpl::popState() ...@@ -3550,12 +3566,22 @@ int RTFDocumentImpl::popState()
m_aMathBuffer.appendClosingTag(M_TOKEN(acc)); m_aMathBuffer.appendClosingTag(M_TOKEN(acc));
else if (m_aStates.top().nDestinationState == DESTINATION_MACCPR) else if (m_aStates.top().nDestinationState == DESTINATION_MACCPR)
m_aMathBuffer.appendClosingTag(M_TOKEN(accPr)); m_aMathBuffer.appendClosingTag(M_TOKEN(accPr));
else if (m_aStates.top().nDestinationState == DESTINATION_MCHR) else if (m_aStates.top().nDestinationState == DESTINATION_MCHR ||
m_aStates.top().nDestinationState == DESTINATION_MBEGCHR ||
m_aStates.top().nDestinationState == DESTINATION_MENDCHR)
{ {
oox::formulaimport::XmlStream::AttributeList aAttribs; oox::formulaimport::XmlStream::AttributeList aAttribs;
aAttribs[M_TOKEN(val)] = m_aStates.top().aDestinationText.makeStringAndClear(); aAttribs[M_TOKEN(val)] = m_aStates.top().aDestinationText.makeStringAndClear();
m_aMathBuffer.appendOpeningTag(M_TOKEN(chr), aAttribs); sal_Int32 nToken = 0;
m_aMathBuffer.appendClosingTag(M_TOKEN(chr)); switch (m_aStates.top().nDestinationState)
{
case DESTINATION_MCHR: nToken = M_TOKEN(chr); break;
case DESTINATION_MBEGCHR: nToken = M_TOKEN(begChr); break;
case DESTINATION_MENDCHR: nToken = M_TOKEN(endChr); break;
default: break;
}
m_aMathBuffer.appendOpeningTag(nToken, aAttribs);
m_aMathBuffer.appendClosingTag(nToken);
} }
else if (m_aStates.top().nDestinationState == DESTINATION_ME) else if (m_aStates.top().nDestinationState == DESTINATION_ME)
m_aMathBuffer.appendClosingTag(M_TOKEN(e)); m_aMathBuffer.appendClosingTag(M_TOKEN(e));
...@@ -3563,6 +3589,10 @@ int RTFDocumentImpl::popState() ...@@ -3563,6 +3589,10 @@ int RTFDocumentImpl::popState()
m_aMathBuffer.appendClosingTag(M_TOKEN(bar)); m_aMathBuffer.appendClosingTag(M_TOKEN(bar));
else if (m_aStates.top().nDestinationState == DESTINATION_MBARPR) else if (m_aStates.top().nDestinationState == DESTINATION_MBARPR)
m_aMathBuffer.appendClosingTag(M_TOKEN(barPr)); m_aMathBuffer.appendClosingTag(M_TOKEN(barPr));
else if (m_aStates.top().nDestinationState == DESTINATION_MD)
m_aMathBuffer.appendClosingTag(M_TOKEN(d));
else if (m_aStates.top().nDestinationState == DESTINATION_MDPR)
m_aMathBuffer.appendClosingTag(M_TOKEN(dPr));
// See if we need to end a track change // See if we need to end a track change
RTFValue::Pointer_t pTrackchange = m_aStates.top().aCharacterSprms.find(NS_ooxml::LN_trackchange); RTFValue::Pointer_t pTrackchange = m_aStates.top().aCharacterSprms.find(NS_ooxml::LN_trackchange);
......
...@@ -132,7 +132,11 @@ namespace writerfilter { ...@@ -132,7 +132,11 @@ namespace writerfilter {
DESTINATION_MCHR, DESTINATION_MCHR,
DESTINATION_ME, DESTINATION_ME,
DESTINATION_MBAR, DESTINATION_MBAR,
DESTINATION_MBARPR DESTINATION_MBARPR,
DESTINATION_MD,
DESTINATION_MDPR,
DESTINATION_MBEGCHR,
DESTINATION_MENDCHR
}; };
enum RTFBorderState enum RTFBorderState
......
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