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

fdo#61507 import RTF_UPR and RTF_UD

It turns out Word wraps document title with these destinations if they
contain something that isn't possible to describe using legacy charsets.

Change-Id: Ic9417d0f23d44149acb3ae3dc9d4c281058a1b36
üst 627f220b
...@@ -1517,7 +1517,11 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) ...@@ -1517,7 +1517,11 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
m_aStates.top().nDestinationState = DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE; m_aStates.top().nDestinationState = DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE;
break; break;
case RTF_TITLE: case RTF_TITLE:
m_aStates.top().nDestinationState = DESTINATION_TITLE; // \title inside \upr but outside \ud should be ignored.
if (m_aStates.top().nDestinationState != DESTINATION_UPR)
m_aStates.top().nDestinationState = DESTINATION_TITLE;
else
m_aStates.top().nDestinationState = DESTINATION_SKIP;
break; break;
case RTF_SUBJECT: case RTF_SUBJECT:
m_aStates.top().nDestinationState = DESTINATION_SUBJECT; m_aStates.top().nDestinationState = DESTINATION_SUBJECT;
...@@ -1615,6 +1619,13 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) ...@@ -1615,6 +1619,13 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
OPEN_M_TOKEN(SPREPR, sPrePr); OPEN_M_TOKEN(SPREPR, sPrePr);
OPEN_M_TOKEN(BOX, box); OPEN_M_TOKEN(BOX, box);
OPEN_M_TOKEN(EQARR, eqArr); OPEN_M_TOKEN(EQARR, eqArr);
case RTF_UPR:
m_aStates.top().nDestinationState = DESTINATION_UPR;
break;
case RTF_UD:
// Anything inside \ud is just normal Unicode content.
m_aStates.top().nDestinationState = DESTINATION_NORMAL;
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
...@@ -3808,10 +3819,6 @@ int RTFDocumentImpl::popState() ...@@ -3808,10 +3819,6 @@ int RTFDocumentImpl::popState()
if (m_xDocumentProperties.is()) if (m_xDocumentProperties.is())
m_xDocumentProperties->setGenerator(m_aStates.top().aDestinationText.makeStringAndClear()); m_xDocumentProperties->setGenerator(m_aStates.top().aDestinationText.makeStringAndClear());
break; break;
case DESTINATION_TITLE:
if (m_xDocumentProperties.is())
m_xDocumentProperties->setTitle(m_aStates.top().aDestinationText.makeStringAndClear());
break;
case DESTINATION_SUBJECT: case DESTINATION_SUBJECT:
if (m_xDocumentProperties.is()) if (m_xDocumentProperties.is())
m_xDocumentProperties->setSubject(m_aStates.top().aDestinationText.makeStringAndClear()); m_xDocumentProperties->setSubject(m_aStates.top().aDestinationText.makeStringAndClear());
...@@ -4234,6 +4241,14 @@ int RTFDocumentImpl::popState() ...@@ -4234,6 +4241,14 @@ int RTFDocumentImpl::popState()
aState.nDestinationState == DESTINATION_SHPPICT || aState.nDestinationState == DESTINATION_SHPPICT ||
aState.nDestinationState == DESTINATION_SHAPE) aState.nDestinationState == DESTINATION_SHAPE)
m_aStates.top().aFrame = aState.aFrame; m_aStates.top().aFrame = aState.aFrame;
else if (aState.nDestinationState == DESTINATION_TITLE)
{
if (m_aStates.top().nDestinationState == DESTINATION_TITLE)
// The parent is a title as well, just append what we have so far.
m_aStates.top().aDestinationText.append(aState.aDestinationText.makeStringAndClear());
else if (m_xDocumentProperties.is())
m_xDocumentProperties->setTitle(aState.aDestinationText.makeStringAndClear());
}
if (m_pCurrentBuffer == &m_aSuperBuffer) if (m_pCurrentBuffer == &m_aSuperBuffer)
{ {
if (!m_bHasFootnote) if (!m_bHasFootnote)
......
...@@ -178,6 +178,7 @@ namespace writerfilter { ...@@ -178,6 +178,7 @@ namespace writerfilter {
DESTINATION_MGROW, DESTINATION_MGROW,
DESTINATION_MBOX, DESTINATION_MBOX,
DESTINATION_MEQARR, DESTINATION_MEQARR,
DESTINATION_UPR,
}; };
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